diff --git a/dist/sntools.js b/dist/sntools.js index 7bb5c601..e31c8b04 100644 --- a/dist/sntools.js +++ b/dist/sntools.js @@ -122,6 +122,7 @@ var SNTools = function () { var contentXmlString = xmlNote.getElementsByTagName("content")[0].childNodes[0].nodeValue; var contentXml = this.loadXMLString(contentXmlString, "html"); var contentHTML = contentXml.getElementsByTagName("en-note")[0].innerHTML; + contentHTML = contentHTML.replace(/]*>/g, "\n\n"); var text = this.strip(contentHTML); var note = { diff --git a/dist/sntools.min.js b/dist/sntools.min.js index dad0f5a9..4c955e7f 100644 --- a/dist/sntools.min.js +++ b/dist/sntools.min.js @@ -1,2 +1,2 @@ -!function a(b,c,d){function e(g,h){if(!c[g]){if(!b[g]){var i="function"==typeof require&&require;if(!h&&i)return i(g,!0);if(f)return f(g,!0);var j=new Error("Cannot find module '"+g+"'");throw j.code="MODULE_NOT_FOUND",j}var k=c[g]={exports:{}};b[g][0].call(k.exports,function(a){var c=b[g][1][a];return e(c||a)},k,k.exports,a,b,c,d)}return c[g].exports}for(var f="function"==typeof require&&require,g=0;g>3]>>c%8*4&15;return("x"==a?d:3&d|8).toString(16)})}var d=(new Date).getTime();return window.performance&&"function"==typeof window.performance.now&&(d+=performance.now()),"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(a){var b=(d+16*Math.random())%16|0;return d=Math.floor(d/16),("x"==a?b:3&b|8).toString(16)})}},{key:"strip",value:function(a){var b=document.implementation.createHTMLDocument("New").body;return b.innerHTML=a,b.textContent||b.innerText||""}},{key:"loadXMLString",value:function(a,b){var c;if(window.DOMParser){c=(new DOMParser).parseFromString(a,"text/"+b)}else c=new ActiveXObject("Microsoft.XMLDOM"),c.async=!1,c.loadXML(a);return c}},{key:"downloadSNData",value:function(a,b){var c=null,d=function(a){var b=new Blob([a],{type:"text/json"});return null!==c&&window.URL.revokeObjectURL(c),c=window.URL.createObjectURL(b)}(JSON.stringify(a,null,2)),e=document.createElement("a");e.setAttribute("download",b),e.href=d,document.body.appendChild(e),e.click(),document.body.removeChild(e)}},{key:"convertENEXDatatoSN",value:function(a){var b=this.loadXMLString(a,"xml"),c=b.getElementsByTagName("note"),d=[],e=[],f=!0,g=!1,h=void 0;try{for(var i,j=c[Symbol.iterator]();!(f=(i=j.next()).done);f=!0){var k=i.value,l=k.getElementsByTagName("title")[0].childNodes[0].nodeValue,m=k.getElementsByTagName("created")[0].childNodes[0].nodeValue,n=k.getElementsByTagName("updated"),o=n.length?n[0].childNodes[0].nodeValue:null,p=k.getElementsByTagName("content")[0].childNodes[0].nodeValue,q=this.loadXMLString(p,"html"),r=q.getElementsByTagName("en-note")[0].innerHTML,s=this.strip(r),t={created_at:moment(m).toDate(),updated_at:o?moment(o).toDate():null,uuid:this.generateUUID(),content_type:"Note",content:{title:l,text:s,references:[]}},u=k.getElementsByTagName("tag"),v=!0,w=!1,x=void 0;try{for(var y,z=u[Symbol.iterator]();!(v=(y=z.next()).done);v=!0){var A=y.value,B=A.childNodes[0].nodeValue,C=function(a){return e.filter(function(b){return b.content.title==a})[0]}(B);C||(C={uuid:this.generateUUID(),content_type:"Tag",created_at:new Date,updated_at:new Date,content:{title:B,references:[]}},function(a){e.push(a)}(C)),t.content.references.push({content_type:C.content_type,uuid:C.uuid}),C.content.references.push({content_type:t.content_type,uuid:t.uuid})}}catch(a){w=!0,x=a}finally{try{!v&&z.return&&z.return()}finally{if(w)throw x}}d.push(t)}}catch(a){g=!0,h=a}finally{try{!f&&j.return&&j.return()}finally{if(g)throw h}}return{items:d.concat(e)}}},{key:"convertPlaintextFiles",value:function(a,b){var c=0,d=[],e=function(){var f=a[c];c++;var g=new FileReader;g.onload=function(g){var h=g.target.result,i={created_at:new Date,updated_at:new Date,uuid:this.generateUUID(),content_type:"Note",content:{title:f.name.split(".")[0],text:h,references:[]}};d.push(i),c0)for(c in qd)d=qd[c],e=b[d],o(e)||(a[d]=e);return a}function q(b){p(this,b),this._d=new Date(null!=b._d?b._d.getTime():NaN),this.isValid()||(this._d=new Date(NaN)),!1===rd&&(rd=!0,a.updateOffset(this),rd=!1)}function r(a){return a instanceof q||null!=a&&null!=a._isAMomentObject}function s(a){return a<0?Math.ceil(a)||0:Math.floor(a)}function t(a){var b=+a,c=0;return 0!==b&&isFinite(b)&&(c=s(b)),c}function u(a,b,c){var d,e=Math.min(a.length,b.length),f=Math.abs(a.length-b.length),g=0;for(d=0;d0?"future":"past"];return y(c)?c(b):c.replace(/%s/i,b)}function I(a,b){var c=a.toLowerCase();zd[c]=zd[c+"s"]=zd[b]=a}function J(a){return"string"==typeof a?zd[a]||zd[a.toLowerCase()]:void 0}function K(a){var b,c,d={};for(c in a)h(a,c)&&(b=J(c))&&(d[b]=a[c]);return d}function L(a,b){Ad[a]=b}function M(a){var b=[];for(var c in a)b.push({unit:c,priority:Ad[c]});return b.sort(function(a,b){return a.priority-b.priority}),b}function N(b,c){return function(d){return null!=d?(P(this,b,d),a.updateOffset(this,c),this):O(this,b)}}function O(a,b){return a.isValid()?a._d["get"+(a._isUTC?"UTC":"")+b]():NaN}function P(a,b,c){a.isValid()&&a._d["set"+(a._isUTC?"UTC":"")+b](c)}function Q(a){return a=J(a),y(this[a])?this[a]():this}function R(a,b){if("object"==typeof a){a=K(a);for(var c=M(a),d=0;d=0?c?"+":"":"-")+Math.pow(10,Math.max(0,e)).toString().substr(1)+d}function T(a,b,c,d){var e=d;"string"==typeof d&&(e=function(){return this[d]()}),a&&(Ed[a]=e),b&&(Ed[b[0]]=function(){return S(e.apply(this,arguments),b[1],b[2])}),c&&(Ed[c]=function(){return this.localeData().ordinal(e.apply(this,arguments),a)})}function U(a){return a.match(/\[[\s\S]/)?a.replace(/^\[|\]$/g,""):a.replace(/\\/g,"")}function V(a){var b,c,d=a.match(Bd);for(b=0,c=d.length;b=0&&Cd.test(a);)a=a.replace(Cd,c),Cd.lastIndex=0,d-=1;return a}function Y(a,b,c){Sd[a]=y(b)?b:function(a,d){return a&&c?c:b}}function Z(a,b){return h(Sd,a)?Sd[a](b._strict,b._locale):new RegExp($(a))}function $(a){return _(a.replace("\\","").replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g,function(a,b,c,d,e){return b||c||d||e}))}function _(a){return a.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}function aa(a,b){var c,d=b;for("string"==typeof a&&(a=[a]),e(b)&&(d=function(a,c){c[b]=t(a)}),c=0;c=0&&isFinite(h.getFullYear())&&h.setFullYear(a),h}function sa(a){var b=new Date(Date.UTC.apply(null,arguments));return a<100&&a>=0&&isFinite(b.getUTCFullYear())&&b.setUTCFullYear(a),b}function ta(a,b,c){var d=7+b-c;return-(7+sa(a,0,d).getUTCDay()-b)%7+d-1}function ua(a,b,c,d,e){var f,g,h=(7+c-d)%7,i=ta(a,d,e),j=1+7*(b-1)+h+i;return j<=0?(f=a-1,g=oa(f)+j):j>oa(a)?(f=a+1,g=j-oa(a)):(f=a,g=j),{year:f,dayOfYear:g}}function va(a,b,c){var d,e,f=ta(a.year(),b,c),g=Math.floor((a.dayOfYear()-f-1)/7)+1;return g<1?(e=a.year()-1,d=g+wa(e,b,c)):g>wa(a.year(),b,c)?(d=g-wa(a.year(),b,c),e=a.year()+1):(e=a.year(),d=g),{week:d,year:e}}function wa(a,b,c){var d=ta(a,b,c),e=ta(a+1,b,c);return(oa(a)-d+e)/7}function xa(a){return va(a,this._week.dow,this._week.doy).week}function ya(){return this._week.dow}function za(){return this._week.doy}function Aa(a){var b=this.localeData().week(this);return null==a?b:this.add(7*(a-b),"d")}function Ba(a){var b=va(this,1,4).week;return null==a?b:this.add(7*(a-b),"d")}function Ca(a,b){return"string"!=typeof a?a:isNaN(a)?(a=b.weekdaysParse(a),"number"==typeof a?a:null):parseInt(a,10)}function Da(a,b){return"string"==typeof a?b.weekdaysParse(a)%7||7:isNaN(a)?null:a}function Ea(a,c){return a?b(this._weekdays)?this._weekdays[a.day()]:this._weekdays[this._weekdays.isFormat.test(c)?"format":"standalone"][a.day()]:this._weekdays}function Fa(a){return a?this._weekdaysShort[a.day()]:this._weekdaysShort}function Ga(a){return a?this._weekdaysMin[a.day()]:this._weekdaysMin}function Ha(a,b,c){var d,e,f,g=a.toLocaleLowerCase();if(!this._weekdaysParse)for(this._weekdaysParse=[],this._shortWeekdaysParse=[],this._minWeekdaysParse=[],d=0;d<7;++d)f=j([2e3,1]).day(d),this._minWeekdaysParse[d]=this.weekdaysMin(f,"").toLocaleLowerCase(),this._shortWeekdaysParse[d]=this.weekdaysShort(f,"").toLocaleLowerCase(),this._weekdaysParse[d]=this.weekdays(f,"").toLocaleLowerCase();return c?"dddd"===b?(e=be.call(this._weekdaysParse,g),-1!==e?e:null):"ddd"===b?(e=be.call(this._shortWeekdaysParse,g),-1!==e?e:null):(e=be.call(this._minWeekdaysParse,g),-1!==e?e:null):"dddd"===b?(e=be.call(this._weekdaysParse,g),-1!==e?e:(e=be.call(this._shortWeekdaysParse,g),-1!==e?e:(e=be.call(this._minWeekdaysParse,g),-1!==e?e:null))):"ddd"===b?(e=be.call(this._shortWeekdaysParse,g),-1!==e?e:(e=be.call(this._weekdaysParse,g),-1!==e?e:(e=be.call(this._minWeekdaysParse,g),-1!==e?e:null))):(e=be.call(this._minWeekdaysParse,g),-1!==e?e:(e=be.call(this._weekdaysParse,g),-1!==e?e:(e=be.call(this._shortWeekdaysParse,g),-1!==e?e:null)))}function Ia(a,b,c){var d,e,f;if(this._weekdaysParseExact)return Ha.call(this,a,b,c);for(this._weekdaysParse||(this._weekdaysParse=[],this._minWeekdaysParse=[],this._shortWeekdaysParse=[],this._fullWeekdaysParse=[]),d=0;d<7;d++){if(e=j([2e3,1]).day(d),c&&!this._fullWeekdaysParse[d]&&(this._fullWeekdaysParse[d]=new RegExp("^"+this.weekdays(e,"").replace(".",".?")+"$","i"),this._shortWeekdaysParse[d]=new RegExp("^"+this.weekdaysShort(e,"").replace(".",".?")+"$","i"),this._minWeekdaysParse[d]=new RegExp("^"+this.weekdaysMin(e,"").replace(".",".?")+"$","i")),this._weekdaysParse[d]||(f="^"+this.weekdays(e,"")+"|^"+this.weekdaysShort(e,"")+"|^"+this.weekdaysMin(e,""),this._weekdaysParse[d]=new RegExp(f.replace(".",""),"i")),c&&"dddd"===b&&this._fullWeekdaysParse[d].test(a))return d;if(c&&"ddd"===b&&this._shortWeekdaysParse[d].test(a))return d;if(c&&"dd"===b&&this._minWeekdaysParse[d].test(a))return d;if(!c&&this._weekdaysParse[d].test(a))return d}}function Ja(a){if(!this.isValid())return null!=a?this:NaN;var b=this._isUTC?this._d.getUTCDay():this._d.getDay();return null!=a?(a=Ca(a,this.localeData()),this.add(a-b,"d")):b}function Ka(a){if(!this.isValid())return null!=a?this:NaN;var b=(this.day()+7-this.localeData()._week.dow)%7;return null==a?b:this.add(a-b,"d")}function La(a){if(!this.isValid())return null!=a?this:NaN;if(null!=a){var b=Da(a,this.localeData());return this.day(this.day()%7?b:b-7)}return this.day()||7}function Ma(a){return this._weekdaysParseExact?(h(this,"_weekdaysRegex")||Pa.call(this),a?this._weekdaysStrictRegex:this._weekdaysRegex):(h(this,"_weekdaysRegex")||(this._weekdaysRegex=me),this._weekdaysStrictRegex&&a?this._weekdaysStrictRegex:this._weekdaysRegex)}function Na(a){return this._weekdaysParseExact?(h(this,"_weekdaysRegex")||Pa.call(this),a?this._weekdaysShortStrictRegex:this._weekdaysShortRegex):(h(this,"_weekdaysShortRegex")||(this._weekdaysShortRegex=ne),this._weekdaysShortStrictRegex&&a?this._weekdaysShortStrictRegex:this._weekdaysShortRegex)}function Oa(a){return this._weekdaysParseExact?(h(this,"_weekdaysRegex")||Pa.call(this),a?this._weekdaysMinStrictRegex:this._weekdaysMinRegex):(h(this,"_weekdaysMinRegex")||(this._weekdaysMinRegex=oe),this._weekdaysMinStrictRegex&&a?this._weekdaysMinStrictRegex:this._weekdaysMinRegex)}function Pa(){function a(a,b){return b.length-a.length}var b,c,d,e,f,g=[],h=[],i=[],k=[];for(b=0;b<7;b++)c=j([2e3,1]).day(b),d=this.weekdaysMin(c,""),e=this.weekdaysShort(c,""),f=this.weekdays(c,""),g.push(d),h.push(e),i.push(f),k.push(d),k.push(e),k.push(f);for(g.sort(a),h.sort(a),i.sort(a),k.sort(a),b=0;b<7;b++)h[b]=_(h[b]),i[b]=_(i[b]),k[b]=_(k[b]);this._weekdaysRegex=new RegExp("^("+k.join("|")+")","i"),this._weekdaysShortRegex=this._weekdaysRegex,this._weekdaysMinRegex=this._weekdaysRegex,this._weekdaysStrictRegex=new RegExp("^("+i.join("|")+")","i"),this._weekdaysShortStrictRegex=new RegExp("^("+h.join("|")+")","i"),this._weekdaysMinStrictRegex=new RegExp("^("+g.join("|")+")","i")}function Qa(){return this.hours()%12||12}function Ra(){return this.hours()||24}function Sa(a,b){T(a,0,0,function(){return this.localeData().meridiem(this.hours(),this.minutes(),b)})}function Ta(a,b){return b._meridiemParse}function Ua(a){return"p"===(a+"").toLowerCase().charAt(0)}function Va(a,b,c){return a>11?c?"pm":"PM":c?"am":"AM"}function Wa(a){return a?a.toLowerCase().replace("_","-"):a}function Xa(a){for(var b,c,d,e,f=0;f0;){if(d=Ya(e.slice(0,b).join("-")))return d;if(c&&c.length>=b&&u(e,c,!0)>=b-1)break;b--}f++}return null}function Ya(a){var b=null;if(!se[a]&&"undefined"!=typeof module&&module&&module.exports)try{b=pe._abbr,require("./locale/"+a),Za(b)}catch(a){}return se[a]}function Za(a,b){var c;return a&&(c=o(b)?ab(a):$a(a,b))&&(pe=c),pe._abbr}function $a(a,b){if(null!==b){var c=re;if(b.abbr=a,null!=se[a])x("defineLocaleOverride","use moment.updateLocale(localeName, config) to change an existing locale. moment.defineLocale(localeName, config) should only be used for creating a new locale See http://momentjs.com/guides/#/warnings/define-locale/ for more info."),c=se[a]._config;else if(null!=b.parentLocale){if(null==se[b.parentLocale])return te[b.parentLocale]||(te[b.parentLocale]=[]),te[b.parentLocale].push({name:a,config:b}),null;c=se[b.parentLocale]._config}return se[a]=new B(A(c,b)),te[a]&&te[a].forEach(function(a){$a(a.name,a.config)}),Za(a),se[a]}return delete se[a],null}function _a(a,b){if(null!=b){var c,d=re;null!=se[a]&&(d=se[a]._config),b=A(d,b),c=new B(b),c.parentLocale=se[a],se[a]=c,Za(a)}else null!=se[a]&&(null!=se[a].parentLocale?se[a]=se[a].parentLocale:null!=se[a]&&delete se[a]);return se[a]}function ab(a){var c;if(a&&a._locale&&a._locale._abbr&&(a=a._locale._abbr),!a)return pe;if(!b(a)){if(c=Ya(a))return c;a=[a]}return Xa(a)}function bb(){return vd(se)}function cb(a){var b,c=a._a;return c&&-2===l(a).overflow&&(b=c[Vd]<0||c[Vd]>11?Vd:c[Wd]<1||c[Wd]>da(c[Ud],c[Vd])?Wd:c[Xd]<0||c[Xd]>24||24===c[Xd]&&(0!==c[Yd]||0!==c[Zd]||0!==c[$d])?Xd:c[Yd]<0||c[Yd]>59?Yd:c[Zd]<0||c[Zd]>59?Zd:c[$d]<0||c[$d]>999?$d:-1,l(a)._overflowDayOfYear&&(bWd)&&(b=Wd),l(a)._overflowWeeks&&-1===b&&(b=_d),l(a)._overflowWeekday&&-1===b&&(b=ae),l(a).overflow=b),a}function db(a){var b,c,d,e,f,g,h=a._i,i=ue.exec(h)||ve.exec(h);if(i){for(l(a).iso=!0,b=0,c=xe.length;boa(e)&&(l(a)._overflowDayOfYear=!0),c=sa(e,0,a._dayOfYear),a._a[Vd]=c.getUTCMonth(),a._a[Wd]=c.getUTCDate()),b=0;b<3&&null==a._a[b];++b)a._a[b]=f[b]=d[b];for(;b<7;b++)a._a[b]=f[b]=null==a._a[b]?2===b?1:0:a._a[b];24===a._a[Xd]&&0===a._a[Yd]&&0===a._a[Zd]&&0===a._a[$d]&&(a._nextDay=!0,a._a[Xd]=0),a._d=(a._useUTC?sa:ra).apply(null,f),null!=a._tzm&&a._d.setUTCMinutes(a._d.getUTCMinutes()-a._tzm),a._nextDay&&(a._a[Xd]=24)}}function ib(a){var b,c,d,e,f,g,h,i;if(b=a._w,null!=b.GG||null!=b.W||null!=b.E)f=1,g=4,c=fb(b.GG,a._a[Ud],va(rb(),1,4).year),d=fb(b.W,1),((e=fb(b.E,1))<1||e>7)&&(i=!0);else{f=a._locale._week.dow,g=a._locale._week.doy;var j=va(rb(),f,g);c=fb(b.gg,a._a[Ud],j.year),d=fb(b.w,j.week),null!=b.d?((e=b.d)<0||e>6)&&(i=!0):null!=b.e?(e=b.e+f,(b.e<0||b.e>6)&&(i=!0)):e=f}d<1||d>wa(c,f,g)?l(a)._overflowWeeks=!0:null!=i?l(a)._overflowWeekday=!0:(h=ua(c,d,e,f,g),a._a[Ud]=h.year,a._dayOfYear=h.dayOfYear)}function jb(b){if(b._f===a.ISO_8601)return void db(b);b._a=[],l(b).empty=!0;var c,d,e,f,g,h=""+b._i,i=h.length,j=0;for(e=X(b._f,b._locale).match(Bd)||[],c=0;c0&&l(b).unusedInput.push(g),h=h.slice(h.indexOf(d)+d.length),j+=d.length),Ed[f]?(d?l(b).empty=!1:l(b).unusedTokens.push(f),ca(f,d,b)):b._strict&&!d&&l(b).unusedTokens.push(f);l(b).charsLeftOver=i-j,h.length>0&&l(b).unusedInput.push(h),b._a[Xd]<=12&&!0===l(b).bigHour&&b._a[Xd]>0&&(l(b).bigHour=void 0),l(b).parsedDateParts=b._a.slice(0),l(b).meridiem=b._meridiem,b._a[Xd]=kb(b._locale,b._a[Xd],b._meridiem),hb(b),cb(b)}function kb(a,b,c){var d;return null==c?b:null!=a.meridiemHour?a.meridiemHour(b,c):null!=a.isPM?(d=a.isPM(c),d&&b<12&&(b+=12),d||12!==b||(b=0),b):b}function lb(a){var b,c,d,e,f;if(0===a._f.length)return l(a).invalidFormat=!0,void(a._d=new Date(NaN));for(e=0;ethis.clone().month(0).utcOffset()||this.utcOffset()>this.clone().month(5).utcOffset()}function Jb(){if(!o(this._isDSTShifted))return this._isDSTShifted;var a={};if(p(a,this),a=ob(a),a._a){var b=a._isUTC?j(a._a):rb(a._a);this._isDSTShifted=this.isValid()&&u(a._a,b.toArray())>0}else this._isDSTShifted=!1;return this._isDSTShifted}function Kb(){return!!this.isValid()&&!this._isUTC}function Lb(){return!!this.isValid()&&this._isUTC}function Mb(){return!!this.isValid()&&this._isUTC&&0===this._offset}function Nb(a,b){var c,d,f,g=a,i=null;return wb(a)?g={ms:a._milliseconds,d:a._days,M:a._months}:e(a)?(g={},b?g[b]=a:g.milliseconds=a):(i=Ee.exec(a))?(c="-"===i[1]?-1:1,g={y:0,d:t(i[Wd])*c,h:t(i[Xd])*c,m:t(i[Yd])*c,s:t(i[Zd])*c,ms:t(xb(1e3*i[$d]))*c}):(i=Fe.exec(a))?(c="-"===i[1]?-1:1,g={y:Ob(i[2],c),M:Ob(i[3],c),w:Ob(i[4],c),d:Ob(i[5],c),h:Ob(i[6],c),m:Ob(i[7],c),s:Ob(i[8],c)}):null==g?g={}:"object"==typeof g&&("from"in g||"to"in g)&&(f=Qb(rb(g.from),rb(g.to)),g={},g.ms=f.milliseconds,g.M=f.months),d=new vb(g),wb(a)&&h(a,"_locale")&&(d._locale=a._locale),d}function Ob(a,b){var c=a&&parseFloat(a.replace(",","."));return(isNaN(c)?0:c)*b}function Pb(a,b){var c={milliseconds:0,months:0};return c.months=b.month()-a.month()+12*(b.year()-a.year()),a.clone().add(c.months,"M").isAfter(b)&&--c.months,c.milliseconds=+b-+a.clone().add(c.months,"M"),c}function Qb(a,b){var c;return a.isValid()&&b.isValid()?(b=Ab(b,a),a.isBefore(b)?c=Pb(a,b):(c=Pb(b,a),c.milliseconds=-c.milliseconds,c.months=-c.months),c):{milliseconds:0,months:0}}function Rb(a,b){return function(c,d){var e,f;return null===d||isNaN(+d)||(x(b,"moment()."+b+"(period, number) is deprecated. Please use moment()."+b+"(number, period). See http://momentjs.com/guides/#/warnings/add-inverted-param/ for more info."),f=c,c=d,d=f),c="string"==typeof c?+c:c,e=Nb(c,d),Sb(this,e,a),this}}function Sb(b,c,d,e){var f=c._milliseconds,g=xb(c._days),h=xb(c._months);b.isValid()&&(e=null==e||e,f&&b._d.setTime(b._d.valueOf()+f*d),g&&P(b,"Date",O(b,"Date")+g*d),h&&ia(b,O(b,"Month")+h*d),e&&a.updateOffset(b,g||h))}function Tb(a,b){var c=a.diff(b,"days",!0);return c<-6?"sameElse":c<-1?"lastWeek":c<0?"lastDay":c<1?"sameDay":c<2?"nextDay":c<7?"nextWeek":"sameElse"}function Ub(b,c){var d=b||rb(),e=Ab(d,this).startOf("day"),f=a.calendarFormat(this,e)||"sameElse",g=c&&(y(c[f])?c[f].call(this,d):c[f]);return this.format(g||this.localeData().calendar(f,this,rb(d)))}function Vb(){return new q(this)}function Wb(a,b){var c=r(a)?a:rb(a);return!(!this.isValid()||!c.isValid())&&(b=J(o(b)?"millisecond":b),"millisecond"===b?this.valueOf()>c.valueOf():c.valueOf()f&&(b=f),Ec.call(this,a,b,c,d,e))}function Ec(a,b,c,d,e){var f=ua(a,b,c,d,e),g=sa(f.year,0,f.dayOfYear);return this.year(g.getUTCFullYear()),this.month(g.getUTCMonth()),this.date(g.getUTCDate()),this}function Fc(a){return null==a?Math.ceil((this.month()+1)/3):this.month(3*(a-1)+this.month()%3)}function Gc(a){var b=Math.round((this.clone().startOf("day")-this.clone().startOf("year"))/864e5)+1;return null==a?b:this.add(a-b,"d")}function Hc(a,b){b[$d]=t(1e3*("0."+a))}function Ic(){return this._isUTC?"UTC":""}function Jc(){return this._isUTC?"Coordinated Universal Time":""}function Kc(a){return rb(1e3*a)}function Lc(){return rb.apply(null,arguments).parseZone()}function Mc(a){return a}function Nc(a,b,c,d){var e=ab(),f=j().set(d,b);return e[c](f,a)}function Oc(a,b,c){if(e(a)&&(b=a,a=void 0),a=a||"",null!=b)return Nc(a,b,c,"month");var d,f=[];for(d=0;d<12;d++)f[d]=Nc(a,d,c,"month");return f}function Pc(a,b,c,d){"boolean"==typeof a?(e(b)&&(c=b,b=void 0),b=b||""):(b=a,c=b,a=!1,e(b)&&(c=b,b=void 0),b=b||"");var f=ab(),g=a?f._week.dow:0;if(null!=c)return Nc(b,(c+g)%7,d,"day");var h,i=[];for(h=0;h<7;h++)i[h]=Nc(b,(h+g)%7,d,"day");return i}function Qc(a,b){return Oc(a,b,"months")}function Rc(a,b){return Oc(a,b,"monthsShort")}function Sc(a,b,c){return Pc(a,b,c,"weekdays")}function Tc(a,b,c){return Pc(a,b,c,"weekdaysShort")}function Uc(a,b,c){return Pc(a,b,c,"weekdaysMin")}function Vc(){var a=this._data;return this._milliseconds=Qe(this._milliseconds),this._days=Qe(this._days),this._months=Qe(this._months),a.milliseconds=Qe(a.milliseconds),a.seconds=Qe(a.seconds),a.minutes=Qe(a.minutes),a.hours=Qe(a.hours),a.months=Qe(a.months),a.years=Qe(a.years),this}function Wc(a,b,c,d){var e=Nb(b,c);return a._milliseconds+=d*e._milliseconds,a._days+=d*e._days,a._months+=d*e._months,a._bubble()}function Xc(a,b){return Wc(this,a,b,1)}function Yc(a,b){return Wc(this,a,b,-1)}function Zc(a){return a<0?Math.floor(a):Math.ceil(a)}function $c(){var a,b,c,d,e,f=this._milliseconds,g=this._days,h=this._months,i=this._data;return f>=0&&g>=0&&h>=0||f<=0&&g<=0&&h<=0||(f+=864e5*Zc(ad(h)+g),g=0,h=0),i.milliseconds=f%1e3,a=s(f/1e3),i.seconds=a%60,b=s(a/60),i.minutes=b%60,c=s(b/60),i.hours=c%24,g+=s(c/24),e=s(_c(g)),h+=e,g-=Zc(ad(e)),d=s(h/12),h%=12,i.days=g,i.months=h,i.years=d,this}function _c(a){return 4800*a/146097}function ad(a){return 146097*a/4800}function bd(a){var b,c,d=this._milliseconds;if("month"===(a=J(a))||"year"===a)return b=this._days+d/864e5,c=this._months+_c(b),"month"===a?c:c/12;switch(b=this._days+Math.round(ad(this._months)),a){case"week":return b/7+d/6048e5;case"day":return b+d/864e5;case"hour":return 24*b+d/36e5;case"minute":return 1440*b+d/6e4;case"second":return 86400*b+d/1e3;case"millisecond":return Math.floor(864e5*b)+d;default:throw new Error("Unknown unit "+a)}}function cd(){return this._milliseconds+864e5*this._days+this._months%12*2592e6+31536e6*t(this._months/12)}function dd(a){return function(){return this.as(a)}}function ed(a){return a=J(a),this[a+"s"]()}function fd(a){return function(){return this._data[a]}}function gd(){return s(this.days()/7)}function hd(a,b,c,d,e){return e.relativeTime(b||1,!!c,a,d)}function id(a,b,c){var d=Nb(a).abs(),e=ef(d.as("s")),f=ef(d.as("m")),g=ef(d.as("h")),h=ef(d.as("d")),i=ef(d.as("M")),j=ef(d.as("y")),k=e0,k[4]=c,hd.apply(null,k)}function jd(a){return void 0===a?ef:"function"==typeof a&&(ef=a,!0)}function kd(a,b){return void 0!==ff[a]&&(void 0===b?ff[a]:(ff[a]=b,!0))}function ld(a){var b=this.localeData(),c=id(this,!a,b);return a&&(c=b.pastFuture(+this,c)),b.postformat(c)}function md(){var a,b,c,d=gf(this._milliseconds)/1e3,e=gf(this._days),f=gf(this._months);a=s(d/60),b=s(a/60),d%=60,a%=60,c=s(f/12),f%=12;var g=c,h=f,i=e,j=b,k=a,l=d,m=this.asSeconds();return m?(m<0?"-":"")+"P"+(g?g+"Y":"")+(h?h+"M":"")+(i?i+"D":"")+(j||k||l?"T":"")+(j?j+"H":"")+(k?k+"M":"")+(l?l+"S":""):"P0D"}var nd,od;od=Array.prototype.some?Array.prototype.some:function(a){for(var b=Object(this),c=b.length>>>0,d=0;d68?1900:2e3)};var he=N("FullYear",!0);T("w",["ww",2],"wo","week"),T("W",["WW",2],"Wo","isoWeek"),I("week","w"),I("isoWeek","W"),L("week",5),L("isoWeek",5),Y("w",Id),Y("ww",Id,Fd),Y("W",Id),Y("WW",Id,Fd),ba(["w","ww","W","WW"],function(a,b,c,d){b[d.substr(0,1)]=t(a)});var ie={dow:0,doy:6};T("d",0,"do","day"),T("dd",0,0,function(a){return this.localeData().weekdaysMin(this,a)}),T("ddd",0,0,function(a){return this.localeData().weekdaysShort(this,a)}),T("dddd",0,0,function(a){return this.localeData().weekdays(this,a)}),T("e",0,0,"weekday"),T("E",0,0,"isoWeekday"),I("day","d"),I("weekday","e"),I("isoWeekday","E"),L("day",11),L("weekday",11),L("isoWeekday",11),Y("d",Id),Y("e",Id),Y("E",Id),Y("dd",function(a,b){return b.weekdaysMinRegex(a)}),Y("ddd",function(a,b){return b.weekdaysShortRegex(a)}),Y("dddd",function(a,b){return b.weekdaysRegex(a)}),ba(["dd","ddd","dddd"],function(a,b,c,d){var e=c._locale.weekdaysParse(a,d,c._strict);null!=e?b.d=e:l(c).invalidWeekday=a}),ba(["d","e","E"],function(a,b,c,d){b[d]=t(a)});var je="Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),ke="Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),le="Su_Mo_Tu_We_Th_Fr_Sa".split("_"),me=Rd,ne=Rd,oe=Rd;T("H",["HH",2],0,"hour"),T("h",["hh",2],0,Qa),T("k",["kk",2],0,Ra),T("hmm",0,0,function(){return""+Qa.apply(this)+S(this.minutes(),2)}),T("hmmss",0,0,function(){return""+Qa.apply(this)+S(this.minutes(),2)+S(this.seconds(),2)}),T("Hmm",0,0,function(){return""+this.hours()+S(this.minutes(),2)}),T("Hmmss",0,0,function(){return""+this.hours()+S(this.minutes(),2)+S(this.seconds(),2)}),Sa("a",!0),Sa("A",!1),I("hour","h"),L("hour",13),Y("a",Ta),Y("A",Ta),Y("H",Id),Y("h",Id),Y("HH",Id,Fd),Y("hh",Id,Fd),Y("hmm",Jd),Y("hmmss",Kd),Y("Hmm",Jd),Y("Hmmss",Kd),aa(["H","HH"],Xd),aa(["a","A"],function(a,b,c){c._isPm=c._locale.isPM(a),c._meridiem=a}),aa(["h","hh"],function(a,b,c){b[Xd]=t(a),l(c).bigHour=!0}),aa("hmm",function(a,b,c){var d=a.length-2;b[Xd]=t(a.substr(0,d)),b[Yd]=t(a.substr(d)),l(c).bigHour=!0}),aa("hmmss",function(a,b,c){var d=a.length-4,e=a.length-2;b[Xd]=t(a.substr(0,d)),b[Yd]=t(a.substr(d,2)),b[Zd]=t(a.substr(e)),l(c).bigHour=!0}),aa("Hmm",function(a,b,c){var d=a.length-2;b[Xd]=t(a.substr(0,d)),b[Yd]=t(a.substr(d))}),aa("Hmmss",function(a,b,c){var d=a.length-4,e=a.length-2;b[Xd]=t(a.substr(0,d)),b[Yd]=t(a.substr(d,2)),b[Zd]=t(a.substr(e))});var pe,qe=N("Hours",!0),re={calendar:wd,longDateFormat:xd,invalidDate:"Invalid date",ordinal:"%d",ordinalParse:/\d{1,2}/,relativeTime:yd,months:de,monthsShort:ee,week:ie,weekdays:je,weekdaysMin:le,weekdaysShort:ke,meridiemParse:/[ap]\.?m?\.?/i},se={},te={},ue=/^\s*((?:[+-]\d{6}|\d{4})-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?$/,ve=/^\s*((?:[+-]\d{6}|\d{4})(?:\d\d\d\d|W\d\d\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?:\d\d(?:\d\d(?:[.,]\d+)?)?)?)([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?$/,we=/Z|[+-]\d\d(?::?\d\d)?/,xe=[["YYYYYY-MM-DD",/[+-]\d{6}-\d\d-\d\d/],["YYYY-MM-DD",/\d{4}-\d\d-\d\d/],["GGGG-[W]WW-E",/\d{4}-W\d\d-\d/],["GGGG-[W]WW",/\d{4}-W\d\d/,!1],["YYYY-DDD",/\d{4}-\d{3}/],["YYYY-MM",/\d{4}-\d\d/,!1],["YYYYYYMMDD",/[+-]\d{10}/],["YYYYMMDD",/\d{8}/],["GGGG[W]WWE",/\d{4}W\d{3}/],["GGGG[W]WW",/\d{4}W\d{2}/,!1],["YYYYDDD",/\d{7}/]],ye=[["HH:mm:ss.SSSS",/\d\d:\d\d:\d\d\.\d+/],["HH:mm:ss,SSSS",/\d\d:\d\d:\d\d,\d+/],["HH:mm:ss",/\d\d:\d\d:\d\d/],["HH:mm",/\d\d:\d\d/],["HHmmss.SSSS",/\d\d\d\d\d\d\.\d+/],["HHmmss,SSSS",/\d\d\d\d\d\d,\d+/],["HHmmss",/\d\d\d\d\d\d/],["HHmm",/\d\d\d\d/],["HH",/\d\d/]],ze=/^\/?Date\((\-?\d+)/i;a.createFromInputFallback=w("value provided is not in a recognized ISO format. moment construction falls back to js Date(), which is not reliable across all browsers and versions. Non ISO date formats are discouraged and will be removed in an upcoming major release. Please refer to http://momentjs.com/guides/#/warnings/js-date/ for more info.",function(a){a._d=new Date(a._i+(a._useUTC?" UTC":""))}),a.ISO_8601=function(){};var Ae=w("moment().min is deprecated, use moment.max instead. http://momentjs.com/guides/#/warnings/min-max/",function(){var a=rb.apply(null,arguments);return this.isValid()&&a.isValid()?athis?this:a:n()}),Ce=function(){return Date.now?Date.now():+new Date};yb("Z",":"),yb("ZZ",""),Y("Z",Qd),Y("ZZ",Qd),aa(["Z","ZZ"],function(a,b,c){c._useUTC=!0,c._tzm=zb(Qd,a)});var De=/([\+\-]|\d\d)/gi;a.updateOffset=function(){};var Ee=/^(\-)?(?:(\d*)[. ])?(\d+)\:(\d+)(?:\:(\d+)(\.\d*)?)?$/,Fe=/^(-)?P(?:(-?[0-9,.]*)Y)?(?:(-?[0-9,.]*)M)?(?:(-?[0-9,.]*)W)?(?:(-?[0-9,.]*)D)?(?:T(?:(-?[0-9,.]*)H)?(?:(-?[0-9,.]*)M)?(?:(-?[0-9,.]*)S)?)?$/;Nb.fn=vb.prototype;var Ge=Rb(1,"add"),He=Rb(-1,"subtract");a.defaultFormat="YYYY-MM-DDTHH:mm:ssZ",a.defaultFormatUtc="YYYY-MM-DDTHH:mm:ss[Z]";var Ie=w("moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.",function(a){return void 0===a?this.localeData():this.locale(a)});T(0,["gg",2],0,function(){return this.weekYear()%100}),T(0,["GG",2],0,function(){return this.isoWeekYear()%100}),yc("gggg","weekYear"),yc("ggggg","weekYear"),yc("GGGG","isoWeekYear"),yc("GGGGG","isoWeekYear"),I("weekYear","gg"),I("isoWeekYear","GG"),L("weekYear",1),L("isoWeekYear",1),Y("G",Od),Y("g",Od),Y("GG",Id,Fd),Y("gg",Id,Fd),Y("GGGG",Md,Gd),Y("gggg",Md,Gd),Y("GGGGG",Nd,Hd),Y("ggggg",Nd,Hd),ba(["gggg","ggggg","GGGG","GGGGG"],function(a,b,c,d){b[d.substr(0,2)]=t(a)}),ba(["gg","GG"],function(b,c,d,e){c[e]=a.parseTwoDigitYear(b)}),T("Q",0,"Qo","quarter"),I("quarter","Q"),L("quarter",7),Y("Q",/\d/),aa("Q",function(a,b){b[Vd]=3*(t(a)-1)}),T("D",["DD",2],"Do","date"),I("date","D"),L("date",9),Y("D",Id),Y("DD",Id,Fd),Y("Do",function(a,b){return a?b._ordinalParse:b._ordinalParseLenient}),aa(["D","DD"],Wd),aa("Do",function(a,b){b[Wd]=t(a.match(Id)[0],10)});var Je=N("Date",!0);T("DDD",["DDDD",3],"DDDo","dayOfYear"),I("dayOfYear","DDD"),L("dayOfYear",4),Y("DDD",Ld),Y("DDDD",/\d{3}/),aa(["DDD","DDDD"],function(a,b,c){c._dayOfYear=t(a)}),T("m",["mm",2],0,"minute"),I("minute","m"),L("minute",14),Y("m",Id),Y("mm",Id,Fd),aa(["m","mm"],Yd);var Ke=N("Minutes",!1);T("s",["ss",2],0,"second"),I("second","s"),L("second",15),Y("s",Id),Y("ss",Id,Fd),aa(["s","ss"],Zd);var Le=N("Seconds",!1);T("S",0,0,function(){return~~(this.millisecond()/100)}),T(0,["SS",2],0,function(){return~~(this.millisecond()/10)}),T(0,["SSS",3],0,"millisecond"),T(0,["SSSS",4],0,function(){return 10*this.millisecond()}),T(0,["SSSSS",5],0,function(){return 100*this.millisecond()}),T(0,["SSSSSS",6],0,function(){return 1e3*this.millisecond()}),T(0,["SSSSSSS",7],0,function(){return 1e4*this.millisecond()}),T(0,["SSSSSSSS",8],0,function(){return 1e5*this.millisecond()}),T(0,["SSSSSSSSS",9],0,function(){return 1e6*this.millisecond()}),I("millisecond","ms"),L("millisecond",16),Y("S",Ld,/\d/),Y("SS",Ld,Fd),Y("SSS",Ld,/\d{3}/);var Me;for(Me="SSSS";Me.length<=9;Me+="S")Y(Me,/\d+/);for(Me="S";Me.length<=9;Me+="S")aa(Me,Hc);var Ne=N("Milliseconds",!1);T("z",0,0,"zoneAbbr"),T("zz",0,0,"zoneName");var Oe=q.prototype;Oe.add=Ge,Oe.calendar=Ub,Oe.clone=Vb,Oe.diff=ac,Oe.endOf=nc,Oe.format=fc,Oe.from=gc,Oe.fromNow=hc,Oe.to=ic,Oe.toNow=jc,Oe.get=Q,Oe.invalidAt=wc,Oe.isAfter=Wb,Oe.isBefore=Xb,Oe.isBetween=Yb,Oe.isSame=Zb,Oe.isSameOrAfter=$b,Oe.isSameOrBefore=_b,Oe.isValid=uc,Oe.lang=Ie,Oe.locale=kc,Oe.localeData=lc,Oe.max=Be,Oe.min=Ae,Oe.parsingFlags=vc,Oe.set=R,Oe.startOf=mc,Oe.subtract=He,Oe.toArray=rc,Oe.toObject=sc,Oe.toDate=qc,Oe.toISOString=dc,Oe.inspect=ec,Oe.toJSON=tc,Oe.toString=cc,Oe.unix=pc,Oe.valueOf=oc,Oe.creationData=xc,Oe.year=he,Oe.isLeapYear=qa,Oe.weekYear=zc,Oe.isoWeekYear=Ac,Oe.quarter=Oe.quarters=Fc,Oe.month=ja,Oe.daysInMonth=ka,Oe.week=Oe.weeks=Aa,Oe.isoWeek=Oe.isoWeeks=Ba,Oe.weeksInYear=Cc,Oe.isoWeeksInYear=Bc,Oe.date=Je,Oe.day=Oe.days=Ja,Oe.weekday=Ka,Oe.isoWeekday=La,Oe.dayOfYear=Gc,Oe.hour=Oe.hours=qe,Oe.minute=Oe.minutes=Ke,Oe.second=Oe.seconds=Le,Oe.millisecond=Oe.milliseconds=Ne,Oe.utcOffset=Cb,Oe.utc=Eb,Oe.local=Fb,Oe.parseZone=Gb,Oe.hasAlignedHourOffset=Hb,Oe.isDST=Ib,Oe.isLocal=Kb,Oe.isUtcOffset=Lb,Oe.isUtc=Mb,Oe.isUTC=Mb,Oe.zoneAbbr=Ic,Oe.zoneName=Jc,Oe.dates=w("dates accessor is deprecated. Use date instead.",Je),Oe.months=w("months accessor is deprecated. Use month instead",ja),Oe.years=w("years accessor is deprecated. Use year instead",he),Oe.zone=w("moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/",Db),Oe.isDSTShifted=w("isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information",Jb);var Pe=B.prototype;Pe.calendar=C,Pe.longDateFormat=D,Pe.invalidDate=E,Pe.ordinal=F,Pe.preparse=Mc,Pe.postformat=Mc,Pe.relativeTime=G,Pe.pastFuture=H,Pe.set=z,Pe.months=ea,Pe.monthsShort=fa,Pe.monthsParse=ha,Pe.monthsRegex=ma,Pe.monthsShortRegex=la,Pe.week=xa,Pe.firstDayOfYear=za,Pe.firstDayOfWeek=ya,Pe.weekdays=Ea,Pe.weekdaysMin=Ga,Pe.weekdaysShort=Fa,Pe.weekdaysParse=Ia,Pe.weekdaysRegex=Ma,Pe.weekdaysShortRegex=Na,Pe.weekdaysMinRegex=Oa,Pe.isPM=Ua,Pe.meridiem=Va,Za("en",{ordinalParse:/\d{1,2}(th|st|nd|rd)/,ordinal:function(a){var b=a%10;return a+(1===t(a%100/10)?"th":1===b?"st":2===b?"nd":3===b?"rd":"th")}}),a.lang=w("moment.lang is deprecated. Use moment.locale instead.",Za),a.langData=w("moment.langData is deprecated. Use moment.localeData instead.",ab);var Qe=Math.abs,Re=dd("ms"),Se=dd("s"),Te=dd("m"),Ue=dd("h"),Ve=dd("d"),We=dd("w"),Xe=dd("M"),Ye=dd("y"),Ze=fd("milliseconds"),$e=fd("seconds"),_e=fd("minutes"),af=fd("hours"),bf=fd("days"),cf=fd("months"),df=fd("years"),ef=Math.round,ff={s:45,m:45,h:22,d:26,M:11},gf=Math.abs,hf=vb.prototype;return hf.abs=Vc,hf.add=Xc,hf.subtract=Yc,hf.as=bd,hf.asMilliseconds=Re,hf.asSeconds=Se,hf.asMinutes=Te,hf.asHours=Ue,hf.asDays=Ve,hf.asWeeks=We,hf.asMonths=Xe,hf.asYears=Ye,hf.valueOf=cd,hf._bubble=$c,hf.get=ed,hf.milliseconds=Ze,hf.seconds=$e,hf.minutes=_e,hf.hours=af,hf.days=bf,hf.weeks=gd,hf.months=cf,hf.years=df,hf.humanize=ld,hf.toISOString=md,hf.toString=md,hf.toJSON=md,hf.locale=kc,hf.localeData=lc,hf.toIsoString=w("toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)",md),hf.lang=Ie,T("X",0,0,"unix"),T("x",0,0,"valueOf"),Y("x",Od),Y("X",/[+-]?\d+(\.\d{1,3})?/),aa("X",function(a,b,c){c._d=new Date(1e3*parseFloat(a,10))}),aa("x",function(a,b,c){c._d=new Date(t(a))}),a.version="2.17.1",function(a){nd=a}(rb),a.fn=Oe,a.min=tb,a.max=ub,a.now=Ce,a.utc=j,a.unix=Kc,a.months=Qc,a.isDate=f,a.locale=Za,a.invalid=n,a.duration=Nb,a.isMoment=r,a.weekdays=Sc,a.parseZone=Lc,a.localeData=ab,a.isDuration=wb,a.monthsShort=Rc,a.weekdaysMin=Uc,a.defineLocale=$a,a.updateLocale=_a,a.locales=bb,a.weekdaysShort=Tc,a.normalizeUnits=J,a.relativeTimeRounding=jd,a.relativeTimeThreshold=kd,a.calendarFormat=Tb,a.prototype=Oe,a}); \ No newline at end of file +!function a(b,c,d){function e(g,h){if(!c[g]){if(!b[g]){var i="function"==typeof require&&require;if(!h&&i)return i(g,!0);if(f)return f(g,!0);var j=new Error("Cannot find module '"+g+"'");throw j.code="MODULE_NOT_FOUND",j}var k=c[g]={exports:{}};b[g][0].call(k.exports,function(a){var c=b[g][1][a];return e(c?c:a)},k,k.exports,a,b,c,d)}return c[g].exports}for(var f="function"==typeof require&&require,g=0;g>3]>>c%8*4&15,e="x"==a?d:3&d|8;return e.toString(16)})}var d=(new Date).getTime();window.performance&&"function"==typeof window.performance.now&&(d+=performance.now());var e="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(a){var b=(d+16*Math.random())%16|0;return d=Math.floor(d/16),("x"==a?b:3&b|8).toString(16)});return e}},{key:"strip",value:function(a){var b=document.implementation.createHTMLDocument("New").body;return b.innerHTML=a,b.textContent||b.innerText||""}},{key:"loadXMLString",value:function(a,b){var c;if(window.DOMParser){var d=new DOMParser;c=d.parseFromString(a,"text/"+b)}else c=new ActiveXObject("Microsoft.XMLDOM"),c.async=!1,c.loadXML(a);return c}},{key:"downloadSNData",value:function(a,b){var c=null,d=function(a){var b=new Blob([a],{type:"text/json"});return null!==c&&window.URL.revokeObjectURL(c),c=window.URL.createObjectURL(b)},e=d(JSON.stringify(a,null,2)),f=document.createElement("a");f.setAttribute("download",b),f.href=e,document.body.appendChild(f),f.click(),document.body.removeChild(f)}},{key:"convertENEXDatatoSN",value:function(a){function b(a){return g.filter(function(b){return b.content.title==a})[0]}function c(a){g.push(a)}var d=this.loadXMLString(a,"xml"),e=d.getElementsByTagName("note"),f=[],g=[],h=!0,i=!1,j=void 0;try{for(var k,l=e[Symbol.iterator]();!(h=(k=l.next()).done);h=!0){var m=k.value,n=m.getElementsByTagName("title")[0].childNodes[0].nodeValue,o=m.getElementsByTagName("created")[0].childNodes[0].nodeValue,p=m.getElementsByTagName("updated"),q=p.length?p[0].childNodes[0].nodeValue:null,r=m.getElementsByTagName("content")[0].childNodes[0].nodeValue,s=this.loadXMLString(r,"html"),t=s.getElementsByTagName("en-note")[0].innerHTML;t=t.replace(/]*>/g,"\n\n");var u=this.strip(t),v={created_at:moment(o).toDate(),updated_at:q?moment(q).toDate():null,uuid:this.generateUUID(),content_type:"Note",content:{title:n,text:u,references:[]}},w=m.getElementsByTagName("tag"),x=!0,y=!1,z=void 0;try{for(var A,B=w[Symbol.iterator]();!(x=(A=B.next()).done);x=!0){var C=A.value,D=C.childNodes[0].nodeValue,E=b(D);E||(E={uuid:this.generateUUID(),content_type:"Tag",created_at:new Date,updated_at:new Date,content:{title:D,references:[]}},c(E)),v.content.references.push({content_type:E.content_type,uuid:E.uuid}),E.content.references.push({content_type:v.content_type,uuid:v.uuid})}}catch(a){y=!0,z=a}finally{try{!x&&B.return&&B.return()}finally{if(y)throw z}}f.push(v)}}catch(a){i=!0,j=a}finally{try{!h&&l.return&&l.return()}finally{if(i)throw j}}var F={items:f.concat(g)};return F}},{key:"convertPlaintextFiles",value:function(a,b){var c=0,d=[],e=function(){var f=a[c];c++;var g=new FileReader;g.onload=function(g){var h=g.target.result,i={created_at:new Date,updated_at:new Date,uuid:this.generateUUID(),content_type:"Note",content:{title:f.name.split(".")[0],text:h,references:[]}};d.push(i),c0)for(c in rd)d=rd[c],e=b[d],p(e)||(a[d]=e);return a}function r(b){q(this,b),this._d=new Date(null!=b._d?b._d.getTime():NaN),this.isValid()||(this._d=new Date(NaN)),sd===!1&&(sd=!0,a.updateOffset(this),sd=!1)}function s(a){return a instanceof r||null!=a&&null!=a._isAMomentObject}function t(a){return a<0?Math.ceil(a)||0:Math.floor(a)}function u(a){var b=+a,c=0;return 0!==b&&isFinite(b)&&(c=t(b)),c}function v(a,b,c){var d,e=Math.min(a.length,b.length),f=Math.abs(a.length-b.length),g=0;for(d=0;d0?"future":"past"];return z(c)?c(b):c.replace(/%s/i,b)}function J(a,b){var c=a.toLowerCase();Dd[c]=Dd[c+"s"]=Dd[b]=a}function K(a){return"string"==typeof a?Dd[a]||Dd[a.toLowerCase()]:void 0}function L(a){var b,c,d={};for(c in a)i(a,c)&&(b=K(c),b&&(d[b]=a[c]));return d}function M(a,b){Ed[a]=b}function N(a){var b=[];for(var c in a)b.push({unit:c,priority:Ed[c]});return b.sort(function(a,b){return a.priority-b.priority}),b}function O(b,c){return function(d){return null!=d?(Q(this,b,d),a.updateOffset(this,c),this):P(this,b)}}function P(a,b){return a.isValid()?a._d["get"+(a._isUTC?"UTC":"")+b]():NaN}function Q(a,b,c){a.isValid()&&a._d["set"+(a._isUTC?"UTC":"")+b](c)}function R(a){return a=K(a),z(this[a])?this[a]():this}function S(a,b){if("object"==typeof a){a=L(a);for(var c=N(a),d=0;d=0;return(f?c?"+":"":"-")+Math.pow(10,Math.max(0,e)).toString().substr(1)+d}function U(a,b,c,d){var e=d;"string"==typeof d&&(e=function(){return this[d]()}),a&&(Id[a]=e),b&&(Id[b[0]]=function(){return T(e.apply(this,arguments),b[1],b[2])}),c&&(Id[c]=function(){return this.localeData().ordinal(e.apply(this,arguments),a)})}function V(a){return a.match(/\[[\s\S]/)?a.replace(/^\[|\]$/g,""):a.replace(/\\/g,"")}function W(a){var b,c,d=a.match(Fd);for(b=0,c=d.length;b=0&&Gd.test(a);)a=a.replace(Gd,c),Gd.lastIndex=0,d-=1;return a}function Z(a,b,c){$d[a]=z(b)?b:function(a,d){return a&&c?c:b}}function $(a,b){return i($d,a)?$d[a](b._strict,b._locale):new RegExp(_(a))}function _(a){return aa(a.replace("\\","").replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g,function(a,b,c,d,e){return b||c||d||e}))}function aa(a){return a.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}function ba(a,b){var c,d=b;for("string"==typeof a&&(a=[a]),f(b)&&(d=function(a,c){c[b]=u(a)}),c=0;c=0&&isFinite(h.getFullYear())&&h.setFullYear(a),h}function ta(a){var b=new Date(Date.UTC.apply(null,arguments));return a<100&&a>=0&&isFinite(b.getUTCFullYear())&&b.setUTCFullYear(a),b}function ua(a,b,c){var d=7+b-c,e=(7+ta(a,0,d).getUTCDay()-b)%7;return-e+d-1}function va(a,b,c,d,e){var f,g,h=(7+c-d)%7,i=ua(a,d,e),j=1+7*(b-1)+h+i;return j<=0?(f=a-1,g=pa(f)+j):j>pa(a)?(f=a+1,g=j-pa(a)):(f=a,g=j),{year:f,dayOfYear:g}}function wa(a,b,c){var d,e,f=ua(a.year(),b,c),g=Math.floor((a.dayOfYear()-f-1)/7)+1;return g<1?(e=a.year()-1,d=g+xa(e,b,c)):g>xa(a.year(),b,c)?(d=g-xa(a.year(),b,c),e=a.year()+1):(e=a.year(),d=g),{week:d,year:e}}function xa(a,b,c){var d=ua(a,b,c),e=ua(a+1,b,c);return(pa(a)-d+e)/7}function ya(a){return wa(a,this._week.dow,this._week.doy).week}function za(){return this._week.dow}function Aa(){return this._week.doy}function Ba(a){var b=this.localeData().week(this);return null==a?b:this.add(7*(a-b),"d")}function Ca(a){var b=wa(this,1,4).week;return null==a?b:this.add(7*(a-b),"d")}function Da(a,b){return"string"!=typeof a?a:isNaN(a)?(a=b.weekdaysParse(a),"number"==typeof a?a:null):parseInt(a,10)}function Ea(a,b){return"string"==typeof a?b.weekdaysParse(a)%7||7:isNaN(a)?null:a}function Fa(a,b){return a?c(this._weekdays)?this._weekdays[a.day()]:this._weekdays[this._weekdays.isFormat.test(b)?"format":"standalone"][a.day()]:this._weekdays}function Ga(a){return a?this._weekdaysShort[a.day()]:this._weekdaysShort}function Ha(a){return a?this._weekdaysMin[a.day()]:this._weekdaysMin}function Ia(a,b,c){var d,e,f,g=a.toLocaleLowerCase();if(!this._weekdaysParse)for(this._weekdaysParse=[],this._shortWeekdaysParse=[],this._minWeekdaysParse=[],d=0;d<7;++d)f=k([2e3,1]).day(d),this._minWeekdaysParse[d]=this.weekdaysMin(f,"").toLocaleLowerCase(),this._shortWeekdaysParse[d]=this.weekdaysShort(f,"").toLocaleLowerCase(),this._weekdaysParse[d]=this.weekdays(f,"").toLocaleLowerCase();return c?"dddd"===b?(e=je.call(this._weekdaysParse,g),e!==-1?e:null):"ddd"===b?(e=je.call(this._shortWeekdaysParse,g),e!==-1?e:null):(e=je.call(this._minWeekdaysParse,g),e!==-1?e:null):"dddd"===b?(e=je.call(this._weekdaysParse,g),e!==-1?e:(e=je.call(this._shortWeekdaysParse,g),e!==-1?e:(e=je.call(this._minWeekdaysParse,g),e!==-1?e:null))):"ddd"===b?(e=je.call(this._shortWeekdaysParse,g),e!==-1?e:(e=je.call(this._weekdaysParse,g),e!==-1?e:(e=je.call(this._minWeekdaysParse,g),e!==-1?e:null))):(e=je.call(this._minWeekdaysParse,g),e!==-1?e:(e=je.call(this._weekdaysParse,g),e!==-1?e:(e=je.call(this._shortWeekdaysParse,g),e!==-1?e:null)))}function Ja(a,b,c){var d,e,f;if(this._weekdaysParseExact)return Ia.call(this,a,b,c);for(this._weekdaysParse||(this._weekdaysParse=[],this._minWeekdaysParse=[],this._shortWeekdaysParse=[],this._fullWeekdaysParse=[]),d=0;d<7;d++){if(e=k([2e3,1]).day(d),c&&!this._fullWeekdaysParse[d]&&(this._fullWeekdaysParse[d]=new RegExp("^"+this.weekdays(e,"").replace(".",".?")+"$","i"),this._shortWeekdaysParse[d]=new RegExp("^"+this.weekdaysShort(e,"").replace(".",".?")+"$","i"),this._minWeekdaysParse[d]=new RegExp("^"+this.weekdaysMin(e,"").replace(".",".?")+"$","i")),this._weekdaysParse[d]||(f="^"+this.weekdays(e,"")+"|^"+this.weekdaysShort(e,"")+"|^"+this.weekdaysMin(e,""),this._weekdaysParse[d]=new RegExp(f.replace(".",""),"i")),c&&"dddd"===b&&this._fullWeekdaysParse[d].test(a))return d;if(c&&"ddd"===b&&this._shortWeekdaysParse[d].test(a))return d;if(c&&"dd"===b&&this._minWeekdaysParse[d].test(a))return d;if(!c&&this._weekdaysParse[d].test(a))return d}}function Ka(a){if(!this.isValid())return null!=a?this:NaN;var b=this._isUTC?this._d.getUTCDay():this._d.getDay();return null!=a?(a=Da(a,this.localeData()),this.add(a-b,"d")):b}function La(a){if(!this.isValid())return null!=a?this:NaN;var b=(this.day()+7-this.localeData()._week.dow)%7;return null==a?b:this.add(a-b,"d")}function Ma(a){if(!this.isValid())return null!=a?this:NaN;if(null!=a){var b=Ea(a,this.localeData());return this.day(this.day()%7?b:b-7)}return this.day()||7}function Na(a){return this._weekdaysParseExact?(i(this,"_weekdaysRegex")||Qa.call(this),a?this._weekdaysStrictRegex:this._weekdaysRegex):(i(this,"_weekdaysRegex")||(this._weekdaysRegex=ue),this._weekdaysStrictRegex&&a?this._weekdaysStrictRegex:this._weekdaysRegex)}function Oa(a){return this._weekdaysParseExact?(i(this,"_weekdaysRegex")||Qa.call(this),a?this._weekdaysShortStrictRegex:this._weekdaysShortRegex):(i(this,"_weekdaysShortRegex")||(this._weekdaysShortRegex=ve),this._weekdaysShortStrictRegex&&a?this._weekdaysShortStrictRegex:this._weekdaysShortRegex)}function Pa(a){return this._weekdaysParseExact?(i(this,"_weekdaysRegex")||Qa.call(this),a?this._weekdaysMinStrictRegex:this._weekdaysMinRegex):(i(this,"_weekdaysMinRegex")||(this._weekdaysMinRegex=we),this._weekdaysMinStrictRegex&&a?this._weekdaysMinStrictRegex:this._weekdaysMinRegex)}function Qa(){function a(a,b){return b.length-a.length}var b,c,d,e,f,g=[],h=[],i=[],j=[];for(b=0;b<7;b++)c=k([2e3,1]).day(b),d=this.weekdaysMin(c,""),e=this.weekdaysShort(c,""),f=this.weekdays(c,""),g.push(d),h.push(e),i.push(f),j.push(d),j.push(e),j.push(f);for(g.sort(a),h.sort(a),i.sort(a),j.sort(a),b=0;b<7;b++)h[b]=aa(h[b]),i[b]=aa(i[b]),j[b]=aa(j[b]);this._weekdaysRegex=new RegExp("^("+j.join("|")+")","i"),this._weekdaysShortRegex=this._weekdaysRegex,this._weekdaysMinRegex=this._weekdaysRegex,this._weekdaysStrictRegex=new RegExp("^("+i.join("|")+")","i"),this._weekdaysShortStrictRegex=new RegExp("^("+h.join("|")+")","i"),this._weekdaysMinStrictRegex=new RegExp("^("+g.join("|")+")","i")}function Ra(){return this.hours()%12||12}function Sa(){return this.hours()||24}function Ta(a,b){U(a,0,0,function(){return this.localeData().meridiem(this.hours(),this.minutes(),b)})}function Ua(a,b){return b._meridiemParse}function Va(a){return"p"===(a+"").toLowerCase().charAt(0)}function Wa(a,b,c){return a>11?c?"pm":"PM":c?"am":"AM"}function Xa(a){return a?a.toLowerCase().replace("_","-"):a}function Ya(a){for(var b,c,d,e,f=0;f0;){if(d=Za(e.slice(0,b).join("-")))return d;if(c&&c.length>=b&&v(e,c,!0)>=b-1)break;b--}f++}return null}function Za(a){var b=null;if(!Be[a]&&"undefined"!=typeof module&&module&&module.exports)try{b=xe._abbr,require("./locale/"+a),$a(b)}catch(a){}return Be[a]}function $a(a,b){var c;return a&&(c=p(b)?bb(a):_a(a,b),c&&(xe=c)),xe._abbr}function _a(a,b){if(null!==b){var c=Ae;if(b.abbr=a,null!=Be[a])y("defineLocaleOverride","use moment.updateLocale(localeName, config) to change an existing locale. moment.defineLocale(localeName, config) should only be used for creating a new locale See http://momentjs.com/guides/#/warnings/define-locale/ for more info."),c=Be[a]._config;else if(null!=b.parentLocale){if(null==Be[b.parentLocale])return Ce[b.parentLocale]||(Ce[b.parentLocale]=[]),Ce[b.parentLocale].push({name:a,config:b}),null;c=Be[b.parentLocale]._config}return Be[a]=new C(B(c,b)),Ce[a]&&Ce[a].forEach(function(a){_a(a.name,a.config)}),$a(a),Be[a]}return delete Be[a],null}function ab(a,b){if(null!=b){var c,d=Ae;null!=Be[a]&&(d=Be[a]._config),b=B(d,b),c=new C(b),c.parentLocale=Be[a],Be[a]=c,$a(a)}else null!=Be[a]&&(null!=Be[a].parentLocale?Be[a]=Be[a].parentLocale:null!=Be[a]&&delete Be[a]);return Be[a]}function bb(a){var b;if(a&&a._locale&&a._locale._abbr&&(a=a._locale._abbr),!a)return xe;if(!c(a)){if(b=Za(a))return b;a=[a]}return Ya(a)}function cb(){return wd(Be)}function db(a){var b,c=a._a;return c&&m(a).overflow===-2&&(b=c[be]<0||c[be]>11?be:c[ce]<1||c[ce]>ea(c[ae],c[be])?ce:c[de]<0||c[de]>24||24===c[de]&&(0!==c[ee]||0!==c[fe]||0!==c[ge])?de:c[ee]<0||c[ee]>59?ee:c[fe]<0||c[fe]>59?fe:c[ge]<0||c[ge]>999?ge:-1,m(a)._overflowDayOfYear&&(bce)&&(b=ce),m(a)._overflowWeeks&&b===-1&&(b=he),m(a)._overflowWeekday&&b===-1&&(b=ie),m(a).overflow=b),a}function eb(a){var b,c,d,e,f,g,h=a._i,i=De.exec(h)||Ee.exec(h);if(i){for(m(a).iso=!0,b=0,c=Ge.length;bpa(e)&&(m(a)._overflowDayOfYear=!0),c=ta(e,0,a._dayOfYear),a._a[be]=c.getUTCMonth(),a._a[ce]=c.getUTCDate()),b=0;b<3&&null==a._a[b];++b)a._a[b]=f[b]=d[b];for(;b<7;b++)a._a[b]=f[b]=null==a._a[b]?2===b?1:0:a._a[b];24===a._a[de]&&0===a._a[ee]&&0===a._a[fe]&&0===a._a[ge]&&(a._nextDay=!0,a._a[de]=0),a._d=(a._useUTC?ta:sa).apply(null,f),null!=a._tzm&&a._d.setUTCMinutes(a._d.getUTCMinutes()-a._tzm),a._nextDay&&(a._a[de]=24)}}function jb(a){var b,c,d,e,f,g,h,i;if(b=a._w,null!=b.GG||null!=b.W||null!=b.E)f=1,g=4,c=gb(b.GG,a._a[ae],wa(sb(),1,4).year),d=gb(b.W,1),e=gb(b.E,1),(e<1||e>7)&&(i=!0);else{f=a._locale._week.dow,g=a._locale._week.doy;var j=wa(sb(),f,g);c=gb(b.gg,a._a[ae],j.year),d=gb(b.w,j.week),null!=b.d?(e=b.d,(e<0||e>6)&&(i=!0)):null!=b.e?(e=b.e+f,(b.e<0||b.e>6)&&(i=!0)):e=f}d<1||d>xa(c,f,g)?m(a)._overflowWeeks=!0:null!=i?m(a)._overflowWeekday=!0:(h=va(c,d,e,f,g),a._a[ae]=h.year,a._dayOfYear=h.dayOfYear)}function kb(b){if(b._f===a.ISO_8601)return void eb(b);b._a=[],m(b).empty=!0;var c,d,e,f,g,h=""+b._i,i=h.length,j=0;for(e=Y(b._f,b._locale).match(Fd)||[],c=0;c0&&m(b).unusedInput.push(g),h=h.slice(h.indexOf(d)+d.length),j+=d.length),Id[f]?(d?m(b).empty=!1:m(b).unusedTokens.push(f),da(f,d,b)):b._strict&&!d&&m(b).unusedTokens.push(f);m(b).charsLeftOver=i-j,h.length>0&&m(b).unusedInput.push(h),b._a[de]<=12&&m(b).bigHour===!0&&b._a[de]>0&&(m(b).bigHour=void 0),m(b).parsedDateParts=b._a.slice(0),m(b).meridiem=b._meridiem,b._a[de]=lb(b._locale,b._a[de],b._meridiem),ib(b),db(b)}function lb(a,b,c){var d;return null==c?b:null!=a.meridiemHour?a.meridiemHour(b,c):null!=a.isPM?(d=a.isPM(c),d&&b<12&&(b+=12),d||12!==b||(b=0),b):b}function mb(a){var b,c,d,e,f;if(0===a._f.length)return m(a).invalidFormat=!0,void(a._d=new Date(NaN));for(e=0;ethis.clone().month(0).utcOffset()||this.utcOffset()>this.clone().month(5).utcOffset()}function Kb(){if(!p(this._isDSTShifted))return this._isDSTShifted;var a={};if(q(a,this),a=pb(a),a._a){var b=a._isUTC?k(a._a):sb(a._a);this._isDSTShifted=this.isValid()&&v(a._a,b.toArray())>0}else this._isDSTShifted=!1;return this._isDSTShifted}function Lb(){return!!this.isValid()&&!this._isUTC}function Mb(){return!!this.isValid()&&this._isUTC}function Nb(){return!!this.isValid()&&this._isUTC&&0===this._offset}function Ob(a,b){var c,d,e,g=a,h=null;return xb(a)?g={ms:a._milliseconds,d:a._days,M:a._months}:f(a)?(g={},b?g[b]=a:g.milliseconds=a):(h=Ne.exec(a))?(c="-"===h[1]?-1:1,g={y:0,d:u(h[ce])*c,h:u(h[de])*c,m:u(h[ee])*c,s:u(h[fe])*c,ms:u(yb(1e3*h[ge]))*c}):(h=Oe.exec(a))?(c="-"===h[1]?-1:1,g={y:Pb(h[2],c),M:Pb(h[3],c),w:Pb(h[4],c),d:Pb(h[5],c),h:Pb(h[6],c),m:Pb(h[7],c),s:Pb(h[8],c)}):null==g?g={}:"object"==typeof g&&("from"in g||"to"in g)&&(e=Rb(sb(g.from),sb(g.to)),g={},g.ms=e.milliseconds,g.M=e.months),d=new wb(g),xb(a)&&i(a,"_locale")&&(d._locale=a._locale),d}function Pb(a,b){var c=a&&parseFloat(a.replace(",","."));return(isNaN(c)?0:c)*b}function Qb(a,b){var c={milliseconds:0,months:0};return c.months=b.month()-a.month()+12*(b.year()-a.year()),a.clone().add(c.months,"M").isAfter(b)&&--c.months,c.milliseconds=+b-+a.clone().add(c.months,"M"),c}function Rb(a,b){var c;return a.isValid()&&b.isValid()?(b=Bb(b,a),a.isBefore(b)?c=Qb(a,b):(c=Qb(b,a),c.milliseconds=-c.milliseconds,c.months=-c.months),c):{milliseconds:0,months:0}}function Sb(a,b){return function(c,d){var e,f;return null===d||isNaN(+d)||(y(b,"moment()."+b+"(period, number) is deprecated. Please use moment()."+b+"(number, period). See http://momentjs.com/guides/#/warnings/add-inverted-param/ for more info."),f=c,c=d,d=f),c="string"==typeof c?+c:c,e=Ob(c,d),Tb(this,e,a),this}}function Tb(b,c,d,e){var f=c._milliseconds,g=yb(c._days),h=yb(c._months);b.isValid()&&(e=null==e||e,f&&b._d.setTime(b._d.valueOf()+f*d),g&&Q(b,"Date",P(b,"Date")+g*d),h&&ja(b,P(b,"Month")+h*d),e&&a.updateOffset(b,g||h))}function Ub(a,b){var c=a.diff(b,"days",!0);return c<-6?"sameElse":c<-1?"lastWeek":c<0?"lastDay":c<1?"sameDay":c<2?"nextDay":c<7?"nextWeek":"sameElse"}function Vb(b,c){var d=b||sb(),e=Bb(d,this).startOf("day"),f=a.calendarFormat(this,e)||"sameElse",g=c&&(z(c[f])?c[f].call(this,d):c[f]);return this.format(g||this.localeData().calendar(f,this,sb(d)))}function Wb(){return new r(this)}function Xb(a,b){var c=s(a)?a:sb(a);return!(!this.isValid()||!c.isValid())&&(b=K(p(b)?"millisecond":b),"millisecond"===b?this.valueOf()>c.valueOf():c.valueOf()f&&(b=f),Fc.call(this,a,b,c,d,e))}function Fc(a,b,c,d,e){var f=va(a,b,c,d,e),g=ta(f.year,0,f.dayOfYear);return this.year(g.getUTCFullYear()),this.month(g.getUTCMonth()),this.date(g.getUTCDate()),this}function Gc(a){return null==a?Math.ceil((this.month()+1)/3):this.month(3*(a-1)+this.month()%3)}function Hc(a){var b=Math.round((this.clone().startOf("day")-this.clone().startOf("year"))/864e5)+1;return null==a?b:this.add(a-b,"d")}function Ic(a,b){b[ge]=u(1e3*("0."+a))}function Jc(){return this._isUTC?"UTC":""}function Kc(){return this._isUTC?"Coordinated Universal Time":""}function Lc(a){return sb(1e3*a)}function Mc(){return sb.apply(null,arguments).parseZone()}function Nc(a){return a}function Oc(a,b,c,d){var e=bb(),f=k().set(d,b);return e[c](f,a)}function Pc(a,b,c){if(f(a)&&(b=a,a=void 0),a=a||"",null!=b)return Oc(a,b,c,"month");var d,e=[];for(d=0;d<12;d++)e[d]=Oc(a,d,c,"month");return e}function Qc(a,b,c,d){"boolean"==typeof a?(f(b)&&(c=b,b=void 0),b=b||""):(b=a,c=b,a=!1,f(b)&&(c=b,b=void 0),b=b||"");var e=bb(),g=a?e._week.dow:0;if(null!=c)return Oc(b,(c+g)%7,d,"day");var h,i=[];for(h=0;h<7;h++)i[h]=Oc(b,(h+g)%7,d,"day");return i}function Rc(a,b){return Pc(a,b,"months")}function Sc(a,b){return Pc(a,b,"monthsShort")}function Tc(a,b,c){return Qc(a,b,c,"weekdays")}function Uc(a,b,c){return Qc(a,b,c,"weekdaysShort")}function Vc(a,b,c){return Qc(a,b,c,"weekdaysMin")}function Wc(){var a=this._data;return this._milliseconds=Ze(this._milliseconds),this._days=Ze(this._days),this._months=Ze(this._months),a.milliseconds=Ze(a.milliseconds),a.seconds=Ze(a.seconds),a.minutes=Ze(a.minutes),a.hours=Ze(a.hours),a.months=Ze(a.months),a.years=Ze(a.years),this}function Xc(a,b,c,d){var e=Ob(b,c);return a._milliseconds+=d*e._milliseconds,a._days+=d*e._days,a._months+=d*e._months,a._bubble()}function Yc(a,b){return Xc(this,a,b,1)}function Zc(a,b){return Xc(this,a,b,-1)}function $c(a){return a<0?Math.floor(a):Math.ceil(a)}function _c(){var a,b,c,d,e,f=this._milliseconds,g=this._days,h=this._months,i=this._data;return f>=0&&g>=0&&h>=0||f<=0&&g<=0&&h<=0||(f+=864e5*$c(bd(h)+g),g=0,h=0),i.milliseconds=f%1e3,a=t(f/1e3),i.seconds=a%60,b=t(a/60),i.minutes=b%60,c=t(b/60),i.hours=c%24,g+=t(c/24),e=t(ad(g)),h+=e,g-=$c(bd(e)),d=t(h/12),h%=12,i.days=g,i.months=h,i.years=d,this}function ad(a){return 4800*a/146097}function bd(a){return 146097*a/4800}function cd(a){var b,c,d=this._milliseconds;if(a=K(a),"month"===a||"year"===a)return b=this._days+d/864e5,c=this._months+ad(b),"month"===a?c:c/12;switch(b=this._days+Math.round(bd(this._months)),a){case"week":return b/7+d/6048e5;case"day":return b+d/864e5;case"hour":return 24*b+d/36e5;case"minute":return 1440*b+d/6e4;case"second":return 86400*b+d/1e3;case"millisecond":return Math.floor(864e5*b)+d;default:throw new Error("Unknown unit "+a)}}function dd(){return this._milliseconds+864e5*this._days+this._months%12*2592e6+31536e6*u(this._months/12)}function ed(a){return function(){return this.as(a)}}function fd(a){return a=K(a),this[a+"s"]()}function gd(a){return function(){return this._data[a]}}function hd(){return t(this.days()/7)}function id(a,b,c,d,e){return e.relativeTime(b||1,!!c,a,d)}function jd(a,b,c){var d=Ob(a).abs(),e=of(d.as("s")),f=of(d.as("m")),g=of(d.as("h")),h=of(d.as("d")),i=of(d.as("M")),j=of(d.as("y")),k=e0,k[4]=c,id.apply(null,k)}function kd(a){return void 0===a?of:"function"==typeof a&&(of=a,!0)}function ld(a,b){return void 0!==pf[a]&&(void 0===b?pf[a]:(pf[a]=b,!0))}function md(a){var b=this.localeData(),c=jd(this,!a,b);return a&&(c=b.pastFuture(+this,c)),b.postformat(c)}function nd(){var a,b,c,d=qf(this._milliseconds)/1e3,e=qf(this._days),f=qf(this._months);a=t(d/60),b=t(a/60),d%=60,a%=60,c=t(f/12),f%=12;var g=c,h=f,i=e,j=b,k=a,l=d,m=this.asSeconds();return m?(m<0?"-":"")+"P"+(g?g+"Y":"")+(h?h+"M":"")+(i?i+"D":"")+(j||k||l?"T":"")+(j?j+"H":"")+(k?k+"M":"")+(l?l+"S":""):"P0D"}var od,pd;pd=Array.prototype.some?Array.prototype.some:function(a){for(var b=Object(this),c=b.length>>>0,d=0;d68?1900:2e3)};var pe=O("FullYear",!0);U("w",["ww",2],"wo","week"),U("W",["WW",2],"Wo","isoWeek"),J("week","w"),J("isoWeek","W"),M("week",5),M("isoWeek",5),Z("w",Od),Z("ww",Od,Kd),Z("W",Od),Z("WW",Od,Kd),ca(["w","ww","W","WW"],function(a,b,c,d){b[d.substr(0,1)]=u(a)});var qe={dow:0,doy:6};U("d",0,"do","day"),U("dd",0,0,function(a){return this.localeData().weekdaysMin(this,a)}),U("ddd",0,0,function(a){return this.localeData().weekdaysShort(this,a)}),U("dddd",0,0,function(a){return this.localeData().weekdays(this,a)}),U("e",0,0,"weekday"),U("E",0,0,"isoWeekday"),J("day","d"),J("weekday","e"),J("isoWeekday","E"),M("day",11),M("weekday",11),M("isoWeekday",11),Z("d",Od),Z("e",Od),Z("E",Od),Z("dd",function(a,b){return b.weekdaysMinRegex(a)}),Z("ddd",function(a,b){return b.weekdaysShortRegex(a)}),Z("dddd",function(a,b){return b.weekdaysRegex(a)}),ca(["dd","ddd","dddd"],function(a,b,c,d){var e=c._locale.weekdaysParse(a,d,c._strict);null!=e?b.d=e:m(c).invalidWeekday=a}),ca(["d","e","E"],function(a,b,c,d){b[d]=u(a)});var re="Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),se="Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),te="Su_Mo_Tu_We_Th_Fr_Sa".split("_"),ue=Zd,ve=Zd,we=Zd;U("H",["HH",2],0,"hour"),U("h",["hh",2],0,Ra),U("k",["kk",2],0,Sa),U("hmm",0,0,function(){return""+Ra.apply(this)+T(this.minutes(),2)}),U("hmmss",0,0,function(){return""+Ra.apply(this)+T(this.minutes(),2)+T(this.seconds(),2)}),U("Hmm",0,0,function(){return""+this.hours()+T(this.minutes(),2)}),U("Hmmss",0,0,function(){return""+this.hours()+T(this.minutes(),2)+T(this.seconds(),2)}),Ta("a",!0),Ta("A",!1),J("hour","h"),M("hour",13),Z("a",Ua),Z("A",Ua),Z("H",Od),Z("h",Od),Z("HH",Od,Kd),Z("hh",Od,Kd),Z("hmm",Pd),Z("hmmss",Qd),Z("Hmm",Pd),Z("Hmmss",Qd),ba(["H","HH"],de),ba(["a","A"],function(a,b,c){c._isPm=c._locale.isPM(a),c._meridiem=a}),ba(["h","hh"],function(a,b,c){b[de]=u(a),m(c).bigHour=!0}),ba("hmm",function(a,b,c){var d=a.length-2;b[de]=u(a.substr(0,d)),b[ee]=u(a.substr(d)),m(c).bigHour=!0}),ba("hmmss",function(a,b,c){var d=a.length-4,e=a.length-2;b[de]=u(a.substr(0,d)),b[ee]=u(a.substr(d,2)),b[fe]=u(a.substr(e)),m(c).bigHour=!0}),ba("Hmm",function(a,b,c){var d=a.length-2;b[de]=u(a.substr(0,d)),b[ee]=u(a.substr(d))}),ba("Hmmss",function(a,b,c){var d=a.length-4,e=a.length-2;b[de]=u(a.substr(0,d)),b[ee]=u(a.substr(d,2)),b[fe]=u(a.substr(e))});var xe,ye=/[ap]\.?m?\.?/i,ze=O("Hours",!0),Ae={calendar:xd,longDateFormat:yd,invalidDate:zd,ordinal:Ad,ordinalParse:Bd,relativeTime:Cd,months:le,monthsShort:me,week:qe,weekdays:re,weekdaysMin:te,weekdaysShort:se,meridiemParse:ye},Be={},Ce={},De=/^\s*((?:[+-]\d{6}|\d{4})-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?$/,Ee=/^\s*((?:[+-]\d{6}|\d{4})(?:\d\d\d\d|W\d\d\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?:\d\d(?:\d\d(?:[.,]\d+)?)?)?)([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?$/,Fe=/Z|[+-]\d\d(?::?\d\d)?/,Ge=[["YYYYYY-MM-DD",/[+-]\d{6}-\d\d-\d\d/],["YYYY-MM-DD",/\d{4}-\d\d-\d\d/],["GGGG-[W]WW-E",/\d{4}-W\d\d-\d/],["GGGG-[W]WW",/\d{4}-W\d\d/,!1],["YYYY-DDD",/\d{4}-\d{3}/],["YYYY-MM",/\d{4}-\d\d/,!1],["YYYYYYMMDD",/[+-]\d{10}/],["YYYYMMDD",/\d{8}/],["GGGG[W]WWE",/\d{4}W\d{3}/],["GGGG[W]WW",/\d{4}W\d{2}/,!1],["YYYYDDD",/\d{7}/]],He=[["HH:mm:ss.SSSS",/\d\d:\d\d:\d\d\.\d+/],["HH:mm:ss,SSSS",/\d\d:\d\d:\d\d,\d+/],["HH:mm:ss",/\d\d:\d\d:\d\d/],["HH:mm",/\d\d:\d\d/],["HHmmss.SSSS",/\d\d\d\d\d\d\.\d+/],["HHmmss,SSSS",/\d\d\d\d\d\d,\d+/],["HHmmss",/\d\d\d\d\d\d/],["HHmm",/\d\d\d\d/],["HH",/\d\d/]],Ie=/^\/?Date\((\-?\d+)/i;a.createFromInputFallback=x("value provided is not in a recognized ISO format. moment construction falls back to js Date(), which is not reliable across all browsers and versions. Non ISO date formats are discouraged and will be removed in an upcoming major release. Please refer to http://momentjs.com/guides/#/warnings/js-date/ for more info.",function(a){a._d=new Date(a._i+(a._useUTC?" UTC":""))}),a.ISO_8601=function(){};var Je=x("moment().min is deprecated, use moment.max instead. http://momentjs.com/guides/#/warnings/min-max/",function(){var a=sb.apply(null,arguments);return this.isValid()&&a.isValid()?athis?this:a:o()}),Le=function(){return Date.now?Date.now():+new Date};zb("Z",":"),zb("ZZ",""),Z("Z",Xd),Z("ZZ",Xd),ba(["Z","ZZ"],function(a,b,c){c._useUTC=!0,c._tzm=Ab(Xd,a)});var Me=/([\+\-]|\d\d)/gi;a.updateOffset=function(){};var Ne=/^(\-)?(?:(\d*)[. ])?(\d+)\:(\d+)(?:\:(\d+)(\.\d*)?)?$/,Oe=/^(-)?P(?:(-?[0-9,.]*)Y)?(?:(-?[0-9,.]*)M)?(?:(-?[0-9,.]*)W)?(?:(-?[0-9,.]*)D)?(?:T(?:(-?[0-9,.]*)H)?(?:(-?[0-9,.]*)M)?(?:(-?[0-9,.]*)S)?)?$/;Ob.fn=wb.prototype;var Pe=Sb(1,"add"),Qe=Sb(-1,"subtract");a.defaultFormat="YYYY-MM-DDTHH:mm:ssZ",a.defaultFormatUtc="YYYY-MM-DDTHH:mm:ss[Z]";var Re=x("moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.",function(a){return void 0===a?this.localeData():this.locale(a)});U(0,["gg",2],0,function(){return this.weekYear()%100}),U(0,["GG",2],0,function(){return this.isoWeekYear()%100}),zc("gggg","weekYear"),zc("ggggg","weekYear"),zc("GGGG","isoWeekYear"),zc("GGGGG","isoWeekYear"),J("weekYear","gg"),J("isoWeekYear","GG"),M("weekYear",1),M("isoWeekYear",1),Z("G",Vd),Z("g",Vd),Z("GG",Od,Kd),Z("gg",Od,Kd),Z("GGGG",Sd,Md),Z("gggg",Sd,Md),Z("GGGGG",Td,Nd),Z("ggggg",Td,Nd),ca(["gggg","ggggg","GGGG","GGGGG"],function(a,b,c,d){b[d.substr(0,2)]=u(a)}),ca(["gg","GG"],function(b,c,d,e){c[e]=a.parseTwoDigitYear(b)}),U("Q",0,"Qo","quarter"),J("quarter","Q"),M("quarter",7),Z("Q",Jd),ba("Q",function(a,b){b[be]=3*(u(a)-1)}),U("D",["DD",2],"Do","date"),J("date","D"),M("date",9),Z("D",Od),Z("DD",Od,Kd),Z("Do",function(a,b){return a?b._ordinalParse:b._ordinalParseLenient}),ba(["D","DD"],ce),ba("Do",function(a,b){b[ce]=u(a.match(Od)[0],10)});var Se=O("Date",!0);U("DDD",["DDDD",3],"DDDo","dayOfYear"),J("dayOfYear","DDD"),M("dayOfYear",4),Z("DDD",Rd),Z("DDDD",Ld),ba(["DDD","DDDD"],function(a,b,c){c._dayOfYear=u(a)}),U("m",["mm",2],0,"minute"),J("minute","m"),M("minute",14),Z("m",Od),Z("mm",Od,Kd),ba(["m","mm"],ee);var Te=O("Minutes",!1);U("s",["ss",2],0,"second"),J("second","s"),M("second",15),Z("s",Od),Z("ss",Od,Kd),ba(["s","ss"],fe);var Ue=O("Seconds",!1);U("S",0,0,function(){return~~(this.millisecond()/100)}),U(0,["SS",2],0,function(){return~~(this.millisecond()/10)}),U(0,["SSS",3],0,"millisecond"),U(0,["SSSS",4],0,function(){return 10*this.millisecond()}),U(0,["SSSSS",5],0,function(){return 100*this.millisecond()}),U(0,["SSSSSS",6],0,function(){return 1e3*this.millisecond()}),U(0,["SSSSSSS",7],0,function(){return 1e4*this.millisecond()}),U(0,["SSSSSSSS",8],0,function(){return 1e5*this.millisecond()}),U(0,["SSSSSSSSS",9],0,function(){return 1e6*this.millisecond()}),J("millisecond","ms"),M("millisecond",16),Z("S",Rd,Jd),Z("SS",Rd,Kd),Z("SSS",Rd,Ld);var Ve;for(Ve="SSSS";Ve.length<=9;Ve+="S")Z(Ve,Ud);for(Ve="S";Ve.length<=9;Ve+="S")ba(Ve,Ic);var We=O("Milliseconds",!1);U("z",0,0,"zoneAbbr"),U("zz",0,0,"zoneName");var Xe=r.prototype;Xe.add=Pe,Xe.calendar=Vb,Xe.clone=Wb,Xe.diff=bc,Xe.endOf=oc,Xe.format=gc,Xe.from=hc,Xe.fromNow=ic,Xe.to=jc,Xe.toNow=kc,Xe.get=R,Xe.invalidAt=xc,Xe.isAfter=Xb,Xe.isBefore=Yb,Xe.isBetween=Zb,Xe.isSame=$b,Xe.isSameOrAfter=_b,Xe.isSameOrBefore=ac,Xe.isValid=vc,Xe.lang=Re,Xe.locale=lc,Xe.localeData=mc,Xe.max=Ke,Xe.min=Je,Xe.parsingFlags=wc,Xe.set=S,Xe.startOf=nc,Xe.subtract=Qe,Xe.toArray=sc,Xe.toObject=tc,Xe.toDate=rc,Xe.toISOString=ec,Xe.inspect=fc,Xe.toJSON=uc,Xe.toString=dc,Xe.unix=qc,Xe.valueOf=pc,Xe.creationData=yc,Xe.year=pe,Xe.isLeapYear=ra,Xe.weekYear=Ac,Xe.isoWeekYear=Bc,Xe.quarter=Xe.quarters=Gc,Xe.month=ka,Xe.daysInMonth=la,Xe.week=Xe.weeks=Ba,Xe.isoWeek=Xe.isoWeeks=Ca,Xe.weeksInYear=Dc,Xe.isoWeeksInYear=Cc,Xe.date=Se,Xe.day=Xe.days=Ka,Xe.weekday=La,Xe.isoWeekday=Ma,Xe.dayOfYear=Hc,Xe.hour=Xe.hours=ze,Xe.minute=Xe.minutes=Te,Xe.second=Xe.seconds=Ue,Xe.millisecond=Xe.milliseconds=We,Xe.utcOffset=Db,Xe.utc=Fb,Xe.local=Gb,Xe.parseZone=Hb,Xe.hasAlignedHourOffset=Ib,Xe.isDST=Jb,Xe.isLocal=Lb,Xe.isUtcOffset=Mb,Xe.isUtc=Nb,Xe.isUTC=Nb,Xe.zoneAbbr=Jc,Xe.zoneName=Kc,Xe.dates=x("dates accessor is deprecated. Use date instead.",Se),Xe.months=x("months accessor is deprecated. Use month instead",ka),Xe.years=x("years accessor is deprecated. Use year instead",pe),Xe.zone=x("moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/",Eb),Xe.isDSTShifted=x("isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information",Kb);var Ye=C.prototype;Ye.calendar=D,Ye.longDateFormat=E,Ye.invalidDate=F,Ye.ordinal=G,Ye.preparse=Nc,Ye.postformat=Nc,Ye.relativeTime=H,Ye.pastFuture=I,Ye.set=A,Ye.months=fa,Ye.monthsShort=ga,Ye.monthsParse=ia,Ye.monthsRegex=na,Ye.monthsShortRegex=ma,Ye.week=ya,Ye.firstDayOfYear=Aa,Ye.firstDayOfWeek=za,Ye.weekdays=Fa,Ye.weekdaysMin=Ha,Ye.weekdaysShort=Ga,Ye.weekdaysParse=Ja,Ye.weekdaysRegex=Na,Ye.weekdaysShortRegex=Oa,Ye.weekdaysMinRegex=Pa,Ye.isPM=Va,Ye.meridiem=Wa,$a("en",{ordinalParse:/\d{1,2}(th|st|nd|rd)/,ordinal:function(a){var b=a%10,c=1===u(a%100/10)?"th":1===b?"st":2===b?"nd":3===b?"rd":"th";return a+c}}),a.lang=x("moment.lang is deprecated. Use moment.locale instead.",$a),a.langData=x("moment.langData is deprecated. Use moment.localeData instead.",bb);var Ze=Math.abs,$e=ed("ms"),_e=ed("s"),af=ed("m"),bf=ed("h"),cf=ed("d"),df=ed("w"),ef=ed("M"),ff=ed("y"),gf=gd("milliseconds"),hf=gd("seconds"),jf=gd("minutes"),kf=gd("hours"),lf=gd("days"),mf=gd("months"),nf=gd("years"),of=Math.round,pf={s:45,m:45,h:22,d:26,M:11},qf=Math.abs,rf=wb.prototype;return rf.abs=Wc,rf.add=Yc,rf.subtract=Zc,rf.as=cd,rf.asMilliseconds=$e,rf.asSeconds=_e,rf.asMinutes=af,rf.asHours=bf,rf.asDays=cf,rf.asWeeks=df,rf.asMonths=ef,rf.asYears=ff,rf.valueOf=dd,rf._bubble=_c,rf.get=fd,rf.milliseconds=gf,rf.seconds=hf,rf.minutes=jf,rf.hours=kf,rf.days=lf,rf.weeks=hd,rf.months=mf,rf.years=nf,rf.humanize=md,rf.toISOString=nd,rf.toString=nd,rf.toJSON=nd,rf.locale=lc,rf.localeData=mc,rf.toIsoString=x("toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)",nd),rf.lang=Re,U("X",0,0,"unix"),U("x",0,0,"valueOf"),Z("x",Vd),Z("X",Yd),ba("X",function(a,b,c){c._d=new Date(1e3*parseFloat(a,10))}),ba("x",function(a,b,c){c._d=new Date(u(a))}),a.version="2.17.1",b(sb),a.fn=Xe,a.min=ub,a.max=vb,a.now=Le,a.utc=k,a.unix=Lc,a.months=Rc,a.isDate=g,a.locale=$a,a.invalid=o,a.duration=Ob,a.isMoment=s,a.weekdays=Tc,a.parseZone=Mc,a.localeData=bb,a.isDuration=xb,a.monthsShort=Sc,a.weekdaysMin=Vc,a.defineLocale=_a,a.updateLocale=ab,a.locales=cb,a.weekdaysShort=Uc,a.normalizeUnits=K,a.relativeTimeRounding=kd,a.relativeTimeThreshold=ld,a.calendarFormat=Ub,a.prototype=Xe,a}); \ No newline at end of file diff --git a/dist/transpiled.js b/dist/transpiled.js index 5aba333f..0cd49f36 100644 --- a/dist/transpiled.js +++ b/dist/transpiled.js @@ -122,6 +122,7 @@ var SNTools = function () { var contentXmlString = xmlNote.getElementsByTagName("content")[0].childNodes[0].nodeValue; var contentXml = this.loadXMLString(contentXmlString, "html"); var contentHTML = contentXml.getElementsByTagName("en-note")[0].innerHTML; + contentHTML = contentHTML.replace(/]*>/g, "\n\n"); var text = this.strip(contentHTML); var note = { diff --git a/dist/transpiled.js.map b/dist/transpiled.js.map index 6099cb6e..1c3390b8 100644 --- a/dist/transpiled.js.map +++ b/dist/transpiled.js.map @@ -1 +1 @@ -{"version":3,"sources":["../lib/sntools.js"],"names":["SNTools","crypto","window","msCrypto","buf","Uint32Array","getRandomValues","idx","replace","c","r","v","toString","d","Date","getTime","performance","now","uuid","Math","random","floor","html","tmp","document","implementation","createHTMLDocument","body","innerHTML","textContent","innerText","string","type","xmlDoc","DOMParser","parser","parseFromString","ActiveXObject","async","loadXML","data","filename","textFile","makeTextFile","text","Blob","URL","revokeObjectURL","createObjectURL","file","JSON","stringify","link","createElement","setAttribute","href","appendChild","click","removeChild","loadXMLString","xmlNotes","getElementsByTagName","notes","tags","findTag","title","filter","tag","content","addTag","push","xmlNote","childNodes","nodeValue","created","updatedNodes","updated","length","contentXmlString","contentXml","contentHTML","strip","note","created_at","moment","toDate","updated_at","generateUUID","content_type","references","xmlTags","tagXml","tagName","itemsData","items","concat","files","completion","index","processedData","readNext","reader","FileReader","onload","e","target","result","name","split","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WY,IAAX;AACD;AA9DuB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AAgExB,UAAIW,YAAY;AACdC,eAAOhC,MAAMiC,MAAN,CAAahC,IAAb;AADO,OAAhB;;AAIA,aAAO8B,SAAP;AACD;;;0CAEqBG,K,EAAOC,U,EAAY;AACvC,UAAIC,QAAQ,CAAZ;AACA,UAAIC,gBAAgB,EAApB;;AAEA,UAAIC,WAAW,YAAW;AACxB,YAAInD,OAAO+C,MAAME,KAAN,CAAX;AACAA;AACA,YAAIG,SAAS,IAAIC,UAAJ,EAAb;;AAEAD,eAAOE,MAAP,GAAgB,UAASC,CAAT,EAAY;;AAE1B,cAAIhE,OAAOgE,EAAEC,MAAF,CAASC,MAApB;AACA,cAAIxB,OAAO;AACTC,wBAAY,IAAIrE,IAAJ,EADH;AAETwE,wBAAY,IAAIxE,IAAJ,EAFH;AAGTI,kBAAM,KAAKqE,YAAL,EAHG;AAITC,0BAAc,MAJL;AAKTpB,qBAAS;AACPH,qBAAOhB,KAAK0D,IAAL,CAAUC,KAAV,CAAgB,GAAhB,EAAqB,CAArB,CADA;AAEPhE,oBAAMJ,IAFC;AAGPiD,0BAAY;AAHL;AALA,WAAX;AAWAU,wBAAc7B,IAAd,CAAmBY,IAAnB;;AAEA,cAAGgB,QAAQF,MAAMnB,MAAjB,EAAyB;AACvBuB;AACD,WAFD,MAEO;AACLH,uBAAW,EAACH,OAAOK,aAAR,EAAX;AACD;AACF,SArBe,CAqBdU,IArBc,CAqBT,IArBS,CAAhB;AAsBAR,eAAOS,UAAP,CAAkB7D,IAAlB;AACD,OA5Bc,CA4Bb4D,IA5Ba,CA4BR,IA5BQ,CAAf;;AA8BAT;AACD;;;;;;AAGHlG,OAAOF,OAAP,GAAiB,IAAIA,OAAJ,EAAjB","file":"transpiled.js","sourcesContent":["class SNTools {\n\n generateUUID() {\n var crypto = window.crypto || window.msCrypto;\n if(crypto) {\n var buf = new Uint32Array(4);\n crypto.getRandomValues(buf);\n var idx = -1;\n return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {\n idx++;\n var r = (buf[idx>>3] >> ((idx%8)*4))&15;\n var v = c == 'x' ? r : (r&0x3|0x8);\n return v.toString(16);\n });\n } else {\n var d = new Date().getTime();\n if(window.performance && typeof window.performance.now === \"function\"){\n d += performance.now(); //use high-precision timer if available\n }\n var uuid = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {\n var r = (d + Math.random()*16)%16 | 0;\n d = Math.floor(d/16);\n return (c=='x' ? r : (r&0x3|0x8)).toString(16);\n });\n return uuid;\n }\n }\n\n strip(html) {\n var tmp = document.implementation.createHTMLDocument(\"New\").body;\n tmp.innerHTML = html;\n return tmp.textContent || tmp.innerText || \"\";\n }\n\n loadXMLString(string, type) {\n var xmlDoc;\n if (window.DOMParser) {\n var parser = new DOMParser();\n xmlDoc = parser.parseFromString(string, \"text/\" + type);\n } else {\n // Internet Explorer\n xmlDoc = new ActiveXObject(\"Microsoft.XMLDOM\");\n xmlDoc.async = false;\n xmlDoc.loadXML(string);\n }\n\n return xmlDoc;\n }\n\n downloadSNData(data, filename) {\n var textFile = null;\n var makeTextFile = function (text) {\n var data = new Blob([text], {type: 'text/json'});\n\n // If we are replacing a previously generated file we need to\n // manually revoke the object URL to avoid memory leaks.\n if (textFile !== null) {\n window.URL.revokeObjectURL(textFile);\n }\n\n textFile = window.URL.createObjectURL(data);\n\n // returns a URL you can use as a href\n return textFile;\n }\n\n var file = makeTextFile(JSON.stringify(data, null, 2 /* pretty print */));\n\n var link = document.createElement('a');\n link.setAttribute('download', filename);\n link.href = file;\n document.body.appendChild(link);\n link.click();\n document.body.removeChild(link);\n }\n\n convertENEXDatatoSN(data) {\n var xmlDoc = this.loadXMLString(data, \"xml\");\n var xmlNotes = xmlDoc.getElementsByTagName(\"note\");\n var notes = [];\n var tags = [];\n\n function findTag(title) {\n return tags.filter(function(tag){\n return tag.content.title == title;\n })[0];\n }\n\n function addTag(tag) {\n tags.push(tag);\n }\n\n for(var xmlNote of xmlNotes) {\n var title = xmlNote.getElementsByTagName(\"title\")[0].childNodes[0].nodeValue;\n var created = xmlNote.getElementsByTagName(\"created\")[0].childNodes[0].nodeValue;\n var updatedNodes = xmlNote.getElementsByTagName(\"updated\");\n var updated = updatedNodes.length ? updatedNodes[0].childNodes[0].nodeValue : null;\n\n var contentXmlString = xmlNote.getElementsByTagName(\"content\")[0].childNodes[0].nodeValue;\n var contentXml = this.loadXMLString(contentXmlString, \"html\");\n var contentHTML = contentXml.getElementsByTagName(\"en-note\")[0].innerHTML;\n var text = this.strip(contentHTML);\n\n var note = {\n created_at: moment(created).toDate(),\n updated_at: updated ? moment(updated).toDate() : null,\n uuid: this.generateUUID(),\n content_type: \"Note\",\n content: {\n title: title,\n text: text,\n references: [],\n }\n };\n\n var xmlTags = xmlNote.getElementsByTagName(\"tag\");\n for(var tagXml of xmlTags) {\n var tagName = tagXml.childNodes[0].nodeValue;\n var tag = findTag(tagName);\n if(!tag) {\n tag = {\n uuid: this.generateUUID(),\n content_type: \"Tag\",\n created_at: new Date(),\n updated_at: new Date(),\n content: {\n title: tagName,\n references: []\n }\n }\n addTag(tag);\n }\n\n note.content.references.push({content_type: tag.content_type, uuid: tag.uuid})\n tag.content.references.push({content_type: note.content_type, uuid: note.uuid})\n }\n\n notes.push(note);\n }\n\n var itemsData = {\n items: notes.concat(tags)\n }\n\n return itemsData;\n }\n\n convertPlaintextFiles(files, completion) {\n var index = 0;\n var processedData = [];\n\n var readNext = function() {\n var file = files[index];\n index++;\n var reader = new FileReader();\n\n reader.onload = function(e) {\n\n var data = e.target.result;\n var note = {\n created_at: new Date(),\n updated_at: new Date(),\n uuid: this.generateUUID(),\n content_type: \"Note\",\n content: {\n title: file.name.split(\".\")[0],\n text: data,\n references: [],\n }\n };\n processedData.push(note);\n\n if(index < files.length) {\n readNext();\n } else {\n completion({items: processedData});\n }\n }.bind(this)\n reader.readAsText(file);\n }.bind(this);\n\n readNext();\n }\n}\n\nwindow.SNTools = new SNTools()\n"]} \ No newline at end of file +{"version":3,"sources":["../lib/sntools.js"],"names":["SNTools","crypto","window","msCrypto","buf","Uint32Array","getRandomValues","idx","replace","c","r","v","toString","d","Date","getTime","performance","now","uuid","Math","random","floor","html","tmp","document","implementation","createHTMLDocument","body","innerHTML","textContent","innerText","string","type","xmlDoc","DOMParser","parser","parseFromString","ActiveXObject","async","loadXML","data","filename","textFile","makeTextFile","text","Blob","URL","revokeObjectURL","createObjectURL","file","JSON","stringify","link","createElement","setAttribute","href","appendChild","click","removeChild","loadXMLString","xmlNotes","getElementsByTagName","notes","tags","findTag","title","filter","tag","content","addTag","push","xmlNote","childNodes","nodeValue","created","updatedNodes","updated","length","contentXmlString","contentXml","contentHTML","strip","note","created_at","moment","toDate","updated_at","generateUUID","content_type","references","xmlTags","tagXml","tagName","itemsData","items","concat","files","completion","index","processedData","readNext","reader","FileReader","onload","e","target","result","name","split","bind","readAsText"],"mappings":";;;;;;IAAMA,O;;;;;;;mCAEW;AACb,UAAIC,SAASC,OAAOD,MAAP,IAAiBC,OAAOC,QAArC;AACA,UAAGF,MAAH,EAAW;AACT,YAAIG,MAAM,IAAIC,WAAJ,CAAgB,CAAhB,CAAV;AACAJ,eAAOK,eAAP,CAAuBF,GAAvB;AACA,YAAIG,MAAM,CAAC,CAAX;AACA,eAAO,uCAAuCC,OAAvC,CAA+C,OAA/C,EAAwD,UAASC,CAAT,EAAY;AACvEF;AACA,cAAIG,IAAKN,IAAIG,OAAK,CAAT,KAAiBA,MAAI,CAAL,GAAQ,CAAzB,GAA6B,EAArC;AACA,cAAII,IAAIF,KAAK,GAAL,GAAWC,CAAX,GAAgBA,IAAE,GAAF,GAAM,GAA9B;AACA,iBAAOC,EAAEC,QAAF,CAAW,EAAX,CAAP;AACH,SALM,CAAP;AAMD,OAVD,MAUO;AACL,YAA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IxB,OAAO;AACTC,wBAAY,IAAIrE,IAAJ,EADH;AAETwE,wBAAY,IAAIxE,IAAJ,EAFH;AAGTI,kBAAM,KAAKqE,YAAL,EAHG;AAITC,0BAAc,MAJL;AAKTpB,qBAAS;AACPH,qBAAOhB,KAAK0D,IAAL,CAAUC,KAAV,CAAgB,GAAhB,EAAqB,CAArB,CADA;AAEPhE,oBAAMJ,IAFC;AAGPiD,0BAAY;AAHL;AALA,WAAX;AAWAU,wBAAc7B,IAAd,CAAmBY,IAAnB;;AAEA,cAAGgB,QAAQF,MAAMnB,MAAjB,EAAyB;AACvBuB;AACD,WAFD,MAEO;AACLH,uBAAW,EAACH,OAAOK,aAAR,EAAX;AACD;AACF,SArBe,CAqBdU,IArBc,CAqBT,IArBS,CAAhB;AAsBAR,eAAOS,UAAP,CAAkB7D,IAAlB;AACD,OA5Bc,CA4Bb4D,IA5Ba,CA4BR,IA5BQ,CAAf;;AA8BAT;AACD;;;;;;AAGHlG,OAAOF,OAAP,GAAiB,IAAIA,OAAJ,EAAjB","file":"transpiled.js","sourcesContent":["class SNTools {\n\n generateUUID() {\n var crypto = window.crypto || window.msCrypto;\n if(crypto) {\n var buf = new Uint32Array(4);\n crypto.getRandomValues(buf);\n var idx = -1;\n return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {\n idx++;\n var r = (buf[idx>>3] >> ((idx%8)*4))&15;\n var v = c == 'x' ? r : (r&0x3|0x8);\n return v.toString(16);\n });\n } else {\n var d = new Date().getTime();\n if(window.performance && typeof window.performance.now === \"function\"){\n d += performance.now(); //use high-precision timer if available\n }\n var uuid = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {\n var r = (d + Math.random()*16)%16 | 0;\n d = Math.floor(d/16);\n return (c=='x' ? r : (r&0x3|0x8)).toString(16);\n });\n return uuid;\n }\n }\n\n strip(html) {\n var tmp = document.implementation.createHTMLDocument(\"New\").body;\n tmp.innerHTML = html;\n return tmp.textContent || tmp.innerText || \"\";\n }\n\n loadXMLString(string, type) {\n var xmlDoc;\n if (window.DOMParser) {\n var parser = new DOMParser();\n xmlDoc = parser.parseFromString(string, \"text/\" + type);\n } else {\n // Internet Explorer\n xmlDoc = new ActiveXObject(\"Microsoft.XMLDOM\");\n xmlDoc.async = false;\n xmlDoc.loadXML(string);\n }\n\n return xmlDoc;\n }\n\n downloadSNData(data, filename) {\n var textFile = null;\n var makeTextFile = function (text) {\n var data = new Blob([text], {type: 'text/json'});\n\n // If we are replacing a previously generated file we need to\n // manually revoke the object URL to avoid memory leaks.\n if (textFile !== null) {\n window.URL.revokeObjectURL(textFile);\n }\n\n textFile = window.URL.createObjectURL(data);\n\n // returns a URL you can use as a href\n return textFile;\n }\n\n var file = makeTextFile(JSON.stringify(data, null, 2 /* pretty print */));\n\n var link = document.createElement('a');\n link.setAttribute('download', filename);\n link.href = file;\n document.body.appendChild(link);\n link.click();\n document.body.removeChild(link);\n }\n\n convertENEXDatatoSN(data) {\n var xmlDoc = this.loadXMLString(data, \"xml\");\n var xmlNotes = xmlDoc.getElementsByTagName(\"note\");\n var notes = [];\n var tags = [];\n\n function findTag(title) {\n return tags.filter(function(tag){\n return tag.content.title == title;\n })[0];\n }\n\n function addTag(tag) {\n tags.push(tag);\n }\n\n for(var xmlNote of xmlNotes) {\n var title = xmlNote.getElementsByTagName(\"title\")[0].childNodes[0].nodeValue;\n var created = xmlNote.getElementsByTagName(\"created\")[0].childNodes[0].nodeValue;\n var updatedNodes = xmlNote.getElementsByTagName(\"updated\");\n var updated = updatedNodes.length ? updatedNodes[0].childNodes[0].nodeValue : null;\n\n var contentXmlString = xmlNote.getElementsByTagName(\"content\")[0].childNodes[0].nodeValue;\n var contentXml = this.loadXMLString(contentXmlString, \"html\");\n var contentHTML = contentXml.getElementsByTagName(\"en-note\")[0].innerHTML;\n contentHTML = contentHTML.replace(/]*>/g, \"\\n\\n\");\n var text = this.strip(contentHTML);\n\n var note = {\n created_at: moment(created).toDate(),\n updated_at: updated ? moment(updated).toDate() : null,\n uuid: this.generateUUID(),\n content_type: \"Note\",\n content: {\n title: title,\n text: text,\n references: [],\n }\n };\n\n var xmlTags = xmlNote.getElementsByTagName(\"tag\");\n for(var tagXml of xmlTags) {\n var tagName = tagXml.childNodes[0].nodeValue;\n var tag = findTag(tagName);\n if(!tag) {\n tag = {\n uuid: this.generateUUID(),\n content_type: \"Tag\",\n created_at: new Date(),\n updated_at: new Date(),\n content: {\n title: tagName,\n references: []\n }\n }\n addTag(tag);\n }\n\n note.content.references.push({content_type: tag.content_type, uuid: tag.uuid})\n tag.content.references.push({content_type: note.content_type, uuid: note.uuid})\n }\n\n notes.push(note);\n }\n\n var itemsData = {\n items: notes.concat(tags)\n }\n\n return itemsData;\n }\n\n convertPlaintextFiles(files, completion) {\n var index = 0;\n var processedData = [];\n\n var readNext = function() {\n var file = files[index];\n index++;\n var reader = new FileReader();\n\n reader.onload = function(e) {\n\n var data = e.target.result;\n var note = {\n created_at: new Date(),\n updated_at: new Date(),\n uuid: this.generateUUID(),\n content_type: \"Note\",\n content: {\n title: file.name.split(\".\")[0],\n text: data,\n references: [],\n }\n };\n processedData.push(note);\n\n if(index < files.length) {\n readNext();\n } else {\n completion({items: processedData});\n }\n }.bind(this)\n reader.readAsText(file);\n }.bind(this);\n\n readNext();\n }\n}\n\nwindow.SNTools = new SNTools()\n"]} \ No newline at end of file diff --git a/lib/sntools.js b/lib/sntools.js index 2f1ffe9c..f1f8d69c 100644 --- a/lib/sntools.js +++ b/lib/sntools.js @@ -99,6 +99,7 @@ class SNTools { var contentXmlString = xmlNote.getElementsByTagName("content")[0].childNodes[0].nodeValue; var contentXml = this.loadXMLString(contentXmlString, "html"); var contentHTML = contentXml.getElementsByTagName("en-note")[0].innerHTML; + contentHTML = contentHTML.replace(/]*>/g, "\n\n"); var text = this.strip(contentHTML); var note = {