mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-01-28 07:03:17 +08:00
43 lines
26 KiB
JavaScript
43 lines
26 KiB
JavaScript
|
!function(){if("ontouchstart"in window){var t,e,n,r,i,a,o={};t=function(t,e){return Math.abs(t[0]-e[0])>5||Math.abs(t[1]-e[1])>5},e=function(t){this.startXY=[t.touches[0].clientX,t.touches[0].clientY],this.threshold=!1},n=function(e){return this.threshold?!1:void(this.threshold=t(this.startXY,[e.touches[0].clientX,e.touches[0].clientY]))},r=function(e){if(!this.threshold&&!t(this.startXY,[e.changedTouches[0].clientX,e.changedTouches[0].clientY])){var n=e.changedTouches[0],r=document.createEvent("MouseEvents");r.initMouseEvent("click",!0,!0,window,0,n.screenX,n.screenY,n.clientX,n.clientY,!1,!1,!1,!1,0,null),r.simulated=!0,e.target.dispatchEvent(r)}},i=function(t){var e=Date.now(),n=e-o.time,r=t.clientX,i=t.clientY,u=[Math.abs(o.x-r),Math.abs(o.y-i)],s=a(t.target,"A")||t.target,c=s.nodeName,l="A"===c,h=window.navigator.standalone&&l&&t.target.getAttribute("href");return o.time=e,o.x=r,o.y=i,(!t.simulated&&(500>n||1500>n&&u[0]<50&&u[1]<50)||h)&&(t.preventDefault(),t.stopPropagation(),!h)?!1:(h&&(window.location=s.getAttribute("href")),void(s&&s.classList&&(s.classList.add("energize-focus"),window.setTimeout(function(){s.classList.remove("energize-focus")},150))))},a=function(t,e){for(var n=t;n!==document.body;){if(!n||n.nodeName===e)return n;n=n.parentNode}return null},document.addEventListener("touchstart",e,!1),document.addEventListener("touchmove",n,!1),document.addEventListener("touchend",r,!1),document.addEventListener("click",i,!0)}}(),/*
|
||
|
Copyright 2008-2013 Concur Technologies, Inc.
|
||
|
|
||
|
Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||
|
not use this file except in compliance with the License. You may obtain
|
||
|
a copy of the License at
|
||
|
|
||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||
|
|
||
|
Unless required by applicable law or agreed to in writing, software
|
||
|
distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||
|
WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||
|
License for the specific language governing permissions and limitations
|
||
|
under the License.
|
||
|
*/
|
||
|
function(t){"use strict";function e(e){if(e&&""!==e){$(".lang-selector a").removeClass("active"),$(".lang-selector a[data-language-name='"+e+"']").addClass("active");for(var n=0;n<s.length;n++)$(".highlight."+s[n]).hide();$(".highlight."+e).show(),t.toc.calculateHeights(),$(window.location.hash).get(0)&&$(window.location.hash).get(0).scrollIntoView(!0)}}function n(t){return"string"!=typeof t?{}:(t=t.trim().replace(/^(\?|#|&)/,""),t?t.split("&").reduce(function(t,e){var n=e.replace(/\+/g," ").split("="),r=n[0],i=n[1];return r=decodeURIComponent(r),i=void 0===i?null:decodeURIComponent(i),t.hasOwnProperty(r)?Array.isArray(t[r])?t[r].push(i):t[r]=[t[r],i]:t[r]=i,t},{}):{})}function r(t){return t?Object.keys(t).sort().map(function(e){var n=t[e];return Array.isArray(n)?n.sort().map(function(t){return encodeURIComponent(e)+"="+encodeURIComponent(t)}).join("&"):encodeURIComponent(e)+"="+encodeURIComponent(n)}).join("&"):""}function i(){if(location.search.length>=1){var t=n(location.search).language;if(t)return t;if(-1!=jQuery.inArray(location.search.substr(1),s))return location.search.substr(1)}return!1}function a(t){var e=n(location.search);return e.language?(e.language=t,r(e)):t}function o(t){if(history){var e=window.location.hash;e&&(e=e.replace(/^#+/,"")),history.pushState({},"","?"+a(t)+"#"+e),localStorage.setItem("language",t)}}function u(t){var n=localStorage.getItem("language");s=t;var r=i();r?(e(r),localStorage.setItem("language",r)):e(null!==n&&-1!=jQuery.inArray(n,s)?n:s[0])}var s=[];t.setupLanguages=u,t.activateLanguage=e,$(function(){$(".lang-selector a").on("click",function(){var t=$(this).data("language-name");return o(t),e(t),!1}),window.onpopstate=function(){e(i())}})}(window),/*! jQuery UI - v1.11.3 - 2015-02-12
|
||
|
* http://jqueryui.com
|
||
|
* Includes: widget.js
|
||
|
* Copyright 2015 jQuery Foundation and other contributors; Licensed MIT */
|
||
|
function(t){"function"==typeof define&&define.amd?define(["jquery"],t):t(jQuery)}(function(t){/*!
|
||
|
* jQuery UI Widget 1.11.3
|
||
|
* http://jqueryui.com
|
||
|
*
|
||
|
* Copyright jQuery Foundation and other contributors
|
||
|
* Released under the MIT license.
|
||
|
* http://jquery.org/license
|
||
|
*
|
||
|
* http://api.jqueryui.com/jQuery.widget/
|
||
|
*/
|
||
|
var e=0,n=Array.prototype.slice;t.cleanData=function(e){return function(n){var r,i,a;for(a=0;null!=(i=n[a]);a++)try{r=t._data(i,"events"),r&&r.remove&&t(i).triggerHandler("remove")}catch(o){}e(n)}}(t.cleanData),t.widget=function(e,n,r){var i,a,o,u,s={},c=e.split(".")[0];return e=e.split(".")[1],i=c+"-"+e,r||(r=n,n=t.Widget),t.expr[":"][i.toLowerCase()]=function(e){return!!t.data(e,i)},t[c]=t[c]||{},a=t[c][e],o=t[c][e]=function(t,e){return this._createWidget?void(arguments.length&&this._createWidget(t,e)):new o(t,e)},t.extend(o,a,{version:r.version,_proto:t.extend({},r),_childConstructors:[]}),u=new n,u.options=t.widget.extend({},u.options),t.each(r,function(e,r){return t.isFunction(r)?void(s[e]=function(){var t=function(){return n.prototype[e].apply(this,arguments)},i=function(t){return n.prototype[e].apply(this,t)};return function(){var e,n=this._super,a=this._superApply;return this._super=t,this._superApply=i,e=r.apply(this,arguments),this._super=n,this._superApply=a,e}}()):void(s[e]=r)}),o.prototype=t.widget.extend(u,{widgetEventPrefix:a?u.widgetEventPrefix||e:e},s,{constructor:o,namespace:c,widgetName:e,widgetFullName:i}),a?(t.each(a._childConstructors,function(e,n){var r=n.prototype;t.widget(r.namespace+"."+r.widgetName,o,n._proto)}),delete a._childConstructors):n._childConstructors.push(o),t.widget.bridge(e,o),o},t.widget.extend=function(e){for(var r,i,a=n.call(arguments,1),o=0,u=a.length;u>o;o++)for(r in a[o])i=a[o][r],a[o].hasOwnProperty(r)&&void 0!==i&&(e[r]=t.isPlainObject(i)?t.isPlainObject(e[r])?t.widget.extend({},e[r],i):t.widget.extend({},i):i);return e},t.widget.bridge=function(e,r){var i=r.prototype.widgetFullName||e;t.fn[e]=function(a){var o="string"==typeof a,u=n.call(arguments,1),s=this;return o?this.each(function(){var n,r=t.data(this,i);return"instance"===a?(s=r,!1):r?t.isFunction(r[a])&&"_"!==a.charAt(0)?(n=r[a].apply(r,u),n!==r&&void 0!==n?(s=n&&n.jquery?s.pushStack(n.get()):n,!1):void 0):t.error("no such method '"+a+"' for "+e+" widget instance"):t.error("cannot call methods on "+e+" prior to initialization; attempted to call method '"+a+"'")}):(u.length&&(a=t.widget.extend.apply(null,[a].concat(u))),this.each(function(){var e=t.data(this,i);e?(e.option(a||{}),e._init&&e._init()):t.data(this,i,new r(a,this))})),s}},t.Widget=function(){},t.Widget._childConstructors=[],t.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",defaultElement:"<div>",options:{disabled:!1,create:null},_createWidget:function(n,r){r=t(r||this.defaultElement||this)[0],this.element=t(r),this.uuid=e++,this.eventNamespace="."+this.widgetName+this.uuid,this.bindings=t(),this.hoverable=t(),this.focusable=t(),r!==this&&(t.data(r,this.widgetFullName,this),this._on(!0,this.element,{remove:function(t){t.target===r&&this.destroy()}}),this.document=t(r.style?r.ownerDocument:r.document||r),this.window=t(this.document[0].defaultView||this.document[0].parentWindow)),this.options=t.widget.extend({},this.options,this._getCreateOptions(),n),this._create(),this._trigger("create",null,this._getCreateEventData()),this._init()},_getCreateOptions:t.noop,_getCreateEventData:t.noop,_create:t.noop,_init:t.noop,destroy:function(){this._destroy(),this.element.unbind(this.eventNamespace).removeData(this.widgetFullName).removeData(t.camelCase(this.widgetFullName)),this.widget().unbind(this.eventNamespace).removeAttr("aria-disabled").removeClass(this.widgetFullName+"-disabled ui-state-disabled"),this.bindings.unbind(this.eventNamespace),this.hoverable.removeClass("ui-state-hover"),this.focusable.removeClass("ui-state-focus")},_destroy:t.noop,widget:function(){return this.element},option:function(e,n){var r,i,a,o=e;if(0===arguments.length)return t.widget.extend({},this.options);if("string"==typeof e)if(o={},r=e.split("."),e=r.shift(),r.length){for(i=o[e]=t.widget.extend({},this.options[e]),a=0;a<r.length-1;a++)i[r[a]]=i[r[a]]||{},i=i[r[a]];if(e=r.pop(),1===arguments.length)return void 0===i[e]?null:i[e];i[e]=n}else{if(1===arguments.length)return void 0===this.options[e]?null:this.options[e];o[e]=n}return this._setOptions(o),this},_setOptions:functi
|
||
|
* http://www.gregfranko.com/jquery.tocify.js/
|
||
|
* Copyright (c) 2013 Greg Franko; Licensed MIT
|
||
|
* Modified lightly by Robert Lord to fix a bug I found,
|
||
|
* and also so it adds ids to headers
|
||
|
* also because I want height caching, since the
|
||
|
* height lookup for h1s and h2s was causing serious
|
||
|
* lag spikes below 30 fps */
|
||
|
function(t){"use strict";t(window.jQuery,window,document)}(function(t,e,n,r){"use strict";var i="tocify",a="tocify-focus",o="tocify-hover",u="tocify-hide",s="tocify-header",c="."+s,l="tocify-subheader",h="."+l,f="tocify-item",d="."+f,p="tocify-extend-page",g="."+p;t.widget("toc.tocify",{version:"1.8.0",options:{context:"body",ignoreSelector:null,selectors:"h1, h2, h3",showAndHide:!0,showEffect:"slideDown",showEffectSpeed:"medium",hideEffect:"slideUp",hideEffectSpeed:"medium",smoothScroll:!0,smoothScrollSpeed:"medium",scrollTo:0,showAndHideOnScroll:!0,highlightOnScroll:!0,highlightOffset:40,theme:"bootstrap",extendPage:!0,extendPageOffset:100,history:!0,scrollHistory:!1,hashGenerator:"compact",highlightDefault:!0},_create:function(){var n=this;n.tocifyWrapper=t(".tocify-wrapper"),n.extendPageScroll=!0,n.items=[],n._generateToc(),n.cachedHeights=[],n.cachedAnchors=[],n._addCSSClasses(),n.webkit=function(){for(var t in e)if(t&&-1!==t.toLowerCase().indexOf("webkit"))return!0;return!1}(),n._setEventHandlers(),t(e).load(function(){n._setActiveElement(!0),t("html, body").promise().done(function(){setTimeout(function(){n.extendPageScroll=!1},0)})})},_generateToc:function(){var e,n,r=this,a=r.options.ignoreSelector;return e=t(this.options.context).find(-1!==this.options.selectors.indexOf(",")?this.options.selectors.replace(/ /g,"").substr(0,this.options.selectors.indexOf(",")):this.options.selectors.replace(/ /g,"")),e.length?(r.element.addClass(i),void e.each(function(e){t(this).is(a)||(n=t("<ul/>",{id:s+e,"class":s}).append(r._nestElements(t(this),e)),r.element.append(n),t(this).nextUntil(this.nodeName.toLowerCase()).each(function(){0===t(this).find(r.options.selectors).length?t(this).filter(r.options.selectors).each(function(){t(this).is(a)||r._appendSubheaders.call(this,r,n)}):t(this).find(r.options.selectors).each(function(){t(this).is(a)||r._appendSubheaders.call(this,r,n)})}))})):void r.element.addClass(u)},_setActiveElement:function(t){var n=this,r=e.location.hash.substring(1),i=n.element.find("li[data-unique='"+r+"']");return r.length?(n.element.find("."+n.focusClass).removeClass(n.focusClass),i.addClass(n.focusClass),n.options.showAndHide&&i.click()):(n.element.find("."+n.focusClass).removeClass(n.focusClass),!r.length&&t&&n.options.highlightDefault&&n.element.find(d).first().addClass(n.focusClass)),n},_nestElements:function(e,n){var r,i,a;return r=t.grep(this.items,function(t){return t===e.text()}),this.items.push(r.length?e.text()+n:e.text()),a=this._generateHashValue(r,e,n),i=t("<li/>",{"class":f,"data-unique":a}).append(t("<a/>",{text:e.text()})),e.before(t("<div/>",{name:a,"data-unique":a})),i},_generateHashValue:function(t,e,n){var r="",i=this.options.hashGenerator;if("pretty"===i){for(r=e.text().toLowerCase().replace(/\s/g,"-"),r=r.replace(/[^\x00-\x7F]/g,"");r.indexOf("--")>-1;)r=r.replace(/--/g,"-");for(;r.indexOf(":-")>-1;)r=r.replace(/:-/g,"-")}else r="function"==typeof i?i(e.text(),e):e.text().replace(/\s/g,"");return t.length&&(r+=""+n),r},_appendSubheaders:function(e,n){var r=t(this).index(e.options.selectors),i=t(e.options.selectors).eq(r-1),a=+t(this).prop("tagName").charAt(1),o=+i.prop("tagName").charAt(1);o>a?e.element.find(h+"[data-tag="+a+"]").last().append(e._nestElements(t(this),r)):a===o?n.find(d).last().after(e._nestElements(t(this),r)):n.find(d).last().after(t("<ul/>",{"class":l,"data-tag":a})).next(h).append(e._nestElements(t(this),r))},_setEventHandlers:function(){var i=this;this.element.on("click.tocify","li",function(){if(i.options.history&&(e.location.hash=t(this).attr("data-unique")),i.element.find("."+i.focusClass).removeClass(i.focusClass),t(this).addClass(i.focusClass),i.options.showAndHide){var n=t('li[data-unique="'+t(this).attr("data-unique")+'"]');i._triggerShow(n)}i._scrollTo(t(this))}),this.element.find("li").on({"mouseenter.tocify":function(){t(this).addClass(i.hoverClass),t(this).css("cursor","pointer")},"mouseleave.tocify":function(){"bootstrap"!==i.options.theme&&t(this).removeClass(i.hoverClass)}}),t(e).on("resize",function(){i.calculateHeights()}),t(e).on("scroll.tocify",fu
|
||
|
* imagesLoaded PACKAGED v3.1.8
|
||
|
* JavaScript is all like "You images are done yet or what?"
|
||
|
* MIT License
|
||
|
*/
|
||
|
function(){function t(){}function e(t,e){for(var n=t.length;n--;)if(t[n].listener===e)return n;return-1}function n(t){return function(){return this[t].apply(this,arguments)}}var r=t.prototype,i=this,a=i.EventEmitter;r.getListeners=function(t){var e,n,r=this._getEvents();if("object"==typeof t){e={};for(n in r)r.hasOwnProperty(n)&&t.test(n)&&(e[n]=r[n])}else e=r[t]||(r[t]=[]);return e},r.flattenListeners=function(t){var e,n=[];for(e=0;t.length>e;e+=1)n.push(t[e].listener);return n},r.getListenersAsObject=function(t){var e,n=this.getListeners(t);return n instanceof Array&&(e={},e[t]=n),e||n},r.addListener=function(t,n){var r,i=this.getListenersAsObject(t),a="object"==typeof n;for(r in i)i.hasOwnProperty(r)&&-1===e(i[r],n)&&i[r].push(a?n:{listener:n,once:!1});return this},r.on=n("addListener"),r.addOnceListener=function(t,e){return this.addListener(t,{listener:e,once:!0})},r.once=n("addOnceListener"),r.defineEvent=function(t){return this.getListeners(t),this},r.defineEvents=function(t){for(var e=0;t.length>e;e+=1)this.defineEvent(t[e]);return this},r.removeListener=function(t,n){var r,i,a=this.getListenersAsObject(t);for(i in a)a.hasOwnProperty(i)&&(r=e(a[i],n),-1!==r&&a[i].splice(r,1));return this},r.off=n("removeListener"),r.addListeners=function(t,e){return this.manipulateListeners(!1,t,e)},r.removeListeners=function(t,e){return this.manipulateListeners(!0,t,e)},r.manipulateListeners=function(t,e,n){var r,i,a=t?this.removeListener:this.addListener,o=t?this.removeListeners:this.addListeners;if("object"!=typeof e||e instanceof RegExp)for(r=n.length;r--;)a.call(this,e,n[r]);else for(r in e)e.hasOwnProperty(r)&&(i=e[r])&&("function"==typeof i?a.call(this,r,i):o.call(this,r,i));return this},r.removeEvent=function(t){var e,n=typeof t,r=this._getEvents();if("string"===n)delete r[t];else if("object"===n)for(e in r)r.hasOwnProperty(e)&&t.test(e)&&delete r[e];else delete this._events;return this},r.removeAllListeners=n("removeEvent"),r.emitEvent=function(t,e){var n,r,i,a,o=this.getListenersAsObject(t);for(i in o)if(o.hasOwnProperty(i))for(r=o[i].length;r--;)n=o[i][r],n.once===!0&&this.removeListener(t,n.listener),a=n.listener.apply(this,e||[]),a===this._getOnceReturnValue()&&this.removeListener(t,n.listener);return this},r.trigger=n("emitEvent"),r.emit=function(t){var e=Array.prototype.slice.call(arguments,1);return this.emitEvent(t,e)},r.setOnceReturnValue=function(t){return this._onceReturnValue=t,this},r._getOnceReturnValue=function(){return this.hasOwnProperty("_onceReturnValue")?this._onceReturnValue:!0},r._getEvents=function(){return this._events||(this._events={})},t.noConflict=function(){return i.EventEmitter=a,t},"function"==typeof define&&define.amd?define("eventEmitter/EventEmitter",[],function(){return t}):"object"==typeof module&&module.exports?module.exports=t:this.EventEmitter=t}.call(this),function(t){function e(e){var n=t.event;return n.target=n.target||n.srcElement||e,n}var n=document.documentElement,r=function(){};n.addEventListener?r=function(t,e,n){t.addEventListener(e,n,!1)}:n.attachEvent&&(r=function(t,n,r){t[n+r]=r.handleEvent?function(){var n=e(t);r.handleEvent.call(r,n)}:function(){var n=e(t);r.call(t,n)},t.attachEvent("on"+n,t[n+r])});var i=function(){};n.removeEventListener?i=function(t,e,n){t.removeEventListener(e,n,!1)}:n.detachEvent&&(i=function(t,e,n){t.detachEvent("on"+e,t[e+n]);try{delete t[e+n]}catch(r){t[e+n]=void 0}});var a={bind:r,unbind:i};"function"==typeof define&&define.amd?define("eventie/eventie",a):t.eventie=a}(this),function(t,e){"function"==typeof define&&define.amd?define(["eventEmitter/EventEmitter","eventie/eventie"],function(n,r){return e(t,n,r)}):"object"==typeof exports?module.exports=e(t,require("wolfy87-eventemitter"),require("eventie")):t.imagesLoaded=e(t,t.EventEmitter,t.eventie)}(window,function(t,e,n){function r(t,e){for(var n in e)t[n]=e[n];return t}function i(t){return"[object Array]"===f.call(t)}function a(t){var e=[];if(i(t))e=t;else if("number"==typeof t.length)for(var n=0,r=t.length;r>n;n++)e.push(t[n]);else e.push(t);return e}function o(t,e,n){if(!(this instanceof o
|