hubermedia documentation 2015 html
Sample 1

http://meta.et4.de/rest.ashx/script/ectypeahead,toureditor 

response
Copy Code
/*! handlebars v2.0.0 Copyright (C) 2011-2014 by Yehuda Katz Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. @license */ (function(n,t){typeof define=="function"&&define.amd?define([],t):typeof exports=="object"?module.exports=t():n.Handlebars=n.Handlebars||t()})(this,function(){var r=function(){"use strict";function n(n){this.string=n}return n.prototype.toString=function(){return""+this.string},n}(),t=function(n){"use strict";function h(n){return e[n]}function c(n){for(var i,t=1;t<arguments.length;t++)for(i in arguments[t])Object.prototype.hasOwnProperty.call(arguments[t],i)&&(n[i]=arguments[t][i]);return n}function l(n){return n instanceof f?n.toString():n==null?"":n?(n=""+n,!s.test(n))?n:n.replace(o,h):n+""}function a(n){return n||n===0?u(n)&&n.length===0?!0:!1:!0}function v(n,t){return(n?n+".":"")+t}var t={},f=n,e={"&":"&","<":"<",">":">",'"':""","'":"'","`":"`"},o=/[&<>"'`]/g,s=/[&<>"'`]/,i,r,u;return t.extend=c,i=Object.prototype.toString,t.toString=i,r=function(n){return typeof n=="function"},r(/x/)&&(r=function(n){return typeof n=="function"&&i.call(n)==="[object Function]"}),t.isFunction=r,u=Array.isArray||function(n){return n&&typeof n=="object"?i.call(n)==="[object Array]":!1},t.isArray=u,t.escapeExpression=l,t.isEmpty=a,t.appendContextPath=v,t}(r),n=function(){"use strict";function t(t,i){var u,f,r;for(i&&i.firstLine&&(u=i.firstLine,t+=" - "+u+":"+i.firstColumn),f=Error.prototype.constructor.call(this,t),r=0;r<n.length;r++)this[n[r]]=f[n[r]];u&&(this.lineNumber=u,this.column=i.firstColumn)}var n=["description","fileName","lineNumber","message","name","number","stack"];return t.prototype=new Error,t}(),i=function(n,t){"use strict";function s(n,t){this.helpers=n||{};this.partials=t||{};p(this)}function p(n){n.registerHelper("helperMissing",function(){if(arguments.length===1)return undefined;throw new e("Missing helper: '"+arguments[arguments.length-1].name+"'");});n.registerHelper("blockHelperMissing",function(t,r){var e=r.inverse,o=r.fn,u;return t===!0?o(this):t===!1||t==null?e(this):a(t)?t.length>0?(r.ids&&(r.ids=[r.name]),n.helpers.each(t,r)):e(this):(r.data&&r.ids&&(u=f(r.data),u.contextPath=i.appendContextPath(r.data.contextPath,r.name),r={data:u}),o(t,r))});n.registerHelper("each",function(n,t){var v,c;if(!t)throw new e("Must pass iterator to #each");var l=t.fn,y=t.inverse,u=0,s="",r,h;if(t.data&&t.ids&&(h=i.appendContextPath(t.data.contextPath,t.ids[0])+"."),o(n)&&(n=n.call(this)),t.data&&(r=f(t.data)),n&&typeof n=="object")if(a(n))for(v=n.length;u<v;u++)r&&(r.index=u,r.first=u===0,r.last=u===n.length-1,h&&(r.contextPath=h+u)),s=s+l(n[u],{data:r});else for(c in n)n.hasOwnProperty(c)&&(r&&(r.key=c,r.index=u,r.first=u===0,h&&(r.contextPath=h+c)),s=s+l(n[c],{data:r}),u++);return u===0&&(s=y(this)),s});n.registerHelper("if",function(n,t){return o(n)&&(n=n.call(this)),(t.hash.includeZero||n)&&!i.isEmpty(n)?t.fn(this):t.inverse(this)});n.registerHelper("unless",function(t,i){return n.helpers["if"].call(this,t,{fn:i.inverse,inverse:i.fn,hash:i.hash})});n.registerHelper("with",function(n,t){var u,r;return o(n)&&(n=n.call(this)),u=t.fn,i.isEmpty(n)?t.inverse(this):(t.data&&t.ids&&(r=f(t.data),r.contextPath=i.appendContextPath(t.data.contextPath,t.ids[0]),t={data:r}),u(n,t))});n.registerHelper("log",function(t,i){var r=i.data&&i.data.level!=null?parseInt(i.data.level,10):1;n.log(r,t)});n.registerHelper("lookup",function(n,t){return n&&n[t]})}var r={},i=n,e=t,c,l,u,h,f;r.VERSION="2.0.0";c=6;r.COMPILER_REVISION=c;l={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"};r.REVISION_CHANGES=l;var a=i.isArray,o=i.isFunction,v=i.toString,y="[object Object]";return r.HandlebarsEnvironment=s,s.prototype={constructor:s,logger:u,log:h,registerHelper:function(n,t){if(v.call(n)===y){if(t)throw new e("Arg not supported with multiple helpers");i.extend(this.helpers,n)}else this.helpers[n]=t},unregisterHelper:function(n){delete this.helpers[n]},registerPartial:function(n,t){v.call(n)===y?i.extend(this.partials,n):this.partials[n]=t},unregisterPartial:function(n){delete this.partials[n]}},u={methodMap:{0:"debug",1:"info",2:"warn",3:"error"},DEBUG:0,INFO:1,WARN:2,ERROR:3,level:3,log:function(n,t){if(u.level<=n){var i=u.methodMap[n];typeof console!="undefined"&&console[i]&&console[i].call(console,t)}}},r.logger=u,h=u.log,r.log=h,f=function(n){var t=i.extend({},n);return t._parent=n,t},r.createFrame=f,r}(t,n),f=function(n,t,i){"use strict";function c(n){var t=n&&n[0]||1,i=s,u,f;if(t!==i)if(t<i){u=o[i];f=o[t];throw new r("Template was precompiled with an older version of Handlebars than the current runtime. Please update your precompiler to a newer version ("+u+") or downgrade your runtime to an older version ("+f+").");}else throw new r("Template was precompiled with a newer version of Handlebars than the current runtime. Please update your runtime to a newer version ("+n[1]+").");}function l(n,t){if(!t)throw new r("No environment passed to template");if(!n||!n.main)throw new r("Unknown template object: "+typeof n);t.VM.checkRevision(n.compiler);var o=function(i,u,f,o,s,h,c,l,a){var v,b,p,y,w;if(s&&(o=e.extend({},o,s)),v=t.VM.invokePartial.call(this,i,f,o,h,c,l,a),v==null&&t.compile&&(b={helpers:h,partials:c,data:l,depths:a},c[f]=t.compile(i,{data:l!==undefined,compat:n.compat},t),v=c[f](o,b)),v!=null){if(u){for(p=v.split("\n"),y=0,w=p.length;y<w;y++){if(!p[y]&&y+1===w)break;p[y]=u+p[y]}v=p.join("\n")}return v}throw new r("The partial "+f+" could not be compiled when running in runtime-only mode");},i={lookup:function(n,t){for(var r=n.length,i=0;i<r;i++)if(n[i]&&n[i][t]!=null)return n[i][t]},lambda:function(n,t){return typeof n=="function"?n.call(t):n},escapeExpression:e.escapeExpression,invokePartial:o,fn:function(t){return n[t]},programs:[],program:function(n,t,i){var r=this.programs[n],u=this.fn(n);return t||i?r=f(this,n,u,t,i):r||(r=this.programs[n]=f(this,n,u)),r},data:function(n,t){while(n&&t--)n=n._parent;return n},merge:function(n,t){var i=n||t;return n&&t&&n!==t&&(i=e.extend({},t,n)),i},noop:t.VM.noop,compilerInfo:n.compiler},u=function(t,r){var f,e;return r=r||{},f=r.data,u._setup(r),!r.partial&&n.useData&&(f=y(t,f)),n.useDepths&&(e=r.depths?[t].concat(r.depths):[t]),n.main.call(i,t,i.helpers,i.partials,f,e)};return u.isTop=!0,u._setup=function(r){r.partial?(i.helpers=r.helpers,i.partials=r.partials):(i.helpers=i.merge(r.helpers,t.helpers),n.usePartial&&(i.partials=i.merge(r.partials,t.partials)))},u._child=function(t,u,e){if(n.useDepths&&!e)throw new r("must pass parent depths");return f(i,t,n[t],u,e)},u}function f(n,t,i,r,u){var f=function(t,f){return f=f||{},i.call(n,t,n.helpers,n.partials,f.data||r,u&&[t].concat(u))};return f.program=t,f.depth=u?u.length:0,f}function a(n,t,i,u,f,e,o){var s={partial:!0,helpers:u,partials:f,data:e,depths:o};if(n===undefined)throw new r("The partial "+t+" could not be found");else if(n instanceof Function)return n(i,s)}function v(){return""}function y(n,t){return t&&"root"in t||(t=t?h(t):{},t.root=n),t}var u={},e=n,r=t,s=i.COMPILER_REVISION,o=i.REVISION_CHANGES,h=i.createFrame;return u.checkRevision=c,u.template=l,u.program=f,u.invokePartial=a,u.noop=v,u}(t,n,i),e=function(n,t,i,r,u){"use strict";var o=n,c=t,l=i,e=r,s=u,h=function(){var n=new o.HandlebarsEnvironment;return e.extend(n,o),n.SafeString=c,n.Exception=l,n.Utils=e,n.escapeExpression=e.escapeExpression,n.VM=s,n.template=function(t){return s.template(t,n)},n},f=h();return f.create=h,f["default"]=f,f}(i,r,n,t,f),u=function(n){"use strict";function t(n){n=n||{};this.firstLine=n.first_line;this.firstColumn=n.first_column;this.lastColumn=n.last_column;this.lastLine=n.last_line}var r=n,i={ProgramNode:function(n,i,r){t.call(this,r);this.type="program";this.statements=n;this.strip=i},MustacheNode:function(n,r,u,f,e){if(t.call(this,e),this.type="mustache",this.strip=f,u!=null&&u.charAt){var o=u.charAt(3)||u.charAt(2);this.escaped=o!=="{"&&o!=="&"}else this.escaped=!!u;this.sexpr=n instanceof i.SexprNode?n:new i.SexprNode(n,r);this.id=this.sexpr.id;this.params=this.sexpr.params;this.hash=this.sexpr.hash;this.eligibleHelper=this.sexpr.eligibleHelper;this.isHelper=this.sexpr.isHelper},SexprNode:function(n,i,r){t.call(this,r);this.type="sexpr";this.hash=i;var u=this.id=n[0],f=this.params=n.slice(1);this.isHelper=!!(f.length||i);this.eligibleHelper=this.isHelper||u.isSimple},PartialNode:function(n,i,r,u,f){t.call(this,f);this.type="partial";this.partialName=n;this.context=i;this.hash=r;this.strip=u;this.strip.inlineStandalone=!0},BlockNode:function(n,i,r,u,f){t.call(this,f);this.type="block";this.mustache=n;this.program=i;this.inverse=r;this.strip=u;r&&!i&&(this.isInverse=!0)},RawBlockNode:function(n,u,f,e){if(t.call(this,e),n.sexpr.id.original!==f)throw new r(n.sexpr.id.original+" doesn't match "+f,this);u=new i.ContentNode(u,e);this.type="block";this.mustache=n;this.program=new i.ProgramNode([u],{},e)},ContentNode:function(n,i){t.call(this,i);this.type="content";this.original=this.string=n},HashNode:function(n,i){t.call(this,i);this.type="hash";this.pairs=n},IdNode:function(n,i){var f,c,u;t.call(this,i);this.type="ID";var o="",e=[],s=0,h="";for(f=0,c=n.length;f<c;f++)if(u=n[f].part,o+=(n[f].separator||"")+u,u===".."||u==="."||u==="this")if(e.length>0)throw new r("Invalid path: "+o,this);else u===".."?(s++,h+="../"):this.isScoped=!0;else e.push(u);this.original=o;this.parts=e;this.string=e.join(".");this.depth=s;this.idName=h+this.string;this.isSimple=n.length===1&&!this.isScoped&&s===0;this.stringModeValue=this.string},PartialNameNode:function(n,i){t.call(this,i);this.type="PARTIAL_NAME";this.name=n.original},DataNode:function(n,i){t.call(this,i);this.type="DATA";this.id=n;this.stringModeValue=n.stringModeValue;this.idName="@"+n.stringModeValue},StringNode:function(n,i){t.call(this,i);this.type="STRING";this.original=this.string=this.stringModeValue=n},NumberNode:function(n,i){t.call(this,i);this.type="NUMBER";this.original=this.number=n;this.stringModeValue=Number(n)},BooleanNode:function(n,i){t.call(this,i);this.type="BOOLEAN";this.bool=n;this.stringModeValue=n==="true"},CommentNode:function(n,i){t.call(this,i);this.type="comment";this.comment=n;this.strip={inlineStandalone:!0}}};return i}(n),o=function(){"use strict";return function(){function t(){this.yy={}}var n={trace:function(){},yy:{},symbols_:{error:2,root:3,program:4,EOF:5,program_repetition0:6,statement:7,mustache:8,block:9,rawBlock:10,partial:11,CONTENT:12,COMMENT:13,openRawBlock:14,END_RAW_BLOCK:15,OPEN_RAW_BLOCK:16,sexpr:17,CLOSE_RAW_BLOCK:18,openBlock:19,block_option0:20,closeBlock:21,openInverse:22,block_option1:23,OPEN_BLOCK:24,CLOSE:25,OPEN_INVERSE:26,inverseAndProgram:27,INVERSE:28,OPEN_ENDBLOCK:29,path:30,OPEN:31,OPEN_UNESCAPED:32,CLOSE_UNESCAPED:33,OPEN_PARTIAL:34,partialName:35,param:36,partial_option0:37,partial_option1:38,sexpr_repetition0:39,sexpr_option0:40,dataName:41,STRING:42,NUMBER:43,BOOLEAN:44,OPEN_SEXPR:45,CLOSE_SEXPR:46,hash:47,hash_repetition_plus0:48,hashSegment:49,ID:50,EQUALS:51,DATA:52,pathSegments:53,SEP:54,$accept:0,$end:1},terminals_:{2:"error",5:"EOF",12:"CONTENT",13:"COMMENT",15:"END_RAW_BLOCK",16:"OPEN_RAW_BLOCK",18:"CLOSE_RAW_BLOCK",24:"OPEN_BLOCK",25:"CLOSE",26:"OPEN_INVERSE",28:"INVERSE",29:"OPEN_ENDBLOCK",31:"OPEN",32:"OPEN_UNESCAPED",33:"CLOSE_UNESCAPED",34:"OPEN_PARTIAL",42:"STRING",43:"NUMBER",44:"BOOLEAN",45:"OPEN_SEXPR",46:"CLOSE_SEXPR",50:"ID",51:"EQUALS",52:"DATA",54:"SEP"},productions_:[0,[3,2],[4,1],[7,1],[7,1],[7,1],[7,1],[7,1],[7,1],[10,3],[14,3],[9,4],[9,4],[19,3],[22,3],[27,2],[21,3],[8,3],[8,3],[11,5],[11,4],[17,3],[17,1],[36,1],[36,1],[36,1],[36,1],[36,1],[36,3],[47,1],[49,3],[35,1],[35,1],[35,1],[41,2],[30,1],[53,3],[53,1],[6,0],[6,2],[20,0],[20,1],[23,0],[23,1],[37,0],[37,1],[38,0],[38,1],[39,0],[39,2],[40,0],[40,1],[48,1],[48,2]],performAction:function(n,t,i,r,u,f){var e=f.length-1;switch(u){case 1:return r.prepareProgram(f[e-1].statements,!0),f[e-1];case 2:this.$=new r.ProgramNode(r.prepareProgram(f[e]),{},this._$);break;case 3:this.$=f[e];break;case 4:this.$=f[e];break;case 5:this.$=f[e];break;case 6:this.$=f[e];break;case 7:this.$=new r.ContentNode(f[e],this._$);break;case 8:this.$=new r.CommentNode(f[e],this._$);break;case 9:this.$=new r.RawBlockNode(f[e-2],f[e-1],f[e],this._$);break;case 10:this.$=new r.MustacheNode(f[e-1],null,"","",this._$);break;case 11:this.$=r.prepareBlock(f[e-3],f[e-2],f[e-1],f[e],!1,this._$);break;case 12:this.$=r.prepareBlock(f[e-3],f[e-2],f[e-1],f[e],!0,this._$);break;case 13:this.$=new r.MustacheNode(f[e-1],null,f[e-2],r.stripFlags(f[e-2],f[e]),this._$);break;case 14:this.$=new r.MustacheNode(f[e-1],null,f[e-2],r.stripFlags(f[e-2],f[e]),this._$);break;case 15:this.$={strip:r.stripFlags(f[e-1],f[e-1]),program:f[e]};break;case 16:this.$={path:f[e-1],strip:r.stripFlags(f[e-2],f[e])};break;case 17:this.$=new r.MustacheNode(f[e-1],null,f[e-2],r.stripFlags(f[e-2],f[e]),this._$);break;case 18:this.$=new r.MustacheNode(f[e-1],null,f[e-2],r.stripFlags(f[e-2],f[e]),this._$);break;case 19:this.$=new r.PartialNode(f[e-3],f[e-2],f[e-1],r.stripFlags(f[e-4],f[e]),this._$);break;case 20:this.$=new r.PartialNode(f[e-2],undefined,f[e-1],r.stripFlags(f[e-3],f[e]),this._$);break;case 21:this.$=new r.SexprNode([f[e-2]].concat(f[e-1]),f[e],this._$);break;case 22:this.$=new r.SexprNode([f[e]],null,this._$);break;case 23:this.$=f[e];break;case 24:this.$=new r.StringNode(f[e],this._$);break;case 25:this.$=new r.NumberNode(f[e],this._$);break;case 26:this.$=new r.BooleanNode(f[e],this._$);break;case 27:this.$=f[e];break;case 28:f[e-1].isHelper=!0;this.$=f[e-1];break;case 29:this.$=new r.HashNode(f[e],this._$);break;case 30:this.$=[f[e-2],f[e]];break;case 31:this.$=new r.PartialNameNode(f[e],this._$);break;case 32:this.$=new r.PartialNameNode(new r.StringNode(f[e],this._$),this._$);break;case 33:this.$=new r.PartialNameNode(new r.NumberNode(f[e],this._$));break;case 34:this.$=new r.DataNode(f[e],this._$);break;case 35:this.$=new r.IdNode(f[e],this._$);break;case 36:f[e-2].push({part:f[e],separator:f[e-1]});this.$=f[e-2];break;case 37:this.$=[{part:f[e]}];break;case 38:this.$=[];break;case 39:f[e-1].push(f[e]);break;case 48:this.$=[];break;case 49:f[e-1].push(f[e]);break;case 52:this.$=[f[e]];break;case 53:f[e-1].push(f[e])}},table:[{3:1,4:2,5:[2,38],6:3,12:[2,38],13:[2,38],16:[2,38],24:[2,38],26:[2,38],31:[2,38],32:[2,38],34:[2,38]},{1:[3]},{5:[1,4]},{5:[2,2],7:5,8:6,9:7,10:8,11:9,12:[1,10],13:[1,11],14:16,16:[1,20],19:14,22:15,24:[1,18],26:[1,19],28:[2,2],29:[2,2],31:[1,12],32:[1,13],34:[1,17]},{1:[2,1]},{5:[2,39],12:[2,39],13:[2,39],16:[2,39],24:[2,39],26:[2,39],28:[2,39],29:[2,39],31:[2,39],32:[2,39],34:[2,39]},{5:[2,3],12:[2,3],13:[2,3],16:[2,3],24:[2,3],26:[2,3],28:[2,3],29:[2,3],31:[2,3],32:[2,3],34:[2,3]},{5:[2,4],12:[2,4],13:[2,4],16:[2,4],24:[2,4],26:[2,4],28:[2,4],29:[2,4],31:[2,4],32:[2,4],34:[2,4]},{5:[2,5],12:[2,5],13:[2,5],16:[2,5],24:[2,5],26:[2,5],28:[2,5],29:[2,5],31:[2,5],32:[2,5],34:[2,5]},{5:[2,6],12:[2,6],13:[2,6],16:[2,6],24:[2,6],26:[2,6],28:[2,6],29:[2,6],31:[2,6],32:[2,6],34:[2,6]},{5:[2,7],12:[2,7],13:[2,7],16:[2,7],24:[2,7],26:[2,7],28:[2,7],29:[2,7],31:[2,7],32:[2,7],34:[2,7]},{5:[2,8],12:[2,8],13:[2,8],16:[2,8],24:[2,8],26:[2,8],28:[2,8],29:[2,8],31:[2,8],32:[2,8],34:[2,8]},{17:21,30:22,41:23,50:[1,26],52:[1,25],53:24},{17:27,30:22,41:23,50:[1,26],52:[1,25],53:24},{4:28,6:3,12:[2,38],13:[2,38],16:[2,38],24:[2,38],26:[2,38],28:[2,38],29:[2,38],31:[2,38],32:[2,38],34:[2,38]},{4:29,6:3,12:[2,38],13:[2,38],16:[2,38],24:[2,38],26:[2,38],28:[2,38],29:[2,38],31:[2,38],32:[2,38],34:[2,38]},{12:[1,30]},{30:32,35:31,42:[1,33],43:[1,34],50:[1,26],53:24},{17:35,30:22,41:23,50:[1,26],52:[1,25],53:24},{17:36,30:22,41:23,50:[1,26],52:[1,25],53:24},{17:37,30:22,41:23,50:[1,26],52:[1,25],53:24},{25:[1,38]},{18:[2,48],25:[2,48],33:[2,48],39:39,42:[2,48],43:[2,48],44:[2,48],45:[2,48],46:[2,48],50:[2,48],52:[2,48]},{18:[2,22],25:[2,22],33:[2,22],46:[2,22]},{18:[2,35],25:[2,35],33:[2,35],42:[2,35],43:[2,35],44:[2,35],45:[2,35],46:[2,35],50:[2,35],52:[2,35],54:[1,40]},{30:41,50:[1,26],53:24},{18:[2,37],25:[2,37],33:[2,37],42:[2,37],43:[2,37],44:[2,37],45:[2,37],46:[2,37],50:[2,37],52:[2,37],54:[2,37]},{33:[1,42]},{20:43,27:44,28:[1,45],29:[2,40]},{23:46,27:47,28:[1,45],29:[2,42]},{15:[1,48]},{25:[2,46],30:51,36:49,38:50,41:55,42:[1,52],43:[1,53],44:[1,54],45:[1,56],47:57,48:58,49:60,50:[1,59],52:[1,25],53:24},{25:[2,31],42:[2,31],43:[2,31],44:[2,31],45:[2,31],50:[2,31],52:[2,31]},{25:[2,32],42:[2,32],43:[2,32],44:[2,32],45:[2,32],50:[2,32],52:[2,32]},{25:[2,33],42:[2,33],43:[2,33],44:[2,33],45:[2,33],50:[2,33],52:[2,33]},{25:[1,61]},{25:[1,62]},{18:[1,63]},{5:[2,17],12:[2,17],13:[2,17],16:[2,17],24:[2,17],26:[2,17],28:[2,17],29:[2,17],31:[2,17],32:[2,17],34:[2,17]},{18:[2,50],25:[2,50],30:51,33:[2,50],36:65,40:64,41:55,42:[1,52],43:[1,53],44:[1,54],45:[1,56],46:[2,50],47:66,48:58,49:60,50:[1,59],52:[1,25],53:24},{50:[1,67]},{18:[2,34],25:[2,34],33:[2,34],42:[2,34],43:[2,34],44:[2,34],45:[2,34],46:[2,34],50:[2,34],52:[2,34]},{5:[2,18],12:[2,18],13:[2,18],16:[2,18],24:[2,18],26:[2,18],28:[2,18],29:[2,18],31:[2,18],32:[2,18],34:[2,18]},{21:68,29:[1,69]},{29:[2,41]},{4:70,6:3,12:[2,38],13:[2,38],16:[2,38],24:[2,38],26:[2,38],29:[2,38],31:[2,38],32:[2,38],34:[2,38]},{21:71,29:[1,69]},{29:[2,43]},{5:[2,9],12:[2,9],13:[2,9],16:[2,9],24:[2,9],26:[2,9],28:[2,9],29:[2,9],31:[2,9],32:[2,9],34:[2,9]},{25:[2,44],37:72,47:73,48:58,49:60,50:[1,74]},{25:[1,75]},{18:[2,23],25:[2,23],33:[2,23],42:[2,23],43:[2,23],44:[2,23],45:[2,23],46:[2,23],50:[2,23],52:[2,23]},{18:[2,24],25:[2,24],33:[2,24],42:[2,24],43:[2,24],44:[2,24],45:[2,24],46:[2,24],50:[2,24],52:[2,24]},{18:[2,25],25:[2,25],33:[2,25],42:[2,25],43:[2,25],44:[2,25],45:[2,25],46:[2,25],50:[2,25],52:[2,25]},{18:[2,26],25:[2,26],33:[2,26],42:[2,26],43:[2,26],44:[2,26],45:[2,26],46:[2,26],50:[2,26],52:[2,26]},{18:[2,27],25:[2,27],33:[2,27],42:[2,27],43:[2,27],44:[2,27],45:[2,27],46:[2,27],50:[2,27],52:[2,27]},{17:76,30:22,41:23,50:[1,26],52:[1,25],53:24},{25:[2,47]},{18:[2,29],25:[2,29],33:[2,29],46:[2,29],49:77,50:[1,74]},{18:[2,37],25:[2,37],33:[2,37],42:[2,37],43:[2,37],44:[2,37],45:[2,37],46:[2,37],50:[2,37],51:[1,78],52:[2,37],54:[2,37]},{18:[2,52],25:[2,52],33:[2,52],46:[2,52],50:[2,52]},{12:[2,13],13:[2,13],16:[2,13],24:[2,13],26:[2,13],28:[2,13],29:[2,13],31:[2,13],32:[2,13],34:[2,13]},{12:[2,14],13:[2,14],16:[2,14],24:[2,14],26:[2,14],28:[2,14],29:[2,14],31:[2,14],32:[2,14],34:[2,14]},{12:[2,10]},{18:[2,21],25:[2,21],33:[2,21],46:[2,21]},{18:[2,49],25:[2,49],33:[2,49],42:[2,49],43:[2,49],44:[2,49],45:[2,49],46:[2,49],50:[2,49],52:[2,49]},{18:[2,51],25:[2,51],33:[2,51],46:[2,51]},{18:[2,36],25:[2,36],33:[2,36],42:[2,36],43:[2,36],44:[2,36],45:[2,36],46:[2,36],50:[2,36],52:[2,36],54:[2,36]},{5:[2,11],12:[2,11],13:[2,11],16:[2,11],24:[2,11],26:[2,11],28:[2,11],29:[2,11],31:[2,11],32:[2,11],34:[2,11]},{30:79,50:[1,26],53:24},{29:[2,15]},{5:[2,12],12:[2,12],13:[2,12],16:[2,12],24:[2,12],26:[2,12],28:[2,12],29:[2,12],31:[2,12],32:[2,12],34:[2,12]},{25:[1,80]},{25:[2,45]},{51:[1,78]},{5:[2,20],12:[2,20],13:[2,20],16:[2,20],24:[2,20],26:[2,20],28:[2,20],29:[2,20],31:[2,20],32:[2,20],34:[2,20]},{46:[1,81]},{18:[2,53],25:[2,53],33:[2,53],46:[2,53],50:[2,53]},{30:51,36:82,41:55,42:[1,52],43:[1,53],44:[1,54],45:[1,56],50:[1,26],52:[1,25],53:24},{25:[1,83]},{5:[2,19],12:[2,19],13:[2,19],16:[2,19],24:[2,19],26:[2,19],28:[2,19],29:[2,19],31:[2,19],32:[2,19],34:[2,19]},{18:[2,28],25:[2,28],33:[2,28],42:[2,28],43:[2,28],44:[2,28],45:[2,28],46:[2,28],50:[2,28],52:[2,28]},{18:[2,30],25:[2,30],33:[2,30],46:[2,30],50:[2,30]},{5:[2,16],12:[2,16],13:[2,16],16:[2,16],24:[2,16],26:[2,16],28:[2,16],29:[2,16],31:[2,16],32:[2,16],34:[2,16]}],defaultActions:{4:[2,1],44:[2,41],47:[2,43],57:[2,47],63:[2,10],70:[2,15],73:[2,45]},parseError:function(n){throw new Error(n);},parse:function(n){function it(){var n;return n=k.lexer.lex()||1,typeof n!="number"&&(n=k.symbols_[n]||n),n}var k=this,r=[0],f=[null],t=[],h=this.table,d="",c=0,g=0,y=0,l,nt,i,p,o,u,w,s,a,e,tt,v,b;for(this.lexer.setInput(n),this.lexer.yy=this.yy,this.yy.lexer=this.lexer,this.yy.parser=this,typeof this.lexer.yylloc=="undefined"&&(this.lexer.yylloc={}),l=this.lexer.yylloc,t.push(l),nt=this.lexer.options&&this.lexer.options.ranges,typeof this.yy.parseError=="function"&&(this.parseError=this.yy.parseError),s={};;){if(o=r[r.length-1],this.defaultActions[o]?u=this.defaultActions[o]:((i===null||typeof i=="undefined")&&(i=it()),u=h[o]&&h[o][i]),(typeof u=="undefined"||!u.length||!u[0])&&(b="",!y)){v=[];for(a in h[o])this.terminals_[a]&&a>2&&v.push("'"+this.terminals_[a]+"'");b=this.lexer.showPosition?"Parse error on line "+(c+1)+":\n"+this.lexer.showPosition()+"\nExpecting "+v.join(", ")+", got '"+(this.terminals_[i]||i)+"'":"Parse error on line "+(c+1)+": Unexpected "+(i==1?"end of input":"'"+(this.terminals_[i]||i)+"'");this.parseError(b,{text:this.lexer.match,token:this.terminals_[i]||i,line:this.lexer.yylineno,loc:l,expected:v})}if(u[0]instanceof Array&&u.length>1)throw new Error("Parse Error: multiple actions possible at state: "+o+", token: "+i);switch(u[0]){case 1:r.push(i);f.push(this.lexer.yytext);t.push(this.lexer.yylloc);r.push(u[1]);i=null;p?(i=p,p=null):(g=this.lexer.yyleng,d=this.lexer.yytext,c=this.lexer.yylineno,l=this.lexer.yylloc,y>0&&y--);break;case 2:if(e=this.productions_[u[1]][1],s.$=f[f.length-e],s._$={first_line:t[t.length-(e||1)].first_line,last_line:t[t.length-1].last_line,first_column:t[t.length-(e||1)].first_column,last_column:t[t.length-1].last_column},nt&&(s._$.range=[t[t.length-(e||1)].range[0],t[t.length-1].range[1]]),w=this.performAction.call(s,d,g,c,this.yy,u[1],f,t),typeof w!="undefined")return w;e&&(r=r.slice(0,-2*e),f=f.slice(0,-1*e),t=t.slice(0,-1*e));r.push(this.productions_[u[1]][0]);f.push(s.$);t.push(s._$);tt=h[r[r.length-2]][r[r.length-1]];r.push(tt);break;case 3:return!0}}return!0}},i=function(){var n={EOF:1,parseError:function(n,t){if(this.yy.parser)this.yy.parser.parseError(n,t);else throw new Error(n);},setInput:function(n){return this._input=n,this._more=this._less=this.done=!1,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},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},input:function(){var n=this._input[0],t;return this.yytext+=n,this.yyleng++,this.offset++,this.match+=n,this.matched+=n,t=n.match(/(?:\r\n?|\n).*/g),t?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),n},unput:function(n){var i=n.length,t=n.split(/(?:\r\n?|\n)/g),r,u;return this._input=n+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-i-1),this.offset-=i,r=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),t.length-1&&(this.yylineno-=t.length-1),u=this.yylloc.range,this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:t?(t.length===r.length?this.yylloc.first_column:0)+r[r.length-t.length].length-t[0].length:this.yylloc.first_column-i},this.options.ranges&&(this.yylloc.range=[u[0],u[0]+this.yyleng-i]),this},more:function(){return this._more=!0,this},less:function(n){this.unput(this.match.slice(n))},pastInput:function(){var n=this.matched.substr(0,this.matched.length-this.match.length);return(n.length>20?"...":"")+n.substr(-20).replace(/\n/g,"")},upcomingInput:function(){var n=this.match;return n.length<20&&(n+=this._input.substr(0,20-n.length)),(n.substr(0,20)+(n.length>20?"...":"")).replace(/\n/g,"")},showPosition:function(){var n=this.pastInput(),t=new Array(n.length+1).join("-");return n+this.upcomingInput()+"\n"+t+"^"},next:function(){var f,n,r,e,t,u,i;if(this.done)return this.EOF;for(this._input||(this.done=!0),this._more||(this.yytext="",this.match=""),u=this._currentRules(),i=0;i<u.length;i++)if(r=this._input.match(this.rules[u[i]]),r&&(!n||r[0].length>n[0].length)&&(n=r,e=i,!this.options.flex))break;return n?(t=n[0].match(/(?:\r\n?|\n).*/g),t&&(this.yylineno+=t.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:t?t[t.length-1].length-t[t.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+n[0].length},this.yytext+=n[0],this.match+=n[0],this.matches=n,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._input=this._input.slice(n[0].length),this.matched+=n[0],f=this.performAction.call(this,this.yy,this,u[e],this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),f)?f:void 0:this._input===""?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+". Unrecognized text.\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},lex:function(){var n=this.next();return typeof n!="undefined"?n:this.lex()},begin:function(n){this.conditionStack.push(n)},popState:function(){return this.conditionStack.pop()},_currentRules:function(){return this.conditions[this.conditionStack[this.conditionStack.length-1]].rules},topState:function(){return this.conditionStack[this.conditionStack.length-2]},pushState:function(n){this.begin(n)}};return n.options={},n.performAction=function(n,t,i,r){function u(n,i){return t.yytext=t.yytext.substr(n,t.yyleng-i)}var f=r;switch(i){case 0:if(t.yytext.slice(-2)==="\\\\"?(u(0,1),this.begin("mu")):t.yytext.slice(-1)==="\\"?(u(0,1),this.begin("emu")):this.begin("mu"),t.yytext)return 12;break;case 1:return 12;case 2:return this.popState(),12;case 3:return t.yytext=t.yytext.substr(5,t.yyleng-9),this.popState(),15;case 4:return 12;case 5:return u(0,4),this.popState(),13;case 6:return 45;case 7:return 46;case 8:return 16;case 9:return this.popState(),this.begin("raw"),18;case 10:return 34;case 11:return 24;case 12:return 29;case 13:return this.popState(),28;case 14:return this.popState(),28;case 15:return 26;case 16:return 26;case 17:return 32;case 18:return 31;case 19:this.popState();this.begin("com");break;case 20:return u(3,5),this.popState(),13;case 21:return 31;case 22:return 51;case 23:return 50;case 24:return 50;case 25:return 54;case 27:return this.popState(),33;case 28:return this.popState(),25;case 29:return t.yytext=u(1,2).replace(/\\"/g,'"'),42;case 30:return t.yytext=u(1,2).replace(/\\'/g,"'"),42;case 31:return 52;case 32:return 44;case 33:return 44;case 34:return 43;case 35:return 50;case 36:return t.yytext=u(1,2),50;case 37:return"INVALID";case 38:return 5}},n.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)])))/,/^(?:-?[0-9]+(?:\.[0-9]+)?(?=([~}\s)])))/,/^(?:([^\s!"#%-,\.\/;->@\[-\^`\{-~]+(?=([=~}\s\/.)]))))/,/^(?:\[[^\]]*\])/,/^(?:.)/,/^(?:$)/],n.conditions={mu:{rules:[6,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],inclusive:!1},emu:{rules:[2],inclusive:!1},com:{rules:[5],inclusive:!1},raw:{rules:[3,4],inclusive:!1},INITIAL:{rules:[0,1,38],inclusive:!0}},n}();return n.lexer=i,t.prototype=n,n.Parser=t,new t}()}(),s=function(n){"use strict";function o(n,t){return{left:n.charAt(2)==="~",right:t.charAt(t.length-3)==="~"}}function s(n,r,o,s,h,c){var l,a,v;if(n.sexpr.id.original!==s.path.original)throw new e(n.sexpr.id.original+" doesn't match "+s.path.original,n);return l=o&&o.program,a={left:n.strip.left,right:s.strip.right,openStandalone:f(r.statements),closeStandalone:u((l||r).statements)},n.strip.right&&i(r.statements,null,!0),l?(v=o.strip,v.left&&t(r.statements,null,!0),v.right&&i(l.statements,null,!0),s.strip.left&&t(l.statements,null,!0),u(r.statements)&&f(l.statements)&&(t(r.statements),i(l.statements))):s.strip.left&&t(r.statements,null,!0),h?new this.BlockNode(n,l,r,a,c):new this.BlockNode(n,r,l,a,c)}function h(n,r){for(var o,s,e=0,h=n.length;e<h;e++)if(o=n[e],s=o.strip,s){var c=u(n,e,r,o.type==="partial"),l=f(n,e,r),a=s.openStandalone&&c,v=s.closeStandalone&&l,y=s.inlineStandalone&&c&&l;s.right&&i(n,e,!0);s.left&&t(n,e,!0);y&&(i(n,e),t(n,e)&&o.type==="partial"&&(o.indent=/([ \t]+$)/.exec(n[e-1].original)?RegExp.$1:""));a&&(i((o.program||o.inverse).statements),t(n,e));v&&(i(n,e),t((o.inverse||o.program).statements))}return n}function u(n,t,i){t===undefined&&(t=n.length);var r=n[t-1],u=n[t-2];return r?r.type==="content"?(u||!i?/\r?\n\s*?$/:/(^|\r?\n)\s*?$/).test(r.original):void 0:i}function f(n,t,i){t===undefined&&(t=-1);var r=n[t+1],u=n[t+2];return r?r.type==="content"?(u||!i?/^\s*?\r?\n/:/^\s*?(\r?\n|$)/).test(r.original):void 0:i}function i(n,t,i){var r=n[t==null?0:t+1],u;r&&r.type==="content"&&(i||!r.rightStripped)&&(u=r.string,r.string=r.string.replace(i?/^\s+/:/^[ \t]*\r?\n?/,""),r.rightStripped=r.string!==u)}function t(n,t,i){var r=n[t==null?n.length-1:t-1],u;if(r&&r.type==="content"&&(i||!r.leftStripped))return u=r.string,r.string=r.string.replace(i?/\s+$/:/[ \t]+$/,""),r.leftStripped=r.string!==u,r.leftStripped}var r={},e=n;return r.stripFlags=o,r.prepareBlock=s,r.prepareProgram=h,r}(n),h=function(n,t,i,r){"use strict";function c(n){return n.constructor===o.ProgramNode?n:(f.yy=e,f.parse(n))}var u={},f=n,o=t,s=i,h=r.extend,e;return u.parser=f,e={},h(e,s,o),u.parse=c,u}(o,u,s,t),c=function(n,t){"use strict";function u(){}function s(n,t,i){if(n==null||typeof n!="string"&&n.constructor!==i.AST.ProgramNode)throw new r("You must pass a string or Handlebars AST to Handlebars.precompile. You passed "+n);t=t||{};"data"in t||(t.data=!0);t.compat&&(t.useDepths=!0);var u=i.parse(n),f=(new i.Compiler).compile(u,t);return(new i.JavaScriptCompiler).compile(f,t)}function h(n,t,i){function e(){var r=i.parse(n),u=(new i.Compiler).compile(r,t),f=(new i.JavaScriptCompiler).compile(u,t,undefined,!0);return i.template(f)}var u,f;if(n==null||typeof n!="string"&&n.constructor!==i.AST.ProgramNode)throw new r("You must pass a string or Handlebars AST to Handlebars.compile. You passed "+n);return t=t||{},"data"in t||(t.data=!0),t.compat&&(t.useDepths=!0),f=function(n,t){return u||(u=e()),u.call(this,n,t)},f._setup=function(n){return u||(u=e()),u._setup(n)},f._child=function(n,t,i){return u||(u=e()),u._child(n,t,i)},f}function e(n,t){if(n===t)return!0;if(f(n)&&f(t)&&n.length===t.length){for(var i=0;i<n.length;i++)if(!e(n[i],t[i]))return!1;return!0}}var i={},r=n,f=t.isArray,o=[].slice;return i.Compiler=u,u.prototype={compiler:u,equals:function(n){var i=this.opcodes.length,t,r,u;if(n.opcodes.length!==i)return!1;for(t=0;t<i;t++)if(r=this.opcodes[t],u=n.opcodes[t],r.opcode!==u.opcode||!e(r.args,u.args))return!1;for(i=this.children.length,t=0;t<i;t++)if(!this.children[t].equals(n.children[t]))return!1;return!0},guid:0,compile:function(n,t){var i,r;if(this.opcodes=[],this.children=[],this.depths={list:[]},this.options=t,this.stringParams=t.stringParams,this.trackIds=t.trackIds,i=this.options.knownHelpers,this.options.knownHelpers={helperMissing:!0,blockHelperMissing:!0,each:!0,"if":!0,unless:!0,"with":!0,log:!0,lookup:!0},i)for(r in i)this.options.knownHelpers[r]=i[r];return this.accept(n)},accept:function(n){return this[n.type](n)},program:function(n){for(var i=n.statements,t=0,r=i.length;t<r;t++)this.accept(i[t]);return this.isSimple=r===1,this.depths.list=this.depths.list.sort(function(n,t){return n-t}),this},compileProgram:function(n){var t=(new this.compiler).compile(n,this.options),u=this.guid++,r,i,f;for(this.usePartial=this.usePartial||t.usePartial,this.children[u]=t,i=0,f=t.depths.list.length;i<f;i++)if(r=t.depths.list[i],r<2)continue;else this.addDepth(r-1);return u},block:function(n){var f=n.mustache,t=n.program,i=n.inverse,r,u;t&&(t=this.compileProgram(t));i&&(i=this.compileProgram(i));r=f.sexpr;u=this.classifySexpr(r);u==="helper"?this.helperSexpr(r,t,i):u==="simple"?(this.simpleSexpr(r),this.opcode("pushProgram",t),this.opcode("pushProgram",i),this.opcode("emptyHash"),this.opcode("blockValue",r.id.original)):(this.ambiguousSexpr(r,t,i),this.opcode("pushProgram",t),this.opcode("pushProgram",i),this.opcode("emptyHash"),this.opcode("ambiguousBlockValue"));this.opcode("append")},hash:function(n){var i=n.pairs,t,r;for(this.opcode("pushHash"),t=0,r=i.length;t<r;t++)this.pushParam(i[t][1]);while(t--)this.opcode("assignToHash",i[t][0]);this.opcode("popHash")},partial:function(n){var t=n.partialName;this.usePartial=!0;n.hash?this.accept(n.hash):this.opcode("push","undefined");n.context?this.accept(n.context):(this.opcode("getContext",0),this.opcode("pushContext"));this.opcode("invokePartial",t.name,n.indent||"");this.opcode("append")},content:function(n){n.string&&this.opcode("appendContent",n.string)},mustache:function(n){this.sexpr(n.sexpr);n.escaped&&!this.options.noEscape?this.opcode("appendEscaped"):this.opcode("append")},ambiguousSexpr:function(n,t,i){var r=n.id,u=r.parts[0],f=t!=null||i!=null;this.opcode("getContext",r.depth);this.opcode("pushProgram",t);this.opcode("pushProgram",i);this.ID(r);this.opcode("invokeAmbiguous",u,f)},simpleSexpr:function(n){var t=n.id;t.type==="DATA"?this.DATA(t):t.parts.length?this.ID(t):(this.addDepth(t.depth),this.opcode("getContext",t.depth),this.opcode("pushContext"));this.opcode("resolvePossibleLambda")},helperSexpr:function(n,t,i){var e=this.setupFullMustacheParams(n,t,i),u=n.id,f=u.parts[0];if(this.options.knownHelpers[f])this.opcode("invokeKnownHelper",e.length,f);else if(this.options.knownHelpersOnly)throw new r("You specified knownHelpersOnly, but used the unknown helper "+f,n);else u.falsy=!0,this.ID(u),this.opcode("invokeHelper",e.length,u.original,u.isSimple)},sexpr:function(n){var t=this.classifySexpr(n);t==="simple"?this.simpleSexpr(n):t==="helper"?this.helperSexpr(n):this.ambiguousSexpr(n)},ID:function(n){this.addDepth(n.depth);this.opcode("getContext",n.depth);var t=n.parts[0];t?this.opcode("lookupOnContext",n.parts,n.falsy,n.isScoped):this.opcode("pushContext")},DATA:function(n){this.options.data=!0;this.opcode("lookupData",n.id.depth,n.id.parts)},STRING:function(n){this.opcode("pushString",n.string)},NUMBER:function(n){this.opcode("pushLiteral",n.number)},BOOLEAN:function(n){this.opcode("pushLiteral",n.bool)},comment:function(){},opcode:function(n){this.opcodes.push({opcode:n,args:o.call(arguments,1)})},addDepth:function(n){n!==0&&(this.depths[n]||(this.depths[n]=!0,this.depths.list.push(n)))},classifySexpr:function(n){var t=n.isHelper,i=n.eligibleHelper,r=this.options,u;return i&&!t&&(u=n.id.parts[0],r.knownHelpers[u]?t=!0:r.knownHelpersOnly&&(i=!1)),t?"helper":i?"ambiguous":"simple"},pushParams:function(n){for(var t=0,i=n.length;t<i;t++)this.pushParam(n[t])},pushParam:function(n){this.stringParams?(n.depth&&this.addDepth(n.depth),this.opcode("getContext",n.depth||0),this.opcode("pushStringParam",n.stringModeValue,n.type),n.type==="sexpr"&&this.sexpr(n)):(this.trackIds&&this.opcode("pushId",n.type,n.idName||n.stringModeValue),this.accept(n))},setupFullMustacheParams:function(n,t,i){var r=n.params;return this.pushParams(r),this.opcode("pushProgram",t),this.opcode("pushProgram",i),n.hash?this.hash(n.hash):this.opcode("emptyHash"),r}},i.precompile=s,i.compile=h,i}(n,t),l=function(n,t){"use strict";function r(n){this.value=n}function i(){}var h=n.COMPILER_REVISION,c=n.REVISION_CHANGES,f=t,e,o,u,s;for(i.prototype={nameLookup:function(n,t){return i.isValidJavaScriptVariableName(t)?n+"."+t:n+"['"+t+"']"},depthedLookup:function(n){return this.aliases.lookup="this.lookup",'lookup(depths, "'+n+'")'},compilerInfo:function(){var n=h,t=c[n];return[n,t]},appendToBuffer:function(n){return this.environment.isSimple?"return "+n+";":{appendToBuffer:!0,content:n,toString:function(){return"buffer += "+n+";"}}},initializeBuffer:function(){return this.quotedString("")},namespace:"Handlebars",compile:function(n,t,i,r){var h,c,e,o,l,u,s;for(this.environment=n,this.options=t,this.stringParams=this.options.stringParams,this.trackIds=this.options.trackIds,this.precompile=!r,this.name=this.environment.name,this.isChild=!!i,this.context=i||{programs:[],environments:[]},this.preamble(),this.stackSlot=0,this.stackVars=[],this.aliases={},this.registers={list:[]},this.hashes=[],this.compileStack=[],this.inlineStack=[],this.compileChildren(n,t),this.useDepths=this.useDepths||n.depths.list.length||this.options.compat,h=n.opcodes,e=0,o=h.length;e<o;e++)c=h[e],this[c.opcode].apply(this,c.args);if(this.pushSource(""),this.stackSlot||this.inlineStack.length||this.compileStack.length)throw new f("Compile completed with content left on stack");if(l=this.createFunctionContext(r),this.isChild)return l;for(u={compiler:this.compilerInfo(),main:l},s=this.context.programs,e=0,o=s.length;e<o;e++)s[e]&&(u[e]=s[e]);return this.environment.usePartial&&(u.usePartial=!0),this.options.data&&(u.useData=!0),this.useDepths&&(u.useDepths=!0),this.options.compat&&(u.compat=!0),r||(u.compiler=JSON.stringify(u.compiler),u=this.objectLiteral(u)),u},preamble:function(){this.lastContext=0;this.source=[]},createFunctionContext:function(n){var r="",f=this.stackVars.concat(this.registers.list),i,t,u;f.length>0&&(r+=", "+f.join(", "));for(i in this.aliases)this.aliases.hasOwnProperty(i)&&(r+=", "+i+"="+this.aliases[i]);return t=["depth0","helpers","partials","data"],this.useDepths&&t.push("depths"),u=this.mergeSource(r),n?(t.push(u),Function.apply(this,t)):"function("+t.join(",")+") {\n "+u+"}"},mergeSource:function(n){for(var r,i="",t,e=!this.forceBuffer,u,f=0,o=this.source.length;f<o;f++)r=this.source[f],r.appendToBuffer?t=t?t+"\n + "+r.content:r.content:(t&&(i?i+="buffer += "+t+";\n ":(u=!0,i=t+";\n "),t=undefined),i+=r+"\n ",this.environment.isSimple||(e=!1));return e?(t||!i)&&(i+="return "+(t||'""')+";\n"):(n+=", buffer = "+(u?"":this.initializeBuffer()),i+=t?"return buffer + "+t+";\n":"return buffer;\n"),n&&(i="var "+n.substring(2)+(u?"":";\n ")+i),i},blockValue:function(n){var t,i;this.aliases.blockHelperMissing="helpers.blockHelperMissing";t=[this.contextName(0)];this.setupParams(n,0,t);i=this.popStack();t.splice(1,0,i);this.push("blockHelperMissing.call("+t.join(", ")+")")},ambiguousBlockValue:function(){var n,t;this.aliases.blockHelperMissing="helpers.blockHelperMissing";n=[this.contextName(0)];this.setupParams("",0,n,!0);this.flushInline();t=this.topStack();n.splice(1,0,t);this.pushSource("if (!"+this.lastHelper+") { "+t+" = blockHelperMissing.call("+n.join(", ")+"); }")},appendContent:function(n){this.pendingContent&&(n=this.pendingContent+n);this.pendingContent=n},append:function(){this.flushInline();var n=this.popStack();this.pushSource("if ("+n+" != null) { "+this.appendToBuffer(n)+" }");this.environment.isSimple&&this.pushSource("else { "+this.appendToBuffer("''")+" }")},appendEscaped:function(){this.aliases.escapeExpression="this.escapeExpression";this.pushSource(this.appendToBuffer("escapeExpression("+this.popStack()+")"))},getContext:function(n){this.lastContext=n},pushContext:function(){this.pushStackLiteral(this.contextName(this.lastContext))},lookupOnContext:function(n,t,i){var r=0,u=n.length;for(i||!this.options.compat||this.lastContext?this.pushContext():this.push(this.depthedLookup(n[r++]));r<u;r++)this.replaceStack(function(i){var u=this.nameLookup(i,n[r],"context");return t?" && "+u:" != null ? "+u+" : "+i})},lookupData:function(n,t){var r,i;for(n?this.pushStackLiteral("this.data(data, "+n+")"):this.pushStackLiteral("data"),r=t.length,i=0;i<r;i++)this.replaceStack(function(n){return" && "+this.nameLookup(n,t[i],"data")})},resolvePossibleLambda:function(){this.aliases.lambda="this.lambda";this.push("lambda("+this.popStack()+", "+this.contextName(0)+")")},pushStringParam:function(n,t){this.pushContext();this.pushString(t);t!=="sexpr"&&(typeof n=="string"?this.pushString(n):this.pushStackLiteral(n))},emptyHash:function(){this.pushStackLiteral("{}");this.trackIds&&this.push("{}");this.stringParams&&(this.push("{}"),this.push("{}"))},pushHash:function(){this.hash&&this.hashes.push(this.hash);this.hash={values:[],types:[],contexts:[],ids:[]}},popHash:function(){var n=this.hash;this.hash=this.hashes.pop();this.trackIds&&this.push("{"+n.ids.join(",")+"}");this.stringParams&&(this.push("{"+n.contexts.join(",")+"}"),this.push("{"+n.types.join(",")+"}"));this.push("{\n "+n.values.join(",\n ")+"\n }")},pushString:function(n){this.pushStackLiteral(this.quotedString(n))},push:function(n){return this.inlineStack.push(n),n},pushLiteral:function(n){this.pushStackLiteral(n)},pushProgram:function(n){n!=null?this.pushStackLiteral(this.programExpression(n)):this.pushStackLiteral(null)},invokeHelper:function(n,t,i){this.aliases.helperMissing="helpers.helperMissing";var u=this.popStack(),r=this.setupHelper(n,t),f=(i?r.name+" || ":"")+u+" || helperMissing";this.push("(("+f+").call("+r.callParams+"))")},invokeKnownHelper:function(n,t){var i=this.setupHelper(n,t);this.push(i.name+".call("+i.callParams+")")},invokeAmbiguous:function(n,t){var r,i,u;this.aliases.functionType='"function"';this.aliases.helperMissing="helpers.helperMissing";this.useRegister("helper");r=this.popStack();this.emptyHash();i=this.setupHelper(0,n,t);u=this.lastHelper=this.nameLookup("helpers",n,"helper");this.push("((helper = (helper = "+u+" || "+r+") != null ? helper : helperMissing"+(i.paramsInit?"),("+i.paramsInit:"")+"),(typeof helper === functionType ? helper.call("+i.callParams+") : helper))")},invokePartial:function(n,t){var i=[this.nameLookup("partials",n,"partial"),"'"+t+"'","'"+n+"'",this.popStack(),this.popStack(),"helpers","partials"];this.options.data?i.push("data"):this.options.compat&&i.push("undefined");this.options.compat&&i.push("depths");this.push("this.invokePartial("+i.join(", ")+")")},assignToHash:function(n){var f=this.popStack(),i,r,u,t;this.trackIds&&(u=this.popStack());this.stringParams&&(r=this.popStack(),i=this.popStack());t=this.hash;i&&t.contexts.push("'"+n+"': "+i);r&&t.types.push("'"+n+"': "+r);u&&t.ids.push("'"+n+"': "+u);t.values.push("'"+n+"': ("+f+")")},pushId:function(n,t){n==="ID"||n==="DATA"?this.pushString(t):n==="sexpr"?this.pushStackLiteral("true"):this.pushStackLiteral("null")},compiler:i,compileChildren:function(n,t){for(var i,e=n.children,r,u,f=0,o=e.length;f<o;f++)r=e[f],u=new this.compiler,i=this.matchExistingProgram(r),i==null?(this.context.programs.push(""),i=this.context.programs.length,r.index=i,r.name="program"+i,this.context.programs[i]=u.compile(r,t,this.context,!this.precompile),this.context.environments[i]=r,this.useDepths=this.useDepths||u.useDepths):(r.index=i,r.name="program"+i)},matchExistingProgram:function(n){for(var i,t=0,r=this.context.environments.length;t<r;t++)if(i=this.context.environments[t],i&&i.equals(n))return t},programExpression:function(n){var t=this.environment.children[n],u=t.depths.list,r=this.useDepths,i=[t.index,"data"];return r&&i.push("depths"),"this.program("+i.join(", ")+")"},useRegister:function(n){this.registers[n]||(this.registers[n]=!0,this.registers.list.push(n))},pushStackLiteral:function(n){return this.push(new r(n))},pushSource:function(n){this.pendingContent&&(this.source.push(this.appendToBuffer(this.quotedString(this.pendingContent))),this.pendingContent=undefined);n&&this.source.push(n)},pushStack:function(n){this.flushInline();var t=this.incrStack();return this.pushSource(t+" = "+n+";"),this.compileStack.push(t),t},replaceStack:function(n){var i="",c=this.isInline(),u,e,o,t,s,h;if(!this.isInline())throw new f("replaceStack on non-inline");t=this.popStack(!0);t instanceof r?(i=u=t.value,o=!0):(e=!this.stackSlot,s=e?this.incrStack():this.topStackName(),i="("+this.push(s)+" = "+t+")",u=this.topStack());h=n.call(this,u);o||this.popStack();e&&this.stackSlot--;this.push("("+i+h+")")},incrStack:function(){return this.stackSlot++,this.stackSlot>this.stackVars.length&&this.stackVars.push("stack"+this.stackSlot),this.topStackName()},topStackName:function(){return"stack"+this.stackSlot},flushInline:function(){var i=this.inlineStack,n,u,t;if(i.length)for(this.inlineStack=[],n=0,u=i.length;n<u;n++)t=i[n],t instanceof r?this.compileStack.push(t):this.pushStack(t)},isInline:function(){return this.inlineStack.length},popStack:function(n){var i=this.isInline(),t=(i?this.inlineStack:this.compileStack).pop();if(!n&&t instanceof r)return t.value;if(!i){if(!this.stackSlot)throw new f("Invalid stack pop");this.stackSlot--}return t},topStack:function(){var t=this.isInline()?this.inlineStack:this.compileStack,n=t[t.length-1];return n instanceof r?n.value:n},contextName:function(n){return this.useDepths&&n?"depths["+n+"]":"depth"+n},quotedString:function(n){return'"'+n.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")+'"'},objectLiteral:function(n){var i=[];for(var t in n)n.hasOwnProperty(t)&&i.push(this.quotedString(t)+":"+n[t]);return"{"+i.join(",")+"}"},setupHelper:function(n,t,i){var r=[],u=this.setupParams(t,n,r,i),f=this.nameLookup("helpers",t,"helper");return{params:r,paramsInit:u,name:f,callParams:[this.contextName(0)].concat(r).join(", ")}},setupOptions:function(n,t,i){var r={},o=[],s=[],h=[],c,f,e,u;for(r.name=this.quotedString(n),r.hash=this.popStack(),this.trackIds&&(r.hashIds=this.popStack()),this.stringParams&&(r.hashTypes=this.popStack(),r.hashContexts=this.popStack()),f=this.popStack(),e=this.popStack(),(e||f)&&(e||(e="this.noop"),f||(f="this.noop"),r.fn=e,r.inverse=f),u=t;u--;)c=this.popStack(),i[u]=c,this.trackIds&&(h[u]=this.popStack()),this.stringParams&&(s[u]=this.popStack(),o[u]=this.popStack());return this.trackIds&&(r.ids="["+h.join(",")+"]"),this.stringParams&&(r.types="["+s.join(",")+"]",r.contexts="["+o.join(",")+"]"),this.options.data&&(r.data="data"),r},setupParams:function(n,t,i,r){var u=this.objectLiteral(this.setupOptions(n,t,i));return r?(this.useRegister("options"),i.push("options"),"options="+u):(i.push(u),"")}},e="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".split(" "),o=i.RESERVED_WORDS={},u=0,s=e.length;u<s;u++)o[e[u]]=!0;return i.isValidJavaScriptVariableName=function(n){return!i.RESERVED_WORDS[n]&&/^[a-zA-Z_$][0-9a-zA-Z_$]*$/.test(n)},i}(i,n);return function(n,t,i,r,u){"use strict";var f=n,o=t,s=i.parser,h=i.parse,c=r.Compiler,l=r.compile,a=r.precompile,v=u,y=f.create,e=function(){var n=y();return n.compile=function(t,i){return l(t,i,n)},n.precompile=function(t,i){return a(t,i,n)},n.AST=o,n.Compiler=c,n.JavaScriptCompiler=v,n.Parser=s,n.parse=h,n};return f=e(),f.create=e,f["default"]=f,f}(e,u,h,c,l)});/*! * typeahead.js 0.10.5 * https://github.com/twitter/typeahead.js * Copyright 2013-2014 Twitter, Inc. and other contributors; Licensed MIT */ (function(n){var t=function(){"use strict";return{isMsie:function(){return/(msie|trident)/i.test(navigator.userAgent)?navigator.userAgent.match(/(msie |rv:)(\d+(.\d+)?)/i)[2]:!1},isBlankString:function(n){return!n||/^\s*$/.test(n)},escapeRegExChars:function(n){return n.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")},isString:function(n){return typeof n=="string"},isNumber:function(n){return typeof n=="number"},isArray:n.isArray,isFunction:n.isFunction,isObject:n.isPlainObject,isUndefined:function(n){return typeof n=="undefined"},toStr:function(n){return t.isUndefined(n)||n===null?"":n+""},bind:n.proxy,each:function(t,i){function r(n,t){return i(t,n)}n.each(t,r)},map:n.map,filter:n.grep,every:function(t,i){var r=!0;return t?(n.each(t,function(n,u){if(!(r=i.call(null,u,n,t)))return!1}),!!r):r},some:function(t,i){var r=!1;return t?(n.each(t,function(n,u){if(r=i.call(null,u,n,t))return!1}),!!r):r},mixin:n.extend,getUniqueId:function(){var n=0;return function(){return n++}}(),templatify:function(t){function i(){return String(t)}return n.isFunction(t)?t:i},defer:function(n){setTimeout(n,0)},debounce:function(n,t,i){var r,u;return function(){var f=this,e=arguments,o,s;return o=function(){r=null;i||(u=n.apply(f,e))},s=i&&!r,clearTimeout(r),r=setTimeout(o,t),s&&(u=n.apply(f,e)),u}},throttle:function(n,t){var u,f,i,e,r,o;return r=0,o=function(){r=new Date;i=null;e=n.apply(u,f)},function(){var s=new Date,h=t-(s-r);return u=this,f=arguments,h<=0?(clearTimeout(i),i=null,r=s,e=n.apply(u,f)):i||(i=setTimeout(o,h)),e}},noop:function(){}}}(),l="0.10.5",a=function(){"use strict";function n(n){return n=t.toStr(n),n?n.split(/\s+/):[]}function i(n){return n=t.toStr(n),n?n.split(/\W+/):[]}function r(n){return function(){var i=[].slice.call(arguments,0);return function(r){var u=[];return t.each(i,function(i){u=u.concat(n(t.toStr(r[i])))}),u}}}return{nonword:i,whitespace:n,obj:{nonword:r(i),whitespace:r(n)}}}(),o=function(){"use strict";function i(i){this.maxSize=t.isNumber(i)?i:100;this.reset();this.maxSize<=0&&(this.set=this.get=n.noop)}function r(){this.head=this.tail=null}function u(n,t){this.key=n;this.val=t;this.prev=this.next=null}return t.mixin(i.prototype,{set:function(n,t){var r=this.list.tail,i;this.size>=this.maxSize&&(this.list.remove(r),delete this.hash[r.key]);(i=this.hash[n])?(i.val=t,this.list.moveToFront(i)):(i=new u(n,t),this.list.add(i),this.hash[n]=i,this.size++)},get:function(n){var t=this.hash[n];if(t)return this.list.moveToFront(t),t.val},reset:function(){this.size=0;this.hash={};this.list=new r}}),t.mixin(r.prototype,{add:function(n){this.head&&(n.next=this.head,this.head.prev=n);this.head=n;this.tail=this.tail||n},remove:function(n){n.prev?n.prev.next=n.next:this.head=n.next;n.next?n.next.prev=n.prev:this.tail=n.prev},moveToFront:function(n){this.remove(n);this.add(n)}}),i}(),v=function(){"use strict";function r(n){this.prefix=["__",n,"__"].join("");this.ttlKey="__ttl__";this.keyMatcher=new RegExp("^"+t.escapeRegExChars(this.prefix))}function u(){return(new Date).getTime()}function f(n){return JSON.stringify(t.isUndefined(n)?null:n)}function e(n){return JSON.parse(n)}var n,i;try{n=window.localStorage;n.setItem("~~~","!");n.removeItem("~~~")}catch(o){n=null}return i=n&&window.JSON?{_prefix:function(n){return this.prefix+n},_ttlKey:function(n){return this._prefix(n)+this.ttlKey},get:function(t){return this.isExpired(t)&&this.remove(t),e(n.getItem(this._prefix(t)))},set:function(i,r,e){return t.isNumber(e)?n.setItem(this._ttlKey(i),f(u()+e)):n.removeItem(this._ttlKey(i)),n.setItem(this._prefix(i),f(r))},remove:function(t){return n.removeItem(this._ttlKey(t)),n.removeItem(this._prefix(t)),this},clear:function(){for(var r,i=[],u=n.length,t=0;t<u;t++)(r=n.key(t)).match(this.keyMatcher)&&i.push(r.replace(this.keyMatcher,""));for(t=i.length;t--;)this.remove(i[t]);return this},isExpired:function(i){var r=e(n.getItem(this._ttlKey(i)));return t.isNumber(r)&&u()>r?!0:!1}}:{get:t.noop,set:t.noop,remove:t.noop,clear:t.noop,isExpired:t.noop},t.mixin(r.prototype,i),r}(),s=function(){"use strict";function i(t){t=t||{};this.cancelled=!1;this.lastUrl=null;this._send=t.transport?s(t.transport):n.ajax;this._get=t.rateLimiter?t.rateLimiter(this._get):this._get;this._cache=t.cache===!1?new o(0):e}function s(i){return function(r,u){function e(n){t.defer(function(){f.resolve(n)})}function o(n){t.defer(function(){f.reject(n)})}var f=n.Deferred();return i(r,u,e,o),f}}var r=0,u={},f=6,e=new o(10);return i.setMaxPendingRequests=function(n){f=n},i.resetCache=function(){e.reset()},t.mixin(i.prototype,{_get:function(n,t,i){function s(t){i&&i(null,t);e._cache.set(n,t)}function h(){i&&i(!0)}function c(){r--;delete u[n];e.onDeckRequestArgs&&(e._get.apply(e,e.onDeckRequestArgs),e.onDeckRequestArgs=null)}var e=this,o;this.cancelled||n!==this.lastUrl||((o=u[n])?o.done(s).fail(h):r<f?(r++,u[n]=this._send(n,t).done(s).fail(h).always(c)):this.onDeckRequestArgs=[].slice.call(arguments,0))},get:function(n,i,r){var u;return t.isFunction(i)&&(r=i,i={}),this.cancelled=!1,this.lastUrl=n,(u=this._cache.get(n))?t.defer(function(){r&&r(null,u)}):this._get(n,i,r),!!u},cancel:function(){this.cancelled=!0}}),i}(),y=function(){"use strict";function i(t){t=t||{};t.datumTokenizer&&t.queryTokenizer||n.error("datumTokenizer and queryTokenizer are both required");this.datumTokenizer=t.datumTokenizer;this.queryTokenizer=t.queryTokenizer;this.reset()}function r(n){return n=t.filter(n,function(n){return!!n}),t.map(n,function(n){return n.toLowerCase()})}function u(){return{ids:[],children:{}}}function f(n){for(var i={},r=[],t=0,u=n.length;t<u;t++)i[n[t]]||(i[n[t]]=!0,r.push(n[t]));return r}function e(n,t){function o(n,t){return n-t}var i=0,r=0,u=[],f,e;for(n=n.sort(o),t=t.sort(o),f=n.length,e=t.length;i<f&&r<e;)n[i]<t[r]?i++:n[i]>t[r]?r++:(u.push(n[i]),i++,r++);return u}return t.mixin(i.prototype,{bootstrap:function(n){this.datums=n.datums;this.trie=n.trie},add:function(n){var i=this;n=t.isArray(n)?n:[n];t.each(n,function(n){var f,e;f=i.datums.push(n)-1;e=r(i.datumTokenizer(n));t.each(e,function(n){for(var r,t=i.trie,e=n.split("");r=e.shift();)t=t.children[r]||(t.children[r]=u()),t.ids.push(f)})})},get:function(n){var u=this,o,i;return o=r(this.queryTokenizer(n)),t.each(o,function(n){var t,r,o,f;if(i&&i.length===0)return!1;for(t=u.trie,r=n.split("");t&&(o=r.shift());)t=t.children[o];if(t&&r.length===0)f=t.ids.slice(0),i=i?e(i,f):f;else return i=[],!1}),i?t.map(f(i),function(n){return u.datums[n]}):[]},reset:function(){this.datums=[];this.trie=u()},serialize:function(){return{datums:this.datums,trie:this.trie}}}),i}(),f=function(){"use strict";function i(n){return n.local||null}function r(i){var r,u;return u={url:null,thumbprint:"",ttl:864e5,filter:null,ajax:{}},(r=i.prefetch||null)&&(r=t.isString(r)?{url:r}:r,r=t.mixin(u,r),r.thumbprint=l+r.thumbprint,r.ajax.type=r.ajax.type||"GET",r.ajax.dataType=r.ajax.dataType||"json",r.url||n.error("prefetch requires url to be set")),r}function u(i){function f(n){return function(i){return t.debounce(i,n)}}function e(n){return function(i){return t.throttle(i,n)}}var r,u;return u={url:null,cache:!0,wildcard:"%QUERY",replace:null,rateLimitBy:"debounce",rateLimitWait:300,send:null,filter:null,ajax:{}},(r=i.remote||null)&&(r=t.isString(r)?{url:r}:r,r=t.mixin(u,r),r.rateLimiter=/^throttle$/i.test(r.rateLimitBy)?e(r.rateLimitWait):f(r.rateLimitWait),r.ajax.type=r.ajax.type||"GET",r.ajax.dataType=r.ajax.dataType||"json",delete r.rateLimitBy,delete r.rateLimitWait,r.url||n.error("remote requires url to be set")),r}return{local:i,prefetch:r,remote:u}}();(function(i){"use strict";function u(t){t&&(t.local||t.prefetch||t.remote)||n.error("one of local, prefetch, or remote is required");this.limit=t.limit||5;this.sorter=o(t.sorter);this.dupDetector=t.dupDetector||h;this.local=f.local(t);this.prefetch=f.prefetch(t);this.remote=f.remote(t);this.cacheKey=this.prefetch?this.prefetch.cacheKey||this.prefetch.url:null;this.index=new y({datumTokenizer:t.datumTokenizer,queryTokenizer:t.queryTokenizer});this.storage=this.cacheKey?new v(this.cacheKey):null}function o(n){function i(t){return t.sort(n)}function r(n){return n}return t.isFunction(n)?i:r}function h(){return!1}var e,r;return e=i.Bloodhound,r={data:"data",protocol:"protocol",thumbprint:"thumbprint"},i.Bloodhound=u,u.noConflict=function(){return i.Bloodhound=e,u},u.tokenizers=a,t.mixin(u.prototype,{_loadPrefetch:function(t){function f(n){i.clear();i.add(t.filter?t.filter(n):n);i._saveToStorage(i.index.serialize(),t.thumbprint,t.ttl)}var i=this,u,r;return(u=this._readFromStorage(t.thumbprint))?(this.index.bootstrap(u),r=n.Deferred().resolve()):r=n.ajax(t.url,t.ajax).done(f),r},_getFromRemote:function(n,t){function f(n,r){n?t([]):t(i.remote.filter?i.remote.filter(r):r)}var i=this,r,u;if(this.transport)return n=n||"",u=encodeURIComponent(n),r=this.remote.replace?this.remote.replace(this.remote.url,n):this.remote.url.replace(this.remote.wildcard,u),this.transport.get(r,this.remote.ajax,f)},_cancelLastRemoteRequest:function(){this.transport&&this.transport.cancel()},_saveToStorage:function(n,t,i){this.storage&&(this.storage.set(r.data,n,i),this.storage.set(r.protocol,location.protocol,i),this.storage.set(r.thumbprint,t,i))},_readFromStorage:function(n){var t={},i;return this.storage&&(t.data=this.storage.get(r.data),t.protocol=this.storage.get(r.protocol),t.thumbprint=this.storage.get(r.thumbprint)),i=t.thumbprint!==n||t.protocol!==location.protocol,t.data&&!i?t.data:null},_initialize:function(){function f(){u.add(t.isFunction(i)?i():i)}var u=this,i=this.local,r;return r=this.prefetch?this._loadPrefetch(this.prefetch):n.Deferred().resolve(),i&&r.done(f),this.transport=this.remote?new s(this.remote):null,this.initPromise=r.promise()},initialize:function(n){return!this.initPromise||n?this._initialize():this.initPromise},add:function(n){this.index.add(n)},get:function(n,i){function e(n){var f=r.slice(0);t.each(n,function(n){var i;return i=t.some(f,function(t){return u.dupDetector(n,t)}),i||f.push(n),f.length<u.limit});i&&i(u.sorter(f))}var u=this,r=[],f=!1;r=this.index.get(n);r=this.sorter(r).slice(0,this.limit);r.length<this.limit?f=this._getFromRemote(n,e):this._cancelLastRemoteRequest();f||(r.length>0||!this.transport)&&i&&i(r)},clear:function(){this.index.reset()},clearPrefetchCache:function(){this.storage&&this.storage.clear()},clearRemoteCache:function(){this.transport&&s.resetCache()},ttAdapter:function(){return t.bind(this.get,this)}}),u})(this);var r=function(){return{wrapper:'<span class="twitter-typeahead"><\/span>',dropdown:'<span class="tt-dropdown-menu"><\/span>',dataset:'<div class="tt-dataset-%CLASS%"><\/div>',suggestions:'<span class="tt-suggestions"><\/span>',suggestion:'<div class="tt-suggestion"><\/div>'}}(),i=function(){"use strict";var n={wrapper:{position:"relative",display:"inline-block"},hint:{position:"absolute",top:"0",left:"0",borderColor:"transparent",boxShadow:"none",opacity:"1"},input:{position:"relative",verticalAlign:"top",backgroundColor:"transparent"},inputWithNoHint:{position:"relative",verticalAlign:"top"},dropdown:{position:"absolute",top:"100%",left:"0",zIndex:"100",display:"none"},suggestions:{display:"block"},suggestion:{whiteSpace:"nowrap",cursor:"pointer"},suggestionChild:{whiteSpace:"normal"},ltr:{left:"0",right:"auto"},rtl:{left:"auto",right:" 0"}};return t.isMsie()&&t.mixin(n.input,{backgroundImage:"url(data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)"}),t.isMsie()&&t.isMsie()<=7&&t.mixin(n.input,{marginTop:"-1px"}),n}(),h=function(){"use strict";function i(t){t&&t.el||n.error("EventBus initialized without el");this.$el=n(t.el)}var r="typeahead:";return t.mixin(i.prototype,{trigger:function(n){var t=[].slice.call(arguments,1);this.$el.trigger(r+n,t)}}),i}(),e=function(){"use strict";function t(t,i,r,u){var f;if(!r)return this;for(i=i.split(n),r=u?h(r,u):r,this._callbacks=this._callbacks||{};f=i.shift();)this._callbacks[f]=this._callbacks[f]||{sync:[],async:[]},this._callbacks[f][t].push(r);return this}function u(n,i,r){return t.call(this,"async",n,i,r)}function f(n,i,r){return t.call(this,"sync",n,i,r)}function e(t){var i;if(!this._callbacks)return this;for(t=t.split(n);i=t.shift();)delete this._callbacks[i];return this}function o(t){var u,f,e,o,s;if(!this._callbacks)return this;for(t=t.split(n),e=[].slice.call(arguments,1);(u=t.shift())&&(f=this._callbacks[u]);)o=i(f.sync,this,[u].concat(e)),s=i(f.async,this,[u].concat(e)),o()&&r(s);return this}function i(n,t,i){function r(){for(var r,u=0,f=n.length;!r&&u<f;u+=1)r=n[u].apply(t,i)===!1;return!r}return r}function s(){return window.setImmediate?function(n){setImmediate(function(){n()})}:function(n){setTimeout(function(){n()},0)}}function h(n,t){return n.bind?n.bind(t):function(){n.apply(t,[].slice.call(arguments,0))}}var n=/\s+/,r=s();return{onSync:f,onAsync:u,off:e,trigger:o}}(),p=function(n){"use strict";function r(n,i,r){for(var u=[],f,e=0,o=n.length;e<o;e++)u.push(t.escapeRegExChars(n[e]));return f=r?"\\b("+u.join("|")+")\\b":"("+u.join("|")+")",i?new RegExp(f):new RegExp(f,"i")}var i={node:null,pattern:null,tagName:"strong",className:null,wordsOnly:!1,caseSensitive:!1};return function(u){function o(t){var i,r,e;return(i=f.exec(t.data))&&(e=n.createElement(u.tagName),u.className&&(e.className=u.className),r=t.splitText(i.index),r.splitText(i[0].length),e.appendChild(r.cloneNode(!0)),t.parentNode.replaceChild(e,r)),!!i}function e(n,t){for(var i,r=0;r<n.childNodes.length;r++)i=n.childNodes[r],i.nodeType===3?r+=t(i)?1:0:e(i,t)}var f;(u=t.mixin({},i,u),u.node&&u.pattern)&&(u.pattern=t.isArray(u.pattern)?u.pattern:[u.pattern],f=r(u.pattern,u.caseSensitive,u.wordsOnly),e(u.node,o))}}(window.document),c=function(){"use strict";function i(i){var u=this,e,o,s,h;if(i=i||{},i.input||n.error("input is missing"),e=t.bind(this._onBlur,this),o=t.bind(this._onFocus,this),s=t.bind(this._onKeydown,this),h=t.bind(this._onInput,this),this.$hint=n(i.hint),this.$input=n(i.input).on("blur.tt",e).on("focus.tt",o).on("keydown.tt",s),this.$hint.length===0&&(this.setHint=this.getHint=this.clearHint=this.clearHintIfInvalid=t.noop),t.isMsie())this.$input.on("keydown.tt keypress.tt cut.tt paste.tt",function(n){r[n.which||n.keyCode]||t.defer(t.bind(u._onInput,u,n))});else this.$input.on("input.tt",h);this.query=this.$input.val();this.$overflowHelper=f(this.$input)}function f(t){return n('<pre aria-hidden="true"><\/pre>').css({position:"absolute",visibility:"hidden",whiteSpace:"pre",fontFamily:t.css("font-family"),fontSize:t.css("font-size"),fontStyle:t.css("font-style"),fontVariant:t.css("font-variant"),fontWeight:t.css("font-weight"),wordSpacing:t.css("word-spacing"),letterSpacing:t.css("letter-spacing"),textIndent:t.css("text-indent"),textRendering:t.css("text-rendering"),textTransform:t.css("text-transform")}).insertAfter(t)}function o(n,t){return i.normalizeQuery(n)===i.normalizeQuery(t)}function u(n){return n.altKey||n.ctrlKey||n.metaKey||n.shiftKey}var r;return r={9:"tab",27:"esc",37:"left",39:"right",13:"enter",38:"up",40:"down"},i.normalizeQuery=function(n){return(n||"").replace(/^\s*/g,"").replace(/\s{2,}/g," ")},t.mixin(i.prototype,e,{_onBlur:function(){this.resetInputValue();this.trigger("blurred")},_onFocus:function(){this.trigger("focused")},_onKeydown:function(n){var t=r[n.which||n.keyCode];this._managePreventDefault(t,n);t&&this._shouldTrigger(t,n)&&this.trigger(t+"Keyed",n)},_onInput:function(){this._checkInputValue()},_managePreventDefault:function(n,t){var i,r,f;switch(n){case"tab":r=this.getHint();f=this.getInputValue();i=r&&r!==f&&!u(t);break;case"up":case"down":i=!u(t);break;default:i=!1}i&&t.preventDefault()},_shouldTrigger:function(n,t){var i;switch(n){case"tab":i=!u(t);break;default:i=!0}return i},_checkInputValue:function(){var n,t,i;n=this.getInputValue();t=o(n,this.query);i=t?this.query.length!==n.length:!1;this.query=n;t?i&&this.trigger("whitespaceChanged",this.query):this.trigger("queryChanged",this.query)},focus:function(){this.$input.focus()},blur:function(){this.$input.blur()},getQuery:function(){return this.query},setQuery:function(n){this.query=n},getInputValue:function(){return this.$input.val()},setInputValue:function(n,t){this.$input.val(n);t?this.clearHint():this._checkInputValue()},resetInputValue:function(){this.setInputValue(this.query,!0)},getHint:function(){return this.$hint.val()},setHint:function(n){this.$hint.val(n)},clearHint:function(){this.setHint("")},clearHintIfInvalid:function(){var n,t,i,r;n=this.getInputValue();t=this.getHint();i=n!==t&&t.indexOf(n)===0;r=n!==""&&i&&!this.hasOverflow();r||this.clearHint()},getLanguageDirection:function(){return(this.$input.css("direction")||"ltr").toLowerCase()},hasOverflow:function(){var n=this.$input.width()-2;return this.$overflowHelper.text(this.getInputValue()),this.$overflowHelper.width()>=n},isCursorAtEnd:function(){var n,i,r;return(n=this.$input.val().length,i=this.$input[0].selectionStart,t.isNumber(i))?i===n:document.selection?(r=document.selection.createRange(),r.moveStart("character",-n),n===r.text.length):!0},destroy:function(){this.$hint.off(".tt");this.$input.off(".tt");this.$hint=this.$input=this.$overflowHelper=null}}),i}(),u=function(){"use strict";function u(i){i=i||{};i.templates=i.templates||{};i.source||n.error("missing source");i.name&&!l(i.name)&&n.error("invalid dataset name: "+i.name);this.query=null;this.highlight=!!i.highlight;this.name=i.name||t.getUniqueId();this.source=i.source;this.displayFn=h(i.display||i.displayKey);this.templates=c(i.templates,this.displayFn);this.$el=n(r.dataset.replace("%CLASS%",this.name))}function h(n){function i(t){return t[n]}return n=n||"value",t.isFunction(n)?n:i}function c(n,i){function r(n){return"<p>"+i(n)+"<\/p>"}return{empty:n.empty&&t.templatify(n.empty),header:n.header&&t.templatify(n.header),footer:n.footer&&t.templatify(n.footer),suggestion:n.suggestion||r}}function l(n){return/^[_a-zA-Z0-9-]+$/.test(n)}var f="ttDataset",o="ttValue",s="ttDatum";return u.extractDatasetName=function(t){return n(t).data(f)},u.extractValue=function(t){return n(t).data(o)},u.extractDatum=function(t){return n(t).data(s)},t.mixin(u.prototype,e,{_render:function(u,e){function v(){return h.templates.empty({query:u,isEmpty:!0})}function y(){function a(t){var u;return u=n(r.suggestion).append(h.templates.suggestion(t)).data(f,h.name).data(o,h.displayFn(t)).data(s,t),u.children().each(function(){n(this).css(i.suggestionChild)}),u}var c,l;return c=n(r.suggestions).css(i.suggestions),l=t.map(e,a),c.append.apply(c,l),h.highlight&&p({className:"tt-highlight",node:c[0],pattern:u}),c}function l(){return h.templates.header({query:u,isEmpty:!c})}function a(){return h.templates.footer({query:u,isEmpty:!c})}if(this.$el){var h=this,c;this.$el.empty();c=e&&e.length;!c&&this.templates.empty?this.$el.html(v()).prepend(h.templates.header?l():null).append(h.templates.footer?a():null):c&&this.$el.html(y()).prepend(h.templates.header?l():null).append(h.templates.footer?a():null);this.trigger("rendered")}},getRoot:function(){return this.$el},update:function(n){function i(i){t.canceled||n!==t.query||t._render(n,i)}var t=this;this.query=n;this.canceled=!1;this.source(n,i)},cancel:function(){this.canceled=!0},clear:function(){this.cancel();this.$el.empty();this.trigger("rendered")},isEmpty:function(){return this.$el.is(":empty")},destroy:function(){this.$el=null}}),u}(),w=function(){"use strict";function r(i){var r=this,u,e,o;i=i||{};i.menu||n.error("menu is required");this.isOpen=!1;this.isEmpty=!0;this.datasets=t.map(i.datasets,f);u=t.bind(this._onSuggestionClick,this);e=t.bind(this._onSuggestionMouseEnter,this);o=t.bind(this._onSuggestionMouseLeave,this);this.$menu=n(i.menu).on("click.tt",".tt-suggestion",u).on("mouseenter.tt",".tt-suggestion",e).on("mouseleave.tt",".tt-suggestion",o);t.each(this.datasets,function(n){r.$menu.append(n.getRoot());n.onSync("rendered",r._onRendered,r)})}function f(n){return new u(n)}return t.mixin(r.prototype,e,{_onSuggestionClick:function(t){this.trigger("suggestionClicked",n(t.currentTarget))},_onSuggestionMouseEnter:function(t){this._removeCursor();this._setCursor(n(t.currentTarget),!0)},_onSuggestionMouseLeave:function(){this._removeCursor()},_onRendered:function(){function n(n){return n.isEmpty()}this.isEmpty=t.every(this.datasets,n);this.isEmpty?this._hide():this.isOpen&&this._show();this.trigger("datasetRendered")},_hide:function(){this.$menu.hide()},_show:function(){this.$menu.css("display","block")},_getSuggestions:function(){return this.$menu.find(".tt-suggestion")},_getCursor:function(){return this.$menu.find(".tt-cursor").first()},_setCursor:function(n,t){n.first().addClass("tt-cursor");t||this.trigger("cursorMoved")},_removeCursor:function(){this._getCursor().removeClass("tt-cursor")},_moveCursor:function(n){var i,r,t,u;if(this.isOpen){if(r=this._getCursor(),i=this._getSuggestions(),this._removeCursor(),t=i.index(r)+n,t=(t+1)%(i.length+1)-1,t===-1){this.trigger("cursorRemoved");return}t<-1&&(t=i.length-1);this._setCursor(u=i.eq(t));this._ensureVisible(u)}},_ensureVisible:function(n){var t,i,r,u;t=n.position().top;i=t+n.outerHeight(!0);r=this.$menu.scrollTop();u=this.$menu.height()+parseInt(this.$menu.css("paddingTop"),10)+parseInt(this.$menu.css("paddingBottom"),10);t<0?this.$menu.scrollTop(r+t):u<i&&this.$menu.scrollTop(r+(i-u))},close:function(){this.isOpen&&(this.isOpen=!1,this._removeCursor(),this._hide(),this.trigger("closed"))},open:function(){this.isOpen||(this.isOpen=!0,this.isEmpty||this._show(),this.trigger("opened"))},setLanguageDirection:function(n){this.$menu.css(n==="ltr"?i.ltr:i.rtl)},moveCursorUp:function(){this._moveCursor(-1)},moveCursorDown:function(){this._moveCursor(1)},getDatumForSuggestion:function(n){var t=null;return n.length&&(t={raw:u.extractDatum(n),value:u.extractValue(n),datasetName:u.extractDatasetName(n)}),t},getDatumForCursor:function(){return this.getDatumForSuggestion(this._getCursor().first())},getDatumForTopSuggestion:function(){return this.getDatumForSuggestion(this._getSuggestions().first())},update:function(n){function i(t){t.update(n)}t.each(this.datasets,i)},empty:function(){function n(n){n.clear()}t.each(this.datasets,n);this.isEmpty=!0},isVisible:function(){return this.isOpen&&!this.isEmpty},destroy:function(){function n(n){n.destroy()}this.$menu.off(".tt");this.$menu=null;t.each(this.datasets,n)}}),r}(),b=function(){"use strict";function f(i){var r,u,f;i=i||{};i.input||n.error("missing input");this.isActivated=!1;this.autoselect=!!i.autoselect;this.minLength=t.isNumber(i.minLength)?i.minLength:1;this.$node=e(i.input,i.withHint);r=this.$node.find(".tt-dropdown-menu");u=this.$node.find(".tt-input");f=this.$node.find(".tt-hint");u.on("blur.tt",function(n){var i,f,e;i=document.activeElement;f=r.is(i);e=r.has(i).length>0;t.isMsie()&&(f||e)&&(n.preventDefault(),n.stopImmediatePropagation(),t.defer(function(){u.focus()}))});r.on("mousedown.tt",function(n){n.preventDefault()});this.eventBus=i.eventBus||new h({el:u});this.dropdown=new w({menu:r,datasets:i.datasets}).onSync("suggestionClicked",this._onSuggestionClicked,this).onSync("cursorMoved",this._onCursorMoved,this).onSync("cursorRemoved",this._onCursorRemoved,this).onSync("opened",this._onOpened,this).onSync("closed",this._onClosed,this).onAsync("datasetRendered",this._onDatasetRendered,this);this.input=new c({input:u,hint:f}).onSync("focused",this._onFocused,this).onSync("blurred",this._onBlurred,this).onSync("enterKeyed",this._onEnterKeyed,this).onSync("tabKeyed",this._onTabKeyed,this).onSync("escKeyed",this._onEscKeyed,this).onSync("upKeyed",this._onUpKeyed,this).onSync("downKeyed",this._onDownKeyed,this).onSync("leftKeyed",this._onLeftKeyed,this).onSync("rightKeyed",this._onRightKeyed,this).onSync("queryChanged",this._onQueryChanged,this).onSync("whitespaceChanged",this._onWhitespaceChanged,this);this._setLanguageDirection()}function e(t,f){var e,h,c,s;e=n(t);h=n(r.wrapper).css(i.wrapper);c=n(r.dropdown).css(i.dropdown);s=e.clone().css(i.hint).css(o(e));s.val("").removeData().addClass("tt-hint").removeAttr("id name placeholder required").prop("readonly",!0).attr({autocomplete:"off",spellcheck:"false",tabindex:-1});e.data(u,{dir:e.attr("dir"),autocomplete:e.attr("autocomplete"),spellcheck:e.attr("spellcheck"),style:e.attr("style")});e.addClass("tt-input").attr({autocomplete:"off",spellcheck:!1}).css(f?i.input:i.inputWithNoHint);try{e.attr("dir")||e.attr("dir","auto")}catch(l){}return e.wrap(h).parent().prepend(f?s:null).append(c)}function o(n){return{backgroundAttachment:n.css("background-attachment"),backgroundClip:n.css("background-clip"),backgroundColor:n.css("background-color"),backgroundImage:n.css("background-image"),backgroundOrigin:n.css("background-origin"),backgroundPosition:n.css("background-position"),backgroundRepeat:n.css("background-repeat"),backgroundSize:n.css("background-size")}}function s(n){var i=n.find(".tt-input");t.each(i.data(u),function(n,r){t.isUndefined(n)?i.removeAttr(r):i.attr(r,n)});i.detach().removeData(u).removeClass("tt-input").insertAfter(n);n.remove()}var u="ttAttrs";return t.mixin(f.prototype,{_onSuggestionClicked:function(n,t){var i;(i=this.dropdown.getDatumForSuggestion(t))&&this._select(i)},_onCursorMoved:function(){var n=this.dropdown.getDatumForCursor();this.input.setInputValue(n.value,!0);this.eventBus.trigger("cursorchanged",n.raw,n.datasetName)},_onCursorRemoved:function(){this.input.resetInputValue();this._updateHint()},_onDatasetRendered:function(){this._updateHint()},_onOpened:function(){this._updateHint();this.eventBus.trigger("opened")},_onClosed:function(){this.input.clearHint();this.eventBus.trigger("closed")},_onFocused:function(){this.isActivated=!0;this.dropdown.open()},_onBlurred:function(){this.isActivated=!1;this.dropdown.empty();this.dropdown.close()},_onEnterKeyed:function(n,t){var i,r;i=this.dropdown.getDatumForCursor();r=this.dropdown.getDatumForTopSuggestion();i?(this._select(i),t.preventDefault()):this.autoselect&&r&&(this._select(r),t.preventDefault())},_onTabKeyed:function(n,t){var i;(i=this.dropdown.getDatumForCursor())?(this._select(i),t.preventDefault()):this._autocomplete(!0)},_onEscKeyed:function(){this.dropdown.close();this.input.resetInputValue()},_onUpKeyed:function(){var n=this.input.getQuery();this.dropdown.isEmpty&&n.length>=this.minLength?this.dropdown.update(n):this.dropdown.moveCursorUp();this.dropdown.open()},_onDownKeyed:function(){var n=this.input.getQuery();this.dropdown.isEmpty&&n.length>=this.minLength?this.dropdown.update(n):this.dropdown.moveCursorDown();this.dropdown.open()},_onLeftKeyed:function(){this.dir==="rtl"&&this._autocomplete()},_onRightKeyed:function(){this.dir==="ltr"&&this._autocomplete()},_onQueryChanged:function(n,t){this.input.clearHintIfInvalid();t.length>=this.minLength?this.dropdown.update(t):this.dropdown.empty();this.dropdown.open();this._setLanguageDirection()},_onWhitespaceChanged:function(){this._updateHint();this.dropdown.open()},_setLanguageDirection:function(){var n;this.dir!==(n=this.input.getLanguageDirection())&&(this.dir=n,this.$node.css("direction",n),this.dropdown.setLanguageDirection(n))},_updateHint:function(){var n,i,u,f,e,r;n=this.dropdown.getDatumForTopSuggestion();n&&this.dropdown.isVisible()&&!this.input.hasOverflow()?(i=this.input.getInputValue(),u=c.normalizeQuery(i),f=t.escapeRegExChars(u),e=new RegExp("^(?:"+f+")(.+$)","i"),r=e.exec(n.value),r?this.input.setHint(i+r[1]):this.input.clearHint()):this.input.clearHint()},_autocomplete:function(n){var i,r,u,t;i=this.input.getHint();r=this.input.getQuery();u=n||this.input.isCursorAtEnd();i&&r!==i&&u&&(t=this.dropdown.getDatumForTopSuggestion(),t&&this.input.setInputValue(t.value),this.eventBus.trigger("autocompleted",t.raw,t.datasetName))},_select:function(n){this.input.setQuery(n.value);this.input.setInputValue(n.value,!0);this._setLanguageDirection();this.eventBus.trigger("selected",n.raw,n.datasetName);this.dropdown.close();t.defer(t.bind(this.dropdown.empty,this.dropdown))},open:function(){this.dropdown.open()},close:function(){this.dropdown.close()},setVal:function(n){n=t.toStr(n);this.isActivated?this.input.setInputValue(n):(this.input.setQuery(n),this.input.setInputValue(n,!0));this._setLanguageDirection()},getVal:function(){return this.input.getQuery()},destroy:function(){this.input.destroy();this.dropdown.destroy();s(this.$node);this.$node=null}}),f}();(function(){"use strict";var u,i,r;u=n.fn.typeahead;i="ttTypeahead";r={initialize:function(r,u){function f(){var f=n(this),o,e;t.each(u,function(n){n.highlight=!!r.highlight});e=new b({input:f,eventBus:o=new h({el:f}),withHint:t.isUndefined(r.hint)?!0:!!r.hint,minLength:r.minLength,autoselect:r.autoselect,datasets:u});f.data(i,e)}return u=t.isArray(u)?u:[].slice.call(arguments,1),r=r||{},this.each(f)},open:function(){function t(){var r=n(this),t;(t=r.data(i))&&t.open()}return this.each(t)},close:function(){function t(){var r=n(this),t;(t=r.data(i))&&t.close()}return this.each(t)},val:function(t){function r(){var u=n(this),r;(r=u.data(i))&&r.setVal(t)}function u(n){var t,r;return(t=n.data(i))&&(r=t.getVal()),r}return arguments.length?this.each(r):u(this.first())},destroy:function(){function t(){var t=n(this),r;(r=t.data(i))&&(r.destroy(),t.removeData(i))}return this.each(t)}};n.fn.typeahead=function(t){var u;return r[t]&&t!=="initialize"?(u=this.filter(function(){return!!n(this).data(i)}),r[t].apply(u,[].slice.call(arguments,1))):r.initialize.apply(this,arguments)};n.fn.typeahead.noConflict=function(){return n.fn.typeahead=u,this}})()})(window.jQuery);EC_TYPEAHEAD_NOMINATIM_TRANSLATIONS={de:{geocoder:{search_osm_nominatim:{prefix:{aerialway:{chair_lift:"Sessellift",drag_lift:"Schlepplift",station:"Gondelstation"},aeroway:{aerodrome:"Flugplatz",apron:"Flugvorfeld",gate:"Flugsteig",helipad:"Hubschrauberlandeplatz",runway:"Start- und Landebahn",taxiway:"Rollbahn",terminal:"Terminal"},amenity:{airport:"Flughafen",arts_centre:"Kulturzentrum",artwork:"Kunstwerk",atm:"Geldautomat",auditorium:"Hörsaal",bank:"Bank",bar:"Bar",bbq:"Grillplatz",bench:"Bank",bicycle_parking:"Fahrrad-Stellplatz",bicycle_rental:"Fahrradverleih",biergarten:"Biergarten",brothel:"Bordell",bureau_de_change:"Wechselstube",bus_station:"Busbahnhof",cafe:"Café",car_rental:"Autovermietung",car_sharing:"Carsharing",car_wash:"Autowaschanlage",casino:"Casino",charging_station:"Ladestation",cinema:"Kino",clinic:"Krankenhaus",club:"Club",college:"Hochschule",community_centre:"Gemeindezentrum",courthouse:"Gericht",crematorium:"Krematorium",dentist:"Zahnarzt",doctors:"Arzt",dormitory:"Studentenwohnheim",drinking_water:"Trinkwasser",driving_school:"Fahrschule",embassy:"Botschaft",emergency_phone:"Notrufsäule",fast_food:"Schnellimbiss",ferry_terminal:"Fähren-Anlaufstelle",fire_hydrant:"Hydrant",fire_station:"Feuerwehr",food_court:"Food-Court",fountain:"Springbrunnen",fuel:"Tankstelle",grave_yard:"Friedhof",gym:"Fitnessstudio",hall:"Halle",health_centre:"Gesundheitszentrum",hospital:"Krankenhaus",hotel:"Hotel",hunting_stand:"Hochstand",ice_cream:"Eisdiele",kindergarten:"Kindergarten",library:"Bücherei",market:"Markt",marketplace:"Marktplatz",mountain_rescue:"Bergrettung",nightclub:"Nachtklub",nursery:"Kindertagesstätte",nursing_home:"Altersheim",office:"Büro",park:"Park",parking:"Parkplatz",pharmacy:"Apotheke",place_of_worship:"Andachtsstätte",police:"Polizei",post_box:"Briefkasten",post_office:"Postamt",preschool:"Vorschule",prison:"Gefängnis",pub:"Pub",public_building:"Öffentliches Gebäude",public_market:"Öffentlicher Markt",reception_area:"Empfangsbereich",recycling:"Recycling-Center",restaurant:"Restaurant",retirement_home:"Altersheim",sauna:"Sauna",school:"Schule",shelter:"Unterstand",shop:"Geschäft",shopping:"Einkaufszentrum",shower:"Dusche",social_centre:"Sozialzentrum",social_club:"Social Club",social_facility:"Soziale Einrichtung",studio:"Studio",supermarket:"Supermarkt",swimming_pool:"Schwimmbecken",taxi:"Taxi",telephone:"Telefonzelle",theatre:"Theater",toilets:"WC",townhall:"Rathaus",university:"Universität",vending_machine:"Selbstbedienungsautomat",veterinary:"Tierarzt",village_hall:"Gemeindeamt",waste_basket:"Mülleimer",wifi:"WLAN-Zugangspunkt",WLAN:"WLAN-Zugangspunkt",youth_centre:"Jugendzentrum"},boundary:{administrative:"Verwaltungsgrenze",census:"Grenze des Volkszählungsgebiets",national_park:"Nationalpark",protected_area:"Schutzgebiet"},bridge:{aqueduct:"Aquädukt",suspension:"Hängebrücke",swing:"Drehbrücke",viaduct:"Viadukt",yes:"Brücke"},building:{yes:"Gebäude"},emergency:{fire_hydrant:"Hydrant",phone:"Notrufsäule"},highway:{bridleway:"Reitweg",bus_guideway:"Busspur",bus_stop:"Bushaltestelle",byway:"Seitenweg (brit.)",construction:"Straße im Bau",cycleway:"Radweg",emergency_access_point:"Notrufpunkt",footway:"Fußweg",ford:"Furt",living_street:"Spiel-/Wohnstraße",milestone:"Kilometerstein",minor:"Nebenstraße",motorway:"Autobahn",motorway_junction:"Autobahnausfahrt/-kreuz",motorway_link:"Autobahnauffahrt",path:"Pfad (Wanderweg)",pedestrian:"Fußgängerzone",platform:"Bahnsteig",primary:"Bundesstraße",primary_link:"Bundesstraße-Auffahrt",proposed:"Geplante Straße",raceway:"Rennstrecke",residential:"Wohnstraße",rest_area:"Rastplatz",road:"Straße",secondary:"Landesstraße",secondary_link:"Landesstraße-Auffahrt",service:"Zufahrtsstraße",services:"Autobahnraststätte",speed_camera:"Blitzer",steps:"Treppe",street_lamp:"Straßenlaterne",stile:"Zaunübertritt",tertiary:"Gemeindestraße",tertiary_link:"Tertiärstraße-Auffahrt",track:"Feldweg",trail:"Pfad",trunk:"Schnellstraße",trunk_link:"Schnellstraßenauffahrt",unclassified:"Straße",unsurfaced:"Nichtasphaltierte Straße"},historic:{archaeological_site:"Ausgrabungsstätte",battlefield:"Kampfgebiet",boundary_stone:"Grenzstein",building:"Historisches Gebäude",castle:"Schloss",church:"Kirche",citywalls:"Stadtmauern",fort:"Fort",house:"Historisches Haus",icon:"Symbol",manor:"Gutshaus",memorial:"Denkmal",mine:"Mine",monument:"Monument",museum:"Museum",ruins:"Ruine",tomb:"Grabstätte",tower:"Historischer Turm",wayside_cross:"Wegkreuz",wayside_shrine:"Bildstock",wreck:"Schiffswrack"},landuse:{allotments:"Kleingärten",basin:"Becken",brownfield:"Brache",cemetery:"Friedhof",commercial:"Gewerbegebiet",conservation:"Naturschutzgebiet",construction:"Baustelle",farm:"Bauernhof",farmland:"Acker",farmyard:"Bauernhof",forest:"Wald",garages:"Garagen",grass:"Wiese",greenfield:"unerschlossene Fläche",industrial:"Industriegebiet",landfill:"Deponie",meadow:"Wiese",military:"Militärgebiet",mine:"Mine",orchard:"Obstgarten",nature_reserve:"Naturschutzgebiet",park:"Park",piste:"Piste",quarry:"Steinbruch",railway:"Bahnkörper",recreation_ground:"Erholungsgebiet",reservoir:"Reservoir",reservoir_watershed:"Wassereinzugsgebiet",residential:"Siedlung",retail:"Einzelhandel",road:"Straßenfläche",village_green:"Dorfwiese (brit.)",vineyard:"Weingut",wetland:"Feuchtgebiet",wood:"Wald"},leisure:{beach_resort:"Strandbad",bird_hide:"Vogelbeobachtungshütte",common:"öffentliche Grünfläche (brit.)",fishing:"Fischereigrund",fitness_station:"Fitnessstudio",garden:"Garten",golf_course:"Golfplatz",ice_rink:"Eislaufplatz",marina:"Sporthafen",miniature_golf:"Minigolf",nature_reserve:"Naturschutzgebiet",park:"Park",pitch:"Sportplatz",playground:"Spielplatz",recreation_ground:"Erholungsgebiet",sauna:"Sauna",slipway:"Slipanlage",sports_centre:"Sportzentrum",stadium:"Stadion",swimming_pool:"Schwimmbecken",track:"Laufbahn",water_park:"Wasserpark"},military:{airfield:"Militärflugplatz",barracks:"Kaserne",bunker:"Bunker"},mountain_pass:{yes:"Gebirgspass"},natural:{bay:"Bucht",beach:"Strand",cape:"Kap",cave_entrance:"Höhleneingang",channel:"Kanal",cliff:"Klippe",crater:"Krater",dune:"Düne",feature:"Feature",fell:"Weide",fjord:"Fjord",forest:"Wald",geyser:"Geysir",glacier:"Gletscher",heath:"Heide",hill:"Hügel",island:"Insel",land:"Land",marsh:"Marsch",moor:"Moor",mud:"Schlick",peak:"Gipfel",point:"Punkt",reef:"Riff",ridge:"Grat",river:"Fluss",rock:"Steine",scree:"Geröll",scrub:"Buschland",shoal:"Untiefe",spring:"Quelle",stone:"Findling",strait:"Straße",tree:"Baum",valley:"Tal",volcano:"Vulkan",water:"Wasser",wetland:"Feuchtgebiet",wetlands:"Feuchtgebiet",wood:"Wald"},office:{accountant:"Buchhaltungsbüro",architect:"Architekt",company:"Unternehmen",employment_agency:"Arbeitsamt",estate_agent:"Immobilienhändler",government:"Amt",insurance:"Krankenversicherungsbüro",lawyer:"Rechtsanwalt",ngo:"NGO",telecommunication:"Postamt",travel_agent:"Reisebüro",yes:"Büro"},place:{airport:"Flughafen",city:"Stadt",country:"Staat",county:"Bezirk",farm:"Bauernhof",hamlet:"Weiler",house:"Haus",houses:"Häuser",island:"Insel",islet:"Eiland",isolated_dwelling:"Einzelgehöft",locality:"Flur",moor:"Moor",municipality:"Gemeinde",neighbourhood:"Wohngegend",postcode:"Postleitzahl",region:"Region",sea:"Meer",state:"Bundesland/-staat",subdivision:"Vorort",suburb:"Stadtteil",town:"Stadt",unincorporated_area:"Gemeindefreies Gebiet",village:"Dorf"},railway:{abandoned:"Aufgelassene Bahnstrecke",construction:"Eisenbahn im Bau",disused:"Aufgelassene Bahnstrecke",disused_station:"Aufgelassener Bahnhof",funicular:"Standseilbahn",halt:"Haltepunkt",historic_station:"Ehemaliger Bahnhof",junction:"Bahnknoten",level_crossing:"Eisenbahnkreuzung",light_rail:"Stadtbahn",miniature:"Miniaturbahn",monorail:"Einschienenbahn",narrow_gauge:"Schmalspurbahn",platform:"Bahnsteig",preserved:"Museumsbahn",proposed:"Geplante Bahnstrecke",spur:"Anschlussgleis",station:"Bahnhof",stop:"Haltepunkt",subway:"U-Bahn-Station",subway_entrance:"U-Bahn-Eingang","switch":"Weiche",tram:"Straßenbahn",tram_stop:"Haltestelle",yard:"Rangierbahnhof"},route:{bus:"Buslinie"},shop:{alcohol:"Spirituosenladen",antiques:"Antiquitätengeschäft",art:"Kunstladen",bakery:"Bäckerei",beauty:"Parfümerie",beverages:"Getränkemarkt",bicycle:"Fahrradgeschäft",books:"Buchgeschäft",boutique:"Boutique",butcher:"Metzgerei",car:"Autohaus",car_parts:"Autoteilehändler",car_repair:"Autowerkstatt",carpet:"Teppichladen",charity:"Wohltätigkeitsladen",chemist:"Drogerie",clothes:"Bekleidungsgeschäft",computer:"Computergeschäft",confectionery:"Konditorei",convenience:"Tante-Emma-Laden",copyshop:"Copyshop",cosmetics:"Parfümerie",deli:"Feinkostladen",department_store:"Kaufhaus",discount:"Diskontladen",doityourself:"Baumarkt",dry_cleaning:"Textilreinigung",electronics:"Elektronikgeschäft",estate_agent:"Immobilienhändler",farm:"Hofladen",fashion:"Modegeschäft",fish:"Fischereiladen",florist:"Blumengeschäft",food:"Lebensmittelladen",funeral_directors:"Bestattungsunternehmen",furniture:"Möbelgeschäft",gallery:"Galerie",garden_centre:"Garten-Center",general:"Gemischtwarenladen",gift:"Geschenkeladen",greengrocer:"Obst- und Gemüsehändler",grocery:"Lebensmittelladen",hairdresser:"Frisör",hardware:"Eisenwarenhändler",hifi:"Elektroshop",insurance:"Versicherungsbüro",jewelry:"Juwelier",kiosk:"Kiosk",laundry:"Wäscherei",mall:"Einkaufszentrum",market:"Markt",mobile_phone:"Handygeschäft",motorcycle:"Motorradgeschäft",music:"Musikladen",newsagent:"Zeitschriftenladen",optician:"Optiker",organic:"Bio-Laden",outdoor:"Außenbekleidungsladen",pet:"Tierhandlung",pharmacy:"Apotheke",photo:"Fotoladen",salon:"Salon",second_hand:"Second-Hand-Geschäft",shoes:"Schuhgeschäft",shopping_centre:"Einkaufszentrum",sports:"Sportgeschäft",stationery:"Schreibwarenladen",supermarket:"Supermarkt",tailor:"Schneiderei",toys:"Spielwarengeschäft",travel_agency:"Reisebüro",video:"Videothek",wine:"Vinothek",yes:"Geschäft"},tourism:{alpine_hut:"Berghütte",artwork:"Kunstwerk",attraction:"Sehenswürdigkeit",bed_and_breakfast:"Bed and Breakfast",cabin:"Hütte",camp_site:"Campingplatz",caravan_site:"Wohnmobile-Stellplatz",chalet:"Chalet",guest_house:"Pension",hostel:"Jugendherberge",hotel:"Hotel",information:"Information",lean_to:"Unterstand",motel:"Motel",museum:"Museum",picnic_site:"Piknikplatz",theme_park:"Freizeitpark",valley:"Tal",viewpoint:"Aussichtspunkt",zoo:"Zoo"},tunnel:{culvert:"Durchlass",yes:"Tunnel"},waterway:{artificial:"Künstliche Wasserstraße",boatyard:"Werft",canal:"Kanal",connector:"Wasserstraßenverbindung",dam:"Staudamm",derelict_canal:"Aufgelassener Kanal",ditch:"Wassergraben",dock:"Dock",drain:"Abwassergraben",lock:"Schleuse",lock_gate:"Schleusentor",mineral_spring:"Mineralquelle",mooring:"Anlegeplatz",rapids:"Stromschnellen",river:"Fluss",riverbank:"Flussufer",stream:"Bach",wadi:"Trockental",waterfall:"Wasserfall",water_point:"Trinkwassernachfüllstation",weir:"Wehr"}},admin_levels:{level2:"Staatsgrenze",level4:"Landesgrenze",level5:"Regionsgrenze",level6:"Kreis-/Bezirksgrenze",level8:"Gemeinde-/Stadtgrenze",level9:"Stadtteilgrenze",level10:"Nachbarschaftsgrenze"}}}}};window.eContent||(window.eContent={});eContent.Typeahead=function(n,t){var r,u,f,e,i,o;if(!window.jQuery)throw new Error("eContent.Typeahead needs jQuery");if(!window.Bloodhound)throw new Error("eContent.Typeahead needs typeahead.js with Bloodhound");if(!window.Handlebars)throw new Error("eContent.Typeahead needs Handlebars");for(r=this,this.options=$.extend(!0,{sources:[],defaults:{meta:{geo:!1,url:"http://meta.et4.de/",experience:window.EXPERIENCE||"develop"},nominatim:{bounds:!1,polygon:!1,countries:null}},debug:!1,hint:!0,limit:5,geolocation:!1,speech:!1,simpleSemantics:!1},t),this.options.sources.length==0&&(this.options.sources=[{type:"meta"},{type:"nominatim"}]),this.element=$(n),u=[],u.push({highlight:!0,hint:this.options.hint}),f=Handlebars.compile('<p class="{{#if type}}ec-tt-geocoding{{/if}}"><span class="badge badge-inverse pull-right {{#if type}}city-badge{{/if}}">{{#if type}}{{#if kind}}{{kind}}{{else}}Ort:{{/if}} {{/if}}{{count}}<\/span>{{value}}{{#if subtitle}} – <span class="ec-tt-subtitle">{{subtitle}}<\/span>{{/if}}<\/p>'),e=0;e<this.options.sources.length;e++){i=this.options.sources[e];i=$.extend({},this.options.defaults[i.type],i);switch(i.type){case"meta":u.push({name:i.id||i.type,source:this._metaMakeSource(i),templates:{header:this.options.debug?'<h3 class="tt-group-header">Inhalte - eT4 META<\/h3>':'<h3 class="tt-group-header">Inhalte<\/h3>',suggestion:f}});break;case"nominatim":u.push({name:i.id||i.type,source:this._nominatimMakeSource(i),templates:{header:this.options.debug?'<h3 class="tt-group-header">Orte - Nominatim<\/h3>':'<h3 class="tt-group-header">Orte/Adressen<\/h3>',suggestion:f}});break;case"photon":u.push({name:i.id||i.type,source:this._photonMakeSource(i),templates:{header:this.options.debug?'<h3 class="tt-group-header">Orte - Photon<\/h3>':'<h3 class="tt-group-header">Orte/Adressen<\/h3>',suggestion:f}});break;case"ecmap":if(!this.options.map)continue}}this.element.typeahead.apply(this.element,u).on("typeahead:selected",function(n,t){t.type=="geocoding"?(r.element.typeahead("val",""),r.element.trigger("ec-typeahead:locationselected",t)):r.element.trigger("ec-typeahead:search",[r.element.typeahead("val"),"selected"])}).on("typeahead:autocompleted",function(){r.element.trigger("ec-typeahead:search",[r.element.typeahead("val"),"autocompleted"])}).on("keyup",function(n){n.which==13&&(r.element.typeahead("close"),r._handleSimplePredicateSemantics()||r.element.trigger("ec-typeahead:search",[r.element.typeahead("val"),"keyup"]))});o=$('<div class="ec-tt-buttons"><\/div>').appendTo(this.element.parent());this._initSpeech(o);this._initGeolocation(o)};eContent.Typeahead.prototype={_metaMakeSource:function(n){var t=new Bloodhound({datumTokenizer:Bloodhound.tokenizers.obj.whitespace("value"),queryTokenizer:Bloodhound.tokenizers.whitespace,remote:{url:n.url+"rest.ashx/autocomplete/?term=%QUERY&callback=?",filter:this._metaFilter,ajax:{data:{limit:this.options.limit,experience:n.experience,city:n.geo,geo:n.geo}}}});return t.initialize(),t.ttAdapter()},_metaFilter:function(n){for(var t,i=[],r=0;r<n.length;r++)t=n[r],t.Type=="geo"?i.push({value:t.Term,count:t.Count,type:"geocoding",lat:t.Lat,lon:t.Lon}):i.push({value:t.Term,count:t.Count});return i},_nominatimMakeSource:function(n){var r=undefined,t,i;return n.bounds&&this.options.map&&(r=function(n,t){return n=n.replace(%QUERY/,encodeURIComponent(t)),n+("&viewbox="+[ecMap.GetMapView().TopLeftLatLong.Longitude,ecMap.GetMapView().TopLeftLatLong.Latitude,ecMap.GetMapView().BottomRightLatLong.Longitude,ecMap.GetMapView().BottomRightLatLong.Latitude].join(","))}),t="//nominatim.openstreetmap.org/search?q=%QUERY",n.url&&(t=n.url=="mapquest"?"//open.mapquestapi.com/nominatim/v1/search?q=%QUERY":n.url),i=new Bloodhound({datumTokenizer:Bloodhound.tokenizers.obj.whitespace("value"),queryTokenizer:Bloodhound.tokenizers.whitespace,remote:{url:t,filter:$.proxy(this._nominatimFilter,this),replace:r,ajax:{data:{limit:this.options.limit,countrycodes:n.countries?n.countries.join?n.countries.join(","):n.countries:undefined,polygon_geojson:n.polygon?!0:undefined,format:"jsonv2",addressdetails:1}}}}),i.initialize(),i.ttAdapter()},_nominatimFilter:function(n){for(var u=[],r=0;r<n.length;r++){var t=n[r],f=t.display_name.split(/,(.+)/),i={value:f[0],subtitle:f[1],type:"geocoding",lat:t.lat,lon:t.lon,kind:this._nominatimGetTranslatedType(t.category,t.type,t.place_rank),_category:t.category,_type:t.type,_placeId:t.place_id,_address:t.address};t.boundingbox&&(i.bbox=[t.boundingbox[2],t.boundingbox[0],t.boundingbox[3],t.boundingbox[1]].map(parseFloat),i.bbox[2]-i.bbox[0]<.00011&&i.bbox[3]-i.bbox[1]<.00011&&(i.bbox=undefined));t.geojson&&(i.geojson=t.geojson);u.push(i)}return u},_geocodeOne:function(n,t){n=="gps"?this._doGeolocation(t):this.element.data("ttTypeahead").dropdown.datasets.filter(function(n){return n.name=="nominatim"})[0].source(n,t)},geocode:function(n){var t=this;this._geocodeOne(n,function(n){n.length>0&&t.element.trigger("ec-typeahead:locationselected",[n[0],"geocode"])})},search:function(n){var t=this;n&&t.element.typeahead("val",n);t._handleSimplePredicateSemantics()||t.element.trigger("ec-typeahead:search",[t.element.typeahead("val"),"search"])},loadGeoJson:function(n,t){var r,u,i;if(n.lat&&n.lon&&n._category&&n._type&&n._placeId&&n.bbox){if(r=this,u=(n.bbox[2]-n.bbox[0])*(n.bbox[3]-n.bbox[1]),u>1){console.log("bbox is very large, refusing to load geojson");return}i={polygon_geojson:!0,format:"jsonv2",limit:1};i.q=["[",n._category,"=",n._type,"] ",n.lat,",",n.lon].join("");n._address&&n._address.country_code&&(i.countrycodes=n._address.country_code);i.bounded=1;i.viewboxlbrt=n.bbox.join(",");$.ajax({url:"//nominatim.openstreetmap.org/search",data:i}).done(function(i){if(i.length>0){var u=r._nominatimFilter(i)[0];u._placeId!=n._placeId&&(console.warn("got geojson for the wrong place - got "+u._placeId+" vs selected "+n._placeId),t(null));u.geojson?t(u):(console.warn("got a place without geojson"),t(null))}else t(null)})}},_nominatimGetTranslatedType:function(n,t,i){var u,r,f;return window.EC_TYPEAHEAD_NOMINATIM_TRANSLATIONS?(u=function(n,t){for(var i=EC_TYPEAHEAD_NOMINATIM_TRANSLATIONS.de,u=n.split("."),r=0;r<u.length;r++)if(i=i[u[r]],!i)return t;return i},r=t?u("geocoder.search_osm_nominatim.prefix."+n+"."+t,t.replace(/_/g," ")):"",n=="boundary"&&t=="administrative"&&(f=Math.floor((parseInt(i,10)+1)/2),r=u("geocoder.search_osm_nominatim.admin_levels.level"+f,r)),r):null},_photonMakeSource:function(){var n=new Bloodhound({datumTokenizer:Bloodhound.tokenizers.obj.whitespace("value"),queryTokenizer:Bloodhound.tokenizers.whitespace,remote:{url:"//photon.komoot.de/api/?q=%QUERY&lang=de",filter:$.proxy(this._photonFilter,this),ajax:{data:{limit:5}}}});return n.initialize(),n.ttAdapter()},_photonFilter:function(n){for(var t,r=[],i=0;i<n.features.length;i++)t=n.features[i],r.push({value:t.properties.name,subtitle:t.properties.country,type:"geocoding",lat:t.geometry.coordinates[1],lon:t.geometry.coordinates[0],kind:this._nominatimGetTranslatedType(t.properties.osm_key,t.properties.osm_value,0)});return r},_handleSimplePredicateSemantics:function(){var u=this,n,t,i,r;return this.options.simpleSemantics?(n=this.element.typeahead("val"),i=null,/ich habe hunger/i.test(n)&&(n="type:Gastro in der nähe"),/mir ist kalt/i.test(n)&&(n="eisdiele OR eiscafe OR freibad in der nähe"),/ich bin müde/i.test(n)&&(n="type:Hotel in der nähe"),/ich habe (kopfweh|kopfschmerzen)/i.test(n)&&(n="arzt OR apotheke in der nähe"),/ich habe (zahnweh|zahnschmerzen)/i.test(n)&&(n="zahnarzt in der nähe"),/ich bin krank/i.test(n)&&(n="arzt OR apotheke in der nähe"),/wo bin ich\??/i.test(n)&&(n="zeige mir meinen standort"),t=n.match(/(zeige?|suche?|finde) (mir|nach) (.+)$/i),t&&(n=t[3],this.element.typeahead("val",n)),t=n.match(/wo ist ((der|die|das) )?(.+)$/i),t&&!n.match(/nächste/i)&&(n="nichts in "+t[3]),t&&n.match(/nächste/i)&&(n=t[3]),t=n.match(/^((der|die|das|den) )?nächste[srn]? (.+)$/i),t&&(n=t[3]+" in der nähe"),t=n.match(/^mein(en)? standort$/i),t&&(n="nichts in der nähe"),t=n.match(/^was ist (heute|morgen|am wochenende|dieses wochenende|diese woche|nächste woche|die nächsten tage|nächstes wochenende)(.*) los\??$/i),t&&(n="type:Event "+(t[2]||"in der nähe"),i=t[1]),t=n.match(/^(.+) (in|bei|near|im) (.+)$/),!t)?!1:(/alles/i.test(t[1])&&(t[1]="all:all"),/nichts/i.test(t[1])&&(t[1]=""),/highlights/i.test(t[1])&&(t[1]="highlight:true"),/der nähe/i.test(t[3])&&(t[3]="gps"),this.element.typeahead("val",t[1]),this.element.typeahead("close"),i&&(i=="heute"?i={mode:"today"}:i=="morgen"?i={mode:"tomorrow"}:i=="am wochenende"||i=="dieses wochenende"?i={mode:"this_weekend"}:i=="diese woche"?i={mode:"this_week"}:i=="nächste woche"?i={mode:"next_week"}:i=="die nächsten tage"?i={mode:"next_days,7"}:i=="nächstes wochenende"&&(i={mode:"next_weekend"})),r={},i&&i.mode&&(r.intervalMode=i.mode),this.element.trigger("ec-typeahead:search",[this.element.typeahead("val"),"semantic",r]),t[3]!="*"&&this._geocodeOne(t[3],function(n){n.length>0&&u.element.trigger("ec-typeahead:locationselected",[n[0],"semantic"])}),!0):!1},_initSpeech:function(n){function i(n,t){s.removeClass(o).addClass(n).attr("title",t||"")}var r=this,o,s;if(!this.options.speech||!("webkitSpeechRecognition"in window))return!1;this.element.parent().addClass("ec-tt-with-buttons");o="fa-microphone fa-microphone-slash fa-question listening error";var u="",f=!1,e=!1,t=this._recognition=new webkitSpeechRecognition;t.lang="de-DE";t.onstart=function(){i("fa-microphone listening");f=!1;e=!0};t.onerror=function(n){switch(n.error){case"no-speech":i("fa-question error","keine Sprache erkannt.");break;case"audio-capture":i("fa-microphone-slash error","Kein Mikrofon erkannt.");break;case"not-allowed":i("fa-microphone-slash error","Zugriff auf Mikrofon wurde verweigert. Siehe chrome://settings/contentExceptions#media-stream");break;default:i("fa-microphone-slash error",n.error)}f=!0};t.onend=function(){(e=!1,f)||i("fa-microphone")};t.onresult=function(n){var f="",i;if(typeof n.results=="undefined"){t.onend=null;t.stop();return}for(i=n.resultIndex;i<n.results.length;++i)n.results[i].isFinal?u+=n.results[i][0].transcript:f+=n.results[i][0].transcript;u&&(r.element.typeahead("val",u),r._handleSimplePredicateSemantics()||r.element.trigger("ec-typeahead:search",[r.element.typeahead("val"),"speech"]))};s=$('<i class="ec-tt-speech fa fa-microphone"><\/i>').click(function(){u="";e?t.stop():t.start()}).appendTo(n)},_initGeolocation:function(n){var t=this,i;this.options.geolocation&&"geolocation"in navigator&&(this.element.parent().addClass("ec-tt-with-buttons"),i=$('<i class="ec-tt-geolocation fa fa-location-arrow"><\/i>').click(function(){t._doGeolocation(function(n){t.element.trigger("ec-typeahead:locationselected",n[0])})}).appendTo(n))},_doGeolocation:function(n){var t=this;"geolocation"in navigator&&navigator.geolocation.getCurrentPosition(function(t){n([{value:"Ich",lat:t.coords.latitude,lon:t.coords.longitude}])})},on:function(n,t){this.element.on("ec-typeahead:"+n,t);return this}};eContent.PinLoader=function(n){this._ecMap=n;this._loaded=[]};eContent.PinLoader.prototype={ClearLoadState:function(){Array.clear(this._loaded)},IsLoaded:function(n){return Array.contains(this._loaded,n)},SetLoaded:function(n){Array.add(this._loaded,n)},SetEnabled:function(n,t){t&&!this.IsLoaded(n)?(this._ecMap.LoadDefaultFeed(n),this.SetLoaded(n)):(this._ecMap.SetPinsEnablement(n,t),this._ecMap.UpdatePins())}};eContent.VisiblePinHandler=function(n,t,i){this._ecMap=n;this._pinType=i;this._callback=t;this._beforeWait=null;this._beforeLoad=null;this._pageIndex=0;this._maxCount=30;this._data=[];this._running=!1;this._stopped=!1;this._onPinDataPart=Function.createDelegate(this,this.OnPinDataPart);this._shuffle=!0;this._shuffleIndex=[];this._onReady=Function.createDelegate(this,this.OnReady);this._timerId=-1;this._delay=1500};eContent.VisiblePinHandler.prototype={Start:function(){this._ecMap.IsGMap?this._handlerRef=this._ecMap.AttachEvent("ecpinschanged",Function.createDelegate(this,this.PinsChanged)):this._ecMap.SetPinsChangedListener(Function.createDelegate(this,this.PinsChanged));this.PinsChanged()},Stop:function(){this._ecMap.IsGMap?this._ecMap.DetachEvent("ecpinschanged",this._handlerRef):this._ecMap.SetPinsChangedListener(null);this._stopped=!0},SetPinType:function(n){this._pinType=n;this._stopped=!0},SetMaxCount:function(n){this._maxCount=n;this._stopped=!0},SetCallback:function(n){this._callback=n;this._stopped=!0},SetBeforeWait:function(n){this._beforeWait=n;this._stopped=!0},SetBeforeLoad:function(n){this._beforeLoad=n;this._stopped=!0},SetShuffle:function(n){this._shuffle=n;this._stopped=!0},SetDelay:function(n){this._delay=n},PinsChanged:function(){this.DoBeforeWait()&&(this._delay>0?(this._timerId!=-1&&clearTimeout(this._timerId),this._timerId=setTimeout(this._onReady,this._delay)):this.OnReady())},OnReady:function(){if(this._timerId=-1,this._ecMap.GetVisiblePinDataCount()==0){this.Reset();this.DoBeforeLoad()&&this.DoCallback();return}this._running?this._stopped=!0:(this.Reset(),this._running=!0,this._stopped=!1,this.DoBeforeLoad()?this.Next():this._running=!1)},Reset:function(){this._pageIndex=0;Array.clear(this._shuffleIndex);Array.clear(this._data)},GetCount:function(){return Math.min(this._ecMap.GetVisiblePinDataCount(),this._maxCount)},Next:function(){if(this._running)return this._data.length<this.GetCount()?(this._ecMap.GetVisiblePinData(this._onPinDataPart,this._pageIndex,this._pinType),!0):!1},OnPinDataPart:function(n,t,i){var u,r;if(this._running){if(this._stopped)if(this.Reset(),this._stopped=!1,this.DoBeforeLoad()){if(this.Next())return}else{this._running=!1;return}if(u=this.GetCount(),n!=null&&n.length>0){if(this._shuffle){if(this.UpdateShuffleIndex(t),this._pageIndex!=0||this._data.length>0||i<=u)for(r=0;r<n.length;r++)Array.insert(this._data,Math.random()*this._data.length|0,n[r])}else Array.addRange(this._data,n);if(this.NextIndex(),this.Next())return}while(this._data.length>u)Array.removeAt(this._data,this._data.length-1);this.DoCallback()}},DoBeforeWait:function(){if(this._beforeWait!=null){var n=this._beforeWait();return n==null||n=="undefined"||n}return!0},DoBeforeLoad:function(){if(this._beforeLoad!=null){var n=this._beforeLoad();return n==null||n=="undefined"||n}return!0},DoCallback:function(){this._running=!1;this._callback&&this._callback(this._data)},UpdateShuffleIndex:function(n){if(this._shuffleIndex.length==0)for(var t=1;t<n;t++)Array.add(this._shuffleIndex,t)},NextIndex:function(){if(this._shuffle)if(this._shuffleIndex.length>0){var n=Math.random()*this._shuffleIndex.length|0;this._pageIndex=this._shuffleIndex[n];Array.removeAt(this._shuffleIndex,n)}else this._pageIndex=0;else this._pageIndex++}};Type.registerNamespace("eContent.eSuchWas");eContent.eSuchWas.InputExtender=function(n,t){this.MinSearchTextLength=3;this.SearchStartDelay=500;this._ecMap=n;this._inputElement=$get(t);this._lastSearchText="";this._loading=!1;this._loadAgain=!1;this._searchTimerId=-1;this._forceSearch=!1;this._searchDelegate=Function.createDelegate(this,this.SearchNow);this._afterSetDelegate=Function.createDelegate(this,this._AfterSet);this._afterUpdateDelegate=Function.createDelegate(this,this._AfterUpdate);this.Init()};eContent.eSuchWas.InputExtender.prototype={Init:function(){$addHandler(this._inputElement,"keyup",Function.createDelegate(this,this._OnSearchChanged));$addHandler(this._inputElement,"keypress",Function.createDelegate(this,this._OnSearchPressed));this.Search()},Search:function(){this._searchTimerId!=-1&&clearTimeout(this._searchTimerId);this._searchTimerId=setTimeout(this._searchDelegate,this.SearchStartDelay)},ForceSearch:function(){this._forceSearch=!0;this.Search()},SearchNow:function(){var n=this.MinifySearchText(this._inputElement.value);if((n==""||this.IsSearchTextComplete(n))&&(this._forceSearch||n==""||n!=this._lastSearchText)){if(this._loading){this._loadAgain=!0;return}this._forceSearch=!1;this._lastSearchText=n;this._loading=!0;this._loadAgain=!1;this._ecMap.SetBusy(!0);this._ecMap.SetPinFilter(n,this._afterSetDelegate)}},_AfterSet:function(){this._ecMap.AddLoadCompleteHandler(this._afterUpdateDelegate);this._ecMap.SetBusy(!1)},_AfterUpdate:function(){this._loading=!1;this._loadAgain&&this.Search()},_OnSearchChanged:function(){return this.Search(),!0},_OnSearchPressed:function(n){var t=document.layers?n.which:document.all?event.keyCode:n.keyCode;return t==13?(this.Search(),!1):!0},MinifySearchText:function(n){return n.replace(/[^A-Za-z0-9\u00dc\u00fc\u00c4\u00e4\u00d6\u00f6]/g," ").replace(/\s+/g," ").trim()},IsSearchTextComplete:function(n){return n!=""&&n.length>=this.MinSearchTextLength}};eContent.Algorithms=function(){};eContent.Algorithms.DouglasPeucker=function(n,t){var nt,u,s,r,f,a,tt,v,y,e,c,p,o,l,w,h,it,b,rt=Math.PI/180*.5,k=[],d=[],g=[],ut,i;if(n.length<3)return n;for(nt=n.length,y=t*360/(12756274*Math.PI),y*=y,s=0,d[0]=0,g[0]=nt-1,u=1;u>0;)if(r=d[u-1],f=g[u-1],u--,f-r>1){for(e=n[f].lng()-n[r].lng(),c=n[f].lat()-n[r].lat(),Math.abs(e)>180&&(e=360-Math.abs(e)),e*=Math.cos(rt*(n[f].lat()+n[r].lat())),p=e*e+c*c,i=r+1,a=r,v=-1;i<f;i++)o=n[i].lng()-n[r].lng(),l=n[i].lat()-n[r].lat(),Math.abs(o)>180&&(o=360-Math.abs(o)),o*=Math.cos(rt*(n[i].lat()+n[r].lat())),w=o*o+l*l,h=n[i].lng()-n[f].lng(),it=n[i].lat()-n[f].lat(),Math.abs(h)>180&&(h=360-Math.abs(h)),h*=Math.cos(rt*(n[i].lat()+n[f].lat())),b=h*h+it*it,tt=w>=p+b?b:b>=p+w?w:(o*c-l*e)*(o*c-l*e)/p,tt>v&&(a=i,v=tt);v<y?(k[s]=r,s++):(u++,d[u-1]=a,g[u-1]=f,u++,d[u-1]=r,g[u-1]=a)}else k[s]=r,s++;for(k[s]=nt-1,s++,ut=[],i=0;i<s;i++)ut.push(n[k[i]]);return ut};eContent.HistoryItem=function(n,t){this.Command=n;this.Object=t};eContent.History=function(){this._currentHistoryPosition=0;this._historyList=[];this._Init()};eContent.History.prototype={_Init:function(){},Add:function(n){this._historyList.splice(this._currentHistoryPosition+1,this._historyList.length-this._currentHistoryPosition);this._historyList.push(n);this._currentHistoryPosition=this._historyList.length-1;this.OnChangeCallback()},Remove:function(){},Next:function(){return(this._currentHistoryPosition++,this._currentHistoryPosition>this._historyList.length-1)?(this._currentHistoryPosition=this._historyList.length-1,null):this._historyList[this._currentHistoryPosition]},Previous:function(){return this._currentHistoryPosition--,this._historyList[this._currentHistoryPosition+1]},Clear:function(){this._currentHistoryPosition=0;this._historyList=[];this.OnChangeCallback()},OnChangeCallback:function(){}};eContent.TourEditorColors={Active:new eContent.Color(88,88,255,.9),Inactive:new eContent.Color(0,0,0,.9),Hidden:new eContent.Color(0,0,0,.5)};eContent.TourEditorPinTypes={Segment:0,OffRoutePoint:1};eContent.TourEditorPins={MetaObject:"http://maps.google.com/mapfiles/kml/paddle/ltblu-diamond.png",MetaOffRouteObject:"http://maps.google.com/mapfiles/kml/paddle/grn-diamond.png",OwnObject:"http://maps.google.com/mapfiles/kml/paddle/ltblu-blank.png",OwnOffRouteObject:"http://maps.google.com/mapfiles/kml/paddle/grn-blank.png",NumberedPinRed:"http://ecmaps.de/images/pins/NumberedPinsRed/number_{0}.png"};eContent.TourEditorMode={Routing:"Routing",FreeHand:"FreeHand",Selection:"Selection"};eContent.TourPointPinDataInfo=function(n,t,i,r,u,f,e,o,s,h,c,l,a,v){if(this.WayPointNumber=n,this.Title=t,this.Type=i,this.Source=r,this.Id=u,this.Hashlink=f,this.Latitude=e,this.Longitude=o,this.Description=s,this.Categories=[],this.Street=c,this.ZipCode=l,this.City=a,this.Country=v,h!=null)for(var y=0;y<h.length;y++)this.Categories.push(h[y])};eContent.TourPoint=function(n,t,i,r,u){this.Latitude=n;this.Longitude=t;this.GeoCodeInfo=i;this.TourPointPinDataInfo=r;this.LeistungId=u};eContent.TourSegment=function(n,t,i,r,u,f,e){this.ShapeLayer=null;this.Start=n;this.End=t;this.WayPoints=i;this.TourEditorMode=r;this.RoutingProviderId=u;this.Points=[];this.Length=0;this.LinearDistance=0;this.Name=f!=null?f:"";this.Pin=e!=null?e:eContent.TourEditorPins.MetaObject;this.Duration=0;this.AltitudeAbsolut=0;this.AltitudeAbsolutDesc=0;this.AltitudeMax=0;this.AltitudeMin=0};eContent.TourSegment.prototype={GetSegmentRoutingTypeIcon:function(){var n=ecMap.RoutingEngine.GetRoutingType(this.RoutingProviderId),t="? ",i,r;return this.TourEditorMode==eContent.TourEditorMode.FreeHand?n!=null&&n.Icon!=null?(i=n.Icon.substring(0,n.Icon.lastIndexOf("/")),r=n.Icon.substring(n.Icon.lastIndexOf("/")+1),t='<img src="'+i+"/r_freehand_"+r+'" title="'+n.InfoTitle+'" />'):t='<img src="http://ecmaps.de/images/routing/r_freehand.png" /> ':this.TourEditorMode==eContent.TourEditorMode.Routing&&n!=null&&n.Icon!=null&&(t='<img src="'+n.Icon+'" title="'+n.InfoTitle+'" />'),t}};eContent.TourEditor=function(n,t,i,r){this._ecMap=n;this._segments=[];this._offRoutePoints=[];this._history=new eContent.History;this._currentIndex=-1;this._pinLayer=new eContent.ShapeLayer;this._onMapClickEventEnabled=!0;this._freeHandStartPin=null;this._freeHandEndPin=null;this._Init(t,i,r)};eContent.TourEditor.prototype={_Init:function(n,t,i){var r=this,u=this._ecMap.RoutingEngine.RoutingTypes[0].Id;n==null?this.SetCurrentMode(eContent.TourEditorMode.Routing):this.SetCurrentMode(n);this.CurrentRoutingProviderId=t==null?u:t;this._ecMap.AddShapeLayer(this._pinLayer);this._ecMap.EnableFullscreenButton(!0);(i==null||i==!0)&&this._ecMap.AttachEvent("onclick",function(n){if(r._onMapClickEventEnabled==!0&&!n.elementID){var t=ecMap.GetEventLatLong(n),i=new eContent.TourPoint(t.Latitude,t.Longitude,null,null),u=r.GetSegmentCount()-1;r._AddPoint(u,i)}})},_ActivateSegment:function(n,t,i){var s,u,r,f,e,h,o;t==null&&(t=!0);s=this._currentIndex;u=this;this._currentIndex=n;this._SaveShape(s);this._ShowSegments(n);this._RemvoveFlagsPinFreeHand();r=this.GetSegment(n);f=r.ShapeLayer!=null?r.ShapeLayer.GetShapeByIndex(0):null;switch(r.TourEditorMode){case eContent.TourEditorMode.Routing:u.SetOnMapClickEventEnabled(!0);f!=null&&f.SetLineColor(eContent.TourEditorColors.Active);this._Recalculate(r.TourEditorMode,this._currentIndex,i);break;case eContent.TourEditorMode.FreeHand:u.SetOnMapClickEventEnabled(!1);u._ecMap.StopTourEditor();e=this.GetSegment(s);e!=null&&(h=e.ShapeLayer!=null?e.ShapeLayer.GetShapeByIndex(0):null,h!=null&&h.SetLineColor(eContent.TourEditorColors.Inactive));u._ecMap.SetTourEditedHandler(function(){u._Recalculate(r.TourEditorMode,n,function(){u._ActivateSegment(n,!1)})});f==null&&r.Start!=null&&r.Start.Latitude!=null&&r.Start.Longitude!=null&&r.End!=null&&r.End.Latitude!=null&&r.End.Longitude!=null&&(o=[],o.push(new eContent.LatLong(r.Start.Latitude,r.Start.Longitude)),o.push(new eContent.LatLong(r.End.Latitude,r.End.Longitude)),f=u._ecMap.CreateTourShape(o));f!=null&&f.SetLineColor(eContent.TourEditorColors.Active);this._AddFlagsPinFreeHand(n,r.Start.Latitude,r.Start.Longitude,r.End.Latitude,r.End.Longitude);u._ecMap.EditTour(f);i!=null&&i();this.OnChangeCallback()}t},_AddPin:function(n,t,i,r,u,f){var o=this,l=r!=null?r:eContent.TourEditorPins.MetaObject,e=ecMap.CreatePinShape(new eContent.LatLong(t,i)),c='<img src="'+l+'" ',s,h;if(f!=null&&(c+='title="'+f+'"'),c+='style="width: 35px; height: 35px; position: relative; left: -12px;top: -30px;">',e.SetCustomIcon(c),s=null,u==null||u==eContent.TourEditorPinTypes.Segment?(s=this.GetSegment(n),h=s.End):h=this.GetOffRoutePoint(n),u==null||u==eContent.TourEditorPinTypes.Segment){if(n!=null){e.on("click",function(){o.ActivateSegment(n)});this._ecMap.EnablePinMoveCallback(e,function(t){o.OnPinMoved(e,h,t,function(){o._Recalculate(s.TourEditorMode,n,null)})})}}else u==eContent.TourEditorPinTypes.OffRoutePoint&&this._ecMap.EnablePinMoveCallback(e,function(n){o.OnPinMoved(e,h,n,function(){o.OnChangeCallback()})});this._pinLayer.AddShape(e)},_AddFlagsPinFreeHand:function(n,t,i,r,u){var e=this;if(this._freeHandStartPin!=null&&this._pinLayer.DeleteShape(this._freeHandStartPin),this._freeHandEndPin!=null&&this._pinLayer.DeleteShape(this._freeHandEndPin),this._freeHandStartPin=ecMap.CreatePinShape(new eContent.LatLong(t,i)),this._freeHandStartPin.SetCustomIcon('<img src="http://ecmaps.de/images/routing/start.png" style="position: relative; left: -2px;top: -35px;">'),this._freeHandEndPin=ecMap.CreatePinShape(new eContent.LatLong(r,u)),this._freeHandEndPin.SetCustomIcon('<img src="http://ecmaps.de/images/routing/destination.png" style="position: relative; left: -2px;top: -35px;">'),n!=null){var f=this.GetSegment(n),o=f.Start!=null?f.Start.TourPointPinDataInfo:null,s=f.End!=null?f.End.TourPointPinDataInfo:null;this._freeHandStartPin.on("click",function(){e.ActivateSegment(n)});this._freeHandEndPin.on("click",function(){e.ActivateSegment(n)});this._ecMap.EnablePinMoveCallback(this._freeHandStartPin,function(t){e.OnPinMoved(e._freeHandStartPin,f.Start,t,function(){var t=f.Points;t[0]=new eContent.LatLong(f.Start.Latitude,f.Start.Longitude);e._ecMap.StopTourEditor();e.ReDrawPinShapes();e._GetElevationData(t,function(i){f.Points=t;f.Start=new eContent.TourPoint(f.Start.Latitude,f.Start.Longitude,null,o);f.AltitudeAbsolut=i.ElevAsc;f.AltitudeAbsolutDesc=i.ElevDesc;f.AltitudeMax=i.AltitudeMax;f.AltitudeMin=i.AltitudeMin;f.Length=e._GetLengthOfPolyline(t).toFixed(3);t!=null&&t.length>1&&(f.LinearDistance=e._GetLengthOfPolyline([t[0],t[t.length-1]]).toFixed(3));f.Duration=0;e._RenderShapeLayer(n);e._ShowSegments(n);e._UpdateLeadingSegment(n,f.Start.Latitude,f.Start.Longitude,o,!0);e.OnChangeCallback()},function(){})})});this._ecMap.EnablePinMoveCallback(this._freeHandEndPin,function(t){e.OnPinMoved(e._freeHandEndPin,f.End,t,function(){var t=f.Points;t[t.length-1]=new eContent.LatLong(f.End.Latitude,f.End.Longitude);e._ecMap.StopTourEditor();e._GetElevationData(t,function(i){f.Points=t;f.End=new eContent.TourPoint(f.End.Latitude,f.End.Longitude,null,o);f.AltitudeAbsolut=i.ElevAsc;f.AltitudeAbsolutDesc=i.ElevDesc;f.AltitudeMax=i.AltitudeMax;f.AltitudeMin=i.AltitudeMin;f.Length=e._GetLengthOfPolyline(t).toFixed(3);t!=null&&t.length>1&&(f.LinearDistance=e._GetLengthOfPolyline([t[0],t[t.length-1]]).toFixed(3));f.Duration=0;e._RenderShapeLayer(n);e._ShowSegments(n);e._UpdateFollowingSegment(n,f.End.Latitude,f.End.Longitude,s,!0);e.OnChangeCallback()},function(){})})})}this._pinLayer.AddShape(this._freeHandStartPin);this._pinLayer.AddShape(this._freeHandEndPin)},_AddPoint:function(n,t){var i,r;switch(this.CurrentMode){case eContent.TourEditorMode.Routing:n==-1?(this.AddSegment(new eContent.TourSegment(null,t,null,this.CurrentMode,this.CurrentRoutingProviderId,t.TourPointPinDataInfo!=null?t.TourPointPinDataInfo.Title:null)),this._Recalculate(this.CurrentMode,0),this.AddSegment(new eContent.TourSegment(t,null,null,this.CurrentMode,this.CurrentRoutingProviderId)),this._Recalculate(this.CurrentMode,1)):this.GetSegment(n).End==null?this._SetSegmentEndPoint(n,t):(this._StopAllEditors(),this.AddSegment(new eContent.TourSegment(this.GetSegment(n).End,t,null,this.CurrentMode,this.CurrentRoutingProviderId)),this._Recalculate(this.CurrentMode,n+1));break;case eContent.TourEditorMode.FreeHand:if(i=this.GetSegment(n),n==-1)this.AddSegment(new eContent.TourSegment(null,t,null,this.CurrentMode,this.CurrentRoutingProviderId)),this.AddSegment(new eContent.TourSegment(t,null,null,this.CurrentMode,this.CurrentRoutingProviderId)),this._CreateNewTour(0,[t]);else if(this.GetSegment(n).End!=null)if(this.GetCurrentIndex()==n)this._StopAllEditors(),this._Recalculate(i.TourEditorMode,n),n++,this.AddSegment(new eContent.TourSegment(i.End,t,null,this.CurrentMode,this.CurrentRoutingProviderId)),this._CreateNewTour(n,[i.End,t]),this.ActivateSegment(n);else{this._StopAllEditors();switch(this.LastMode){case eContent.TourEditorMode.Routing:n++;this.AddSegment(new eContent.TourSegment(i.End,null,null,this.CurrentMode,this.CurrentRoutingProviderId));this._CreateNewTour(n,[i.End,t]);this._Recalculate(this.CurrentMode,n);break;case eContent.TourEditorMode.FreeHand:this._Recalculate(i.TourEditorMode,n);n++;this._ShowSegments(n);this.AddSegment(new eContent.TourSegment(i.End,null,null,this.CurrentMode,this.CurrentRoutingProviderId));this._CreateNewTour(n,[i.End,t])}}}r=this.GetSegment();t!=null&&t.TourPointPinDataInfo!=null&&t.TourPointPinDataInfo.Title!=null&&t.TourPointPinDataInfo.Title!=""&&(r.Name=t.TourPointPinDataInfo.Title)},_CreateNewTour:function(n,t){var i=this;this._ecMap.CreateNewTour(t);this._ecMap.SetTourEditedHandler(function(){n==0&&(n=1);i._Recalculate(i.CurrentMode,n,function(){i._ActivateSegment(n)})})},_DoTheDouglasPeucker:function(n,t){var u,i,r;if(eContent.Algorithms&&eContent.Algorithms.DouglasPeucker&&n.length>0){t==null&&(u=this._GetLengthOfPolyline(n),t=u*50,t=parseInt(t.toFixed(0)));i=n;r=10;do i=eContent.Algorithms.DouglasPeucker(n,r),r*=2;while(i.length>t);return i.length>10&&i.length==n.length?this._DoTheDouglasPeucker(n,n.length-10):i}return n},_GetElevationData:function(n,t,i){var u=250,f=this._GetLengthOfPolyline(n),r=(f*10).toFixed(0)*1;n=this._DoTheDouglasPeucker(n,r<3?3:r<u?r:u);$.ajax({dataType:"json",url:"http://osm.ecmaps.de/maps/api/elevation/json?callback=?",data:{locations:"enc:"+createEncodings(n),sensor:!0},success:function(n){for(var s,h,u,c,l=0,a=0,f=n.results[0].elevation,e=n.results[0].elevation,o=null,r=0;r<n.results.length;r++)f=Math.min(n.results[r].elevation,f),e=Math.max(n.results[r].elevation,e),r>0&&(s=n.results[r].elevation,h=n.results[r-1].elevation,o==null?(u=s-h,o=h):u=s-o,Math.abs(u)>25&&(o=null,u>0?l+=u:a-=u));c=e.toFixed(0)*1>1e4||f.toFixed(0)*1<-1e3?{ElevAsc:0,ElevDesc:0,AltitudeMax:0,AltitudeMin:0,RawData:n}:{ElevAsc:l.toFixed(0)*1,ElevDesc:a.toFixed(0)*1,AltitudeMax:e.toFixed(0)*1,AltitudeMin:f.toFixed(0)*1,RawData:n};n.status=="OK"?t(c):i&&i(c)},error:function(n){i&&i(n)}})},_GetLengthOfPolylineBasedOnTwoPoints:function(n,t){var i=[];return i.push(n),i.push(t),this._GetLengthOfPolyline(i)},_GetLengthOfPolyline:function(n){for(var r=0,t=0;t<n.length-1;t++){var i=Math.PI/180,u=n[t].Latitude*i,f=n[t+1].Latitude*i,e=u-f,o=n[t].Longitude*i-n[t+1].Longitude*i,s=2*Math.asin(Math.sqrt(Math.pow(Math.sin(e/2),2)+Math.cos(u)*Math.cos(f)*Math.pow(Math.sin(o/2),2)));r+=s*6378.137}return r},_GetSegmentDuration:function(n){var t=0,i=0;return/^Car/.test(n.RoutingProviderId)?t=n.Length/60:/^Public/.test(n.RoutingProviderId)?t=n.Length/30:/^Biking/.test(n.RoutingProviderId)?(t=n.Length/16,i=n.AltitudeAbsolut/500):/^MountainBiking/.test(n.RoutingProviderId)?(t=n.Length/16,i=n.AltitudeAbsolut/600):/^Hiking/.test(n.RoutingProviderId)&&(t=n.Length/4.2,i=n.AltitudeAbsolut/300+n.AltitudeAbsolutDesc/800),t<i?t/2+i:t+i/2},_GetSplitIndex:function(n,t){for(var r,u=-1,f=Number.MAX_VALUE,i=0;i<n.length;i++)r=this._GetLengthOfPolylineBasedOnTwoPoints(n[i],t),r<f&&(f=r,u=i);return u},_ReDrawPinShapes:function(){var r,u,n,i,t;for(this._pinLayer.DeleteAllShapes(),r=0;r<this.GetSegmentCount();r++)u=this.GetSegment(r),u!=null&&(n=u.End,n!=null&&n.TourPointPinDataInfo!=null&&n.TourPointPinDataInfo.Latitude!=null&&n.TourPointPinDataInfo.Longitude!=null&&n.TourPointPinDataInfo.Title!=null&&n.TourPointPinDataInfo.Title!=""&&this._AddPin(r,n.TourPointPinDataInfo.Latitude,n.TourPointPinDataInfo.Longitude,u.Pin,eContent.TourEditorPinTypes.Segment,n.TourPointPinDataInfo.Title));if(this._offRoutePoints!=null&&this._offRoutePoints.length>0)for(i=0;i<this._offRoutePoints.length;i++)t=this.GetOffRoutePoint(i),this._AddPin(i,this._offRoutePoints[i].Latitude,this._offRoutePoints[i].Longitude,t!=null&&t.TourPointPinDataInfo!=null&&t.TourPointPinDataInfo.Hashlink!=null&&t.TourPointPinDataInfo.Hashlink!=""?eContent.TourEditorPins.MetaOffRouteObject:eContent.TourEditorPins.OwnOffRouteObject,eContent.TourEditorPinTypes.OffRoutePoint,t!=null&&t.TourPointPinDataInfo!=null?t.TourPointPinDataInfo.Title:null)},_RemvoveFlagsPinFreeHand:function(){this._freeHandStartPin!=null&&(this._pinLayer.DeleteShape(this._freeHandStartPin),this._freeHandStartPin=null);this._freeHandEndPin!=null&&(this._pinLayer.DeleteShape(this._freeHandEndPin),this._freeHandEndPin=null)},_RenderShapeLayer:function(n,t){var r=this,i=this.GetSegment(n),u;i!=null&&i.Points!=null&&i.Points.length!=0&&(i.ShapeLayer==null&&(i.ShapeLayer=new eContent.ShapeLayer,i.ShapeLayer.AttachEvent("onclick",function(){r._ActivateSegment(n,!1,r.OnMapSegmentLineClicked)}),ecMap.AddShapeLayer(i.ShapeLayer)),r._SaveShape(n),u=i.ShapeLayer.GetShapeByIndex(0),u!=null&&u.SetLineColor(eContent.TourEditorColors.Hidden),i.TourEditorMode==eContent.TourEditorMode.Routing&&i.ShapeLayer.Hide(),(t==null||t==!1)&&this.OnChangeCallback())},_UpdateLeadingSegment:function(n,t,i,r,u){var e=this,f;if(n>0){f=this.GetSegment(n-1);switch(f.TourEditorMode){case eContent.TourEditorMode.Routing:(u||f.End.Latitude!=t&&f.End.Longitude!=i)&&(f.End=new eContent.TourPoint(t,i,null,r),this._Recalculate(f.TourEditorMode,n-1,function(){e.ActivateSegment(n)}));break;case eContent.TourEditorMode.FreeHand:(u||f.End.Latitude!=t&&f.End.Longitude!=i)&&(f.End=new eContent.TourPoint(t,i,null,r),f.Points[f.Points.length-1]=new eContent.LatLong(t,i),this._RenderShapeLayer(n-1),this._ShowSegments(n),this.ActivateSegment(n))}}},_UpdateFollowingSegment:function(n,t,i,r,u){var e=this,f;if(n<this.GetSegmentCount()-1){f=this.GetSegment(n+1);switch(f.TourEditorMode){case eContent.TourEditorMode.Routing:(u||f.Start.Latitude!=t&&f.Start.Longitude!=i)&&(f.Start=new eContent.TourPoint(t,i,null,r),this._Recalculate(f.TourEditorMode,n+1,function(){e.ActivateSegment(n)}));break;case eContent.TourEditorMode.FreeHand:(u||f.Start.Latitude!=t&&f.Start.Longitude!=i)&&(f.Start=new eContent.TourPoint(t,i,null,r),f.Points[0]=new eContent.LatLong(t,i),this._RenderShapeLayer(n+1),this._ShowSegments(n),this.ActivateSegment(n))}}},_Recalculate:function(n,t,i,r){var f=this,u=this.GetSegment(t),s=u.Start!=null?u.Start.TourPointPinDataInfo:null,o=u.End!=null?u.End.TourPointPinDataInfo:null,a,e;switch(n){case eContent.TourEditorMode.Routing:var h=u.Start!=null?new eContent.LatLong(u.Start.Latitude,u.Start.Longitude):null,c=u.End!=null?new eContent.LatLong(u.End.Latitude,u.End.Longitude):null,l=u.WayPoints!=null&&u.WayPoints.length<=50?u.WayPoints:[];if(f._StopAllEditors(),t==0){u.Points.length==0?u.Points.push(u.End):u.Points[0].End=u.End;u.ShapeLayer=new eContent.ShapeLayer;i!=null&&i();return}ecMap.RoutingEngine.OnSuccess=function(n){u.Start.Latitude=n.AllPoints[0].Latitude;u.Start.Longitude=n.AllPoints[0].Longitude;u.End.Latitude=n.AllPoints[n.AllPoints.length-1].Latitude;u.End.Longitude=n.AllPoints[n.AllPoints.length-1].Longitude;s!=null&&(u.Start.TourPointPinDataInfo=s);o!=null&&(u.End.TourPointPinDataInfo=o,u.Name=o.Title);u.Points=ecMap.RoutingEngine.GetCurrentTourPoints();u.WayPoints=[];for(var r=0;r<n.AllPoints.length-1;r++)n.AllPoints[r].Latitude!=u.Start.Latitude&&n.AllPoints[r].Longitude!=u.Start.Longitude&&n.AllPoints[r].Latitude!=u.End.Latitude&&n.AllPoints[r].Longitude!=u.End.Longitude&&u.WayPoints.push(new eContent.TourPoint(n.AllPoints[r].Latitude,n.AllPoints[r].Longitude,null,null));f._GetElevationData(u.Points,function(r){u.AltitudeAbsolut=r.ElevAsc;u.AltitudeAbsolutDesc=r.ElevDesc;u.AltitudeMax=r.AltitudeMax;u.AltitudeMin=r.AltitudeMin;u.Length=parseFloat(n.Length).toFixed(3);u.LinearDistance=parseFloat(n.LinearDistance).toFixed(3);u.Duration=n.Duration!=null&&parseFloat(n.Duration)!=0&&!/^Hiking/.test(u.RoutingProviderId)?parseFloat(n.Duration)/3600:parseFloat(f._GetSegmentDuration(u)).toFixed(2);f._RenderShapeLayer(t);f._ShowSegments(t);f._ecMap.StopTourEditor();n.DestinationLatitude!=null&&f._UpdateLeadingSegment(t,n.StartLatitude,n.StartLongitude,s);n.DestinationLatitude!=null&&f._UpdateFollowingSegment(t,n.DestinationLatitude,n.DestinationLongitude,o);f.OnUnBlockUi();i!=null&&i();f.OnChangeCallback();f.OnRoutingFinished()})};ecMap.RoutingEngine.SetProviderId(u.RoutingProviderId);ecMap.RoutingEngine.AddWayPoint(h);l!=null&&l.length>0&&l.forEach(function(n){n.Latitude!=h.Latitude&&n.Longitude!=h.Longitude&&n.Latitude!=c.Latitude&&n.Longitude!=c.Longitude&&ecMap.RoutingEngine.AddWayPoint(new eContent.LatLong(n.Latitude,n.Longitude))});u.End!=null&&ecMap.RoutingEngine.AddWayPoint(c);h!=null&&h.Latitude!=null&&h.Longitude!=null&&c!=null&&c.Latitude!=null&&c.Longitude!=null&&f.OnBlockUi();ecMap.RoutingEngine.Update();f._ShowSegments(t);ecMap.RoutingEngine.OnChange=function(n){var i,r;if(u.Start!=null&&u.Start.Latitude==n.StartLatitude&&u.Start.Longitude==n.StartLongitude&&(i=ecMap.RoutingEngine.GetAllPoints(),i.length>0)){for(f.OnBlockUi(),u.Start.Latitude=i[0].Latitude,u.Start.Longitude=i[0].Longitude,u.WayPoints=[],r=0;r<i.length-1;r++)u.WayPoints.push(new eContent.TourPoint(i[r].Latitude,i[r].Longitude,null,null));u.End.Latitude=i[i.length-1].Latitude;u.End.Longitude=i[i.length-1].Longitude;u.Points=ecMap.RoutingEngine.GetCurrentTourPoints();f._RenderShapeLayer(t);f.OnUnBlockUi()}};break;case eContent.TourEditorMode.FreeHand:ecMap.RoutingEngine.Reset();f._currentIndex!=t||r!=null&&r?(f._RenderShapeLayer(t),f._ShowSegments(t),u.Start!=null&&f._UpdateLeadingSegment(t,u.Start.Latitude,u.Start.Longitude,s),u.End!=null&&f._UpdateFollowingSegment(t,u.End.Latitude,u.End.Longitude,o),i!=null&&i(),f.OnChangeCallback()):(a=f._ecMap.GetEditedTour(),a!=null&&(e=a.GetPoints(),f._ecMap.StopTourEditor(),this._GetElevationData(e,function(n){u.Points=e;u.Start=new eContent.TourPoint(e[0].Latitude,e[0].Longitude,null,s);u.End=new eContent.TourPoint(e[e.length-1].Latitude,e[e.length-1].Longitude,null,o);u.AltitudeAbsolut=n.ElevAsc;u.AltitudeAbsolutDesc=n.ElevDesc;u.AltitudeMax=n.AltitudeMax;u.AltitudeMin=n.AltitudeMin;u.Length=f._GetLengthOfPolyline(e).toFixed(3);e!=null&&e.length>1&&(u.LinearDistance=f._GetLengthOfPolyline([e[0],e[e.length-1]]).toFixed(3));u.Duration=parseFloat(f._GetSegmentDuration(u)).toFixed(2);f._RenderShapeLayer(t);f._ShowSegments(t);u.Start!=null&&f._UpdateLeadingSegment(t,u.Start.Latitude,u.Start.Longitude,s);u.End!=null&&f._UpdateFollowingSegment(t,u.End.Latitude,u.End.Longitude,o);i!=null&&i();f.OnChangeCallback()},function(){})));break;case eContent.TourEditorMode.Selection:alert("NotImplemented")}},_RecalculateWayPointNumbers:function(n,t){var r,i,f,e,o,u;if(n!=null)if(i=this._segments[n],t){for(r=0,f=0;f<n&&f<this._segments.length;f++)e=this._segments[f],e.End!=null&&e.End.TourPointPinDataInfo!=null&&e.End.TourPointPinDataInfo.WayPointNumber!=null&&r++;i.End!=null&&i.End.TourPointPinDataInfo!=null&&(i.End.TourPointPinDataInfo.WayPointNumber=++r)}else i.End!=null&&i.End.TourPointPinDataInfo!=null&&(i.End.TourPointPinDataInfo.WayPointNumber=null,i.Pin=i.End.TourPointPinDataInfo.Title!=null&&i.End.TourPointPinDataInfo.Title!=""?i.End.TourPointPinDataInfo!=null&&i.End.TourPointPinDataInfo.Hashlink!=null?eContent.TourEditorPins.MetaObject:eContent.TourEditorPins.OwnObject:null);for(r=0,o=0;o<this._segments.length;o++)u=this._segments[o],u.End!=null&&u.End.TourPointPinDataInfo!=null&&u.End.TourPointPinDataInfo.WayPointNumber!=null&&(r++,u.End.TourPointPinDataInfo.WayPointNumber=r,u.Pin=eContent.TourEditorPins.NumberedPinRed.replace("{0}",r));this._ReDrawPinShapes()},_SaveShape:function(n){var t=this.GetSegment(n),i;t!=null&&t.Points!=null&&t.Points.length>1&&(i=ecMap.CreateTourShape(t.Points),i.SetLineColor(eContent.TourEditorColors.Inactive),t.ShapeLayer.DeleteAllShapes(),t.ShapeLayer.AddShape(i))},_ShowSegments:function(n){var t,i,r;for(n==null&&(n=this._currentIndex),t=0;t<this.GetSegmentCount();t++)i=this.GetSegment(t),t!=n&&(i.ShapeLayer==null||(r=i.ShapeLayer.GetShapeByIndex(0),r!=null&&(r.SetLineColor(eContent.TourEditorColors.Inactive),i.TourEditorMode==eContent.TourEditorMode.Routing&&i.ShapeLayer.Show())))},_SetSegmentEndPoint:function(n,t){var r,i;if(n==null&&(n=this._currentIndex),t!=null){r=this.GetSegment(n);switch(r.TourEditorMode){case eContent.TourEditorMode.Routing:this._segments[n].End=t;this._Recalculate(this.CurrentMode,n);break;case eContent.TourEditorMode.FreeHand:i=this._ecMap.GetEditedTour();i!=null&&(i._latlngs[i._latlngs.length-1]=new eContent.LatLong(t.Latitude,t.Longitude),this._Recalculate(this.CurrentMode,n),this._ActivateSegment(n,!1))}r.Name=t.TourPointPinDataInfo!=null&&t.TourPointPinDataInfo.Title!=null&&t.TourPointPinDataInfo.Title!=""?t.TourPointPinDataInfo.Title:""}},_StopAllEditors:function(n){for(var t=0;t<this.GetSegmentCount();t++)this._SaveShape(t);this._ecMap.StopTourEditor();ecMap.RoutingEngine.Reset();n!=null&&n()},ActivateSegment:function(n,t,i){var r,u;(t==null&&(t=!0),r=n,r==0&&(r=1),r!=1||this.GetSegment(r).End!=null)&&(u=this,this._StopAllEditors(function(){u._ActivateSegment(r,t,i)}))},AddPointAsDivisionOfCurrentSegment:function(n){var u=this,r=this._currentIndex,t=this.GetSegment(r),s=t.Start,h=t.End,c=t.Pin,i,f,e,o;this._history.Add(new eContent.HistoryItem("AddPointAsDivisionOfCurrentSegment",{Index:this._currentIndex,point:n}));i=new eContent.TourSegment(t.Start,t.End,null,t.TourEditorMode,t.RoutingProviderId,t.Name);t.TourEditorMode=="Routing"?(t.Start=s,t.End=n,t.WayPoints=null,t.Points=[],t.Pin=eContent.TourEditorPins.MetaObject,t.Name="",i.Start=n,i.End=h,i.WayPoints=null,i.Points=[],i.Pin=c):t.TourEditorMode=="FreeHand"&&(f=this._GetSplitIndex(t.Points,n),e=t.Points.slice(0,f+1),e.push(new eContent.LatLong(n.Latitude,n.Longitude)),o=t.Points.slice(f),o.unshift(new eContent.LatLong(n.Latitude,n.Longitude)),t.Start=s,t.End=n,t.WayPoints=null,t.Points=e,t.Pin=eContent.TourEditorPins.MetaObject,t.Name="",i.Start=n,i.End=h,i.WayPoints=null,i.Points=o,i.Pin=c);this._segments[r]=t;this._segments.splice(r+1,0,i);this._Recalculate(t.TourEditorMode,r,function(){u._Recalculate(t.TourEditorMode,r+1,function(){n.TourPointPinDataInfo!=null&&(n.TourPointPinDataInfo.Hashlink!=null&&n.TourPointPinDataInfo.Hashlink!=""?u._AddPin(r,n.Latitude,n.Longitude,eContent.TourEditorPins.MetaObject,eContent.TourEditorPinTypes.Segment,n.TourPointPinDataInfo.Title):u._AddPin(r,n.Latitude,n.Longitude,eContent.TourEditorPins.OwnObject,eContent.TourEditorPinTypes.Segment,n.TourPointPinDataInfo.Title));u._currentIndex=r+1;u.OnChangeCallback()},!0)},!0)},AddPointAsEndPointOfNewSegment:function(n){this._currentIndex==-1&&(this._currentIndex=this.GetSegmentCount()-1);this._history.Add(new eContent.HistoryItem("AddPointAsEndPointOfNewSegment",{Index:this._currentIndex,point:n}));this._AddPoint(this._currentIndex,n);n.TourPointPinDataInfo!=null&&(n.TourPointPinDataInfo.Hashlink!=null&&n.TourPointPinDataInfo.Hashlink!=""?this._AddPin(this._currentIndex,n.Latitude,n.Longitude,eContent.TourEditorPins.MetaObject,eContent.TourEditorPinTypes.Segment,n.TourPointPinDataInfo.Title):this._AddPin(this._currentIndex,n.Latitude,n.Longitude,eContent.TourEditorPins.OwnObject,eContent.TourEditorPinTypes.Segment,n.TourPointPinDataInfo.Title));this.OnChangeCallback();this.OnUnBlockUi()},AddOffRoutePoint:function(n){this._history.Add(new eContent.HistoryItem("AddOffRoutePoint",{Index:this._offRoutePoints.length,point:n}));this._offRoutePoints.push(n);n.TourPointPinDataInfo!=null&&(n.TourPointPinDataInfo.Hashlink!=null&&n.TourPointPinDataInfo.Hashlink!=""?this._AddPin(this._offRoutePoints.length-1,n.Latitude,n.Longitude,eContent.TourEditorPins.MetaOffRouteObject,eContent.TourEditorPinTypes.OffRoutePoint,n.TourPointPinDataInfo.Title):this._AddPin(this._offRoutePoints.length-1,n.Latitude,n.Longitude,eContent.TourEditorPins.OwnOffRouteObject,eContent.TourEditorPinTypes.OffRoutePoint,n.TourPointPinDataInfo.Title));this._ReDrawPinShapes();this.OnChangeCallback();this.OnUnBlockUi()},AddSegment:function(n,t,i){t==null&&(t=!0);t&&this._history.Add(new eContent.HistoryItem("AddSegment",{Index:this._currentIndex,Segment:n}));this._segments.push(n);this._currentIndex=this._segments.length-1;(i==null||i==!1)&&this.OnChangeCallback()},Clear:function(){},GenerateJsonObjectFromPoints:function(n){var u=this._ecMap.PointsToTourString(n),i=this._GetLengthOfPolyline(n).toFixed(3),t=n[0],f=n[n.length-1],e=this._ecMap.RoutingEngine.RoutingTypes[0].Id,r=[];return r.push({Start:null,End:new eContent.TourPoint(t.Latitude,t.Longitude,null,null),WayPoints:null,TourEditorMode:eContent.TourEditorMode.FreeHand,RoutingProviderId:e,TourString:null,Length:null,LinearDistance:null,Name:"",Pin:eContent.TourEditorPins.MetaObject,Duration:0,AltitudeAbsolut:0,AltitudeAbsolutDesc:0,AltitudeMax:0,AltitudeMin:0}),r.push({Start:new eContent.TourPoint(t.Latitude,t.Longitude,null,null),End:new eContent.TourPoint(f.Latitude,f.Longitude,null,null),WayPoints:n,TourEditorMode:eContent.TourEditorMode.FreeHand,RoutingProviderId:e,TourString:u,Length:i,LinearDistance:i,Name:"",Pin:eContent.TourEditorPins.MetaObject,Duration:0,AltitudeAbsolut:0,AltitudeAbsolutDesc:0,AltitudeMax:0,AltitudeMin:0}),{TotalTourString:u,Length:i,Duration:0,AltitudeAbsolut:0,AltitudeAbsolutDesc:0,AltitudeMax:0,AltitudeMin:0,Segments:r,OffRoutePoints:[]}},ConvertSegment:function(n,t){var i=this;n==null&&(n=this._currentIndex);this._history.Add(new eContent.HistoryItem("ConvertSegment",{Index:n,doDouglasPeucker:t}));this._StopAllEditors(function(){i._segments[n].TourEditorMode=i.GetSegment(n).TourEditorMode==eContent.TourEditorMode.Routing?eContent.TourEditorMode.FreeHand:eContent.TourEditorMode.Routing;i._segments[n].TourEditorMode==eContent.TourEditorMode.FreeHand?(i.SetOnMapClickEventEnabled(!1),t!=null&&t&&(i._segments[n].Points=i._DoTheDouglasPeucker(i._segments[n].Points))):i.SetOnMapClickEventEnabled(!0);i._ActivateSegment(n,!0,function(){i.OnChangeCallback()})})},ConvertSegmentToFreehand:function(n,t){this.GetSegment(n).TourEditorMode!=eContent.TourEditorMode.FreeHand&&this.ConvertSegment(n,t)},DoTheDouglasPeucker:function(n){n==null&&(n=this._currentIndex);n>-1&&(this._history.Add(new eContent.HistoryItem("DoTheDouglasPeucker",{Index:n,points:this._segments[n].Points})),this._segments[n].Points=this._DoTheDouglasPeucker(this._segments[n].Points),this.ActivateSegment(n),this.OnChangeCallback())},GetCurrentIndex:function(){return this._currentIndex},GetJson:function(){for(var n,i,r,e=[],o=[],s=[],h=0,c=0,l=0,a=0,u=0,t=0,f=0;f<this.GetSegmentCount();f++){for(n=this.GetSegment(f),i=0;i<n.Points.length;i++)s.push(n.Points[i]);n.Length!=null&&n.Length>0&&(h+=parseFloat(n.Length));n.Duration!=null&&n.Duration>0&&(c+=parseFloat(n.Duration));n.AltitudeAbsolut!=null&&n.AltitudeAbsolut>0&&(l+=parseFloat(n.AltitudeAbsolut));n.AltitudeAbsolutDesc!=null&&n.AltitudeAbsolutDesc>0&&(a+=parseFloat(n.AltitudeAbsolutDesc));n.AltitudeMax!=null&&parseFloat(n.AltitudeMax)>u&&(u=parseFloat(n.AltitudeMax));n.AltitudeMin!=null&&(t==0||parseFloat(n.AltitudeMin)<t)&&(t=parseFloat(n.AltitudeMin));e.push({Start:n.Start==null?null:new eContent.TourPoint(n.Start.Latitude,n.Start.Longitude,n.Start.GeoCodeInfo,n.Start.TourPointPinDataInfo),End:n.End==null?null:new eContent.TourPoint(n.End.Latitude,n.End.Longitude,n.End.GeoCodeInfo,n.End.TourPointPinDataInfo,n.End.LeistungId),WayPoints:n.WayPoints,TourEditorMode:n.TourEditorMode,RoutingProviderId:n.RoutingProviderId,TourString:n.Start!=null?this._ecMap.PointsToTourString(n.Points):"",Length:n.Length,LinearDistance:n.LinearDistance,Name:n.Name,Pin:n.Pin,Duration:n.Duration,AltitudeAbsolut:n.AltitudeAbsolut,AltitudeAbsolutDesc:n.AltitudeAbsolutDesc,AltitudeMax:n.AltitudeMax,AltitudeMin:n.AltitudeMin})}for(r=0;r<this._offRoutePoints.length;r++)o.push(this._offRoutePoints[r]);return{TotalTourString:this._ecMap.PointsToTourString(s),Length:h.toFixed(3),Duration:c.toFixed(2),AltitudeAbsolut:l.toFixed(0),AltitudeAbsolutDesc:a.toFixed(0),AltitudeMax:u.toFixed(0),AltitudeMin:t.toFixed(0),Segments:e,OffRoutePoints:o}},GetJSonString:function(){var n=this.GetJson();return JSON.stringify(n)},GetLinkedObjects:function(){function f(t){for(var r=!1,i=0;i<n.length;i++)if(n[i].Hashlink!=null){if(n[i].Hashlink==t.Hashlink){r=!0;break}}else if(n[i].Title==t.Title&&n[i].Latitude==t.Latitude&&n[i].Longitude==t.Longitude){r=!0;break}r||n.push(t)}for(var t,i,r,n=[],u=0;u<this.GetSegmentCount();u++)t=this.GetSegment(u),t!=null&&(i=t.Start,r=t.End,i!=null&&i.TourPointPinDataInfo!=null&&f(i.TourPointPinDataInfo),r!=null&&r.TourPointPinDataInfo!=null&&f(r.TourPointPinDataInfo));return n},GetOffRoutePoint:function(n){return this._offRoutePoints[n]},GetOnMapClickEventEnabled:function(){return this._onMapClickEventEnabled},GetSegment:function(n){return n==null&&(n=this._currentIndex),this._segments[n]},GetSegmentCount:function(){return this._segments.length},LoadFromJson:function(n,t){var e,u,i,r,f;for(this.Reset(!0),u=0;u<n.Segments.length;u++)i=n.Segments[u],r=new eContent.TourSegment(i.Start,i.End,i.WayPoints,i.TourEditorMode,i.RoutingProviderId,i.Name),r.Start=i.Start,r.End=i.End,r.Points=i.TourString!=null?this._ecMap.TourStringToPoints(i.TourString):[],r.Length=i.Length,r.LinearDistance=i.LinearDistance,r.Pin=i.Pin,r.Duration=i.Duration==0?this._GetSegmentDuration(i):i.Duration,r.AltitudeAbsolut=i.AltitudeAbsolut,r.AltitudeAbsolutDesc=i.AltitudeAbsolutDesc,r.AltitudeMax=i.AltitudeMax,r.AltitudeMin=i.AltitudeMin,e=i.RoutingProviderId,this.AddSegment(r,!0,!0),this._RenderShapeLayer(u,!0);if(n.OffRoutePoints!=null&&n.OffRoutePoints.length>0)for(f=0;f<n.OffRoutePoints.length;f++)this._offRoutePoints.push(n.OffRoutePoints[f]);this._ReDrawPinShapes();this._ShowSegments(-1);this._currentIndex=-1;e!=null&&this.SetCurrentRoutingProviderId(e);t!=null&&setTimeout(function(){t()},100);this.OnChangeCallback()},LoadFromJsonString:function(n,t){if(n!=null&&n!=""){var i=JSON.parse(n);this.LoadFromJson(i,t)}else t!=null&&t()},LoadFromJsonStringAndReRoute:function(n,t){var i=this,r=this._ecMap.RoutingEngine.RoutingTypes[0].Id;this.LoadFromJsonString(n,function(){if(i.GetSegmentCount()==2){var n=i.GetSegment(1);n.TourEditorMode=eContent.TourEditorMode.Routing;n.RoutingProviderId=r;n.WayPoints=i._DoTheDouglasPeucker(n.Points,10);i.ActivateSegment(1,!1);t!=null&&setTimeout(function(){t()},100);i.OnChangeCallback()}})},ReCalculateMetaInformations:function(){for(var n=this,t=0;t<n.GetSegmentCount();t++)(function(t){n._GetElevationData(t.Points,function(i){t.AltitudeAbsolut=i.ElevAsc;t.AltitudeAbsolutDesc=i.ElevDesc;t.AltitudeMax=i.AltitudeMax;t.AltitudeMin=i.AltitudeMin;t.Length=n._GetLengthOfPolyline(t.Points).toFixed(3);t.Points!=null&&t.Points.length>1&&(t.LinearDistance=n._GetLengthOfPolyline([t.Points[0],t.Points[t.Points.length-1]]).toFixed(3));t.Duration=parseFloat(n._GetSegmentDuration(t)).toFixed(2);n.OnChangeCallback()})})(n.GetSegment(t))},ReDrawPinShapes:function(){this._ReDrawPinShapes()},RemovePointsFromFreehandSegment:function(n){var t=this.GetSegment(n);t.Points.length>2&&t.Points.splice(1,t.Points.length-2)},RemoveOffRoutePoint:function(n){this._history.Add(new eContent.HistoryItem("RemoveOffRoutePoint",{Index:n,point:this._offRoutePoints[n]}));this._offRoutePoints.splice(n,1);this._ReDrawPinShapes();this.OnChangeCallback()},RemoveSegment:function(n){var t,r,u,i,f,e;if(n==null&&(n=this._currentIndex),this._history.Add(new eContent.HistoryItem("RemoveSegment",{Index:n,segment:this.GetSegment(n)})),t=this.GetSegment(n),r=this.GetSegmentCount(),r==1||n==0&&r==2){this.Reset();return}t.ShapeLayer!=null&&(u=t.ShapeLayer.GetShapeByIndex(0),u!=null?(ecMap.DeleteShape(u),t.ShapeLayer.DeleteAllShapes(),t.Points=[]):(i=this.GetSegment(1),i.ShapeLayer!=null&&(f=i.ShapeLayer.GetShapeByIndex(0),f!=null&&(ecMap.DeleteShape(f),i.ShapeLayer.DeleteAllShapes(),i.Start=null,i.Points=[]))));this._segments.splice(n,1);n==0?(this._segments[0].Start=null,this._segments[0].ShapeLayer!=null&&(e=this._segments[0].ShapeLayer.GetShapeByIndex(0),e!=null&&(ecMap.DeleteShape(e),this._segments[0].ShapeLayer.DeleteAllShapes(),this._segments[0].Points=[])),this.ActivateSegment(0)):n==r-1?this.ActivateSegment(r-2):(this._UpdateFollowingSegment(n-1,t.Start.Latitude,t.Start.Longitude,t.Start.TourPointPinDataInfo),this.ActivateSegment(n));this._RecalculateWayPointNumbers();this.OnChangeCallback()},Reset:function(n){var i,t,r;for(this._StopAllEditors(),this._pinLayer.DeleteAllShapes(),i=0;i<this.GetSegmentCount();i++)t=this.GetSegment(i),t.ShapeLayer!=null&&(r=t.ShapeLayer.GetShapeByIndex(0),r!=null&&r.SetLineColor(eContent.TourEditorColors.Hidden),t.ShapeLayer.Hide()),t.ShapeLayer=null;this._segments=[];this._offRoutePoints=[];this._currentIndex=-1;this._history=new eContent.History;(n==null||n==!1)&&this.OnChangeCallback()},SetCategories:function(n,t){var i=this.GetSegment(n),r;if(this._history.Add(new eContent.HistoryItem("SetCategories",{Index:n,categories:t,oldCategories:i.End.TourPointPinDataInfo.Categories})),i.End!=null&&i.End.TourPointPinDataInfo!=null){for(i.End.TourPointPinDataInfo.Categories=[],r=0;r<t.length;r++)i.End.TourPointPinDataInfo.Categories.indexOf(t[r])==-1&&i.End.TourPointPinDataInfo.Categories.push(t[r]);this.OnChangeCallback()}},SetCategoriesAndWayPointNumber:function(n,t,i){var r=this.GetSegment(n),u;if(this._history.Add(new eContent.HistoryItem("SetCategoriesAndWayPointNumber",{Index:n,categories:t,oldCategories:r.End.TourPointPinDataInfo.Categories,setWayPointNumber:i})),r.End!=null&&r.End.TourPointPinDataInfo!=null)for(r.End.TourPointPinDataInfo.Categories=[],u=0;u<t.length;u++)r.End.TourPointPinDataInfo.Categories.indexOf(t[u])==-1&&r.End.TourPointPinDataInfo.Categories.push(t[u]);this._RecalculateWayPointNumbers(n,i);this.OnChangeCallback()},SetCategoriesOffRoutePoint:function(n,t){var i=this._offRoutePoints[n],r;if(this._history.Add(new eContent.HistoryItem("SetCategoriesOffRoutePoint",{Index:n,categories:t,oldCategories:i.TourPointPinDataInfo.Categories})),i.TourPointPinDataInfo!=null){for(i.TourPointPinDataInfo.Categories=[],r=0;r<t.length;r++)i.TourPointPinDataInfo.Categories.indexOf(t[r])==-1&&i.TourPointPinDataInfo.Categories.push(t[r]);this.OnChangeCallback()}},SetCurrentFreehandMode:function(n,t){if(this.SetCurrentMode(eContent.TourEditorMode.FreeHand),this.CurrentRoutingProviderId=n,this._currentIndex>-1){var i=this.GetSegment(this._currentIndex);i.TourEditorMode=eContent.TourEditorMode.FreeHand;i.RoutingProviderId=this.CurrentRoutingProviderId;i.Duration=this._GetSegmentDuration(i)}this.SetOnMapClickEventEnabled(!0);t!=null&&t();this.OnChangeCallback()},SetCurrentMode:function(n){this._history.Add(new eContent.HistoryItem("SetCurrentMode",{mode:n,lastMode:this.LastMode}));this.LastMode=this.CurrentMode;this.CurrentMode=n;this.GetSegmentCount()==0&&(this.LastMode=n);this.CurrentMode==eContent.TourEditorMode.FreeHand?this.SetOnMapClickEventEnabled(!1):this.SetOnMapClickEventEnabled(!0)},SetCurrentRoutingProviderId:function(n){if(this._history.Add(new eContent.HistoryItem("SetCurrentRoutingProviderId",{routingProviderId:n,lastRoutingProviderId:this.CurrentRoutingProviderId})),this.SetCurrentMode(eContent.TourEditorMode.Routing),this.CurrentRoutingProviderId=n,this._currentIndex>-1){var t=this.GetSegment(this._currentIndex);t.TourEditorMode=eContent.TourEditorMode.Routing;t.RoutingProviderId=this.CurrentRoutingProviderId}ecMap.RoutingEngine.SetProviderId(this.CurrentRoutingProviderId);this.OnChangeCallback()},SetDescription:function(n,t){var i=this.GetSegment(n);this._history.Add(new eContent.HistoryItem("SetDescription",{Index:n,description:t,oldDescription:i.End.TourPointPinDataInfo.Description}));i.End!=null&&i.End.TourPointPinDataInfo!=null&&(i.End.TourPointPinDataInfo.Description=t);this.OnChangeCallback()},SetPin:function(n,t){n==null&&(n=this._currentIndex);t==null&&(t=eContent.TourEditorPins.MetaObject);var i=this.GetSegment(n);i.Pin=t;this._ReDrawPinShapes()},SetPointName:function(n,t){n==null&&(n=this._currentIndex);var i=this.GetSegment(n);this._history.Add(new eContent.HistoryItem("SetPointName",{Index:n,title:t,oldTitle:i.Name}));i.Name=t;i.End.TourPointPinDataInfo!=null?(i.End.TourPointPinDataInfo.Title=t,(i.End.TourPointPinDataInfo.Latitude==null||i.End.TourPointPinDataInfo.Longitude==null)&&(i.End.TourPointPinDataInfo.Latitude=i.End.Latitude,i.End.TourPointPinDataInfo.Longitude=i.End.Longitude)):(i.End.TourPointPinDataInfo=new eContent.TourPointPinDataInfo(null,t,null,null,null,null,i.End.Latitude,i.End.Longitude),i.Pin=eContent.TourEditorPins.OwnObject);this.ReDrawPinShapes();this.OnChangeCallback()},SetOffTrackWaypointName:function(n,t){var i=this._offRoutePoints[n];this._history.Add(new eContent.HistoryItem("SetOffTrackWaypointName",{Index:n,title:t,oldTitle:i.TourPointPinDataInfo!=null&&i.TourPointPinDataInfo.Title!=null?i.TourPointPinDataInfo.Title:""}));i.TourPointPinDataInfo!=null?i.TourPointPinDataInfo.Title=t:(i.TourPointPinDataInfo=new eContent.TourPointPinDataInfo(null,t,null,null,null,null,i.Latitude,i.Longitude),i.Pin=eContent.TourEditorPins.OwnOffRouteObject);this.ReDrawPinShapes();this.OnChangeCallback()},SetOffTrackWaypointNumber:function(n,t){var i=this._offRoutePoints[n];this._history.Add(new eContent.HistoryItem("SetOffTrackWaypointNumber",{Index:n,value:t,oldValue:i.TourPointPinDataInfo.WayPointNumber}));i.TourPointPinDataInfo!=null&&(i.TourPointPinDataInfo.WayPointNumber=t);this.OnChangeCallback()},SetOnMapClickEventEnabled:function(n){this._onMapClickEventEnabled=n;this.OnMapClickEventEnabledChangedCallback()},OnPinMoved:function(n,t,i,r){t.Latitude=i.Latitude;t.Longitude=i.Longitude;t.TourPointPinDataInfo!=null&&(t.TourPointPinDataInfo.Latitude=i.Latitude,t.TourPointPinDataInfo.Longitude=i.Longitude);r()},OnChangeCallback:function(){},OnMapClickEventEnabledChangedCallback:function(){},OnRoutingFinished:function(){},OnMapSegmentLineClicked:function(){},OnBlockUi:function(){},OnUnBlockUi:function(){}};

 

 


© hubermedia 2018 Privacy Statement Imprint