Mercurial > hg > digilib
view webapp/src/main/webapp/jquery/annotator-dl.min.js @ 1286:98265aa69929
new annotator plugin with new Annotator.js 2.0. works now.
needs no digilibintegration plugin in Annotator!
author | robcast |
---|---|
date | Thu, 13 Mar 2014 16:52:25 +0100 |
parents | 09e495e39c32 |
children | f4fb3482f116 |
line wrap: on
line source
/* ** Annotator v2.0.0-dev-5b27640 ** https://github.com/okfn/annotator/ ** ** Copyright 2014, the Annotator project contributors. ** Dual licensed under the MIT and GPLv3 licenses. ** https://github.com/okfn/annotator/blob/master/LICENSE ** ** Built at: 2014-03-13 15:20:20Z */ !function(t){if("object"==typeof exports)module.exports=t();else if("function"==typeof define&&define.amd)define(t);else{var e;"undefined"!=typeof window?e=window:"undefined"!=typeof global?e=global:"undefined"!=typeof self&&(e=self),e.Annotator=t()}}(function(){var t;return function e(t,n,o){function r(s,a){if(!n[s]){if(!t[s]){var u="function"==typeof require&&require;if(!a&&u)return u(s,!0);if(i)return i(s,!0);throw new Error("Cannot find module '"+s+"'")}var l=n[s]={exports:{}};t[s][0].call(l.exports,function(e){var n=t[s][1][e];return r(n?n:e)},l,l.exports,e,t,n,o)}return n[s].exports}for(var i="function"==typeof require&&require,s=0;s<o.length;s++)r(o[s]);return r}({1:[function(e,n,o){!function(){function e(){return{keys:Object.keys,uniqueId:function(t){var e=++h+"";return t?t+e:e},has:function(t,e){return u.call(t,e)},each:function(t,e,n){if(null!=t)if(a&&t.forEach===a)t.forEach(e,n);else if(t.length===+t.length){for(var o=0,r=t.length;r>o;o++)if(e.call(n,t[o],o,t)===s)return}else for(var i in t)if(this.has(t,i)&&e.call(n,t[i],i,t)===s)return},once:function(t){var e,n=!1;return function(){return n?e:(n=!0,e=t.apply(this,arguments),t=null,e)}}}}var r,i=this,s={},a=Array.prototype.forEach,u=Object.prototype.hasOwnProperty,l=Array.prototype.slice,h=0,p=e();r={on:function(t,e,n){if(!d(this,"on",t,[e,n])||!e)return this;this._events||(this._events={});var o=this._events[t]||(this._events[t]=[]);return o.push({callback:e,context:n,ctx:n||this}),this},once:function(t,e,n){if(!d(this,"once",t,[e,n])||!e)return this;var o=this,r=p.once(function(){o.off(t,r),e.apply(this,arguments)});return r._callback=e,this.on(t,r,n)},off:function(t,e,n){var o,r,i,s,a,u,l,h;if(!this._events||!d(this,"off",t,[e,n]))return this;if(!t&&!e&&!n)return this._events={},this;for(s=t?[t]:p.keys(this._events),a=0,u=s.length;u>a;a++)if(t=s[a],i=this._events[t]){if(this._events[t]=o=[],e||n)for(l=0,h=i.length;h>l;l++)r=i[l],(e&&e!==r.callback&&e!==r.callback._callback||n&&n!==r.context)&&o.push(r);o.length||delete this._events[t]}return this},trigger:function(t){if(!this._events)return this;var e=l.call(arguments,1);if(!d(this,"trigger",t,e))return this;var n=this._events[t],o=this._events.all;return n&&f(n,e),o&&f(o,arguments),this},stopListening:function(t,e,n){var o=this._listeners;if(!o)return this;var r=!e&&!n;"object"==typeof e&&(n=this),t&&((o={})[t._listenerId]=t);for(var i in o)o[i].off(e,n,this),r&&delete this._listeners[i];return this}};var c=/\s+/,d=function(t,e,n,o){if(!n)return!0;if("object"==typeof n){for(var r in n)t[e].apply(t,[r,n[r]].concat(o));return!1}if(c.test(n)){for(var i=n.split(c),s=0,a=i.length;a>s;s++)t[e].apply(t,[i[s]].concat(o));return!1}return!0},f=function(t,e){var n,o=-1,r=t.length,i=e[0],s=e[1],a=e[2];switch(e.length){case 0:for(;++o<r;)(n=t[o]).callback.call(n.ctx);return;case 1:for(;++o<r;)(n=t[o]).callback.call(n.ctx,i);return;case 2:for(;++o<r;)(n=t[o]).callback.call(n.ctx,i,s);return;case 3:for(;++o<r;)(n=t[o]).callback.call(n.ctx,i,s,a);return;default:for(;++o<r;)(n=t[o]).callback.apply(n.ctx,e)}},g={listenTo:"on",listenToOnce:"once"};p.each(g,function(t,e){r[e]=function(e,n,o){var r=this._listeners||(this._listeners={}),i=e._listenerId||(e._listenerId=p.uniqueId("l"));return r[i]=e,"object"==typeof n&&(o=this),e[t](n,o,this),this}}),r.bind=r.on,r.unbind=r.off,r.mixin=function(t){var e=["on","once","off","trigger","stopListening","listenTo","listenToOnce","bind","unbind"];return p.each(e,function(e){t[e]=this[e]},this),t},"function"==typeof t?t(function(){return r}):"undefined"!=typeof o?("undefined"!=typeof n&&n.exports&&(o=n.exports=r),o.BackboneEvents=r):i.BackboneEvents=r}(this)},{}],2:[function(t,e){e.exports=t("./backbone-events-standalone")},{"./backbone-events-standalone":1}],3:[function(e,n,o){!function(e){"object"==typeof o?n.exports=e():"function"==typeof t&&t.amd?t(e):window.BackboneExtend=e()}(function(){"use strict";var t={has:function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},extend:function(t){for(var e=1;e<arguments.length;++e){var n=arguments[e];if(n)for(var o in n)t[o]=n[o]}return t}},e=function(e,n){var o,r=this;o=e&&t.has(e,"constructor")?e.constructor:function(){return r.apply(this,arguments)},t.extend(o,r,n);var i=function(){this.constructor=o};return i.prototype=r.prototype,o.prototype=new i,e&&t.extend(o.prototype,e),o.__super__=r.prototype,o};return e})},{}],4:[function(t,e){var n,o,r={}.hasOwnProperty;o=t("./storage"),n=function(){function t(t){this.registry=t}return t.configure=function(t){return null==t.annotations&&(t.annotations=new this(t)),t.include(o)},t.prototype.create=function(t){return null==t&&(t={}),this._cycle(t,"create")},t.prototype.update=function(t){if(null==t.id)throw new TypeError("annotation must have an id for update()");return this._cycle(t,"update")},t.prototype["delete"]=function(t){if(null==t.id)throw new TypeError("annotation must have an id for delete()");return this._cycle(t,"delete")},t.prototype.query=function(t){return this.registry.store.query(t)},t.prototype.load=function(t){return this.query(t)},t.prototype._cycle=function(t,e){var n;return n=$.extend(!0,{},t),delete n._local,this.registry.store[e](n).then(function(){return function(e){var n,o;for(n in t)r.call(t,n)&&(o=t[n],"_local"!==n&&delete t[n]);return $.extend(t,e),t}}(this))},t}(),e.exports=n},{"./storage":26}],annotator:[function(t,e){e.exports=t("haW+cw")},{}],"haW+cw":[function(t,e){var n,o,r,i,s,a,u,l,h,p,c,d,f,g,y,m,v,w=function(t,e){return function(){return t.apply(e,arguments)}},_={}.hasOwnProperty,b=function(t,e){function n(){this.constructor=t}for(var o in e)_.call(e,o)&&(t[o]=e[o]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t};c=t("backbone-extend-standalone"),r=t("./class"),a=t("./range"),l=t("./util"),p=t("./widget"),h=t("./viewer"),i=t("./editor"),s=t("./notification"),u=t("./registry"),n=t("./annotations"),v=l.TranslationString,y=this.Annotator,f=function(){return console.error.apply(console,arguments)},o=function(t){function e(t,n){return this.onEditAnnotation=w(this.onEditAnnotation,this),this.onAdderClick=w(this.onAdderClick,this),this.onAdderMousedown=w(this.onAdderMousedown,this),this.onHighlightMouseover=w(this.onHighlightMouseover,this),this.checkForEndSelection=w(this.checkForEndSelection,this),this.checkForStartSelection=w(this.checkForStartSelection,this),this.clearViewerHideTimer=w(this.clearViewerHideTimer,this),this.startViewerHideTimer=w(this.startViewerHideTimer,this),this.showViewer=w(this.showViewer,this),this.onEditorSubmit=w(this.onEditorSubmit,this),this.onEditorHide=w(this.onEditorHide,this),this.showEditor=w(this.showEditor,this),e.__super__.constructor.apply(this,arguments),this.plugins={},e._instances.push(this),e.supported()?void u.createApp(this,n):this}return b(e,t),e.prototype.events={".annotator-adder button click":"onAdderClick",".annotator-adder button mousedown":"onAdderMousedown",".annotator-hl mouseover":"onHighlightMouseover",".annotator-hl mouseout":"startViewerHideTimer"},e.prototype.html={adder:'<div class="annotator-adder"><button type="button">'+v("Annotate")+"</button></div>",wrapper:'<div class="annotator-wrapper"></div>'},e.prototype.options={store:null,readOnly:!1,loadQuery:{}},e.prototype.plugins={},e.prototype.editor=null,e.prototype.viewer=null,e.prototype.selectedRanges=null,e.prototype.mouseIsDown=!1,e.prototype.ignoreMouseup=!1,e.prototype.viewerHideTimer=null,e.extend=c,e.prototype._setupWrapper=function(){return this.wrapper=$(this.html.wrapper),this.element.find("script").remove(),this.element.wrapInner(this.wrapper),this.wrapper=this.element.find(".annotator-wrapper"),this},e.prototype._setupViewer=function(){return this.viewer=new e.Viewer({readOnly:this.options.readOnly}),this.viewer.hide().on("edit",this.onEditAnnotation).on("delete",function(t){return function(e){return t.viewer.hide(),t.publish("beforeAnnotationDeleted",[e]),t.cleanupAnnotation(e),t.annotations["delete"](e).done(function(){return t.publish("annotationDeleted",[e])})}}(this)).addField({load:function(t){return function(e,n){return $(e).html(n.text?l.escape(n.text):"<i>"+v("No Comment")+"</i>"),t.publish("annotationViewerTextField",[e,n])}}(this)}).element.appendTo(this.wrapper).bind({mouseover:this.clearViewerHideTimer,mouseout:this.startViewerHideTimer}),this},e.prototype._setupEditor=function(){return this.editor=new e.Editor,this.editor.hide().on("hide",this.onEditorHide).on("save",this.onEditorSubmit).addField({type:"textarea",label:v("Comments")+"…",load:function(t,e){return $(t).find("textarea").val(e.text||"")},submit:function(t,e){return e.text=$(t).find("textarea").val()}}),this.editor.element.appendTo(this.wrapper),this},e.prototype._setupDocumentEvents=function(){return $(document).bind({mouseup:this.checkForEndSelection,mousedown:this.checkForStartSelection}),this},e.prototype._setupDynamicStyle=function(){var t,e,n,o;return n=$("#annotator-dynamic-style"),n.length||(n=$('<style id="annotator-dynamic-style"></style>').appendTo(document.head)),e="*"+function(){var t,e,n,r;for(n=["adder","outer","notice","filter"],r=[],t=0,e=n.length;e>t;t++)o=n[t],r.push(":not(.annotator-"+o+")");return r}().join(""),t=l.maxZIndex($(document.body).find(e)),t=Math.max(t,1e3),n.text([".annotator-adder, .annotator-outer, .annotator-notice {"," z-index: "+(t+20)+";","}",".annotator-filter {"," z-index: "+(t+10)+";","}"].join("\n")),this},e.prototype.load=function(t){return this.annotations.load(t).then(function(t){return function(e){return t.loadAnnotations(e)}}(this))},e.prototype.destroy=function(){var t,n,o,r;$(document).unbind({mouseup:this.checkForEndSelection,mousedown:this.checkForStartSelection}),$("#annotator-dynamic-style").remove(),this.adder.remove(),this.viewer.destroy(),this.editor.destroy(),this.wrapper.find(".annotator-hl").each(function(){return $(this).contents().insertBefore(this),$(this).remove()}),this.wrapper.contents().insertBefore(this.wrapper),this.wrapper.remove(),this.element.data("annotator",null),r=this.plugins;for(n in r)o=r[n],this.plugins[n].destroy();return this.removeEvents(),t=e._instances.indexOf(this),-1!==t?e._instances.splice(t,1):void 0},e.prototype.getSelectedRanges=function(){var t,e,n,o,r,i,s,u,h;for(s=l.getGlobal().getSelection(),r=[],i=[],s.isCollapsed||(r=function(){var r,u,l;for(l=[],e=r=0,u=s.rangeCount;u>=0?u>r:r>u;e=u>=0?++r:--r)o=s.getRangeAt(e),t=new a.BrowserRange(o),n=t.normalize().limit(this.wrapper[0]),null===n&&i.push(o),l.push(n);return l}.call(this),s.removeAllRanges()),u=0,h=i.length;h>u;u++)o=i[u],s.addRange(o);return $.grep(r,function(t){return t&&s.addRange(t.toRange()),t})},e.prototype.setupAnnotation=function(t){var e,n,o,r,i,s,u,l,h,p;for(i=this.wrapper[0],o=[],p=t.ranges,s=0,l=p.length;l>s;s++){r=p[s];try{o.push(a.sniff(r).normalize(i))}catch(c){if(e=c,!(e instanceof a.RangeError))throw e;this.publish("rangeNormalizeFail",[t,r,e])}}for(t.quote=[],t.ranges=[],t._local={},t._local.highlights=[],u=0,h=o.length;h>u;u++)n=o[u],t.quote.push($.trim(n.text())),t.ranges.push(n.serialize(this.wrapper[0],".annotator-hl")),$.merge(t._local.highlights,this.highlightRange(n));return t.quote=t.quote.join(" / "),$(t._local.highlights).data("annotation",t),t},e.prototype.cleanupAnnotation=function(t){var e,n,o,r,i;if(null!=(null!=(r=t._local)?r.highlights:void 0)){for(i=t._local.highlights,n=0,o=i.length;o>n;n++)e=i[n],null!=e.parentNode&&$(e).replaceWith(e.childNodes);delete t._local.highlights}return t},e.prototype.loadAnnotations=function(t){var e,n;return null==t&&(t=[]),n=function(t){return function(o){var r,i,s,a;for(null==o&&(o=[]),i=o.splice(0,10),s=0,a=i.length;a>s;s++)r=i[s],t.setupAnnotation(r);return o.length>0?setTimeout(function(){return n(o)},10):t.publish("annotationsLoaded",[e])}}(this),e=t.slice(),n(t),this},e.prototype.dumpAnnotations=function(){return this.plugins.Store?this.plugins.Store.dumpAnnotations():(console.warn(v("Can't dump annotations without Store plugin.")),!1)},e.prototype.highlightRange=function(t,e){var n,o,r,i,s,a,u;for(null==e&&(e="annotator-hl"),r=/^\s*$/,n=$("<span class='"+e+"'></span>"),a=t.textNodes(),u=[],i=0,s=a.length;s>i;i++)o=a[i],r.test(o.nodeValue)||u.push($(o).wrapAll(n).parent().show()[0]);return u},e.prototype.highlightRanges=function(t,e){var n,o,r,i;for(null==e&&(e="annotator-hl"),n=[],r=0,i=t.length;i>r;r++)o=t[r],$.merge(n,this.highlightRange(o,e));return n},e.prototype.addPlugin=function(t,n){var o,r;return this.plugins[t]?console.error(v("You cannot have more than one instance of any plugin.")):(o=e.Plugin[t],"function"==typeof o?(this.plugins[t]=new o(this.element[0],n),this.plugins[t].annotator=this,"function"==typeof(r=this.plugins[t]).pluginInit&&r.pluginInit()):console.error(v("Could not load ")+t+v(" plugin. Have you included the appropriate <script> tag?"))),this},e.prototype.editAnnotation=function(t,e){var n,o,r;return n=$.Deferred(),r=n.resolve.bind(n,t),o=n.reject.bind(n,t),this.showEditor(t,e),this.subscribe("annotationEditorSubmit",r),this.once("annotationEditorHidden",function(t){return function(){return t.unsubscribe("annotationEditorSubmit",r),"pending"===n.state()?o():void 0}}(this)),n.promise()},e.prototype.showEditor=function(t,e){return this.editor.element.css(e),this.editor.load(t),this.publish("annotationEditorShown",[this.editor,t]),this},e.prototype.onEditorHide=function(){return this.publish("annotationEditorHidden",[this.editor]),this.ignoreMouseup=!1},e.prototype.onEditorSubmit=function(t){return this.publish("annotationEditorSubmit",[this.editor,t])},e.prototype.showViewer=function(t,e){return this.viewer.element.css(e),this.viewer.load(t),this.publish("annotationViewerShown",[this.viewer,t])},e.prototype.startViewerHideTimer=function(){return this.viewerHideTimer?void 0:this.viewerHideTimer=setTimeout(this.viewer.hide,250)},e.prototype.clearViewerHideTimer=function(){return clearTimeout(this.viewerHideTimer),this.viewerHideTimer=!1},e.prototype.checkForStartSelection=function(t){return t&&this.isAnnotator(t.target)||this.startViewerHideTimer(),this.mouseIsDown=!0},e.prototype.checkForEndSelection=function(t){var e,n,o,r,i;if(this.mouseIsDown=!1,!this.ignoreMouseup){for(this.selectedRanges=this.getSelectedRanges(),i=this.selectedRanges,o=0,r=i.length;r>o;o++)if(n=i[o],e=n.commonAncestor,$(e).hasClass("annotator-hl")&&(e=$(e).parents("[class!=annotator-hl]")[0]),this.isAnnotator(e))return;return t&&this.selectedRanges.length?this.adder.css(l.mousePosition(t,this.wrapper[0])).show():this.adder.hide()}},e.prototype.isAnnotator=function(t){return!!$(t).parents().addBack().filter("[class^=annotator-]").not(this.wrapper).length},e.prototype.configure=function(t){return this.registry=t,t.include(n)},e.prototype.run=function(t){return this.registry=t,this.options.readOnly||this._setupDocumentEvents(),this._setupWrapper()._setupViewer()._setupEditor(),this._setupDynamicStyle(),this.adder=$(this.html.adder).appendTo(this.wrapper).hide(),this.options.loadQuery?this.load(this.options.loadQuery):void 0},e.prototype.onHighlightMouseover=function(t){var e;return this.clearViewerHideTimer(),this.mouseIsDown||this.viewer.isShown()?!1:(e=$(t.target).parents(".annotator-hl").addBack().map(function(){return $(this).data("annotation")}),this.showViewer($.makeArray(e),l.mousePosition(t,this.wrapper[0])))},e.prototype.onAdderMousedown=function(t){return null!=t&&t.preventDefault(),this.ignoreMouseup=!0},e.prototype.onAdderClick=function(t){var e,n;return null!=t&&t.preventDefault(),n=this.adder.position(),this.adder.hide(),e={ranges:this.selectedRanges},$.when(e).done(function(t){return function(e){return t.publish("beforeAnnotationCreated",[e])}}(this)).then(function(t){return function(e){return t.setupAnnotation(e)}}(this)).done(function(){return function(t){return $(t._local.highlights).addClass("annotator-hl-temporary")}}(this)).then(function(t){return function(e){return t.editAnnotation(e,n)}}(this)).then(function(t){return function(e){return t.annotations.create(e).fail(f)}}(this)).done(function(){return function(t){return $(t._local.highlights).removeClass("annotator-hl-temporary")}}(this)).done(function(t){return function(e){return t.publish("annotationCreated",[e])}}(this)).fail(this.cleanupAnnotation)},e.prototype.onEditAnnotation=function(t){var e;return e=this.viewer.element.position(),this.viewer.hide(),$.when(t).done(function(t){return function(e){return t.publish("beforeAnnotationUpdated",[e])}}(this)).then(function(t){return function(n){return t.editAnnotation(n,e)}}(this)).then(function(t){return function(e){return t.annotations.update(e).fail(f)}}(this)).done(function(t){return function(e){return t.publish("annotationUpdated",[e])}}(this))},e}(r),o.Plugin=function(t){function e(){e.__super__.constructor.apply(this,arguments)}return b(e,t),e.prototype.pluginInit=function(){},e.prototype.destroy=function(){return this.removeEvents()},e}(r),d=l.getGlobal(),null==(null!=(m=d.document)?m.evaluate:void 0)&&$.getScript("http://assets.annotateit.org/vendor/xpath.min.js"),null==d.getSelection&&$.getScript("http://assets.annotateit.org/vendor/ierange.min.js"),null==d.JSON&&$.getScript("http://assets.annotateit.org/vendor/json2.min.js"),null==d.Node&&(d.Node={ELEMENT_NODE:1,ATTRIBUTE_NODE:2,TEXT_NODE:3,CDATA_SECTION_NODE:4,ENTITY_REFERENCE_NODE:5,ENTITY_NODE:6,PROCESSING_INSTRUCTION_NODE:7,COMMENT_NODE:8,DOCUMENT_NODE:9,DOCUMENT_TYPE_NODE:10,DOCUMENT_FRAGMENT_NODE:11,NOTATION_NODE:12}),o.Delegator=r,o.Range=a,o.Util=l,o.Widget=p,o.Viewer=h,o.Editor=i,o.Notification=s,g=new s,o.showNotification=g.show,o.hideNotification=g.hide,o._instances=[],o._t=v,o.supported=function(){return function(){return!!this.getSelection}()},o.noConflict=function(){return l.getGlobal().Annotator=y,this},$.fn.annotator=function(t){var e;return e=Array.prototype.slice.call(arguments,1),this.each(function(){var n;return n=$.data(this,"annotator"),n?t&&n[t].apply(n,e):(n=new o(this,t),$.data(this,"annotator",n))})},e.exports=o,t("annotator-plugin-authlogin"),t("annotator-plugin-filter"),t("annotator-plugin-markdown"),t("annotator-plugin-permissions"),t("annotator-plugin-store"),t("annotator-plugin-tags"),t("annotator-plugin-unsupported")},{"./annotations":4,"./class":7,"./editor":8,"./notification":9,"./range":24,"./registry":25,"./util":27,"./viewer":28,"./widget":29,"annotator-plugin-authlogin":"M3jdsG","annotator-plugin-filter":"EZHTbU","annotator-plugin-markdown":"CyErHP","annotator-plugin-permissions":"HUruzR","annotator-plugin-store":"vOrhum","annotator-plugin-tags":"rXlHIq","annotator-plugin-unsupported":"Q5LRaO","backbone-extend-standalone":3}],7:[function(t,e){var n,o,r,i=[].slice,s={}.hasOwnProperty;r=t("./util"),o=function(){function t(t,e){this.options=$.extend(!0,{},this.options,e),this.element=$(t),this._closures={},this.addEvents()}return t.prototype.events={},t.prototype.options={},t.prototype.element=null,t.prototype.addEvents=function(){var e,n,o,r,i;for(r=t._parseEvents(this.events),i=[],n=0,o=r.length;o>n;n++)e=r[n],i.push(this._addEvent(e.selector,e.event,e.functionName));return i},t.prototype.removeEvents=function(){var e,n,o,r,i;for(r=t._parseEvents(this.events),i=[],n=0,o=r.length;o>n;n++)e=r[n],i.push(this._removeEvent(e.selector,e.event,e.functionName));return i},t.prototype._addEvent=function(e,n,o){var r;return r=function(t){return function(){return t[o].apply(t,arguments)}}(this),""===e&&t._isCustomEvent(n)?this.subscribe(n,r):this.element.delegate(e,n,r),this._closures[""+e+"/"+n+"/"+o]=r,this},t.prototype._removeEvent=function(e,n,o){var r;return r=this._closures[""+e+"/"+n+"/"+o],""===e&&t._isCustomEvent(n)?this.unsubscribe(n,r):this.element.undelegate(e,n,r),delete this._closures[""+e+"/"+n+"/"+o],this},t.prototype.publish=function(t,e){return null==e&&(e=[]),this.trigger.apply(this,[t].concat(i.call(e)))},t.prototype.subscribe=function(t,e,n){return null==n&&(n=this),this.on(t,e,n)},t.prototype.unsubscribe=function(t,e,n){return null==n&&(n=this),this.off(t,e,n)},t}(),o._parseEvents=function(t){var e,n,o,r,s,a,u;n=[];for(r in t)o=t[r],u=r.split(" "),s=2<=u.length?i.call(u,0,a=u.length-1):(a=0,[]),e=u[a++],n.push({selector:s.join(" "),event:e,functionName:o});return n},o.natives=function(){var t,e,n;return e=function(){var e,o;e=$.event.special,o=[];for(t in e)s.call(e,t)&&(n=e[t],o.push(t));return o}(),"blur focus focusin focusout load resize scroll unload click dblclick\nmousedown mouseup mousemove mouseover mouseout mouseenter mouseleave\nchange select submit keydown keypress keyup error".split(/[^a-z]+/).concat(e)}(),o._isCustomEvent=function(t){return t=t.split(".")[0],-1===$.inArray(t,o.natives)},n=t("backbone-events-standalone"),n.mixin(o.prototype),e.exports=o},{"./util":27,"backbone-events-standalone":2}],8:[function(t,e){var n,o,r,i,s=function(t,e){return function(){return t.apply(e,arguments)}},a={}.hasOwnProperty,u=function(t,e){function n(){this.constructor=t}for(var o in e)a.call(e,o)&&(t[o]=e[o]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t};o=t("./util"),r=t("./widget"),i=o.TranslationString,n=function(t){function e(t){this.onCancelButtonMouseover=s(this.onCancelButtonMouseover,this),this.processKeypress=s(this.processKeypress,this),this.submit=s(this.submit,this),this.load=s(this.load,this),this.hide=s(this.hide,this),this.show=s(this.show,this),e.__super__.constructor.call(this,$(this.html)[0],t),this.fields=[],this.annotation={}}return u(e,t),e.prototype.events={"form submit":"submit",".annotator-save click":"submit",".annotator-cancel click":"hide",".annotator-cancel mouseover":"onCancelButtonMouseover","textarea keydown":"processKeypress"},e.prototype.classes={hide:"annotator-hide",focus:"annotator-focus"},e.prototype.html='<div class="annotator-outer annotator-editor">\n <form class="annotator-widget">\n <ul class="annotator-listing"></ul>\n <div class="annotator-controls">\n <a href="#cancel" class="annotator-cancel">'+i("Cancel")+'</a>\n<a href="#save" class="annotator-save annotator-focus">'+i("Save")+"</a>\n </div>\n </form>\n</div>",e.prototype.options={},e.prototype.show=function(t){return o.preventEventDefault(t),this.element.removeClass(this.classes.hide),this.element.find(".annotator-save").addClass(this.classes.focus),this.checkOrientation(),this.element.find(":input:first").focus(),this.setupDraggables(),this.publish("show")},e.prototype.hide=function(t){return o.preventEventDefault(t),this.element.addClass(this.classes.hide),this.publish("hide")},e.prototype.load=function(t){var e,n,o,r;for(this.annotation=t,this.publish("load",[this.annotation]),r=this.fields,n=0,o=r.length;o>n;n++)e=r[n],e.load(e.element,this.annotation);return this.show()},e.prototype.submit=function(t){var e,n,r,i;for(o.preventEventDefault(t),i=this.fields,n=0,r=i.length;r>n;n++)e=i[n],e.submit(e.element,this.annotation);return this.publish("save",[this.annotation]),this.hide()},e.prototype.addField=function(t){var e,n,r;switch(n=$.extend({id:"annotator-field-"+o.uuid(),type:"input",label:"",load:function(){},submit:function(){}},t),r=null,e=$('<li class="annotator-item" />'),n.element=e[0],n.type){case"textarea":r=$("<textarea />");break;case"input":case"checkbox":r=$("<input />");break;case"select":r=$("<select />")}return e.append(r),r.attr({id:n.id,placeholder:n.label}),"checkbox"===n.type&&(r[0].type="checkbox",e.addClass("annotator-checkbox"),e.append($("<label />",{"for":n.id,html:n.label}))),this.element.find("ul:first").append(e),this.fields.push(n),n.element},e.prototype.checkOrientation=function(){var t,n;return e.__super__.checkOrientation.apply(this,arguments),n=this.element.find("ul"),t=this.element.find(".annotator-controls"),this.element.hasClass(this.classes.invert.y)?t.insertBefore(n):t.is(":first-child")&&t.insertAfter(n),this},e.prototype.processKeypress=function(t){return 27===t.keyCode?this.hide():13!==t.keyCode||t.shiftKey?void 0:this.submit()},e.prototype.onCancelButtonMouseover=function(){return this.element.find("."+this.classes.focus).removeClass(this.classes.focus)},e.prototype.setupDraggables=function(){var t,e,n,o,r,i,s,a,u,l,h;return this.element.find(".annotator-resize").remove(),n=this.element.find(this.element.hasClass(this.classes.invert.y)?".annotator-item:last":".annotator-item:first"),n&&$('<span class="annotator-resize"></span>').appendTo(n),r=null,t=this.classes,o=this.element,l=null,u=o.find(".annotator-resize"),e=o.find(".annotator-controls"),h=!1,i=function(t){return t.target===this?(r={element:this,top:t.pageY,left:t.pageX},l=o.find("textarea:first"),$(window).bind({"mouseup.annotator-editor-resize":a,"mousemove.annotator-editor-resize":s}),t.preventDefault()):void 0},a=function(){return r=null,$(window).unbind(".annotator-editor-resize")},s=function(){return function(n){var i,s,a,p,c;return r&&h===!1?(i={top:n.pageY-r.top,left:n.pageX-r.left},r.element===u[0]?(p=l.outerHeight(),c=l.outerWidth(),s=o.hasClass(t.invert.x)?-1:1,a=o.hasClass(t.invert.y)?1:-1,l.height(p+i.top*a),l.width(c+i.left*s),l.outerHeight()!==p&&(r.top=n.pageY),l.outerWidth()!==c&&(r.left=n.pageX)):r.element===e[0]&&(o.css({top:parseInt(o.css("top"),10)+i.top,left:parseInt(o.css("left"),10)+i.left}),r.top=n.pageY,r.left=n.pageX),h=!0,setTimeout(function(){return h=!1},1e3/60)):void 0}}(this),u.bind("mousedown",i),e.bind("mousedown",i)},e}(r),e.exports=n},{"./util":27,"./widget":29}],9:[function(t,e){var n,o,r,i=function(t,e){return function(){return t.apply(e,arguments)}},s={}.hasOwnProperty,a=function(t,e){function n(){this.constructor=t}for(var o in e)s.call(e,o)&&(t[o]=e[o]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t};n=t("./class"),r=t("./util"),o=function(t){function e(t){this.hide=i(this.hide,this),this.show=i(this.show,this),e.__super__.constructor.call(this,$(this.options.html)[0],t)}return a(e,t),e.prototype.events={click:"hide"},e.prototype.options={html:"<div class='annotator-notice'></div>",classes:{show:"annotator-notice-show",info:"annotator-notice-info",success:"annotator-notice-success",error:"annotator-notice-error"}},e.prototype.show=function(t,n){return null==n&&(n=e.INFO),this.currentStatus=n,this._appendElement(),$(this.element).addClass(this.options.classes.show).addClass(this.options.classes[this.currentStatus]).html(r.escape(t||"")),setTimeout(this.hide,5e3),this},e.prototype.hide=function(){return null==this.currentStatus&&(this.currentStatus=Annotator.Notification.INFO),$(this.element).removeClass(this.options.classes.show).removeClass(this.options.classes[this.currentStatus]),this},e.prototype._appendElement=function(){return null==this.element.parentNode?$(this.element).appendTo(document.body):void 0},e}(n),o.INFO="info",o.SUCCESS="success",o.ERROR="error",e.exports=o},{"./class":7,"./util":27}],"annotator-plugin-authlogin":[function(t,e){e.exports=t("M3jdsG")},{}],M3jdsG:[function(t,e){var n,o,r,i,s,a={}.hasOwnProperty,u=function(t,e){function n(){this.constructor=t}for(var o in e)a.call(e,o)&&(t[o]=e[o]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t};n=t("annotator"),i=function(t){var e,n,o,r,i,s;return r="([0-9]{4})(-([0-9]{2})(-([0-9]{2})(T([0-9]{2}):([0-9]{2})(:([0-9]{2})(\\.([0-9]+))?)?(Z|(([-+])([0-9]{2}):([0-9]{2})))?)?)?)?",e=t.match(new RegExp(r)),o=0,n=new Date(e[1],0,1),e[3]&&n.setMonth(e[3]-1),e[5]&&n.setDate(e[5]),e[7]&&n.setHours(e[7]),e[8]&&n.setMinutes(e[8]),e[10]&&n.setSeconds(e[10]),e[12]&&n.setMilliseconds(1e3*Number("0."+e[12])),e[14]&&(o=60*Number(e[16])+Number(e[17]),o*=null!=(s="-"===e[15])?s:{1:-1}),o-=n.getTimezoneOffset(),i=Number(n)+60*o*1e3,n.setTime(Number(i)),n},o=function(t){var e,n,o,r,i,s,a,u,l,h,p,c,d;if("undefined"!=typeof atob&&null!==atob)return atob(t);if(n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",l=0,e=0,r="",d=[],!t)return t;for(t+="";l<t.length;)i=n.indexOf(t.charAt(l++)),s=n.indexOf(t.charAt(l++)),a=n.indexOf(t.charAt(l++)),u=n.indexOf(t.charAt(l++)),o=i<<18|s<<12|a<<6|u,h=o>>16&255,p=o>>8&255,c=255&o,d[e++]=64===a?String.fromCharCode(h):64===u?String.fromCharCode(h,p):String.fromCharCode(h,p,c);return d.join("")},r=function(t){var e,n,r,i;if(n=t.length%4,0!==n)for(e=r=0,i=4-n;i>=0?i>r:r>i;e=i>=0?++r:--r)t+="=";return t=t.replace(/-/g,"+"),t=t.replace(/_/g,"/"),o(t)},s=function(t){var e,n,o,i;return i=t.split("."),e=i[0],n=i[1],o=i[2],JSON.parse(r(n))},n.Plugin.Auth=function(t){function e(){e.__super__.constructor.apply(this,arguments),this.waitingForToken=[],this.options.token?this.setToken(this.options.token):this.requestToken()}return u(e,t),e.prototype.options={token:null,tokenUrl:"/auth/token",autoFetch:!0,requestMethod:"GET",requestData:null,unauthorizedCallback:null},e.prototype.requestToken=function(){return this.requestInProgress=!0,$.ajax({url:this.options.tokenUrl,dataType:"text",data:this.options.requestData,type:this.options.requestMethod,xhrFields:{withCredentials:!0}}).done(function(t){return function(e){return t.setToken(e)}}(this)).fail(function(t){return function(e,o,r){var i,s;return 401===e.status&&(i=t.options.unauthorizedCallback,null!=i&&i(t))?void(t.retryTimeout=setTimeout(function(){return t.requestToken()},1e3)):(s=n._t("Couldn't get auth token:"),console.error(""+s+" "+r,e),n.showNotification(""+s+" "+e.responseText,n.Notification.ERROR))}}(this)).always(function(t){return function(){return t.requestInProgress=!1}}(this))},e.prototype.setToken=function(t){var e;if(this.token=t,this._unsafeToken=s(t),this.haveValidToken()){for(this.options.autoFetch&&(this.refreshTimeout=setTimeout(function(t){return function(){return t.requestToken()}}(this),1e3*(this.timeToExpiry()-2))),this.updateHeaders(),e=[];this.waitingForToken.length>0;)e.push(this.waitingForToken.pop()(this._unsafeToken));return e}return console.warn(n._t("Didn't get a valid token.")),this.options.autoFetch?(console.warn(n._t("Getting a new token in 10s.")),setTimeout(function(t){return function(){return t.requestToken()}}(this),1e4)):void 0},e.prototype.haveValidToken=function(){var t;return t=this._unsafeToken&&this._unsafeToken.issuedAt&&this._unsafeToken.ttl&&this._unsafeToken.consumerKey,t&&this.timeToExpiry()>0?!0:!1},e.prototype.timeToExpiry=function(){var t,e,n,o;return n=(new Date).getTime()/1e3,e=i(this._unsafeToken.issuedAt).getTime()/1e3,t=e+this._unsafeToken.ttl,o=t-n,o>0?o:0},e.prototype.updateHeaders=function(){var t;return t=this.element.data("annotator:headers"),this.element.data("annotator:headers",$.extend(t,{"x-annotator-auth-token":this.token}))},e.prototype.withToken=function(t){return null!=t?this.haveValidToken()?t(this._unsafeToken):(this.waitingForToken.push(t),this.requestInProgress?void 0:this.requestToken()):void 0},e}(n.Plugin),e.exports=n.Plugin.Auth},{annotator:"haW+cw"}],EZHTbU:[function(t,e){var n,o=function(t,e){return function(){return t.apply(e,arguments)}},r={}.hasOwnProperty,i=function(t,e){function n(){this.constructor=t}for(var o in e)r.call(e,o)&&(t[o]=e[o]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t};n=t("annotator"),n.Plugin.Filter=function(t){function e(t,n){this._onPreviousClick=o(this._onPreviousClick,this),this._onNextClick=o(this._onNextClick,this),this._onFilterKeyup=o(this._onFilterKeyup,this),this._onFilterBlur=o(this._onFilterBlur,this),this._onFilterFocus=o(this._onFilterFocus,this),this.updateHighlights=o(this.updateHighlights,this);var r;t=$(this.html.element).appendTo((null!=n?n.appendTo:void 0)||this.options.appendTo),e.__super__.constructor.call(this,t,n),(r=this.options).filters||(r.filters=[]),this.filter=$(this.html.filter),this.filters=[],this.current=0}return i(e,t),e.prototype.events={".annotator-filter-property input focus":"_onFilterFocus",".annotator-filter-property input blur":"_onFilterBlur",".annotator-filter-property input keyup":"_onFilterKeyup",".annotator-filter-previous click":"_onPreviousClick",".annotator-filter-next click":"_onNextClick",".annotator-filter-clear click":"_onClearClick"},e.prototype.classes={active:"annotator-filter-active",hl:{hide:"annotator-hl-filtered",active:"annotator-hl-active"}},e.prototype.html={element:'<div class="annotator-filter">\n <strong>'+n._t("Navigate:")+'</strong>\n<span class="annotator-filter-navigation">\n <button type="button" class="annotator-filter-previous">'+n._t("Previous")+'</button>\n<button type="button" class="annotator-filter-next">'+n._t("Next")+"</button>\n</span>\n<strong>"+n._t("Filter by:")+"</strong>\n</div>",filter:'<span class="annotator-filter-property">\n <label></label>\n <input/>\n <button type="button" class="annotator-filter-clear">'+n._t("Clear")+"</button>\n</span>"},e.prototype.options={appendTo:"body",filters:[],addAnnotationFilter:!0,isFiltered:function(t,e){var n,o,r,i; if(!t||!e)return!1;for(i=t.split(/\s+/),o=0,r=i.length;r>o;o++)if(n=i[o],-1===e.indexOf(n))return!1;return!0}},e.prototype.pluginInit=function(){var t,e,o,r;for(r=this.options.filters,e=0,o=r.length;o>e;e++)t=r[e],this.addFilter(t);return this.updateHighlights(),this._setupListeners()._insertSpacer(),this.options.addAnnotationFilter===!0?this.addFilter({label:n._t("Annotation"),property:"text"}):void 0},e.prototype.destroy=function(){var t,n;return e.__super__.destroy.apply(this,arguments),n=$("html"),t=parseInt(n.css("padding-top"),10)||0,n.css("padding-top",t-this.element.outerHeight()),this.element.remove()},e.prototype._insertSpacer=function(){var t,e;return e=$("html"),t=parseInt(e.css("padding-top"),10)||0,e.css("padding-top",t+this.element.outerHeight()),this},e.prototype._setupListeners=function(){var t,e,n,o;for(e=["annotationsLoaded","annotationCreated","annotationUpdated","annotationDeleted"],n=0,o=e.length;o>n;n++)t=e[n],this.annotator.subscribe(t,this.updateHighlights);return this},e.prototype.addFilter=function(t){var e,o;return o=$.extend({label:"",property:"",isFiltered:this.options.isFiltered},t),function(){var t,n,r,i;for(r=this.filters,i=[],t=0,n=r.length;n>t;t++)e=r[t],e.property===o.property&&i.push(e);return i}.call(this).length||(o.id="annotator-filter-"+o.property,o.annotations=[],o.element=this.filter.clone().appendTo(this.element),o.element.find("label").html(o.label).attr("for",o.id),o.element.find("input").attr({id:o.id,placeholder:n._t("Filter by ")+o.label+"…"}),o.element.find("button").hide(),o.element.data("filter",o),this.filters.push(o)),this},e.prototype.updateFilter=function(t){var e,n,o,r,i,s,a;if(t.annotations=[],this.updateHighlights(),this.resetHighlights(),o=$.trim(t.element.find("input").val())){for(n=this.highlights.map(function(){return $(this).data("annotation")}),a=$.makeArray(n),i=0,s=a.length;s>i;i++)e=a[i],r=e[t.property],t.isFiltered(o,r)&&t.annotations.push(e);return this.filterHighlights()}},e.prototype.updateHighlights=function(){return this.highlights=this.annotator.element.find(".annotator-hl:visible"),this.filtered=this.highlights.not(this.classes.hl.hide)},e.prototype.filterHighlights=function(){var t,e,n,o,r,i,s,a,u,l;for(t=$.grep(this.filters,function(t){return!!t.annotations.length}),o=(null!=(l=t[0])?l.annotations:void 0)||[],t.length>1&&(n=[],$.each(t,function(){return $.merge(n,this.annotations)}),s=[],o=[],$.each(n,function(){return-1===$.inArray(this,s)?s.push(this):o.push(this)})),r=this.highlights,i=a=0,u=o.length;u>a;i=++a)e=o[i],r=r.not(e.highlights);return r.addClass(this.classes.hl.hide),this.filtered=this.highlights.not(this.classes.hl.hide),this},e.prototype.resetHighlights=function(){return this.highlights.removeClass(this.classes.hl.hide),this.filtered=this.highlights,this},e.prototype._onFilterFocus=function(t){var e;return e=$(t.target),e.parent().addClass(this.classes.active),e.next("button").show()},e.prototype._onFilterBlur=function(t){var e;return t.target.value?void 0:(e=$(t.target),e.parent().removeClass(this.classes.active),e.next("button").hide())},e.prototype._onFilterKeyup=function(t){var e;return e=$(t.target).parent().data("filter"),e?this.updateFilter(e):void 0},e.prototype._findNextHighlight=function(t){var e,n,o,r,i,s,a,u;return this.highlights.length?(s=t?0:-1,u=t?-1:0,a=t?"lt":"gt",e=this.highlights.not("."+this.classes.hl.hide),o=e.filter("."+this.classes.hl.active),o.length||(o=e.eq(s)),n=o.data("annotation"),r=e.index(o[0]),i=e.filter(":"+a+"("+r+")").not(n.highlights).eq(u),i.length||(i=e.eq(u)),this._scrollToHighlight(i.data("annotation").highlights)):this},e.prototype._onNextClick=function(){return this._findNextHighlight()},e.prototype._onPreviousClick=function(){return this._findNextHighlight(!0)},e.prototype._scrollToHighlight=function(t){return t=$(t),this.highlights.removeClass(this.classes.hl.active),t.addClass(this.classes.hl.active),$("html, body").animate({scrollTop:t.offset().top-(this.element.height()+20)},150)},e.prototype._onClearClick=function(t){return $(t.target).prev("input").val("").keyup().blur()},e}(n.Plugin),e.exports=n.Plugin.Filter},{annotator:"haW+cw"}],"annotator-plugin-filter":[function(t,e){e.exports=t("EZHTbU")},{}],CyErHP:[function(t,e){var n,o=function(t,e){return function(){return t.apply(e,arguments)}},r={}.hasOwnProperty,i=function(t,e){function n(){this.constructor=t}for(var o in e)r.call(e,o)&&(t[o]=e[o]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t};n=t("annotator"),n.Plugin.Markdown=function(t){function e(){this.updateTextField=o(this.updateTextField,this),null!=("undefined"!=typeof Showdown&&null!==Showdown?Showdown.converter:void 0)?(e.__super__.constructor.apply(this,arguments),this.converter=new Showdown.converter):console.error(n._t("To use the Markdown plugin, you must include Showdown into the page first."))}return i(e,t),e.prototype.events={annotationViewerTextField:"updateTextField"},e.prototype.updateTextField=function(t,e){var o;return o=n.Util.escape(e.text||""),$(t).html(this.convert(o))},e.prototype.convert=function(t){return this.converter.makeHtml(t)},e}(n.Plugin),e.exports=n.Plugin.Markdown},{annotator:"haW+cw"}],"annotator-plugin-markdown":[function(t,e){e.exports=t("CyErHP")},{}],HUruzR:[function(t,e){var n,o=function(t,e){return function(){return t.apply(e,arguments)}},r={}.hasOwnProperty,i=function(t,e){function n(){this.constructor=t}for(var o in e)r.call(e,o)&&(t[o]=e[o]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t};n=t("annotator"),n.Plugin.Permissions=function(t){function e(){this._setAuthFromToken=o(this._setAuthFromToken,this),this.updateViewer=o(this.updateViewer,this),this.updateAnnotationPermissions=o(this.updateAnnotationPermissions,this),this.updatePermissionsField=o(this.updatePermissionsField,this),this.addFieldsToAnnotation=o(this.addFieldsToAnnotation,this),e.__super__.constructor.apply(this,arguments),this.options.user&&(this.setUser(this.options.user),delete this.options.user)}return i(e,t),e.prototype.options={showViewPermissionsCheckbox:!0,showEditPermissionsCheckbox:!0,userId:function(t){return t},userString:function(t){return t},userAuthorize:function(t,e,n){var o,r,i,s;if(e.permissions){if(r=e.permissions[t]||[],0===r.length)return!0;for(i=0,s=r.length;s>i;i++)if(o=r[i],this.userId(n)===o)return!0;return!1}return e.user?n?this.userId(n)===this.userId(e.user):!1:!0},user:"",permissions:{read:[],update:[],"delete":[],admin:[]}},e.prototype.pluginInit=function(){var t,e;if(n.supported())return this.annotator.subscribe("beforeAnnotationCreated",this.addFieldsToAnnotation),e=this,t=function(t,n){return function(o,r){return e[t].call(e,n,o,r)}},!this.user&&this.annotator.plugins.Auth&&this.annotator.plugins.Auth.withToken(this._setAuthFromToken),this.options.showViewPermissionsCheckbox===!0&&this.annotator.editor.addField({type:"checkbox",label:n._t("Allow anyone to <strong>view</strong> this annotation"),load:t("updatePermissionsField","read"),submit:t("updateAnnotationPermissions","read")}),this.options.showEditPermissionsCheckbox===!0&&this.annotator.editor.addField({type:"checkbox",label:n._t("Allow anyone to <strong>edit</strong> this annotation"),load:t("updatePermissionsField","update"),submit:t("updateAnnotationPermissions","update")}),this.annotator.viewer.addField({load:this.updateViewer}),this.annotator.plugins.Filter?this.annotator.plugins.Filter.addFilter({label:n._t("User"),property:"user",isFiltered:function(t){return function(e,n){var o,r,i,s;if(n=t.options.userString(n),!e||!n)return!1;for(s=e.split(/\s*/),r=0,i=s.length;i>r;r++)if(o=s[r],-1===n.indexOf(o))return!1;return!0}}(this)}):void 0},e.prototype.setUser=function(t){return this.user=t},e.prototype.addFieldsToAnnotation=function(t){return t&&(t.permissions=this.options.permissions,this.user)?t.user=this.user:void 0},e.prototype.authorize=function(t,e,n){return void 0===n&&(n=this.user),this.options.userAuthorize?this.options.userAuthorize.call(this.options,t,e,n):!0},e.prototype.updatePermissionsField=function(t,e,n){var o;return e=$(e).show(),o=e.find("input").removeAttr("disabled"),this.authorize("admin",n)||e.hide(),this.authorize(t,n||{},null)?o.attr("checked","checked"):o.removeAttr("checked")},e.prototype.updateAnnotationPermissions=function(t,e,n){var o;return n.permissions||(n.permissions=this.options.permissions),o=t+"-permissions",n.permissions[t]=$(e).find("input").is(":checked")?[]:[this.options.userId(this.user)]},e.prototype.updateViewer=function(t,e,o){var r,i;return t=$(t),i=this.options.userString(e.user),e.user&&i&&"string"==typeof i?(r=n.Util.escape(this.options.userString(e.user)),t.html(r).addClass("annotator-user")):t.remove(),o&&(this.authorize("update",e)||o.hideEdit(),!this.authorize("delete",e))?o.hideDelete():void 0},e.prototype._setAuthFromToken=function(t){return this.setUser(t.userId)},e}(n.Plugin),e.exports=n.Plugin.Permissions},{annotator:"haW+cw"}],"annotator-plugin-permissions":[function(t,e){e.exports=t("HUruzR")},{}],vOrhum:[function(t,e){var n,o=function(t,e){return function(){return t.apply(e,arguments)}};n=t("annotator"),n.Plugin.Store=function(){function t(t){this._onError=o(this._onError,this),this.options=$.extend(!0,{},this.options,t)}return t.prototype.options={annotationData:{},emulateHTTP:!1,emulateJSON:!1,prefix:"/store",urls:{create:"/annotations",read:"/annotations/:id",update:"/annotations/:id",destroy:"/annotations/:id",search:"/search"}},t.prototype.create=function(t){return this._apiRequest("create",t)},t.prototype.update=function(t){return this._apiRequest("update",t)},t.prototype["delete"]=function(t){return this._apiRequest("destroy",t)},t.prototype.query=function(t){var e;return e=$.Deferred(),this._apiRequest("search",t).done(function(t){var n;return n=t.rows,delete t.rows,e.resolve(n,t)}).fail(function(){return e.reject.apply(e,arguments)}),e.promise()},t.prototype._apiRequest=function(t,e){var n,o,r,i;return n=e&&e.id,i=this._urlFor(t,n),o=this._apiRequestOptions(t,e),r=$.ajax(i,o),r._id=n,r._action=t,r},t.prototype._apiRequestOptions=function(t,e){var n,o,r;return o=this._methodFor(t),r={type:o,dataType:"json",error:this._onError},!this.options.emulateHTTP||"PUT"!==o&&"DELETE"!==o||(r.headers=$.extend(r.headers,{"X-HTTP-Method-Override":o}),r.type="POST"),"search"===t?r=$.extend(r,{data:e}):(("create"===t||"update"===t)&&(e=$.extend(e,this.options.annotationData)),n=e&&JSON.stringify(e),this.options.emulateJSON?(r.data={json:n},this.options.emulateHTTP&&(r.data._method=o),r):r=$.extend(r,{data:n,contentType:"application/json; charset=utf-8"}))},t.prototype._urlFor=function(t,e){var n;return n=null!=this.options.prefix?this.options.prefix:"",n+=this.options.urls[t],n=n.replace(/\/:id/,null!=e?"/"+e:""),n=n.replace(/:id/,null!=e?e:"")},t.prototype._methodFor=function(t){var e;return e={create:"POST",read:"GET",update:"PUT",destroy:"DELETE",search:"GET"},e[t]},t.prototype._onError=function(t){var e,o;switch(e=t._action,o=n._t("Sorry we could not ")+e+n._t(" this annotation"),"search"===t._action?o=n._t("Sorry we could not search the store for annotations"):"read"!==t._action||t._id||(o=n._t("Sorry we could not ")+e+n._t(" the annotations from the store")),t.status){case 401:o=n._t("Sorry you are not allowed to ")+e+n._t(" this annotation");break;case 404:o=n._t("Sorry we could not connect to the annotations store");break;case 500:o=n._t("Sorry something went wrong with the annotation store")}return n.showNotification(o,n.Notification.ERROR),console.error(n._t("API request failed:")+(" '"+t.status+"'"))},t}(),e.exports=n.Plugin.Store},{annotator:"haW+cw"}],"annotator-plugin-store":[function(t,e){e.exports=t("vOrhum")},{}],"annotator-plugin-tags":[function(t,e){e.exports=t("rXlHIq")},{}],rXlHIq:[function(t,e){var n,o=function(t,e){return function(){return t.apply(e,arguments)}},r={}.hasOwnProperty,i=function(t,e){function n(){this.constructor=t}for(var o in e)r.call(e,o)&&(t[o]=e[o]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t};n=t("annotator"),n.Plugin.Tags=function(t){function e(){return this.setAnnotationTags=o(this.setAnnotationTags,this),this.updateField=o(this.updateField,this),e.__super__.constructor.apply(this,arguments)}return i(e,t),e.prototype.options={parseTags:function(t){var e;return t=$.trim(t),e=[],t&&(e=t.split(/\s+/)),e},stringifyTags:function(t){return t.join(" ")}},e.prototype.field=null,e.prototype.input=null,e.prototype.pluginInit=function(){return n.supported()?(this.field=this.annotator.editor.addField({label:n._t("Add some tags here")+"…",load:this.updateField,submit:this.setAnnotationTags}),this.annotator.viewer.addField({load:this.updateViewer}),this.annotator.plugins.Filter&&this.annotator.plugins.Filter.addFilter({label:n._t("Tag"),property:"tags",isFiltered:n.Plugin.Tags.filterCallback}),this.input=$(this.field).find(":input")):void 0},e.prototype.parseTags=function(t){return this.options.parseTags(t)},e.prototype.stringifyTags=function(t){return this.options.stringifyTags(t)},e.prototype.updateField=function(t,e){var n;return n="",e.tags&&(n=this.stringifyTags(e.tags)),this.input.val(n)},e.prototype.setAnnotationTags=function(t,e){return e.tags=this.parseTags(this.input.val())},e.prototype.updateViewer=function(t,e){return t=$(t),e.tags&&$.isArray(e.tags)&&e.tags.length?t.addClass("annotator-tags").html(function(){var t;return t=$.map(e.tags,function(t){return'<span class="annotator-tag">'+n.Util.escape(t)+"</span>"}).join(" ")}):t.remove()},e}(n.Plugin),n.Plugin.Tags.filterCallback=function(t,e){var n,o,r,i,s,a,u,l;if(null==e&&(e=[]),r=0,o=[],t)for(o=t.split(/\s+/g),s=0,u=o.length;u>s;s++)if(n=o[s],e.length)for(a=0,l=e.length;l>a;a++)i=e[a],-1!==i.indexOf(n)&&(r+=1);return r===o.length},e.exports=n.Plugin.Tags},{annotator:"haW+cw"}],"annotator-plugin-unsupported":[function(t,e){e.exports=t("Q5LRaO")},{}],Q5LRaO:[function(t,e){var n,o={}.hasOwnProperty,r=function(t,e){function n(){this.constructor=t}for(var r in e)o.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t};n=t("annotator"),n.Plugin.Unsupported=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return r(e,t),e.prototype.options={message:n._t("Sorry your current browser does not support the Annotator")},e.prototype.pluginInit=function(){return n.supported()?void 0:$(function(t){return function(){return n.showNotification(t.options.message),void 0===window.XMLHttpRequest&&void 0!==ActiveXObject?$("html").addClass("ie6"):void 0}}(this))},e}(n.Plugin),e.exports=n.Plugin.Unsupported},{annotator:"haW+cw"}],24:[function(t,e){var n,o,r={}.hasOwnProperty,i=function(t,e){function n(){this.constructor=t}for(var o in e)r.call(e,o)&&(t[o]=e[o]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t};o=t("./util"),n={},n.sniff=function(t){return null!=t.commonAncestorContainer?new n.BrowserRange(t):"string"==typeof t.start?new n.SerializedRange(t):t.start&&"object"==typeof t.start?new n.NormalizedRange(t):(console.error(_t("Could not sniff range type")),!1)},n.nodeFromXPath=function(t,e){var n,r,i,s,a;return null==e&&(e=document),r=function(t,n){var r;null==n&&(n=null);try{return document.evaluate("."+t,e,n,XPathResult.FIRST_ORDERED_NODE_TYPE,null).singleNodeValue}catch(i){return r=i,console.log("XPath evaluation failed."),console.log("Trying fallback..."),o.nodeFromXPath(t,e)}},$.isXMLDoc(document.documentElement)?(n=document.createNSResolver(null===document.ownerDocument?document.documentElement:document.ownerDocument.documentElement),s=r(t,n),s||(t=function(){var e,n,o,r;for(o=t.split("/"),r=[],e=0,n=o.length;n>e;e++)a=o[e],r.push(a&&-1===a.indexOf(":")?a.replace(/^([a-z]+)/,"xhtml:$1"):a);return r}().join("/"),i=document.lookupNamespaceURI(null),n=function(t){return"xhtml"===t?i:document.documentElement.getAttribute("xmlns:"+t)},s=r(t,n)),s):r(t)},n.RangeError=function(t){function e(t,n,o){this.type=t,this.message=n,this.parent=null!=o?o:null,e.__super__.constructor.call(this,this.message)}return i(e,t),e}(Error),n.BrowserRange=function(){function t(t){this.commonAncestorContainer=t.commonAncestorContainer,this.startContainer=t.startContainer,this.startOffset=t.startOffset,this.endContainer=t.endContainer,this.endOffset=t.endOffset}return t.prototype.normalize=function(){var t,e,r,i;if(this.tainted)return console.error(_t("You may only call normalize() once on a BrowserRange!")),!1;if(this.tainted=!0,i={},this.startContainer.nodeType===Node.ELEMENT_NODE?(i.start=o.getFirstTextNodeNotBefore(this.startContainer.childNodes[this.startOffset]),i.startOffset=0):(i.start=this.startContainer,i.startOffset=this.startOffset),this.endContainer.nodeType===Node.ELEMENT_NODE){if(e=this.endContainer.childNodes[this.endOffset],null!=e){for(t=e;null!=t&&t.nodeType!==Node.TEXT_NODE;)t=t.firstChild;null!=t&&(i.end=t,i.endOffset=0)}null==i.end&&(e=this.endOffset?this.endContainer.childNodes[this.endOffset-1]:this.endContainer.previousSibling,i.end=o.getLastTextNodeUpTo(e),i.endOffset=i.end.nodeValue.length)}else i.end=this.endContainer,i.endOffset=this.endOffset;for(r={},r.start=i.startOffset>0?i.start.nodeValue.length>i.startOffset?i.start.splitText(i.startOffset):i.start.nextSibling:i.start,i.start===i.end?(r.start.nodeValue.length>i.endOffset-i.startOffset&&r.start.splitText(i.endOffset-i.startOffset),r.end=r.start):(i.end.nodeValue.length>i.endOffset&&i.end.splitText(i.endOffset),r.end=i.end),r.commonAncestor=this.commonAncestorContainer;r.commonAncestor.nodeType!==Node.ELEMENT_NODE;)r.commonAncestor=r.commonAncestor.parentNode;return new n.NormalizedRange(r)},t.prototype.serialize=function(t,e){return this.normalize(t).serialize(t,e)},t}(),n.NormalizedRange=function(){function t(t){this.commonAncestor=t.commonAncestor,this.start=t.start,this.end=t.end}return t.prototype.normalize=function(){return this},t.prototype.limit=function(t){var e,n,o,r,i,s;if(e=$.grep(this.textNodes(),function(e){return e.parentNode===t||$.contains(t,e.parentNode)}),!e.length)return null;for(this.start=e[0],this.end=e[e.length-1],o=$(this.start).parents(),s=$(this.end).parents(),r=0,i=s.length;i>r;r++)if(n=s[r],-1!==o.index(n)){this.commonAncestor=n;break}return this},t.prototype.serialize=function(t,e){var r,i,s;return i=function(n,r){var i,s,a,u,l,h,p,c;for(u=e?$(n).parents(":not("+e+")").eq(0):$(n).parent(),h=o.xpathFromNode(u,t)[0],l=o.getTextNodes(u),s=l.slice(0,l.index(n)),a=0,p=0,c=s.length;c>p;p++)i=s[p],a+=i.nodeValue.length;return r?[h,a+n.nodeValue.length]:[h,a]},s=i(this.start),r=i(this.end,!0),new n.SerializedRange({start:s[0],end:r[0],startOffset:s[1],endOffset:r[1]})},t.prototype.text=function(){var t;return function(){var e,n,o,r;for(o=this.textNodes(),r=[],e=0,n=o.length;n>e;e++)t=o[e],r.push(t.nodeValue);return r}.call(this).join("")},t.prototype.textNodes=function(){var t,e,n,r;return n=o.getTextNodes($(this.commonAncestor)),r=[n.index(this.start),n.index(this.end)],e=r[0],t=r[1],$.makeArray(n.slice(e,+t+1||9e9))},t.prototype.toRange=function(){var t;return t=document.createRange(),t.setStartBefore(this.start),t.setEndAfter(this.end),t},t}(),n.SerializedRange=function(){function t(t){this.start=t.start,this.startOffset=t.startOffset,this.end=t.end,this.endOffset=t.endOffset}return t.prototype.normalize=function(t){var e,r,i,s,a,u,l,h,p,c,d,f,g,y;for(u={},g=["start","end"],p=0,d=g.length;d>p;p++){a=g[p];try{s=n.nodeFromXPath(this[a],t)}catch(m){throw r=m,new n.RangeError(a,"Error while finding "+a+" node: "+this[a]+": "+r,r)}if(!s)throw new n.RangeError(a,"Couldn't find "+a+" node: "+this[a]);for(i=0,l=this[a+"Offset"],"end"===a&&l--,y=o.getTextNodes($(s)),c=0,f=y.length;f>c;c++){if(h=y[c],i+h.nodeValue.length>l){u[a+"Container"]=h,u[a+"Offset"]=this[a+"Offset"]-i;break}i+=h.nodeValue.length}if(null==u[a+"Offset"])throw new n.RangeError(""+a+"offset","Couldn't find offset "+this[a+"Offset"]+" in element "+this[a])}return e=null==document.compareDocumentPosition?function(t,e){return t.contains(e)}:function(t,e){return 16&t.compareDocumentPosition(e)},$(u.startContainer).parents().each(function(){return e(this,u.endContainer)?(u.commonAncestorContainer=this,!1):void 0}),new n.BrowserRange(u).normalize(t)},t.prototype.serialize=function(t,e){return this.normalize(t).serialize(t,e)},t.prototype.toObject=function(){return{start:this.start,startOffset:this.startOffset,end:this.end,endOffset:this.endOffset}},t}(),e.exports=n},{"./util":27}],25:[function(t,e){var n,o={}.hasOwnProperty;n=function(){function t(t){this.settings=null!=t?t:{}}return t.createApp=function(t,e){return null==e&&(e={}),new this(e).run(t)},t.prototype.include=function(t){return t.configure(this),this},t.prototype.run=function(t){var e,n;if(this.app)throw new Error("Registry is already bound to a running application");this.include(t);for(e in this)o.call(this,e)&&(n=this[e],t[e]=n);return this.app=t,t.run(this)},t}(),e.exports=n},{}],26:[function(t,e){var n;n=function(){function t(t){this.registry=t}return t.configure=function(t){var e,n,o;return e=null!=(o=t.settings.store)?o.type:void 0,n="function"==typeof e?new e(t.settings.store):new this(t),null!=t.store?t.store:t.store=n},t.prototype.id=function(){var t;return t=0,function(){return t++}}(),t.prototype.create=function(t){var e;return e=$.Deferred(),null==t.id&&(t.id=this.id()),e.resolve(t),e.promise()},t.prototype.update=function(t){var e;return e=$.Deferred(),e.resolve(t),e.promise()},t.prototype["delete"]=function(t){var e;return e=$.Deferred(),e.resolve(t),e.promise()},t.prototype.query=function(){var t;return t=$.Deferred(),t.resolve([],{}),t.promise()},t}(),e.exports=n},{}],27:[function(t,e){var n,o,r,i,s,a;r=t("./xpath"),o=null,"undefined"!=typeof Gettext&&null!==Gettext?(i=new Gettext({domain:"annotator"}),o=function(t){return i.gettext(t)}):o=function(t){return t},a=function(t){return o(t)},("undefined"!=typeof jQuery&&null!==jQuery&&null!=(s=jQuery.fn)?s.jquery:void 0)||console.error(a("Annotator requires jQuery: have you included lib/vendor/jquery.js?")),JSON&&JSON.parse&&JSON.stringify||console.error(a("Annotator requires a JSON implementation: have you included lib/vendor/json2.js?")),n={},n.TranslationString=a,n.flatten=function(t){var e;return(e=function(t){var n,o,r,i;for(o=[],r=0,i=t.length;i>r;r++)n=t[r],o=o.concat(n&&$.isArray(n)?e(n):n);return o})(t)},n.contains=function(t,e){var n;for(n=e;null!=n;){if(n===t)return!0;n=n.parentNode}return!1},n.getTextNodes=function(t){var e;return e=function(t){var n;if(t&&t.nodeType!==Node.TEXT_NODE){if(n=[],t.nodeType!==Node.COMMENT_NODE)for(t=t.lastChild;t;)n.push(e(t)),t=t.previousSibling;return n.reverse()}return t},t.map(function(){return n.flatten(e(this))})},n.getLastTextNodeUpTo=function(t){var e;switch(t.nodeType){case Node.TEXT_NODE:return t;case Node.ELEMENT_NODE:if(null!=t.lastChild&&(e=n.getLastTextNodeUpTo(t.lastChild),null!=e))return e}return t=t.previousSibling,null!=t?n.getLastTextNodeUpTo(t):null},n.getFirstTextNodeNotBefore=function(t){var e;switch(t.nodeType){case Node.TEXT_NODE:return t;case Node.ELEMENT_NODE:if(null!=t.firstChild&&(e=n.getFirstTextNodeNotBefore(t.firstChild),null!=e))return e}return t=t.nextSibling,null!=t?n.getFirstTextNodeNotBefore(t):null},n.readRangeViaSelection=function(t){var e;return e=n.getGlobal().getSelection(),e.removeAllRanges(),e.addRange(t.toRange()),e.toString()},n.xpathFromNode=function(t,e){var n,o;try{o=r.simpleXPathJQuery.call(t,e)}catch(i){n=i,console.log("jQuery-based XPath construction failed! Falling back to manual."),o=r.simpleXPathPure.call(t,e)}return o},n.nodeFromXPath=function(t,e){var n,o,i,s,a,u,l,h;for(a=t.substring(1).split("/"),i=e,u=0,l=a.length;l>u;u++)s=a[u],h=s.split("["),o=h[0],n=h[1],n=null!=n?parseInt((null!=n?n.split("]"):void 0)[0]):1,i=r.findChild(i,o.toLowerCase(),n);return i},n.escape=function(t){return t.replace(/&(?!\w+;)/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")},n.uuid=function(){var t;return t=0,function(){return t++}}(),n.getGlobal=function(){return function(){return this}()},n.maxZIndex=function(t){var e,n;return e=function(){var e,o,r;for(r=[],e=0,o=t.length;o>e;e++)n=t[e],r.push("static"===$(n).css("position")?-1:parseInt($(n).css("z-index"),10)||-1);return r}(),Math.max.apply(Math,e)},n.mousePosition=function(t,e){var n,o;return"absolute"!==(o=$(e).css("position"))&&"fixed"!==o&&"relative"!==o&&(e=$(e).offsetParent()[0]),n=$(e).offset(),{top:t.pageY-n.top,left:t.pageX-n.left}},n.preventEventDefault=function(t){return null!=t&&"function"==typeof t.preventDefault?t.preventDefault():void 0},e.exports=n},{"./xpath":30}],28:[function(t,e){var n,o,r,i,s,a=function(t,e){return function(){return t.apply(e,arguments)}},u={}.hasOwnProperty,l=function(t,e){function n(){this.constructor=t}for(var o in e)u.call(e,o)&&(t[o]=e[o]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t};o=t("./util"),i=t("./widget"),s=o.TranslationString,r=function(t){function e(t){this.onDeleteClick=a(this.onDeleteClick,this),this.onEditClick=a(this.onEditClick,this),this.load=a(this.load,this),this.hide=a(this.hide,this),this.show=a(this.show,this),e.__super__.constructor.call(this,$(this.html.element)[0],t),this.item=$(this.html.item)[0],this.fields=[],this.annotations=[]}return l(e,t),e.prototype.events={".annotator-edit click":"onEditClick",".annotator-delete click":"onDeleteClick"},e.prototype.classes={hide:"annotator-hide",showControls:"annotator-visible"},e.prototype.html={element:'<div class="annotator-outer annotator-viewer">\n <ul class="annotator-widget annotator-listing"></ul>\n</div>',item:'<li class="annotator-annotation annotator-item">\n <span class="annotator-controls">\n <a href="#" title="View as webpage" class="annotator-link">View as webpage</a>\n <button type="button" title="Edit" class="annotator-edit">Edit</button>\n <button type="button" title="Delete" class="annotator-delete">Delete</button>\n </span>\n</li>'},e.prototype.options={readOnly:!1},e.prototype.show=function(t){var e;return o.preventEventDefault(t),e=this.element.find(".annotator-controls").addClass(this.classes.showControls),setTimeout(function(t){return function(){return e.removeClass(t.classes.showControls)}}(this),500),this.element.removeClass(this.classes.hide),this.checkOrientation().publish("show")},e.prototype.isShown=function(){return!this.element.hasClass(this.classes.hide)},e.prototype.hide=function(t){return o.preventEventDefault(t),this.element.addClass(this.classes.hide),this.publish("hide")},e.prototype.load=function(t){var e,o,r,i,s,a,u,l,h,p,c,d,f,g,y,m,v;for(this.annotations=t||[],c=this.element.find("ul:first").empty(),m=this.annotations,d=0,g=m.length;g>d;d++)for(e=m[d],l=$(this.item).clone().appendTo(c).data("annotation",e),r=l.find(".annotator-controls"),h=r.find(".annotator-link"),s=r.find(".annotator-edit"),i=r.find(".annotator-delete"),p=new n(e.links||[]).get("alternate",{type:"text/html"}),0===p.length||null==p[0].href?h.remove():h.attr("href",p[0].href),this.options.readOnly?(s.remove(),i.remove()):o={showEdit:function(){return s.removeAttr("disabled")},hideEdit:function(){return s.attr("disabled","disabled")},showDelete:function(){return i.removeAttr("disabled")},hideDelete:function(){return i.attr("disabled","disabled")}},v=this.fields,f=0,y=v.length;y>f;f++)u=v[f],a=$(u.element).clone().appendTo(l)[0],u.load(a,e,o);return this.publish("load",[this.annotations]),this.show()},e.prototype.addField=function(t){var e;return e=$.extend({load:function(){}},t),e.element=$("<div />")[0],this.fields.push(e),e.element,this},e.prototype.onEditClick=function(t){return this.onButtonClick(t,"edit")},e.prototype.onDeleteClick=function(t){return this.onButtonClick(t,"delete")},e.prototype.onButtonClick=function(t,e){var n;return n=$(t.target).parents(".annotator-annotation"),this.publish(e,[n.data("annotation")])},e}(i),n=function(){function t(t){this.data=t}return t.prototype.get=function(t,e){var n,o,r,i,s,a,l,h,p;for(null==e&&(e={}),e=$.extend({},e,{rel:t}),r=function(){var t;t=[];for(o in e)u.call(e,o)&&(s=e[o],t.push(o));return t}(),h=this.data,p=[],a=0,l=h.length;l>a;a++)n=h[a],i=r.reduce(function(t,o){return t&&n[o]===e[o]},!0),i&&p.push(n);return p},t}(),e.exports=r},{"./util":27,"./widget":29}],29:[function(t,e){var n,o,r,i={}.hasOwnProperty,s=function(t,e){function n(){this.constructor=t}for(var o in e)i.call(e,o)&&(t[o]=e[o]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t};n=t("./class"),o=t("./util"),r=function(t){function e(){e.__super__.constructor.apply(this,arguments),this.classes=$.extend({},e.prototype.classes,this.classes)}return s(e,t),e.prototype.classes={hide:"annotator-hide",invert:{x:"annotator-invert-x",y:"annotator-invert-y"}},e.prototype.destroy=function(){return this.removeEvents(),this.element.remove()},e.prototype.checkOrientation=function(){var t,e,n,r,i;return this.resetOrientation(),i=$(o.getGlobal()),r=this.element.children(":first"),e=r.offset(),n={top:i.scrollTop(),right:i.width()+i.scrollLeft()},t={top:e.top,right:e.left+r.width()},t.top-n.top<0&&this.invertY(),t.right-n.right>0&&this.invertX(),this},e.prototype.resetOrientation=function(){return this.element.removeClass(this.classes.invert.x).removeClass(this.classes.invert.y),this},e.prototype.invertX=function(){return this.element.addClass(this.classes.invert.x),this},e.prototype.invertY=function(){return this.element.addClass(this.classes.invert.y),this},e.prototype.isInvertedY=function(){return this.element.hasClass(this.classes.invert.y)},e.prototype.isInvertedX=function(){return this.element.hasClass(this.classes.invert.x)},e}(n),e.exports=r},{"./class":7,"./util":27}],30:[function(t,e){var n,o,r,i,s;i=function(t){var e;return e=this.map(function(){var e,n,o,r;for(o="",e=this;(null!=e?e.nodeType:void 0)===Node.ELEMENT_NODE&&e!==t;)r=e.tagName.replace(":","\\:"),n=$(e.parentNode).children(r).index(e)+1,n="["+n+"]",o="/"+e.tagName.toLowerCase()+n+o,e=e.parentNode;return o}),e.get()},s=function(t){var e,n,i,s;return e=function(t){var e,n;return e=o(t),n=r(t),""+e+"["+n+"]"},s=t,n=function(t){var n;for(n="";t!==s;){if(null==t)throw new Error("Called getPathTo on a node which was not a descendant of @rootNode. "+s);n=e(t)+"/"+n,t=t.parentNode}return n="/"+n,n=n.replace(/\/$/,"")},i=this.map(function(){var t;return t=n(this)}),i.get()},n=function(t,e,n){var r,i,s,a,u,l;if(!t.hasChildNodes())throw new Error("XPath error: node has no children!");for(i=t.childNodes,s=0,u=0,l=i.length;l>u;u++)if(r=i[u],a=o(r),a===e&&(s+=1,s===n))return r;throw new Error("XPath error: wanted child not found.")},o=function(t){var e;switch(e=t.nodeName.toLowerCase()){case"#text":return"text()";case"#comment":return"comment()";case"#cdata-section":return"cdata-section()";default:return e}},r=function(t){var e,n;for(e=0,n=t;n;)n.nodeName===t.nodeName&&e++,n=n.previousSibling;return e},e.exports={simpleXPathJQuery:i,simpleXPathPure:s,findChild:n}},{}]},{},["haW+cw"])("haW+cw")}); //# sourceMappingURL=annotator-digilib.min.js.map