From c68e060ecc41a07a4daf56a90c354254b801ef38 Mon Sep 17 00:00:00 2001 From: Kenshin Date: Thu, 4 Apr 2019 14:34:54 +0800 Subject: [PATCH 01/43] Add md file to read mode. --- src/manifest.json | 2 +- src/vender/puread/adaptesite.js | 33 +++++++++++++++++++++++- src/vender/puread/plugin.js | 2 ++ src/vender/puread/plugin/showdown.min.js | 3 +++ src/vender/puread/puread.js | 2 ++ 5 files changed, 40 insertions(+), 2 deletions(-) create mode 100644 src/vender/puread/plugin/showdown.min.js diff --git a/src/manifest.json b/src/manifest.json index aa4c4aff..d9de452e 100644 --- a/src/manifest.json +++ b/src/manifest.json @@ -22,7 +22,7 @@ }, "content_scripts" : [ { - "matches" : [ "http://*/*", "https://*/*", "file:///*/*.txt" ], + "matches" : [ "http://*/*", "https://*/*", "file:///*/*.txt", "file:///*/*.md" ], "exclude_matches": [ "http://localhost/*", "https://simpread.herokuapp.com/view/*" ], "js" : [ "/bundle/common.js", diff --git a/src/vender/puread/adaptesite.js b/src/vender/puread/adaptesite.js index 9e446b6f..c1677446 100644 --- a/src/vender/puread/adaptesite.js +++ b/src/vender/puread/adaptesite.js @@ -14,7 +14,7 @@ const site = { avatar : [], paging : [], }; -let minimatch, rdability; +let minimatch, rdability, markdown; export default class AdapteSite { @@ -40,6 +40,13 @@ export default class AdapteSite { rdability = value; } + /** + * Set global markdown + */ + SetMarkdown( value ) { + markdown = value; + } + /** * Not adapter usage mozilla readability and readtmpl */ @@ -339,6 +346,9 @@ function readmeta() { if ( minimatch( location.href, "file://**/*.txt" ) || minimatch( location.href, "http*://**/*.txt" ) ) { return readtxt(); } + if ( minimatch( location.href, "file://**/*.md" ) || minimatch( location.href, "http*://**/*.md" ) ) { + return readmd(); + } const reg = /<\S+ (class|id)=("|')?[\w-_=;:' ]+("|')?>?$|<[^/][-_a-zA-Z0-9]+>?$/ig, // from util.verifyHtml() meta = { name : $( "meta[name='simpread:name']" ).attr( "content" ), @@ -392,6 +402,27 @@ function readtxt() { return meta; } +/** + * Read Markdown, include: file and http + */ +function readmd() { + const title = location.pathname.split( "/" ).pop(), + type = location.protocol == "file:" ? "local" : "remote", + meta = { + name : `txtread::${type}`, + title : "", + desc : "", + include: "", + auto : false, + exclude: [], + }; + const converter = new markdown.Converter(), + html = converter.makeHtml( $( "body pre" ).text() ); + meta.html = html; + !$( "title" ).html() && $( "head" ).append( `<title>${ decodeURI(title.replace( ".md", "" )) }` ); + return meta; +} + /** * Read mode template, include: * diff --git a/src/vender/puread/plugin.js b/src/vender/puread/plugin.js index fed86ef0..7c9ea66d 100644 --- a/src/vender/puread/plugin.js +++ b/src/vender/puread/plugin.js @@ -5,6 +5,7 @@ import minimatch from './plugin/minimatch'; import * as be from './plugin/beautify'; import * as ss from './plugin/stylesheet'; import * as rda from './plugin/readability'; +import * as md from './plugin/showdown.min'; const plugins = { pangu : pangu, @@ -12,6 +13,7 @@ const plugins = { beautify : be, style : ss, rdability: rda, + markdown : md, }; /** diff --git a/src/vender/puread/plugin/showdown.min.js b/src/vender/puread/plugin/showdown.min.js new file mode 100644 index 00000000..72ed9bcc --- /dev/null +++ b/src/vender/puread/plugin/showdown.min.js @@ -0,0 +1,3 @@ +/*! showdown v 1.9.0 - 10-11-2018 */ +(function(){function e(e){"use strict";var r={omitExtraWLInCodeBlocks:{defaultValue:!1,describe:"Omit the default extra whiteline added to code blocks",type:"boolean"},noHeaderId:{defaultValue:!1,describe:"Turn on/off generated header id",type:"boolean"},prefixHeaderId:{defaultValue:!1,describe:"Add a prefix to the generated header ids. Passing a string will prefix that string to the header id. Setting to true will add a generic 'section-' prefix",type:"string"},rawPrefixHeaderId:{defaultValue:!1,describe:'Setting this option to true will prevent showdown from modifying the prefix. This might result in malformed IDs (if, for instance, the " char is used in the prefix)',type:"boolean"},ghCompatibleHeaderId:{defaultValue:!1,describe:"Generate header ids compatible with github style (spaces are replaced with dashes, a bunch of non alphanumeric chars are removed)",type:"boolean"},rawHeaderId:{defaultValue:!1,describe:"Remove only spaces, ' and \" from generated header ids (including prefixes), replacing them with dashes (-). WARNING: This might result in malformed ids",type:"boolean"},headerLevelStart:{defaultValue:!1,describe:"The header blocks level start",type:"integer"},parseImgDimensions:{defaultValue:!1,describe:"Turn on/off image dimension parsing",type:"boolean"},simplifiedAutoLink:{defaultValue:!1,describe:"Turn on/off GFM autolink style",type:"boolean"},excludeTrailingPunctuationFromURLs:{defaultValue:!1,describe:"Excludes trailing punctuation from links generated with autoLinking",type:"boolean"},literalMidWordUnderscores:{defaultValue:!1,describe:"Parse midword underscores as literal underscores",type:"boolean"},literalMidWordAsterisks:{defaultValue:!1,describe:"Parse midword asterisks as literal asterisks",type:"boolean"},strikethrough:{defaultValue:!1,describe:"Turn on/off strikethrough support",type:"boolean"},tables:{defaultValue:!1,describe:"Turn on/off tables support",type:"boolean"},tablesHeaderId:{defaultValue:!1,describe:"Add an id to table headers",type:"boolean"},ghCodeBlocks:{defaultValue:!0,describe:"Turn on/off GFM fenced code blocks support",type:"boolean"},tasklists:{defaultValue:!1,describe:"Turn on/off GFM tasklist support",type:"boolean"},smoothLivePreview:{defaultValue:!1,describe:"Prevents weird effects in live previews due to incomplete input",type:"boolean"},smartIndentationFix:{defaultValue:!1,description:"Tries to smartly fix indentation in es6 strings",type:"boolean"},disableForced4SpacesIndentedSublists:{defaultValue:!1,description:"Disables the requirement of indenting nested sublists by 4 spaces",type:"boolean"},simpleLineBreaks:{defaultValue:!1,description:"Parses simple line breaks as
(GFM Style)",type:"boolean"},requireSpaceBeforeHeadingText:{defaultValue:!1,description:"Makes adding a space between `#` and the header text mandatory (GFM Style)",type:"boolean"},ghMentions:{defaultValue:!1,description:"Enables github @mentions",type:"boolean"},ghMentionsLink:{defaultValue:"https://github.com/{u}",description:"Changes the link generated by @mentions. Only applies if ghMentions option is enabled.",type:"string"},encodeEmails:{defaultValue:!0,description:"Encode e-mail addresses through the use of Character Entities, transforming ASCII e-mail addresses into its equivalent decimal entities",type:"boolean"},openLinksInNewWindow:{defaultValue:!1,description:"Open all links in new windows",type:"boolean"},backslashEscapesHTMLTags:{defaultValue:!1,description:"Support for HTML Tag escaping. ex:
foo
",type:"boolean"},emoji:{defaultValue:!1,description:"Enable emoji support. Ex: `this is a :smile: emoji`",type:"boolean"},underline:{defaultValue:!1,description:"Enable support for underline. Syntax is double or triple underscores: `__underline word__`. With this option enabled, underscores no longer parses into `` and ``",type:"boolean"},completeHTMLDocument:{defaultValue:!1,description:"Outputs a complete html document, including ``, `` and `` tags",type:"boolean"},metadata:{defaultValue:!1,description:"Enable support for document metadata (defined at the top of the document between `«««` and `»»»` or between `---` and `---`).",type:"boolean"},splitAdjacentBlockquotes:{defaultValue:!1,description:"Split adjacent blockquote blocks",type:"boolean"}};if(!1===e)return JSON.parse(JSON.stringify(r));var t={};for(var a in r)r.hasOwnProperty(a)&&(t[a]=r[a].defaultValue);return t}function r(e,r){"use strict";var t=r?"Error in "+r+" extension->":"Error in unnamed extension",n={valid:!0,error:""};a.helper.isArray(e)||(e=[e]);for(var s=0;s").replace(/&/g,"&")};var c=function(e,r,t,a){"use strict";var n,s,o,i,l,c=a||"",u=c.indexOf("g")>-1,d=new RegExp(r+"|"+t,"g"+c.replace(/g/g,"")),p=new RegExp(r,c.replace(/g/g,"")),h=[];do{for(n=0;o=d.exec(e);)if(p.test(o[0]))n++||(i=(s=d.lastIndex)-o[0].length);else if(n&&!--n){l=o.index+o[0].length;var _={left:{start:i,end:s},match:{start:s,end:o.index},right:{start:o.index,end:l},wholeMatch:{start:i,end:l}};if(h.push(_),!u)return h}}while(n&&(d.lastIndex=s));return h};a.helper.matchRecursiveRegExp=function(e,r,t,a){"use strict";for(var n=c(e,r,t,a),s=[],o=0;o0){var d=[];0!==i[0].wholeMatch.start&&d.push(e.slice(0,i[0].wholeMatch.start));for(var p=0;p=0?n+(t||0):n},a.helper.splitAtIndex=function(e,r){"use strict";if(!a.helper.isString(e))throw"InvalidArgumentError: first parameter of showdown.helper.regexIndexOf function must be a string";return[e.substring(0,r),e.substring(r)]},a.helper.encodeEmailAddress=function(e){"use strict";var r=[function(e){return"&#"+e.charCodeAt(0)+";"},function(e){return"&#x"+e.charCodeAt(0).toString(16)+";"},function(e){return e}];return e=e.replace(/./g,function(e){if("@"===e)e=r[Math.floor(2*Math.random())](e);else{var t=Math.random();e=t>.9?r[2](e):t>.45?r[1](e):r[0](e)}return e})},a.helper.padEnd=function(e,r,t){"use strict";return r>>=0,t=String(t||" "),e.length>r?String(e):((r-=e.length)>t.length&&(t+=t.repeat(r/t.length)),String(e)+t.slice(0,r))},"undefined"==typeof console&&(console={warn:function(e){"use strict";alert(e)},log:function(e){"use strict";alert(e)},error:function(e){"use strict";throw e}}),a.helper.regexes={asteriskDashAndColon:/([*_:~])/g},a.helper.emojis={"+1":"👍","-1":"👎",100:"💯",1234:"🔢","1st_place_medal":"🥇","2nd_place_medal":"🥈","3rd_place_medal":"🥉","8ball":"🎱",a:"🅰️",ab:"🆎",abc:"🔤",abcd:"🔡",accept:"🉑",aerial_tramway:"🚡",airplane:"✈️",alarm_clock:"⏰",alembic:"⚗️",alien:"👽",ambulance:"🚑",amphora:"🏺",anchor:"⚓️",angel:"👼",anger:"💢",angry:"😠",anguished:"😧",ant:"🐜",apple:"🍎",aquarius:"♒️",aries:"♈️",arrow_backward:"◀️",arrow_double_down:"⏬",arrow_double_up:"⏫",arrow_down:"⬇️",arrow_down_small:"🔽",arrow_forward:"▶️",arrow_heading_down:"⤵️",arrow_heading_up:"⤴️",arrow_left:"⬅️",arrow_lower_left:"↙️",arrow_lower_right:"↘️",arrow_right:"➡️",arrow_right_hook:"↪️",arrow_up:"⬆️",arrow_up_down:"↕️",arrow_up_small:"🔼",arrow_upper_left:"↖️",arrow_upper_right:"↗️",arrows_clockwise:"🔃",arrows_counterclockwise:"🔄",art:"🎨",articulated_lorry:"🚛",artificial_satellite:"🛰",astonished:"😲",athletic_shoe:"👟",atm:"🏧",atom_symbol:"⚛️",avocado:"🥑",b:"🅱️",baby:"👶",baby_bottle:"🍼",baby_chick:"🐤",baby_symbol:"🚼",back:"🔙",bacon:"🥓",badminton:"🏸",baggage_claim:"🛄",baguette_bread:"🥖",balance_scale:"⚖️",balloon:"🎈",ballot_box:"🗳",ballot_box_with_check:"☑️",bamboo:"🎍",banana:"🍌",bangbang:"‼️",bank:"🏦",bar_chart:"📊",barber:"💈",baseball:"⚾️",basketball:"🏀",basketball_man:"⛹️",basketball_woman:"⛹️‍♀️",bat:"🦇",bath:"🛀",bathtub:"🛁",battery:"🔋",beach_umbrella:"🏖",bear:"🐻",bed:"🛏",bee:"🐝",beer:"🍺",beers:"🍻",beetle:"🐞",beginner:"🔰",bell:"🔔",bellhop_bell:"🛎",bento:"🍱",biking_man:"🚴",bike:"🚲",biking_woman:"🚴‍♀️",bikini:"👙",biohazard:"☣️",bird:"🐦",birthday:"🎂",black_circle:"⚫️",black_flag:"🏴",black_heart:"🖤",black_joker:"🃏",black_large_square:"⬛️",black_medium_small_square:"◾️",black_medium_square:"◼️",black_nib:"✒️",black_small_square:"▪️",black_square_button:"🔲",blonde_man:"👱",blonde_woman:"👱‍♀️",blossom:"🌼",blowfish:"🐡",blue_book:"📘",blue_car:"🚙",blue_heart:"💙",blush:"😊",boar:"🐗",boat:"⛵️",bomb:"💣",book:"📖",bookmark:"🔖",bookmark_tabs:"📑",books:"📚",boom:"💥",boot:"👢",bouquet:"💐",bowing_man:"🙇",bow_and_arrow:"🏹",bowing_woman:"🙇‍♀️",bowling:"🎳",boxing_glove:"🥊",boy:"👦",bread:"🍞",bride_with_veil:"👰",bridge_at_night:"🌉",briefcase:"💼",broken_heart:"💔",bug:"🐛",building_construction:"🏗",bulb:"💡",bullettrain_front:"🚅",bullettrain_side:"🚄",burrito:"🌯",bus:"🚌",business_suit_levitating:"🕴",busstop:"🚏",bust_in_silhouette:"👤",busts_in_silhouette:"👥",butterfly:"🦋",cactus:"🌵",cake:"🍰",calendar:"📆",call_me_hand:"🤙",calling:"📲",camel:"🐫",camera:"📷",camera_flash:"📸",camping:"🏕",cancer:"♋️",candle:"🕯",candy:"🍬",canoe:"🛶",capital_abcd:"🔠",capricorn:"♑️",car:"🚗",card_file_box:"🗃",card_index:"📇",card_index_dividers:"🗂",carousel_horse:"🎠",carrot:"🥕",cat:"🐱",cat2:"🐈",cd:"💿",chains:"⛓",champagne:"🍾",chart:"💹",chart_with_downwards_trend:"📉",chart_with_upwards_trend:"📈",checkered_flag:"🏁",cheese:"🧀",cherries:"🍒",cherry_blossom:"🌸",chestnut:"🌰",chicken:"🐔",children_crossing:"🚸",chipmunk:"🐿",chocolate_bar:"🍫",christmas_tree:"🎄",church:"⛪️",cinema:"🎦",circus_tent:"🎪",city_sunrise:"🌇",city_sunset:"🌆",cityscape:"🏙",cl:"🆑",clamp:"🗜",clap:"👏",clapper:"🎬",classical_building:"🏛",clinking_glasses:"🥂",clipboard:"📋",clock1:"🕐",clock10:"🕙",clock1030:"🕥",clock11:"🕚",clock1130:"🕦",clock12:"🕛",clock1230:"🕧",clock130:"🕜",clock2:"🕑",clock230:"🕝",clock3:"🕒",clock330:"🕞",clock4:"🕓",clock430:"🕟",clock5:"🕔",clock530:"🕠",clock6:"🕕",clock630:"🕡",clock7:"🕖",clock730:"🕢",clock8:"🕗",clock830:"🕣",clock9:"🕘",clock930:"🕤",closed_book:"📕",closed_lock_with_key:"🔐",closed_umbrella:"🌂",cloud:"☁️",cloud_with_lightning:"🌩",cloud_with_lightning_and_rain:"⛈",cloud_with_rain:"🌧",cloud_with_snow:"🌨",clown_face:"🤡",clubs:"♣️",cocktail:"🍸",coffee:"☕️",coffin:"⚰️",cold_sweat:"😰",comet:"☄️",computer:"💻",computer_mouse:"🖱",confetti_ball:"🎊",confounded:"😖",confused:"😕",congratulations:"㊗️",construction:"🚧",construction_worker_man:"👷",construction_worker_woman:"👷‍♀️",control_knobs:"🎛",convenience_store:"🏪",cookie:"🍪",cool:"🆒",policeman:"👮",copyright:"©️",corn:"🌽",couch_and_lamp:"🛋",couple:"👫",couple_with_heart_woman_man:"💑",couple_with_heart_man_man:"👨‍❤️‍👨",couple_with_heart_woman_woman:"👩‍❤️‍👩",couplekiss_man_man:"👨‍❤️‍💋‍👨",couplekiss_man_woman:"💏",couplekiss_woman_woman:"👩‍❤️‍💋‍👩",cow:"🐮",cow2:"🐄",cowboy_hat_face:"🤠",crab:"🦀",crayon:"🖍",credit_card:"💳",crescent_moon:"🌙",cricket:"🏏",crocodile:"🐊",croissant:"🥐",crossed_fingers:"🤞",crossed_flags:"🎌",crossed_swords:"⚔️",crown:"👑",cry:"😢",crying_cat_face:"😿",crystal_ball:"🔮",cucumber:"🥒",cupid:"💘",curly_loop:"➰",currency_exchange:"💱",curry:"🍛",custard:"🍮",customs:"🛃",cyclone:"🌀",dagger:"🗡",dancer:"💃",dancing_women:"👯",dancing_men:"👯‍♂️",dango:"🍡",dark_sunglasses:"🕶",dart:"🎯",dash:"💨",date:"📅",deciduous_tree:"🌳",deer:"🦌",department_store:"🏬",derelict_house:"🏚",desert:"🏜",desert_island:"🏝",desktop_computer:"🖥",male_detective:"🕵️",diamond_shape_with_a_dot_inside:"💠",diamonds:"♦️",disappointed:"😞",disappointed_relieved:"😥",dizzy:"💫",dizzy_face:"😵",do_not_litter:"🚯",dog:"🐶",dog2:"🐕",dollar:"💵",dolls:"🎎",dolphin:"🐬",door:"🚪",doughnut:"🍩",dove:"🕊",dragon:"🐉",dragon_face:"🐲",dress:"👗",dromedary_camel:"🐪",drooling_face:"🤤",droplet:"💧",drum:"🥁",duck:"🦆",dvd:"📀","e-mail":"📧",eagle:"🦅",ear:"👂",ear_of_rice:"🌾",earth_africa:"🌍",earth_americas:"🌎",earth_asia:"🌏",egg:"🥚",eggplant:"🍆",eight_pointed_black_star:"✴️",eight_spoked_asterisk:"✳️",electric_plug:"🔌",elephant:"🐘",email:"✉️",end:"🔚",envelope_with_arrow:"📩",euro:"💶",european_castle:"🏰",european_post_office:"🏤",evergreen_tree:"🌲",exclamation:"❗️",expressionless:"😑",eye:"👁",eye_speech_bubble:"👁‍🗨",eyeglasses:"👓",eyes:"👀",face_with_head_bandage:"🤕",face_with_thermometer:"🤒",fist_oncoming:"👊",factory:"🏭",fallen_leaf:"🍂",family_man_woman_boy:"👪",family_man_boy:"👨‍👦",family_man_boy_boy:"👨‍👦‍👦",family_man_girl:"👨‍👧",family_man_girl_boy:"👨‍👧‍👦",family_man_girl_girl:"👨‍👧‍👧",family_man_man_boy:"👨‍👨‍👦",family_man_man_boy_boy:"👨‍👨‍👦‍👦",family_man_man_girl:"👨‍👨‍👧",family_man_man_girl_boy:"👨‍👨‍👧‍👦",family_man_man_girl_girl:"👨‍👨‍👧‍👧",family_man_woman_boy_boy:"👨‍👩‍👦‍👦",family_man_woman_girl:"👨‍👩‍👧",family_man_woman_girl_boy:"👨‍👩‍👧‍👦",family_man_woman_girl_girl:"👨‍👩‍👧‍👧",family_woman_boy:"👩‍👦",family_woman_boy_boy:"👩‍👦‍👦",family_woman_girl:"👩‍👧",family_woman_girl_boy:"👩‍👧‍👦",family_woman_girl_girl:"👩‍👧‍👧",family_woman_woman_boy:"👩‍👩‍👦",family_woman_woman_boy_boy:"👩‍👩‍👦‍👦",family_woman_woman_girl:"👩‍👩‍👧",family_woman_woman_girl_boy:"👩‍👩‍👧‍👦",family_woman_woman_girl_girl:"👩‍👩‍👧‍👧",fast_forward:"⏩",fax:"📠",fearful:"😨",feet:"🐾",female_detective:"🕵️‍♀️",ferris_wheel:"🎡",ferry:"⛴",field_hockey:"🏑",file_cabinet:"🗄",file_folder:"📁",film_projector:"📽",film_strip:"🎞",fire:"🔥",fire_engine:"🚒",fireworks:"🎆",first_quarter_moon:"🌓",first_quarter_moon_with_face:"🌛",fish:"🐟",fish_cake:"🍥",fishing_pole_and_fish:"🎣",fist_raised:"✊",fist_left:"🤛",fist_right:"🤜",flags:"🎏",flashlight:"🔦",fleur_de_lis:"⚜️",flight_arrival:"🛬",flight_departure:"🛫",floppy_disk:"💾",flower_playing_cards:"🎴",flushed:"😳",fog:"🌫",foggy:"🌁",football:"🏈",footprints:"👣",fork_and_knife:"🍴",fountain:"⛲️",fountain_pen:"🖋",four_leaf_clover:"🍀",fox_face:"🦊",framed_picture:"🖼",free:"🆓",fried_egg:"🍳",fried_shrimp:"🍤",fries:"🍟",frog:"🐸",frowning:"😦",frowning_face:"☹️",frowning_man:"🙍‍♂️",frowning_woman:"🙍",middle_finger:"🖕",fuelpump:"⛽️",full_moon:"🌕",full_moon_with_face:"🌝",funeral_urn:"⚱️",game_die:"🎲",gear:"⚙️",gem:"💎",gemini:"♊️",ghost:"👻",gift:"🎁",gift_heart:"💝",girl:"👧",globe_with_meridians:"🌐",goal_net:"🥅",goat:"🐐",golf:"⛳️",golfing_man:"🏌️",golfing_woman:"🏌️‍♀️",gorilla:"🦍",grapes:"🍇",green_apple:"🍏",green_book:"📗",green_heart:"💚",green_salad:"🥗",grey_exclamation:"❕",grey_question:"❔",grimacing:"😬",grin:"😁",grinning:"😀",guardsman:"💂",guardswoman:"💂‍♀️",guitar:"🎸",gun:"🔫",haircut_woman:"💇",haircut_man:"💇‍♂️",hamburger:"🍔",hammer:"🔨",hammer_and_pick:"⚒",hammer_and_wrench:"🛠",hamster:"🐹",hand:"✋",handbag:"👜",handshake:"🤝",hankey:"💩",hatched_chick:"🐥",hatching_chick:"🐣",headphones:"🎧",hear_no_evil:"🙉",heart:"❤️",heart_decoration:"💟",heart_eyes:"😍",heart_eyes_cat:"😻",heartbeat:"💓",heartpulse:"💗",hearts:"♥️",heavy_check_mark:"✔️",heavy_division_sign:"➗",heavy_dollar_sign:"💲",heavy_heart_exclamation:"❣️",heavy_minus_sign:"➖",heavy_multiplication_x:"✖️",heavy_plus_sign:"➕",helicopter:"🚁",herb:"🌿",hibiscus:"🌺",high_brightness:"🔆",high_heel:"👠",hocho:"🔪",hole:"🕳",honey_pot:"🍯",horse:"🐴",horse_racing:"🏇",hospital:"🏥",hot_pepper:"🌶",hotdog:"🌭",hotel:"🏨",hotsprings:"♨️",hourglass:"⌛️",hourglass_flowing_sand:"⏳",house:"🏠",house_with_garden:"🏡",houses:"🏘",hugs:"🤗",hushed:"😯",ice_cream:"🍨",ice_hockey:"🏒",ice_skate:"⛸",icecream:"🍦",id:"🆔",ideograph_advantage:"🉐",imp:"👿",inbox_tray:"📥",incoming_envelope:"📨",tipping_hand_woman:"💁",information_source:"ℹ️",innocent:"😇",interrobang:"⁉️",iphone:"📱",izakaya_lantern:"🏮",jack_o_lantern:"🎃",japan:"🗾",japanese_castle:"🏯",japanese_goblin:"👺",japanese_ogre:"👹",jeans:"👖",joy:"😂",joy_cat:"😹",joystick:"🕹",kaaba:"🕋",key:"🔑",keyboard:"⌨️",keycap_ten:"🔟",kick_scooter:"🛴",kimono:"👘",kiss:"💋",kissing:"😗",kissing_cat:"😽",kissing_closed_eyes:"😚",kissing_heart:"😘",kissing_smiling_eyes:"😙",kiwi_fruit:"🥝",koala:"🐨",koko:"🈁",label:"🏷",large_blue_circle:"🔵",large_blue_diamond:"🔷",large_orange_diamond:"🔶",last_quarter_moon:"🌗",last_quarter_moon_with_face:"🌜",latin_cross:"✝️",laughing:"😆",leaves:"🍃",ledger:"📒",left_luggage:"🛅",left_right_arrow:"↔️",leftwards_arrow_with_hook:"↩️",lemon:"🍋",leo:"♌️",leopard:"🐆",level_slider:"🎚",libra:"♎️",light_rail:"🚈",link:"🔗",lion:"🦁",lips:"👄",lipstick:"💄",lizard:"🦎",lock:"🔒",lock_with_ink_pen:"🔏",lollipop:"🍭",loop:"➿",loud_sound:"🔊",loudspeaker:"📢",love_hotel:"🏩",love_letter:"💌",low_brightness:"🔅",lying_face:"🤥",m:"Ⓜ️",mag:"🔍",mag_right:"🔎",mahjong:"🀄️",mailbox:"📫",mailbox_closed:"📪",mailbox_with_mail:"📬",mailbox_with_no_mail:"📭",man:"👨",man_artist:"👨‍🎨",man_astronaut:"👨‍🚀",man_cartwheeling:"🤸‍♂️",man_cook:"👨‍🍳",man_dancing:"🕺",man_facepalming:"🤦‍♂️",man_factory_worker:"👨‍🏭",man_farmer:"👨‍🌾",man_firefighter:"👨‍🚒",man_health_worker:"👨‍⚕️",man_in_tuxedo:"🤵",man_judge:"👨‍⚖️",man_juggling:"🤹‍♂️",man_mechanic:"👨‍🔧",man_office_worker:"👨‍💼",man_pilot:"👨‍✈️",man_playing_handball:"🤾‍♂️",man_playing_water_polo:"🤽‍♂️",man_scientist:"👨‍🔬",man_shrugging:"🤷‍♂️",man_singer:"👨‍🎤",man_student:"👨‍🎓",man_teacher:"👨‍🏫",man_technologist:"👨‍💻",man_with_gua_pi_mao:"👲",man_with_turban:"👳",tangerine:"🍊",mans_shoe:"👞",mantelpiece_clock:"🕰",maple_leaf:"🍁",martial_arts_uniform:"🥋",mask:"😷",massage_woman:"💆",massage_man:"💆‍♂️",meat_on_bone:"🍖",medal_military:"🎖",medal_sports:"🏅",mega:"📣",melon:"🍈",memo:"📝",men_wrestling:"🤼‍♂️",menorah:"🕎",mens:"🚹",metal:"🤘",metro:"🚇",microphone:"🎤",microscope:"🔬",milk_glass:"🥛",milky_way:"🌌",minibus:"🚐",minidisc:"💽",mobile_phone_off:"📴",money_mouth_face:"🤑",money_with_wings:"💸",moneybag:"💰",monkey:"🐒",monkey_face:"🐵",monorail:"🚝",moon:"🌔",mortar_board:"🎓",mosque:"🕌",motor_boat:"🛥",motor_scooter:"🛵",motorcycle:"🏍",motorway:"🛣",mount_fuji:"🗻",mountain:"⛰",mountain_biking_man:"🚵",mountain_biking_woman:"🚵‍♀️",mountain_cableway:"🚠",mountain_railway:"🚞",mountain_snow:"🏔",mouse:"🐭",mouse2:"🐁",movie_camera:"🎥",moyai:"🗿",mrs_claus:"🤶",muscle:"💪",mushroom:"🍄",musical_keyboard:"🎹",musical_note:"🎵",musical_score:"🎼",mute:"🔇",nail_care:"💅",name_badge:"📛",national_park:"🏞",nauseated_face:"🤢",necktie:"👔",negative_squared_cross_mark:"❎",nerd_face:"🤓",neutral_face:"😐",new:"🆕",new_moon:"🌑",new_moon_with_face:"🌚",newspaper:"📰",newspaper_roll:"🗞",next_track_button:"⏭",ng:"🆖",no_good_man:"🙅‍♂️",no_good_woman:"🙅",night_with_stars:"🌃",no_bell:"🔕",no_bicycles:"🚳",no_entry:"⛔️",no_entry_sign:"🚫",no_mobile_phones:"📵",no_mouth:"😶",no_pedestrians:"🚷",no_smoking:"🚭","non-potable_water":"🚱",nose:"👃",notebook:"📓",notebook_with_decorative_cover:"📔",notes:"🎶",nut_and_bolt:"🔩",o:"⭕️",o2:"🅾️",ocean:"🌊",octopus:"🐙",oden:"🍢",office:"🏢",oil_drum:"🛢",ok:"🆗",ok_hand:"👌",ok_man:"🙆‍♂️",ok_woman:"🙆",old_key:"🗝",older_man:"👴",older_woman:"👵",om:"🕉",on:"🔛",oncoming_automobile:"🚘",oncoming_bus:"🚍",oncoming_police_car:"🚔",oncoming_taxi:"🚖",open_file_folder:"📂",open_hands:"👐",open_mouth:"😮",open_umbrella:"☂️",ophiuchus:"⛎",orange_book:"📙",orthodox_cross:"☦️",outbox_tray:"📤",owl:"🦉",ox:"🐂",package:"📦",page_facing_up:"📄",page_with_curl:"📃",pager:"📟",paintbrush:"🖌",palm_tree:"🌴",pancakes:"🥞",panda_face:"🐼",paperclip:"📎",paperclips:"🖇",parasol_on_ground:"⛱",parking:"🅿️",part_alternation_mark:"〽️",partly_sunny:"⛅️",passenger_ship:"🛳",passport_control:"🛂",pause_button:"⏸",peace_symbol:"☮️",peach:"🍑",peanuts:"🥜",pear:"🍐",pen:"🖊",pencil2:"✏️",penguin:"🐧",pensive:"😔",performing_arts:"🎭",persevere:"😣",person_fencing:"🤺",pouting_woman:"🙎",phone:"☎️",pick:"⛏",pig:"🐷",pig2:"🐖",pig_nose:"🐽",pill:"💊",pineapple:"🍍",ping_pong:"🏓",pisces:"♓️",pizza:"🍕",place_of_worship:"🛐",plate_with_cutlery:"🍽",play_or_pause_button:"⏯",point_down:"👇",point_left:"👈",point_right:"👉",point_up:"☝️",point_up_2:"👆",police_car:"🚓",policewoman:"👮‍♀️",poodle:"🐩",popcorn:"🍿",post_office:"🏣",postal_horn:"📯",postbox:"📮",potable_water:"🚰",potato:"🥔",pouch:"👝",poultry_leg:"🍗",pound:"💷",rage:"😡",pouting_cat:"😾",pouting_man:"🙎‍♂️",pray:"🙏",prayer_beads:"📿",pregnant_woman:"🤰",previous_track_button:"⏮",prince:"🤴",princess:"👸",printer:"🖨",purple_heart:"💜",purse:"👛",pushpin:"📌",put_litter_in_its_place:"🚮",question:"❓",rabbit:"🐰",rabbit2:"🐇",racehorse:"🐎",racing_car:"🏎",radio:"📻",radio_button:"🔘",radioactive:"☢️",railway_car:"🚃",railway_track:"🛤",rainbow:"🌈",rainbow_flag:"🏳️‍🌈",raised_back_of_hand:"🤚",raised_hand_with_fingers_splayed:"🖐",raised_hands:"🙌",raising_hand_woman:"🙋",raising_hand_man:"🙋‍♂️",ram:"🐏",ramen:"🍜",rat:"🐀",record_button:"⏺",recycle:"♻️",red_circle:"🔴",registered:"®️",relaxed:"☺️",relieved:"😌",reminder_ribbon:"🎗",repeat:"🔁",repeat_one:"🔂",rescue_worker_helmet:"⛑",restroom:"🚻",revolving_hearts:"💞",rewind:"⏪",rhinoceros:"🦏",ribbon:"🎀",rice:"🍚",rice_ball:"🍙",rice_cracker:"🍘",rice_scene:"🎑",right_anger_bubble:"🗯",ring:"💍",robot:"🤖",rocket:"🚀",rofl:"🤣",roll_eyes:"🙄",roller_coaster:"🎢",rooster:"🐓",rose:"🌹",rosette:"🏵",rotating_light:"🚨",round_pushpin:"📍",rowing_man:"🚣",rowing_woman:"🚣‍♀️",rugby_football:"🏉",running_man:"🏃",running_shirt_with_sash:"🎽",running_woman:"🏃‍♀️",sa:"🈂️",sagittarius:"♐️",sake:"🍶",sandal:"👡",santa:"🎅",satellite:"📡",saxophone:"🎷",school:"🏫",school_satchel:"🎒",scissors:"✂️",scorpion:"🦂",scorpius:"♏️",scream:"😱",scream_cat:"🙀",scroll:"📜",seat:"💺",secret:"㊙️",see_no_evil:"🙈",seedling:"🌱",selfie:"🤳",shallow_pan_of_food:"🥘",shamrock:"☘️",shark:"🦈",shaved_ice:"🍧",sheep:"🐑",shell:"🐚",shield:"🛡",shinto_shrine:"⛩",ship:"🚢",shirt:"👕",shopping:"🛍",shopping_cart:"🛒",shower:"🚿",shrimp:"🦐",signal_strength:"📶",six_pointed_star:"🔯",ski:"🎿",skier:"⛷",skull:"💀",skull_and_crossbones:"☠️",sleeping:"😴",sleeping_bed:"🛌",sleepy:"😪",slightly_frowning_face:"🙁",slightly_smiling_face:"🙂",slot_machine:"🎰",small_airplane:"🛩",small_blue_diamond:"🔹",small_orange_diamond:"🔸",small_red_triangle:"🔺",small_red_triangle_down:"🔻",smile:"😄",smile_cat:"😸",smiley:"😃",smiley_cat:"😺",smiling_imp:"😈",smirk:"😏",smirk_cat:"😼",smoking:"🚬",snail:"🐌",snake:"🐍",sneezing_face:"🤧",snowboarder:"🏂",snowflake:"❄️",snowman:"⛄️",snowman_with_snow:"☃️",sob:"😭",soccer:"⚽️",soon:"🔜",sos:"🆘",sound:"🔉",space_invader:"👾",spades:"♠️",spaghetti:"🍝",sparkle:"❇️",sparkler:"🎇",sparkles:"✨",sparkling_heart:"💖",speak_no_evil:"🙊",speaker:"🔈",speaking_head:"🗣",speech_balloon:"💬",speedboat:"🚤",spider:"🕷",spider_web:"🕸",spiral_calendar:"🗓",spiral_notepad:"🗒",spoon:"🥄",squid:"🦑",stadium:"🏟",star:"⭐️",star2:"🌟",star_and_crescent:"☪️",star_of_david:"✡️",stars:"🌠",station:"🚉",statue_of_liberty:"🗽",steam_locomotive:"🚂",stew:"🍲",stop_button:"⏹",stop_sign:"🛑",stopwatch:"⏱",straight_ruler:"📏",strawberry:"🍓",stuck_out_tongue:"😛",stuck_out_tongue_closed_eyes:"😝",stuck_out_tongue_winking_eye:"😜",studio_microphone:"🎙",stuffed_flatbread:"🥙",sun_behind_large_cloud:"🌥",sun_behind_rain_cloud:"🌦",sun_behind_small_cloud:"🌤",sun_with_face:"🌞",sunflower:"🌻",sunglasses:"😎",sunny:"☀️",sunrise:"🌅",sunrise_over_mountains:"🌄",surfing_man:"🏄",surfing_woman:"🏄‍♀️",sushi:"🍣",suspension_railway:"🚟",sweat:"😓",sweat_drops:"💦",sweat_smile:"😅",sweet_potato:"🍠",swimming_man:"🏊",swimming_woman:"🏊‍♀️",symbols:"🔣",synagogue:"🕍",syringe:"💉",taco:"🌮",tada:"🎉",tanabata_tree:"🎋",taurus:"♉️",taxi:"🚕",tea:"🍵",telephone_receiver:"📞",telescope:"🔭",tennis:"🎾",tent:"⛺️",thermometer:"🌡",thinking:"🤔",thought_balloon:"💭",ticket:"🎫",tickets:"🎟",tiger:"🐯",tiger2:"🐅",timer_clock:"⏲",tipping_hand_man:"💁‍♂️",tired_face:"😫",tm:"™️",toilet:"🚽",tokyo_tower:"🗼",tomato:"🍅",tongue:"👅",top:"🔝",tophat:"🎩",tornado:"🌪",trackball:"🖲",tractor:"🚜",traffic_light:"🚥",train:"🚋",train2:"🚆",tram:"🚊",triangular_flag_on_post:"🚩",triangular_ruler:"📐",trident:"🔱",triumph:"😤",trolleybus:"🚎",trophy:"🏆",tropical_drink:"🍹",tropical_fish:"🐠",truck:"🚚",trumpet:"🎺",tulip:"🌷",tumbler_glass:"🥃",turkey:"🦃",turtle:"🐢",tv:"📺",twisted_rightwards_arrows:"🔀",two_hearts:"💕",two_men_holding_hands:"👬",two_women_holding_hands:"👭",u5272:"🈹",u5408:"🈴",u55b6:"🈺",u6307:"🈯️",u6708:"🈷️",u6709:"🈶",u6e80:"🈵",u7121:"🈚️",u7533:"🈸",u7981:"🈲",u7a7a:"🈳",umbrella:"☔️",unamused:"😒",underage:"🔞",unicorn:"🦄",unlock:"🔓",up:"🆙",upside_down_face:"🙃",v:"✌️",vertical_traffic_light:"🚦",vhs:"📼",vibration_mode:"📳",video_camera:"📹",video_game:"🎮",violin:"🎻",virgo:"♍️",volcano:"🌋",volleyball:"🏐",vs:"🆚",vulcan_salute:"🖖",walking_man:"🚶",walking_woman:"🚶‍♀️",waning_crescent_moon:"🌘",waning_gibbous_moon:"🌖",warning:"⚠️",wastebasket:"🗑",watch:"⌚️",water_buffalo:"🐃",watermelon:"🍉",wave:"👋",wavy_dash:"〰️",waxing_crescent_moon:"🌒",wc:"🚾",weary:"😩",wedding:"💒",weight_lifting_man:"🏋️",weight_lifting_woman:"🏋️‍♀️",whale:"🐳",whale2:"🐋",wheel_of_dharma:"☸️",wheelchair:"♿️",white_check_mark:"✅",white_circle:"⚪️",white_flag:"🏳️",white_flower:"💮",white_large_square:"⬜️",white_medium_small_square:"◽️",white_medium_square:"◻️",white_small_square:"▫️",white_square_button:"🔳",wilted_flower:"🥀",wind_chime:"🎐",wind_face:"🌬",wine_glass:"🍷",wink:"😉",wolf:"🐺",woman:"👩",woman_artist:"👩‍🎨",woman_astronaut:"👩‍🚀",woman_cartwheeling:"🤸‍♀️",woman_cook:"👩‍🍳",woman_facepalming:"🤦‍♀️",woman_factory_worker:"👩‍🏭",woman_farmer:"👩‍🌾",woman_firefighter:"👩‍🚒",woman_health_worker:"👩‍⚕️",woman_judge:"👩‍⚖️",woman_juggling:"🤹‍♀️",woman_mechanic:"👩‍🔧",woman_office_worker:"👩‍💼",woman_pilot:"👩‍✈️",woman_playing_handball:"🤾‍♀️",woman_playing_water_polo:"🤽‍♀️",woman_scientist:"👩‍🔬",woman_shrugging:"🤷‍♀️",woman_singer:"👩‍🎤",woman_student:"👩‍🎓",woman_teacher:"👩‍🏫",woman_technologist:"👩‍💻",woman_with_turban:"👳‍♀️",womans_clothes:"👚",womans_hat:"👒",women_wrestling:"🤼‍♀️",womens:"🚺",world_map:"🗺",worried:"😟",wrench:"🔧",writing_hand:"✍️",x:"❌",yellow_heart:"💛",yen:"💴",yin_yang:"☯️",yum:"😋",zap:"⚡️",zipper_mouth_face:"🤐",zzz:"💤",octocat:':octocat:',showdown:"S"},a.Converter=function(e){"use strict";function t(e,t){if(t=t||null,a.helper.isString(e)){if(e=a.helper.stdExtName(e),t=e,a.extensions[e])return console.warn("DEPRECATION WARNING: "+e+" is an old extension that uses a deprecated loading method.Please inform the developer that the extension should be updated!"),void function(e,t){"function"==typeof e&&(e=e(new a.Converter));a.helper.isArray(e)||(e=[e]);var n=r(e,t);if(!n.valid)throw Error(n.error);for(var s=0;s[ \t]+¨NBSP;<"),!r){if(!window||!window.document)throw new Error("HTMLParser is undefined. If in a webworker or nodejs environment, you need to provide a WHATWG DOM and HTML such as JSDOM");r=window.document}var n=r.createElement("div");n.innerHTML=e;var s={preList:function(e){for(var r=e.querySelectorAll("pre"),t=[],n=0;n'}else t.push(r[n].innerHTML),r[n].innerHTML="",r[n].setAttribute("prenum",n.toString());return t}(n)};t(n);for(var o=n.childNodes,i="",l=0;l? ?(['"].*['"])?\)$/m)>-1)o="";else if(!o){if(s||(s=n.toLowerCase().replace(/ ?\n/g," ")),o="#"+s,a.helper.isUndefined(t.gUrls[s]))return e;o=t.gUrls[s],a.helper.isUndefined(t.gTitles[s])||(c=t.gTitles[s])}var u='"};return e=(e=t.converter._dispatch("anchors.before",e,r,t)).replace(/\[((?:\[[^\]]*]|[^\[\]])*)] ?(?:\n *)?\[(.*?)]()()()()/g,n),e=e.replace(/\[((?:\[[^\]]*]|[^\[\]])*)]()[ \t]*\([ \t]?<([^>]*)>(?:[ \t]*((["'])([^"]*?)\5))?[ \t]?\)/g,n),e=e.replace(/\[((?:\[[^\]]*]|[^\[\]])*)]()[ \t]*\([ \t]??(?:[ \t]*((["'])([^"]*?)\5))?[ \t]?\)/g,n),e=e.replace(/\[([^\[\]]+)]()()()()()/g,n),r.ghMentions&&(e=e.replace(/(^|\s)(\\)?(@([a-z\d]+(?:[a-z\d.-]+?[a-z\d]+)*))/gim,function(e,t,n,s,o){if("\\"===n)return t+s;if(!a.helper.isString(r.ghMentionsLink))throw new Error("ghMentionsLink option must be a string");var i=r.ghMentionsLink.replace(/\{u}/g,o),l="";return r.openLinksInNewWindow&&(l=' target="¨E95Eblank"'),t+'"+s+""})),e=t.converter._dispatch("anchors.after",e,r,t)});var u=/([*~_]+|\b)(((https?|ftp|dict):\/\/|www\.)[^'">\s]+?\.[^'">\s]+?)()(\1)?(?=\s|$)(?!["<>])/gi,d=/([*~_]+|\b)(((https?|ftp|dict):\/\/|www\.)[^'">\s]+\.[^'">\s]+?)([.!?,()\[\]])?(\1)?(?=\s|$)(?!["<>])/gi,p=/()<(((https?|ftp|dict):\/\/|www\.)[^'">\s]+)()>()/gi,h=/(^|\s)(?:mailto:)?([A-Za-z0-9!#$%&'*+-/=?^_`{|}~.]+@[-a-z0-9]+(\.[-a-z0-9]+)*\.[a-z]+)(?=$|\s)/gim,_=/<()(?:mailto:)?([-.\w]+@[-a-z0-9]+(\.[-a-z0-9]+)*\.[a-z]+)>/gi,g=function(e){"use strict";return function(r,t,n,s,o,i,l){var c=n=n.replace(a.helper.regexes.asteriskDashAndColon,a.helper.escapeCharactersCallback),u="",d="",p=t||"",h=l||"";return/^www\./i.test(n)&&(n=n.replace(/^www\./i,"http://www.")),e.excludeTrailingPunctuationFromURLs&&i&&(u=i),e.openLinksInNewWindow&&(d=' target="¨E95Eblank"'),p+'"+c+""+u+h}},m=function(e,r){"use strict";return function(t,n,s){var o="mailto:";return n=n||"",s=a.subParser("unescapeSpecialChars")(s,e,r),e.encodeEmails?(o=a.helper.encodeEmailAddress(o+s),s=a.helper.encodeEmailAddress(s)):o+=s,n+''+s+""}};a.subParser("autoLinks",function(e,r,t){"use strict";return e=t.converter._dispatch("autoLinks.before",e,r,t),e=e.replace(p,g(r)),e=e.replace(_,m(r,t)),e=t.converter._dispatch("autoLinks.after",e,r,t)}),a.subParser("simplifiedAutoLinks",function(e,r,t){"use strict";return r.simplifiedAutoLink?(e=t.converter._dispatch("simplifiedAutoLinks.before",e,r,t),e=r.excludeTrailingPunctuationFromURLs?e.replace(d,g(r)):e.replace(u,g(r)),e=e.replace(h,m(r,t)),e=t.converter._dispatch("simplifiedAutoLinks.after",e,r,t)):e}),a.subParser("blockGamut",function(e,r,t){"use strict";return e=t.converter._dispatch("blockGamut.before",e,r,t),e=a.subParser("blockQuotes")(e,r,t),e=a.subParser("headers")(e,r,t),e=a.subParser("horizontalRule")(e,r,t),e=a.subParser("lists")(e,r,t),e=a.subParser("codeBlocks")(e,r,t),e=a.subParser("tables")(e,r,t),e=a.subParser("hashHTMLBlocks")(e,r,t),e=a.subParser("paragraphs")(e,r,t),e=t.converter._dispatch("blockGamut.after",e,r,t)}),a.subParser("blockQuotes",function(e,r,t){"use strict";e=t.converter._dispatch("blockQuotes.before",e,r,t),e+="\n\n";var n=/(^ {0,3}>[ \t]?.+\n(.+\n)*\n*)+/gm;return r.splitAdjacentBlockquotes&&(n=/^ {0,3}>[\s\S]*?(?:\n\n)/gm),e=e.replace(n,function(e){return e=e.replace(/^[ \t]*>[ \t]?/gm,""),e=e.replace(/¨0/g,""),e=e.replace(/^[ \t]+$/gm,""),e=a.subParser("githubCodeBlocks")(e,r,t),e=a.subParser("blockGamut")(e,r,t),e=e.replace(/(^|\n)/g,"$1 "),e=e.replace(/(\s*
[^\r]+?<\/pre>)/gm,function(e,r){var t=r;return t=t.replace(/^  /gm,"¨0"),t=t.replace(/¨0/g,"")}),a.subParser("hashBlock")("
\n"+e+"\n
",r,t)}),e=t.converter._dispatch("blockQuotes.after",e,r,t)}),a.subParser("codeBlocks",function(e,r,t){"use strict";e=t.converter._dispatch("codeBlocks.before",e,r,t);return e=(e+="¨0").replace(/(?:\n\n|^)((?:(?:[ ]{4}|\t).*\n+)+)(\n*[ ]{0,3}[^ \t\n]|(?=¨0))/g,function(e,n,s){var o=n,i=s,l="\n";return o=a.subParser("outdent")(o,r,t),o=a.subParser("encodeCode")(o,r,t),o=a.subParser("detab")(o,r,t),o=o.replace(/^\n+/g,""),o=o.replace(/\n+$/g,""),r.omitExtraWLInCodeBlocks&&(l=""),o="
"+o+l+"
",a.subParser("hashBlock")(o,r,t)+i}),e=e.replace(/¨0/,""),e=t.converter._dispatch("codeBlocks.after",e,r,t)}),a.subParser("codeSpans",function(e,r,t){"use strict";return void 0===(e=t.converter._dispatch("codeSpans.before",e,r,t))&&(e=""),e=e.replace(/(^|[^\\])(`+)([^\r]*?[^`])\2(?!`)/gm,function(e,n,s,o){var i=o;return i=i.replace(/^([ \t]*)/g,""),i=i.replace(/[ \t]*$/g,""),i=a.subParser("encodeCode")(i,r,t),i=n+""+i+"",i=a.subParser("hashHTMLSpans")(i,r,t)}),e=t.converter._dispatch("codeSpans.after",e,r,t)}),a.subParser("completeHTMLDocument",function(e,r,t){"use strict";if(!r.completeHTMLDocument)return e;e=t.converter._dispatch("completeHTMLDocument.before",e,r,t);var a="html",n="\n",s="",o='\n',i="",l="";void 0!==t.metadata.parsed.doctype&&(n="\n","html"!==(a=t.metadata.parsed.doctype.toString().toLowerCase())&&"html5"!==a||(o=''));for(var c in t.metadata.parsed)if(t.metadata.parsed.hasOwnProperty(c))switch(c.toLowerCase()){case"doctype":break;case"title":s=""+t.metadata.parsed.title+"\n";break;case"charset":o="html"===a||"html5"===a?'\n':'\n';break;case"language":case"lang":i=' lang="'+t.metadata.parsed[c]+'"',l+='\n';break;default:l+='\n'}return e=n+"\n\n"+s+o+l+"\n\n"+e.trim()+"\n\n",e=t.converter._dispatch("completeHTMLDocument.after",e,r,t)}),a.subParser("detab",function(e,r,t){"use strict";return e=t.converter._dispatch("detab.before",e,r,t),e=e.replace(/\t(?=\t)/g," "),e=e.replace(/\t/g,"¨A¨B"),e=e.replace(/¨B(.+?)¨A/g,function(e,r){for(var t=r,a=4-t.length%4,n=0;n/g,">"),e=t.converter._dispatch("encodeAmpsAndAngles.after",e,r,t)}),a.subParser("encodeBackslashEscapes",function(e,r,t){"use strict";return e=t.converter._dispatch("encodeBackslashEscapes.before",e,r,t),e=e.replace(/\\(\\)/g,a.helper.escapeCharactersCallback),e=e.replace(/\\([`*_{}\[\]()>#+.!~=|-])/g,a.helper.escapeCharactersCallback),e=t.converter._dispatch("encodeBackslashEscapes.after",e,r,t)}),a.subParser("encodeCode",function(e,r,t){"use strict";return e=t.converter._dispatch("encodeCode.before",e,r,t),e=e.replace(/&/g,"&").replace(//g,">").replace(/([*_{}\[\]\\=~-])/g,a.helper.escapeCharactersCallback),e=t.converter._dispatch("encodeCode.after",e,r,t)}),a.subParser("escapeSpecialCharsWithinTagAttributes",function(e,r,t){"use strict";return e=(e=t.converter._dispatch("escapeSpecialCharsWithinTagAttributes.before",e,r,t)).replace(/<\/?[a-z\d_:-]+(?:[\s]+[\s\S]+?)?>/gi,function(e){return e.replace(/(.)<\/?code>(?=.)/g,"$1`").replace(/([\\`*_~=|])/g,a.helper.escapeCharactersCallback)}),e=e.replace(/-]|-[^>])(?:[^-]|-[^-])*)--)>/gi,function(e){return e.replace(/([\\`*_~=|])/g,a.helper.escapeCharactersCallback)}),e=t.converter._dispatch("escapeSpecialCharsWithinTagAttributes.after",e,r,t)}),a.subParser("githubCodeBlocks",function(e,r,t){"use strict";return r.ghCodeBlocks?(e=t.converter._dispatch("githubCodeBlocks.before",e,r,t),e+="¨0",e=e.replace(/(?:^|\n)(?: {0,3})(```+|~~~+)(?: *)([^\s`~]*)\n([\s\S]*?)\n(?: {0,3})\1/g,function(e,n,s,o){var i=r.omitExtraWLInCodeBlocks?"":"\n";return o=a.subParser("encodeCode")(o,r,t),o=a.subParser("detab")(o,r,t),o=o.replace(/^\n+/g,""),o=o.replace(/\n+$/g,""),o="
"+o+i+"
",o=a.subParser("hashBlock")(o,r,t),"\n\n¨G"+(t.ghCodeBlocks.push({text:e,codeblock:o})-1)+"G\n\n"}),e=e.replace(/¨0/,""),t.converter._dispatch("githubCodeBlocks.after",e,r,t)):e}),a.subParser("hashBlock",function(e,r,t){"use strict";return e=t.converter._dispatch("hashBlock.before",e,r,t),e=e.replace(/(^\n+|\n+$)/g,""),e="\n\n¨K"+(t.gHtmlBlocks.push(e)-1)+"K\n\n",e=t.converter._dispatch("hashBlock.after",e,r,t)}),a.subParser("hashCodeTags",function(e,r,t){"use strict";e=t.converter._dispatch("hashCodeTags.before",e,r,t);return e=a.helper.replaceRecursiveRegExp(e,function(e,n,s,o){var i=s+a.subParser("encodeCode")(n,r,t)+o;return"¨C"+(t.gHtmlSpans.push(i)-1)+"C"},"]*>","","gim"),e=t.converter._dispatch("hashCodeTags.after",e,r,t)}),a.subParser("hashElement",function(e,r,t){"use strict";return function(e,r){var a=r;return a=a.replace(/\n\n/g,"\n"),a=a.replace(/^\n/,""),a=a.replace(/\n+$/g,""),a="\n\n¨K"+(t.gHtmlBlocks.push(a)-1)+"K\n\n"}}),a.subParser("hashHTMLBlocks",function(e,r,t){"use strict";e=t.converter._dispatch("hashHTMLBlocks.before",e,r,t);var n=["pre","div","h1","h2","h3","h4","h5","h6","blockquote","table","dl","ol","ul","script","noscript","form","fieldset","iframe","math","style","section","header","footer","nav","article","aside","address","audio","canvas","figure","hgroup","output","video","p"],s=function(e,r,a,n){var s=e;return-1!==a.search(/\bmarkdown\b/)&&(s=a+t.converter.makeHtml(r)+n),"\n\n¨K"+(t.gHtmlBlocks.push(s)-1)+"K\n\n"};r.backslashEscapesHTMLTags&&(e=e.replace(/\\<(\/?[^>]+?)>/g,function(e,r){return"<"+r+">"}));for(var o=0;o]*>)","im"),c="<"+n[o]+"\\b[^>]*>",u="";-1!==(i=a.helper.regexIndexOf(e,l));){var d=a.helper.splitAtIndex(e,i),p=a.helper.replaceRecursiveRegExp(d[1],s,c,u,"im");if(p===d[1])break;e=d[0].concat(p)}return e=e.replace(/(\n {0,3}(<(hr)\b([^<>])*?\/?>)[ \t]*(?=\n{2,}))/g,a.subParser("hashElement")(e,r,t)),e=a.helper.replaceRecursiveRegExp(e,function(e){return"\n\n¨K"+(t.gHtmlBlocks.push(e)-1)+"K\n\n"},"^ {0,3}\x3c!--","--\x3e","gm"),e=e.replace(/(?:\n\n)( {0,3}(?:<([?%])[^\r]*?\2>)[ \t]*(?=\n{2,}))/g,a.subParser("hashElement")(e,r,t)),e=t.converter._dispatch("hashHTMLBlocks.after",e,r,t)}),a.subParser("hashHTMLSpans",function(e,r,t){"use strict";function a(e){return"¨C"+(t.gHtmlSpans.push(e)-1)+"C"}return e=t.converter._dispatch("hashHTMLSpans.before",e,r,t),e=e.replace(/<[^>]+?\/>/gi,function(e){return a(e)}),e=e.replace(/<([^>]+?)>[\s\S]*?<\/\1>/g,function(e){return a(e)}),e=e.replace(/<([^>]+?)\s[^>]+?>[\s\S]*?<\/\1>/g,function(e){return a(e)}),e=e.replace(/<[^>]+?>/gi,function(e){return a(e)}),e=t.converter._dispatch("hashHTMLSpans.after",e,r,t)}),a.subParser("unhashHTMLSpans",function(e,r,t){"use strict";e=t.converter._dispatch("unhashHTMLSpans.before",e,r,t);for(var a=0;a]*>\\s*]*>","^ {0,3}\\s*
","gim"),e=t.converter._dispatch("hashPreCodeTags.after",e,r,t)}),a.subParser("headers",function(e,r,t){"use strict";function n(e){var n,s;if(r.customizedHeaderId){var o=e.match(/\{([^{]+?)}\s*$/);o&&o[1]&&(e=o[1])}return n=e,s=a.helper.isString(r.prefixHeaderId)?r.prefixHeaderId:!0===r.prefixHeaderId?"section-":"",r.rawPrefixHeaderId||(n=s+n),n=r.ghCompatibleHeaderId?n.replace(/ /g,"-").replace(/&/g,"").replace(/¨T/g,"").replace(/¨D/g,"").replace(/[&+$,\/:;=?@"#{}|^¨~\[\]`\\*)(%.!'<>]/g,"").toLowerCase():r.rawHeaderId?n.replace(/ /g,"-").replace(/&/g,"&").replace(/¨T/g,"¨").replace(/¨D/g,"$").replace(/["']/g,"-").toLowerCase():n.replace(/[^\w]/g,"").toLowerCase(),r.rawPrefixHeaderId&&(n=s+n),t.hashLinkCounts[n]?n=n+"-"+t.hashLinkCounts[n]++:t.hashLinkCounts[n]=1,n}e=t.converter._dispatch("headers.before",e,r,t);var s=isNaN(parseInt(r.headerLevelStart))?1:parseInt(r.headerLevelStart),o=r.smoothLivePreview?/^(.+)[ \t]*\n={2,}[ \t]*\n+/gm:/^(.+)[ \t]*\n=+[ \t]*\n+/gm,i=r.smoothLivePreview?/^(.+)[ \t]*\n-{2,}[ \t]*\n+/gm:/^(.+)[ \t]*\n-+[ \t]*\n+/gm;e=(e=e.replace(o,function(e,o){var i=a.subParser("spanGamut")(o,r,t),l=r.noHeaderId?"":' id="'+n(o)+'"',c=""+i+"";return a.subParser("hashBlock")(c,r,t)})).replace(i,function(e,o){var i=a.subParser("spanGamut")(o,r,t),l=r.noHeaderId?"":' id="'+n(o)+'"',c=s+1,u=""+i+"";return a.subParser("hashBlock")(u,r,t)});var l=r.requireSpaceBeforeHeadingText?/^(#{1,6})[ \t]+(.+?)[ \t]*#*\n+/gm:/^(#{1,6})[ \t]*(.+?)[ \t]*#*\n+/gm;return e=e.replace(l,function(e,o,i){var l=i;r.customizedHeaderId&&(l=i.replace(/\s?\{([^{]+?)}\s*$/,""));var c=a.subParser("spanGamut")(l,r,t),u=r.noHeaderId?"":' id="'+n(i)+'"',d=s-1+o.length,p=""+c+"";return a.subParser("hashBlock")(p,r,t)}),e=t.converter._dispatch("headers.after",e,r,t)}),a.subParser("horizontalRule",function(e,r,t){"use strict";e=t.converter._dispatch("horizontalRule.before",e,r,t);var n=a.subParser("hashBlock")("
",r,t);return e=e.replace(/^ {0,2}( ?-){3,}[ \t]*$/gm,n),e=e.replace(/^ {0,2}( ?\*){3,}[ \t]*$/gm,n),e=e.replace(/^ {0,2}( ?_){3,}[ \t]*$/gm,n),e=t.converter._dispatch("horizontalRule.after",e,r,t)}),a.subParser("images",function(e,r,t){"use strict";function n(e,r,n,s,o,i,l,c){var u=t.gUrls,d=t.gTitles,p=t.gDimensions;if(n=n.toLowerCase(),c||(c=""),e.search(/\(? ?(['"].*['"])?\)$/m)>-1)s="";else if(""===s||null===s){if(""!==n&&null!==n||(n=r.toLowerCase().replace(/ ?\n/g," ")),s="#"+n,a.helper.isUndefined(u[n]))return e;s=u[n],a.helper.isUndefined(d[n])||(c=d[n]),a.helper.isUndefined(p[n])||(o=p[n].width,i=p[n].height)}r=r.replace(/"/g,""").replace(a.helper.regexes.asteriskDashAndColon,a.helper.escapeCharactersCallback);var h=''+r+'"}return e=(e=t.converter._dispatch("images.before",e,r,t)).replace(/!\[([^\]]*?)] ?(?:\n *)?\[([\s\S]*?)]()()()()()/g,n),e=e.replace(/!\[([^\]]*?)][ \t]*()\([ \t]??(?: =([*\d]+[A-Za-z%]{0,4})x([*\d]+[A-Za-z%]{0,4}))?[ \t]*(?:(["'])([^"]*?)\6)?[ \t]?\)/g,function(e,r,t,a,s,o,i,l){return a=a.replace(/\s/g,""),n(e,r,t,a,s,o,0,l)}),e=e.replace(/!\[([^\]]*?)][ \t]*()\([ \t]?<([^>]*)>(?: =([*\d]+[A-Za-z%]{0,4})x([*\d]+[A-Za-z%]{0,4}))?[ \t]*(?:(?:(["'])([^"]*?)\6))?[ \t]?\)/g,n),e=e.replace(/!\[([^\]]*?)][ \t]*()\([ \t]??(?: =([*\d]+[A-Za-z%]{0,4})x([*\d]+[A-Za-z%]{0,4}))?[ \t]*(?:(["'])([^"]*?)\6)?[ \t]?\)/g,n),e=e.replace(/!\[([^\[\]]+)]()()()()()/g,n),e=t.converter._dispatch("images.after",e,r,t)}),a.subParser("italicsAndBold",function(e,r,t){"use strict";function a(e,r,t){return r+e+t}return e=t.converter._dispatch("italicsAndBold.before",e,r,t),e=r.literalMidWordUnderscores?(e=(e=e.replace(/\b___(\S[\s\S]*?)___\b/g,function(e,r){return a(r,"","")})).replace(/\b__(\S[\s\S]*?)__\b/g,function(e,r){return a(r,"","")})).replace(/\b_(\S[\s\S]*?)_\b/g,function(e,r){return a(r,"","")}):(e=(e=e.replace(/___(\S[\s\S]*?)___/g,function(e,r){return/\S$/.test(r)?a(r,"",""):e})).replace(/__(\S[\s\S]*?)__/g,function(e,r){return/\S$/.test(r)?a(r,"",""):e})).replace(/_([^\s_][\s\S]*?)_/g,function(e,r){return/\S$/.test(r)?a(r,"",""):e}),e=r.literalMidWordAsterisks?(e=(e=e.replace(/([^*]|^)\B\*\*\*(\S[\s\S]*?)\*\*\*\B(?!\*)/g,function(e,r,t){return a(t,r+"","")})).replace(/([^*]|^)\B\*\*(\S[\s\S]*?)\*\*\B(?!\*)/g,function(e,r,t){return a(t,r+"","")})).replace(/([^*]|^)\B\*(\S[\s\S]*?)\*\B(?!\*)/g,function(e,r,t){return a(t,r+"","")}):(e=(e=e.replace(/\*\*\*(\S[\s\S]*?)\*\*\*/g,function(e,r){return/\S$/.test(r)?a(r,"",""):e})).replace(/\*\*(\S[\s\S]*?)\*\*/g,function(e,r){return/\S$/.test(r)?a(r,"",""):e})).replace(/\*([^\s*][\s\S]*?)\*/g,function(e,r){return/\S$/.test(r)?a(r,"",""):e}),e=t.converter._dispatch("italicsAndBold.after",e,r,t)}),a.subParser("lists",function(e,r,t){"use strict";function n(e,n){t.gListLevel++,e=e.replace(/\n{2,}$/,"\n");var s=/(\n)?(^ {0,3})([*+-]|\d+[.])[ \t]+((\[(x|X| )?])?[ \t]*[^\r]+?(\n{1,2}))(?=\n*(¨0| {0,3}([*+-]|\d+[.])[ \t]+))/gm,o=/\n[ \t]*\n(?!¨0)/.test(e+="¨0");return r.disableForced4SpacesIndentedSublists&&(s=/(\n)?(^ {0,3})([*+-]|\d+[.])[ \t]+((\[(x|X| )?])?[ \t]*[^\r]+?(\n{1,2}))(?=\n*(¨0|\2([*+-]|\d+[.])[ \t]+))/gm),e=e.replace(s,function(e,n,s,i,l,c,u){u=u&&""!==u.trim();var d=a.subParser("outdent")(l,r,t),p="";return c&&r.tasklists&&(p=' class="task-list-item" style="list-style-type: none;"',d=d.replace(/^[ \t]*\[(x|X| )?]/m,function(){var e='-1?(d=a.subParser("githubCodeBlocks")(d,r,t),d=a.subParser("blockGamut")(d,r,t)):(d=(d=a.subParser("lists")(d,r,t)).replace(/\n$/,""),d=(d=a.subParser("hashHTMLBlocks")(d,r,t)).replace(/\n\n+/g,"\n\n"),d=o?a.subParser("paragraphs")(d,r,t):a.subParser("spanGamut")(d,r,t)),d=d.replace("¨A",""),d=""+d+"\n"}),e=e.replace(/¨0/g,""),t.gListLevel--,n&&(e=e.replace(/\s+$/,"")),e}function s(e,r){if("ol"===r){var t=e.match(/^ *(\d+)\./);if(t&&"1"!==t[1])return' start="'+t[1]+'"'}return""}function o(e,t,a){var o=r.disableForced4SpacesIndentedSublists?/^ ?\d+\.[ \t]/gm:/^ {0,3}\d+\.[ \t]/gm,i=r.disableForced4SpacesIndentedSublists?/^ ?[*+-][ \t]/gm:/^ {0,3}[*+-][ \t]/gm,l="ul"===t?o:i,c="";if(-1!==e.search(l))!function r(u){var d=u.search(l),p=s(e,t);-1!==d?(c+="\n\n<"+t+p+">\n"+n(u.slice(0,d),!!a)+"\n",l="ul"===(t="ul"===t?"ol":"ul")?o:i,r(u.slice(d))):c+="\n\n<"+t+p+">\n"+n(u,!!a)+"\n"}(e);else{var u=s(e,t);c="\n\n<"+t+u+">\n"+n(e,!!a)+"\n"}return c}return e=t.converter._dispatch("lists.before",e,r,t),e+="¨0",e=t.gListLevel?e.replace(/^(( {0,3}([*+-]|\d+[.])[ \t]+)[^\r]+?(¨0|\n{2,}(?=\S)(?![ \t]*(?:[*+-]|\d+[.])[ \t]+)))/gm,function(e,r,t){return o(r,t.search(/[*+-]/g)>-1?"ul":"ol",!0)}):e.replace(/(\n\n|^\n?)(( {0,3}([*+-]|\d+[.])[ \t]+)[^\r]+?(¨0|\n{2,}(?=\S)(?![ \t]*(?:[*+-]|\d+[.])[ \t]+)))/gm,function(e,r,t,a){return o(t,a.search(/[*+-]/g)>-1?"ul":"ol",!1)}),e=e.replace(/¨0/,""),e=t.converter._dispatch("lists.after",e,r,t)}),a.subParser("metadata",function(e,r,t){"use strict";function a(e){t.metadata.raw=e,(e=(e=e.replace(/&/g,"&").replace(/"/g,""")).replace(/\n {4}/g," ")).replace(/^([\S ]+): +([\s\S]+?)$/gm,function(e,r,a){return t.metadata.parsed[r]=a,""})}return r.metadata?(e=t.converter._dispatch("metadata.before",e,r,t),e=e.replace(/^\s*«««+(\S*?)\n([\s\S]+?)\n»»»+\n/,function(e,r,t){return a(t),"¨M"}),e=e.replace(/^\s*---+(\S*?)\n([\s\S]+?)\n---+\n/,function(e,r,n){return r&&(t.metadata.format=r),a(n),"¨M"}),e=e.replace(/¨M/g,""),e=t.converter._dispatch("metadata.after",e,r,t)):e}),a.subParser("outdent",function(e,r,t){"use strict";return e=t.converter._dispatch("outdent.before",e,r,t),e=e.replace(/^(\t|[ ]{1,4})/gm,"¨0"),e=e.replace(/¨0/g,""),e=t.converter._dispatch("outdent.after",e,r,t)}),a.subParser("paragraphs",function(e,r,t){"use strict";for(var n=(e=(e=(e=t.converter._dispatch("paragraphs.before",e,r,t)).replace(/^\n+/g,"")).replace(/\n+$/g,"")).split(/\n{2,}/g),s=[],o=n.length,i=0;i=0?s.push(l):l.search(/\S/)>=0&&(l=(l=a.subParser("spanGamut")(l,r,t)).replace(/^([ \t]*)/g,"

"),l+="

",s.push(l))}for(o=s.length,i=0;i]*>\s*]*>/.test(u)&&(d=!0)}s[i]=u}return e=s.join("\n"),e=e.replace(/^\n+/g,""),e=e.replace(/\n+$/g,""),t.converter._dispatch("paragraphs.after",e,r,t)}),a.subParser("runExtension",function(e,r,t,a){"use strict";if(e.filter)r=e.filter(r,a.converter,t);else if(e.regex){var n=e.regex;n instanceof RegExp||(n=new RegExp(n,"g")),r=r.replace(n,e.replace)}return r}),a.subParser("spanGamut",function(e,r,t){"use strict";return e=t.converter._dispatch("spanGamut.before",e,r,t),e=a.subParser("codeSpans")(e,r,t),e=a.subParser("escapeSpecialCharsWithinTagAttributes")(e,r,t),e=a.subParser("encodeBackslashEscapes")(e,r,t),e=a.subParser("images")(e,r,t),e=a.subParser("anchors")(e,r,t),e=a.subParser("autoLinks")(e,r,t),e=a.subParser("simplifiedAutoLinks")(e,r,t),e=a.subParser("emoji")(e,r,t),e=a.subParser("underline")(e,r,t),e=a.subParser("italicsAndBold")(e,r,t),e=a.subParser("strikethrough")(e,r,t),e=a.subParser("ellipsis")(e,r,t),e=a.subParser("hashHTMLSpans")(e,r,t),e=a.subParser("encodeAmpsAndAngles")(e,r,t),r.simpleLineBreaks?/\n\n¨K/.test(e)||(e=e.replace(/\n+/g,"
\n")):e=e.replace(/ +\n/g,"
\n"),e=t.converter._dispatch("spanGamut.after",e,r,t)}),a.subParser("strikethrough",function(e,r,t){"use strict";return r.strikethrough&&(e=(e=t.converter._dispatch("strikethrough.before",e,r,t)).replace(/(?:~){2}([\s\S]+?)(?:~){2}/g,function(e,n){return function(e){return r.simplifiedAutoLink&&(e=a.subParser("simplifiedAutoLinks")(e,r,t)),""+e+""}(n)}),e=t.converter._dispatch("strikethrough.after",e,r,t)),e}),a.subParser("stripLinkDefinitions",function(e,r,t){"use strict";var n=function(e,n,s,o,i,l,c){return n=n.toLowerCase(),s.match(/^data:.+?\/.+?;base64,/)?t.gUrls[n]=s.replace(/\s/g,""):t.gUrls[n]=a.subParser("encodeAmpsAndAngles")(s,r,t),l?l+c:(c&&(t.gTitles[n]=c.replace(/"|'/g,""")),r.parseImgDimensions&&o&&i&&(t.gDimensions[n]={width:o,height:i}),"")};return e=(e+="¨0").replace(/^ {0,3}\[(.+)]:[ \t]*\n?[ \t]*?(?: =([*\d]+[A-Za-z%]{0,4})x([*\d]+[A-Za-z%]{0,4}))?[ \t]*\n?[ \t]*(?:(\n*)["|'(](.+?)["|')][ \t]*)?(?:\n\n|(?=¨0)|(?=\n\[))/gm,n),e=e.replace(/^ {0,3}\[(.+)]:[ \t]*\n?[ \t]*\s]+)>?(?: =([*\d]+[A-Za-z%]{0,4})x([*\d]+[A-Za-z%]{0,4}))?[ \t]*\n?[ \t]*(?:(\n*)["|'(](.+?)["|')][ \t]*)?(?:\n+|(?=¨0))/gm,n),e=e.replace(/¨0/,"")}),a.subParser("tables",function(e,r,t){"use strict";function n(e){return/^:[ \t]*--*$/.test(e)?' style="text-align:left;"':/^--*[ \t]*:[ \t]*$/.test(e)?' style="text-align:right;"':/^:[ \t]*--*[ \t]*:$/.test(e)?' style="text-align:center;"':""}function s(e,n){var s="";return e=e.trim(),(r.tablesHeaderId||r.tableHeaderId)&&(s=' id="'+e.replace(/ /g,"_").toLowerCase()+'"'),e=a.subParser("spanGamut")(e,r,t),""+e+"\n"}function o(e,n){return""+a.subParser("spanGamut")(e,r,t)+"\n"}function i(e){var i,l=e.split("\n");for(i=0;i\n\n\n",n=0;n\n";for(var s=0;s\n"}return t+="\n\n"}(p,_)}if(!r.tables)return e;return e=t.converter._dispatch("tables.before",e,r,t),e=e.replace(/\\(\|)/g,a.helper.escapeCharactersCallback),e=e.replace(/^ {0,3}\|?.+\|.+\n {0,3}\|?[ \t]*:?[ \t]*(?:[-=]){2,}[ \t]*:?[ \t]*\|[ \t]*:?[ \t]*(?:[-=]){2,}[\s\S]+?(?:\n\n|¨0)/gm,i),e=e.replace(/^ {0,3}\|.+\|[ \t]*\n {0,3}\|[ \t]*:?[ \t]*(?:[-=]){2,}[ \t]*:?[ \t]*\|[ \t]*\n( {0,3}\|.+\|[ \t]*\n)*(?:\n|¨0)/gm,i),e=t.converter._dispatch("tables.after",e,r,t)}),a.subParser("underline",function(e,r,t){"use strict";return r.underline?(e=t.converter._dispatch("underline.before",e,r,t),e=r.literalMidWordUnderscores?(e=e.replace(/\b___(\S[\s\S]*?)___\b/g,function(e,r){return""+r+""})).replace(/\b__(\S[\s\S]*?)__\b/g,function(e,r){return""+r+""}):(e=e.replace(/___(\S[\s\S]*?)___/g,function(e,r){return/\S$/.test(r)?""+r+"":e})).replace(/__(\S[\s\S]*?)__/g,function(e,r){return/\S$/.test(r)?""+r+"":e}),e=e.replace(/(_)/g,a.helper.escapeCharactersCallback),e=t.converter._dispatch("underline.after",e,r,t)):e}),a.subParser("unescapeSpecialChars",function(e,r,t){"use strict";return e=t.converter._dispatch("unescapeSpecialChars.before",e,r,t),e=e.replace(/¨E(\d+)E/g,function(e,r){var t=parseInt(r);return String.fromCharCode(t)}),e=t.converter._dispatch("unescapeSpecialChars.after",e,r,t)}),a.subParser("makeMarkdown.blockquote",function(e,r){"use strict";var t="";if(e.hasChildNodes())for(var n=e.childNodes,s=n.length,o=0;o "+t.split("\n").join("\n> ")}),a.subParser("makeMarkdown.codeBlock",function(e,r){"use strict";var t=e.getAttribute("language"),a=e.getAttribute("precodenum");return"```"+t+"\n"+r.preList[a]+"\n```"}),a.subParser("makeMarkdown.codeSpan",function(e){"use strict";return"`"+e.innerHTML+"`"}),a.subParser("makeMarkdown.emphasis",function(e,r){"use strict";var t="";if(e.hasChildNodes()){t+="*";for(var n=e.childNodes,s=n.length,o=0;o",e.hasAttribute("width")&&e.hasAttribute("height")&&(r+=" ="+e.getAttribute("width")+"x"+e.getAttribute("height")),e.hasAttribute("title")&&(r+=' "'+e.getAttribute("title")+'"'),r+=")"),r}),a.subParser("makeMarkdown.links",function(e,r){"use strict";var t="";if(e.hasChildNodes()&&e.hasAttribute("href")){var n=e.childNodes,s=n.length;t="[";for(var o=0;o",e.hasAttribute("title")&&(t+=' "'+e.getAttribute("title")+'"'),t+=")"}return t}),a.subParser("makeMarkdown.list",function(e,r,t){"use strict";var n="";if(!e.hasChildNodes())return"";for(var s=e.childNodes,o=s.length,i=e.getAttribute("start")||1,l=0;l"+r.preList[t]+""}),a.subParser("makeMarkdown.strikethrough",function(e,r){"use strict";var t="";if(e.hasChildNodes()){t+="~~";for(var n=e.childNodes,s=n.length,o=0;otr>th"),l=e.querySelectorAll("tbody>tr");for(t=0;t_&&(_=g)}for(t=0;t/g,"\\$1>"),r=r.replace(/^#/gm,"\\#"),r=r.replace(/^(\s*)([-=]{3,})(\s*)$/,"$1\\$2$3"),r=r.replace(/^( {0,3}\d+)\./gm,"$1\\."),r=r.replace(/^( {0,3})([+-])/gm,"$1\\$2"),r=r.replace(/]([\s]*)\(/g,"\\]$1\\("),r=r.replace(/^ {0,3}\[([\S \t]*?)]:/gm,"\\[$1]:")});"function"==typeof define&&define.amd?define(function(){"use strict";return a}):"undefined"!=typeof module&&module.exports?module.exports=a:this.showdown=a}).call(this); +//# sourceMappingURL=showdown.min.js.map diff --git a/src/vender/puread/puread.js b/src/vender/puread/puread.js index ec5e013b..1a9d2894 100644 --- a/src/vender/puread/puread.js +++ b/src/vender/puread/puread.js @@ -34,9 +34,11 @@ export default class PureRead extends AdapteSite { beautify : plugin.beautify, stylesheet: plugin.style, rdability : plugin.rdability, + markdown : plugin.markdown, }; super.SetMinimatch( this.plugin.minimatch ); super.SetRdability( this.plugin.rdability ); + super.SetMarkdown( this.plugin.markdown ); } /** From 9af020c6d96490e238e6f140e75ca16f9fac4dc4 Mon Sep 17 00:00:00 2001 From: Kenshin Date: Fri, 5 Apr 2019 12:54:08 +0800 Subject: [PATCH 02/43] Add mdStyle(). --- src/service/stylesheet.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/service/stylesheet.js b/src/service/stylesheet.js index 8591c44c..547d0c4d 100644 --- a/src/service/stylesheet.js +++ b/src/service/stylesheet.js @@ -174,6 +174,16 @@ function preview( styles ) { css( "css", styles["css"] ); } +/** + * Add markdown css to for read mode + * + */ +function mdStyle() { + const styles = 'sr-rd-content{line-height:initial!important}sr-rd-content h1,sr-rd-content h2,sr-rd-content h3,sr-rd-content h4,sr-rd-content h5{margin:0!important;padding:0!important}sr-rd-content p{margin:0!important}sr-rd-content ol,sr-rd-content ul{margin-bottom:0!important;line-height:0!important}sr-rd-content sr-blockquote{padding-top:0!important;padding-bottom:0!important;line-height:.5}sr-rd-content sr-blockquote *{line-height:1.8!important}sr-rd-content ol li,sr-rd-content ol li *,sr-rd-content ul li,sr-rd-content ul li *{line-height:initial!important}'; + $( "head" ).find( "#simpread-custom-markdown" ).length == 0 && + $( "head" ).append(``); +} + /** * Verify custom is exist * @@ -210,4 +220,5 @@ export { custom as Custom, css as CSS, vfyCustom as VerifyCustom, + mdStyle as MDStyle, } \ No newline at end of file From 9ebb9ee4f1e7c9b04d6eb85ba7bc9a79be3f45b4 Mon Sep 17 00:00:00 2001 From: Kenshin Date: Fri, 5 Apr 2019 12:54:40 +0800 Subject: [PATCH 03/43] Add markdown read mode css logic. --- src/read/read.jsx | 1 + 1 file changed, 1 insertion(+) diff --git a/src/read/read.jsx b/src/read/read.jsx index 2f664c75..45f6fd34 100644 --- a/src/read/read.jsx +++ b/src/read/read.jsx @@ -109,6 +109,7 @@ class Read extends React.Component { loadPlugins( "read_complete" ); + storage.pr.state == "txt" && location.href.endsWith( ".md" ) && ss.MDStyle(); localStorage.removeItem( "sr-update-site" ); } } From bd8c808e5c5f1becdc1efd01c7bd08a5a3bb5afb Mon Sep 17 00:00:00 2001 From: Kenshin Date: Fri, 5 Apr 2019 12:55:49 +0800 Subject: [PATCH 04/43] Fix localStorage is undefined bug. --- src/read/read.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/read/read.jsx b/src/read/read.jsx index 45f6fd34..1879c576 100644 --- a/src/read/read.jsx +++ b/src/read/read.jsx @@ -110,7 +110,7 @@ class Read extends React.Component { loadPlugins( "read_complete" ); storage.pr.state == "txt" && location.href.endsWith( ".md" ) && ss.MDStyle(); - localStorage.removeItem( "sr-update-site" ); + localStorage && localStorage.removeItem( "sr-update-site" ); } } From 53794ba55619dd091232bd3120bedb8037bf6aa6 Mon Sep 17 00:00:00 2001 From: Kenshin Date: Fri, 5 Apr 2019 14:01:37 +0800 Subject: [PATCH 05/43] Format source. --- src/service/stylesheet.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/service/stylesheet.js b/src/service/stylesheet.js index 547d0c4d..760384fa 100644 --- a/src/service/stylesheet.js +++ b/src/service/stylesheet.js @@ -179,7 +179,7 @@ function preview( styles ) { * */ function mdStyle() { - const styles = 'sr-rd-content{line-height:initial!important}sr-rd-content h1,sr-rd-content h2,sr-rd-content h3,sr-rd-content h4,sr-rd-content h5{margin:0!important;padding:0!important}sr-rd-content p{margin:0!important}sr-rd-content ol,sr-rd-content ul{margin-bottom:0!important;line-height:0!important}sr-rd-content sr-blockquote{padding-top:0!important;padding-bottom:0!important;line-height:.5}sr-rd-content sr-blockquote *{line-height:1.8!important}sr-rd-content ol li,sr-rd-content ol li *,sr-rd-content ul li,sr-rd-content ul li *{line-height:initial!important}'; + const styles = 'sr-rd-content{line-height:initial!important}sr-rd-content h1,sr-rd-content h2,sr-rd-content h3,sr-rd-content h4,sr-rd-content h5{margin:0!important;padding:0!important}sr-rd-content p{margin:0!important}sr-rd-content ol,sr-rd-content ul{margin-bottom:0!important;line-height:0!important}sr-rd-content sr-blockquote{padding-top:0!important;padding-bottom:0!important;line-height:.5}sr-rd-content sr-blockquote *{line-height:1.8!important}sr-rd-content ol li,sr-rd-content ol li *,sr-rd-content ul li,sr-rd-content ul li *{}'; $( "head" ).find( "#simpread-custom-markdown" ).length == 0 && $( "head" ).append(``); } From bf54b059ef3a6e1e5452aea7b2348c7e9d2cb484 Mon Sep 17 00:00:00 2001 From: Kenshin Date: Fri, 5 Apr 2019 14:18:00 +0800 Subject: [PATCH 06/43] Format source. --- src/read/read.jsx | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/read/read.jsx b/src/read/read.jsx index 1879c576..77dc5530 100644 --- a/src/read/read.jsx +++ b/src/read/read.jsx @@ -79,12 +79,12 @@ class Read extends React.Component { localStorage.removeItem( "sr-update-site" ); } else { $root - .addClass( "simpread-font" ) - .addClass( theme ) - .find( rdclsjq ) + .addClass( "simpread-font" ) .addClass( theme ) - .sreffect( { opacity: 1 }, { delay: 100 }) - .addClass( "simpread-read-root-show" ); + .find( rdclsjq ) + .addClass( theme ) + .sreffect( { opacity: 1 }, { delay: 100 }) + .addClass( "simpread-read-root-show" ); this.props.read.fontfamily && ss.FontFamily( this.props.read.fontfamily ); this.props.read.fontsize && ss.FontSize( this.props.read.fontsize ); From 3358bc0ac658023aca34709956e20accf4b38343 Mon Sep 17 00:00:00 2001 From: Kenshin Date: Fri, 5 Apr 2019 14:19:21 +0800 Subject: [PATCH 07/43] Format source. --- src/read/read.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/read/read.jsx b/src/read/read.jsx index 77dc5530..c16c663e 100644 --- a/src/read/read.jsx +++ b/src/read/read.jsx @@ -92,6 +92,7 @@ class Read extends React.Component { ss.Preview( this.props.read.custom ); storage.pr.state == "txt" && $( "sr-rd-content" ).css({ "word-wrap": "break-word", "white-space": "pre-wrap" }); + storage.pr.state == "txt" && location.href.endsWith( ".md" ) && ss.MDStyle(); storage.pr.current.site.desc == "" && $( "sr-rd-desc" ).addClass( "simpread-hidden" ); excludes( $("sr-rd-content"), this.props.wrapper.exclude ); @@ -109,7 +110,6 @@ class Read extends React.Component { loadPlugins( "read_complete" ); - storage.pr.state == "txt" && location.href.endsWith( ".md" ) && ss.MDStyle(); localStorage && localStorage.removeItem( "sr-update-site" ); } } From 29e4cedd83b7b5da2f7a7722a130fc3c12b7e893 Mon Sep 17 00:00:00 2001 From: Kenshin Date: Fri, 5 Apr 2019 14:21:33 +0800 Subject: [PATCH 08/43] Format source. --- src/read/read.jsx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/read/read.jsx b/src/read/read.jsx index c16c663e..68e9c3dc 100644 --- a/src/read/read.jsx +++ b/src/read/read.jsx @@ -89,6 +89,10 @@ class Read extends React.Component { this.props.read.fontfamily && ss.FontFamily( this.props.read.fontfamily ); this.props.read.fontsize && ss.FontSize( this.props.read.fontsize ); this.props.read.layout && ss.Layout( this.props.read.layout ); + this.props.read.site.css && this.props.read.site.css.length > 0 + && ss.SiteCSS( this.props.read.site.css ); + !this.props.wrapper.avatar && this.props.read.toc + && toc.Render( "sr-read", $( "sr-rd-content" ), this.props.read.theme, this.props.read.toc_hide ); ss.Preview( this.props.read.custom ); storage.pr.state == "txt" && $( "sr-rd-content" ).css({ "word-wrap": "break-word", "white-space": "pre-wrap" }); @@ -99,10 +103,6 @@ class Read extends React.Component { storage.pr.Beautify( $( "sr-rd-content" ) ); storage.pr.Format( rdcls ); - !this.props.wrapper.avatar && this.props.read.toc && toc.Render( "sr-read", $( "sr-rd-content" ), this.props.read.theme, this.props.read.toc_hide ); - this.props.read.site.css && this.props.read.site.css.length > 0 && - ss.SiteCSS( this.props.read.site.css ); - kbd.Render( $( "sr-rd-content" )); tooltip.Render( rdclsjq ); waves.Render({ root: rdclsjq }); From dfbb26ce12c38736c30afb6876fa37ad192dfa1e Mon Sep 17 00:00:00 2001 From: Kenshin Date: Fri, 5 Apr 2019 14:21:45 +0800 Subject: [PATCH 09/43] Format source. --- src/read/read.jsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/read/read.jsx b/src/read/read.jsx index 68e9c3dc..e19c5d5a 100644 --- a/src/read/read.jsx +++ b/src/read/read.jsx @@ -95,8 +95,8 @@ class Read extends React.Component { && toc.Render( "sr-read", $( "sr-rd-content" ), this.props.read.theme, this.props.read.toc_hide ); ss.Preview( this.props.read.custom ); - storage.pr.state == "txt" && $( "sr-rd-content" ).css({ "word-wrap": "break-word", "white-space": "pre-wrap" }); - storage.pr.state == "txt" && location.href.endsWith( ".md" ) && ss.MDStyle(); + storage.pr.state == "txt" && $( "sr-rd-content" ).css({ "word-wrap": "break-word", "white-space": "pre-wrap" }); + storage.pr.state == "txt" && location.href.endsWith( ".md" ) && ss.MDStyle(); storage.pr.current.site.desc == "" && $( "sr-rd-desc" ).addClass( "simpread-hidden" ); excludes( $("sr-rd-content"), this.props.wrapper.exclude ); From 16e9cb9aa3e5ad8e067e3391d514bfcd66537b91 Mon Sep 17 00:00:00 2001 From: Kenshin Date: Fri, 5 Apr 2019 16:17:31 +0800 Subject: [PATCH 10/43] Fix image inline bug. --- src/assets/css/theme_common.css | 11 +++++++++++ src/vender/puread/plugin/beautify.js | 7 ++++--- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/src/assets/css/theme_common.css b/src/assets/css/theme_common.css index 7dcb8519..51cff5e2 100644 --- a/src/assets/css/theme_common.css +++ b/src/assets/css/theme_common.css @@ -217,6 +217,17 @@ sr-rd-content p code { -webkit-box-orient: vertical; } +.sr-rd-content-center-small { + display: inline-flex; +} + +.sr-rd-content-center-small img { + margin: 0; + padding: 0; + border: 0; + box-shadow: none; +} + .sr-rd-content-nobeautify { margin: 0; padding: 0; diff --git a/src/vender/puread/plugin/beautify.js b/src/vender/puread/plugin/beautify.js index 9d724536..d8bf0b71 100644 --- a/src/vender/puread/plugin/beautify.js +++ b/src/vender/puread/plugin/beautify.js @@ -315,10 +315,11 @@ function commbeautify( name, $target ) { sina = $target.attr( "real_src" ), fixOverflowImgsize = () => { $img.removeClass( "sr-rd-content-img-load" ); - if ( $img[0].clientWidth > 1000 ) { + if ( $img[0].clientWidth < 400 ) { + $img.parent().removeClass( "sr-rd-content-center" ).addClass( "sr-rd-content-center-small" ); + } else if ( $img[0].clientWidth > 1000 ) { $img.css( "zoom", "0.6" ); - } - else if ( $img[0].clientHeight > 620 ) { + } else if ( $img[0].clientHeight > 620 ) { if ( /win|mac/i.test(navigator.platform) ) { $img.attr( "height", 620 ); if ( $img[0].clientWidth < $("sr-rd-content").width()) $img.css({ "width":"auto" }); From 9a4af9921e80a76166306cd84fbc8b9a375bfc48 Mon Sep 17 00:00:00 2001 From: Kenshin Date: Fri, 5 Apr 2019 16:19:56 +0800 Subject: [PATCH 11/43] Optimize markdown read mode logic. --- src/read/read.jsx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/read/read.jsx b/src/read/read.jsx index e19c5d5a..8a2eff75 100644 --- a/src/read/read.jsx +++ b/src/read/read.jsx @@ -95,8 +95,7 @@ class Read extends React.Component { && toc.Render( "sr-read", $( "sr-rd-content" ), this.props.read.theme, this.props.read.toc_hide ); ss.Preview( this.props.read.custom ); - storage.pr.state == "txt" && $( "sr-rd-content" ).css({ "word-wrap": "break-word", "white-space": "pre-wrap" }); - storage.pr.state == "txt" && location.href.endsWith( ".md" ) && ss.MDStyle(); + storage.pr.state == "txt" && !location.href.endsWith( ".md" ) && $( "sr-rd-content" ).css({ "word-wrap": "break-word", "white-space": "pre-wrap" }); storage.pr.current.site.desc == "" && $( "sr-rd-desc" ).addClass( "simpread-hidden" ); excludes( $("sr-rd-content"), this.props.wrapper.exclude ); From ab7accfe2f9a73bdd9d7dfdf4b1a0efe417e34bb Mon Sep 17 00:00:00 2001 From: Kenshin Date: Fri, 5 Apr 2019 16:20:30 +0800 Subject: [PATCH 12/43] Remove old source. --- src/service/stylesheet.js | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/src/service/stylesheet.js b/src/service/stylesheet.js index 760384fa..8591c44c 100644 --- a/src/service/stylesheet.js +++ b/src/service/stylesheet.js @@ -174,16 +174,6 @@ function preview( styles ) { css( "css", styles["css"] ); } -/** - * Add markdown css to for read mode - * - */ -function mdStyle() { - const styles = 'sr-rd-content{line-height:initial!important}sr-rd-content h1,sr-rd-content h2,sr-rd-content h3,sr-rd-content h4,sr-rd-content h5{margin:0!important;padding:0!important}sr-rd-content p{margin:0!important}sr-rd-content ol,sr-rd-content ul{margin-bottom:0!important;line-height:0!important}sr-rd-content sr-blockquote{padding-top:0!important;padding-bottom:0!important;line-height:.5}sr-rd-content sr-blockquote *{line-height:1.8!important}sr-rd-content ol li,sr-rd-content ol li *,sr-rd-content ul li,sr-rd-content ul li *{}'; - $( "head" ).find( "#simpread-custom-markdown" ).length == 0 && - $( "head" ).append(``); -} - /** * Verify custom is exist * @@ -220,5 +210,4 @@ export { custom as Custom, css as CSS, vfyCustom as VerifyCustom, - mdStyle as MDStyle, } \ No newline at end of file From 32d2ecce03c1344e08d375af3104d1eea1fcd654 Mon Sep 17 00:00:00 2001 From: Kenshin Date: Fri, 5 Apr 2019 16:31:16 +0800 Subject: [PATCH 13/43] Fix parse MD some bug. --- src/read/controlbar.jsx | 30 +++++++++++++++++------------- src/read/read.jsx | 2 +- 2 files changed, 18 insertions(+), 14 deletions(-) diff --git a/src/read/controlbar.jsx b/src/read/controlbar.jsx index 3e4d66df..807e8c19 100644 --- a/src/read/controlbar.jsx +++ b/src/read/controlbar.jsx @@ -126,19 +126,23 @@ export default class ReadCtlbar extends React.Component { } componentWillMount() { - if ( storage.current.fap ) { - delete conf.readItems.exit; - delete conf.readItems.option.items.setting; - } - if ( this.props.type.startsWith( "txtread::" ) && this.props.type.endsWith( "::local" )) { - delete conf.readItems.download; - delete conf.readItems.readlater; - delete conf.readItems.send; - delete conf.readItems.share; - delete conf.readItems.option; - } - if ( this.props.type.startsWith( "metaread::" ) || this.props.type.startsWith( "txtread::" ) ) { - delete conf.readItems.option; + try { + if ( storage.current.fap ) { + delete conf.readItems.exit; + delete conf.readItems.option.items.setting; + } + if ( this.props.type.startsWith( "txtread::" ) && this.props.type.endsWith( "::local" )) { + delete conf.readItems.download; + delete conf.readItems.readlater; + delete conf.readItems.send; + delete conf.readItems.share; + delete conf.readItems.option; + } + if ( this.props.type.startsWith( "metaread::" ) || this.props.type.startsWith( "txtread::" ) ) { + delete conf.readItems.option; + } + } catch ( err ) { + // TO-DO } // hack code !/chrome/ig.test( navigator.userAgent ) && ( delete conf.readItems.dyslexia ); diff --git a/src/read/read.jsx b/src/read/read.jsx index 8a2eff75..fce4a992 100644 --- a/src/read/read.jsx +++ b/src/read/read.jsx @@ -109,7 +109,7 @@ class Read extends React.Component { loadPlugins( "read_complete" ); - localStorage && localStorage.removeItem( "sr-update-site" ); + //localStorage.removeItem( "sr-update-site" ); } } From 2ef778fa0b5ce268f14d5836289cce8e82083085 Mon Sep 17 00:00:00 2001 From: Kenshin Date: Fri, 5 Apr 2019 16:35:24 +0800 Subject: [PATCH 14/43] Format source. --- src/read/read.jsx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/read/read.jsx b/src/read/read.jsx index fce4a992..777b6bdc 100644 --- a/src/read/read.jsx +++ b/src/read/read.jsx @@ -54,6 +54,7 @@ class Read extends React.Component { async componentDidMount() { if ( $root.find( "sr-rd-content-error" ).length > 0 ) { + // Puread level to III,can't work this flow. this.componentWillUnmount(); if ( ! localStorage["sr-update-site"] ) { new Notify().Render({ content: "当前页面结构改变导致不匹配阅读模式,接下来请选择?", action: "更新", cancel: "高亮", callback: type => { @@ -109,6 +110,7 @@ class Read extends React.Component { loadPlugins( "read_complete" ); + // Puread level to III,can't work this flow. //localStorage.removeItem( "sr-update-site" ); } } From 2e2b4d4f7fb8e7052e0d34ac28d59797414c8245 Mon Sep 17 00:00:00 2001 From: Kenshin Date: Sat, 13 Apr 2019 16:42:02 +0800 Subject: [PATCH 15/43] Update puread version to '0.0.4 build 0413'. --- src/vender/puread/adaptesite.js | 33 +++++++++++++++++++++------- src/vender/puread/plugin/beautify.js | 18 ++++++++++++--- src/vender/puread/puread.js | 2 +- src/vender/puread/util.js | 26 ++++++++++++++++++++++ 4 files changed, 67 insertions(+), 12 deletions(-) diff --git a/src/vender/puread/adaptesite.js b/src/vender/puread/adaptesite.js index c1677446..faf2ccd7 100644 --- a/src/vender/puread/adaptesite.js +++ b/src/vender/puread/adaptesite.js @@ -14,7 +14,7 @@ const site = { avatar : [], paging : [], }; -let minimatch, rdability, markdown; +let minimatch, rdability, markdown, current_url; export default class AdapteSite { @@ -24,6 +24,22 @@ export default class AdapteSite { this.current = {}; this.state = "none"; // include: meta, txt, adapter, none, temp this.origins = []; + current_url = this.url;// origin url not changed + } + + /** + * Set url + */ + SetURL( value ) { + const uri = util.getLocation( value ); + // Clone util.getURI() source + const name = (pathname) => { + pathname = pathname != "/" && pathname.endsWith("/") ? pathname = pathname.replace( /\/$/, "" ) : pathname; + return pathname.replace( /\/[%@#.~a-zA-Z0-9_-]+$|^\/$/g, "" ); + }, + path = name( uri.pathname ); + this.url = `${ uri.protocol }//${ uri.hostname }${ path }/`; + current_url = value; } /** @@ -54,10 +70,10 @@ export default class AdapteSite { try { const location = document.location, uri = { - spec: location.href, - host: location.host, - prePath: location.protocol + "//" + location.host, - scheme: location.protocol.substr(0, location.protocol.indexOf(":")), + spec : location.href, + host : location.host, + prePath : location.protocol + "//" + location.host, + scheme : location.protocol.substr(0, location.protocol.indexOf(":")), pathBase: location.protocol + "//" + location.host + location.pathname.substr(0, location.pathname.lastIndexOf("/") + 1) }, article = new rdability.Readability( uri, document.cloneNode(true) ).parse(); @@ -522,11 +538,12 @@ function getsite( type, sites, url, matching = [] ) { return names.replace( "www.", "" ); } }, + local = util.getLocation( current_url ), urls = [ ...sites.keys() ], arr = url.match( /[.a-zA-z0-9-_]+/g ), uri = arr[1].replace( "www.", "" ), - hostname = domain( window.location.hostname ), - isroot = ()=>window.location.pathname == "/" || /\/(default|index|portal).[0-9a-zA-Z]+$/.test(window.location.pathname); + hostname = domain( local.hostname ), + isroot = ()=>local.pathname == "/" || /\/(default|index|portal).[0-9a-zA-Z]+$/.test(local.pathname); for ( const cur of urls ) { const name = sites.get(cur).name, sufname= domain( name ); @@ -535,7 +552,7 @@ function getsite( type, sites, url, matching = [] ) { } else if ( cur.match( /\*/g ) && cur.match( /\*/g ).length == 1 && !isroot() && cur.endsWith( "*" ) && uri.includes( sufname ) && hostname == sufname && url.includes( name ) ) { // e.g. https://www.douban.com/* http://mp.weixin.qq.com/* matching.push( [ cur, util.clone( sites.get( cur )), type ] ); - } else if ( minimatch( window.location.origin + window.location.pathname, cur ) ) { + } else if ( minimatch( local.origin + local.pathname, cur ) ) { matching.push( [ cur, util.clone( sites.get( cur )), type ] ); } } diff --git a/src/vender/puread/plugin/beautify.js b/src/vender/puread/plugin/beautify.js index d8bf0b71..879ca901 100644 --- a/src/vender/puread/plugin/beautify.js +++ b/src/vender/puread/plugin/beautify.js @@ -332,7 +332,13 @@ function commbeautify( name, $target ) { if ( $img.parent().hasClass( "sr-rd-content-center" )) { $img.parent().removeAttr( "class" ).addClass( "simpread-hidden" ); } - }; + }, + getImgAbsolutePath = path => { + const link = document.createElement( "a" ); + link.href = path; + return link.protocol + "//" + link.host + link.pathname + link.search + link.hash; + }, + getImgAbsolutePath2 = (url,base) => {if('string'!==typeof url||!url){return null}else if(url.match(/^[a-z]+\:\/\//i)){return url}else if(url.match(/^\/\//)){return'http:'+url}else if(url.match(/^[a-z]+\:/i)){return url}else if('string'!==typeof base){var a=document.createElement('a');a.href=url;if(!a.pathname){return null}return'http://'+url}else{base=getImgAbsolutePath2(base);if(base===null){return null}}var a=document.createElement('a');a.href=base;if(url[0]==='/'){base=[]}else{base=a.pathname.split('/');base.pop()}url=url.split('/');for(var i=0;i" ); diff --git a/src/vender/puread/puread.js b/src/vender/puread/puread.js index 1a9d2894..7fa0dfcd 100644 --- a/src/vender/puread/puread.js +++ b/src/vender/puread/puread.js @@ -7,7 +7,7 @@ export default class PureRead extends AdapteSite { constructor( sites ) { super( sites ); - this.version = "0.0.3"; + this.version = "0.0.4 build 0413"; this.org_url = location.href; this.html = {}; // clone site, include: title, desc, include, avatar, paging this.plugin = {}; diff --git a/src/vender/puread/util.js b/src/vender/puread/util.js index 94116d2b..81504c43 100644 --- a/src/vender/puread/util.js +++ b/src/vender/puread/util.js @@ -24,6 +24,31 @@ function getURI() { return `${ window.location.protocol }//${ window.location.hostname }${ path }/`; } +/** + * Get url and parser location + * + * @param {string} url + */ +function getLocation( href ) { + if ( document ) { + const a = document.createElement( "a" ); + a.href = href; + return a; + } else { + const match = href.match(/^(https?\:)\/\/(([^:\/?#]*)(?:\:([0-9]+))?)([\/]{0,1}[^?#]*)(\?[^#]*|)(#.*|)$/); + return match && { + href : href, + protocol: match[1], + host : match[2], + hostname: match[3], + port : match[4], + pathname: match[5], + search : match[6], + hash : match[7] + } + } +} + /** * Verify html * @@ -134,6 +159,7 @@ function specAction( content ) { export { clone, getURI, + getLocation, verifyHtml, selector, specTest, From 9bcfdb62f53845f3567779e4bbb18cbda578633d Mon Sep 17 00:00:00 2001 From: Kenshin Date: Sat, 13 Apr 2019 18:17:03 +0800 Subject: [PATCH 16/43] Update puread files. --- src/vender/puread/adaptesite.js | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/vender/puread/adaptesite.js b/src/vender/puread/adaptesite.js index faf2ccd7..0a5af42a 100644 --- a/src/vender/puread/adaptesite.js +++ b/src/vender/puread/adaptesite.js @@ -14,23 +14,24 @@ const site = { avatar : [], paging : [], }; -let minimatch, rdability, markdown, current_url; +let minimatch, rdability, markdown, host_href; export default class AdapteSite { constructor( sites = { global:[], custom:[], local:[] } ) { this.url = util.getURI(); - this.sites = sites; // include: global, custom, local, person + this.sites = sites; // include: global, custom, local, person this.current = {}; - this.state = "none"; // include: meta, txt, adapter, none, temp + this.state = "none"; // include: meta, txt, adapter, none, temp this.origins = []; - current_url = this.url;// origin url not changed + host_href = location.href; // origin url } /** * Set url */ SetURL( value ) { + /* const uri = util.getLocation( value ); // Clone util.getURI() source const name = (pathname) => { @@ -39,7 +40,8 @@ export default class AdapteSite { }, path = name( uri.pathname ); this.url = `${ uri.protocol }//${ uri.hostname }${ path }/`; - current_url = value; + */ + host_href = value; } /** @@ -538,7 +540,7 @@ function getsite( type, sites, url, matching = [] ) { return names.replace( "www.", "" ); } }, - local = util.getLocation( current_url ), + local = util.getLocation( host_href ), urls = [ ...sites.keys() ], arr = url.match( /[.a-zA-z0-9-_]+/g ), uri = arr[1].replace( "www.", "" ), From 8c317d8bef628f5083df6bea1ab6e93fed4fcb4e Mon Sep 17 00:00:00 2001 From: Kenshin Date: Sat, 13 Apr 2019 18:39:53 +0800 Subject: [PATCH 17/43] Update puread files. --- src/vender/puread/adaptesite.js | 8 +++----- src/vender/puread/plugin/beautify.js | 2 +- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/src/vender/puread/adaptesite.js b/src/vender/puread/adaptesite.js index 0a5af42a..b334df9f 100644 --- a/src/vender/puread/adaptesite.js +++ b/src/vender/puread/adaptesite.js @@ -31,17 +31,15 @@ export default class AdapteSite { * Set url */ SetURL( value ) { - /* const uri = util.getLocation( value ); // Clone util.getURI() source const name = (pathname) => { pathname = pathname != "/" && pathname.endsWith("/") ? pathname = pathname.replace( /\/$/, "" ) : pathname; return pathname.replace( /\/[%@#.~a-zA-Z0-9_-]+$|^\/$/g, "" ); }, - path = name( uri.pathname ); - this.url = `${ uri.protocol }//${ uri.hostname }${ path }/`; - */ - host_href = value; + path = name( uri.pathname ); + this.url = `${ uri.protocol }//${ uri.hostname }${ path }/`; + host_href = value; } /** diff --git a/src/vender/puread/plugin/beautify.js b/src/vender/puread/plugin/beautify.js index 879ca901..11a99988 100644 --- a/src/vender/puread/plugin/beautify.js +++ b/src/vender/puread/plugin/beautify.js @@ -350,7 +350,7 @@ function commbeautify( name, $target ) { newsrc = jianshu ? jianshu : newsrc; newsrc = sina ? sina : newsrc; //newsrc = getImgAbsolutePath( newsrc ); - if ( newsrc && !src.startsWith( 'http' ) && !src.startsWith( 'data' ) ) { + if ( newsrc && !newsrc.startsWith( 'http' ) && !newsrc.startsWith( 'data' ) ) { newsrc = getImgAbsolutePath2( newsrc, location.href ); } From f3509bf645b6d18e2ac5726a437a1638b3ae3ab0 Mon Sep 17 00:00:00 2001 From: Kenshin Date: Sun, 14 Apr 2019 13:52:00 +0800 Subject: [PATCH 18/43] Optimize multiple style. --- src/assets/css/theme_common.css | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/assets/css/theme_common.css b/src/assets/css/theme_common.css index 51cff5e2..c19b1d1b 100644 --- a/src/assets/css/theme_common.css +++ b/src/assets/css/theme_common.css @@ -268,6 +268,8 @@ sr-rd-mult sr-rd-mult-avatar { display: flex; flex-direction: column; align-items: center; + + margin: 0 15px; } sr-rd-mult sr-rd-mult-avatar span { From abd200b2b63ff1d7ddcad3960181c8b273e7a88f Mon Sep 17 00:00:00 2001 From: Kenshin Date: Sun, 14 Apr 2019 15:43:57 +0800 Subject: [PATCH 19/43] Update puread file. --- src/vender/puread/adaptesite.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/vender/puread/adaptesite.js b/src/vender/puread/adaptesite.js index b334df9f..2ff728fb 100644 --- a/src/vender/puread/adaptesite.js +++ b/src/vender/puread/adaptesite.js @@ -432,7 +432,7 @@ function readmd() { auto : false, exclude: [], }; - const converter = new markdown.Converter(), + const converter = new markdown.default.Converter(), html = converter.makeHtml( $( "body pre" ).text() ); meta.html = html; !$( "title" ).html() && $( "head" ).append( `${ decodeURI(title.replace( ".md", "" )) }` ); From a6469e2b93cfc461af2aa5379258b6855ae0f4b8 Mon Sep 17 00:00:00 2001 From: Kenshin Date: Sun, 21 Apr 2019 19:06:49 +0800 Subject: [PATCH 20/43] Update puread files. --- src/vender/puread/puplugin.min.js | 1 + src/vender/puread/puread.min.js | 1 + 2 files changed, 2 insertions(+) create mode 100644 src/vender/puread/puplugin.min.js create mode 100644 src/vender/puread/puread.min.js diff --git a/src/vender/puread/puplugin.min.js b/src/vender/puread/puplugin.min.js new file mode 100644 index 00000000..770f0305 --- /dev/null +++ b/src/vender/puread/puplugin.min.js @@ -0,0 +1 @@ +!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t(e.puplugin={})}(this,function(e){"use strict";var t="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function r(e,t){return e(t={exports:{}},t.exports),t.exports}var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},a=r(function(e,t){e.exports=function(e){function t(n){if(r[n])return r[n].exports;var a=r[n]={exports:{},id:n,loaded:!1};return e[n].call(a.exports,a,a.exports,t),a.loaded=!0,a.exports}var r={};return t.m=e,t.c=r,t.p="",t(0)}([function(e,t,r){var a=function(){function e(e,t){for(var r=0;r=0||t.isContentEditable||"true"===t.getAttribute("g_editable"))return!0;t=t.parentNode}return!1}},{key:"isFirstTextChild",value:function(e,t){for(var r=e.childNodes,n=0;n-1;n--){var a=r[n];if(8!==a.nodeType&&a.textContent)return a===t}return!1}},{key:"spacingNodeByXPath",value:function(e,t){for(var r=document.evaluate(e,t,null,XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,null),n=void 0,a=void 0,i=r.snapshotLength-1;i>-1;--i)if(n=r.snapshotItem(i),this.canIgnoreNode(n))a=n;else{var o=this.spacing(n.data);if(n.data!==o&&(n.data=o),a){if(n.nextSibling&&n.nextSibling.nodeName.search(this.spaceLikeTags)>=0){a=n;continue}var s=n.data.toString().substr(-1)+a.data.toString().substr(0,1),l=this.spacing(s);if(l!==s){for(var c=a;c.parentNode&&-1===c.nodeName.search(this.spaceSensitiveTags)&&this.isFirstTextChild(c.parentNode,c);)c=c.parentNode;for(var u=n;u.parentNode&&-1===u.nodeName.search(this.spaceSensitiveTags)&&this.isLastTextChild(u.parentNode,u);)u=u.parentNode;if(u.nextSibling&&u.nextSibling.nodeName.search(this.spaceLikeTags)>=0){a=n;continue}if(-1===u.nodeName.search(this.blockTags))if(-1===c.nodeName.search(this.spaceSensitiveTags))-1===c.nodeName.search(this.ignoreTags)&&-1===c.nodeName.search(this.blockTags)&&(a.previousSibling?-1===a.previousSibling.nodeName.search(this.spaceLikeTags)&&(a.data=" "+a.data):this.canIgnoreNode(a)||(a.data=" "+a.data));else if(-1===u.nodeName.search(this.spaceSensitiveTags))n.data=n.data+" ";else{var d=document.createElement("pangu");d.innerHTML=" ",c.previousSibling?-1===c.previousSibling.nodeName.search(this.spaceLikeTags)&&c.parentNode.insertBefore(d,c):c.parentNode.insertBefore(d,c),d.previousElementSibling||d.parentNode&&d.parentNode.removeChild(d)}}}a=n}}},{key:"spacingNode",value:function(e){this.spacingNodeByXPath(".//*/text()[normalize-space(.)]",e)}},{key:"spacingElementById",value:function(e){var t='id("'+e+'")//text()';this.spacingNodeByXPath(t,document)}},{key:"spacingElementByClassName",value:function(e){var t='//*[contains(concat(" ", normalize-space(@class), " "), "'+e+'")]//text()';this.spacingNodeByXPath(t,document)}},{key:"spacingElementByTagName",value:function(e){var t="//"+e+"//text()";this.spacingNodeByXPath(t,document)}},{key:"spacingPageTitle",value:function(){this.spacingNodeByXPath("/html/head/title/text()",document)}},{key:"spacingPageBody",value:function(){for(var e="/html/body//*/text()[normalize-space(.)]",t=["script","style","textarea"],r=0;r])([A-Za-z0-9])/g,d=/([A-Za-z0-9])([\+\-\*\/=&\\|<>])([\u2e80-\u2eff\u2f00-\u2fdf\u3040-\u309f\u30a0-\u30ff\u3100-\u312f\u3200-\u32ff\u3400-\u4dbf\u4e00-\u9fff\uf900-\ufaff])/g,h=/([\u2e80-\u2eff\u2f00-\u2fdf\u3040-\u309f\u30a0-\u30ff\u3100-\u312f\u3200-\u32ff\u3400-\u4dbf\u4e00-\u9fff\uf900-\ufaff])([\(\[\{<\u201c]+(.*?)[\)\]\}>\u201d]+)([\u2e80-\u2eff\u2f00-\u2fdf\u3040-\u309f\u30a0-\u30ff\u3100-\u312f\u3200-\u32ff\u3400-\u4dbf\u4e00-\u9fff\uf900-\ufaff])/g,f=/([\u2e80-\u2eff\u2f00-\u2fdf\u3040-\u309f\u30a0-\u30ff\u3100-\u312f\u3200-\u32ff\u3400-\u4dbf\u4e00-\u9fff\uf900-\ufaff])([\(\[\{<\u201c>])/g,p=/([\)\]\}>\u201d<])([\u2e80-\u2eff\u2f00-\u2fdf\u3040-\u309f\u30a0-\u30ff\u3100-\u312f\u3200-\u32ff\u3400-\u4dbf\u4e00-\u9fff\uf900-\ufaff])/g,g=/([\(\[\{<\u201c]+)(\s*)(.+?)(\s*)([\)\]\}>\u201d]+)/,m=/([\u2e80-\u2eff\u2f00-\u2fdf\u3040-\u309f\u30a0-\u30ff\u3100-\u312f\u3200-\u32ff\u3400-\u4dbf\u4e00-\u9fff\uf900-\ufaff])([~!;:,\.\?\u2026])([A-Za-z0-9])/g,_=/([\u2e80-\u2eff\u2f00-\u2fdf\u3040-\u309f\u30a0-\u30ff\u3100-\u312f\u3200-\u32ff\u3400-\u4dbf\u4e00-\u9fff\uf900-\ufaff])([A-Za-z0-9`\$%\^&\*\-=\+\\\|\/@\u00a1-\u00ff\u2022\u2027\u2150-\u218f])/g,b=/([A-Za-z0-9`~\$%\^&\*\-=\+\\\|\/!;:,\.\?\u00a1-\u00ff\u2022\u2026\u2027\u2150-\u218f])([\u2e80-\u2eff\u2f00-\u2fdf\u3040-\u309f\u30a0-\u30ff\u3100-\u312f\u3200-\u32ff\u3400-\u4dbf\u4e00-\u9fff\uf900-\ufaff])/g,w=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}return r(e,[{key:"spacing",value:function(e){var t=e,r=t=(t=(t=(t=(t=(t=(t=(t=(t=t.replace(n,"$1 $2")).replace(a,"$1 $2")).replace(i,"$1$3$5")).replace(o,"$1$3$4")).replace(s,"$1 $2$3$4 $5")).replace(l,"$1 $2")).replace(c,"$1 $3")).replace(u,"$1 $2 $3")).replace(d,"$1 $2 $3"),w=t.replace(h,"$1 $2 $4");return t=w,r===w&&(t=(t=t.replace(f,"$1 $2")).replace(p,"$1 $2")),t=(t=(t=(t=t.replace(g,"$1$3$5")).replace(m,"$1$2 $3")).replace(_,"$1 $2")).replace(b,"$1 $2")}},{key:"spacingText",value:function(e){var t=arguments.length<=1||void 0===arguments[1]?function(){}:arguments[1];try{var r=this.spacing(e);t(null,r)}catch(e){t(e)}}}]),e}(),v=new w;(e.exports=v).Pangu=w}])});a.pangu;function i(e,t){for(var r=0,n=e.length-1;n>=0;n--){var a=e[n];"."===a?e.splice(n,1):".."===a?(e.splice(n,1),r++):r&&(e.splice(n,1),r--)}if(t)for(;r--;r)e.unshift("..");return e}var o=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/,s=function(e){return o.exec(e).slice(1)};function l(){for(var e="",t=!1,r=arguments.length-1;r>=-1&&!t;r--){var n=r>=0?arguments[r]:"/";if("string"!=typeof n)throw new TypeError("Arguments to path.resolve must be strings");n&&(e=n+"/"+e,t="/"===n.charAt(0))}return e=i(_(e.split("/"),function(e){return!!e}),!t).join("/"),(t?"/":"")+e||"."}function c(e){var t=u(e),r="/"===b(e,-1);return(e=i(_(e.split("/"),function(e){return!!e}),!t).join("/"))||t||(e="."),e&&r&&(e+="/"),(t?"/":"")+e}function u(e){return"/"===e.charAt(0)}function d(){return c(_(Array.prototype.slice.call(arguments,0),function(e,t){if("string"!=typeof e)throw new TypeError("Arguments to path.join must be strings");return e}).join("/"))}function h(e,t){function r(e){for(var t=0;t=0&&""===e[r];r--);return t>r?[]:e.slice(t,r-t+1)}e=l(e).substr(1),t=l(t).substr(1);for(var n=r(e.split("/")),a=r(t.split("/")),i=Math.min(n.length,a.length),o=i,s=0;s=0&&c>0){for(n=[],i=r.length;u>=0&&!s;)u==l?(n.push(u),l=r.indexOf(e,u+1)):1==n.length?s=[n.pop(),c]:((a=n.pop())=0?l:c;n.length&&(s=[i,o])}return s}E.range=T;var N=function(e){if(!e)return[];"{}"===e.substr(0,2)&&(e="\\{\\}"+e.substr(2));return function e(t,r){var n=[];var a=k("{","}",t);if(!a||/\$$/.test(a.pre))return[t];var i=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(a.body);var o=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(a.body);var s=i||o;var l=a.body.indexOf(",")>=0;if(!s&&!l)return a.post.match(/,.*\}/)?(t=a.pre+"{"+a.body+C+a.post,e(t)):[t];var c;if(s)c=a.body.split(/\.\./);else if(1===(c=function e(t){if(!t)return[""];var r=[];var n=k("{","}",t);if(!n)return t.split(",");var a=n.pre;var i=n.body;var o=n.post;var s=a.split(",");s[s.length-1]+="{"+i+"}";var l=e(o);o.length&&(s[s.length-1]+=l.shift(),s.push.apply(s,l));r.push.apply(r,s);return r}(a.body)).length&&1===(c=e(c[0],!1).map(M)).length){var u=a.post.length?e(a.post,!1):[""];return u.map(function(e){return a.pre+c[0]+e})}var d=a.pre;var u=a.post.length?e(a.post,!1):[""];var h;if(s){var f=L(c[0]),p=L(c[1]),g=Math.max(c[0].length,c[1].length),m=3==c.length?Math.abs(L(c[2])):1,_=I,b=p0){var T=new Array(x+1).join("0");E=y<0?"-"+T+E.slice(1):T+E}}h.push(E)}}else h=v(c,function(t){return e(t,!1)});for(var N=0;N=t}var R=w&&m||w,D=Y;Y.Minimatch=Q;var H={sep:"/"};try{H=R}catch(e){}var G=Y.GLOBSTAR=Q.GLOBSTAR={},U={"!":{open:"(?:(?!(?:",close:"))[^/]*?)"},"?":{open:"(?:",close:")?"},"+":{open:"(?:",close:")+"},"*":{open:"(?:",close:")*"},"@":{open:"(?:",close:")"}},q="[^/]",F=q+"*?",V="(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?",W="(?:(?!(?:\\/|^)\\.).)*?",X="().*{}+?[]^$\\!".split("").reduce(function(e,t){return e[t]=!0,e},{});var Z=/\/+/;function K(e,t){e=e||{},t=t||{};var r={};return Object.keys(t).forEach(function(e){r[e]=t[e]}),Object.keys(e).forEach(function(t){r[t]=e[t]}),r}function Y(e,t,r){if("string"!=typeof t)throw new TypeError("glob pattern string required");return r||(r={}),!(!r.nocomment&&"#"===t.charAt(0))&&(""===t.trim()?""===e:new Q(t,r).match(e))}function Q(e,t){if(!(this instanceof Q))return new Q(e,t);if("string"!=typeof e)throw new TypeError("glob pattern string required");t||(t={}),e=e.trim(),"/"!==H.sep&&(e=e.split(H.sep).join("/")),this.options=t,this.set=[],this.pattern=e,this.regexp=null,this.negate=!1,this.comment=!1,this.empty=!1,this.make()}function J(e,t){if(t||(t=this instanceof Q?this.options:{}),void 0===(e=void 0===e?this.pattern:e))throw new TypeError("undefined pattern");return t.nobrace||!e.match(/\{.*\}/)?[e]:N(e)}Y.filter=function(e,t){return t=t||{},function(r,n,a){return Y(r,e,t)}},Y.defaults=function(e){if(!e||!Object.keys(e).length)return Y;var t=Y,r=function(r,n,a){return t.minimatch(r,n,K(e,a))};return r.Minimatch=function(r,n){return new t.Minimatch(r,K(e,n))},r},Q.defaults=function(e){return e&&Object.keys(e).length?Y.defaults(e).Minimatch:Q},Q.prototype.debug=function(){},Q.prototype.make=function(){if(this._made)return;var e=this.pattern,t=this.options;if(!t.nocomment&&"#"===e.charAt(0))return void(this.comment=!0);if(!e)return void(this.empty=!0);this.parseNegate();var r=this.globSet=this.braceExpand();t.debug&&(this.debug=console.error);this.debug(this.pattern,r),r=this.globParts=r.map(function(e){return e.split(Z)}),this.debug(this.pattern,r),r=r.map(function(e,t,r){return e.map(this.parse,this)},this),this.debug(this.pattern,r),r=r.filter(function(e){return-1===e.indexOf(!1)}),this.debug(this.pattern,r),this.set=r},Q.prototype.parseNegate=function(){var e=this.pattern,t=!1,r=0;if(this.options.nonegate)return;for(var n=0,a=e.length;n65536)throw new TypeError("pattern is too long");var r=this.options;if(!r.noglobstar&&"**"===e)return G;if(""===e)return"";var n,a="",i=!!r.nocase,o=!1,s=[],l=[],c=!1,u=-1,d=-1,h="."===e.charAt(0)?"":r.dot?"(?!(?:^|\\/)\\.{1,2}(?:$|\\/))":"(?!\\.)",f=this;function p(){if(n){switch(n){case"*":a+=F,i=!0;break;case"?":a+=q,i=!0;break;default:a+="\\"+n}f.debug("clearStateChar %j %j",n,a),n=!1}}for(var g,m=0,_=e.length;m<_&&(g=e.charAt(m));m++)if(this.debug("%s\t%s %s %j",e,m,a,g),o&&X[g])a+="\\"+g,o=!1;else switch(g){case"/":return!1;case"\\":p(),o=!0;continue;case"?":case"*":case"+":case"@":case"!":if(this.debug("%s\t%s %s %j <-- stateChar",e,m,a,g),c){this.debug(" in class"),"!"===g&&m===d+1&&(g="^"),a+=g;continue}f.debug("call clearStateChar %j",n),p(),n=g,r.noext&&p();continue;case"(":if(c){a+="(";continue}if(!n){a+="\\(";continue}s.push({type:n,start:m-1,reStart:a.length,open:U[n].open,close:U[n].close}),a+="!"===n?"(?:(?!(?:":"(?:",this.debug("plType %j %j",n,a),n=!1;continue;case")":if(c||!s.length){a+="\\)";continue}p(),i=!0;var b=s.pop();a+=b.close,"!"===b.type&&l.push(b),b.reEnd=a.length;continue;case"|":if(c||!s.length||o){a+="\\|",o=!1;continue}p(),a+="|";continue;case"[":if(p(),c){a+="\\"+g;continue}c=!0,d=m,u=a.length,a+=g;continue;case"]":if(m===d+1||!c){a+="\\"+g,o=!1;continue}if(c)var w,v=e.substring(d+1,m);i=!0,c=!1,a+=g;continue;default:p(),o?o=!1:!X[g]||"^"===g&&c||(a+="\\"),a+=g}c&&(v=e.substr(d+1),w=this.parse(v,ee),a=a.substr(0,u)+"\\["+w[0],i=i||w[1]);for(b=s.pop();b;b=s.pop()){var y=a.slice(b.reStart+b.open.length);this.debug("setting tail",a,b),y=y.replace(/((?:\\{2}){0,64})(\\?)\|/g,function(e,t,r){return r||(r="\\"),t+t+r+"|"}),this.debug("tail=%j\n %s",y,y,b,a);var k="*"===b.type?F:"?"===b.type?q:"\\"+b.type;i=!0,a=a.slice(0,b.reStart)+k+"\\("+y}p(),o&&(a+="\\\\");var E=!1;switch(a.charAt(0)){case".":case"[":case"(":E=!0}for(var x=l.length-1;x>-1;x--){var T=l[x],N=a.slice(0,T.reStart),A=a.slice(T.reStart,T.reEnd-8),S=a.slice(T.reEnd-8,T.reEnd),C=a.slice(T.reEnd);S+=C;var P=N.split("(").length-1,j=C;for(m=0;m=0&&!(n=e[a]);a--);for(a=0;a>> no match, partial?",e,d,t,h),d!==o))}if("string"==typeof c?(l=n.nocase?u.toLowerCase()===c.toLowerCase():u===c,this.debug("string match",c,u,l)):(l=u.match(c),this.debug("pattern match",c,u,l)),!l)return!1}if(a===o&&i===s)return!0;if(a===o)return r;if(i===s)return a===o-1&&""===e[a];throw new Error("wtf?")};var te=Object.freeze({specbeautify:function(e,t){switch(e){case"sspai.com":t.find(".relation-apps").remove(),t.find(".ss-app-card").remove();break;case"post.smzdm.com":t.find("img.face").addClass("sr-rd-content-nobeautify"),t.find(".insert-outer img").addClass("sr-rd-content-nobeautify");break;case"infoq.com":t.find("img").map(function(e,t){"left"==$(t).css("float")&&$(t).addClass("sr-rd-content-nobeautify")}),t.find("script").remove();break;case"appinn.com":case"hacpai.com":t.find(".emoji").addClass("sr-rd-content-nobeautify");break;case"douban.com":t.find(".review-content").children().unwrap(),t.find("table").addClass("sr-rd-content-center"),t.find("p").css({"white-space":"pre-wrap"}),t.find(".cc").removeClass();break;case"qdaily.com":t.find("img").map(function(e,t){var r=$(t);0==Number.parseInt(r.css("height"))&&r.remove()}),t.find(".com-insert-images").map(function(e,t){var r=$(t),n=r.find("img").map(function(e,t){return"
"+t.outerHTML+"
"}).get().join("");r.empty().removeAttr("class").append(n)}),t.find(".com-insert-embed").remove();break;case"news.mtime.com":t.find(".newspictool").map(function(e,t){var r=$(t),n=r.find("img"),a=r.find("p:last");r.removeAttr("class").addClass("sr-rd-content-center").empty().append(n).append(a)});break;case"blog.csdn.net":t.find(".save_code").remove(),t.find(".pre-numbering").remove(),t.find("pre").removeAttr("style").removeAttr("class"),t.find("code").removeAttr("style"),t.find(".dp-highlighter").map(function(e,t){$(t).find(".bar .tools").remove(),$(t).next().is("pre")&&$(t).next().remove()});break;case"news.sohu.com":t.find(".conserve-photo").remove(),t.find("table").addClass("sr-rd-content-center");break;case"qq.com":t.find(".rv-root-v2, #backqqcom").remove();break;case"azofreeware.com":t.find("iframe").remove();break;case"apprcn.com":t.find("img").map(function(e,t){var r=$(t),n=r.attr("src");n&&n.includes("Apprcn_Wechat_Small.jpeg")&&r.parent().remove()}),t.find("a").map(function(e,t){var r=$(t);"来自反斗软件"==r.text()&&r.parent().remove()});break;case"tieba.baidu.com":t.find(".BDE_Smiley").addClass("sr-rd-content-nobeautify"),t.find(".replace_div").removeAttr("class").removeAttr("style"),t.find(".replace_tip").remove(),t.find(".d_post_content, .j_d_post_content, .post_bubble_top, .post_bubble_middle, .post_bubble_bottom").map(function(e,t){$(t).removeAttr("class").removeAttr("style")}),$("body").find(".p_author_face").map(function(e,t){var r=$(t).find("img"),n=r.attr("data-tb-lazyload"),a=r.attr("username");n&&$("sr-rd-mult-avatar").find("span").map(function(e,t){var r=$(t);r.text()==a&&r.parent().find("img").attr("src",n)})});break;case"jingyan.baidu.com":t.find(".exp-image-wraper").removeAttr("class").removeAttr("href");break;case"question.zhihu.com":t.find(".zu-edit-button").remove(),t.find("a.external").map(function(e,t){$(t).removeAttr("class").attr("style","border: none;")}),t.find(".VagueImage").map(function(e,t){var r=$(t),n=r.attr("data-src");r.replaceWith('')});break;case"chiphell.com":t.find("img").map(function(e,t){var r=$(t),n=r.parent(),a=r.attr("src"),i=r.attr("smilieid");n.is("ignore_js_op")&&r.unwrap(),i&&a&&a.includes("static/image/smiley")&&r.addClass("sr-rd-content-nobeautify").attr("style","width: 50px;")}),t.find(".quote").remove();break;case"jiemian.com":t.find("script").remove();break;case"36kr.com":t.find(".load-html-img").removeAttr("class");break;case"cnblogs.com":t.find(".cnblogs_code").removeClass(),t.find(".cnblogs_code_hide").removeClass().removeAttr("style"),t.find(".cnblogs_code_toolbar").remove(),t.find(".code_img_opened").remove(),t.find(".code_img_closed").remove();break;case"news.cnblogs.com":t.find(".topic_img").remove();break;case"g-cores.com":t.find(".swiper-slide-active").find("img").map(function(e,t){var r=$(t);r.parent().parent().parent().parent().parent().parent().removeAttr("class").removeAttr("style").html(r)});break;case"feng.com":case"young.ifeng.com":t.find("span").removeAttr("style");break;case"ftchinese.com":t.find("script").remove();break;case"segmentfault.com":t.find(".widget-codetool").remove();break;case"mp.weixin.qq.com":t.find('section[powered-by="xiumi.us"]').find("img").map(function(e,t){var r=$(t),n=r.attr("data-src");r.addClass("sr-rd-content-nobeautify").attr("src",n)});break;case"ruby-china.org":t.find(".twemoji").remove();break;case"w3cplus.com":t.find("iframe").addClass("sr-rd-content-nobeautify");break;case"zuojj.com":t.find(".syntaxhighlighter .Brush").attr("style","font-size: .7em !important;");break;case"aotu.io":t.find(".highlight table").map(function(e,t){var r=$(t),n=r.find("pre"),a=r.find("table");r.html(n[1]),a.unwrap()}),t.find("table").addClass("sr-rd-content-center");break;case"colobu.com":t.find(".highlight table").map(function(e,t){var r=$(t),n=r.find("pre");r.html(n[1]),r.unwrap()});break;case"hao.caibaojian.com":t.find(".tlink").map(function(e,t){$(t).html("")});break;case"wkee.net":t.find("script").remove();break;case"linux.cn":t.find("pre").attr("style","background-color: #161b20; background-image: none;"),t.find("code").attr("style","background-color: transparent; background-image: none;");break;case"zhuanlan.zhihu.com":t.find("div[data-src]").map(function(e,t){var r=$(t),n=r.attr("data-src");r.replaceWith('
')});break;case"jianshu.com":t.find(".image-package").map(function(e,t){var r=$(t),n=r.find("img");r.html(n)});break;case"medium.com":t.find("figure").map(function(e,t){var r=$(t),n=r.find("img");r.replaceWith('
')});break;case"worldcup.fifa.com":t.find("iframe").css({width:"790px",height:"450px"}),t.find("div").removeClass()}},removeSpareTag:function(e,t){var r=!1,n="";["lib.csdn.net","huxiu.com","my.oschina.net","caixin.com","163.com","steachs.com","hacpai.com","apprcn.com","mp.weixin.qq.com"].includes(e)?(r=!0,n="p"):["nationalgeographic.com.cn","dgtle.com","news.mtime.com"].includes(e)?(r=!0,n="div"):["chiphell.com"].includes(e)&&(r=!0,n="font"),r&&t.find(n).map(function(e,t){var r=$(t).text().toLowerCase().trim();0==$(t).find("img").length&&""==r&&$(t).remove()})},htmlbeautify:function(e){try{e.html(function(e,t){return t.trim().replace(/<\/?blockquote/g,function(e){return"/"==e[1]?"\n?
(\n?
)*/g,"
").replace(/\/(div|p)>\n*(
\n)+/g,function(e){return e.replace("
","")})})}catch(t){return e.html()}},commbeautify:function(e,t){t.find("img:not(.sr-rd-content-nobeautify)").map(function(e,t){var r=$(t),n=(r.parent(),$("")),a=r.attr("src"),i=r.attr("data-src"),o=r.attr("data-original"),s=r.attr("original"),l=r.attr("data-original-src"),c=r.attr("real_src"),u=function(){n.removeClass("sr-rd-content-img-load"),n[0].clientWidth<400?n.parent().removeClass("sr-rd-content-center").addClass("sr-rd-content-center-small"):n[0].clientWidth>1e3?n.css("zoom","0.6"):n[0].clientHeight>620&&/win|mac/i.test(navigator.platform)&&(n.attr("height",620),n[0].clientWidth<$("sr-rd-content").width()&&n.css({width:"auto"})),n[0].clientWidth>$("sr-rd-content").width()&&n.addClass("sr-rd-content-img")},d=function(){n.addClass("simpread-hidden"),n.parent().hasClass("sr-rd-content-center")&&n.parent().removeAttr("class").addClass("simpread-hidden")},h=void 0;r.parent()[0].tagName.toLowerCase(),h=s||a,h=i||h,h=o||h,h=l||h,!(h=c||h)||h.startsWith("http")||h.startsWith("data")||(h=function e(t,r){if("string"!=typeof t||!t)return null;if(t.match(/^[a-z]+\:\/\//i))return t;if(t.match(/^\/\//))return"http:"+t;if(t.match(/^[a-z]+\:/i))return t;var n;if("string"!=typeof r)return(n=document.createElement("a")).href=t,n.pathname?"http://"+t:null;if(null===(r=e(r)))return null;(n=document.createElement("a")).href=r,"/"===t[0]?r=[]:(r=n.pathname.split("/")).pop(),t=t.split("/");for(var a=0;a"),/win|mac/i.test(navigator.platform)?n.one("load",function(){return u()}).one("error",function(){return d()}):n.on("load",function(){return u()}).on("error",function(){return d()})}),t.find("sr-blockquote").map(function(t,r){var n=$(r),a=n.parent();n.removeAttr("style").removeAttr("class"),"dgtle.com"==e&&a.removeClass("quote")}),t.find("iframe:not(.sr-rd-content-nobeautify), embed:not(.sr-rd-content-nobeautify)").map(function(e,t){$(t).wrap("
")}),t.find("hr").map(function(e,t){$(t).addClass("simpread-hidden")}),t.find("pre").map(function(e,t){$(t).find("code").removeAttr("class")}),t.find("pre").removeAttr("class"),t.find("a").removeAttr("style")},cleanHTML:function(e,t){for(var r=e.html().split("\n"),n="",a=0;a0&&(n+=i+"\n"):n+="

"+i+"

\n"}e.html(function(e){var r="";return $.parseHTML(e).forEach(function(e,n){var a=e.tagName,i=e.outerText,o=e.outerHTML;void 0==a?r+="

"+e.textContent.replace(/^\n|\n$/gi,"").trim()+"

":(""!=i||o.includes("0?t.join("").replace(/, $/,""):null}function oe(e,t){var r=Object.keys(t).map(function(e){return t[e]&&e.replace(/[A-Z]/,function(e){return"-"+e.toLowerCase()})+": "+t[e]+";"}).join("");switch(e){case"title":r="sr-rd-title {"+r+"}";break;case"desc":r="sr-rd-desc {"+r+"}";break;case"art":r="sr-rd-content *, sr-rd-content p, sr-rd-content div {"+r+"}";break;case"pre":r="sr-rd-content pre {"+r+"}";break;case"code":r="sr-rd-content pre code, sr-rd-content pre code * {"+r+"}"}var n=$("head").find("style#simpread-custom-"+e);0==n.length?$("head").append('"):n.html(r)}function se(e,t){var r=$("head").find("style#simpread-custom-"+e);0==r.length?$("head").append('"):r.html(t)}var le=Object.freeze({GetColor:ie,BgColor:function(e,t){var r="rgba("+ie(e)+", "+t/100+")";return $(ne).css(re,r),r},Opacity:function(e){var t=ie($(ne).css(re)),r="rgba("+t+", "+e/100+")";return t?($(ne).css(re,r),r):null},FontFamily:function(e){$("sr-read").css("font-family","default"==e?"":e)},FontSize:function(e){"-1"==ae&&void 0==(ae=$("html").attr("style"))&&(ae=""),e?$("html").attr("style","font-size: "+e+"!important;"+ae):$("html").attr("style",ae)},Layout:function(e){$("sr-read").css("margin",e?"20px "+e:"")},SiteCSS:function(e){e?$("head").append('"):$("#simpread-site-css").remove()},Preview:function(e){Object.keys(e).forEach(function(t){"css"!=t&&oe(t,e[t])}),se("css",e.css)},Custom:oe,CSS:se,VerifyCustom:function(e,t){switch(e){case"layout":case"margin":case"fontfamily":case"custom":return""!=t.css;case"fontsize":return""!=t.title.fontSize||""!=t.desc.fontSize||""!=t.art.fontSize||""!=t.css;case"theme":return-1!=t.css.search("simpread-theme-root")}}});function ce(e,t){if(t&&t.documentElement)e=t,t=arguments[2];else if(!e||!e.documentElement)throw new Error("First argument to Readability constructor should be a document object.");var r;t=t||{},this._doc=e,this._articleTitle=null,this._articleByline=null,this._articleDir=null,this._articleSiteName=null,this._attempts=[],this._debug=!!t.debug,this._maxElemsToParse=t.maxElemsToParse||this.DEFAULT_MAX_ELEMS_TO_PARSE,this._nbTopCandidates=t.nbTopCandidates||this.DEFAULT_N_TOP_CANDIDATES,this._charThreshold=t.charThreshold||this.DEFAULT_CHAR_THRESHOLD,this._classesToPreserve=this.CLASSES_TO_PRESERVE.concat(t.classesToPreserve||[]),this._flags=this.FLAG_STRIP_UNLIKELYS|this.FLAG_WEIGHT_CLASSES|this.FLAG_CLEAN_CONDITIONALLY,this._debug?(r=function(e){var t,r,n=e.nodeName+" ";return e.nodeType==e.TEXT_NODE?n+'("'+e.textContent+'")':(t=e.className&&"."+e.className.replace(/ /g,"."),r="",e.id?r="(#"+e.id+t+")":t&&(r="("+t+")"),n+r)},this.log=function(){var e;"undefined"!=typeof dump?(e=Array.prototype.map.call(arguments,function(e){return e&&e.nodeName?r(e):e}).join(" "),dump("Reader: (Readability) "+e+"\n")):"undefined"!=typeof console&&["Reader: (Readability) "].concat(arguments)}):this.log=function(){}}ce.prototype={FLAG_STRIP_UNLIKELYS:1,FLAG_WEIGHT_CLASSES:2,FLAG_CLEAN_CONDITIONALLY:4,ELEMENT_NODE:1,TEXT_NODE:3,DEFAULT_MAX_ELEMS_TO_PARSE:0,DEFAULT_N_TOP_CANDIDATES:5,DEFAULT_TAGS_TO_SCORE:"section,h2,h3,h4,h5,h6,p,td,pre".toUpperCase().split(","),DEFAULT_CHAR_THRESHOLD:500,REGEXPS:{unlikelyCandidates:/-ad-|ai2html|banner|breadcrumbs|combx|comment|community|cover-wrap|disqus|extra|foot|gdpr|header|legends|menu|related|remark|replies|rss|shoutbox|sidebar|skyscraper|social|sponsor|supplemental|ad-break|agegate|pagination|pager|popup|yom-remote/i,okMaybeItsACandidate:/and|article|body|column|main|shadow/i,positive:/article|body|content|entry|hentry|h-entry|main|page|pagination|post|text|blog|story/i,negative:/hidden|^hid$| hid$| hid |^hid |banner|combx|comment|com-|contact|foot|footer|footnote|gdpr|masthead|media|meta|outbrain|promo|related|scroll|share|shoutbox|sidebar|skyscraper|sponsor|shopping|tags|tool|widget/i,extraneous:/print|archive|comment|discuss|e[\-]?mail|share|reply|all|login|sign|single|utility/i,byline:/byline|author|dateline|writtenby|p-author/i,replaceFonts:/<(\/?)font[^>]*>/gi,normalize:/\s{2,}/g,videos:/\/\/(www\.)?((dailymotion|youtube|youtube-nocookie|player\.vimeo|v\.qq)\.com|(archive|upload\.wikimedia)\.org|player\.twitch\.tv)/i,nextLink:/(next|weiter|continue|>([^\|]|$)|禄([^\|]|$))/i,prevLink:/(prev|earl|old|new|<|芦)/i,whitespace:/^\s*$/,hasContent:/\S$/},DIV_TO_P_ELEMS:["A","BLOCKQUOTE","DL","DIV","IMG","OL","P","PRE","TABLE","UL","SELECT"],ALTER_TO_DIV_EXCEPTIONS:["DIV","ARTICLE","SECTION","P"],PRESENTATIONAL_ATTRIBUTES:["align","background","bgcolor","border","cellpadding","cellspacing","frame","hspace","rules","style","valign","vspace"],DEPRECATED_SIZE_ATTRIBUTE_ELEMS:["TABLE","TH","TD","HR","PRE"],PHRASING_ELEMS:["ABBR","AUDIO","B","BDO","BR","BUTTON","CITE","CODE","DATA","DATALIST","DFN","EM","EMBED","I","IMG","INPUT","KBD","LABEL","MARK","MATH","METER","NOSCRIPT","OBJECT","OUTPUT","PROGRESS","Q","RUBY","SAMP","SCRIPT","SELECT","SMALL","SPAN","STRONG","SUB","SUP","TEXTAREA","TIME","VAR","WBR"],CLASSES_TO_PRESERVE:["page"],_postProcessContent:function(e){this._fixRelativeUris(e),this._cleanClasses(e)},_removeNodes:function(e,t){var r,n,a;for(r=e.length-1;r>=0;r--)(a=(n=e[r]).parentNode)&&(!t||t.call(this,n,r,e))&&a.removeChild(n)},_replaceNodeTags:function(e,t){var r,n;for(r=e.length-1;r>=0;r--)n=e[r],this._setNodeTag(n,t)},_forEachNode:function(e,t){Array.prototype.forEach.call(e,t,this)},_someNode:function(e,t){return Array.prototype.some.call(e,t,this)},_everyNode:function(e,t){return Array.prototype.every.call(e,t,this)},_concatNodeLists:function(){var e=Array.prototype.slice,t=e.call(arguments).map(function(t){return e.call(t)});return Array.prototype.concat.apply([],t)},_getAllNodesWithTag:function(e,t){return e.querySelectorAll?e.querySelectorAll(t.join(",")):[].concat.apply([],t.map(function(t){var r=e.getElementsByTagName(t);return Array.isArray(r)?r:Array.from(r)}))},_cleanClasses:function(e){var t=this._classesToPreserve,r=(e.getAttribute("class")||"").split(/\s+/).filter(function(e){return-1!=t.indexOf(e)}).join(" ");for(r?e.setAttribute("class",r):e.removeAttribute("class"),e=e.firstElementChild;e;e=e.nextElementSibling)this._cleanClasses(e)},_fixRelativeUris:function(e){function t(e){if(n==a&&"#"==e.charAt(0))return e;try{return new URL(e,n).href}catch(e){}return e}var r,n=this._doc.baseURI,a=this._doc.documentURI,i=this._getAllNodesWithTag(e,["a"]);this._forEachNode(i,function(e){var r,n=e.getAttribute("href");n&&(0===n.indexOf("javascript:")?(r=this._doc.createTextNode(e.textContent),e.parentNode.replaceChild(r,e)):e.setAttribute("href",t(n)))}),r=this._getAllNodesWithTag(e,["img"]),this._forEachNode(r,function(e){var r=e.getAttribute("src");r&&e.setAttribute("src",t(r))})},_getArticleTitle:function(){function e(e){return e.split(/\s+/).length}var t,r,n,a,i,o=this._doc,s="",l="";try{"string"!=typeof(s=l=o.title.trim())&&(s=l=this._getInnerText(o.getElementsByTagName("title")[0]))}catch(e){}return t=!1,/ [\|\-\\\/>禄] /.test(s)?(t=/ [\\\/>禄] /.test(s),e(s=l.replace(/(.*)[\|\-\\\/>禄] .*/gi,"$1"))<3&&(s=l.replace(/[^\|\-\\\/>禄]*[\|\-\\\/>禄](.*)/gi,"$1"))):-1!==s.indexOf(": ")?(r=this._concatNodeLists(o.getElementsByTagName("h1"),o.getElementsByTagName("h2")),n=s.trim(),this._someNode(r,function(e){return e.textContent.trim()===n})||(e(s=l.substring(l.lastIndexOf(":")+1))<3?s=l.substring(l.indexOf(":")+1):e(l.substr(0,l.indexOf(":")))>5&&(s=l))):(s.length>150||s.length<15)&&(1===(a=o.getElementsByTagName("h1")).length&&(s=this._getInnerText(a[0]))),4>=(i=e(s=s.trim().replace(this.REGEXPS.normalize," ")))&&(!t||i!=e(l.replace(/[\|\-\\\/>禄]+/g,""))-1)&&(s=l),s},_prepDocument:function(){var e=this._doc;this._removeNodes(e.getElementsByTagName("style")),e.body&&this._replaceBrs(e.body),this._replaceNodeTags(e.getElementsByTagName("font"),"SPAN")},_nextElement:function(e){for(var t=e;t&&t.nodeType!=this.ELEMENT_NODE&&this.REGEXPS.whitespace.test(t.textContent);)t=t.nextSibling;return t},_replaceBrs:function(e){this._forEachNode(this._getAllNodesWithTag(e,["br"]),function(e){for(var t,r,n,a,i=e.nextSibling,o=!1;(i=this._nextElement(i))&&"BR"==i.tagName;)o=!0,t=i.nextSibling,i.parentNode.removeChild(i),i=t;if(o){for(r=this._doc.createElement("p"),e.parentNode.replaceChild(r,e),i=r.nextSibling;i&&("BR"!=i.tagName||(!(n=this._nextElement(i.nextSibling))||"BR"!=n.tagName))&&this._isPhrasingContent(i);)a=i.nextSibling,r.appendChild(i),i=a;for(;r.lastChild&&this._isWhitespace(r.lastChild);)r.removeChild(r.lastChild);"P"===r.parentNode.tagName&&this._setNodeTag(r.parentNode,"DIV")}})},_setNodeTag:function(e,t){var r,n;if(this.log("_setNodeTag",e,t),e.__JSDOMParser__)return e.localName=t.toLowerCase(),e.tagName=t.toUpperCase(),e;for(r=e.ownerDocument.createElement(t);e.firstChild;)r.appendChild(e.firstChild);for(e.parentNode.replaceChild(r,e),e.readability&&(r.readability=e.readability),n=0;n0?r[0].textContent.includes(this._articleTitle):this._articleTitle.includes(r[0].textContent))&&this._clean(e,"h2"))),this._clean(e,"iframe"),this._clean(e,"input"),this._clean(e,"textarea"),this._clean(e,"select"),this._clean(e,"button"),this._cleanHeaders(e),this._cleanConditionally(e,"table"),this._cleanConditionally(e,"ul"),this._cleanConditionally(e,"div"),this._removeNodes(e.getElementsByTagName("p"),function(e){return 0===e.getElementsByTagName("img").length+e.getElementsByTagName("embed").length+e.getElementsByTagName("object").length+e.getElementsByTagName("iframe").length&&!this._getInnerText(e,!1)}),this._forEachNode(this._getAllNodesWithTag(e,["br"]),function(e){var t=this._nextElement(e.nextSibling);t&&"P"==t.tagName&&e.parentNode.removeChild(e)}),this._forEachNode(this._getAllNodesWithTag(e,["table"]),function(e){var t,r,n=this._hasSingleTagInsideElement(e,"TBODY")?e.firstElementChild:e;this._hasSingleTagInsideElement(n,"TR")&&(t=n.firstElementChild,this._hasSingleTagInsideElement(t,"TD")&&(r=t.firstElementChild,r=this._setNodeTag(r,this._everyNode(r.childNodes,this._isPhrasingContent)?"P":"DIV"),e.parentNode.replaceChild(r,e)))})},_initializeNode:function(e){switch(e.readability={contentScore:0},e.tagName){case"DIV":e.readability.contentScore+=5;break;case"PRE":case"TD":case"BLOCKQUOTE":e.readability.contentScore+=3;break;case"ADDRESS":case"OL":case"UL":case"DL":case"DD":case"DT":case"LI":case"FORM":e.readability.contentScore-=3;break;case"H1":case"H2":case"H3":case"H4":case"H5":case"H6":case"TH":e.readability.contentScore-=5}e.readability.contentScore+=this._getClassWeight(e)},_removeAndGetNext:function(e){var t=this._getNextNode(e,!0);return e.parentNode.removeChild(e),t},_getNextNode:function(e,t){if(!t&&e.firstElementChild)return e.firstElementChild;if(e.nextElementSibling)return e.nextElementSibling;do{e=e.parentNode}while(e&&!e.nextElementSibling);return e&&e.nextElementSibling},_checkByline:function(e,t){var r,n;return!this._articleByline&&(void 0!==e.getAttribute&&(r=e.getAttribute("rel"),n=e.getAttribute("itemprop")),!(!("author"===r||n&&-1!==n.indexOf("author")||this.REGEXPS.byline.test(t))||!this._isValidByline(e.textContent))&&(this._articleByline=e.textContent.trim(),!0))},_getNodeAncestors:function(e,t){t=t||0;for(var r=0,n=[];e.parentNode&&(n.push(e.parentNode),!t||++r!==t);)e=e.parentNode;return n},_grabArticle:function(e){var t,r,n,a,i,o,s,l,c,u,d,h,f,p,g,m,_,b,w,v,y,k,E,x,T,N,A,S,C,P,j,L,z,M,$,B,I,O,R,D,H,G,U,q,F,V,W;if(this.log("**** grabArticle ****"),t=this._doc,r=null!==e,!(e=e||this._doc.body))return this.log("No body found in document. Abort."),null;for(n=e.innerHTML;;){for(a=this._flagIsActive(this.FLAG_STRIP_UNLIKELYS),i=[],o=this._doc.documentElement;o;)if(s=o.className+" "+o.id,this._isProbablyVisible(o))if(this._checkByline(o,s))o=this._removeAndGetNext(o);else if(!a||!this.REGEXPS.unlikelyCandidates.test(s)||this.REGEXPS.okMaybeItsACandidate.test(s)||this._hasAncestorTag(o,"table")||"BODY"===o.tagName||"A"===o.tagName)if("DIV"!==o.tagName&&"SECTION"!==o.tagName&&"HEADER"!==o.tagName&&"H1"!==o.tagName&&"H2"!==o.tagName&&"H3"!==o.tagName&&"H4"!==o.tagName&&"H5"!==o.tagName&&"H6"!==o.tagName||!this._isElementWithoutContent(o)){if(-1!==this.DEFAULT_TAGS_TO_SCORE.indexOf(o.tagName)&&i.push(o),"DIV"===o.tagName){for(l=null,c=o.firstChild;c;){if(u=c.nextSibling,this._isPhrasingContent(c))null!==l?l.appendChild(c):this._isWhitespace(c)||(l=t.createElement("p"),o.replaceChild(l,c),l.appendChild(c));else if(null!==l){for(;l.lastChild&&this._isWhitespace(l.lastChild);)l.removeChild(l.lastChild);l=null}c=u}this._hasSingleTagInsideElement(o,"P")&&this._getLinkDensity(o)<.25?(d=o.children[0],o.parentNode.replaceChild(d,o),o=d,i.push(o)):this._hasChildBlockElement(o)||(o=this._setNodeTag(o,"P"),i.push(o))}o=this._getNextNode(o)}else o=this._removeAndGetNext(o);else this.log("Removing unlikely candidate - "+s),o=this._removeAndGetNext(o);else this.log("Removing hidden node - "+s),o=this._removeAndGetNext(o);for(h=[],this._forEachNode(i,function(e){var t,r,n;e.parentNode&&void 0!==e.parentNode.tagName&&((t=this._getInnerText(e)).length<25||0!==(r=this._getNodeAncestors(e,3)).length&&(n=0,n+=1,n+=t.split(",").length,n+=Math.min(Math.floor(t.length/100),3),this._forEachNode(r,function(e,t){if(e.tagName&&e.parentNode&&void 0!==e.parentNode.tagName){if(void 0===e.readability&&(this._initializeNode(e),h.push(e)),0===t)var r=1;else r=1===t?2:3*t;e.readability.contentScore+=n/r}})))}),f=[],p=0,g=h.length;g>p;p+=1)for(_=(m=h[p]).readability.contentScore*(1-this._getLinkDensity(m)),m.readability.contentScore=_,this.log("Candidate:",m,"with score "+_),b=0;bw.readability.contentScore){f.splice(b,0,m),f.length>this._nbTopCandidates&&f.pop();break}if(y=!1,null===(v=f[0]||null)||"BODY"===v.tagName){for(v=t.createElement("DIV"),y=!0,E=e.childNodes;E.length;)this.log("Moving child out:",E[0]),v.appendChild(E[0]);e.appendChild(v),this._initializeNode(v)}else if(v){for(x=[],T=1;T=.75&&x.push(this._getNodeAncestors(f[T]));if(N=3,x.length>=N)for(k=v.parentNode;"BODY"!==k.tagName;){for(A=0,S=0;SA;S++)A+=Number(x[S].includes(k));if(A>=N){v=k;break}k=k.parentNode}for(v.readability||this._initializeNode(v),k=v.parentNode,P=(C=v.readability.contentScore)/3;"BODY"!==k.tagName;)if(k.readability){if(P>(j=k.readability.contentScore))break;if(j>C){v=k;break}C=k.readability.contentScore,k=k.parentNode}else k=k.parentNode;for(k=v.parentNode;"BODY"!=k.tagName&&1==k.children.length;)k=(v=k).parentNode;v.readability||this._initializeNode(v)}for(L=t.createElement("DIV"),r&&(L.id="readability-content"),z=Math.max(10,.2*v.readability.contentScore),$=0,B=(M=(k=v.parentNode).children).length;B>$;$++)I=M[$],O=!1,this.log("Looking at sibling node:",I,I.readability?"with score "+I.readability.contentScore:""),this.log("Sibling has score",I.readability?I.readability.contentScore:"Unknown"),I===v?O=!0:(R=0,I.className===v.className&&""!==v.className&&(R+=.2*v.readability.contentScore),I.readability&&I.readability.contentScore+R>=z?O=!0:"P"===I.nodeName&&(D=this._getLinkDensity(I),(G=(H=this._getInnerText(I)).length)>80&&.25>D?O=!0:80>G&&G>0&&0===D&&-1!==H.search(/\.( |$)/)&&(O=!0))),O&&(this.log("Appending node:",I),-1===this.ALTER_TO_DIV_EXCEPTIONS.indexOf(I.nodeName)&&(this.log("Altering sibling:",I,"to div."),I=this._setNodeTag(I,"DIV")),L.appendChild(I),$-=1,B-=1);if(this._debug&&this.log("Article content pre-prep: "+L.innerHTML),this._prepArticle(L),this._debug&&this.log("Article content post-prep: "+L.innerHTML),y)v.id="readability-page-1",v.className="page";else{for((U=t.createElement("DIV")).id="readability-page-1",U.className="page",q=L.childNodes;q.length;)U.appendChild(q[0]);L.appendChild(U)}if(this._debug&&this.log("Article content after paging: "+L.innerHTML),F=!0,(V=this._getInnerText(L,!0).length)0&&e.length<100)},_getArticleMetadata:function(){var e={},t={},r=this._doc.getElementsByTagName("meta"),n=/\s*(dc|dcterm|og|twitter)\s*:\s*(author|creator|description|title|site_name)\s*/gi,a=/^\s*(?:(dc|dcterm|og|twitter|weibo:(article|webpage))\s*[\.:]\s*)?(author|creator|description|title|site_name)\s*$/i;return this._forEachNode(r,function(e){var r,i,o,s=e.getAttribute("name"),l=e.getAttribute("property"),c=e.getAttribute("content");if(c){if(r=null,i=null,l&&(r=l.match(n)))for(o=r.length-1;o>=0;o--)i=r[o].toLowerCase().replace(/\s/g,""),t[i]=c.trim();!r&&s&&a.test(s)&&(i=s,c&&(i=i.toLowerCase().replace(/\s/g,"").replace(/\./g,":"),t[i]=c.trim()))}}),e.title=t["dc:title"]||t["dcterm:title"]||t["og:title"]||t["weibo:article:title"]||t["weibo:webpage:title"]||t.title||t["twitter:title"],e.title||(e.title=this._getArticleTitle()),e.byline=t["dc:creator"]||t["dcterm:creator"]||t.author,e.excerpt=t["dc:description"]||t["dcterm:description"]||t["og:description"]||t["weibo:article:description"]||t["weibo:webpage:description"]||t.description||t["twitter:description"],e.siteName=t["og:site_name"],e},_removeScripts:function(e){this._removeNodes(e.getElementsByTagName("script"),function(e){return e.nodeValue="",e.removeAttribute("src"),!0}),this._removeNodes(e.getElementsByTagName("noscript"))},_hasSingleTagInsideElement:function(e,t){return 1==e.children.length&&e.children[0].tagName===t&&!this._someNode(e.childNodes,function(e){return e.nodeType===this.TEXT_NODE&&this.REGEXPS.hasContent.test(e.textContent)})},_isElementWithoutContent:function(e){return e.nodeType===this.ELEMENT_NODE&&0==e.textContent.trim().length&&(0==e.children.length||e.children.length==e.getElementsByTagName("br").length+e.getElementsByTagName("hr").length)},_hasChildBlockElement:function(e){return this._someNode(e.childNodes,function(e){return-1!==this.DIV_TO_P_ELEMS.indexOf(e.tagName)||this._hasChildBlockElement(e)})},_isPhrasingContent:function(e){return e.nodeType===this.TEXT_NODE||-1!==this.PHRASING_ELEMS.indexOf(e.tagName)||("A"===e.tagName||"DEL"===e.tagName||"INS"===e.tagName)&&this._everyNode(e.childNodes,this._isPhrasingContent)},_isWhitespace:function(e){return e.nodeType===this.TEXT_NODE&&0===e.textContent.trim().length||e.nodeType===this.ELEMENT_NODE&&"BR"===e.tagName},_getInnerText:function(e,t){t=void 0===t||t;var r=e.textContent.trim();return t?r.replace(this.REGEXPS.normalize," "):r},_getCharCount:function(e,t){return t=t||",",this._getInnerText(e).split(t).length-1},_cleanStyles:function(e){var t,r;if(e&&"svg"!==e.tagName.toLowerCase()){for(t=0;t0&&a>r)return!1;if(e.parentNode.tagName===t&&(!n||n(e.parentNode)))return!0;e=e.parentNode,a++}return!1},_getRowAndColumnCount:function(e){var t,r,n,a,i,o,s=0,l=0,c=e.getElementsByTagName("tr");for(t=0;t0?r._readabilityDataTable=!0:["col","colgroup","tfoot","thead","th"].some(function(e){return!!r.getElementsByTagName(e)[0]})?(this.log("Data table because found data-y descendant"),r._readabilityDataTable=!0):r.getElementsByTagName("table")[0]?r._readabilityDataTable=!1:(a=this._getRowAndColumnCount(r),r._readabilityDataTable=a.rows>=10||a.columns>4||a.rows*a.columns>10):r._readabilityDataTable=!1:r._readabilityDataTable=!1},_cleanConditionally:function(e,t){if(this._flagIsActive(this.FLAG_CLEAN_CONDITIONALLY)){var r="ul"===t||"ol"===t;this._removeNodes(e.getElementsByTagName(t),function(e){var n,a,i,o,s,l,c,u,d,h,f,p=function(e){return e._readabilityDataTable};if("table"===t&&p(e))return!1;if(this._hasAncestorTag(e,"table",-1,p))return!1;if(n=this._getClassWeight(e),0,this.log("Cleaning Conditionally",e),0>n+0)return!0;if(this._getCharCount(e,",")<10){for(a=e.getElementsByTagName("p").length,i=e.getElementsByTagName("img").length,o=e.getElementsByTagName("li").length-100,s=e.getElementsByTagName("input").length,l=0,c=this._concatNodeLists(e.getElementsByTagName("object"),e.getElementsByTagName("embed"),e.getElementsByTagName("iframe")),u=0;u1&&.5>a/i&&!this._hasAncestorTag(e,"figure")||!r&&o>a||s>Math.floor(a/3)||!r&&25>f&&(0===i||i>2)&&!this._hasAncestorTag(e,"figure")||!r&&25>n&&h>.2||n>=25&&h>.5||1===l&&75>f||l>1}return!1})}},_cleanMatchedNodes:function(e,t){for(var r=this._getNextNode(e,!0),n=this._getNextNode(e);n&&n!=r;)n=t(n,n.className+" "+n.id)?this._removeAndGetNext(n):this._getNextNode(n)},_cleanHeaders:function(e){for(var t=1;3>t;t+=1)this._removeNodes(e.getElementsByTagName("h"+t),function(e){return this._getClassWeight(e)<0})},_flagIsActive:function(e){return(this._flags&e)>0},_removeFlag:function(e){this._flags=this._flags&~e},_isProbablyVisible:function(e){return!(e.style&&"none"==e.style.display||e.hasAttribute("hidden"))},parse:function(){var e,t,r,n,a;if(this._maxElemsToParse>0&&(e=this._doc.getElementsByTagName("*").length)>this._maxElemsToParse)throw new Error("Aborting parsing document; "+e+" elements found");return this._removeScripts(this._doc),this._prepDocument(),t=this._getArticleMetadata(),this._articleTitle=t.title,(r=this._grabArticle())?(this.log("Grabbed: "+r.innerHTML),this._postProcessContent(r),t.excerpt||(n=r.getElementsByTagName("p")).length>0&&(t.excerpt=n[0].textContent.trim()),a=r.textContent,{title:this._articleTitle,byline:t.byline||this._articleByline,dir:this._articleDir,content:r.innerHTML,textContent:a,length:a.length,excerpt:t.excerpt,siteName:t.siteName||this._articleSiteName}):null}};var ue=Object.freeze({Readability:ce}),de=r(function(e){(function(){function t(e){var t={omitExtraWLInCodeBlocks:{defaultValue:!1,describe:"Omit the default extra whiteline added to code blocks",type:"boolean"},noHeaderId:{defaultValue:!1,describe:"Turn on/off generated header id",type:"boolean"},prefixHeaderId:{defaultValue:!1,describe:"Add a prefix to the generated header ids. Passing a string will prefix that string to the header id. Setting to true will add a generic 'section-' prefix",type:"string"},rawPrefixHeaderId:{defaultValue:!1,describe:'Setting this option to true will prevent showdown from modifying the prefix. This might result in malformed IDs (if, for instance, the " char is used in the prefix)',type:"boolean"},ghCompatibleHeaderId:{defaultValue:!1,describe:"Generate header ids compatible with github style (spaces are replaced with dashes, a bunch of non alphanumeric chars are removed)",type:"boolean"},rawHeaderId:{defaultValue:!1,describe:"Remove only spaces, ' and \" from generated header ids (including prefixes), replacing them with dashes (-). WARNING: This might result in malformed ids",type:"boolean"},headerLevelStart:{defaultValue:!1,describe:"The header blocks level start",type:"integer"},parseImgDimensions:{defaultValue:!1,describe:"Turn on/off image dimension parsing",type:"boolean"},simplifiedAutoLink:{defaultValue:!1,describe:"Turn on/off GFM autolink style",type:"boolean"},excludeTrailingPunctuationFromURLs:{defaultValue:!1,describe:"Excludes trailing punctuation from links generated with autoLinking",type:"boolean"},literalMidWordUnderscores:{defaultValue:!1,describe:"Parse midword underscores as literal underscores",type:"boolean"},literalMidWordAsterisks:{defaultValue:!1,describe:"Parse midword asterisks as literal asterisks",type:"boolean"},strikethrough:{defaultValue:!1,describe:"Turn on/off strikethrough support",type:"boolean"},tables:{defaultValue:!1,describe:"Turn on/off tables support",type:"boolean"},tablesHeaderId:{defaultValue:!1,describe:"Add an id to table headers",type:"boolean"},ghCodeBlocks:{defaultValue:!0,describe:"Turn on/off GFM fenced code blocks support",type:"boolean"},tasklists:{defaultValue:!1,describe:"Turn on/off GFM tasklist support",type:"boolean"},smoothLivePreview:{defaultValue:!1,describe:"Prevents weird effects in live previews due to incomplete input",type:"boolean"},smartIndentationFix:{defaultValue:!1,description:"Tries to smartly fix indentation in es6 strings",type:"boolean"},disableForced4SpacesIndentedSublists:{defaultValue:!1,description:"Disables the requirement of indenting nested sublists by 4 spaces",type:"boolean"},simpleLineBreaks:{defaultValue:!1,description:"Parses simple line breaks as
(GFM Style)",type:"boolean"},requireSpaceBeforeHeadingText:{defaultValue:!1,description:"Makes adding a space between `#` and the header text mandatory (GFM Style)",type:"boolean"},ghMentions:{defaultValue:!1,description:"Enables github @mentions",type:"boolean"},ghMentionsLink:{defaultValue:"https://github.com/{u}",description:"Changes the link generated by @mentions. Only applies if ghMentions option is enabled.",type:"string"},encodeEmails:{defaultValue:!0,description:"Encode e-mail addresses through the use of Character Entities, transforming ASCII e-mail addresses into its equivalent decimal entities",type:"boolean"},openLinksInNewWindow:{defaultValue:!1,description:"Open all links in new windows",type:"boolean"},backslashEscapesHTMLTags:{defaultValue:!1,description:"Support for HTML Tag escaping. ex:
foo
",type:"boolean"},emoji:{defaultValue:!1,description:"Enable emoji support. Ex: `this is a :smile: emoji`",type:"boolean"},underline:{defaultValue:!1,description:"Enable support for underline. Syntax is double or triple underscores: `__underline word__`. With this option enabled, underscores no longer parses into `` and ``",type:"boolean"},completeHTMLDocument:{defaultValue:!1,description:"Outputs a complete html document, including ``, `` and `` tags",type:"boolean"},metadata:{defaultValue:!1,description:"Enable support for document metadata (defined at the top of the document between `«««` and `»»»` or between `---` and `---`).",type:"boolean"},splitAdjacentBlockquotes:{defaultValue:!1,description:"Split adjacent blockquote blocks",type:"boolean"}};if(!1===e)return JSON.parse(JSON.stringify(t));var r={};for(var n in t)t.hasOwnProperty(n)&&(r[n]=t[n].defaultValue);return r}function r(e,t){var r=t?"Error in "+t+" extension->":"Error in unnamed extension",a={valid:!0,error:""};i.helper.isArray(e)||(e=[e]);for(var o=0;o").replace(/&/g,"&")};var d=function(e,t,r,n){var a,i,o,s,l,c=n||"",u=c.indexOf("g")>-1,d=new RegExp(t+"|"+r,"g"+c.replace(/g/g,"")),h=new RegExp(t,c.replace(/g/g,"")),f=[];do{for(a=0;o=d.exec(e);)if(h.test(o[0]))a++||(s=(i=d.lastIndex)-o[0].length);else if(a&&!--a){l=o.index+o[0].length;var p={left:{start:s,end:i},match:{start:i,end:o.index},right:{start:o.index,end:l},wholeMatch:{start:s,end:l}};if(f.push(p),!u)return f}}while(a&&(d.lastIndex=i));return f};i.helper.matchRecursiveRegExp=function(e,t,r,n){for(var a=d(e,t,r,n),i=[],o=0;o0){var u=[];0!==s[0].wholeMatch.start&&u.push(e.slice(0,s[0].wholeMatch.start));for(var h=0;h=0?n+(r||0):n},i.helper.splitAtIndex=function(e,t){if(!i.helper.isString(e))throw"InvalidArgumentError: first parameter of showdown.helper.regexIndexOf function must be a string";return[e.substring(0,t),e.substring(t)]},i.helper.encodeEmailAddress=function(e){var t=[function(e){return"&#"+e.charCodeAt(0)+";"},function(e){return"&#x"+e.charCodeAt(0).toString(16)+";"},function(e){return e}];return e.replace(/./g,function(e){if("@"===e)e=t[Math.floor(2*Math.random())](e);else{var r=Math.random();e=r>.9?t[2](e):r>.45?t[1](e):t[0](e)}return e})},i.helper.padEnd=function(e,t,r){return t>>=0,r=String(r||" "),e.length>t?String(e):((t-=e.length)>r.length&&(r+=r.repeat(t/r.length)),String(e)+r.slice(0,t))},"undefined"==typeof console&&(console={warn:function(e){alert(e)},log:function(e){alert(e)},error:function(e){throw e}}),i.helper.regexes={asteriskDashAndColon:/([*_:~])/g},i.helper.emojis={"+1":"👍","-1":"👎",100:"💯",1234:"🔢","1st_place_medal":"🥇","2nd_place_medal":"🥈","3rd_place_medal":"🥉","8ball":"🎱",a:"🅰️",ab:"🆎",abc:"🔤",abcd:"🔡",accept:"🉑",aerial_tramway:"🚡",airplane:"✈️",alarm_clock:"⏰",alembic:"⚗️",alien:"👽",ambulance:"🚑",amphora:"🏺",anchor:"⚓️",angel:"👼",anger:"💢",angry:"😠",anguished:"😧",ant:"🐜",apple:"🍎",aquarius:"♒️",aries:"♈️",arrow_backward:"◀️",arrow_double_down:"⏬",arrow_double_up:"⏫",arrow_down:"⬇️",arrow_down_small:"🔽",arrow_forward:"▶️",arrow_heading_down:"⤵️",arrow_heading_up:"⤴️",arrow_left:"⬅️",arrow_lower_left:"↙️",arrow_lower_right:"↘️",arrow_right:"➡️",arrow_right_hook:"↪️",arrow_up:"⬆️",arrow_up_down:"↕️",arrow_up_small:"🔼",arrow_upper_left:"↖️",arrow_upper_right:"↗️",arrows_clockwise:"🔃",arrows_counterclockwise:"🔄",art:"🎨",articulated_lorry:"🚛",artificial_satellite:"🛰",astonished:"😲",athletic_shoe:"👟",atm:"🏧",atom_symbol:"⚛️",avocado:"🥑",b:"🅱️",baby:"👶",baby_bottle:"🍼",baby_chick:"🐤",baby_symbol:"🚼",back:"🔙",bacon:"🥓",badminton:"🏸",baggage_claim:"🛄",baguette_bread:"🥖",balance_scale:"⚖️",balloon:"🎈",ballot_box:"🗳",ballot_box_with_check:"☑️",bamboo:"🎍",banana:"🍌",bangbang:"‼️",bank:"🏦",bar_chart:"📊",barber:"💈",baseball:"⚾️",basketball:"🏀",basketball_man:"⛹️",basketball_woman:"⛹️‍♀️",bat:"🦇",bath:"🛀",bathtub:"🛁",battery:"🔋",beach_umbrella:"🏖",bear:"🐻",bed:"🛏",bee:"🐝",beer:"🍺",beers:"🍻",beetle:"🐞",beginner:"🔰",bell:"🔔",bellhop_bell:"🛎",bento:"🍱",biking_man:"🚴",bike:"🚲",biking_woman:"🚴‍♀️",bikini:"👙",biohazard:"☣️",bird:"🐦",birthday:"🎂",black_circle:"⚫️",black_flag:"🏴",black_heart:"🖤",black_joker:"🃏",black_large_square:"⬛️",black_medium_small_square:"◾️",black_medium_square:"◼️",black_nib:"✒️",black_small_square:"▪️",black_square_button:"🔲",blonde_man:"👱",blonde_woman:"👱‍♀️",blossom:"🌼",blowfish:"🐡",blue_book:"📘",blue_car:"🚙",blue_heart:"💙",blush:"😊",boar:"🐗",boat:"⛵️",bomb:"💣",book:"📖",bookmark:"🔖",bookmark_tabs:"📑",books:"📚",boom:"💥",boot:"👢",bouquet:"💐",bowing_man:"🙇",bow_and_arrow:"🏹",bowing_woman:"🙇‍♀️",bowling:"🎳",boxing_glove:"🥊",boy:"👦",bread:"🍞",bride_with_veil:"👰",bridge_at_night:"🌉",briefcase:"💼",broken_heart:"💔",bug:"🐛",building_construction:"🏗",bulb:"💡",bullettrain_front:"🚅",bullettrain_side:"🚄",burrito:"🌯",bus:"🚌",business_suit_levitating:"🕴",busstop:"🚏",bust_in_silhouette:"👤",busts_in_silhouette:"👥",butterfly:"🦋",cactus:"🌵",cake:"🍰",calendar:"📆",call_me_hand:"🤙",calling:"📲",camel:"🐫",camera:"📷",camera_flash:"📸",camping:"🏕",cancer:"♋️",candle:"🕯",candy:"🍬",canoe:"🛶",capital_abcd:"🔠",capricorn:"♑️",car:"🚗",card_file_box:"🗃",card_index:"📇",card_index_dividers:"🗂",carousel_horse:"🎠",carrot:"🥕",cat:"🐱",cat2:"🐈",cd:"💿",chains:"⛓",champagne:"🍾",chart:"💹",chart_with_downwards_trend:"📉",chart_with_upwards_trend:"📈",checkered_flag:"🏁",cheese:"🧀",cherries:"🍒",cherry_blossom:"🌸",chestnut:"🌰",chicken:"🐔",children_crossing:"🚸",chipmunk:"🐿",chocolate_bar:"🍫",christmas_tree:"🎄",church:"⛪️",cinema:"🎦",circus_tent:"🎪",city_sunrise:"🌇",city_sunset:"🌆",cityscape:"🏙",cl:"🆑",clamp:"🗜",clap:"👏",clapper:"🎬",classical_building:"🏛",clinking_glasses:"🥂",clipboard:"📋",clock1:"🕐",clock10:"🕙",clock1030:"🕥",clock11:"🕚",clock1130:"🕦",clock12:"🕛",clock1230:"🕧",clock130:"🕜",clock2:"🕑",clock230:"🕝",clock3:"🕒",clock330:"🕞",clock4:"🕓",clock430:"🕟",clock5:"🕔",clock530:"🕠",clock6:"🕕",clock630:"🕡",clock7:"🕖",clock730:"🕢",clock8:"🕗",clock830:"🕣",clock9:"🕘",clock930:"🕤",closed_book:"📕",closed_lock_with_key:"🔐",closed_umbrella:"🌂",cloud:"☁️",cloud_with_lightning:"🌩",cloud_with_lightning_and_rain:"⛈",cloud_with_rain:"🌧",cloud_with_snow:"🌨",clown_face:"🤡",clubs:"♣️",cocktail:"🍸",coffee:"☕️",coffin:"⚰️",cold_sweat:"😰",comet:"☄️",computer:"💻",computer_mouse:"🖱",confetti_ball:"🎊",confounded:"😖",confused:"😕",congratulations:"㊗️",construction:"🚧",construction_worker_man:"👷",construction_worker_woman:"👷‍♀️",control_knobs:"🎛",convenience_store:"🏪",cookie:"🍪",cool:"🆒",policeman:"👮",copyright:"©️",corn:"🌽",couch_and_lamp:"🛋",couple:"👫",couple_with_heart_woman_man:"💑",couple_with_heart_man_man:"👨‍❤️‍👨",couple_with_heart_woman_woman:"👩‍❤️‍👩",couplekiss_man_man:"👨‍❤️‍💋‍👨",couplekiss_man_woman:"💏",couplekiss_woman_woman:"👩‍❤️‍💋‍👩",cow:"🐮",cow2:"🐄",cowboy_hat_face:"🤠",crab:"🦀",crayon:"🖍",credit_card:"💳",crescent_moon:"🌙",cricket:"🏏",crocodile:"🐊",croissant:"🥐",crossed_fingers:"🤞",crossed_flags:"🎌",crossed_swords:"⚔️",crown:"👑",cry:"😢",crying_cat_face:"😿",crystal_ball:"🔮",cucumber:"🥒",cupid:"💘",curly_loop:"➰",currency_exchange:"💱",curry:"🍛",custard:"🍮",customs:"🛃",cyclone:"🌀",dagger:"🗡",dancer:"💃",dancing_women:"👯",dancing_men:"👯‍♂️",dango:"🍡",dark_sunglasses:"🕶",dart:"🎯",dash:"💨",date:"📅",deciduous_tree:"🌳",deer:"🦌",department_store:"🏬",derelict_house:"🏚",desert:"🏜",desert_island:"🏝",desktop_computer:"🖥",male_detective:"🕵️",diamond_shape_with_a_dot_inside:"💠",diamonds:"♦️",disappointed:"😞",disappointed_relieved:"😥",dizzy:"💫",dizzy_face:"😵",do_not_litter:"🚯",dog:"🐶",dog2:"🐕",dollar:"💵",dolls:"🎎",dolphin:"🐬",door:"🚪",doughnut:"🍩",dove:"🕊",dragon:"🐉",dragon_face:"🐲",dress:"👗",dromedary_camel:"🐪",drooling_face:"🤤",droplet:"💧",drum:"🥁",duck:"🦆",dvd:"📀","e-mail":"📧",eagle:"🦅",ear:"👂",ear_of_rice:"🌾",earth_africa:"🌍",earth_americas:"🌎",earth_asia:"🌏",egg:"🥚",eggplant:"🍆",eight_pointed_black_star:"✴️",eight_spoked_asterisk:"✳️",electric_plug:"🔌",elephant:"🐘",email:"✉️",end:"🔚",envelope_with_arrow:"📩",euro:"💶",european_castle:"🏰",european_post_office:"🏤",evergreen_tree:"🌲",exclamation:"❗️",expressionless:"😑",eye:"👁",eye_speech_bubble:"👁‍🗨",eyeglasses:"👓",eyes:"👀",face_with_head_bandage:"🤕",face_with_thermometer:"🤒",fist_oncoming:"👊",factory:"🏭",fallen_leaf:"🍂",family_man_woman_boy:"👪",family_man_boy:"👨‍👦",family_man_boy_boy:"👨‍👦‍👦",family_man_girl:"👨‍👧",family_man_girl_boy:"👨‍👧‍👦",family_man_girl_girl:"👨‍👧‍👧",family_man_man_boy:"👨‍👨‍👦",family_man_man_boy_boy:"👨‍👨‍👦‍👦",family_man_man_girl:"👨‍👨‍👧",family_man_man_girl_boy:"👨‍👨‍👧‍👦",family_man_man_girl_girl:"👨‍👨‍👧‍👧",family_man_woman_boy_boy:"👨‍👩‍👦‍👦",family_man_woman_girl:"👨‍👩‍👧",family_man_woman_girl_boy:"👨‍👩‍👧‍👦",family_man_woman_girl_girl:"👨‍👩‍👧‍👧",family_woman_boy:"👩‍👦",family_woman_boy_boy:"👩‍👦‍👦",family_woman_girl:"👩‍👧",family_woman_girl_boy:"👩‍👧‍👦",family_woman_girl_girl:"👩‍👧‍👧",family_woman_woman_boy:"👩‍👩‍👦",family_woman_woman_boy_boy:"👩‍👩‍👦‍👦",family_woman_woman_girl:"👩‍👩‍👧",family_woman_woman_girl_boy:"👩‍👩‍👧‍👦",family_woman_woman_girl_girl:"👩‍👩‍👧‍👧",fast_forward:"⏩",fax:"📠",fearful:"😨",feet:"🐾",female_detective:"🕵️‍♀️",ferris_wheel:"🎡",ferry:"⛴",field_hockey:"🏑",file_cabinet:"🗄",file_folder:"📁",film_projector:"📽",film_strip:"🎞",fire:"🔥",fire_engine:"🚒",fireworks:"🎆",first_quarter_moon:"🌓",first_quarter_moon_with_face:"🌛",fish:"🐟",fish_cake:"🍥",fishing_pole_and_fish:"🎣",fist_raised:"✊",fist_left:"🤛",fist_right:"🤜",flags:"🎏",flashlight:"🔦",fleur_de_lis:"⚜️",flight_arrival:"🛬",flight_departure:"🛫",floppy_disk:"💾",flower_playing_cards:"🎴",flushed:"😳",fog:"🌫",foggy:"🌁",football:"🏈",footprints:"👣",fork_and_knife:"🍴",fountain:"⛲️",fountain_pen:"🖋",four_leaf_clover:"🍀",fox_face:"🦊",framed_picture:"🖼",free:"🆓",fried_egg:"🍳",fried_shrimp:"🍤",fries:"🍟",frog:"🐸",frowning:"😦",frowning_face:"☹️",frowning_man:"🙍‍♂️",frowning_woman:"🙍",middle_finger:"🖕",fuelpump:"⛽️",full_moon:"🌕",full_moon_with_face:"🌝",funeral_urn:"⚱️",game_die:"🎲",gear:"⚙️",gem:"💎",gemini:"♊️",ghost:"👻",gift:"🎁",gift_heart:"💝",girl:"👧",globe_with_meridians:"🌐",goal_net:"🥅",goat:"🐐",golf:"⛳️",golfing_man:"🏌️",golfing_woman:"🏌️‍♀️",gorilla:"🦍",grapes:"🍇",green_apple:"🍏",green_book:"📗",green_heart:"💚",green_salad:"🥗",grey_exclamation:"❕",grey_question:"❔",grimacing:"😬",grin:"😁",grinning:"😀",guardsman:"💂",guardswoman:"💂‍♀️",guitar:"🎸",gun:"🔫",haircut_woman:"💇",haircut_man:"💇‍♂️",hamburger:"🍔",hammer:"🔨",hammer_and_pick:"⚒",hammer_and_wrench:"🛠",hamster:"🐹",hand:"✋",handbag:"👜",handshake:"🤝",hankey:"💩",hatched_chick:"🐥",hatching_chick:"🐣",headphones:"🎧",hear_no_evil:"🙉",heart:"❤️",heart_decoration:"💟",heart_eyes:"😍",heart_eyes_cat:"😻",heartbeat:"💓",heartpulse:"💗",hearts:"♥️",heavy_check_mark:"✔️",heavy_division_sign:"➗",heavy_dollar_sign:"💲",heavy_heart_exclamation:"❣️",heavy_minus_sign:"➖",heavy_multiplication_x:"✖️",heavy_plus_sign:"➕",helicopter:"🚁",herb:"🌿",hibiscus:"🌺",high_brightness:"🔆",high_heel:"👠",hocho:"🔪",hole:"🕳",honey_pot:"🍯",horse:"🐴",horse_racing:"🏇",hospital:"🏥",hot_pepper:"🌶",hotdog:"🌭",hotel:"🏨",hotsprings:"♨️",hourglass:"⌛️",hourglass_flowing_sand:"⏳",house:"🏠",house_with_garden:"🏡",houses:"🏘",hugs:"🤗",hushed:"😯",ice_cream:"🍨",ice_hockey:"🏒",ice_skate:"⛸",icecream:"🍦",id:"🆔",ideograph_advantage:"🉐",imp:"👿",inbox_tray:"📥",incoming_envelope:"📨",tipping_hand_woman:"💁",information_source:"ℹ️",innocent:"😇",interrobang:"⁉️",iphone:"📱",izakaya_lantern:"🏮",jack_o_lantern:"🎃",japan:"🗾",japanese_castle:"🏯",japanese_goblin:"👺",japanese_ogre:"👹",jeans:"👖",joy:"😂",joy_cat:"😹",joystick:"🕹",kaaba:"🕋",key:"🔑",keyboard:"⌨️",keycap_ten:"🔟",kick_scooter:"🛴",kimono:"👘",kiss:"💋",kissing:"😗",kissing_cat:"😽",kissing_closed_eyes:"😚",kissing_heart:"😘",kissing_smiling_eyes:"😙",kiwi_fruit:"🥝",koala:"🐨",koko:"🈁",label:"🏷",large_blue_circle:"🔵",large_blue_diamond:"🔷",large_orange_diamond:"🔶",last_quarter_moon:"🌗",last_quarter_moon_with_face:"🌜",latin_cross:"✝️",laughing:"😆",leaves:"🍃",ledger:"📒",left_luggage:"🛅",left_right_arrow:"↔️",leftwards_arrow_with_hook:"↩️",lemon:"🍋",leo:"♌️",leopard:"🐆",level_slider:"🎚",libra:"♎️",light_rail:"🚈",link:"🔗",lion:"🦁",lips:"👄",lipstick:"💄",lizard:"🦎",lock:"🔒",lock_with_ink_pen:"🔏",lollipop:"🍭",loop:"➿",loud_sound:"🔊",loudspeaker:"📢",love_hotel:"🏩",love_letter:"💌",low_brightness:"🔅",lying_face:"🤥",m:"Ⓜ️",mag:"🔍",mag_right:"🔎",mahjong:"🀄️",mailbox:"📫",mailbox_closed:"📪",mailbox_with_mail:"📬",mailbox_with_no_mail:"📭",man:"👨",man_artist:"👨‍🎨",man_astronaut:"👨‍🚀",man_cartwheeling:"🤸‍♂️",man_cook:"👨‍🍳",man_dancing:"🕺",man_facepalming:"🤦‍♂️",man_factory_worker:"👨‍🏭",man_farmer:"👨‍🌾",man_firefighter:"👨‍🚒",man_health_worker:"👨‍⚕️",man_in_tuxedo:"🤵",man_judge:"👨‍⚖️",man_juggling:"🤹‍♂️",man_mechanic:"👨‍🔧",man_office_worker:"👨‍💼",man_pilot:"👨‍✈️",man_playing_handball:"🤾‍♂️",man_playing_water_polo:"🤽‍♂️",man_scientist:"👨‍🔬",man_shrugging:"🤷‍♂️",man_singer:"👨‍🎤",man_student:"👨‍🎓",man_teacher:"👨‍🏫",man_technologist:"👨‍💻",man_with_gua_pi_mao:"👲",man_with_turban:"👳",tangerine:"🍊",mans_shoe:"👞",mantelpiece_clock:"🕰",maple_leaf:"🍁",martial_arts_uniform:"🥋",mask:"😷",massage_woman:"💆",massage_man:"💆‍♂️",meat_on_bone:"🍖",medal_military:"🎖",medal_sports:"🏅",mega:"📣",melon:"🍈",memo:"📝",men_wrestling:"🤼‍♂️",menorah:"🕎",mens:"🚹",metal:"🤘",metro:"🚇",microphone:"🎤",microscope:"🔬",milk_glass:"🥛",milky_way:"🌌",minibus:"🚐",minidisc:"💽",mobile_phone_off:"📴",money_mouth_face:"🤑",money_with_wings:"💸",moneybag:"💰",monkey:"🐒",monkey_face:"🐵",monorail:"🚝",moon:"🌔",mortar_board:"🎓",mosque:"🕌",motor_boat:"🛥",motor_scooter:"🛵",motorcycle:"🏍",motorway:"🛣",mount_fuji:"🗻",mountain:"⛰",mountain_biking_man:"🚵",mountain_biking_woman:"🚵‍♀️",mountain_cableway:"🚠",mountain_railway:"🚞",mountain_snow:"🏔",mouse:"🐭",mouse2:"🐁",movie_camera:"🎥",moyai:"🗿",mrs_claus:"🤶",muscle:"💪",mushroom:"🍄",musical_keyboard:"🎹",musical_note:"🎵",musical_score:"🎼",mute:"🔇",nail_care:"💅",name_badge:"📛",national_park:"🏞",nauseated_face:"🤢",necktie:"👔",negative_squared_cross_mark:"❎",nerd_face:"🤓",neutral_face:"😐",new:"🆕",new_moon:"🌑",new_moon_with_face:"🌚",newspaper:"📰",newspaper_roll:"🗞",next_track_button:"⏭",ng:"🆖",no_good_man:"🙅‍♂️",no_good_woman:"🙅",night_with_stars:"🌃",no_bell:"🔕",no_bicycles:"🚳",no_entry:"⛔️",no_entry_sign:"🚫",no_mobile_phones:"📵",no_mouth:"😶",no_pedestrians:"🚷",no_smoking:"🚭","non-potable_water":"🚱",nose:"👃",notebook:"📓",notebook_with_decorative_cover:"📔",notes:"🎶",nut_and_bolt:"🔩",o:"⭕️",o2:"🅾️",ocean:"🌊",octopus:"🐙",oden:"🍢",office:"🏢",oil_drum:"🛢",ok:"🆗",ok_hand:"👌",ok_man:"🙆‍♂️",ok_woman:"🙆",old_key:"🗝",older_man:"👴",older_woman:"👵",om:"🕉",on:"🔛",oncoming_automobile:"🚘",oncoming_bus:"🚍",oncoming_police_car:"🚔",oncoming_taxi:"🚖",open_file_folder:"📂",open_hands:"👐",open_mouth:"😮",open_umbrella:"☂️",ophiuchus:"⛎",orange_book:"📙",orthodox_cross:"☦️",outbox_tray:"📤",owl:"🦉",ox:"🐂",package:"📦",page_facing_up:"📄",page_with_curl:"📃",pager:"📟",paintbrush:"🖌",palm_tree:"🌴",pancakes:"🥞",panda_face:"🐼",paperclip:"📎",paperclips:"🖇",parasol_on_ground:"⛱",parking:"🅿️",part_alternation_mark:"〽️",partly_sunny:"⛅️",passenger_ship:"🛳",passport_control:"🛂",pause_button:"⏸",peace_symbol:"☮️",peach:"🍑",peanuts:"🥜",pear:"🍐",pen:"🖊",pencil2:"✏️",penguin:"🐧",pensive:"😔",performing_arts:"🎭",persevere:"😣",person_fencing:"🤺",pouting_woman:"🙎",phone:"☎️",pick:"⛏",pig:"🐷",pig2:"🐖",pig_nose:"🐽",pill:"💊",pineapple:"🍍",ping_pong:"🏓",pisces:"♓️",pizza:"🍕",place_of_worship:"🛐",plate_with_cutlery:"🍽",play_or_pause_button:"⏯",point_down:"👇",point_left:"👈",point_right:"👉",point_up:"☝️",point_up_2:"👆",police_car:"🚓",policewoman:"👮‍♀️",poodle:"🐩",popcorn:"🍿",post_office:"🏣",postal_horn:"📯",postbox:"📮",potable_water:"🚰",potato:"🥔",pouch:"👝",poultry_leg:"🍗",pound:"💷",rage:"😡",pouting_cat:"😾",pouting_man:"🙎‍♂️",pray:"🙏",prayer_beads:"📿",pregnant_woman:"🤰",previous_track_button:"⏮",prince:"🤴",princess:"👸",printer:"🖨",purple_heart:"💜",purse:"👛",pushpin:"📌",put_litter_in_its_place:"🚮",question:"❓",rabbit:"🐰",rabbit2:"🐇",racehorse:"🐎",racing_car:"🏎",radio:"📻",radio_button:"🔘",radioactive:"☢️",railway_car:"🚃",railway_track:"🛤",rainbow:"🌈",rainbow_flag:"🏳️‍🌈",raised_back_of_hand:"🤚",raised_hand_with_fingers_splayed:"🖐",raised_hands:"🙌",raising_hand_woman:"🙋",raising_hand_man:"🙋‍♂️",ram:"🐏",ramen:"🍜",rat:"🐀",record_button:"⏺",recycle:"♻️",red_circle:"🔴",registered:"®️",relaxed:"☺️",relieved:"😌",reminder_ribbon:"🎗",repeat:"🔁",repeat_one:"🔂",rescue_worker_helmet:"⛑",restroom:"🚻",revolving_hearts:"💞",rewind:"⏪",rhinoceros:"🦏",ribbon:"🎀",rice:"🍚",rice_ball:"🍙",rice_cracker:"🍘",rice_scene:"🎑",right_anger_bubble:"🗯",ring:"💍",robot:"🤖",rocket:"🚀",rofl:"🤣",roll_eyes:"🙄",roller_coaster:"🎢",rooster:"🐓",rose:"🌹",rosette:"🏵",rotating_light:"🚨",round_pushpin:"📍",rowing_man:"🚣",rowing_woman:"🚣‍♀️",rugby_football:"🏉",running_man:"🏃",running_shirt_with_sash:"🎽",running_woman:"🏃‍♀️",sa:"🈂️",sagittarius:"♐️",sake:"🍶",sandal:"👡",santa:"🎅",satellite:"📡",saxophone:"🎷",school:"🏫",school_satchel:"🎒",scissors:"✂️",scorpion:"🦂",scorpius:"♏️",scream:"😱",scream_cat:"🙀",scroll:"📜",seat:"💺",secret:"㊙️",see_no_evil:"🙈",seedling:"🌱",selfie:"🤳",shallow_pan_of_food:"🥘",shamrock:"☘️",shark:"🦈",shaved_ice:"🍧",sheep:"🐑",shell:"🐚",shield:"🛡",shinto_shrine:"⛩",ship:"🚢",shirt:"👕",shopping:"🛍",shopping_cart:"🛒",shower:"🚿",shrimp:"🦐",signal_strength:"📶",six_pointed_star:"🔯",ski:"🎿",skier:"⛷",skull:"💀",skull_and_crossbones:"☠️",sleeping:"😴",sleeping_bed:"🛌",sleepy:"😪",slightly_frowning_face:"🙁",slightly_smiling_face:"🙂",slot_machine:"🎰",small_airplane:"🛩",small_blue_diamond:"🔹",small_orange_diamond:"🔸",small_red_triangle:"🔺",small_red_triangle_down:"🔻",smile:"😄",smile_cat:"😸",smiley:"😃",smiley_cat:"😺",smiling_imp:"😈",smirk:"😏",smirk_cat:"😼",smoking:"🚬",snail:"🐌",snake:"🐍",sneezing_face:"🤧",snowboarder:"🏂",snowflake:"❄️",snowman:"⛄️",snowman_with_snow:"☃️",sob:"😭",soccer:"⚽️",soon:"🔜",sos:"🆘",sound:"🔉",space_invader:"👾",spades:"♠️",spaghetti:"🍝",sparkle:"❇️",sparkler:"🎇",sparkles:"✨",sparkling_heart:"💖",speak_no_evil:"🙊",speaker:"🔈",speaking_head:"🗣",speech_balloon:"💬",speedboat:"🚤",spider:"🕷",spider_web:"🕸",spiral_calendar:"🗓",spiral_notepad:"🗒",spoon:"🥄",squid:"🦑",stadium:"🏟",star:"⭐️",star2:"🌟",star_and_crescent:"☪️",star_of_david:"✡️",stars:"🌠",station:"🚉",statue_of_liberty:"🗽",steam_locomotive:"🚂",stew:"🍲",stop_button:"⏹",stop_sign:"🛑",stopwatch:"⏱",straight_ruler:"📏",strawberry:"🍓",stuck_out_tongue:"😛",stuck_out_tongue_closed_eyes:"😝",stuck_out_tongue_winking_eye:"😜",studio_microphone:"🎙",stuffed_flatbread:"🥙",sun_behind_large_cloud:"🌥",sun_behind_rain_cloud:"🌦",sun_behind_small_cloud:"🌤",sun_with_face:"🌞",sunflower:"🌻",sunglasses:"😎",sunny:"☀️",sunrise:"🌅",sunrise_over_mountains:"🌄",surfing_man:"🏄",surfing_woman:"🏄‍♀️",sushi:"🍣",suspension_railway:"🚟",sweat:"😓",sweat_drops:"💦",sweat_smile:"😅",sweet_potato:"🍠",swimming_man:"🏊",swimming_woman:"🏊‍♀️",symbols:"🔣",synagogue:"🕍",syringe:"💉",taco:"🌮",tada:"🎉",tanabata_tree:"🎋",taurus:"♉️",taxi:"🚕",tea:"🍵",telephone_receiver:"📞",telescope:"🔭",tennis:"🎾",tent:"⛺️",thermometer:"🌡",thinking:"🤔",thought_balloon:"💭",ticket:"🎫",tickets:"🎟",tiger:"🐯",tiger2:"🐅",timer_clock:"⏲",tipping_hand_man:"💁‍♂️",tired_face:"😫",tm:"™️",toilet:"🚽",tokyo_tower:"🗼",tomato:"🍅",tongue:"👅",top:"🔝",tophat:"🎩",tornado:"🌪",trackball:"🖲",tractor:"🚜",traffic_light:"🚥",train:"🚋",train2:"🚆",tram:"🚊",triangular_flag_on_post:"🚩",triangular_ruler:"📐",trident:"🔱",triumph:"😤",trolleybus:"🚎",trophy:"🏆",tropical_drink:"🍹",tropical_fish:"🐠",truck:"🚚",trumpet:"🎺",tulip:"🌷",tumbler_glass:"🥃",turkey:"🦃",turtle:"🐢",tv:"📺",twisted_rightwards_arrows:"🔀",two_hearts:"💕",two_men_holding_hands:"👬",two_women_holding_hands:"👭",u5272:"🈹",u5408:"🈴",u55b6:"🈺",u6307:"🈯️",u6708:"🈷️",u6709:"🈶",u6e80:"🈵",u7121:"🈚️",u7533:"🈸",u7981:"🈲",u7a7a:"🈳",umbrella:"☔️",unamused:"😒",underage:"🔞",unicorn:"🦄",unlock:"🔓",up:"🆙",upside_down_face:"🙃",v:"✌️",vertical_traffic_light:"🚦",vhs:"📼",vibration_mode:"📳",video_camera:"📹",video_game:"🎮",violin:"🎻",virgo:"♍️",volcano:"🌋",volleyball:"🏐",vs:"🆚",vulcan_salute:"🖖",walking_man:"🚶",walking_woman:"🚶‍♀️",waning_crescent_moon:"🌘",waning_gibbous_moon:"🌖",warning:"⚠️",wastebasket:"🗑",watch:"⌚️",water_buffalo:"🐃",watermelon:"🍉",wave:"👋",wavy_dash:"〰️",waxing_crescent_moon:"🌒",wc:"🚾",weary:"😩",wedding:"💒",weight_lifting_man:"🏋️",weight_lifting_woman:"🏋️‍♀️",whale:"🐳",whale2:"🐋",wheel_of_dharma:"☸️",wheelchair:"♿️",white_check_mark:"✅",white_circle:"⚪️",white_flag:"🏳️",white_flower:"💮",white_large_square:"⬜️",white_medium_small_square:"◽️",white_medium_square:"◻️",white_small_square:"▫️",white_square_button:"🔳",wilted_flower:"🥀",wind_chime:"🎐",wind_face:"🌬",wine_glass:"🍷",wink:"😉",wolf:"🐺",woman:"👩",woman_artist:"👩‍🎨",woman_astronaut:"👩‍🚀",woman_cartwheeling:"🤸‍♀️",woman_cook:"👩‍🍳",woman_facepalming:"🤦‍♀️",woman_factory_worker:"👩‍🏭",woman_farmer:"👩‍🌾",woman_firefighter:"👩‍🚒",woman_health_worker:"👩‍⚕️",woman_judge:"👩‍⚖️",woman_juggling:"🤹‍♀️",woman_mechanic:"👩‍🔧",woman_office_worker:"👩‍💼",woman_pilot:"👩‍✈️",woman_playing_handball:"🤾‍♀️",woman_playing_water_polo:"🤽‍♀️",woman_scientist:"👩‍🔬",woman_shrugging:"🤷‍♀️",woman_singer:"👩‍🎤",woman_student:"👩‍🎓",woman_teacher:"👩‍🏫",woman_technologist:"👩‍💻",woman_with_turban:"👳‍♀️",womans_clothes:"👚",womans_hat:"👒",women_wrestling:"🤼‍♀️",womens:"🚺",world_map:"🗺",worried:"😟",wrench:"🔧",writing_hand:"✍️",x:"❌",yellow_heart:"💛",yen:"💴",yin_yang:"☯️",yum:"😋",zap:"⚡️",zipper_mouth_face:"🤐",zzz:"💤",octocat:':octocat:',showdown:"S"},i.Converter=function(e){function t(e,t){if(t=t||null,i.helper.isString(e)){if(t=e=i.helper.stdExtName(e),i.extensions[e])return void function(e,t){"function"==typeof e&&(e=e(new i.Converter)),i.helper.isArray(e)||(e=[e]);var n=r(e,t);if(!n.valid)throw Error(n.error);for(var a=0;a[ \t]+¨NBSP;<"),!t){if(!window||!window.document)throw new Error("HTMLParser is undefined. If in a webworker or nodejs environment, you need to provide a WHATWG DOM and HTML such as JSDOM");t=window.document}var r=t.createElement("div");r.innerHTML=e;var n={preList:function(e){for(var t=e.querySelectorAll("pre"),r=[],n=0;n'}else r.push(t[n].innerHTML),t[n].innerHTML="",t[n].setAttribute("prenum",n.toString());return r}(r)};!function e(t){for(var r=0;r? ?(['"].*['"])?\)$/m)>-1)o="";else if(!o){if(a||(a=n.toLowerCase().replace(/ ?\n/g," ")),o="#"+a,i.helper.isUndefined(r.gUrls[a]))return e;o=r.gUrls[a],i.helper.isUndefined(r.gTitles[a])||(c=r.gTitles[a])}var u='"+n+""};return e=(e=(e=(e=(e=r.converter._dispatch("anchors.before",e,t,r)).replace(/\[((?:\[[^\]]*]|[^\[\]])*)] ?(?:\n *)?\[(.*?)]()()()()/g,n)).replace(/\[((?:\[[^\]]*]|[^\[\]])*)]()[ \t]*\([ \t]?<([^>]*)>(?:[ \t]*((["'])([^"]*?)\5))?[ \t]?\)/g,n)).replace(/\[((?:\[[^\]]*]|[^\[\]])*)]()[ \t]*\([ \t]??(?:[ \t]*((["'])([^"]*?)\5))?[ \t]?\)/g,n)).replace(/\[([^\[\]]+)]()()()()()/g,n),t.ghMentions&&(e=e.replace(/(^|\s)(\\)?(@([a-z\d]+(?:[a-z\d.-]+?[a-z\d]+)*))/gim,function(e,r,n,a,o){if("\\"===n)return r+a;if(!i.helper.isString(t.ghMentionsLink))throw new Error("ghMentionsLink option must be a string");var s=t.ghMentionsLink.replace(/\{u}/g,o),l="";return t.openLinksInNewWindow&&(l=' target="¨E95Eblank"'),r+'"+a+""})),r.converter._dispatch("anchors.after",e,t,r)});var h=/([*~_]+|\b)(((https?|ftp|dict):\/\/|www\.)[^'">\s]+?\.[^'">\s]+?)()(\1)?(?=\s|$)(?!["<>])/gi,f=/([*~_]+|\b)(((https?|ftp|dict):\/\/|www\.)[^'">\s]+\.[^'">\s]+?)([.!?,()\[\]])?(\1)?(?=\s|$)(?!["<>])/gi,p=/()<(((https?|ftp|dict):\/\/|www\.)[^'">\s]+)()>()/gi,g=/(^|\s)(?:mailto:)?([A-Za-z0-9!#$%&'*+-/=?^_`{|}~.]+@[-a-z0-9]+(\.[-a-z0-9]+)*\.[a-z]+)(?=$|\s)/gim,m=/<()(?:mailto:)?([-.\w]+@[-a-z0-9]+(\.[-a-z0-9]+)*\.[a-z]+)>/gi,_=function(e){return function(t,r,n,a,o,s,l){var c=n=n.replace(i.helper.regexes.asteriskDashAndColon,i.helper.escapeCharactersCallback),u="",d="",h=r||"",f=l||"";return/^www\./i.test(n)&&(n=n.replace(/^www\./i,"http://www.")),e.excludeTrailingPunctuationFromURLs&&s&&(u=s),e.openLinksInNewWindow&&(d=' target="¨E95Eblank"'),h+'"+c+""+u+f}},b=function(e,t){return function(r,n,a){var o="mailto:";return n=n||"",a=i.subParser("unescapeSpecialChars")(a,e,t),e.encodeEmails?(o=i.helper.encodeEmailAddress(o+a),a=i.helper.encodeEmailAddress(a)):o+=a,n+''+a+""}};i.subParser("autoLinks",function(e,t,r){return e=(e=(e=r.converter._dispatch("autoLinks.before",e,t,r)).replace(p,_(t))).replace(m,b(t,r)),r.converter._dispatch("autoLinks.after",e,t,r)}),i.subParser("simplifiedAutoLinks",function(e,t,r){return t.simplifiedAutoLink?(e=r.converter._dispatch("simplifiedAutoLinks.before",e,t,r),e=(e=t.excludeTrailingPunctuationFromURLs?e.replace(f,_(t)):e.replace(h,_(t))).replace(g,b(t,r)),e=r.converter._dispatch("simplifiedAutoLinks.after",e,t,r)):e}),i.subParser("blockGamut",function(e,t,r){return e=r.converter._dispatch("blockGamut.before",e,t,r),e=i.subParser("blockQuotes")(e,t,r),e=i.subParser("headers")(e,t,r),e=i.subParser("horizontalRule")(e,t,r),e=i.subParser("lists")(e,t,r),e=i.subParser("codeBlocks")(e,t,r),e=i.subParser("tables")(e,t,r),e=i.subParser("hashHTMLBlocks")(e,t,r),e=i.subParser("paragraphs")(e,t,r),r.converter._dispatch("blockGamut.after",e,t,r)}),i.subParser("blockQuotes",function(e,t,r){e=r.converter._dispatch("blockQuotes.before",e,t,r),e+="\n\n";var n=/(^ {0,3}>[ \t]?.+\n(.+\n)*\n*)+/gm;return t.splitAdjacentBlockquotes&&(n=/^ {0,3}>[\s\S]*?(?:\n\n)/gm),e=e.replace(n,function(e){return e=(e=(e=e.replace(/^[ \t]*>[ \t]?/gm,"")).replace(/¨0/g,"")).replace(/^[ \t]+$/gm,""),e=i.subParser("githubCodeBlocks")(e,t,r),e=(e=(e=i.subParser("blockGamut")(e,t,r)).replace(/(^|\n)/g,"$1 ")).replace(/(\s*
[^\r]+?<\/pre>)/gm,function(e,t){var r=t;return(r=r.replace(/^  /gm,"¨0")).replace(/¨0/g,"")}),i.subParser("hashBlock")("
\n"+e+"\n
",t,r)}),r.converter._dispatch("blockQuotes.after",e,t,r)}),i.subParser("codeBlocks",function(e,t,r){return e=r.converter._dispatch("codeBlocks.before",e,t,r),e=(e=(e+="¨0").replace(/(?:\n\n|^)((?:(?:[ ]{4}|\t).*\n+)+)(\n*[ ]{0,3}[^ \t\n]|(?=¨0))/g,function(e,n,a){var o=n,s=a,l="\n";return o=i.subParser("outdent")(o,t,r),o=i.subParser("encodeCode")(o,t,r),o=(o=(o=i.subParser("detab")(o,t,r)).replace(/^\n+/g,"")).replace(/\n+$/g,""),t.omitExtraWLInCodeBlocks&&(l=""),o="
"+o+l+"
",i.subParser("hashBlock")(o,t,r)+s})).replace(/¨0/,""),r.converter._dispatch("codeBlocks.after",e,t,r)}),i.subParser("codeSpans",function(e,t,r){return void 0===(e=r.converter._dispatch("codeSpans.before",e,t,r))&&(e=""),e=e.replace(/(^|[^\\])(`+)([^\r]*?[^`])\2(?!`)/gm,function(e,n,a,o){var s=o;return s=(s=s.replace(/^([ \t]*)/g,"")).replace(/[ \t]*$/g,""),s=n+""+(s=i.subParser("encodeCode")(s,t,r))+"",i.subParser("hashHTMLSpans")(s,t,r)}),r.converter._dispatch("codeSpans.after",e,t,r)}),i.subParser("completeHTMLDocument",function(e,t,r){if(!t.completeHTMLDocument)return e;e=r.converter._dispatch("completeHTMLDocument.before",e,t,r);var n="html",a="\n",i="",o='\n',s="",l="";for(var c in void 0!==r.metadata.parsed.doctype&&(a="\n","html"!==(n=r.metadata.parsed.doctype.toString().toLowerCase())&&"html5"!==n||(o='')),r.metadata.parsed)if(r.metadata.parsed.hasOwnProperty(c))switch(c.toLowerCase()){case"doctype":break;case"title":i=""+r.metadata.parsed.title+"\n";break;case"charset":o="html"===n||"html5"===n?'\n':'\n';break;case"language":case"lang":s=' lang="'+r.metadata.parsed[c]+'"',l+='\n';break;default:l+='\n'}return e=a+"\n\n"+i+o+l+"\n\n"+e.trim()+"\n\n",r.converter._dispatch("completeHTMLDocument.after",e,t,r)}),i.subParser("detab",function(e,t,r){return e=(e=(e=(e=(e=(e=r.converter._dispatch("detab.before",e,t,r)).replace(/\t(?=\t)/g," ")).replace(/\t/g,"¨A¨B")).replace(/¨B(.+?)¨A/g,function(e,t){for(var r=t,n=4-r.length%4,a=0;a/g,">"),r.converter._dispatch("encodeAmpsAndAngles.after",e,t,r)}),i.subParser("encodeBackslashEscapes",function(e,t,r){return e=(e=(e=r.converter._dispatch("encodeBackslashEscapes.before",e,t,r)).replace(/\\(\\)/g,i.helper.escapeCharactersCallback)).replace(/\\([`*_{}\[\]()>#+.!~=|-])/g,i.helper.escapeCharactersCallback),r.converter._dispatch("encodeBackslashEscapes.after",e,t,r)}),i.subParser("encodeCode",function(e,t,r){return e=(e=r.converter._dispatch("encodeCode.before",e,t,r)).replace(/&/g,"&").replace(//g,">").replace(/([*_{}\[\]\\=~-])/g,i.helper.escapeCharactersCallback),r.converter._dispatch("encodeCode.after",e,t,r)}),i.subParser("escapeSpecialCharsWithinTagAttributes",function(e,t,r){return e=(e=(e=r.converter._dispatch("escapeSpecialCharsWithinTagAttributes.before",e,t,r)).replace(/<\/?[a-z\d_:-]+(?:[\s]+[\s\S]+?)?>/gi,function(e){return e.replace(/(.)<\/?code>(?=.)/g,"$1`").replace(/([\\`*_~=|])/g,i.helper.escapeCharactersCallback)})).replace(/-]|-[^>])(?:[^-]|-[^-])*)--)>/gi,function(e){return e.replace(/([\\`*_~=|])/g,i.helper.escapeCharactersCallback)}),r.converter._dispatch("escapeSpecialCharsWithinTagAttributes.after",e,t,r)}),i.subParser("githubCodeBlocks",function(e,t,r){return t.ghCodeBlocks?(e=r.converter._dispatch("githubCodeBlocks.before",e,t,r),e=(e=(e+="¨0").replace(/(?:^|\n)(?: {0,3})(```+|~~~+)(?: *)([^\s`~]*)\n([\s\S]*?)\n(?: {0,3})\1/g,function(e,n,a,o){var s=t.omitExtraWLInCodeBlocks?"":"\n";return o=i.subParser("encodeCode")(o,t,r),o=(o=(o=i.subParser("detab")(o,t,r)).replace(/^\n+/g,"")).replace(/\n+$/g,""),o="
"+o+s+"
",o=i.subParser("hashBlock")(o,t,r),"\n\n¨G"+(r.ghCodeBlocks.push({text:e,codeblock:o})-1)+"G\n\n"})).replace(/¨0/,""),r.converter._dispatch("githubCodeBlocks.after",e,t,r)):e}),i.subParser("hashBlock",function(e,t,r){return e=(e=r.converter._dispatch("hashBlock.before",e,t,r)).replace(/(^\n+|\n+$)/g,""),e="\n\n¨K"+(r.gHtmlBlocks.push(e)-1)+"K\n\n",r.converter._dispatch("hashBlock.after",e,t,r)}),i.subParser("hashCodeTags",function(e,t,r){return e=r.converter._dispatch("hashCodeTags.before",e,t,r),e=i.helper.replaceRecursiveRegExp(e,function(e,n,a,o){var s=a+i.subParser("encodeCode")(n,t,r)+o;return"¨C"+(r.gHtmlSpans.push(s)-1)+"C"},"]*>","","gim"),r.converter._dispatch("hashCodeTags.after",e,t,r)}),i.subParser("hashElement",function(e,t,r){return function(e,t){var n=t;return n=(n=(n=n.replace(/\n\n/g,"\n")).replace(/^\n/,"")).replace(/\n+$/g,""),"\n\n¨K"+(r.gHtmlBlocks.push(n)-1)+"K\n\n"}}),i.subParser("hashHTMLBlocks",function(e,t,r){e=r.converter._dispatch("hashHTMLBlocks.before",e,t,r);var n=["pre","div","h1","h2","h3","h4","h5","h6","blockquote","table","dl","ol","ul","script","noscript","form","fieldset","iframe","math","style","section","header","footer","nav","article","aside","address","audio","canvas","figure","hgroup","output","video","p"],a=function(e,t,n,a){var i=e;return-1!==n.search(/\bmarkdown\b/)&&(i=n+r.converter.makeHtml(t)+a),"\n\n¨K"+(r.gHtmlBlocks.push(i)-1)+"K\n\n"};t.backslashEscapesHTMLTags&&(e=e.replace(/\\<(\/?[^>]+?)>/g,function(e,t){return"<"+t+">"}));for(var o=0;o]*>)","im"),c="<"+n[o]+"\\b[^>]*>",u="";-1!==(s=i.helper.regexIndexOf(e,l));){var d=i.helper.splitAtIndex(e,s),h=i.helper.replaceRecursiveRegExp(d[1],a,c,u,"im");if(h===d[1])break;e=d[0].concat(h)}return e=e.replace(/(\n {0,3}(<(hr)\b([^<>])*?\/?>)[ \t]*(?=\n{2,}))/g,i.subParser("hashElement")(e,t,r)),e=(e=i.helper.replaceRecursiveRegExp(e,function(e){return"\n\n¨K"+(r.gHtmlBlocks.push(e)-1)+"K\n\n"},"^ {0,3}\x3c!--","--\x3e","gm")).replace(/(?:\n\n)( {0,3}(?:<([?%])[^\r]*?\2>)[ \t]*(?=\n{2,}))/g,i.subParser("hashElement")(e,t,r)),r.converter._dispatch("hashHTMLBlocks.after",e,t,r)}),i.subParser("hashHTMLSpans",function(e,t,r){function n(e){return"¨C"+(r.gHtmlSpans.push(e)-1)+"C"}return e=(e=(e=(e=(e=r.converter._dispatch("hashHTMLSpans.before",e,t,r)).replace(/<[^>]+?\/>/gi,function(e){return n(e)})).replace(/<([^>]+?)>[\s\S]*?<\/\1>/g,function(e){return n(e)})).replace(/<([^>]+?)\s[^>]+?>[\s\S]*?<\/\1>/g,function(e){return n(e)})).replace(/<[^>]+?>/gi,function(e){return n(e)}),r.converter._dispatch("hashHTMLSpans.after",e,t,r)}),i.subParser("unhashHTMLSpans",function(e,t,r){e=r.converter._dispatch("unhashHTMLSpans.before",e,t,r);for(var n=0;n]*>\\s*]*>","^ {0,3}\\s*
","gim"),r.converter._dispatch("hashPreCodeTags.after",e,t,r)}),i.subParser("headers",function(e,t,r){function n(e){var n,a;if(t.customizedHeaderId){var o=e.match(/\{([^{]+?)}\s*$/);o&&o[1]&&(e=o[1])}return n=e,a=i.helper.isString(t.prefixHeaderId)?t.prefixHeaderId:!0===t.prefixHeaderId?"section-":"",t.rawPrefixHeaderId||(n=a+n),n=t.ghCompatibleHeaderId?n.replace(/ /g,"-").replace(/&/g,"").replace(/¨T/g,"").replace(/¨D/g,"").replace(/[&+$,\/:;=?@"#{}|^¨~\[\]`\\*)(%.!'<>]/g,"").toLowerCase():t.rawHeaderId?n.replace(/ /g,"-").replace(/&/g,"&").replace(/¨T/g,"¨").replace(/¨D/g,"$").replace(/["']/g,"-").toLowerCase():n.replace(/[^\w]/g,"").toLowerCase(),t.rawPrefixHeaderId&&(n=a+n),r.hashLinkCounts[n]?n=n+"-"+r.hashLinkCounts[n]++:r.hashLinkCounts[n]=1,n}e=r.converter._dispatch("headers.before",e,t,r);var a=isNaN(parseInt(t.headerLevelStart))?1:parseInt(t.headerLevelStart),o=t.smoothLivePreview?/^(.+)[ \t]*\n={2,}[ \t]*\n+/gm:/^(.+)[ \t]*\n=+[ \t]*\n+/gm,s=t.smoothLivePreview?/^(.+)[ \t]*\n-{2,}[ \t]*\n+/gm:/^(.+)[ \t]*\n-+[ \t]*\n+/gm;e=(e=e.replace(o,function(e,o){var s=i.subParser("spanGamut")(o,t,r),l=t.noHeaderId?"":' id="'+n(o)+'"',c=""+s+"";return i.subParser("hashBlock")(c,t,r)})).replace(s,function(e,o){var s=i.subParser("spanGamut")(o,t,r),l=t.noHeaderId?"":' id="'+n(o)+'"',c=a+1,u=""+s+"";return i.subParser("hashBlock")(u,t,r)});var l=t.requireSpaceBeforeHeadingText?/^(#{1,6})[ \t]+(.+?)[ \t]*#*\n+/gm:/^(#{1,6})[ \t]*(.+?)[ \t]*#*\n+/gm;return e=e.replace(l,function(e,o,s){var l=s;t.customizedHeaderId&&(l=s.replace(/\s?\{([^{]+?)}\s*$/,""));var c=i.subParser("spanGamut")(l,t,r),u=t.noHeaderId?"":' id="'+n(s)+'"',d=a-1+o.length,h=""+c+"";return i.subParser("hashBlock")(h,t,r)}),r.converter._dispatch("headers.after",e,t,r)}),i.subParser("horizontalRule",function(e,t,r){e=r.converter._dispatch("horizontalRule.before",e,t,r);var n=i.subParser("hashBlock")("
",t,r);return e=(e=(e=e.replace(/^ {0,2}( ?-){3,}[ \t]*$/gm,n)).replace(/^ {0,2}( ?\*){3,}[ \t]*$/gm,n)).replace(/^ {0,2}( ?_){3,}[ \t]*$/gm,n),r.converter._dispatch("horizontalRule.after",e,t,r)}),i.subParser("images",function(e,t,r){function n(e,t,n,a,o,s,l,c){var u=r.gUrls,d=r.gTitles,h=r.gDimensions;if(n=n.toLowerCase(),c||(c=""),e.search(/\(? ?(['"].*['"])?\)$/m)>-1)a="";else if(""===a||null===a){if(""!==n&&null!==n||(n=t.toLowerCase().replace(/ ?\n/g," ")),a="#"+n,i.helper.isUndefined(u[n]))return e;a=u[n],i.helper.isUndefined(d[n])||(c=d[n]),i.helper.isUndefined(h[n])||(o=h[n].width,s=h[n].height)}t=t.replace(/"/g,""").replace(i.helper.regexes.asteriskDashAndColon,i.helper.escapeCharactersCallback);var f=''+t+'"}return e=(e=(e=(e=(e=(e=r.converter._dispatch("images.before",e,t,r)).replace(/!\[([^\]]*?)] ?(?:\n *)?\[([\s\S]*?)]()()()()()/g,n)).replace(/!\[([^\]]*?)][ \t]*()\([ \t]??(?: =([*\d]+[A-Za-z%]{0,4})x([*\d]+[A-Za-z%]{0,4}))?[ \t]*(?:(["'])([^"]*?)\6)?[ \t]?\)/g,function(e,t,r,a,i,o,s,l){return n(e,t,r,a=a.replace(/\s/g,""),i,o,0,l)})).replace(/!\[([^\]]*?)][ \t]*()\([ \t]?<([^>]*)>(?: =([*\d]+[A-Za-z%]{0,4})x([*\d]+[A-Za-z%]{0,4}))?[ \t]*(?:(?:(["'])([^"]*?)\6))?[ \t]?\)/g,n)).replace(/!\[([^\]]*?)][ \t]*()\([ \t]??(?: =([*\d]+[A-Za-z%]{0,4})x([*\d]+[A-Za-z%]{0,4}))?[ \t]*(?:(["'])([^"]*?)\6)?[ \t]?\)/g,n)).replace(/!\[([^\[\]]+)]()()()()()/g,n),r.converter._dispatch("images.after",e,t,r)}),i.subParser("italicsAndBold",function(e,t,r){function n(e,t,r){return t+e+r}return e=r.converter._dispatch("italicsAndBold.before",e,t,r),e=t.literalMidWordUnderscores?(e=(e=e.replace(/\b___(\S[\s\S]*?)___\b/g,function(e,t){return n(t,"","")})).replace(/\b__(\S[\s\S]*?)__\b/g,function(e,t){return n(t,"","")})).replace(/\b_(\S[\s\S]*?)_\b/g,function(e,t){return n(t,"","")}):(e=(e=e.replace(/___(\S[\s\S]*?)___/g,function(e,t){return/\S$/.test(t)?n(t,"",""):e})).replace(/__(\S[\s\S]*?)__/g,function(e,t){return/\S$/.test(t)?n(t,"",""):e})).replace(/_([^\s_][\s\S]*?)_/g,function(e,t){return/\S$/.test(t)?n(t,"",""):e}),e=t.literalMidWordAsterisks?(e=(e=e.replace(/([^*]|^)\B\*\*\*(\S[\s\S]*?)\*\*\*\B(?!\*)/g,function(e,t,r){return n(r,t+"","")})).replace(/([^*]|^)\B\*\*(\S[\s\S]*?)\*\*\B(?!\*)/g,function(e,t,r){return n(r,t+"","")})).replace(/([^*]|^)\B\*(\S[\s\S]*?)\*\B(?!\*)/g,function(e,t,r){return n(r,t+"","")}):(e=(e=e.replace(/\*\*\*(\S[\s\S]*?)\*\*\*/g,function(e,t){return/\S$/.test(t)?n(t,"",""):e})).replace(/\*\*(\S[\s\S]*?)\*\*/g,function(e,t){return/\S$/.test(t)?n(t,"",""):e})).replace(/\*([^\s*][\s\S]*?)\*/g,function(e,t){return/\S$/.test(t)?n(t,"",""):e}),r.converter._dispatch("italicsAndBold.after",e,t,r)}),i.subParser("lists",function(e,t,r){function n(e,n){r.gListLevel++,e=e.replace(/\n{2,}$/,"\n");var a=/(\n)?(^ {0,3})([*+-]|\d+[.])[ \t]+((\[(x|X| )?])?[ \t]*[^\r]+?(\n{1,2}))(?=\n*(¨0| {0,3}([*+-]|\d+[.])[ \t]+))/gm,o=/\n[ \t]*\n(?!¨0)/.test(e+="¨0");return t.disableForced4SpacesIndentedSublists&&(a=/(\n)?(^ {0,3})([*+-]|\d+[.])[ \t]+((\[(x|X| )?])?[ \t]*[^\r]+?(\n{1,2}))(?=\n*(¨0|\2([*+-]|\d+[.])[ \t]+))/gm),e=(e=e.replace(a,function(e,n,a,s,l,c,u){u=u&&""!==u.trim();var d=i.subParser("outdent")(l,t,r),h="";return c&&t.tasklists&&(h=' class="task-list-item" style="list-style-type: none;"',d=d.replace(/^[ \t]*\[(x|X| )?]/m,function(){var e='"})),d=d.replace(/^([-*+]|\d\.)[ \t]+[\S\n ]*/g,function(e){return"¨A"+e}),n||d.search(/\n{2,}/)>-1?(d=i.subParser("githubCodeBlocks")(d,t,r),d=i.subParser("blockGamut")(d,t,r)):(d=(d=i.subParser("lists")(d,t,r)).replace(/\n$/,""),d=(d=i.subParser("hashHTMLBlocks")(d,t,r)).replace(/\n\n+/g,"\n\n"),d=o?i.subParser("paragraphs")(d,t,r):i.subParser("spanGamut")(d,t,r)),""+(d=d.replace("¨A",""))+"\n"})).replace(/¨0/g,""),r.gListLevel--,n&&(e=e.replace(/\s+$/,"")),e}function a(e,t){if("ol"===t){var r=e.match(/^ *(\d+)\./);if(r&&"1"!==r[1])return' start="'+r[1]+'"'}return""}function o(e,r,i){var o=t.disableForced4SpacesIndentedSublists?/^ ?\d+\.[ \t]/gm:/^ {0,3}\d+\.[ \t]/gm,s=t.disableForced4SpacesIndentedSublists?/^ ?[*+-][ \t]/gm:/^ {0,3}[*+-][ \t]/gm,l="ul"===r?o:s,c="";if(-1!==e.search(l))!function t(u){var d=u.search(l),h=a(e,r);-1!==d?(c+="\n\n<"+r+h+">\n"+n(u.slice(0,d),!!i)+"\n",l="ul"==(r="ul"===r?"ol":"ul")?o:s,t(u.slice(d))):c+="\n\n<"+r+h+">\n"+n(u,!!i)+"\n"}(e);else{var u=a(e,r);c="\n\n<"+r+u+">\n"+n(e,!!i)+"\n"}return c}return e=r.converter._dispatch("lists.before",e,t,r),e+="¨0",e=(e=r.gListLevel?e.replace(/^(( {0,3}([*+-]|\d+[.])[ \t]+)[^\r]+?(¨0|\n{2,}(?=\S)(?![ \t]*(?:[*+-]|\d+[.])[ \t]+)))/gm,function(e,t,r){return o(t,r.search(/[*+-]/g)>-1?"ul":"ol",!0)}):e.replace(/(\n\n|^\n?)(( {0,3}([*+-]|\d+[.])[ \t]+)[^\r]+?(¨0|\n{2,}(?=\S)(?![ \t]*(?:[*+-]|\d+[.])[ \t]+)))/gm,function(e,t,r,n){return o(r,n.search(/[*+-]/g)>-1?"ul":"ol",!1)})).replace(/¨0/,""),r.converter._dispatch("lists.after",e,t,r)}),i.subParser("metadata",function(e,t,r){function n(e){r.metadata.raw=e,(e=(e=e.replace(/&/g,"&").replace(/"/g,""")).replace(/\n {4}/g," ")).replace(/^([\S ]+): +([\s\S]+?)$/gm,function(e,t,n){return r.metadata.parsed[t]=n,""})}return t.metadata?(e=(e=(e=(e=r.converter._dispatch("metadata.before",e,t,r)).replace(/^\s*«««+(\S*?)\n([\s\S]+?)\n»»»+\n/,function(e,t,r){return n(r),"¨M"})).replace(/^\s*---+(\S*?)\n([\s\S]+?)\n---+\n/,function(e,t,a){return t&&(r.metadata.format=t),n(a),"¨M"})).replace(/¨M/g,""),e=r.converter._dispatch("metadata.after",e,t,r)):e}),i.subParser("outdent",function(e,t,r){return e=(e=(e=r.converter._dispatch("outdent.before",e,t,r)).replace(/^(\t|[ ]{1,4})/gm,"¨0")).replace(/¨0/g,""),r.converter._dispatch("outdent.after",e,t,r)}),i.subParser("paragraphs",function(e,t,r){for(var n=(e=(e=(e=r.converter._dispatch("paragraphs.before",e,t,r)).replace(/^\n+/g,"")).replace(/\n+$/g,"")).split(/\n{2,}/g),a=[],o=n.length,s=0;s=0?a.push(l):l.search(/\S/)>=0&&(l=(l=i.subParser("spanGamut")(l,t,r)).replace(/^([ \t]*)/g,"

"),l+="

",a.push(l))}for(o=a.length,s=0;s]*>\s*]*>/.test(u)&&(d=!0)}a[s]=u}return e=(e=(e=a.join("\n")).replace(/^\n+/g,"")).replace(/\n+$/g,""),r.converter._dispatch("paragraphs.after",e,t,r)}),i.subParser("runExtension",function(e,t,r,n){if(e.filter)t=e.filter(t,n.converter,r);else if(e.regex){var a=e.regex;a instanceof RegExp||(a=new RegExp(a,"g")),t=t.replace(a,e.replace)}return t}),i.subParser("spanGamut",function(e,t,r){return e=r.converter._dispatch("spanGamut.before",e,t,r),e=i.subParser("codeSpans")(e,t,r),e=i.subParser("escapeSpecialCharsWithinTagAttributes")(e,t,r),e=i.subParser("encodeBackslashEscapes")(e,t,r),e=i.subParser("images")(e,t,r),e=i.subParser("anchors")(e,t,r),e=i.subParser("autoLinks")(e,t,r),e=i.subParser("simplifiedAutoLinks")(e,t,r),e=i.subParser("emoji")(e,t,r),e=i.subParser("underline")(e,t,r),e=i.subParser("italicsAndBold")(e,t,r),e=i.subParser("strikethrough")(e,t,r),e=i.subParser("ellipsis")(e,t,r),e=i.subParser("hashHTMLSpans")(e,t,r),e=i.subParser("encodeAmpsAndAngles")(e,t,r),t.simpleLineBreaks?/\n\n¨K/.test(e)||(e=e.replace(/\n+/g,"
\n")):e=e.replace(/ +\n/g,"
\n"),r.converter._dispatch("spanGamut.after",e,t,r)}),i.subParser("strikethrough",function(e,t,r){return t.strikethrough&&(e=(e=r.converter._dispatch("strikethrough.before",e,t,r)).replace(/(?:~){2}([\s\S]+?)(?:~){2}/g,function(e,n){return function(e){return t.simplifiedAutoLink&&(e=i.subParser("simplifiedAutoLinks")(e,t,r)),""+e+""}(n)}),e=r.converter._dispatch("strikethrough.after",e,t,r)),e}),i.subParser("stripLinkDefinitions",function(e,t,r){var n=function(e,n,a,o,s,l,c){return n=n.toLowerCase(),a.match(/^data:.+?\/.+?;base64,/)?r.gUrls[n]=a.replace(/\s/g,""):r.gUrls[n]=i.subParser("encodeAmpsAndAngles")(a,t,r),l?l+c:(c&&(r.gTitles[n]=c.replace(/"|'/g,""")),t.parseImgDimensions&&o&&s&&(r.gDimensions[n]={width:o,height:s}),"")};return(e=(e=(e+="¨0").replace(/^ {0,3}\[(.+)]:[ \t]*\n?[ \t]*?(?: =([*\d]+[A-Za-z%]{0,4})x([*\d]+[A-Za-z%]{0,4}))?[ \t]*\n?[ \t]*(?:(\n*)["|'(](.+?)["|')][ \t]*)?(?:\n\n|(?=¨0)|(?=\n\[))/gm,n)).replace(/^ {0,3}\[(.+)]:[ \t]*\n?[ \t]*\s]+)>?(?: =([*\d]+[A-Za-z%]{0,4})x([*\d]+[A-Za-z%]{0,4}))?[ \t]*\n?[ \t]*(?:(\n*)["|'(](.+?)["|')][ \t]*)?(?:\n+|(?=¨0))/gm,n)).replace(/¨0/,"")}),i.subParser("tables",function(e,t,r){function n(e){return/^:[ \t]*--*$/.test(e)?' style="text-align:left;"':/^--*[ \t]*:[ \t]*$/.test(e)?' style="text-align:right;"':/^:[ \t]*--*[ \t]*:$/.test(e)?' style="text-align:center;"':""}function a(e,n){var a="";return e=e.trim(),(t.tablesHeaderId||t.tableHeaderId)&&(a=' id="'+e.replace(/ /g,"_").toLowerCase()+'"'),""+(e=i.subParser("spanGamut")(e,t,r))+"\n"}function o(e,n){return""+i.subParser("spanGamut")(e,t,r)+"\n"}function s(e){var s,l=e.split("\n");for(s=0;s\n\n\n",a=0;a\n";for(var i=0;i\n"}return r+"\n\n"}(h,p)}return t.tables?(e=(e=(e=(e=r.converter._dispatch("tables.before",e,t,r)).replace(/\\(\|)/g,i.helper.escapeCharactersCallback)).replace(/^ {0,3}\|?.+\|.+\n {0,3}\|?[ \t]*:?[ \t]*(?:[-=]){2,}[ \t]*:?[ \t]*\|[ \t]*:?[ \t]*(?:[-=]){2,}[\s\S]+?(?:\n\n|¨0)/gm,s)).replace(/^ {0,3}\|.+\|[ \t]*\n {0,3}\|[ \t]*:?[ \t]*(?:[-=]){2,}[ \t]*:?[ \t]*\|[ \t]*\n( {0,3}\|.+\|[ \t]*\n)*(?:\n|¨0)/gm,s),r.converter._dispatch("tables.after",e,t,r)):e}),i.subParser("underline",function(e,t,r){return t.underline?(e=r.converter._dispatch("underline.before",e,t,r),e=(e=t.literalMidWordUnderscores?(e=e.replace(/\b___(\S[\s\S]*?)___\b/g,function(e,t){return""+t+""})).replace(/\b__(\S[\s\S]*?)__\b/g,function(e,t){return""+t+""}):(e=e.replace(/___(\S[\s\S]*?)___/g,function(e,t){return/\S$/.test(t)?""+t+"":e})).replace(/__(\S[\s\S]*?)__/g,function(e,t){return/\S$/.test(t)?""+t+"":e})).replace(/(_)/g,i.helper.escapeCharactersCallback),e=r.converter._dispatch("underline.after",e,t,r)):e}),i.subParser("unescapeSpecialChars",function(e,t,r){return e=(e=r.converter._dispatch("unescapeSpecialChars.before",e,t,r)).replace(/¨E(\d+)E/g,function(e,t){var r=parseInt(t);return String.fromCharCode(r)}),r.converter._dispatch("unescapeSpecialChars.after",e,t,r)}),i.subParser("makeMarkdown.blockquote",function(e,t){var r="";if(e.hasChildNodes())for(var n=e.childNodes,a=n.length,o=0;o "+(r=r.trim()).split("\n").join("\n> ")}),i.subParser("makeMarkdown.codeBlock",function(e,t){var r=e.getAttribute("language"),n=e.getAttribute("precodenum");return"```"+r+"\n"+t.preList[n]+"\n```"}),i.subParser("makeMarkdown.codeSpan",function(e){return"`"+e.innerHTML+"`"}),i.subParser("makeMarkdown.emphasis",function(e,t){var r="";if(e.hasChildNodes()){r+="*";for(var n=e.childNodes,a=n.length,o=0;o",e.hasAttribute("width")&&e.hasAttribute("height")&&(t+=" ="+e.getAttribute("width")+"x"+e.getAttribute("height")),e.hasAttribute("title")&&(t+=' "'+e.getAttribute("title")+'"'),t+=")"),t}),i.subParser("makeMarkdown.links",function(e,t){var r="";if(e.hasChildNodes()&&e.hasAttribute("href")){var n=e.childNodes,a=n.length;r="[";for(var o=0;o",e.hasAttribute("title")&&(r+=' "'+e.getAttribute("title")+'"'),r+=")"}return r}),i.subParser("makeMarkdown.list",function(e,t,r){var n="";if(!e.hasChildNodes())return"";for(var a=e.childNodes,o=a.length,s=e.getAttribute("start")||1,l=0;l"+t.preList[r]+""}),i.subParser("makeMarkdown.strikethrough",function(e,t){var r="";if(e.hasChildNodes()){r+="~~";for(var n=e.childNodes,a=n.length,o=0;otr>th"),l=e.querySelectorAll("tbody>tr");for(r=0;rp&&(p=g)}for(r=0;r/g,"\\$1>")).replace(/^#/gm,"\\#")).replace(/^(\s*)([-=]{3,})(\s*)$/,"$1\\$2$3")).replace(/^( {0,3}\d+)\./gm,"$1\\.")).replace(/^( {0,3})([+-])/gm,"$1\\$2")).replace(/]([\s]*)\(/g,"\\]$1\\(")).replace(/^ {0,3}\[([\S \t]*?)]:/gm,"\\[$1]:")}),e.exports?e.exports=i:this.showdown=i}).call(t)}),he={pangu:a,minimatch:D,beautify:te,style:le,rdability:ue,markdown:Object.freeze({default:de,__moduleExports:de})};e.Plugin=function(e){return void 0==e?he:he[e]},Object.defineProperty(e,"__esModule",{value:!0})}); diff --git a/src/vender/puread/puread.min.js b/src/vender/puread/puread.min.js new file mode 100644 index 00000000..922b745c --- /dev/null +++ b/src/vender/puread/puread.min.js @@ -0,0 +1 @@ +!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):t.PureRead=e()}(this,function(){"use strict";var t=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},e=function(){function t(t,e){for(var r=0;r?$|<[^/][-_a-zA-Z0-9]+>?$/gi);return e&&e.length>0?[1,e]:[-1,void 0]}function c(t){var e=s(t),r=a(e,2),n=r[0],i=r[1];if(2==n)return t;if(1==n){var o=i[0].trim().replace(/['"<>]/g,"").replace(/ /gi,"=").split("="),l=a(o,3),u=l[0],c=l[1],h=l[2];return c?"class"===c.toLowerCase()?c=u+"."+h:"id"===c.toLowerCase()&&(c=u+"#"+h):c=u,c}return null}function h(t){return/^(\[\[)[\[{'/]{1}[ \S]+[}'/\]]\]\]{1}($)/g.test(t)}function f(t){var e=[t.replace(/(^)\[\[|\]\]$/g,"")],r=e[0],n=e[1];switch(r[0]){case"{":r=r.replace(/^{|}$/g,""),t=new Function("return "+r)(),n=0;break;case"'":t=(t=r.replace(/^'|'$/g,"")).match(/^<[a-zA-Z0-9_-]+>/g).join("").replace(/<|>/g,"")+":contains("+t.replace(/<[/a-zA-Z0-9_-]+>/g,"")+")",n=1;break;case"/":t=r.replace(/^\/|\/$/g,"").replace(/\\{2}/g,"\\").replace(/'/g,'"'),n=2;break;case"[":r=r.replace(/^{|}$/g,""),t=new Function("return "+r)()[0],n=3;break;default:n=-1}return[t,n]}var d={url:"",target:"",matching:[],name:"",title:"",desc:"",exclude:[],include:"",avatar:[],paging:[]},p=void 0,m=void 0,v=void 0,g=void 0,y=function(){function n(){var e,r,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{global:[],custom:[],local:[]};t(this,n),this.url=(r=(e="/"!=(e=window.location.pathname)&&e.endsWith("/")?e=e.replace(/\/$/,""):e).replace(/\/[%@#.~a-zA-Z0-9_-]+$|^\/$/g,""),window.location.protocol+"//"+window.location.hostname+r+"/"),this.sites=i,this.current={},this.state="none",this.origins=[],g=location.href}return e(n,[{key:"SetURL",value:function(t){var e,r=u(t),n=(e="/"!=(e=r.pathname)&&e.endsWith("/")?e=e.replace(/\/$/,""):e).replace(/\/[%@#.~a-zA-Z0-9_-]+$|^\/$/g,"");this.url=r.protocol+"//"+r.hostname+n+"/",g=t}},{key:"SetMinimatch",value:function(t){p=t}},{key:"SetRdability",value:function(t){m=t}},{key:"SetMarkdown",value:function(t){v=t}},{key:"Readability",value:function(){try{var t=document.location,e={spec:t.href,host:t.host,prePath:t.protocol+"//"+t.host,scheme:t.protocol.substr(0,t.protocol.indexOf(":")),pathBase:t.protocol+"//"+t.host+t.pathname.substr(0,t.pathname.lastIndexOf("/")+1)},r=new m.Readability(e,document.cloneNode(!0)).parse();if(!r||""==r.content)throw"Readability error";this.Newsite("read",r.content),this.dom=$(r.content)[0],this.state="temp"}catch(t){var n=function(){var t=$("body"),e=!0,r=!1,n=void 0;try{for(var i,a=[".post-content",".entry-content",".post-article",".content-post",".article-entry",".article-content",".article-body",".markdown-body","[itemprop='articleBody']","article",".post",".content"][Symbol.iterator]();!(e=(i=a.next()).done);e=!0){var o=i.value,l=t.find(o);if(l.length>0)return l}}catch(t){r=!0,n=t}finally{try{!e&&a.return&&a.return()}finally{if(r)throw n}}return-1}();-1!=n?(this.Newsite("read",n[0].outerHTML),this.dom=n[0],this.state="temp"):this.current.site=l(d)}}},{key:"Getsite",value:function(t,e){return this.sites[t].find(function(t){return t[0]==e})}},{key:"Getsites",value:function(){var t=this,e=[],n=function(){if(p(location.href,"file://**/*.txt")||p(location.href,"http*://**/*.txt"))return function(){var t=location.pathname.split("/").pop(),e="file:"==location.protocol?"local":"remote",r={name:"txtread::"+e,title:"",desc:"",include:"<pre>",auto:!1,exclude:[]};"remote"==e&&(r.include="",r.html=$("body pre").html().replace(/\n/gi,"<br>"));return!$("title").html()&&$("head").append("<title>"+decodeURI(t.replace(".txt",""))+""),r}();if(p(location.href,"file://**/*.md")||p(location.href,"http*://**/*.md"))return function(){var t=location.pathname.split("/").pop(),e={name:"txtread::"+("file:"==location.protocol?"local":"remote"),title:"",desc:"",include:"",auto:!1,exclude:[]},r=(new v.default.Converter).makeHtml($("body pre").text());return e.html=r,!$("title").html()&&$("head").append("<title>"+decodeURI(t.replace(".md",""))+""),e}();var t=/<\S+ (class|id)=("|')?[\w-_=;:' ]+("|')?>?$|<[^/][-_a-zA-Z0-9]+>?$/gi,e={name:$("meta[name='simpread:name']").attr("content"),url:$("meta[name='simpread:url']").attr("content"),title:$("meta[name='simpread:title']").attr("content"),desc:$("meta[name='simpread:desc']").attr("content"),include:$("meta[name='simpread:include']").attr("content"),exp:$("meta[name='simpread:exclude']").attr("content"),auto:$("meta[name='simpread:auto']").attr("content"),exclude:[]};if(e.name&&e.include){if(e.url&&!p(location.href,e.url))return;!e.title&&(e.title=""),!e.desc&&(e.desc=""),!e.exp&&(e.exp=""),e.name="metaread::"+e.name,e.auto="true"==e.auto;var r=["title","desc","include","exp"].findIndex(function(r){return""!=e[r]&&!e[r].match(t)});return e.exclude.push(e.exp),delete e.exp,-1==r?e:void 0}return}();if(this.current.url=this.url,n)this.current.auto=n.auto,this.current.url=n.url,delete n.auto,delete n.url,this.current.site=r({},n),this.current.site.name.startsWith("metaread::")&&(this.state="meta"),this.current.site.name.startsWith("txtread::")&&(this.state="txt");else if(b("local",new Map(this.sites.local),this.url,e),b("global",new Map(this.sites.global),this.url,e),b("person",new Map(this.sites.person),this.url,e),b("custom",new Map(this.sites.custom),this.url,e),e.length>0){var i=void 0;if(e.forEach(function(e){e[1].active&&(i=e,t.current.url=i[0],t.current.site=t.Safesite(r({},i[1]),i[2],i[0]),t.state="adapter")}),!i){var a=e[0];a[1].active=!0,this.current.url=a[0],this.current.site=this.Safesite(r({},a[1]),a[2],a[0]),this.state="adapter"}}else{var o=function(){if(location.pathname.includes("thread")||location.pathname.includes("forum.php")){if($(".t_f").length>0&&$(".favatar").find(".authi").length>0&&$(".avatar").find("img").length>0)return{avatar:[{name:"[[{$('.favatar').find('.authi')}]]"},{url:"[[{$('.avatar').find('img')}]]"}],include:"[[{$('.t_f')}]]"}}else if(/\/t\/[\w-]+\/\d+/.test(location.pathname)&&$("meta[name=generator]").attr("content").includes("discourse"))return{avatar:[{name:"[[{$('.topic-avatar').find('.a[data-user-card]')}]]"},{url:"[[{$('.topic-avatar').find('img')}]]"}],include:"[[{$('.cooked')}]]"};return-1}();-1!=o?(this.Newmultisite("read",o),this.state="temp"):this.Readability()}this.current.site.matching=e}},{key:"Addsites",value:function(t){var e=0;if(0==this.sites.global.length)this.sites.global=this.Formatsites(t),e=this.sites.global.length;else{var r=function(t,e){var r=new Map(e),n=[].concat(o(r.keys())),i=0;return t.map(function(t){n.includes(t[0])?n.includes(t[0]):i++}),{count:i,newsites:t}}(this.Formatsites(t),this.sites.global);e=r.count,this.sites.global=r.newsites}return e}},{key:"Addlocalsites",value:function(t){return this.sites.local=[].concat(o(t)),this.sites.local}},{key:"Addallsites",value:function(t){return this.sites={global:[].concat(o(t.global)),person:[].concat(o(t.person)),custom:[].concat(o(t.custom)),local:[].concat(o(t.local))},this.sites}},{key:"Newsite",value:function(t,e){var n={mode:t,url:window.location.href,site:{name:"tempread::"+window.location.host,title:"<title>",desc:"",include:"",exclude:[]}};e&&(n.site.html=e),this.current.mode=n.mode,this.current.url=n.url,this.current.site=this.Safesite(r({},n.site),"local",n.url)}},{key:"Newmultisite",value:function(t,e){var n={mode:t,url:window.location.href,site:{name:"tempread::"+window.location.host,title:"<title>",desc:"",include:e.include,exclude:[],avatar:e.avatar}};this.current.mode=n.mode,this.current.url=n.url,this.current.site=this.Safesite(r({},n.site),"local",n.url)}},{key:"Updatesite",value:function(t,e,r){var n=this.sites[t].findIndex(function(t){return t[0]==e});-1==n&&(n=this.sites[t].length),this.sites[t].splice(n,1,r)}},{key:"Deletesite",value:function(t,e,r){var n=this.sites[t].findIndex(function(t){return t[0]==e});-1!=n&&this.sites[t].splice(n,1),r(n)}},{key:"Safesite",value:function(t,e,r){return t.url=r,t.target=e,""==t.name&&(t.name="tempread::"),(!t.avatar||0==t.avatar.length)&&(t.avatar=[{name:""},{url:""}]),(!t.paging||0==t.paging.length)&&(t.paging=[{prev:""},{next:""}]),t}},{key:"Cleansite",value:function(t){return delete t.url,delete t.html,delete t.target,delete t.matching,t.avatar&&t.avatar.length>0&&""==t.avatar[0].name&&delete t.avatar,t.paging&&t.paging.length>0&&""==t.paging[0].prev&&delete t.paging,t}},{key:"Formatsites",value:function(t){var e=new Map,r=!0,n=!1,i=void 0;try{for(var a,l=t.sites[Symbol.iterator]();!(r=(a=l.next()).done);r=!0){var u=a.value;if(0==w(u)){var s=u.url;delete u.url,e.set(s,u)}}}catch(t){n=!0,i=t}finally{try{!r&&l.return&&l.return()}finally{if(n)throw i}}return[].concat(o(e))}},{key:"Clearsites",value:function(t){t?this.sites[t]=[]:this.sites={global:[],custom:[],local:[]}}},{key:"Origins",value:function(t){var e=t.origins.map(function(t){return t.url});return(e=new Set(this.origins.concat(e))).forEach(function(t){""!=t.trim()&&t.trim().startsWith("http")&&t.trim().endsWith(".json")||e.delete(t)}),this.origins=[].concat(o(e)),this.origins}},{key:"Addorigins",value:function(t){return this.sites.custom=[].concat(o(t)),this.sites.custom}},{key:"Clearorigins",value:function(){var t=this.sites.custom.length;return this.sites.custom=[],t}}]),n}();function b(t,e,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[],i=function(t){var e=t.replace("www.","").match(/\.\S+\.\S+/g);return e?e[0].substr(1):t.replace("www.","")},a=u(g),s=[].concat(o(e.keys())),c=r.match(/[.a-zA-z0-9-_]+/g)[1].replace("www.",""),h=i(a.hostname),f=function(){return"/"==a.pathname||/\/(default|index|portal).[0-9a-zA-Z]+$/.test(a.pathname)},d=!0,m=!1,v=void 0;try{for(var y,b=s[Symbol.iterator]();!(d=(y=b.next()).done);d=!0){var w=y.value,$=e.get(w).name,k=i($);f()||w.endsWith("*")||w.replace(/^http[s]?:/,"")!=r.replace(/^http[s]?:/,"")?w.match(/\*/g)&&1==w.match(/\*/g).length&&!f()&&w.endsWith("*")&&c.includes(k)&&h==k&&r.includes($)?n.push([w,l(e.get(w)),t]):p(a.origin+a.pathname,w)&&n.push([w,l(e.get(w)),t]):n.push([w,l(e.get(w)),t])}}catch(t){m=!0,v=t}finally{try{!d&&b.return&&b.return()}finally{if(m)throw v}}}function w(t){if(!t.name||!t.url||!t.include)return-1;if(-1==s(t.title)[0]||-1==s(t.include)[0]||-1==s(t.desc)[0])return-2;if(t.paging){if(2!=t.paging.length)return-3;if(!t.paging[0].prev)return-4;if(!t.paging[1].next)return-5;if(-1==s(t.paging[0].prev)[0]||-1==s(t.paging[1].next)[0])return-6}if(t.avatar){if(2!=t.avatar.length)return-7;if(!t.avatar[0].name)return-8;if(!t.avatar[1].url)return-9;if(-1==s(t.avatar[0].name)[0]||-1==s(t.avatar[1].url)[0])return-10}return 0}function k(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"text",r=$("html");if(h(t)){var n=f(t),i=a(n,2),o=i[0],l=i[1];0==l?t=o:3==l&&(t=x(r.find(o)))}else"html"==e?t=x(r.find(t)):"multi"==e||(t=r.find(t).text().trim());return t}function x(t){var e="";switch(t.length){case 0:e="<sr-rd-content-error></sr-rd-content-error>";break;case 1:e=t.html().trim();break;default:e=t.map(function(t,e){return $(e).html()}).get().join("<br>")}return e}return function(r){function o(e){t(this,o);var r=i(this,(o.__proto__||Object.getPrototypeOf(o)).call(this,e));return r.version="0.0.4 build 0421",r.org_url=location.href,r.html={},r.plugin={},r.pure=!1,r}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(o,y),e(o,[{key:"Exist",value:function(){return this.org_url==location.href}},{key:"AddPlugin",value:function(t){this.plugin={minimatch:t.minimatch,pangu:t.pangu,beautify:t.beautify,stylesheet:t.style,rdability:t.rdability,markdown:t.markdown},n(o.prototype.__proto__||Object.getPrototypeOf(o.prototype),"SetMinimatch",this).call(this,this.plugin.minimatch),n(o.prototype.__proto__||Object.getPrototypeOf(o.prototype),"SetRdability",this).call(this,this.plugin.rdability),n(o.prototype.__proto__||Object.getPrototypeOf(o.prototype),"SetMarkdown",this).call(this,this.plugin.markdown)}},{key:"TempMode",value:function(t,e){this.state="temp",this.dom=e,this.Newsite(t,e.outerHTML)}},{key:"ReadMode",value:function(){var t,e,r,n,i;this.html=(t=this.current.site,e=l(t),r=c(""==t.title?"<title>":t.title),n=c(t.desc),i=c(t.include),e.title=""==t.title||"<title>"==t.title?$("head title").text():k(r),e.desc=k(n),e.include=""==t.include&&""!=t.html?t.html:k(i,"html"),e.avatar&&e.avatar.length>0&&""==e.avatar[0].name&&delete e.avatar,e.paging&&e.paging.length>0&&""==e.paging[0].prev&&delete e.paging,e.avatar&&e.avatar.forEach(function(t){var e=Object.keys(t).join(),r=t[e];t[e]=k(c(r),"html")}),e.paging&&e.paging.forEach(function(t){var e=Object.keys(t).join(),r=t[e];t[e]=k(c(r))}),e)}},{key:"Include",value:function(){var t=this.current.site.include,e=[],r=c(t);try{if(h(r)){var n=f(t),i=a(n,2),o=i[0],l=i[1];0==l?(t=t.replace(/\[\[{\$\(|}\]\]|\).html\(\)/g,""),e=$(f("[[["+t+"]]]")[0])):3==l&&(e=o)}else r&&(e=$("body").find(r))}catch(t){}return e}},{key:"Exclude",value:function(t){return function(t,e){var r=[],n="",i=!0,o=!1,l=void 0;try{for(var u,s=e[Symbol.iterator]();!(i=(u=s.next()).done);i=!0){var d=u.value;if(h(d)){var p=f(d),m=a(p,2),v=m[0],g=m[1];if(1==g)n=v;else if(2==g){var y=t.html().match(new RegExp(v,"g"));if(y&&y.length>0){var b=y.join("");n="*["+b+"]"}else n=void 0}else 3==g&&v.remove()}else n=c(d);n&&r.push(n)}}catch(t){o=!0,l=t}finally{try{!i&&s.return&&s.return()}finally{if(o)throw l}}return r.join(",")}(t,this.current.site.exclude)}},{key:"Beautify",value:function(t){this.plugin.beautify&&(this.plugin.beautify.cleanHTML(t,this.pure),this.plugin.beautify.specbeautify(this.current.site.name,t),this.plugin.beautify.removeSpareTag(this.current.site.name,t),this.plugin.beautify.htmlbeautify(t),this.plugin.beautify.commbeautify(this.current.site.name,t))}},{key:"Format",value:function(t){this.plugin.pangu&&this.plugin.pangu.spacingElementByClassName(t)}}]),o}()}); From bf84edfdb100d6024ad7fe6ec69661289eeb90f8 Mon Sep 17 00:00:00 2001 From: Kenshin <fxblog@gmail.com> Date: Tue, 23 Apr 2019 14:44:20 +0800 Subject: [PATCH 21/43] Update puread files. --- src/vender/puread/puplugin.min.js | 2 +- webpack.config.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/vender/puread/puplugin.min.js b/src/vender/puread/puplugin.min.js index 770f0305..cb8017b6 100644 --- a/src/vender/puread/puplugin.min.js +++ b/src/vender/puread/puplugin.min.js @@ -1 +1 @@ -!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t(e.puplugin={})}(this,function(e){"use strict";var t="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function r(e,t){return e(t={exports:{}},t.exports),t.exports}var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},a=r(function(e,t){e.exports=function(e){function t(n){if(r[n])return r[n].exports;var a=r[n]={exports:{},id:n,loaded:!1};return e[n].call(a.exports,a,a.exports,t),a.loaded=!0,a.exports}var r={};return t.m=e,t.c=r,t.p="",t(0)}([function(e,t,r){var a=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),i=r(1).Pangu,o=function(e){function t(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var e=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=(void 0===t?"undefined":n(t))&&"function"!=typeof t?e:t}(this,Object.getPrototypeOf(t).call(this));return e.topTags=/^(html|head|body|#document)$/i,e.ignoreTags=/^(script|code|pre|textarea)$/i,e.spaceSensitiveTags=/^(a|del|pre|s|strike|u)$/i,e.spaceLikeTags=/^(br|hr|i|img|pangu)$/i,e.blockTags=/^(div|h1|h2|h3|h4|h5|h6|p)$/i,e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+(void 0===t?"undefined":n(t)));e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),a(t,[{key:"canIgnoreNode",value:function(e){for(var t=e.parentNode;t&&t.nodeName&&-1===t.nodeName.search(this.topTags);){if(t.nodeName.search(this.ignoreTags)>=0||t.isContentEditable||"true"===t.getAttribute("g_editable"))return!0;t=t.parentNode}return!1}},{key:"isFirstTextChild",value:function(e,t){for(var r=e.childNodes,n=0;n<r.length;n++){var a=r[n];if(8!==a.nodeType&&a.textContent)return a===t}return!1}},{key:"isLastTextChild",value:function(e,t){for(var r=e.childNodes,n=r.length-1;n>-1;n--){var a=r[n];if(8!==a.nodeType&&a.textContent)return a===t}return!1}},{key:"spacingNodeByXPath",value:function(e,t){for(var r=document.evaluate(e,t,null,XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,null),n=void 0,a=void 0,i=r.snapshotLength-1;i>-1;--i)if(n=r.snapshotItem(i),this.canIgnoreNode(n))a=n;else{var o=this.spacing(n.data);if(n.data!==o&&(n.data=o),a){if(n.nextSibling&&n.nextSibling.nodeName.search(this.spaceLikeTags)>=0){a=n;continue}var s=n.data.toString().substr(-1)+a.data.toString().substr(0,1),l=this.spacing(s);if(l!==s){for(var c=a;c.parentNode&&-1===c.nodeName.search(this.spaceSensitiveTags)&&this.isFirstTextChild(c.parentNode,c);)c=c.parentNode;for(var u=n;u.parentNode&&-1===u.nodeName.search(this.spaceSensitiveTags)&&this.isLastTextChild(u.parentNode,u);)u=u.parentNode;if(u.nextSibling&&u.nextSibling.nodeName.search(this.spaceLikeTags)>=0){a=n;continue}if(-1===u.nodeName.search(this.blockTags))if(-1===c.nodeName.search(this.spaceSensitiveTags))-1===c.nodeName.search(this.ignoreTags)&&-1===c.nodeName.search(this.blockTags)&&(a.previousSibling?-1===a.previousSibling.nodeName.search(this.spaceLikeTags)&&(a.data=" "+a.data):this.canIgnoreNode(a)||(a.data=" "+a.data));else if(-1===u.nodeName.search(this.spaceSensitiveTags))n.data=n.data+" ";else{var d=document.createElement("pangu");d.innerHTML=" ",c.previousSibling?-1===c.previousSibling.nodeName.search(this.spaceLikeTags)&&c.parentNode.insertBefore(d,c):c.parentNode.insertBefore(d,c),d.previousElementSibling||d.parentNode&&d.parentNode.removeChild(d)}}}a=n}}},{key:"spacingNode",value:function(e){this.spacingNodeByXPath(".//*/text()[normalize-space(.)]",e)}},{key:"spacingElementById",value:function(e){var t='id("'+e+'")//text()';this.spacingNodeByXPath(t,document)}},{key:"spacingElementByClassName",value:function(e){var t='//*[contains(concat(" ", normalize-space(@class), " "), "'+e+'")]//text()';this.spacingNodeByXPath(t,document)}},{key:"spacingElementByTagName",value:function(e){var t="//"+e+"//text()";this.spacingNodeByXPath(t,document)}},{key:"spacingPageTitle",value:function(){this.spacingNodeByXPath("/html/head/title/text()",document)}},{key:"spacingPageBody",value:function(){for(var e="/html/body//*/text()[normalize-space(.)]",t=["script","style","textarea"],r=0;r<t.length;r++){var n=t[r];e+='[translate(name(..),"ABCDEFGHIJKLMNOPQRSTUVWXYZ","abcdefghijklmnopqrstuvwxyz")!="'+n+'"]'}this.spacingNodeByXPath(e,document)}},{key:"spacingPage",value:function(){this.spacingPageTitle(),this.spacingPageBody()}}]),t}(i),s=new o;(e.exports=s).Pangu=o},function(e,t){var r=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),n=/([\u2e80-\u2eff\u2f00-\u2fdf\u3040-\u309f\u30a0-\u30ff\u3100-\u312f\u3200-\u32ff\u3400-\u4dbf\u4e00-\u9fff\uf900-\ufaff])(["])/g,a=/(["])([\u2e80-\u2eff\u2f00-\u2fdf\u3040-\u309f\u30a0-\u30ff\u3100-\u312f\u3200-\u32ff\u3400-\u4dbf\u4e00-\u9fff\uf900-\ufaff])/g,i=/(["']+)(\s*)(.+?)(\s*)(["']+)/g,o=/([\u2e80-\u2eff\u2f00-\u2fdf\u3040-\u309f\u30a0-\u30ff\u3100-\u312f\u3200-\u32ff\u3400-\u4dbf\u4e00-\u9fff\uf900-\ufaff])( )(')([A-Za-z])/g,s=/([\u2e80-\u2eff\u2f00-\u2fdf\u3040-\u309f\u30a0-\u30ff\u3100-\u312f\u3200-\u32ff\u3400-\u4dbf\u4e00-\u9fff\uf900-\ufaff])(#)([A-Za-z0-9\u2e80-\u2eff\u2f00-\u2fdf\u3040-\u309f\u30a0-\u30ff\u3100-\u312f\u3200-\u32ff\u3400-\u4dbf\u4e00-\u9fff\uf900-\ufaff]+)(#)([\u2e80-\u2eff\u2f00-\u2fdf\u3040-\u309f\u30a0-\u30ff\u3100-\u312f\u3200-\u32ff\u3400-\u4dbf\u4e00-\u9fff\uf900-\ufaff])/g,l=/([\u2e80-\u2eff\u2f00-\u2fdf\u3040-\u309f\u30a0-\u30ff\u3100-\u312f\u3200-\u32ff\u3400-\u4dbf\u4e00-\u9fff\uf900-\ufaff])(#([^ ]))/g,c=/(([^ ])#)([\u2e80-\u2eff\u2f00-\u2fdf\u3040-\u309f\u30a0-\u30ff\u3100-\u312f\u3200-\u32ff\u3400-\u4dbf\u4e00-\u9fff\uf900-\ufaff])/g,u=/([\u2e80-\u2eff\u2f00-\u2fdf\u3040-\u309f\u30a0-\u30ff\u3100-\u312f\u3200-\u32ff\u3400-\u4dbf\u4e00-\u9fff\uf900-\ufaff])([\+\-\*\/=&\\|<>])([A-Za-z0-9])/g,d=/([A-Za-z0-9])([\+\-\*\/=&\\|<>])([\u2e80-\u2eff\u2f00-\u2fdf\u3040-\u309f\u30a0-\u30ff\u3100-\u312f\u3200-\u32ff\u3400-\u4dbf\u4e00-\u9fff\uf900-\ufaff])/g,h=/([\u2e80-\u2eff\u2f00-\u2fdf\u3040-\u309f\u30a0-\u30ff\u3100-\u312f\u3200-\u32ff\u3400-\u4dbf\u4e00-\u9fff\uf900-\ufaff])([\(\[\{<\u201c]+(.*?)[\)\]\}>\u201d]+)([\u2e80-\u2eff\u2f00-\u2fdf\u3040-\u309f\u30a0-\u30ff\u3100-\u312f\u3200-\u32ff\u3400-\u4dbf\u4e00-\u9fff\uf900-\ufaff])/g,f=/([\u2e80-\u2eff\u2f00-\u2fdf\u3040-\u309f\u30a0-\u30ff\u3100-\u312f\u3200-\u32ff\u3400-\u4dbf\u4e00-\u9fff\uf900-\ufaff])([\(\[\{<\u201c>])/g,p=/([\)\]\}>\u201d<])([\u2e80-\u2eff\u2f00-\u2fdf\u3040-\u309f\u30a0-\u30ff\u3100-\u312f\u3200-\u32ff\u3400-\u4dbf\u4e00-\u9fff\uf900-\ufaff])/g,g=/([\(\[\{<\u201c]+)(\s*)(.+?)(\s*)([\)\]\}>\u201d]+)/,m=/([\u2e80-\u2eff\u2f00-\u2fdf\u3040-\u309f\u30a0-\u30ff\u3100-\u312f\u3200-\u32ff\u3400-\u4dbf\u4e00-\u9fff\uf900-\ufaff])([~!;:,\.\?\u2026])([A-Za-z0-9])/g,_=/([\u2e80-\u2eff\u2f00-\u2fdf\u3040-\u309f\u30a0-\u30ff\u3100-\u312f\u3200-\u32ff\u3400-\u4dbf\u4e00-\u9fff\uf900-\ufaff])([A-Za-z0-9`\$%\^&\*\-=\+\\\|\/@\u00a1-\u00ff\u2022\u2027\u2150-\u218f])/g,b=/([A-Za-z0-9`~\$%\^&\*\-=\+\\\|\/!;:,\.\?\u00a1-\u00ff\u2022\u2026\u2027\u2150-\u218f])([\u2e80-\u2eff\u2f00-\u2fdf\u3040-\u309f\u30a0-\u30ff\u3100-\u312f\u3200-\u32ff\u3400-\u4dbf\u4e00-\u9fff\uf900-\ufaff])/g,w=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}return r(e,[{key:"spacing",value:function(e){var t=e,r=t=(t=(t=(t=(t=(t=(t=(t=(t=t.replace(n,"$1 $2")).replace(a,"$1 $2")).replace(i,"$1$3$5")).replace(o,"$1$3$4")).replace(s,"$1 $2$3$4 $5")).replace(l,"$1 $2")).replace(c,"$1 $3")).replace(u,"$1 $2 $3")).replace(d,"$1 $2 $3"),w=t.replace(h,"$1 $2 $4");return t=w,r===w&&(t=(t=t.replace(f,"$1 $2")).replace(p,"$1 $2")),t=(t=(t=(t=t.replace(g,"$1$3$5")).replace(m,"$1$2 $3")).replace(_,"$1 $2")).replace(b,"$1 $2")}},{key:"spacingText",value:function(e){var t=arguments.length<=1||void 0===arguments[1]?function(){}:arguments[1];try{var r=this.spacing(e);t(null,r)}catch(e){t(e)}}}]),e}(),v=new w;(e.exports=v).Pangu=w}])});a.pangu;function i(e,t){for(var r=0,n=e.length-1;n>=0;n--){var a=e[n];"."===a?e.splice(n,1):".."===a?(e.splice(n,1),r++):r&&(e.splice(n,1),r--)}if(t)for(;r--;r)e.unshift("..");return e}var o=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/,s=function(e){return o.exec(e).slice(1)};function l(){for(var e="",t=!1,r=arguments.length-1;r>=-1&&!t;r--){var n=r>=0?arguments[r]:"/";if("string"!=typeof n)throw new TypeError("Arguments to path.resolve must be strings");n&&(e=n+"/"+e,t="/"===n.charAt(0))}return e=i(_(e.split("/"),function(e){return!!e}),!t).join("/"),(t?"/":"")+e||"."}function c(e){var t=u(e),r="/"===b(e,-1);return(e=i(_(e.split("/"),function(e){return!!e}),!t).join("/"))||t||(e="."),e&&r&&(e+="/"),(t?"/":"")+e}function u(e){return"/"===e.charAt(0)}function d(){return c(_(Array.prototype.slice.call(arguments,0),function(e,t){if("string"!=typeof e)throw new TypeError("Arguments to path.join must be strings");return e}).join("/"))}function h(e,t){function r(e){for(var t=0;t<e.length&&""===e[t];t++);for(var r=e.length-1;r>=0&&""===e[r];r--);return t>r?[]:e.slice(t,r-t+1)}e=l(e).substr(1),t=l(t).substr(1);for(var n=r(e.split("/")),a=r(t.split("/")),i=Math.min(n.length,a.length),o=i,s=0;s<i;s++)if(n[s]!==a[s]){o=s;break}var c=[];for(s=o;s<n.length;s++)c.push("..");return(c=c.concat(a.slice(o))).join("/")}function f(e){var t=s(e),r=t[0],n=t[1];return r||n?(n&&(n=n.substr(0,n.length-1)),r+n):"."}function p(e,t){var r=s(e)[2];return t&&r.substr(-1*t.length)===t&&(r=r.substr(0,r.length-t.length)),r}function g(e){return s(e)[3]}var m={extname:g,basename:p,dirname:f,sep:"/",delimiter:":",relative:h,join:d,isAbsolute:u,normalize:c,resolve:l};function _(e,t){if(e.filter)return e.filter(t);for(var r=[],n=0;n<e.length;n++)t(e[n],n,e)&&r.push(e[n]);return r}var b="b"==="ab".substr(-1)?function(e,t,r){return e.substr(t,r)}:function(e,t,r){return t<0&&(t=e.length+t),e.substr(t,r)},w=Object.freeze({resolve:l,normalize:c,isAbsolute:u,join:d,relative:h,sep:"/",delimiter:":",dirname:f,basename:p,extname:g,default:m}),v=function(e,t){for(var r=[],n=0;n<e.length;n++){var a=t(e[n],n);y(a)?r.push.apply(r,a):r.push(a)}return r},y=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)},k=E;function E(e,t,r){e instanceof RegExp&&(e=x(e,r)),t instanceof RegExp&&(t=x(t,r));var n=T(e,t,r);return n&&{start:n[0],end:n[1],pre:r.slice(0,n[0]),body:r.slice(n[0]+e.length,n[1]),post:r.slice(n[1]+t.length)}}function x(e,t){var r=t.match(e);return r?r[0]:null}function T(e,t,r){var n,a,i,o,s,l=r.indexOf(e),c=r.indexOf(t,l+1),u=l;if(l>=0&&c>0){for(n=[],i=r.length;u>=0&&!s;)u==l?(n.push(u),l=r.indexOf(e,u+1)):1==n.length?s=[n.pop(),c]:((a=n.pop())<i&&(i=a,o=c),c=r.indexOf(t,u+1)),u=l<c&&l>=0?l:c;n.length&&(s=[i,o])}return s}E.range=T;var N=function(e){if(!e)return[];"{}"===e.substr(0,2)&&(e="\\{\\}"+e.substr(2));return function e(t,r){var n=[];var a=k("{","}",t);if(!a||/\$$/.test(a.pre))return[t];var i=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(a.body);var o=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(a.body);var s=i||o;var l=a.body.indexOf(",")>=0;if(!s&&!l)return a.post.match(/,.*\}/)?(t=a.pre+"{"+a.body+C+a.post,e(t)):[t];var c;if(s)c=a.body.split(/\.\./);else if(1===(c=function e(t){if(!t)return[""];var r=[];var n=k("{","}",t);if(!n)return t.split(",");var a=n.pre;var i=n.body;var o=n.post;var s=a.split(",");s[s.length-1]+="{"+i+"}";var l=e(o);o.length&&(s[s.length-1]+=l.shift(),s.push.apply(s,l));r.push.apply(r,s);return r}(a.body)).length&&1===(c=e(c[0],!1).map(M)).length){var u=a.post.length?e(a.post,!1):[""];return u.map(function(e){return a.pre+c[0]+e})}var d=a.pre;var u=a.post.length?e(a.post,!1):[""];var h;if(s){var f=L(c[0]),p=L(c[1]),g=Math.max(c[0].length,c[1].length),m=3==c.length?Math.abs(L(c[2])):1,_=I,b=p<f;b&&(m*=-1,_=O);var w=c.some(B);h=[];for(var y=f;_(y,p);y+=m){var E;if(o)"\\"===(E=String.fromCharCode(y))&&(E="");else if(E=String(y),w){var x=g-E.length;if(x>0){var T=new Array(x+1).join("0");E=y<0?"-"+T+E.slice(1):T+E}}h.push(E)}}else h=v(c,function(t){return e(t,!1)});for(var N=0;N<h.length;N++)for(var A=0;A<u.length;A++){var S=d+h[N]+u[A];(!r||s||S)&&n.push(S)}return n}(function(e){return e.split("\\\\").join(A).split("\\{").join(S).split("\\}").join(C).split("\\,").join(P).split("\\.").join(j)}(e),!0).map(z)},A="\0SLASH"+Math.random()+"\0",S="\0OPEN"+Math.random()+"\0",C="\0CLOSE"+Math.random()+"\0",P="\0COMMA"+Math.random()+"\0",j="\0PERIOD"+Math.random()+"\0";function L(e){return parseInt(e,10)==e?parseInt(e,10):e.charCodeAt(0)}function z(e){return e.split(A).join("\\").split(S).join("{").split(C).join("}").split(P).join(",").split(j).join(".")}function M(e){return"{"+e+"}"}function B(e){return/^-?0\d/.test(e)}function I(e,t){return e<=t}function O(e,t){return e>=t}var R=w&&m||w,D=Y;Y.Minimatch=Q;var H={sep:"/"};try{H=R}catch(e){}var G=Y.GLOBSTAR=Q.GLOBSTAR={},U={"!":{open:"(?:(?!(?:",close:"))[^/]*?)"},"?":{open:"(?:",close:")?"},"+":{open:"(?:",close:")+"},"*":{open:"(?:",close:")*"},"@":{open:"(?:",close:")"}},q="[^/]",F=q+"*?",V="(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?",W="(?:(?!(?:\\/|^)\\.).)*?",X="().*{}+?[]^$\\!".split("").reduce(function(e,t){return e[t]=!0,e},{});var Z=/\/+/;function K(e,t){e=e||{},t=t||{};var r={};return Object.keys(t).forEach(function(e){r[e]=t[e]}),Object.keys(e).forEach(function(t){r[t]=e[t]}),r}function Y(e,t,r){if("string"!=typeof t)throw new TypeError("glob pattern string required");return r||(r={}),!(!r.nocomment&&"#"===t.charAt(0))&&(""===t.trim()?""===e:new Q(t,r).match(e))}function Q(e,t){if(!(this instanceof Q))return new Q(e,t);if("string"!=typeof e)throw new TypeError("glob pattern string required");t||(t={}),e=e.trim(),"/"!==H.sep&&(e=e.split(H.sep).join("/")),this.options=t,this.set=[],this.pattern=e,this.regexp=null,this.negate=!1,this.comment=!1,this.empty=!1,this.make()}function J(e,t){if(t||(t=this instanceof Q?this.options:{}),void 0===(e=void 0===e?this.pattern:e))throw new TypeError("undefined pattern");return t.nobrace||!e.match(/\{.*\}/)?[e]:N(e)}Y.filter=function(e,t){return t=t||{},function(r,n,a){return Y(r,e,t)}},Y.defaults=function(e){if(!e||!Object.keys(e).length)return Y;var t=Y,r=function(r,n,a){return t.minimatch(r,n,K(e,a))};return r.Minimatch=function(r,n){return new t.Minimatch(r,K(e,n))},r},Q.defaults=function(e){return e&&Object.keys(e).length?Y.defaults(e).Minimatch:Q},Q.prototype.debug=function(){},Q.prototype.make=function(){if(this._made)return;var e=this.pattern,t=this.options;if(!t.nocomment&&"#"===e.charAt(0))return void(this.comment=!0);if(!e)return void(this.empty=!0);this.parseNegate();var r=this.globSet=this.braceExpand();t.debug&&(this.debug=console.error);this.debug(this.pattern,r),r=this.globParts=r.map(function(e){return e.split(Z)}),this.debug(this.pattern,r),r=r.map(function(e,t,r){return e.map(this.parse,this)},this),this.debug(this.pattern,r),r=r.filter(function(e){return-1===e.indexOf(!1)}),this.debug(this.pattern,r),this.set=r},Q.prototype.parseNegate=function(){var e=this.pattern,t=!1,r=0;if(this.options.nonegate)return;for(var n=0,a=e.length;n<a&&"!"===e.charAt(n);n++)t=!t,r++;r&&(this.pattern=e.substr(r));this.negate=t},Y.braceExpand=function(e,t){return J(e,t)},Q.prototype.braceExpand=J,Q.prototype.parse=function(e,t){if(e.length>65536)throw new TypeError("pattern is too long");var r=this.options;if(!r.noglobstar&&"**"===e)return G;if(""===e)return"";var n,a="",i=!!r.nocase,o=!1,s=[],l=[],c=!1,u=-1,d=-1,h="."===e.charAt(0)?"":r.dot?"(?!(?:^|\\/)\\.{1,2}(?:$|\\/))":"(?!\\.)",f=this;function p(){if(n){switch(n){case"*":a+=F,i=!0;break;case"?":a+=q,i=!0;break;default:a+="\\"+n}f.debug("clearStateChar %j %j",n,a),n=!1}}for(var g,m=0,_=e.length;m<_&&(g=e.charAt(m));m++)if(this.debug("%s\t%s %s %j",e,m,a,g),o&&X[g])a+="\\"+g,o=!1;else switch(g){case"/":return!1;case"\\":p(),o=!0;continue;case"?":case"*":case"+":case"@":case"!":if(this.debug("%s\t%s %s %j <-- stateChar",e,m,a,g),c){this.debug(" in class"),"!"===g&&m===d+1&&(g="^"),a+=g;continue}f.debug("call clearStateChar %j",n),p(),n=g,r.noext&&p();continue;case"(":if(c){a+="(";continue}if(!n){a+="\\(";continue}s.push({type:n,start:m-1,reStart:a.length,open:U[n].open,close:U[n].close}),a+="!"===n?"(?:(?!(?:":"(?:",this.debug("plType %j %j",n,a),n=!1;continue;case")":if(c||!s.length){a+="\\)";continue}p(),i=!0;var b=s.pop();a+=b.close,"!"===b.type&&l.push(b),b.reEnd=a.length;continue;case"|":if(c||!s.length||o){a+="\\|",o=!1;continue}p(),a+="|";continue;case"[":if(p(),c){a+="\\"+g;continue}c=!0,d=m,u=a.length,a+=g;continue;case"]":if(m===d+1||!c){a+="\\"+g,o=!1;continue}if(c)var w,v=e.substring(d+1,m);i=!0,c=!1,a+=g;continue;default:p(),o?o=!1:!X[g]||"^"===g&&c||(a+="\\"),a+=g}c&&(v=e.substr(d+1),w=this.parse(v,ee),a=a.substr(0,u)+"\\["+w[0],i=i||w[1]);for(b=s.pop();b;b=s.pop()){var y=a.slice(b.reStart+b.open.length);this.debug("setting tail",a,b),y=y.replace(/((?:\\{2}){0,64})(\\?)\|/g,function(e,t,r){return r||(r="\\"),t+t+r+"|"}),this.debug("tail=%j\n %s",y,y,b,a);var k="*"===b.type?F:"?"===b.type?q:"\\"+b.type;i=!0,a=a.slice(0,b.reStart)+k+"\\("+y}p(),o&&(a+="\\\\");var E=!1;switch(a.charAt(0)){case".":case"[":case"(":E=!0}for(var x=l.length-1;x>-1;x--){var T=l[x],N=a.slice(0,T.reStart),A=a.slice(T.reStart,T.reEnd-8),S=a.slice(T.reEnd-8,T.reEnd),C=a.slice(T.reEnd);S+=C;var P=N.split("(").length-1,j=C;for(m=0;m<P;m++)j=j.replace(/\)[+*?]?/,"");var L="";""===(C=j)&&t!==ee&&(L="$");var z=N+A+C+L+S;a=z}""!==a&&i&&(a="(?=.)"+a);E&&(a=h+a);if(t===ee)return[a,i];if(!i)return e.replace(/\\(.)/g,"$1");var M=r.nocase?"i":"";try{var $=new RegExp("^"+a+"$",M)}catch(e){return new RegExp("$.")}return $._glob=e,$._src=a,$};var ee={};Y.makeRe=function(e,t){return new Q(e,t||{}).makeRe()},Q.prototype.makeRe=function(){if(this.regexp||!1===this.regexp)return this.regexp;var e=this.set;if(!e.length)return this.regexp=!1,this.regexp;var t=this.options,r=t.noglobstar?F:t.dot?V:W,n=t.nocase?"i":"",a=e.map(function(e){return e.map(function(e){return e===G?r:"string"==typeof e?e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"):e._src}).join("\\/")}).join("|");a="^(?:"+a+")$",this.negate&&(a="^(?!"+a+").*$");try{this.regexp=new RegExp(a,n)}catch(e){this.regexp=!1}return this.regexp},Y.match=function(e,t,r){var n=new Q(t,r=r||{});return e=e.filter(function(e){return n.match(e)}),n.options.nonull&&!e.length&&e.push(t),e},Q.prototype.match=function(e,t){if(this.debug("match",e,this.pattern),this.comment)return!1;if(this.empty)return""===e;if("/"===e&&t)return!0;var r=this.options;"/"!==H.sep&&(e=e.split(H.sep).join("/"));e=e.split(Z),this.debug(this.pattern,"split",e);var n,a,i=this.set;for(this.debug(this.pattern,"set",i),a=e.length-1;a>=0&&!(n=e[a]);a--);for(a=0;a<i.length;a++){var o=i[a],s=e;r.matchBase&&1===o.length&&(s=[n]);var l=this.matchOne(s,o,t);if(l)return!!r.flipNegate||!this.negate}return!r.flipNegate&&this.negate},Q.prototype.matchOne=function(e,t,r){var n=this.options;this.debug("matchOne",{this:this,file:e,pattern:t}),this.debug("matchOne",e.length,t.length);for(var a=0,i=0,o=e.length,s=t.length;a<o&&i<s;a++,i++){this.debug("matchOne loop");var l,c=t[i],u=e[a];if(this.debug(t,c,u),!1===c)return!1;if(c===G){this.debug("GLOBSTAR",[t,c,u]);var d=a,h=i+1;if(h===s){for(this.debug("** at the end");a<o;a++)if("."===e[a]||".."===e[a]||!n.dot&&"."===e[a].charAt(0))return!1;return!0}for(;d<o;){var f=e[d];if(this.debug("\nglobstar while",e,d,t,h,f),this.matchOne(e.slice(d),t.slice(h),r))return this.debug("globstar found match!",d,o,f),!0;if("."===f||".."===f||!n.dot&&"."===f.charAt(0)){this.debug("dot detected!",e,d,t,h);break}this.debug("globstar swallow a segment, and continue"),d++}return!(!r||(this.debug("\n>>> no match, partial?",e,d,t,h),d!==o))}if("string"==typeof c?(l=n.nocase?u.toLowerCase()===c.toLowerCase():u===c,this.debug("string match",c,u,l)):(l=u.match(c),this.debug("pattern match",c,u,l)),!l)return!1}if(a===o&&i===s)return!0;if(a===o)return r;if(i===s)return a===o-1&&""===e[a];throw new Error("wtf?")};var te=Object.freeze({specbeautify:function(e,t){switch(e){case"sspai.com":t.find(".relation-apps").remove(),t.find(".ss-app-card").remove();break;case"post.smzdm.com":t.find("img.face").addClass("sr-rd-content-nobeautify"),t.find(".insert-outer img").addClass("sr-rd-content-nobeautify");break;case"infoq.com":t.find("img").map(function(e,t){"left"==$(t).css("float")&&$(t).addClass("sr-rd-content-nobeautify")}),t.find("script").remove();break;case"appinn.com":case"hacpai.com":t.find(".emoji").addClass("sr-rd-content-nobeautify");break;case"douban.com":t.find(".review-content").children().unwrap(),t.find("table").addClass("sr-rd-content-center"),t.find("p").css({"white-space":"pre-wrap"}),t.find(".cc").removeClass();break;case"qdaily.com":t.find("img").map(function(e,t){var r=$(t);0==Number.parseInt(r.css("height"))&&r.remove()}),t.find(".com-insert-images").map(function(e,t){var r=$(t),n=r.find("img").map(function(e,t){return"<div>"+t.outerHTML+"</div>"}).get().join("");r.empty().removeAttr("class").append(n)}),t.find(".com-insert-embed").remove();break;case"news.mtime.com":t.find(".newspictool").map(function(e,t){var r=$(t),n=r.find("img"),a=r.find("p:last");r.removeAttr("class").addClass("sr-rd-content-center").empty().append(n).append(a)});break;case"blog.csdn.net":t.find(".save_code").remove(),t.find(".pre-numbering").remove(),t.find("pre").removeAttr("style").removeAttr("class"),t.find("code").removeAttr("style"),t.find(".dp-highlighter").map(function(e,t){$(t).find(".bar .tools").remove(),$(t).next().is("pre")&&$(t).next().remove()});break;case"news.sohu.com":t.find(".conserve-photo").remove(),t.find("table").addClass("sr-rd-content-center");break;case"qq.com":t.find(".rv-root-v2, #backqqcom").remove();break;case"azofreeware.com":t.find("iframe").remove();break;case"apprcn.com":t.find("img").map(function(e,t){var r=$(t),n=r.attr("src");n&&n.includes("Apprcn_Wechat_Small.jpeg")&&r.parent().remove()}),t.find("a").map(function(e,t){var r=$(t);"来自反斗软件"==r.text()&&r.parent().remove()});break;case"tieba.baidu.com":t.find(".BDE_Smiley").addClass("sr-rd-content-nobeautify"),t.find(".replace_div").removeAttr("class").removeAttr("style"),t.find(".replace_tip").remove(),t.find(".d_post_content, .j_d_post_content, .post_bubble_top, .post_bubble_middle, .post_bubble_bottom").map(function(e,t){$(t).removeAttr("class").removeAttr("style")}),$("body").find(".p_author_face").map(function(e,t){var r=$(t).find("img"),n=r.attr("data-tb-lazyload"),a=r.attr("username");n&&$("sr-rd-mult-avatar").find("span").map(function(e,t){var r=$(t);r.text()==a&&r.parent().find("img").attr("src",n)})});break;case"jingyan.baidu.com":t.find(".exp-image-wraper").removeAttr("class").removeAttr("href");break;case"question.zhihu.com":t.find(".zu-edit-button").remove(),t.find("a.external").map(function(e,t){$(t).removeAttr("class").attr("style","border: none;")}),t.find(".VagueImage").map(function(e,t){var r=$(t),n=r.attr("data-src");r.replaceWith('<img class="sr-rd-content-img" src="'+n+'" style="zoom: 0.6;">')});break;case"chiphell.com":t.find("img").map(function(e,t){var r=$(t),n=r.parent(),a=r.attr("src"),i=r.attr("smilieid");n.is("ignore_js_op")&&r.unwrap(),i&&a&&a.includes("static/image/smiley")&&r.addClass("sr-rd-content-nobeautify").attr("style","width: 50px;")}),t.find(".quote").remove();break;case"jiemian.com":t.find("script").remove();break;case"36kr.com":t.find(".load-html-img").removeAttr("class");break;case"cnblogs.com":t.find(".cnblogs_code").removeClass(),t.find(".cnblogs_code_hide").removeClass().removeAttr("style"),t.find(".cnblogs_code_toolbar").remove(),t.find(".code_img_opened").remove(),t.find(".code_img_closed").remove();break;case"news.cnblogs.com":t.find(".topic_img").remove();break;case"g-cores.com":t.find(".swiper-slide-active").find("img").map(function(e,t){var r=$(t);r.parent().parent().parent().parent().parent().parent().removeAttr("class").removeAttr("style").html(r)});break;case"feng.com":case"young.ifeng.com":t.find("span").removeAttr("style");break;case"ftchinese.com":t.find("script").remove();break;case"segmentfault.com":t.find(".widget-codetool").remove();break;case"mp.weixin.qq.com":t.find('section[powered-by="xiumi.us"]').find("img").map(function(e,t){var r=$(t),n=r.attr("data-src");r.addClass("sr-rd-content-nobeautify").attr("src",n)});break;case"ruby-china.org":t.find(".twemoji").remove();break;case"w3cplus.com":t.find("iframe").addClass("sr-rd-content-nobeautify");break;case"zuojj.com":t.find(".syntaxhighlighter .Brush").attr("style","font-size: .7em !important;");break;case"aotu.io":t.find(".highlight table").map(function(e,t){var r=$(t),n=r.find("pre"),a=r.find("table");r.html(n[1]),a.unwrap()}),t.find("table").addClass("sr-rd-content-center");break;case"colobu.com":t.find(".highlight table").map(function(e,t){var r=$(t),n=r.find("pre");r.html(n[1]),r.unwrap()});break;case"hao.caibaojian.com":t.find(".tlink").map(function(e,t){$(t).html("<link>")});break;case"wkee.net":t.find("script").remove();break;case"linux.cn":t.find("pre").attr("style","background-color: #161b20; background-image: none;"),t.find("code").attr("style","background-color: transparent; background-image: none;");break;case"zhuanlan.zhihu.com":t.find("div[data-src]").map(function(e,t){var r=$(t),n=r.attr("data-src");r.replaceWith('<div class="sr-rd-content-center"><img src="'+n+'"></div>')});break;case"jianshu.com":t.find(".image-package").map(function(e,t){var r=$(t),n=r.find("img");r.html(n)});break;case"medium.com":t.find("figure").map(function(e,t){var r=$(t),n=r.find("img");r.replaceWith('<div class="sr-rd-content-center"><img class="sr-rd-content-nobeautify" src="'+n.attr("data-src")+'" style="max-width:100%"></div>')});break;case"worldcup.fifa.com":t.find("iframe").css({width:"790px",height:"450px"}),t.find("div").removeClass()}},removeSpareTag:function(e,t){var r=!1,n="";["lib.csdn.net","huxiu.com","my.oschina.net","caixin.com","163.com","steachs.com","hacpai.com","apprcn.com","mp.weixin.qq.com"].includes(e)?(r=!0,n="p"):["nationalgeographic.com.cn","dgtle.com","news.mtime.com"].includes(e)?(r=!0,n="div"):["chiphell.com"].includes(e)&&(r=!0,n="font"),r&&t.find(n).map(function(e,t){var r=$(t).text().toLowerCase().trim();0==$(t).find("img").length&&""==r&&$(t).remove()})},htmlbeautify:function(e){try{e.html(function(e,t){return t.trim().replace(/<\/?blockquote/g,function(e){return"/"==e[1]?"</sr-blockquote":"<sr-blockquote"}).replace(/<br>\n?<br>(\n?<br>)*/g,"<br>").replace(/\/(div|p)>\n*(<br>\n)+/g,function(e){return e.replace("<br>","")})})}catch(t){return e.html()}},commbeautify:function(e,t){t.find("img:not(.sr-rd-content-nobeautify)").map(function(e,t){var r=$(t),n=(r.parent(),$("<img class='sr-rd-content-img-load'>")),a=r.attr("src"),i=r.attr("data-src"),o=r.attr("data-original"),s=r.attr("original"),l=r.attr("data-original-src"),c=r.attr("real_src"),u=function(){n.removeClass("sr-rd-content-img-load"),n[0].clientWidth<400?n.parent().removeClass("sr-rd-content-center").addClass("sr-rd-content-center-small"):n[0].clientWidth>1e3?n.css("zoom","0.6"):n[0].clientHeight>620&&/win|mac/i.test(navigator.platform)&&(n.attr("height",620),n[0].clientWidth<$("sr-rd-content").width()&&n.css({width:"auto"})),n[0].clientWidth>$("sr-rd-content").width()&&n.addClass("sr-rd-content-img")},d=function(){n.addClass("simpread-hidden"),n.parent().hasClass("sr-rd-content-center")&&n.parent().removeAttr("class").addClass("simpread-hidden")},h=void 0;r.parent()[0].tagName.toLowerCase(),h=s||a,h=i||h,h=o||h,h=l||h,!(h=c||h)||h.startsWith("http")||h.startsWith("data")||(h=function e(t,r){if("string"!=typeof t||!t)return null;if(t.match(/^[a-z]+\:\/\//i))return t;if(t.match(/^\/\//))return"http:"+t;if(t.match(/^[a-z]+\:/i))return t;var n;if("string"!=typeof r)return(n=document.createElement("a")).href=t,n.pathname?"http://"+t:null;if(null===(r=e(r)))return null;(n=document.createElement("a")).href=r,"/"===t[0]?r=[]:(r=n.pathname.split("/")).pop(),t=t.split("/");for(var a=0;a<t.length;++a)if("."!==t[a])if(".."===t[a]){if(void 0===r.pop()||0===r.length)return null}else r.push(t[a]);return n.protocol+"//"+n.hostname+r.join("/")}(h,location.href)),n.attr("src",h).replaceAll(r).wrap("<div class='sr-rd-content-center'></div>"),/win|mac/i.test(navigator.platform)?n.one("load",function(){return u()}).one("error",function(){return d()}):n.on("load",function(){return u()}).on("error",function(){return d()})}),t.find("sr-blockquote").map(function(t,r){var n=$(r),a=n.parent();n.removeAttr("style").removeAttr("class"),"dgtle.com"==e&&a.removeClass("quote")}),t.find("iframe:not(.sr-rd-content-nobeautify), embed:not(.sr-rd-content-nobeautify)").map(function(e,t){$(t).wrap("<div class='sr-rd-content-center'></div>")}),t.find("hr").map(function(e,t){$(t).addClass("simpread-hidden")}),t.find("pre").map(function(e,t){$(t).find("code").removeAttr("class")}),t.find("pre").removeAttr("class"),t.find("a").removeAttr("style")},cleanHTML:function(e,t){for(var r=e.html().split("\n"),n="",a=0;a<r.length;a++){var i=r[a];i.trim().startsWith("<")?i.trim().length>0&&(n+=i+"\n"):n+="<p>"+i+"</p>\n"}e.html(function(e){var r="";return $.parseHTML(e).forEach(function(e,n){var a=e.tagName,i=e.outerText,o=e.outerHTML;void 0==a?r+="<p>"+e.textContent.replace(/^\n|\n$/gi,"").trim()+"</p>":(""!=i||o.includes("<img"))&&(r+=t?o.replace(/ style="[\w ;%@#!-:(),\u4e00-\u9fa5]*"/gi,""):o)}),r}(n))}}),re="background-color",ne=".simpread-focus-root",ae="-1";function ie(e){var t=e?e.match(/[0-9]+, /gi):[];return t.length>0?t.join("").replace(/, $/,""):null}function oe(e,t){var r=Object.keys(t).map(function(e){return t[e]&&e.replace(/[A-Z]/,function(e){return"-"+e.toLowerCase()})+": "+t[e]+";"}).join("");switch(e){case"title":r="sr-rd-title {"+r+"}";break;case"desc":r="sr-rd-desc {"+r+"}";break;case"art":r="sr-rd-content *, sr-rd-content p, sr-rd-content div {"+r+"}";break;case"pre":r="sr-rd-content pre {"+r+"}";break;case"code":r="sr-rd-content pre code, sr-rd-content pre code * {"+r+"}"}var n=$("head").find("style#simpread-custom-"+e);0==n.length?$("head").append('<style type="text/css" id="simpread-custom-'+e+'">'+r+"</style>"):n.html(r)}function se(e,t){var r=$("head").find("style#simpread-custom-"+e);0==r.length?$("head").append('<style type="text/css" id="simpread-custom-'+e+'">'+t+"</style>"):r.html(t)}var le=Object.freeze({GetColor:ie,BgColor:function(e,t){var r="rgba("+ie(e)+", "+t/100+")";return $(ne).css(re,r),r},Opacity:function(e){var t=ie($(ne).css(re)),r="rgba("+t+", "+e/100+")";return t?($(ne).css(re,r),r):null},FontFamily:function(e){$("sr-read").css("font-family","default"==e?"":e)},FontSize:function(e){"-1"==ae&&void 0==(ae=$("html").attr("style"))&&(ae=""),e?$("html").attr("style","font-size: "+e+"!important;"+ae):$("html").attr("style",ae)},Layout:function(e){$("sr-read").css("margin",e?"20px "+e:"")},SiteCSS:function(e){e?$("head").append('<style type="text/css" id="simpread-site-css">'+e+"</style>"):$("#simpread-site-css").remove()},Preview:function(e){Object.keys(e).forEach(function(t){"css"!=t&&oe(t,e[t])}),se("css",e.css)},Custom:oe,CSS:se,VerifyCustom:function(e,t){switch(e){case"layout":case"margin":case"fontfamily":case"custom":return""!=t.css;case"fontsize":return""!=t.title.fontSize||""!=t.desc.fontSize||""!=t.art.fontSize||""!=t.css;case"theme":return-1!=t.css.search("simpread-theme-root")}}});function ce(e,t){if(t&&t.documentElement)e=t,t=arguments[2];else if(!e||!e.documentElement)throw new Error("First argument to Readability constructor should be a document object.");var r;t=t||{},this._doc=e,this._articleTitle=null,this._articleByline=null,this._articleDir=null,this._articleSiteName=null,this._attempts=[],this._debug=!!t.debug,this._maxElemsToParse=t.maxElemsToParse||this.DEFAULT_MAX_ELEMS_TO_PARSE,this._nbTopCandidates=t.nbTopCandidates||this.DEFAULT_N_TOP_CANDIDATES,this._charThreshold=t.charThreshold||this.DEFAULT_CHAR_THRESHOLD,this._classesToPreserve=this.CLASSES_TO_PRESERVE.concat(t.classesToPreserve||[]),this._flags=this.FLAG_STRIP_UNLIKELYS|this.FLAG_WEIGHT_CLASSES|this.FLAG_CLEAN_CONDITIONALLY,this._debug?(r=function(e){var t,r,n=e.nodeName+" ";return e.nodeType==e.TEXT_NODE?n+'("'+e.textContent+'")':(t=e.className&&"."+e.className.replace(/ /g,"."),r="",e.id?r="(#"+e.id+t+")":t&&(r="("+t+")"),n+r)},this.log=function(){var e;"undefined"!=typeof dump?(e=Array.prototype.map.call(arguments,function(e){return e&&e.nodeName?r(e):e}).join(" "),dump("Reader: (Readability) "+e+"\n")):"undefined"!=typeof console&&["Reader: (Readability) "].concat(arguments)}):this.log=function(){}}ce.prototype={FLAG_STRIP_UNLIKELYS:1,FLAG_WEIGHT_CLASSES:2,FLAG_CLEAN_CONDITIONALLY:4,ELEMENT_NODE:1,TEXT_NODE:3,DEFAULT_MAX_ELEMS_TO_PARSE:0,DEFAULT_N_TOP_CANDIDATES:5,DEFAULT_TAGS_TO_SCORE:"section,h2,h3,h4,h5,h6,p,td,pre".toUpperCase().split(","),DEFAULT_CHAR_THRESHOLD:500,REGEXPS:{unlikelyCandidates:/-ad-|ai2html|banner|breadcrumbs|combx|comment|community|cover-wrap|disqus|extra|foot|gdpr|header|legends|menu|related|remark|replies|rss|shoutbox|sidebar|skyscraper|social|sponsor|supplemental|ad-break|agegate|pagination|pager|popup|yom-remote/i,okMaybeItsACandidate:/and|article|body|column|main|shadow/i,positive:/article|body|content|entry|hentry|h-entry|main|page|pagination|post|text|blog|story/i,negative:/hidden|^hid$| hid$| hid |^hid |banner|combx|comment|com-|contact|foot|footer|footnote|gdpr|masthead|media|meta|outbrain|promo|related|scroll|share|shoutbox|sidebar|skyscraper|sponsor|shopping|tags|tool|widget/i,extraneous:/print|archive|comment|discuss|e[\-]?mail|share|reply|all|login|sign|single|utility/i,byline:/byline|author|dateline|writtenby|p-author/i,replaceFonts:/<(\/?)font[^>]*>/gi,normalize:/\s{2,}/g,videos:/\/\/(www\.)?((dailymotion|youtube|youtube-nocookie|player\.vimeo|v\.qq)\.com|(archive|upload\.wikimedia)\.org|player\.twitch\.tv)/i,nextLink:/(next|weiter|continue|>([^\|]|$)|禄([^\|]|$))/i,prevLink:/(prev|earl|old|new|<|芦)/i,whitespace:/^\s*$/,hasContent:/\S$/},DIV_TO_P_ELEMS:["A","BLOCKQUOTE","DL","DIV","IMG","OL","P","PRE","TABLE","UL","SELECT"],ALTER_TO_DIV_EXCEPTIONS:["DIV","ARTICLE","SECTION","P"],PRESENTATIONAL_ATTRIBUTES:["align","background","bgcolor","border","cellpadding","cellspacing","frame","hspace","rules","style","valign","vspace"],DEPRECATED_SIZE_ATTRIBUTE_ELEMS:["TABLE","TH","TD","HR","PRE"],PHRASING_ELEMS:["ABBR","AUDIO","B","BDO","BR","BUTTON","CITE","CODE","DATA","DATALIST","DFN","EM","EMBED","I","IMG","INPUT","KBD","LABEL","MARK","MATH","METER","NOSCRIPT","OBJECT","OUTPUT","PROGRESS","Q","RUBY","SAMP","SCRIPT","SELECT","SMALL","SPAN","STRONG","SUB","SUP","TEXTAREA","TIME","VAR","WBR"],CLASSES_TO_PRESERVE:["page"],_postProcessContent:function(e){this._fixRelativeUris(e),this._cleanClasses(e)},_removeNodes:function(e,t){var r,n,a;for(r=e.length-1;r>=0;r--)(a=(n=e[r]).parentNode)&&(!t||t.call(this,n,r,e))&&a.removeChild(n)},_replaceNodeTags:function(e,t){var r,n;for(r=e.length-1;r>=0;r--)n=e[r],this._setNodeTag(n,t)},_forEachNode:function(e,t){Array.prototype.forEach.call(e,t,this)},_someNode:function(e,t){return Array.prototype.some.call(e,t,this)},_everyNode:function(e,t){return Array.prototype.every.call(e,t,this)},_concatNodeLists:function(){var e=Array.prototype.slice,t=e.call(arguments).map(function(t){return e.call(t)});return Array.prototype.concat.apply([],t)},_getAllNodesWithTag:function(e,t){return e.querySelectorAll?e.querySelectorAll(t.join(",")):[].concat.apply([],t.map(function(t){var r=e.getElementsByTagName(t);return Array.isArray(r)?r:Array.from(r)}))},_cleanClasses:function(e){var t=this._classesToPreserve,r=(e.getAttribute("class")||"").split(/\s+/).filter(function(e){return-1!=t.indexOf(e)}).join(" ");for(r?e.setAttribute("class",r):e.removeAttribute("class"),e=e.firstElementChild;e;e=e.nextElementSibling)this._cleanClasses(e)},_fixRelativeUris:function(e){function t(e){if(n==a&&"#"==e.charAt(0))return e;try{return new URL(e,n).href}catch(e){}return e}var r,n=this._doc.baseURI,a=this._doc.documentURI,i=this._getAllNodesWithTag(e,["a"]);this._forEachNode(i,function(e){var r,n=e.getAttribute("href");n&&(0===n.indexOf("javascript:")?(r=this._doc.createTextNode(e.textContent),e.parentNode.replaceChild(r,e)):e.setAttribute("href",t(n)))}),r=this._getAllNodesWithTag(e,["img"]),this._forEachNode(r,function(e){var r=e.getAttribute("src");r&&e.setAttribute("src",t(r))})},_getArticleTitle:function(){function e(e){return e.split(/\s+/).length}var t,r,n,a,i,o=this._doc,s="",l="";try{"string"!=typeof(s=l=o.title.trim())&&(s=l=this._getInnerText(o.getElementsByTagName("title")[0]))}catch(e){}return t=!1,/ [\|\-\\\/>禄] /.test(s)?(t=/ [\\\/>禄] /.test(s),e(s=l.replace(/(.*)[\|\-\\\/>禄] .*/gi,"$1"))<3&&(s=l.replace(/[^\|\-\\\/>禄]*[\|\-\\\/>禄](.*)/gi,"$1"))):-1!==s.indexOf(": ")?(r=this._concatNodeLists(o.getElementsByTagName("h1"),o.getElementsByTagName("h2")),n=s.trim(),this._someNode(r,function(e){return e.textContent.trim()===n})||(e(s=l.substring(l.lastIndexOf(":")+1))<3?s=l.substring(l.indexOf(":")+1):e(l.substr(0,l.indexOf(":")))>5&&(s=l))):(s.length>150||s.length<15)&&(1===(a=o.getElementsByTagName("h1")).length&&(s=this._getInnerText(a[0]))),4>=(i=e(s=s.trim().replace(this.REGEXPS.normalize," ")))&&(!t||i!=e(l.replace(/[\|\-\\\/>禄]+/g,""))-1)&&(s=l),s},_prepDocument:function(){var e=this._doc;this._removeNodes(e.getElementsByTagName("style")),e.body&&this._replaceBrs(e.body),this._replaceNodeTags(e.getElementsByTagName("font"),"SPAN")},_nextElement:function(e){for(var t=e;t&&t.nodeType!=this.ELEMENT_NODE&&this.REGEXPS.whitespace.test(t.textContent);)t=t.nextSibling;return t},_replaceBrs:function(e){this._forEachNode(this._getAllNodesWithTag(e,["br"]),function(e){for(var t,r,n,a,i=e.nextSibling,o=!1;(i=this._nextElement(i))&&"BR"==i.tagName;)o=!0,t=i.nextSibling,i.parentNode.removeChild(i),i=t;if(o){for(r=this._doc.createElement("p"),e.parentNode.replaceChild(r,e),i=r.nextSibling;i&&("BR"!=i.tagName||(!(n=this._nextElement(i.nextSibling))||"BR"!=n.tagName))&&this._isPhrasingContent(i);)a=i.nextSibling,r.appendChild(i),i=a;for(;r.lastChild&&this._isWhitespace(r.lastChild);)r.removeChild(r.lastChild);"P"===r.parentNode.tagName&&this._setNodeTag(r.parentNode,"DIV")}})},_setNodeTag:function(e,t){var r,n;if(this.log("_setNodeTag",e,t),e.__JSDOMParser__)return e.localName=t.toLowerCase(),e.tagName=t.toUpperCase(),e;for(r=e.ownerDocument.createElement(t);e.firstChild;)r.appendChild(e.firstChild);for(e.parentNode.replaceChild(r,e),e.readability&&(r.readability=e.readability),n=0;n<e.attributes.length;n++)try{r.setAttribute(e.attributes[n].name,e.attributes[n].value)}catch(e){}return r},_prepArticle:function(e){var t,r,n;this._cleanStyles(e),this._markDataTables(e),this._cleanConditionally(e,"form"),this._cleanConditionally(e,"fieldset"),this._clean(e,"object"),this._clean(e,"embed"),this._clean(e,"h1"),this._clean(e,"footer"),this._clean(e,"link"),this._clean(e,"aside"),t=this.DEFAULT_CHAR_THRESHOLD,this._forEachNode(e.children,function(e){this._cleanMatchedNodes(e,function(e,r){return/share/.test(r)&&e.textContent.length<t})}),1===(r=e.getElementsByTagName("h2")).length&&(n=(r[0].textContent.length-this._articleTitle.length)/this._articleTitle.length,Math.abs(n)<.5&&(!1,(n>0?r[0].textContent.includes(this._articleTitle):this._articleTitle.includes(r[0].textContent))&&this._clean(e,"h2"))),this._clean(e,"iframe"),this._clean(e,"input"),this._clean(e,"textarea"),this._clean(e,"select"),this._clean(e,"button"),this._cleanHeaders(e),this._cleanConditionally(e,"table"),this._cleanConditionally(e,"ul"),this._cleanConditionally(e,"div"),this._removeNodes(e.getElementsByTagName("p"),function(e){return 0===e.getElementsByTagName("img").length+e.getElementsByTagName("embed").length+e.getElementsByTagName("object").length+e.getElementsByTagName("iframe").length&&!this._getInnerText(e,!1)}),this._forEachNode(this._getAllNodesWithTag(e,["br"]),function(e){var t=this._nextElement(e.nextSibling);t&&"P"==t.tagName&&e.parentNode.removeChild(e)}),this._forEachNode(this._getAllNodesWithTag(e,["table"]),function(e){var t,r,n=this._hasSingleTagInsideElement(e,"TBODY")?e.firstElementChild:e;this._hasSingleTagInsideElement(n,"TR")&&(t=n.firstElementChild,this._hasSingleTagInsideElement(t,"TD")&&(r=t.firstElementChild,r=this._setNodeTag(r,this._everyNode(r.childNodes,this._isPhrasingContent)?"P":"DIV"),e.parentNode.replaceChild(r,e)))})},_initializeNode:function(e){switch(e.readability={contentScore:0},e.tagName){case"DIV":e.readability.contentScore+=5;break;case"PRE":case"TD":case"BLOCKQUOTE":e.readability.contentScore+=3;break;case"ADDRESS":case"OL":case"UL":case"DL":case"DD":case"DT":case"LI":case"FORM":e.readability.contentScore-=3;break;case"H1":case"H2":case"H3":case"H4":case"H5":case"H6":case"TH":e.readability.contentScore-=5}e.readability.contentScore+=this._getClassWeight(e)},_removeAndGetNext:function(e){var t=this._getNextNode(e,!0);return e.parentNode.removeChild(e),t},_getNextNode:function(e,t){if(!t&&e.firstElementChild)return e.firstElementChild;if(e.nextElementSibling)return e.nextElementSibling;do{e=e.parentNode}while(e&&!e.nextElementSibling);return e&&e.nextElementSibling},_checkByline:function(e,t){var r,n;return!this._articleByline&&(void 0!==e.getAttribute&&(r=e.getAttribute("rel"),n=e.getAttribute("itemprop")),!(!("author"===r||n&&-1!==n.indexOf("author")||this.REGEXPS.byline.test(t))||!this._isValidByline(e.textContent))&&(this._articleByline=e.textContent.trim(),!0))},_getNodeAncestors:function(e,t){t=t||0;for(var r=0,n=[];e.parentNode&&(n.push(e.parentNode),!t||++r!==t);)e=e.parentNode;return n},_grabArticle:function(e){var t,r,n,a,i,o,s,l,c,u,d,h,f,p,g,m,_,b,w,v,y,k,E,x,T,N,A,S,C,P,j,L,z,M,$,B,I,O,R,D,H,G,U,q,F,V,W;if(this.log("**** grabArticle ****"),t=this._doc,r=null!==e,!(e=e||this._doc.body))return this.log("No body found in document. Abort."),null;for(n=e.innerHTML;;){for(a=this._flagIsActive(this.FLAG_STRIP_UNLIKELYS),i=[],o=this._doc.documentElement;o;)if(s=o.className+" "+o.id,this._isProbablyVisible(o))if(this._checkByline(o,s))o=this._removeAndGetNext(o);else if(!a||!this.REGEXPS.unlikelyCandidates.test(s)||this.REGEXPS.okMaybeItsACandidate.test(s)||this._hasAncestorTag(o,"table")||"BODY"===o.tagName||"A"===o.tagName)if("DIV"!==o.tagName&&"SECTION"!==o.tagName&&"HEADER"!==o.tagName&&"H1"!==o.tagName&&"H2"!==o.tagName&&"H3"!==o.tagName&&"H4"!==o.tagName&&"H5"!==o.tagName&&"H6"!==o.tagName||!this._isElementWithoutContent(o)){if(-1!==this.DEFAULT_TAGS_TO_SCORE.indexOf(o.tagName)&&i.push(o),"DIV"===o.tagName){for(l=null,c=o.firstChild;c;){if(u=c.nextSibling,this._isPhrasingContent(c))null!==l?l.appendChild(c):this._isWhitespace(c)||(l=t.createElement("p"),o.replaceChild(l,c),l.appendChild(c));else if(null!==l){for(;l.lastChild&&this._isWhitespace(l.lastChild);)l.removeChild(l.lastChild);l=null}c=u}this._hasSingleTagInsideElement(o,"P")&&this._getLinkDensity(o)<.25?(d=o.children[0],o.parentNode.replaceChild(d,o),o=d,i.push(o)):this._hasChildBlockElement(o)||(o=this._setNodeTag(o,"P"),i.push(o))}o=this._getNextNode(o)}else o=this._removeAndGetNext(o);else this.log("Removing unlikely candidate - "+s),o=this._removeAndGetNext(o);else this.log("Removing hidden node - "+s),o=this._removeAndGetNext(o);for(h=[],this._forEachNode(i,function(e){var t,r,n;e.parentNode&&void 0!==e.parentNode.tagName&&((t=this._getInnerText(e)).length<25||0!==(r=this._getNodeAncestors(e,3)).length&&(n=0,n+=1,n+=t.split(",").length,n+=Math.min(Math.floor(t.length/100),3),this._forEachNode(r,function(e,t){if(e.tagName&&e.parentNode&&void 0!==e.parentNode.tagName){if(void 0===e.readability&&(this._initializeNode(e),h.push(e)),0===t)var r=1;else r=1===t?2:3*t;e.readability.contentScore+=n/r}})))}),f=[],p=0,g=h.length;g>p;p+=1)for(_=(m=h[p]).readability.contentScore*(1-this._getLinkDensity(m)),m.readability.contentScore=_,this.log("Candidate:",m,"with score "+_),b=0;b<this._nbTopCandidates;b++)if(!(w=f[b])||_>w.readability.contentScore){f.splice(b,0,m),f.length>this._nbTopCandidates&&f.pop();break}if(y=!1,null===(v=f[0]||null)||"BODY"===v.tagName){for(v=t.createElement("DIV"),y=!0,E=e.childNodes;E.length;)this.log("Moving child out:",E[0]),v.appendChild(E[0]);e.appendChild(v),this._initializeNode(v)}else if(v){for(x=[],T=1;T<f.length;T++)f[T].readability.contentScore/v.readability.contentScore>=.75&&x.push(this._getNodeAncestors(f[T]));if(N=3,x.length>=N)for(k=v.parentNode;"BODY"!==k.tagName;){for(A=0,S=0;S<x.length&&N>A;S++)A+=Number(x[S].includes(k));if(A>=N){v=k;break}k=k.parentNode}for(v.readability||this._initializeNode(v),k=v.parentNode,P=(C=v.readability.contentScore)/3;"BODY"!==k.tagName;)if(k.readability){if(P>(j=k.readability.contentScore))break;if(j>C){v=k;break}C=k.readability.contentScore,k=k.parentNode}else k=k.parentNode;for(k=v.parentNode;"BODY"!=k.tagName&&1==k.children.length;)k=(v=k).parentNode;v.readability||this._initializeNode(v)}for(L=t.createElement("DIV"),r&&(L.id="readability-content"),z=Math.max(10,.2*v.readability.contentScore),$=0,B=(M=(k=v.parentNode).children).length;B>$;$++)I=M[$],O=!1,this.log("Looking at sibling node:",I,I.readability?"with score "+I.readability.contentScore:""),this.log("Sibling has score",I.readability?I.readability.contentScore:"Unknown"),I===v?O=!0:(R=0,I.className===v.className&&""!==v.className&&(R+=.2*v.readability.contentScore),I.readability&&I.readability.contentScore+R>=z?O=!0:"P"===I.nodeName&&(D=this._getLinkDensity(I),(G=(H=this._getInnerText(I)).length)>80&&.25>D?O=!0:80>G&&G>0&&0===D&&-1!==H.search(/\.( |$)/)&&(O=!0))),O&&(this.log("Appending node:",I),-1===this.ALTER_TO_DIV_EXCEPTIONS.indexOf(I.nodeName)&&(this.log("Altering sibling:",I,"to div."),I=this._setNodeTag(I,"DIV")),L.appendChild(I),$-=1,B-=1);if(this._debug&&this.log("Article content pre-prep: "+L.innerHTML),this._prepArticle(L),this._debug&&this.log("Article content post-prep: "+L.innerHTML),y)v.id="readability-page-1",v.className="page";else{for((U=t.createElement("DIV")).id="readability-page-1",U.className="page",q=L.childNodes;q.length;)U.appendChild(q[0]);L.appendChild(U)}if(this._debug&&this.log("Article content after paging: "+L.innerHTML),F=!0,(V=this._getInnerText(L,!0).length)<this._charThreshold)if(F=!1,e.innerHTML=n,this._flagIsActive(this.FLAG_STRIP_UNLIKELYS))this._removeFlag(this.FLAG_STRIP_UNLIKELYS),this._attempts.push({articleContent:L,textLength:V});else if(this._flagIsActive(this.FLAG_WEIGHT_CLASSES))this._removeFlag(this.FLAG_WEIGHT_CLASSES),this._attempts.push({articleContent:L,textLength:V});else if(this._flagIsActive(this.FLAG_CLEAN_CONDITIONALLY))this._removeFlag(this.FLAG_CLEAN_CONDITIONALLY),this._attempts.push({articleContent:L,textLength:V});else{if(this._attempts.push({articleContent:L,textLength:V}),this._attempts.sort(function(e,t){return t.textLength-e.textLength}),!this._attempts[0].textLength)return null;L=this._attempts[0].articleContent,F=!0}if(F)return W=[k,v].concat(this._getNodeAncestors(k)),this._someNode(W,function(e){if(!e.tagName)return!1;var t=e.getAttribute("dir");return!!t&&(this._articleDir=t,!0)}),L}},_isValidByline:function(e){return("string"==typeof e||e instanceof String)&&((e=e.trim()).length>0&&e.length<100)},_getArticleMetadata:function(){var e={},t={},r=this._doc.getElementsByTagName("meta"),n=/\s*(dc|dcterm|og|twitter)\s*:\s*(author|creator|description|title|site_name)\s*/gi,a=/^\s*(?:(dc|dcterm|og|twitter|weibo:(article|webpage))\s*[\.:]\s*)?(author|creator|description|title|site_name)\s*$/i;return this._forEachNode(r,function(e){var r,i,o,s=e.getAttribute("name"),l=e.getAttribute("property"),c=e.getAttribute("content");if(c){if(r=null,i=null,l&&(r=l.match(n)))for(o=r.length-1;o>=0;o--)i=r[o].toLowerCase().replace(/\s/g,""),t[i]=c.trim();!r&&s&&a.test(s)&&(i=s,c&&(i=i.toLowerCase().replace(/\s/g,"").replace(/\./g,":"),t[i]=c.trim()))}}),e.title=t["dc:title"]||t["dcterm:title"]||t["og:title"]||t["weibo:article:title"]||t["weibo:webpage:title"]||t.title||t["twitter:title"],e.title||(e.title=this._getArticleTitle()),e.byline=t["dc:creator"]||t["dcterm:creator"]||t.author,e.excerpt=t["dc:description"]||t["dcterm:description"]||t["og:description"]||t["weibo:article:description"]||t["weibo:webpage:description"]||t.description||t["twitter:description"],e.siteName=t["og:site_name"],e},_removeScripts:function(e){this._removeNodes(e.getElementsByTagName("script"),function(e){return e.nodeValue="",e.removeAttribute("src"),!0}),this._removeNodes(e.getElementsByTagName("noscript"))},_hasSingleTagInsideElement:function(e,t){return 1==e.children.length&&e.children[0].tagName===t&&!this._someNode(e.childNodes,function(e){return e.nodeType===this.TEXT_NODE&&this.REGEXPS.hasContent.test(e.textContent)})},_isElementWithoutContent:function(e){return e.nodeType===this.ELEMENT_NODE&&0==e.textContent.trim().length&&(0==e.children.length||e.children.length==e.getElementsByTagName("br").length+e.getElementsByTagName("hr").length)},_hasChildBlockElement:function(e){return this._someNode(e.childNodes,function(e){return-1!==this.DIV_TO_P_ELEMS.indexOf(e.tagName)||this._hasChildBlockElement(e)})},_isPhrasingContent:function(e){return e.nodeType===this.TEXT_NODE||-1!==this.PHRASING_ELEMS.indexOf(e.tagName)||("A"===e.tagName||"DEL"===e.tagName||"INS"===e.tagName)&&this._everyNode(e.childNodes,this._isPhrasingContent)},_isWhitespace:function(e){return e.nodeType===this.TEXT_NODE&&0===e.textContent.trim().length||e.nodeType===this.ELEMENT_NODE&&"BR"===e.tagName},_getInnerText:function(e,t){t=void 0===t||t;var r=e.textContent.trim();return t?r.replace(this.REGEXPS.normalize," "):r},_getCharCount:function(e,t){return t=t||",",this._getInnerText(e).split(t).length-1},_cleanStyles:function(e){var t,r;if(e&&"svg"!==e.tagName.toLowerCase()){for(t=0;t<this.PRESENTATIONAL_ATTRIBUTES.length;t++)e.removeAttribute(this.PRESENTATIONAL_ATTRIBUTES[t]);for(-1!==this.DEPRECATED_SIZE_ATTRIBUTE_ELEMS.indexOf(e.tagName)&&(e.removeAttribute("width"),e.removeAttribute("height")),r=e.firstElementChild;null!==r;)this._cleanStyles(r),r=r.nextElementSibling}},_getLinkDensity:function(e){var t,r=this._getInnerText(e).length;return 0===r?0:(t=0,this._forEachNode(e.getElementsByTagName("a"),function(e){t+=this._getInnerText(e).length}),t/r)},_getClassWeight:function(e){if(!this._flagIsActive(this.FLAG_WEIGHT_CLASSES))return 0;var t=0;return"string"==typeof e.className&&""!==e.className&&(this.REGEXPS.negative.test(e.className)&&(t-=25),this.REGEXPS.positive.test(e.className)&&(t+=25)),"string"==typeof e.id&&""!==e.id&&(this.REGEXPS.negative.test(e.id)&&(t-=25),this.REGEXPS.positive.test(e.id)&&(t+=25)),t},_clean:function(e,t){var r=-1!==["object","embed","iframe"].indexOf(t);this._removeNodes(e.getElementsByTagName(t),function(e){if(r){for(var t=0;t<e.attributes.length;t++)if(this.REGEXPS.videos.test(e.attributes[t].value))return!1;if("object"===e.tagName&&this.REGEXPS.videos.test(e.innerHTML))return!1}return!0})},_hasAncestorTag:function(e,t,r,n){r=r||3,t=t.toUpperCase();for(var a=0;e.parentNode;){if(r>0&&a>r)return!1;if(e.parentNode.tagName===t&&(!n||n(e.parentNode)))return!0;e=e.parentNode,a++}return!1},_getRowAndColumnCount:function(e){var t,r,n,a,i,o,s=0,l=0,c=e.getElementsByTagName("tr");for(t=0;t<c.length;t++){for((r=c[t].getAttribute("rowspan")||0)&&(r=parseInt(r,10)),s+=r||1,n=0,a=c[t].getElementsByTagName("td"),i=0;i<a.length;i++)(o=a[i].getAttribute("colspan")||0)&&(o=parseInt(o,10)),n+=o||1;l=Math.max(l,n)}return{rows:s,columns:l}},_markDataTables:function(e){var t,r,n,a,i=e.getElementsByTagName("table");for(t=0;t<i.length;t++)"presentation"!=(r=i[t]).getAttribute("role")?"0"!=r.getAttribute("datatable")?r.getAttribute("summary")?r._readabilityDataTable=!0:(n=r.getElementsByTagName("caption")[0])&&n.childNodes.length>0?r._readabilityDataTable=!0:["col","colgroup","tfoot","thead","th"].some(function(e){return!!r.getElementsByTagName(e)[0]})?(this.log("Data table because found data-y descendant"),r._readabilityDataTable=!0):r.getElementsByTagName("table")[0]?r._readabilityDataTable=!1:(a=this._getRowAndColumnCount(r),r._readabilityDataTable=a.rows>=10||a.columns>4||a.rows*a.columns>10):r._readabilityDataTable=!1:r._readabilityDataTable=!1},_cleanConditionally:function(e,t){if(this._flagIsActive(this.FLAG_CLEAN_CONDITIONALLY)){var r="ul"===t||"ol"===t;this._removeNodes(e.getElementsByTagName(t),function(e){var n,a,i,o,s,l,c,u,d,h,f,p=function(e){return e._readabilityDataTable};if("table"===t&&p(e))return!1;if(this._hasAncestorTag(e,"table",-1,p))return!1;if(n=this._getClassWeight(e),0,this.log("Cleaning Conditionally",e),0>n+0)return!0;if(this._getCharCount(e,",")<10){for(a=e.getElementsByTagName("p").length,i=e.getElementsByTagName("img").length,o=e.getElementsByTagName("li").length-100,s=e.getElementsByTagName("input").length,l=0,c=this._concatNodeLists(e.getElementsByTagName("object"),e.getElementsByTagName("embed"),e.getElementsByTagName("iframe")),u=0;u<c.length;u++){for(d=0;d<c[u].attributes.length;d++)if(this.REGEXPS.videos.test(c[u].attributes[d].value))return!1;if("object"===c[u].tagName&&this.REGEXPS.videos.test(c[u].innerHTML))return!1;l++}return h=this._getLinkDensity(e),f=this._getInnerText(e).length,i>1&&.5>a/i&&!this._hasAncestorTag(e,"figure")||!r&&o>a||s>Math.floor(a/3)||!r&&25>f&&(0===i||i>2)&&!this._hasAncestorTag(e,"figure")||!r&&25>n&&h>.2||n>=25&&h>.5||1===l&&75>f||l>1}return!1})}},_cleanMatchedNodes:function(e,t){for(var r=this._getNextNode(e,!0),n=this._getNextNode(e);n&&n!=r;)n=t(n,n.className+" "+n.id)?this._removeAndGetNext(n):this._getNextNode(n)},_cleanHeaders:function(e){for(var t=1;3>t;t+=1)this._removeNodes(e.getElementsByTagName("h"+t),function(e){return this._getClassWeight(e)<0})},_flagIsActive:function(e){return(this._flags&e)>0},_removeFlag:function(e){this._flags=this._flags&~e},_isProbablyVisible:function(e){return!(e.style&&"none"==e.style.display||e.hasAttribute("hidden"))},parse:function(){var e,t,r,n,a;if(this._maxElemsToParse>0&&(e=this._doc.getElementsByTagName("*").length)>this._maxElemsToParse)throw new Error("Aborting parsing document; "+e+" elements found");return this._removeScripts(this._doc),this._prepDocument(),t=this._getArticleMetadata(),this._articleTitle=t.title,(r=this._grabArticle())?(this.log("Grabbed: "+r.innerHTML),this._postProcessContent(r),t.excerpt||(n=r.getElementsByTagName("p")).length>0&&(t.excerpt=n[0].textContent.trim()),a=r.textContent,{title:this._articleTitle,byline:t.byline||this._articleByline,dir:this._articleDir,content:r.innerHTML,textContent:a,length:a.length,excerpt:t.excerpt,siteName:t.siteName||this._articleSiteName}):null}};var ue=Object.freeze({Readability:ce}),de=r(function(e){(function(){function t(e){var t={omitExtraWLInCodeBlocks:{defaultValue:!1,describe:"Omit the default extra whiteline added to code blocks",type:"boolean"},noHeaderId:{defaultValue:!1,describe:"Turn on/off generated header id",type:"boolean"},prefixHeaderId:{defaultValue:!1,describe:"Add a prefix to the generated header ids. Passing a string will prefix that string to the header id. Setting to true will add a generic 'section-' prefix",type:"string"},rawPrefixHeaderId:{defaultValue:!1,describe:'Setting this option to true will prevent showdown from modifying the prefix. This might result in malformed IDs (if, for instance, the " char is used in the prefix)',type:"boolean"},ghCompatibleHeaderId:{defaultValue:!1,describe:"Generate header ids compatible with github style (spaces are replaced with dashes, a bunch of non alphanumeric chars are removed)",type:"boolean"},rawHeaderId:{defaultValue:!1,describe:"Remove only spaces, ' and \" from generated header ids (including prefixes), replacing them with dashes (-). WARNING: This might result in malformed ids",type:"boolean"},headerLevelStart:{defaultValue:!1,describe:"The header blocks level start",type:"integer"},parseImgDimensions:{defaultValue:!1,describe:"Turn on/off image dimension parsing",type:"boolean"},simplifiedAutoLink:{defaultValue:!1,describe:"Turn on/off GFM autolink style",type:"boolean"},excludeTrailingPunctuationFromURLs:{defaultValue:!1,describe:"Excludes trailing punctuation from links generated with autoLinking",type:"boolean"},literalMidWordUnderscores:{defaultValue:!1,describe:"Parse midword underscores as literal underscores",type:"boolean"},literalMidWordAsterisks:{defaultValue:!1,describe:"Parse midword asterisks as literal asterisks",type:"boolean"},strikethrough:{defaultValue:!1,describe:"Turn on/off strikethrough support",type:"boolean"},tables:{defaultValue:!1,describe:"Turn on/off tables support",type:"boolean"},tablesHeaderId:{defaultValue:!1,describe:"Add an id to table headers",type:"boolean"},ghCodeBlocks:{defaultValue:!0,describe:"Turn on/off GFM fenced code blocks support",type:"boolean"},tasklists:{defaultValue:!1,describe:"Turn on/off GFM tasklist support",type:"boolean"},smoothLivePreview:{defaultValue:!1,describe:"Prevents weird effects in live previews due to incomplete input",type:"boolean"},smartIndentationFix:{defaultValue:!1,description:"Tries to smartly fix indentation in es6 strings",type:"boolean"},disableForced4SpacesIndentedSublists:{defaultValue:!1,description:"Disables the requirement of indenting nested sublists by 4 spaces",type:"boolean"},simpleLineBreaks:{defaultValue:!1,description:"Parses simple line breaks as <br> (GFM Style)",type:"boolean"},requireSpaceBeforeHeadingText:{defaultValue:!1,description:"Makes adding a space between `#` and the header text mandatory (GFM Style)",type:"boolean"},ghMentions:{defaultValue:!1,description:"Enables github @mentions",type:"boolean"},ghMentionsLink:{defaultValue:"https://github.com/{u}",description:"Changes the link generated by @mentions. Only applies if ghMentions option is enabled.",type:"string"},encodeEmails:{defaultValue:!0,description:"Encode e-mail addresses through the use of Character Entities, transforming ASCII e-mail addresses into its equivalent decimal entities",type:"boolean"},openLinksInNewWindow:{defaultValue:!1,description:"Open all links in new windows",type:"boolean"},backslashEscapesHTMLTags:{defaultValue:!1,description:"Support for HTML Tag escaping. ex: <div>foo</div>",type:"boolean"},emoji:{defaultValue:!1,description:"Enable emoji support. Ex: `this is a :smile: emoji`",type:"boolean"},underline:{defaultValue:!1,description:"Enable support for underline. Syntax is double or triple underscores: `__underline word__`. With this option enabled, underscores no longer parses into `<em>` and `<strong>`",type:"boolean"},completeHTMLDocument:{defaultValue:!1,description:"Outputs a complete html document, including `<html>`, `<head>` and `<body>` tags",type:"boolean"},metadata:{defaultValue:!1,description:"Enable support for document metadata (defined at the top of the document between `«««` and `»»»` or between `---` and `---`).",type:"boolean"},splitAdjacentBlockquotes:{defaultValue:!1,description:"Split adjacent blockquote blocks",type:"boolean"}};if(!1===e)return JSON.parse(JSON.stringify(t));var r={};for(var n in t)t.hasOwnProperty(n)&&(r[n]=t[n].defaultValue);return r}function r(e,t){var r=t?"Error in "+t+" extension->":"Error in unnamed extension",a={valid:!0,error:""};i.helper.isArray(e)||(e=[e]);for(var o=0;o<e.length;++o){var s=r+" sub-extension "+o+": ",l=e[o];if("object"!=(void 0===l?"undefined":n(l)))return a.valid=!1,a.error=s+"must be an object, but "+(void 0===l?"undefined":n(l))+" given",a;if(!i.helper.isString(l.type))return a.valid=!1,a.error=s+'property "type" must be a string, but '+n(l.type)+" given",a;var c=l.type=l.type.toLowerCase();if("language"===c&&(c=l.type="lang"),"html"===c&&(c=l.type="output"),"lang"!==c&&"output"!==c&&"listener"!==c)return a.valid=!1,a.error=s+"type "+c+' is not recognized. Valid values: "lang/language", "output/html" or "listener"',a;if("listener"===c){if(i.helper.isUndefined(l.listeners))return a.valid=!1,a.error=s+'. Extensions of type "listener" must have a property called "listeners"',a}else if(i.helper.isUndefined(l.filter)&&i.helper.isUndefined(l.regex))return a.valid=!1,a.error=s+c+' extensions must define either a "regex" property or a "filter" method',a;if(l.listeners){if("object"!=n(l.listeners))return a.valid=!1,a.error=s+'"listeners" property must be an object but '+n(l.listeners)+" given",a;for(var u in l.listeners)if(l.listeners.hasOwnProperty(u)&&"function"!=typeof l.listeners[u])return a.valid=!1,a.error=s+'"listeners" property must be an hash of [event name]: [callback]. listeners.'+u+" must be a function but "+n(l.listeners[u])+" given",a}if(l.filter){if("function"!=typeof l.filter)return a.valid=!1,a.error=s+'"filter" must be a function, but '+n(l.filter)+" given",a}else if(l.regex){if(i.helper.isString(l.regex)&&(l.regex=new RegExp(l.regex,"g")),!(l.regex instanceof RegExp))return a.valid=!1,a.error=s+'"regex" property must either be a string or a RegExp object, but '+n(l.regex)+" given",a;if(i.helper.isUndefined(l.replace))return a.valid=!1,a.error=s+'"regex" extensions must implement a replace string or function',a}}return a}function a(e,t){return"¨E"+t.charCodeAt(0)+"E"}var i={},o={},s={},l=t(!0),c="vanilla",u={github:{omitExtraWLInCodeBlocks:!0,simplifiedAutoLink:!0,excludeTrailingPunctuationFromURLs:!0,literalMidWordUnderscores:!0,strikethrough:!0,tables:!0,tablesHeaderId:!0,ghCodeBlocks:!0,tasklists:!0,disableForced4SpacesIndentedSublists:!0,simpleLineBreaks:!0,requireSpaceBeforeHeadingText:!0,ghCompatibleHeaderId:!0,ghMentions:!0,backslashEscapesHTMLTags:!0,emoji:!0,splitAdjacentBlockquotes:!0},original:{noHeaderId:!0,ghCodeBlocks:!1},ghost:{omitExtraWLInCodeBlocks:!0,parseImgDimensions:!0,simplifiedAutoLink:!0,excludeTrailingPunctuationFromURLs:!0,literalMidWordUnderscores:!0,strikethrough:!0,tables:!0,tablesHeaderId:!0,ghCodeBlocks:!0,tasklists:!0,smoothLivePreview:!0,simpleLineBreaks:!0,requireSpaceBeforeHeadingText:!0,ghMentions:!1,encodeEmails:!0},vanilla:t(!0),allOn:function(){var e=t(!0),r={};for(var n in e)e.hasOwnProperty(n)&&(r[n]=!0);return r}()};i.helper={},i.extensions={},i.setOption=function(e,t){return l[e]=t,this},i.getOption=function(e){return l[e]},i.getOptions=function(){return l},i.resetOptions=function(){l=t(!0)},i.setFlavor=function(e){if(!u.hasOwnProperty(e))throw Error(e+" flavor was not found");i.resetOptions();var t=u[e];for(var r in c=e,t)t.hasOwnProperty(r)&&(l[r]=t[r])},i.getFlavor=function(){return c},i.getFlavorOptions=function(e){if(u.hasOwnProperty(e))return u[e]},i.getDefaultOptions=function(e){return t(e)},i.subParser=function(e,t){if(i.helper.isString(e)){if(void 0===t){if(o.hasOwnProperty(e))return o[e];throw Error("SubParser named "+e+" not registered!")}o[e]=t}},i.extension=function(e,t){if(!i.helper.isString(e))throw Error("Extension 'name' must be a string");if(e=i.helper.stdExtName(e),i.helper.isUndefined(t)){if(!s.hasOwnProperty(e))throw Error("Extension named "+e+" is not registered!");return s[e]}"function"==typeof t&&(t=t()),i.helper.isArray(t)||(t=[t]);var n=r(t,e);if(!n.valid)throw Error(n.error);s[e]=t},i.getAllExtensions=function(){return s},i.removeExtension=function(e){delete s[e]},i.resetExtensions=function(){s={}},i.validateExtension=function(e){var t=r(e,null);return!!t.valid||!1},i.hasOwnProperty("helper")||(i.helper={}),i.helper.isString=function(e){return"string"==typeof e||e instanceof String},i.helper.isFunction=function(e){return e&&"[object Function]"==={}.toString.call(e)},i.helper.isArray=function(e){return Array.isArray(e)},i.helper.isUndefined=function(e){return void 0===e},i.helper.forEach=function(e,t){if(i.helper.isUndefined(e))throw new Error("obj param is required");if(i.helper.isUndefined(t))throw new Error("callback param is required");if(!i.helper.isFunction(t))throw new Error("callback param must be a function/closure");if("function"==typeof e.forEach)e.forEach(t);else if(i.helper.isArray(e))for(var r=0;r<e.length;r++)t(e[r],r,e);else{if("object"!=(void 0===e?"undefined":n(e)))throw new Error("obj does not seem to be an array or an iterable object");for(var a in e)e.hasOwnProperty(a)&&t(e[a],a,e)}},i.helper.stdExtName=function(e){return e.replace(/[_?*+\/\\.^-]/g,"").replace(/\s/g,"").toLowerCase()},i.helper.escapeCharactersCallback=a,i.helper.escapeCharacters=function(e,t,r){var n="(["+t.replace(/([\[\]\\])/g,"\\$1")+"])";r&&(n="\\\\"+n);var i=new RegExp(n,"g");return e.replace(i,a)},i.helper.unescapeHTMLEntities=function(e){return e.replace(/"/g,'"').replace(/</g,"<").replace(/>/g,">").replace(/&/g,"&")};var d=function(e,t,r,n){var a,i,o,s,l,c=n||"",u=c.indexOf("g")>-1,d=new RegExp(t+"|"+r,"g"+c.replace(/g/g,"")),h=new RegExp(t,c.replace(/g/g,"")),f=[];do{for(a=0;o=d.exec(e);)if(h.test(o[0]))a++||(s=(i=d.lastIndex)-o[0].length);else if(a&&!--a){l=o.index+o[0].length;var p={left:{start:s,end:i},match:{start:i,end:o.index},right:{start:o.index,end:l},wholeMatch:{start:s,end:l}};if(f.push(p),!u)return f}}while(a&&(d.lastIndex=i));return f};i.helper.matchRecursiveRegExp=function(e,t,r,n){for(var a=d(e,t,r,n),i=[],o=0;o<a.length;++o)i.push([e.slice(a[o].wholeMatch.start,a[o].wholeMatch.end),e.slice(a[o].match.start,a[o].match.end),e.slice(a[o].left.start,a[o].left.end),e.slice(a[o].right.start,a[o].right.end)]);return i},i.helper.replaceRecursiveRegExp=function(e,t,r,n,a){if(!i.helper.isFunction(t)){var o=t;t=function(){return o}}var s=d(e,r,n,a),l=e,c=s.length;if(c>0){var u=[];0!==s[0].wholeMatch.start&&u.push(e.slice(0,s[0].wholeMatch.start));for(var h=0;h<c;++h)u.push(t(e.slice(s[h].wholeMatch.start,s[h].wholeMatch.end),e.slice(s[h].match.start,s[h].match.end),e.slice(s[h].left.start,s[h].left.end),e.slice(s[h].right.start,s[h].right.end))),h<c-1&&u.push(e.slice(s[h].wholeMatch.end,s[h+1].wholeMatch.start));s[c-1].wholeMatch.end<e.length&&u.push(e.slice(s[c-1].wholeMatch.end)),l=u.join("")}return l},i.helper.regexIndexOf=function(e,t,r){if(!i.helper.isString(e))throw"InvalidArgumentError: first parameter of showdown.helper.regexIndexOf function must be a string";if(t instanceof RegExp==0)throw"InvalidArgumentError: second parameter of showdown.helper.regexIndexOf function must be an instance of RegExp";var n=e.substring(r||0).search(t);return n>=0?n+(r||0):n},i.helper.splitAtIndex=function(e,t){if(!i.helper.isString(e))throw"InvalidArgumentError: first parameter of showdown.helper.regexIndexOf function must be a string";return[e.substring(0,t),e.substring(t)]},i.helper.encodeEmailAddress=function(e){var t=[function(e){return"&#"+e.charCodeAt(0)+";"},function(e){return"&#x"+e.charCodeAt(0).toString(16)+";"},function(e){return e}];return e.replace(/./g,function(e){if("@"===e)e=t[Math.floor(2*Math.random())](e);else{var r=Math.random();e=r>.9?t[2](e):r>.45?t[1](e):t[0](e)}return e})},i.helper.padEnd=function(e,t,r){return t>>=0,r=String(r||" "),e.length>t?String(e):((t-=e.length)>r.length&&(r+=r.repeat(t/r.length)),String(e)+r.slice(0,t))},"undefined"==typeof console&&(console={warn:function(e){alert(e)},log:function(e){alert(e)},error:function(e){throw e}}),i.helper.regexes={asteriskDashAndColon:/([*_:~])/g},i.helper.emojis={"+1":"👍","-1":"👎",100:"💯",1234:"🔢","1st_place_medal":"🥇","2nd_place_medal":"🥈","3rd_place_medal":"🥉","8ball":"🎱",a:"🅰️",ab:"🆎",abc:"🔤",abcd:"🔡",accept:"🉑",aerial_tramway:"🚡",airplane:"✈️",alarm_clock:"⏰",alembic:"⚗️",alien:"👽",ambulance:"🚑",amphora:"🏺",anchor:"⚓️",angel:"👼",anger:"💢",angry:"😠",anguished:"😧",ant:"🐜",apple:"🍎",aquarius:"♒️",aries:"♈️",arrow_backward:"◀️",arrow_double_down:"⏬",arrow_double_up:"⏫",arrow_down:"⬇️",arrow_down_small:"🔽",arrow_forward:"▶️",arrow_heading_down:"⤵️",arrow_heading_up:"⤴️",arrow_left:"⬅️",arrow_lower_left:"↙️",arrow_lower_right:"↘️",arrow_right:"➡️",arrow_right_hook:"↪️",arrow_up:"⬆️",arrow_up_down:"↕️",arrow_up_small:"🔼",arrow_upper_left:"↖️",arrow_upper_right:"↗️",arrows_clockwise:"🔃",arrows_counterclockwise:"🔄",art:"🎨",articulated_lorry:"🚛",artificial_satellite:"🛰",astonished:"😲",athletic_shoe:"👟",atm:"🏧",atom_symbol:"⚛️",avocado:"🥑",b:"🅱️",baby:"👶",baby_bottle:"🍼",baby_chick:"🐤",baby_symbol:"🚼",back:"🔙",bacon:"🥓",badminton:"🏸",baggage_claim:"🛄",baguette_bread:"🥖",balance_scale:"⚖️",balloon:"🎈",ballot_box:"🗳",ballot_box_with_check:"☑️",bamboo:"🎍",banana:"🍌",bangbang:"‼️",bank:"🏦",bar_chart:"📊",barber:"💈",baseball:"⚾️",basketball:"🏀",basketball_man:"⛹️",basketball_woman:"⛹️‍♀️",bat:"🦇",bath:"🛀",bathtub:"🛁",battery:"🔋",beach_umbrella:"🏖",bear:"🐻",bed:"🛏",bee:"🐝",beer:"🍺",beers:"🍻",beetle:"🐞",beginner:"🔰",bell:"🔔",bellhop_bell:"🛎",bento:"🍱",biking_man:"🚴",bike:"🚲",biking_woman:"🚴‍♀️",bikini:"👙",biohazard:"☣️",bird:"🐦",birthday:"🎂",black_circle:"⚫️",black_flag:"🏴",black_heart:"🖤",black_joker:"🃏",black_large_square:"⬛️",black_medium_small_square:"◾️",black_medium_square:"◼️",black_nib:"✒️",black_small_square:"▪️",black_square_button:"🔲",blonde_man:"👱",blonde_woman:"👱‍♀️",blossom:"🌼",blowfish:"🐡",blue_book:"📘",blue_car:"🚙",blue_heart:"💙",blush:"😊",boar:"🐗",boat:"⛵️",bomb:"💣",book:"📖",bookmark:"🔖",bookmark_tabs:"📑",books:"📚",boom:"💥",boot:"👢",bouquet:"💐",bowing_man:"🙇",bow_and_arrow:"🏹",bowing_woman:"🙇‍♀️",bowling:"🎳",boxing_glove:"🥊",boy:"👦",bread:"🍞",bride_with_veil:"👰",bridge_at_night:"🌉",briefcase:"💼",broken_heart:"💔",bug:"🐛",building_construction:"🏗",bulb:"💡",bullettrain_front:"🚅",bullettrain_side:"🚄",burrito:"🌯",bus:"🚌",business_suit_levitating:"🕴",busstop:"🚏",bust_in_silhouette:"👤",busts_in_silhouette:"👥",butterfly:"🦋",cactus:"🌵",cake:"🍰",calendar:"📆",call_me_hand:"🤙",calling:"📲",camel:"🐫",camera:"📷",camera_flash:"📸",camping:"🏕",cancer:"♋️",candle:"🕯",candy:"🍬",canoe:"🛶",capital_abcd:"🔠",capricorn:"♑️",car:"🚗",card_file_box:"🗃",card_index:"📇",card_index_dividers:"🗂",carousel_horse:"🎠",carrot:"🥕",cat:"🐱",cat2:"🐈",cd:"💿",chains:"⛓",champagne:"🍾",chart:"💹",chart_with_downwards_trend:"📉",chart_with_upwards_trend:"📈",checkered_flag:"🏁",cheese:"🧀",cherries:"🍒",cherry_blossom:"🌸",chestnut:"🌰",chicken:"🐔",children_crossing:"🚸",chipmunk:"🐿",chocolate_bar:"🍫",christmas_tree:"🎄",church:"⛪️",cinema:"🎦",circus_tent:"🎪",city_sunrise:"🌇",city_sunset:"🌆",cityscape:"🏙",cl:"🆑",clamp:"🗜",clap:"👏",clapper:"🎬",classical_building:"🏛",clinking_glasses:"🥂",clipboard:"📋",clock1:"🕐",clock10:"🕙",clock1030:"🕥",clock11:"🕚",clock1130:"🕦",clock12:"🕛",clock1230:"🕧",clock130:"🕜",clock2:"🕑",clock230:"🕝",clock3:"🕒",clock330:"🕞",clock4:"🕓",clock430:"🕟",clock5:"🕔",clock530:"🕠",clock6:"🕕",clock630:"🕡",clock7:"🕖",clock730:"🕢",clock8:"🕗",clock830:"🕣",clock9:"🕘",clock930:"🕤",closed_book:"📕",closed_lock_with_key:"🔐",closed_umbrella:"🌂",cloud:"☁️",cloud_with_lightning:"🌩",cloud_with_lightning_and_rain:"⛈",cloud_with_rain:"🌧",cloud_with_snow:"🌨",clown_face:"🤡",clubs:"♣️",cocktail:"🍸",coffee:"☕️",coffin:"⚰️",cold_sweat:"😰",comet:"☄️",computer:"💻",computer_mouse:"🖱",confetti_ball:"🎊",confounded:"😖",confused:"😕",congratulations:"㊗️",construction:"🚧",construction_worker_man:"👷",construction_worker_woman:"👷‍♀️",control_knobs:"🎛",convenience_store:"🏪",cookie:"🍪",cool:"🆒",policeman:"👮",copyright:"©️",corn:"🌽",couch_and_lamp:"🛋",couple:"👫",couple_with_heart_woman_man:"💑",couple_with_heart_man_man:"👨‍❤️‍👨",couple_with_heart_woman_woman:"👩‍❤️‍👩",couplekiss_man_man:"👨‍❤️‍💋‍👨",couplekiss_man_woman:"💏",couplekiss_woman_woman:"👩‍❤️‍💋‍👩",cow:"🐮",cow2:"🐄",cowboy_hat_face:"🤠",crab:"🦀",crayon:"🖍",credit_card:"💳",crescent_moon:"🌙",cricket:"🏏",crocodile:"🐊",croissant:"🥐",crossed_fingers:"🤞",crossed_flags:"🎌",crossed_swords:"⚔️",crown:"👑",cry:"😢",crying_cat_face:"😿",crystal_ball:"🔮",cucumber:"🥒",cupid:"💘",curly_loop:"➰",currency_exchange:"💱",curry:"🍛",custard:"🍮",customs:"🛃",cyclone:"🌀",dagger:"🗡",dancer:"💃",dancing_women:"👯",dancing_men:"👯‍♂️",dango:"🍡",dark_sunglasses:"🕶",dart:"🎯",dash:"💨",date:"📅",deciduous_tree:"🌳",deer:"🦌",department_store:"🏬",derelict_house:"🏚",desert:"🏜",desert_island:"🏝",desktop_computer:"🖥",male_detective:"🕵️",diamond_shape_with_a_dot_inside:"💠",diamonds:"♦️",disappointed:"😞",disappointed_relieved:"😥",dizzy:"💫",dizzy_face:"😵",do_not_litter:"🚯",dog:"🐶",dog2:"🐕",dollar:"💵",dolls:"🎎",dolphin:"🐬",door:"🚪",doughnut:"🍩",dove:"🕊",dragon:"🐉",dragon_face:"🐲",dress:"👗",dromedary_camel:"🐪",drooling_face:"🤤",droplet:"💧",drum:"🥁",duck:"🦆",dvd:"📀","e-mail":"📧",eagle:"🦅",ear:"👂",ear_of_rice:"🌾",earth_africa:"🌍",earth_americas:"🌎",earth_asia:"🌏",egg:"🥚",eggplant:"🍆",eight_pointed_black_star:"✴️",eight_spoked_asterisk:"✳️",electric_plug:"🔌",elephant:"🐘",email:"✉️",end:"🔚",envelope_with_arrow:"📩",euro:"💶",european_castle:"🏰",european_post_office:"🏤",evergreen_tree:"🌲",exclamation:"❗️",expressionless:"😑",eye:"👁",eye_speech_bubble:"👁‍🗨",eyeglasses:"👓",eyes:"👀",face_with_head_bandage:"🤕",face_with_thermometer:"🤒",fist_oncoming:"👊",factory:"🏭",fallen_leaf:"🍂",family_man_woman_boy:"👪",family_man_boy:"👨‍👦",family_man_boy_boy:"👨‍👦‍👦",family_man_girl:"👨‍👧",family_man_girl_boy:"👨‍👧‍👦",family_man_girl_girl:"👨‍👧‍👧",family_man_man_boy:"👨‍👨‍👦",family_man_man_boy_boy:"👨‍👨‍👦‍👦",family_man_man_girl:"👨‍👨‍👧",family_man_man_girl_boy:"👨‍👨‍👧‍👦",family_man_man_girl_girl:"👨‍👨‍👧‍👧",family_man_woman_boy_boy:"👨‍👩‍👦‍👦",family_man_woman_girl:"👨‍👩‍👧",family_man_woman_girl_boy:"👨‍👩‍👧‍👦",family_man_woman_girl_girl:"👨‍👩‍👧‍👧",family_woman_boy:"👩‍👦",family_woman_boy_boy:"👩‍👦‍👦",family_woman_girl:"👩‍👧",family_woman_girl_boy:"👩‍👧‍👦",family_woman_girl_girl:"👩‍👧‍👧",family_woman_woman_boy:"👩‍👩‍👦",family_woman_woman_boy_boy:"👩‍👩‍👦‍👦",family_woman_woman_girl:"👩‍👩‍👧",family_woman_woman_girl_boy:"👩‍👩‍👧‍👦",family_woman_woman_girl_girl:"👩‍👩‍👧‍👧",fast_forward:"⏩",fax:"📠",fearful:"😨",feet:"🐾",female_detective:"🕵️‍♀️",ferris_wheel:"🎡",ferry:"⛴",field_hockey:"🏑",file_cabinet:"🗄",file_folder:"📁",film_projector:"📽",film_strip:"🎞",fire:"🔥",fire_engine:"🚒",fireworks:"🎆",first_quarter_moon:"🌓",first_quarter_moon_with_face:"🌛",fish:"🐟",fish_cake:"🍥",fishing_pole_and_fish:"🎣",fist_raised:"✊",fist_left:"🤛",fist_right:"🤜",flags:"🎏",flashlight:"🔦",fleur_de_lis:"⚜️",flight_arrival:"🛬",flight_departure:"🛫",floppy_disk:"💾",flower_playing_cards:"🎴",flushed:"😳",fog:"🌫",foggy:"🌁",football:"🏈",footprints:"👣",fork_and_knife:"🍴",fountain:"⛲️",fountain_pen:"🖋",four_leaf_clover:"🍀",fox_face:"🦊",framed_picture:"🖼",free:"🆓",fried_egg:"🍳",fried_shrimp:"🍤",fries:"🍟",frog:"🐸",frowning:"😦",frowning_face:"☹️",frowning_man:"🙍‍♂️",frowning_woman:"🙍",middle_finger:"🖕",fuelpump:"⛽️",full_moon:"🌕",full_moon_with_face:"🌝",funeral_urn:"⚱️",game_die:"🎲",gear:"⚙️",gem:"💎",gemini:"♊️",ghost:"👻",gift:"🎁",gift_heart:"💝",girl:"👧",globe_with_meridians:"🌐",goal_net:"🥅",goat:"🐐",golf:"⛳️",golfing_man:"🏌️",golfing_woman:"🏌️‍♀️",gorilla:"🦍",grapes:"🍇",green_apple:"🍏",green_book:"📗",green_heart:"💚",green_salad:"🥗",grey_exclamation:"❕",grey_question:"❔",grimacing:"😬",grin:"😁",grinning:"😀",guardsman:"💂",guardswoman:"💂‍♀️",guitar:"🎸",gun:"🔫",haircut_woman:"💇",haircut_man:"💇‍♂️",hamburger:"🍔",hammer:"🔨",hammer_and_pick:"⚒",hammer_and_wrench:"🛠",hamster:"🐹",hand:"✋",handbag:"👜",handshake:"🤝",hankey:"💩",hatched_chick:"🐥",hatching_chick:"🐣",headphones:"🎧",hear_no_evil:"🙉",heart:"❤️",heart_decoration:"💟",heart_eyes:"😍",heart_eyes_cat:"😻",heartbeat:"💓",heartpulse:"💗",hearts:"♥️",heavy_check_mark:"✔️",heavy_division_sign:"➗",heavy_dollar_sign:"💲",heavy_heart_exclamation:"❣️",heavy_minus_sign:"➖",heavy_multiplication_x:"✖️",heavy_plus_sign:"➕",helicopter:"🚁",herb:"🌿",hibiscus:"🌺",high_brightness:"🔆",high_heel:"👠",hocho:"🔪",hole:"🕳",honey_pot:"🍯",horse:"🐴",horse_racing:"🏇",hospital:"🏥",hot_pepper:"🌶",hotdog:"🌭",hotel:"🏨",hotsprings:"♨️",hourglass:"⌛️",hourglass_flowing_sand:"⏳",house:"🏠",house_with_garden:"🏡",houses:"🏘",hugs:"🤗",hushed:"😯",ice_cream:"🍨",ice_hockey:"🏒",ice_skate:"⛸",icecream:"🍦",id:"🆔",ideograph_advantage:"🉐",imp:"👿",inbox_tray:"📥",incoming_envelope:"📨",tipping_hand_woman:"💁",information_source:"ℹ️",innocent:"😇",interrobang:"⁉️",iphone:"📱",izakaya_lantern:"🏮",jack_o_lantern:"🎃",japan:"🗾",japanese_castle:"🏯",japanese_goblin:"👺",japanese_ogre:"👹",jeans:"👖",joy:"😂",joy_cat:"😹",joystick:"🕹",kaaba:"🕋",key:"🔑",keyboard:"⌨️",keycap_ten:"🔟",kick_scooter:"🛴",kimono:"👘",kiss:"💋",kissing:"😗",kissing_cat:"😽",kissing_closed_eyes:"😚",kissing_heart:"😘",kissing_smiling_eyes:"😙",kiwi_fruit:"🥝",koala:"🐨",koko:"🈁",label:"🏷",large_blue_circle:"🔵",large_blue_diamond:"🔷",large_orange_diamond:"🔶",last_quarter_moon:"🌗",last_quarter_moon_with_face:"🌜",latin_cross:"✝️",laughing:"😆",leaves:"🍃",ledger:"📒",left_luggage:"🛅",left_right_arrow:"↔️",leftwards_arrow_with_hook:"↩️",lemon:"🍋",leo:"♌️",leopard:"🐆",level_slider:"🎚",libra:"♎️",light_rail:"🚈",link:"🔗",lion:"🦁",lips:"👄",lipstick:"💄",lizard:"🦎",lock:"🔒",lock_with_ink_pen:"🔏",lollipop:"🍭",loop:"➿",loud_sound:"🔊",loudspeaker:"📢",love_hotel:"🏩",love_letter:"💌",low_brightness:"🔅",lying_face:"🤥",m:"Ⓜ️",mag:"🔍",mag_right:"🔎",mahjong:"🀄️",mailbox:"📫",mailbox_closed:"📪",mailbox_with_mail:"📬",mailbox_with_no_mail:"📭",man:"👨",man_artist:"👨‍🎨",man_astronaut:"👨‍🚀",man_cartwheeling:"🤸‍♂️",man_cook:"👨‍🍳",man_dancing:"🕺",man_facepalming:"🤦‍♂️",man_factory_worker:"👨‍🏭",man_farmer:"👨‍🌾",man_firefighter:"👨‍🚒",man_health_worker:"👨‍⚕️",man_in_tuxedo:"🤵",man_judge:"👨‍⚖️",man_juggling:"🤹‍♂️",man_mechanic:"👨‍🔧",man_office_worker:"👨‍💼",man_pilot:"👨‍✈️",man_playing_handball:"🤾‍♂️",man_playing_water_polo:"🤽‍♂️",man_scientist:"👨‍🔬",man_shrugging:"🤷‍♂️",man_singer:"👨‍🎤",man_student:"👨‍🎓",man_teacher:"👨‍🏫",man_technologist:"👨‍💻",man_with_gua_pi_mao:"👲",man_with_turban:"👳",tangerine:"🍊",mans_shoe:"👞",mantelpiece_clock:"🕰",maple_leaf:"🍁",martial_arts_uniform:"🥋",mask:"😷",massage_woman:"💆",massage_man:"💆‍♂️",meat_on_bone:"🍖",medal_military:"🎖",medal_sports:"🏅",mega:"📣",melon:"🍈",memo:"📝",men_wrestling:"🤼‍♂️",menorah:"🕎",mens:"🚹",metal:"🤘",metro:"🚇",microphone:"🎤",microscope:"🔬",milk_glass:"🥛",milky_way:"🌌",minibus:"🚐",minidisc:"💽",mobile_phone_off:"📴",money_mouth_face:"🤑",money_with_wings:"💸",moneybag:"💰",monkey:"🐒",monkey_face:"🐵",monorail:"🚝",moon:"🌔",mortar_board:"🎓",mosque:"🕌",motor_boat:"🛥",motor_scooter:"🛵",motorcycle:"🏍",motorway:"🛣",mount_fuji:"🗻",mountain:"⛰",mountain_biking_man:"🚵",mountain_biking_woman:"🚵‍♀️",mountain_cableway:"🚠",mountain_railway:"🚞",mountain_snow:"🏔",mouse:"🐭",mouse2:"🐁",movie_camera:"🎥",moyai:"🗿",mrs_claus:"🤶",muscle:"💪",mushroom:"🍄",musical_keyboard:"🎹",musical_note:"🎵",musical_score:"🎼",mute:"🔇",nail_care:"💅",name_badge:"📛",national_park:"🏞",nauseated_face:"🤢",necktie:"👔",negative_squared_cross_mark:"❎",nerd_face:"🤓",neutral_face:"😐",new:"🆕",new_moon:"🌑",new_moon_with_face:"🌚",newspaper:"📰",newspaper_roll:"🗞",next_track_button:"⏭",ng:"🆖",no_good_man:"🙅‍♂️",no_good_woman:"🙅",night_with_stars:"🌃",no_bell:"🔕",no_bicycles:"🚳",no_entry:"⛔️",no_entry_sign:"🚫",no_mobile_phones:"📵",no_mouth:"😶",no_pedestrians:"🚷",no_smoking:"🚭","non-potable_water":"🚱",nose:"👃",notebook:"📓",notebook_with_decorative_cover:"📔",notes:"🎶",nut_and_bolt:"🔩",o:"⭕️",o2:"🅾️",ocean:"🌊",octopus:"🐙",oden:"🍢",office:"🏢",oil_drum:"🛢",ok:"🆗",ok_hand:"👌",ok_man:"🙆‍♂️",ok_woman:"🙆",old_key:"🗝",older_man:"👴",older_woman:"👵",om:"🕉",on:"🔛",oncoming_automobile:"🚘",oncoming_bus:"🚍",oncoming_police_car:"🚔",oncoming_taxi:"🚖",open_file_folder:"📂",open_hands:"👐",open_mouth:"😮",open_umbrella:"☂️",ophiuchus:"⛎",orange_book:"📙",orthodox_cross:"☦️",outbox_tray:"📤",owl:"🦉",ox:"🐂",package:"📦",page_facing_up:"📄",page_with_curl:"📃",pager:"📟",paintbrush:"🖌",palm_tree:"🌴",pancakes:"🥞",panda_face:"🐼",paperclip:"📎",paperclips:"🖇",parasol_on_ground:"⛱",parking:"🅿️",part_alternation_mark:"〽️",partly_sunny:"⛅️",passenger_ship:"🛳",passport_control:"🛂",pause_button:"⏸",peace_symbol:"☮️",peach:"🍑",peanuts:"🥜",pear:"🍐",pen:"🖊",pencil2:"✏️",penguin:"🐧",pensive:"😔",performing_arts:"🎭",persevere:"😣",person_fencing:"🤺",pouting_woman:"🙎",phone:"☎️",pick:"⛏",pig:"🐷",pig2:"🐖",pig_nose:"🐽",pill:"💊",pineapple:"🍍",ping_pong:"🏓",pisces:"♓️",pizza:"🍕",place_of_worship:"🛐",plate_with_cutlery:"🍽",play_or_pause_button:"⏯",point_down:"👇",point_left:"👈",point_right:"👉",point_up:"☝️",point_up_2:"👆",police_car:"🚓",policewoman:"👮‍♀️",poodle:"🐩",popcorn:"🍿",post_office:"🏣",postal_horn:"📯",postbox:"📮",potable_water:"🚰",potato:"🥔",pouch:"👝",poultry_leg:"🍗",pound:"💷",rage:"😡",pouting_cat:"😾",pouting_man:"🙎‍♂️",pray:"🙏",prayer_beads:"📿",pregnant_woman:"🤰",previous_track_button:"⏮",prince:"🤴",princess:"👸",printer:"🖨",purple_heart:"💜",purse:"👛",pushpin:"📌",put_litter_in_its_place:"🚮",question:"❓",rabbit:"🐰",rabbit2:"🐇",racehorse:"🐎",racing_car:"🏎",radio:"📻",radio_button:"🔘",radioactive:"☢️",railway_car:"🚃",railway_track:"🛤",rainbow:"🌈",rainbow_flag:"🏳️‍🌈",raised_back_of_hand:"🤚",raised_hand_with_fingers_splayed:"🖐",raised_hands:"🙌",raising_hand_woman:"🙋",raising_hand_man:"🙋‍♂️",ram:"🐏",ramen:"🍜",rat:"🐀",record_button:"⏺",recycle:"♻️",red_circle:"🔴",registered:"®️",relaxed:"☺️",relieved:"😌",reminder_ribbon:"🎗",repeat:"🔁",repeat_one:"🔂",rescue_worker_helmet:"⛑",restroom:"🚻",revolving_hearts:"💞",rewind:"⏪",rhinoceros:"🦏",ribbon:"🎀",rice:"🍚",rice_ball:"🍙",rice_cracker:"🍘",rice_scene:"🎑",right_anger_bubble:"🗯",ring:"💍",robot:"🤖",rocket:"🚀",rofl:"🤣",roll_eyes:"🙄",roller_coaster:"🎢",rooster:"🐓",rose:"🌹",rosette:"🏵",rotating_light:"🚨",round_pushpin:"📍",rowing_man:"🚣",rowing_woman:"🚣‍♀️",rugby_football:"🏉",running_man:"🏃",running_shirt_with_sash:"🎽",running_woman:"🏃‍♀️",sa:"🈂️",sagittarius:"♐️",sake:"🍶",sandal:"👡",santa:"🎅",satellite:"📡",saxophone:"🎷",school:"🏫",school_satchel:"🎒",scissors:"✂️",scorpion:"🦂",scorpius:"♏️",scream:"😱",scream_cat:"🙀",scroll:"📜",seat:"💺",secret:"㊙️",see_no_evil:"🙈",seedling:"🌱",selfie:"🤳",shallow_pan_of_food:"🥘",shamrock:"☘️",shark:"🦈",shaved_ice:"🍧",sheep:"🐑",shell:"🐚",shield:"🛡",shinto_shrine:"⛩",ship:"🚢",shirt:"👕",shopping:"🛍",shopping_cart:"🛒",shower:"🚿",shrimp:"🦐",signal_strength:"📶",six_pointed_star:"🔯",ski:"🎿",skier:"⛷",skull:"💀",skull_and_crossbones:"☠️",sleeping:"😴",sleeping_bed:"🛌",sleepy:"😪",slightly_frowning_face:"🙁",slightly_smiling_face:"🙂",slot_machine:"🎰",small_airplane:"🛩",small_blue_diamond:"🔹",small_orange_diamond:"🔸",small_red_triangle:"🔺",small_red_triangle_down:"🔻",smile:"😄",smile_cat:"😸",smiley:"😃",smiley_cat:"😺",smiling_imp:"😈",smirk:"😏",smirk_cat:"😼",smoking:"🚬",snail:"🐌",snake:"🐍",sneezing_face:"🤧",snowboarder:"🏂",snowflake:"❄️",snowman:"⛄️",snowman_with_snow:"☃️",sob:"😭",soccer:"⚽️",soon:"🔜",sos:"🆘",sound:"🔉",space_invader:"👾",spades:"♠️",spaghetti:"🍝",sparkle:"❇️",sparkler:"🎇",sparkles:"✨",sparkling_heart:"💖",speak_no_evil:"🙊",speaker:"🔈",speaking_head:"🗣",speech_balloon:"💬",speedboat:"🚤",spider:"🕷",spider_web:"🕸",spiral_calendar:"🗓",spiral_notepad:"🗒",spoon:"🥄",squid:"🦑",stadium:"🏟",star:"⭐️",star2:"🌟",star_and_crescent:"☪️",star_of_david:"✡️",stars:"🌠",station:"🚉",statue_of_liberty:"🗽",steam_locomotive:"🚂",stew:"🍲",stop_button:"⏹",stop_sign:"🛑",stopwatch:"⏱",straight_ruler:"📏",strawberry:"🍓",stuck_out_tongue:"😛",stuck_out_tongue_closed_eyes:"😝",stuck_out_tongue_winking_eye:"😜",studio_microphone:"🎙",stuffed_flatbread:"🥙",sun_behind_large_cloud:"🌥",sun_behind_rain_cloud:"🌦",sun_behind_small_cloud:"🌤",sun_with_face:"🌞",sunflower:"🌻",sunglasses:"😎",sunny:"☀️",sunrise:"🌅",sunrise_over_mountains:"🌄",surfing_man:"🏄",surfing_woman:"🏄‍♀️",sushi:"🍣",suspension_railway:"🚟",sweat:"😓",sweat_drops:"💦",sweat_smile:"😅",sweet_potato:"🍠",swimming_man:"🏊",swimming_woman:"🏊‍♀️",symbols:"🔣",synagogue:"🕍",syringe:"💉",taco:"🌮",tada:"🎉",tanabata_tree:"🎋",taurus:"♉️",taxi:"🚕",tea:"🍵",telephone_receiver:"📞",telescope:"🔭",tennis:"🎾",tent:"⛺️",thermometer:"🌡",thinking:"🤔",thought_balloon:"💭",ticket:"🎫",tickets:"🎟",tiger:"🐯",tiger2:"🐅",timer_clock:"⏲",tipping_hand_man:"💁‍♂️",tired_face:"😫",tm:"™️",toilet:"🚽",tokyo_tower:"🗼",tomato:"🍅",tongue:"👅",top:"🔝",tophat:"🎩",tornado:"🌪",trackball:"🖲",tractor:"🚜",traffic_light:"🚥",train:"🚋",train2:"🚆",tram:"🚊",triangular_flag_on_post:"🚩",triangular_ruler:"📐",trident:"🔱",triumph:"😤",trolleybus:"🚎",trophy:"🏆",tropical_drink:"🍹",tropical_fish:"🐠",truck:"🚚",trumpet:"🎺",tulip:"🌷",tumbler_glass:"🥃",turkey:"🦃",turtle:"🐢",tv:"📺",twisted_rightwards_arrows:"🔀",two_hearts:"💕",two_men_holding_hands:"👬",two_women_holding_hands:"👭",u5272:"🈹",u5408:"🈴",u55b6:"🈺",u6307:"🈯️",u6708:"🈷️",u6709:"🈶",u6e80:"🈵",u7121:"🈚️",u7533:"🈸",u7981:"🈲",u7a7a:"🈳",umbrella:"☔️",unamused:"😒",underage:"🔞",unicorn:"🦄",unlock:"🔓",up:"🆙",upside_down_face:"🙃",v:"✌️",vertical_traffic_light:"🚦",vhs:"📼",vibration_mode:"📳",video_camera:"📹",video_game:"🎮",violin:"🎻",virgo:"♍️",volcano:"🌋",volleyball:"🏐",vs:"🆚",vulcan_salute:"🖖",walking_man:"🚶",walking_woman:"🚶‍♀️",waning_crescent_moon:"🌘",waning_gibbous_moon:"🌖",warning:"⚠️",wastebasket:"🗑",watch:"⌚️",water_buffalo:"🐃",watermelon:"🍉",wave:"👋",wavy_dash:"〰️",waxing_crescent_moon:"🌒",wc:"🚾",weary:"😩",wedding:"💒",weight_lifting_man:"🏋️",weight_lifting_woman:"🏋️‍♀️",whale:"🐳",whale2:"🐋",wheel_of_dharma:"☸️",wheelchair:"♿️",white_check_mark:"✅",white_circle:"⚪️",white_flag:"🏳️",white_flower:"💮",white_large_square:"⬜️",white_medium_small_square:"◽️",white_medium_square:"◻️",white_small_square:"▫️",white_square_button:"🔳",wilted_flower:"🥀",wind_chime:"🎐",wind_face:"🌬",wine_glass:"🍷",wink:"😉",wolf:"🐺",woman:"👩",woman_artist:"👩‍🎨",woman_astronaut:"👩‍🚀",woman_cartwheeling:"🤸‍♀️",woman_cook:"👩‍🍳",woman_facepalming:"🤦‍♀️",woman_factory_worker:"👩‍🏭",woman_farmer:"👩‍🌾",woman_firefighter:"👩‍🚒",woman_health_worker:"👩‍⚕️",woman_judge:"👩‍⚖️",woman_juggling:"🤹‍♀️",woman_mechanic:"👩‍🔧",woman_office_worker:"👩‍💼",woman_pilot:"👩‍✈️",woman_playing_handball:"🤾‍♀️",woman_playing_water_polo:"🤽‍♀️",woman_scientist:"👩‍🔬",woman_shrugging:"🤷‍♀️",woman_singer:"👩‍🎤",woman_student:"👩‍🎓",woman_teacher:"👩‍🏫",woman_technologist:"👩‍💻",woman_with_turban:"👳‍♀️",womans_clothes:"👚",womans_hat:"👒",women_wrestling:"🤼‍♀️",womens:"🚺",world_map:"🗺",worried:"😟",wrench:"🔧",writing_hand:"✍️",x:"❌",yellow_heart:"💛",yen:"💴",yin_yang:"☯️",yum:"😋",zap:"⚡️",zipper_mouth_face:"🤐",zzz:"💤",octocat:'<img alt=":octocat:" height="20" width="20" align="absmiddle" src="https://assets-cdn.github.com/images/icons/emoji/octocat.png">',showdown:"<span style=\"font-family: 'Anonymous Pro', monospace; text-decoration: underline; text-decoration-style: dashed; text-decoration-color: #3e8b8a;text-underline-position: under;\">S</span>"},i.Converter=function(e){function t(e,t){if(t=t||null,i.helper.isString(e)){if(t=e=i.helper.stdExtName(e),i.extensions[e])return void function(e,t){"function"==typeof e&&(e=e(new i.Converter)),i.helper.isArray(e)||(e=[e]);var n=r(e,t);if(!n.valid)throw Error(n.error);for(var a=0;a<e.length;++a)switch(e[a].type){case"lang":d.push(e[a]);break;case"output":h.push(e[a]);break;default:throw Error("Extension loader error: Type unrecognized!!!")}}(i.extensions[e],e);if(i.helper.isUndefined(s[e]))throw Error('Extension "'+e+'" could not be loaded. It was either not found or is not a valid extension.');e=s[e]}"function"==typeof e&&(e=e()),i.helper.isArray(e)||(e=[e]);var n=r(e,t);if(!n.valid)throw Error(n.error);for(var o=0;o<e.length;++o){switch(e[o].type){case"lang":d.push(e[o]);break;case"output":h.push(e[o])}if(e[o].hasOwnProperty("listeners"))for(var l in e[o].listeners)e[o].listeners.hasOwnProperty(l)&&a(l,e[o].listeners[l])}}function a(e,t){if(!i.helper.isString(e))throw Error("Invalid argument in converter.listen() method: name must be a string, but "+(void 0===e?"undefined":n(e))+" given");if("function"!=typeof t)throw Error("Invalid argument in converter.listen() method: callback must be a function, but "+(void 0===t?"undefined":n(t))+" given");f.hasOwnProperty(e)||(f[e]=[]),f[e].push(t)}var o={},d=[],h=[],f={},p=c,g={parsed:{},raw:"",format:""};!function(){for(var r in e=e||{},l)l.hasOwnProperty(r)&&(o[r]=l[r]);if("object"!=(void 0===e?"undefined":n(e)))throw Error("Converter expects the passed parameter to be an object, but "+(void 0===e?"undefined":n(e))+" was passed instead.");for(var a in e)e.hasOwnProperty(a)&&(o[a]=e[a]);o.extensions&&i.helper.forEach(o.extensions,t)}(),this._dispatch=function(e,t,r,n){if(f.hasOwnProperty(e))for(var a=0;a<f[e].length;++a){var i=f[e][a](e,t,this,r,n);i&&void 0!==i&&(t=i)}return t},this.listen=function(e,t){return a(e,t),this},this.makeHtml=function(e){if(!e)return e;var t={gHtmlBlocks:[],gHtmlMdBlocks:[],gHtmlSpans:[],gUrls:{},gTitles:{},gDimensions:{},gListLevel:0,hashLinkCounts:{},langExtensions:d,outputModifiers:h,converter:this,ghCodeBlocks:[],metadata:{parsed:{},raw:"",format:""}};return e=(e=(e=(e=(e=e.replace(/¨/g,"¨T")).replace(/\$/g,"¨D")).replace(/\r\n/g,"\n")).replace(/\r/g,"\n")).replace(/\u00A0/g," "),o.smartIndentationFix&&(e=function(e){var t=e.match(/^\s*/)[0].length,r=new RegExp("^\\s{0,"+t+"}","gm");return e.replace(r,"")}(e)),e="\n\n"+e+"\n\n",e=(e=i.subParser("detab")(e,o,t)).replace(/^[ \t]+$/gm,""),i.helper.forEach(d,function(r){e=i.subParser("runExtension")(r,e,o,t)}),e=i.subParser("metadata")(e,o,t),e=i.subParser("hashPreCodeTags")(e,o,t),e=i.subParser("githubCodeBlocks")(e,o,t),e=i.subParser("hashHTMLBlocks")(e,o,t),e=i.subParser("hashCodeTags")(e,o,t),e=i.subParser("stripLinkDefinitions")(e,o,t),e=i.subParser("blockGamut")(e,o,t),e=i.subParser("unhashHTMLSpans")(e,o,t),e=(e=(e=i.subParser("unescapeSpecialChars")(e,o,t)).replace(/¨D/g,"$$")).replace(/¨T/g,"¨"),e=i.subParser("completeHTMLDocument")(e,o,t),i.helper.forEach(h,function(r){e=i.subParser("runExtension")(r,e,o,t)}),g=t.metadata,e},this.makeMarkdown=this.makeMd=function(e,t){if(e=(e=(e=e.replace(/\r\n/g,"\n")).replace(/\r/g,"\n")).replace(/>[ \t]+</,">¨NBSP;<"),!t){if(!window||!window.document)throw new Error("HTMLParser is undefined. If in a webworker or nodejs environment, you need to provide a WHATWG DOM and HTML such as JSDOM");t=window.document}var r=t.createElement("div");r.innerHTML=e;var n={preList:function(e){for(var t=e.querySelectorAll("pre"),r=[],n=0;n<t.length;++n)if(1===t[n].childElementCount&&"code"===t[n].firstChild.tagName.toLowerCase()){var a=t[n].firstChild.innerHTML.trim(),o=t[n].firstChild.getAttribute("data-language")||"";if(""===o)for(var s=t[n].firstChild.className.split(" "),l=0;l<s.length;++l){var c=s[l].match(/^language-(.+)$/);if(null!==c){o=c[1];break}}a=i.helper.unescapeHTMLEntities(a),r.push(a),t[n].outerHTML='<precode language="'+o+'" precodenum="'+n.toString()+'"></precode>'}else r.push(t[n].innerHTML),t[n].innerHTML="",t[n].setAttribute("prenum",n.toString());return r}(r)};!function e(t){for(var r=0;r<t.childNodes.length;++r){var n=t.childNodes[r];3===n.nodeType?/\S/.test(n.nodeValue)?(n.nodeValue=n.nodeValue.split("\n").join(" "),n.nodeValue=n.nodeValue.replace(/(\s)+/g,"$1")):(t.removeChild(n),--r):1===n.nodeType&&e(n)}}(r);for(var a=r.childNodes,o="",s=0;s<a.length;s++)o+=i.subParser("makeMarkdown.node")(a[s],n);return o},this.setOption=function(e,t){o[e]=t},this.getOption=function(e){return o[e]},this.getOptions=function(){return o},this.addExtension=function(e,r){t(e,r=r||null)},this.useExtension=function(e){t(e)},this.setFlavor=function(e){if(!u.hasOwnProperty(e))throw Error(e+" flavor was not found");var t=u[e];for(var r in p=e,t)t.hasOwnProperty(r)&&(o[r]=t[r])},this.getFlavor=function(){return p},this.removeExtension=function(e){i.helper.isArray(e)||(e=[e]);for(var t=0;t<e.length;++t){for(var r=e[t],n=0;n<d.length;++n)d[n]===r&&d[n].splice(n,1);for(;0<h.length;++n)h[0]===r&&h[0].splice(n,1)}},this.getAllExtensions=function(){return{language:d,output:h}},this.getMetadata=function(e){return e?g.raw:g.parsed},this.getMetadataFormat=function(){return g.format},this._setMetadataPair=function(e,t){g.parsed[e]=t},this._setMetadataFormat=function(e){g.format=e},this._setMetadataRaw=function(e){g.raw=e}},i.subParser("anchors",function(e,t,r){var n=function(e,n,a,o,s,l,c){if(i.helper.isUndefined(c)&&(c=""),a=a.toLowerCase(),e.search(/\(<?\s*>? ?(['"].*['"])?\)$/m)>-1)o="";else if(!o){if(a||(a=n.toLowerCase().replace(/ ?\n/g," ")),o="#"+a,i.helper.isUndefined(r.gUrls[a]))return e;o=r.gUrls[a],i.helper.isUndefined(r.gTitles[a])||(c=r.gTitles[a])}var u='<a href="'+(o=o.replace(i.helper.regexes.asteriskDashAndColon,i.helper.escapeCharactersCallback))+'"';return""!==c&&null!==c&&(u+=' title="'+(c=(c=c.replace(/"/g,""")).replace(i.helper.regexes.asteriskDashAndColon,i.helper.escapeCharactersCallback))+'"'),t.openLinksInNewWindow&&!/^#/.test(o)&&(u+=' target="¨E95Eblank"'),u+">"+n+"</a>"};return e=(e=(e=(e=(e=r.converter._dispatch("anchors.before",e,t,r)).replace(/\[((?:\[[^\]]*]|[^\[\]])*)] ?(?:\n *)?\[(.*?)]()()()()/g,n)).replace(/\[((?:\[[^\]]*]|[^\[\]])*)]()[ \t]*\([ \t]?<([^>]*)>(?:[ \t]*((["'])([^"]*?)\5))?[ \t]?\)/g,n)).replace(/\[((?:\[[^\]]*]|[^\[\]])*)]()[ \t]*\([ \t]?<?([\S]+?(?:\([\S]*?\)[\S]*?)?)>?(?:[ \t]*((["'])([^"]*?)\5))?[ \t]?\)/g,n)).replace(/\[([^\[\]]+)]()()()()()/g,n),t.ghMentions&&(e=e.replace(/(^|\s)(\\)?(@([a-z\d]+(?:[a-z\d.-]+?[a-z\d]+)*))/gim,function(e,r,n,a,o){if("\\"===n)return r+a;if(!i.helper.isString(t.ghMentionsLink))throw new Error("ghMentionsLink option must be a string");var s=t.ghMentionsLink.replace(/\{u}/g,o),l="";return t.openLinksInNewWindow&&(l=' target="¨E95Eblank"'),r+'<a href="'+s+'"'+l+">"+a+"</a>"})),r.converter._dispatch("anchors.after",e,t,r)});var h=/([*~_]+|\b)(((https?|ftp|dict):\/\/|www\.)[^'">\s]+?\.[^'">\s]+?)()(\1)?(?=\s|$)(?!["<>])/gi,f=/([*~_]+|\b)(((https?|ftp|dict):\/\/|www\.)[^'">\s]+\.[^'">\s]+?)([.!?,()\[\]])?(\1)?(?=\s|$)(?!["<>])/gi,p=/()<(((https?|ftp|dict):\/\/|www\.)[^'">\s]+)()>()/gi,g=/(^|\s)(?:mailto:)?([A-Za-z0-9!#$%&'*+-/=?^_`{|}~.]+@[-a-z0-9]+(\.[-a-z0-9]+)*\.[a-z]+)(?=$|\s)/gim,m=/<()(?:mailto:)?([-.\w]+@[-a-z0-9]+(\.[-a-z0-9]+)*\.[a-z]+)>/gi,_=function(e){return function(t,r,n,a,o,s,l){var c=n=n.replace(i.helper.regexes.asteriskDashAndColon,i.helper.escapeCharactersCallback),u="",d="",h=r||"",f=l||"";return/^www\./i.test(n)&&(n=n.replace(/^www\./i,"http://www.")),e.excludeTrailingPunctuationFromURLs&&s&&(u=s),e.openLinksInNewWindow&&(d=' target="¨E95Eblank"'),h+'<a href="'+n+'"'+d+">"+c+"</a>"+u+f}},b=function(e,t){return function(r,n,a){var o="mailto:";return n=n||"",a=i.subParser("unescapeSpecialChars")(a,e,t),e.encodeEmails?(o=i.helper.encodeEmailAddress(o+a),a=i.helper.encodeEmailAddress(a)):o+=a,n+'<a href="'+o+'">'+a+"</a>"}};i.subParser("autoLinks",function(e,t,r){return e=(e=(e=r.converter._dispatch("autoLinks.before",e,t,r)).replace(p,_(t))).replace(m,b(t,r)),r.converter._dispatch("autoLinks.after",e,t,r)}),i.subParser("simplifiedAutoLinks",function(e,t,r){return t.simplifiedAutoLink?(e=r.converter._dispatch("simplifiedAutoLinks.before",e,t,r),e=(e=t.excludeTrailingPunctuationFromURLs?e.replace(f,_(t)):e.replace(h,_(t))).replace(g,b(t,r)),e=r.converter._dispatch("simplifiedAutoLinks.after",e,t,r)):e}),i.subParser("blockGamut",function(e,t,r){return e=r.converter._dispatch("blockGamut.before",e,t,r),e=i.subParser("blockQuotes")(e,t,r),e=i.subParser("headers")(e,t,r),e=i.subParser("horizontalRule")(e,t,r),e=i.subParser("lists")(e,t,r),e=i.subParser("codeBlocks")(e,t,r),e=i.subParser("tables")(e,t,r),e=i.subParser("hashHTMLBlocks")(e,t,r),e=i.subParser("paragraphs")(e,t,r),r.converter._dispatch("blockGamut.after",e,t,r)}),i.subParser("blockQuotes",function(e,t,r){e=r.converter._dispatch("blockQuotes.before",e,t,r),e+="\n\n";var n=/(^ {0,3}>[ \t]?.+\n(.+\n)*\n*)+/gm;return t.splitAdjacentBlockquotes&&(n=/^ {0,3}>[\s\S]*?(?:\n\n)/gm),e=e.replace(n,function(e){return e=(e=(e=e.replace(/^[ \t]*>[ \t]?/gm,"")).replace(/¨0/g,"")).replace(/^[ \t]+$/gm,""),e=i.subParser("githubCodeBlocks")(e,t,r),e=(e=(e=i.subParser("blockGamut")(e,t,r)).replace(/(^|\n)/g,"$1 ")).replace(/(\s*<pre>[^\r]+?<\/pre>)/gm,function(e,t){var r=t;return(r=r.replace(/^ /gm,"¨0")).replace(/¨0/g,"")}),i.subParser("hashBlock")("<blockquote>\n"+e+"\n</blockquote>",t,r)}),r.converter._dispatch("blockQuotes.after",e,t,r)}),i.subParser("codeBlocks",function(e,t,r){return e=r.converter._dispatch("codeBlocks.before",e,t,r),e=(e=(e+="¨0").replace(/(?:\n\n|^)((?:(?:[ ]{4}|\t).*\n+)+)(\n*[ ]{0,3}[^ \t\n]|(?=¨0))/g,function(e,n,a){var o=n,s=a,l="\n";return o=i.subParser("outdent")(o,t,r),o=i.subParser("encodeCode")(o,t,r),o=(o=(o=i.subParser("detab")(o,t,r)).replace(/^\n+/g,"")).replace(/\n+$/g,""),t.omitExtraWLInCodeBlocks&&(l=""),o="<pre><code>"+o+l+"</code></pre>",i.subParser("hashBlock")(o,t,r)+s})).replace(/¨0/,""),r.converter._dispatch("codeBlocks.after",e,t,r)}),i.subParser("codeSpans",function(e,t,r){return void 0===(e=r.converter._dispatch("codeSpans.before",e,t,r))&&(e=""),e=e.replace(/(^|[^\\])(`+)([^\r]*?[^`])\2(?!`)/gm,function(e,n,a,o){var s=o;return s=(s=s.replace(/^([ \t]*)/g,"")).replace(/[ \t]*$/g,""),s=n+"<code>"+(s=i.subParser("encodeCode")(s,t,r))+"</code>",i.subParser("hashHTMLSpans")(s,t,r)}),r.converter._dispatch("codeSpans.after",e,t,r)}),i.subParser("completeHTMLDocument",function(e,t,r){if(!t.completeHTMLDocument)return e;e=r.converter._dispatch("completeHTMLDocument.before",e,t,r);var n="html",a="<!DOCTYPE HTML>\n",i="",o='<meta charset="utf-8">\n',s="",l="";for(var c in void 0!==r.metadata.parsed.doctype&&(a="<!DOCTYPE "+r.metadata.parsed.doctype+">\n","html"!==(n=r.metadata.parsed.doctype.toString().toLowerCase())&&"html5"!==n||(o='<meta charset="utf-8">')),r.metadata.parsed)if(r.metadata.parsed.hasOwnProperty(c))switch(c.toLowerCase()){case"doctype":break;case"title":i="<title>"+r.metadata.parsed.title+"\n";break;case"charset":o="html"===n||"html5"===n?'\n':'\n';break;case"language":case"lang":s=' lang="'+r.metadata.parsed[c]+'"',l+='\n';break;default:l+='\n'}return e=a+"\n\n"+i+o+l+"\n\n"+e.trim()+"\n\n",r.converter._dispatch("completeHTMLDocument.after",e,t,r)}),i.subParser("detab",function(e,t,r){return e=(e=(e=(e=(e=(e=r.converter._dispatch("detab.before",e,t,r)).replace(/\t(?=\t)/g," ")).replace(/\t/g,"¨A¨B")).replace(/¨B(.+?)¨A/g,function(e,t){for(var r=t,n=4-r.length%4,a=0;a/g,">"),r.converter._dispatch("encodeAmpsAndAngles.after",e,t,r)}),i.subParser("encodeBackslashEscapes",function(e,t,r){return e=(e=(e=r.converter._dispatch("encodeBackslashEscapes.before",e,t,r)).replace(/\\(\\)/g,i.helper.escapeCharactersCallback)).replace(/\\([`*_{}\[\]()>#+.!~=|-])/g,i.helper.escapeCharactersCallback),r.converter._dispatch("encodeBackslashEscapes.after",e,t,r)}),i.subParser("encodeCode",function(e,t,r){return e=(e=r.converter._dispatch("encodeCode.before",e,t,r)).replace(/&/g,"&").replace(//g,">").replace(/([*_{}\[\]\\=~-])/g,i.helper.escapeCharactersCallback),r.converter._dispatch("encodeCode.after",e,t,r)}),i.subParser("escapeSpecialCharsWithinTagAttributes",function(e,t,r){return e=(e=(e=r.converter._dispatch("escapeSpecialCharsWithinTagAttributes.before",e,t,r)).replace(/<\/?[a-z\d_:-]+(?:[\s]+[\s\S]+?)?>/gi,function(e){return e.replace(/(.)<\/?code>(?=.)/g,"$1`").replace(/([\\`*_~=|])/g,i.helper.escapeCharactersCallback)})).replace(/-]|-[^>])(?:[^-]|-[^-])*)--)>/gi,function(e){return e.replace(/([\\`*_~=|])/g,i.helper.escapeCharactersCallback)}),r.converter._dispatch("escapeSpecialCharsWithinTagAttributes.after",e,t,r)}),i.subParser("githubCodeBlocks",function(e,t,r){return t.ghCodeBlocks?(e=r.converter._dispatch("githubCodeBlocks.before",e,t,r),e=(e=(e+="¨0").replace(/(?:^|\n)(?: {0,3})(```+|~~~+)(?: *)([^\s`~]*)\n([\s\S]*?)\n(?: {0,3})\1/g,function(e,n,a,o){var s=t.omitExtraWLInCodeBlocks?"":"\n";return o=i.subParser("encodeCode")(o,t,r),o=(o=(o=i.subParser("detab")(o,t,r)).replace(/^\n+/g,"")).replace(/\n+$/g,""),o="
"+o+s+"
",o=i.subParser("hashBlock")(o,t,r),"\n\n¨G"+(r.ghCodeBlocks.push({text:e,codeblock:o})-1)+"G\n\n"})).replace(/¨0/,""),r.converter._dispatch("githubCodeBlocks.after",e,t,r)):e}),i.subParser("hashBlock",function(e,t,r){return e=(e=r.converter._dispatch("hashBlock.before",e,t,r)).replace(/(^\n+|\n+$)/g,""),e="\n\n¨K"+(r.gHtmlBlocks.push(e)-1)+"K\n\n",r.converter._dispatch("hashBlock.after",e,t,r)}),i.subParser("hashCodeTags",function(e,t,r){return e=r.converter._dispatch("hashCodeTags.before",e,t,r),e=i.helper.replaceRecursiveRegExp(e,function(e,n,a,o){var s=a+i.subParser("encodeCode")(n,t,r)+o;return"¨C"+(r.gHtmlSpans.push(s)-1)+"C"},"]*>","","gim"),r.converter._dispatch("hashCodeTags.after",e,t,r)}),i.subParser("hashElement",function(e,t,r){return function(e,t){var n=t;return n=(n=(n=n.replace(/\n\n/g,"\n")).replace(/^\n/,"")).replace(/\n+$/g,""),"\n\n¨K"+(r.gHtmlBlocks.push(n)-1)+"K\n\n"}}),i.subParser("hashHTMLBlocks",function(e,t,r){e=r.converter._dispatch("hashHTMLBlocks.before",e,t,r);var n=["pre","div","h1","h2","h3","h4","h5","h6","blockquote","table","dl","ol","ul","script","noscript","form","fieldset","iframe","math","style","section","header","footer","nav","article","aside","address","audio","canvas","figure","hgroup","output","video","p"],a=function(e,t,n,a){var i=e;return-1!==n.search(/\bmarkdown\b/)&&(i=n+r.converter.makeHtml(t)+a),"\n\n¨K"+(r.gHtmlBlocks.push(i)-1)+"K\n\n"};t.backslashEscapesHTMLTags&&(e=e.replace(/\\<(\/?[^>]+?)>/g,function(e,t){return"<"+t+">"}));for(var o=0;o]*>)","im"),c="<"+n[o]+"\\b[^>]*>",u="";-1!==(s=i.helper.regexIndexOf(e,l));){var d=i.helper.splitAtIndex(e,s),h=i.helper.replaceRecursiveRegExp(d[1],a,c,u,"im");if(h===d[1])break;e=d[0].concat(h)}return e=e.replace(/(\n {0,3}(<(hr)\b([^<>])*?\/?>)[ \t]*(?=\n{2,}))/g,i.subParser("hashElement")(e,t,r)),e=(e=i.helper.replaceRecursiveRegExp(e,function(e){return"\n\n¨K"+(r.gHtmlBlocks.push(e)-1)+"K\n\n"},"^ {0,3}\x3c!--","--\x3e","gm")).replace(/(?:\n\n)( {0,3}(?:<([?%])[^\r]*?\2>)[ \t]*(?=\n{2,}))/g,i.subParser("hashElement")(e,t,r)),r.converter._dispatch("hashHTMLBlocks.after",e,t,r)}),i.subParser("hashHTMLSpans",function(e,t,r){function n(e){return"¨C"+(r.gHtmlSpans.push(e)-1)+"C"}return e=(e=(e=(e=(e=r.converter._dispatch("hashHTMLSpans.before",e,t,r)).replace(/<[^>]+?\/>/gi,function(e){return n(e)})).replace(/<([^>]+?)>[\s\S]*?<\/\1>/g,function(e){return n(e)})).replace(/<([^>]+?)\s[^>]+?>[\s\S]*?<\/\1>/g,function(e){return n(e)})).replace(/<[^>]+?>/gi,function(e){return n(e)}),r.converter._dispatch("hashHTMLSpans.after",e,t,r)}),i.subParser("unhashHTMLSpans",function(e,t,r){e=r.converter._dispatch("unhashHTMLSpans.before",e,t,r);for(var n=0;n]*>\\s*]*>","^ {0,3}\\s*","gim"),r.converter._dispatch("hashPreCodeTags.after",e,t,r)}),i.subParser("headers",function(e,t,r){function n(e){var n,a;if(t.customizedHeaderId){var o=e.match(/\{([^{]+?)}\s*$/);o&&o[1]&&(e=o[1])}return n=e,a=i.helper.isString(t.prefixHeaderId)?t.prefixHeaderId:!0===t.prefixHeaderId?"section-":"",t.rawPrefixHeaderId||(n=a+n),n=t.ghCompatibleHeaderId?n.replace(/ /g,"-").replace(/&/g,"").replace(/¨T/g,"").replace(/¨D/g,"").replace(/[&+$,\/:;=?@"#{}|^¨~\[\]`\\*)(%.!'<>]/g,"").toLowerCase():t.rawHeaderId?n.replace(/ /g,"-").replace(/&/g,"&").replace(/¨T/g,"¨").replace(/¨D/g,"$").replace(/["']/g,"-").toLowerCase():n.replace(/[^\w]/g,"").toLowerCase(),t.rawPrefixHeaderId&&(n=a+n),r.hashLinkCounts[n]?n=n+"-"+r.hashLinkCounts[n]++:r.hashLinkCounts[n]=1,n}e=r.converter._dispatch("headers.before",e,t,r);var a=isNaN(parseInt(t.headerLevelStart))?1:parseInt(t.headerLevelStart),o=t.smoothLivePreview?/^(.+)[ \t]*\n={2,}[ \t]*\n+/gm:/^(.+)[ \t]*\n=+[ \t]*\n+/gm,s=t.smoothLivePreview?/^(.+)[ \t]*\n-{2,}[ \t]*\n+/gm:/^(.+)[ \t]*\n-+[ \t]*\n+/gm;e=(e=e.replace(o,function(e,o){var s=i.subParser("spanGamut")(o,t,r),l=t.noHeaderId?"":' id="'+n(o)+'"',c=""+s+"";return i.subParser("hashBlock")(c,t,r)})).replace(s,function(e,o){var s=i.subParser("spanGamut")(o,t,r),l=t.noHeaderId?"":' id="'+n(o)+'"',c=a+1,u=""+s+"";return i.subParser("hashBlock")(u,t,r)});var l=t.requireSpaceBeforeHeadingText?/^(#{1,6})[ \t]+(.+?)[ \t]*#*\n+/gm:/^(#{1,6})[ \t]*(.+?)[ \t]*#*\n+/gm;return e=e.replace(l,function(e,o,s){var l=s;t.customizedHeaderId&&(l=s.replace(/\s?\{([^{]+?)}\s*$/,""));var c=i.subParser("spanGamut")(l,t,r),u=t.noHeaderId?"":' id="'+n(s)+'"',d=a-1+o.length,h=""+c+"";return i.subParser("hashBlock")(h,t,r)}),r.converter._dispatch("headers.after",e,t,r)}),i.subParser("horizontalRule",function(e,t,r){e=r.converter._dispatch("horizontalRule.before",e,t,r);var n=i.subParser("hashBlock")("
",t,r);return e=(e=(e=e.replace(/^ {0,2}( ?-){3,}[ \t]*$/gm,n)).replace(/^ {0,2}( ?\*){3,}[ \t]*$/gm,n)).replace(/^ {0,2}( ?_){3,}[ \t]*$/gm,n),r.converter._dispatch("horizontalRule.after",e,t,r)}),i.subParser("images",function(e,t,r){function n(e,t,n,a,o,s,l,c){var u=r.gUrls,d=r.gTitles,h=r.gDimensions;if(n=n.toLowerCase(),c||(c=""),e.search(/\(? ?(['"].*['"])?\)$/m)>-1)a="";else if(""===a||null===a){if(""!==n&&null!==n||(n=t.toLowerCase().replace(/ ?\n/g," ")),a="#"+n,i.helper.isUndefined(u[n]))return e;a=u[n],i.helper.isUndefined(d[n])||(c=d[n]),i.helper.isUndefined(h[n])||(o=h[n].width,s=h[n].height)}t=t.replace(/"/g,""").replace(i.helper.regexes.asteriskDashAndColon,i.helper.escapeCharactersCallback);var f=''+t+'"}return e=(e=(e=(e=(e=(e=r.converter._dispatch("images.before",e,t,r)).replace(/!\[([^\]]*?)] ?(?:\n *)?\[([\s\S]*?)]()()()()()/g,n)).replace(/!\[([^\]]*?)][ \t]*()\([ \t]??(?: =([*\d]+[A-Za-z%]{0,4})x([*\d]+[A-Za-z%]{0,4}))?[ \t]*(?:(["'])([^"]*?)\6)?[ \t]?\)/g,function(e,t,r,a,i,o,s,l){return n(e,t,r,a=a.replace(/\s/g,""),i,o,0,l)})).replace(/!\[([^\]]*?)][ \t]*()\([ \t]?<([^>]*)>(?: =([*\d]+[A-Za-z%]{0,4})x([*\d]+[A-Za-z%]{0,4}))?[ \t]*(?:(?:(["'])([^"]*?)\6))?[ \t]?\)/g,n)).replace(/!\[([^\]]*?)][ \t]*()\([ \t]??(?: =([*\d]+[A-Za-z%]{0,4})x([*\d]+[A-Za-z%]{0,4}))?[ \t]*(?:(["'])([^"]*?)\6)?[ \t]?\)/g,n)).replace(/!\[([^\[\]]+)]()()()()()/g,n),r.converter._dispatch("images.after",e,t,r)}),i.subParser("italicsAndBold",function(e,t,r){function n(e,t,r){return t+e+r}return e=r.converter._dispatch("italicsAndBold.before",e,t,r),e=t.literalMidWordUnderscores?(e=(e=e.replace(/\b___(\S[\s\S]*?)___\b/g,function(e,t){return n(t,"","")})).replace(/\b__(\S[\s\S]*?)__\b/g,function(e,t){return n(t,"","")})).replace(/\b_(\S[\s\S]*?)_\b/g,function(e,t){return n(t,"","")}):(e=(e=e.replace(/___(\S[\s\S]*?)___/g,function(e,t){return/\S$/.test(t)?n(t,"",""):e})).replace(/__(\S[\s\S]*?)__/g,function(e,t){return/\S$/.test(t)?n(t,"",""):e})).replace(/_([^\s_][\s\S]*?)_/g,function(e,t){return/\S$/.test(t)?n(t,"",""):e}),e=t.literalMidWordAsterisks?(e=(e=e.replace(/([^*]|^)\B\*\*\*(\S[\s\S]*?)\*\*\*\B(?!\*)/g,function(e,t,r){return n(r,t+"","")})).replace(/([^*]|^)\B\*\*(\S[\s\S]*?)\*\*\B(?!\*)/g,function(e,t,r){return n(r,t+"","")})).replace(/([^*]|^)\B\*(\S[\s\S]*?)\*\B(?!\*)/g,function(e,t,r){return n(r,t+"","")}):(e=(e=e.replace(/\*\*\*(\S[\s\S]*?)\*\*\*/g,function(e,t){return/\S$/.test(t)?n(t,"",""):e})).replace(/\*\*(\S[\s\S]*?)\*\*/g,function(e,t){return/\S$/.test(t)?n(t,"",""):e})).replace(/\*([^\s*][\s\S]*?)\*/g,function(e,t){return/\S$/.test(t)?n(t,"",""):e}),r.converter._dispatch("italicsAndBold.after",e,t,r)}),i.subParser("lists",function(e,t,r){function n(e,n){r.gListLevel++,e=e.replace(/\n{2,}$/,"\n");var a=/(\n)?(^ {0,3})([*+-]|\d+[.])[ \t]+((\[(x|X| )?])?[ \t]*[^\r]+?(\n{1,2}))(?=\n*(¨0| {0,3}([*+-]|\d+[.])[ \t]+))/gm,o=/\n[ \t]*\n(?!¨0)/.test(e+="¨0");return t.disableForced4SpacesIndentedSublists&&(a=/(\n)?(^ {0,3})([*+-]|\d+[.])[ \t]+((\[(x|X| )?])?[ \t]*[^\r]+?(\n{1,2}))(?=\n*(¨0|\2([*+-]|\d+[.])[ \t]+))/gm),e=(e=e.replace(a,function(e,n,a,s,l,c,u){u=u&&""!==u.trim();var d=i.subParser("outdent")(l,t,r),h="";return c&&t.tasklists&&(h=' class="task-list-item" style="list-style-type: none;"',d=d.replace(/^[ \t]*\[(x|X| )?]/m,function(){var e='"})),d=d.replace(/^([-*+]|\d\.)[ \t]+[\S\n ]*/g,function(e){return"¨A"+e}),n||d.search(/\n{2,}/)>-1?(d=i.subParser("githubCodeBlocks")(d,t,r),d=i.subParser("blockGamut")(d,t,r)):(d=(d=i.subParser("lists")(d,t,r)).replace(/\n$/,""),d=(d=i.subParser("hashHTMLBlocks")(d,t,r)).replace(/\n\n+/g,"\n\n"),d=o?i.subParser("paragraphs")(d,t,r):i.subParser("spanGamut")(d,t,r)),""+(d=d.replace("¨A",""))+"\n"})).replace(/¨0/g,""),r.gListLevel--,n&&(e=e.replace(/\s+$/,"")),e}function a(e,t){if("ol"===t){var r=e.match(/^ *(\d+)\./);if(r&&"1"!==r[1])return' start="'+r[1]+'"'}return""}function o(e,r,i){var o=t.disableForced4SpacesIndentedSublists?/^ ?\d+\.[ \t]/gm:/^ {0,3}\d+\.[ \t]/gm,s=t.disableForced4SpacesIndentedSublists?/^ ?[*+-][ \t]/gm:/^ {0,3}[*+-][ \t]/gm,l="ul"===r?o:s,c="";if(-1!==e.search(l))!function t(u){var d=u.search(l),h=a(e,r);-1!==d?(c+="\n\n<"+r+h+">\n"+n(u.slice(0,d),!!i)+"\n",l="ul"==(r="ul"===r?"ol":"ul")?o:s,t(u.slice(d))):c+="\n\n<"+r+h+">\n"+n(u,!!i)+"\n"}(e);else{var u=a(e,r);c="\n\n<"+r+u+">\n"+n(e,!!i)+"\n"}return c}return e=r.converter._dispatch("lists.before",e,t,r),e+="¨0",e=(e=r.gListLevel?e.replace(/^(( {0,3}([*+-]|\d+[.])[ \t]+)[^\r]+?(¨0|\n{2,}(?=\S)(?![ \t]*(?:[*+-]|\d+[.])[ \t]+)))/gm,function(e,t,r){return o(t,r.search(/[*+-]/g)>-1?"ul":"ol",!0)}):e.replace(/(\n\n|^\n?)(( {0,3}([*+-]|\d+[.])[ \t]+)[^\r]+?(¨0|\n{2,}(?=\S)(?![ \t]*(?:[*+-]|\d+[.])[ \t]+)))/gm,function(e,t,r,n){return o(r,n.search(/[*+-]/g)>-1?"ul":"ol",!1)})).replace(/¨0/,""),r.converter._dispatch("lists.after",e,t,r)}),i.subParser("metadata",function(e,t,r){function n(e){r.metadata.raw=e,(e=(e=e.replace(/&/g,"&").replace(/"/g,""")).replace(/\n {4}/g," ")).replace(/^([\S ]+): +([\s\S]+?)$/gm,function(e,t,n){return r.metadata.parsed[t]=n,""})}return t.metadata?(e=(e=(e=(e=r.converter._dispatch("metadata.before",e,t,r)).replace(/^\s*«««+(\S*?)\n([\s\S]+?)\n»»»+\n/,function(e,t,r){return n(r),"¨M"})).replace(/^\s*---+(\S*?)\n([\s\S]+?)\n---+\n/,function(e,t,a){return t&&(r.metadata.format=t),n(a),"¨M"})).replace(/¨M/g,""),e=r.converter._dispatch("metadata.after",e,t,r)):e}),i.subParser("outdent",function(e,t,r){return e=(e=(e=r.converter._dispatch("outdent.before",e,t,r)).replace(/^(\t|[ ]{1,4})/gm,"¨0")).replace(/¨0/g,""),r.converter._dispatch("outdent.after",e,t,r)}),i.subParser("paragraphs",function(e,t,r){for(var n=(e=(e=(e=r.converter._dispatch("paragraphs.before",e,t,r)).replace(/^\n+/g,"")).replace(/\n+$/g,"")).split(/\n{2,}/g),a=[],o=n.length,s=0;s=0?a.push(l):l.search(/\S/)>=0&&(l=(l=i.subParser("spanGamut")(l,t,r)).replace(/^([ \t]*)/g,"

"),l+="

",a.push(l))}for(o=a.length,s=0;s]*>\s*]*>/.test(u)&&(d=!0)}a[s]=u}return e=(e=(e=a.join("\n")).replace(/^\n+/g,"")).replace(/\n+$/g,""),r.converter._dispatch("paragraphs.after",e,t,r)}),i.subParser("runExtension",function(e,t,r,n){if(e.filter)t=e.filter(t,n.converter,r);else if(e.regex){var a=e.regex;a instanceof RegExp||(a=new RegExp(a,"g")),t=t.replace(a,e.replace)}return t}),i.subParser("spanGamut",function(e,t,r){return e=r.converter._dispatch("spanGamut.before",e,t,r),e=i.subParser("codeSpans")(e,t,r),e=i.subParser("escapeSpecialCharsWithinTagAttributes")(e,t,r),e=i.subParser("encodeBackslashEscapes")(e,t,r),e=i.subParser("images")(e,t,r),e=i.subParser("anchors")(e,t,r),e=i.subParser("autoLinks")(e,t,r),e=i.subParser("simplifiedAutoLinks")(e,t,r),e=i.subParser("emoji")(e,t,r),e=i.subParser("underline")(e,t,r),e=i.subParser("italicsAndBold")(e,t,r),e=i.subParser("strikethrough")(e,t,r),e=i.subParser("ellipsis")(e,t,r),e=i.subParser("hashHTMLSpans")(e,t,r),e=i.subParser("encodeAmpsAndAngles")(e,t,r),t.simpleLineBreaks?/\n\n¨K/.test(e)||(e=e.replace(/\n+/g,"
\n")):e=e.replace(/ +\n/g,"
\n"),r.converter._dispatch("spanGamut.after",e,t,r)}),i.subParser("strikethrough",function(e,t,r){return t.strikethrough&&(e=(e=r.converter._dispatch("strikethrough.before",e,t,r)).replace(/(?:~){2}([\s\S]+?)(?:~){2}/g,function(e,n){return function(e){return t.simplifiedAutoLink&&(e=i.subParser("simplifiedAutoLinks")(e,t,r)),""+e+""}(n)}),e=r.converter._dispatch("strikethrough.after",e,t,r)),e}),i.subParser("stripLinkDefinitions",function(e,t,r){var n=function(e,n,a,o,s,l,c){return n=n.toLowerCase(),a.match(/^data:.+?\/.+?;base64,/)?r.gUrls[n]=a.replace(/\s/g,""):r.gUrls[n]=i.subParser("encodeAmpsAndAngles")(a,t,r),l?l+c:(c&&(r.gTitles[n]=c.replace(/"|'/g,""")),t.parseImgDimensions&&o&&s&&(r.gDimensions[n]={width:o,height:s}),"")};return(e=(e=(e+="¨0").replace(/^ {0,3}\[(.+)]:[ \t]*\n?[ \t]*?(?: =([*\d]+[A-Za-z%]{0,4})x([*\d]+[A-Za-z%]{0,4}))?[ \t]*\n?[ \t]*(?:(\n*)["|'(](.+?)["|')][ \t]*)?(?:\n\n|(?=¨0)|(?=\n\[))/gm,n)).replace(/^ {0,3}\[(.+)]:[ \t]*\n?[ \t]*\s]+)>?(?: =([*\d]+[A-Za-z%]{0,4})x([*\d]+[A-Za-z%]{0,4}))?[ \t]*\n?[ \t]*(?:(\n*)["|'(](.+?)["|')][ \t]*)?(?:\n+|(?=¨0))/gm,n)).replace(/¨0/,"")}),i.subParser("tables",function(e,t,r){function n(e){return/^:[ \t]*--*$/.test(e)?' style="text-align:left;"':/^--*[ \t]*:[ \t]*$/.test(e)?' style="text-align:right;"':/^:[ \t]*--*[ \t]*:$/.test(e)?' style="text-align:center;"':""}function a(e,n){var a="";return e=e.trim(),(t.tablesHeaderId||t.tableHeaderId)&&(a=' id="'+e.replace(/ /g,"_").toLowerCase()+'"'),""+(e=i.subParser("spanGamut")(e,t,r))+"\n"}function o(e,n){return""+i.subParser("spanGamut")(e,t,r)+"\n"}function s(e){var s,l=e.split("\n");for(s=0;s\n\n\n",a=0;a\n";for(var i=0;i\n"}return r+"\n\n"}(h,p)}return t.tables?(e=(e=(e=(e=r.converter._dispatch("tables.before",e,t,r)).replace(/\\(\|)/g,i.helper.escapeCharactersCallback)).replace(/^ {0,3}\|?.+\|.+\n {0,3}\|?[ \t]*:?[ \t]*(?:[-=]){2,}[ \t]*:?[ \t]*\|[ \t]*:?[ \t]*(?:[-=]){2,}[\s\S]+?(?:\n\n|¨0)/gm,s)).replace(/^ {0,3}\|.+\|[ \t]*\n {0,3}\|[ \t]*:?[ \t]*(?:[-=]){2,}[ \t]*:?[ \t]*\|[ \t]*\n( {0,3}\|.+\|[ \t]*\n)*(?:\n|¨0)/gm,s),r.converter._dispatch("tables.after",e,t,r)):e}),i.subParser("underline",function(e,t,r){return t.underline?(e=r.converter._dispatch("underline.before",e,t,r),e=(e=t.literalMidWordUnderscores?(e=e.replace(/\b___(\S[\s\S]*?)___\b/g,function(e,t){return""+t+""})).replace(/\b__(\S[\s\S]*?)__\b/g,function(e,t){return""+t+""}):(e=e.replace(/___(\S[\s\S]*?)___/g,function(e,t){return/\S$/.test(t)?""+t+"":e})).replace(/__(\S[\s\S]*?)__/g,function(e,t){return/\S$/.test(t)?""+t+"":e})).replace(/(_)/g,i.helper.escapeCharactersCallback),e=r.converter._dispatch("underline.after",e,t,r)):e}),i.subParser("unescapeSpecialChars",function(e,t,r){return e=(e=r.converter._dispatch("unescapeSpecialChars.before",e,t,r)).replace(/¨E(\d+)E/g,function(e,t){var r=parseInt(t);return String.fromCharCode(r)}),r.converter._dispatch("unescapeSpecialChars.after",e,t,r)}),i.subParser("makeMarkdown.blockquote",function(e,t){var r="";if(e.hasChildNodes())for(var n=e.childNodes,a=n.length,o=0;o "+(r=r.trim()).split("\n").join("\n> ")}),i.subParser("makeMarkdown.codeBlock",function(e,t){var r=e.getAttribute("language"),n=e.getAttribute("precodenum");return"```"+r+"\n"+t.preList[n]+"\n```"}),i.subParser("makeMarkdown.codeSpan",function(e){return"`"+e.innerHTML+"`"}),i.subParser("makeMarkdown.emphasis",function(e,t){var r="";if(e.hasChildNodes()){r+="*";for(var n=e.childNodes,a=n.length,o=0;o",e.hasAttribute("width")&&e.hasAttribute("height")&&(t+=" ="+e.getAttribute("width")+"x"+e.getAttribute("height")),e.hasAttribute("title")&&(t+=' "'+e.getAttribute("title")+'"'),t+=")"),t}),i.subParser("makeMarkdown.links",function(e,t){var r="";if(e.hasChildNodes()&&e.hasAttribute("href")){var n=e.childNodes,a=n.length;r="[";for(var o=0;o",e.hasAttribute("title")&&(r+=' "'+e.getAttribute("title")+'"'),r+=")"}return r}),i.subParser("makeMarkdown.list",function(e,t,r){var n="";if(!e.hasChildNodes())return"";for(var a=e.childNodes,o=a.length,s=e.getAttribute("start")||1,l=0;l"+t.preList[r]+""}),i.subParser("makeMarkdown.strikethrough",function(e,t){var r="";if(e.hasChildNodes()){r+="~~";for(var n=e.childNodes,a=n.length,o=0;otr>th"),l=e.querySelectorAll("tbody>tr");for(r=0;rp&&(p=g)}for(r=0;r/g,"\\$1>")).replace(/^#/gm,"\\#")).replace(/^(\s*)([-=]{3,})(\s*)$/,"$1\\$2$3")).replace(/^( {0,3}\d+)\./gm,"$1\\.")).replace(/^( {0,3})([+-])/gm,"$1\\$2")).replace(/]([\s]*)\(/g,"\\]$1\\(")).replace(/^ {0,3}\[([\S \t]*?)]:/gm,"\\[$1]:")}),e.exports?e.exports=i:this.showdown=i}).call(t)}),he={pangu:a,minimatch:D,beautify:te,style:le,rdability:ue,markdown:Object.freeze({default:de,__moduleExports:de})};e.Plugin=function(e){return void 0==e?he:he[e]},Object.defineProperty(e,"__esModule",{value:!0})}); +!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t(e.puplugin={})}(this,function(e){"use strict";var t="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function r(e,t){return e(t={exports:{}},t.exports),t.exports}var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},a=r(function(e,t){e.exports=function(e){function t(n){if(r[n])return r[n].exports;var a=r[n]={exports:{},id:n,loaded:!1};return e[n].call(a.exports,a,a.exports,t),a.loaded=!0,a.exports}var r={};return t.m=e,t.c=r,t.p="",t(0)}([function(e,t,r){var a=function(){function e(e,t){for(var r=0;r=0||t.isContentEditable||"true"===t.getAttribute("g_editable"))return!0;t=t.parentNode}return!1}},{key:"isFirstTextChild",value:function(e,t){for(var r=e.childNodes,n=0;n-1;n--){var a=r[n];if(8!==a.nodeType&&a.textContent)return a===t}return!1}},{key:"spacingNodeByXPath",value:function(e,t){for(var r=document.evaluate(e,t,null,XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,null),n=void 0,a=void 0,i=r.snapshotLength-1;i>-1;--i)if(n=r.snapshotItem(i),this.canIgnoreNode(n))a=n;else{var o=this.spacing(n.data);if(n.data!==o&&(n.data=o),a){if(n.nextSibling&&n.nextSibling.nodeName.search(this.spaceLikeTags)>=0){a=n;continue}var s=n.data.toString().substr(-1)+a.data.toString().substr(0,1),l=this.spacing(s);if(l!==s){for(var c=a;c.parentNode&&-1===c.nodeName.search(this.spaceSensitiveTags)&&this.isFirstTextChild(c.parentNode,c);)c=c.parentNode;for(var u=n;u.parentNode&&-1===u.nodeName.search(this.spaceSensitiveTags)&&this.isLastTextChild(u.parentNode,u);)u=u.parentNode;if(u.nextSibling&&u.nextSibling.nodeName.search(this.spaceLikeTags)>=0){a=n;continue}if(-1===u.nodeName.search(this.blockTags))if(-1===c.nodeName.search(this.spaceSensitiveTags))-1===c.nodeName.search(this.ignoreTags)&&-1===c.nodeName.search(this.blockTags)&&(a.previousSibling?-1===a.previousSibling.nodeName.search(this.spaceLikeTags)&&(a.data=" "+a.data):this.canIgnoreNode(a)||(a.data=" "+a.data));else if(-1===u.nodeName.search(this.spaceSensitiveTags))n.data=n.data+" ";else{var d=document.createElement("pangu");d.innerHTML=" ",c.previousSibling?-1===c.previousSibling.nodeName.search(this.spaceLikeTags)&&c.parentNode.insertBefore(d,c):c.parentNode.insertBefore(d,c),d.previousElementSibling||d.parentNode&&d.parentNode.removeChild(d)}}}a=n}}},{key:"spacingNode",value:function(e){this.spacingNodeByXPath(".//*/text()[normalize-space(.)]",e)}},{key:"spacingElementById",value:function(e){var t='id("'+e+'")//text()';this.spacingNodeByXPath(t,document)}},{key:"spacingElementByClassName",value:function(e){var t='//*[contains(concat(" ", normalize-space(@class), " "), "'+e+'")]//text()';this.spacingNodeByXPath(t,document)}},{key:"spacingElementByTagName",value:function(e){var t="//"+e+"//text()";this.spacingNodeByXPath(t,document)}},{key:"spacingPageTitle",value:function(){this.spacingNodeByXPath("/html/head/title/text()",document)}},{key:"spacingPageBody",value:function(){for(var e="/html/body//*/text()[normalize-space(.)]",t=["script","style","textarea"],r=0;r])([A-Za-z0-9])/g,d=/([A-Za-z0-9])([\+\-\*\/=&\\|<>])([\u2e80-\u2eff\u2f00-\u2fdf\u3040-\u309f\u30a0-\u30ff\u3100-\u312f\u3200-\u32ff\u3400-\u4dbf\u4e00-\u9fff\uf900-\ufaff])/g,h=/([\u2e80-\u2eff\u2f00-\u2fdf\u3040-\u309f\u30a0-\u30ff\u3100-\u312f\u3200-\u32ff\u3400-\u4dbf\u4e00-\u9fff\uf900-\ufaff])([\(\[\{<\u201c]+(.*?)[\)\]\}>\u201d]+)([\u2e80-\u2eff\u2f00-\u2fdf\u3040-\u309f\u30a0-\u30ff\u3100-\u312f\u3200-\u32ff\u3400-\u4dbf\u4e00-\u9fff\uf900-\ufaff])/g,f=/([\u2e80-\u2eff\u2f00-\u2fdf\u3040-\u309f\u30a0-\u30ff\u3100-\u312f\u3200-\u32ff\u3400-\u4dbf\u4e00-\u9fff\uf900-\ufaff])([\(\[\{<\u201c>])/g,p=/([\)\]\}>\u201d<])([\u2e80-\u2eff\u2f00-\u2fdf\u3040-\u309f\u30a0-\u30ff\u3100-\u312f\u3200-\u32ff\u3400-\u4dbf\u4e00-\u9fff\uf900-\ufaff])/g,g=/([\(\[\{<\u201c]+)(\s*)(.+?)(\s*)([\)\]\}>\u201d]+)/,m=/([\u2e80-\u2eff\u2f00-\u2fdf\u3040-\u309f\u30a0-\u30ff\u3100-\u312f\u3200-\u32ff\u3400-\u4dbf\u4e00-\u9fff\uf900-\ufaff])([~!;:,\.\?\u2026])([A-Za-z0-9])/g,_=/([\u2e80-\u2eff\u2f00-\u2fdf\u3040-\u309f\u30a0-\u30ff\u3100-\u312f\u3200-\u32ff\u3400-\u4dbf\u4e00-\u9fff\uf900-\ufaff])([A-Za-z0-9`\$%\^&\*\-=\+\\\|\/@\u00a1-\u00ff\u2022\u2027\u2150-\u218f])/g,b=/([A-Za-z0-9`~\$%\^&\*\-=\+\\\|\/!;:,\.\?\u00a1-\u00ff\u2022\u2026\u2027\u2150-\u218f])([\u2e80-\u2eff\u2f00-\u2fdf\u3040-\u309f\u30a0-\u30ff\u3100-\u312f\u3200-\u32ff\u3400-\u4dbf\u4e00-\u9fff\uf900-\ufaff])/g,w=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}return r(e,[{key:"spacing",value:function(e){var t=e,r=t=(t=(t=(t=(t=(t=(t=(t=(t=t.replace(n,"$1 $2")).replace(a,"$1 $2")).replace(i,"$1$3$5")).replace(o,"$1$3$4")).replace(s,"$1 $2$3$4 $5")).replace(l,"$1 $2")).replace(c,"$1 $3")).replace(u,"$1 $2 $3")).replace(d,"$1 $2 $3"),w=t.replace(h,"$1 $2 $4");return t=w,r===w&&(t=(t=t.replace(f,"$1 $2")).replace(p,"$1 $2")),t=(t=(t=(t=t.replace(g,"$1$3$5")).replace(m,"$1$2 $3")).replace(_,"$1 $2")).replace(b,"$1 $2")}},{key:"spacingText",value:function(e){var t=arguments.length<=1||void 0===arguments[1]?function(){}:arguments[1];try{var r=this.spacing(e);t(null,r)}catch(e){t(e)}}}]),e}(),v=new w;(e.exports=v).Pangu=w}])});a.pangu;function i(e,t){for(var r=0,n=e.length-1;n>=0;n--){var a=e[n];"."===a?e.splice(n,1):".."===a?(e.splice(n,1),r++):r&&(e.splice(n,1),r--)}if(t)for(;r--;r)e.unshift("..");return e}var o=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/,s=function(e){return o.exec(e).slice(1)};function l(){for(var e="",t=!1,r=arguments.length-1;r>=-1&&!t;r--){var n=r>=0?arguments[r]:"/";if("string"!=typeof n)throw new TypeError("Arguments to path.resolve must be strings");n&&(e=n+"/"+e,t="/"===n.charAt(0))}return e=i(_(e.split("/"),function(e){return!!e}),!t).join("/"),(t?"/":"")+e||"."}function c(e){var t=u(e),r="/"===b(e,-1);return(e=i(_(e.split("/"),function(e){return!!e}),!t).join("/"))||t||(e="."),e&&r&&(e+="/"),(t?"/":"")+e}function u(e){return"/"===e.charAt(0)}function d(){return c(_(Array.prototype.slice.call(arguments,0),function(e,t){if("string"!=typeof e)throw new TypeError("Arguments to path.join must be strings");return e}).join("/"))}function h(e,t){function r(e){for(var t=0;t=0&&""===e[r];r--);return t>r?[]:e.slice(t,r-t+1)}e=l(e).substr(1),t=l(t).substr(1);for(var n=r(e.split("/")),a=r(t.split("/")),i=Math.min(n.length,a.length),o=i,s=0;s=0&&c>0){for(n=[],i=r.length;u>=0&&!s;)u==l?(n.push(u),l=r.indexOf(e,u+1)):1==n.length?s=[n.pop(),c]:((a=n.pop())=0?l:c;n.length&&(s=[i,o])}return s}E.range=T;var N=function(e){if(!e)return[];"{}"===e.substr(0,2)&&(e="\\{\\}"+e.substr(2));return function e(t,r){var n=[];var a=k("{","}",t);if(!a||/\$$/.test(a.pre))return[t];var i=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(a.body);var o=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(a.body);var s=i||o;var l=a.body.indexOf(",")>=0;if(!s&&!l)return a.post.match(/,.*\}/)?(t=a.pre+"{"+a.body+C+a.post,e(t)):[t];var c;if(s)c=a.body.split(/\.\./);else if(1===(c=function e(t){if(!t)return[""];var r=[];var n=k("{","}",t);if(!n)return t.split(",");var a=n.pre;var i=n.body;var o=n.post;var s=a.split(",");s[s.length-1]+="{"+i+"}";var l=e(o);o.length&&(s[s.length-1]+=l.shift(),s.push.apply(s,l));r.push.apply(r,s);return r}(a.body)).length&&1===(c=e(c[0],!1).map(M)).length){var u=a.post.length?e(a.post,!1):[""];return u.map(function(e){return a.pre+c[0]+e})}var d=a.pre;var u=a.post.length?e(a.post,!1):[""];var h;if(s){var f=L(c[0]),p=L(c[1]),g=Math.max(c[0].length,c[1].length),m=3==c.length?Math.abs(L(c[2])):1,_=I,b=p0){var T=new Array(x+1).join("0");E=y<0?"-"+T+E.slice(1):T+E}}h.push(E)}}else h=v(c,function(t){return e(t,!1)});for(var N=0;N=t}var R=w&&m||w,D=Y;Y.Minimatch=Q;var H={sep:"/"};try{H=R}catch(e){}var G=Y.GLOBSTAR=Q.GLOBSTAR={},U={"!":{open:"(?:(?!(?:",close:"))[^/]*?)"},"?":{open:"(?:",close:")?"},"+":{open:"(?:",close:")+"},"*":{open:"(?:",close:")*"},"@":{open:"(?:",close:")"}},q="[^/]",F=q+"*?",V="(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?",W="(?:(?!(?:\\/|^)\\.).)*?",X="().*{}+?[]^$\\!".split("").reduce(function(e,t){return e[t]=!0,e},{});var Z=/\/+/;function K(e,t){e=e||{},t=t||{};var r={};return Object.keys(t).forEach(function(e){r[e]=t[e]}),Object.keys(e).forEach(function(t){r[t]=e[t]}),r}function Y(e,t,r){if("string"!=typeof t)throw new TypeError("glob pattern string required");return r||(r={}),!(!r.nocomment&&"#"===t.charAt(0))&&(""===t.trim()?""===e:new Q(t,r).match(e))}function Q(e,t){if(!(this instanceof Q))return new Q(e,t);if("string"!=typeof e)throw new TypeError("glob pattern string required");t||(t={}),e=e.trim(),"/"!==H.sep&&(e=e.split(H.sep).join("/")),this.options=t,this.set=[],this.pattern=e,this.regexp=null,this.negate=!1,this.comment=!1,this.empty=!1,this.make()}function J(e,t){if(t||(t=this instanceof Q?this.options:{}),void 0===(e=void 0===e?this.pattern:e))throw new TypeError("undefined pattern");return t.nobrace||!e.match(/\{.*\}/)?[e]:N(e)}Y.filter=function(e,t){return t=t||{},function(r,n,a){return Y(r,e,t)}},Y.defaults=function(e){if(!e||!Object.keys(e).length)return Y;var t=Y,r=function(r,n,a){return t.minimatch(r,n,K(e,a))};return r.Minimatch=function(r,n){return new t.Minimatch(r,K(e,n))},r},Q.defaults=function(e){return e&&Object.keys(e).length?Y.defaults(e).Minimatch:Q},Q.prototype.debug=function(){},Q.prototype.make=function(){if(this._made)return;var e=this.pattern,t=this.options;if(!t.nocomment&&"#"===e.charAt(0))return void(this.comment=!0);if(!e)return void(this.empty=!0);this.parseNegate();var r=this.globSet=this.braceExpand();t.debug&&(this.debug=console.error);this.debug(this.pattern,r),r=this.globParts=r.map(function(e){return e.split(Z)}),this.debug(this.pattern,r),r=r.map(function(e,t,r){return e.map(this.parse,this)},this),this.debug(this.pattern,r),r=r.filter(function(e){return-1===e.indexOf(!1)}),this.debug(this.pattern,r),this.set=r},Q.prototype.parseNegate=function(){var e=this.pattern,t=!1,r=0;if(this.options.nonegate)return;for(var n=0,a=e.length;n65536)throw new TypeError("pattern is too long");var r=this.options;if(!r.noglobstar&&"**"===e)return G;if(""===e)return"";var n,a="",i=!!r.nocase,o=!1,s=[],l=[],c=!1,u=-1,d=-1,h="."===e.charAt(0)?"":r.dot?"(?!(?:^|\\/)\\.{1,2}(?:$|\\/))":"(?!\\.)",f=this;function p(){if(n){switch(n){case"*":a+=F,i=!0;break;case"?":a+=q,i=!0;break;default:a+="\\"+n}f.debug("clearStateChar %j %j",n,a),n=!1}}for(var g,m=0,_=e.length;m<_&&(g=e.charAt(m));m++)if(this.debug("%s\t%s %s %j",e,m,a,g),o&&X[g])a+="\\"+g,o=!1;else switch(g){case"/":return!1;case"\\":p(),o=!0;continue;case"?":case"*":case"+":case"@":case"!":if(this.debug("%s\t%s %s %j <-- stateChar",e,m,a,g),c){this.debug(" in class"),"!"===g&&m===d+1&&(g="^"),a+=g;continue}f.debug("call clearStateChar %j",n),p(),n=g,r.noext&&p();continue;case"(":if(c){a+="(";continue}if(!n){a+="\\(";continue}s.push({type:n,start:m-1,reStart:a.length,open:U[n].open,close:U[n].close}),a+="!"===n?"(?:(?!(?:":"(?:",this.debug("plType %j %j",n,a),n=!1;continue;case")":if(c||!s.length){a+="\\)";continue}p(),i=!0;var b=s.pop();a+=b.close,"!"===b.type&&l.push(b),b.reEnd=a.length;continue;case"|":if(c||!s.length||o){a+="\\|",o=!1;continue}p(),a+="|";continue;case"[":if(p(),c){a+="\\"+g;continue}c=!0,d=m,u=a.length,a+=g;continue;case"]":if(m===d+1||!c){a+="\\"+g,o=!1;continue}if(c)var w,v=e.substring(d+1,m);i=!0,c=!1,a+=g;continue;default:p(),o?o=!1:!X[g]||"^"===g&&c||(a+="\\"),a+=g}c&&(v=e.substr(d+1),w=this.parse(v,ee),a=a.substr(0,u)+"\\["+w[0],i=i||w[1]);for(b=s.pop();b;b=s.pop()){var y=a.slice(b.reStart+b.open.length);this.debug("setting tail",a,b),y=y.replace(/((?:\\{2}){0,64})(\\?)\|/g,function(e,t,r){return r||(r="\\"),t+t+r+"|"}),this.debug("tail=%j\n %s",y,y,b,a);var k="*"===b.type?F:"?"===b.type?q:"\\"+b.type;i=!0,a=a.slice(0,b.reStart)+k+"\\("+y}p(),o&&(a+="\\\\");var E=!1;switch(a.charAt(0)){case".":case"[":case"(":E=!0}for(var x=l.length-1;x>-1;x--){var T=l[x],N=a.slice(0,T.reStart),A=a.slice(T.reStart,T.reEnd-8),S=a.slice(T.reEnd-8,T.reEnd),C=a.slice(T.reEnd);S+=C;var P=N.split("(").length-1,j=C;for(m=0;m=0&&!(n=e[a]);a--);for(a=0;a>> no match, partial?",e,d,t,h),d!==o))}if("string"==typeof c?(l=n.nocase?u.toLowerCase()===c.toLowerCase():u===c,this.debug("string match",c,u,l)):(l=u.match(c),this.debug("pattern match",c,u,l)),!l)return!1}if(a===o&&i===s)return!0;if(a===o)return r;if(i===s)return a===o-1&&""===e[a];throw new Error("wtf?")};var te=Object.freeze({specbeautify:function(e,t){switch(e){case"sspai.com":t.find(".relation-apps").remove(),t.find(".ss-app-card").remove();break;case"post.smzdm.com":t.find("img.face").addClass("sr-rd-content-nobeautify"),t.find(".insert-outer img").addClass("sr-rd-content-nobeautify");break;case"infoq.com":t.find("img").map(function(e,t){"left"==$(t).css("float")&&$(t).addClass("sr-rd-content-nobeautify")}),t.find("script").remove();break;case"appinn.com":case"hacpai.com":t.find(".emoji").addClass("sr-rd-content-nobeautify");break;case"douban.com":t.find(".review-content").children().unwrap(),t.find("table").addClass("sr-rd-content-center"),t.find("p").css({"white-space":"pre-wrap"}),t.find(".cc").removeClass();break;case"qdaily.com":t.find("img").map(function(e,t){var r=$(t);0==Number.parseInt(r.css("height"))&&r.remove()}),t.find(".com-insert-images").map(function(e,t){var r=$(t),n=r.find("img").map(function(e,t){return"
"+t.outerHTML+"
"}).get().join("");r.empty().removeAttr("class").append(n)}),t.find(".com-insert-embed").remove();break;case"news.mtime.com":t.find(".newspictool").map(function(e,t){var r=$(t),n=r.find("img"),a=r.find("p:last");r.removeAttr("class").addClass("sr-rd-content-center").empty().append(n).append(a)});break;case"blog.csdn.net":t.find(".save_code").remove(),t.find(".pre-numbering").remove(),t.find("pre").removeAttr("style").removeAttr("class"),t.find("code").removeAttr("style"),t.find(".dp-highlighter").map(function(e,t){$(t).find(".bar .tools").remove(),$(t).next().is("pre")&&$(t).next().remove()});break;case"news.sohu.com":t.find(".conserve-photo").remove(),t.find("table").addClass("sr-rd-content-center");break;case"qq.com":t.find(".rv-root-v2, #backqqcom").remove();break;case"azofreeware.com":t.find("iframe").remove();break;case"apprcn.com":t.find("img").map(function(e,t){var r=$(t),n=r.attr("src");n&&n.includes("Apprcn_Wechat_Small.jpeg")&&r.parent().remove()}),t.find("a").map(function(e,t){var r=$(t);"来自反斗软件"==r.text()&&r.parent().remove()});break;case"tieba.baidu.com":t.find(".BDE_Smiley").addClass("sr-rd-content-nobeautify"),t.find(".replace_div").removeAttr("class").removeAttr("style"),t.find(".replace_tip").remove(),t.find(".d_post_content, .j_d_post_content, .post_bubble_top, .post_bubble_middle, .post_bubble_bottom").map(function(e,t){$(t).removeAttr("class").removeAttr("style")}),$("body").find(".p_author_face").map(function(e,t){var r=$(t).find("img"),n=r.attr("data-tb-lazyload"),a=r.attr("username");n&&$("sr-rd-mult-avatar").find("span").map(function(e,t){var r=$(t);r.text()==a&&r.parent().find("img").attr("src",n)})});break;case"jingyan.baidu.com":t.find(".exp-image-wraper").removeAttr("class").removeAttr("href");break;case"question.zhihu.com":t.find(".zu-edit-button").remove(),t.find("a.external").map(function(e,t){$(t).removeAttr("class").attr("style","border: none;")}),t.find(".VagueImage").map(function(e,t){var r=$(t),n=r.attr("data-src");r.replaceWith('')});break;case"chiphell.com":t.find("img").map(function(e,t){var r=$(t),n=r.parent(),a=r.attr("src"),i=r.attr("smilieid");n.is("ignore_js_op")&&r.unwrap(),i&&a&&a.includes("static/image/smiley")&&r.addClass("sr-rd-content-nobeautify").attr("style","width: 50px;")}),t.find(".quote").remove();break;case"jiemian.com":t.find("script").remove();break;case"36kr.com":t.find(".load-html-img").removeAttr("class");break;case"cnblogs.com":t.find(".cnblogs_code").removeClass(),t.find(".cnblogs_code_hide").removeClass().removeAttr("style"),t.find(".cnblogs_code_toolbar").remove(),t.find(".code_img_opened").remove(),t.find(".code_img_closed").remove();break;case"news.cnblogs.com":t.find(".topic_img").remove();break;case"g-cores.com":t.find(".swiper-slide-active").find("img").map(function(e,t){var r=$(t);r.parent().parent().parent().parent().parent().parent().removeAttr("class").removeAttr("style").html(r)});break;case"feng.com":case"young.ifeng.com":t.find("span").removeAttr("style");break;case"ftchinese.com":t.find("script").remove();break;case"segmentfault.com":t.find(".widget-codetool").remove();break;case"mp.weixin.qq.com":t.find('section[powered-by="xiumi.us"]').find("img").map(function(e,t){var r=$(t),n=r.attr("data-src");r.addClass("sr-rd-content-nobeautify").attr("src",n)});break;case"ruby-china.org":t.find(".twemoji").remove();break;case"w3cplus.com":t.find("iframe").addClass("sr-rd-content-nobeautify");break;case"zuojj.com":t.find(".syntaxhighlighter .Brush").attr("style","font-size: .7em !important;");break;case"aotu.io":t.find(".highlight table").map(function(e,t){var r=$(t),n=r.find("pre"),a=r.find("table");r.html(n[1]),a.unwrap()}),t.find("table").addClass("sr-rd-content-center");break;case"colobu.com":t.find(".highlight table").map(function(e,t){var r=$(t),n=r.find("pre");r.html(n[1]),r.unwrap()});break;case"hao.caibaojian.com":t.find(".tlink").map(function(e,t){$(t).html("")});break;case"wkee.net":t.find("script").remove();break;case"linux.cn":t.find("pre").attr("style","background-color: #161b20; background-image: none;"),t.find("code").attr("style","background-color: transparent; background-image: none;");break;case"zhuanlan.zhihu.com":t.find("div[data-src]").map(function(e,t){var r=$(t),n=r.attr("data-src");r.replaceWith('
')});break;case"jianshu.com":t.find(".image-package").map(function(e,t){var r=$(t),n=r.find("img");r.html(n)});break;case"medium.com":t.find("figure").map(function(e,t){var r=$(t),n=r.find("img");r.replaceWith('
')});break;case"worldcup.fifa.com":t.find("iframe").css({width:"790px",height:"450px"}),t.find("div").removeClass()}},removeSpareTag:function(e,t){var r=!1,n="";["lib.csdn.net","huxiu.com","my.oschina.net","caixin.com","163.com","steachs.com","hacpai.com","apprcn.com","mp.weixin.qq.com"].includes(e)?(r=!0,n="p"):["nationalgeographic.com.cn","dgtle.com","news.mtime.com"].includes(e)?(r=!0,n="div"):["chiphell.com"].includes(e)&&(r=!0,n="font"),r&&t.find(n).map(function(e,t){var r=$(t).text().toLowerCase().trim();0==$(t).find("img").length&&""==r&&$(t).remove()})},htmlbeautify:function(e){try{e.html(function(e,t){return t.trim().replace(/<\/?blockquote/g,function(e){return"/"==e[1]?"\n?
(\n?
)*/g,"
").replace(/\/(div|p)>\n*(
\n)+/g,function(e){return e.replace("
","")})})}catch(t){return e.html()}},commbeautify:function(e,t){t.find("img:not(.sr-rd-content-nobeautify)").map(function(e,t){var r=$(t),n=(r.parent(),$("")),a=r.attr("src"),i=r.attr("data-src"),o=r.attr("data-original"),s=r.attr("original"),l=r.attr("data-original-src"),c=r.attr("real_src"),u=function(){n.removeClass("sr-rd-content-img-load"),n[0].clientWidth<400?n.parent().removeClass("sr-rd-content-center").addClass("sr-rd-content-center-small"):n[0].clientWidth>1e3?n.css("zoom","0.6"):n[0].clientHeight>620&&/win|mac/i.test(navigator.platform)&&(n.attr("height",620),n[0].clientWidth<$("sr-rd-content").width()&&n.css({width:"auto"})),n[0].clientWidth>$("sr-rd-content").width()&&n.addClass("sr-rd-content-img")},d=function(){n.addClass("simpread-hidden"),n.parent().hasClass("sr-rd-content-center")&&n.parent().removeAttr("class").addClass("simpread-hidden")},h=void 0;r.parent()[0].tagName.toLowerCase(),h=s||a,h=i||h,h=o||h,h=l||h,!(h=c||h)||h.startsWith("http")||h.startsWith("data")||(h=function e(t,r){if("string"!=typeof t||!t)return null;if(t.match(/^[a-z]+\:\/\//i))return t;if(t.match(/^\/\//))return"http:"+t;if(t.match(/^[a-z]+\:/i))return t;var n;if("string"!=typeof r)return(n=document.createElement("a")).href=t,n.pathname?"http://"+t:null;if(null===(r=e(r)))return null;(n=document.createElement("a")).href=r,"/"===t[0]?r=[]:(r=n.pathname.split("/")).pop(),t=t.split("/");for(var a=0;a"),/win|mac/i.test(navigator.platform)?n.one("load",function(){return u()}).one("error",function(){return d()}):n.on("load",function(){return u()}).on("error",function(){return d()})}),t.find("sr-blockquote").map(function(t,r){var n=$(r),a=n.parent();n.removeAttr("style").removeAttr("class"),"dgtle.com"==e&&a.removeClass("quote")}),t.find("iframe:not(.sr-rd-content-nobeautify), embed:not(.sr-rd-content-nobeautify)").map(function(e,t){$(t).wrap("
")}),t.find("hr").map(function(e,t){$(t).addClass("simpread-hidden")}),t.find("pre").map(function(e,t){$(t).find("code").removeAttr("class")}),t.find("pre").removeAttr("class"),t.find("a").removeAttr("style")},cleanHTML:function(e,t){var r,n,a=e.html();"readability-page-1"==$(e.children()).attr("id")&&1==e.children().children().length?a=e.children().children().html():1==e.children().length&&(a=e.children().html()),a=a.replace(//gi,""),e.html((r=a,n="",$.parseHTML(r).forEach(function(e,r){var a=e.tagName,i=e.outerText,o=e.outerHTML;void 0==a?n+="

"+e.textContent.replace(/^\n|\n$/gi,"").trim()+"

":"PRE"==a?n+="
"+i.replace(//gi,">")+"
":(""!=i||o.includes("0?t.join("").replace(/, $/,""):null}function oe(e,t){var r=Object.keys(t).map(function(e){return t[e]&&e.replace(/[A-Z]/,function(e){return"-"+e.toLowerCase()})+": "+t[e]+";"}).join("");switch(e){case"title":r="sr-rd-title {"+r+"}";break;case"desc":r="sr-rd-desc {"+r+"}";break;case"art":r="sr-rd-content *, sr-rd-content p, sr-rd-content div {"+r+"}";break;case"pre":r="sr-rd-content pre {"+r+"}";break;case"code":r="sr-rd-content pre code, sr-rd-content pre code * {"+r+"}"}var n=$("head").find("style#simpread-custom-"+e);0==n.length?$("head").append('"):n.html(r)}function se(e,t){var r=$("head").find("style#simpread-custom-"+e);0==r.length?$("head").append('"):r.html(t)}var le=Object.freeze({GetColor:ie,BgColor:function(e,t){var r="rgba("+ie(e)+", "+t/100+")";return $(ne).css(re,r),r},Opacity:function(e){var t=ie($(ne).css(re)),r="rgba("+t+", "+e/100+")";return t?($(ne).css(re,r),r):null},FontFamily:function(e){$("sr-read").css("font-family","default"==e?"":e)},FontSize:function(e){"-1"==ae&&void 0==(ae=$("html").attr("style"))&&(ae=""),e?$("html").attr("style","font-size: "+e+"!important;"+ae):$("html").attr("style",ae)},Layout:function(e){$("sr-read").css("margin",e?"20px "+e:"")},SiteCSS:function(e){e?$("head").append('"):$("#simpread-site-css").remove()},Preview:function(e){Object.keys(e).forEach(function(t){"css"!=t&&oe(t,e[t])}),se("css",e.css)},Custom:oe,CSS:se,VerifyCustom:function(e,t){switch(e){case"layout":case"margin":case"fontfamily":case"custom":return""!=t.css;case"fontsize":return""!=t.title.fontSize||""!=t.desc.fontSize||""!=t.art.fontSize||""!=t.css;case"theme":return-1!=t.css.search("simpread-theme-root")}}});function ce(e,t){if(t&&t.documentElement)e=t,t=arguments[2];else if(!e||!e.documentElement)throw new Error("First argument to Readability constructor should be a document object.");var r;t=t||{},this._doc=e,this._articleTitle=null,this._articleByline=null,this._articleDir=null,this._articleSiteName=null,this._attempts=[],this._debug=!!t.debug,this._maxElemsToParse=t.maxElemsToParse||this.DEFAULT_MAX_ELEMS_TO_PARSE,this._nbTopCandidates=t.nbTopCandidates||this.DEFAULT_N_TOP_CANDIDATES,this._charThreshold=t.charThreshold||this.DEFAULT_CHAR_THRESHOLD,this._classesToPreserve=this.CLASSES_TO_PRESERVE.concat(t.classesToPreserve||[]),this._flags=this.FLAG_STRIP_UNLIKELYS|this.FLAG_WEIGHT_CLASSES|this.FLAG_CLEAN_CONDITIONALLY,this._debug?(r=function(e){var t,r,n=e.nodeName+" ";return e.nodeType==e.TEXT_NODE?n+'("'+e.textContent+'")':(t=e.className&&"."+e.className.replace(/ /g,"."),r="",e.id?r="(#"+e.id+t+")":t&&(r="("+t+")"),n+r)},this.log=function(){var e;"undefined"!=typeof dump?(e=Array.prototype.map.call(arguments,function(e){return e&&e.nodeName?r(e):e}).join(" "),dump("Reader: (Readability) "+e+"\n")):"undefined"!=typeof console&&["Reader: (Readability) "].concat(arguments)}):this.log=function(){}}ce.prototype={FLAG_STRIP_UNLIKELYS:1,FLAG_WEIGHT_CLASSES:2,FLAG_CLEAN_CONDITIONALLY:4,ELEMENT_NODE:1,TEXT_NODE:3,DEFAULT_MAX_ELEMS_TO_PARSE:0,DEFAULT_N_TOP_CANDIDATES:5,DEFAULT_TAGS_TO_SCORE:"section,h2,h3,h4,h5,h6,p,td,pre".toUpperCase().split(","),DEFAULT_CHAR_THRESHOLD:500,REGEXPS:{unlikelyCandidates:/-ad-|ai2html|banner|breadcrumbs|combx|comment|community|cover-wrap|disqus|extra|foot|gdpr|header|legends|menu|related|remark|replies|rss|shoutbox|sidebar|skyscraper|social|sponsor|supplemental|ad-break|agegate|pagination|pager|popup|yom-remote/i,okMaybeItsACandidate:/and|article|body|column|main|shadow/i,positive:/article|body|content|entry|hentry|h-entry|main|page|pagination|post|text|blog|story/i,negative:/hidden|^hid$| hid$| hid |^hid |banner|combx|comment|com-|contact|foot|footer|footnote|gdpr|masthead|media|meta|outbrain|promo|related|scroll|share|shoutbox|sidebar|skyscraper|sponsor|shopping|tags|tool|widget/i,extraneous:/print|archive|comment|discuss|e[\-]?mail|share|reply|all|login|sign|single|utility/i,byline:/byline|author|dateline|writtenby|p-author/i,replaceFonts:/<(\/?)font[^>]*>/gi,normalize:/\s{2,}/g,videos:/\/\/(www\.)?((dailymotion|youtube|youtube-nocookie|player\.vimeo|v\.qq)\.com|(archive|upload\.wikimedia)\.org|player\.twitch\.tv)/i,nextLink:/(next|weiter|continue|>([^\|]|$)|禄([^\|]|$))/i,prevLink:/(prev|earl|old|new|<|芦)/i,whitespace:/^\s*$/,hasContent:/\S$/},DIV_TO_P_ELEMS:["A","BLOCKQUOTE","DL","DIV","IMG","OL","P","PRE","TABLE","UL","SELECT"],ALTER_TO_DIV_EXCEPTIONS:["DIV","ARTICLE","SECTION","P"],PRESENTATIONAL_ATTRIBUTES:["align","background","bgcolor","border","cellpadding","cellspacing","frame","hspace","rules","style","valign","vspace"],DEPRECATED_SIZE_ATTRIBUTE_ELEMS:["TABLE","TH","TD","HR","PRE"],PHRASING_ELEMS:["ABBR","AUDIO","B","BDO","BR","BUTTON","CITE","CODE","DATA","DATALIST","DFN","EM","EMBED","I","IMG","INPUT","KBD","LABEL","MARK","MATH","METER","NOSCRIPT","OBJECT","OUTPUT","PROGRESS","Q","RUBY","SAMP","SCRIPT","SELECT","SMALL","SPAN","STRONG","SUB","SUP","TEXTAREA","TIME","VAR","WBR"],CLASSES_TO_PRESERVE:["page"],_postProcessContent:function(e){this._fixRelativeUris(e),this._cleanClasses(e)},_removeNodes:function(e,t){var r,n,a;for(r=e.length-1;r>=0;r--)(a=(n=e[r]).parentNode)&&(!t||t.call(this,n,r,e))&&a.removeChild(n)},_replaceNodeTags:function(e,t){var r,n;for(r=e.length-1;r>=0;r--)n=e[r],this._setNodeTag(n,t)},_forEachNode:function(e,t){Array.prototype.forEach.call(e,t,this)},_someNode:function(e,t){return Array.prototype.some.call(e,t,this)},_everyNode:function(e,t){return Array.prototype.every.call(e,t,this)},_concatNodeLists:function(){var e=Array.prototype.slice,t=e.call(arguments).map(function(t){return e.call(t)});return Array.prototype.concat.apply([],t)},_getAllNodesWithTag:function(e,t){return e.querySelectorAll?e.querySelectorAll(t.join(",")):[].concat.apply([],t.map(function(t){var r=e.getElementsByTagName(t);return Array.isArray(r)?r:Array.from(r)}))},_cleanClasses:function(e){var t=this._classesToPreserve,r=(e.getAttribute("class")||"").split(/\s+/).filter(function(e){return-1!=t.indexOf(e)}).join(" ");for(r?e.setAttribute("class",r):e.removeAttribute("class"),e=e.firstElementChild;e;e=e.nextElementSibling)this._cleanClasses(e)},_fixRelativeUris:function(e){function t(e){if(n==a&&"#"==e.charAt(0))return e;try{return new URL(e,n).href}catch(e){}return e}var r,n=this._doc.baseURI,a=this._doc.documentURI,i=this._getAllNodesWithTag(e,["a"]);this._forEachNode(i,function(e){var r,n=e.getAttribute("href");n&&(0===n.indexOf("javascript:")?(r=this._doc.createTextNode(e.textContent),e.parentNode.replaceChild(r,e)):e.setAttribute("href",t(n)))}),r=this._getAllNodesWithTag(e,["img"]),this._forEachNode(r,function(e){var r=e.getAttribute("src");r&&e.setAttribute("src",t(r))})},_getArticleTitle:function(){function e(e){return e.split(/\s+/).length}var t,r,n,a,i,o=this._doc,s="",l="";try{"string"!=typeof(s=l=o.title.trim())&&(s=l=this._getInnerText(o.getElementsByTagName("title")[0]))}catch(e){}return t=!1,/ [\|\-\\\/>禄] /.test(s)?(t=/ [\\\/>禄] /.test(s),e(s=l.replace(/(.*)[\|\-\\\/>禄] .*/gi,"$1"))<3&&(s=l.replace(/[^\|\-\\\/>禄]*[\|\-\\\/>禄](.*)/gi,"$1"))):-1!==s.indexOf(": ")?(r=this._concatNodeLists(o.getElementsByTagName("h1"),o.getElementsByTagName("h2")),n=s.trim(),this._someNode(r,function(e){return e.textContent.trim()===n})||(e(s=l.substring(l.lastIndexOf(":")+1))<3?s=l.substring(l.indexOf(":")+1):e(l.substr(0,l.indexOf(":")))>5&&(s=l))):(s.length>150||s.length<15)&&(1===(a=o.getElementsByTagName("h1")).length&&(s=this._getInnerText(a[0]))),4>=(i=e(s=s.trim().replace(this.REGEXPS.normalize," ")))&&(!t||i!=e(l.replace(/[\|\-\\\/>禄]+/g,""))-1)&&(s=l),s},_prepDocument:function(){var e=this._doc;this._removeNodes(e.getElementsByTagName("style")),e.body&&this._replaceBrs(e.body),this._replaceNodeTags(e.getElementsByTagName("font"),"SPAN")},_nextElement:function(e){for(var t=e;t&&t.nodeType!=this.ELEMENT_NODE&&this.REGEXPS.whitespace.test(t.textContent);)t=t.nextSibling;return t},_replaceBrs:function(e){this._forEachNode(this._getAllNodesWithTag(e,["br"]),function(e){for(var t,r,n,a,i=e.nextSibling,o=!1;(i=this._nextElement(i))&&"BR"==i.tagName;)o=!0,t=i.nextSibling,i.parentNode.removeChild(i),i=t;if(o){for(r=this._doc.createElement("p"),e.parentNode.replaceChild(r,e),i=r.nextSibling;i&&("BR"!=i.tagName||(!(n=this._nextElement(i.nextSibling))||"BR"!=n.tagName))&&this._isPhrasingContent(i);)a=i.nextSibling,r.appendChild(i),i=a;for(;r.lastChild&&this._isWhitespace(r.lastChild);)r.removeChild(r.lastChild);"P"===r.parentNode.tagName&&this._setNodeTag(r.parentNode,"DIV")}})},_setNodeTag:function(e,t){var r,n;if(this.log("_setNodeTag",e,t),e.__JSDOMParser__)return e.localName=t.toLowerCase(),e.tagName=t.toUpperCase(),e;for(r=e.ownerDocument.createElement(t);e.firstChild;)r.appendChild(e.firstChild);for(e.parentNode.replaceChild(r,e),e.readability&&(r.readability=e.readability),n=0;n0?r[0].textContent.includes(this._articleTitle):this._articleTitle.includes(r[0].textContent))&&this._clean(e,"h2"))),this._clean(e,"iframe"),this._clean(e,"input"),this._clean(e,"textarea"),this._clean(e,"select"),this._clean(e,"button"),this._cleanHeaders(e),this._cleanConditionally(e,"table"),this._cleanConditionally(e,"ul"),this._cleanConditionally(e,"div"),this._removeNodes(e.getElementsByTagName("p"),function(e){return 0===e.getElementsByTagName("img").length+e.getElementsByTagName("embed").length+e.getElementsByTagName("object").length+e.getElementsByTagName("iframe").length&&!this._getInnerText(e,!1)}),this._forEachNode(this._getAllNodesWithTag(e,["br"]),function(e){var t=this._nextElement(e.nextSibling);t&&"P"==t.tagName&&e.parentNode.removeChild(e)}),this._forEachNode(this._getAllNodesWithTag(e,["table"]),function(e){var t,r,n=this._hasSingleTagInsideElement(e,"TBODY")?e.firstElementChild:e;this._hasSingleTagInsideElement(n,"TR")&&(t=n.firstElementChild,this._hasSingleTagInsideElement(t,"TD")&&(r=t.firstElementChild,r=this._setNodeTag(r,this._everyNode(r.childNodes,this._isPhrasingContent)?"P":"DIV"),e.parentNode.replaceChild(r,e)))})},_initializeNode:function(e){switch(e.readability={contentScore:0},e.tagName){case"DIV":e.readability.contentScore+=5;break;case"PRE":case"TD":case"BLOCKQUOTE":e.readability.contentScore+=3;break;case"ADDRESS":case"OL":case"UL":case"DL":case"DD":case"DT":case"LI":case"FORM":e.readability.contentScore-=3;break;case"H1":case"H2":case"H3":case"H4":case"H5":case"H6":case"TH":e.readability.contentScore-=5}e.readability.contentScore+=this._getClassWeight(e)},_removeAndGetNext:function(e){var t=this._getNextNode(e,!0);return e.parentNode.removeChild(e),t},_getNextNode:function(e,t){if(!t&&e.firstElementChild)return e.firstElementChild;if(e.nextElementSibling)return e.nextElementSibling;do{e=e.parentNode}while(e&&!e.nextElementSibling);return e&&e.nextElementSibling},_checkByline:function(e,t){var r,n;return!this._articleByline&&(void 0!==e.getAttribute&&(r=e.getAttribute("rel"),n=e.getAttribute("itemprop")),!(!("author"===r||n&&-1!==n.indexOf("author")||this.REGEXPS.byline.test(t))||!this._isValidByline(e.textContent))&&(this._articleByline=e.textContent.trim(),!0))},_getNodeAncestors:function(e,t){t=t||0;for(var r=0,n=[];e.parentNode&&(n.push(e.parentNode),!t||++r!==t);)e=e.parentNode;return n},_grabArticle:function(e){var t,r,n,a,i,o,s,l,c,u,d,h,f,p,g,m,_,b,w,v,y,k,E,x,T,N,A,S,C,P,j,L,z,M,$,B,I,O,R,D,H,G,U,q,F,V,W;if(this.log("**** grabArticle ****"),t=this._doc,r=null!==e,!(e=e||this._doc.body))return this.log("No body found in document. Abort."),null;for(n=e.innerHTML;;){for(a=this._flagIsActive(this.FLAG_STRIP_UNLIKELYS),i=[],o=this._doc.documentElement;o;)if(s=o.className+" "+o.id,this._isProbablyVisible(o))if(this._checkByline(o,s))o=this._removeAndGetNext(o);else if(!a||!this.REGEXPS.unlikelyCandidates.test(s)||this.REGEXPS.okMaybeItsACandidate.test(s)||this._hasAncestorTag(o,"table")||"BODY"===o.tagName||"A"===o.tagName)if("DIV"!==o.tagName&&"SECTION"!==o.tagName&&"HEADER"!==o.tagName&&"H1"!==o.tagName&&"H2"!==o.tagName&&"H3"!==o.tagName&&"H4"!==o.tagName&&"H5"!==o.tagName&&"H6"!==o.tagName||!this._isElementWithoutContent(o)){if(-1!==this.DEFAULT_TAGS_TO_SCORE.indexOf(o.tagName)&&i.push(o),"DIV"===o.tagName){for(l=null,c=o.firstChild;c;){if(u=c.nextSibling,this._isPhrasingContent(c))null!==l?l.appendChild(c):this._isWhitespace(c)||(l=t.createElement("p"),o.replaceChild(l,c),l.appendChild(c));else if(null!==l){for(;l.lastChild&&this._isWhitespace(l.lastChild);)l.removeChild(l.lastChild);l=null}c=u}this._hasSingleTagInsideElement(o,"P")&&this._getLinkDensity(o)<.25?(d=o.children[0],o.parentNode.replaceChild(d,o),o=d,i.push(o)):this._hasChildBlockElement(o)||(o=this._setNodeTag(o,"P"),i.push(o))}o=this._getNextNode(o)}else o=this._removeAndGetNext(o);else this.log("Removing unlikely candidate - "+s),o=this._removeAndGetNext(o);else this.log("Removing hidden node - "+s),o=this._removeAndGetNext(o);for(h=[],this._forEachNode(i,function(e){var t,r,n;e.parentNode&&void 0!==e.parentNode.tagName&&((t=this._getInnerText(e)).length<25||0!==(r=this._getNodeAncestors(e,3)).length&&(n=0,n+=1,n+=t.split(",").length,n+=Math.min(Math.floor(t.length/100),3),this._forEachNode(r,function(e,t){if(e.tagName&&e.parentNode&&void 0!==e.parentNode.tagName){if(void 0===e.readability&&(this._initializeNode(e),h.push(e)),0===t)var r=1;else r=1===t?2:3*t;e.readability.contentScore+=n/r}})))}),f=[],p=0,g=h.length;g>p;p+=1)for(_=(m=h[p]).readability.contentScore*(1-this._getLinkDensity(m)),m.readability.contentScore=_,this.log("Candidate:",m,"with score "+_),b=0;bw.readability.contentScore){f.splice(b,0,m),f.length>this._nbTopCandidates&&f.pop();break}if(y=!1,null===(v=f[0]||null)||"BODY"===v.tagName){for(v=t.createElement("DIV"),y=!0,E=e.childNodes;E.length;)this.log("Moving child out:",E[0]),v.appendChild(E[0]);e.appendChild(v),this._initializeNode(v)}else if(v){for(x=[],T=1;T=.75&&x.push(this._getNodeAncestors(f[T]));if(N=3,x.length>=N)for(k=v.parentNode;"BODY"!==k.tagName;){for(A=0,S=0;SA;S++)A+=Number(x[S].includes(k));if(A>=N){v=k;break}k=k.parentNode}for(v.readability||this._initializeNode(v),k=v.parentNode,P=(C=v.readability.contentScore)/3;"BODY"!==k.tagName;)if(k.readability){if(P>(j=k.readability.contentScore))break;if(j>C){v=k;break}C=k.readability.contentScore,k=k.parentNode}else k=k.parentNode;for(k=v.parentNode;"BODY"!=k.tagName&&1==k.children.length;)k=(v=k).parentNode;v.readability||this._initializeNode(v)}for(L=t.createElement("DIV"),r&&(L.id="readability-content"),z=Math.max(10,.2*v.readability.contentScore),$=0,B=(M=(k=v.parentNode).children).length;B>$;$++)I=M[$],O=!1,this.log("Looking at sibling node:",I,I.readability?"with score "+I.readability.contentScore:""),this.log("Sibling has score",I.readability?I.readability.contentScore:"Unknown"),I===v?O=!0:(R=0,I.className===v.className&&""!==v.className&&(R+=.2*v.readability.contentScore),I.readability&&I.readability.contentScore+R>=z?O=!0:"P"===I.nodeName&&(D=this._getLinkDensity(I),(G=(H=this._getInnerText(I)).length)>80&&.25>D?O=!0:80>G&&G>0&&0===D&&-1!==H.search(/\.( |$)/)&&(O=!0))),O&&(this.log("Appending node:",I),-1===this.ALTER_TO_DIV_EXCEPTIONS.indexOf(I.nodeName)&&(this.log("Altering sibling:",I,"to div."),I=this._setNodeTag(I,"DIV")),L.appendChild(I),$-=1,B-=1);if(this._debug&&this.log("Article content pre-prep: "+L.innerHTML),this._prepArticle(L),this._debug&&this.log("Article content post-prep: "+L.innerHTML),y)v.id="readability-page-1",v.className="page";else{for((U=t.createElement("DIV")).id="readability-page-1",U.className="page",q=L.childNodes;q.length;)U.appendChild(q[0]);L.appendChild(U)}if(this._debug&&this.log("Article content after paging: "+L.innerHTML),F=!0,(V=this._getInnerText(L,!0).length)0&&e.length<100)},_getArticleMetadata:function(){var e={},t={},r=this._doc.getElementsByTagName("meta"),n=/\s*(dc|dcterm|og|twitter)\s*:\s*(author|creator|description|title|site_name)\s*/gi,a=/^\s*(?:(dc|dcterm|og|twitter|weibo:(article|webpage))\s*[\.:]\s*)?(author|creator|description|title|site_name)\s*$/i;return this._forEachNode(r,function(e){var r,i,o,s=e.getAttribute("name"),l=e.getAttribute("property"),c=e.getAttribute("content");if(c){if(r=null,i=null,l&&(r=l.match(n)))for(o=r.length-1;o>=0;o--)i=r[o].toLowerCase().replace(/\s/g,""),t[i]=c.trim();!r&&s&&a.test(s)&&(i=s,c&&(i=i.toLowerCase().replace(/\s/g,"").replace(/\./g,":"),t[i]=c.trim()))}}),e.title=t["dc:title"]||t["dcterm:title"]||t["og:title"]||t["weibo:article:title"]||t["weibo:webpage:title"]||t.title||t["twitter:title"],e.title||(e.title=this._getArticleTitle()),e.byline=t["dc:creator"]||t["dcterm:creator"]||t.author,e.excerpt=t["dc:description"]||t["dcterm:description"]||t["og:description"]||t["weibo:article:description"]||t["weibo:webpage:description"]||t.description||t["twitter:description"],e.siteName=t["og:site_name"],e},_removeScripts:function(e){this._removeNodes(e.getElementsByTagName("script"),function(e){return e.nodeValue="",e.removeAttribute("src"),!0}),this._removeNodes(e.getElementsByTagName("noscript"))},_hasSingleTagInsideElement:function(e,t){return 1==e.children.length&&e.children[0].tagName===t&&!this._someNode(e.childNodes,function(e){return e.nodeType===this.TEXT_NODE&&this.REGEXPS.hasContent.test(e.textContent)})},_isElementWithoutContent:function(e){return e.nodeType===this.ELEMENT_NODE&&0==e.textContent.trim().length&&(0==e.children.length||e.children.length==e.getElementsByTagName("br").length+e.getElementsByTagName("hr").length)},_hasChildBlockElement:function(e){return this._someNode(e.childNodes,function(e){return-1!==this.DIV_TO_P_ELEMS.indexOf(e.tagName)||this._hasChildBlockElement(e)})},_isPhrasingContent:function(e){return e.nodeType===this.TEXT_NODE||-1!==this.PHRASING_ELEMS.indexOf(e.tagName)||("A"===e.tagName||"DEL"===e.tagName||"INS"===e.tagName)&&this._everyNode(e.childNodes,this._isPhrasingContent)},_isWhitespace:function(e){return e.nodeType===this.TEXT_NODE&&0===e.textContent.trim().length||e.nodeType===this.ELEMENT_NODE&&"BR"===e.tagName},_getInnerText:function(e,t){t=void 0===t||t;var r=e.textContent.trim();return t?r.replace(this.REGEXPS.normalize," "):r},_getCharCount:function(e,t){return t=t||",",this._getInnerText(e).split(t).length-1},_cleanStyles:function(e){var t,r;if(e&&"svg"!==e.tagName.toLowerCase()){for(t=0;t0&&a>r)return!1;if(e.parentNode.tagName===t&&(!n||n(e.parentNode)))return!0;e=e.parentNode,a++}return!1},_getRowAndColumnCount:function(e){var t,r,n,a,i,o,s=0,l=0,c=e.getElementsByTagName("tr");for(t=0;t0?r._readabilityDataTable=!0:["col","colgroup","tfoot","thead","th"].some(function(e){return!!r.getElementsByTagName(e)[0]})?(this.log("Data table because found data-y descendant"),r._readabilityDataTable=!0):r.getElementsByTagName("table")[0]?r._readabilityDataTable=!1:(a=this._getRowAndColumnCount(r),r._readabilityDataTable=a.rows>=10||a.columns>4||a.rows*a.columns>10):r._readabilityDataTable=!1:r._readabilityDataTable=!1},_cleanConditionally:function(e,t){if(this._flagIsActive(this.FLAG_CLEAN_CONDITIONALLY)){var r="ul"===t||"ol"===t;this._removeNodes(e.getElementsByTagName(t),function(e){var n,a,i,o,s,l,c,u,d,h,f,p=function(e){return e._readabilityDataTable};if("table"===t&&p(e))return!1;if(this._hasAncestorTag(e,"table",-1,p))return!1;if(n=this._getClassWeight(e),0,this.log("Cleaning Conditionally",e),0>n+0)return!0;if(this._getCharCount(e,",")<10){for(a=e.getElementsByTagName("p").length,i=e.getElementsByTagName("img").length,o=e.getElementsByTagName("li").length-100,s=e.getElementsByTagName("input").length,l=0,c=this._concatNodeLists(e.getElementsByTagName("object"),e.getElementsByTagName("embed"),e.getElementsByTagName("iframe")),u=0;u1&&.5>a/i&&!this._hasAncestorTag(e,"figure")||!r&&o>a||s>Math.floor(a/3)||!r&&25>f&&(0===i||i>2)&&!this._hasAncestorTag(e,"figure")||!r&&25>n&&h>.2||n>=25&&h>.5||1===l&&75>f||l>1}return!1})}},_cleanMatchedNodes:function(e,t){for(var r=this._getNextNode(e,!0),n=this._getNextNode(e);n&&n!=r;)n=t(n,n.className+" "+n.id)?this._removeAndGetNext(n):this._getNextNode(n)},_cleanHeaders:function(e){for(var t=1;3>t;t+=1)this._removeNodes(e.getElementsByTagName("h"+t),function(e){return this._getClassWeight(e)<0})},_flagIsActive:function(e){return(this._flags&e)>0},_removeFlag:function(e){this._flags=this._flags&~e},_isProbablyVisible:function(e){return!(e.style&&"none"==e.style.display||e.hasAttribute("hidden"))},parse:function(){var e,t,r,n,a;if(this._maxElemsToParse>0&&(e=this._doc.getElementsByTagName("*").length)>this._maxElemsToParse)throw new Error("Aborting parsing document; "+e+" elements found");return this._removeScripts(this._doc),this._prepDocument(),t=this._getArticleMetadata(),this._articleTitle=t.title,(r=this._grabArticle())?(this.log("Grabbed: "+r.innerHTML),this._postProcessContent(r),t.excerpt||(n=r.getElementsByTagName("p")).length>0&&(t.excerpt=n[0].textContent.trim()),a=r.textContent,{title:this._articleTitle,byline:t.byline||this._articleByline,dir:this._articleDir,content:r.innerHTML,textContent:a,length:a.length,excerpt:t.excerpt,siteName:t.siteName||this._articleSiteName}):null}};var ue=Object.freeze({Readability:ce}),de=r(function(e){(function(){function t(e){var t={omitExtraWLInCodeBlocks:{defaultValue:!1,describe:"Omit the default extra whiteline added to code blocks",type:"boolean"},noHeaderId:{defaultValue:!1,describe:"Turn on/off generated header id",type:"boolean"},prefixHeaderId:{defaultValue:!1,describe:"Add a prefix to the generated header ids. Passing a string will prefix that string to the header id. Setting to true will add a generic 'section-' prefix",type:"string"},rawPrefixHeaderId:{defaultValue:!1,describe:'Setting this option to true will prevent showdown from modifying the prefix. This might result in malformed IDs (if, for instance, the " char is used in the prefix)',type:"boolean"},ghCompatibleHeaderId:{defaultValue:!1,describe:"Generate header ids compatible with github style (spaces are replaced with dashes, a bunch of non alphanumeric chars are removed)",type:"boolean"},rawHeaderId:{defaultValue:!1,describe:"Remove only spaces, ' and \" from generated header ids (including prefixes), replacing them with dashes (-). WARNING: This might result in malformed ids",type:"boolean"},headerLevelStart:{defaultValue:!1,describe:"The header blocks level start",type:"integer"},parseImgDimensions:{defaultValue:!1,describe:"Turn on/off image dimension parsing",type:"boolean"},simplifiedAutoLink:{defaultValue:!1,describe:"Turn on/off GFM autolink style",type:"boolean"},excludeTrailingPunctuationFromURLs:{defaultValue:!1,describe:"Excludes trailing punctuation from links generated with autoLinking",type:"boolean"},literalMidWordUnderscores:{defaultValue:!1,describe:"Parse midword underscores as literal underscores",type:"boolean"},literalMidWordAsterisks:{defaultValue:!1,describe:"Parse midword asterisks as literal asterisks",type:"boolean"},strikethrough:{defaultValue:!1,describe:"Turn on/off strikethrough support",type:"boolean"},tables:{defaultValue:!1,describe:"Turn on/off tables support",type:"boolean"},tablesHeaderId:{defaultValue:!1,describe:"Add an id to table headers",type:"boolean"},ghCodeBlocks:{defaultValue:!0,describe:"Turn on/off GFM fenced code blocks support",type:"boolean"},tasklists:{defaultValue:!1,describe:"Turn on/off GFM tasklist support",type:"boolean"},smoothLivePreview:{defaultValue:!1,describe:"Prevents weird effects in live previews due to incomplete input",type:"boolean"},smartIndentationFix:{defaultValue:!1,description:"Tries to smartly fix indentation in es6 strings",type:"boolean"},disableForced4SpacesIndentedSublists:{defaultValue:!1,description:"Disables the requirement of indenting nested sublists by 4 spaces",type:"boolean"},simpleLineBreaks:{defaultValue:!1,description:"Parses simple line breaks as
(GFM Style)",type:"boolean"},requireSpaceBeforeHeadingText:{defaultValue:!1,description:"Makes adding a space between `#` and the header text mandatory (GFM Style)",type:"boolean"},ghMentions:{defaultValue:!1,description:"Enables github @mentions",type:"boolean"},ghMentionsLink:{defaultValue:"https://github.com/{u}",description:"Changes the link generated by @mentions. Only applies if ghMentions option is enabled.",type:"string"},encodeEmails:{defaultValue:!0,description:"Encode e-mail addresses through the use of Character Entities, transforming ASCII e-mail addresses into its equivalent decimal entities",type:"boolean"},openLinksInNewWindow:{defaultValue:!1,description:"Open all links in new windows",type:"boolean"},backslashEscapesHTMLTags:{defaultValue:!1,description:"Support for HTML Tag escaping. ex:
foo
",type:"boolean"},emoji:{defaultValue:!1,description:"Enable emoji support. Ex: `this is a :smile: emoji`",type:"boolean"},underline:{defaultValue:!1,description:"Enable support for underline. Syntax is double or triple underscores: `__underline word__`. With this option enabled, underscores no longer parses into `` and ``",type:"boolean"},completeHTMLDocument:{defaultValue:!1,description:"Outputs a complete html document, including ``, `` and `` tags",type:"boolean"},metadata:{defaultValue:!1,description:"Enable support for document metadata (defined at the top of the document between `«««` and `»»»` or between `---` and `---`).",type:"boolean"},splitAdjacentBlockquotes:{defaultValue:!1,description:"Split adjacent blockquote blocks",type:"boolean"}};if(!1===e)return JSON.parse(JSON.stringify(t));var r={};for(var n in t)t.hasOwnProperty(n)&&(r[n]=t[n].defaultValue);return r}function r(e,t){var r=t?"Error in "+t+" extension->":"Error in unnamed extension",a={valid:!0,error:""};i.helper.isArray(e)||(e=[e]);for(var o=0;o").replace(/&/g,"&")};var d=function(e,t,r,n){var a,i,o,s,l,c=n||"",u=c.indexOf("g")>-1,d=new RegExp(t+"|"+r,"g"+c.replace(/g/g,"")),h=new RegExp(t,c.replace(/g/g,"")),f=[];do{for(a=0;o=d.exec(e);)if(h.test(o[0]))a++||(s=(i=d.lastIndex)-o[0].length);else if(a&&!--a){l=o.index+o[0].length;var p={left:{start:s,end:i},match:{start:i,end:o.index},right:{start:o.index,end:l},wholeMatch:{start:s,end:l}};if(f.push(p),!u)return f}}while(a&&(d.lastIndex=i));return f};i.helper.matchRecursiveRegExp=function(e,t,r,n){for(var a=d(e,t,r,n),i=[],o=0;o0){var u=[];0!==s[0].wholeMatch.start&&u.push(e.slice(0,s[0].wholeMatch.start));for(var h=0;h=0?n+(r||0):n},i.helper.splitAtIndex=function(e,t){if(!i.helper.isString(e))throw"InvalidArgumentError: first parameter of showdown.helper.regexIndexOf function must be a string";return[e.substring(0,t),e.substring(t)]},i.helper.encodeEmailAddress=function(e){var t=[function(e){return"&#"+e.charCodeAt(0)+";"},function(e){return"&#x"+e.charCodeAt(0).toString(16)+";"},function(e){return e}];return e.replace(/./g,function(e){if("@"===e)e=t[Math.floor(2*Math.random())](e);else{var r=Math.random();e=r>.9?t[2](e):r>.45?t[1](e):t[0](e)}return e})},i.helper.padEnd=function(e,t,r){return t>>=0,r=String(r||" "),e.length>t?String(e):((t-=e.length)>r.length&&(r+=r.repeat(t/r.length)),String(e)+r.slice(0,t))},"undefined"==typeof console&&(console={warn:function(e){alert(e)},log:function(e){alert(e)},error:function(e){throw e}}),i.helper.regexes={asteriskDashAndColon:/([*_:~])/g},i.helper.emojis={"+1":"👍","-1":"👎",100:"💯",1234:"🔢","1st_place_medal":"🥇","2nd_place_medal":"🥈","3rd_place_medal":"🥉","8ball":"🎱",a:"🅰️",ab:"🆎",abc:"🔤",abcd:"🔡",accept:"🉑",aerial_tramway:"🚡",airplane:"✈️",alarm_clock:"⏰",alembic:"⚗️",alien:"👽",ambulance:"🚑",amphora:"🏺",anchor:"⚓️",angel:"👼",anger:"💢",angry:"😠",anguished:"😧",ant:"🐜",apple:"🍎",aquarius:"♒️",aries:"♈️",arrow_backward:"◀️",arrow_double_down:"⏬",arrow_double_up:"⏫",arrow_down:"⬇️",arrow_down_small:"🔽",arrow_forward:"▶️",arrow_heading_down:"⤵️",arrow_heading_up:"⤴️",arrow_left:"⬅️",arrow_lower_left:"↙️",arrow_lower_right:"↘️",arrow_right:"➡️",arrow_right_hook:"↪️",arrow_up:"⬆️",arrow_up_down:"↕️",arrow_up_small:"🔼",arrow_upper_left:"↖️",arrow_upper_right:"↗️",arrows_clockwise:"🔃",arrows_counterclockwise:"🔄",art:"🎨",articulated_lorry:"🚛",artificial_satellite:"🛰",astonished:"😲",athletic_shoe:"👟",atm:"🏧",atom_symbol:"⚛️",avocado:"🥑",b:"🅱️",baby:"👶",baby_bottle:"🍼",baby_chick:"🐤",baby_symbol:"🚼",back:"🔙",bacon:"🥓",badminton:"🏸",baggage_claim:"🛄",baguette_bread:"🥖",balance_scale:"⚖️",balloon:"🎈",ballot_box:"🗳",ballot_box_with_check:"☑️",bamboo:"🎍",banana:"🍌",bangbang:"‼️",bank:"🏦",bar_chart:"📊",barber:"💈",baseball:"⚾️",basketball:"🏀",basketball_man:"⛹️",basketball_woman:"⛹️‍♀️",bat:"🦇",bath:"🛀",bathtub:"🛁",battery:"🔋",beach_umbrella:"🏖",bear:"🐻",bed:"🛏",bee:"🐝",beer:"🍺",beers:"🍻",beetle:"🐞",beginner:"🔰",bell:"🔔",bellhop_bell:"🛎",bento:"🍱",biking_man:"🚴",bike:"🚲",biking_woman:"🚴‍♀️",bikini:"👙",biohazard:"☣️",bird:"🐦",birthday:"🎂",black_circle:"⚫️",black_flag:"🏴",black_heart:"🖤",black_joker:"🃏",black_large_square:"⬛️",black_medium_small_square:"◾️",black_medium_square:"◼️",black_nib:"✒️",black_small_square:"▪️",black_square_button:"🔲",blonde_man:"👱",blonde_woman:"👱‍♀️",blossom:"🌼",blowfish:"🐡",blue_book:"📘",blue_car:"🚙",blue_heart:"💙",blush:"😊",boar:"🐗",boat:"⛵️",bomb:"💣",book:"📖",bookmark:"🔖",bookmark_tabs:"📑",books:"📚",boom:"💥",boot:"👢",bouquet:"💐",bowing_man:"🙇",bow_and_arrow:"🏹",bowing_woman:"🙇‍♀️",bowling:"🎳",boxing_glove:"🥊",boy:"👦",bread:"🍞",bride_with_veil:"👰",bridge_at_night:"🌉",briefcase:"💼",broken_heart:"💔",bug:"🐛",building_construction:"🏗",bulb:"💡",bullettrain_front:"🚅",bullettrain_side:"🚄",burrito:"🌯",bus:"🚌",business_suit_levitating:"🕴",busstop:"🚏",bust_in_silhouette:"👤",busts_in_silhouette:"👥",butterfly:"🦋",cactus:"🌵",cake:"🍰",calendar:"📆",call_me_hand:"🤙",calling:"📲",camel:"🐫",camera:"📷",camera_flash:"📸",camping:"🏕",cancer:"♋️",candle:"🕯",candy:"🍬",canoe:"🛶",capital_abcd:"🔠",capricorn:"♑️",car:"🚗",card_file_box:"🗃",card_index:"📇",card_index_dividers:"🗂",carousel_horse:"🎠",carrot:"🥕",cat:"🐱",cat2:"🐈",cd:"💿",chains:"⛓",champagne:"🍾",chart:"💹",chart_with_downwards_trend:"📉",chart_with_upwards_trend:"📈",checkered_flag:"🏁",cheese:"🧀",cherries:"🍒",cherry_blossom:"🌸",chestnut:"🌰",chicken:"🐔",children_crossing:"🚸",chipmunk:"🐿",chocolate_bar:"🍫",christmas_tree:"🎄",church:"⛪️",cinema:"🎦",circus_tent:"🎪",city_sunrise:"🌇",city_sunset:"🌆",cityscape:"🏙",cl:"🆑",clamp:"🗜",clap:"👏",clapper:"🎬",classical_building:"🏛",clinking_glasses:"🥂",clipboard:"📋",clock1:"🕐",clock10:"🕙",clock1030:"🕥",clock11:"🕚",clock1130:"🕦",clock12:"🕛",clock1230:"🕧",clock130:"🕜",clock2:"🕑",clock230:"🕝",clock3:"🕒",clock330:"🕞",clock4:"🕓",clock430:"🕟",clock5:"🕔",clock530:"🕠",clock6:"🕕",clock630:"🕡",clock7:"🕖",clock730:"🕢",clock8:"🕗",clock830:"🕣",clock9:"🕘",clock930:"🕤",closed_book:"📕",closed_lock_with_key:"🔐",closed_umbrella:"🌂",cloud:"☁️",cloud_with_lightning:"🌩",cloud_with_lightning_and_rain:"⛈",cloud_with_rain:"🌧",cloud_with_snow:"🌨",clown_face:"🤡",clubs:"♣️",cocktail:"🍸",coffee:"☕️",coffin:"⚰️",cold_sweat:"😰",comet:"☄️",computer:"💻",computer_mouse:"🖱",confetti_ball:"🎊",confounded:"😖",confused:"😕",congratulations:"㊗️",construction:"🚧",construction_worker_man:"👷",construction_worker_woman:"👷‍♀️",control_knobs:"🎛",convenience_store:"🏪",cookie:"🍪",cool:"🆒",policeman:"👮",copyright:"©️",corn:"🌽",couch_and_lamp:"🛋",couple:"👫",couple_with_heart_woman_man:"💑",couple_with_heart_man_man:"👨‍❤️‍👨",couple_with_heart_woman_woman:"👩‍❤️‍👩",couplekiss_man_man:"👨‍❤️‍💋‍👨",couplekiss_man_woman:"💏",couplekiss_woman_woman:"👩‍❤️‍💋‍👩",cow:"🐮",cow2:"🐄",cowboy_hat_face:"🤠",crab:"🦀",crayon:"🖍",credit_card:"💳",crescent_moon:"🌙",cricket:"🏏",crocodile:"🐊",croissant:"🥐",crossed_fingers:"🤞",crossed_flags:"🎌",crossed_swords:"⚔️",crown:"👑",cry:"😢",crying_cat_face:"😿",crystal_ball:"🔮",cucumber:"🥒",cupid:"💘",curly_loop:"➰",currency_exchange:"💱",curry:"🍛",custard:"🍮",customs:"🛃",cyclone:"🌀",dagger:"🗡",dancer:"💃",dancing_women:"👯",dancing_men:"👯‍♂️",dango:"🍡",dark_sunglasses:"🕶",dart:"🎯",dash:"💨",date:"📅",deciduous_tree:"🌳",deer:"🦌",department_store:"🏬",derelict_house:"🏚",desert:"🏜",desert_island:"🏝",desktop_computer:"🖥",male_detective:"🕵️",diamond_shape_with_a_dot_inside:"💠",diamonds:"♦️",disappointed:"😞",disappointed_relieved:"😥",dizzy:"💫",dizzy_face:"😵",do_not_litter:"🚯",dog:"🐶",dog2:"🐕",dollar:"💵",dolls:"🎎",dolphin:"🐬",door:"🚪",doughnut:"🍩",dove:"🕊",dragon:"🐉",dragon_face:"🐲",dress:"👗",dromedary_camel:"🐪",drooling_face:"🤤",droplet:"💧",drum:"🥁",duck:"🦆",dvd:"📀","e-mail":"📧",eagle:"🦅",ear:"👂",ear_of_rice:"🌾",earth_africa:"🌍",earth_americas:"🌎",earth_asia:"🌏",egg:"🥚",eggplant:"🍆",eight_pointed_black_star:"✴️",eight_spoked_asterisk:"✳️",electric_plug:"🔌",elephant:"🐘",email:"✉️",end:"🔚",envelope_with_arrow:"📩",euro:"💶",european_castle:"🏰",european_post_office:"🏤",evergreen_tree:"🌲",exclamation:"❗️",expressionless:"😑",eye:"👁",eye_speech_bubble:"👁‍🗨",eyeglasses:"👓",eyes:"👀",face_with_head_bandage:"🤕",face_with_thermometer:"🤒",fist_oncoming:"👊",factory:"🏭",fallen_leaf:"🍂",family_man_woman_boy:"👪",family_man_boy:"👨‍👦",family_man_boy_boy:"👨‍👦‍👦",family_man_girl:"👨‍👧",family_man_girl_boy:"👨‍👧‍👦",family_man_girl_girl:"👨‍👧‍👧",family_man_man_boy:"👨‍👨‍👦",family_man_man_boy_boy:"👨‍👨‍👦‍👦",family_man_man_girl:"👨‍👨‍👧",family_man_man_girl_boy:"👨‍👨‍👧‍👦",family_man_man_girl_girl:"👨‍👨‍👧‍👧",family_man_woman_boy_boy:"👨‍👩‍👦‍👦",family_man_woman_girl:"👨‍👩‍👧",family_man_woman_girl_boy:"👨‍👩‍👧‍👦",family_man_woman_girl_girl:"👨‍👩‍👧‍👧",family_woman_boy:"👩‍👦",family_woman_boy_boy:"👩‍👦‍👦",family_woman_girl:"👩‍👧",family_woman_girl_boy:"👩‍👧‍👦",family_woman_girl_girl:"👩‍👧‍👧",family_woman_woman_boy:"👩‍👩‍👦",family_woman_woman_boy_boy:"👩‍👩‍👦‍👦",family_woman_woman_girl:"👩‍👩‍👧",family_woman_woman_girl_boy:"👩‍👩‍👧‍👦",family_woman_woman_girl_girl:"👩‍👩‍👧‍👧",fast_forward:"⏩",fax:"📠",fearful:"😨",feet:"🐾",female_detective:"🕵️‍♀️",ferris_wheel:"🎡",ferry:"⛴",field_hockey:"🏑",file_cabinet:"🗄",file_folder:"📁",film_projector:"📽",film_strip:"🎞",fire:"🔥",fire_engine:"🚒",fireworks:"🎆",first_quarter_moon:"🌓",first_quarter_moon_with_face:"🌛",fish:"🐟",fish_cake:"🍥",fishing_pole_and_fish:"🎣",fist_raised:"✊",fist_left:"🤛",fist_right:"🤜",flags:"🎏",flashlight:"🔦",fleur_de_lis:"⚜️",flight_arrival:"🛬",flight_departure:"🛫",floppy_disk:"💾",flower_playing_cards:"🎴",flushed:"😳",fog:"🌫",foggy:"🌁",football:"🏈",footprints:"👣",fork_and_knife:"🍴",fountain:"⛲️",fountain_pen:"🖋",four_leaf_clover:"🍀",fox_face:"🦊",framed_picture:"🖼",free:"🆓",fried_egg:"🍳",fried_shrimp:"🍤",fries:"🍟",frog:"🐸",frowning:"😦",frowning_face:"☹️",frowning_man:"🙍‍♂️",frowning_woman:"🙍",middle_finger:"🖕",fuelpump:"⛽️",full_moon:"🌕",full_moon_with_face:"🌝",funeral_urn:"⚱️",game_die:"🎲",gear:"⚙️",gem:"💎",gemini:"♊️",ghost:"👻",gift:"🎁",gift_heart:"💝",girl:"👧",globe_with_meridians:"🌐",goal_net:"🥅",goat:"🐐",golf:"⛳️",golfing_man:"🏌️",golfing_woman:"🏌️‍♀️",gorilla:"🦍",grapes:"🍇",green_apple:"🍏",green_book:"📗",green_heart:"💚",green_salad:"🥗",grey_exclamation:"❕",grey_question:"❔",grimacing:"😬",grin:"😁",grinning:"😀",guardsman:"💂",guardswoman:"💂‍♀️",guitar:"🎸",gun:"🔫",haircut_woman:"💇",haircut_man:"💇‍♂️",hamburger:"🍔",hammer:"🔨",hammer_and_pick:"⚒",hammer_and_wrench:"🛠",hamster:"🐹",hand:"✋",handbag:"👜",handshake:"🤝",hankey:"💩",hatched_chick:"🐥",hatching_chick:"🐣",headphones:"🎧",hear_no_evil:"🙉",heart:"❤️",heart_decoration:"💟",heart_eyes:"😍",heart_eyes_cat:"😻",heartbeat:"💓",heartpulse:"💗",hearts:"♥️",heavy_check_mark:"✔️",heavy_division_sign:"➗",heavy_dollar_sign:"💲",heavy_heart_exclamation:"❣️",heavy_minus_sign:"➖",heavy_multiplication_x:"✖️",heavy_plus_sign:"➕",helicopter:"🚁",herb:"🌿",hibiscus:"🌺",high_brightness:"🔆",high_heel:"👠",hocho:"🔪",hole:"🕳",honey_pot:"🍯",horse:"🐴",horse_racing:"🏇",hospital:"🏥",hot_pepper:"🌶",hotdog:"🌭",hotel:"🏨",hotsprings:"♨️",hourglass:"⌛️",hourglass_flowing_sand:"⏳",house:"🏠",house_with_garden:"🏡",houses:"🏘",hugs:"🤗",hushed:"😯",ice_cream:"🍨",ice_hockey:"🏒",ice_skate:"⛸",icecream:"🍦",id:"🆔",ideograph_advantage:"🉐",imp:"👿",inbox_tray:"📥",incoming_envelope:"📨",tipping_hand_woman:"💁",information_source:"ℹ️",innocent:"😇",interrobang:"⁉️",iphone:"📱",izakaya_lantern:"🏮",jack_o_lantern:"🎃",japan:"🗾",japanese_castle:"🏯",japanese_goblin:"👺",japanese_ogre:"👹",jeans:"👖",joy:"😂",joy_cat:"😹",joystick:"🕹",kaaba:"🕋",key:"🔑",keyboard:"⌨️",keycap_ten:"🔟",kick_scooter:"🛴",kimono:"👘",kiss:"💋",kissing:"😗",kissing_cat:"😽",kissing_closed_eyes:"😚",kissing_heart:"😘",kissing_smiling_eyes:"😙",kiwi_fruit:"🥝",koala:"🐨",koko:"🈁",label:"🏷",large_blue_circle:"🔵",large_blue_diamond:"🔷",large_orange_diamond:"🔶",last_quarter_moon:"🌗",last_quarter_moon_with_face:"🌜",latin_cross:"✝️",laughing:"😆",leaves:"🍃",ledger:"📒",left_luggage:"🛅",left_right_arrow:"↔️",leftwards_arrow_with_hook:"↩️",lemon:"🍋",leo:"♌️",leopard:"🐆",level_slider:"🎚",libra:"♎️",light_rail:"🚈",link:"🔗",lion:"🦁",lips:"👄",lipstick:"💄",lizard:"🦎",lock:"🔒",lock_with_ink_pen:"🔏",lollipop:"🍭",loop:"➿",loud_sound:"🔊",loudspeaker:"📢",love_hotel:"🏩",love_letter:"💌",low_brightness:"🔅",lying_face:"🤥",m:"Ⓜ️",mag:"🔍",mag_right:"🔎",mahjong:"🀄️",mailbox:"📫",mailbox_closed:"📪",mailbox_with_mail:"📬",mailbox_with_no_mail:"📭",man:"👨",man_artist:"👨‍🎨",man_astronaut:"👨‍🚀",man_cartwheeling:"🤸‍♂️",man_cook:"👨‍🍳",man_dancing:"🕺",man_facepalming:"🤦‍♂️",man_factory_worker:"👨‍🏭",man_farmer:"👨‍🌾",man_firefighter:"👨‍🚒",man_health_worker:"👨‍⚕️",man_in_tuxedo:"🤵",man_judge:"👨‍⚖️",man_juggling:"🤹‍♂️",man_mechanic:"👨‍🔧",man_office_worker:"👨‍💼",man_pilot:"👨‍✈️",man_playing_handball:"🤾‍♂️",man_playing_water_polo:"🤽‍♂️",man_scientist:"👨‍🔬",man_shrugging:"🤷‍♂️",man_singer:"👨‍🎤",man_student:"👨‍🎓",man_teacher:"👨‍🏫",man_technologist:"👨‍💻",man_with_gua_pi_mao:"👲",man_with_turban:"👳",tangerine:"🍊",mans_shoe:"👞",mantelpiece_clock:"🕰",maple_leaf:"🍁",martial_arts_uniform:"🥋",mask:"😷",massage_woman:"💆",massage_man:"💆‍♂️",meat_on_bone:"🍖",medal_military:"🎖",medal_sports:"🏅",mega:"📣",melon:"🍈",memo:"📝",men_wrestling:"🤼‍♂️",menorah:"🕎",mens:"🚹",metal:"🤘",metro:"🚇",microphone:"🎤",microscope:"🔬",milk_glass:"🥛",milky_way:"🌌",minibus:"🚐",minidisc:"💽",mobile_phone_off:"📴",money_mouth_face:"🤑",money_with_wings:"💸",moneybag:"💰",monkey:"🐒",monkey_face:"🐵",monorail:"🚝",moon:"🌔",mortar_board:"🎓",mosque:"🕌",motor_boat:"🛥",motor_scooter:"🛵",motorcycle:"🏍",motorway:"🛣",mount_fuji:"🗻",mountain:"⛰",mountain_biking_man:"🚵",mountain_biking_woman:"🚵‍♀️",mountain_cableway:"🚠",mountain_railway:"🚞",mountain_snow:"🏔",mouse:"🐭",mouse2:"🐁",movie_camera:"🎥",moyai:"🗿",mrs_claus:"🤶",muscle:"💪",mushroom:"🍄",musical_keyboard:"🎹",musical_note:"🎵",musical_score:"🎼",mute:"🔇",nail_care:"💅",name_badge:"📛",national_park:"🏞",nauseated_face:"🤢",necktie:"👔",negative_squared_cross_mark:"❎",nerd_face:"🤓",neutral_face:"😐",new:"🆕",new_moon:"🌑",new_moon_with_face:"🌚",newspaper:"📰",newspaper_roll:"🗞",next_track_button:"⏭",ng:"🆖",no_good_man:"🙅‍♂️",no_good_woman:"🙅",night_with_stars:"🌃",no_bell:"🔕",no_bicycles:"🚳",no_entry:"⛔️",no_entry_sign:"🚫",no_mobile_phones:"📵",no_mouth:"😶",no_pedestrians:"🚷",no_smoking:"🚭","non-potable_water":"🚱",nose:"👃",notebook:"📓",notebook_with_decorative_cover:"📔",notes:"🎶",nut_and_bolt:"🔩",o:"⭕️",o2:"🅾️",ocean:"🌊",octopus:"🐙",oden:"🍢",office:"🏢",oil_drum:"🛢",ok:"🆗",ok_hand:"👌",ok_man:"🙆‍♂️",ok_woman:"🙆",old_key:"🗝",older_man:"👴",older_woman:"👵",om:"🕉",on:"🔛",oncoming_automobile:"🚘",oncoming_bus:"🚍",oncoming_police_car:"🚔",oncoming_taxi:"🚖",open_file_folder:"📂",open_hands:"👐",open_mouth:"😮",open_umbrella:"☂️",ophiuchus:"⛎",orange_book:"📙",orthodox_cross:"☦️",outbox_tray:"📤",owl:"🦉",ox:"🐂",package:"📦",page_facing_up:"📄",page_with_curl:"📃",pager:"📟",paintbrush:"🖌",palm_tree:"🌴",pancakes:"🥞",panda_face:"🐼",paperclip:"📎",paperclips:"🖇",parasol_on_ground:"⛱",parking:"🅿️",part_alternation_mark:"〽️",partly_sunny:"⛅️",passenger_ship:"🛳",passport_control:"🛂",pause_button:"⏸",peace_symbol:"☮️",peach:"🍑",peanuts:"🥜",pear:"🍐",pen:"🖊",pencil2:"✏️",penguin:"🐧",pensive:"😔",performing_arts:"🎭",persevere:"😣",person_fencing:"🤺",pouting_woman:"🙎",phone:"☎️",pick:"⛏",pig:"🐷",pig2:"🐖",pig_nose:"🐽",pill:"💊",pineapple:"🍍",ping_pong:"🏓",pisces:"♓️",pizza:"🍕",place_of_worship:"🛐",plate_with_cutlery:"🍽",play_or_pause_button:"⏯",point_down:"👇",point_left:"👈",point_right:"👉",point_up:"☝️",point_up_2:"👆",police_car:"🚓",policewoman:"👮‍♀️",poodle:"🐩",popcorn:"🍿",post_office:"🏣",postal_horn:"📯",postbox:"📮",potable_water:"🚰",potato:"🥔",pouch:"👝",poultry_leg:"🍗",pound:"💷",rage:"😡",pouting_cat:"😾",pouting_man:"🙎‍♂️",pray:"🙏",prayer_beads:"📿",pregnant_woman:"🤰",previous_track_button:"⏮",prince:"🤴",princess:"👸",printer:"🖨",purple_heart:"💜",purse:"👛",pushpin:"📌",put_litter_in_its_place:"🚮",question:"❓",rabbit:"🐰",rabbit2:"🐇",racehorse:"🐎",racing_car:"🏎",radio:"📻",radio_button:"🔘",radioactive:"☢️",railway_car:"🚃",railway_track:"🛤",rainbow:"🌈",rainbow_flag:"🏳️‍🌈",raised_back_of_hand:"🤚",raised_hand_with_fingers_splayed:"🖐",raised_hands:"🙌",raising_hand_woman:"🙋",raising_hand_man:"🙋‍♂️",ram:"🐏",ramen:"🍜",rat:"🐀",record_button:"⏺",recycle:"♻️",red_circle:"🔴",registered:"®️",relaxed:"☺️",relieved:"😌",reminder_ribbon:"🎗",repeat:"🔁",repeat_one:"🔂",rescue_worker_helmet:"⛑",restroom:"🚻",revolving_hearts:"💞",rewind:"⏪",rhinoceros:"🦏",ribbon:"🎀",rice:"🍚",rice_ball:"🍙",rice_cracker:"🍘",rice_scene:"🎑",right_anger_bubble:"🗯",ring:"💍",robot:"🤖",rocket:"🚀",rofl:"🤣",roll_eyes:"🙄",roller_coaster:"🎢",rooster:"🐓",rose:"🌹",rosette:"🏵",rotating_light:"🚨",round_pushpin:"📍",rowing_man:"🚣",rowing_woman:"🚣‍♀️",rugby_football:"🏉",running_man:"🏃",running_shirt_with_sash:"🎽",running_woman:"🏃‍♀️",sa:"🈂️",sagittarius:"♐️",sake:"🍶",sandal:"👡",santa:"🎅",satellite:"📡",saxophone:"🎷",school:"🏫",school_satchel:"🎒",scissors:"✂️",scorpion:"🦂",scorpius:"♏️",scream:"😱",scream_cat:"🙀",scroll:"📜",seat:"💺",secret:"㊙️",see_no_evil:"🙈",seedling:"🌱",selfie:"🤳",shallow_pan_of_food:"🥘",shamrock:"☘️",shark:"🦈",shaved_ice:"🍧",sheep:"🐑",shell:"🐚",shield:"🛡",shinto_shrine:"⛩",ship:"🚢",shirt:"👕",shopping:"🛍",shopping_cart:"🛒",shower:"🚿",shrimp:"🦐",signal_strength:"📶",six_pointed_star:"🔯",ski:"🎿",skier:"⛷",skull:"💀",skull_and_crossbones:"☠️",sleeping:"😴",sleeping_bed:"🛌",sleepy:"😪",slightly_frowning_face:"🙁",slightly_smiling_face:"🙂",slot_machine:"🎰",small_airplane:"🛩",small_blue_diamond:"🔹",small_orange_diamond:"🔸",small_red_triangle:"🔺",small_red_triangle_down:"🔻",smile:"😄",smile_cat:"😸",smiley:"😃",smiley_cat:"😺",smiling_imp:"😈",smirk:"😏",smirk_cat:"😼",smoking:"🚬",snail:"🐌",snake:"🐍",sneezing_face:"🤧",snowboarder:"🏂",snowflake:"❄️",snowman:"⛄️",snowman_with_snow:"☃️",sob:"😭",soccer:"⚽️",soon:"🔜",sos:"🆘",sound:"🔉",space_invader:"👾",spades:"♠️",spaghetti:"🍝",sparkle:"❇️",sparkler:"🎇",sparkles:"✨",sparkling_heart:"💖",speak_no_evil:"🙊",speaker:"🔈",speaking_head:"🗣",speech_balloon:"💬",speedboat:"🚤",spider:"🕷",spider_web:"🕸",spiral_calendar:"🗓",spiral_notepad:"🗒",spoon:"🥄",squid:"🦑",stadium:"🏟",star:"⭐️",star2:"🌟",star_and_crescent:"☪️",star_of_david:"✡️",stars:"🌠",station:"🚉",statue_of_liberty:"🗽",steam_locomotive:"🚂",stew:"🍲",stop_button:"⏹",stop_sign:"🛑",stopwatch:"⏱",straight_ruler:"📏",strawberry:"🍓",stuck_out_tongue:"😛",stuck_out_tongue_closed_eyes:"😝",stuck_out_tongue_winking_eye:"😜",studio_microphone:"🎙",stuffed_flatbread:"🥙",sun_behind_large_cloud:"🌥",sun_behind_rain_cloud:"🌦",sun_behind_small_cloud:"🌤",sun_with_face:"🌞",sunflower:"🌻",sunglasses:"😎",sunny:"☀️",sunrise:"🌅",sunrise_over_mountains:"🌄",surfing_man:"🏄",surfing_woman:"🏄‍♀️",sushi:"🍣",suspension_railway:"🚟",sweat:"😓",sweat_drops:"💦",sweat_smile:"😅",sweet_potato:"🍠",swimming_man:"🏊",swimming_woman:"🏊‍♀️",symbols:"🔣",synagogue:"🕍",syringe:"💉",taco:"🌮",tada:"🎉",tanabata_tree:"🎋",taurus:"♉️",taxi:"🚕",tea:"🍵",telephone_receiver:"📞",telescope:"🔭",tennis:"🎾",tent:"⛺️",thermometer:"🌡",thinking:"🤔",thought_balloon:"💭",ticket:"🎫",tickets:"🎟",tiger:"🐯",tiger2:"🐅",timer_clock:"⏲",tipping_hand_man:"💁‍♂️",tired_face:"😫",tm:"™️",toilet:"🚽",tokyo_tower:"🗼",tomato:"🍅",tongue:"👅",top:"🔝",tophat:"🎩",tornado:"🌪",trackball:"🖲",tractor:"🚜",traffic_light:"🚥",train:"🚋",train2:"🚆",tram:"🚊",triangular_flag_on_post:"🚩",triangular_ruler:"📐",trident:"🔱",triumph:"😤",trolleybus:"🚎",trophy:"🏆",tropical_drink:"🍹",tropical_fish:"🐠",truck:"🚚",trumpet:"🎺",tulip:"🌷",tumbler_glass:"🥃",turkey:"🦃",turtle:"🐢",tv:"📺",twisted_rightwards_arrows:"🔀",two_hearts:"💕",two_men_holding_hands:"👬",two_women_holding_hands:"👭",u5272:"🈹",u5408:"🈴",u55b6:"🈺",u6307:"🈯️",u6708:"🈷️",u6709:"🈶",u6e80:"🈵",u7121:"🈚️",u7533:"🈸",u7981:"🈲",u7a7a:"🈳",umbrella:"☔️",unamused:"😒",underage:"🔞",unicorn:"🦄",unlock:"🔓",up:"🆙",upside_down_face:"🙃",v:"✌️",vertical_traffic_light:"🚦",vhs:"📼",vibration_mode:"📳",video_camera:"📹",video_game:"🎮",violin:"🎻",virgo:"♍️",volcano:"🌋",volleyball:"🏐",vs:"🆚",vulcan_salute:"🖖",walking_man:"🚶",walking_woman:"🚶‍♀️",waning_crescent_moon:"🌘",waning_gibbous_moon:"🌖",warning:"⚠️",wastebasket:"🗑",watch:"⌚️",water_buffalo:"🐃",watermelon:"🍉",wave:"👋",wavy_dash:"〰️",waxing_crescent_moon:"🌒",wc:"🚾",weary:"😩",wedding:"💒",weight_lifting_man:"🏋️",weight_lifting_woman:"🏋️‍♀️",whale:"🐳",whale2:"🐋",wheel_of_dharma:"☸️",wheelchair:"♿️",white_check_mark:"✅",white_circle:"⚪️",white_flag:"🏳️",white_flower:"💮",white_large_square:"⬜️",white_medium_small_square:"◽️",white_medium_square:"◻️",white_small_square:"▫️",white_square_button:"🔳",wilted_flower:"🥀",wind_chime:"🎐",wind_face:"🌬",wine_glass:"🍷",wink:"😉",wolf:"🐺",woman:"👩",woman_artist:"👩‍🎨",woman_astronaut:"👩‍🚀",woman_cartwheeling:"🤸‍♀️",woman_cook:"👩‍🍳",woman_facepalming:"🤦‍♀️",woman_factory_worker:"👩‍🏭",woman_farmer:"👩‍🌾",woman_firefighter:"👩‍🚒",woman_health_worker:"👩‍⚕️",woman_judge:"👩‍⚖️",woman_juggling:"🤹‍♀️",woman_mechanic:"👩‍🔧",woman_office_worker:"👩‍💼",woman_pilot:"👩‍✈️",woman_playing_handball:"🤾‍♀️",woman_playing_water_polo:"🤽‍♀️",woman_scientist:"👩‍🔬",woman_shrugging:"🤷‍♀️",woman_singer:"👩‍🎤",woman_student:"👩‍🎓",woman_teacher:"👩‍🏫",woman_technologist:"👩‍💻",woman_with_turban:"👳‍♀️",womans_clothes:"👚",womans_hat:"👒",women_wrestling:"🤼‍♀️",womens:"🚺",world_map:"🗺",worried:"😟",wrench:"🔧",writing_hand:"✍️",x:"❌",yellow_heart:"💛",yen:"💴",yin_yang:"☯️",yum:"😋",zap:"⚡️",zipper_mouth_face:"🤐",zzz:"💤",octocat:':octocat:',showdown:"S"},i.Converter=function(e){function t(e,t){if(t=t||null,i.helper.isString(e)){if(t=e=i.helper.stdExtName(e),i.extensions[e])return void function(e,t){"function"==typeof e&&(e=e(new i.Converter)),i.helper.isArray(e)||(e=[e]);var n=r(e,t);if(!n.valid)throw Error(n.error);for(var a=0;a[ \t]+¨NBSP;<"),!t){if(!window||!window.document)throw new Error("HTMLParser is undefined. If in a webworker or nodejs environment, you need to provide a WHATWG DOM and HTML such as JSDOM");t=window.document}var r=t.createElement("div");r.innerHTML=e;var n={preList:function(e){for(var t=e.querySelectorAll("pre"),r=[],n=0;n'}else r.push(t[n].innerHTML),t[n].innerHTML="",t[n].setAttribute("prenum",n.toString());return r}(r)};!function e(t){for(var r=0;r? ?(['"].*['"])?\)$/m)>-1)o="";else if(!o){if(a||(a=n.toLowerCase().replace(/ ?\n/g," ")),o="#"+a,i.helper.isUndefined(r.gUrls[a]))return e;o=r.gUrls[a],i.helper.isUndefined(r.gTitles[a])||(c=r.gTitles[a])}var u='"+n+""};return e=(e=(e=(e=(e=r.converter._dispatch("anchors.before",e,t,r)).replace(/\[((?:\[[^\]]*]|[^\[\]])*)] ?(?:\n *)?\[(.*?)]()()()()/g,n)).replace(/\[((?:\[[^\]]*]|[^\[\]])*)]()[ \t]*\([ \t]?<([^>]*)>(?:[ \t]*((["'])([^"]*?)\5))?[ \t]?\)/g,n)).replace(/\[((?:\[[^\]]*]|[^\[\]])*)]()[ \t]*\([ \t]??(?:[ \t]*((["'])([^"]*?)\5))?[ \t]?\)/g,n)).replace(/\[([^\[\]]+)]()()()()()/g,n),t.ghMentions&&(e=e.replace(/(^|\s)(\\)?(@([a-z\d]+(?:[a-z\d.-]+?[a-z\d]+)*))/gim,function(e,r,n,a,o){if("\\"===n)return r+a;if(!i.helper.isString(t.ghMentionsLink))throw new Error("ghMentionsLink option must be a string");var s=t.ghMentionsLink.replace(/\{u}/g,o),l="";return t.openLinksInNewWindow&&(l=' target="¨E95Eblank"'),r+'"+a+""})),r.converter._dispatch("anchors.after",e,t,r)});var h=/([*~_]+|\b)(((https?|ftp|dict):\/\/|www\.)[^'">\s]+?\.[^'">\s]+?)()(\1)?(?=\s|$)(?!["<>])/gi,f=/([*~_]+|\b)(((https?|ftp|dict):\/\/|www\.)[^'">\s]+\.[^'">\s]+?)([.!?,()\[\]])?(\1)?(?=\s|$)(?!["<>])/gi,p=/()<(((https?|ftp|dict):\/\/|www\.)[^'">\s]+)()>()/gi,g=/(^|\s)(?:mailto:)?([A-Za-z0-9!#$%&'*+-/=?^_`{|}~.]+@[-a-z0-9]+(\.[-a-z0-9]+)*\.[a-z]+)(?=$|\s)/gim,m=/<()(?:mailto:)?([-.\w]+@[-a-z0-9]+(\.[-a-z0-9]+)*\.[a-z]+)>/gi,_=function(e){return function(t,r,n,a,o,s,l){var c=n=n.replace(i.helper.regexes.asteriskDashAndColon,i.helper.escapeCharactersCallback),u="",d="",h=r||"",f=l||"";return/^www\./i.test(n)&&(n=n.replace(/^www\./i,"http://www.")),e.excludeTrailingPunctuationFromURLs&&s&&(u=s),e.openLinksInNewWindow&&(d=' target="¨E95Eblank"'),h+'"+c+""+u+f}},b=function(e,t){return function(r,n,a){var o="mailto:";return n=n||"",a=i.subParser("unescapeSpecialChars")(a,e,t),e.encodeEmails?(o=i.helper.encodeEmailAddress(o+a),a=i.helper.encodeEmailAddress(a)):o+=a,n+''+a+""}};i.subParser("autoLinks",function(e,t,r){return e=(e=(e=r.converter._dispatch("autoLinks.before",e,t,r)).replace(p,_(t))).replace(m,b(t,r)),r.converter._dispatch("autoLinks.after",e,t,r)}),i.subParser("simplifiedAutoLinks",function(e,t,r){return t.simplifiedAutoLink?(e=r.converter._dispatch("simplifiedAutoLinks.before",e,t,r),e=(e=t.excludeTrailingPunctuationFromURLs?e.replace(f,_(t)):e.replace(h,_(t))).replace(g,b(t,r)),e=r.converter._dispatch("simplifiedAutoLinks.after",e,t,r)):e}),i.subParser("blockGamut",function(e,t,r){return e=r.converter._dispatch("blockGamut.before",e,t,r),e=i.subParser("blockQuotes")(e,t,r),e=i.subParser("headers")(e,t,r),e=i.subParser("horizontalRule")(e,t,r),e=i.subParser("lists")(e,t,r),e=i.subParser("codeBlocks")(e,t,r),e=i.subParser("tables")(e,t,r),e=i.subParser("hashHTMLBlocks")(e,t,r),e=i.subParser("paragraphs")(e,t,r),r.converter._dispatch("blockGamut.after",e,t,r)}),i.subParser("blockQuotes",function(e,t,r){e=r.converter._dispatch("blockQuotes.before",e,t,r),e+="\n\n";var n=/(^ {0,3}>[ \t]?.+\n(.+\n)*\n*)+/gm;return t.splitAdjacentBlockquotes&&(n=/^ {0,3}>[\s\S]*?(?:\n\n)/gm),e=e.replace(n,function(e){return e=(e=(e=e.replace(/^[ \t]*>[ \t]?/gm,"")).replace(/¨0/g,"")).replace(/^[ \t]+$/gm,""),e=i.subParser("githubCodeBlocks")(e,t,r),e=(e=(e=i.subParser("blockGamut")(e,t,r)).replace(/(^|\n)/g,"$1 ")).replace(/(\s*
[^\r]+?<\/pre>)/gm,function(e,t){var r=t;return(r=r.replace(/^  /gm,"¨0")).replace(/¨0/g,"")}),i.subParser("hashBlock")("
\n"+e+"\n
",t,r)}),r.converter._dispatch("blockQuotes.after",e,t,r)}),i.subParser("codeBlocks",function(e,t,r){return e=r.converter._dispatch("codeBlocks.before",e,t,r),e=(e=(e+="¨0").replace(/(?:\n\n|^)((?:(?:[ ]{4}|\t).*\n+)+)(\n*[ ]{0,3}[^ \t\n]|(?=¨0))/g,function(e,n,a){var o=n,s=a,l="\n";return o=i.subParser("outdent")(o,t,r),o=i.subParser("encodeCode")(o,t,r),o=(o=(o=i.subParser("detab")(o,t,r)).replace(/^\n+/g,"")).replace(/\n+$/g,""),t.omitExtraWLInCodeBlocks&&(l=""),o="
"+o+l+"
",i.subParser("hashBlock")(o,t,r)+s})).replace(/¨0/,""),r.converter._dispatch("codeBlocks.after",e,t,r)}),i.subParser("codeSpans",function(e,t,r){return void 0===(e=r.converter._dispatch("codeSpans.before",e,t,r))&&(e=""),e=e.replace(/(^|[^\\])(`+)([^\r]*?[^`])\2(?!`)/gm,function(e,n,a,o){var s=o;return s=(s=s.replace(/^([ \t]*)/g,"")).replace(/[ \t]*$/g,""),s=n+""+(s=i.subParser("encodeCode")(s,t,r))+"",i.subParser("hashHTMLSpans")(s,t,r)}),r.converter._dispatch("codeSpans.after",e,t,r)}),i.subParser("completeHTMLDocument",function(e,t,r){if(!t.completeHTMLDocument)return e;e=r.converter._dispatch("completeHTMLDocument.before",e,t,r);var n="html",a="\n",i="",o='\n',s="",l="";for(var c in void 0!==r.metadata.parsed.doctype&&(a="\n","html"!==(n=r.metadata.parsed.doctype.toString().toLowerCase())&&"html5"!==n||(o='')),r.metadata.parsed)if(r.metadata.parsed.hasOwnProperty(c))switch(c.toLowerCase()){case"doctype":break;case"title":i=""+r.metadata.parsed.title+"\n";break;case"charset":o="html"===n||"html5"===n?'\n':'\n';break;case"language":case"lang":s=' lang="'+r.metadata.parsed[c]+'"',l+='\n';break;default:l+='\n'}return e=a+"\n\n"+i+o+l+"\n\n"+e.trim()+"\n\n",r.converter._dispatch("completeHTMLDocument.after",e,t,r)}),i.subParser("detab",function(e,t,r){return e=(e=(e=(e=(e=(e=r.converter._dispatch("detab.before",e,t,r)).replace(/\t(?=\t)/g," ")).replace(/\t/g,"¨A¨B")).replace(/¨B(.+?)¨A/g,function(e,t){for(var r=t,n=4-r.length%4,a=0;a/g,">"),r.converter._dispatch("encodeAmpsAndAngles.after",e,t,r)}),i.subParser("encodeBackslashEscapes",function(e,t,r){return e=(e=(e=r.converter._dispatch("encodeBackslashEscapes.before",e,t,r)).replace(/\\(\\)/g,i.helper.escapeCharactersCallback)).replace(/\\([`*_{}\[\]()>#+.!~=|-])/g,i.helper.escapeCharactersCallback),r.converter._dispatch("encodeBackslashEscapes.after",e,t,r)}),i.subParser("encodeCode",function(e,t,r){return e=(e=r.converter._dispatch("encodeCode.before",e,t,r)).replace(/&/g,"&").replace(//g,">").replace(/([*_{}\[\]\\=~-])/g,i.helper.escapeCharactersCallback),r.converter._dispatch("encodeCode.after",e,t,r)}),i.subParser("escapeSpecialCharsWithinTagAttributes",function(e,t,r){return e=(e=(e=r.converter._dispatch("escapeSpecialCharsWithinTagAttributes.before",e,t,r)).replace(/<\/?[a-z\d_:-]+(?:[\s]+[\s\S]+?)?>/gi,function(e){return e.replace(/(.)<\/?code>(?=.)/g,"$1`").replace(/([\\`*_~=|])/g,i.helper.escapeCharactersCallback)})).replace(/-]|-[^>])(?:[^-]|-[^-])*)--)>/gi,function(e){return e.replace(/([\\`*_~=|])/g,i.helper.escapeCharactersCallback)}),r.converter._dispatch("escapeSpecialCharsWithinTagAttributes.after",e,t,r)}),i.subParser("githubCodeBlocks",function(e,t,r){return t.ghCodeBlocks?(e=r.converter._dispatch("githubCodeBlocks.before",e,t,r),e=(e=(e+="¨0").replace(/(?:^|\n)(?: {0,3})(```+|~~~+)(?: *)([^\s`~]*)\n([\s\S]*?)\n(?: {0,3})\1/g,function(e,n,a,o){var s=t.omitExtraWLInCodeBlocks?"":"\n";return o=i.subParser("encodeCode")(o,t,r),o=(o=(o=i.subParser("detab")(o,t,r)).replace(/^\n+/g,"")).replace(/\n+$/g,""),o="
"+o+s+"
",o=i.subParser("hashBlock")(o,t,r),"\n\n¨G"+(r.ghCodeBlocks.push({text:e,codeblock:o})-1)+"G\n\n"})).replace(/¨0/,""),r.converter._dispatch("githubCodeBlocks.after",e,t,r)):e}),i.subParser("hashBlock",function(e,t,r){return e=(e=r.converter._dispatch("hashBlock.before",e,t,r)).replace(/(^\n+|\n+$)/g,""),e="\n\n¨K"+(r.gHtmlBlocks.push(e)-1)+"K\n\n",r.converter._dispatch("hashBlock.after",e,t,r)}),i.subParser("hashCodeTags",function(e,t,r){return e=r.converter._dispatch("hashCodeTags.before",e,t,r),e=i.helper.replaceRecursiveRegExp(e,function(e,n,a,o){var s=a+i.subParser("encodeCode")(n,t,r)+o;return"¨C"+(r.gHtmlSpans.push(s)-1)+"C"},"]*>","","gim"),r.converter._dispatch("hashCodeTags.after",e,t,r)}),i.subParser("hashElement",function(e,t,r){return function(e,t){var n=t;return n=(n=(n=n.replace(/\n\n/g,"\n")).replace(/^\n/,"")).replace(/\n+$/g,""),"\n\n¨K"+(r.gHtmlBlocks.push(n)-1)+"K\n\n"}}),i.subParser("hashHTMLBlocks",function(e,t,r){e=r.converter._dispatch("hashHTMLBlocks.before",e,t,r);var n=["pre","div","h1","h2","h3","h4","h5","h6","blockquote","table","dl","ol","ul","script","noscript","form","fieldset","iframe","math","style","section","header","footer","nav","article","aside","address","audio","canvas","figure","hgroup","output","video","p"],a=function(e,t,n,a){var i=e;return-1!==n.search(/\bmarkdown\b/)&&(i=n+r.converter.makeHtml(t)+a),"\n\n¨K"+(r.gHtmlBlocks.push(i)-1)+"K\n\n"};t.backslashEscapesHTMLTags&&(e=e.replace(/\\<(\/?[^>]+?)>/g,function(e,t){return"<"+t+">"}));for(var o=0;o]*>)","im"),c="<"+n[o]+"\\b[^>]*>",u="";-1!==(s=i.helper.regexIndexOf(e,l));){var d=i.helper.splitAtIndex(e,s),h=i.helper.replaceRecursiveRegExp(d[1],a,c,u,"im");if(h===d[1])break;e=d[0].concat(h)}return e=e.replace(/(\n {0,3}(<(hr)\b([^<>])*?\/?>)[ \t]*(?=\n{2,}))/g,i.subParser("hashElement")(e,t,r)),e=(e=i.helper.replaceRecursiveRegExp(e,function(e){return"\n\n¨K"+(r.gHtmlBlocks.push(e)-1)+"K\n\n"},"^ {0,3}\x3c!--","--\x3e","gm")).replace(/(?:\n\n)( {0,3}(?:<([?%])[^\r]*?\2>)[ \t]*(?=\n{2,}))/g,i.subParser("hashElement")(e,t,r)),r.converter._dispatch("hashHTMLBlocks.after",e,t,r)}),i.subParser("hashHTMLSpans",function(e,t,r){function n(e){return"¨C"+(r.gHtmlSpans.push(e)-1)+"C"}return e=(e=(e=(e=(e=r.converter._dispatch("hashHTMLSpans.before",e,t,r)).replace(/<[^>]+?\/>/gi,function(e){return n(e)})).replace(/<([^>]+?)>[\s\S]*?<\/\1>/g,function(e){return n(e)})).replace(/<([^>]+?)\s[^>]+?>[\s\S]*?<\/\1>/g,function(e){return n(e)})).replace(/<[^>]+?>/gi,function(e){return n(e)}),r.converter._dispatch("hashHTMLSpans.after",e,t,r)}),i.subParser("unhashHTMLSpans",function(e,t,r){e=r.converter._dispatch("unhashHTMLSpans.before",e,t,r);for(var n=0;n]*>\\s*]*>","^ {0,3}\\s*
","gim"),r.converter._dispatch("hashPreCodeTags.after",e,t,r)}),i.subParser("headers",function(e,t,r){function n(e){var n,a;if(t.customizedHeaderId){var o=e.match(/\{([^{]+?)}\s*$/);o&&o[1]&&(e=o[1])}return n=e,a=i.helper.isString(t.prefixHeaderId)?t.prefixHeaderId:!0===t.prefixHeaderId?"section-":"",t.rawPrefixHeaderId||(n=a+n),n=t.ghCompatibleHeaderId?n.replace(/ /g,"-").replace(/&/g,"").replace(/¨T/g,"").replace(/¨D/g,"").replace(/[&+$,\/:;=?@"#{}|^¨~\[\]`\\*)(%.!'<>]/g,"").toLowerCase():t.rawHeaderId?n.replace(/ /g,"-").replace(/&/g,"&").replace(/¨T/g,"¨").replace(/¨D/g,"$").replace(/["']/g,"-").toLowerCase():n.replace(/[^\w]/g,"").toLowerCase(),t.rawPrefixHeaderId&&(n=a+n),r.hashLinkCounts[n]?n=n+"-"+r.hashLinkCounts[n]++:r.hashLinkCounts[n]=1,n}e=r.converter._dispatch("headers.before",e,t,r);var a=isNaN(parseInt(t.headerLevelStart))?1:parseInt(t.headerLevelStart),o=t.smoothLivePreview?/^(.+)[ \t]*\n={2,}[ \t]*\n+/gm:/^(.+)[ \t]*\n=+[ \t]*\n+/gm,s=t.smoothLivePreview?/^(.+)[ \t]*\n-{2,}[ \t]*\n+/gm:/^(.+)[ \t]*\n-+[ \t]*\n+/gm;e=(e=e.replace(o,function(e,o){var s=i.subParser("spanGamut")(o,t,r),l=t.noHeaderId?"":' id="'+n(o)+'"',c=""+s+"";return i.subParser("hashBlock")(c,t,r)})).replace(s,function(e,o){var s=i.subParser("spanGamut")(o,t,r),l=t.noHeaderId?"":' id="'+n(o)+'"',c=a+1,u=""+s+"";return i.subParser("hashBlock")(u,t,r)});var l=t.requireSpaceBeforeHeadingText?/^(#{1,6})[ \t]+(.+?)[ \t]*#*\n+/gm:/^(#{1,6})[ \t]*(.+?)[ \t]*#*\n+/gm;return e=e.replace(l,function(e,o,s){var l=s;t.customizedHeaderId&&(l=s.replace(/\s?\{([^{]+?)}\s*$/,""));var c=i.subParser("spanGamut")(l,t,r),u=t.noHeaderId?"":' id="'+n(s)+'"',d=a-1+o.length,h=""+c+"";return i.subParser("hashBlock")(h,t,r)}),r.converter._dispatch("headers.after",e,t,r)}),i.subParser("horizontalRule",function(e,t,r){e=r.converter._dispatch("horizontalRule.before",e,t,r);var n=i.subParser("hashBlock")("
",t,r);return e=(e=(e=e.replace(/^ {0,2}( ?-){3,}[ \t]*$/gm,n)).replace(/^ {0,2}( ?\*){3,}[ \t]*$/gm,n)).replace(/^ {0,2}( ?_){3,}[ \t]*$/gm,n),r.converter._dispatch("horizontalRule.after",e,t,r)}),i.subParser("images",function(e,t,r){function n(e,t,n,a,o,s,l,c){var u=r.gUrls,d=r.gTitles,h=r.gDimensions;if(n=n.toLowerCase(),c||(c=""),e.search(/\(? ?(['"].*['"])?\)$/m)>-1)a="";else if(""===a||null===a){if(""!==n&&null!==n||(n=t.toLowerCase().replace(/ ?\n/g," ")),a="#"+n,i.helper.isUndefined(u[n]))return e;a=u[n],i.helper.isUndefined(d[n])||(c=d[n]),i.helper.isUndefined(h[n])||(o=h[n].width,s=h[n].height)}t=t.replace(/"/g,""").replace(i.helper.regexes.asteriskDashAndColon,i.helper.escapeCharactersCallback);var f=''+t+'"}return e=(e=(e=(e=(e=(e=r.converter._dispatch("images.before",e,t,r)).replace(/!\[([^\]]*?)] ?(?:\n *)?\[([\s\S]*?)]()()()()()/g,n)).replace(/!\[([^\]]*?)][ \t]*()\([ \t]??(?: =([*\d]+[A-Za-z%]{0,4})x([*\d]+[A-Za-z%]{0,4}))?[ \t]*(?:(["'])([^"]*?)\6)?[ \t]?\)/g,function(e,t,r,a,i,o,s,l){return n(e,t,r,a=a.replace(/\s/g,""),i,o,0,l)})).replace(/!\[([^\]]*?)][ \t]*()\([ \t]?<([^>]*)>(?: =([*\d]+[A-Za-z%]{0,4})x([*\d]+[A-Za-z%]{0,4}))?[ \t]*(?:(?:(["'])([^"]*?)\6))?[ \t]?\)/g,n)).replace(/!\[([^\]]*?)][ \t]*()\([ \t]??(?: =([*\d]+[A-Za-z%]{0,4})x([*\d]+[A-Za-z%]{0,4}))?[ \t]*(?:(["'])([^"]*?)\6)?[ \t]?\)/g,n)).replace(/!\[([^\[\]]+)]()()()()()/g,n),r.converter._dispatch("images.after",e,t,r)}),i.subParser("italicsAndBold",function(e,t,r){function n(e,t,r){return t+e+r}return e=r.converter._dispatch("italicsAndBold.before",e,t,r),e=t.literalMidWordUnderscores?(e=(e=e.replace(/\b___(\S[\s\S]*?)___\b/g,function(e,t){return n(t,"","")})).replace(/\b__(\S[\s\S]*?)__\b/g,function(e,t){return n(t,"","")})).replace(/\b_(\S[\s\S]*?)_\b/g,function(e,t){return n(t,"","")}):(e=(e=e.replace(/___(\S[\s\S]*?)___/g,function(e,t){return/\S$/.test(t)?n(t,"",""):e})).replace(/__(\S[\s\S]*?)__/g,function(e,t){return/\S$/.test(t)?n(t,"",""):e})).replace(/_([^\s_][\s\S]*?)_/g,function(e,t){return/\S$/.test(t)?n(t,"",""):e}),e=t.literalMidWordAsterisks?(e=(e=e.replace(/([^*]|^)\B\*\*\*(\S[\s\S]*?)\*\*\*\B(?!\*)/g,function(e,t,r){return n(r,t+"","")})).replace(/([^*]|^)\B\*\*(\S[\s\S]*?)\*\*\B(?!\*)/g,function(e,t,r){return n(r,t+"","")})).replace(/([^*]|^)\B\*(\S[\s\S]*?)\*\B(?!\*)/g,function(e,t,r){return n(r,t+"","")}):(e=(e=e.replace(/\*\*\*(\S[\s\S]*?)\*\*\*/g,function(e,t){return/\S$/.test(t)?n(t,"",""):e})).replace(/\*\*(\S[\s\S]*?)\*\*/g,function(e,t){return/\S$/.test(t)?n(t,"",""):e})).replace(/\*([^\s*][\s\S]*?)\*/g,function(e,t){return/\S$/.test(t)?n(t,"",""):e}),r.converter._dispatch("italicsAndBold.after",e,t,r)}),i.subParser("lists",function(e,t,r){function n(e,n){r.gListLevel++,e=e.replace(/\n{2,}$/,"\n");var a=/(\n)?(^ {0,3})([*+-]|\d+[.])[ \t]+((\[(x|X| )?])?[ \t]*[^\r]+?(\n{1,2}))(?=\n*(¨0| {0,3}([*+-]|\d+[.])[ \t]+))/gm,o=/\n[ \t]*\n(?!¨0)/.test(e+="¨0");return t.disableForced4SpacesIndentedSublists&&(a=/(\n)?(^ {0,3})([*+-]|\d+[.])[ \t]+((\[(x|X| )?])?[ \t]*[^\r]+?(\n{1,2}))(?=\n*(¨0|\2([*+-]|\d+[.])[ \t]+))/gm),e=(e=e.replace(a,function(e,n,a,s,l,c,u){u=u&&""!==u.trim();var d=i.subParser("outdent")(l,t,r),h="";return c&&t.tasklists&&(h=' class="task-list-item" style="list-style-type: none;"',d=d.replace(/^[ \t]*\[(x|X| )?]/m,function(){var e='"})),d=d.replace(/^([-*+]|\d\.)[ \t]+[\S\n ]*/g,function(e){return"¨A"+e}),n||d.search(/\n{2,}/)>-1?(d=i.subParser("githubCodeBlocks")(d,t,r),d=i.subParser("blockGamut")(d,t,r)):(d=(d=i.subParser("lists")(d,t,r)).replace(/\n$/,""),d=(d=i.subParser("hashHTMLBlocks")(d,t,r)).replace(/\n\n+/g,"\n\n"),d=o?i.subParser("paragraphs")(d,t,r):i.subParser("spanGamut")(d,t,r)),""+(d=d.replace("¨A",""))+"\n"})).replace(/¨0/g,""),r.gListLevel--,n&&(e=e.replace(/\s+$/,"")),e}function a(e,t){if("ol"===t){var r=e.match(/^ *(\d+)\./);if(r&&"1"!==r[1])return' start="'+r[1]+'"'}return""}function o(e,r,i){var o=t.disableForced4SpacesIndentedSublists?/^ ?\d+\.[ \t]/gm:/^ {0,3}\d+\.[ \t]/gm,s=t.disableForced4SpacesIndentedSublists?/^ ?[*+-][ \t]/gm:/^ {0,3}[*+-][ \t]/gm,l="ul"===r?o:s,c="";if(-1!==e.search(l))!function t(u){var d=u.search(l),h=a(e,r);-1!==d?(c+="\n\n<"+r+h+">\n"+n(u.slice(0,d),!!i)+"\n",l="ul"==(r="ul"===r?"ol":"ul")?o:s,t(u.slice(d))):c+="\n\n<"+r+h+">\n"+n(u,!!i)+"\n"}(e);else{var u=a(e,r);c="\n\n<"+r+u+">\n"+n(e,!!i)+"\n"}return c}return e=r.converter._dispatch("lists.before",e,t,r),e+="¨0",e=(e=r.gListLevel?e.replace(/^(( {0,3}([*+-]|\d+[.])[ \t]+)[^\r]+?(¨0|\n{2,}(?=\S)(?![ \t]*(?:[*+-]|\d+[.])[ \t]+)))/gm,function(e,t,r){return o(t,r.search(/[*+-]/g)>-1?"ul":"ol",!0)}):e.replace(/(\n\n|^\n?)(( {0,3}([*+-]|\d+[.])[ \t]+)[^\r]+?(¨0|\n{2,}(?=\S)(?![ \t]*(?:[*+-]|\d+[.])[ \t]+)))/gm,function(e,t,r,n){return o(r,n.search(/[*+-]/g)>-1?"ul":"ol",!1)})).replace(/¨0/,""),r.converter._dispatch("lists.after",e,t,r)}),i.subParser("metadata",function(e,t,r){function n(e){r.metadata.raw=e,(e=(e=e.replace(/&/g,"&").replace(/"/g,""")).replace(/\n {4}/g," ")).replace(/^([\S ]+): +([\s\S]+?)$/gm,function(e,t,n){return r.metadata.parsed[t]=n,""})}return t.metadata?(e=(e=(e=(e=r.converter._dispatch("metadata.before",e,t,r)).replace(/^\s*«««+(\S*?)\n([\s\S]+?)\n»»»+\n/,function(e,t,r){return n(r),"¨M"})).replace(/^\s*---+(\S*?)\n([\s\S]+?)\n---+\n/,function(e,t,a){return t&&(r.metadata.format=t),n(a),"¨M"})).replace(/¨M/g,""),e=r.converter._dispatch("metadata.after",e,t,r)):e}),i.subParser("outdent",function(e,t,r){return e=(e=(e=r.converter._dispatch("outdent.before",e,t,r)).replace(/^(\t|[ ]{1,4})/gm,"¨0")).replace(/¨0/g,""),r.converter._dispatch("outdent.after",e,t,r)}),i.subParser("paragraphs",function(e,t,r){for(var n=(e=(e=(e=r.converter._dispatch("paragraphs.before",e,t,r)).replace(/^\n+/g,"")).replace(/\n+$/g,"")).split(/\n{2,}/g),a=[],o=n.length,s=0;s=0?a.push(l):l.search(/\S/)>=0&&(l=(l=i.subParser("spanGamut")(l,t,r)).replace(/^([ \t]*)/g,"

"),l+="

",a.push(l))}for(o=a.length,s=0;s]*>\s*]*>/.test(u)&&(d=!0)}a[s]=u}return e=(e=(e=a.join("\n")).replace(/^\n+/g,"")).replace(/\n+$/g,""),r.converter._dispatch("paragraphs.after",e,t,r)}),i.subParser("runExtension",function(e,t,r,n){if(e.filter)t=e.filter(t,n.converter,r);else if(e.regex){var a=e.regex;a instanceof RegExp||(a=new RegExp(a,"g")),t=t.replace(a,e.replace)}return t}),i.subParser("spanGamut",function(e,t,r){return e=r.converter._dispatch("spanGamut.before",e,t,r),e=i.subParser("codeSpans")(e,t,r),e=i.subParser("escapeSpecialCharsWithinTagAttributes")(e,t,r),e=i.subParser("encodeBackslashEscapes")(e,t,r),e=i.subParser("images")(e,t,r),e=i.subParser("anchors")(e,t,r),e=i.subParser("autoLinks")(e,t,r),e=i.subParser("simplifiedAutoLinks")(e,t,r),e=i.subParser("emoji")(e,t,r),e=i.subParser("underline")(e,t,r),e=i.subParser("italicsAndBold")(e,t,r),e=i.subParser("strikethrough")(e,t,r),e=i.subParser("ellipsis")(e,t,r),e=i.subParser("hashHTMLSpans")(e,t,r),e=i.subParser("encodeAmpsAndAngles")(e,t,r),t.simpleLineBreaks?/\n\n¨K/.test(e)||(e=e.replace(/\n+/g,"
\n")):e=e.replace(/ +\n/g,"
\n"),r.converter._dispatch("spanGamut.after",e,t,r)}),i.subParser("strikethrough",function(e,t,r){return t.strikethrough&&(e=(e=r.converter._dispatch("strikethrough.before",e,t,r)).replace(/(?:~){2}([\s\S]+?)(?:~){2}/g,function(e,n){return function(e){return t.simplifiedAutoLink&&(e=i.subParser("simplifiedAutoLinks")(e,t,r)),""+e+""}(n)}),e=r.converter._dispatch("strikethrough.after",e,t,r)),e}),i.subParser("stripLinkDefinitions",function(e,t,r){var n=function(e,n,a,o,s,l,c){return n=n.toLowerCase(),a.match(/^data:.+?\/.+?;base64,/)?r.gUrls[n]=a.replace(/\s/g,""):r.gUrls[n]=i.subParser("encodeAmpsAndAngles")(a,t,r),l?l+c:(c&&(r.gTitles[n]=c.replace(/"|'/g,""")),t.parseImgDimensions&&o&&s&&(r.gDimensions[n]={width:o,height:s}),"")};return(e=(e=(e+="¨0").replace(/^ {0,3}\[(.+)]:[ \t]*\n?[ \t]*?(?: =([*\d]+[A-Za-z%]{0,4})x([*\d]+[A-Za-z%]{0,4}))?[ \t]*\n?[ \t]*(?:(\n*)["|'(](.+?)["|')][ \t]*)?(?:\n\n|(?=¨0)|(?=\n\[))/gm,n)).replace(/^ {0,3}\[(.+)]:[ \t]*\n?[ \t]*\s]+)>?(?: =([*\d]+[A-Za-z%]{0,4})x([*\d]+[A-Za-z%]{0,4}))?[ \t]*\n?[ \t]*(?:(\n*)["|'(](.+?)["|')][ \t]*)?(?:\n+|(?=¨0))/gm,n)).replace(/¨0/,"")}),i.subParser("tables",function(e,t,r){function n(e){return/^:[ \t]*--*$/.test(e)?' style="text-align:left;"':/^--*[ \t]*:[ \t]*$/.test(e)?' style="text-align:right;"':/^:[ \t]*--*[ \t]*:$/.test(e)?' style="text-align:center;"':""}function a(e,n){var a="";return e=e.trim(),(t.tablesHeaderId||t.tableHeaderId)&&(a=' id="'+e.replace(/ /g,"_").toLowerCase()+'"'),""+(e=i.subParser("spanGamut")(e,t,r))+"\n"}function o(e,n){return""+i.subParser("spanGamut")(e,t,r)+"\n"}function s(e){var s,l=e.split("\n");for(s=0;s\n\n\n",a=0;a\n";for(var i=0;i\n"}return r+"\n\n"}(h,p)}return t.tables?(e=(e=(e=(e=r.converter._dispatch("tables.before",e,t,r)).replace(/\\(\|)/g,i.helper.escapeCharactersCallback)).replace(/^ {0,3}\|?.+\|.+\n {0,3}\|?[ \t]*:?[ \t]*(?:[-=]){2,}[ \t]*:?[ \t]*\|[ \t]*:?[ \t]*(?:[-=]){2,}[\s\S]+?(?:\n\n|¨0)/gm,s)).replace(/^ {0,3}\|.+\|[ \t]*\n {0,3}\|[ \t]*:?[ \t]*(?:[-=]){2,}[ \t]*:?[ \t]*\|[ \t]*\n( {0,3}\|.+\|[ \t]*\n)*(?:\n|¨0)/gm,s),r.converter._dispatch("tables.after",e,t,r)):e}),i.subParser("underline",function(e,t,r){return t.underline?(e=r.converter._dispatch("underline.before",e,t,r),e=(e=t.literalMidWordUnderscores?(e=e.replace(/\b___(\S[\s\S]*?)___\b/g,function(e,t){return""+t+""})).replace(/\b__(\S[\s\S]*?)__\b/g,function(e,t){return""+t+""}):(e=e.replace(/___(\S[\s\S]*?)___/g,function(e,t){return/\S$/.test(t)?""+t+"":e})).replace(/__(\S[\s\S]*?)__/g,function(e,t){return/\S$/.test(t)?""+t+"":e})).replace(/(_)/g,i.helper.escapeCharactersCallback),e=r.converter._dispatch("underline.after",e,t,r)):e}),i.subParser("unescapeSpecialChars",function(e,t,r){return e=(e=r.converter._dispatch("unescapeSpecialChars.before",e,t,r)).replace(/¨E(\d+)E/g,function(e,t){var r=parseInt(t);return String.fromCharCode(r)}),r.converter._dispatch("unescapeSpecialChars.after",e,t,r)}),i.subParser("makeMarkdown.blockquote",function(e,t){var r="";if(e.hasChildNodes())for(var n=e.childNodes,a=n.length,o=0;o "+(r=r.trim()).split("\n").join("\n> ")}),i.subParser("makeMarkdown.codeBlock",function(e,t){var r=e.getAttribute("language"),n=e.getAttribute("precodenum");return"```"+r+"\n"+t.preList[n]+"\n```"}),i.subParser("makeMarkdown.codeSpan",function(e){return"`"+e.innerHTML+"`"}),i.subParser("makeMarkdown.emphasis",function(e,t){var r="";if(e.hasChildNodes()){r+="*";for(var n=e.childNodes,a=n.length,o=0;o",e.hasAttribute("width")&&e.hasAttribute("height")&&(t+=" ="+e.getAttribute("width")+"x"+e.getAttribute("height")),e.hasAttribute("title")&&(t+=' "'+e.getAttribute("title")+'"'),t+=")"),t}),i.subParser("makeMarkdown.links",function(e,t){var r="";if(e.hasChildNodes()&&e.hasAttribute("href")){var n=e.childNodes,a=n.length;r="[";for(var o=0;o",e.hasAttribute("title")&&(r+=' "'+e.getAttribute("title")+'"'),r+=")"}return r}),i.subParser("makeMarkdown.list",function(e,t,r){var n="";if(!e.hasChildNodes())return"";for(var a=e.childNodes,o=a.length,s=e.getAttribute("start")||1,l=0;l"+t.preList[r]+""}),i.subParser("makeMarkdown.strikethrough",function(e,t){var r="";if(e.hasChildNodes()){r+="~~";for(var n=e.childNodes,a=n.length,o=0;otr>th"),l=e.querySelectorAll("tbody>tr");for(r=0;rp&&(p=g)}for(r=0;r/g,"\\$1>")).replace(/^#/gm,"\\#")).replace(/^(\s*)([-=]{3,})(\s*)$/,"$1\\$2$3")).replace(/^( {0,3}\d+)\./gm,"$1\\.")).replace(/^( {0,3})([+-])/gm,"$1\\$2")).replace(/]([\s]*)\(/g,"\\]$1\\(")).replace(/^ {0,3}\[([\S \t]*?)]:/gm,"\\[$1]:")}),e.exports?e.exports=i:this.showdown=i}).call(t)}),he={pangu:a,minimatch:D,beautify:te,style:le,rdability:ue,markdown:Object.freeze({default:de,__moduleExports:de})};e.Plugin=function(e){return void 0==e?he:he[e]},Object.defineProperty(e,"__esModule",{value:!0})}); diff --git a/webpack.config.js b/webpack.config.js index b274ee38..b306aed6 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -308,8 +308,8 @@ const webpack = require( 'webpack' ), tooltip : __dirname + '/src/vender/mduikit/tooltip.jsx', waves : __dirname + '/src/vender/mduikit/waves.js', - puread : __dirname + '/src/vender/puread/puread.js', - puplugin : __dirname + '/src/vender/puread/plugin.js', + puread : __dirname + '/src/vender/puread/puread.min.js', + puplugin : __dirname + '/src/vender/puread/puplugin.min.js', } } From 17ff3b7be8fcefc4664fdce8e396696489468590 Mon Sep 17 00:00:00 2001 From: Kenshin Date: Tue, 23 Apr 2019 14:46:42 +0800 Subject: [PATCH 22/43] Remove old source. --- src/vender/puread/adaptesite.js | 595 --------------- src/vender/puread/plugin.js | 34 - src/vender/puread/plugin/beautify.js | 398 ---------- src/vender/puread/plugin/minimatch.js | 923 ----------------------- src/vender/puread/plugin/pangu.min.js | 10 - src/vender/puread/plugin/readability.js | 45 -- src/vender/puread/plugin/showdown.min.js | 3 - src/vender/puread/plugin/stylesheet.js | 198 ----- src/vender/puread/puread.js | 233 ------ src/vender/puread/util.js | 167 ---- 10 files changed, 2606 deletions(-) delete mode 100644 src/vender/puread/adaptesite.js delete mode 100644 src/vender/puread/plugin.js delete mode 100644 src/vender/puread/plugin/beautify.js delete mode 100644 src/vender/puread/plugin/minimatch.js delete mode 100644 src/vender/puread/plugin/pangu.min.js delete mode 100644 src/vender/puread/plugin/readability.js delete mode 100644 src/vender/puread/plugin/showdown.min.js delete mode 100644 src/vender/puread/plugin/stylesheet.js delete mode 100644 src/vender/puread/puread.js delete mode 100644 src/vender/puread/util.js diff --git a/src/vender/puread/adaptesite.js b/src/vender/puread/adaptesite.js deleted file mode 100644 index 2ff728fb..00000000 --- a/src/vender/puread/adaptesite.js +++ /dev/null @@ -1,595 +0,0 @@ -console.log( "=== PureRead: AdapteSite load ===" ) - -import * as util from './util'; - -const site = { - url : "", - target : "", - matching : [], - name : "", // only read mode - title : "", // only read mode - desc : "", // only read mode - exclude : [], - include : "", - avatar : [], - paging : [], -}; -let minimatch, rdability, markdown, host_href; - -export default class AdapteSite { - - constructor( sites = { global:[], custom:[], local:[] } ) { - this.url = util.getURI(); - this.sites = sites; // include: global, custom, local, person - this.current = {}; - this.state = "none"; // include: meta, txt, adapter, none, temp - this.origins = []; - host_href = location.href; // origin url - } - - /** - * Set url - */ - SetURL( value ) { - const uri = util.getLocation( value ); - // Clone util.getURI() source - const name = (pathname) => { - pathname = pathname != "/" && pathname.endsWith("/") ? pathname = pathname.replace( /\/$/, "" ) : pathname; - return pathname.replace( /\/[%@#.~a-zA-Z0-9_-]+$|^\/$/g, "" ); - }, - path = name( uri.pathname ); - this.url = `${ uri.protocol }//${ uri.hostname }${ path }/`; - host_href = value; - } - - /** - * Set global minimatch - */ - SetMinimatch( value ) { - minimatch = value; - } - - /** - * Set global rdability - */ - SetRdability( value ) { - rdability = value; - } - - /** - * Set global markdown - */ - SetMarkdown( value ) { - markdown = value; - } - - /** - * Not adapter usage mozilla readability and readtmpl - */ - Readability() { - try { - const location = document.location, - uri = { - spec : location.href, - host : location.host, - prePath : location.protocol + "//" + location.host, - scheme : location.protocol.substr(0, location.protocol.indexOf(":")), - pathBase: location.protocol + "//" + location.host + location.pathname.substr(0, location.pathname.lastIndexOf("/") + 1) - }, - article = new rdability.Readability( uri, document.cloneNode(true) ).parse(); - if ( article && article.content != "" ) { - console.warn( "current parse is Readability", article ) - this.Newsite( "read", article.content ); - this.dom = $(article.content)[0]; - this.state = "temp"; - } else throw "Readability error"; - } catch ( error ) { - const $dom = readtmpl(); - if ( $dom != -1 ) { - this.Newsite( "read", $dom[0].outerHTML ); - this.dom = $dom[0]; - this.state = "temp"; - } else this.current.site = util.clone( site ); - } - } - - /** - * Get site from url - * - * @param {string} include: global, custom, local - * @param {string} url - */ - Getsite( type, url ) { - return this.sites[type].find( item => item[0] == url ); - } - - /** - * Get sites from url - */ - Getsites() { - const matching = [], - meta = readmeta(); - this.current.url = this.url; - if ( meta ) { - this.current.auto = meta.auto; - this.current.url = meta.url; - delete meta.auto; - delete meta.url; - this.current.site = { ...meta }; - this.current.site.name.startsWith( "metaread::" ) && ( this.state = "meta" ); - this.current.site.name.startsWith( "txtread::" ) && ( this.state = "txt" ); - } else { - getsite( "local", new Map( this.sites.local ), this.url, matching ); - getsite( "global", new Map( this.sites.global ), this.url, matching ); - getsite( "person", new Map( this.sites.person ), this.url, matching ); - getsite( "custom", new Map( this.sites.custom ), this.url, matching ); - if ( matching.length > 0 ) { - let found; - matching.forEach( site => { - if ( site[1].active ) { - found = site; - this.current.url = found[0]; - this.current.site = this.Safesite({ ...found[1] }, found[2], found[0] ); - this.state = "adapter"; - } - }); - if ( !found ) { - const found = matching[0]; - found[1].active = true; - this.current.url = found[0]; - this.current.site = this.Safesite({ ...found[1] }, found[2], found[0] ); - this.state = "adapter"; - } - } else { - const obj = readmulti(); - if ( obj != -1 ) { - this.Newmultisite( "read", obj ); - this.state = "temp"; - } else { - this.Readability(); - } - } - } - this.current.site.matching = matching; - } - - /** - * Add new sites to this.sites.global( global sites ) - * - * @param {object} sites.[array] - * @return {int} update sites count - */ - Addsites( result ) { - let count = 0; - if ( this.sites.global.length == 0 ) { - this.sites.global = this.Formatsites( result ); - count = this.sites.global.length; - } - else { - const obj = addsites( this.Formatsites( result ), this.sites.global ); - count = obj.count; - this.sites.global = obj.newsites; - } - return count; - } - - /** - * Add new sites to this.sites.local( local sites ) - * - * @param {object} new sites - * @return {array} this.sites.local - */ - Addlocalsites( new_sites ) { - this.sites.local = [ ...new_sites ]; - return this.sites.local; - } - - /** - * Add all sites to this.sites - * - * @param {object} new sites - * @return {object} this.sites - */ - Addallsites( sites ) { - this.sites = { - global: [ ...sites.global ], - person: [ ...sites.person ], - custom: [ ...sites.custom ], - local : [ ...sites.local ], - }; - return this.sites; - } - - /** - * Add new site( read only ) - * - * @param {string} include: focus, read - * @param {string} when read html is dom.outerHTML - */ - Newsite( mode, html ) { - const new_site = { mode, url: window.location.href, site: { name: `tempread::${window.location.host}`, title: "", desc: "", include: "", exclude: [] } }; - html && ( new_site.site.html = html ); - this.current.mode = new_site.mode, - this.current.url = new_site.url; - this.current.site = this.Safesite({ ...new_site.site }, "local", new_site.url ); - console.log( "【read only】current site object is ", this.current ) - } - - /** - * Add new multi-site( read only ) - * - * @param {string} include: focus, read - * @param {object} multi-page, avator, include - */ - Newmultisite( mode, multi ) { - const new_site = { mode, url: window.location.href, site: { name: `tempread::${window.location.host}`, title: "<title>", desc: "", include: multi.include, exclude: [], avatar: multi.avatar } }; - this.current.mode = new_site.mode, - this.current.url = new_site.url; - this.current.site = this.Safesite({ ...new_site.site }, "local", new_site.url ); - console.log( "【read only】current multi-site object is ", this.current ) - } - - /** - * Update url and site from param - * - * @param {string} value is: global, custom, local - * @param {string} older url - * @param {array} [ url, new site] - */ - Updatesite( key, older, newer ) { - let idx = this.sites[key].findIndex( item => item[0] == older ); - idx == -1 && ( idx = this.sites[key].length ); - this.sites[key].splice( idx, 1, newer ); - } - - /** - * Delete site from this.sites.local - * - * @param {string} value is: global, custom, local - * @param {string} older url - * @param {func} callback - */ - Deletesite( key, older, callback ) { - let idx = this.sites[key].findIndex( item => item[0] == older ); - idx != -1 && this.sites[key].splice( idx, 1 ); - callback( idx ); - } - - /** - * Safe site, add all site props - * - * @param {object} modify site - * @param {string} target include: global custom local - * @param {string} url - * @returns {object} site - */ - Safesite( site, target, url ) { - site.url = url; - site.target = target; - site.name == "" && ( site.name = "tempread::" ); - ( !site.avatar || site.avatar.length == 0 ) && ( site.avatar = [{ name: "" }, { url: "" }]); - ( !site.paging || site.paging.length == 0 ) && ( site.paging = [{ prev: "" }, { next: "" }]); - return site; - } - - /** - * Clean useless site props - * - * @param {object} site - * @returns {object} site - */ - Cleansite( site ) { - delete site.url; - delete site.html; - delete site.target; - delete site.matching; - site.avatar && site.avatar.length > 0 && site.avatar[0].name == "" && delete site.avatar; - site.paging && site.paging.length > 0 && site.paging[0].prev == "" && delete site.paging; - return site; - } - - /** - * Format sites object from local or remote json file - * - * @param {object} sites.[array] - * @return {array} foramat e.g. [[ <url>, object ],[ <url>, object ]] - */ - Formatsites( result ) { - const format = new Map(); - for ( let site of result.sites ) { - if ( verifysite( site ) != 0 ) continue; - const url = site.url; - delete site.url; - format.set( url, site ); - } - return [ ...format ]; - } - - /** - * Clear sites - * - * @param {string} site type, only include: global, custom. local - */ - Clearsites( type ) { - type ? ( this.sites[type] = [] ) : ( this.sites = { global:[], custom:[], local:[] }); - } - - /** - * Add urls to origins - * - * @param {json} result json - */ - Origins( result ) { - let urls = result.origins.map( item => item.url ); - urls = new Set( this.origins.concat( urls ) ); - urls.forEach( item => { - if ( item.trim() == "" || !item.trim().startsWith( "http" ) || !item.trim().endsWith( ".json" ) ) urls.delete( item ); - }); - this.origins = [ ...urls ]; - return this.origins; - } - - /** - * Add new sites to this.sites.custom( custom sites ) - * - * @param {object} new sites - * @return {array} this.sites.custom - */ - Addorigins( new_sites ) { - this.sites.custom = [ ...new_sites ]; - return this.sites.custom; - } - - /** - * Clear origins - * - * @returns custom.length - */ - Clearorigins() { - const len = this.sites.custom.length; - this.sites.custom = []; - return len; - } - -} - -/** - * Get readmeta, inlcude: txtread and metaread - * - * @return {object} meata data or undefined - */ -function readmeta() { - if ( minimatch( location.href, "file://**/*.txt" ) || minimatch( location.href, "http*://**/*.txt" ) ) { - return readtxt(); - } - if ( minimatch( location.href, "file://**/*.md" ) || minimatch( location.href, "http*://**/*.md" ) ) { - return readmd(); - } - const reg = /<\S+ (class|id)=("|')?[\w-_=;:' ]+("|')?>?$|<[^/][-_a-zA-Z0-9]+>?$/ig, // from util.verifyHtml() - meta = { - name : $( "meta[name='simpread:name']" ).attr( "content" ), - url : $( "meta[name='simpread:url']" ).attr( "content" ), - title : $( "meta[name='simpread:title']" ).attr( "content" ), - desc : $( "meta[name='simpread:desc']" ).attr( "content" ), - include: $( "meta[name='simpread:include']" ).attr( "content" ), - exp : $( "meta[name='simpread:exclude']" ).attr( "content" ), - auto : $( "meta[name='simpread:auto']" ).attr( "content" ), - exclude: [], - }; - if ( meta.name && meta.include ) { - if ( meta.url && !minimatch( location.href, meta.url )) { - return undefined; - } - !meta.title && ( meta.title = "<title>" ); - !meta.desc && ( meta.desc = "" ); - !meta.exp && ( meta.exp = "" ); - meta.name = `metaread::${meta.name}`; - meta.auto = meta.auto == "true" ? true : false; - const idx = [ "title", "desc", "include", "exp" ].findIndex( item => meta[item] != "" && !meta[item].match( reg )); - meta.exclude.push( meta.exp ); - delete meta.exp; - console.assert( idx == -1, "meta read mode error. ", meta ) - return idx == -1 ? meta : undefined; - } else { - console.warn( "current not found meta data", meta ) - return undefined; - } -} - -/** - * Read txt, include: file and http - */ -function readtxt() { - const title = location.pathname.split( "/" ).pop(), - type = location.protocol == "file:" ? "local" : "remote", - meta = { - name : `txtread::${type}`, - title : "<title>", - desc : "", - include: "<pre>", - auto : false, - exclude: [], - }; - if ( type == "remote" ) { - meta.include = ""; - meta.html = $( "body pre" ).html().replace( /\n/ig, "<br>" ); - } - !$( "title" ).html() && $( "head" ).append( `<title>${ decodeURI(title.replace( ".txt", "" )) }` ); - return meta; -} - -/** - * Read Markdown, include: file and http - */ -function readmd() { - const title = location.pathname.split( "/" ).pop(), - type = location.protocol == "file:" ? "local" : "remote", - meta = { - name : `txtread::${type}`, - title : "", - desc : "", - include: "", - auto : false, - exclude: [], - }; - const converter = new markdown.default.Converter(), - html = converter.makeHtml( $( "body pre" ).text() ); - meta.html = html; - !$( "title" ).html() && $( "head" ).append( `<title>${ decodeURI(title.replace( ".md", "" )) }` ); - return meta; -} - -/** - * Read mode template, include: - * - * - Hexo - * - WordPress - * - Common( include
) - * - * @return {jquery} jquery object - */ -function readtmpl() { - const $root = $( "body" ), - selectors = [ - ".post-content", ".entry-content", ".post-article", ".content-post", ".article-entry", ".article-content", - ".article-body", ".markdown-body", - "[itemprop='articleBody']", - "article", - ".post", ".content", - ]; - for ( const selector of selectors ) { - const $target = $root.find( selector ); - if ( $target.length > 0 ) { - console.warn( "current selector is", selector ); - return $target; - } - } - return -1; -} - -/** - * Read mode multi template, include: - * - * - Discuz - * - Discourse - * - * @return {object} true: object; false: -1 - */ -function readmulti() { - if ( location.pathname.includes( "thread" ) || location.pathname.includes( "forum.php" ) ) { - if ( $('.t_f').length > 0 && $('.favatar').find('.authi').length > 0 && $('.avatar').find('img').length > 0 ) { - return { - avatar: [ - {"name" : "[[{$('.favatar').find('.authi')}]]"}, - {"url" : "[[{$('.avatar').find('img')}]]"} - ], - include: "[[{$('.t_f')}]]" - }; - } - } else if ( /\/t\/[\w-]+\/\d+/.test( location.pathname ) && $('meta[name=generator]').attr("content").includes("discourse") ) { - return { - avatar: [ - {"name" : "[[{$('.topic-avatar').find('.a[data-user-card]')}]]"}, - {"url" : "[[{$('.topic-avatar').find('img')}]]"} - ], - include: "[[{$('.cooked')}]]" - }; - } - return -1; -} - -/** - * Add new sites to old sites - * - * @param {array} new sites from local or remote - * @param {array} current sites from this.sites.global - * @return {object} count: new sites; forced: update sites( discard, all site must be forced update) - */ -function addsites( newsites, old ) { - const oldsites = new Map( old ), - urls = [ ...oldsites.keys() ]; - let [ count, forced ] = [ 0, 0 ]; - newsites.map( site => { - if ( !urls.includes( site[0] ) ) { - count++; - } else if ( urls.includes( site[0] )) { - forced++; - } - }); - return { count, newsites }; -} - -/** - * Find site by url from sites - * - * @param {string} type, include: global, local, custom - * @param {map} sites - * @param {string} url - * @param {array} matching sites - * - * @return {array} 0: current site; 1: current url, 2: type - */ -function getsite( type, sites, url, matching = [] ) { - const domain = (names)=>{ - const arr = names.replace( "www.", "" ).match( /\.\S+\.\S+/g ); - if ( arr ) { - return arr[0].substr(1); - } else { - return names.replace( "www.", "" ); - } - }, - local = util.getLocation( host_href ), - urls = [ ...sites.keys() ], - arr = url.match( /[.a-zA-z0-9-_]+/g ), - uri = arr[1].replace( "www.", "" ), - hostname = domain( local.hostname ), - isroot = ()=>local.pathname == "/" || /\/(default|index|portal).[0-9a-zA-Z]+$/.test(local.pathname); - for ( const cur of urls ) { - const name = sites.get(cur).name, - sufname= domain( name ); - if ( !isroot() && !cur.endsWith( "*" ) && cur.replace( /^http[s]?:/, "" ) == url.replace( /^http[s]?:/, "" ) ) { - matching.push( [ cur, util.clone( sites.get( cur )), type ] ); - } else if ( cur.match( /\*/g ) && cur.match( /\*/g ).length == 1 && !isroot() && cur.endsWith( "*" ) && uri.includes( sufname ) && hostname == sufname && url.includes( name ) ) { - // e.g. https://www.douban.com/* http://mp.weixin.qq.com/* - matching.push( [ cur, util.clone( sites.get( cur )), type ] ); - } else if ( minimatch( local.origin + local.pathname, cur ) ) { - matching.push( [ cur, util.clone( sites.get( cur )), type ] ); - } - } -} - -/** - * Verify site validity, include: - * - name, url, include, error is -1 - * - title include desc, error is -2 - * - paging, error is -3 ~ -6 - * - avatar, error is -7 ~ -10 - * - * @param {object} site - */ -function verifysite( site ) { - if ( !site.name || !site.url || !site.include ) return -1; - if ( util.verifyHtml( site.title )[0] == -1 || - util.verifyHtml( site.include )[0] == -1 || - util.verifyHtml( site.desc )[0] == -1 - ) { - return -2; - } - if ( site.paging ) { - if ( site.paging.length != 2 ) return -3; - if ( !site.paging[0].prev ) return -4; - if ( !site.paging[1].next ) return -5; - if ( util.verifyHtml( site.paging[0].prev )[0] == -1 || util.verifyHtml( site.paging[1].next )[0] == -1 ) { - return -6; - } - } - if ( site.avatar ) { - if ( site.avatar.length != 2 ) return -7; - if ( !site.avatar[0].name ) return -8; - if ( !site.avatar[1].url ) return -9; - if ( util.verifyHtml( site.avatar[0].name )[0] == -1 || util.verifyHtml( site.avatar[1].url )[0] == -1 ) { - return -10; - } - } - return 0; -} diff --git a/src/vender/puread/plugin.js b/src/vender/puread/plugin.js deleted file mode 100644 index 7c9ea66d..00000000 --- a/src/vender/puread/plugin.js +++ /dev/null @@ -1,34 +0,0 @@ -console.log( "=== PureRead: Plugin load ===" ) - -import pangu from './plugin/pangu.min'; -import minimatch from './plugin/minimatch'; -import * as be from './plugin/beautify'; -import * as ss from './plugin/stylesheet'; -import * as rda from './plugin/readability'; -import * as md from './plugin/showdown.min'; - -const plugins = { - pangu : pangu, - minimatch: minimatch, - beautify : be, - style : ss, - rdability: rda, - markdown : md, -}; - -/** - * Get PureRead Plugin - * - * @param {string} plugin name, when undefined, return all plugin - * @return {object} all plugins - * {string} plgin - */ -export function Plugin( type ) { - let result; - if ( type == undefined ) { - result = plugins; - } else { - result = plugins[type]; - } - return result; -} \ No newline at end of file diff --git a/src/vender/puread/plugin/beautify.js b/src/vender/puread/plugin/beautify.js deleted file mode 100644 index 11a99988..00000000 --- a/src/vender/puread/plugin/beautify.js +++ /dev/null @@ -1,398 +0,0 @@ -console.log( "=== PureRead: Beautify load ===" ) - -/** - * Beautify html - * - * @param {string} storage.current.site.name - */ -function specbeautify( name, $target ) { - switch ( name ) { - case "sspai.com": - //TO-DO - $target.find( ".relation-apps" ).remove(); - $target.find( ".ss-app-card" ).remove(); - break; - case "post.smzdm.com": - $target.find( "img.face" ).addClass( "sr-rd-content-nobeautify" ); - $target.find( ".insert-outer img" ).addClass( "sr-rd-content-nobeautify" ); - break; - case "infoq.com": - $target.find( "img" ).map( (index, item) => { - if ( $(item).css("float") == "left" ) { - $(item).addClass( "sr-rd-content-nobeautify" ); - } - }); - $target.find( "script" ).remove(); - break; - case "appinn.com": - $target.find( ".emoji" ).addClass( "sr-rd-content-nobeautify" ); - break; - case "hacpai.com": - $target.find( ".emoji" ).addClass( "sr-rd-content-nobeautify" ); - break; - case "douban.com": - $target.find( ".review-content" ).children().unwrap(); - $target.find( "table" ).addClass( "sr-rd-content-center" ); - $target.find( "p" ).css({"white-space": "pre-wrap"}); - $target.find( ".cc" ).removeClass(); - break; - case "qdaily.com": - $target.find( "img" ).map( (index, item) => { - const $target = $(item), - height = Number.parseInt($target.css("height")); - if ( height == 0 ) $target.remove(); - }); - $target.find( ".com-insert-images" ).map( (index, item) => { - const $target = $(item), - imgs = $target.find( "img" ).map( (index, item)=>`
${item.outerHTML}
` ), - str = imgs.get().join( "" ); - $target.empty().removeAttr( "class" ).append( str ); - }); - $target.find( ".com-insert-embed" ).remove(); - break; - case "news.mtime.com": - $target.find( ".newspictool" ).map( ( index, item ) => { - const $target = $(item), - $img = $target.find( "img" ), - $label = $target.find( "p:last" ); - $target.removeAttr( "class" ).addClass( "sr-rd-content-center" ).empty().append( $img ).append( $label ); - }); - break; - case "blog.csdn.net": - $target.find( ".save_code" ).remove(); - $target.find( ".pre-numbering" ).remove(); - $target.find( "pre" ).removeAttr( "style" ).removeAttr( "class" ); - $target.find( "code" ).removeAttr( "style" ); - $target.find( ".dp-highlighter" ).map( ( index, item )=> { - $(item).find(".bar .tools").remove(); - if ( $(item).next().is( "pre" )) $(item).next().remove(); - }); - break; - case "news.sohu.com": - $target.find( ".conserve-photo" ).remove(); - $target.find( "table" ).addClass( "sr-rd-content-center" ); - break; - case "qq.com": - $target.find( ".rv-root-v2, #backqqcom" ).remove(); - break; - case "azofreeware.com": - $target.find( "iframe" ).remove(); - break; - case "apprcn.com": - $target.find( "img" ).map( ( index, item ) => { - const $target = $(item), - src = $target.attr( "src" ); - if ( src && src.includes( "Apprcn_Wechat_Small.jpeg" ) ) $target.parent().remove(); - }); - $target.find( "a" ).map( ( index, item ) => { - const $target = $(item), - text = $target.text(); - if ( text == "来自反斗软件" ) $target.parent().remove(); - }); - break; - case "tieba.baidu.com": - $target.find( ".BDE_Smiley" ).addClass( "sr-rd-content-nobeautify" ); - $target.find( ".replace_div" ).removeAttr( "class" ).removeAttr( "style" ); - $target.find( ".replace_tip" ).remove(); - $target.find( ".d_post_content, .j_d_post_content, .post_bubble_top, .post_bubble_middle, .post_bubble_bottom" ).map( ( idx, target ) => { - $( target ).removeAttr( "class" ).removeAttr( "style" ); - }); - $( "body" ).find( ".p_author_face" ).map( ( idx, target ) => { - const $target = $( target ).find( "img" ), - src = $target.attr( "data-tb-lazyload" ), - name = $target.attr( "username" ); - src && $( "sr-rd-mult-avatar" ).find( "span" ).map( ( idx, span ) => { - const $span = $( span ), - text = $span.text(); - if ( text == name ) { - $span.parent().find( "img" ).attr( "src", src ); - } - }); - }); - break; - case "jingyan.baidu.com": - $target.find( ".exp-image-wraper" ).removeAttr( "class" ).removeAttr( "href" ); - break; - case "question.zhihu.com": - $target.find( ".zu-edit-button" ).remove(); - $target.find( "a.external" ).map( ( idx, target ) => { - $( target ).removeAttr( "class" ) - .attr( "style", "border: none;" ); - }); - $target.find( ".VagueImage" ).map( ( idx, target ) => { - const $target = $( target ), - src = $target.attr( "data-src" ); - $target.replaceWith( `` ) - }); - break; - case "chiphell.com": - $target.find( "img" ).map( ( index, item ) => { - const $target = $(item), - $parent = $target.parent(), - src = $target.attr( "src" ), - smilieid= $target.attr( "smilieid" ); - if ( $parent.is( "ignore_js_op" )) $target.unwrap(); - smilieid && src && src.includes( "static/image/smiley" ) && - $target.addClass( "sr-rd-content-nobeautify" ).attr( "style", "width: 50px;" ); - }); - $target.find( ".quote" ).remove(); - break; - case "jiemian.com": - $target.find( "script" ).remove(); - break; - case "36kr.com": - $target.find( ".load-html-img" ).removeAttr( "class" ); - break; - case "cnblogs.com": - $target.find( ".cnblogs_code" ).removeClass(); - $target.find( ".cnblogs_code_hide" ).removeClass().removeAttr( "style" ); - $target.find( ".cnblogs_code_toolbar" ).remove(); - $target.find( ".code_img_opened" ).remove(); - $target.find( ".code_img_closed" ).remove(); - break; - case "news.cnblogs.com": - $target.find( ".topic_img" ).remove(); - break; - case "g-cores.com": - $target.find( ".swiper-slide-active" ).find( "img" ).map( ( index, item ) => { - const $target = $(item); - $target.parent().parent().parent().parent().parent().parent().removeAttr( "class" ).removeAttr( "style" ).html($target); - }); - break; - case "feng.com": - $target.find( "span" ).removeAttr( "style" ); - break; - case "young.ifeng.com": - $target.find( "span" ).removeAttr( "style" ); - break; - case "ftchinese.com": - $target.find( "script" ).remove(); - break; - case "segmentfault.com": - $target.find( ".widget-codetool" ).remove(); - break; - case "mp.weixin.qq.com": - $target.find( 'section[powered-by="xiumi.us"]' ).find( "img" ).map( ( index, item ) => { - const $target = $(item), - src = $target.attr( "data-src" ); - $target.addClass( "sr-rd-content-nobeautify" ).attr( "src", src ); - }); - break; - case "ruby-china.org": - $target.find( ".twemoji" ).remove(); - break; - case "w3cplus.com": - $target.find( "iframe" ).addClass( "sr-rd-content-nobeautify" ); - break; - case "zuojj.com": - $target.find( ".syntaxhighlighter .Brush" ).attr( "style", "font-size: .7em !important;" ) - break; - case "aotu.io": - $target.find( ".highlight table" ).map( ( index, item ) => { - const $target = $(item), - $pre = $target.find( "pre" ), - $table = $target.find( "table" ); - $target.html( $pre[1] ); - $table.unwrap(); - }); - $target.find( "table" ).addClass( "sr-rd-content-center" ); - break; - case "colobu.com": - $target.find( ".highlight table" ).map( ( index, item ) => { - const $target = $(item), - $pre = $target.find( "pre" ); - $target.html( $pre[1] ); - $target.unwrap(); - }); - break; - case "hao.caibaojian.com": - $target.find( ".tlink" ).map( ( index, item ) => { - const $target = $(item); - $target.html( "" ); - }); - break; - case "wkee.net": - $target.find( "script" ).remove(); - break; - case "linux.cn": - $target.find( "pre" ).attr( "style", "background-color: #161b20; background-image: none;" ); - $target.find( "code" ).attr( "style", "background-color: transparent; background-image: none;" ); - break; - case "zhuanlan.zhihu.com": - $target.find( "div[data-src]" ).map( ( index, item ) => { - const $target = $(item), - src = $target.attr( "data-src" ); - $target.replaceWith( `
` ); - }); - break; - case "jianshu.com": - $target.find( ".image-package" ).map( ( index, item ) => { - const $target = $( item ), - $div = $target.find( "img" ); - $target.html( $div ); - }); - break; - case "medium.com": - $target.find( "figure" ).map( ( index, item ) => { - const $target = $(item), - $img = $target.find( "img" ); - $target.replaceWith( `
` ); - }); - break; - case "worldcup.fifa.com": - $target.find( "iframe" ).css({ width: "790px", height: "450px" }); - $target.find( "div" ).removeClass(); - break; - } -} - -/** - * Remove spare tag - * - * @param {string} storage.current.site.name - * @param {jquery} jquery object - */ -function removeSpareTag( name, $target ) { - let [ remove, tag ] = [ false, "" ]; - if ([ "lib.csdn.net", "huxiu.com", "my.oschina.net", "caixin.com", "163.com", "steachs.com", "hacpai.com", "apprcn.com", "mp.weixin.qq.com" ].includes( name )) { - [ remove, tag ] = [ true, "p" ]; - } else if ([ "nationalgeographic.com.cn", "dgtle.com", "news.mtime.com" ].includes( name )) { - [ remove, tag ] = [ true, "div" ]; - } else if ( ["chiphell.com"].includes( name ) ) { - [ remove, tag ] = [ true, "font" ]; - } - if ( remove ) { - $target.find( tag ).map( ( index, item ) => { - const str = $(item).text().toLowerCase().trim(); - if ( $(item).find( "img" ).length == 0 && str == "" ) $(item).remove(); - }); - } -} - -/** - * Beautify html, incldue: - * - * - change all
to - * - remove useless
- * - * @param {jquery} jquery object - */ -function htmlbeautify( $target ) { - try { - $target.html( ( index, html ) => { - return html.trim() - .replace( /<\/?blockquote/g, (value) => value[1] == "/" ? "\n?
(\n?
)*/g, "
" ) - .replace( /\/(div|p)>\n*(
\n)+/g, (value) =>value.replace( "
", "" )); - }); - } catch ( error ) { - console.error( error ); - return $target.html(); - } -} - -/** - * Common Beautify html, include: - * - task: all webiste image, remove old image and create new image - * - task: all webiste sr-blockquote, remove style - * - task: all webiste iframe, embed add center style - * - task: all hr tag add simpread-hidden class - * - task: all pre/code tag remove class - * - task: all a tag remove style - * - * @param {jquery} - */ -function commbeautify( name, $target ) { - $target.find( "img:not(.sr-rd-content-nobeautify)" ).map( ( index, item ) => { - const $target = $(item), - $orgpar = $target.parent(), - $img = $( "" ), - src = $target.attr( "src" ), - lazysrc = $target.attr( "data-src" ), - zuimei = $target.attr( "data-original" ), - cnbeta = $target.attr( "original" ), - jianshu = $target.attr( "data-original-src" ), - sina = $target.attr( "real_src" ), - fixOverflowImgsize = () => { - $img.removeClass( "sr-rd-content-img-load" ); - if ( $img[0].clientWidth < 400 ) { - $img.parent().removeClass( "sr-rd-content-center" ).addClass( "sr-rd-content-center-small" ); - } else if ( $img[0].clientWidth > 1000 ) { - $img.css( "zoom", "0.6" ); - } else if ( $img[0].clientHeight > 620 ) { - if ( /win|mac/i.test(navigator.platform) ) { - $img.attr( "height", 620 ); - if ( $img[0].clientWidth < $("sr-rd-content").width()) $img.css({ "width":"auto" }); - } - } - if ( $img[0].clientWidth > $("sr-rd-content").width()) $img.addClass( "sr-rd-content-img" ); - }, - loaderrorHandle = () => { - $img.addClass( "simpread-hidden" ); - if ( $img.parent().hasClass( "sr-rd-content-center" )) { - $img.parent().removeAttr( "class" ).addClass( "simpread-hidden" ); - } - }, - getImgAbsolutePath = path => { - const link = document.createElement( "a" ); - link.href = path; - return link.protocol + "//" + link.host + link.pathname + link.search + link.hash; - }, - getImgAbsolutePath2 = (url,base) => {if('string'!==typeof url||!url){return null}else if(url.match(/^[a-z]+\:\/\//i)){return url}else if(url.match(/^\/\//)){return'http:'+url}else if(url.match(/^[a-z]+\:/i)){return url}else if('string'!==typeof base){var a=document.createElement('a');a.href=url;if(!a.pathname){return null}return'http://'+url}else{base=getImgAbsolutePath2(base);if(base===null){return null}}var a=document.createElement('a');a.href=base;if(url[0]==='/'){base=[]}else{base=a.pathname.split('/');base.pop()}url=url.split('/');for(var i=0;i" ); - if ( !/win|mac/i.test(navigator.platform) ) { - $img.on( "load", ()=>fixOverflowImgsize() ) - .on( "error", ()=>loaderrorHandle() ); - } else { - $img.one( "load", ()=>fixOverflowImgsize() ) - .one( "error", ()=>loaderrorHandle() ); - } - }); - $target.find( "sr-blockquote" ).map( ( index, item ) => { - const $target = $(item), - $parent = $target.parent(); - $target.removeAttr( "style" ).removeAttr( "class" ); - if ( name == "dgtle.com" ) { - $parent.removeClass( "quote" ); - } - }); - $target.find( "iframe:not(.sr-rd-content-nobeautify), embed:not(.sr-rd-content-nobeautify)" ).map( ( index, item )=> { - $(item).wrap( "
" ); - }); - $target.find( "hr" ).map( ( index, item )=> { - $(item).addClass( "simpread-hidden" ); - }); - $target.find( "pre" ).map( ( index, item )=> { - $(item).find( "code" ).removeAttr( "class" ); - }); - $target.find( "pre" ).removeAttr( "class" ); - $target.find( "a" ).removeAttr( "style" ); -} - -export { - specbeautify, - removeSpareTag, - htmlbeautify, - commbeautify, -} \ No newline at end of file diff --git a/src/vender/puread/plugin/minimatch.js b/src/vender/puread/plugin/minimatch.js deleted file mode 100644 index 5b5f8cf4..00000000 --- a/src/vender/puread/plugin/minimatch.js +++ /dev/null @@ -1,923 +0,0 @@ -module.exports = minimatch -minimatch.Minimatch = Minimatch - -var path = { sep: '/' } -try { - path = require('path') -} catch (er) {} - -var GLOBSTAR = minimatch.GLOBSTAR = Minimatch.GLOBSTAR = {} -var expand = require('brace-expansion') - -var plTypes = { - '!': { open: '(?:(?!(?:', close: '))[^/]*?)'}, - '?': { open: '(?:', close: ')?' }, - '+': { open: '(?:', close: ')+' }, - '*': { open: '(?:', close: ')*' }, - '@': { open: '(?:', close: ')' } -} - -// any single thing other than / -// don't need to escape / when using new RegExp() -var qmark = '[^/]' - -// * => any number of characters -var star = qmark + '*?' - -// ** when dots are allowed. Anything goes, except .. and . -// not (^ or / followed by one or two dots followed by $ or /), -// followed by anything, any number of times. -var twoStarDot = '(?:(?!(?:\\\/|^)(?:\\.{1,2})($|\\\/)).)*?' - -// not a ^ or / followed by a dot, -// followed by anything, any number of times. -var twoStarNoDot = '(?:(?!(?:\\\/|^)\\.).)*?' - -// characters that need to be escaped in RegExp. -var reSpecials = charSet('().*{}+?[]^$\\!') - -// "abc" -> { a:true, b:true, c:true } -function charSet (s) { - return s.split('').reduce(function (set, c) { - set[c] = true - return set - }, {}) -} - -// normalizes slashes. -var slashSplit = /\/+/ - -minimatch.filter = filter -function filter (pattern, options) { - options = options || {} - return function (p, i, list) { - return minimatch(p, pattern, options) - } -} - -function ext (a, b) { - a = a || {} - b = b || {} - var t = {} - Object.keys(b).forEach(function (k) { - t[k] = b[k] - }) - Object.keys(a).forEach(function (k) { - t[k] = a[k] - }) - return t -} - -minimatch.defaults = function (def) { - if (!def || !Object.keys(def).length) return minimatch - - var orig = minimatch - - var m = function minimatch (p, pattern, options) { - return orig.minimatch(p, pattern, ext(def, options)) - } - - m.Minimatch = function Minimatch (pattern, options) { - return new orig.Minimatch(pattern, ext(def, options)) - } - - return m -} - -Minimatch.defaults = function (def) { - if (!def || !Object.keys(def).length) return Minimatch - return minimatch.defaults(def).Minimatch -} - -function minimatch (p, pattern, options) { - if (typeof pattern !== 'string') { - throw new TypeError('glob pattern string required') - } - - if (!options) options = {} - - // shortcut: comments match nothing. - if (!options.nocomment && pattern.charAt(0) === '#') { - return false - } - - // "" only matches "" - if (pattern.trim() === '') return p === '' - - return new Minimatch(pattern, options).match(p) -} - -function Minimatch (pattern, options) { - if (!(this instanceof Minimatch)) { - return new Minimatch(pattern, options) - } - - if (typeof pattern !== 'string') { - throw new TypeError('glob pattern string required') - } - - if (!options) options = {} - pattern = pattern.trim() - - // windows support: need to use /, not \ - if (path.sep !== '/') { - pattern = pattern.split(path.sep).join('/') - } - - this.options = options - this.set = [] - this.pattern = pattern - this.regexp = null - this.negate = false - this.comment = false - this.empty = false - - // make the set of regexps etc. - this.make() -} - -Minimatch.prototype.debug = function () {} - -Minimatch.prototype.make = make -function make () { - // don't do it more than once. - if (this._made) return - - var pattern = this.pattern - var options = this.options - - // empty patterns and comments match nothing. - if (!options.nocomment && pattern.charAt(0) === '#') { - this.comment = true - return - } - if (!pattern) { - this.empty = true - return - } - - // step 1: figure out negation, etc. - this.parseNegate() - - // step 2: expand braces - var set = this.globSet = this.braceExpand() - - if (options.debug) this.debug = console.error - - this.debug(this.pattern, set) - - // step 3: now we have a set, so turn each one into a series of path-portion - // matching patterns. - // These will be regexps, except in the case of "**", which is - // set to the GLOBSTAR object for globstar behavior, - // and will not contain any / characters - set = this.globParts = set.map(function (s) { - return s.split(slashSplit) - }) - - this.debug(this.pattern, set) - - // glob --> regexps - set = set.map(function (s, si, set) { - return s.map(this.parse, this) - }, this) - - this.debug(this.pattern, set) - - // filter out everything that didn't compile properly. - set = set.filter(function (s) { - return s.indexOf(false) === -1 - }) - - this.debug(this.pattern, set) - - this.set = set -} - -Minimatch.prototype.parseNegate = parseNegate -function parseNegate () { - var pattern = this.pattern - var negate = false - var options = this.options - var negateOffset = 0 - - if (options.nonegate) return - - for (var i = 0, l = pattern.length - ; i < l && pattern.charAt(i) === '!' - ; i++) { - negate = !negate - negateOffset++ - } - - if (negateOffset) this.pattern = pattern.substr(negateOffset) - this.negate = negate -} - -// Brace expansion: -// a{b,c}d -> abd acd -// a{b,}c -> abc ac -// a{0..3}d -> a0d a1d a2d a3d -// a{b,c{d,e}f}g -> abg acdfg acefg -// a{b,c}d{e,f}g -> abdeg acdeg abdeg abdfg -// -// Invalid sets are not expanded. -// a{2..}b -> a{2..}b -// a{b}c -> a{b}c -minimatch.braceExpand = function (pattern, options) { - return braceExpand(pattern, options) -} - -Minimatch.prototype.braceExpand = braceExpand - -function braceExpand (pattern, options) { - if (!options) { - if (this instanceof Minimatch) { - options = this.options - } else { - options = {} - } - } - - pattern = typeof pattern === 'undefined' - ? this.pattern : pattern - - if (typeof pattern === 'undefined') { - throw new TypeError('undefined pattern') - } - - if (options.nobrace || - !pattern.match(/\{.*\}/)) { - // shortcut. no need to expand. - return [pattern] - } - - return expand(pattern) -} - -// parse a component of the expanded set. -// At this point, no pattern may contain "/" in it -// so we're going to return a 2d array, where each entry is the full -// pattern, split on '/', and then turned into a regular expression. -// A regexp is made at the end which joins each array with an -// escaped /, and another full one which joins each regexp with |. -// -// Following the lead of Bash 4.1, note that "**" only has special meaning -// when it is the *only* thing in a path portion. Otherwise, any series -// of * is equivalent to a single *. Globstar behavior is enabled by -// default, and can be disabled by setting options.noglobstar. -Minimatch.prototype.parse = parse -var SUBPARSE = {} -function parse (pattern, isSub) { - if (pattern.length > 1024 * 64) { - throw new TypeError('pattern is too long') - } - - var options = this.options - - // shortcuts - if (!options.noglobstar && pattern === '**') return GLOBSTAR - if (pattern === '') return '' - - var re = '' - var hasMagic = !!options.nocase - var escaping = false - // ? => one single character - var patternListStack = [] - var negativeLists = [] - var stateChar - var inClass = false - var reClassStart = -1 - var classStart = -1 - // . and .. never match anything that doesn't start with ., - // even when options.dot is set. - var patternStart = pattern.charAt(0) === '.' ? '' // anything - // not (start or / followed by . or .. followed by / or end) - : options.dot ? '(?!(?:^|\\\/)\\.{1,2}(?:$|\\\/))' - : '(?!\\.)' - var self = this - - function clearStateChar () { - if (stateChar) { - // we had some state-tracking character - // that wasn't consumed by this pass. - switch (stateChar) { - case '*': - re += star - hasMagic = true - break - case '?': - re += qmark - hasMagic = true - break - default: - re += '\\' + stateChar - break - } - self.debug('clearStateChar %j %j', stateChar, re) - stateChar = false - } - } - - for (var i = 0, len = pattern.length, c - ; (i < len) && (c = pattern.charAt(i)) - ; i++) { - this.debug('%s\t%s %s %j', pattern, i, re, c) - - // skip over any that are escaped. - if (escaping && reSpecials[c]) { - re += '\\' + c - escaping = false - continue - } - - switch (c) { - case '/': - // completely not allowed, even escaped. - // Should already be path-split by now. - return false - - case '\\': - clearStateChar() - escaping = true - continue - - // the various stateChar values - // for the "extglob" stuff. - case '?': - case '*': - case '+': - case '@': - case '!': - this.debug('%s\t%s %s %j <-- stateChar', pattern, i, re, c) - - // all of those are literals inside a class, except that - // the glob [!a] means [^a] in regexp - if (inClass) { - this.debug(' in class') - if (c === '!' && i === classStart + 1) c = '^' - re += c - continue - } - - // if we already have a stateChar, then it means - // that there was something like ** or +? in there. - // Handle the stateChar, then proceed with this one. - self.debug('call clearStateChar %j', stateChar) - clearStateChar() - stateChar = c - // if extglob is disabled, then +(asdf|foo) isn't a thing. - // just clear the statechar *now*, rather than even diving into - // the patternList stuff. - if (options.noext) clearStateChar() - continue - - case '(': - if (inClass) { - re += '(' - continue - } - - if (!stateChar) { - re += '\\(' - continue - } - - patternListStack.push({ - type: stateChar, - start: i - 1, - reStart: re.length, - open: plTypes[stateChar].open, - close: plTypes[stateChar].close - }) - // negation is (?:(?!js)[^/]*) - re += stateChar === '!' ? '(?:(?!(?:' : '(?:' - this.debug('plType %j %j', stateChar, re) - stateChar = false - continue - - case ')': - if (inClass || !patternListStack.length) { - re += '\\)' - continue - } - - clearStateChar() - hasMagic = true - var pl = patternListStack.pop() - // negation is (?:(?!js)[^/]*) - // The others are (?:) - re += pl.close - if (pl.type === '!') { - negativeLists.push(pl) - } - pl.reEnd = re.length - continue - - case '|': - if (inClass || !patternListStack.length || escaping) { - re += '\\|' - escaping = false - continue - } - - clearStateChar() - re += '|' - continue - - // these are mostly the same in regexp and glob - case '[': - // swallow any state-tracking char before the [ - clearStateChar() - - if (inClass) { - re += '\\' + c - continue - } - - inClass = true - classStart = i - reClassStart = re.length - re += c - continue - - case ']': - // a right bracket shall lose its special - // meaning and represent itself in - // a bracket expression if it occurs - // first in the list. -- POSIX.2 2.8.3.2 - if (i === classStart + 1 || !inClass) { - re += '\\' + c - escaping = false - continue - } - - // handle the case where we left a class open. - // "[z-a]" is valid, equivalent to "\[z-a\]" - if (inClass) { - // split where the last [ was, make sure we don't have - // an invalid re. if so, re-walk the contents of the - // would-be class to re-translate any characters that - // were passed through as-is - // TODO: It would probably be faster to determine this - // without a try/catch and a new RegExp, but it's tricky - // to do safely. For now, this is safe and works. - var cs = pattern.substring(classStart + 1, i) - try { - RegExp('[' + cs + ']') - } catch (er) { - // not a valid class! - var sp = this.parse(cs, SUBPARSE) - re = re.substr(0, reClassStart) + '\\[' + sp[0] + '\\]' - hasMagic = hasMagic || sp[1] - inClass = false - continue - } - } - - // finish up the class. - hasMagic = true - inClass = false - re += c - continue - - default: - // swallow any state char that wasn't consumed - clearStateChar() - - if (escaping) { - // no need - escaping = false - } else if (reSpecials[c] - && !(c === '^' && inClass)) { - re += '\\' - } - - re += c - - } // switch - } // for - - // handle the case where we left a class open. - // "[abc" is valid, equivalent to "\[abc" - if (inClass) { - // split where the last [ was, and escape it - // this is a huge pita. We now have to re-walk - // the contents of the would-be class to re-translate - // any characters that were passed through as-is - cs = pattern.substr(classStart + 1) - sp = this.parse(cs, SUBPARSE) - re = re.substr(0, reClassStart) + '\\[' + sp[0] - hasMagic = hasMagic || sp[1] - } - - // handle the case where we had a +( thing at the *end* - // of the pattern. - // each pattern list stack adds 3 chars, and we need to go through - // and escape any | chars that were passed through as-is for the regexp. - // Go through and escape them, taking care not to double-escape any - // | chars that were already escaped. - for (pl = patternListStack.pop(); pl; pl = patternListStack.pop()) { - var tail = re.slice(pl.reStart + pl.open.length) - this.debug('setting tail', re, pl) - // maybe some even number of \, then maybe 1 \, followed by a | - tail = tail.replace(/((?:\\{2}){0,64})(\\?)\|/g, function (_, $1, $2) { - if (!$2) { - // the | isn't already escaped, so escape it. - $2 = '\\' - } - - // need to escape all those slashes *again*, without escaping the - // one that we need for escaping the | character. As it works out, - // escaping an even number of slashes can be done by simply repeating - // it exactly after itself. That's why this trick works. - // - // I am sorry that you have to see this. - return $1 + $1 + $2 + '|' - }) - - this.debug('tail=%j\n %s', tail, tail, pl, re) - var t = pl.type === '*' ? star - : pl.type === '?' ? qmark - : '\\' + pl.type - - hasMagic = true - re = re.slice(0, pl.reStart) + t + '\\(' + tail - } - - // handle trailing things that only matter at the very end. - clearStateChar() - if (escaping) { - // trailing \\ - re += '\\\\' - } - - // only need to apply the nodot start if the re starts with - // something that could conceivably capture a dot - var addPatternStart = false - switch (re.charAt(0)) { - case '.': - case '[': - case '(': addPatternStart = true - } - - // Hack to work around lack of negative lookbehind in JS - // A pattern like: *.!(x).!(y|z) needs to ensure that a name - // like 'a.xyz.yz' doesn't match. So, the first negative - // lookahead, has to look ALL the way ahead, to the end of - // the pattern. - for (var n = negativeLists.length - 1; n > -1; n--) { - var nl = negativeLists[n] - - var nlBefore = re.slice(0, nl.reStart) - var nlFirst = re.slice(nl.reStart, nl.reEnd - 8) - var nlLast = re.slice(nl.reEnd - 8, nl.reEnd) - var nlAfter = re.slice(nl.reEnd) - - nlLast += nlAfter - - // Handle nested stuff like *(*.js|!(*.json)), where open parens - // mean that we should *not* include the ) in the bit that is considered - // "after" the negated section. - var openParensBefore = nlBefore.split('(').length - 1 - var cleanAfter = nlAfter - for (i = 0; i < openParensBefore; i++) { - cleanAfter = cleanAfter.replace(/\)[+*?]?/, '') - } - nlAfter = cleanAfter - - var dollar = '' - if (nlAfter === '' && isSub !== SUBPARSE) { - dollar = '$' - } - var newRe = nlBefore + nlFirst + nlAfter + dollar + nlLast - re = newRe - } - - // if the re is not "" at this point, then we need to make sure - // it doesn't match against an empty path part. - // Otherwise a/* will match a/, which it should not. - if (re !== '' && hasMagic) { - re = '(?=.)' + re - } - - if (addPatternStart) { - re = patternStart + re - } - - // parsing just a piece of a larger pattern. - if (isSub === SUBPARSE) { - return [re, hasMagic] - } - - // skip the regexp for non-magical patterns - // unescape anything in it, though, so that it'll be - // an exact match against a file etc. - if (!hasMagic) { - return globUnescape(pattern) - } - - var flags = options.nocase ? 'i' : '' - try { - var regExp = new RegExp('^' + re + '$', flags) - } catch (er) { - // If it was an invalid regular expression, then it can't match - // anything. This trick looks for a character after the end of - // the string, which is of course impossible, except in multi-line - // mode, but it's not a /m regex. - return new RegExp('$.') - } - - regExp._glob = pattern - regExp._src = re - - return regExp -} - -minimatch.makeRe = function (pattern, options) { - return new Minimatch(pattern, options || {}).makeRe() -} - -Minimatch.prototype.makeRe = makeRe -function makeRe () { - if (this.regexp || this.regexp === false) return this.regexp - - // at this point, this.set is a 2d array of partial - // pattern strings, or "**". - // - // It's better to use .match(). This function shouldn't - // be used, really, but it's pretty convenient sometimes, - // when you just want to work with a regex. - var set = this.set - - if (!set.length) { - this.regexp = false - return this.regexp - } - var options = this.options - - var twoStar = options.noglobstar ? star - : options.dot ? twoStarDot - : twoStarNoDot - var flags = options.nocase ? 'i' : '' - - var re = set.map(function (pattern) { - return pattern.map(function (p) { - return (p === GLOBSTAR) ? twoStar - : (typeof p === 'string') ? regExpEscape(p) - : p._src - }).join('\\\/') - }).join('|') - - // must match entire pattern - // ending in a * or ** will make it less strict. - re = '^(?:' + re + ')$' - - // can match anything, as long as it's not this. - if (this.negate) re = '^(?!' + re + ').*$' - - try { - this.regexp = new RegExp(re, flags) - } catch (ex) { - this.regexp = false - } - return this.regexp -} - -minimatch.match = function (list, pattern, options) { - options = options || {} - var mm = new Minimatch(pattern, options) - list = list.filter(function (f) { - return mm.match(f) - }) - if (mm.options.nonull && !list.length) { - list.push(pattern) - } - return list -} - -Minimatch.prototype.match = match -function match (f, partial) { - this.debug('match', f, this.pattern) - // short-circuit in the case of busted things. - // comments, etc. - if (this.comment) return false - if (this.empty) return f === '' - - if (f === '/' && partial) return true - - var options = this.options - - // windows: need to use /, not \ - if (path.sep !== '/') { - f = f.split(path.sep).join('/') - } - - // treat the test path as a set of pathparts. - f = f.split(slashSplit) - this.debug(this.pattern, 'split', f) - - // just ONE of the pattern sets in this.set needs to match - // in order for it to be valid. If negating, then just one - // match means that we have failed. - // Either way, return on the first hit. - - var set = this.set - this.debug(this.pattern, 'set', set) - - // Find the basename of the path by looking for the last non-empty segment - var filename - var i - for (i = f.length - 1; i >= 0; i--) { - filename = f[i] - if (filename) break - } - - for (i = 0; i < set.length; i++) { - var pattern = set[i] - var file = f - if (options.matchBase && pattern.length === 1) { - file = [filename] - } - var hit = this.matchOne(file, pattern, partial) - if (hit) { - if (options.flipNegate) return true - return !this.negate - } - } - - // didn't get any hits. this is success if it's a negative - // pattern, failure otherwise. - if (options.flipNegate) return false - return this.negate -} - -// set partial to true to test if, for example, -// "/a/b" matches the start of "/*/b/*/d" -// Partial means, if you run out of file before you run -// out of pattern, then that's fine, as long as all -// the parts match. -Minimatch.prototype.matchOne = function (file, pattern, partial) { - var options = this.options - - this.debug('matchOne', - { 'this': this, file: file, pattern: pattern }) - - this.debug('matchOne', file.length, pattern.length) - - for (var fi = 0, - pi = 0, - fl = file.length, - pl = pattern.length - ; (fi < fl) && (pi < pl) - ; fi++, pi++) { - this.debug('matchOne loop') - var p = pattern[pi] - var f = file[fi] - - this.debug(pattern, p, f) - - // should be impossible. - // some invalid regexp stuff in the set. - if (p === false) return false - - if (p === GLOBSTAR) { - this.debug('GLOBSTAR', [pattern, p, f]) - - // "**" - // a/**/b/**/c would match the following: - // a/b/x/y/z/c - // a/x/y/z/b/c - // a/b/x/b/x/c - // a/b/c - // To do this, take the rest of the pattern after - // the **, and see if it would match the file remainder. - // If so, return success. - // If not, the ** "swallows" a segment, and try again. - // This is recursively awful. - // - // a/**/b/**/c matching a/b/x/y/z/c - // - a matches a - // - doublestar - // - matchOne(b/x/y/z/c, b/**/c) - // - b matches b - // - doublestar - // - matchOne(x/y/z/c, c) -> no - // - matchOne(y/z/c, c) -> no - // - matchOne(z/c, c) -> no - // - matchOne(c, c) yes, hit - var fr = fi - var pr = pi + 1 - if (pr === pl) { - this.debug('** at the end') - // a ** at the end will just swallow the rest. - // We have found a match. - // however, it will not swallow /.x, unless - // options.dot is set. - // . and .. are *never* matched by **, for explosively - // exponential reasons. - for (; fi < fl; fi++) { - if (file[fi] === '.' || file[fi] === '..' || - (!options.dot && file[fi].charAt(0) === '.')) return false - } - return true - } - - // ok, let's see if we can swallow whatever we can. - while (fr < fl) { - var swallowee = file[fr] - - this.debug('\nglobstar while', file, fr, pattern, pr, swallowee) - - // XXX remove this slice. Just pass the start index. - if (this.matchOne(file.slice(fr), pattern.slice(pr), partial)) { - this.debug('globstar found match!', fr, fl, swallowee) - // found a match. - return true - } else { - // can't swallow "." or ".." ever. - // can only swallow ".foo" when explicitly asked. - if (swallowee === '.' || swallowee === '..' || - (!options.dot && swallowee.charAt(0) === '.')) { - this.debug('dot detected!', file, fr, pattern, pr) - break - } - - // ** swallows a segment, and continue. - this.debug('globstar swallow a segment, and continue') - fr++ - } - } - - // no match was found. - // However, in partial mode, we can't say this is necessarily over. - // If there's more *pattern* left, then - if (partial) { - // ran out of file - this.debug('\n>>> no match, partial?', file, fr, pattern, pr) - if (fr === fl) return true - } - return false - } - - // something other than ** - // non-magic patterns just have to match exactly - // patterns with magic have been turned into regexps. - var hit - if (typeof p === 'string') { - if (options.nocase) { - hit = f.toLowerCase() === p.toLowerCase() - } else { - hit = f === p - } - this.debug('string match', p, f, hit) - } else { - hit = f.match(p) - this.debug('pattern match', p, f, hit) - } - - if (!hit) return false - } - - // Note: ending in / means that we'll get a final "" - // at the end of the pattern. This can only match a - // corresponding "" at the end of the file. - // If the file ends in /, then it can only match a - // a pattern that ends in /, unless the pattern just - // doesn't have any more for it. But, a/b/ should *not* - // match "a/b/*", even though "" matches against the - // [^/]*? pattern, except in partial mode, where it might - // simply not be reached yet. - // However, a/b/ should still satisfy a/* - - // now either we fell off the end of the pattern, or we're done. - if (fi === fl && pi === pl) { - // ran out of pattern and filename at the same time. - // an exact hit! - return true - } else if (fi === fl) { - // ran out of file, but still had pattern left. - // this is ok if we're doing the match as part of - // a glob fs traversal. - return partial - } else if (pi === pl) { - // ran out of pattern, still have file left. - // this is only acceptable if we're on the very last - // empty segment of a file with a trailing slash. - // a/* should match a/b/ - var emptyFileEnd = (fi === fl - 1) && (file[fi] === '') - return emptyFileEnd - } - - // should be unreachable. - throw new Error('wtf?') -} - -// replace stuff like \* with * -function globUnescape (s) { - return s.replace(/\\(.)/g, '$1') -} - -function regExpEscape (s) { - return s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&') -} diff --git a/src/vender/puread/plugin/pangu.min.js b/src/vender/puread/plugin/pangu.min.js deleted file mode 100644 index e8f4305b..00000000 --- a/src/vender/puread/plugin/pangu.min.js +++ /dev/null @@ -1,10 +0,0 @@ -/*! - * pangu.js - * -------- - * @version: 3.3.0 - * @homepage: https://github.com/vinta/pangu.js - * @license: MIT - * @author: Vinta Chen (https://github.com/vinta) - */ -!function(e,u){"object"==typeof exports&&"object"==typeof module?module.exports=u():"function"==typeof define&&define.amd?define("pangu",[],u):"object"==typeof exports?exports.pangu=u():e.pangu=u()}(this,function(){return function(e){function u(a){if(f[a])return f[a].exports;var t=f[a]={exports:{},id:a,loaded:!1};return e[a].call(t.exports,t,t.exports,u),t.loaded=!0,t.exports}var f={};return u.m=e,u.c=f,u.p="",u(0)}([function(e,u,f){"use strict";function a(e,u){if(!(e instanceof u))throw new TypeError("Cannot call a class as a function")}function t(e,u){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!u||"object"!=typeof u&&"function"!=typeof u?e:u}function n(e,u){if("function"!=typeof u&&null!==u)throw new TypeError("Super expression must either be null or a function, not "+typeof u);e.prototype=Object.create(u&&u.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),u&&(Object.setPrototypeOf?Object.setPrototypeOf(e,u):e.__proto__=u)}var i=function(){function e(e,u){for(var f=0;f=0||u.isContentEditable||"true"===u.getAttribute("g_editable"))return!0;u=u.parentNode}return!1}},{key:"isFirstTextChild",value:function(e,u){for(var f=e.childNodes,a=0;a-1;a--){var t=f[a];if(t.nodeType!==o&&t.textContent)return t===u}return!1}},{key:"spacingNodeByXPath",value:function(e,u){for(var f=document.evaluate(e,u,null,XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,null),a=void 0,t=void 0,n=f.snapshotLength-1;n>-1;--n)if(a=f.snapshotItem(n),this.canIgnoreNode(a))t=a;else{var i=this.spacing(a.data);if(a.data!==i&&(a.data=i),t){if(a.nextSibling&&a.nextSibling.nodeName.search(this.spaceLikeTags)>=0){t=a;continue}var r=a.data.toString().substr(-1)+t.data.toString().substr(0,1),o=this.spacing(r);if(o!==r){for(var s=t;s.parentNode&&s.nodeName.search(this.spaceSensitiveTags)===-1&&this.isFirstTextChild(s.parentNode,s);)s=s.parentNode;for(var c=a;c.parentNode&&c.nodeName.search(this.spaceSensitiveTags)===-1&&this.isLastTextChild(c.parentNode,c);)c=c.parentNode;if(c.nextSibling&&c.nextSibling.nodeName.search(this.spaceLikeTags)>=0){t=a;continue}if(c.nodeName.search(this.blockTags)===-1)if(s.nodeName.search(this.spaceSensitiveTags)===-1)s.nodeName.search(this.ignoreTags)===-1&&s.nodeName.search(this.blockTags)===-1&&(t.previousSibling?t.previousSibling.nodeName.search(this.spaceLikeTags)===-1&&(t.data=" "+t.data):this.canIgnoreNode(t)||(t.data=" "+t.data));else if(c.nodeName.search(this.spaceSensitiveTags)===-1)a.data=a.data+" ";else{var d=document.createElement("pangu");d.innerHTML=" ",s.previousSibling?s.previousSibling.nodeName.search(this.spaceLikeTags)===-1&&s.parentNode.insertBefore(d,s):s.parentNode.insertBefore(d,s),d.previousElementSibling||d.parentNode&&d.parentNode.removeChild(d)}}}t=a}}},{key:"spacingNode",value:function(e){var u=".//*/text()[normalize-space(.)]";this.spacingNodeByXPath(u,e)}},{key:"spacingElementById",value:function(e){var u='id("'+e+'")//text()';this.spacingNodeByXPath(u,document)}},{key:"spacingElementByClassName",value:function(e){var u='//*[contains(concat(" ", normalize-space(@class), " "), "'+e+'")]//text()';this.spacingNodeByXPath(u,document)}},{key:"spacingElementByTagName",value:function(e){var u="//"+e+"//text()";this.spacingNodeByXPath(u,document)}},{key:"spacingPageTitle",value:function(){var e="/html/head/title/text()";this.spacingNodeByXPath(e,document)}},{key:"spacingPageBody",value:function(){for(var e="/html/body//*/text()[normalize-space(.)]",u=["script","style","textarea"],f=0;f])([A-Za-z0-9])/g,p=/([A-Za-z0-9])([\+\-\*\/=&\\|<>])([\u2e80-\u2eff\u2f00-\u2fdf\u3040-\u309f\u30a0-\u30ff\u3100-\u312f\u3200-\u32ff\u3400-\u4dbf\u4e00-\u9fff\uf900-\ufaff])/g,l=/([\u2e80-\u2eff\u2f00-\u2fdf\u3040-\u309f\u30a0-\u30ff\u3100-\u312f\u3200-\u32ff\u3400-\u4dbf\u4e00-\u9fff\uf900-\ufaff])([\(\[\{<\u201c]+(.*?)[\)\]\}>\u201d]+)([\u2e80-\u2eff\u2f00-\u2fdf\u3040-\u309f\u30a0-\u30ff\u3100-\u312f\u3200-\u32ff\u3400-\u4dbf\u4e00-\u9fff\uf900-\ufaff])/g,g=/([\u2e80-\u2eff\u2f00-\u2fdf\u3040-\u309f\u30a0-\u30ff\u3100-\u312f\u3200-\u32ff\u3400-\u4dbf\u4e00-\u9fff\uf900-\ufaff])([\(\[\{<\u201c>])/g,h=/([\)\]\}>\u201d<])([\u2e80-\u2eff\u2f00-\u2fdf\u3040-\u309f\u30a0-\u30ff\u3100-\u312f\u3200-\u32ff\u3400-\u4dbf\u4e00-\u9fff\uf900-\ufaff])/g,v=/([\(\[\{<\u201c]+)(\s*)(.+?)(\s*)([\)\]\}>\u201d]+)/,b=/([\u2e80-\u2eff\u2f00-\u2fdf\u3040-\u309f\u30a0-\u30ff\u3100-\u312f\u3200-\u32ff\u3400-\u4dbf\u4e00-\u9fff\uf900-\ufaff])([~!;:,\.\?\u2026])([A-Za-z0-9])/g,y=/([\u2e80-\u2eff\u2f00-\u2fdf\u3040-\u309f\u30a0-\u30ff\u3100-\u312f\u3200-\u32ff\u3400-\u4dbf\u4e00-\u9fff\uf900-\ufaff])([A-Za-z0-9`\$%\^&\*\-=\+\\\|\/@\u00a1-\u00ff\u2022\u2027\u2150-\u218f])/g,m=/([A-Za-z0-9`~\$%\^&\*\-=\+\\\|\/!;:,\.\?\u00a1-\u00ff\u2022\u2026\u2027\u2150-\u218f])([\u2e80-\u2eff\u2f00-\u2fdf\u3040-\u309f\u30a0-\u30ff\u3100-\u312f\u3200-\u32ff\u3400-\u4dbf\u4e00-\u9fff\uf900-\ufaff])/g,$=function(){function e(){f(this,e)}return a(e,[{key:"spacing",value:function(e){var u=e;u=u.replace(t,"$1 $2"),u=u.replace(n,"$1 $2"),u=u.replace(i,"$1$3$5"),u=u.replace(r,"$1$3$4"),u=u.replace(o,"$1 $2$3$4 $5"),u=u.replace(s,"$1 $2"),u=u.replace(c,"$1 $3"),u=u.replace(d,"$1 $2 $3"),u=u.replace(p,"$1 $2 $3");var f=u,a=u.replace(l,"$1 $2 $4");return u=a,f===a&&(u=u.replace(g,"$1 $2"),u=u.replace(h,"$1 $2")),u=u.replace(v,"$1$3$5"),u=u.replace(b,"$1$2 $3"),u=u.replace(y,"$1 $2"),u=u.replace(m,"$1 $2")}},{key:"spacingText",value:function(e){var u=arguments.length<=1||void 0===arguments[1]?function(){}:arguments[1];try{var f=this.spacing(e);u(null,f)}catch(a){u(a)}}}]),e}(),N=new $;u=e.exports=N,u.Pangu=$}])}); -//# sourceMappingURL=pangu.min.js.map \ No newline at end of file diff --git a/src/vender/puread/plugin/readability.js b/src/vender/puread/plugin/readability.js deleted file mode 100644 index 3f6b9617..00000000 --- a/src/vender/puread/plugin/readability.js +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (c) 2010 Arc90 Inc - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/*eslint-env es6:false*/ -/* - * Copyright (c) 2010 Arc90 Inc - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/* - * This code is heavily based on Arc90's readability.js (1.7.1) script - * available at: http://code.google.com/p/arc90labs-readability - */ -/** - * Public constructor. - * @param {HTMLDocument} doc The document to parse. - * @param {Object} options The options object. - */ -function Readability(a,b){if(b&&b.documentElement)a=b,b=arguments[2];else if(!a||!a.documentElement)throw new Error("First argument to Readability constructor should be a document object.");b=b||{},this._doc=a,this._articleTitle=null,this._articleByline=null,this._articleDir=null,this._articleSiteName=null,this._attempts=[],this._debug=!!b.debug,this._maxElemsToParse=b.maxElemsToParse||this.DEFAULT_MAX_ELEMS_TO_PARSE,this._nbTopCandidates=b.nbTopCandidates||this.DEFAULT_N_TOP_CANDIDATES,this._charThreshold=b.charThreshold||this.DEFAULT_CHAR_THRESHOLD,this._classesToPreserve=this.CLASSES_TO_PRESERVE.concat(b.classesToPreserve||[]),this._flags=this.FLAG_STRIP_UNLIKELYS|this.FLAG_WEIGHT_CLASSES|this.FLAG_CLEAN_CONDITIONALLY;var c;this._debug?(c=function(a){var c,d,b=a.nodeName+" ";return a.nodeType==a.TEXT_NODE?b+'("'+a.textContent+'")':(c=a.className&&"."+a.className.replace(/ /g,"."),d="",a.id?d="(#"+a.id+c+")":c&&(d="("+c+")"),b+d)},this.log=function(){var a,b;"undefined"!=typeof dump?(a=Array.prototype.map.call(arguments,function(a){return a&&a.nodeName?c(a):a}).join(" "),dump("Reader: (Readability) "+a+"\n")):"undefined"!=typeof console&&(b=["Reader: (Readability) "].concat(arguments),console.log.apply(console,b))}):this.log=function(){}}Readability.prototype={FLAG_STRIP_UNLIKELYS:1,FLAG_WEIGHT_CLASSES:2,FLAG_CLEAN_CONDITIONALLY:4,ELEMENT_NODE:1,TEXT_NODE:3,DEFAULT_MAX_ELEMS_TO_PARSE:0,DEFAULT_N_TOP_CANDIDATES:5,DEFAULT_TAGS_TO_SCORE:"section,h2,h3,h4,h5,h6,p,td,pre".toUpperCase().split(","),DEFAULT_CHAR_THRESHOLD:500,REGEXPS:{unlikelyCandidates:/-ad-|ai2html|banner|breadcrumbs|combx|comment|community|cover-wrap|disqus|extra|foot|gdpr|header|legends|menu|related|remark|replies|rss|shoutbox|sidebar|skyscraper|social|sponsor|supplemental|ad-break|agegate|pagination|pager|popup|yom-remote/i,okMaybeItsACandidate:/and|article|body|column|main|shadow/i,positive:/article|body|content|entry|hentry|h-entry|main|page|pagination|post|text|blog|story/i,negative:/hidden|^hid$| hid$| hid |^hid |banner|combx|comment|com-|contact|foot|footer|footnote|gdpr|masthead|media|meta|outbrain|promo|related|scroll|share|shoutbox|sidebar|skyscraper|sponsor|shopping|tags|tool|widget/i,extraneous:/print|archive|comment|discuss|e[\-]?mail|share|reply|all|login|sign|single|utility/i,byline:/byline|author|dateline|writtenby|p-author/i,replaceFonts:/<(\/?)font[^>]*>/gi,normalize:/\s{2,}/g,videos:/\/\/(www\.)?((dailymotion|youtube|youtube-nocookie|player\.vimeo|v\.qq)\.com|(archive|upload\.wikimedia)\.org|player\.twitch\.tv)/i,nextLink:/(next|weiter|continue|>([^\|]|$)|禄([^\|]|$))/i,prevLink:/(prev|earl|old|new|<|芦)/i,whitespace:/^\s*$/,hasContent:/\S$/},DIV_TO_P_ELEMS:["A","BLOCKQUOTE","DL","DIV","IMG","OL","P","PRE","TABLE","UL","SELECT"],ALTER_TO_DIV_EXCEPTIONS:["DIV","ARTICLE","SECTION","P"],PRESENTATIONAL_ATTRIBUTES:["align","background","bgcolor","border","cellpadding","cellspacing","frame","hspace","rules","style","valign","vspace"],DEPRECATED_SIZE_ATTRIBUTE_ELEMS:["TABLE","TH","TD","HR","PRE"],PHRASING_ELEMS:["ABBR","AUDIO","B","BDO","BR","BUTTON","CITE","CODE","DATA","DATALIST","DFN","EM","EMBED","I","IMG","INPUT","KBD","LABEL","MARK","MATH","METER","NOSCRIPT","OBJECT","OUTPUT","PROGRESS","Q","RUBY","SAMP","SCRIPT","SELECT","SMALL","SPAN","STRONG","SUB","SUP","TEXTAREA","TIME","VAR","WBR"],CLASSES_TO_PRESERVE:["page"],_postProcessContent:function(a){this._fixRelativeUris(a),this._cleanClasses(a)},_removeNodes:function(a,b){var c,d,e;for(c=a.length-1;c>=0;c--)d=a[c],e=d.parentNode,e&&(!b||b.call(this,d,c,a))&&e.removeChild(d)},_replaceNodeTags:function(a,b){var c,d;for(c=a.length-1;c>=0;c--)d=a[c],this._setNodeTag(d,b)},_forEachNode:function(a,b){Array.prototype.forEach.call(a,b,this)},_someNode:function(a,b){return Array.prototype.some.call(a,b,this)},_everyNode:function(a,b){return Array.prototype.every.call(a,b,this)},_concatNodeLists:function(){var a=Array.prototype.slice,b=a.call(arguments),c=b.map(function(b){return a.call(b)});return Array.prototype.concat.apply([],c)},_getAllNodesWithTag:function(a,b){return a.querySelectorAll?a.querySelectorAll(b.join(",")):[].concat.apply([],b.map(function(b){var c=a.getElementsByTagName(b);return Array.isArray(c)?c:Array.from(c)}))},_cleanClasses:function(a){var b=this._classesToPreserve,c=(a.getAttribute("class")||"").split(/\s+/).filter(function(a){return-1!=b.indexOf(a)}).join(" ");for(c?a.setAttribute("class",c):a.removeAttribute("class"),a=a.firstElementChild;a;a=a.nextElementSibling)this._cleanClasses(a)},_fixRelativeUris:function(a){function d(a){if(b==c&&"#"==a.charAt(0))return a;try{return new URL(a,b).href}catch(d){}return a}var f,b=this._doc.baseURI,c=this._doc.documentURI,e=this._getAllNodesWithTag(a,["a"]);this._forEachNode(e,function(a){var c,b=a.getAttribute("href");b&&(0===b.indexOf("javascript:")?(c=this._doc.createTextNode(a.textContent),a.parentNode.replaceChild(c,a)):a.setAttribute("href",d(b)))}),f=this._getAllNodesWithTag(a,["img"]),this._forEachNode(f,function(a){var b=a.getAttribute("src");b&&a.setAttribute("src",d(b))})},_getArticleTitle:function(){function f(a){return a.split(/\s+/).length}var e,g,h,i,j,k,a=this._doc,b="",c="";try{b=c=a.title.trim(),"string"!=typeof b&&(b=c=this._getInnerText(a.getElementsByTagName("title")[0]))}catch(d){}return e=!1,/ [\|\-\\\/>禄] /.test(b)?(e=/ [\\\/>禄] /.test(b),b=c.replace(/(.*)[\|\-\\\/>禄] .*/gi,"$1"),f(b)<3&&(b=c.replace(/[^\|\-\\\/>禄]*[\|\-\\\/>禄](.*)/gi,"$1"))):-1!==b.indexOf(": ")?(g=this._concatNodeLists(a.getElementsByTagName("h1"),a.getElementsByTagName("h2")),h=b.trim(),i=this._someNode(g,function(a){return a.textContent.trim()===h}),i||(b=c.substring(c.lastIndexOf(":")+1),f(b)<3?b=c.substring(c.indexOf(":")+1):f(c.substr(0,c.indexOf(":")))>5&&(b=c))):(b.length>150||b.length<15)&&(j=a.getElementsByTagName("h1"),1===j.length&&(b=this._getInnerText(j[0]))),b=b.trim().replace(this.REGEXPS.normalize," "),k=f(b),4>=k&&(!e||k!=f(c.replace(/[\|\-\\\/>禄]+/g,""))-1)&&(b=c),b},_prepDocument:function(){var a=this._doc;this._removeNodes(a.getElementsByTagName("style")),a.body&&this._replaceBrs(a.body),this._replaceNodeTags(a.getElementsByTagName("font"),"SPAN")},_nextElement:function(a){for(var b=a;b&&b.nodeType!=this.ELEMENT_NODE&&this.REGEXPS.whitespace.test(b.textContent);)b=b.nextSibling;return b},_replaceBrs:function(a){this._forEachNode(this._getAllNodesWithTag(a,["br"]),function(a){for(var d,e,f,g,b=a.nextSibling,c=!1;(b=this._nextElement(b))&&"BR"==b.tagName;)c=!0,d=b.nextSibling,b.parentNode.removeChild(b),b=d;if(c){for(e=this._doc.createElement("p"),a.parentNode.replaceChild(e,a),b=e.nextSibling;b&&("BR"!=b.tagName||(f=this._nextElement(b.nextSibling),!f||"BR"!=f.tagName))&&this._isPhrasingContent(b);)g=b.nextSibling,e.appendChild(b),b=g;for(;e.lastChild&&this._isWhitespace(e.lastChild);)e.removeChild(e.lastChild);"P"===e.parentNode.tagName&&this._setNodeTag(e.parentNode,"DIV")}})},_setNodeTag:function(a,b){var c,d;if(this.log("_setNodeTag",a,b),a.__JSDOMParser__)return a.localName=b.toLowerCase(),a.tagName=b.toUpperCase(),a;for(c=a.ownerDocument.createElement(b);a.firstChild;)c.appendChild(a.firstChild);for(a.parentNode.replaceChild(c,a),a.readability&&(c.readability=a.readability),d=0;d0?c[0].textContent.includes(this._articleTitle):this._articleTitle.includes(c[0].textContent),e&&this._clean(a,"h2"))),this._clean(a,"iframe"),this._clean(a,"input"),this._clean(a,"textarea"),this._clean(a,"select"),this._clean(a,"button"),this._cleanHeaders(a),this._cleanConditionally(a,"table"),this._cleanConditionally(a,"ul"),this._cleanConditionally(a,"div"),this._removeNodes(a.getElementsByTagName("p"),function(a){var b=a.getElementsByTagName("img").length,c=a.getElementsByTagName("embed").length,d=a.getElementsByTagName("object").length,e=a.getElementsByTagName("iframe").length,f=b+c+d+e;return 0===f&&!this._getInnerText(a,!1)}),this._forEachNode(this._getAllNodesWithTag(a,["br"]),function(a){var b=this._nextElement(a.nextSibling);b&&"P"==b.tagName&&a.parentNode.removeChild(a)}),this._forEachNode(this._getAllNodesWithTag(a,["table"]),function(a){var c,d,b=this._hasSingleTagInsideElement(a,"TBODY")?a.firstElementChild:a;this._hasSingleTagInsideElement(b,"TR")&&(c=b.firstElementChild,this._hasSingleTagInsideElement(c,"TD")&&(d=c.firstElementChild,d=this._setNodeTag(d,this._everyNode(d.childNodes,this._isPhrasingContent)?"P":"DIV"),a.parentNode.replaceChild(d,a)))})},_initializeNode:function(a){switch(a.readability={contentScore:0},a.tagName){case"DIV":a.readability.contentScore+=5;break;case"PRE":case"TD":case"BLOCKQUOTE":a.readability.contentScore+=3;break;case"ADDRESS":case"OL":case"UL":case"DL":case"DD":case"DT":case"LI":case"FORM":a.readability.contentScore-=3;break;case"H1":case"H2":case"H3":case"H4":case"H5":case"H6":case"TH":a.readability.contentScore-=5}a.readability.contentScore+=this._getClassWeight(a)},_removeAndGetNext:function(a){var b=this._getNextNode(a,!0);return a.parentNode.removeChild(a),b},_getNextNode:function(a,b){if(!b&&a.firstElementChild)return a.firstElementChild;if(a.nextElementSibling)return a.nextElementSibling;do a=a.parentNode;while(a&&!a.nextElementSibling);return a&&a.nextElementSibling},_checkByline:function(a,b){var c,d;return this._articleByline?!1:(void 0!==a.getAttribute&&(c=a.getAttribute("rel"),d=a.getAttribute("itemprop")),("author"===c||d&&-1!==d.indexOf("author")||this.REGEXPS.byline.test(b))&&this._isValidByline(a.textContent)?(this._articleByline=a.textContent.trim(),!0):!1)},_getNodeAncestors:function(a,b){b=b||0;for(var c=0,d=[];a.parentNode&&(d.push(a.parentNode),!b||++c!==b);)a=a.parentNode;return d},_grabArticle:function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V;if(this.log("**** grabArticle ****"),b=this._doc,c=null!==a?!0:!1,a=a?a:this._doc.body,!a)return this.log("No body found in document. Abort."),null;for(d=a.innerHTML;;){for(e=this._flagIsActive(this.FLAG_STRIP_UNLIKELYS),f=[],g=this._doc.documentElement;g;)if(h=g.className+" "+g.id,this._isProbablyVisible(g))if(this._checkByline(g,h))g=this._removeAndGetNext(g);else if(!e||!this.REGEXPS.unlikelyCandidates.test(h)||this.REGEXPS.okMaybeItsACandidate.test(h)||this._hasAncestorTag(g,"table")||"BODY"===g.tagName||"A"===g.tagName)if("DIV"!==g.tagName&&"SECTION"!==g.tagName&&"HEADER"!==g.tagName&&"H1"!==g.tagName&&"H2"!==g.tagName&&"H3"!==g.tagName&&"H4"!==g.tagName&&"H5"!==g.tagName&&"H6"!==g.tagName||!this._isElementWithoutContent(g)){if(-1!==this.DEFAULT_TAGS_TO_SCORE.indexOf(g.tagName)&&f.push(g),"DIV"===g.tagName){for(i=null,j=g.firstChild;j;){if(k=j.nextSibling,this._isPhrasingContent(j))null!==i?i.appendChild(j):this._isWhitespace(j)||(i=b.createElement("p"),g.replaceChild(i,j),i.appendChild(j));else if(null!==i){for(;i.lastChild&&this._isWhitespace(i.lastChild);)i.removeChild(i.lastChild);i=null}j=k}this._hasSingleTagInsideElement(g,"P")&&this._getLinkDensity(g)<.25?(l=g.children[0],g.parentNode.replaceChild(l,g),g=l,f.push(g)):this._hasChildBlockElement(g)||(g=this._setNodeTag(g,"P"),f.push(g))}g=this._getNextNode(g)}else g=this._removeAndGetNext(g);else this.log("Removing unlikely candidate - "+h),g=this._removeAndGetNext(g);else this.log("Removing hidden node - "+h),g=this._removeAndGetNext(g);for(m=[],this._forEachNode(f,function(a){var b,c,d;a.parentNode&&"undefined"!=typeof a.parentNode.tagName&&(b=this._getInnerText(a),b.length<25||(c=this._getNodeAncestors(a,3),0!==c.length&&(d=0,d+=1,d+=b.split(",").length,d+=Math.min(Math.floor(b.length/100),3),this._forEachNode(c,function(a,b){if(a.tagName&&a.parentNode&&"undefined"!=typeof a.parentNode.tagName){if("undefined"==typeof a.readability&&(this._initializeNode(a),m.push(a)),0===b)var c=1;else c=1===b?2:3*b;a.readability.contentScore+=d/c}}))))}),n=[],o=0,p=m.length;p>o;o+=1)for(q=m[o],r=q.readability.contentScore*(1-this._getLinkDensity(q)),q.readability.contentScore=r,this.log("Candidate:",q,"with score "+r),s=0;st.readability.contentScore){n.splice(s,0,q),n.length>this._nbTopCandidates&&n.pop();break}if(u=n[0]||null,v=!1,null===u||"BODY"===u.tagName){for(u=b.createElement("DIV"),v=!0,x=a.childNodes;x.length;)this.log("Moving child out:",x[0]),u.appendChild(x[0]);a.appendChild(u),this._initializeNode(u)}else if(u){for(y=[],z=1;z=.75&&y.push(this._getNodeAncestors(n[z]));if(A=3,y.length>=A)for(w=u.parentNode;"BODY"!==w.tagName;){for(B=0,C=0;CB;C++)B+=Number(y[C].includes(w));if(B>=A){u=w;break}w=w.parentNode}for(u.readability||this._initializeNode(u),w=u.parentNode,D=u.readability.contentScore,E=D/3;"BODY"!==w.tagName;)if(w.readability){if(F=w.readability.contentScore,E>F)break;if(F>D){u=w;break}D=w.readability.contentScore,w=w.parentNode}else w=w.parentNode;for(w=u.parentNode;"BODY"!=w.tagName&&1==w.children.length;)u=w,w=u.parentNode;u.readability||this._initializeNode(u)}for(G=b.createElement("DIV"),c&&(G.id="readability-content"),H=Math.max(10,.2*u.readability.contentScore),w=u.parentNode,I=w.children,J=0,K=I.length;K>J;J++)L=I[J],M=!1,this.log("Looking at sibling node:",L,L.readability?"with score "+L.readability.contentScore:""),this.log("Sibling has score",L.readability?L.readability.contentScore:"Unknown"),L===u?M=!0:(N=0,L.className===u.className&&""!==u.className&&(N+=.2*u.readability.contentScore),L.readability&&L.readability.contentScore+N>=H?M=!0:"P"===L.nodeName&&(O=this._getLinkDensity(L),P=this._getInnerText(L),Q=P.length,Q>80&&.25>O?M=!0:80>Q&&Q>0&&0===O&&-1!==P.search(/\.( |$)/)&&(M=!0))),M&&(this.log("Appending node:",L),-1===this.ALTER_TO_DIV_EXCEPTIONS.indexOf(L.nodeName)&&(this.log("Altering sibling:",L,"to div."),L=this._setNodeTag(L,"DIV")),G.appendChild(L),J-=1,K-=1);if(this._debug&&this.log("Article content pre-prep: "+G.innerHTML),this._prepArticle(G),this._debug&&this.log("Article content post-prep: "+G.innerHTML),v)u.id="readability-page-1",u.className="page";else{for(R=b.createElement("DIV"),R.id="readability-page-1",R.className="page",S=G.childNodes;S.length;)R.appendChild(S[0]);G.appendChild(R)}if(this._debug&&this.log("Article content after paging: "+G.innerHTML),T=!0,U=this._getInnerText(G,!0).length,U0&&a.length<100):!1},_getArticleMetadata:function(){var a={},b={},c=this._doc.getElementsByTagName("meta"),d=/\s*(dc|dcterm|og|twitter)\s*:\s*(author|creator|description|title|site_name)\s*/gi,e=/^\s*(?:(dc|dcterm|og|twitter|weibo:(article|webpage))\s*[\.:]\s*)?(author|creator|description|title|site_name)\s*$/i;return this._forEachNode(c,function(a){var h,i,j,c=a.getAttribute("name"),f=a.getAttribute("property"),g=a.getAttribute("content");if(g){if(h=null,i=null,f&&(h=f.match(d)))for(j=h.length-1;j>=0;j--)i=h[j].toLowerCase().replace(/\s/g,""),b[i]=g.trim();!h&&c&&e.test(c)&&(i=c,g&&(i=i.toLowerCase().replace(/\s/g,"").replace(/\./g,":"),b[i]=g.trim()))}}),a.title=b["dc:title"]||b["dcterm:title"]||b["og:title"]||b["weibo:article:title"]||b["weibo:webpage:title"]||b["title"]||b["twitter:title"],a.title||(a.title=this._getArticleTitle()),a.byline=b["dc:creator"]||b["dcterm:creator"]||b["author"],a.excerpt=b["dc:description"]||b["dcterm:description"]||b["og:description"]||b["weibo:article:description"]||b["weibo:webpage:description"]||b["description"]||b["twitter:description"],a.siteName=b["og:site_name"],a},_removeScripts:function(a){this._removeNodes(a.getElementsByTagName("script"),function(a){return a.nodeValue="",a.removeAttribute("src"),!0}),this._removeNodes(a.getElementsByTagName("noscript"))},_hasSingleTagInsideElement:function(a,b){return 1!=a.children.length||a.children[0].tagName!==b?!1:!this._someNode(a.childNodes,function(a){return a.nodeType===this.TEXT_NODE&&this.REGEXPS.hasContent.test(a.textContent)})},_isElementWithoutContent:function(a){return a.nodeType===this.ELEMENT_NODE&&0==a.textContent.trim().length&&(0==a.children.length||a.children.length==a.getElementsByTagName("br").length+a.getElementsByTagName("hr").length)},_hasChildBlockElement:function(a){return this._someNode(a.childNodes,function(a){return-1!==this.DIV_TO_P_ELEMS.indexOf(a.tagName)||this._hasChildBlockElement(a)})},_isPhrasingContent:function(a){return a.nodeType===this.TEXT_NODE||-1!==this.PHRASING_ELEMS.indexOf(a.tagName)||("A"===a.tagName||"DEL"===a.tagName||"INS"===a.tagName)&&this._everyNode(a.childNodes,this._isPhrasingContent)},_isWhitespace:function(a){return a.nodeType===this.TEXT_NODE&&0===a.textContent.trim().length||a.nodeType===this.ELEMENT_NODE&&"BR"===a.tagName},_getInnerText:function(a,b){b="undefined"==typeof b?!0:b;var c=a.textContent.trim();return b?c.replace(this.REGEXPS.normalize," "):c},_getCharCount:function(a,b){return b=b||",",this._getInnerText(a).split(b).length-1},_cleanStyles:function(a){var b,c;if(a&&"svg"!==a.tagName.toLowerCase()){for(b=0;b0&&e>c)return!1;if(a.parentNode.tagName===b&&(!d||d(a.parentNode)))return!0;a=a.parentNode,e++}return!1},_getRowAndColumnCount:function(a){var e,f,g,h,i,j,b=0,c=0,d=a.getElementsByTagName("tr");for(e=0;e0?d._readabilityDataTable=!0:(i=["col","colgroup","tfoot","thead","th"],j=function(a){return!!d.getElementsByTagName(a)[0]},i.some(j)?(this.log("Data table because found data-y descendant"),d._readabilityDataTable=!0):d.getElementsByTagName("table")[0]?d._readabilityDataTable=!1:(k=this._getRowAndColumnCount(d),d._readabilityDataTable=k.rows>=10||k.columns>4?!0:k.rows*k.columns>10)))):d._readabilityDataTable=!1):d._readabilityDataTable=!1},_cleanConditionally:function(a,b){if(this._flagIsActive(this.FLAG_CLEAN_CONDITIONALLY)){var c="ul"===b||"ol"===b;this._removeNodes(a.getElementsByTagName(b),function(a){var e,f,g,h,i,j,k,l,m,n,o,p,q,d=function(a){return a._readabilityDataTable};if("table"===b&&d(a))return!1;if(this._hasAncestorTag(a,"table",-1,d))return!1;if(e=this._getClassWeight(a),f=0,this.log("Cleaning Conditionally",a),0>e+f)return!0;if(this._getCharCount(a,",")<10){for(g=a.getElementsByTagName("p").length,h=a.getElementsByTagName("img").length,i=a.getElementsByTagName("li").length-100,j=a.getElementsByTagName("input").length,k=0,l=this._concatNodeLists(a.getElementsByTagName("object"),a.getElementsByTagName("embed"),a.getElementsByTagName("iframe")),m=0;m1&&.5>g/h&&!this._hasAncestorTag(a,"figure")||!c&&i>g||j>Math.floor(g/3)||!c&&25>p&&(0===h||h>2)&&!this._hasAncestorTag(a,"figure")||!c&&25>e&&o>.2||e>=25&&o>.5||1===k&&75>p||k>1}return!1})}},_cleanMatchedNodes:function(a,b){for(var c=this._getNextNode(a,!0),d=this._getNextNode(a);d&&d!=c;)d=b(d,d.className+" "+d.id)?this._removeAndGetNext(d):this._getNextNode(d)},_cleanHeaders:function(a){for(var b=1;3>b;b+=1)this._removeNodes(a.getElementsByTagName("h"+b),function(a){return this._getClassWeight(a)<0})},_flagIsActive:function(a){return(this._flags&a)>0},_removeFlag:function(a){this._flags=this._flags&~a},_isProbablyVisible:function(a){return!(a.style&&"none"==a.style.display||a.hasAttribute("hidden"))},parse:function(){var a,b,c,d,e;if(this._maxElemsToParse>0&&(a=this._doc.getElementsByTagName("*").length,a>this._maxElemsToParse))throw new Error("Aborting parsing document; "+a+" elements found");return this._removeScripts(this._doc),this._prepDocument(),b=this._getArticleMetadata(),this._articleTitle=b.title,(c=this._grabArticle())?(this.log("Grabbed: "+c.innerHTML),this._postProcessContent(c),b.excerpt||(d=c.getElementsByTagName("p"),d.length>0&&(b.excerpt=d[0].textContent.trim())),e=c.textContent,{title:this._articleTitle,byline:b.byline||this._articleByline,dir:this._articleDir,content:c.innerHTML,textContent:e,length:e.length,excerpt:b.excerpt,siteName:b.siteName||this._articleSiteName}):null}}; - -export { - Readability as Readability -} \ No newline at end of file diff --git a/src/vender/puread/plugin/showdown.min.js b/src/vender/puread/plugin/showdown.min.js deleted file mode 100644 index 72ed9bcc..00000000 --- a/src/vender/puread/plugin/showdown.min.js +++ /dev/null @@ -1,3 +0,0 @@ -/*! showdown v 1.9.0 - 10-11-2018 */ -(function(){function e(e){"use strict";var r={omitExtraWLInCodeBlocks:{defaultValue:!1,describe:"Omit the default extra whiteline added to code blocks",type:"boolean"},noHeaderId:{defaultValue:!1,describe:"Turn on/off generated header id",type:"boolean"},prefixHeaderId:{defaultValue:!1,describe:"Add a prefix to the generated header ids. Passing a string will prefix that string to the header id. Setting to true will add a generic 'section-' prefix",type:"string"},rawPrefixHeaderId:{defaultValue:!1,describe:'Setting this option to true will prevent showdown from modifying the prefix. This might result in malformed IDs (if, for instance, the " char is used in the prefix)',type:"boolean"},ghCompatibleHeaderId:{defaultValue:!1,describe:"Generate header ids compatible with github style (spaces are replaced with dashes, a bunch of non alphanumeric chars are removed)",type:"boolean"},rawHeaderId:{defaultValue:!1,describe:"Remove only spaces, ' and \" from generated header ids (including prefixes), replacing them with dashes (-). WARNING: This might result in malformed ids",type:"boolean"},headerLevelStart:{defaultValue:!1,describe:"The header blocks level start",type:"integer"},parseImgDimensions:{defaultValue:!1,describe:"Turn on/off image dimension parsing",type:"boolean"},simplifiedAutoLink:{defaultValue:!1,describe:"Turn on/off GFM autolink style",type:"boolean"},excludeTrailingPunctuationFromURLs:{defaultValue:!1,describe:"Excludes trailing punctuation from links generated with autoLinking",type:"boolean"},literalMidWordUnderscores:{defaultValue:!1,describe:"Parse midword underscores as literal underscores",type:"boolean"},literalMidWordAsterisks:{defaultValue:!1,describe:"Parse midword asterisks as literal asterisks",type:"boolean"},strikethrough:{defaultValue:!1,describe:"Turn on/off strikethrough support",type:"boolean"},tables:{defaultValue:!1,describe:"Turn on/off tables support",type:"boolean"},tablesHeaderId:{defaultValue:!1,describe:"Add an id to table headers",type:"boolean"},ghCodeBlocks:{defaultValue:!0,describe:"Turn on/off GFM fenced code blocks support",type:"boolean"},tasklists:{defaultValue:!1,describe:"Turn on/off GFM tasklist support",type:"boolean"},smoothLivePreview:{defaultValue:!1,describe:"Prevents weird effects in live previews due to incomplete input",type:"boolean"},smartIndentationFix:{defaultValue:!1,description:"Tries to smartly fix indentation in es6 strings",type:"boolean"},disableForced4SpacesIndentedSublists:{defaultValue:!1,description:"Disables the requirement of indenting nested sublists by 4 spaces",type:"boolean"},simpleLineBreaks:{defaultValue:!1,description:"Parses simple line breaks as
(GFM Style)",type:"boolean"},requireSpaceBeforeHeadingText:{defaultValue:!1,description:"Makes adding a space between `#` and the header text mandatory (GFM Style)",type:"boolean"},ghMentions:{defaultValue:!1,description:"Enables github @mentions",type:"boolean"},ghMentionsLink:{defaultValue:"https://github.com/{u}",description:"Changes the link generated by @mentions. Only applies if ghMentions option is enabled.",type:"string"},encodeEmails:{defaultValue:!0,description:"Encode e-mail addresses through the use of Character Entities, transforming ASCII e-mail addresses into its equivalent decimal entities",type:"boolean"},openLinksInNewWindow:{defaultValue:!1,description:"Open all links in new windows",type:"boolean"},backslashEscapesHTMLTags:{defaultValue:!1,description:"Support for HTML Tag escaping. ex:
foo
",type:"boolean"},emoji:{defaultValue:!1,description:"Enable emoji support. Ex: `this is a :smile: emoji`",type:"boolean"},underline:{defaultValue:!1,description:"Enable support for underline. Syntax is double or triple underscores: `__underline word__`. With this option enabled, underscores no longer parses into `` and ``",type:"boolean"},completeHTMLDocument:{defaultValue:!1,description:"Outputs a complete html document, including ``, `` and `` tags",type:"boolean"},metadata:{defaultValue:!1,description:"Enable support for document metadata (defined at the top of the document between `«««` and `»»»` or between `---` and `---`).",type:"boolean"},splitAdjacentBlockquotes:{defaultValue:!1,description:"Split adjacent blockquote blocks",type:"boolean"}};if(!1===e)return JSON.parse(JSON.stringify(r));var t={};for(var a in r)r.hasOwnProperty(a)&&(t[a]=r[a].defaultValue);return t}function r(e,r){"use strict";var t=r?"Error in "+r+" extension->":"Error in unnamed extension",n={valid:!0,error:""};a.helper.isArray(e)||(e=[e]);for(var s=0;s").replace(/&/g,"&")};var c=function(e,r,t,a){"use strict";var n,s,o,i,l,c=a||"",u=c.indexOf("g")>-1,d=new RegExp(r+"|"+t,"g"+c.replace(/g/g,"")),p=new RegExp(r,c.replace(/g/g,"")),h=[];do{for(n=0;o=d.exec(e);)if(p.test(o[0]))n++||(i=(s=d.lastIndex)-o[0].length);else if(n&&!--n){l=o.index+o[0].length;var _={left:{start:i,end:s},match:{start:s,end:o.index},right:{start:o.index,end:l},wholeMatch:{start:i,end:l}};if(h.push(_),!u)return h}}while(n&&(d.lastIndex=s));return h};a.helper.matchRecursiveRegExp=function(e,r,t,a){"use strict";for(var n=c(e,r,t,a),s=[],o=0;o0){var d=[];0!==i[0].wholeMatch.start&&d.push(e.slice(0,i[0].wholeMatch.start));for(var p=0;p=0?n+(t||0):n},a.helper.splitAtIndex=function(e,r){"use strict";if(!a.helper.isString(e))throw"InvalidArgumentError: first parameter of showdown.helper.regexIndexOf function must be a string";return[e.substring(0,r),e.substring(r)]},a.helper.encodeEmailAddress=function(e){"use strict";var r=[function(e){return"&#"+e.charCodeAt(0)+";"},function(e){return"&#x"+e.charCodeAt(0).toString(16)+";"},function(e){return e}];return e=e.replace(/./g,function(e){if("@"===e)e=r[Math.floor(2*Math.random())](e);else{var t=Math.random();e=t>.9?r[2](e):t>.45?r[1](e):r[0](e)}return e})},a.helper.padEnd=function(e,r,t){"use strict";return r>>=0,t=String(t||" "),e.length>r?String(e):((r-=e.length)>t.length&&(t+=t.repeat(r/t.length)),String(e)+t.slice(0,r))},"undefined"==typeof console&&(console={warn:function(e){"use strict";alert(e)},log:function(e){"use strict";alert(e)},error:function(e){"use strict";throw e}}),a.helper.regexes={asteriskDashAndColon:/([*_:~])/g},a.helper.emojis={"+1":"👍","-1":"👎",100:"💯",1234:"🔢","1st_place_medal":"🥇","2nd_place_medal":"🥈","3rd_place_medal":"🥉","8ball":"🎱",a:"🅰️",ab:"🆎",abc:"🔤",abcd:"🔡",accept:"🉑",aerial_tramway:"🚡",airplane:"✈️",alarm_clock:"⏰",alembic:"⚗️",alien:"👽",ambulance:"🚑",amphora:"🏺",anchor:"⚓️",angel:"👼",anger:"💢",angry:"😠",anguished:"😧",ant:"🐜",apple:"🍎",aquarius:"♒️",aries:"♈️",arrow_backward:"◀️",arrow_double_down:"⏬",arrow_double_up:"⏫",arrow_down:"⬇️",arrow_down_small:"🔽",arrow_forward:"▶️",arrow_heading_down:"⤵️",arrow_heading_up:"⤴️",arrow_left:"⬅️",arrow_lower_left:"↙️",arrow_lower_right:"↘️",arrow_right:"➡️",arrow_right_hook:"↪️",arrow_up:"⬆️",arrow_up_down:"↕️",arrow_up_small:"🔼",arrow_upper_left:"↖️",arrow_upper_right:"↗️",arrows_clockwise:"🔃",arrows_counterclockwise:"🔄",art:"🎨",articulated_lorry:"🚛",artificial_satellite:"🛰",astonished:"😲",athletic_shoe:"👟",atm:"🏧",atom_symbol:"⚛️",avocado:"🥑",b:"🅱️",baby:"👶",baby_bottle:"🍼",baby_chick:"🐤",baby_symbol:"🚼",back:"🔙",bacon:"🥓",badminton:"🏸",baggage_claim:"🛄",baguette_bread:"🥖",balance_scale:"⚖️",balloon:"🎈",ballot_box:"🗳",ballot_box_with_check:"☑️",bamboo:"🎍",banana:"🍌",bangbang:"‼️",bank:"🏦",bar_chart:"📊",barber:"💈",baseball:"⚾️",basketball:"🏀",basketball_man:"⛹️",basketball_woman:"⛹️‍♀️",bat:"🦇",bath:"🛀",bathtub:"🛁",battery:"🔋",beach_umbrella:"🏖",bear:"🐻",bed:"🛏",bee:"🐝",beer:"🍺",beers:"🍻",beetle:"🐞",beginner:"🔰",bell:"🔔",bellhop_bell:"🛎",bento:"🍱",biking_man:"🚴",bike:"🚲",biking_woman:"🚴‍♀️",bikini:"👙",biohazard:"☣️",bird:"🐦",birthday:"🎂",black_circle:"⚫️",black_flag:"🏴",black_heart:"🖤",black_joker:"🃏",black_large_square:"⬛️",black_medium_small_square:"◾️",black_medium_square:"◼️",black_nib:"✒️",black_small_square:"▪️",black_square_button:"🔲",blonde_man:"👱",blonde_woman:"👱‍♀️",blossom:"🌼",blowfish:"🐡",blue_book:"📘",blue_car:"🚙",blue_heart:"💙",blush:"😊",boar:"🐗",boat:"⛵️",bomb:"💣",book:"📖",bookmark:"🔖",bookmark_tabs:"📑",books:"📚",boom:"💥",boot:"👢",bouquet:"💐",bowing_man:"🙇",bow_and_arrow:"🏹",bowing_woman:"🙇‍♀️",bowling:"🎳",boxing_glove:"🥊",boy:"👦",bread:"🍞",bride_with_veil:"👰",bridge_at_night:"🌉",briefcase:"💼",broken_heart:"💔",bug:"🐛",building_construction:"🏗",bulb:"💡",bullettrain_front:"🚅",bullettrain_side:"🚄",burrito:"🌯",bus:"🚌",business_suit_levitating:"🕴",busstop:"🚏",bust_in_silhouette:"👤",busts_in_silhouette:"👥",butterfly:"🦋",cactus:"🌵",cake:"🍰",calendar:"📆",call_me_hand:"🤙",calling:"📲",camel:"🐫",camera:"📷",camera_flash:"📸",camping:"🏕",cancer:"♋️",candle:"🕯",candy:"🍬",canoe:"🛶",capital_abcd:"🔠",capricorn:"♑️",car:"🚗",card_file_box:"🗃",card_index:"📇",card_index_dividers:"🗂",carousel_horse:"🎠",carrot:"🥕",cat:"🐱",cat2:"🐈",cd:"💿",chains:"⛓",champagne:"🍾",chart:"💹",chart_with_downwards_trend:"📉",chart_with_upwards_trend:"📈",checkered_flag:"🏁",cheese:"🧀",cherries:"🍒",cherry_blossom:"🌸",chestnut:"🌰",chicken:"🐔",children_crossing:"🚸",chipmunk:"🐿",chocolate_bar:"🍫",christmas_tree:"🎄",church:"⛪️",cinema:"🎦",circus_tent:"🎪",city_sunrise:"🌇",city_sunset:"🌆",cityscape:"🏙",cl:"🆑",clamp:"🗜",clap:"👏",clapper:"🎬",classical_building:"🏛",clinking_glasses:"🥂",clipboard:"📋",clock1:"🕐",clock10:"🕙",clock1030:"🕥",clock11:"🕚",clock1130:"🕦",clock12:"🕛",clock1230:"🕧",clock130:"🕜",clock2:"🕑",clock230:"🕝",clock3:"🕒",clock330:"🕞",clock4:"🕓",clock430:"🕟",clock5:"🕔",clock530:"🕠",clock6:"🕕",clock630:"🕡",clock7:"🕖",clock730:"🕢",clock8:"🕗",clock830:"🕣",clock9:"🕘",clock930:"🕤",closed_book:"📕",closed_lock_with_key:"🔐",closed_umbrella:"🌂",cloud:"☁️",cloud_with_lightning:"🌩",cloud_with_lightning_and_rain:"⛈",cloud_with_rain:"🌧",cloud_with_snow:"🌨",clown_face:"🤡",clubs:"♣️",cocktail:"🍸",coffee:"☕️",coffin:"⚰️",cold_sweat:"😰",comet:"☄️",computer:"💻",computer_mouse:"🖱",confetti_ball:"🎊",confounded:"😖",confused:"😕",congratulations:"㊗️",construction:"🚧",construction_worker_man:"👷",construction_worker_woman:"👷‍♀️",control_knobs:"🎛",convenience_store:"🏪",cookie:"🍪",cool:"🆒",policeman:"👮",copyright:"©️",corn:"🌽",couch_and_lamp:"🛋",couple:"👫",couple_with_heart_woman_man:"💑",couple_with_heart_man_man:"👨‍❤️‍👨",couple_with_heart_woman_woman:"👩‍❤️‍👩",couplekiss_man_man:"👨‍❤️‍💋‍👨",couplekiss_man_woman:"💏",couplekiss_woman_woman:"👩‍❤️‍💋‍👩",cow:"🐮",cow2:"🐄",cowboy_hat_face:"🤠",crab:"🦀",crayon:"🖍",credit_card:"💳",crescent_moon:"🌙",cricket:"🏏",crocodile:"🐊",croissant:"🥐",crossed_fingers:"🤞",crossed_flags:"🎌",crossed_swords:"⚔️",crown:"👑",cry:"😢",crying_cat_face:"😿",crystal_ball:"🔮",cucumber:"🥒",cupid:"💘",curly_loop:"➰",currency_exchange:"💱",curry:"🍛",custard:"🍮",customs:"🛃",cyclone:"🌀",dagger:"🗡",dancer:"💃",dancing_women:"👯",dancing_men:"👯‍♂️",dango:"🍡",dark_sunglasses:"🕶",dart:"🎯",dash:"💨",date:"📅",deciduous_tree:"🌳",deer:"🦌",department_store:"🏬",derelict_house:"🏚",desert:"🏜",desert_island:"🏝",desktop_computer:"🖥",male_detective:"🕵️",diamond_shape_with_a_dot_inside:"💠",diamonds:"♦️",disappointed:"😞",disappointed_relieved:"😥",dizzy:"💫",dizzy_face:"😵",do_not_litter:"🚯",dog:"🐶",dog2:"🐕",dollar:"💵",dolls:"🎎",dolphin:"🐬",door:"🚪",doughnut:"🍩",dove:"🕊",dragon:"🐉",dragon_face:"🐲",dress:"👗",dromedary_camel:"🐪",drooling_face:"🤤",droplet:"💧",drum:"🥁",duck:"🦆",dvd:"📀","e-mail":"📧",eagle:"🦅",ear:"👂",ear_of_rice:"🌾",earth_africa:"🌍",earth_americas:"🌎",earth_asia:"🌏",egg:"🥚",eggplant:"🍆",eight_pointed_black_star:"✴️",eight_spoked_asterisk:"✳️",electric_plug:"🔌",elephant:"🐘",email:"✉️",end:"🔚",envelope_with_arrow:"📩",euro:"💶",european_castle:"🏰",european_post_office:"🏤",evergreen_tree:"🌲",exclamation:"❗️",expressionless:"😑",eye:"👁",eye_speech_bubble:"👁‍🗨",eyeglasses:"👓",eyes:"👀",face_with_head_bandage:"🤕",face_with_thermometer:"🤒",fist_oncoming:"👊",factory:"🏭",fallen_leaf:"🍂",family_man_woman_boy:"👪",family_man_boy:"👨‍👦",family_man_boy_boy:"👨‍👦‍👦",family_man_girl:"👨‍👧",family_man_girl_boy:"👨‍👧‍👦",family_man_girl_girl:"👨‍👧‍👧",family_man_man_boy:"👨‍👨‍👦",family_man_man_boy_boy:"👨‍👨‍👦‍👦",family_man_man_girl:"👨‍👨‍👧",family_man_man_girl_boy:"👨‍👨‍👧‍👦",family_man_man_girl_girl:"👨‍👨‍👧‍👧",family_man_woman_boy_boy:"👨‍👩‍👦‍👦",family_man_woman_girl:"👨‍👩‍👧",family_man_woman_girl_boy:"👨‍👩‍👧‍👦",family_man_woman_girl_girl:"👨‍👩‍👧‍👧",family_woman_boy:"👩‍👦",family_woman_boy_boy:"👩‍👦‍👦",family_woman_girl:"👩‍👧",family_woman_girl_boy:"👩‍👧‍👦",family_woman_girl_girl:"👩‍👧‍👧",family_woman_woman_boy:"👩‍👩‍👦",family_woman_woman_boy_boy:"👩‍👩‍👦‍👦",family_woman_woman_girl:"👩‍👩‍👧",family_woman_woman_girl_boy:"👩‍👩‍👧‍👦",family_woman_woman_girl_girl:"👩‍👩‍👧‍👧",fast_forward:"⏩",fax:"📠",fearful:"😨",feet:"🐾",female_detective:"🕵️‍♀️",ferris_wheel:"🎡",ferry:"⛴",field_hockey:"🏑",file_cabinet:"🗄",file_folder:"📁",film_projector:"📽",film_strip:"🎞",fire:"🔥",fire_engine:"🚒",fireworks:"🎆",first_quarter_moon:"🌓",first_quarter_moon_with_face:"🌛",fish:"🐟",fish_cake:"🍥",fishing_pole_and_fish:"🎣",fist_raised:"✊",fist_left:"🤛",fist_right:"🤜",flags:"🎏",flashlight:"🔦",fleur_de_lis:"⚜️",flight_arrival:"🛬",flight_departure:"🛫",floppy_disk:"💾",flower_playing_cards:"🎴",flushed:"😳",fog:"🌫",foggy:"🌁",football:"🏈",footprints:"👣",fork_and_knife:"🍴",fountain:"⛲️",fountain_pen:"🖋",four_leaf_clover:"🍀",fox_face:"🦊",framed_picture:"🖼",free:"🆓",fried_egg:"🍳",fried_shrimp:"🍤",fries:"🍟",frog:"🐸",frowning:"😦",frowning_face:"☹️",frowning_man:"🙍‍♂️",frowning_woman:"🙍",middle_finger:"🖕",fuelpump:"⛽️",full_moon:"🌕",full_moon_with_face:"🌝",funeral_urn:"⚱️",game_die:"🎲",gear:"⚙️",gem:"💎",gemini:"♊️",ghost:"👻",gift:"🎁",gift_heart:"💝",girl:"👧",globe_with_meridians:"🌐",goal_net:"🥅",goat:"🐐",golf:"⛳️",golfing_man:"🏌️",golfing_woman:"🏌️‍♀️",gorilla:"🦍",grapes:"🍇",green_apple:"🍏",green_book:"📗",green_heart:"💚",green_salad:"🥗",grey_exclamation:"❕",grey_question:"❔",grimacing:"😬",grin:"😁",grinning:"😀",guardsman:"💂",guardswoman:"💂‍♀️",guitar:"🎸",gun:"🔫",haircut_woman:"💇",haircut_man:"💇‍♂️",hamburger:"🍔",hammer:"🔨",hammer_and_pick:"⚒",hammer_and_wrench:"🛠",hamster:"🐹",hand:"✋",handbag:"👜",handshake:"🤝",hankey:"💩",hatched_chick:"🐥",hatching_chick:"🐣",headphones:"🎧",hear_no_evil:"🙉",heart:"❤️",heart_decoration:"💟",heart_eyes:"😍",heart_eyes_cat:"😻",heartbeat:"💓",heartpulse:"💗",hearts:"♥️",heavy_check_mark:"✔️",heavy_division_sign:"➗",heavy_dollar_sign:"💲",heavy_heart_exclamation:"❣️",heavy_minus_sign:"➖",heavy_multiplication_x:"✖️",heavy_plus_sign:"➕",helicopter:"🚁",herb:"🌿",hibiscus:"🌺",high_brightness:"🔆",high_heel:"👠",hocho:"🔪",hole:"🕳",honey_pot:"🍯",horse:"🐴",horse_racing:"🏇",hospital:"🏥",hot_pepper:"🌶",hotdog:"🌭",hotel:"🏨",hotsprings:"♨️",hourglass:"⌛️",hourglass_flowing_sand:"⏳",house:"🏠",house_with_garden:"🏡",houses:"🏘",hugs:"🤗",hushed:"😯",ice_cream:"🍨",ice_hockey:"🏒",ice_skate:"⛸",icecream:"🍦",id:"🆔",ideograph_advantage:"🉐",imp:"👿",inbox_tray:"📥",incoming_envelope:"📨",tipping_hand_woman:"💁",information_source:"ℹ️",innocent:"😇",interrobang:"⁉️",iphone:"📱",izakaya_lantern:"🏮",jack_o_lantern:"🎃",japan:"🗾",japanese_castle:"🏯",japanese_goblin:"👺",japanese_ogre:"👹",jeans:"👖",joy:"😂",joy_cat:"😹",joystick:"🕹",kaaba:"🕋",key:"🔑",keyboard:"⌨️",keycap_ten:"🔟",kick_scooter:"🛴",kimono:"👘",kiss:"💋",kissing:"😗",kissing_cat:"😽",kissing_closed_eyes:"😚",kissing_heart:"😘",kissing_smiling_eyes:"😙",kiwi_fruit:"🥝",koala:"🐨",koko:"🈁",label:"🏷",large_blue_circle:"🔵",large_blue_diamond:"🔷",large_orange_diamond:"🔶",last_quarter_moon:"🌗",last_quarter_moon_with_face:"🌜",latin_cross:"✝️",laughing:"😆",leaves:"🍃",ledger:"📒",left_luggage:"🛅",left_right_arrow:"↔️",leftwards_arrow_with_hook:"↩️",lemon:"🍋",leo:"♌️",leopard:"🐆",level_slider:"🎚",libra:"♎️",light_rail:"🚈",link:"🔗",lion:"🦁",lips:"👄",lipstick:"💄",lizard:"🦎",lock:"🔒",lock_with_ink_pen:"🔏",lollipop:"🍭",loop:"➿",loud_sound:"🔊",loudspeaker:"📢",love_hotel:"🏩",love_letter:"💌",low_brightness:"🔅",lying_face:"🤥",m:"Ⓜ️",mag:"🔍",mag_right:"🔎",mahjong:"🀄️",mailbox:"📫",mailbox_closed:"📪",mailbox_with_mail:"📬",mailbox_with_no_mail:"📭",man:"👨",man_artist:"👨‍🎨",man_astronaut:"👨‍🚀",man_cartwheeling:"🤸‍♂️",man_cook:"👨‍🍳",man_dancing:"🕺",man_facepalming:"🤦‍♂️",man_factory_worker:"👨‍🏭",man_farmer:"👨‍🌾",man_firefighter:"👨‍🚒",man_health_worker:"👨‍⚕️",man_in_tuxedo:"🤵",man_judge:"👨‍⚖️",man_juggling:"🤹‍♂️",man_mechanic:"👨‍🔧",man_office_worker:"👨‍💼",man_pilot:"👨‍✈️",man_playing_handball:"🤾‍♂️",man_playing_water_polo:"🤽‍♂️",man_scientist:"👨‍🔬",man_shrugging:"🤷‍♂️",man_singer:"👨‍🎤",man_student:"👨‍🎓",man_teacher:"👨‍🏫",man_technologist:"👨‍💻",man_with_gua_pi_mao:"👲",man_with_turban:"👳",tangerine:"🍊",mans_shoe:"👞",mantelpiece_clock:"🕰",maple_leaf:"🍁",martial_arts_uniform:"🥋",mask:"😷",massage_woman:"💆",massage_man:"💆‍♂️",meat_on_bone:"🍖",medal_military:"🎖",medal_sports:"🏅",mega:"📣",melon:"🍈",memo:"📝",men_wrestling:"🤼‍♂️",menorah:"🕎",mens:"🚹",metal:"🤘",metro:"🚇",microphone:"🎤",microscope:"🔬",milk_glass:"🥛",milky_way:"🌌",minibus:"🚐",minidisc:"💽",mobile_phone_off:"📴",money_mouth_face:"🤑",money_with_wings:"💸",moneybag:"💰",monkey:"🐒",monkey_face:"🐵",monorail:"🚝",moon:"🌔",mortar_board:"🎓",mosque:"🕌",motor_boat:"🛥",motor_scooter:"🛵",motorcycle:"🏍",motorway:"🛣",mount_fuji:"🗻",mountain:"⛰",mountain_biking_man:"🚵",mountain_biking_woman:"🚵‍♀️",mountain_cableway:"🚠",mountain_railway:"🚞",mountain_snow:"🏔",mouse:"🐭",mouse2:"🐁",movie_camera:"🎥",moyai:"🗿",mrs_claus:"🤶",muscle:"💪",mushroom:"🍄",musical_keyboard:"🎹",musical_note:"🎵",musical_score:"🎼",mute:"🔇",nail_care:"💅",name_badge:"📛",national_park:"🏞",nauseated_face:"🤢",necktie:"👔",negative_squared_cross_mark:"❎",nerd_face:"🤓",neutral_face:"😐",new:"🆕",new_moon:"🌑",new_moon_with_face:"🌚",newspaper:"📰",newspaper_roll:"🗞",next_track_button:"⏭",ng:"🆖",no_good_man:"🙅‍♂️",no_good_woman:"🙅",night_with_stars:"🌃",no_bell:"🔕",no_bicycles:"🚳",no_entry:"⛔️",no_entry_sign:"🚫",no_mobile_phones:"📵",no_mouth:"😶",no_pedestrians:"🚷",no_smoking:"🚭","non-potable_water":"🚱",nose:"👃",notebook:"📓",notebook_with_decorative_cover:"📔",notes:"🎶",nut_and_bolt:"🔩",o:"⭕️",o2:"🅾️",ocean:"🌊",octopus:"🐙",oden:"🍢",office:"🏢",oil_drum:"🛢",ok:"🆗",ok_hand:"👌",ok_man:"🙆‍♂️",ok_woman:"🙆",old_key:"🗝",older_man:"👴",older_woman:"👵",om:"🕉",on:"🔛",oncoming_automobile:"🚘",oncoming_bus:"🚍",oncoming_police_car:"🚔",oncoming_taxi:"🚖",open_file_folder:"📂",open_hands:"👐",open_mouth:"😮",open_umbrella:"☂️",ophiuchus:"⛎",orange_book:"📙",orthodox_cross:"☦️",outbox_tray:"📤",owl:"🦉",ox:"🐂",package:"📦",page_facing_up:"📄",page_with_curl:"📃",pager:"📟",paintbrush:"🖌",palm_tree:"🌴",pancakes:"🥞",panda_face:"🐼",paperclip:"📎",paperclips:"🖇",parasol_on_ground:"⛱",parking:"🅿️",part_alternation_mark:"〽️",partly_sunny:"⛅️",passenger_ship:"🛳",passport_control:"🛂",pause_button:"⏸",peace_symbol:"☮️",peach:"🍑",peanuts:"🥜",pear:"🍐",pen:"🖊",pencil2:"✏️",penguin:"🐧",pensive:"😔",performing_arts:"🎭",persevere:"😣",person_fencing:"🤺",pouting_woman:"🙎",phone:"☎️",pick:"⛏",pig:"🐷",pig2:"🐖",pig_nose:"🐽",pill:"💊",pineapple:"🍍",ping_pong:"🏓",pisces:"♓️",pizza:"🍕",place_of_worship:"🛐",plate_with_cutlery:"🍽",play_or_pause_button:"⏯",point_down:"👇",point_left:"👈",point_right:"👉",point_up:"☝️",point_up_2:"👆",police_car:"🚓",policewoman:"👮‍♀️",poodle:"🐩",popcorn:"🍿",post_office:"🏣",postal_horn:"📯",postbox:"📮",potable_water:"🚰",potato:"🥔",pouch:"👝",poultry_leg:"🍗",pound:"💷",rage:"😡",pouting_cat:"😾",pouting_man:"🙎‍♂️",pray:"🙏",prayer_beads:"📿",pregnant_woman:"🤰",previous_track_button:"⏮",prince:"🤴",princess:"👸",printer:"🖨",purple_heart:"💜",purse:"👛",pushpin:"📌",put_litter_in_its_place:"🚮",question:"❓",rabbit:"🐰",rabbit2:"🐇",racehorse:"🐎",racing_car:"🏎",radio:"📻",radio_button:"🔘",radioactive:"☢️",railway_car:"🚃",railway_track:"🛤",rainbow:"🌈",rainbow_flag:"🏳️‍🌈",raised_back_of_hand:"🤚",raised_hand_with_fingers_splayed:"🖐",raised_hands:"🙌",raising_hand_woman:"🙋",raising_hand_man:"🙋‍♂️",ram:"🐏",ramen:"🍜",rat:"🐀",record_button:"⏺",recycle:"♻️",red_circle:"🔴",registered:"®️",relaxed:"☺️",relieved:"😌",reminder_ribbon:"🎗",repeat:"🔁",repeat_one:"🔂",rescue_worker_helmet:"⛑",restroom:"🚻",revolving_hearts:"💞",rewind:"⏪",rhinoceros:"🦏",ribbon:"🎀",rice:"🍚",rice_ball:"🍙",rice_cracker:"🍘",rice_scene:"🎑",right_anger_bubble:"🗯",ring:"💍",robot:"🤖",rocket:"🚀",rofl:"🤣",roll_eyes:"🙄",roller_coaster:"🎢",rooster:"🐓",rose:"🌹",rosette:"🏵",rotating_light:"🚨",round_pushpin:"📍",rowing_man:"🚣",rowing_woman:"🚣‍♀️",rugby_football:"🏉",running_man:"🏃",running_shirt_with_sash:"🎽",running_woman:"🏃‍♀️",sa:"🈂️",sagittarius:"♐️",sake:"🍶",sandal:"👡",santa:"🎅",satellite:"📡",saxophone:"🎷",school:"🏫",school_satchel:"🎒",scissors:"✂️",scorpion:"🦂",scorpius:"♏️",scream:"😱",scream_cat:"🙀",scroll:"📜",seat:"💺",secret:"㊙️",see_no_evil:"🙈",seedling:"🌱",selfie:"🤳",shallow_pan_of_food:"🥘",shamrock:"☘️",shark:"🦈",shaved_ice:"🍧",sheep:"🐑",shell:"🐚",shield:"🛡",shinto_shrine:"⛩",ship:"🚢",shirt:"👕",shopping:"🛍",shopping_cart:"🛒",shower:"🚿",shrimp:"🦐",signal_strength:"📶",six_pointed_star:"🔯",ski:"🎿",skier:"⛷",skull:"💀",skull_and_crossbones:"☠️",sleeping:"😴",sleeping_bed:"🛌",sleepy:"😪",slightly_frowning_face:"🙁",slightly_smiling_face:"🙂",slot_machine:"🎰",small_airplane:"🛩",small_blue_diamond:"🔹",small_orange_diamond:"🔸",small_red_triangle:"🔺",small_red_triangle_down:"🔻",smile:"😄",smile_cat:"😸",smiley:"😃",smiley_cat:"😺",smiling_imp:"😈",smirk:"😏",smirk_cat:"😼",smoking:"🚬",snail:"🐌",snake:"🐍",sneezing_face:"🤧",snowboarder:"🏂",snowflake:"❄️",snowman:"⛄️",snowman_with_snow:"☃️",sob:"😭",soccer:"⚽️",soon:"🔜",sos:"🆘",sound:"🔉",space_invader:"👾",spades:"♠️",spaghetti:"🍝",sparkle:"❇️",sparkler:"🎇",sparkles:"✨",sparkling_heart:"💖",speak_no_evil:"🙊",speaker:"🔈",speaking_head:"🗣",speech_balloon:"💬",speedboat:"🚤",spider:"🕷",spider_web:"🕸",spiral_calendar:"🗓",spiral_notepad:"🗒",spoon:"🥄",squid:"🦑",stadium:"🏟",star:"⭐️",star2:"🌟",star_and_crescent:"☪️",star_of_david:"✡️",stars:"🌠",station:"🚉",statue_of_liberty:"🗽",steam_locomotive:"🚂",stew:"🍲",stop_button:"⏹",stop_sign:"🛑",stopwatch:"⏱",straight_ruler:"📏",strawberry:"🍓",stuck_out_tongue:"😛",stuck_out_tongue_closed_eyes:"😝",stuck_out_tongue_winking_eye:"😜",studio_microphone:"🎙",stuffed_flatbread:"🥙",sun_behind_large_cloud:"🌥",sun_behind_rain_cloud:"🌦",sun_behind_small_cloud:"🌤",sun_with_face:"🌞",sunflower:"🌻",sunglasses:"😎",sunny:"☀️",sunrise:"🌅",sunrise_over_mountains:"🌄",surfing_man:"🏄",surfing_woman:"🏄‍♀️",sushi:"🍣",suspension_railway:"🚟",sweat:"😓",sweat_drops:"💦",sweat_smile:"😅",sweet_potato:"🍠",swimming_man:"🏊",swimming_woman:"🏊‍♀️",symbols:"🔣",synagogue:"🕍",syringe:"💉",taco:"🌮",tada:"🎉",tanabata_tree:"🎋",taurus:"♉️",taxi:"🚕",tea:"🍵",telephone_receiver:"📞",telescope:"🔭",tennis:"🎾",tent:"⛺️",thermometer:"🌡",thinking:"🤔",thought_balloon:"💭",ticket:"🎫",tickets:"🎟",tiger:"🐯",tiger2:"🐅",timer_clock:"⏲",tipping_hand_man:"💁‍♂️",tired_face:"😫",tm:"™️",toilet:"🚽",tokyo_tower:"🗼",tomato:"🍅",tongue:"👅",top:"🔝",tophat:"🎩",tornado:"🌪",trackball:"🖲",tractor:"🚜",traffic_light:"🚥",train:"🚋",train2:"🚆",tram:"🚊",triangular_flag_on_post:"🚩",triangular_ruler:"📐",trident:"🔱",triumph:"😤",trolleybus:"🚎",trophy:"🏆",tropical_drink:"🍹",tropical_fish:"🐠",truck:"🚚",trumpet:"🎺",tulip:"🌷",tumbler_glass:"🥃",turkey:"🦃",turtle:"🐢",tv:"📺",twisted_rightwards_arrows:"🔀",two_hearts:"💕",two_men_holding_hands:"👬",two_women_holding_hands:"👭",u5272:"🈹",u5408:"🈴",u55b6:"🈺",u6307:"🈯️",u6708:"🈷️",u6709:"🈶",u6e80:"🈵",u7121:"🈚️",u7533:"🈸",u7981:"🈲",u7a7a:"🈳",umbrella:"☔️",unamused:"😒",underage:"🔞",unicorn:"🦄",unlock:"🔓",up:"🆙",upside_down_face:"🙃",v:"✌️",vertical_traffic_light:"🚦",vhs:"📼",vibration_mode:"📳",video_camera:"📹",video_game:"🎮",violin:"🎻",virgo:"♍️",volcano:"🌋",volleyball:"🏐",vs:"🆚",vulcan_salute:"🖖",walking_man:"🚶",walking_woman:"🚶‍♀️",waning_crescent_moon:"🌘",waning_gibbous_moon:"🌖",warning:"⚠️",wastebasket:"🗑",watch:"⌚️",water_buffalo:"🐃",watermelon:"🍉",wave:"👋",wavy_dash:"〰️",waxing_crescent_moon:"🌒",wc:"🚾",weary:"😩",wedding:"💒",weight_lifting_man:"🏋️",weight_lifting_woman:"🏋️‍♀️",whale:"🐳",whale2:"🐋",wheel_of_dharma:"☸️",wheelchair:"♿️",white_check_mark:"✅",white_circle:"⚪️",white_flag:"🏳️",white_flower:"💮",white_large_square:"⬜️",white_medium_small_square:"◽️",white_medium_square:"◻️",white_small_square:"▫️",white_square_button:"🔳",wilted_flower:"🥀",wind_chime:"🎐",wind_face:"🌬",wine_glass:"🍷",wink:"😉",wolf:"🐺",woman:"👩",woman_artist:"👩‍🎨",woman_astronaut:"👩‍🚀",woman_cartwheeling:"🤸‍♀️",woman_cook:"👩‍🍳",woman_facepalming:"🤦‍♀️",woman_factory_worker:"👩‍🏭",woman_farmer:"👩‍🌾",woman_firefighter:"👩‍🚒",woman_health_worker:"👩‍⚕️",woman_judge:"👩‍⚖️",woman_juggling:"🤹‍♀️",woman_mechanic:"👩‍🔧",woman_office_worker:"👩‍💼",woman_pilot:"👩‍✈️",woman_playing_handball:"🤾‍♀️",woman_playing_water_polo:"🤽‍♀️",woman_scientist:"👩‍🔬",woman_shrugging:"🤷‍♀️",woman_singer:"👩‍🎤",woman_student:"👩‍🎓",woman_teacher:"👩‍🏫",woman_technologist:"👩‍💻",woman_with_turban:"👳‍♀️",womans_clothes:"👚",womans_hat:"👒",women_wrestling:"🤼‍♀️",womens:"🚺",world_map:"🗺",worried:"😟",wrench:"🔧",writing_hand:"✍️",x:"❌",yellow_heart:"💛",yen:"💴",yin_yang:"☯️",yum:"😋",zap:"⚡️",zipper_mouth_face:"🤐",zzz:"💤",octocat:':octocat:',showdown:"S"},a.Converter=function(e){"use strict";function t(e,t){if(t=t||null,a.helper.isString(e)){if(e=a.helper.stdExtName(e),t=e,a.extensions[e])return console.warn("DEPRECATION WARNING: "+e+" is an old extension that uses a deprecated loading method.Please inform the developer that the extension should be updated!"),void function(e,t){"function"==typeof e&&(e=e(new a.Converter));a.helper.isArray(e)||(e=[e]);var n=r(e,t);if(!n.valid)throw Error(n.error);for(var s=0;s[ \t]+¨NBSP;<"),!r){if(!window||!window.document)throw new Error("HTMLParser is undefined. If in a webworker or nodejs environment, you need to provide a WHATWG DOM and HTML such as JSDOM");r=window.document}var n=r.createElement("div");n.innerHTML=e;var s={preList:function(e){for(var r=e.querySelectorAll("pre"),t=[],n=0;n'}else t.push(r[n].innerHTML),r[n].innerHTML="",r[n].setAttribute("prenum",n.toString());return t}(n)};t(n);for(var o=n.childNodes,i="",l=0;l? ?(['"].*['"])?\)$/m)>-1)o="";else if(!o){if(s||(s=n.toLowerCase().replace(/ ?\n/g," ")),o="#"+s,a.helper.isUndefined(t.gUrls[s]))return e;o=t.gUrls[s],a.helper.isUndefined(t.gTitles[s])||(c=t.gTitles[s])}var u='"};return e=(e=t.converter._dispatch("anchors.before",e,r,t)).replace(/\[((?:\[[^\]]*]|[^\[\]])*)] ?(?:\n *)?\[(.*?)]()()()()/g,n),e=e.replace(/\[((?:\[[^\]]*]|[^\[\]])*)]()[ \t]*\([ \t]?<([^>]*)>(?:[ \t]*((["'])([^"]*?)\5))?[ \t]?\)/g,n),e=e.replace(/\[((?:\[[^\]]*]|[^\[\]])*)]()[ \t]*\([ \t]??(?:[ \t]*((["'])([^"]*?)\5))?[ \t]?\)/g,n),e=e.replace(/\[([^\[\]]+)]()()()()()/g,n),r.ghMentions&&(e=e.replace(/(^|\s)(\\)?(@([a-z\d]+(?:[a-z\d.-]+?[a-z\d]+)*))/gim,function(e,t,n,s,o){if("\\"===n)return t+s;if(!a.helper.isString(r.ghMentionsLink))throw new Error("ghMentionsLink option must be a string");var i=r.ghMentionsLink.replace(/\{u}/g,o),l="";return r.openLinksInNewWindow&&(l=' target="¨E95Eblank"'),t+'"+s+""})),e=t.converter._dispatch("anchors.after",e,r,t)});var u=/([*~_]+|\b)(((https?|ftp|dict):\/\/|www\.)[^'">\s]+?\.[^'">\s]+?)()(\1)?(?=\s|$)(?!["<>])/gi,d=/([*~_]+|\b)(((https?|ftp|dict):\/\/|www\.)[^'">\s]+\.[^'">\s]+?)([.!?,()\[\]])?(\1)?(?=\s|$)(?!["<>])/gi,p=/()<(((https?|ftp|dict):\/\/|www\.)[^'">\s]+)()>()/gi,h=/(^|\s)(?:mailto:)?([A-Za-z0-9!#$%&'*+-/=?^_`{|}~.]+@[-a-z0-9]+(\.[-a-z0-9]+)*\.[a-z]+)(?=$|\s)/gim,_=/<()(?:mailto:)?([-.\w]+@[-a-z0-9]+(\.[-a-z0-9]+)*\.[a-z]+)>/gi,g=function(e){"use strict";return function(r,t,n,s,o,i,l){var c=n=n.replace(a.helper.regexes.asteriskDashAndColon,a.helper.escapeCharactersCallback),u="",d="",p=t||"",h=l||"";return/^www\./i.test(n)&&(n=n.replace(/^www\./i,"http://www.")),e.excludeTrailingPunctuationFromURLs&&i&&(u=i),e.openLinksInNewWindow&&(d=' target="¨E95Eblank"'),p+'"+c+""+u+h}},m=function(e,r){"use strict";return function(t,n,s){var o="mailto:";return n=n||"",s=a.subParser("unescapeSpecialChars")(s,e,r),e.encodeEmails?(o=a.helper.encodeEmailAddress(o+s),s=a.helper.encodeEmailAddress(s)):o+=s,n+''+s+""}};a.subParser("autoLinks",function(e,r,t){"use strict";return e=t.converter._dispatch("autoLinks.before",e,r,t),e=e.replace(p,g(r)),e=e.replace(_,m(r,t)),e=t.converter._dispatch("autoLinks.after",e,r,t)}),a.subParser("simplifiedAutoLinks",function(e,r,t){"use strict";return r.simplifiedAutoLink?(e=t.converter._dispatch("simplifiedAutoLinks.before",e,r,t),e=r.excludeTrailingPunctuationFromURLs?e.replace(d,g(r)):e.replace(u,g(r)),e=e.replace(h,m(r,t)),e=t.converter._dispatch("simplifiedAutoLinks.after",e,r,t)):e}),a.subParser("blockGamut",function(e,r,t){"use strict";return e=t.converter._dispatch("blockGamut.before",e,r,t),e=a.subParser("blockQuotes")(e,r,t),e=a.subParser("headers")(e,r,t),e=a.subParser("horizontalRule")(e,r,t),e=a.subParser("lists")(e,r,t),e=a.subParser("codeBlocks")(e,r,t),e=a.subParser("tables")(e,r,t),e=a.subParser("hashHTMLBlocks")(e,r,t),e=a.subParser("paragraphs")(e,r,t),e=t.converter._dispatch("blockGamut.after",e,r,t)}),a.subParser("blockQuotes",function(e,r,t){"use strict";e=t.converter._dispatch("blockQuotes.before",e,r,t),e+="\n\n";var n=/(^ {0,3}>[ \t]?.+\n(.+\n)*\n*)+/gm;return r.splitAdjacentBlockquotes&&(n=/^ {0,3}>[\s\S]*?(?:\n\n)/gm),e=e.replace(n,function(e){return e=e.replace(/^[ \t]*>[ \t]?/gm,""),e=e.replace(/¨0/g,""),e=e.replace(/^[ \t]+$/gm,""),e=a.subParser("githubCodeBlocks")(e,r,t),e=a.subParser("blockGamut")(e,r,t),e=e.replace(/(^|\n)/g,"$1 "),e=e.replace(/(\s*
[^\r]+?<\/pre>)/gm,function(e,r){var t=r;return t=t.replace(/^  /gm,"¨0"),t=t.replace(/¨0/g,"")}),a.subParser("hashBlock")("
\n"+e+"\n
",r,t)}),e=t.converter._dispatch("blockQuotes.after",e,r,t)}),a.subParser("codeBlocks",function(e,r,t){"use strict";e=t.converter._dispatch("codeBlocks.before",e,r,t);return e=(e+="¨0").replace(/(?:\n\n|^)((?:(?:[ ]{4}|\t).*\n+)+)(\n*[ ]{0,3}[^ \t\n]|(?=¨0))/g,function(e,n,s){var o=n,i=s,l="\n";return o=a.subParser("outdent")(o,r,t),o=a.subParser("encodeCode")(o,r,t),o=a.subParser("detab")(o,r,t),o=o.replace(/^\n+/g,""),o=o.replace(/\n+$/g,""),r.omitExtraWLInCodeBlocks&&(l=""),o="
"+o+l+"
",a.subParser("hashBlock")(o,r,t)+i}),e=e.replace(/¨0/,""),e=t.converter._dispatch("codeBlocks.after",e,r,t)}),a.subParser("codeSpans",function(e,r,t){"use strict";return void 0===(e=t.converter._dispatch("codeSpans.before",e,r,t))&&(e=""),e=e.replace(/(^|[^\\])(`+)([^\r]*?[^`])\2(?!`)/gm,function(e,n,s,o){var i=o;return i=i.replace(/^([ \t]*)/g,""),i=i.replace(/[ \t]*$/g,""),i=a.subParser("encodeCode")(i,r,t),i=n+""+i+"",i=a.subParser("hashHTMLSpans")(i,r,t)}),e=t.converter._dispatch("codeSpans.after",e,r,t)}),a.subParser("completeHTMLDocument",function(e,r,t){"use strict";if(!r.completeHTMLDocument)return e;e=t.converter._dispatch("completeHTMLDocument.before",e,r,t);var a="html",n="\n",s="",o='\n',i="",l="";void 0!==t.metadata.parsed.doctype&&(n="\n","html"!==(a=t.metadata.parsed.doctype.toString().toLowerCase())&&"html5"!==a||(o=''));for(var c in t.metadata.parsed)if(t.metadata.parsed.hasOwnProperty(c))switch(c.toLowerCase()){case"doctype":break;case"title":s=""+t.metadata.parsed.title+"\n";break;case"charset":o="html"===a||"html5"===a?'\n':'\n';break;case"language":case"lang":i=' lang="'+t.metadata.parsed[c]+'"',l+='\n';break;default:l+='\n'}return e=n+"\n\n"+s+o+l+"\n\n"+e.trim()+"\n\n",e=t.converter._dispatch("completeHTMLDocument.after",e,r,t)}),a.subParser("detab",function(e,r,t){"use strict";return e=t.converter._dispatch("detab.before",e,r,t),e=e.replace(/\t(?=\t)/g," "),e=e.replace(/\t/g,"¨A¨B"),e=e.replace(/¨B(.+?)¨A/g,function(e,r){for(var t=r,a=4-t.length%4,n=0;n/g,">"),e=t.converter._dispatch("encodeAmpsAndAngles.after",e,r,t)}),a.subParser("encodeBackslashEscapes",function(e,r,t){"use strict";return e=t.converter._dispatch("encodeBackslashEscapes.before",e,r,t),e=e.replace(/\\(\\)/g,a.helper.escapeCharactersCallback),e=e.replace(/\\([`*_{}\[\]()>#+.!~=|-])/g,a.helper.escapeCharactersCallback),e=t.converter._dispatch("encodeBackslashEscapes.after",e,r,t)}),a.subParser("encodeCode",function(e,r,t){"use strict";return e=t.converter._dispatch("encodeCode.before",e,r,t),e=e.replace(/&/g,"&").replace(//g,">").replace(/([*_{}\[\]\\=~-])/g,a.helper.escapeCharactersCallback),e=t.converter._dispatch("encodeCode.after",e,r,t)}),a.subParser("escapeSpecialCharsWithinTagAttributes",function(e,r,t){"use strict";return e=(e=t.converter._dispatch("escapeSpecialCharsWithinTagAttributes.before",e,r,t)).replace(/<\/?[a-z\d_:-]+(?:[\s]+[\s\S]+?)?>/gi,function(e){return e.replace(/(.)<\/?code>(?=.)/g,"$1`").replace(/([\\`*_~=|])/g,a.helper.escapeCharactersCallback)}),e=e.replace(/-]|-[^>])(?:[^-]|-[^-])*)--)>/gi,function(e){return e.replace(/([\\`*_~=|])/g,a.helper.escapeCharactersCallback)}),e=t.converter._dispatch("escapeSpecialCharsWithinTagAttributes.after",e,r,t)}),a.subParser("githubCodeBlocks",function(e,r,t){"use strict";return r.ghCodeBlocks?(e=t.converter._dispatch("githubCodeBlocks.before",e,r,t),e+="¨0",e=e.replace(/(?:^|\n)(?: {0,3})(```+|~~~+)(?: *)([^\s`~]*)\n([\s\S]*?)\n(?: {0,3})\1/g,function(e,n,s,o){var i=r.omitExtraWLInCodeBlocks?"":"\n";return o=a.subParser("encodeCode")(o,r,t),o=a.subParser("detab")(o,r,t),o=o.replace(/^\n+/g,""),o=o.replace(/\n+$/g,""),o="
"+o+i+"
",o=a.subParser("hashBlock")(o,r,t),"\n\n¨G"+(t.ghCodeBlocks.push({text:e,codeblock:o})-1)+"G\n\n"}),e=e.replace(/¨0/,""),t.converter._dispatch("githubCodeBlocks.after",e,r,t)):e}),a.subParser("hashBlock",function(e,r,t){"use strict";return e=t.converter._dispatch("hashBlock.before",e,r,t),e=e.replace(/(^\n+|\n+$)/g,""),e="\n\n¨K"+(t.gHtmlBlocks.push(e)-1)+"K\n\n",e=t.converter._dispatch("hashBlock.after",e,r,t)}),a.subParser("hashCodeTags",function(e,r,t){"use strict";e=t.converter._dispatch("hashCodeTags.before",e,r,t);return e=a.helper.replaceRecursiveRegExp(e,function(e,n,s,o){var i=s+a.subParser("encodeCode")(n,r,t)+o;return"¨C"+(t.gHtmlSpans.push(i)-1)+"C"},"]*>","","gim"),e=t.converter._dispatch("hashCodeTags.after",e,r,t)}),a.subParser("hashElement",function(e,r,t){"use strict";return function(e,r){var a=r;return a=a.replace(/\n\n/g,"\n"),a=a.replace(/^\n/,""),a=a.replace(/\n+$/g,""),a="\n\n¨K"+(t.gHtmlBlocks.push(a)-1)+"K\n\n"}}),a.subParser("hashHTMLBlocks",function(e,r,t){"use strict";e=t.converter._dispatch("hashHTMLBlocks.before",e,r,t);var n=["pre","div","h1","h2","h3","h4","h5","h6","blockquote","table","dl","ol","ul","script","noscript","form","fieldset","iframe","math","style","section","header","footer","nav","article","aside","address","audio","canvas","figure","hgroup","output","video","p"],s=function(e,r,a,n){var s=e;return-1!==a.search(/\bmarkdown\b/)&&(s=a+t.converter.makeHtml(r)+n),"\n\n¨K"+(t.gHtmlBlocks.push(s)-1)+"K\n\n"};r.backslashEscapesHTMLTags&&(e=e.replace(/\\<(\/?[^>]+?)>/g,function(e,r){return"<"+r+">"}));for(var o=0;o]*>)","im"),c="<"+n[o]+"\\b[^>]*>",u="";-1!==(i=a.helper.regexIndexOf(e,l));){var d=a.helper.splitAtIndex(e,i),p=a.helper.replaceRecursiveRegExp(d[1],s,c,u,"im");if(p===d[1])break;e=d[0].concat(p)}return e=e.replace(/(\n {0,3}(<(hr)\b([^<>])*?\/?>)[ \t]*(?=\n{2,}))/g,a.subParser("hashElement")(e,r,t)),e=a.helper.replaceRecursiveRegExp(e,function(e){return"\n\n¨K"+(t.gHtmlBlocks.push(e)-1)+"K\n\n"},"^ {0,3}\x3c!--","--\x3e","gm"),e=e.replace(/(?:\n\n)( {0,3}(?:<([?%])[^\r]*?\2>)[ \t]*(?=\n{2,}))/g,a.subParser("hashElement")(e,r,t)),e=t.converter._dispatch("hashHTMLBlocks.after",e,r,t)}),a.subParser("hashHTMLSpans",function(e,r,t){"use strict";function a(e){return"¨C"+(t.gHtmlSpans.push(e)-1)+"C"}return e=t.converter._dispatch("hashHTMLSpans.before",e,r,t),e=e.replace(/<[^>]+?\/>/gi,function(e){return a(e)}),e=e.replace(/<([^>]+?)>[\s\S]*?<\/\1>/g,function(e){return a(e)}),e=e.replace(/<([^>]+?)\s[^>]+?>[\s\S]*?<\/\1>/g,function(e){return a(e)}),e=e.replace(/<[^>]+?>/gi,function(e){return a(e)}),e=t.converter._dispatch("hashHTMLSpans.after",e,r,t)}),a.subParser("unhashHTMLSpans",function(e,r,t){"use strict";e=t.converter._dispatch("unhashHTMLSpans.before",e,r,t);for(var a=0;a]*>\\s*]*>","^ {0,3}\\s*
","gim"),e=t.converter._dispatch("hashPreCodeTags.after",e,r,t)}),a.subParser("headers",function(e,r,t){"use strict";function n(e){var n,s;if(r.customizedHeaderId){var o=e.match(/\{([^{]+?)}\s*$/);o&&o[1]&&(e=o[1])}return n=e,s=a.helper.isString(r.prefixHeaderId)?r.prefixHeaderId:!0===r.prefixHeaderId?"section-":"",r.rawPrefixHeaderId||(n=s+n),n=r.ghCompatibleHeaderId?n.replace(/ /g,"-").replace(/&/g,"").replace(/¨T/g,"").replace(/¨D/g,"").replace(/[&+$,\/:;=?@"#{}|^¨~\[\]`\\*)(%.!'<>]/g,"").toLowerCase():r.rawHeaderId?n.replace(/ /g,"-").replace(/&/g,"&").replace(/¨T/g,"¨").replace(/¨D/g,"$").replace(/["']/g,"-").toLowerCase():n.replace(/[^\w]/g,"").toLowerCase(),r.rawPrefixHeaderId&&(n=s+n),t.hashLinkCounts[n]?n=n+"-"+t.hashLinkCounts[n]++:t.hashLinkCounts[n]=1,n}e=t.converter._dispatch("headers.before",e,r,t);var s=isNaN(parseInt(r.headerLevelStart))?1:parseInt(r.headerLevelStart),o=r.smoothLivePreview?/^(.+)[ \t]*\n={2,}[ \t]*\n+/gm:/^(.+)[ \t]*\n=+[ \t]*\n+/gm,i=r.smoothLivePreview?/^(.+)[ \t]*\n-{2,}[ \t]*\n+/gm:/^(.+)[ \t]*\n-+[ \t]*\n+/gm;e=(e=e.replace(o,function(e,o){var i=a.subParser("spanGamut")(o,r,t),l=r.noHeaderId?"":' id="'+n(o)+'"',c=""+i+"";return a.subParser("hashBlock")(c,r,t)})).replace(i,function(e,o){var i=a.subParser("spanGamut")(o,r,t),l=r.noHeaderId?"":' id="'+n(o)+'"',c=s+1,u=""+i+"";return a.subParser("hashBlock")(u,r,t)});var l=r.requireSpaceBeforeHeadingText?/^(#{1,6})[ \t]+(.+?)[ \t]*#*\n+/gm:/^(#{1,6})[ \t]*(.+?)[ \t]*#*\n+/gm;return e=e.replace(l,function(e,o,i){var l=i;r.customizedHeaderId&&(l=i.replace(/\s?\{([^{]+?)}\s*$/,""));var c=a.subParser("spanGamut")(l,r,t),u=r.noHeaderId?"":' id="'+n(i)+'"',d=s-1+o.length,p=""+c+"";return a.subParser("hashBlock")(p,r,t)}),e=t.converter._dispatch("headers.after",e,r,t)}),a.subParser("horizontalRule",function(e,r,t){"use strict";e=t.converter._dispatch("horizontalRule.before",e,r,t);var n=a.subParser("hashBlock")("
",r,t);return e=e.replace(/^ {0,2}( ?-){3,}[ \t]*$/gm,n),e=e.replace(/^ {0,2}( ?\*){3,}[ \t]*$/gm,n),e=e.replace(/^ {0,2}( ?_){3,}[ \t]*$/gm,n),e=t.converter._dispatch("horizontalRule.after",e,r,t)}),a.subParser("images",function(e,r,t){"use strict";function n(e,r,n,s,o,i,l,c){var u=t.gUrls,d=t.gTitles,p=t.gDimensions;if(n=n.toLowerCase(),c||(c=""),e.search(/\(? ?(['"].*['"])?\)$/m)>-1)s="";else if(""===s||null===s){if(""!==n&&null!==n||(n=r.toLowerCase().replace(/ ?\n/g," ")),s="#"+n,a.helper.isUndefined(u[n]))return e;s=u[n],a.helper.isUndefined(d[n])||(c=d[n]),a.helper.isUndefined(p[n])||(o=p[n].width,i=p[n].height)}r=r.replace(/"/g,""").replace(a.helper.regexes.asteriskDashAndColon,a.helper.escapeCharactersCallback);var h=''+r+'"}return e=(e=t.converter._dispatch("images.before",e,r,t)).replace(/!\[([^\]]*?)] ?(?:\n *)?\[([\s\S]*?)]()()()()()/g,n),e=e.replace(/!\[([^\]]*?)][ \t]*()\([ \t]??(?: =([*\d]+[A-Za-z%]{0,4})x([*\d]+[A-Za-z%]{0,4}))?[ \t]*(?:(["'])([^"]*?)\6)?[ \t]?\)/g,function(e,r,t,a,s,o,i,l){return a=a.replace(/\s/g,""),n(e,r,t,a,s,o,0,l)}),e=e.replace(/!\[([^\]]*?)][ \t]*()\([ \t]?<([^>]*)>(?: =([*\d]+[A-Za-z%]{0,4})x([*\d]+[A-Za-z%]{0,4}))?[ \t]*(?:(?:(["'])([^"]*?)\6))?[ \t]?\)/g,n),e=e.replace(/!\[([^\]]*?)][ \t]*()\([ \t]??(?: =([*\d]+[A-Za-z%]{0,4})x([*\d]+[A-Za-z%]{0,4}))?[ \t]*(?:(["'])([^"]*?)\6)?[ \t]?\)/g,n),e=e.replace(/!\[([^\[\]]+)]()()()()()/g,n),e=t.converter._dispatch("images.after",e,r,t)}),a.subParser("italicsAndBold",function(e,r,t){"use strict";function a(e,r,t){return r+e+t}return e=t.converter._dispatch("italicsAndBold.before",e,r,t),e=r.literalMidWordUnderscores?(e=(e=e.replace(/\b___(\S[\s\S]*?)___\b/g,function(e,r){return a(r,"","")})).replace(/\b__(\S[\s\S]*?)__\b/g,function(e,r){return a(r,"","")})).replace(/\b_(\S[\s\S]*?)_\b/g,function(e,r){return a(r,"","")}):(e=(e=e.replace(/___(\S[\s\S]*?)___/g,function(e,r){return/\S$/.test(r)?a(r,"",""):e})).replace(/__(\S[\s\S]*?)__/g,function(e,r){return/\S$/.test(r)?a(r,"",""):e})).replace(/_([^\s_][\s\S]*?)_/g,function(e,r){return/\S$/.test(r)?a(r,"",""):e}),e=r.literalMidWordAsterisks?(e=(e=e.replace(/([^*]|^)\B\*\*\*(\S[\s\S]*?)\*\*\*\B(?!\*)/g,function(e,r,t){return a(t,r+"","")})).replace(/([^*]|^)\B\*\*(\S[\s\S]*?)\*\*\B(?!\*)/g,function(e,r,t){return a(t,r+"","")})).replace(/([^*]|^)\B\*(\S[\s\S]*?)\*\B(?!\*)/g,function(e,r,t){return a(t,r+"","")}):(e=(e=e.replace(/\*\*\*(\S[\s\S]*?)\*\*\*/g,function(e,r){return/\S$/.test(r)?a(r,"",""):e})).replace(/\*\*(\S[\s\S]*?)\*\*/g,function(e,r){return/\S$/.test(r)?a(r,"",""):e})).replace(/\*([^\s*][\s\S]*?)\*/g,function(e,r){return/\S$/.test(r)?a(r,"",""):e}),e=t.converter._dispatch("italicsAndBold.after",e,r,t)}),a.subParser("lists",function(e,r,t){"use strict";function n(e,n){t.gListLevel++,e=e.replace(/\n{2,}$/,"\n");var s=/(\n)?(^ {0,3})([*+-]|\d+[.])[ \t]+((\[(x|X| )?])?[ \t]*[^\r]+?(\n{1,2}))(?=\n*(¨0| {0,3}([*+-]|\d+[.])[ \t]+))/gm,o=/\n[ \t]*\n(?!¨0)/.test(e+="¨0");return r.disableForced4SpacesIndentedSublists&&(s=/(\n)?(^ {0,3})([*+-]|\d+[.])[ \t]+((\[(x|X| )?])?[ \t]*[^\r]+?(\n{1,2}))(?=\n*(¨0|\2([*+-]|\d+[.])[ \t]+))/gm),e=e.replace(s,function(e,n,s,i,l,c,u){u=u&&""!==u.trim();var d=a.subParser("outdent")(l,r,t),p="";return c&&r.tasklists&&(p=' class="task-list-item" style="list-style-type: none;"',d=d.replace(/^[ \t]*\[(x|X| )?]/m,function(){var e='-1?(d=a.subParser("githubCodeBlocks")(d,r,t),d=a.subParser("blockGamut")(d,r,t)):(d=(d=a.subParser("lists")(d,r,t)).replace(/\n$/,""),d=(d=a.subParser("hashHTMLBlocks")(d,r,t)).replace(/\n\n+/g,"\n\n"),d=o?a.subParser("paragraphs")(d,r,t):a.subParser("spanGamut")(d,r,t)),d=d.replace("¨A",""),d=""+d+"\n"}),e=e.replace(/¨0/g,""),t.gListLevel--,n&&(e=e.replace(/\s+$/,"")),e}function s(e,r){if("ol"===r){var t=e.match(/^ *(\d+)\./);if(t&&"1"!==t[1])return' start="'+t[1]+'"'}return""}function o(e,t,a){var o=r.disableForced4SpacesIndentedSublists?/^ ?\d+\.[ \t]/gm:/^ {0,3}\d+\.[ \t]/gm,i=r.disableForced4SpacesIndentedSublists?/^ ?[*+-][ \t]/gm:/^ {0,3}[*+-][ \t]/gm,l="ul"===t?o:i,c="";if(-1!==e.search(l))!function r(u){var d=u.search(l),p=s(e,t);-1!==d?(c+="\n\n<"+t+p+">\n"+n(u.slice(0,d),!!a)+"\n",l="ul"===(t="ul"===t?"ol":"ul")?o:i,r(u.slice(d))):c+="\n\n<"+t+p+">\n"+n(u,!!a)+"\n"}(e);else{var u=s(e,t);c="\n\n<"+t+u+">\n"+n(e,!!a)+"\n"}return c}return e=t.converter._dispatch("lists.before",e,r,t),e+="¨0",e=t.gListLevel?e.replace(/^(( {0,3}([*+-]|\d+[.])[ \t]+)[^\r]+?(¨0|\n{2,}(?=\S)(?![ \t]*(?:[*+-]|\d+[.])[ \t]+)))/gm,function(e,r,t){return o(r,t.search(/[*+-]/g)>-1?"ul":"ol",!0)}):e.replace(/(\n\n|^\n?)(( {0,3}([*+-]|\d+[.])[ \t]+)[^\r]+?(¨0|\n{2,}(?=\S)(?![ \t]*(?:[*+-]|\d+[.])[ \t]+)))/gm,function(e,r,t,a){return o(t,a.search(/[*+-]/g)>-1?"ul":"ol",!1)}),e=e.replace(/¨0/,""),e=t.converter._dispatch("lists.after",e,r,t)}),a.subParser("metadata",function(e,r,t){"use strict";function a(e){t.metadata.raw=e,(e=(e=e.replace(/&/g,"&").replace(/"/g,""")).replace(/\n {4}/g," ")).replace(/^([\S ]+): +([\s\S]+?)$/gm,function(e,r,a){return t.metadata.parsed[r]=a,""})}return r.metadata?(e=t.converter._dispatch("metadata.before",e,r,t),e=e.replace(/^\s*«««+(\S*?)\n([\s\S]+?)\n»»»+\n/,function(e,r,t){return a(t),"¨M"}),e=e.replace(/^\s*---+(\S*?)\n([\s\S]+?)\n---+\n/,function(e,r,n){return r&&(t.metadata.format=r),a(n),"¨M"}),e=e.replace(/¨M/g,""),e=t.converter._dispatch("metadata.after",e,r,t)):e}),a.subParser("outdent",function(e,r,t){"use strict";return e=t.converter._dispatch("outdent.before",e,r,t),e=e.replace(/^(\t|[ ]{1,4})/gm,"¨0"),e=e.replace(/¨0/g,""),e=t.converter._dispatch("outdent.after",e,r,t)}),a.subParser("paragraphs",function(e,r,t){"use strict";for(var n=(e=(e=(e=t.converter._dispatch("paragraphs.before",e,r,t)).replace(/^\n+/g,"")).replace(/\n+$/g,"")).split(/\n{2,}/g),s=[],o=n.length,i=0;i=0?s.push(l):l.search(/\S/)>=0&&(l=(l=a.subParser("spanGamut")(l,r,t)).replace(/^([ \t]*)/g,"

"),l+="

",s.push(l))}for(o=s.length,i=0;i]*>\s*]*>/.test(u)&&(d=!0)}s[i]=u}return e=s.join("\n"),e=e.replace(/^\n+/g,""),e=e.replace(/\n+$/g,""),t.converter._dispatch("paragraphs.after",e,r,t)}),a.subParser("runExtension",function(e,r,t,a){"use strict";if(e.filter)r=e.filter(r,a.converter,t);else if(e.regex){var n=e.regex;n instanceof RegExp||(n=new RegExp(n,"g")),r=r.replace(n,e.replace)}return r}),a.subParser("spanGamut",function(e,r,t){"use strict";return e=t.converter._dispatch("spanGamut.before",e,r,t),e=a.subParser("codeSpans")(e,r,t),e=a.subParser("escapeSpecialCharsWithinTagAttributes")(e,r,t),e=a.subParser("encodeBackslashEscapes")(e,r,t),e=a.subParser("images")(e,r,t),e=a.subParser("anchors")(e,r,t),e=a.subParser("autoLinks")(e,r,t),e=a.subParser("simplifiedAutoLinks")(e,r,t),e=a.subParser("emoji")(e,r,t),e=a.subParser("underline")(e,r,t),e=a.subParser("italicsAndBold")(e,r,t),e=a.subParser("strikethrough")(e,r,t),e=a.subParser("ellipsis")(e,r,t),e=a.subParser("hashHTMLSpans")(e,r,t),e=a.subParser("encodeAmpsAndAngles")(e,r,t),r.simpleLineBreaks?/\n\n¨K/.test(e)||(e=e.replace(/\n+/g,"
\n")):e=e.replace(/ +\n/g,"
\n"),e=t.converter._dispatch("spanGamut.after",e,r,t)}),a.subParser("strikethrough",function(e,r,t){"use strict";return r.strikethrough&&(e=(e=t.converter._dispatch("strikethrough.before",e,r,t)).replace(/(?:~){2}([\s\S]+?)(?:~){2}/g,function(e,n){return function(e){return r.simplifiedAutoLink&&(e=a.subParser("simplifiedAutoLinks")(e,r,t)),""+e+""}(n)}),e=t.converter._dispatch("strikethrough.after",e,r,t)),e}),a.subParser("stripLinkDefinitions",function(e,r,t){"use strict";var n=function(e,n,s,o,i,l,c){return n=n.toLowerCase(),s.match(/^data:.+?\/.+?;base64,/)?t.gUrls[n]=s.replace(/\s/g,""):t.gUrls[n]=a.subParser("encodeAmpsAndAngles")(s,r,t),l?l+c:(c&&(t.gTitles[n]=c.replace(/"|'/g,""")),r.parseImgDimensions&&o&&i&&(t.gDimensions[n]={width:o,height:i}),"")};return e=(e+="¨0").replace(/^ {0,3}\[(.+)]:[ \t]*\n?[ \t]*?(?: =([*\d]+[A-Za-z%]{0,4})x([*\d]+[A-Za-z%]{0,4}))?[ \t]*\n?[ \t]*(?:(\n*)["|'(](.+?)["|')][ \t]*)?(?:\n\n|(?=¨0)|(?=\n\[))/gm,n),e=e.replace(/^ {0,3}\[(.+)]:[ \t]*\n?[ \t]*\s]+)>?(?: =([*\d]+[A-Za-z%]{0,4})x([*\d]+[A-Za-z%]{0,4}))?[ \t]*\n?[ \t]*(?:(\n*)["|'(](.+?)["|')][ \t]*)?(?:\n+|(?=¨0))/gm,n),e=e.replace(/¨0/,"")}),a.subParser("tables",function(e,r,t){"use strict";function n(e){return/^:[ \t]*--*$/.test(e)?' style="text-align:left;"':/^--*[ \t]*:[ \t]*$/.test(e)?' style="text-align:right;"':/^:[ \t]*--*[ \t]*:$/.test(e)?' style="text-align:center;"':""}function s(e,n){var s="";return e=e.trim(),(r.tablesHeaderId||r.tableHeaderId)&&(s=' id="'+e.replace(/ /g,"_").toLowerCase()+'"'),e=a.subParser("spanGamut")(e,r,t),""+e+"\n"}function o(e,n){return""+a.subParser("spanGamut")(e,r,t)+"\n"}function i(e){var i,l=e.split("\n");for(i=0;i\n\n\n",n=0;n\n";for(var s=0;s\n"}return t+="\n\n"}(p,_)}if(!r.tables)return e;return e=t.converter._dispatch("tables.before",e,r,t),e=e.replace(/\\(\|)/g,a.helper.escapeCharactersCallback),e=e.replace(/^ {0,3}\|?.+\|.+\n {0,3}\|?[ \t]*:?[ \t]*(?:[-=]){2,}[ \t]*:?[ \t]*\|[ \t]*:?[ \t]*(?:[-=]){2,}[\s\S]+?(?:\n\n|¨0)/gm,i),e=e.replace(/^ {0,3}\|.+\|[ \t]*\n {0,3}\|[ \t]*:?[ \t]*(?:[-=]){2,}[ \t]*:?[ \t]*\|[ \t]*\n( {0,3}\|.+\|[ \t]*\n)*(?:\n|¨0)/gm,i),e=t.converter._dispatch("tables.after",e,r,t)}),a.subParser("underline",function(e,r,t){"use strict";return r.underline?(e=t.converter._dispatch("underline.before",e,r,t),e=r.literalMidWordUnderscores?(e=e.replace(/\b___(\S[\s\S]*?)___\b/g,function(e,r){return""+r+""})).replace(/\b__(\S[\s\S]*?)__\b/g,function(e,r){return""+r+""}):(e=e.replace(/___(\S[\s\S]*?)___/g,function(e,r){return/\S$/.test(r)?""+r+"":e})).replace(/__(\S[\s\S]*?)__/g,function(e,r){return/\S$/.test(r)?""+r+"":e}),e=e.replace(/(_)/g,a.helper.escapeCharactersCallback),e=t.converter._dispatch("underline.after",e,r,t)):e}),a.subParser("unescapeSpecialChars",function(e,r,t){"use strict";return e=t.converter._dispatch("unescapeSpecialChars.before",e,r,t),e=e.replace(/¨E(\d+)E/g,function(e,r){var t=parseInt(r);return String.fromCharCode(t)}),e=t.converter._dispatch("unescapeSpecialChars.after",e,r,t)}),a.subParser("makeMarkdown.blockquote",function(e,r){"use strict";var t="";if(e.hasChildNodes())for(var n=e.childNodes,s=n.length,o=0;o "+t.split("\n").join("\n> ")}),a.subParser("makeMarkdown.codeBlock",function(e,r){"use strict";var t=e.getAttribute("language"),a=e.getAttribute("precodenum");return"```"+t+"\n"+r.preList[a]+"\n```"}),a.subParser("makeMarkdown.codeSpan",function(e){"use strict";return"`"+e.innerHTML+"`"}),a.subParser("makeMarkdown.emphasis",function(e,r){"use strict";var t="";if(e.hasChildNodes()){t+="*";for(var n=e.childNodes,s=n.length,o=0;o",e.hasAttribute("width")&&e.hasAttribute("height")&&(r+=" ="+e.getAttribute("width")+"x"+e.getAttribute("height")),e.hasAttribute("title")&&(r+=' "'+e.getAttribute("title")+'"'),r+=")"),r}),a.subParser("makeMarkdown.links",function(e,r){"use strict";var t="";if(e.hasChildNodes()&&e.hasAttribute("href")){var n=e.childNodes,s=n.length;t="[";for(var o=0;o",e.hasAttribute("title")&&(t+=' "'+e.getAttribute("title")+'"'),t+=")"}return t}),a.subParser("makeMarkdown.list",function(e,r,t){"use strict";var n="";if(!e.hasChildNodes())return"";for(var s=e.childNodes,o=s.length,i=e.getAttribute("start")||1,l=0;l"+r.preList[t]+""}),a.subParser("makeMarkdown.strikethrough",function(e,r){"use strict";var t="";if(e.hasChildNodes()){t+="~~";for(var n=e.childNodes,s=n.length,o=0;otr>th"),l=e.querySelectorAll("tbody>tr");for(t=0;t_&&(_=g)}for(t=0;t/g,"\\$1>"),r=r.replace(/^#/gm,"\\#"),r=r.replace(/^(\s*)([-=]{3,})(\s*)$/,"$1\\$2$3"),r=r.replace(/^( {0,3}\d+)\./gm,"$1\\."),r=r.replace(/^( {0,3})([+-])/gm,"$1\\$2"),r=r.replace(/]([\s]*)\(/g,"\\]$1\\("),r=r.replace(/^ {0,3}\[([\S \t]*?)]:/gm,"\\[$1]:")});"function"==typeof define&&define.amd?define(function(){"use strict";return a}):"undefined"!=typeof module&&module.exports?module.exports=a:this.showdown=a}).call(this); -//# sourceMappingURL=showdown.min.js.map diff --git a/src/vender/puread/plugin/stylesheet.js b/src/vender/puread/plugin/stylesheet.js deleted file mode 100644 index 970f5769..00000000 --- a/src/vender/puread/plugin/stylesheet.js +++ /dev/null @@ -1,198 +0,0 @@ -console.log( "=== PureRead: StyleSheet load ===" ) - -const [ bgcolorstyl, bgcls ] = [ "background-color", ".simpread-focus-root" ]; -let origin_read_style = "", html_style_bal = "-1"; - -/** - * Get background color value for focus mode - * - * @param {string} background-color, e.g. rgba(235, 235, 235, 0.901961) - * @return {string} e.g. 235, 235, 235 - */ -function getColor( value ) { - const arr = value ? value.match( /[0-9]+, /ig ) : []; - if ( arr.length > 0 ) { - return arr.join( "" ).replace( /, $/, "" ); - } else { - return null; - } -}; - -/** - * Set focus mode background color for focus mode - * - * @param {string} background color - * @param {number} background opacity - * @return {string} new background color - */ -function backgroundColor( bgcolor, opacity ) { - const color = getColor( bgcolor ), - newval = `rgba(${color}, ${opacity / 100})`; - $( bgcls ).css( bgcolorstyl, newval ); - return newval; -} - -/** - * Set background opacity for focus mode - * - * @param {string} opacity - * @return {string} new background color or null - */ -function opacity( opacity ) { - const bgcolor = $( bgcls ).css( bgcolorstyl ), - color = getColor( bgcolor ), - newval = `rgba(${color}, ${opacity / 100})`; - if ( color ) { - $( bgcls ).css( bgcolorstyl, newval ); - return newval; - } else { - return null; - } -} - -/** - * Set read mode font family for read mode - * - * @param {string} font family name e.g. PingFang SC; Microsoft Yahei - */ -function fontFamily( family ) { - $( "sr-read" ).css( "font-family", family == "default" ? "" : family ); -} - -/** - * Set read mode font size for read mode - * - * @param {string} font size, e.g. 70% 62.5% - */ -function fontSize( value ) { - if ( html_style_bal == "-1" ) { - html_style_bal = $( "html" ).attr( "style" ); - html_style_bal == undefined && ( html_style_bal = "" ); - } - value ? $( "html" ).attr( "style", `font-size: ${value}!important;${html_style_bal}` ) : $( "html" ).attr( "style", html_style_bal ); -} - -/** - * Set read mode layout width for read mode - * - * @param {string} layout width - */ -function layout( width ) { - $( "sr-read" ).css( "margin", width ? `20px ${width}` : "" ); -} - -/** - * Add custom css to for read mode - * - * @param {string} read.custom[type] - * @param {object} read.custom - */ -function custom( type, props ) { - const format = ( name ) => { - return name.replace( /[A-Z]/, name => { return `-${name.toLowerCase()}` } ); - }, - arr = Object.keys( props ).map( v => { - return props[v] && `${format( v )}: ${ props[v] };` - }); - let styles = arr.join( "" ); - switch ( type ) { - case "title": - styles = `sr-rd-title {${styles}}`; - break; - case "desc": - styles = `sr-rd-desc {${styles}}`; - break; - case "art": - styles = `sr-rd-content *, sr-rd-content p, sr-rd-content div {${styles}}`; - break; - case "pre": - styles = `sr-rd-content pre {${styles}}`; - break; - case "code": - styles = `sr-rd-content pre code, sr-rd-content pre code * {${styles}}`; - break; - } - - const $target = $( "head" ).find( `style#simpread-custom-${type}` ); - if ( $target.length == 0 ) { - $( "head" ).append(``); - } else { - $target.html( styles ); - } - -} - -/** - * Add css to for read mode - * - * @param {string} read.custom.css - * @param {object} read.custom.css value - */ -function css( type, styles ) { - const $target = $( "head" ).find( `style#simpread-custom-${type}` ); - if ( $target.length == 0 ) { - $( "head" ).append(``); - } else { - $target.html( styles ); - } -} - -/** - * Add/Remove current site styles( string ) to head for read mdoe - * - * @param {string} styles - */ -function siteCSS( styles ) { - styles ? $( "head" ).append(``) : - $( "#simpread-site-css" ).remove(); -} - -/** - * Add custom to .preview tag - * - * @param {object} read.custom - * @param {string} theme backgroud color - */ -function preview( styles ) { - Object.keys( styles ).forEach( v => { - v != "css" && custom( v, styles[v] ); - }); - css( "css", styles["css"] ); -} - -/** - * Verify custom is exist - * - * @param {string} verify type - * @param {object} read.custom value - */ -function vfyCustom( type, styles ) { - switch( type ) { - case "layout": - case "margin": - case "fontfamily": - case "custom": - return styles.css != ""; - case "fontsize": - return styles.title.fontSize != "" || - styles.desc.fontSize != "" || - styles.art.fontSize != "" || - styles.css != ""; - case "theme": - return styles.css.search( "simpread-theme-root" ) != -1; - } -} - -export { - getColor as GetColor, - backgroundColor as BgColor, - opacity as Opacity, - fontFamily as FontFamily, - fontSize as FontSize, - layout as Layout, - siteCSS as SiteCSS, - preview as Preview, - custom as Custom, - css as CSS, - vfyCustom as VerifyCustom, -} \ No newline at end of file diff --git a/src/vender/puread/puread.js b/src/vender/puread/puread.js deleted file mode 100644 index 7fa0dfcd..00000000 --- a/src/vender/puread/puread.js +++ /dev/null @@ -1,233 +0,0 @@ -console.log( "=== PureRead: PureRead load ===" ) - -import * as util from './util'; -import AdapteSite from './adaptesite'; - -export default class PureRead extends AdapteSite { - - constructor( sites ) { - super( sites ); - this.version = "0.0.4 build 0413"; - this.org_url = location.href; - this.html = {}; // clone site, include: title, desc, include, avatar, paging - this.plugin = {}; - } - - /** - * Verify current puread is same - * - * @return {boolean} true: same; false: not same; - */ - Exist() { - return this.org_url == location.href; - } - - /** - * Add Plugin - * - * @param {object} plugin object - */ - AddPlugin( plugin ) { - this.plugin = { - minimatch : plugin.minimatch, - pangu : plugin.pangu, - beautify : plugin.beautify, - stylesheet: plugin.style, - rdability : plugin.rdability, - markdown : plugin.markdown, - }; - super.SetMinimatch( this.plugin.minimatch ); - super.SetRdability( this.plugin.rdability ); - super.SetMarkdown( this.plugin.markdown ); - } - - /** - * Create temp read mode - * - * @param {string} include: read, focus - * @param {dom} html dom element - */ - TempMode( mode, dom ) { - this.state = "temp"; - this.dom = dom; - this.Newsite( mode, dom.outerHTML ); - } - - /** - * Get read mode html - */ - ReadMode() { - this.html = wrap( this.current.site ); - } - - /** - * Get highlight( focus ) jquery, only usage focus mode - * - * @return {jquery} jquery object - */ - Include() { - let include = this.current.site.include, - $focus = []; - const target = util.selector( include ); - try { - if ( util.specTest( target ) ) { - const [ value, state ] = util.specAction( include ); - if ( state == 0 ) { - include = include.replace( /\[\[{\$\(|}\]\]|\).html\(\)/g, "" ); - $focus = $( util.specAction( `[[[${include}]]]` )[0] ); - } else if ( state == 3 ) { - $focus = value; - } - } else if ( target ) { - $focus = $( "body" ).find( target ); - } - } catch ( error ) { - console.error( "Get $focus failed", error ) - } - return $focus; - } - - /** - * Get exlcude jquery selector array list - * - * @param {jquery} jquery object - * @return {array} jquery selector - */ - Exclude( $target ) { - return excludeSelector( $target, this.current.site.exclude ); - } - - /** - * Beautify html - * - * @param {jquery} jquery - */ - Beautify( $target ) { - if ( this.plugin.beautify ) { - this.plugin.beautify.specbeautify( this.current.site.name, $target ); - this.plugin.beautify.removeSpareTag( this.current.site.name, $target ); - this.plugin.beautify.htmlbeautify( $target ); - this.plugin.beautify.commbeautify( this.current.site.name, $target ); - } - } - - /** - * Format usage pangu plugin - * - * @param {string} class name - */ - Format( cls ) { - this.plugin.pangu && - this.plugin.pangu.spacingElementByClassName( cls ); - } -} - -/** - * Wrap storage.current.site object - * - * @param {object} storage.current.site object - * @return {object} wrapper object - */ -function wrap( site ) { - const wrapper = util.clone( site ), - title = util.selector( site.title == "" ? "" : site.title ), - desc = util.selector( site.desc ), - include = util.selector( site.include ); - wrapper.title = site.title == "" || site.title == "<title>" ? $( "head title" ).text() : query( title ); - wrapper.desc = query( desc ); - wrapper.include = site.include == "" && site.html != "" ? site.html : query( include, "html" ); - wrapper.avatar && wrapper.avatar.length > 0 && wrapper.avatar[0].name == "" && delete wrapper.avatar; - wrapper.paging && wrapper.paging.length > 0 && wrapper.paging[0].prev == "" && delete wrapper.paging; - wrapper.avatar && wrapper.avatar.forEach( item => { - const key = Object.keys( item ).join(), - value = item[key]; - item[key] = query( util.selector( value ), "html" ); - }); - wrapper.paging && wrapper.paging.forEach( item => { - const key = Object.keys( item ).join(), - value = item[key]; - item[key] = query( util.selector( value ) ); - }); - return wrapper; -} - -/** - * Query content usage jquery - * - * @param {string} query content - * @param {string} type, incldue: text, html and multi - * @return {string} query result - */ -function query( content, type = "text" ) { - const $root = $( "html" ); - if ( util.specTest( content ) ) { - const [ value, state ] = util.specAction( content ); - if ( state == 0 ) { - content = value; - } else if ( state == 3 ) { - content = getcontent( $root.find( value ) ); - } - } else if ( type == "html" ) { - content = getcontent( $root.find( content ) ); - } else if ( type == "multi" ) { - // TO-DO - } else { - content = $root.find( content ).text().trim(); - } - return content; -} - -/** - * Get content from current.site.include - * - * @param {jquery} jquery object e.g. $root.find( content ) - * @return {string} $target html - */ -function getcontent( $target ) { - let html = ""; - switch ( $target.length ) { - case 0: - html = "<sr-rd-content-error></sr-rd-content-error>"; - break; - case 1: - html = $target.html().trim(); - break; - default: - html = $target.map( (index, item) => $(item).html() ).get().join( "<br>" ); - break; - } - return html; -} - -/** - * Get exclude tags list - * - * @param {jquery} jquery object - * @param {array} hidden html - * @return {string} tags list string - */ -function excludeSelector( $target, exclude ) { - let tags = [], tag = ""; - for ( let content of exclude ) { - if ( util.specTest( content )) { - const [ value, type ] = util.specAction( content ); - if ( type == 1 ) { - tag = value; - } else if ( type == 2 ) { - const arr = $target.html().match( new RegExp( value, "g" ) ); - if ( arr && arr.length > 0 ) { - const str = arr.join( "" ); - tag = `*[${str}]`; - } else { - tag = undefined; - } - } else if ( type == 3 ) { - value.remove(); - } - } else { - tag = util.selector( content ); - } - if ( tag ) tags.push( tag ); - } - return tags.join( "," ); -} \ No newline at end of file diff --git a/src/vender/puread/util.js b/src/vender/puread/util.js deleted file mode 100644 index 81504c43..00000000 --- a/src/vender/puread/util.js +++ /dev/null @@ -1,167 +0,0 @@ -console.log( "=== PureRead: Util load ===" ) - -/** - * Deep clone object - * - * @param {object} target object - * @return {object} new target object - */ -function clone( target ) { - return $.extend( true, {}, target ); -} - -/** - * Get URI - * - * @return {string} e.g. current site url is http://www.cnbeta.com/articles/1234.html return http://www.cnbeta.com/articles/ - */ -function getURI() { - const name = (pathname) => { - pathname = pathname != "/" && pathname.endsWith("/") ? pathname = pathname.replace( /\/$/, "" ) : pathname; - return pathname.replace( /\/[%@#.~a-zA-Z0-9_-]+$|^\/$/g, "" ); - }, - path = name( window.location.pathname ); - return `${ window.location.protocol }//${ window.location.hostname }${ path }/`; -} - -/** - * Get url and parser location - * - * @param {string} url - */ -function getLocation( href ) { - if ( document ) { - const a = document.createElement( "a" ); - a.href = href; - return a; - } else { - const match = href.match(/^(https?\:)\/\/(([^:\/?#]*)(?:\:([0-9]+))?)([\/]{0,1}[^?#]*)(\?[^#]*|)(#.*|)$/); - return match && { - href : href, - protocol: match[1], - host : match[2], - hostname: match[3], - port : match[4], - pathname: match[5], - search : match[6], - hash : match[7] - } - } -} - -/** - * Verify html - * - * @param {string} input include html tag, e.g.: - <div class="article fmt article__content"> - * - * @return {array} 0: int include ( -1: fail; 0: empty html; 1: success; 2: special tag ) - * 1: result - */ -function verifyHtml( html ) { - if ( html == "" ) return [ 0, html ]; - else if ( specTest( html )) return [ 2, html ]; - const item = html.match( /<\S+ (class|id)=("|')?[\w-_=;:' ]+("|')?>?$|<[^/][-_a-zA-Z0-9]+>?$/ig ); - if ( item && item.length > 0 ) { - return [ 1, item ]; - } else { - return [ -1, undefined ]; - } -} - -/** - * Conver html to jquery object - * - * @param {string} input include html tag, e.g.: - <div class="article fmt article__content"> - * - * @return {string} formatting e.g.: - h2#news_title - div.introduction - div.content - div.clearfix - div.rating_box - span - special tag, @see specTest - e.g. [['<strong>▽</strong>']] [[[$('.article-btn')]]] - [[/src=\\S+(342459.png)\\S+'/]] [[{$('.content').html()}]] - * - */ -function selector( html ) { - const [ code, item ] = verifyHtml( html ); - if ( code == 2 ) return html; - else if ( code == 1 ) { - let [tag, prop, value] = item[0].trim().replace( /['"<>]/g, "" ).replace( / /ig, "=" ).split( "=" ); // ["h2", "class", "title"] - if ( !prop ) prop = tag; - else if ( prop.toLowerCase() === "class") prop = `${tag}.${value}`; - else if ( prop.toLowerCase() === "id" ) prop = `${tag}#${value}`; - return prop; - } else { - return null; - } -} - -/** - * Verify special action, action include: - - [[{juqery code}]] // new Function, e.g. $("xxx").xxx() return string - - [['text']] // remove '<text>' - - [[/regexp/]] // regexp e.g. $("sr-rd-content").find( "*[src='http://ifanr-cdn.b0.upaiyun.com/wp-content/uploads/2016/09/AppSo-qrcode-signature.jpg']" ) - - [[[juqery code]]] // new Function, e.g. $("xxx").find() return jquery object - - * - * @param {string} verify content - * @return {boolen} verify result - */ -function specTest( content ) { - return /^(\[\[)[\[{'/]{1}[ \S]+[}'/\]]\]\]{1}($)/g.test( content ); -} - -/** - * Exec special action, action include: @see specTest - * type: 0, 3 - be chiefly used in include logic - * type: 1, 2 - be chiefly used in exclude logic - * - * @param {string} content - * @return {array} 0: result; 1: type( include: -1:error 0:{} 1:'' 2:// 3:[]) - */ -function specAction( content ) { - let [ value, type ] = [ content.replace( /(^)\[\[|\]\]$/g, "" ) ]; - switch (value[0]) { - case "{": - value = value.replace( /^{|}$/g, "" ); - content = ( v=>new Function( `return ${v}` )() )(value); - type = 0; - break; - case "'": - content = value.replace( /^'|'$/g, "" ); - const name = content.match(/^<[a-zA-Z0-9_-]+>/g).join("").replace( /<|>/g, "" ); - const str = content.replace( /<[/a-zA-Z0-9_-]+>/g, "" ); - content = `${name}:contains(${str})`; - type = 1; - break; - case "/": - content = value.replace( /^\/|\/$/g, "" ).replace( /\\{2}/g, "\\" ).replace( /'/g, '"' ); - type = 2; - break; - case "[": - value = value.replace( /^{|}$/g, "" ); - content = ( v=>new Function( `return ${v}` )() )(value)[0]; - type = 3; - break; - default: - console.error( "Not support current action.", content ) - type = -1; - break; - } - return [ content, type ]; -} - -export { - clone, - getURI, - getLocation, - verifyHtml, - selector, - specTest, - specAction -} \ No newline at end of file From 0408986aaae26d1c56eef37cb912bd6861bdff92 Mon Sep 17 00:00:00 2001 From: Kenshin <fxblog@gmail.com> Date: Tue, 23 Apr 2019 14:48:02 +0800 Subject: [PATCH 23/43] Fix theme common css bug. --- src/assets/css/theme_common.css | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/assets/css/theme_common.css b/src/assets/css/theme_common.css index c19b1d1b..be3af248 100644 --- a/src/assets/css/theme_common.css +++ b/src/assets/css/theme_common.css @@ -4,7 +4,7 @@ * sr-rd-title, sr-rd-desc, sr-rd-content, p, div, a, img, pre, code, sr-blockquote, ul ol */ -.simpread-theme-root { + .simpread-theme-root { font-size: 62.5%!important; } @@ -186,6 +186,14 @@ sr-rd-content pre code * { font-size: 1.1rem; } +sr-rd-content pre p { + margin: 0; + padding: 0; + color: inherit; + font-size: inherit; + line-height: inherit; +} + sr-rd-content li code, sr-rd-content p code { margin: 0 4px; From 1a3455c833400853aca79efd004feae15304bb4e Mon Sep 17 00:00:00 2001 From: Kenshin <fxblog@gmail.com> Date: Wed, 24 Apr 2019 08:29:04 +0800 Subject: [PATCH 24/43] Update puread files. --- src/vender/puread/puplugin.min.js | 3407 ++++++++++++++++++++++++++++- src/vender/puread/puread.min.js | 1336 ++++++++++- 2 files changed, 4741 insertions(+), 2 deletions(-) diff --git a/src/vender/puread/puplugin.min.js b/src/vender/puread/puplugin.min.js index cb8017b6..b31e5f65 100644 --- a/src/vender/puread/puplugin.min.js +++ b/src/vender/puread/puplugin.min.js @@ -1 +1,3406 @@ -!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t(e.puplugin={})}(this,function(e){"use strict";var t="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function r(e,t){return e(t={exports:{}},t.exports),t.exports}var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},a=r(function(e,t){e.exports=function(e){function t(n){if(r[n])return r[n].exports;var a=r[n]={exports:{},id:n,loaded:!1};return e[n].call(a.exports,a,a.exports,t),a.loaded=!0,a.exports}var r={};return t.m=e,t.c=r,t.p="",t(0)}([function(e,t,r){var a=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),i=r(1).Pangu,o=function(e){function t(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var e=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=(void 0===t?"undefined":n(t))&&"function"!=typeof t?e:t}(this,Object.getPrototypeOf(t).call(this));return e.topTags=/^(html|head|body|#document)$/i,e.ignoreTags=/^(script|code|pre|textarea)$/i,e.spaceSensitiveTags=/^(a|del|pre|s|strike|u)$/i,e.spaceLikeTags=/^(br|hr|i|img|pangu)$/i,e.blockTags=/^(div|h1|h2|h3|h4|h5|h6|p)$/i,e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+(void 0===t?"undefined":n(t)));e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),a(t,[{key:"canIgnoreNode",value:function(e){for(var t=e.parentNode;t&&t.nodeName&&-1===t.nodeName.search(this.topTags);){if(t.nodeName.search(this.ignoreTags)>=0||t.isContentEditable||"true"===t.getAttribute("g_editable"))return!0;t=t.parentNode}return!1}},{key:"isFirstTextChild",value:function(e,t){for(var r=e.childNodes,n=0;n<r.length;n++){var a=r[n];if(8!==a.nodeType&&a.textContent)return a===t}return!1}},{key:"isLastTextChild",value:function(e,t){for(var r=e.childNodes,n=r.length-1;n>-1;n--){var a=r[n];if(8!==a.nodeType&&a.textContent)return a===t}return!1}},{key:"spacingNodeByXPath",value:function(e,t){for(var r=document.evaluate(e,t,null,XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,null),n=void 0,a=void 0,i=r.snapshotLength-1;i>-1;--i)if(n=r.snapshotItem(i),this.canIgnoreNode(n))a=n;else{var o=this.spacing(n.data);if(n.data!==o&&(n.data=o),a){if(n.nextSibling&&n.nextSibling.nodeName.search(this.spaceLikeTags)>=0){a=n;continue}var s=n.data.toString().substr(-1)+a.data.toString().substr(0,1),l=this.spacing(s);if(l!==s){for(var c=a;c.parentNode&&-1===c.nodeName.search(this.spaceSensitiveTags)&&this.isFirstTextChild(c.parentNode,c);)c=c.parentNode;for(var u=n;u.parentNode&&-1===u.nodeName.search(this.spaceSensitiveTags)&&this.isLastTextChild(u.parentNode,u);)u=u.parentNode;if(u.nextSibling&&u.nextSibling.nodeName.search(this.spaceLikeTags)>=0){a=n;continue}if(-1===u.nodeName.search(this.blockTags))if(-1===c.nodeName.search(this.spaceSensitiveTags))-1===c.nodeName.search(this.ignoreTags)&&-1===c.nodeName.search(this.blockTags)&&(a.previousSibling?-1===a.previousSibling.nodeName.search(this.spaceLikeTags)&&(a.data=" "+a.data):this.canIgnoreNode(a)||(a.data=" "+a.data));else if(-1===u.nodeName.search(this.spaceSensitiveTags))n.data=n.data+" ";else{var d=document.createElement("pangu");d.innerHTML=" ",c.previousSibling?-1===c.previousSibling.nodeName.search(this.spaceLikeTags)&&c.parentNode.insertBefore(d,c):c.parentNode.insertBefore(d,c),d.previousElementSibling||d.parentNode&&d.parentNode.removeChild(d)}}}a=n}}},{key:"spacingNode",value:function(e){this.spacingNodeByXPath(".//*/text()[normalize-space(.)]",e)}},{key:"spacingElementById",value:function(e){var t='id("'+e+'")//text()';this.spacingNodeByXPath(t,document)}},{key:"spacingElementByClassName",value:function(e){var t='//*[contains(concat(" ", normalize-space(@class), " "), "'+e+'")]//text()';this.spacingNodeByXPath(t,document)}},{key:"spacingElementByTagName",value:function(e){var t="//"+e+"//text()";this.spacingNodeByXPath(t,document)}},{key:"spacingPageTitle",value:function(){this.spacingNodeByXPath("/html/head/title/text()",document)}},{key:"spacingPageBody",value:function(){for(var e="/html/body//*/text()[normalize-space(.)]",t=["script","style","textarea"],r=0;r<t.length;r++){var n=t[r];e+='[translate(name(..),"ABCDEFGHIJKLMNOPQRSTUVWXYZ","abcdefghijklmnopqrstuvwxyz")!="'+n+'"]'}this.spacingNodeByXPath(e,document)}},{key:"spacingPage",value:function(){this.spacingPageTitle(),this.spacingPageBody()}}]),t}(i),s=new o;(e.exports=s).Pangu=o},function(e,t){var r=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),n=/([\u2e80-\u2eff\u2f00-\u2fdf\u3040-\u309f\u30a0-\u30ff\u3100-\u312f\u3200-\u32ff\u3400-\u4dbf\u4e00-\u9fff\uf900-\ufaff])(["])/g,a=/(["])([\u2e80-\u2eff\u2f00-\u2fdf\u3040-\u309f\u30a0-\u30ff\u3100-\u312f\u3200-\u32ff\u3400-\u4dbf\u4e00-\u9fff\uf900-\ufaff])/g,i=/(["']+)(\s*)(.+?)(\s*)(["']+)/g,o=/([\u2e80-\u2eff\u2f00-\u2fdf\u3040-\u309f\u30a0-\u30ff\u3100-\u312f\u3200-\u32ff\u3400-\u4dbf\u4e00-\u9fff\uf900-\ufaff])( )(')([A-Za-z])/g,s=/([\u2e80-\u2eff\u2f00-\u2fdf\u3040-\u309f\u30a0-\u30ff\u3100-\u312f\u3200-\u32ff\u3400-\u4dbf\u4e00-\u9fff\uf900-\ufaff])(#)([A-Za-z0-9\u2e80-\u2eff\u2f00-\u2fdf\u3040-\u309f\u30a0-\u30ff\u3100-\u312f\u3200-\u32ff\u3400-\u4dbf\u4e00-\u9fff\uf900-\ufaff]+)(#)([\u2e80-\u2eff\u2f00-\u2fdf\u3040-\u309f\u30a0-\u30ff\u3100-\u312f\u3200-\u32ff\u3400-\u4dbf\u4e00-\u9fff\uf900-\ufaff])/g,l=/([\u2e80-\u2eff\u2f00-\u2fdf\u3040-\u309f\u30a0-\u30ff\u3100-\u312f\u3200-\u32ff\u3400-\u4dbf\u4e00-\u9fff\uf900-\ufaff])(#([^ ]))/g,c=/(([^ ])#)([\u2e80-\u2eff\u2f00-\u2fdf\u3040-\u309f\u30a0-\u30ff\u3100-\u312f\u3200-\u32ff\u3400-\u4dbf\u4e00-\u9fff\uf900-\ufaff])/g,u=/([\u2e80-\u2eff\u2f00-\u2fdf\u3040-\u309f\u30a0-\u30ff\u3100-\u312f\u3200-\u32ff\u3400-\u4dbf\u4e00-\u9fff\uf900-\ufaff])([\+\-\*\/=&\\|<>])([A-Za-z0-9])/g,d=/([A-Za-z0-9])([\+\-\*\/=&\\|<>])([\u2e80-\u2eff\u2f00-\u2fdf\u3040-\u309f\u30a0-\u30ff\u3100-\u312f\u3200-\u32ff\u3400-\u4dbf\u4e00-\u9fff\uf900-\ufaff])/g,h=/([\u2e80-\u2eff\u2f00-\u2fdf\u3040-\u309f\u30a0-\u30ff\u3100-\u312f\u3200-\u32ff\u3400-\u4dbf\u4e00-\u9fff\uf900-\ufaff])([\(\[\{<\u201c]+(.*?)[\)\]\}>\u201d]+)([\u2e80-\u2eff\u2f00-\u2fdf\u3040-\u309f\u30a0-\u30ff\u3100-\u312f\u3200-\u32ff\u3400-\u4dbf\u4e00-\u9fff\uf900-\ufaff])/g,f=/([\u2e80-\u2eff\u2f00-\u2fdf\u3040-\u309f\u30a0-\u30ff\u3100-\u312f\u3200-\u32ff\u3400-\u4dbf\u4e00-\u9fff\uf900-\ufaff])([\(\[\{<\u201c>])/g,p=/([\)\]\}>\u201d<])([\u2e80-\u2eff\u2f00-\u2fdf\u3040-\u309f\u30a0-\u30ff\u3100-\u312f\u3200-\u32ff\u3400-\u4dbf\u4e00-\u9fff\uf900-\ufaff])/g,g=/([\(\[\{<\u201c]+)(\s*)(.+?)(\s*)([\)\]\}>\u201d]+)/,m=/([\u2e80-\u2eff\u2f00-\u2fdf\u3040-\u309f\u30a0-\u30ff\u3100-\u312f\u3200-\u32ff\u3400-\u4dbf\u4e00-\u9fff\uf900-\ufaff])([~!;:,\.\?\u2026])([A-Za-z0-9])/g,_=/([\u2e80-\u2eff\u2f00-\u2fdf\u3040-\u309f\u30a0-\u30ff\u3100-\u312f\u3200-\u32ff\u3400-\u4dbf\u4e00-\u9fff\uf900-\ufaff])([A-Za-z0-9`\$%\^&\*\-=\+\\\|\/@\u00a1-\u00ff\u2022\u2027\u2150-\u218f])/g,b=/([A-Za-z0-9`~\$%\^&\*\-=\+\\\|\/!;:,\.\?\u00a1-\u00ff\u2022\u2026\u2027\u2150-\u218f])([\u2e80-\u2eff\u2f00-\u2fdf\u3040-\u309f\u30a0-\u30ff\u3100-\u312f\u3200-\u32ff\u3400-\u4dbf\u4e00-\u9fff\uf900-\ufaff])/g,w=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}return r(e,[{key:"spacing",value:function(e){var t=e,r=t=(t=(t=(t=(t=(t=(t=(t=(t=t.replace(n,"$1 $2")).replace(a,"$1 $2")).replace(i,"$1$3$5")).replace(o,"$1$3$4")).replace(s,"$1 $2$3$4 $5")).replace(l,"$1 $2")).replace(c,"$1 $3")).replace(u,"$1 $2 $3")).replace(d,"$1 $2 $3"),w=t.replace(h,"$1 $2 $4");return t=w,r===w&&(t=(t=t.replace(f,"$1 $2")).replace(p,"$1 $2")),t=(t=(t=(t=t.replace(g,"$1$3$5")).replace(m,"$1$2 $3")).replace(_,"$1 $2")).replace(b,"$1 $2")}},{key:"spacingText",value:function(e){var t=arguments.length<=1||void 0===arguments[1]?function(){}:arguments[1];try{var r=this.spacing(e);t(null,r)}catch(e){t(e)}}}]),e}(),v=new w;(e.exports=v).Pangu=w}])});a.pangu;function i(e,t){for(var r=0,n=e.length-1;n>=0;n--){var a=e[n];"."===a?e.splice(n,1):".."===a?(e.splice(n,1),r++):r&&(e.splice(n,1),r--)}if(t)for(;r--;r)e.unshift("..");return e}var o=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/,s=function(e){return o.exec(e).slice(1)};function l(){for(var e="",t=!1,r=arguments.length-1;r>=-1&&!t;r--){var n=r>=0?arguments[r]:"/";if("string"!=typeof n)throw new TypeError("Arguments to path.resolve must be strings");n&&(e=n+"/"+e,t="/"===n.charAt(0))}return e=i(_(e.split("/"),function(e){return!!e}),!t).join("/"),(t?"/":"")+e||"."}function c(e){var t=u(e),r="/"===b(e,-1);return(e=i(_(e.split("/"),function(e){return!!e}),!t).join("/"))||t||(e="."),e&&r&&(e+="/"),(t?"/":"")+e}function u(e){return"/"===e.charAt(0)}function d(){return c(_(Array.prototype.slice.call(arguments,0),function(e,t){if("string"!=typeof e)throw new TypeError("Arguments to path.join must be strings");return e}).join("/"))}function h(e,t){function r(e){for(var t=0;t<e.length&&""===e[t];t++);for(var r=e.length-1;r>=0&&""===e[r];r--);return t>r?[]:e.slice(t,r-t+1)}e=l(e).substr(1),t=l(t).substr(1);for(var n=r(e.split("/")),a=r(t.split("/")),i=Math.min(n.length,a.length),o=i,s=0;s<i;s++)if(n[s]!==a[s]){o=s;break}var c=[];for(s=o;s<n.length;s++)c.push("..");return(c=c.concat(a.slice(o))).join("/")}function f(e){var t=s(e),r=t[0],n=t[1];return r||n?(n&&(n=n.substr(0,n.length-1)),r+n):"."}function p(e,t){var r=s(e)[2];return t&&r.substr(-1*t.length)===t&&(r=r.substr(0,r.length-t.length)),r}function g(e){return s(e)[3]}var m={extname:g,basename:p,dirname:f,sep:"/",delimiter:":",relative:h,join:d,isAbsolute:u,normalize:c,resolve:l};function _(e,t){if(e.filter)return e.filter(t);for(var r=[],n=0;n<e.length;n++)t(e[n],n,e)&&r.push(e[n]);return r}var b="b"==="ab".substr(-1)?function(e,t,r){return e.substr(t,r)}:function(e,t,r){return t<0&&(t=e.length+t),e.substr(t,r)},w=Object.freeze({resolve:l,normalize:c,isAbsolute:u,join:d,relative:h,sep:"/",delimiter:":",dirname:f,basename:p,extname:g,default:m}),v=function(e,t){for(var r=[],n=0;n<e.length;n++){var a=t(e[n],n);y(a)?r.push.apply(r,a):r.push(a)}return r},y=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)},k=E;function E(e,t,r){e instanceof RegExp&&(e=x(e,r)),t instanceof RegExp&&(t=x(t,r));var n=T(e,t,r);return n&&{start:n[0],end:n[1],pre:r.slice(0,n[0]),body:r.slice(n[0]+e.length,n[1]),post:r.slice(n[1]+t.length)}}function x(e,t){var r=t.match(e);return r?r[0]:null}function T(e,t,r){var n,a,i,o,s,l=r.indexOf(e),c=r.indexOf(t,l+1),u=l;if(l>=0&&c>0){for(n=[],i=r.length;u>=0&&!s;)u==l?(n.push(u),l=r.indexOf(e,u+1)):1==n.length?s=[n.pop(),c]:((a=n.pop())<i&&(i=a,o=c),c=r.indexOf(t,u+1)),u=l<c&&l>=0?l:c;n.length&&(s=[i,o])}return s}E.range=T;var N=function(e){if(!e)return[];"{}"===e.substr(0,2)&&(e="\\{\\}"+e.substr(2));return function e(t,r){var n=[];var a=k("{","}",t);if(!a||/\$$/.test(a.pre))return[t];var i=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(a.body);var o=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(a.body);var s=i||o;var l=a.body.indexOf(",")>=0;if(!s&&!l)return a.post.match(/,.*\}/)?(t=a.pre+"{"+a.body+C+a.post,e(t)):[t];var c;if(s)c=a.body.split(/\.\./);else if(1===(c=function e(t){if(!t)return[""];var r=[];var n=k("{","}",t);if(!n)return t.split(",");var a=n.pre;var i=n.body;var o=n.post;var s=a.split(",");s[s.length-1]+="{"+i+"}";var l=e(o);o.length&&(s[s.length-1]+=l.shift(),s.push.apply(s,l));r.push.apply(r,s);return r}(a.body)).length&&1===(c=e(c[0],!1).map(M)).length){var u=a.post.length?e(a.post,!1):[""];return u.map(function(e){return a.pre+c[0]+e})}var d=a.pre;var u=a.post.length?e(a.post,!1):[""];var h;if(s){var f=L(c[0]),p=L(c[1]),g=Math.max(c[0].length,c[1].length),m=3==c.length?Math.abs(L(c[2])):1,_=I,b=p<f;b&&(m*=-1,_=O);var w=c.some(B);h=[];for(var y=f;_(y,p);y+=m){var E;if(o)"\\"===(E=String.fromCharCode(y))&&(E="");else if(E=String(y),w){var x=g-E.length;if(x>0){var T=new Array(x+1).join("0");E=y<0?"-"+T+E.slice(1):T+E}}h.push(E)}}else h=v(c,function(t){return e(t,!1)});for(var N=0;N<h.length;N++)for(var A=0;A<u.length;A++){var S=d+h[N]+u[A];(!r||s||S)&&n.push(S)}return n}(function(e){return e.split("\\\\").join(A).split("\\{").join(S).split("\\}").join(C).split("\\,").join(P).split("\\.").join(j)}(e),!0).map(z)},A="\0SLASH"+Math.random()+"\0",S="\0OPEN"+Math.random()+"\0",C="\0CLOSE"+Math.random()+"\0",P="\0COMMA"+Math.random()+"\0",j="\0PERIOD"+Math.random()+"\0";function L(e){return parseInt(e,10)==e?parseInt(e,10):e.charCodeAt(0)}function z(e){return e.split(A).join("\\").split(S).join("{").split(C).join("}").split(P).join(",").split(j).join(".")}function M(e){return"{"+e+"}"}function B(e){return/^-?0\d/.test(e)}function I(e,t){return e<=t}function O(e,t){return e>=t}var R=w&&m||w,D=Y;Y.Minimatch=Q;var H={sep:"/"};try{H=R}catch(e){}var G=Y.GLOBSTAR=Q.GLOBSTAR={},U={"!":{open:"(?:(?!(?:",close:"))[^/]*?)"},"?":{open:"(?:",close:")?"},"+":{open:"(?:",close:")+"},"*":{open:"(?:",close:")*"},"@":{open:"(?:",close:")"}},q="[^/]",F=q+"*?",V="(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?",W="(?:(?!(?:\\/|^)\\.).)*?",X="().*{}+?[]^$\\!".split("").reduce(function(e,t){return e[t]=!0,e},{});var Z=/\/+/;function K(e,t){e=e||{},t=t||{};var r={};return Object.keys(t).forEach(function(e){r[e]=t[e]}),Object.keys(e).forEach(function(t){r[t]=e[t]}),r}function Y(e,t,r){if("string"!=typeof t)throw new TypeError("glob pattern string required");return r||(r={}),!(!r.nocomment&&"#"===t.charAt(0))&&(""===t.trim()?""===e:new Q(t,r).match(e))}function Q(e,t){if(!(this instanceof Q))return new Q(e,t);if("string"!=typeof e)throw new TypeError("glob pattern string required");t||(t={}),e=e.trim(),"/"!==H.sep&&(e=e.split(H.sep).join("/")),this.options=t,this.set=[],this.pattern=e,this.regexp=null,this.negate=!1,this.comment=!1,this.empty=!1,this.make()}function J(e,t){if(t||(t=this instanceof Q?this.options:{}),void 0===(e=void 0===e?this.pattern:e))throw new TypeError("undefined pattern");return t.nobrace||!e.match(/\{.*\}/)?[e]:N(e)}Y.filter=function(e,t){return t=t||{},function(r,n,a){return Y(r,e,t)}},Y.defaults=function(e){if(!e||!Object.keys(e).length)return Y;var t=Y,r=function(r,n,a){return t.minimatch(r,n,K(e,a))};return r.Minimatch=function(r,n){return new t.Minimatch(r,K(e,n))},r},Q.defaults=function(e){return e&&Object.keys(e).length?Y.defaults(e).Minimatch:Q},Q.prototype.debug=function(){},Q.prototype.make=function(){if(this._made)return;var e=this.pattern,t=this.options;if(!t.nocomment&&"#"===e.charAt(0))return void(this.comment=!0);if(!e)return void(this.empty=!0);this.parseNegate();var r=this.globSet=this.braceExpand();t.debug&&(this.debug=console.error);this.debug(this.pattern,r),r=this.globParts=r.map(function(e){return e.split(Z)}),this.debug(this.pattern,r),r=r.map(function(e,t,r){return e.map(this.parse,this)},this),this.debug(this.pattern,r),r=r.filter(function(e){return-1===e.indexOf(!1)}),this.debug(this.pattern,r),this.set=r},Q.prototype.parseNegate=function(){var e=this.pattern,t=!1,r=0;if(this.options.nonegate)return;for(var n=0,a=e.length;n<a&&"!"===e.charAt(n);n++)t=!t,r++;r&&(this.pattern=e.substr(r));this.negate=t},Y.braceExpand=function(e,t){return J(e,t)},Q.prototype.braceExpand=J,Q.prototype.parse=function(e,t){if(e.length>65536)throw new TypeError("pattern is too long");var r=this.options;if(!r.noglobstar&&"**"===e)return G;if(""===e)return"";var n,a="",i=!!r.nocase,o=!1,s=[],l=[],c=!1,u=-1,d=-1,h="."===e.charAt(0)?"":r.dot?"(?!(?:^|\\/)\\.{1,2}(?:$|\\/))":"(?!\\.)",f=this;function p(){if(n){switch(n){case"*":a+=F,i=!0;break;case"?":a+=q,i=!0;break;default:a+="\\"+n}f.debug("clearStateChar %j %j",n,a),n=!1}}for(var g,m=0,_=e.length;m<_&&(g=e.charAt(m));m++)if(this.debug("%s\t%s %s %j",e,m,a,g),o&&X[g])a+="\\"+g,o=!1;else switch(g){case"/":return!1;case"\\":p(),o=!0;continue;case"?":case"*":case"+":case"@":case"!":if(this.debug("%s\t%s %s %j <-- stateChar",e,m,a,g),c){this.debug(" in class"),"!"===g&&m===d+1&&(g="^"),a+=g;continue}f.debug("call clearStateChar %j",n),p(),n=g,r.noext&&p();continue;case"(":if(c){a+="(";continue}if(!n){a+="\\(";continue}s.push({type:n,start:m-1,reStart:a.length,open:U[n].open,close:U[n].close}),a+="!"===n?"(?:(?!(?:":"(?:",this.debug("plType %j %j",n,a),n=!1;continue;case")":if(c||!s.length){a+="\\)";continue}p(),i=!0;var b=s.pop();a+=b.close,"!"===b.type&&l.push(b),b.reEnd=a.length;continue;case"|":if(c||!s.length||o){a+="\\|",o=!1;continue}p(),a+="|";continue;case"[":if(p(),c){a+="\\"+g;continue}c=!0,d=m,u=a.length,a+=g;continue;case"]":if(m===d+1||!c){a+="\\"+g,o=!1;continue}if(c)var w,v=e.substring(d+1,m);i=!0,c=!1,a+=g;continue;default:p(),o?o=!1:!X[g]||"^"===g&&c||(a+="\\"),a+=g}c&&(v=e.substr(d+1),w=this.parse(v,ee),a=a.substr(0,u)+"\\["+w[0],i=i||w[1]);for(b=s.pop();b;b=s.pop()){var y=a.slice(b.reStart+b.open.length);this.debug("setting tail",a,b),y=y.replace(/((?:\\{2}){0,64})(\\?)\|/g,function(e,t,r){return r||(r="\\"),t+t+r+"|"}),this.debug("tail=%j\n %s",y,y,b,a);var k="*"===b.type?F:"?"===b.type?q:"\\"+b.type;i=!0,a=a.slice(0,b.reStart)+k+"\\("+y}p(),o&&(a+="\\\\");var E=!1;switch(a.charAt(0)){case".":case"[":case"(":E=!0}for(var x=l.length-1;x>-1;x--){var T=l[x],N=a.slice(0,T.reStart),A=a.slice(T.reStart,T.reEnd-8),S=a.slice(T.reEnd-8,T.reEnd),C=a.slice(T.reEnd);S+=C;var P=N.split("(").length-1,j=C;for(m=0;m<P;m++)j=j.replace(/\)[+*?]?/,"");var L="";""===(C=j)&&t!==ee&&(L="$");var z=N+A+C+L+S;a=z}""!==a&&i&&(a="(?=.)"+a);E&&(a=h+a);if(t===ee)return[a,i];if(!i)return e.replace(/\\(.)/g,"$1");var M=r.nocase?"i":"";try{var $=new RegExp("^"+a+"$",M)}catch(e){return new RegExp("$.")}return $._glob=e,$._src=a,$};var ee={};Y.makeRe=function(e,t){return new Q(e,t||{}).makeRe()},Q.prototype.makeRe=function(){if(this.regexp||!1===this.regexp)return this.regexp;var e=this.set;if(!e.length)return this.regexp=!1,this.regexp;var t=this.options,r=t.noglobstar?F:t.dot?V:W,n=t.nocase?"i":"",a=e.map(function(e){return e.map(function(e){return e===G?r:"string"==typeof e?e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"):e._src}).join("\\/")}).join("|");a="^(?:"+a+")$",this.negate&&(a="^(?!"+a+").*$");try{this.regexp=new RegExp(a,n)}catch(e){this.regexp=!1}return this.regexp},Y.match=function(e,t,r){var n=new Q(t,r=r||{});return e=e.filter(function(e){return n.match(e)}),n.options.nonull&&!e.length&&e.push(t),e},Q.prototype.match=function(e,t){if(this.debug("match",e,this.pattern),this.comment)return!1;if(this.empty)return""===e;if("/"===e&&t)return!0;var r=this.options;"/"!==H.sep&&(e=e.split(H.sep).join("/"));e=e.split(Z),this.debug(this.pattern,"split",e);var n,a,i=this.set;for(this.debug(this.pattern,"set",i),a=e.length-1;a>=0&&!(n=e[a]);a--);for(a=0;a<i.length;a++){var o=i[a],s=e;r.matchBase&&1===o.length&&(s=[n]);var l=this.matchOne(s,o,t);if(l)return!!r.flipNegate||!this.negate}return!r.flipNegate&&this.negate},Q.prototype.matchOne=function(e,t,r){var n=this.options;this.debug("matchOne",{this:this,file:e,pattern:t}),this.debug("matchOne",e.length,t.length);for(var a=0,i=0,o=e.length,s=t.length;a<o&&i<s;a++,i++){this.debug("matchOne loop");var l,c=t[i],u=e[a];if(this.debug(t,c,u),!1===c)return!1;if(c===G){this.debug("GLOBSTAR",[t,c,u]);var d=a,h=i+1;if(h===s){for(this.debug("** at the end");a<o;a++)if("."===e[a]||".."===e[a]||!n.dot&&"."===e[a].charAt(0))return!1;return!0}for(;d<o;){var f=e[d];if(this.debug("\nglobstar while",e,d,t,h,f),this.matchOne(e.slice(d),t.slice(h),r))return this.debug("globstar found match!",d,o,f),!0;if("."===f||".."===f||!n.dot&&"."===f.charAt(0)){this.debug("dot detected!",e,d,t,h);break}this.debug("globstar swallow a segment, and continue"),d++}return!(!r||(this.debug("\n>>> no match, partial?",e,d,t,h),d!==o))}if("string"==typeof c?(l=n.nocase?u.toLowerCase()===c.toLowerCase():u===c,this.debug("string match",c,u,l)):(l=u.match(c),this.debug("pattern match",c,u,l)),!l)return!1}if(a===o&&i===s)return!0;if(a===o)return r;if(i===s)return a===o-1&&""===e[a];throw new Error("wtf?")};var te=Object.freeze({specbeautify:function(e,t){switch(e){case"sspai.com":t.find(".relation-apps").remove(),t.find(".ss-app-card").remove();break;case"post.smzdm.com":t.find("img.face").addClass("sr-rd-content-nobeautify"),t.find(".insert-outer img").addClass("sr-rd-content-nobeautify");break;case"infoq.com":t.find("img").map(function(e,t){"left"==$(t).css("float")&&$(t).addClass("sr-rd-content-nobeautify")}),t.find("script").remove();break;case"appinn.com":case"hacpai.com":t.find(".emoji").addClass("sr-rd-content-nobeautify");break;case"douban.com":t.find(".review-content").children().unwrap(),t.find("table").addClass("sr-rd-content-center"),t.find("p").css({"white-space":"pre-wrap"}),t.find(".cc").removeClass();break;case"qdaily.com":t.find("img").map(function(e,t){var r=$(t);0==Number.parseInt(r.css("height"))&&r.remove()}),t.find(".com-insert-images").map(function(e,t){var r=$(t),n=r.find("img").map(function(e,t){return"<div>"+t.outerHTML+"</div>"}).get().join("");r.empty().removeAttr("class").append(n)}),t.find(".com-insert-embed").remove();break;case"news.mtime.com":t.find(".newspictool").map(function(e,t){var r=$(t),n=r.find("img"),a=r.find("p:last");r.removeAttr("class").addClass("sr-rd-content-center").empty().append(n).append(a)});break;case"blog.csdn.net":t.find(".save_code").remove(),t.find(".pre-numbering").remove(),t.find("pre").removeAttr("style").removeAttr("class"),t.find("code").removeAttr("style"),t.find(".dp-highlighter").map(function(e,t){$(t).find(".bar .tools").remove(),$(t).next().is("pre")&&$(t).next().remove()});break;case"news.sohu.com":t.find(".conserve-photo").remove(),t.find("table").addClass("sr-rd-content-center");break;case"qq.com":t.find(".rv-root-v2, #backqqcom").remove();break;case"azofreeware.com":t.find("iframe").remove();break;case"apprcn.com":t.find("img").map(function(e,t){var r=$(t),n=r.attr("src");n&&n.includes("Apprcn_Wechat_Small.jpeg")&&r.parent().remove()}),t.find("a").map(function(e,t){var r=$(t);"来自反斗软件"==r.text()&&r.parent().remove()});break;case"tieba.baidu.com":t.find(".BDE_Smiley").addClass("sr-rd-content-nobeautify"),t.find(".replace_div").removeAttr("class").removeAttr("style"),t.find(".replace_tip").remove(),t.find(".d_post_content, .j_d_post_content, .post_bubble_top, .post_bubble_middle, .post_bubble_bottom").map(function(e,t){$(t).removeAttr("class").removeAttr("style")}),$("body").find(".p_author_face").map(function(e,t){var r=$(t).find("img"),n=r.attr("data-tb-lazyload"),a=r.attr("username");n&&$("sr-rd-mult-avatar").find("span").map(function(e,t){var r=$(t);r.text()==a&&r.parent().find("img").attr("src",n)})});break;case"jingyan.baidu.com":t.find(".exp-image-wraper").removeAttr("class").removeAttr("href");break;case"question.zhihu.com":t.find(".zu-edit-button").remove(),t.find("a.external").map(function(e,t){$(t).removeAttr("class").attr("style","border: none;")}),t.find(".VagueImage").map(function(e,t){var r=$(t),n=r.attr("data-src");r.replaceWith('<img class="sr-rd-content-img" src="'+n+'" style="zoom: 0.6;">')});break;case"chiphell.com":t.find("img").map(function(e,t){var r=$(t),n=r.parent(),a=r.attr("src"),i=r.attr("smilieid");n.is("ignore_js_op")&&r.unwrap(),i&&a&&a.includes("static/image/smiley")&&r.addClass("sr-rd-content-nobeautify").attr("style","width: 50px;")}),t.find(".quote").remove();break;case"jiemian.com":t.find("script").remove();break;case"36kr.com":t.find(".load-html-img").removeAttr("class");break;case"cnblogs.com":t.find(".cnblogs_code").removeClass(),t.find(".cnblogs_code_hide").removeClass().removeAttr("style"),t.find(".cnblogs_code_toolbar").remove(),t.find(".code_img_opened").remove(),t.find(".code_img_closed").remove();break;case"news.cnblogs.com":t.find(".topic_img").remove();break;case"g-cores.com":t.find(".swiper-slide-active").find("img").map(function(e,t){var r=$(t);r.parent().parent().parent().parent().parent().parent().removeAttr("class").removeAttr("style").html(r)});break;case"feng.com":case"young.ifeng.com":t.find("span").removeAttr("style");break;case"ftchinese.com":t.find("script").remove();break;case"segmentfault.com":t.find(".widget-codetool").remove();break;case"mp.weixin.qq.com":t.find('section[powered-by="xiumi.us"]').find("img").map(function(e,t){var r=$(t),n=r.attr("data-src");r.addClass("sr-rd-content-nobeautify").attr("src",n)});break;case"ruby-china.org":t.find(".twemoji").remove();break;case"w3cplus.com":t.find("iframe").addClass("sr-rd-content-nobeautify");break;case"zuojj.com":t.find(".syntaxhighlighter .Brush").attr("style","font-size: .7em !important;");break;case"aotu.io":t.find(".highlight table").map(function(e,t){var r=$(t),n=r.find("pre"),a=r.find("table");r.html(n[1]),a.unwrap()}),t.find("table").addClass("sr-rd-content-center");break;case"colobu.com":t.find(".highlight table").map(function(e,t){var r=$(t),n=r.find("pre");r.html(n[1]),r.unwrap()});break;case"hao.caibaojian.com":t.find(".tlink").map(function(e,t){$(t).html("<link>")});break;case"wkee.net":t.find("script").remove();break;case"linux.cn":t.find("pre").attr("style","background-color: #161b20; background-image: none;"),t.find("code").attr("style","background-color: transparent; background-image: none;");break;case"zhuanlan.zhihu.com":t.find("div[data-src]").map(function(e,t){var r=$(t),n=r.attr("data-src");r.replaceWith('<div class="sr-rd-content-center"><img src="'+n+'"></div>')});break;case"jianshu.com":t.find(".image-package").map(function(e,t){var r=$(t),n=r.find("img");r.html(n)});break;case"medium.com":t.find("figure").map(function(e,t){var r=$(t),n=r.find("img");r.replaceWith('<div class="sr-rd-content-center"><img class="sr-rd-content-nobeautify" src="'+n.attr("data-src")+'" style="max-width:100%"></div>')});break;case"worldcup.fifa.com":t.find("iframe").css({width:"790px",height:"450px"}),t.find("div").removeClass()}},removeSpareTag:function(e,t){var r=!1,n="";["lib.csdn.net","huxiu.com","my.oschina.net","caixin.com","163.com","steachs.com","hacpai.com","apprcn.com","mp.weixin.qq.com"].includes(e)?(r=!0,n="p"):["nationalgeographic.com.cn","dgtle.com","news.mtime.com"].includes(e)?(r=!0,n="div"):["chiphell.com"].includes(e)&&(r=!0,n="font"),r&&t.find(n).map(function(e,t){var r=$(t).text().toLowerCase().trim();0==$(t).find("img").length&&""==r&&$(t).remove()})},htmlbeautify:function(e){try{e.html(function(e,t){return t.trim().replace(/<\/?blockquote/g,function(e){return"/"==e[1]?"</sr-blockquote":"<sr-blockquote"}).replace(/<br>\n?<br>(\n?<br>)*/g,"<br>").replace(/\/(div|p)>\n*(<br>\n)+/g,function(e){return e.replace("<br>","")})})}catch(t){return e.html()}},commbeautify:function(e,t){t.find("img:not(.sr-rd-content-nobeautify)").map(function(e,t){var r=$(t),n=(r.parent(),$("<img class='sr-rd-content-img-load'>")),a=r.attr("src"),i=r.attr("data-src"),o=r.attr("data-original"),s=r.attr("original"),l=r.attr("data-original-src"),c=r.attr("real_src"),u=function(){n.removeClass("sr-rd-content-img-load"),n[0].clientWidth<400?n.parent().removeClass("sr-rd-content-center").addClass("sr-rd-content-center-small"):n[0].clientWidth>1e3?n.css("zoom","0.6"):n[0].clientHeight>620&&/win|mac/i.test(navigator.platform)&&(n.attr("height",620),n[0].clientWidth<$("sr-rd-content").width()&&n.css({width:"auto"})),n[0].clientWidth>$("sr-rd-content").width()&&n.addClass("sr-rd-content-img")},d=function(){n.addClass("simpread-hidden"),n.parent().hasClass("sr-rd-content-center")&&n.parent().removeAttr("class").addClass("simpread-hidden")},h=void 0;r.parent()[0].tagName.toLowerCase(),h=s||a,h=i||h,h=o||h,h=l||h,!(h=c||h)||h.startsWith("http")||h.startsWith("data")||(h=function e(t,r){if("string"!=typeof t||!t)return null;if(t.match(/^[a-z]+\:\/\//i))return t;if(t.match(/^\/\//))return"http:"+t;if(t.match(/^[a-z]+\:/i))return t;var n;if("string"!=typeof r)return(n=document.createElement("a")).href=t,n.pathname?"http://"+t:null;if(null===(r=e(r)))return null;(n=document.createElement("a")).href=r,"/"===t[0]?r=[]:(r=n.pathname.split("/")).pop(),t=t.split("/");for(var a=0;a<t.length;++a)if("."!==t[a])if(".."===t[a]){if(void 0===r.pop()||0===r.length)return null}else r.push(t[a]);return n.protocol+"//"+n.hostname+r.join("/")}(h,location.href)),n.attr("src",h).replaceAll(r).wrap("<div class='sr-rd-content-center'></div>"),/win|mac/i.test(navigator.platform)?n.one("load",function(){return u()}).one("error",function(){return d()}):n.on("load",function(){return u()}).on("error",function(){return d()})}),t.find("sr-blockquote").map(function(t,r){var n=$(r),a=n.parent();n.removeAttr("style").removeAttr("class"),"dgtle.com"==e&&a.removeClass("quote")}),t.find("iframe:not(.sr-rd-content-nobeautify), embed:not(.sr-rd-content-nobeautify)").map(function(e,t){$(t).wrap("<div class='sr-rd-content-center'></div>")}),t.find("hr").map(function(e,t){$(t).addClass("simpread-hidden")}),t.find("pre").map(function(e,t){$(t).find("code").removeAttr("class")}),t.find("pre").removeAttr("class"),t.find("a").removeAttr("style")},cleanHTML:function(e,t){var r,n,a=e.html();"readability-page-1"==$(e.children()).attr("id")&&1==e.children().children().length?a=e.children().children().html():1==e.children().length&&(a=e.children().html()),a=a.replace(/<!--[\S ]+-->/gi,""),e.html((r=a,n="",$.parseHTML(r).forEach(function(e,r){var a=e.tagName,i=e.outerText,o=e.outerHTML;void 0==a?n+="<p>"+e.textContent.replace(/^\n|\n$/gi,"").trim()+"</p>":"PRE"==a?n+="<pre><code>"+i.replace(/</gi,"<").replace(/>/gi,">")+"</code></pre>":(""!=i||o.includes("<img"))&&(n+=t?o.replace(/ (style|id|class)="[\w ;%@#!-:(),\u4e00-\u9fa5]*"/gi,""):o)}),n)),t&&e.find("pre code").each(function(e,t){try{t.outerText=t.outerText.split("\n").filter(function(e){return""!=e.trim()}).join("\n")}catch(e){t.outerText=t.outerText}})}}),re="background-color",ne=".simpread-focus-root",ae="-1";function ie(e){var t=e?e.match(/[0-9]+, /gi):[];return t.length>0?t.join("").replace(/, $/,""):null}function oe(e,t){var r=Object.keys(t).map(function(e){return t[e]&&e.replace(/[A-Z]/,function(e){return"-"+e.toLowerCase()})+": "+t[e]+";"}).join("");switch(e){case"title":r="sr-rd-title {"+r+"}";break;case"desc":r="sr-rd-desc {"+r+"}";break;case"art":r="sr-rd-content *, sr-rd-content p, sr-rd-content div {"+r+"}";break;case"pre":r="sr-rd-content pre {"+r+"}";break;case"code":r="sr-rd-content pre code, sr-rd-content pre code * {"+r+"}"}var n=$("head").find("style#simpread-custom-"+e);0==n.length?$("head").append('<style type="text/css" id="simpread-custom-'+e+'">'+r+"</style>"):n.html(r)}function se(e,t){var r=$("head").find("style#simpread-custom-"+e);0==r.length?$("head").append('<style type="text/css" id="simpread-custom-'+e+'">'+t+"</style>"):r.html(t)}var le=Object.freeze({GetColor:ie,BgColor:function(e,t){var r="rgba("+ie(e)+", "+t/100+")";return $(ne).css(re,r),r},Opacity:function(e){var t=ie($(ne).css(re)),r="rgba("+t+", "+e/100+")";return t?($(ne).css(re,r),r):null},FontFamily:function(e){$("sr-read").css("font-family","default"==e?"":e)},FontSize:function(e){"-1"==ae&&void 0==(ae=$("html").attr("style"))&&(ae=""),e?$("html").attr("style","font-size: "+e+"!important;"+ae):$("html").attr("style",ae)},Layout:function(e){$("sr-read").css("margin",e?"20px "+e:"")},SiteCSS:function(e){e?$("head").append('<style type="text/css" id="simpread-site-css">'+e+"</style>"):$("#simpread-site-css").remove()},Preview:function(e){Object.keys(e).forEach(function(t){"css"!=t&&oe(t,e[t])}),se("css",e.css)},Custom:oe,CSS:se,VerifyCustom:function(e,t){switch(e){case"layout":case"margin":case"fontfamily":case"custom":return""!=t.css;case"fontsize":return""!=t.title.fontSize||""!=t.desc.fontSize||""!=t.art.fontSize||""!=t.css;case"theme":return-1!=t.css.search("simpread-theme-root")}}});function ce(e,t){if(t&&t.documentElement)e=t,t=arguments[2];else if(!e||!e.documentElement)throw new Error("First argument to Readability constructor should be a document object.");var r;t=t||{},this._doc=e,this._articleTitle=null,this._articleByline=null,this._articleDir=null,this._articleSiteName=null,this._attempts=[],this._debug=!!t.debug,this._maxElemsToParse=t.maxElemsToParse||this.DEFAULT_MAX_ELEMS_TO_PARSE,this._nbTopCandidates=t.nbTopCandidates||this.DEFAULT_N_TOP_CANDIDATES,this._charThreshold=t.charThreshold||this.DEFAULT_CHAR_THRESHOLD,this._classesToPreserve=this.CLASSES_TO_PRESERVE.concat(t.classesToPreserve||[]),this._flags=this.FLAG_STRIP_UNLIKELYS|this.FLAG_WEIGHT_CLASSES|this.FLAG_CLEAN_CONDITIONALLY,this._debug?(r=function(e){var t,r,n=e.nodeName+" ";return e.nodeType==e.TEXT_NODE?n+'("'+e.textContent+'")':(t=e.className&&"."+e.className.replace(/ /g,"."),r="",e.id?r="(#"+e.id+t+")":t&&(r="("+t+")"),n+r)},this.log=function(){var e;"undefined"!=typeof dump?(e=Array.prototype.map.call(arguments,function(e){return e&&e.nodeName?r(e):e}).join(" "),dump("Reader: (Readability) "+e+"\n")):"undefined"!=typeof console&&["Reader: (Readability) "].concat(arguments)}):this.log=function(){}}ce.prototype={FLAG_STRIP_UNLIKELYS:1,FLAG_WEIGHT_CLASSES:2,FLAG_CLEAN_CONDITIONALLY:4,ELEMENT_NODE:1,TEXT_NODE:3,DEFAULT_MAX_ELEMS_TO_PARSE:0,DEFAULT_N_TOP_CANDIDATES:5,DEFAULT_TAGS_TO_SCORE:"section,h2,h3,h4,h5,h6,p,td,pre".toUpperCase().split(","),DEFAULT_CHAR_THRESHOLD:500,REGEXPS:{unlikelyCandidates:/-ad-|ai2html|banner|breadcrumbs|combx|comment|community|cover-wrap|disqus|extra|foot|gdpr|header|legends|menu|related|remark|replies|rss|shoutbox|sidebar|skyscraper|social|sponsor|supplemental|ad-break|agegate|pagination|pager|popup|yom-remote/i,okMaybeItsACandidate:/and|article|body|column|main|shadow/i,positive:/article|body|content|entry|hentry|h-entry|main|page|pagination|post|text|blog|story/i,negative:/hidden|^hid$| hid$| hid |^hid |banner|combx|comment|com-|contact|foot|footer|footnote|gdpr|masthead|media|meta|outbrain|promo|related|scroll|share|shoutbox|sidebar|skyscraper|sponsor|shopping|tags|tool|widget/i,extraneous:/print|archive|comment|discuss|e[\-]?mail|share|reply|all|login|sign|single|utility/i,byline:/byline|author|dateline|writtenby|p-author/i,replaceFonts:/<(\/?)font[^>]*>/gi,normalize:/\s{2,}/g,videos:/\/\/(www\.)?((dailymotion|youtube|youtube-nocookie|player\.vimeo|v\.qq)\.com|(archive|upload\.wikimedia)\.org|player\.twitch\.tv)/i,nextLink:/(next|weiter|continue|>([^\|]|$)|禄([^\|]|$))/i,prevLink:/(prev|earl|old|new|<|芦)/i,whitespace:/^\s*$/,hasContent:/\S$/},DIV_TO_P_ELEMS:["A","BLOCKQUOTE","DL","DIV","IMG","OL","P","PRE","TABLE","UL","SELECT"],ALTER_TO_DIV_EXCEPTIONS:["DIV","ARTICLE","SECTION","P"],PRESENTATIONAL_ATTRIBUTES:["align","background","bgcolor","border","cellpadding","cellspacing","frame","hspace","rules","style","valign","vspace"],DEPRECATED_SIZE_ATTRIBUTE_ELEMS:["TABLE","TH","TD","HR","PRE"],PHRASING_ELEMS:["ABBR","AUDIO","B","BDO","BR","BUTTON","CITE","CODE","DATA","DATALIST","DFN","EM","EMBED","I","IMG","INPUT","KBD","LABEL","MARK","MATH","METER","NOSCRIPT","OBJECT","OUTPUT","PROGRESS","Q","RUBY","SAMP","SCRIPT","SELECT","SMALL","SPAN","STRONG","SUB","SUP","TEXTAREA","TIME","VAR","WBR"],CLASSES_TO_PRESERVE:["page"],_postProcessContent:function(e){this._fixRelativeUris(e),this._cleanClasses(e)},_removeNodes:function(e,t){var r,n,a;for(r=e.length-1;r>=0;r--)(a=(n=e[r]).parentNode)&&(!t||t.call(this,n,r,e))&&a.removeChild(n)},_replaceNodeTags:function(e,t){var r,n;for(r=e.length-1;r>=0;r--)n=e[r],this._setNodeTag(n,t)},_forEachNode:function(e,t){Array.prototype.forEach.call(e,t,this)},_someNode:function(e,t){return Array.prototype.some.call(e,t,this)},_everyNode:function(e,t){return Array.prototype.every.call(e,t,this)},_concatNodeLists:function(){var e=Array.prototype.slice,t=e.call(arguments).map(function(t){return e.call(t)});return Array.prototype.concat.apply([],t)},_getAllNodesWithTag:function(e,t){return e.querySelectorAll?e.querySelectorAll(t.join(",")):[].concat.apply([],t.map(function(t){var r=e.getElementsByTagName(t);return Array.isArray(r)?r:Array.from(r)}))},_cleanClasses:function(e){var t=this._classesToPreserve,r=(e.getAttribute("class")||"").split(/\s+/).filter(function(e){return-1!=t.indexOf(e)}).join(" ");for(r?e.setAttribute("class",r):e.removeAttribute("class"),e=e.firstElementChild;e;e=e.nextElementSibling)this._cleanClasses(e)},_fixRelativeUris:function(e){function t(e){if(n==a&&"#"==e.charAt(0))return e;try{return new URL(e,n).href}catch(e){}return e}var r,n=this._doc.baseURI,a=this._doc.documentURI,i=this._getAllNodesWithTag(e,["a"]);this._forEachNode(i,function(e){var r,n=e.getAttribute("href");n&&(0===n.indexOf("javascript:")?(r=this._doc.createTextNode(e.textContent),e.parentNode.replaceChild(r,e)):e.setAttribute("href",t(n)))}),r=this._getAllNodesWithTag(e,["img"]),this._forEachNode(r,function(e){var r=e.getAttribute("src");r&&e.setAttribute("src",t(r))})},_getArticleTitle:function(){function e(e){return e.split(/\s+/).length}var t,r,n,a,i,o=this._doc,s="",l="";try{"string"!=typeof(s=l=o.title.trim())&&(s=l=this._getInnerText(o.getElementsByTagName("title")[0]))}catch(e){}return t=!1,/ [\|\-\\\/>禄] /.test(s)?(t=/ [\\\/>禄] /.test(s),e(s=l.replace(/(.*)[\|\-\\\/>禄] .*/gi,"$1"))<3&&(s=l.replace(/[^\|\-\\\/>禄]*[\|\-\\\/>禄](.*)/gi,"$1"))):-1!==s.indexOf(": ")?(r=this._concatNodeLists(o.getElementsByTagName("h1"),o.getElementsByTagName("h2")),n=s.trim(),this._someNode(r,function(e){return e.textContent.trim()===n})||(e(s=l.substring(l.lastIndexOf(":")+1))<3?s=l.substring(l.indexOf(":")+1):e(l.substr(0,l.indexOf(":")))>5&&(s=l))):(s.length>150||s.length<15)&&(1===(a=o.getElementsByTagName("h1")).length&&(s=this._getInnerText(a[0]))),4>=(i=e(s=s.trim().replace(this.REGEXPS.normalize," ")))&&(!t||i!=e(l.replace(/[\|\-\\\/>禄]+/g,""))-1)&&(s=l),s},_prepDocument:function(){var e=this._doc;this._removeNodes(e.getElementsByTagName("style")),e.body&&this._replaceBrs(e.body),this._replaceNodeTags(e.getElementsByTagName("font"),"SPAN")},_nextElement:function(e){for(var t=e;t&&t.nodeType!=this.ELEMENT_NODE&&this.REGEXPS.whitespace.test(t.textContent);)t=t.nextSibling;return t},_replaceBrs:function(e){this._forEachNode(this._getAllNodesWithTag(e,["br"]),function(e){for(var t,r,n,a,i=e.nextSibling,o=!1;(i=this._nextElement(i))&&"BR"==i.tagName;)o=!0,t=i.nextSibling,i.parentNode.removeChild(i),i=t;if(o){for(r=this._doc.createElement("p"),e.parentNode.replaceChild(r,e),i=r.nextSibling;i&&("BR"!=i.tagName||(!(n=this._nextElement(i.nextSibling))||"BR"!=n.tagName))&&this._isPhrasingContent(i);)a=i.nextSibling,r.appendChild(i),i=a;for(;r.lastChild&&this._isWhitespace(r.lastChild);)r.removeChild(r.lastChild);"P"===r.parentNode.tagName&&this._setNodeTag(r.parentNode,"DIV")}})},_setNodeTag:function(e,t){var r,n;if(this.log("_setNodeTag",e,t),e.__JSDOMParser__)return e.localName=t.toLowerCase(),e.tagName=t.toUpperCase(),e;for(r=e.ownerDocument.createElement(t);e.firstChild;)r.appendChild(e.firstChild);for(e.parentNode.replaceChild(r,e),e.readability&&(r.readability=e.readability),n=0;n<e.attributes.length;n++)try{r.setAttribute(e.attributes[n].name,e.attributes[n].value)}catch(e){}return r},_prepArticle:function(e){var t,r,n;this._cleanStyles(e),this._markDataTables(e),this._cleanConditionally(e,"form"),this._cleanConditionally(e,"fieldset"),this._clean(e,"object"),this._clean(e,"embed"),this._clean(e,"h1"),this._clean(e,"footer"),this._clean(e,"link"),this._clean(e,"aside"),t=this.DEFAULT_CHAR_THRESHOLD,this._forEachNode(e.children,function(e){this._cleanMatchedNodes(e,function(e,r){return/share/.test(r)&&e.textContent.length<t})}),1===(r=e.getElementsByTagName("h2")).length&&(n=(r[0].textContent.length-this._articleTitle.length)/this._articleTitle.length,Math.abs(n)<.5&&(!1,(n>0?r[0].textContent.includes(this._articleTitle):this._articleTitle.includes(r[0].textContent))&&this._clean(e,"h2"))),this._clean(e,"iframe"),this._clean(e,"input"),this._clean(e,"textarea"),this._clean(e,"select"),this._clean(e,"button"),this._cleanHeaders(e),this._cleanConditionally(e,"table"),this._cleanConditionally(e,"ul"),this._cleanConditionally(e,"div"),this._removeNodes(e.getElementsByTagName("p"),function(e){return 0===e.getElementsByTagName("img").length+e.getElementsByTagName("embed").length+e.getElementsByTagName("object").length+e.getElementsByTagName("iframe").length&&!this._getInnerText(e,!1)}),this._forEachNode(this._getAllNodesWithTag(e,["br"]),function(e){var t=this._nextElement(e.nextSibling);t&&"P"==t.tagName&&e.parentNode.removeChild(e)}),this._forEachNode(this._getAllNodesWithTag(e,["table"]),function(e){var t,r,n=this._hasSingleTagInsideElement(e,"TBODY")?e.firstElementChild:e;this._hasSingleTagInsideElement(n,"TR")&&(t=n.firstElementChild,this._hasSingleTagInsideElement(t,"TD")&&(r=t.firstElementChild,r=this._setNodeTag(r,this._everyNode(r.childNodes,this._isPhrasingContent)?"P":"DIV"),e.parentNode.replaceChild(r,e)))})},_initializeNode:function(e){switch(e.readability={contentScore:0},e.tagName){case"DIV":e.readability.contentScore+=5;break;case"PRE":case"TD":case"BLOCKQUOTE":e.readability.contentScore+=3;break;case"ADDRESS":case"OL":case"UL":case"DL":case"DD":case"DT":case"LI":case"FORM":e.readability.contentScore-=3;break;case"H1":case"H2":case"H3":case"H4":case"H5":case"H6":case"TH":e.readability.contentScore-=5}e.readability.contentScore+=this._getClassWeight(e)},_removeAndGetNext:function(e){var t=this._getNextNode(e,!0);return e.parentNode.removeChild(e),t},_getNextNode:function(e,t){if(!t&&e.firstElementChild)return e.firstElementChild;if(e.nextElementSibling)return e.nextElementSibling;do{e=e.parentNode}while(e&&!e.nextElementSibling);return e&&e.nextElementSibling},_checkByline:function(e,t){var r,n;return!this._articleByline&&(void 0!==e.getAttribute&&(r=e.getAttribute("rel"),n=e.getAttribute("itemprop")),!(!("author"===r||n&&-1!==n.indexOf("author")||this.REGEXPS.byline.test(t))||!this._isValidByline(e.textContent))&&(this._articleByline=e.textContent.trim(),!0))},_getNodeAncestors:function(e,t){t=t||0;for(var r=0,n=[];e.parentNode&&(n.push(e.parentNode),!t||++r!==t);)e=e.parentNode;return n},_grabArticle:function(e){var t,r,n,a,i,o,s,l,c,u,d,h,f,p,g,m,_,b,w,v,y,k,E,x,T,N,A,S,C,P,j,L,z,M,$,B,I,O,R,D,H,G,U,q,F,V,W;if(this.log("**** grabArticle ****"),t=this._doc,r=null!==e,!(e=e||this._doc.body))return this.log("No body found in document. Abort."),null;for(n=e.innerHTML;;){for(a=this._flagIsActive(this.FLAG_STRIP_UNLIKELYS),i=[],o=this._doc.documentElement;o;)if(s=o.className+" "+o.id,this._isProbablyVisible(o))if(this._checkByline(o,s))o=this._removeAndGetNext(o);else if(!a||!this.REGEXPS.unlikelyCandidates.test(s)||this.REGEXPS.okMaybeItsACandidate.test(s)||this._hasAncestorTag(o,"table")||"BODY"===o.tagName||"A"===o.tagName)if("DIV"!==o.tagName&&"SECTION"!==o.tagName&&"HEADER"!==o.tagName&&"H1"!==o.tagName&&"H2"!==o.tagName&&"H3"!==o.tagName&&"H4"!==o.tagName&&"H5"!==o.tagName&&"H6"!==o.tagName||!this._isElementWithoutContent(o)){if(-1!==this.DEFAULT_TAGS_TO_SCORE.indexOf(o.tagName)&&i.push(o),"DIV"===o.tagName){for(l=null,c=o.firstChild;c;){if(u=c.nextSibling,this._isPhrasingContent(c))null!==l?l.appendChild(c):this._isWhitespace(c)||(l=t.createElement("p"),o.replaceChild(l,c),l.appendChild(c));else if(null!==l){for(;l.lastChild&&this._isWhitespace(l.lastChild);)l.removeChild(l.lastChild);l=null}c=u}this._hasSingleTagInsideElement(o,"P")&&this._getLinkDensity(o)<.25?(d=o.children[0],o.parentNode.replaceChild(d,o),o=d,i.push(o)):this._hasChildBlockElement(o)||(o=this._setNodeTag(o,"P"),i.push(o))}o=this._getNextNode(o)}else o=this._removeAndGetNext(o);else this.log("Removing unlikely candidate - "+s),o=this._removeAndGetNext(o);else this.log("Removing hidden node - "+s),o=this._removeAndGetNext(o);for(h=[],this._forEachNode(i,function(e){var t,r,n;e.parentNode&&void 0!==e.parentNode.tagName&&((t=this._getInnerText(e)).length<25||0!==(r=this._getNodeAncestors(e,3)).length&&(n=0,n+=1,n+=t.split(",").length,n+=Math.min(Math.floor(t.length/100),3),this._forEachNode(r,function(e,t){if(e.tagName&&e.parentNode&&void 0!==e.parentNode.tagName){if(void 0===e.readability&&(this._initializeNode(e),h.push(e)),0===t)var r=1;else r=1===t?2:3*t;e.readability.contentScore+=n/r}})))}),f=[],p=0,g=h.length;g>p;p+=1)for(_=(m=h[p]).readability.contentScore*(1-this._getLinkDensity(m)),m.readability.contentScore=_,this.log("Candidate:",m,"with score "+_),b=0;b<this._nbTopCandidates;b++)if(!(w=f[b])||_>w.readability.contentScore){f.splice(b,0,m),f.length>this._nbTopCandidates&&f.pop();break}if(y=!1,null===(v=f[0]||null)||"BODY"===v.tagName){for(v=t.createElement("DIV"),y=!0,E=e.childNodes;E.length;)this.log("Moving child out:",E[0]),v.appendChild(E[0]);e.appendChild(v),this._initializeNode(v)}else if(v){for(x=[],T=1;T<f.length;T++)f[T].readability.contentScore/v.readability.contentScore>=.75&&x.push(this._getNodeAncestors(f[T]));if(N=3,x.length>=N)for(k=v.parentNode;"BODY"!==k.tagName;){for(A=0,S=0;S<x.length&&N>A;S++)A+=Number(x[S].includes(k));if(A>=N){v=k;break}k=k.parentNode}for(v.readability||this._initializeNode(v),k=v.parentNode,P=(C=v.readability.contentScore)/3;"BODY"!==k.tagName;)if(k.readability){if(P>(j=k.readability.contentScore))break;if(j>C){v=k;break}C=k.readability.contentScore,k=k.parentNode}else k=k.parentNode;for(k=v.parentNode;"BODY"!=k.tagName&&1==k.children.length;)k=(v=k).parentNode;v.readability||this._initializeNode(v)}for(L=t.createElement("DIV"),r&&(L.id="readability-content"),z=Math.max(10,.2*v.readability.contentScore),$=0,B=(M=(k=v.parentNode).children).length;B>$;$++)I=M[$],O=!1,this.log("Looking at sibling node:",I,I.readability?"with score "+I.readability.contentScore:""),this.log("Sibling has score",I.readability?I.readability.contentScore:"Unknown"),I===v?O=!0:(R=0,I.className===v.className&&""!==v.className&&(R+=.2*v.readability.contentScore),I.readability&&I.readability.contentScore+R>=z?O=!0:"P"===I.nodeName&&(D=this._getLinkDensity(I),(G=(H=this._getInnerText(I)).length)>80&&.25>D?O=!0:80>G&&G>0&&0===D&&-1!==H.search(/\.( |$)/)&&(O=!0))),O&&(this.log("Appending node:",I),-1===this.ALTER_TO_DIV_EXCEPTIONS.indexOf(I.nodeName)&&(this.log("Altering sibling:",I,"to div."),I=this._setNodeTag(I,"DIV")),L.appendChild(I),$-=1,B-=1);if(this._debug&&this.log("Article content pre-prep: "+L.innerHTML),this._prepArticle(L),this._debug&&this.log("Article content post-prep: "+L.innerHTML),y)v.id="readability-page-1",v.className="page";else{for((U=t.createElement("DIV")).id="readability-page-1",U.className="page",q=L.childNodes;q.length;)U.appendChild(q[0]);L.appendChild(U)}if(this._debug&&this.log("Article content after paging: "+L.innerHTML),F=!0,(V=this._getInnerText(L,!0).length)<this._charThreshold)if(F=!1,e.innerHTML=n,this._flagIsActive(this.FLAG_STRIP_UNLIKELYS))this._removeFlag(this.FLAG_STRIP_UNLIKELYS),this._attempts.push({articleContent:L,textLength:V});else if(this._flagIsActive(this.FLAG_WEIGHT_CLASSES))this._removeFlag(this.FLAG_WEIGHT_CLASSES),this._attempts.push({articleContent:L,textLength:V});else if(this._flagIsActive(this.FLAG_CLEAN_CONDITIONALLY))this._removeFlag(this.FLAG_CLEAN_CONDITIONALLY),this._attempts.push({articleContent:L,textLength:V});else{if(this._attempts.push({articleContent:L,textLength:V}),this._attempts.sort(function(e,t){return t.textLength-e.textLength}),!this._attempts[0].textLength)return null;L=this._attempts[0].articleContent,F=!0}if(F)return W=[k,v].concat(this._getNodeAncestors(k)),this._someNode(W,function(e){if(!e.tagName)return!1;var t=e.getAttribute("dir");return!!t&&(this._articleDir=t,!0)}),L}},_isValidByline:function(e){return("string"==typeof e||e instanceof String)&&((e=e.trim()).length>0&&e.length<100)},_getArticleMetadata:function(){var e={},t={},r=this._doc.getElementsByTagName("meta"),n=/\s*(dc|dcterm|og|twitter)\s*:\s*(author|creator|description|title|site_name)\s*/gi,a=/^\s*(?:(dc|dcterm|og|twitter|weibo:(article|webpage))\s*[\.:]\s*)?(author|creator|description|title|site_name)\s*$/i;return this._forEachNode(r,function(e){var r,i,o,s=e.getAttribute("name"),l=e.getAttribute("property"),c=e.getAttribute("content");if(c){if(r=null,i=null,l&&(r=l.match(n)))for(o=r.length-1;o>=0;o--)i=r[o].toLowerCase().replace(/\s/g,""),t[i]=c.trim();!r&&s&&a.test(s)&&(i=s,c&&(i=i.toLowerCase().replace(/\s/g,"").replace(/\./g,":"),t[i]=c.trim()))}}),e.title=t["dc:title"]||t["dcterm:title"]||t["og:title"]||t["weibo:article:title"]||t["weibo:webpage:title"]||t.title||t["twitter:title"],e.title||(e.title=this._getArticleTitle()),e.byline=t["dc:creator"]||t["dcterm:creator"]||t.author,e.excerpt=t["dc:description"]||t["dcterm:description"]||t["og:description"]||t["weibo:article:description"]||t["weibo:webpage:description"]||t.description||t["twitter:description"],e.siteName=t["og:site_name"],e},_removeScripts:function(e){this._removeNodes(e.getElementsByTagName("script"),function(e){return e.nodeValue="",e.removeAttribute("src"),!0}),this._removeNodes(e.getElementsByTagName("noscript"))},_hasSingleTagInsideElement:function(e,t){return 1==e.children.length&&e.children[0].tagName===t&&!this._someNode(e.childNodes,function(e){return e.nodeType===this.TEXT_NODE&&this.REGEXPS.hasContent.test(e.textContent)})},_isElementWithoutContent:function(e){return e.nodeType===this.ELEMENT_NODE&&0==e.textContent.trim().length&&(0==e.children.length||e.children.length==e.getElementsByTagName("br").length+e.getElementsByTagName("hr").length)},_hasChildBlockElement:function(e){return this._someNode(e.childNodes,function(e){return-1!==this.DIV_TO_P_ELEMS.indexOf(e.tagName)||this._hasChildBlockElement(e)})},_isPhrasingContent:function(e){return e.nodeType===this.TEXT_NODE||-1!==this.PHRASING_ELEMS.indexOf(e.tagName)||("A"===e.tagName||"DEL"===e.tagName||"INS"===e.tagName)&&this._everyNode(e.childNodes,this._isPhrasingContent)},_isWhitespace:function(e){return e.nodeType===this.TEXT_NODE&&0===e.textContent.trim().length||e.nodeType===this.ELEMENT_NODE&&"BR"===e.tagName},_getInnerText:function(e,t){t=void 0===t||t;var r=e.textContent.trim();return t?r.replace(this.REGEXPS.normalize," "):r},_getCharCount:function(e,t){return t=t||",",this._getInnerText(e).split(t).length-1},_cleanStyles:function(e){var t,r;if(e&&"svg"!==e.tagName.toLowerCase()){for(t=0;t<this.PRESENTATIONAL_ATTRIBUTES.length;t++)e.removeAttribute(this.PRESENTATIONAL_ATTRIBUTES[t]);for(-1!==this.DEPRECATED_SIZE_ATTRIBUTE_ELEMS.indexOf(e.tagName)&&(e.removeAttribute("width"),e.removeAttribute("height")),r=e.firstElementChild;null!==r;)this._cleanStyles(r),r=r.nextElementSibling}},_getLinkDensity:function(e){var t,r=this._getInnerText(e).length;return 0===r?0:(t=0,this._forEachNode(e.getElementsByTagName("a"),function(e){t+=this._getInnerText(e).length}),t/r)},_getClassWeight:function(e){if(!this._flagIsActive(this.FLAG_WEIGHT_CLASSES))return 0;var t=0;return"string"==typeof e.className&&""!==e.className&&(this.REGEXPS.negative.test(e.className)&&(t-=25),this.REGEXPS.positive.test(e.className)&&(t+=25)),"string"==typeof e.id&&""!==e.id&&(this.REGEXPS.negative.test(e.id)&&(t-=25),this.REGEXPS.positive.test(e.id)&&(t+=25)),t},_clean:function(e,t){var r=-1!==["object","embed","iframe"].indexOf(t);this._removeNodes(e.getElementsByTagName(t),function(e){if(r){for(var t=0;t<e.attributes.length;t++)if(this.REGEXPS.videos.test(e.attributes[t].value))return!1;if("object"===e.tagName&&this.REGEXPS.videos.test(e.innerHTML))return!1}return!0})},_hasAncestorTag:function(e,t,r,n){r=r||3,t=t.toUpperCase();for(var a=0;e.parentNode;){if(r>0&&a>r)return!1;if(e.parentNode.tagName===t&&(!n||n(e.parentNode)))return!0;e=e.parentNode,a++}return!1},_getRowAndColumnCount:function(e){var t,r,n,a,i,o,s=0,l=0,c=e.getElementsByTagName("tr");for(t=0;t<c.length;t++){for((r=c[t].getAttribute("rowspan")||0)&&(r=parseInt(r,10)),s+=r||1,n=0,a=c[t].getElementsByTagName("td"),i=0;i<a.length;i++)(o=a[i].getAttribute("colspan")||0)&&(o=parseInt(o,10)),n+=o||1;l=Math.max(l,n)}return{rows:s,columns:l}},_markDataTables:function(e){var t,r,n,a,i=e.getElementsByTagName("table");for(t=0;t<i.length;t++)"presentation"!=(r=i[t]).getAttribute("role")?"0"!=r.getAttribute("datatable")?r.getAttribute("summary")?r._readabilityDataTable=!0:(n=r.getElementsByTagName("caption")[0])&&n.childNodes.length>0?r._readabilityDataTable=!0:["col","colgroup","tfoot","thead","th"].some(function(e){return!!r.getElementsByTagName(e)[0]})?(this.log("Data table because found data-y descendant"),r._readabilityDataTable=!0):r.getElementsByTagName("table")[0]?r._readabilityDataTable=!1:(a=this._getRowAndColumnCount(r),r._readabilityDataTable=a.rows>=10||a.columns>4||a.rows*a.columns>10):r._readabilityDataTable=!1:r._readabilityDataTable=!1},_cleanConditionally:function(e,t){if(this._flagIsActive(this.FLAG_CLEAN_CONDITIONALLY)){var r="ul"===t||"ol"===t;this._removeNodes(e.getElementsByTagName(t),function(e){var n,a,i,o,s,l,c,u,d,h,f,p=function(e){return e._readabilityDataTable};if("table"===t&&p(e))return!1;if(this._hasAncestorTag(e,"table",-1,p))return!1;if(n=this._getClassWeight(e),0,this.log("Cleaning Conditionally",e),0>n+0)return!0;if(this._getCharCount(e,",")<10){for(a=e.getElementsByTagName("p").length,i=e.getElementsByTagName("img").length,o=e.getElementsByTagName("li").length-100,s=e.getElementsByTagName("input").length,l=0,c=this._concatNodeLists(e.getElementsByTagName("object"),e.getElementsByTagName("embed"),e.getElementsByTagName("iframe")),u=0;u<c.length;u++){for(d=0;d<c[u].attributes.length;d++)if(this.REGEXPS.videos.test(c[u].attributes[d].value))return!1;if("object"===c[u].tagName&&this.REGEXPS.videos.test(c[u].innerHTML))return!1;l++}return h=this._getLinkDensity(e),f=this._getInnerText(e).length,i>1&&.5>a/i&&!this._hasAncestorTag(e,"figure")||!r&&o>a||s>Math.floor(a/3)||!r&&25>f&&(0===i||i>2)&&!this._hasAncestorTag(e,"figure")||!r&&25>n&&h>.2||n>=25&&h>.5||1===l&&75>f||l>1}return!1})}},_cleanMatchedNodes:function(e,t){for(var r=this._getNextNode(e,!0),n=this._getNextNode(e);n&&n!=r;)n=t(n,n.className+" "+n.id)?this._removeAndGetNext(n):this._getNextNode(n)},_cleanHeaders:function(e){for(var t=1;3>t;t+=1)this._removeNodes(e.getElementsByTagName("h"+t),function(e){return this._getClassWeight(e)<0})},_flagIsActive:function(e){return(this._flags&e)>0},_removeFlag:function(e){this._flags=this._flags&~e},_isProbablyVisible:function(e){return!(e.style&&"none"==e.style.display||e.hasAttribute("hidden"))},parse:function(){var e,t,r,n,a;if(this._maxElemsToParse>0&&(e=this._doc.getElementsByTagName("*").length)>this._maxElemsToParse)throw new Error("Aborting parsing document; "+e+" elements found");return this._removeScripts(this._doc),this._prepDocument(),t=this._getArticleMetadata(),this._articleTitle=t.title,(r=this._grabArticle())?(this.log("Grabbed: "+r.innerHTML),this._postProcessContent(r),t.excerpt||(n=r.getElementsByTagName("p")).length>0&&(t.excerpt=n[0].textContent.trim()),a=r.textContent,{title:this._articleTitle,byline:t.byline||this._articleByline,dir:this._articleDir,content:r.innerHTML,textContent:a,length:a.length,excerpt:t.excerpt,siteName:t.siteName||this._articleSiteName}):null}};var ue=Object.freeze({Readability:ce}),de=r(function(e){(function(){function t(e){var t={omitExtraWLInCodeBlocks:{defaultValue:!1,describe:"Omit the default extra whiteline added to code blocks",type:"boolean"},noHeaderId:{defaultValue:!1,describe:"Turn on/off generated header id",type:"boolean"},prefixHeaderId:{defaultValue:!1,describe:"Add a prefix to the generated header ids. Passing a string will prefix that string to the header id. Setting to true will add a generic 'section-' prefix",type:"string"},rawPrefixHeaderId:{defaultValue:!1,describe:'Setting this option to true will prevent showdown from modifying the prefix. This might result in malformed IDs (if, for instance, the " char is used in the prefix)',type:"boolean"},ghCompatibleHeaderId:{defaultValue:!1,describe:"Generate header ids compatible with github style (spaces are replaced with dashes, a bunch of non alphanumeric chars are removed)",type:"boolean"},rawHeaderId:{defaultValue:!1,describe:"Remove only spaces, ' and \" from generated header ids (including prefixes), replacing them with dashes (-). WARNING: This might result in malformed ids",type:"boolean"},headerLevelStart:{defaultValue:!1,describe:"The header blocks level start",type:"integer"},parseImgDimensions:{defaultValue:!1,describe:"Turn on/off image dimension parsing",type:"boolean"},simplifiedAutoLink:{defaultValue:!1,describe:"Turn on/off GFM autolink style",type:"boolean"},excludeTrailingPunctuationFromURLs:{defaultValue:!1,describe:"Excludes trailing punctuation from links generated with autoLinking",type:"boolean"},literalMidWordUnderscores:{defaultValue:!1,describe:"Parse midword underscores as literal underscores",type:"boolean"},literalMidWordAsterisks:{defaultValue:!1,describe:"Parse midword asterisks as literal asterisks",type:"boolean"},strikethrough:{defaultValue:!1,describe:"Turn on/off strikethrough support",type:"boolean"},tables:{defaultValue:!1,describe:"Turn on/off tables support",type:"boolean"},tablesHeaderId:{defaultValue:!1,describe:"Add an id to table headers",type:"boolean"},ghCodeBlocks:{defaultValue:!0,describe:"Turn on/off GFM fenced code blocks support",type:"boolean"},tasklists:{defaultValue:!1,describe:"Turn on/off GFM tasklist support",type:"boolean"},smoothLivePreview:{defaultValue:!1,describe:"Prevents weird effects in live previews due to incomplete input",type:"boolean"},smartIndentationFix:{defaultValue:!1,description:"Tries to smartly fix indentation in es6 strings",type:"boolean"},disableForced4SpacesIndentedSublists:{defaultValue:!1,description:"Disables the requirement of indenting nested sublists by 4 spaces",type:"boolean"},simpleLineBreaks:{defaultValue:!1,description:"Parses simple line breaks as <br> (GFM Style)",type:"boolean"},requireSpaceBeforeHeadingText:{defaultValue:!1,description:"Makes adding a space between `#` and the header text mandatory (GFM Style)",type:"boolean"},ghMentions:{defaultValue:!1,description:"Enables github @mentions",type:"boolean"},ghMentionsLink:{defaultValue:"https://github.com/{u}",description:"Changes the link generated by @mentions. Only applies if ghMentions option is enabled.",type:"string"},encodeEmails:{defaultValue:!0,description:"Encode e-mail addresses through the use of Character Entities, transforming ASCII e-mail addresses into its equivalent decimal entities",type:"boolean"},openLinksInNewWindow:{defaultValue:!1,description:"Open all links in new windows",type:"boolean"},backslashEscapesHTMLTags:{defaultValue:!1,description:"Support for HTML Tag escaping. ex: <div>foo</div>",type:"boolean"},emoji:{defaultValue:!1,description:"Enable emoji support. Ex: `this is a :smile: emoji`",type:"boolean"},underline:{defaultValue:!1,description:"Enable support for underline. Syntax is double or triple underscores: `__underline word__`. With this option enabled, underscores no longer parses into `<em>` and `<strong>`",type:"boolean"},completeHTMLDocument:{defaultValue:!1,description:"Outputs a complete html document, including `<html>`, `<head>` and `<body>` tags",type:"boolean"},metadata:{defaultValue:!1,description:"Enable support for document metadata (defined at the top of the document between `«««` and `»»»` or between `---` and `---`).",type:"boolean"},splitAdjacentBlockquotes:{defaultValue:!1,description:"Split adjacent blockquote blocks",type:"boolean"}};if(!1===e)return JSON.parse(JSON.stringify(t));var r={};for(var n in t)t.hasOwnProperty(n)&&(r[n]=t[n].defaultValue);return r}function r(e,t){var r=t?"Error in "+t+" extension->":"Error in unnamed extension",a={valid:!0,error:""};i.helper.isArray(e)||(e=[e]);for(var o=0;o<e.length;++o){var s=r+" sub-extension "+o+": ",l=e[o];if("object"!=(void 0===l?"undefined":n(l)))return a.valid=!1,a.error=s+"must be an object, but "+(void 0===l?"undefined":n(l))+" given",a;if(!i.helper.isString(l.type))return a.valid=!1,a.error=s+'property "type" must be a string, but '+n(l.type)+" given",a;var c=l.type=l.type.toLowerCase();if("language"===c&&(c=l.type="lang"),"html"===c&&(c=l.type="output"),"lang"!==c&&"output"!==c&&"listener"!==c)return a.valid=!1,a.error=s+"type "+c+' is not recognized. Valid values: "lang/language", "output/html" or "listener"',a;if("listener"===c){if(i.helper.isUndefined(l.listeners))return a.valid=!1,a.error=s+'. Extensions of type "listener" must have a property called "listeners"',a}else if(i.helper.isUndefined(l.filter)&&i.helper.isUndefined(l.regex))return a.valid=!1,a.error=s+c+' extensions must define either a "regex" property or a "filter" method',a;if(l.listeners){if("object"!=n(l.listeners))return a.valid=!1,a.error=s+'"listeners" property must be an object but '+n(l.listeners)+" given",a;for(var u in l.listeners)if(l.listeners.hasOwnProperty(u)&&"function"!=typeof l.listeners[u])return a.valid=!1,a.error=s+'"listeners" property must be an hash of [event name]: [callback]. listeners.'+u+" must be a function but "+n(l.listeners[u])+" given",a}if(l.filter){if("function"!=typeof l.filter)return a.valid=!1,a.error=s+'"filter" must be a function, but '+n(l.filter)+" given",a}else if(l.regex){if(i.helper.isString(l.regex)&&(l.regex=new RegExp(l.regex,"g")),!(l.regex instanceof RegExp))return a.valid=!1,a.error=s+'"regex" property must either be a string or a RegExp object, but '+n(l.regex)+" given",a;if(i.helper.isUndefined(l.replace))return a.valid=!1,a.error=s+'"regex" extensions must implement a replace string or function',a}}return a}function a(e,t){return"¨E"+t.charCodeAt(0)+"E"}var i={},o={},s={},l=t(!0),c="vanilla",u={github:{omitExtraWLInCodeBlocks:!0,simplifiedAutoLink:!0,excludeTrailingPunctuationFromURLs:!0,literalMidWordUnderscores:!0,strikethrough:!0,tables:!0,tablesHeaderId:!0,ghCodeBlocks:!0,tasklists:!0,disableForced4SpacesIndentedSublists:!0,simpleLineBreaks:!0,requireSpaceBeforeHeadingText:!0,ghCompatibleHeaderId:!0,ghMentions:!0,backslashEscapesHTMLTags:!0,emoji:!0,splitAdjacentBlockquotes:!0},original:{noHeaderId:!0,ghCodeBlocks:!1},ghost:{omitExtraWLInCodeBlocks:!0,parseImgDimensions:!0,simplifiedAutoLink:!0,excludeTrailingPunctuationFromURLs:!0,literalMidWordUnderscores:!0,strikethrough:!0,tables:!0,tablesHeaderId:!0,ghCodeBlocks:!0,tasklists:!0,smoothLivePreview:!0,simpleLineBreaks:!0,requireSpaceBeforeHeadingText:!0,ghMentions:!1,encodeEmails:!0},vanilla:t(!0),allOn:function(){var e=t(!0),r={};for(var n in e)e.hasOwnProperty(n)&&(r[n]=!0);return r}()};i.helper={},i.extensions={},i.setOption=function(e,t){return l[e]=t,this},i.getOption=function(e){return l[e]},i.getOptions=function(){return l},i.resetOptions=function(){l=t(!0)},i.setFlavor=function(e){if(!u.hasOwnProperty(e))throw Error(e+" flavor was not found");i.resetOptions();var t=u[e];for(var r in c=e,t)t.hasOwnProperty(r)&&(l[r]=t[r])},i.getFlavor=function(){return c},i.getFlavorOptions=function(e){if(u.hasOwnProperty(e))return u[e]},i.getDefaultOptions=function(e){return t(e)},i.subParser=function(e,t){if(i.helper.isString(e)){if(void 0===t){if(o.hasOwnProperty(e))return o[e];throw Error("SubParser named "+e+" not registered!")}o[e]=t}},i.extension=function(e,t){if(!i.helper.isString(e))throw Error("Extension 'name' must be a string");if(e=i.helper.stdExtName(e),i.helper.isUndefined(t)){if(!s.hasOwnProperty(e))throw Error("Extension named "+e+" is not registered!");return s[e]}"function"==typeof t&&(t=t()),i.helper.isArray(t)||(t=[t]);var n=r(t,e);if(!n.valid)throw Error(n.error);s[e]=t},i.getAllExtensions=function(){return s},i.removeExtension=function(e){delete s[e]},i.resetExtensions=function(){s={}},i.validateExtension=function(e){var t=r(e,null);return!!t.valid||!1},i.hasOwnProperty("helper")||(i.helper={}),i.helper.isString=function(e){return"string"==typeof e||e instanceof String},i.helper.isFunction=function(e){return e&&"[object Function]"==={}.toString.call(e)},i.helper.isArray=function(e){return Array.isArray(e)},i.helper.isUndefined=function(e){return void 0===e},i.helper.forEach=function(e,t){if(i.helper.isUndefined(e))throw new Error("obj param is required");if(i.helper.isUndefined(t))throw new Error("callback param is required");if(!i.helper.isFunction(t))throw new Error("callback param must be a function/closure");if("function"==typeof e.forEach)e.forEach(t);else if(i.helper.isArray(e))for(var r=0;r<e.length;r++)t(e[r],r,e);else{if("object"!=(void 0===e?"undefined":n(e)))throw new Error("obj does not seem to be an array or an iterable object");for(var a in e)e.hasOwnProperty(a)&&t(e[a],a,e)}},i.helper.stdExtName=function(e){return e.replace(/[_?*+\/\\.^-]/g,"").replace(/\s/g,"").toLowerCase()},i.helper.escapeCharactersCallback=a,i.helper.escapeCharacters=function(e,t,r){var n="(["+t.replace(/([\[\]\\])/g,"\\$1")+"])";r&&(n="\\\\"+n);var i=new RegExp(n,"g");return e.replace(i,a)},i.helper.unescapeHTMLEntities=function(e){return e.replace(/"/g,'"').replace(/</g,"<").replace(/>/g,">").replace(/&/g,"&")};var d=function(e,t,r,n){var a,i,o,s,l,c=n||"",u=c.indexOf("g")>-1,d=new RegExp(t+"|"+r,"g"+c.replace(/g/g,"")),h=new RegExp(t,c.replace(/g/g,"")),f=[];do{for(a=0;o=d.exec(e);)if(h.test(o[0]))a++||(s=(i=d.lastIndex)-o[0].length);else if(a&&!--a){l=o.index+o[0].length;var p={left:{start:s,end:i},match:{start:i,end:o.index},right:{start:o.index,end:l},wholeMatch:{start:s,end:l}};if(f.push(p),!u)return f}}while(a&&(d.lastIndex=i));return f};i.helper.matchRecursiveRegExp=function(e,t,r,n){for(var a=d(e,t,r,n),i=[],o=0;o<a.length;++o)i.push([e.slice(a[o].wholeMatch.start,a[o].wholeMatch.end),e.slice(a[o].match.start,a[o].match.end),e.slice(a[o].left.start,a[o].left.end),e.slice(a[o].right.start,a[o].right.end)]);return i},i.helper.replaceRecursiveRegExp=function(e,t,r,n,a){if(!i.helper.isFunction(t)){var o=t;t=function(){return o}}var s=d(e,r,n,a),l=e,c=s.length;if(c>0){var u=[];0!==s[0].wholeMatch.start&&u.push(e.slice(0,s[0].wholeMatch.start));for(var h=0;h<c;++h)u.push(t(e.slice(s[h].wholeMatch.start,s[h].wholeMatch.end),e.slice(s[h].match.start,s[h].match.end),e.slice(s[h].left.start,s[h].left.end),e.slice(s[h].right.start,s[h].right.end))),h<c-1&&u.push(e.slice(s[h].wholeMatch.end,s[h+1].wholeMatch.start));s[c-1].wholeMatch.end<e.length&&u.push(e.slice(s[c-1].wholeMatch.end)),l=u.join("")}return l},i.helper.regexIndexOf=function(e,t,r){if(!i.helper.isString(e))throw"InvalidArgumentError: first parameter of showdown.helper.regexIndexOf function must be a string";if(t instanceof RegExp==0)throw"InvalidArgumentError: second parameter of showdown.helper.regexIndexOf function must be an instance of RegExp";var n=e.substring(r||0).search(t);return n>=0?n+(r||0):n},i.helper.splitAtIndex=function(e,t){if(!i.helper.isString(e))throw"InvalidArgumentError: first parameter of showdown.helper.regexIndexOf function must be a string";return[e.substring(0,t),e.substring(t)]},i.helper.encodeEmailAddress=function(e){var t=[function(e){return"&#"+e.charCodeAt(0)+";"},function(e){return"&#x"+e.charCodeAt(0).toString(16)+";"},function(e){return e}];return e.replace(/./g,function(e){if("@"===e)e=t[Math.floor(2*Math.random())](e);else{var r=Math.random();e=r>.9?t[2](e):r>.45?t[1](e):t[0](e)}return e})},i.helper.padEnd=function(e,t,r){return t>>=0,r=String(r||" "),e.length>t?String(e):((t-=e.length)>r.length&&(r+=r.repeat(t/r.length)),String(e)+r.slice(0,t))},"undefined"==typeof console&&(console={warn:function(e){alert(e)},log:function(e){alert(e)},error:function(e){throw e}}),i.helper.regexes={asteriskDashAndColon:/([*_:~])/g},i.helper.emojis={"+1":"👍","-1":"👎",100:"💯",1234:"🔢","1st_place_medal":"🥇","2nd_place_medal":"🥈","3rd_place_medal":"🥉","8ball":"🎱",a:"🅰️",ab:"🆎",abc:"🔤",abcd:"🔡",accept:"🉑",aerial_tramway:"🚡",airplane:"✈️",alarm_clock:"⏰",alembic:"⚗️",alien:"👽",ambulance:"🚑",amphora:"🏺",anchor:"⚓️",angel:"👼",anger:"💢",angry:"😠",anguished:"😧",ant:"🐜",apple:"🍎",aquarius:"♒️",aries:"♈️",arrow_backward:"◀️",arrow_double_down:"⏬",arrow_double_up:"⏫",arrow_down:"⬇️",arrow_down_small:"🔽",arrow_forward:"▶️",arrow_heading_down:"⤵️",arrow_heading_up:"⤴️",arrow_left:"⬅️",arrow_lower_left:"↙️",arrow_lower_right:"↘️",arrow_right:"➡️",arrow_right_hook:"↪️",arrow_up:"⬆️",arrow_up_down:"↕️",arrow_up_small:"🔼",arrow_upper_left:"↖️",arrow_upper_right:"↗️",arrows_clockwise:"🔃",arrows_counterclockwise:"🔄",art:"🎨",articulated_lorry:"🚛",artificial_satellite:"🛰",astonished:"😲",athletic_shoe:"👟",atm:"🏧",atom_symbol:"⚛️",avocado:"🥑",b:"🅱️",baby:"👶",baby_bottle:"🍼",baby_chick:"🐤",baby_symbol:"🚼",back:"🔙",bacon:"🥓",badminton:"🏸",baggage_claim:"🛄",baguette_bread:"🥖",balance_scale:"⚖️",balloon:"🎈",ballot_box:"🗳",ballot_box_with_check:"☑️",bamboo:"🎍",banana:"🍌",bangbang:"‼️",bank:"🏦",bar_chart:"📊",barber:"💈",baseball:"⚾️",basketball:"🏀",basketball_man:"⛹️",basketball_woman:"⛹️‍♀️",bat:"🦇",bath:"🛀",bathtub:"🛁",battery:"🔋",beach_umbrella:"🏖",bear:"🐻",bed:"🛏",bee:"🐝",beer:"🍺",beers:"🍻",beetle:"🐞",beginner:"🔰",bell:"🔔",bellhop_bell:"🛎",bento:"🍱",biking_man:"🚴",bike:"🚲",biking_woman:"🚴‍♀️",bikini:"👙",biohazard:"☣️",bird:"🐦",birthday:"🎂",black_circle:"⚫️",black_flag:"🏴",black_heart:"🖤",black_joker:"🃏",black_large_square:"⬛️",black_medium_small_square:"◾️",black_medium_square:"◼️",black_nib:"✒️",black_small_square:"▪️",black_square_button:"🔲",blonde_man:"👱",blonde_woman:"👱‍♀️",blossom:"🌼",blowfish:"🐡",blue_book:"📘",blue_car:"🚙",blue_heart:"💙",blush:"😊",boar:"🐗",boat:"⛵️",bomb:"💣",book:"📖",bookmark:"🔖",bookmark_tabs:"📑",books:"📚",boom:"💥",boot:"👢",bouquet:"💐",bowing_man:"🙇",bow_and_arrow:"🏹",bowing_woman:"🙇‍♀️",bowling:"🎳",boxing_glove:"🥊",boy:"👦",bread:"🍞",bride_with_veil:"👰",bridge_at_night:"🌉",briefcase:"💼",broken_heart:"💔",bug:"🐛",building_construction:"🏗",bulb:"💡",bullettrain_front:"🚅",bullettrain_side:"🚄",burrito:"🌯",bus:"🚌",business_suit_levitating:"🕴",busstop:"🚏",bust_in_silhouette:"👤",busts_in_silhouette:"👥",butterfly:"🦋",cactus:"🌵",cake:"🍰",calendar:"📆",call_me_hand:"🤙",calling:"📲",camel:"🐫",camera:"📷",camera_flash:"📸",camping:"🏕",cancer:"♋️",candle:"🕯",candy:"🍬",canoe:"🛶",capital_abcd:"🔠",capricorn:"♑️",car:"🚗",card_file_box:"🗃",card_index:"📇",card_index_dividers:"🗂",carousel_horse:"🎠",carrot:"🥕",cat:"🐱",cat2:"🐈",cd:"💿",chains:"⛓",champagne:"🍾",chart:"💹",chart_with_downwards_trend:"📉",chart_with_upwards_trend:"📈",checkered_flag:"🏁",cheese:"🧀",cherries:"🍒",cherry_blossom:"🌸",chestnut:"🌰",chicken:"🐔",children_crossing:"🚸",chipmunk:"🐿",chocolate_bar:"🍫",christmas_tree:"🎄",church:"⛪️",cinema:"🎦",circus_tent:"🎪",city_sunrise:"🌇",city_sunset:"🌆",cityscape:"🏙",cl:"🆑",clamp:"🗜",clap:"👏",clapper:"🎬",classical_building:"🏛",clinking_glasses:"🥂",clipboard:"📋",clock1:"🕐",clock10:"🕙",clock1030:"🕥",clock11:"🕚",clock1130:"🕦",clock12:"🕛",clock1230:"🕧",clock130:"🕜",clock2:"🕑",clock230:"🕝",clock3:"🕒",clock330:"🕞",clock4:"🕓",clock430:"🕟",clock5:"🕔",clock530:"🕠",clock6:"🕕",clock630:"🕡",clock7:"🕖",clock730:"🕢",clock8:"🕗",clock830:"🕣",clock9:"🕘",clock930:"🕤",closed_book:"📕",closed_lock_with_key:"🔐",closed_umbrella:"🌂",cloud:"☁️",cloud_with_lightning:"🌩",cloud_with_lightning_and_rain:"⛈",cloud_with_rain:"🌧",cloud_with_snow:"🌨",clown_face:"🤡",clubs:"♣️",cocktail:"🍸",coffee:"☕️",coffin:"⚰️",cold_sweat:"😰",comet:"☄️",computer:"💻",computer_mouse:"🖱",confetti_ball:"🎊",confounded:"😖",confused:"😕",congratulations:"㊗️",construction:"🚧",construction_worker_man:"👷",construction_worker_woman:"👷‍♀️",control_knobs:"🎛",convenience_store:"🏪",cookie:"🍪",cool:"🆒",policeman:"👮",copyright:"©️",corn:"🌽",couch_and_lamp:"🛋",couple:"👫",couple_with_heart_woman_man:"💑",couple_with_heart_man_man:"👨‍❤️‍👨",couple_with_heart_woman_woman:"👩‍❤️‍👩",couplekiss_man_man:"👨‍❤️‍💋‍👨",couplekiss_man_woman:"💏",couplekiss_woman_woman:"👩‍❤️‍💋‍👩",cow:"🐮",cow2:"🐄",cowboy_hat_face:"🤠",crab:"🦀",crayon:"🖍",credit_card:"💳",crescent_moon:"🌙",cricket:"🏏",crocodile:"🐊",croissant:"🥐",crossed_fingers:"🤞",crossed_flags:"🎌",crossed_swords:"⚔️",crown:"👑",cry:"😢",crying_cat_face:"😿",crystal_ball:"🔮",cucumber:"🥒",cupid:"💘",curly_loop:"➰",currency_exchange:"💱",curry:"🍛",custard:"🍮",customs:"🛃",cyclone:"🌀",dagger:"🗡",dancer:"💃",dancing_women:"👯",dancing_men:"👯‍♂️",dango:"🍡",dark_sunglasses:"🕶",dart:"🎯",dash:"💨",date:"📅",deciduous_tree:"🌳",deer:"🦌",department_store:"🏬",derelict_house:"🏚",desert:"🏜",desert_island:"🏝",desktop_computer:"🖥",male_detective:"🕵️",diamond_shape_with_a_dot_inside:"💠",diamonds:"♦️",disappointed:"😞",disappointed_relieved:"😥",dizzy:"💫",dizzy_face:"😵",do_not_litter:"🚯",dog:"🐶",dog2:"🐕",dollar:"💵",dolls:"🎎",dolphin:"🐬",door:"🚪",doughnut:"🍩",dove:"🕊",dragon:"🐉",dragon_face:"🐲",dress:"👗",dromedary_camel:"🐪",drooling_face:"🤤",droplet:"💧",drum:"🥁",duck:"🦆",dvd:"📀","e-mail":"📧",eagle:"🦅",ear:"👂",ear_of_rice:"🌾",earth_africa:"🌍",earth_americas:"🌎",earth_asia:"🌏",egg:"🥚",eggplant:"🍆",eight_pointed_black_star:"✴️",eight_spoked_asterisk:"✳️",electric_plug:"🔌",elephant:"🐘",email:"✉️",end:"🔚",envelope_with_arrow:"📩",euro:"💶",european_castle:"🏰",european_post_office:"🏤",evergreen_tree:"🌲",exclamation:"❗️",expressionless:"😑",eye:"👁",eye_speech_bubble:"👁‍🗨",eyeglasses:"👓",eyes:"👀",face_with_head_bandage:"🤕",face_with_thermometer:"🤒",fist_oncoming:"👊",factory:"🏭",fallen_leaf:"🍂",family_man_woman_boy:"👪",family_man_boy:"👨‍👦",family_man_boy_boy:"👨‍👦‍👦",family_man_girl:"👨‍👧",family_man_girl_boy:"👨‍👧‍👦",family_man_girl_girl:"👨‍👧‍👧",family_man_man_boy:"👨‍👨‍👦",family_man_man_boy_boy:"👨‍👨‍👦‍👦",family_man_man_girl:"👨‍👨‍👧",family_man_man_girl_boy:"👨‍👨‍👧‍👦",family_man_man_girl_girl:"👨‍👨‍👧‍👧",family_man_woman_boy_boy:"👨‍👩‍👦‍👦",family_man_woman_girl:"👨‍👩‍👧",family_man_woman_girl_boy:"👨‍👩‍👧‍👦",family_man_woman_girl_girl:"👨‍👩‍👧‍👧",family_woman_boy:"👩‍👦",family_woman_boy_boy:"👩‍👦‍👦",family_woman_girl:"👩‍👧",family_woman_girl_boy:"👩‍👧‍👦",family_woman_girl_girl:"👩‍👧‍👧",family_woman_woman_boy:"👩‍👩‍👦",family_woman_woman_boy_boy:"👩‍👩‍👦‍👦",family_woman_woman_girl:"👩‍👩‍👧",family_woman_woman_girl_boy:"👩‍👩‍👧‍👦",family_woman_woman_girl_girl:"👩‍👩‍👧‍👧",fast_forward:"⏩",fax:"📠",fearful:"😨",feet:"🐾",female_detective:"🕵️‍♀️",ferris_wheel:"🎡",ferry:"⛴",field_hockey:"🏑",file_cabinet:"🗄",file_folder:"📁",film_projector:"📽",film_strip:"🎞",fire:"🔥",fire_engine:"🚒",fireworks:"🎆",first_quarter_moon:"🌓",first_quarter_moon_with_face:"🌛",fish:"🐟",fish_cake:"🍥",fishing_pole_and_fish:"🎣",fist_raised:"✊",fist_left:"🤛",fist_right:"🤜",flags:"🎏",flashlight:"🔦",fleur_de_lis:"⚜️",flight_arrival:"🛬",flight_departure:"🛫",floppy_disk:"💾",flower_playing_cards:"🎴",flushed:"😳",fog:"🌫",foggy:"🌁",football:"🏈",footprints:"👣",fork_and_knife:"🍴",fountain:"⛲️",fountain_pen:"🖋",four_leaf_clover:"🍀",fox_face:"🦊",framed_picture:"🖼",free:"🆓",fried_egg:"🍳",fried_shrimp:"🍤",fries:"🍟",frog:"🐸",frowning:"😦",frowning_face:"☹️",frowning_man:"🙍‍♂️",frowning_woman:"🙍",middle_finger:"🖕",fuelpump:"⛽️",full_moon:"🌕",full_moon_with_face:"🌝",funeral_urn:"⚱️",game_die:"🎲",gear:"⚙️",gem:"💎",gemini:"♊️",ghost:"👻",gift:"🎁",gift_heart:"💝",girl:"👧",globe_with_meridians:"🌐",goal_net:"🥅",goat:"🐐",golf:"⛳️",golfing_man:"🏌️",golfing_woman:"🏌️‍♀️",gorilla:"🦍",grapes:"🍇",green_apple:"🍏",green_book:"📗",green_heart:"💚",green_salad:"🥗",grey_exclamation:"❕",grey_question:"❔",grimacing:"😬",grin:"😁",grinning:"😀",guardsman:"💂",guardswoman:"💂‍♀️",guitar:"🎸",gun:"🔫",haircut_woman:"💇",haircut_man:"💇‍♂️",hamburger:"🍔",hammer:"🔨",hammer_and_pick:"⚒",hammer_and_wrench:"🛠",hamster:"🐹",hand:"✋",handbag:"👜",handshake:"🤝",hankey:"💩",hatched_chick:"🐥",hatching_chick:"🐣",headphones:"🎧",hear_no_evil:"🙉",heart:"❤️",heart_decoration:"💟",heart_eyes:"😍",heart_eyes_cat:"😻",heartbeat:"💓",heartpulse:"💗",hearts:"♥️",heavy_check_mark:"✔️",heavy_division_sign:"➗",heavy_dollar_sign:"💲",heavy_heart_exclamation:"❣️",heavy_minus_sign:"➖",heavy_multiplication_x:"✖️",heavy_plus_sign:"➕",helicopter:"🚁",herb:"🌿",hibiscus:"🌺",high_brightness:"🔆",high_heel:"👠",hocho:"🔪",hole:"🕳",honey_pot:"🍯",horse:"🐴",horse_racing:"🏇",hospital:"🏥",hot_pepper:"🌶",hotdog:"🌭",hotel:"🏨",hotsprings:"♨️",hourglass:"⌛️",hourglass_flowing_sand:"⏳",house:"🏠",house_with_garden:"🏡",houses:"🏘",hugs:"🤗",hushed:"😯",ice_cream:"🍨",ice_hockey:"🏒",ice_skate:"⛸",icecream:"🍦",id:"🆔",ideograph_advantage:"🉐",imp:"👿",inbox_tray:"📥",incoming_envelope:"📨",tipping_hand_woman:"💁",information_source:"ℹ️",innocent:"😇",interrobang:"⁉️",iphone:"📱",izakaya_lantern:"🏮",jack_o_lantern:"🎃",japan:"🗾",japanese_castle:"🏯",japanese_goblin:"👺",japanese_ogre:"👹",jeans:"👖",joy:"😂",joy_cat:"😹",joystick:"🕹",kaaba:"🕋",key:"🔑",keyboard:"⌨️",keycap_ten:"🔟",kick_scooter:"🛴",kimono:"👘",kiss:"💋",kissing:"😗",kissing_cat:"😽",kissing_closed_eyes:"😚",kissing_heart:"😘",kissing_smiling_eyes:"😙",kiwi_fruit:"🥝",koala:"🐨",koko:"🈁",label:"🏷",large_blue_circle:"🔵",large_blue_diamond:"🔷",large_orange_diamond:"🔶",last_quarter_moon:"🌗",last_quarter_moon_with_face:"🌜",latin_cross:"✝️",laughing:"😆",leaves:"🍃",ledger:"📒",left_luggage:"🛅",left_right_arrow:"↔️",leftwards_arrow_with_hook:"↩️",lemon:"🍋",leo:"♌️",leopard:"🐆",level_slider:"🎚",libra:"♎️",light_rail:"🚈",link:"🔗",lion:"🦁",lips:"👄",lipstick:"💄",lizard:"🦎",lock:"🔒",lock_with_ink_pen:"🔏",lollipop:"🍭",loop:"➿",loud_sound:"🔊",loudspeaker:"📢",love_hotel:"🏩",love_letter:"💌",low_brightness:"🔅",lying_face:"🤥",m:"Ⓜ️",mag:"🔍",mag_right:"🔎",mahjong:"🀄️",mailbox:"📫",mailbox_closed:"📪",mailbox_with_mail:"📬",mailbox_with_no_mail:"📭",man:"👨",man_artist:"👨‍🎨",man_astronaut:"👨‍🚀",man_cartwheeling:"🤸‍♂️",man_cook:"👨‍🍳",man_dancing:"🕺",man_facepalming:"🤦‍♂️",man_factory_worker:"👨‍🏭",man_farmer:"👨‍🌾",man_firefighter:"👨‍🚒",man_health_worker:"👨‍⚕️",man_in_tuxedo:"🤵",man_judge:"👨‍⚖️",man_juggling:"🤹‍♂️",man_mechanic:"👨‍🔧",man_office_worker:"👨‍💼",man_pilot:"👨‍✈️",man_playing_handball:"🤾‍♂️",man_playing_water_polo:"🤽‍♂️",man_scientist:"👨‍🔬",man_shrugging:"🤷‍♂️",man_singer:"👨‍🎤",man_student:"👨‍🎓",man_teacher:"👨‍🏫",man_technologist:"👨‍💻",man_with_gua_pi_mao:"👲",man_with_turban:"👳",tangerine:"🍊",mans_shoe:"👞",mantelpiece_clock:"🕰",maple_leaf:"🍁",martial_arts_uniform:"🥋",mask:"😷",massage_woman:"💆",massage_man:"💆‍♂️",meat_on_bone:"🍖",medal_military:"🎖",medal_sports:"🏅",mega:"📣",melon:"🍈",memo:"📝",men_wrestling:"🤼‍♂️",menorah:"🕎",mens:"🚹",metal:"🤘",metro:"🚇",microphone:"🎤",microscope:"🔬",milk_glass:"🥛",milky_way:"🌌",minibus:"🚐",minidisc:"💽",mobile_phone_off:"📴",money_mouth_face:"🤑",money_with_wings:"💸",moneybag:"💰",monkey:"🐒",monkey_face:"🐵",monorail:"🚝",moon:"🌔",mortar_board:"🎓",mosque:"🕌",motor_boat:"🛥",motor_scooter:"🛵",motorcycle:"🏍",motorway:"🛣",mount_fuji:"🗻",mountain:"⛰",mountain_biking_man:"🚵",mountain_biking_woman:"🚵‍♀️",mountain_cableway:"🚠",mountain_railway:"🚞",mountain_snow:"🏔",mouse:"🐭",mouse2:"🐁",movie_camera:"🎥",moyai:"🗿",mrs_claus:"🤶",muscle:"💪",mushroom:"🍄",musical_keyboard:"🎹",musical_note:"🎵",musical_score:"🎼",mute:"🔇",nail_care:"💅",name_badge:"📛",national_park:"🏞",nauseated_face:"🤢",necktie:"👔",negative_squared_cross_mark:"❎",nerd_face:"🤓",neutral_face:"😐",new:"🆕",new_moon:"🌑",new_moon_with_face:"🌚",newspaper:"📰",newspaper_roll:"🗞",next_track_button:"⏭",ng:"🆖",no_good_man:"🙅‍♂️",no_good_woman:"🙅",night_with_stars:"🌃",no_bell:"🔕",no_bicycles:"🚳",no_entry:"⛔️",no_entry_sign:"🚫",no_mobile_phones:"📵",no_mouth:"😶",no_pedestrians:"🚷",no_smoking:"🚭","non-potable_water":"🚱",nose:"👃",notebook:"📓",notebook_with_decorative_cover:"📔",notes:"🎶",nut_and_bolt:"🔩",o:"⭕️",o2:"🅾️",ocean:"🌊",octopus:"🐙",oden:"🍢",office:"🏢",oil_drum:"🛢",ok:"🆗",ok_hand:"👌",ok_man:"🙆‍♂️",ok_woman:"🙆",old_key:"🗝",older_man:"👴",older_woman:"👵",om:"🕉",on:"🔛",oncoming_automobile:"🚘",oncoming_bus:"🚍",oncoming_police_car:"🚔",oncoming_taxi:"🚖",open_file_folder:"📂",open_hands:"👐",open_mouth:"😮",open_umbrella:"☂️",ophiuchus:"⛎",orange_book:"📙",orthodox_cross:"☦️",outbox_tray:"📤",owl:"🦉",ox:"🐂",package:"📦",page_facing_up:"📄",page_with_curl:"📃",pager:"📟",paintbrush:"🖌",palm_tree:"🌴",pancakes:"🥞",panda_face:"🐼",paperclip:"📎",paperclips:"🖇",parasol_on_ground:"⛱",parking:"🅿️",part_alternation_mark:"〽️",partly_sunny:"⛅️",passenger_ship:"🛳",passport_control:"🛂",pause_button:"⏸",peace_symbol:"☮️",peach:"🍑",peanuts:"🥜",pear:"🍐",pen:"🖊",pencil2:"✏️",penguin:"🐧",pensive:"😔",performing_arts:"🎭",persevere:"😣",person_fencing:"🤺",pouting_woman:"🙎",phone:"☎️",pick:"⛏",pig:"🐷",pig2:"🐖",pig_nose:"🐽",pill:"💊",pineapple:"🍍",ping_pong:"🏓",pisces:"♓️",pizza:"🍕",place_of_worship:"🛐",plate_with_cutlery:"🍽",play_or_pause_button:"⏯",point_down:"👇",point_left:"👈",point_right:"👉",point_up:"☝️",point_up_2:"👆",police_car:"🚓",policewoman:"👮‍♀️",poodle:"🐩",popcorn:"🍿",post_office:"🏣",postal_horn:"📯",postbox:"📮",potable_water:"🚰",potato:"🥔",pouch:"👝",poultry_leg:"🍗",pound:"💷",rage:"😡",pouting_cat:"😾",pouting_man:"🙎‍♂️",pray:"🙏",prayer_beads:"📿",pregnant_woman:"🤰",previous_track_button:"⏮",prince:"🤴",princess:"👸",printer:"🖨",purple_heart:"💜",purse:"👛",pushpin:"📌",put_litter_in_its_place:"🚮",question:"❓",rabbit:"🐰",rabbit2:"🐇",racehorse:"🐎",racing_car:"🏎",radio:"📻",radio_button:"🔘",radioactive:"☢️",railway_car:"🚃",railway_track:"🛤",rainbow:"🌈",rainbow_flag:"🏳️‍🌈",raised_back_of_hand:"🤚",raised_hand_with_fingers_splayed:"🖐",raised_hands:"🙌",raising_hand_woman:"🙋",raising_hand_man:"🙋‍♂️",ram:"🐏",ramen:"🍜",rat:"🐀",record_button:"⏺",recycle:"♻️",red_circle:"🔴",registered:"®️",relaxed:"☺️",relieved:"😌",reminder_ribbon:"🎗",repeat:"🔁",repeat_one:"🔂",rescue_worker_helmet:"⛑",restroom:"🚻",revolving_hearts:"💞",rewind:"⏪",rhinoceros:"🦏",ribbon:"🎀",rice:"🍚",rice_ball:"🍙",rice_cracker:"🍘",rice_scene:"🎑",right_anger_bubble:"🗯",ring:"💍",robot:"🤖",rocket:"🚀",rofl:"🤣",roll_eyes:"🙄",roller_coaster:"🎢",rooster:"🐓",rose:"🌹",rosette:"🏵",rotating_light:"🚨",round_pushpin:"📍",rowing_man:"🚣",rowing_woman:"🚣‍♀️",rugby_football:"🏉",running_man:"🏃",running_shirt_with_sash:"🎽",running_woman:"🏃‍♀️",sa:"🈂️",sagittarius:"♐️",sake:"🍶",sandal:"👡",santa:"🎅",satellite:"📡",saxophone:"🎷",school:"🏫",school_satchel:"🎒",scissors:"✂️",scorpion:"🦂",scorpius:"♏️",scream:"😱",scream_cat:"🙀",scroll:"📜",seat:"💺",secret:"㊙️",see_no_evil:"🙈",seedling:"🌱",selfie:"🤳",shallow_pan_of_food:"🥘",shamrock:"☘️",shark:"🦈",shaved_ice:"🍧",sheep:"🐑",shell:"🐚",shield:"🛡",shinto_shrine:"⛩",ship:"🚢",shirt:"👕",shopping:"🛍",shopping_cart:"🛒",shower:"🚿",shrimp:"🦐",signal_strength:"📶",six_pointed_star:"🔯",ski:"🎿",skier:"⛷",skull:"💀",skull_and_crossbones:"☠️",sleeping:"😴",sleeping_bed:"🛌",sleepy:"😪",slightly_frowning_face:"🙁",slightly_smiling_face:"🙂",slot_machine:"🎰",small_airplane:"🛩",small_blue_diamond:"🔹",small_orange_diamond:"🔸",small_red_triangle:"🔺",small_red_triangle_down:"🔻",smile:"😄",smile_cat:"😸",smiley:"😃",smiley_cat:"😺",smiling_imp:"😈",smirk:"😏",smirk_cat:"😼",smoking:"🚬",snail:"🐌",snake:"🐍",sneezing_face:"🤧",snowboarder:"🏂",snowflake:"❄️",snowman:"⛄️",snowman_with_snow:"☃️",sob:"😭",soccer:"⚽️",soon:"🔜",sos:"🆘",sound:"🔉",space_invader:"👾",spades:"♠️",spaghetti:"🍝",sparkle:"❇️",sparkler:"🎇",sparkles:"✨",sparkling_heart:"💖",speak_no_evil:"🙊",speaker:"🔈",speaking_head:"🗣",speech_balloon:"💬",speedboat:"🚤",spider:"🕷",spider_web:"🕸",spiral_calendar:"🗓",spiral_notepad:"🗒",spoon:"🥄",squid:"🦑",stadium:"🏟",star:"⭐️",star2:"🌟",star_and_crescent:"☪️",star_of_david:"✡️",stars:"🌠",station:"🚉",statue_of_liberty:"🗽",steam_locomotive:"🚂",stew:"🍲",stop_button:"⏹",stop_sign:"🛑",stopwatch:"⏱",straight_ruler:"📏",strawberry:"🍓",stuck_out_tongue:"😛",stuck_out_tongue_closed_eyes:"😝",stuck_out_tongue_winking_eye:"😜",studio_microphone:"🎙",stuffed_flatbread:"🥙",sun_behind_large_cloud:"🌥",sun_behind_rain_cloud:"🌦",sun_behind_small_cloud:"🌤",sun_with_face:"🌞",sunflower:"🌻",sunglasses:"😎",sunny:"☀️",sunrise:"🌅",sunrise_over_mountains:"🌄",surfing_man:"🏄",surfing_woman:"🏄‍♀️",sushi:"🍣",suspension_railway:"🚟",sweat:"😓",sweat_drops:"💦",sweat_smile:"😅",sweet_potato:"🍠",swimming_man:"🏊",swimming_woman:"🏊‍♀️",symbols:"🔣",synagogue:"🕍",syringe:"💉",taco:"🌮",tada:"🎉",tanabata_tree:"🎋",taurus:"♉️",taxi:"🚕",tea:"🍵",telephone_receiver:"📞",telescope:"🔭",tennis:"🎾",tent:"⛺️",thermometer:"🌡",thinking:"🤔",thought_balloon:"💭",ticket:"🎫",tickets:"🎟",tiger:"🐯",tiger2:"🐅",timer_clock:"⏲",tipping_hand_man:"💁‍♂️",tired_face:"😫",tm:"™️",toilet:"🚽",tokyo_tower:"🗼",tomato:"🍅",tongue:"👅",top:"🔝",tophat:"🎩",tornado:"🌪",trackball:"🖲",tractor:"🚜",traffic_light:"🚥",train:"🚋",train2:"🚆",tram:"🚊",triangular_flag_on_post:"🚩",triangular_ruler:"📐",trident:"🔱",triumph:"😤",trolleybus:"🚎",trophy:"🏆",tropical_drink:"🍹",tropical_fish:"🐠",truck:"🚚",trumpet:"🎺",tulip:"🌷",tumbler_glass:"🥃",turkey:"🦃",turtle:"🐢",tv:"📺",twisted_rightwards_arrows:"🔀",two_hearts:"💕",two_men_holding_hands:"👬",two_women_holding_hands:"👭",u5272:"🈹",u5408:"🈴",u55b6:"🈺",u6307:"🈯️",u6708:"🈷️",u6709:"🈶",u6e80:"🈵",u7121:"🈚️",u7533:"🈸",u7981:"🈲",u7a7a:"🈳",umbrella:"☔️",unamused:"😒",underage:"🔞",unicorn:"🦄",unlock:"🔓",up:"🆙",upside_down_face:"🙃",v:"✌️",vertical_traffic_light:"🚦",vhs:"📼",vibration_mode:"📳",video_camera:"📹",video_game:"🎮",violin:"🎻",virgo:"♍️",volcano:"🌋",volleyball:"🏐",vs:"🆚",vulcan_salute:"🖖",walking_man:"🚶",walking_woman:"🚶‍♀️",waning_crescent_moon:"🌘",waning_gibbous_moon:"🌖",warning:"⚠️",wastebasket:"🗑",watch:"⌚️",water_buffalo:"🐃",watermelon:"🍉",wave:"👋",wavy_dash:"〰️",waxing_crescent_moon:"🌒",wc:"🚾",weary:"😩",wedding:"💒",weight_lifting_man:"🏋️",weight_lifting_woman:"🏋️‍♀️",whale:"🐳",whale2:"🐋",wheel_of_dharma:"☸️",wheelchair:"♿️",white_check_mark:"✅",white_circle:"⚪️",white_flag:"🏳️",white_flower:"💮",white_large_square:"⬜️",white_medium_small_square:"◽️",white_medium_square:"◻️",white_small_square:"▫️",white_square_button:"🔳",wilted_flower:"🥀",wind_chime:"🎐",wind_face:"🌬",wine_glass:"🍷",wink:"😉",wolf:"🐺",woman:"👩",woman_artist:"👩‍🎨",woman_astronaut:"👩‍🚀",woman_cartwheeling:"🤸‍♀️",woman_cook:"👩‍🍳",woman_facepalming:"🤦‍♀️",woman_factory_worker:"👩‍🏭",woman_farmer:"👩‍🌾",woman_firefighter:"👩‍🚒",woman_health_worker:"👩‍⚕️",woman_judge:"👩‍⚖️",woman_juggling:"🤹‍♀️",woman_mechanic:"👩‍🔧",woman_office_worker:"👩‍💼",woman_pilot:"👩‍✈️",woman_playing_handball:"🤾‍♀️",woman_playing_water_polo:"🤽‍♀️",woman_scientist:"👩‍🔬",woman_shrugging:"🤷‍♀️",woman_singer:"👩‍🎤",woman_student:"👩‍🎓",woman_teacher:"👩‍🏫",woman_technologist:"👩‍💻",woman_with_turban:"👳‍♀️",womans_clothes:"👚",womans_hat:"👒",women_wrestling:"🤼‍♀️",womens:"🚺",world_map:"🗺",worried:"😟",wrench:"🔧",writing_hand:"✍️",x:"❌",yellow_heart:"💛",yen:"💴",yin_yang:"☯️",yum:"😋",zap:"⚡️",zipper_mouth_face:"🤐",zzz:"💤",octocat:'<img alt=":octocat:" height="20" width="20" align="absmiddle" src="https://assets-cdn.github.com/images/icons/emoji/octocat.png">',showdown:"<span style=\"font-family: 'Anonymous Pro', monospace; text-decoration: underline; text-decoration-style: dashed; text-decoration-color: #3e8b8a;text-underline-position: under;\">S</span>"},i.Converter=function(e){function t(e,t){if(t=t||null,i.helper.isString(e)){if(t=e=i.helper.stdExtName(e),i.extensions[e])return void function(e,t){"function"==typeof e&&(e=e(new i.Converter)),i.helper.isArray(e)||(e=[e]);var n=r(e,t);if(!n.valid)throw Error(n.error);for(var a=0;a<e.length;++a)switch(e[a].type){case"lang":d.push(e[a]);break;case"output":h.push(e[a]);break;default:throw Error("Extension loader error: Type unrecognized!!!")}}(i.extensions[e],e);if(i.helper.isUndefined(s[e]))throw Error('Extension "'+e+'" could not be loaded. It was either not found or is not a valid extension.');e=s[e]}"function"==typeof e&&(e=e()),i.helper.isArray(e)||(e=[e]);var n=r(e,t);if(!n.valid)throw Error(n.error);for(var o=0;o<e.length;++o){switch(e[o].type){case"lang":d.push(e[o]);break;case"output":h.push(e[o])}if(e[o].hasOwnProperty("listeners"))for(var l in e[o].listeners)e[o].listeners.hasOwnProperty(l)&&a(l,e[o].listeners[l])}}function a(e,t){if(!i.helper.isString(e))throw Error("Invalid argument in converter.listen() method: name must be a string, but "+(void 0===e?"undefined":n(e))+" given");if("function"!=typeof t)throw Error("Invalid argument in converter.listen() method: callback must be a function, but "+(void 0===t?"undefined":n(t))+" given");f.hasOwnProperty(e)||(f[e]=[]),f[e].push(t)}var o={},d=[],h=[],f={},p=c,g={parsed:{},raw:"",format:""};!function(){for(var r in e=e||{},l)l.hasOwnProperty(r)&&(o[r]=l[r]);if("object"!=(void 0===e?"undefined":n(e)))throw Error("Converter expects the passed parameter to be an object, but "+(void 0===e?"undefined":n(e))+" was passed instead.");for(var a in e)e.hasOwnProperty(a)&&(o[a]=e[a]);o.extensions&&i.helper.forEach(o.extensions,t)}(),this._dispatch=function(e,t,r,n){if(f.hasOwnProperty(e))for(var a=0;a<f[e].length;++a){var i=f[e][a](e,t,this,r,n);i&&void 0!==i&&(t=i)}return t},this.listen=function(e,t){return a(e,t),this},this.makeHtml=function(e){if(!e)return e;var t={gHtmlBlocks:[],gHtmlMdBlocks:[],gHtmlSpans:[],gUrls:{},gTitles:{},gDimensions:{},gListLevel:0,hashLinkCounts:{},langExtensions:d,outputModifiers:h,converter:this,ghCodeBlocks:[],metadata:{parsed:{},raw:"",format:""}};return e=(e=(e=(e=(e=e.replace(/¨/g,"¨T")).replace(/\$/g,"¨D")).replace(/\r\n/g,"\n")).replace(/\r/g,"\n")).replace(/\u00A0/g," "),o.smartIndentationFix&&(e=function(e){var t=e.match(/^\s*/)[0].length,r=new RegExp("^\\s{0,"+t+"}","gm");return e.replace(r,"")}(e)),e="\n\n"+e+"\n\n",e=(e=i.subParser("detab")(e,o,t)).replace(/^[ \t]+$/gm,""),i.helper.forEach(d,function(r){e=i.subParser("runExtension")(r,e,o,t)}),e=i.subParser("metadata")(e,o,t),e=i.subParser("hashPreCodeTags")(e,o,t),e=i.subParser("githubCodeBlocks")(e,o,t),e=i.subParser("hashHTMLBlocks")(e,o,t),e=i.subParser("hashCodeTags")(e,o,t),e=i.subParser("stripLinkDefinitions")(e,o,t),e=i.subParser("blockGamut")(e,o,t),e=i.subParser("unhashHTMLSpans")(e,o,t),e=(e=(e=i.subParser("unescapeSpecialChars")(e,o,t)).replace(/¨D/g,"$$")).replace(/¨T/g,"¨"),e=i.subParser("completeHTMLDocument")(e,o,t),i.helper.forEach(h,function(r){e=i.subParser("runExtension")(r,e,o,t)}),g=t.metadata,e},this.makeMarkdown=this.makeMd=function(e,t){if(e=(e=(e=e.replace(/\r\n/g,"\n")).replace(/\r/g,"\n")).replace(/>[ \t]+</,">¨NBSP;<"),!t){if(!window||!window.document)throw new Error("HTMLParser is undefined. If in a webworker or nodejs environment, you need to provide a WHATWG DOM and HTML such as JSDOM");t=window.document}var r=t.createElement("div");r.innerHTML=e;var n={preList:function(e){for(var t=e.querySelectorAll("pre"),r=[],n=0;n<t.length;++n)if(1===t[n].childElementCount&&"code"===t[n].firstChild.tagName.toLowerCase()){var a=t[n].firstChild.innerHTML.trim(),o=t[n].firstChild.getAttribute("data-language")||"";if(""===o)for(var s=t[n].firstChild.className.split(" "),l=0;l<s.length;++l){var c=s[l].match(/^language-(.+)$/);if(null!==c){o=c[1];break}}a=i.helper.unescapeHTMLEntities(a),r.push(a),t[n].outerHTML='<precode language="'+o+'" precodenum="'+n.toString()+'"></precode>'}else r.push(t[n].innerHTML),t[n].innerHTML="",t[n].setAttribute("prenum",n.toString());return r}(r)};!function e(t){for(var r=0;r<t.childNodes.length;++r){var n=t.childNodes[r];3===n.nodeType?/\S/.test(n.nodeValue)?(n.nodeValue=n.nodeValue.split("\n").join(" "),n.nodeValue=n.nodeValue.replace(/(\s)+/g,"$1")):(t.removeChild(n),--r):1===n.nodeType&&e(n)}}(r);for(var a=r.childNodes,o="",s=0;s<a.length;s++)o+=i.subParser("makeMarkdown.node")(a[s],n);return o},this.setOption=function(e,t){o[e]=t},this.getOption=function(e){return o[e]},this.getOptions=function(){return o},this.addExtension=function(e,r){t(e,r=r||null)},this.useExtension=function(e){t(e)},this.setFlavor=function(e){if(!u.hasOwnProperty(e))throw Error(e+" flavor was not found");var t=u[e];for(var r in p=e,t)t.hasOwnProperty(r)&&(o[r]=t[r])},this.getFlavor=function(){return p},this.removeExtension=function(e){i.helper.isArray(e)||(e=[e]);for(var t=0;t<e.length;++t){for(var r=e[t],n=0;n<d.length;++n)d[n]===r&&d[n].splice(n,1);for(;0<h.length;++n)h[0]===r&&h[0].splice(n,1)}},this.getAllExtensions=function(){return{language:d,output:h}},this.getMetadata=function(e){return e?g.raw:g.parsed},this.getMetadataFormat=function(){return g.format},this._setMetadataPair=function(e,t){g.parsed[e]=t},this._setMetadataFormat=function(e){g.format=e},this._setMetadataRaw=function(e){g.raw=e}},i.subParser("anchors",function(e,t,r){var n=function(e,n,a,o,s,l,c){if(i.helper.isUndefined(c)&&(c=""),a=a.toLowerCase(),e.search(/\(<?\s*>? ?(['"].*['"])?\)$/m)>-1)o="";else if(!o){if(a||(a=n.toLowerCase().replace(/ ?\n/g," ")),o="#"+a,i.helper.isUndefined(r.gUrls[a]))return e;o=r.gUrls[a],i.helper.isUndefined(r.gTitles[a])||(c=r.gTitles[a])}var u='<a href="'+(o=o.replace(i.helper.regexes.asteriskDashAndColon,i.helper.escapeCharactersCallback))+'"';return""!==c&&null!==c&&(u+=' title="'+(c=(c=c.replace(/"/g,""")).replace(i.helper.regexes.asteriskDashAndColon,i.helper.escapeCharactersCallback))+'"'),t.openLinksInNewWindow&&!/^#/.test(o)&&(u+=' target="¨E95Eblank"'),u+">"+n+"</a>"};return e=(e=(e=(e=(e=r.converter._dispatch("anchors.before",e,t,r)).replace(/\[((?:\[[^\]]*]|[^\[\]])*)] ?(?:\n *)?\[(.*?)]()()()()/g,n)).replace(/\[((?:\[[^\]]*]|[^\[\]])*)]()[ \t]*\([ \t]?<([^>]*)>(?:[ \t]*((["'])([^"]*?)\5))?[ \t]?\)/g,n)).replace(/\[((?:\[[^\]]*]|[^\[\]])*)]()[ \t]*\([ \t]?<?([\S]+?(?:\([\S]*?\)[\S]*?)?)>?(?:[ \t]*((["'])([^"]*?)\5))?[ \t]?\)/g,n)).replace(/\[([^\[\]]+)]()()()()()/g,n),t.ghMentions&&(e=e.replace(/(^|\s)(\\)?(@([a-z\d]+(?:[a-z\d.-]+?[a-z\d]+)*))/gim,function(e,r,n,a,o){if("\\"===n)return r+a;if(!i.helper.isString(t.ghMentionsLink))throw new Error("ghMentionsLink option must be a string");var s=t.ghMentionsLink.replace(/\{u}/g,o),l="";return t.openLinksInNewWindow&&(l=' target="¨E95Eblank"'),r+'<a href="'+s+'"'+l+">"+a+"</a>"})),r.converter._dispatch("anchors.after",e,t,r)});var h=/([*~_]+|\b)(((https?|ftp|dict):\/\/|www\.)[^'">\s]+?\.[^'">\s]+?)()(\1)?(?=\s|$)(?!["<>])/gi,f=/([*~_]+|\b)(((https?|ftp|dict):\/\/|www\.)[^'">\s]+\.[^'">\s]+?)([.!?,()\[\]])?(\1)?(?=\s|$)(?!["<>])/gi,p=/()<(((https?|ftp|dict):\/\/|www\.)[^'">\s]+)()>()/gi,g=/(^|\s)(?:mailto:)?([A-Za-z0-9!#$%&'*+-/=?^_`{|}~.]+@[-a-z0-9]+(\.[-a-z0-9]+)*\.[a-z]+)(?=$|\s)/gim,m=/<()(?:mailto:)?([-.\w]+@[-a-z0-9]+(\.[-a-z0-9]+)*\.[a-z]+)>/gi,_=function(e){return function(t,r,n,a,o,s,l){var c=n=n.replace(i.helper.regexes.asteriskDashAndColon,i.helper.escapeCharactersCallback),u="",d="",h=r||"",f=l||"";return/^www\./i.test(n)&&(n=n.replace(/^www\./i,"http://www.")),e.excludeTrailingPunctuationFromURLs&&s&&(u=s),e.openLinksInNewWindow&&(d=' target="¨E95Eblank"'),h+'<a href="'+n+'"'+d+">"+c+"</a>"+u+f}},b=function(e,t){return function(r,n,a){var o="mailto:";return n=n||"",a=i.subParser("unescapeSpecialChars")(a,e,t),e.encodeEmails?(o=i.helper.encodeEmailAddress(o+a),a=i.helper.encodeEmailAddress(a)):o+=a,n+'<a href="'+o+'">'+a+"</a>"}};i.subParser("autoLinks",function(e,t,r){return e=(e=(e=r.converter._dispatch("autoLinks.before",e,t,r)).replace(p,_(t))).replace(m,b(t,r)),r.converter._dispatch("autoLinks.after",e,t,r)}),i.subParser("simplifiedAutoLinks",function(e,t,r){return t.simplifiedAutoLink?(e=r.converter._dispatch("simplifiedAutoLinks.before",e,t,r),e=(e=t.excludeTrailingPunctuationFromURLs?e.replace(f,_(t)):e.replace(h,_(t))).replace(g,b(t,r)),e=r.converter._dispatch("simplifiedAutoLinks.after",e,t,r)):e}),i.subParser("blockGamut",function(e,t,r){return e=r.converter._dispatch("blockGamut.before",e,t,r),e=i.subParser("blockQuotes")(e,t,r),e=i.subParser("headers")(e,t,r),e=i.subParser("horizontalRule")(e,t,r),e=i.subParser("lists")(e,t,r),e=i.subParser("codeBlocks")(e,t,r),e=i.subParser("tables")(e,t,r),e=i.subParser("hashHTMLBlocks")(e,t,r),e=i.subParser("paragraphs")(e,t,r),r.converter._dispatch("blockGamut.after",e,t,r)}),i.subParser("blockQuotes",function(e,t,r){e=r.converter._dispatch("blockQuotes.before",e,t,r),e+="\n\n";var n=/(^ {0,3}>[ \t]?.+\n(.+\n)*\n*)+/gm;return t.splitAdjacentBlockquotes&&(n=/^ {0,3}>[\s\S]*?(?:\n\n)/gm),e=e.replace(n,function(e){return e=(e=(e=e.replace(/^[ \t]*>[ \t]?/gm,"")).replace(/¨0/g,"")).replace(/^[ \t]+$/gm,""),e=i.subParser("githubCodeBlocks")(e,t,r),e=(e=(e=i.subParser("blockGamut")(e,t,r)).replace(/(^|\n)/g,"$1 ")).replace(/(\s*<pre>[^\r]+?<\/pre>)/gm,function(e,t){var r=t;return(r=r.replace(/^ /gm,"¨0")).replace(/¨0/g,"")}),i.subParser("hashBlock")("<blockquote>\n"+e+"\n</blockquote>",t,r)}),r.converter._dispatch("blockQuotes.after",e,t,r)}),i.subParser("codeBlocks",function(e,t,r){return e=r.converter._dispatch("codeBlocks.before",e,t,r),e=(e=(e+="¨0").replace(/(?:\n\n|^)((?:(?:[ ]{4}|\t).*\n+)+)(\n*[ ]{0,3}[^ \t\n]|(?=¨0))/g,function(e,n,a){var o=n,s=a,l="\n";return o=i.subParser("outdent")(o,t,r),o=i.subParser("encodeCode")(o,t,r),o=(o=(o=i.subParser("detab")(o,t,r)).replace(/^\n+/g,"")).replace(/\n+$/g,""),t.omitExtraWLInCodeBlocks&&(l=""),o="<pre><code>"+o+l+"</code></pre>",i.subParser("hashBlock")(o,t,r)+s})).replace(/¨0/,""),r.converter._dispatch("codeBlocks.after",e,t,r)}),i.subParser("codeSpans",function(e,t,r){return void 0===(e=r.converter._dispatch("codeSpans.before",e,t,r))&&(e=""),e=e.replace(/(^|[^\\])(`+)([^\r]*?[^`])\2(?!`)/gm,function(e,n,a,o){var s=o;return s=(s=s.replace(/^([ \t]*)/g,"")).replace(/[ \t]*$/g,""),s=n+"<code>"+(s=i.subParser("encodeCode")(s,t,r))+"</code>",i.subParser("hashHTMLSpans")(s,t,r)}),r.converter._dispatch("codeSpans.after",e,t,r)}),i.subParser("completeHTMLDocument",function(e,t,r){if(!t.completeHTMLDocument)return e;e=r.converter._dispatch("completeHTMLDocument.before",e,t,r);var n="html",a="<!DOCTYPE HTML>\n",i="",o='<meta charset="utf-8">\n',s="",l="";for(var c in void 0!==r.metadata.parsed.doctype&&(a="<!DOCTYPE "+r.metadata.parsed.doctype+">\n","html"!==(n=r.metadata.parsed.doctype.toString().toLowerCase())&&"html5"!==n||(o='<meta charset="utf-8">')),r.metadata.parsed)if(r.metadata.parsed.hasOwnProperty(c))switch(c.toLowerCase()){case"doctype":break;case"title":i="<title>"+r.metadata.parsed.title+"\n";break;case"charset":o="html"===n||"html5"===n?'\n':'\n';break;case"language":case"lang":s=' lang="'+r.metadata.parsed[c]+'"',l+='\n';break;default:l+='\n'}return e=a+"\n\n"+i+o+l+"\n\n"+e.trim()+"\n\n",r.converter._dispatch("completeHTMLDocument.after",e,t,r)}),i.subParser("detab",function(e,t,r){return e=(e=(e=(e=(e=(e=r.converter._dispatch("detab.before",e,t,r)).replace(/\t(?=\t)/g," ")).replace(/\t/g,"¨A¨B")).replace(/¨B(.+?)¨A/g,function(e,t){for(var r=t,n=4-r.length%4,a=0;a/g,">"),r.converter._dispatch("encodeAmpsAndAngles.after",e,t,r)}),i.subParser("encodeBackslashEscapes",function(e,t,r){return e=(e=(e=r.converter._dispatch("encodeBackslashEscapes.before",e,t,r)).replace(/\\(\\)/g,i.helper.escapeCharactersCallback)).replace(/\\([`*_{}\[\]()>#+.!~=|-])/g,i.helper.escapeCharactersCallback),r.converter._dispatch("encodeBackslashEscapes.after",e,t,r)}),i.subParser("encodeCode",function(e,t,r){return e=(e=r.converter._dispatch("encodeCode.before",e,t,r)).replace(/&/g,"&").replace(//g,">").replace(/([*_{}\[\]\\=~-])/g,i.helper.escapeCharactersCallback),r.converter._dispatch("encodeCode.after",e,t,r)}),i.subParser("escapeSpecialCharsWithinTagAttributes",function(e,t,r){return e=(e=(e=r.converter._dispatch("escapeSpecialCharsWithinTagAttributes.before",e,t,r)).replace(/<\/?[a-z\d_:-]+(?:[\s]+[\s\S]+?)?>/gi,function(e){return e.replace(/(.)<\/?code>(?=.)/g,"$1`").replace(/([\\`*_~=|])/g,i.helper.escapeCharactersCallback)})).replace(/-]|-[^>])(?:[^-]|-[^-])*)--)>/gi,function(e){return e.replace(/([\\`*_~=|])/g,i.helper.escapeCharactersCallback)}),r.converter._dispatch("escapeSpecialCharsWithinTagAttributes.after",e,t,r)}),i.subParser("githubCodeBlocks",function(e,t,r){return t.ghCodeBlocks?(e=r.converter._dispatch("githubCodeBlocks.before",e,t,r),e=(e=(e+="¨0").replace(/(?:^|\n)(?: {0,3})(```+|~~~+)(?: *)([^\s`~]*)\n([\s\S]*?)\n(?: {0,3})\1/g,function(e,n,a,o){var s=t.omitExtraWLInCodeBlocks?"":"\n";return o=i.subParser("encodeCode")(o,t,r),o=(o=(o=i.subParser("detab")(o,t,r)).replace(/^\n+/g,"")).replace(/\n+$/g,""),o="
"+o+s+"
",o=i.subParser("hashBlock")(o,t,r),"\n\n¨G"+(r.ghCodeBlocks.push({text:e,codeblock:o})-1)+"G\n\n"})).replace(/¨0/,""),r.converter._dispatch("githubCodeBlocks.after",e,t,r)):e}),i.subParser("hashBlock",function(e,t,r){return e=(e=r.converter._dispatch("hashBlock.before",e,t,r)).replace(/(^\n+|\n+$)/g,""),e="\n\n¨K"+(r.gHtmlBlocks.push(e)-1)+"K\n\n",r.converter._dispatch("hashBlock.after",e,t,r)}),i.subParser("hashCodeTags",function(e,t,r){return e=r.converter._dispatch("hashCodeTags.before",e,t,r),e=i.helper.replaceRecursiveRegExp(e,function(e,n,a,o){var s=a+i.subParser("encodeCode")(n,t,r)+o;return"¨C"+(r.gHtmlSpans.push(s)-1)+"C"},"]*>","","gim"),r.converter._dispatch("hashCodeTags.after",e,t,r)}),i.subParser("hashElement",function(e,t,r){return function(e,t){var n=t;return n=(n=(n=n.replace(/\n\n/g,"\n")).replace(/^\n/,"")).replace(/\n+$/g,""),"\n\n¨K"+(r.gHtmlBlocks.push(n)-1)+"K\n\n"}}),i.subParser("hashHTMLBlocks",function(e,t,r){e=r.converter._dispatch("hashHTMLBlocks.before",e,t,r);var n=["pre","div","h1","h2","h3","h4","h5","h6","blockquote","table","dl","ol","ul","script","noscript","form","fieldset","iframe","math","style","section","header","footer","nav","article","aside","address","audio","canvas","figure","hgroup","output","video","p"],a=function(e,t,n,a){var i=e;return-1!==n.search(/\bmarkdown\b/)&&(i=n+r.converter.makeHtml(t)+a),"\n\n¨K"+(r.gHtmlBlocks.push(i)-1)+"K\n\n"};t.backslashEscapesHTMLTags&&(e=e.replace(/\\<(\/?[^>]+?)>/g,function(e,t){return"<"+t+">"}));for(var o=0;o]*>)","im"),c="<"+n[o]+"\\b[^>]*>",u="";-1!==(s=i.helper.regexIndexOf(e,l));){var d=i.helper.splitAtIndex(e,s),h=i.helper.replaceRecursiveRegExp(d[1],a,c,u,"im");if(h===d[1])break;e=d[0].concat(h)}return e=e.replace(/(\n {0,3}(<(hr)\b([^<>])*?\/?>)[ \t]*(?=\n{2,}))/g,i.subParser("hashElement")(e,t,r)),e=(e=i.helper.replaceRecursiveRegExp(e,function(e){return"\n\n¨K"+(r.gHtmlBlocks.push(e)-1)+"K\n\n"},"^ {0,3}\x3c!--","--\x3e","gm")).replace(/(?:\n\n)( {0,3}(?:<([?%])[^\r]*?\2>)[ \t]*(?=\n{2,}))/g,i.subParser("hashElement")(e,t,r)),r.converter._dispatch("hashHTMLBlocks.after",e,t,r)}),i.subParser("hashHTMLSpans",function(e,t,r){function n(e){return"¨C"+(r.gHtmlSpans.push(e)-1)+"C"}return e=(e=(e=(e=(e=r.converter._dispatch("hashHTMLSpans.before",e,t,r)).replace(/<[^>]+?\/>/gi,function(e){return n(e)})).replace(/<([^>]+?)>[\s\S]*?<\/\1>/g,function(e){return n(e)})).replace(/<([^>]+?)\s[^>]+?>[\s\S]*?<\/\1>/g,function(e){return n(e)})).replace(/<[^>]+?>/gi,function(e){return n(e)}),r.converter._dispatch("hashHTMLSpans.after",e,t,r)}),i.subParser("unhashHTMLSpans",function(e,t,r){e=r.converter._dispatch("unhashHTMLSpans.before",e,t,r);for(var n=0;n]*>\\s*]*>","^ {0,3}\\s*","gim"),r.converter._dispatch("hashPreCodeTags.after",e,t,r)}),i.subParser("headers",function(e,t,r){function n(e){var n,a;if(t.customizedHeaderId){var o=e.match(/\{([^{]+?)}\s*$/);o&&o[1]&&(e=o[1])}return n=e,a=i.helper.isString(t.prefixHeaderId)?t.prefixHeaderId:!0===t.prefixHeaderId?"section-":"",t.rawPrefixHeaderId||(n=a+n),n=t.ghCompatibleHeaderId?n.replace(/ /g,"-").replace(/&/g,"").replace(/¨T/g,"").replace(/¨D/g,"").replace(/[&+$,\/:;=?@"#{}|^¨~\[\]`\\*)(%.!'<>]/g,"").toLowerCase():t.rawHeaderId?n.replace(/ /g,"-").replace(/&/g,"&").replace(/¨T/g,"¨").replace(/¨D/g,"$").replace(/["']/g,"-").toLowerCase():n.replace(/[^\w]/g,"").toLowerCase(),t.rawPrefixHeaderId&&(n=a+n),r.hashLinkCounts[n]?n=n+"-"+r.hashLinkCounts[n]++:r.hashLinkCounts[n]=1,n}e=r.converter._dispatch("headers.before",e,t,r);var a=isNaN(parseInt(t.headerLevelStart))?1:parseInt(t.headerLevelStart),o=t.smoothLivePreview?/^(.+)[ \t]*\n={2,}[ \t]*\n+/gm:/^(.+)[ \t]*\n=+[ \t]*\n+/gm,s=t.smoothLivePreview?/^(.+)[ \t]*\n-{2,}[ \t]*\n+/gm:/^(.+)[ \t]*\n-+[ \t]*\n+/gm;e=(e=e.replace(o,function(e,o){var s=i.subParser("spanGamut")(o,t,r),l=t.noHeaderId?"":' id="'+n(o)+'"',c=""+s+"";return i.subParser("hashBlock")(c,t,r)})).replace(s,function(e,o){var s=i.subParser("spanGamut")(o,t,r),l=t.noHeaderId?"":' id="'+n(o)+'"',c=a+1,u=""+s+"";return i.subParser("hashBlock")(u,t,r)});var l=t.requireSpaceBeforeHeadingText?/^(#{1,6})[ \t]+(.+?)[ \t]*#*\n+/gm:/^(#{1,6})[ \t]*(.+?)[ \t]*#*\n+/gm;return e=e.replace(l,function(e,o,s){var l=s;t.customizedHeaderId&&(l=s.replace(/\s?\{([^{]+?)}\s*$/,""));var c=i.subParser("spanGamut")(l,t,r),u=t.noHeaderId?"":' id="'+n(s)+'"',d=a-1+o.length,h=""+c+"";return i.subParser("hashBlock")(h,t,r)}),r.converter._dispatch("headers.after",e,t,r)}),i.subParser("horizontalRule",function(e,t,r){e=r.converter._dispatch("horizontalRule.before",e,t,r);var n=i.subParser("hashBlock")("
",t,r);return e=(e=(e=e.replace(/^ {0,2}( ?-){3,}[ \t]*$/gm,n)).replace(/^ {0,2}( ?\*){3,}[ \t]*$/gm,n)).replace(/^ {0,2}( ?_){3,}[ \t]*$/gm,n),r.converter._dispatch("horizontalRule.after",e,t,r)}),i.subParser("images",function(e,t,r){function n(e,t,n,a,o,s,l,c){var u=r.gUrls,d=r.gTitles,h=r.gDimensions;if(n=n.toLowerCase(),c||(c=""),e.search(/\(? ?(['"].*['"])?\)$/m)>-1)a="";else if(""===a||null===a){if(""!==n&&null!==n||(n=t.toLowerCase().replace(/ ?\n/g," ")),a="#"+n,i.helper.isUndefined(u[n]))return e;a=u[n],i.helper.isUndefined(d[n])||(c=d[n]),i.helper.isUndefined(h[n])||(o=h[n].width,s=h[n].height)}t=t.replace(/"/g,""").replace(i.helper.regexes.asteriskDashAndColon,i.helper.escapeCharactersCallback);var f=''+t+'"}return e=(e=(e=(e=(e=(e=r.converter._dispatch("images.before",e,t,r)).replace(/!\[([^\]]*?)] ?(?:\n *)?\[([\s\S]*?)]()()()()()/g,n)).replace(/!\[([^\]]*?)][ \t]*()\([ \t]??(?: =([*\d]+[A-Za-z%]{0,4})x([*\d]+[A-Za-z%]{0,4}))?[ \t]*(?:(["'])([^"]*?)\6)?[ \t]?\)/g,function(e,t,r,a,i,o,s,l){return n(e,t,r,a=a.replace(/\s/g,""),i,o,0,l)})).replace(/!\[([^\]]*?)][ \t]*()\([ \t]?<([^>]*)>(?: =([*\d]+[A-Za-z%]{0,4})x([*\d]+[A-Za-z%]{0,4}))?[ \t]*(?:(?:(["'])([^"]*?)\6))?[ \t]?\)/g,n)).replace(/!\[([^\]]*?)][ \t]*()\([ \t]??(?: =([*\d]+[A-Za-z%]{0,4})x([*\d]+[A-Za-z%]{0,4}))?[ \t]*(?:(["'])([^"]*?)\6)?[ \t]?\)/g,n)).replace(/!\[([^\[\]]+)]()()()()()/g,n),r.converter._dispatch("images.after",e,t,r)}),i.subParser("italicsAndBold",function(e,t,r){function n(e,t,r){return t+e+r}return e=r.converter._dispatch("italicsAndBold.before",e,t,r),e=t.literalMidWordUnderscores?(e=(e=e.replace(/\b___(\S[\s\S]*?)___\b/g,function(e,t){return n(t,"","")})).replace(/\b__(\S[\s\S]*?)__\b/g,function(e,t){return n(t,"","")})).replace(/\b_(\S[\s\S]*?)_\b/g,function(e,t){return n(t,"","")}):(e=(e=e.replace(/___(\S[\s\S]*?)___/g,function(e,t){return/\S$/.test(t)?n(t,"",""):e})).replace(/__(\S[\s\S]*?)__/g,function(e,t){return/\S$/.test(t)?n(t,"",""):e})).replace(/_([^\s_][\s\S]*?)_/g,function(e,t){return/\S$/.test(t)?n(t,"",""):e}),e=t.literalMidWordAsterisks?(e=(e=e.replace(/([^*]|^)\B\*\*\*(\S[\s\S]*?)\*\*\*\B(?!\*)/g,function(e,t,r){return n(r,t+"","")})).replace(/([^*]|^)\B\*\*(\S[\s\S]*?)\*\*\B(?!\*)/g,function(e,t,r){return n(r,t+"","")})).replace(/([^*]|^)\B\*(\S[\s\S]*?)\*\B(?!\*)/g,function(e,t,r){return n(r,t+"","")}):(e=(e=e.replace(/\*\*\*(\S[\s\S]*?)\*\*\*/g,function(e,t){return/\S$/.test(t)?n(t,"",""):e})).replace(/\*\*(\S[\s\S]*?)\*\*/g,function(e,t){return/\S$/.test(t)?n(t,"",""):e})).replace(/\*([^\s*][\s\S]*?)\*/g,function(e,t){return/\S$/.test(t)?n(t,"",""):e}),r.converter._dispatch("italicsAndBold.after",e,t,r)}),i.subParser("lists",function(e,t,r){function n(e,n){r.gListLevel++,e=e.replace(/\n{2,}$/,"\n");var a=/(\n)?(^ {0,3})([*+-]|\d+[.])[ \t]+((\[(x|X| )?])?[ \t]*[^\r]+?(\n{1,2}))(?=\n*(¨0| {0,3}([*+-]|\d+[.])[ \t]+))/gm,o=/\n[ \t]*\n(?!¨0)/.test(e+="¨0");return t.disableForced4SpacesIndentedSublists&&(a=/(\n)?(^ {0,3})([*+-]|\d+[.])[ \t]+((\[(x|X| )?])?[ \t]*[^\r]+?(\n{1,2}))(?=\n*(¨0|\2([*+-]|\d+[.])[ \t]+))/gm),e=(e=e.replace(a,function(e,n,a,s,l,c,u){u=u&&""!==u.trim();var d=i.subParser("outdent")(l,t,r),h="";return c&&t.tasklists&&(h=' class="task-list-item" style="list-style-type: none;"',d=d.replace(/^[ \t]*\[(x|X| )?]/m,function(){var e='"})),d=d.replace(/^([-*+]|\d\.)[ \t]+[\S\n ]*/g,function(e){return"¨A"+e}),n||d.search(/\n{2,}/)>-1?(d=i.subParser("githubCodeBlocks")(d,t,r),d=i.subParser("blockGamut")(d,t,r)):(d=(d=i.subParser("lists")(d,t,r)).replace(/\n$/,""),d=(d=i.subParser("hashHTMLBlocks")(d,t,r)).replace(/\n\n+/g,"\n\n"),d=o?i.subParser("paragraphs")(d,t,r):i.subParser("spanGamut")(d,t,r)),""+(d=d.replace("¨A",""))+"\n"})).replace(/¨0/g,""),r.gListLevel--,n&&(e=e.replace(/\s+$/,"")),e}function a(e,t){if("ol"===t){var r=e.match(/^ *(\d+)\./);if(r&&"1"!==r[1])return' start="'+r[1]+'"'}return""}function o(e,r,i){var o=t.disableForced4SpacesIndentedSublists?/^ ?\d+\.[ \t]/gm:/^ {0,3}\d+\.[ \t]/gm,s=t.disableForced4SpacesIndentedSublists?/^ ?[*+-][ \t]/gm:/^ {0,3}[*+-][ \t]/gm,l="ul"===r?o:s,c="";if(-1!==e.search(l))!function t(u){var d=u.search(l),h=a(e,r);-1!==d?(c+="\n\n<"+r+h+">\n"+n(u.slice(0,d),!!i)+"\n",l="ul"==(r="ul"===r?"ol":"ul")?o:s,t(u.slice(d))):c+="\n\n<"+r+h+">\n"+n(u,!!i)+"\n"}(e);else{var u=a(e,r);c="\n\n<"+r+u+">\n"+n(e,!!i)+"\n"}return c}return e=r.converter._dispatch("lists.before",e,t,r),e+="¨0",e=(e=r.gListLevel?e.replace(/^(( {0,3}([*+-]|\d+[.])[ \t]+)[^\r]+?(¨0|\n{2,}(?=\S)(?![ \t]*(?:[*+-]|\d+[.])[ \t]+)))/gm,function(e,t,r){return o(t,r.search(/[*+-]/g)>-1?"ul":"ol",!0)}):e.replace(/(\n\n|^\n?)(( {0,3}([*+-]|\d+[.])[ \t]+)[^\r]+?(¨0|\n{2,}(?=\S)(?![ \t]*(?:[*+-]|\d+[.])[ \t]+)))/gm,function(e,t,r,n){return o(r,n.search(/[*+-]/g)>-1?"ul":"ol",!1)})).replace(/¨0/,""),r.converter._dispatch("lists.after",e,t,r)}),i.subParser("metadata",function(e,t,r){function n(e){r.metadata.raw=e,(e=(e=e.replace(/&/g,"&").replace(/"/g,""")).replace(/\n {4}/g," ")).replace(/^([\S ]+): +([\s\S]+?)$/gm,function(e,t,n){return r.metadata.parsed[t]=n,""})}return t.metadata?(e=(e=(e=(e=r.converter._dispatch("metadata.before",e,t,r)).replace(/^\s*«««+(\S*?)\n([\s\S]+?)\n»»»+\n/,function(e,t,r){return n(r),"¨M"})).replace(/^\s*---+(\S*?)\n([\s\S]+?)\n---+\n/,function(e,t,a){return t&&(r.metadata.format=t),n(a),"¨M"})).replace(/¨M/g,""),e=r.converter._dispatch("metadata.after",e,t,r)):e}),i.subParser("outdent",function(e,t,r){return e=(e=(e=r.converter._dispatch("outdent.before",e,t,r)).replace(/^(\t|[ ]{1,4})/gm,"¨0")).replace(/¨0/g,""),r.converter._dispatch("outdent.after",e,t,r)}),i.subParser("paragraphs",function(e,t,r){for(var n=(e=(e=(e=r.converter._dispatch("paragraphs.before",e,t,r)).replace(/^\n+/g,"")).replace(/\n+$/g,"")).split(/\n{2,}/g),a=[],o=n.length,s=0;s=0?a.push(l):l.search(/\S/)>=0&&(l=(l=i.subParser("spanGamut")(l,t,r)).replace(/^([ \t]*)/g,"

"),l+="

",a.push(l))}for(o=a.length,s=0;s]*>\s*]*>/.test(u)&&(d=!0)}a[s]=u}return e=(e=(e=a.join("\n")).replace(/^\n+/g,"")).replace(/\n+$/g,""),r.converter._dispatch("paragraphs.after",e,t,r)}),i.subParser("runExtension",function(e,t,r,n){if(e.filter)t=e.filter(t,n.converter,r);else if(e.regex){var a=e.regex;a instanceof RegExp||(a=new RegExp(a,"g")),t=t.replace(a,e.replace)}return t}),i.subParser("spanGamut",function(e,t,r){return e=r.converter._dispatch("spanGamut.before",e,t,r),e=i.subParser("codeSpans")(e,t,r),e=i.subParser("escapeSpecialCharsWithinTagAttributes")(e,t,r),e=i.subParser("encodeBackslashEscapes")(e,t,r),e=i.subParser("images")(e,t,r),e=i.subParser("anchors")(e,t,r),e=i.subParser("autoLinks")(e,t,r),e=i.subParser("simplifiedAutoLinks")(e,t,r),e=i.subParser("emoji")(e,t,r),e=i.subParser("underline")(e,t,r),e=i.subParser("italicsAndBold")(e,t,r),e=i.subParser("strikethrough")(e,t,r),e=i.subParser("ellipsis")(e,t,r),e=i.subParser("hashHTMLSpans")(e,t,r),e=i.subParser("encodeAmpsAndAngles")(e,t,r),t.simpleLineBreaks?/\n\n¨K/.test(e)||(e=e.replace(/\n+/g,"
\n")):e=e.replace(/ +\n/g,"
\n"),r.converter._dispatch("spanGamut.after",e,t,r)}),i.subParser("strikethrough",function(e,t,r){return t.strikethrough&&(e=(e=r.converter._dispatch("strikethrough.before",e,t,r)).replace(/(?:~){2}([\s\S]+?)(?:~){2}/g,function(e,n){return function(e){return t.simplifiedAutoLink&&(e=i.subParser("simplifiedAutoLinks")(e,t,r)),""+e+""}(n)}),e=r.converter._dispatch("strikethrough.after",e,t,r)),e}),i.subParser("stripLinkDefinitions",function(e,t,r){var n=function(e,n,a,o,s,l,c){return n=n.toLowerCase(),a.match(/^data:.+?\/.+?;base64,/)?r.gUrls[n]=a.replace(/\s/g,""):r.gUrls[n]=i.subParser("encodeAmpsAndAngles")(a,t,r),l?l+c:(c&&(r.gTitles[n]=c.replace(/"|'/g,""")),t.parseImgDimensions&&o&&s&&(r.gDimensions[n]={width:o,height:s}),"")};return(e=(e=(e+="¨0").replace(/^ {0,3}\[(.+)]:[ \t]*\n?[ \t]*?(?: =([*\d]+[A-Za-z%]{0,4})x([*\d]+[A-Za-z%]{0,4}))?[ \t]*\n?[ \t]*(?:(\n*)["|'(](.+?)["|')][ \t]*)?(?:\n\n|(?=¨0)|(?=\n\[))/gm,n)).replace(/^ {0,3}\[(.+)]:[ \t]*\n?[ \t]*\s]+)>?(?: =([*\d]+[A-Za-z%]{0,4})x([*\d]+[A-Za-z%]{0,4}))?[ \t]*\n?[ \t]*(?:(\n*)["|'(](.+?)["|')][ \t]*)?(?:\n+|(?=¨0))/gm,n)).replace(/¨0/,"")}),i.subParser("tables",function(e,t,r){function n(e){return/^:[ \t]*--*$/.test(e)?' style="text-align:left;"':/^--*[ \t]*:[ \t]*$/.test(e)?' style="text-align:right;"':/^:[ \t]*--*[ \t]*:$/.test(e)?' style="text-align:center;"':""}function a(e,n){var a="";return e=e.trim(),(t.tablesHeaderId||t.tableHeaderId)&&(a=' id="'+e.replace(/ /g,"_").toLowerCase()+'"'),""+(e=i.subParser("spanGamut")(e,t,r))+"\n"}function o(e,n){return""+i.subParser("spanGamut")(e,t,r)+"\n"}function s(e){var s,l=e.split("\n");for(s=0;s\n\n\n",a=0;a\n";for(var i=0;i\n"}return r+"\n\n"}(h,p)}return t.tables?(e=(e=(e=(e=r.converter._dispatch("tables.before",e,t,r)).replace(/\\(\|)/g,i.helper.escapeCharactersCallback)).replace(/^ {0,3}\|?.+\|.+\n {0,3}\|?[ \t]*:?[ \t]*(?:[-=]){2,}[ \t]*:?[ \t]*\|[ \t]*:?[ \t]*(?:[-=]){2,}[\s\S]+?(?:\n\n|¨0)/gm,s)).replace(/^ {0,3}\|.+\|[ \t]*\n {0,3}\|[ \t]*:?[ \t]*(?:[-=]){2,}[ \t]*:?[ \t]*\|[ \t]*\n( {0,3}\|.+\|[ \t]*\n)*(?:\n|¨0)/gm,s),r.converter._dispatch("tables.after",e,t,r)):e}),i.subParser("underline",function(e,t,r){return t.underline?(e=r.converter._dispatch("underline.before",e,t,r),e=(e=t.literalMidWordUnderscores?(e=e.replace(/\b___(\S[\s\S]*?)___\b/g,function(e,t){return""+t+""})).replace(/\b__(\S[\s\S]*?)__\b/g,function(e,t){return""+t+""}):(e=e.replace(/___(\S[\s\S]*?)___/g,function(e,t){return/\S$/.test(t)?""+t+"":e})).replace(/__(\S[\s\S]*?)__/g,function(e,t){return/\S$/.test(t)?""+t+"":e})).replace(/(_)/g,i.helper.escapeCharactersCallback),e=r.converter._dispatch("underline.after",e,t,r)):e}),i.subParser("unescapeSpecialChars",function(e,t,r){return e=(e=r.converter._dispatch("unescapeSpecialChars.before",e,t,r)).replace(/¨E(\d+)E/g,function(e,t){var r=parseInt(t);return String.fromCharCode(r)}),r.converter._dispatch("unescapeSpecialChars.after",e,t,r)}),i.subParser("makeMarkdown.blockquote",function(e,t){var r="";if(e.hasChildNodes())for(var n=e.childNodes,a=n.length,o=0;o "+(r=r.trim()).split("\n").join("\n> ")}),i.subParser("makeMarkdown.codeBlock",function(e,t){var r=e.getAttribute("language"),n=e.getAttribute("precodenum");return"```"+r+"\n"+t.preList[n]+"\n```"}),i.subParser("makeMarkdown.codeSpan",function(e){return"`"+e.innerHTML+"`"}),i.subParser("makeMarkdown.emphasis",function(e,t){var r="";if(e.hasChildNodes()){r+="*";for(var n=e.childNodes,a=n.length,o=0;o",e.hasAttribute("width")&&e.hasAttribute("height")&&(t+=" ="+e.getAttribute("width")+"x"+e.getAttribute("height")),e.hasAttribute("title")&&(t+=' "'+e.getAttribute("title")+'"'),t+=")"),t}),i.subParser("makeMarkdown.links",function(e,t){var r="";if(e.hasChildNodes()&&e.hasAttribute("href")){var n=e.childNodes,a=n.length;r="[";for(var o=0;o",e.hasAttribute("title")&&(r+=' "'+e.getAttribute("title")+'"'),r+=")"}return r}),i.subParser("makeMarkdown.list",function(e,t,r){var n="";if(!e.hasChildNodes())return"";for(var a=e.childNodes,o=a.length,s=e.getAttribute("start")||1,l=0;l"+t.preList[r]+""}),i.subParser("makeMarkdown.strikethrough",function(e,t){var r="";if(e.hasChildNodes()){r+="~~";for(var n=e.childNodes,a=n.length,o=0;otr>th"),l=e.querySelectorAll("tbody>tr");for(r=0;rp&&(p=g)}for(r=0;r/g,"\\$1>")).replace(/^#/gm,"\\#")).replace(/^(\s*)([-=]{3,})(\s*)$/,"$1\\$2$3")).replace(/^( {0,3}\d+)\./gm,"$1\\.")).replace(/^( {0,3})([+-])/gm,"$1\\$2")).replace(/]([\s]*)\(/g,"\\]$1\\(")).replace(/^ {0,3}\[([\S \t]*?)]:/gm,"\\[$1]:")}),e.exports?e.exports=i:this.showdown=i}).call(t)}),he={pangu:a,minimatch:D,beautify:te,style:le,rdability:ue,markdown:Object.freeze({default:de,__moduleExports:de})};e.Plugin=function(e){return void 0==e?he:he[e]},Object.defineProperty(e,"__esModule",{value:!0})}); +(function (global, factory) { + typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : + typeof define === 'function' && define.amd ? define(['exports'], factory) : + (factory((global.puplugin = {}))); +}(this, (function (exports) { 'use strict'; + + var commonjsGlobal = typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {}; + + function createCommonjsModule(fn, module) { + return module = { exports: {} }, fn(module, module.exports), module.exports; + } + + var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { + return typeof obj; + } : function (obj) { + return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; + }; + + var pangu_min = createCommonjsModule(function (module, exports) { + /*! + * pangu.js + * -------- + * @version: 3.3.0 + * @homepage: https://github.com/vinta/pangu.js + * @license: MIT + * @author: Vinta Chen (https://github.com/vinta) + */ + !function (e, u) { + module.exports = u(); + }(commonjsGlobal, function () { + return function (e) { + function u(a) { + if (f[a]) return f[a].exports;var t = f[a] = { exports: {}, id: a, loaded: !1 };return e[a].call(t.exports, t, t.exports, u), t.loaded = !0, t.exports; + }var f = {};return u.m = e, u.c = f, u.p = "", u(0); + }([function (e, u, f) { + function a(e, u) { + if (!(e instanceof u)) throw new TypeError("Cannot call a class as a function"); + }function t(e, u) { + if (!e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return !u || "object" != (typeof u === 'undefined' ? 'undefined' : _typeof(u)) && "function" != typeof u ? e : u; + }function n(e, u) { + if ("function" != typeof u && null !== u) throw new TypeError("Super expression must either be null or a function, not " + (typeof u === 'undefined' ? 'undefined' : _typeof(u)));e.prototype = Object.create(u && u.prototype, { constructor: { value: e, enumerable: !1, writable: !0, configurable: !0 } }), u && (Object.setPrototypeOf ? Object.setPrototypeOf(e, u) : e.__proto__ = u); + }var i = function () { + function e(e, u) { + for (var f = 0; f < u.length; f++) { + var a = u[f];a.enumerable = a.enumerable || !1, a.configurable = !0, "value" in a && (a.writable = !0), Object.defineProperty(e, a.key, a); + } + }return function (u, f, a) { + return f && e(u.prototype, f), a && e(u, a), u; + }; + }(), + r = f(1).Pangu, + o = 8, + s = function (e) { + function u() { + a(this, u);var e = t(this, Object.getPrototypeOf(u).call(this));return e.topTags = /^(html|head|body|#document)$/i, e.ignoreTags = /^(script|code|pre|textarea)$/i, e.spaceSensitiveTags = /^(a|del|pre|s|strike|u)$/i, e.spaceLikeTags = /^(br|hr|i|img|pangu)$/i, e.blockTags = /^(div|h1|h2|h3|h4|h5|h6|p)$/i, e; + }return n(u, e), i(u, [{ key: "canIgnoreNode", value: function value(e) { + for (var u = e.parentNode; u && u.nodeName && u.nodeName.search(this.topTags) === -1;) { + if (u.nodeName.search(this.ignoreTags) >= 0 || u.isContentEditable || "true" === u.getAttribute("g_editable")) return !0;u = u.parentNode; + }return !1; + } }, { key: "isFirstTextChild", value: function value(e, u) { + for (var f = e.childNodes, a = 0; a < f.length; a++) { + var t = f[a];if (t.nodeType !== o && t.textContent) return t === u; + }return !1; + } }, { key: "isLastTextChild", value: function value(e, u) { + for (var f = e.childNodes, a = f.length - 1; a > -1; a--) { + var t = f[a];if (t.nodeType !== o && t.textContent) return t === u; + }return !1; + } }, { key: "spacingNodeByXPath", value: function value(e, u) { + for (var f = document.evaluate(e, u, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null), a = void 0, t = void 0, n = f.snapshotLength - 1; n > -1; --n) { + if (a = f.snapshotItem(n), this.canIgnoreNode(a)) t = a;else { + var i = this.spacing(a.data);if (a.data !== i && (a.data = i), t) { + if (a.nextSibling && a.nextSibling.nodeName.search(this.spaceLikeTags) >= 0) { + t = a;continue; + }var r = a.data.toString().substr(-1) + t.data.toString().substr(0, 1), + o = this.spacing(r);if (o !== r) { + for (var s = t; s.parentNode && s.nodeName.search(this.spaceSensitiveTags) === -1 && this.isFirstTextChild(s.parentNode, s);) { + s = s.parentNode; + }for (var c = a; c.parentNode && c.nodeName.search(this.spaceSensitiveTags) === -1 && this.isLastTextChild(c.parentNode, c);) { + c = c.parentNode; + }if (c.nextSibling && c.nextSibling.nodeName.search(this.spaceLikeTags) >= 0) { + t = a;continue; + }if (c.nodeName.search(this.blockTags) === -1) if (s.nodeName.search(this.spaceSensitiveTags) === -1) s.nodeName.search(this.ignoreTags) === -1 && s.nodeName.search(this.blockTags) === -1 && (t.previousSibling ? t.previousSibling.nodeName.search(this.spaceLikeTags) === -1 && (t.data = " " + t.data) : this.canIgnoreNode(t) || (t.data = " " + t.data));else if (c.nodeName.search(this.spaceSensitiveTags) === -1) a.data = a.data + " ";else { + var d = document.createElement("pangu");d.innerHTML = " ", s.previousSibling ? s.previousSibling.nodeName.search(this.spaceLikeTags) === -1 && s.parentNode.insertBefore(d, s) : s.parentNode.insertBefore(d, s), d.previousElementSibling || d.parentNode && d.parentNode.removeChild(d); + } + } + }t = a; + } + } + } }, { key: "spacingNode", value: function value(e) { + var u = ".//*/text()[normalize-space(.)]";this.spacingNodeByXPath(u, e); + } }, { key: "spacingElementById", value: function value(e) { + var u = 'id("' + e + '")//text()';this.spacingNodeByXPath(u, document); + } }, { key: "spacingElementByClassName", value: function value(e) { + var u = '//*[contains(concat(" ", normalize-space(@class), " "), "' + e + '")]//text()';this.spacingNodeByXPath(u, document); + } }, { key: "spacingElementByTagName", value: function value(e) { + var u = "//" + e + "//text()";this.spacingNodeByXPath(u, document); + } }, { key: "spacingPageTitle", value: function value() { + var e = "/html/head/title/text()";this.spacingNodeByXPath(e, document); + } }, { key: "spacingPageBody", value: function value() { + for (var e = "/html/body//*/text()[normalize-space(.)]", u = ["script", "style", "textarea"], f = 0; f < u.length; f++) { + var a = u[f];e += '[translate(name(..),"ABCDEFGHIJKLMNOPQRSTUVWXYZ","abcdefghijklmnopqrstuvwxyz")!="' + a + '"]'; + }this.spacingNodeByXPath(e, document); + } }, { key: "spacingPage", value: function value() { + this.spacingPageTitle(), this.spacingPageBody(); + } }]), u; + }(r), + c = new s();u = e.exports = c, u.Pangu = s; + }, function (e, u) { + function f(e, u) { + if (!(e instanceof u)) throw new TypeError("Cannot call a class as a function"); + }var a = function () { + function e(e, u) { + for (var f = 0; f < u.length; f++) { + var a = u[f];a.enumerable = a.enumerable || !1, a.configurable = !0, "value" in a && (a.writable = !0), Object.defineProperty(e, a.key, a); + } + }return function (u, f, a) { + return f && e(u.prototype, f), a && e(u, a), u; + }; + }(), + t = /([\u2e80-\u2eff\u2f00-\u2fdf\u3040-\u309f\u30a0-\u30ff\u3100-\u312f\u3200-\u32ff\u3400-\u4dbf\u4e00-\u9fff\uf900-\ufaff])(["])/g, + n = /(["])([\u2e80-\u2eff\u2f00-\u2fdf\u3040-\u309f\u30a0-\u30ff\u3100-\u312f\u3200-\u32ff\u3400-\u4dbf\u4e00-\u9fff\uf900-\ufaff])/g, + i = /(["']+)(\s*)(.+?)(\s*)(["']+)/g, + r = /([\u2e80-\u2eff\u2f00-\u2fdf\u3040-\u309f\u30a0-\u30ff\u3100-\u312f\u3200-\u32ff\u3400-\u4dbf\u4e00-\u9fff\uf900-\ufaff])( )(')([A-Za-z])/g, + o = /([\u2e80-\u2eff\u2f00-\u2fdf\u3040-\u309f\u30a0-\u30ff\u3100-\u312f\u3200-\u32ff\u3400-\u4dbf\u4e00-\u9fff\uf900-\ufaff])(#)([A-Za-z0-9\u2e80-\u2eff\u2f00-\u2fdf\u3040-\u309f\u30a0-\u30ff\u3100-\u312f\u3200-\u32ff\u3400-\u4dbf\u4e00-\u9fff\uf900-\ufaff]+)(#)([\u2e80-\u2eff\u2f00-\u2fdf\u3040-\u309f\u30a0-\u30ff\u3100-\u312f\u3200-\u32ff\u3400-\u4dbf\u4e00-\u9fff\uf900-\ufaff])/g, + s = /([\u2e80-\u2eff\u2f00-\u2fdf\u3040-\u309f\u30a0-\u30ff\u3100-\u312f\u3200-\u32ff\u3400-\u4dbf\u4e00-\u9fff\uf900-\ufaff])(#([^ ]))/g, + c = /(([^ ])#)([\u2e80-\u2eff\u2f00-\u2fdf\u3040-\u309f\u30a0-\u30ff\u3100-\u312f\u3200-\u32ff\u3400-\u4dbf\u4e00-\u9fff\uf900-\ufaff])/g, + d = /([\u2e80-\u2eff\u2f00-\u2fdf\u3040-\u309f\u30a0-\u30ff\u3100-\u312f\u3200-\u32ff\u3400-\u4dbf\u4e00-\u9fff\uf900-\ufaff])([\+\-\*\/=&\\|<>])([A-Za-z0-9])/g, + p = /([A-Za-z0-9])([\+\-\*\/=&\\|<>])([\u2e80-\u2eff\u2f00-\u2fdf\u3040-\u309f\u30a0-\u30ff\u3100-\u312f\u3200-\u32ff\u3400-\u4dbf\u4e00-\u9fff\uf900-\ufaff])/g, + l = /([\u2e80-\u2eff\u2f00-\u2fdf\u3040-\u309f\u30a0-\u30ff\u3100-\u312f\u3200-\u32ff\u3400-\u4dbf\u4e00-\u9fff\uf900-\ufaff])([\(\[\{<\u201c]+(.*?)[\)\]\}>\u201d]+)([\u2e80-\u2eff\u2f00-\u2fdf\u3040-\u309f\u30a0-\u30ff\u3100-\u312f\u3200-\u32ff\u3400-\u4dbf\u4e00-\u9fff\uf900-\ufaff])/g, + g = /([\u2e80-\u2eff\u2f00-\u2fdf\u3040-\u309f\u30a0-\u30ff\u3100-\u312f\u3200-\u32ff\u3400-\u4dbf\u4e00-\u9fff\uf900-\ufaff])([\(\[\{<\u201c>])/g, + h = /([\)\]\}>\u201d<])([\u2e80-\u2eff\u2f00-\u2fdf\u3040-\u309f\u30a0-\u30ff\u3100-\u312f\u3200-\u32ff\u3400-\u4dbf\u4e00-\u9fff\uf900-\ufaff])/g, + v = /([\(\[\{<\u201c]+)(\s*)(.+?)(\s*)([\)\]\}>\u201d]+)/, + b = /([\u2e80-\u2eff\u2f00-\u2fdf\u3040-\u309f\u30a0-\u30ff\u3100-\u312f\u3200-\u32ff\u3400-\u4dbf\u4e00-\u9fff\uf900-\ufaff])([~!;:,\.\?\u2026])([A-Za-z0-9])/g, + y = /([\u2e80-\u2eff\u2f00-\u2fdf\u3040-\u309f\u30a0-\u30ff\u3100-\u312f\u3200-\u32ff\u3400-\u4dbf\u4e00-\u9fff\uf900-\ufaff])([A-Za-z0-9`\$%\^&\*\-=\+\\\|\/@\u00a1-\u00ff\u2022\u2027\u2150-\u218f])/g, + m = /([A-Za-z0-9`~\$%\^&\*\-=\+\\\|\/!;:,\.\?\u00a1-\u00ff\u2022\u2026\u2027\u2150-\u218f])([\u2e80-\u2eff\u2f00-\u2fdf\u3040-\u309f\u30a0-\u30ff\u3100-\u312f\u3200-\u32ff\u3400-\u4dbf\u4e00-\u9fff\uf900-\ufaff])/g, + $ = function () { + function e() { + f(this, e); + }return a(e, [{ key: "spacing", value: function value(e) { + var u = e;u = u.replace(t, "$1 $2"), u = u.replace(n, "$1 $2"), u = u.replace(i, "$1$3$5"), u = u.replace(r, "$1$3$4"), u = u.replace(o, "$1 $2$3$4 $5"), u = u.replace(s, "$1 $2"), u = u.replace(c, "$1 $3"), u = u.replace(d, "$1 $2 $3"), u = u.replace(p, "$1 $2 $3");var f = u, + a = u.replace(l, "$1 $2 $4");return u = a, f === a && (u = u.replace(g, "$1 $2"), u = u.replace(h, "$1 $2")), u = u.replace(v, "$1$3$5"), u = u.replace(b, "$1$2 $3"), u = u.replace(y, "$1 $2"), u = u.replace(m, "$1 $2"); + } }, { key: "spacingText", value: function value(e) { + var u = arguments.length <= 1 || void 0 === arguments[1] ? function () {} : arguments[1];try { + var f = this.spacing(e);u(null, f); + } catch (a) { + u(a); + } + } }]), e; + }(), + N = new $();u = e.exports = N, u.Pangu = $; + }]); + }); + + }); + var pangu_min_1 = pangu_min.pangu; + + // Copyright Joyent, Inc. and other Node contributors. + // + // Permission is hereby granted, free of charge, to any person obtaining a + // copy of this software and associated documentation files (the + // "Software"), to deal in the Software without restriction, including + // without limitation the rights to use, copy, modify, merge, publish, + // distribute, sublicense, and/or sell copies of the Software, and to permit + // persons to whom the Software is furnished to do so, subject to the + // following conditions: + // + // The above copyright notice and this permission notice shall be included + // in all copies or substantial portions of the Software. + // + // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN + // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, + // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE + // USE OR OTHER DEALINGS IN THE SOFTWARE. + + // resolves . and .. elements in a path array with directory names there + // must be no slashes, empty elements, or device names (c:\) in the array + // (so also no leading and trailing slashes - it does not distinguish + // relative and absolute paths) + function normalizeArray(parts, allowAboveRoot) { + // if the path tries to go above the root, `up` ends up > 0 + var up = 0; + for (var i = parts.length - 1; i >= 0; i--) { + var last = parts[i]; + if (last === '.') { + parts.splice(i, 1); + } else if (last === '..') { + parts.splice(i, 1); + up++; + } else if (up) { + parts.splice(i, 1); + up--; + } + } + + // if the path is allowed to go above the root, restore leading ..s + if (allowAboveRoot) { + for (; up--; up) { + parts.unshift('..'); + } + } + + return parts; + } + + // Split a filename into [root, dir, basename, ext], unix version + // 'root' is just a slash, or nothing. + var splitPathRe = + /^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/; + var splitPath = function(filename) { + return splitPathRe.exec(filename).slice(1); + }; + + // path.resolve([from ...], to) + // posix version + function resolve() { + var resolvedPath = '', + resolvedAbsolute = false; + + for (var i = arguments.length - 1; i >= -1 && !resolvedAbsolute; i--) { + var path = (i >= 0) ? arguments[i] : '/'; + + // Skip empty and invalid entries + if (typeof path !== 'string') { + throw new TypeError('Arguments to path.resolve must be strings'); + } else if (!path) { + continue; + } + + resolvedPath = path + '/' + resolvedPath; + resolvedAbsolute = path.charAt(0) === '/'; + } + + // At this point the path should be resolved to a full absolute path, but + // handle relative paths to be safe (might happen when process.cwd() fails) + + // Normalize the path + resolvedPath = normalizeArray(filter(resolvedPath.split('/'), function(p) { + return !!p; + }), !resolvedAbsolute).join('/'); + + return ((resolvedAbsolute ? '/' : '') + resolvedPath) || '.'; + } + // path.normalize(path) + // posix version + function normalize(path) { + var isPathAbsolute = isAbsolute(path), + trailingSlash = substr(path, -1) === '/'; + + // Normalize the path + path = normalizeArray(filter(path.split('/'), function(p) { + return !!p; + }), !isPathAbsolute).join('/'); + + if (!path && !isPathAbsolute) { + path = '.'; + } + if (path && trailingSlash) { + path += '/'; + } + + return (isPathAbsolute ? '/' : '') + path; + } + // posix version + function isAbsolute(path) { + return path.charAt(0) === '/'; + } + + // posix version + function join() { + var paths = Array.prototype.slice.call(arguments, 0); + return normalize(filter(paths, function(p, index) { + if (typeof p !== 'string') { + throw new TypeError('Arguments to path.join must be strings'); + } + return p; + }).join('/')); + } + + + // path.relative(from, to) + // posix version + function relative(from, to) { + from = resolve(from).substr(1); + to = resolve(to).substr(1); + + function trim(arr) { + var start = 0; + for (; start < arr.length; start++) { + if (arr[start] !== '') break; + } + + var end = arr.length - 1; + for (; end >= 0; end--) { + if (arr[end] !== '') break; + } + + if (start > end) return []; + return arr.slice(start, end - start + 1); + } + + var fromParts = trim(from.split('/')); + var toParts = trim(to.split('/')); + + var length = Math.min(fromParts.length, toParts.length); + var samePartsLength = length; + for (var i = 0; i < length; i++) { + if (fromParts[i] !== toParts[i]) { + samePartsLength = i; + break; + } + } + + var outputParts = []; + for (var i = samePartsLength; i < fromParts.length; i++) { + outputParts.push('..'); + } + + outputParts = outputParts.concat(toParts.slice(samePartsLength)); + + return outputParts.join('/'); + } + + var sep = '/'; + var delimiter = ':'; + + function dirname(path) { + var result = splitPath(path), + root = result[0], + dir = result[1]; + + if (!root && !dir) { + // No dirname whatsoever + return '.'; + } + + if (dir) { + // It has a dirname, strip trailing slash + dir = dir.substr(0, dir.length - 1); + } + + return root + dir; + } + + function basename(path, ext) { + var f = splitPath(path)[2]; + // TODO: make this comparison case-insensitive on windows? + if (ext && f.substr(-1 * ext.length) === ext) { + f = f.substr(0, f.length - ext.length); + } + return f; + } + + + function extname(path) { + return splitPath(path)[3]; + } + var path = { + extname: extname, + basename: basename, + dirname: dirname, + sep: sep, + delimiter: delimiter, + relative: relative, + join: join, + isAbsolute: isAbsolute, + normalize: normalize, + resolve: resolve + }; + function filter (xs, f) { + if (xs.filter) return xs.filter(f); + var res = []; + for (var i = 0; i < xs.length; i++) { + if (f(xs[i], i, xs)) res.push(xs[i]); + } + return res; + } + + // String.prototype.substr - negative index don't work in IE8 + var substr = 'ab'.substr(-1) === 'b' ? + function (str, start, len) { return str.substr(start, len) } : + function (str, start, len) { + if (start < 0) start = str.length + start; + return str.substr(start, len); + } + ; + + var path$1 = /*#__PURE__*/Object.freeze({ + resolve: resolve, + normalize: normalize, + isAbsolute: isAbsolute, + join: join, + relative: relative, + sep: sep, + delimiter: delimiter, + dirname: dirname, + basename: basename, + extname: extname, + default: path + }); + + var concatMap = function (xs, fn) { + var res = []; + for (var i = 0; i < xs.length; i++) { + var x = fn(xs[i], i); + if (isArray(x)) res.push.apply(res, x); + else res.push(x); + } + return res; + }; + + var isArray = Array.isArray || function (xs) { + return Object.prototype.toString.call(xs) === '[object Array]'; + }; + + var balancedMatch = balanced; + function balanced(a, b, str) { + if (a instanceof RegExp) a = maybeMatch(a, str); + if (b instanceof RegExp) b = maybeMatch(b, str); + + var r = range(a, b, str); + + return r && { + start: r[0], + end: r[1], + pre: str.slice(0, r[0]), + body: str.slice(r[0] + a.length, r[1]), + post: str.slice(r[1] + b.length) + }; + } + + function maybeMatch(reg, str) { + var m = str.match(reg); + return m ? m[0] : null; + } + + balanced.range = range; + function range(a, b, str) { + var begs, beg, left, right, result; + var ai = str.indexOf(a); + var bi = str.indexOf(b, ai + 1); + var i = ai; + + if (ai >= 0 && bi > 0) { + begs = []; + left = str.length; + + while (i >= 0 && !result) { + if (i == ai) { + begs.push(i); + ai = str.indexOf(a, i + 1); + } else if (begs.length == 1) { + result = [ begs.pop(), bi ]; + } else { + beg = begs.pop(); + if (beg < left) { + left = beg; + right = bi; + } + + bi = str.indexOf(b, i + 1); + } + + i = ai < bi && ai >= 0 ? ai : bi; + } + + if (begs.length) { + result = [ left, right ]; + } + } + + return result; + } + + var braceExpansion = expandTop; + + var escSlash = '\0SLASH'+Math.random()+'\0'; + var escOpen = '\0OPEN'+Math.random()+'\0'; + var escClose = '\0CLOSE'+Math.random()+'\0'; + var escComma = '\0COMMA'+Math.random()+'\0'; + var escPeriod = '\0PERIOD'+Math.random()+'\0'; + + function numeric(str) { + return parseInt(str, 10) == str + ? parseInt(str, 10) + : str.charCodeAt(0); + } + + function escapeBraces(str) { + return str.split('\\\\').join(escSlash) + .split('\\{').join(escOpen) + .split('\\}').join(escClose) + .split('\\,').join(escComma) + .split('\\.').join(escPeriod); + } + + function unescapeBraces(str) { + return str.split(escSlash).join('\\') + .split(escOpen).join('{') + .split(escClose).join('}') + .split(escComma).join(',') + .split(escPeriod).join('.'); + } + + + // Basically just str.split(","), but handling cases + // where we have nested braced sections, which should be + // treated as individual members, like {a,{b,c},d} + function parseCommaParts(str) { + if (!str) + return ['']; + + var parts = []; + var m = balancedMatch('{', '}', str); + + if (!m) + return str.split(','); + + var pre = m.pre; + var body = m.body; + var post = m.post; + var p = pre.split(','); + + p[p.length-1] += '{' + body + '}'; + var postParts = parseCommaParts(post); + if (post.length) { + p[p.length-1] += postParts.shift(); + p.push.apply(p, postParts); + } + + parts.push.apply(parts, p); + + return parts; + } + + function expandTop(str) { + if (!str) + return []; + + // I don't know why Bash 4.3 does this, but it does. + // Anything starting with {} will have the first two bytes preserved + // but *only* at the top level, so {},a}b will not expand to anything, + // but a{},b}c will be expanded to [a}c,abc]. + // One could argue that this is a bug in Bash, but since the goal of + // this module is to match Bash's rules, we escape a leading {} + if (str.substr(0, 2) === '{}') { + str = '\\{\\}' + str.substr(2); + } + + return expand(escapeBraces(str), true).map(unescapeBraces); + } + + function embrace(str) { + return '{' + str + '}'; + } + function isPadded(el) { + return /^-?0\d/.test(el); + } + + function lte(i, y) { + return i <= y; + } + function gte(i, y) { + return i >= y; + } + + function expand(str, isTop) { + var expansions = []; + + var m = balancedMatch('{', '}', str); + if (!m || /\$$/.test(m.pre)) return [str]; + + var isNumericSequence = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(m.body); + var isAlphaSequence = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(m.body); + var isSequence = isNumericSequence || isAlphaSequence; + var isOptions = m.body.indexOf(',') >= 0; + if (!isSequence && !isOptions) { + // {a},b} + if (m.post.match(/,.*\}/)) { + str = m.pre + '{' + m.body + escClose + m.post; + return expand(str); + } + return [str]; + } + + var n; + if (isSequence) { + n = m.body.split(/\.\./); + } else { + n = parseCommaParts(m.body); + if (n.length === 1) { + // x{{a,b}}y ==> x{a}y x{b}y + n = expand(n[0], false).map(embrace); + if (n.length === 1) { + var post = m.post.length + ? expand(m.post, false) + : ['']; + return post.map(function(p) { + return m.pre + n[0] + p; + }); + } + } + } + + // at this point, n is the parts, and we know it's not a comma set + // with a single entry. + + // no need to expand pre, since it is guaranteed to be free of brace-sets + var pre = m.pre; + var post = m.post.length + ? expand(m.post, false) + : ['']; + + var N; + + if (isSequence) { + var x = numeric(n[0]); + var y = numeric(n[1]); + var width = Math.max(n[0].length, n[1].length); + var incr = n.length == 3 + ? Math.abs(numeric(n[2])) + : 1; + var test = lte; + var reverse = y < x; + if (reverse) { + incr *= -1; + test = gte; + } + var pad = n.some(isPadded); + + N = []; + + for (var i = x; test(i, y); i += incr) { + var c; + if (isAlphaSequence) { + c = String.fromCharCode(i); + if (c === '\\') + c = ''; + } else { + c = String(i); + if (pad) { + var need = width - c.length; + if (need > 0) { + var z = new Array(need + 1).join('0'); + if (i < 0) + c = '-' + z + c.slice(1); + else + c = z + c; + } + } + } + N.push(c); + } + } else { + N = concatMap(n, function(el) { return expand(el, false) }); + } + + for (var j = 0; j < N.length; j++) { + for (var k = 0; k < post.length; k++) { + var expansion = pre + N[j] + post[k]; + if (!isTop || isSequence || expansion) + expansions.push(expansion); + } + } + + return expansions; + } + + var require$$0 = ( path$1 && path ) || path$1; + + var minimatch_1 = minimatch; + minimatch.Minimatch = Minimatch; + + var path$2 = { sep: '/' }; + try { + path$2 = require$$0; + } catch (er) {} + + var GLOBSTAR = minimatch.GLOBSTAR = Minimatch.GLOBSTAR = {}; + + var plTypes = { + '!': { open: '(?:(?!(?:', close: '))[^/]*?)' }, + '?': { open: '(?:', close: ')?' }, + '+': { open: '(?:', close: ')+' }, + '*': { open: '(?:', close: ')*' }, + '@': { open: '(?:', close: ')' } + + // any single thing other than / + // don't need to escape / when using new RegExp() + };var qmark = '[^/]'; + + // * => any number of characters + var star = qmark + '*?'; + + // ** when dots are allowed. Anything goes, except .. and . + // not (^ or / followed by one or two dots followed by $ or /), + // followed by anything, any number of times. + var twoStarDot = '(?:(?!(?:\\\/|^)(?:\\.{1,2})($|\\\/)).)*?'; + + // not a ^ or / followed by a dot, + // followed by anything, any number of times. + var twoStarNoDot = '(?:(?!(?:\\\/|^)\\.).)*?'; + + // characters that need to be escaped in RegExp. + var reSpecials = charSet('().*{}+?[]^$\\!'); + + // "abc" -> { a:true, b:true, c:true } + function charSet(s) { + return s.split('').reduce(function (set, c) { + set[c] = true; + return set; + }, {}); + } + + // normalizes slashes. + var slashSplit = /\/+/; + + minimatch.filter = filter$1; + function filter$1(pattern, options) { + options = options || {}; + return function (p, i, list) { + return minimatch(p, pattern, options); + }; + } + + function ext(a, b) { + a = a || {}; + b = b || {}; + var t = {}; + Object.keys(b).forEach(function (k) { + t[k] = b[k]; + }); + Object.keys(a).forEach(function (k) { + t[k] = a[k]; + }); + return t; + } + + minimatch.defaults = function (def) { + if (!def || !Object.keys(def).length) return minimatch; + + var orig = minimatch; + + var m = function minimatch(p, pattern, options) { + return orig.minimatch(p, pattern, ext(def, options)); + }; + + m.Minimatch = function Minimatch(pattern, options) { + return new orig.Minimatch(pattern, ext(def, options)); + }; + + return m; + }; + + Minimatch.defaults = function (def) { + if (!def || !Object.keys(def).length) return Minimatch; + return minimatch.defaults(def).Minimatch; + }; + + function minimatch(p, pattern, options) { + if (typeof pattern !== 'string') { + throw new TypeError('glob pattern string required'); + } + + if (!options) options = {}; + + // shortcut: comments match nothing. + if (!options.nocomment && pattern.charAt(0) === '#') { + return false; + } + + // "" only matches "" + if (pattern.trim() === '') return p === ''; + + return new Minimatch(pattern, options).match(p); + } + + function Minimatch(pattern, options) { + if (!(this instanceof Minimatch)) { + return new Minimatch(pattern, options); + } + + if (typeof pattern !== 'string') { + throw new TypeError('glob pattern string required'); + } + + if (!options) options = {}; + pattern = pattern.trim(); + + // windows support: need to use /, not \ + if (path$2.sep !== '/') { + pattern = pattern.split(path$2.sep).join('/'); + } + + this.options = options; + this.set = []; + this.pattern = pattern; + this.regexp = null; + this.negate = false; + this.comment = false; + this.empty = false; + + // make the set of regexps etc. + this.make(); + } + + Minimatch.prototype.debug = function () {}; + + Minimatch.prototype.make = make; + function make() { + // don't do it more than once. + if (this._made) return; + + var pattern = this.pattern; + var options = this.options; + + // empty patterns and comments match nothing. + if (!options.nocomment && pattern.charAt(0) === '#') { + this.comment = true; + return; + } + if (!pattern) { + this.empty = true; + return; + } + + // step 1: figure out negation, etc. + this.parseNegate(); + + // step 2: expand braces + var set = this.globSet = this.braceExpand(); + + if (options.debug) this.debug = console.error; + + this.debug(this.pattern, set); + + // step 3: now we have a set, so turn each one into a series of path-portion + // matching patterns. + // These will be regexps, except in the case of "**", which is + // set to the GLOBSTAR object for globstar behavior, + // and will not contain any / characters + set = this.globParts = set.map(function (s) { + return s.split(slashSplit); + }); + + this.debug(this.pattern, set); + + // glob --> regexps + set = set.map(function (s, si, set) { + return s.map(this.parse, this); + }, this); + + this.debug(this.pattern, set); + + // filter out everything that didn't compile properly. + set = set.filter(function (s) { + return s.indexOf(false) === -1; + }); + + this.debug(this.pattern, set); + + this.set = set; + } + + Minimatch.prototype.parseNegate = parseNegate; + function parseNegate() { + var pattern = this.pattern; + var negate = false; + var options = this.options; + var negateOffset = 0; + + if (options.nonegate) return; + + for (var i = 0, l = pattern.length; i < l && pattern.charAt(i) === '!'; i++) { + negate = !negate; + negateOffset++; + } + + if (negateOffset) this.pattern = pattern.substr(negateOffset); + this.negate = negate; + } + + // Brace expansion: + // a{b,c}d -> abd acd + // a{b,}c -> abc ac + // a{0..3}d -> a0d a1d a2d a3d + // a{b,c{d,e}f}g -> abg acdfg acefg + // a{b,c}d{e,f}g -> abdeg acdeg abdeg abdfg + // + // Invalid sets are not expanded. + // a{2..}b -> a{2..}b + // a{b}c -> a{b}c + minimatch.braceExpand = function (pattern, options) { + return braceExpand(pattern, options); + }; + + Minimatch.prototype.braceExpand = braceExpand; + + function braceExpand(pattern, options) { + if (!options) { + if (this instanceof Minimatch) { + options = this.options; + } else { + options = {}; + } + } + + pattern = typeof pattern === 'undefined' ? this.pattern : pattern; + + if (typeof pattern === 'undefined') { + throw new TypeError('undefined pattern'); + } + + if (options.nobrace || !pattern.match(/\{.*\}/)) { + // shortcut. no need to expand. + return [pattern]; + } + + return braceExpansion(pattern); + } + + // parse a component of the expanded set. + // At this point, no pattern may contain "/" in it + // so we're going to return a 2d array, where each entry is the full + // pattern, split on '/', and then turned into a regular expression. + // A regexp is made at the end which joins each array with an + // escaped /, and another full one which joins each regexp with |. + // + // Following the lead of Bash 4.1, note that "**" only has special meaning + // when it is the *only* thing in a path portion. Otherwise, any series + // of * is equivalent to a single *. Globstar behavior is enabled by + // default, and can be disabled by setting options.noglobstar. + Minimatch.prototype.parse = parse; + var SUBPARSE = {}; + function parse(pattern, isSub) { + if (pattern.length > 1024 * 64) { + throw new TypeError('pattern is too long'); + } + + var options = this.options; + + // shortcuts + if (!options.noglobstar && pattern === '**') return GLOBSTAR; + if (pattern === '') return ''; + + var re = ''; + var hasMagic = !!options.nocase; + var escaping = false; + // ? => one single character + var patternListStack = []; + var negativeLists = []; + var stateChar; + var inClass = false; + var reClassStart = -1; + var classStart = -1; + // . and .. never match anything that doesn't start with ., + // even when options.dot is set. + var patternStart = pattern.charAt(0) === '.' ? '' // anything + // not (start or / followed by . or .. followed by / or end) + : options.dot ? '(?!(?:^|\\\/)\\.{1,2}(?:$|\\\/))' : '(?!\\.)'; + var self = this; + + function clearStateChar() { + if (stateChar) { + // we had some state-tracking character + // that wasn't consumed by this pass. + switch (stateChar) { + case '*': + re += star; + hasMagic = true; + break; + case '?': + re += qmark; + hasMagic = true; + break; + default: + re += '\\' + stateChar; + break; + } + self.debug('clearStateChar %j %j', stateChar, re); + stateChar = false; + } + } + + for (var i = 0, len = pattern.length, c; i < len && (c = pattern.charAt(i)); i++) { + this.debug('%s\t%s %s %j', pattern, i, re, c); + + // skip over any that are escaped. + if (escaping && reSpecials[c]) { + re += '\\' + c; + escaping = false; + continue; + } + + switch (c) { + case '/': + // completely not allowed, even escaped. + // Should already be path-split by now. + return false; + + case '\\': + clearStateChar(); + escaping = true; + continue; + + // the various stateChar values + // for the "extglob" stuff. + case '?': + case '*': + case '+': + case '@': + case '!': + this.debug('%s\t%s %s %j <-- stateChar', pattern, i, re, c); + + // all of those are literals inside a class, except that + // the glob [!a] means [^a] in regexp + if (inClass) { + this.debug(' in class'); + if (c === '!' && i === classStart + 1) c = '^'; + re += c; + continue; + } + + // if we already have a stateChar, then it means + // that there was something like ** or +? in there. + // Handle the stateChar, then proceed with this one. + self.debug('call clearStateChar %j', stateChar); + clearStateChar(); + stateChar = c; + // if extglob is disabled, then +(asdf|foo) isn't a thing. + // just clear the statechar *now*, rather than even diving into + // the patternList stuff. + if (options.noext) clearStateChar(); + continue; + + case '(': + if (inClass) { + re += '('; + continue; + } + + if (!stateChar) { + re += '\\('; + continue; + } + + patternListStack.push({ + type: stateChar, + start: i - 1, + reStart: re.length, + open: plTypes[stateChar].open, + close: plTypes[stateChar].close + }); + // negation is (?:(?!js)[^/]*) + re += stateChar === '!' ? '(?:(?!(?:' : '(?:'; + this.debug('plType %j %j', stateChar, re); + stateChar = false; + continue; + + case ')': + if (inClass || !patternListStack.length) { + re += '\\)'; + continue; + } + + clearStateChar(); + hasMagic = true; + var pl = patternListStack.pop(); + // negation is (?:(?!js)[^/]*) + // The others are (?:) + re += pl.close; + if (pl.type === '!') { + negativeLists.push(pl); + } + pl.reEnd = re.length; + continue; + + case '|': + if (inClass || !patternListStack.length || escaping) { + re += '\\|'; + escaping = false; + continue; + } + + clearStateChar(); + re += '|'; + continue; + + // these are mostly the same in regexp and glob + case '[': + // swallow any state-tracking char before the [ + clearStateChar(); + + if (inClass) { + re += '\\' + c; + continue; + } + + inClass = true; + classStart = i; + reClassStart = re.length; + re += c; + continue; + + case ']': + // a right bracket shall lose its special + // meaning and represent itself in + // a bracket expression if it occurs + // first in the list. -- POSIX.2 2.8.3.2 + if (i === classStart + 1 || !inClass) { + re += '\\' + c; + escaping = false; + continue; + } + + // handle the case where we left a class open. + // "[z-a]" is valid, equivalent to "\[z-a\]" + if (inClass) { + // split where the last [ was, make sure we don't have + // an invalid re. if so, re-walk the contents of the + // would-be class to re-translate any characters that + // were passed through as-is + // TODO: It would probably be faster to determine this + // without a try/catch and a new RegExp, but it's tricky + // to do safely. For now, this is safe and works. + var cs = pattern.substring(classStart + 1, i); + try { + } catch (er) { + // not a valid class! + var sp = this.parse(cs, SUBPARSE); + re = re.substr(0, reClassStart) + '\\[' + sp[0] + '\\]'; + hasMagic = hasMagic || sp[1]; + inClass = false; + continue; + } + } + + // finish up the class. + hasMagic = true; + inClass = false; + re += c; + continue; + + default: + // swallow any state char that wasn't consumed + clearStateChar(); + + if (escaping) { + // no need + escaping = false; + } else if (reSpecials[c] && !(c === '^' && inClass)) { + re += '\\'; + } + + re += c; + + } // switch + } // for + + // handle the case where we left a class open. + // "[abc" is valid, equivalent to "\[abc" + if (inClass) { + // split where the last [ was, and escape it + // this is a huge pita. We now have to re-walk + // the contents of the would-be class to re-translate + // any characters that were passed through as-is + cs = pattern.substr(classStart + 1); + sp = this.parse(cs, SUBPARSE); + re = re.substr(0, reClassStart) + '\\[' + sp[0]; + hasMagic = hasMagic || sp[1]; + } + + // handle the case where we had a +( thing at the *end* + // of the pattern. + // each pattern list stack adds 3 chars, and we need to go through + // and escape any | chars that were passed through as-is for the regexp. + // Go through and escape them, taking care not to double-escape any + // | chars that were already escaped. + for (pl = patternListStack.pop(); pl; pl = patternListStack.pop()) { + var tail = re.slice(pl.reStart + pl.open.length); + this.debug('setting tail', re, pl); + // maybe some even number of \, then maybe 1 \, followed by a | + tail = tail.replace(/((?:\\{2}){0,64})(\\?)\|/g, function (_, $1, $2) { + if (!$2) { + // the | isn't already escaped, so escape it. + $2 = '\\'; + } + + // need to escape all those slashes *again*, without escaping the + // one that we need for escaping the | character. As it works out, + // escaping an even number of slashes can be done by simply repeating + // it exactly after itself. That's why this trick works. + // + // I am sorry that you have to see this. + return $1 + $1 + $2 + '|'; + }); + + this.debug('tail=%j\n %s', tail, tail, pl, re); + var t = pl.type === '*' ? star : pl.type === '?' ? qmark : '\\' + pl.type; + + hasMagic = true; + re = re.slice(0, pl.reStart) + t + '\\(' + tail; + } + + // handle trailing things that only matter at the very end. + clearStateChar(); + if (escaping) { + // trailing \\ + re += '\\\\'; + } + + // only need to apply the nodot start if the re starts with + // something that could conceivably capture a dot + var addPatternStart = false; + switch (re.charAt(0)) { + case '.': + case '[': + case '(': + addPatternStart = true; + } + + // Hack to work around lack of negative lookbehind in JS + // A pattern like: *.!(x).!(y|z) needs to ensure that a name + // like 'a.xyz.yz' doesn't match. So, the first negative + // lookahead, has to look ALL the way ahead, to the end of + // the pattern. + for (var n = negativeLists.length - 1; n > -1; n--) { + var nl = negativeLists[n]; + + var nlBefore = re.slice(0, nl.reStart); + var nlFirst = re.slice(nl.reStart, nl.reEnd - 8); + var nlLast = re.slice(nl.reEnd - 8, nl.reEnd); + var nlAfter = re.slice(nl.reEnd); + + nlLast += nlAfter; + + // Handle nested stuff like *(*.js|!(*.json)), where open parens + // mean that we should *not* include the ) in the bit that is considered + // "after" the negated section. + var openParensBefore = nlBefore.split('(').length - 1; + var cleanAfter = nlAfter; + for (i = 0; i < openParensBefore; i++) { + cleanAfter = cleanAfter.replace(/\)[+*?]?/, ''); + } + nlAfter = cleanAfter; + + var dollar = ''; + if (nlAfter === '' && isSub !== SUBPARSE) { + dollar = '$'; + } + var newRe = nlBefore + nlFirst + nlAfter + dollar + nlLast; + re = newRe; + } + + // if the re is not "" at this point, then we need to make sure + // it doesn't match against an empty path part. + // Otherwise a/* will match a/, which it should not. + if (re !== '' && hasMagic) { + re = '(?=.)' + re; + } + + if (addPatternStart) { + re = patternStart + re; + } + + // parsing just a piece of a larger pattern. + if (isSub === SUBPARSE) { + return [re, hasMagic]; + } + + // skip the regexp for non-magical patterns + // unescape anything in it, though, so that it'll be + // an exact match against a file etc. + if (!hasMagic) { + return globUnescape(pattern); + } + + var flags = options.nocase ? 'i' : ''; + try { + var regExp = new RegExp('^' + re + '$', flags); + } catch (er) { + // If it was an invalid regular expression, then it can't match + // anything. This trick looks for a character after the end of + // the string, which is of course impossible, except in multi-line + // mode, but it's not a /m regex. + return new RegExp('$.'); + } + + regExp._glob = pattern; + regExp._src = re; + + return regExp; + } + + minimatch.makeRe = function (pattern, options) { + return new Minimatch(pattern, options || {}).makeRe(); + }; + + Minimatch.prototype.makeRe = makeRe; + function makeRe() { + if (this.regexp || this.regexp === false) return this.regexp; + + // at this point, this.set is a 2d array of partial + // pattern strings, or "**". + // + // It's better to use .match(). This function shouldn't + // be used, really, but it's pretty convenient sometimes, + // when you just want to work with a regex. + var set = this.set; + + if (!set.length) { + this.regexp = false; + return this.regexp; + } + var options = this.options; + + var twoStar = options.noglobstar ? star : options.dot ? twoStarDot : twoStarNoDot; + var flags = options.nocase ? 'i' : ''; + + var re = set.map(function (pattern) { + return pattern.map(function (p) { + return p === GLOBSTAR ? twoStar : typeof p === 'string' ? regExpEscape(p) : p._src; + }).join('\\\/'); + }).join('|'); + + // must match entire pattern + // ending in a * or ** will make it less strict. + re = '^(?:' + re + ')$'; + + // can match anything, as long as it's not this. + if (this.negate) re = '^(?!' + re + ').*$'; + + try { + this.regexp = new RegExp(re, flags); + } catch (ex) { + this.regexp = false; + } + return this.regexp; + } + + minimatch.match = function (list, pattern, options) { + options = options || {}; + var mm = new Minimatch(pattern, options); + list = list.filter(function (f) { + return mm.match(f); + }); + if (mm.options.nonull && !list.length) { + list.push(pattern); + } + return list; + }; + + Minimatch.prototype.match = match; + function match(f, partial) { + this.debug('match', f, this.pattern); + // short-circuit in the case of busted things. + // comments, etc. + if (this.comment) return false; + if (this.empty) return f === ''; + + if (f === '/' && partial) return true; + + var options = this.options; + + // windows: need to use /, not \ + if (path$2.sep !== '/') { + f = f.split(path$2.sep).join('/'); + } + + // treat the test path as a set of pathparts. + f = f.split(slashSplit); + this.debug(this.pattern, 'split', f); + + // just ONE of the pattern sets in this.set needs to match + // in order for it to be valid. If negating, then just one + // match means that we have failed. + // Either way, return on the first hit. + + var set = this.set; + this.debug(this.pattern, 'set', set); + + // Find the basename of the path by looking for the last non-empty segment + var filename; + var i; + for (i = f.length - 1; i >= 0; i--) { + filename = f[i]; + if (filename) break; + } + + for (i = 0; i < set.length; i++) { + var pattern = set[i]; + var file = f; + if (options.matchBase && pattern.length === 1) { + file = [filename]; + } + var hit = this.matchOne(file, pattern, partial); + if (hit) { + if (options.flipNegate) return true; + return !this.negate; + } + } + + // didn't get any hits. this is success if it's a negative + // pattern, failure otherwise. + if (options.flipNegate) return false; + return this.negate; + } + + // set partial to true to test if, for example, + // "/a/b" matches the start of "/*/b/*/d" + // Partial means, if you run out of file before you run + // out of pattern, then that's fine, as long as all + // the parts match. + Minimatch.prototype.matchOne = function (file, pattern, partial) { + var options = this.options; + + this.debug('matchOne', { 'this': this, file: file, pattern: pattern }); + + this.debug('matchOne', file.length, pattern.length); + + for (var fi = 0, pi = 0, fl = file.length, pl = pattern.length; fi < fl && pi < pl; fi++, pi++) { + this.debug('matchOne loop'); + var p = pattern[pi]; + var f = file[fi]; + + this.debug(pattern, p, f); + + // should be impossible. + // some invalid regexp stuff in the set. + if (p === false) return false; + + if (p === GLOBSTAR) { + this.debug('GLOBSTAR', [pattern, p, f]); + + // "**" + // a/**/b/**/c would match the following: + // a/b/x/y/z/c + // a/x/y/z/b/c + // a/b/x/b/x/c + // a/b/c + // To do this, take the rest of the pattern after + // the **, and see if it would match the file remainder. + // If so, return success. + // If not, the ** "swallows" a segment, and try again. + // This is recursively awful. + // + // a/**/b/**/c matching a/b/x/y/z/c + // - a matches a + // - doublestar + // - matchOne(b/x/y/z/c, b/**/c) + // - b matches b + // - doublestar + // - matchOne(x/y/z/c, c) -> no + // - matchOne(y/z/c, c) -> no + // - matchOne(z/c, c) -> no + // - matchOne(c, c) yes, hit + var fr = fi; + var pr = pi + 1; + if (pr === pl) { + this.debug('** at the end'); + // a ** at the end will just swallow the rest. + // We have found a match. + // however, it will not swallow /.x, unless + // options.dot is set. + // . and .. are *never* matched by **, for explosively + // exponential reasons. + for (; fi < fl; fi++) { + if (file[fi] === '.' || file[fi] === '..' || !options.dot && file[fi].charAt(0) === '.') return false; + } + return true; + } + + // ok, let's see if we can swallow whatever we can. + while (fr < fl) { + var swallowee = file[fr]; + + this.debug('\nglobstar while', file, fr, pattern, pr, swallowee); + + // XXX remove this slice. Just pass the start index. + if (this.matchOne(file.slice(fr), pattern.slice(pr), partial)) { + this.debug('globstar found match!', fr, fl, swallowee); + // found a match. + return true; + } else { + // can't swallow "." or ".." ever. + // can only swallow ".foo" when explicitly asked. + if (swallowee === '.' || swallowee === '..' || !options.dot && swallowee.charAt(0) === '.') { + this.debug('dot detected!', file, fr, pattern, pr); + break; + } + + // ** swallows a segment, and continue. + this.debug('globstar swallow a segment, and continue'); + fr++; + } + } + + // no match was found. + // However, in partial mode, we can't say this is necessarily over. + // If there's more *pattern* left, then + if (partial) { + // ran out of file + this.debug('\n>>> no match, partial?', file, fr, pattern, pr); + if (fr === fl) return true; + } + return false; + } + + // something other than ** + // non-magic patterns just have to match exactly + // patterns with magic have been turned into regexps. + var hit; + if (typeof p === 'string') { + if (options.nocase) { + hit = f.toLowerCase() === p.toLowerCase(); + } else { + hit = f === p; + } + this.debug('string match', p, f, hit); + } else { + hit = f.match(p); + this.debug('pattern match', p, f, hit); + } + + if (!hit) return false; + } + + // Note: ending in / means that we'll get a final "" + // at the end of the pattern. This can only match a + // corresponding "" at the end of the file. + // If the file ends in /, then it can only match a + // a pattern that ends in /, unless the pattern just + // doesn't have any more for it. But, a/b/ should *not* + // match "a/b/*", even though "" matches against the + // [^/]*? pattern, except in partial mode, where it might + // simply not be reached yet. + // However, a/b/ should still satisfy a/* + + // now either we fell off the end of the pattern, or we're done. + if (fi === fl && pi === pl) { + // ran out of pattern and filename at the same time. + // an exact hit! + return true; + } else if (fi === fl) { + // ran out of file, but still had pattern left. + // this is ok if we're doing the match as part of + // a glob fs traversal. + return partial; + } else if (pi === pl) { + // ran out of pattern, still have file left. + // this is only acceptable if we're on the very last + // empty segment of a file with a trailing slash. + // a/* should match a/b/ + var emptyFileEnd = fi === fl - 1 && file[fi] === ''; + return emptyFileEnd; + } + + // should be unreachable. + throw new Error('wtf?'); + }; + + // replace stuff like \* with * + function globUnescape(s) { + return s.replace(/\\(.)/g, '$1'); + } + + function regExpEscape(s) { + return s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&'); + } + + console.log("=== PureRead: Beautify load ==="); + + /** + * Beautify html + * + * @param {string} storage.current.site.name + */ + function specbeautify(name, $target) { + switch (name) { + case "sspai.com": + //TO-DO + $target.find(".relation-apps").remove(); + $target.find(".ss-app-card").remove(); + break; + case "post.smzdm.com": + $target.find("img.face").addClass("sr-rd-content-nobeautify"); + $target.find(".insert-outer img").addClass("sr-rd-content-nobeautify"); + break; + case "infoq.com": + $target.find("img").map(function (index, item) { + if ($(item).css("float") == "left") { + $(item).addClass("sr-rd-content-nobeautify"); + } + }); + $target.find("script").remove(); + break; + case "appinn.com": + $target.find(".emoji").addClass("sr-rd-content-nobeautify"); + break; + case "hacpai.com": + $target.find(".emoji").addClass("sr-rd-content-nobeautify"); + break; + case "douban.com": + $target.find(".review-content").children().unwrap(); + $target.find("table").addClass("sr-rd-content-center"); + $target.find("p").css({ "white-space": "pre-wrap" }); + $target.find(".cc").removeClass(); + break; + case "qdaily.com": + $target.find("img").map(function (index, item) { + var $target = $(item), + height = Number.parseInt($target.css("height")); + if (height == 0) $target.remove(); + }); + $target.find(".com-insert-images").map(function (index, item) { + var $target = $(item), + imgs = $target.find("img").map(function (index, item) { + return "
" + item.outerHTML + "
"; + }), + str = imgs.get().join(""); + $target.empty().removeAttr("class").append(str); + }); + $target.find(".com-insert-embed").remove(); + break; + case "news.mtime.com": + $target.find(".newspictool").map(function (index, item) { + var $target = $(item), + $img = $target.find("img"), + $label = $target.find("p:last"); + $target.removeAttr("class").addClass("sr-rd-content-center").empty().append($img).append($label); + }); + break; + case "blog.csdn.net": + $target.find(".save_code").remove(); + $target.find(".pre-numbering").remove(); + $target.find("pre").removeAttr("style").removeAttr("class"); + $target.find("code").removeAttr("style"); + $target.find(".dp-highlighter").map(function (index, item) { + $(item).find(".bar .tools").remove(); + if ($(item).next().is("pre")) $(item).next().remove(); + }); + break; + case "news.sohu.com": + $target.find(".conserve-photo").remove(); + $target.find("table").addClass("sr-rd-content-center"); + break; + case "qq.com": + $target.find(".rv-root-v2, #backqqcom").remove(); + break; + case "azofreeware.com": + $target.find("iframe").remove(); + break; + case "apprcn.com": + $target.find("img").map(function (index, item) { + var $target = $(item), + src = $target.attr("src"); + if (src && src.includes("Apprcn_Wechat_Small.jpeg")) $target.parent().remove(); + }); + $target.find("a").map(function (index, item) { + var $target = $(item), + text = $target.text(); + if (text == "来自反斗软件") $target.parent().remove(); + }); + break; + case "tieba.baidu.com": + $target.find(".BDE_Smiley").addClass("sr-rd-content-nobeautify"); + $target.find(".replace_div").removeAttr("class").removeAttr("style"); + $target.find(".replace_tip").remove(); + $target.find(".d_post_content, .j_d_post_content, .post_bubble_top, .post_bubble_middle, .post_bubble_bottom").map(function (idx, target) { + $(target).removeAttr("class").removeAttr("style"); + }); + $("body").find(".p_author_face").map(function (idx, target) { + var $target = $(target).find("img"), + src = $target.attr("data-tb-lazyload"), + name = $target.attr("username"); + src && $("sr-rd-mult-avatar").find("span").map(function (idx, span) { + var $span = $(span), + text = $span.text(); + if (text == name) { + $span.parent().find("img").attr("src", src); + } + }); + }); + break; + case "jingyan.baidu.com": + $target.find(".exp-image-wraper").removeAttr("class").removeAttr("href"); + break; + case "question.zhihu.com": + $target.find(".zu-edit-button").remove(); + $target.find("a.external").map(function (idx, target) { + $(target).removeAttr("class").attr("style", "border: none;"); + }); + $target.find(".VagueImage").map(function (idx, target) { + var $target = $(target), + src = $target.attr("data-src"); + $target.replaceWith(""); + }); + break; + case "chiphell.com": + $target.find("img").map(function (index, item) { + var $target = $(item), + $parent = $target.parent(), + src = $target.attr("src"), + smilieid = $target.attr("smilieid"); + if ($parent.is("ignore_js_op")) $target.unwrap(); + smilieid && src && src.includes("static/image/smiley") && $target.addClass("sr-rd-content-nobeautify").attr("style", "width: 50px;"); + }); + $target.find(".quote").remove(); + break; + case "jiemian.com": + $target.find("script").remove(); + break; + case "36kr.com": + $target.find(".load-html-img").removeAttr("class"); + break; + case "cnblogs.com": + $target.find(".cnblogs_code").removeClass(); + $target.find(".cnblogs_code_hide").removeClass().removeAttr("style"); + $target.find(".cnblogs_code_toolbar").remove(); + $target.find(".code_img_opened").remove(); + $target.find(".code_img_closed").remove(); + break; + case "news.cnblogs.com": + $target.find(".topic_img").remove(); + break; + case "g-cores.com": + $target.find(".swiper-slide-active").find("img").map(function (index, item) { + var $target = $(item); + $target.parent().parent().parent().parent().parent().parent().removeAttr("class").removeAttr("style").html($target); + }); + break; + case "feng.com": + $target.find("span").removeAttr("style"); + break; + case "young.ifeng.com": + $target.find("span").removeAttr("style"); + break; + case "ftchinese.com": + $target.find("script").remove(); + break; + case "segmentfault.com": + $target.find(".widget-codetool").remove(); + break; + case "mp.weixin.qq.com": + $target.find('section[powered-by="xiumi.us"]').find("img").map(function (index, item) { + var $target = $(item), + src = $target.attr("data-src"); + $target.addClass("sr-rd-content-nobeautify").attr("src", src); + }); + break; + case "ruby-china.org": + $target.find(".twemoji").remove(); + break; + case "w3cplus.com": + $target.find("iframe").addClass("sr-rd-content-nobeautify"); + break; + case "zuojj.com": + $target.find(".syntaxhighlighter .Brush").attr("style", "font-size: .7em !important;"); + break; + case "aotu.io": + $target.find(".highlight table").map(function (index, item) { + var $target = $(item), + $pre = $target.find("pre"), + $table = $target.find("table"); + $target.html($pre[1]); + $table.unwrap(); + }); + $target.find("table").addClass("sr-rd-content-center"); + break; + case "colobu.com": + $target.find(".highlight table").map(function (index, item) { + var $target = $(item), + $pre = $target.find("pre"); + $target.html($pre[1]); + $target.unwrap(); + }); + break; + case "hao.caibaojian.com": + $target.find(".tlink").map(function (index, item) { + var $target = $(item); + $target.html(""); + }); + break; + case "wkee.net": + $target.find("script").remove(); + break; + case "linux.cn": + $target.find("pre").attr("style", "background-color: #161b20; background-image: none;"); + $target.find("code").attr("style", "background-color: transparent; background-image: none;"); + break; + case "zhuanlan.zhihu.com": + $target.find("div[data-src]").map(function (index, item) { + var $target = $(item), + src = $target.attr("data-src"); + $target.replaceWith("
"); + }); + break; + case "jianshu.com": + $target.find(".image-package").map(function (index, item) { + var $target = $(item), + $div = $target.find("img"); + $target.html($div); + }); + break; + case "medium.com": + $target.find("figure").map(function (index, item) { + var $target = $(item), + $img = $target.find("img"); + $target.replaceWith("
"); + }); + break; + case "worldcup.fifa.com": + $target.find("iframe").css({ width: "790px", height: "450px" }); + $target.find("div").removeClass(); + break; + } + } + + /** + * Remove spare tag + * + * @param {string} storage.current.site.name + * @param {jquery} jquery object + */ + function removeSpareTag(name, $target) { + var remove = false, + tag = ""; + + if (["lib.csdn.net", "huxiu.com", "my.oschina.net", "caixin.com", "163.com", "steachs.com", "hacpai.com", "apprcn.com", "mp.weixin.qq.com"].includes(name)) { + remove = true; + tag = "p"; + } else if (["nationalgeographic.com.cn", "dgtle.com", "news.mtime.com"].includes(name)) { + remove = true; + tag = "div"; + } else if (["chiphell.com"].includes(name)) { + remove = true; + tag = "font"; + } + if (remove) { + $target.find(tag).map(function (index, item) { + var str = $(item).text().toLowerCase().trim(); + if ($(item).find("img").length == 0 && str == "") $(item).remove(); + }); + } + } + + /** + * Beautify html, incldue: + * + * - change all
to + * - remove useless
+ * + * @param {jquery} jquery object + */ + function htmlbeautify($target) { + try { + $target.html(function (index, html) { + return html.trim().replace(/<\/?blockquote/g, function (value) { + return value[1] == "/" ? "\n?
(\n?
)*/g, "
").replace(/\/(div|p)>\n*(
\n)+/g, function (value) { + return value.replace("
", ""); + }); + }); + } catch (error) { + console.error(error); + return $target.html(); + } + } + + /** + * Common Beautify html, include: + * - task: all webiste image, remove old image and create new image + * - task: all webiste sr-blockquote, remove style + * - task: all webiste iframe, embed add center style + * - task: all hr tag add simpread-hidden class + * - task: all pre/code tag remove class + * - task: all a tag remove style + * + * @param {jquery} + */ + function commbeautify(name, $target) { + $target.find("img:not(.sr-rd-content-nobeautify)").map(function (index, item) { + var $target = $(item), + $orgpar = $target.parent(), + $img = $(""), + src = $target.attr("src"), + lazysrc = $target.attr("data-src"), + zuimei = $target.attr("data-original"), + cnbeta = $target.attr("original"), + jianshu = $target.attr("data-original-src"), + sina = $target.attr("real_src"), + fixOverflowImgsize = function fixOverflowImgsize() { + $img.removeClass("sr-rd-content-img-load"); + if ($img[0].clientWidth < 400) { + $img.parent().removeClass("sr-rd-content-center").addClass("sr-rd-content-center-small"); + } else if ($img[0].clientWidth > 1000) { + $img.css("zoom", "0.6"); + } else if ($img[0].clientHeight > 620) { + if (/win|mac/i.test(navigator.platform)) { + $img.attr("height", 620); + if ($img[0].clientWidth < $("sr-rd-content").width()) $img.css({ "width": "auto" }); + } + } + if ($img[0].clientWidth > $("sr-rd-content").width()) $img.addClass("sr-rd-content-img"); + }, + loaderrorHandle = function loaderrorHandle() { + $img.addClass("simpread-hidden"); + if ($img.parent().hasClass("sr-rd-content-center")) { + $img.parent().removeAttr("class").addClass("simpread-hidden"); + } + }, + getImgAbsolutePath2 = function getImgAbsolutePath2(url, base) { + if ('string' !== typeof url || !url) { + return null; + } else if (url.match(/^[a-z]+\:\/\//i)) { + return url; + } else if (url.match(/^\/\//)) { + return 'http:' + url; + } else if (url.match(/^[a-z]+\:/i)) { + return url; + } else if ('string' !== typeof base) { + var a = document.createElement('a');a.href = url;if (!a.pathname) { + return null; + }return 'http://' + url; + } else { + base = getImgAbsolutePath2(base);if (base === null) { + return null; + } + }var a = document.createElement('a');a.href = base;if (url[0] === '/') { + base = []; + } else { + base = a.pathname.split('/');base.pop(); + }url = url.split('/');for (var i = 0; i < url.length; ++i) { + if (url[i] === '.') { + continue; + }if (url[i] === '..') { + if ('undefined' === typeof base.pop() || base.length === 0) { + return null; + } + } else { + base.push(url[i]); + } + }return a.protocol + '//' + a.hostname + base.join('/'); + }; + var newsrc = void 0, + $parent = $target.parent(), + tagname = $parent[0].tagName.toLowerCase(); + + // remove current image and create new image object + newsrc = cnbeta ? cnbeta : src; + newsrc = lazysrc ? lazysrc : newsrc; + newsrc = zuimei ? zuimei : newsrc; + newsrc = jianshu ? jianshu : newsrc; + newsrc = sina ? sina : newsrc; + //newsrc = getImgAbsolutePath( newsrc ); + if (newsrc && !newsrc.startsWith('http') && !newsrc.startsWith('data')) { + newsrc = getImgAbsolutePath2(newsrc, location.href); + } + + // hack code + //location.host.includes( "infoq.com" ) && ( newsrc = src ); + //!newsrc.startsWith( "http" ) && ( newsrc = newsrc.startsWith( "//" ) ? location.protocol + newsrc : location.origin + newsrc ); + + $img.attr("src", newsrc).replaceAll($target).wrap("
"); + if (!/win|mac/i.test(navigator.platform)) { + $img.on("load", function () { + return fixOverflowImgsize(); + }).on("error", function () { + return loaderrorHandle(); + }); + } else { + $img.one("load", function () { + return fixOverflowImgsize(); + }).one("error", function () { + return loaderrorHandle(); + }); + } + }); + $target.find("sr-blockquote").map(function (index, item) { + var $target = $(item), + $parent = $target.parent(); + $target.removeAttr("style").removeAttr("class"); + if (name == "dgtle.com") { + $parent.removeClass("quote"); + } + }); + $target.find("iframe:not(.sr-rd-content-nobeautify), embed:not(.sr-rd-content-nobeautify)").map(function (index, item) { + $(item).wrap("
"); + }); + $target.find("hr").map(function (index, item) { + $(item).addClass("simpread-hidden"); + }); + $target.find("pre").map(function (index, item) { + $(item).find("code").removeAttr("class"); + }); + $target.find("pre").removeAttr("class"); + $target.find("a").removeAttr("style"); + } + + /** + * Clean HTML usage $.parseHTML + * + * @param {jquery} $('sr-rd-content') + * @param {boolean} when true, is remove style, class attr + */ + function cleanHTML($target, is_pure) { + var clear = function clear(str) { + var parse = $.parseHTML(str); + var newHTML = ''; + parse.forEach(function (item, idx) { + var tag = item.tagName, + text = item.outerText, + html = item.outerHTML; + if (tag == undefined) { + newHTML += "

" + item.textContent.replace(/^\n|\n$/ig, "").trim() + "

"; + } else if (tag == "PRE") { + newHTML += "
" + text.replace(//ig, '>') + "
"; + } else if (text == "" && !html.includes('/ig, ''); + /* + const lines = orgHTML.split( '\n' ); + let newLine = ''; + for( let i = 0; i < lines.length; i++ ) { + let str = lines[i]; + if ( !str.trim().startsWith( '<' ) ) { + newLine += `

${str}

` + '\n'; + } else if ( str.trim().length > 0 ) { + newLine += str + '\n'; + } + } + $target.html( clear( newLine ) ); + */ + $target.html(clear(orgHTML)); + is_pure && $target.find('pre code').each(function (idx, item) { + try { + item.outerText = item.outerText.split('\n').filter(function (item) { + return item.trim() != ""; + }).join('\n'); + } catch (error) { + item.outerText = item.outerText; + } + }); + } + + var be = /*#__PURE__*/Object.freeze({ + specbeautify: specbeautify, + removeSpareTag: removeSpareTag, + htmlbeautify: htmlbeautify, + commbeautify: commbeautify, + cleanHTML: cleanHTML + }); + + console.log("=== PureRead: StyleSheet load ==="); + + var bgcolorstyl = "background-color", + bgcls = ".simpread-focus-root"; + + var html_style_bal = "-1"; + + /** + * Get background color value for focus mode + * + * @param {string} background-color, e.g. rgba(235, 235, 235, 0.901961) + * @return {string} e.g. 235, 235, 235 + */ + function getColor(value) { + var arr = value ? value.match(/[0-9]+, /ig) : []; + if (arr.length > 0) { + return arr.join("").replace(/, $/, ""); + } else { + return null; + } + } + /** + * Set focus mode background color for focus mode + * + * @param {string} background color + * @param {number} background opacity + * @return {string} new background color + */ + function backgroundColor(bgcolor, opacity) { + var color = getColor(bgcolor), + newval = "rgba(" + color + ", " + opacity / 100 + ")"; + $(bgcls).css(bgcolorstyl, newval); + return newval; + } + + /** + * Set background opacity for focus mode + * + * @param {string} opacity + * @return {string} new background color or null + */ + function opacity(opacity) { + var bgcolor = $(bgcls).css(bgcolorstyl), + color = getColor(bgcolor), + newval = "rgba(" + color + ", " + opacity / 100 + ")"; + if (color) { + $(bgcls).css(bgcolorstyl, newval); + return newval; + } else { + return null; + } + } + + /** + * Set read mode font family for read mode + * + * @param {string} font family name e.g. PingFang SC; Microsoft Yahei + */ + function fontFamily(family) { + $("sr-read").css("font-family", family == "default" ? "" : family); + } + + /** + * Set read mode font size for read mode + * + * @param {string} font size, e.g. 70% 62.5% + */ + function fontSize(value) { + if (html_style_bal == "-1") { + html_style_bal = $("html").attr("style"); + html_style_bal == undefined && (html_style_bal = ""); + } + value ? $("html").attr("style", "font-size: " + value + "!important;" + html_style_bal) : $("html").attr("style", html_style_bal); + } + + /** + * Set read mode layout width for read mode + * + * @param {string} layout width + */ + function layout(width) { + $("sr-read").css("margin", width ? "20px " + width : ""); + } + + /** + * Add custom css to for read mode + * + * @param {string} read.custom[type] + * @param {object} read.custom + */ + function custom(type, props) { + var format = function format(name) { + return name.replace(/[A-Z]/, function (name) { + return "-" + name.toLowerCase(); + }); + }, + arr = Object.keys(props).map(function (v) { + return props[v] && format(v) + ": " + props[v] + ";"; + }); + var styles = arr.join(""); + switch (type) { + case "title": + styles = "sr-rd-title {" + styles + "}"; + break; + case "desc": + styles = "sr-rd-desc {" + styles + "}"; + break; + case "art": + styles = "sr-rd-content *, sr-rd-content p, sr-rd-content div {" + styles + "}"; + break; + case "pre": + styles = "sr-rd-content pre {" + styles + "}"; + break; + case "code": + styles = "sr-rd-content pre code, sr-rd-content pre code * {" + styles + "}"; + break; + } + + var $target = $("head").find("style#simpread-custom-" + type); + if ($target.length == 0) { + $("head").append(""); + } else { + $target.html(styles); + } + } + + /** + * Add css to for read mode + * + * @param {string} read.custom.css + * @param {object} read.custom.css value + */ + function css(type, styles) { + var $target = $("head").find("style#simpread-custom-" + type); + if ($target.length == 0) { + $("head").append(""); + } else { + $target.html(styles); + } + } + + /** + * Add/Remove current site styles( string ) to head for read mdoe + * + * @param {string} styles + */ + function siteCSS(styles) { + styles ? $("head").append("") : $("#simpread-site-css").remove(); + } + + /** + * Add custom to .preview tag + * + * @param {object} read.custom + * @param {string} theme backgroud color + */ + function preview(styles) { + Object.keys(styles).forEach(function (v) { + v != "css" && custom(v, styles[v]); + }); + css("css", styles["css"]); + } + + /** + * Verify custom is exist + * + * @param {string} verify type + * @param {object} read.custom value + */ + function vfyCustom(type, styles) { + switch (type) { + case "layout": + case "margin": + case "fontfamily": + case "custom": + return styles.css != ""; + case "fontsize": + return styles.title.fontSize != "" || styles.desc.fontSize != "" || styles.art.fontSize != "" || styles.css != ""; + case "theme": + return styles.css.search("simpread-theme-root") != -1; + } + } + + var ss = /*#__PURE__*/Object.freeze({ + GetColor: getColor, + BgColor: backgroundColor, + Opacity: opacity, + FontFamily: fontFamily, + FontSize: fontSize, + Layout: layout, + SiteCSS: siteCSS, + Preview: preview, + Custom: custom, + CSS: css, + VerifyCustom: vfyCustom + }); + + /* + * Copyright (c) 2010 Arc90 Inc + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + /*eslint-env es6:false*/ + /* + * Copyright (c) 2010 Arc90 Inc + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + /* + * This code is heavily based on Arc90's readability.js (1.7.1) script + * available at: http://code.google.com/p/arc90labs-readability + */ + /** + * Public constructor. + * @param {HTMLDocument} doc The document to parse. + * @param {Object} options The options object. + */ + function Readability(a, b) { + if (b && b.documentElement) a = b, b = arguments[2];else if (!a || !a.documentElement) throw new Error("First argument to Readability constructor should be a document object.");b = b || {}, this._doc = a, this._articleTitle = null, this._articleByline = null, this._articleDir = null, this._articleSiteName = null, this._attempts = [], this._debug = !!b.debug, this._maxElemsToParse = b.maxElemsToParse || this.DEFAULT_MAX_ELEMS_TO_PARSE, this._nbTopCandidates = b.nbTopCandidates || this.DEFAULT_N_TOP_CANDIDATES, this._charThreshold = b.charThreshold || this.DEFAULT_CHAR_THRESHOLD, this._classesToPreserve = this.CLASSES_TO_PRESERVE.concat(b.classesToPreserve || []), this._flags = this.FLAG_STRIP_UNLIKELYS | this.FLAG_WEIGHT_CLASSES | this.FLAG_CLEAN_CONDITIONALLY;var c;this._debug ? (c = function c(a) { + var c, + d, + b = a.nodeName + " ";return a.nodeType == a.TEXT_NODE ? b + '("' + a.textContent + '")' : (c = a.className && "." + a.className.replace(/ /g, "."), d = "", a.id ? d = "(#" + a.id + c + ")" : c && (d = "(" + c + ")"), b + d); + }, this.log = function () { + var a, b;"undefined" != typeof dump ? (a = Array.prototype.map.call(arguments, function (a) { + return a && a.nodeName ? c(a) : a; + }).join(" "), dump("Reader: (Readability) " + a + "\n")) : "undefined" != typeof console && (b = ["Reader: (Readability) "].concat(arguments), console.log.apply(console, b)); + }) : this.log = function () {}; + }Readability.prototype = { FLAG_STRIP_UNLIKELYS: 1, FLAG_WEIGHT_CLASSES: 2, FLAG_CLEAN_CONDITIONALLY: 4, ELEMENT_NODE: 1, TEXT_NODE: 3, DEFAULT_MAX_ELEMS_TO_PARSE: 0, DEFAULT_N_TOP_CANDIDATES: 5, DEFAULT_TAGS_TO_SCORE: "section,h2,h3,h4,h5,h6,p,td,pre".toUpperCase().split(","), DEFAULT_CHAR_THRESHOLD: 500, REGEXPS: { unlikelyCandidates: /-ad-|ai2html|banner|breadcrumbs|combx|comment|community|cover-wrap|disqus|extra|foot|gdpr|header|legends|menu|related|remark|replies|rss|shoutbox|sidebar|skyscraper|social|sponsor|supplemental|ad-break|agegate|pagination|pager|popup|yom-remote/i, okMaybeItsACandidate: /and|article|body|column|main|shadow/i, positive: /article|body|content|entry|hentry|h-entry|main|page|pagination|post|text|blog|story/i, negative: /hidden|^hid$| hid$| hid |^hid |banner|combx|comment|com-|contact|foot|footer|footnote|gdpr|masthead|media|meta|outbrain|promo|related|scroll|share|shoutbox|sidebar|skyscraper|sponsor|shopping|tags|tool|widget/i, extraneous: /print|archive|comment|discuss|e[\-]?mail|share|reply|all|login|sign|single|utility/i, byline: /byline|author|dateline|writtenby|p-author/i, replaceFonts: /<(\/?)font[^>]*>/gi, normalize: /\s{2,}/g, videos: /\/\/(www\.)?((dailymotion|youtube|youtube-nocookie|player\.vimeo|v\.qq)\.com|(archive|upload\.wikimedia)\.org|player\.twitch\.tv)/i, nextLink: /(next|weiter|continue|>([^\|]|$)|禄([^\|]|$))/i, prevLink: /(prev|earl|old|new|<|芦)/i, whitespace: /^\s*$/, hasContent: /\S$/ }, DIV_TO_P_ELEMS: ["A", "BLOCKQUOTE", "DL", "DIV", "IMG", "OL", "P", "PRE", "TABLE", "UL", "SELECT"], ALTER_TO_DIV_EXCEPTIONS: ["DIV", "ARTICLE", "SECTION", "P"], PRESENTATIONAL_ATTRIBUTES: ["align", "background", "bgcolor", "border", "cellpadding", "cellspacing", "frame", "hspace", "rules", "style", "valign", "vspace"], DEPRECATED_SIZE_ATTRIBUTE_ELEMS: ["TABLE", "TH", "TD", "HR", "PRE"], PHRASING_ELEMS: ["ABBR", "AUDIO", "B", "BDO", "BR", "BUTTON", "CITE", "CODE", "DATA", "DATALIST", "DFN", "EM", "EMBED", "I", "IMG", "INPUT", "KBD", "LABEL", "MARK", "MATH", "METER", "NOSCRIPT", "OBJECT", "OUTPUT", "PROGRESS", "Q", "RUBY", "SAMP", "SCRIPT", "SELECT", "SMALL", "SPAN", "STRONG", "SUB", "SUP", "TEXTAREA", "TIME", "VAR", "WBR"], CLASSES_TO_PRESERVE: ["page"], _postProcessContent: function _postProcessContent(a) { + this._fixRelativeUris(a), this._cleanClasses(a); + }, _removeNodes: function _removeNodes(a, b) { + var c, d, e;for (c = a.length - 1; c >= 0; c--) { + d = a[c], e = d.parentNode, e && (!b || b.call(this, d, c, a)) && e.removeChild(d); + } + }, _replaceNodeTags: function _replaceNodeTags(a, b) { + var c, d;for (c = a.length - 1; c >= 0; c--) { + d = a[c], this._setNodeTag(d, b); + } + }, _forEachNode: function _forEachNode(a, b) { + Array.prototype.forEach.call(a, b, this); + }, _someNode: function _someNode(a, b) { + return Array.prototype.some.call(a, b, this); + }, _everyNode: function _everyNode(a, b) { + return Array.prototype.every.call(a, b, this); + }, _concatNodeLists: function _concatNodeLists() { + var a = Array.prototype.slice, + b = a.call(arguments), + c = b.map(function (b) { + return a.call(b); + });return Array.prototype.concat.apply([], c); + }, _getAllNodesWithTag: function _getAllNodesWithTag(a, b) { + return a.querySelectorAll ? a.querySelectorAll(b.join(",")) : [].concat.apply([], b.map(function (b) { + var c = a.getElementsByTagName(b);return Array.isArray(c) ? c : Array.from(c); + })); + }, _cleanClasses: function _cleanClasses(a) { + var b = this._classesToPreserve, + c = (a.getAttribute("class") || "").split(/\s+/).filter(function (a) { + return -1 != b.indexOf(a); + }).join(" ");for (c ? a.setAttribute("class", c) : a.removeAttribute("class"), a = a.firstElementChild; a; a = a.nextElementSibling) { + this._cleanClasses(a); + } + }, _fixRelativeUris: function _fixRelativeUris(a) { + function d(a) { + if (b == c && "#" == a.charAt(0)) return a;try { + return new URL(a, b).href; + } catch (d) {}return a; + }var f, + b = this._doc.baseURI, + c = this._doc.documentURI, + e = this._getAllNodesWithTag(a, ["a"]);this._forEachNode(e, function (a) { + var c, + b = a.getAttribute("href");b && (0 === b.indexOf("javascript:") ? (c = this._doc.createTextNode(a.textContent), a.parentNode.replaceChild(c, a)) : a.setAttribute("href", d(b))); + }), f = this._getAllNodesWithTag(a, ["img"]), this._forEachNode(f, function (a) { + var b = a.getAttribute("src");b && a.setAttribute("src", d(b)); + }); + }, _getArticleTitle: function _getArticleTitle() { + function f(a) { + return a.split(/\s+/).length; + }var e, + g, + h, + i, + j, + k, + a = this._doc, + b = "", + c = "";try { + b = c = a.title.trim(), "string" != typeof b && (b = c = this._getInnerText(a.getElementsByTagName("title")[0])); + } catch (d) {}return e = !1, / [\|\-\\\/>禄] /.test(b) ? (e = / [\\\/>禄] /.test(b), b = c.replace(/(.*)[\|\-\\\/>禄] .*/gi, "$1"), f(b) < 3 && (b = c.replace(/[^\|\-\\\/>禄]*[\|\-\\\/>禄](.*)/gi, "$1"))) : -1 !== b.indexOf(": ") ? (g = this._concatNodeLists(a.getElementsByTagName("h1"), a.getElementsByTagName("h2")), h = b.trim(), i = this._someNode(g, function (a) { + return a.textContent.trim() === h; + }), i || (b = c.substring(c.lastIndexOf(":") + 1), f(b) < 3 ? b = c.substring(c.indexOf(":") + 1) : f(c.substr(0, c.indexOf(":"))) > 5 && (b = c))) : (b.length > 150 || b.length < 15) && (j = a.getElementsByTagName("h1"), 1 === j.length && (b = this._getInnerText(j[0]))), b = b.trim().replace(this.REGEXPS.normalize, " "), k = f(b), 4 >= k && (!e || k != f(c.replace(/[\|\-\\\/>禄]+/g, "")) - 1) && (b = c), b; + }, _prepDocument: function _prepDocument() { + var a = this._doc;this._removeNodes(a.getElementsByTagName("style")), a.body && this._replaceBrs(a.body), this._replaceNodeTags(a.getElementsByTagName("font"), "SPAN"); + }, _nextElement: function _nextElement(a) { + for (var b = a; b && b.nodeType != this.ELEMENT_NODE && this.REGEXPS.whitespace.test(b.textContent);) { + b = b.nextSibling; + }return b; + }, _replaceBrs: function _replaceBrs(a) { + this._forEachNode(this._getAllNodesWithTag(a, ["br"]), function (a) { + for (var d, e, f, g, b = a.nextSibling, c = !1; (b = this._nextElement(b)) && "BR" == b.tagName;) { + c = !0, d = b.nextSibling, b.parentNode.removeChild(b), b = d; + }if (c) { + for (e = this._doc.createElement("p"), a.parentNode.replaceChild(e, a), b = e.nextSibling; b && ("BR" != b.tagName || (f = this._nextElement(b.nextSibling), !f || "BR" != f.tagName)) && this._isPhrasingContent(b);) { + g = b.nextSibling, e.appendChild(b), b = g; + }for (; e.lastChild && this._isWhitespace(e.lastChild);) { + e.removeChild(e.lastChild); + }"P" === e.parentNode.tagName && this._setNodeTag(e.parentNode, "DIV"); + } + }); + }, _setNodeTag: function _setNodeTag(a, b) { + var c, d;if (this.log("_setNodeTag", a, b), a.__JSDOMParser__) return a.localName = b.toLowerCase(), a.tagName = b.toUpperCase(), a;for (c = a.ownerDocument.createElement(b); a.firstChild;) { + c.appendChild(a.firstChild); + }for (a.parentNode.replaceChild(c, a), a.readability && (c.readability = a.readability), d = 0; d < a.attributes.length; d++) { + try { + c.setAttribute(a.attributes[d].name, a.attributes[d].value); + } catch (e) {} + }return c; + }, _prepArticle: function _prepArticle(a) { + var b, c, d, e;this._cleanStyles(a), this._markDataTables(a), this._cleanConditionally(a, "form"), this._cleanConditionally(a, "fieldset"), this._clean(a, "object"), this._clean(a, "embed"), this._clean(a, "h1"), this._clean(a, "footer"), this._clean(a, "link"), this._clean(a, "aside"), b = this.DEFAULT_CHAR_THRESHOLD, this._forEachNode(a.children, function (a) { + this._cleanMatchedNodes(a, function (a, c) { + return (/share/.test(c) && a.textContent.length < b + ); + }); + }), c = a.getElementsByTagName("h2"), 1 === c.length && (d = (c[0].textContent.length - this._articleTitle.length) / this._articleTitle.length, Math.abs(d) < .5 && (e = !1, e = d > 0 ? c[0].textContent.includes(this._articleTitle) : this._articleTitle.includes(c[0].textContent), e && this._clean(a, "h2"))), this._clean(a, "iframe"), this._clean(a, "input"), this._clean(a, "textarea"), this._clean(a, "select"), this._clean(a, "button"), this._cleanHeaders(a), this._cleanConditionally(a, "table"), this._cleanConditionally(a, "ul"), this._cleanConditionally(a, "div"), this._removeNodes(a.getElementsByTagName("p"), function (a) { + var b = a.getElementsByTagName("img").length, + c = a.getElementsByTagName("embed").length, + d = a.getElementsByTagName("object").length, + e = a.getElementsByTagName("iframe").length, + f = b + c + d + e;return 0 === f && !this._getInnerText(a, !1); + }), this._forEachNode(this._getAllNodesWithTag(a, ["br"]), function (a) { + var b = this._nextElement(a.nextSibling);b && "P" == b.tagName && a.parentNode.removeChild(a); + }), this._forEachNode(this._getAllNodesWithTag(a, ["table"]), function (a) { + var c, + d, + b = this._hasSingleTagInsideElement(a, "TBODY") ? a.firstElementChild : a;this._hasSingleTagInsideElement(b, "TR") && (c = b.firstElementChild, this._hasSingleTagInsideElement(c, "TD") && (d = c.firstElementChild, d = this._setNodeTag(d, this._everyNode(d.childNodes, this._isPhrasingContent) ? "P" : "DIV"), a.parentNode.replaceChild(d, a))); + }); + }, _initializeNode: function _initializeNode(a) { + switch (a.readability = { contentScore: 0 }, a.tagName) {case "DIV": + a.readability.contentScore += 5;break;case "PRE":case "TD":case "BLOCKQUOTE": + a.readability.contentScore += 3;break;case "ADDRESS":case "OL":case "UL":case "DL":case "DD":case "DT":case "LI":case "FORM": + a.readability.contentScore -= 3;break;case "H1":case "H2":case "H3":case "H4":case "H5":case "H6":case "TH": + a.readability.contentScore -= 5;}a.readability.contentScore += this._getClassWeight(a); + }, _removeAndGetNext: function _removeAndGetNext(a) { + var b = this._getNextNode(a, !0);return a.parentNode.removeChild(a), b; + }, _getNextNode: function _getNextNode(a, b) { + if (!b && a.firstElementChild) return a.firstElementChild;if (a.nextElementSibling) return a.nextElementSibling;do { + a = a.parentNode; + } while (a && !a.nextElementSibling);return a && a.nextElementSibling; + }, _checkByline: function _checkByline(a, b) { + var c, d;return this._articleByline ? !1 : (void 0 !== a.getAttribute && (c = a.getAttribute("rel"), d = a.getAttribute("itemprop")), ("author" === c || d && -1 !== d.indexOf("author") || this.REGEXPS.byline.test(b)) && this._isValidByline(a.textContent) ? (this._articleByline = a.textContent.trim(), !0) : !1); + }, _getNodeAncestors: function _getNodeAncestors(a, b) { + b = b || 0;for (var c = 0, d = []; a.parentNode && (d.push(a.parentNode), !b || ++c !== b);) { + a = a.parentNode; + }return d; + }, _grabArticle: function _grabArticle(a) { + var b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z, A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V;if (this.log("**** grabArticle ****"), b = this._doc, c = null !== a ? !0 : !1, a = a ? a : this._doc.body, !a) return this.log("No body found in document. Abort."), null;for (d = a.innerHTML;;) { + for (e = this._flagIsActive(this.FLAG_STRIP_UNLIKELYS), f = [], g = this._doc.documentElement; g;) { + if (h = g.className + " " + g.id, this._isProbablyVisible(g)) { + if (this._checkByline(g, h)) g = this._removeAndGetNext(g);else if (!e || !this.REGEXPS.unlikelyCandidates.test(h) || this.REGEXPS.okMaybeItsACandidate.test(h) || this._hasAncestorTag(g, "table") || "BODY" === g.tagName || "A" === g.tagName) { + if ("DIV" !== g.tagName && "SECTION" !== g.tagName && "HEADER" !== g.tagName && "H1" !== g.tagName && "H2" !== g.tagName && "H3" !== g.tagName && "H4" !== g.tagName && "H5" !== g.tagName && "H6" !== g.tagName || !this._isElementWithoutContent(g)) { + if (-1 !== this.DEFAULT_TAGS_TO_SCORE.indexOf(g.tagName) && f.push(g), "DIV" === g.tagName) { + for (i = null, j = g.firstChild; j;) { + if (k = j.nextSibling, this._isPhrasingContent(j)) null !== i ? i.appendChild(j) : this._isWhitespace(j) || (i = b.createElement("p"), g.replaceChild(i, j), i.appendChild(j));else if (null !== i) { + for (; i.lastChild && this._isWhitespace(i.lastChild);) { + i.removeChild(i.lastChild); + }i = null; + }j = k; + }this._hasSingleTagInsideElement(g, "P") && this._getLinkDensity(g) < .25 ? (l = g.children[0], g.parentNode.replaceChild(l, g), g = l, f.push(g)) : this._hasChildBlockElement(g) || (g = this._setNodeTag(g, "P"), f.push(g)); + }g = this._getNextNode(g); + } else g = this._removeAndGetNext(g); + } else this.log("Removing unlikely candidate - " + h), g = this._removeAndGetNext(g); + } else this.log("Removing hidden node - " + h), g = this._removeAndGetNext(g); + }for (m = [], this._forEachNode(f, function (a) { + var b, c, d;a.parentNode && "undefined" != typeof a.parentNode.tagName && (b = this._getInnerText(a), b.length < 25 || (c = this._getNodeAncestors(a, 3), 0 !== c.length && (d = 0, d += 1, d += b.split(",").length, d += Math.min(Math.floor(b.length / 100), 3), this._forEachNode(c, function (a, b) { + if (a.tagName && a.parentNode && "undefined" != typeof a.parentNode.tagName) { + if ("undefined" == typeof a.readability && (this._initializeNode(a), m.push(a)), 0 === b) var c = 1;else c = 1 === b ? 2 : 3 * b;a.readability.contentScore += d / c; + } + })))); + }), n = [], o = 0, p = m.length; p > o; o += 1) { + for (q = m[o], r = q.readability.contentScore * (1 - this._getLinkDensity(q)), q.readability.contentScore = r, this.log("Candidate:", q, "with score " + r), s = 0; s < this._nbTopCandidates; s++) { + if (t = n[s], !t || r > t.readability.contentScore) { + n.splice(s, 0, q), n.length > this._nbTopCandidates && n.pop();break; + } + } + }if (u = n[0] || null, v = !1, null === u || "BODY" === u.tagName) { + for (u = b.createElement("DIV"), v = !0, x = a.childNodes; x.length;) { + this.log("Moving child out:", x[0]), u.appendChild(x[0]); + }a.appendChild(u), this._initializeNode(u); + } else if (u) { + for (y = [], z = 1; z < n.length; z++) { + n[z].readability.contentScore / u.readability.contentScore >= .75 && y.push(this._getNodeAncestors(n[z])); + }if (A = 3, y.length >= A) for (w = u.parentNode; "BODY" !== w.tagName;) { + for (B = 0, C = 0; C < y.length && A > B; C++) { + B += Number(y[C].includes(w)); + }if (B >= A) { + u = w;break; + }w = w.parentNode; + }for (u.readability || this._initializeNode(u), w = u.parentNode, D = u.readability.contentScore, E = D / 3; "BODY" !== w.tagName;) { + if (w.readability) { + if (F = w.readability.contentScore, E > F) break;if (F > D) { + u = w;break; + }D = w.readability.contentScore, w = w.parentNode; + } else w = w.parentNode; + }for (w = u.parentNode; "BODY" != w.tagName && 1 == w.children.length;) { + u = w, w = u.parentNode; + }u.readability || this._initializeNode(u); + }for (G = b.createElement("DIV"), c && (G.id = "readability-content"), H = Math.max(10, .2 * u.readability.contentScore), w = u.parentNode, I = w.children, J = 0, K = I.length; K > J; J++) { + L = I[J], M = !1, this.log("Looking at sibling node:", L, L.readability ? "with score " + L.readability.contentScore : ""), this.log("Sibling has score", L.readability ? L.readability.contentScore : "Unknown"), L === u ? M = !0 : (N = 0, L.className === u.className && "" !== u.className && (N += .2 * u.readability.contentScore), L.readability && L.readability.contentScore + N >= H ? M = !0 : "P" === L.nodeName && (O = this._getLinkDensity(L), P = this._getInnerText(L), Q = P.length, Q > 80 && .25 > O ? M = !0 : 80 > Q && Q > 0 && 0 === O && -1 !== P.search(/\.( |$)/) && (M = !0))), M && (this.log("Appending node:", L), -1 === this.ALTER_TO_DIV_EXCEPTIONS.indexOf(L.nodeName) && (this.log("Altering sibling:", L, "to div."), L = this._setNodeTag(L, "DIV")), G.appendChild(L), J -= 1, K -= 1); + }if (this._debug && this.log("Article content pre-prep: " + G.innerHTML), this._prepArticle(G), this._debug && this.log("Article content post-prep: " + G.innerHTML), v) u.id = "readability-page-1", u.className = "page";else { + for (R = b.createElement("DIV"), R.id = "readability-page-1", R.className = "page", S = G.childNodes; S.length;) { + R.appendChild(S[0]); + }G.appendChild(R); + }if (this._debug && this.log("Article content after paging: " + G.innerHTML), T = !0, U = this._getInnerText(G, !0).length, U < this._charThreshold) if (T = !1, a.innerHTML = d, this._flagIsActive(this.FLAG_STRIP_UNLIKELYS)) this._removeFlag(this.FLAG_STRIP_UNLIKELYS), this._attempts.push({ articleContent: G, textLength: U });else if (this._flagIsActive(this.FLAG_WEIGHT_CLASSES)) this._removeFlag(this.FLAG_WEIGHT_CLASSES), this._attempts.push({ articleContent: G, textLength: U });else if (this._flagIsActive(this.FLAG_CLEAN_CONDITIONALLY)) this._removeFlag(this.FLAG_CLEAN_CONDITIONALLY), this._attempts.push({ articleContent: G, textLength: U });else { + if (this._attempts.push({ articleContent: G, textLength: U }), this._attempts.sort(function (a, b) { + return b.textLength - a.textLength; + }), !this._attempts[0].textLength) return null;G = this._attempts[0].articleContent, T = !0; + }if (T) return V = [w, u].concat(this._getNodeAncestors(w)), this._someNode(V, function (a) { + if (!a.tagName) return !1;var b = a.getAttribute("dir");return b ? (this._articleDir = b, !0) : !1; + }), G; + } + }, _isValidByline: function _isValidByline(a) { + return "string" == typeof a || a instanceof String ? (a = a.trim(), a.length > 0 && a.length < 100) : !1; + }, _getArticleMetadata: function _getArticleMetadata() { + var a = {}, + b = {}, + c = this._doc.getElementsByTagName("meta"), + d = /\s*(dc|dcterm|og|twitter)\s*:\s*(author|creator|description|title|site_name)\s*/gi, + e = /^\s*(?:(dc|dcterm|og|twitter|weibo:(article|webpage))\s*[\.:]\s*)?(author|creator|description|title|site_name)\s*$/i;return this._forEachNode(c, function (a) { + var h, + i, + j, + c = a.getAttribute("name"), + f = a.getAttribute("property"), + g = a.getAttribute("content");if (g) { + if (h = null, i = null, f && (h = f.match(d))) for (j = h.length - 1; j >= 0; j--) { + i = h[j].toLowerCase().replace(/\s/g, ""), b[i] = g.trim(); + }!h && c && e.test(c) && (i = c, g && (i = i.toLowerCase().replace(/\s/g, "").replace(/\./g, ":"), b[i] = g.trim())); + } + }), a.title = b["dc:title"] || b["dcterm:title"] || b["og:title"] || b["weibo:article:title"] || b["weibo:webpage:title"] || b["title"] || b["twitter:title"], a.title || (a.title = this._getArticleTitle()), a.byline = b["dc:creator"] || b["dcterm:creator"] || b["author"], a.excerpt = b["dc:description"] || b["dcterm:description"] || b["og:description"] || b["weibo:article:description"] || b["weibo:webpage:description"] || b["description"] || b["twitter:description"], a.siteName = b["og:site_name"], a; + }, _removeScripts: function _removeScripts(a) { + this._removeNodes(a.getElementsByTagName("script"), function (a) { + return a.nodeValue = "", a.removeAttribute("src"), !0; + }), this._removeNodes(a.getElementsByTagName("noscript")); + }, _hasSingleTagInsideElement: function _hasSingleTagInsideElement(a, b) { + return 1 != a.children.length || a.children[0].tagName !== b ? !1 : !this._someNode(a.childNodes, function (a) { + return a.nodeType === this.TEXT_NODE && this.REGEXPS.hasContent.test(a.textContent); + }); + }, _isElementWithoutContent: function _isElementWithoutContent(a) { + return a.nodeType === this.ELEMENT_NODE && 0 == a.textContent.trim().length && (0 == a.children.length || a.children.length == a.getElementsByTagName("br").length + a.getElementsByTagName("hr").length); + }, _hasChildBlockElement: function _hasChildBlockElement(a) { + return this._someNode(a.childNodes, function (a) { + return -1 !== this.DIV_TO_P_ELEMS.indexOf(a.tagName) || this._hasChildBlockElement(a); + }); + }, _isPhrasingContent: function _isPhrasingContent(a) { + return a.nodeType === this.TEXT_NODE || -1 !== this.PHRASING_ELEMS.indexOf(a.tagName) || ("A" === a.tagName || "DEL" === a.tagName || "INS" === a.tagName) && this._everyNode(a.childNodes, this._isPhrasingContent); + }, _isWhitespace: function _isWhitespace(a) { + return a.nodeType === this.TEXT_NODE && 0 === a.textContent.trim().length || a.nodeType === this.ELEMENT_NODE && "BR" === a.tagName; + }, _getInnerText: function _getInnerText(a, b) { + b = "undefined" == typeof b ? !0 : b;var c = a.textContent.trim();return b ? c.replace(this.REGEXPS.normalize, " ") : c; + }, _getCharCount: function _getCharCount(a, b) { + return b = b || ",", this._getInnerText(a).split(b).length - 1; + }, _cleanStyles: function _cleanStyles(a) { + var b, c;if (a && "svg" !== a.tagName.toLowerCase()) { + for (b = 0; b < this.PRESENTATIONAL_ATTRIBUTES.length; b++) { + a.removeAttribute(this.PRESENTATIONAL_ATTRIBUTES[b]); + }for (-1 !== this.DEPRECATED_SIZE_ATTRIBUTE_ELEMS.indexOf(a.tagName) && (a.removeAttribute("width"), a.removeAttribute("height")), c = a.firstElementChild; null !== c;) { + this._cleanStyles(c), c = c.nextElementSibling; + } + } + }, _getLinkDensity: function _getLinkDensity(a) { + var c, + b = this._getInnerText(a).length;return 0 === b ? 0 : (c = 0, this._forEachNode(a.getElementsByTagName("a"), function (a) { + c += this._getInnerText(a).length; + }), c / b); + }, _getClassWeight: function _getClassWeight(a) { + if (!this._flagIsActive(this.FLAG_WEIGHT_CLASSES)) return 0;var b = 0;return "string" == typeof a.className && "" !== a.className && (this.REGEXPS.negative.test(a.className) && (b -= 25), this.REGEXPS.positive.test(a.className) && (b += 25)), "string" == typeof a.id && "" !== a.id && (this.REGEXPS.negative.test(a.id) && (b -= 25), this.REGEXPS.positive.test(a.id) && (b += 25)), b; + }, _clean: function _clean(a, b) { + var c = -1 !== ["object", "embed", "iframe"].indexOf(b);this._removeNodes(a.getElementsByTagName(b), function (a) { + if (c) { + for (var b = 0; b < a.attributes.length; b++) { + if (this.REGEXPS.videos.test(a.attributes[b].value)) return !1; + }if ("object" === a.tagName && this.REGEXPS.videos.test(a.innerHTML)) return !1; + }return !0; + }); + }, _hasAncestorTag: function _hasAncestorTag(a, b, c, d) { + c = c || 3, b = b.toUpperCase();for (var e = 0; a.parentNode;) { + if (c > 0 && e > c) return !1;if (a.parentNode.tagName === b && (!d || d(a.parentNode))) return !0;a = a.parentNode, e++; + }return !1; + }, _getRowAndColumnCount: function _getRowAndColumnCount(a) { + var e, + f, + g, + h, + i, + j, + b = 0, + c = 0, + d = a.getElementsByTagName("tr");for (e = 0; e < d.length; e++) { + for (f = d[e].getAttribute("rowspan") || 0, f && (f = parseInt(f, 10)), b += f || 1, g = 0, h = d[e].getElementsByTagName("td"), i = 0; i < h.length; i++) { + j = h[i].getAttribute("colspan") || 0, j && (j = parseInt(j, 10)), g += j || 1; + }c = Math.max(c, g); + }return { rows: b, columns: c }; + }, _markDataTables: function _markDataTables(a) { + var c, + d, + e, + f, + g, + h, + i, + j, + k, + b = a.getElementsByTagName("table");for (c = 0; c < b.length; c++) { + d = b[c], e = d.getAttribute("role"), "presentation" != e ? (f = d.getAttribute("datatable"), "0" != f ? (g = d.getAttribute("summary"), g ? d._readabilityDataTable = !0 : (h = d.getElementsByTagName("caption")[0], h && h.childNodes.length > 0 ? d._readabilityDataTable = !0 : (i = ["col", "colgroup", "tfoot", "thead", "th"], j = function j(a) { + return !!d.getElementsByTagName(a)[0]; + }, i.some(j) ? (this.log("Data table because found data-y descendant"), d._readabilityDataTable = !0) : d.getElementsByTagName("table")[0] ? d._readabilityDataTable = !1 : (k = this._getRowAndColumnCount(d), d._readabilityDataTable = k.rows >= 10 || k.columns > 4 ? !0 : k.rows * k.columns > 10)))) : d._readabilityDataTable = !1) : d._readabilityDataTable = !1; + } + }, _cleanConditionally: function _cleanConditionally(a, b) { + if (this._flagIsActive(this.FLAG_CLEAN_CONDITIONALLY)) { + var c = "ul" === b || "ol" === b;this._removeNodes(a.getElementsByTagName(b), function (a) { + var e, + f, + g, + h, + i, + j, + k, + l, + m, + n, + o, + p, + q, + d = function d(a) { + return a._readabilityDataTable; + };if ("table" === b && d(a)) return !1;if (this._hasAncestorTag(a, "table", -1, d)) return !1;if (e = this._getClassWeight(a), f = 0, this.log("Cleaning Conditionally", a), 0 > e + f) return !0;if (this._getCharCount(a, ",") < 10) { + for (g = a.getElementsByTagName("p").length, h = a.getElementsByTagName("img").length, i = a.getElementsByTagName("li").length - 100, j = a.getElementsByTagName("input").length, k = 0, l = this._concatNodeLists(a.getElementsByTagName("object"), a.getElementsByTagName("embed"), a.getElementsByTagName("iframe")), m = 0; m < l.length; m++) { + for (n = 0; n < l[m].attributes.length; n++) { + if (this.REGEXPS.videos.test(l[m].attributes[n].value)) return !1; + }if ("object" === l[m].tagName && this.REGEXPS.videos.test(l[m].innerHTML)) return !1;k++; + }return o = this._getLinkDensity(a), p = this._getInnerText(a).length, q = h > 1 && .5 > g / h && !this._hasAncestorTag(a, "figure") || !c && i > g || j > Math.floor(g / 3) || !c && 25 > p && (0 === h || h > 2) && !this._hasAncestorTag(a, "figure") || !c && 25 > e && o > .2 || e >= 25 && o > .5 || 1 === k && 75 > p || k > 1; + }return !1; + }); + } + }, _cleanMatchedNodes: function _cleanMatchedNodes(a, b) { + for (var c = this._getNextNode(a, !0), d = this._getNextNode(a); d && d != c;) { + d = b(d, d.className + " " + d.id) ? this._removeAndGetNext(d) : this._getNextNode(d); + } + }, _cleanHeaders: function _cleanHeaders(a) { + for (var b = 1; 3 > b; b += 1) { + this._removeNodes(a.getElementsByTagName("h" + b), function (a) { + return this._getClassWeight(a) < 0; + }); + } + }, _flagIsActive: function _flagIsActive(a) { + return (this._flags & a) > 0; + }, _removeFlag: function _removeFlag(a) { + this._flags = this._flags & ~a; + }, _isProbablyVisible: function _isProbablyVisible(a) { + return !(a.style && "none" == a.style.display || a.hasAttribute("hidden")); + }, parse: function parse() { + var a, b, c, d, e;if (this._maxElemsToParse > 0 && (a = this._doc.getElementsByTagName("*").length, a > this._maxElemsToParse)) throw new Error("Aborting parsing document; " + a + " elements found");return this._removeScripts(this._doc), this._prepDocument(), b = this._getArticleMetadata(), this._articleTitle = b.title, (c = this._grabArticle()) ? (this.log("Grabbed: " + c.innerHTML), this._postProcessContent(c), b.excerpt || (d = c.getElementsByTagName("p"), d.length > 0 && (b.excerpt = d[0].textContent.trim())), e = c.textContent, { title: this._articleTitle, byline: b.byline || this._articleByline, dir: this._articleDir, content: c.innerHTML, textContent: e, length: e.length, excerpt: b.excerpt, siteName: b.siteName || this._articleSiteName }) : null; + } }; + + var rda = /*#__PURE__*/Object.freeze({ + Readability: Readability + }); + + var showdown_min = createCommonjsModule(function (module) { + /*! showdown v 1.9.0 - 10-11-2018 */ + (function () { + function e(e) { + var r = { omitExtraWLInCodeBlocks: { defaultValue: !1, describe: "Omit the default extra whiteline added to code blocks", type: "boolean" }, noHeaderId: { defaultValue: !1, describe: "Turn on/off generated header id", type: "boolean" }, prefixHeaderId: { defaultValue: !1, describe: "Add a prefix to the generated header ids. Passing a string will prefix that string to the header id. Setting to true will add a generic 'section-' prefix", type: "string" }, rawPrefixHeaderId: { defaultValue: !1, describe: 'Setting this option to true will prevent showdown from modifying the prefix. This might result in malformed IDs (if, for instance, the " char is used in the prefix)', type: "boolean" }, ghCompatibleHeaderId: { defaultValue: !1, describe: "Generate header ids compatible with github style (spaces are replaced with dashes, a bunch of non alphanumeric chars are removed)", type: "boolean" }, rawHeaderId: { defaultValue: !1, describe: "Remove only spaces, ' and \" from generated header ids (including prefixes), replacing them with dashes (-). WARNING: This might result in malformed ids", type: "boolean" }, headerLevelStart: { defaultValue: !1, describe: "The header blocks level start", type: "integer" }, parseImgDimensions: { defaultValue: !1, describe: "Turn on/off image dimension parsing", type: "boolean" }, simplifiedAutoLink: { defaultValue: !1, describe: "Turn on/off GFM autolink style", type: "boolean" }, excludeTrailingPunctuationFromURLs: { defaultValue: !1, describe: "Excludes trailing punctuation from links generated with autoLinking", type: "boolean" }, literalMidWordUnderscores: { defaultValue: !1, describe: "Parse midword underscores as literal underscores", type: "boolean" }, literalMidWordAsterisks: { defaultValue: !1, describe: "Parse midword asterisks as literal asterisks", type: "boolean" }, strikethrough: { defaultValue: !1, describe: "Turn on/off strikethrough support", type: "boolean" }, tables: { defaultValue: !1, describe: "Turn on/off tables support", type: "boolean" }, tablesHeaderId: { defaultValue: !1, describe: "Add an id to table headers", type: "boolean" }, ghCodeBlocks: { defaultValue: !0, describe: "Turn on/off GFM fenced code blocks support", type: "boolean" }, tasklists: { defaultValue: !1, describe: "Turn on/off GFM tasklist support", type: "boolean" }, smoothLivePreview: { defaultValue: !1, describe: "Prevents weird effects in live previews due to incomplete input", type: "boolean" }, smartIndentationFix: { defaultValue: !1, description: "Tries to smartly fix indentation in es6 strings", type: "boolean" }, disableForced4SpacesIndentedSublists: { defaultValue: !1, description: "Disables the requirement of indenting nested sublists by 4 spaces", type: "boolean" }, simpleLineBreaks: { defaultValue: !1, description: "Parses simple line breaks as
(GFM Style)", type: "boolean" }, requireSpaceBeforeHeadingText: { defaultValue: !1, description: "Makes adding a space between `#` and the header text mandatory (GFM Style)", type: "boolean" }, ghMentions: { defaultValue: !1, description: "Enables github @mentions", type: "boolean" }, ghMentionsLink: { defaultValue: "https://github.com/{u}", description: "Changes the link generated by @mentions. Only applies if ghMentions option is enabled.", type: "string" }, encodeEmails: { defaultValue: !0, description: "Encode e-mail addresses through the use of Character Entities, transforming ASCII e-mail addresses into its equivalent decimal entities", type: "boolean" }, openLinksInNewWindow: { defaultValue: !1, description: "Open all links in new windows", type: "boolean" }, backslashEscapesHTMLTags: { defaultValue: !1, description: "Support for HTML Tag escaping. ex:
foo
", type: "boolean" }, emoji: { defaultValue: !1, description: "Enable emoji support. Ex: `this is a :smile: emoji`", type: "boolean" }, underline: { defaultValue: !1, description: "Enable support for underline. Syntax is double or triple underscores: `__underline word__`. With this option enabled, underscores no longer parses into `` and ``", type: "boolean" }, completeHTMLDocument: { defaultValue: !1, description: "Outputs a complete html document, including ``, `` and `` tags", type: "boolean" }, metadata: { defaultValue: !1, description: "Enable support for document metadata (defined at the top of the document between `«««` and `»»»` or between `---` and `---`).", type: "boolean" }, splitAdjacentBlockquotes: { defaultValue: !1, description: "Split adjacent blockquote blocks", type: "boolean" } };if (!1 === e) return JSON.parse(JSON.stringify(r));var t = {};for (var a in r) { + r.hasOwnProperty(a) && (t[a] = r[a].defaultValue); + }return t; + }function r(e, r) { + var t = r ? "Error in " + r + " extension->" : "Error in unnamed extension", + n = { valid: !0, error: "" };a.helper.isArray(e) || (e = [e]);for (var s = 0; s < e.length; ++s) { + var o = t + " sub-extension " + s + ": ", + i = e[s];if ("object" != (typeof i === "undefined" ? "undefined" : _typeof(i))) return n.valid = !1, n.error = o + "must be an object, but " + (typeof i === "undefined" ? "undefined" : _typeof(i)) + " given", n;if (!a.helper.isString(i.type)) return n.valid = !1, n.error = o + 'property "type" must be a string, but ' + _typeof(i.type) + " given", n;var l = i.type = i.type.toLowerCase();if ("language" === l && (l = i.type = "lang"), "html" === l && (l = i.type = "output"), "lang" !== l && "output" !== l && "listener" !== l) return n.valid = !1, n.error = o + "type " + l + ' is not recognized. Valid values: "lang/language", "output/html" or "listener"', n;if ("listener" === l) { + if (a.helper.isUndefined(i.listeners)) return n.valid = !1, n.error = o + '. Extensions of type "listener" must have a property called "listeners"', n; + } else if (a.helper.isUndefined(i.filter) && a.helper.isUndefined(i.regex)) return n.valid = !1, n.error = o + l + ' extensions must define either a "regex" property or a "filter" method', n;if (i.listeners) { + if ("object" != _typeof(i.listeners)) return n.valid = !1, n.error = o + '"listeners" property must be an object but ' + _typeof(i.listeners) + " given", n;for (var c in i.listeners) { + if (i.listeners.hasOwnProperty(c) && "function" != typeof i.listeners[c]) return n.valid = !1, n.error = o + '"listeners" property must be an hash of [event name]: [callback]. listeners.' + c + " must be a function but " + _typeof(i.listeners[c]) + " given", n; + } + }if (i.filter) { + if ("function" != typeof i.filter) return n.valid = !1, n.error = o + '"filter" must be a function, but ' + _typeof(i.filter) + " given", n; + } else if (i.regex) { + if (a.helper.isString(i.regex) && (i.regex = new RegExp(i.regex, "g")), !(i.regex instanceof RegExp)) return n.valid = !1, n.error = o + '"regex" property must either be a string or a RegExp object, but ' + _typeof(i.regex) + " given", n;if (a.helper.isUndefined(i.replace)) return n.valid = !1, n.error = o + '"regex" extensions must implement a replace string or function', n; + } + }return n; + }function t(e, r) { + return "¨E" + r.charCodeAt(0) + "E"; + }var a = {}, + n = {}, + s = {}, + o = e(!0), + i = "vanilla", + l = { github: { omitExtraWLInCodeBlocks: !0, simplifiedAutoLink: !0, excludeTrailingPunctuationFromURLs: !0, literalMidWordUnderscores: !0, strikethrough: !0, tables: !0, tablesHeaderId: !0, ghCodeBlocks: !0, tasklists: !0, disableForced4SpacesIndentedSublists: !0, simpleLineBreaks: !0, requireSpaceBeforeHeadingText: !0, ghCompatibleHeaderId: !0, ghMentions: !0, backslashEscapesHTMLTags: !0, emoji: !0, splitAdjacentBlockquotes: !0 }, original: { noHeaderId: !0, ghCodeBlocks: !1 }, ghost: { omitExtraWLInCodeBlocks: !0, parseImgDimensions: !0, simplifiedAutoLink: !0, excludeTrailingPunctuationFromURLs: !0, literalMidWordUnderscores: !0, strikethrough: !0, tables: !0, tablesHeaderId: !0, ghCodeBlocks: !0, tasklists: !0, smoothLivePreview: !0, simpleLineBreaks: !0, requireSpaceBeforeHeadingText: !0, ghMentions: !1, encodeEmails: !0 }, vanilla: e(!0), allOn: function () { + var r = e(!0), + t = {};for (var a in r) { + r.hasOwnProperty(a) && (t[a] = !0); + }return t; + }() };a.helper = {}, a.extensions = {}, a.setOption = function (e, r) { + return o[e] = r, this; + }, a.getOption = function (e) { + return o[e]; + }, a.getOptions = function () { + return o; + }, a.resetOptions = function () { + o = e(!0); + }, a.setFlavor = function (e) { + if (!l.hasOwnProperty(e)) throw Error(e + " flavor was not found");a.resetOptions();var r = l[e];i = e;for (var t in r) { + r.hasOwnProperty(t) && (o[t] = r[t]); + } + }, a.getFlavor = function () { + return i; + }, a.getFlavorOptions = function (e) { + if (l.hasOwnProperty(e)) return l[e]; + }, a.getDefaultOptions = function (r) { + return e(r); + }, a.subParser = function (e, r) { + if (a.helper.isString(e)) { + if (void 0 === r) { + if (n.hasOwnProperty(e)) return n[e];throw Error("SubParser named " + e + " not registered!"); + }n[e] = r; + } + }, a.extension = function (e, t) { + if (!a.helper.isString(e)) throw Error("Extension 'name' must be a string");if (e = a.helper.stdExtName(e), a.helper.isUndefined(t)) { + if (!s.hasOwnProperty(e)) throw Error("Extension named " + e + " is not registered!");return s[e]; + }"function" == typeof t && (t = t()), a.helper.isArray(t) || (t = [t]);var n = r(t, e);if (!n.valid) throw Error(n.error);s[e] = t; + }, a.getAllExtensions = function () { + return s; + }, a.removeExtension = function (e) { + delete s[e]; + }, a.resetExtensions = function () { + s = {}; + }, a.validateExtension = function (e) { + var t = r(e, null);return !!t.valid || (console.warn(t.error), !1); + }, a.hasOwnProperty("helper") || (a.helper = {}), a.helper.isString = function (e) { + return "string" == typeof e || e instanceof String; + }, a.helper.isFunction = function (e) { + return e && "[object Function]" === {}.toString.call(e); + }, a.helper.isArray = function (e) { + return Array.isArray(e); + }, a.helper.isUndefined = function (e) { + return void 0 === e; + }, a.helper.forEach = function (e, r) { + if (a.helper.isUndefined(e)) throw new Error("obj param is required");if (a.helper.isUndefined(r)) throw new Error("callback param is required");if (!a.helper.isFunction(r)) throw new Error("callback param must be a function/closure");if ("function" == typeof e.forEach) e.forEach(r);else if (a.helper.isArray(e)) for (var t = 0; t < e.length; t++) { + r(e[t], t, e); + } else { + if ("object" != (typeof e === "undefined" ? "undefined" : _typeof(e))) throw new Error("obj does not seem to be an array or an iterable object");for (var n in e) { + e.hasOwnProperty(n) && r(e[n], n, e); + } + } + }, a.helper.stdExtName = function (e) { + return e.replace(/[_?*+\/\\.^-]/g, "").replace(/\s/g, "").toLowerCase(); + }, a.helper.escapeCharactersCallback = t, a.helper.escapeCharacters = function (e, r, a) { + var n = "([" + r.replace(/([\[\]\\])/g, "\\$1") + "])";a && (n = "\\\\" + n);var s = new RegExp(n, "g");return e = e.replace(s, t); + }, a.helper.unescapeHTMLEntities = function (e) { + return e.replace(/"/g, '"').replace(/</g, "<").replace(/>/g, ">").replace(/&/g, "&"); + };var c = function c(e, r, t, a) { + var n, + s, + o, + i, + l, + c = a || "", + u = c.indexOf("g") > -1, + d = new RegExp(r + "|" + t, "g" + c.replace(/g/g, "")), + p = new RegExp(r, c.replace(/g/g, "")), + h = [];do { + for (n = 0; o = d.exec(e);) { + if (p.test(o[0])) n++ || (i = (s = d.lastIndex) - o[0].length);else if (n && ! --n) { + l = o.index + o[0].length;var _ = { left: { start: i, end: s }, match: { start: s, end: o.index }, right: { start: o.index, end: l }, wholeMatch: { start: i, end: l } };if (h.push(_), !u) return h; + } + } + } while (n && (d.lastIndex = s));return h; + };a.helper.matchRecursiveRegExp = function (e, r, t, a) { + for (var n = c(e, r, t, a), s = [], o = 0; o < n.length; ++o) { + s.push([e.slice(n[o].wholeMatch.start, n[o].wholeMatch.end), e.slice(n[o].match.start, n[o].match.end), e.slice(n[o].left.start, n[o].left.end), e.slice(n[o].right.start, n[o].right.end)]); + }return s; + }, a.helper.replaceRecursiveRegExp = function (e, r, t, n, s) { + if (!a.helper.isFunction(r)) { + var o = r;r = function r() { + return o; + }; + }var i = c(e, t, n, s), + l = e, + u = i.length;if (u > 0) { + var d = [];0 !== i[0].wholeMatch.start && d.push(e.slice(0, i[0].wholeMatch.start));for (var p = 0; p < u; ++p) { + d.push(r(e.slice(i[p].wholeMatch.start, i[p].wholeMatch.end), e.slice(i[p].match.start, i[p].match.end), e.slice(i[p].left.start, i[p].left.end), e.slice(i[p].right.start, i[p].right.end))), p < u - 1 && d.push(e.slice(i[p].wholeMatch.end, i[p + 1].wholeMatch.start)); + }i[u - 1].wholeMatch.end < e.length && d.push(e.slice(i[u - 1].wholeMatch.end)), l = d.join(""); + }return l; + }, a.helper.regexIndexOf = function (e, r, t) { + if (!a.helper.isString(e)) throw "InvalidArgumentError: first parameter of showdown.helper.regexIndexOf function must be a string";if (r instanceof RegExp == !1) throw "InvalidArgumentError: second parameter of showdown.helper.regexIndexOf function must be an instance of RegExp";var n = e.substring(t || 0).search(r);return n >= 0 ? n + (t || 0) : n; + }, a.helper.splitAtIndex = function (e, r) { + if (!a.helper.isString(e)) throw "InvalidArgumentError: first parameter of showdown.helper.regexIndexOf function must be a string";return [e.substring(0, r), e.substring(r)]; + }, a.helper.encodeEmailAddress = function (e) { + var r = [function (e) { + return "&#" + e.charCodeAt(0) + ";"; + }, function (e) { + return "&#x" + e.charCodeAt(0).toString(16) + ";"; + }, function (e) { + return e; + }];return e = e.replace(/./g, function (e) { + if ("@" === e) e = r[Math.floor(2 * Math.random())](e);else { + var t = Math.random();e = t > .9 ? r[2](e) : t > .45 ? r[1](e) : r[0](e); + }return e; + }); + }, a.helper.padEnd = function (e, r, t) { + return r >>= 0, t = String(t || " "), e.length > r ? String(e) : ((r -= e.length) > t.length && (t += t.repeat(r / t.length)), String(e) + t.slice(0, r)); + }, "undefined" == typeof console && (console = { warn: function warn(e) { + alert(e); + }, log: function log(e) { + alert(e); + }, error: function error(e) { + throw e; + } }), a.helper.regexes = { asteriskDashAndColon: /([*_:~])/g }, a.helper.emojis = { "+1": "👍", "-1": "👎", 100: "💯", 1234: "🔢", "1st_place_medal": "🥇", "2nd_place_medal": "🥈", "3rd_place_medal": "🥉", "8ball": "🎱", a: "🅰️", ab: "🆎", abc: "🔤", abcd: "🔡", accept: "🉑", aerial_tramway: "🚡", airplane: "✈️", alarm_clock: "⏰", alembic: "⚗️", alien: "👽", ambulance: "🚑", amphora: "🏺", anchor: "⚓️", angel: "👼", anger: "💢", angry: "😠", anguished: "😧", ant: "🐜", apple: "🍎", aquarius: "♒️", aries: "♈️", arrow_backward: "◀️", arrow_double_down: "⏬", arrow_double_up: "⏫", arrow_down: "⬇️", arrow_down_small: "🔽", arrow_forward: "▶️", arrow_heading_down: "⤵️", arrow_heading_up: "⤴️", arrow_left: "⬅️", arrow_lower_left: "↙️", arrow_lower_right: "↘️", arrow_right: "➡️", arrow_right_hook: "↪️", arrow_up: "⬆️", arrow_up_down: "↕️", arrow_up_small: "🔼", arrow_upper_left: "↖️", arrow_upper_right: "↗️", arrows_clockwise: "🔃", arrows_counterclockwise: "🔄", art: "🎨", articulated_lorry: "🚛", artificial_satellite: "🛰", astonished: "😲", athletic_shoe: "👟", atm: "🏧", atom_symbol: "⚛️", avocado: "🥑", b: "🅱️", baby: "👶", baby_bottle: "🍼", baby_chick: "🐤", baby_symbol: "🚼", back: "🔙", bacon: "🥓", badminton: "🏸", baggage_claim: "🛄", baguette_bread: "🥖", balance_scale: "⚖️", balloon: "🎈", ballot_box: "🗳", ballot_box_with_check: "☑️", bamboo: "🎍", banana: "🍌", bangbang: "‼️", bank: "🏦", bar_chart: "📊", barber: "💈", baseball: "⚾️", basketball: "🏀", basketball_man: "⛹️", basketball_woman: "⛹️‍♀️", bat: "🦇", bath: "🛀", bathtub: "🛁", battery: "🔋", beach_umbrella: "🏖", bear: "🐻", bed: "🛏", bee: "🐝", beer: "🍺", beers: "🍻", beetle: "🐞", beginner: "🔰", bell: "🔔", bellhop_bell: "🛎", bento: "🍱", biking_man: "🚴", bike: "🚲", biking_woman: "🚴‍♀️", bikini: "👙", biohazard: "☣️", bird: "🐦", birthday: "🎂", black_circle: "⚫️", black_flag: "🏴", black_heart: "🖤", black_joker: "🃏", black_large_square: "⬛️", black_medium_small_square: "◾️", black_medium_square: "◼️", black_nib: "✒️", black_small_square: "▪️", black_square_button: "🔲", blonde_man: "👱", blonde_woman: "👱‍♀️", blossom: "🌼", blowfish: "🐡", blue_book: "📘", blue_car: "🚙", blue_heart: "💙", blush: "😊", boar: "🐗", boat: "⛵️", bomb: "💣", book: "📖", bookmark: "🔖", bookmark_tabs: "📑", books: "📚", boom: "💥", boot: "👢", bouquet: "💐", bowing_man: "🙇", bow_and_arrow: "🏹", bowing_woman: "🙇‍♀️", bowling: "🎳", boxing_glove: "🥊", boy: "👦", bread: "🍞", bride_with_veil: "👰", bridge_at_night: "🌉", briefcase: "💼", broken_heart: "💔", bug: "🐛", building_construction: "🏗", bulb: "💡", bullettrain_front: "🚅", bullettrain_side: "🚄", burrito: "🌯", bus: "🚌", business_suit_levitating: "🕴", busstop: "🚏", bust_in_silhouette: "👤", busts_in_silhouette: "👥", butterfly: "🦋", cactus: "🌵", cake: "🍰", calendar: "📆", call_me_hand: "🤙", calling: "📲", camel: "🐫", camera: "📷", camera_flash: "📸", camping: "🏕", cancer: "♋️", candle: "🕯", candy: "🍬", canoe: "🛶", capital_abcd: "🔠", capricorn: "♑️", car: "🚗", card_file_box: "🗃", card_index: "📇", card_index_dividers: "🗂", carousel_horse: "🎠", carrot: "🥕", cat: "🐱", cat2: "🐈", cd: "💿", chains: "⛓", champagne: "🍾", chart: "💹", chart_with_downwards_trend: "📉", chart_with_upwards_trend: "📈", checkered_flag: "🏁", cheese: "🧀", cherries: "🍒", cherry_blossom: "🌸", chestnut: "🌰", chicken: "🐔", children_crossing: "🚸", chipmunk: "🐿", chocolate_bar: "🍫", christmas_tree: "🎄", church: "⛪️", cinema: "🎦", circus_tent: "🎪", city_sunrise: "🌇", city_sunset: "🌆", cityscape: "🏙", cl: "🆑", clamp: "🗜", clap: "👏", clapper: "🎬", classical_building: "🏛", clinking_glasses: "🥂", clipboard: "📋", clock1: "🕐", clock10: "🕙", clock1030: "🕥", clock11: "🕚", clock1130: "🕦", clock12: "🕛", clock1230: "🕧", clock130: "🕜", clock2: "🕑", clock230: "🕝", clock3: "🕒", clock330: "🕞", clock4: "🕓", clock430: "🕟", clock5: "🕔", clock530: "🕠", clock6: "🕕", clock630: "🕡", clock7: "🕖", clock730: "🕢", clock8: "🕗", clock830: "🕣", clock9: "🕘", clock930: "🕤", closed_book: "📕", closed_lock_with_key: "🔐", closed_umbrella: "🌂", cloud: "☁️", cloud_with_lightning: "🌩", cloud_with_lightning_and_rain: "⛈", cloud_with_rain: "🌧", cloud_with_snow: "🌨", clown_face: "🤡", clubs: "♣️", cocktail: "🍸", coffee: "☕️", coffin: "⚰️", cold_sweat: "😰", comet: "☄️", computer: "💻", computer_mouse: "🖱", confetti_ball: "🎊", confounded: "😖", confused: "😕", congratulations: "㊗️", construction: "🚧", construction_worker_man: "👷", construction_worker_woman: "👷‍♀️", control_knobs: "🎛", convenience_store: "🏪", cookie: "🍪", cool: "🆒", policeman: "👮", copyright: "©️", corn: "🌽", couch_and_lamp: "🛋", couple: "👫", couple_with_heart_woman_man: "💑", couple_with_heart_man_man: "👨‍❤️‍👨", couple_with_heart_woman_woman: "👩‍❤️‍👩", couplekiss_man_man: "👨‍❤️‍💋‍👨", couplekiss_man_woman: "💏", couplekiss_woman_woman: "👩‍❤️‍💋‍👩", cow: "🐮", cow2: "🐄", cowboy_hat_face: "🤠", crab: "🦀", crayon: "🖍", credit_card: "💳", crescent_moon: "🌙", cricket: "🏏", crocodile: "🐊", croissant: "🥐", crossed_fingers: "🤞", crossed_flags: "🎌", crossed_swords: "⚔️", crown: "👑", cry: "😢", crying_cat_face: "😿", crystal_ball: "🔮", cucumber: "🥒", cupid: "💘", curly_loop: "➰", currency_exchange: "💱", curry: "🍛", custard: "🍮", customs: "🛃", cyclone: "🌀", dagger: "🗡", dancer: "💃", dancing_women: "👯", dancing_men: "👯‍♂️", dango: "🍡", dark_sunglasses: "🕶", dart: "🎯", dash: "💨", date: "📅", deciduous_tree: "🌳", deer: "🦌", department_store: "🏬", derelict_house: "🏚", desert: "🏜", desert_island: "🏝", desktop_computer: "🖥", male_detective: "🕵️", diamond_shape_with_a_dot_inside: "💠", diamonds: "♦️", disappointed: "😞", disappointed_relieved: "😥", dizzy: "💫", dizzy_face: "😵", do_not_litter: "🚯", dog: "🐶", dog2: "🐕", dollar: "💵", dolls: "🎎", dolphin: "🐬", door: "🚪", doughnut: "🍩", dove: "🕊", dragon: "🐉", dragon_face: "🐲", dress: "👗", dromedary_camel: "🐪", drooling_face: "🤤", droplet: "💧", drum: "🥁", duck: "🦆", dvd: "📀", "e-mail": "📧", eagle: "🦅", ear: "👂", ear_of_rice: "🌾", earth_africa: "🌍", earth_americas: "🌎", earth_asia: "🌏", egg: "🥚", eggplant: "🍆", eight_pointed_black_star: "✴️", eight_spoked_asterisk: "✳️", electric_plug: "🔌", elephant: "🐘", email: "✉️", end: "🔚", envelope_with_arrow: "📩", euro: "💶", european_castle: "🏰", european_post_office: "🏤", evergreen_tree: "🌲", exclamation: "❗️", expressionless: "😑", eye: "👁", eye_speech_bubble: "👁‍🗨", eyeglasses: "👓", eyes: "👀", face_with_head_bandage: "🤕", face_with_thermometer: "🤒", fist_oncoming: "👊", factory: "🏭", fallen_leaf: "🍂", family_man_woman_boy: "👪", family_man_boy: "👨‍👦", family_man_boy_boy: "👨‍👦‍👦", family_man_girl: "👨‍👧", family_man_girl_boy: "👨‍👧‍👦", family_man_girl_girl: "👨‍👧‍👧", family_man_man_boy: "👨‍👨‍👦", family_man_man_boy_boy: "👨‍👨‍👦‍👦", family_man_man_girl: "👨‍👨‍👧", family_man_man_girl_boy: "👨‍👨‍👧‍👦", family_man_man_girl_girl: "👨‍👨‍👧‍👧", family_man_woman_boy_boy: "👨‍👩‍👦‍👦", family_man_woman_girl: "👨‍👩‍👧", family_man_woman_girl_boy: "👨‍👩‍👧‍👦", family_man_woman_girl_girl: "👨‍👩‍👧‍👧", family_woman_boy: "👩‍👦", family_woman_boy_boy: "👩‍👦‍👦", family_woman_girl: "👩‍👧", family_woman_girl_boy: "👩‍👧‍👦", family_woman_girl_girl: "👩‍👧‍👧", family_woman_woman_boy: "👩‍👩‍👦", family_woman_woman_boy_boy: "👩‍👩‍👦‍👦", family_woman_woman_girl: "👩‍👩‍👧", family_woman_woman_girl_boy: "👩‍👩‍👧‍👦", family_woman_woman_girl_girl: "👩‍👩‍👧‍👧", fast_forward: "⏩", fax: "📠", fearful: "😨", feet: "🐾", female_detective: "🕵️‍♀️", ferris_wheel: "🎡", ferry: "⛴", field_hockey: "🏑", file_cabinet: "🗄", file_folder: "📁", film_projector: "📽", film_strip: "🎞", fire: "🔥", fire_engine: "🚒", fireworks: "🎆", first_quarter_moon: "🌓", first_quarter_moon_with_face: "🌛", fish: "🐟", fish_cake: "🍥", fishing_pole_and_fish: "🎣", fist_raised: "✊", fist_left: "🤛", fist_right: "🤜", flags: "🎏", flashlight: "🔦", fleur_de_lis: "⚜️", flight_arrival: "🛬", flight_departure: "🛫", floppy_disk: "💾", flower_playing_cards: "🎴", flushed: "😳", fog: "🌫", foggy: "🌁", football: "🏈", footprints: "👣", fork_and_knife: "🍴", fountain: "⛲️", fountain_pen: "🖋", four_leaf_clover: "🍀", fox_face: "🦊", framed_picture: "🖼", free: "🆓", fried_egg: "🍳", fried_shrimp: "🍤", fries: "🍟", frog: "🐸", frowning: "😦", frowning_face: "☹️", frowning_man: "🙍‍♂️", frowning_woman: "🙍", middle_finger: "🖕", fuelpump: "⛽️", full_moon: "🌕", full_moon_with_face: "🌝", funeral_urn: "⚱️", game_die: "🎲", gear: "⚙️", gem: "💎", gemini: "♊️", ghost: "👻", gift: "🎁", gift_heart: "💝", girl: "👧", globe_with_meridians: "🌐", goal_net: "🥅", goat: "🐐", golf: "⛳️", golfing_man: "🏌️", golfing_woman: "🏌️‍♀️", gorilla: "🦍", grapes: "🍇", green_apple: "🍏", green_book: "📗", green_heart: "💚", green_salad: "🥗", grey_exclamation: "❕", grey_question: "❔", grimacing: "😬", grin: "😁", grinning: "😀", guardsman: "💂", guardswoman: "💂‍♀️", guitar: "🎸", gun: "🔫", haircut_woman: "💇", haircut_man: "💇‍♂️", hamburger: "🍔", hammer: "🔨", hammer_and_pick: "⚒", hammer_and_wrench: "🛠", hamster: "🐹", hand: "✋", handbag: "👜", handshake: "🤝", hankey: "💩", hatched_chick: "🐥", hatching_chick: "🐣", headphones: "🎧", hear_no_evil: "🙉", heart: "❤️", heart_decoration: "💟", heart_eyes: "😍", heart_eyes_cat: "😻", heartbeat: "💓", heartpulse: "💗", hearts: "♥️", heavy_check_mark: "✔️", heavy_division_sign: "➗", heavy_dollar_sign: "💲", heavy_heart_exclamation: "❣️", heavy_minus_sign: "➖", heavy_multiplication_x: "✖️", heavy_plus_sign: "➕", helicopter: "🚁", herb: "🌿", hibiscus: "🌺", high_brightness: "🔆", high_heel: "👠", hocho: "🔪", hole: "🕳", honey_pot: "🍯", horse: "🐴", horse_racing: "🏇", hospital: "🏥", hot_pepper: "🌶", hotdog: "🌭", hotel: "🏨", hotsprings: "♨️", hourglass: "⌛️", hourglass_flowing_sand: "⏳", house: "🏠", house_with_garden: "🏡", houses: "🏘", hugs: "🤗", hushed: "😯", ice_cream: "🍨", ice_hockey: "🏒", ice_skate: "⛸", icecream: "🍦", id: "🆔", ideograph_advantage: "🉐", imp: "👿", inbox_tray: "📥", incoming_envelope: "📨", tipping_hand_woman: "💁", information_source: "ℹ️", innocent: "😇", interrobang: "⁉️", iphone: "📱", izakaya_lantern: "🏮", jack_o_lantern: "🎃", japan: "🗾", japanese_castle: "🏯", japanese_goblin: "👺", japanese_ogre: "👹", jeans: "👖", joy: "😂", joy_cat: "😹", joystick: "🕹", kaaba: "🕋", key: "🔑", keyboard: "⌨️", keycap_ten: "🔟", kick_scooter: "🛴", kimono: "👘", kiss: "💋", kissing: "😗", kissing_cat: "😽", kissing_closed_eyes: "😚", kissing_heart: "😘", kissing_smiling_eyes: "😙", kiwi_fruit: "🥝", koala: "🐨", koko: "🈁", label: "🏷", large_blue_circle: "🔵", large_blue_diamond: "🔷", large_orange_diamond: "🔶", last_quarter_moon: "🌗", last_quarter_moon_with_face: "🌜", latin_cross: "✝️", laughing: "😆", leaves: "🍃", ledger: "📒", left_luggage: "🛅", left_right_arrow: "↔️", leftwards_arrow_with_hook: "↩️", lemon: "🍋", leo: "♌️", leopard: "🐆", level_slider: "🎚", libra: "♎️", light_rail: "🚈", link: "🔗", lion: "🦁", lips: "👄", lipstick: "💄", lizard: "🦎", lock: "🔒", lock_with_ink_pen: "🔏", lollipop: "🍭", loop: "➿", loud_sound: "🔊", loudspeaker: "📢", love_hotel: "🏩", love_letter: "💌", low_brightness: "🔅", lying_face: "🤥", m: "Ⓜ️", mag: "🔍", mag_right: "🔎", mahjong: "🀄️", mailbox: "📫", mailbox_closed: "📪", mailbox_with_mail: "📬", mailbox_with_no_mail: "📭", man: "👨", man_artist: "👨‍🎨", man_astronaut: "👨‍🚀", man_cartwheeling: "🤸‍♂️", man_cook: "👨‍🍳", man_dancing: "🕺", man_facepalming: "🤦‍♂️", man_factory_worker: "👨‍🏭", man_farmer: "👨‍🌾", man_firefighter: "👨‍🚒", man_health_worker: "👨‍⚕️", man_in_tuxedo: "🤵", man_judge: "👨‍⚖️", man_juggling: "🤹‍♂️", man_mechanic: "👨‍🔧", man_office_worker: "👨‍💼", man_pilot: "👨‍✈️", man_playing_handball: "🤾‍♂️", man_playing_water_polo: "🤽‍♂️", man_scientist: "👨‍🔬", man_shrugging: "🤷‍♂️", man_singer: "👨‍🎤", man_student: "👨‍🎓", man_teacher: "👨‍🏫", man_technologist: "👨‍💻", man_with_gua_pi_mao: "👲", man_with_turban: "👳", tangerine: "🍊", mans_shoe: "👞", mantelpiece_clock: "🕰", maple_leaf: "🍁", martial_arts_uniform: "🥋", mask: "😷", massage_woman: "💆", massage_man: "💆‍♂️", meat_on_bone: "🍖", medal_military: "🎖", medal_sports: "🏅", mega: "📣", melon: "🍈", memo: "📝", men_wrestling: "🤼‍♂️", menorah: "🕎", mens: "🚹", metal: "🤘", metro: "🚇", microphone: "🎤", microscope: "🔬", milk_glass: "🥛", milky_way: "🌌", minibus: "🚐", minidisc: "💽", mobile_phone_off: "📴", money_mouth_face: "🤑", money_with_wings: "💸", moneybag: "💰", monkey: "🐒", monkey_face: "🐵", monorail: "🚝", moon: "🌔", mortar_board: "🎓", mosque: "🕌", motor_boat: "🛥", motor_scooter: "🛵", motorcycle: "🏍", motorway: "🛣", mount_fuji: "🗻", mountain: "⛰", mountain_biking_man: "🚵", mountain_biking_woman: "🚵‍♀️", mountain_cableway: "🚠", mountain_railway: "🚞", mountain_snow: "🏔", mouse: "🐭", mouse2: "🐁", movie_camera: "🎥", moyai: "🗿", mrs_claus: "🤶", muscle: "💪", mushroom: "🍄", musical_keyboard: "🎹", musical_note: "🎵", musical_score: "🎼", mute: "🔇", nail_care: "💅", name_badge: "📛", national_park: "🏞", nauseated_face: "🤢", necktie: "👔", negative_squared_cross_mark: "❎", nerd_face: "🤓", neutral_face: "😐", new: "🆕", new_moon: "🌑", new_moon_with_face: "🌚", newspaper: "📰", newspaper_roll: "🗞", next_track_button: "⏭", ng: "🆖", no_good_man: "🙅‍♂️", no_good_woman: "🙅", night_with_stars: "🌃", no_bell: "🔕", no_bicycles: "🚳", no_entry: "⛔️", no_entry_sign: "🚫", no_mobile_phones: "📵", no_mouth: "😶", no_pedestrians: "🚷", no_smoking: "🚭", "non-potable_water": "🚱", nose: "👃", notebook: "📓", notebook_with_decorative_cover: "📔", notes: "🎶", nut_and_bolt: "🔩", o: "⭕️", o2: "🅾️", ocean: "🌊", octopus: "🐙", oden: "🍢", office: "🏢", oil_drum: "🛢", ok: "🆗", ok_hand: "👌", ok_man: "🙆‍♂️", ok_woman: "🙆", old_key: "🗝", older_man: "👴", older_woman: "👵", om: "🕉", on: "🔛", oncoming_automobile: "🚘", oncoming_bus: "🚍", oncoming_police_car: "🚔", oncoming_taxi: "🚖", open_file_folder: "📂", open_hands: "👐", open_mouth: "😮", open_umbrella: "☂️", ophiuchus: "⛎", orange_book: "📙", orthodox_cross: "☦️", outbox_tray: "📤", owl: "🦉", ox: "🐂", package: "📦", page_facing_up: "📄", page_with_curl: "📃", pager: "📟", paintbrush: "🖌", palm_tree: "🌴", pancakes: "🥞", panda_face: "🐼", paperclip: "📎", paperclips: "🖇", parasol_on_ground: "⛱", parking: "🅿️", part_alternation_mark: "〽️", partly_sunny: "⛅️", passenger_ship: "🛳", passport_control: "🛂", pause_button: "⏸", peace_symbol: "☮️", peach: "🍑", peanuts: "🥜", pear: "🍐", pen: "🖊", pencil2: "✏️", penguin: "🐧", pensive: "😔", performing_arts: "🎭", persevere: "😣", person_fencing: "🤺", pouting_woman: "🙎", phone: "☎️", pick: "⛏", pig: "🐷", pig2: "🐖", pig_nose: "🐽", pill: "💊", pineapple: "🍍", ping_pong: "🏓", pisces: "♓️", pizza: "🍕", place_of_worship: "🛐", plate_with_cutlery: "🍽", play_or_pause_button: "⏯", point_down: "👇", point_left: "👈", point_right: "👉", point_up: "☝️", point_up_2: "👆", police_car: "🚓", policewoman: "👮‍♀️", poodle: "🐩", popcorn: "🍿", post_office: "🏣", postal_horn: "📯", postbox: "📮", potable_water: "🚰", potato: "🥔", pouch: "👝", poultry_leg: "🍗", pound: "💷", rage: "😡", pouting_cat: "😾", pouting_man: "🙎‍♂️", pray: "🙏", prayer_beads: "📿", pregnant_woman: "🤰", previous_track_button: "⏮", prince: "🤴", princess: "👸", printer: "🖨", purple_heart: "💜", purse: "👛", pushpin: "📌", put_litter_in_its_place: "🚮", question: "❓", rabbit: "🐰", rabbit2: "🐇", racehorse: "🐎", racing_car: "🏎", radio: "📻", radio_button: "🔘", radioactive: "☢️", railway_car: "🚃", railway_track: "🛤", rainbow: "🌈", rainbow_flag: "🏳️‍🌈", raised_back_of_hand: "🤚", raised_hand_with_fingers_splayed: "🖐", raised_hands: "🙌", raising_hand_woman: "🙋", raising_hand_man: "🙋‍♂️", ram: "🐏", ramen: "🍜", rat: "🐀", record_button: "⏺", recycle: "♻️", red_circle: "🔴", registered: "®️", relaxed: "☺️", relieved: "😌", reminder_ribbon: "🎗", repeat: "🔁", repeat_one: "🔂", rescue_worker_helmet: "⛑", restroom: "🚻", revolving_hearts: "💞", rewind: "⏪", rhinoceros: "🦏", ribbon: "🎀", rice: "🍚", rice_ball: "🍙", rice_cracker: "🍘", rice_scene: "🎑", right_anger_bubble: "🗯", ring: "💍", robot: "🤖", rocket: "🚀", rofl: "🤣", roll_eyes: "🙄", roller_coaster: "🎢", rooster: "🐓", rose: "🌹", rosette: "🏵", rotating_light: "🚨", round_pushpin: "📍", rowing_man: "🚣", rowing_woman: "🚣‍♀️", rugby_football: "🏉", running_man: "🏃", running_shirt_with_sash: "🎽", running_woman: "🏃‍♀️", sa: "🈂️", sagittarius: "♐️", sake: "🍶", sandal: "👡", santa: "🎅", satellite: "📡", saxophone: "🎷", school: "🏫", school_satchel: "🎒", scissors: "✂️", scorpion: "🦂", scorpius: "♏️", scream: "😱", scream_cat: "🙀", scroll: "📜", seat: "💺", secret: "㊙️", see_no_evil: "🙈", seedling: "🌱", selfie: "🤳", shallow_pan_of_food: "🥘", shamrock: "☘️", shark: "🦈", shaved_ice: "🍧", sheep: "🐑", shell: "🐚", shield: "🛡", shinto_shrine: "⛩", ship: "🚢", shirt: "👕", shopping: "🛍", shopping_cart: "🛒", shower: "🚿", shrimp: "🦐", signal_strength: "📶", six_pointed_star: "🔯", ski: "🎿", skier: "⛷", skull: "💀", skull_and_crossbones: "☠️", sleeping: "😴", sleeping_bed: "🛌", sleepy: "😪", slightly_frowning_face: "🙁", slightly_smiling_face: "🙂", slot_machine: "🎰", small_airplane: "🛩", small_blue_diamond: "🔹", small_orange_diamond: "🔸", small_red_triangle: "🔺", small_red_triangle_down: "🔻", smile: "😄", smile_cat: "😸", smiley: "😃", smiley_cat: "😺", smiling_imp: "😈", smirk: "😏", smirk_cat: "😼", smoking: "🚬", snail: "🐌", snake: "🐍", sneezing_face: "🤧", snowboarder: "🏂", snowflake: "❄️", snowman: "⛄️", snowman_with_snow: "☃️", sob: "😭", soccer: "⚽️", soon: "🔜", sos: "🆘", sound: "🔉", space_invader: "👾", spades: "♠️", spaghetti: "🍝", sparkle: "❇️", sparkler: "🎇", sparkles: "✨", sparkling_heart: "💖", speak_no_evil: "🙊", speaker: "🔈", speaking_head: "🗣", speech_balloon: "💬", speedboat: "🚤", spider: "🕷", spider_web: "🕸", spiral_calendar: "🗓", spiral_notepad: "🗒", spoon: "🥄", squid: "🦑", stadium: "🏟", star: "⭐️", star2: "🌟", star_and_crescent: "☪️", star_of_david: "✡️", stars: "🌠", station: "🚉", statue_of_liberty: "🗽", steam_locomotive: "🚂", stew: "🍲", stop_button: "⏹", stop_sign: "🛑", stopwatch: "⏱", straight_ruler: "📏", strawberry: "🍓", stuck_out_tongue: "😛", stuck_out_tongue_closed_eyes: "😝", stuck_out_tongue_winking_eye: "😜", studio_microphone: "🎙", stuffed_flatbread: "🥙", sun_behind_large_cloud: "🌥", sun_behind_rain_cloud: "🌦", sun_behind_small_cloud: "🌤", sun_with_face: "🌞", sunflower: "🌻", sunglasses: "😎", sunny: "☀️", sunrise: "🌅", sunrise_over_mountains: "🌄", surfing_man: "🏄", surfing_woman: "🏄‍♀️", sushi: "🍣", suspension_railway: "🚟", sweat: "😓", sweat_drops: "💦", sweat_smile: "😅", sweet_potato: "🍠", swimming_man: "🏊", swimming_woman: "🏊‍♀️", symbols: "🔣", synagogue: "🕍", syringe: "💉", taco: "🌮", tada: "🎉", tanabata_tree: "🎋", taurus: "♉️", taxi: "🚕", tea: "🍵", telephone_receiver: "📞", telescope: "🔭", tennis: "🎾", tent: "⛺️", thermometer: "🌡", thinking: "🤔", thought_balloon: "💭", ticket: "🎫", tickets: "🎟", tiger: "🐯", tiger2: "🐅", timer_clock: "⏲", tipping_hand_man: "💁‍♂️", tired_face: "😫", tm: "™️", toilet: "🚽", tokyo_tower: "🗼", tomato: "🍅", tongue: "👅", top: "🔝", tophat: "🎩", tornado: "🌪", trackball: "🖲", tractor: "🚜", traffic_light: "🚥", train: "🚋", train2: "🚆", tram: "🚊", triangular_flag_on_post: "🚩", triangular_ruler: "📐", trident: "🔱", triumph: "😤", trolleybus: "🚎", trophy: "🏆", tropical_drink: "🍹", tropical_fish: "🐠", truck: "🚚", trumpet: "🎺", tulip: "🌷", tumbler_glass: "🥃", turkey: "🦃", turtle: "🐢", tv: "📺", twisted_rightwards_arrows: "🔀", two_hearts: "💕", two_men_holding_hands: "👬", two_women_holding_hands: "👭", u5272: "🈹", u5408: "🈴", u55b6: "🈺", u6307: "🈯️", u6708: "🈷️", u6709: "🈶", u6e80: "🈵", u7121: "🈚️", u7533: "🈸", u7981: "🈲", u7a7a: "🈳", umbrella: "☔️", unamused: "😒", underage: "🔞", unicorn: "🦄", unlock: "🔓", up: "🆙", upside_down_face: "🙃", v: "✌️", vertical_traffic_light: "🚦", vhs: "📼", vibration_mode: "📳", video_camera: "📹", video_game: "🎮", violin: "🎻", virgo: "♍️", volcano: "🌋", volleyball: "🏐", vs: "🆚", vulcan_salute: "🖖", walking_man: "🚶", walking_woman: "🚶‍♀️", waning_crescent_moon: "🌘", waning_gibbous_moon: "🌖", warning: "⚠️", wastebasket: "🗑", watch: "⌚️", water_buffalo: "🐃", watermelon: "🍉", wave: "👋", wavy_dash: "〰️", waxing_crescent_moon: "🌒", wc: "🚾", weary: "😩", wedding: "💒", weight_lifting_man: "🏋️", weight_lifting_woman: "🏋️‍♀️", whale: "🐳", whale2: "🐋", wheel_of_dharma: "☸️", wheelchair: "♿️", white_check_mark: "✅", white_circle: "⚪️", white_flag: "🏳️", white_flower: "💮", white_large_square: "⬜️", white_medium_small_square: "◽️", white_medium_square: "◻️", white_small_square: "▫️", white_square_button: "🔳", wilted_flower: "🥀", wind_chime: "🎐", wind_face: "🌬", wine_glass: "🍷", wink: "😉", wolf: "🐺", woman: "👩", woman_artist: "👩‍🎨", woman_astronaut: "👩‍🚀", woman_cartwheeling: "🤸‍♀️", woman_cook: "👩‍🍳", woman_facepalming: "🤦‍♀️", woman_factory_worker: "👩‍🏭", woman_farmer: "👩‍🌾", woman_firefighter: "👩‍🚒", woman_health_worker: "👩‍⚕️", woman_judge: "👩‍⚖️", woman_juggling: "🤹‍♀️", woman_mechanic: "👩‍🔧", woman_office_worker: "👩‍💼", woman_pilot: "👩‍✈️", woman_playing_handball: "🤾‍♀️", woman_playing_water_polo: "🤽‍♀️", woman_scientist: "👩‍🔬", woman_shrugging: "🤷‍♀️", woman_singer: "👩‍🎤", woman_student: "👩‍🎓", woman_teacher: "👩‍🏫", woman_technologist: "👩‍💻", woman_with_turban: "👳‍♀️", womans_clothes: "👚", womans_hat: "👒", women_wrestling: "🤼‍♀️", womens: "🚺", world_map: "🗺", worried: "😟", wrench: "🔧", writing_hand: "✍️", x: "❌", yellow_heart: "💛", yen: "💴", yin_yang: "☯️", yum: "😋", zap: "⚡️", zipper_mouth_face: "🤐", zzz: "💤", octocat: ':octocat:', showdown: "S" }, a.Converter = function (e) { + function t(e, t) { + if (t = t || null, a.helper.isString(e)) { + if (e = a.helper.stdExtName(e), t = e, a.extensions[e]) return console.warn("DEPRECATION WARNING: " + e + " is an old extension that uses a deprecated loading method.Please inform the developer that the extension should be updated!"), void function (e, t) { + "function" == typeof e && (e = e(new a.Converter()));a.helper.isArray(e) || (e = [e]);var n = r(e, t);if (!n.valid) throw Error(n.error);for (var s = 0; s < e.length; ++s) { + switch (e[s].type) {case "lang": + u.push(e[s]);break;case "output": + d.push(e[s]);break;default: + throw Error("Extension loader error: Type unrecognized!!!");} + } + }(a.extensions[e], e);if (a.helper.isUndefined(s[e])) throw Error('Extension "' + e + '" could not be loaded. It was either not found or is not a valid extension.');e = s[e]; + }"function" == typeof e && (e = e()), a.helper.isArray(e) || (e = [e]);var o = r(e, t);if (!o.valid) throw Error(o.error);for (var i = 0; i < e.length; ++i) { + switch (e[i].type) {case "lang": + u.push(e[i]);break;case "output": + d.push(e[i]);}if (e[i].hasOwnProperty("listeners")) for (var l in e[i].listeners) { + e[i].listeners.hasOwnProperty(l) && n(l, e[i].listeners[l]); + } + } + }function n(e, r) { + if (!a.helper.isString(e)) throw Error("Invalid argument in converter.listen() method: name must be a string, but " + (typeof e === "undefined" ? "undefined" : _typeof(e)) + " given");if ("function" != typeof r) throw Error("Invalid argument in converter.listen() method: callback must be a function, but " + (typeof r === "undefined" ? "undefined" : _typeof(r)) + " given");p.hasOwnProperty(e) || (p[e] = []), p[e].push(r); + }var c = {}, + u = [], + d = [], + p = {}, + h = i, + _ = { parsed: {}, raw: "", format: "" };!function () { + e = e || {};for (var r in o) { + o.hasOwnProperty(r) && (c[r] = o[r]); + }if ("object" != (typeof e === "undefined" ? "undefined" : _typeof(e))) throw Error("Converter expects the passed parameter to be an object, but " + (typeof e === "undefined" ? "undefined" : _typeof(e)) + " was passed instead.");for (var n in e) { + e.hasOwnProperty(n) && (c[n] = e[n]); + }c.extensions && a.helper.forEach(c.extensions, t); + }(), this._dispatch = function (e, r, t, a) { + if (p.hasOwnProperty(e)) for (var n = 0; n < p[e].length; ++n) { + var s = p[e][n](e, r, this, t, a);s && void 0 !== s && (r = s); + }return r; + }, this.listen = function (e, r) { + return n(e, r), this; + }, this.makeHtml = function (e) { + if (!e) return e;var r = { gHtmlBlocks: [], gHtmlMdBlocks: [], gHtmlSpans: [], gUrls: {}, gTitles: {}, gDimensions: {}, gListLevel: 0, hashLinkCounts: {}, langExtensions: u, outputModifiers: d, converter: this, ghCodeBlocks: [], metadata: { parsed: {}, raw: "", format: "" } };return e = e.replace(/¨/g, "¨T"), e = e.replace(/\$/g, "¨D"), e = e.replace(/\r\n/g, "\n"), e = e.replace(/\r/g, "\n"), e = e.replace(/\u00A0/g, " "), c.smartIndentationFix && (e = function (e) { + var r = e.match(/^\s*/)[0].length, + t = new RegExp("^\\s{0," + r + "}", "gm");return e.replace(t, ""); + }(e)), e = "\n\n" + e + "\n\n", e = a.subParser("detab")(e, c, r), e = e.replace(/^[ \t]+$/gm, ""), a.helper.forEach(u, function (t) { + e = a.subParser("runExtension")(t, e, c, r); + }), e = a.subParser("metadata")(e, c, r), e = a.subParser("hashPreCodeTags")(e, c, r), e = a.subParser("githubCodeBlocks")(e, c, r), e = a.subParser("hashHTMLBlocks")(e, c, r), e = a.subParser("hashCodeTags")(e, c, r), e = a.subParser("stripLinkDefinitions")(e, c, r), e = a.subParser("blockGamut")(e, c, r), e = a.subParser("unhashHTMLSpans")(e, c, r), e = a.subParser("unescapeSpecialChars")(e, c, r), e = e.replace(/¨D/g, "$$"), e = e.replace(/¨T/g, "¨"), e = a.subParser("completeHTMLDocument")(e, c, r), a.helper.forEach(d, function (t) { + e = a.subParser("runExtension")(t, e, c, r); + }), _ = r.metadata, e; + }, this.makeMarkdown = this.makeMd = function (e, r) { + function t(e) { + for (var r = 0; r < e.childNodes.length; ++r) { + var a = e.childNodes[r];3 === a.nodeType ? /\S/.test(a.nodeValue) ? (a.nodeValue = a.nodeValue.split("\n").join(" "), a.nodeValue = a.nodeValue.replace(/(\s)+/g, "$1")) : (e.removeChild(a), --r) : 1 === a.nodeType && t(a); + } + }if (e = e.replace(/\r\n/g, "\n"), e = e.replace(/\r/g, "\n"), e = e.replace(/>[ \t]+¨NBSP;<"), !r) { + if (!window || !window.document) throw new Error("HTMLParser is undefined. If in a webworker or nodejs environment, you need to provide a WHATWG DOM and HTML such as JSDOM");r = window.document; + }var n = r.createElement("div");n.innerHTML = e;var s = { preList: function (e) { + for (var r = e.querySelectorAll("pre"), t = [], n = 0; n < r.length; ++n) { + if (1 === r[n].childElementCount && "code" === r[n].firstChild.tagName.toLowerCase()) { + var s = r[n].firstChild.innerHTML.trim(), + o = r[n].firstChild.getAttribute("data-language") || "";if ("" === o) for (var i = r[n].firstChild.className.split(" "), l = 0; l < i.length; ++l) { + var c = i[l].match(/^language-(.+)$/);if (null !== c) { + o = c[1];break; + } + }s = a.helper.unescapeHTMLEntities(s), t.push(s), r[n].outerHTML = ''; + } else t.push(r[n].innerHTML), r[n].innerHTML = "", r[n].setAttribute("prenum", n.toString()); + }return t; + }(n) };t(n);for (var o = n.childNodes, i = "", l = 0; l < o.length; l++) { + i += a.subParser("makeMarkdown.node")(o[l], s); + }return i; + }, this.setOption = function (e, r) { + c[e] = r; + }, this.getOption = function (e) { + return c[e]; + }, this.getOptions = function () { + return c; + }, this.addExtension = function (e, r) { + t(e, r = r || null); + }, this.useExtension = function (e) { + t(e); + }, this.setFlavor = function (e) { + if (!l.hasOwnProperty(e)) throw Error(e + " flavor was not found");var r = l[e];h = e;for (var t in r) { + r.hasOwnProperty(t) && (c[t] = r[t]); + } + }, this.getFlavor = function () { + return h; + }, this.removeExtension = function (e) { + a.helper.isArray(e) || (e = [e]);for (var r = 0; r < e.length; ++r) { + for (var t = e[r], n = 0; n < u.length; ++n) { + u[n] === t && u[n].splice(n, 1); + }for (; 0 < d.length; ++n) { + d[0] === t && d[0].splice(n, 1); + } + } + }, this.getAllExtensions = function () { + return { language: u, output: d }; + }, this.getMetadata = function (e) { + return e ? _.raw : _.parsed; + }, this.getMetadataFormat = function () { + return _.format; + }, this._setMetadataPair = function (e, r) { + _.parsed[e] = r; + }, this._setMetadataFormat = function (e) { + _.format = e; + }, this._setMetadataRaw = function (e) { + _.raw = e; + }; + }, a.subParser("anchors", function (e, r, t) { + var n = function n(e, _n, s, o, i, l, c) { + if (a.helper.isUndefined(c) && (c = ""), s = s.toLowerCase(), e.search(/\(? ?(['"].*['"])?\)$/m) > -1) o = "";else if (!o) { + if (s || (s = _n.toLowerCase().replace(/ ?\n/g, " ")), o = "#" + s, a.helper.isUndefined(t.gUrls[s])) return e;o = t.gUrls[s], a.helper.isUndefined(t.gTitles[s]) || (c = t.gTitles[s]); + }var u = '"; + };return e = (e = t.converter._dispatch("anchors.before", e, r, t)).replace(/\[((?:\[[^\]]*]|[^\[\]])*)] ?(?:\n *)?\[(.*?)]()()()()/g, n), e = e.replace(/\[((?:\[[^\]]*]|[^\[\]])*)]()[ \t]*\([ \t]?<([^>]*)>(?:[ \t]*((["'])([^"]*?)\5))?[ \t]?\)/g, n), e = e.replace(/\[((?:\[[^\]]*]|[^\[\]])*)]()[ \t]*\([ \t]??(?:[ \t]*((["'])([^"]*?)\5))?[ \t]?\)/g, n), e = e.replace(/\[([^\[\]]+)]()()()()()/g, n), r.ghMentions && (e = e.replace(/(^|\s)(\\)?(@([a-z\d]+(?:[a-z\d.-]+?[a-z\d]+)*))/gim, function (e, t, n, s, o) { + if ("\\" === n) return t + s;if (!a.helper.isString(r.ghMentionsLink)) throw new Error("ghMentionsLink option must be a string");var i = r.ghMentionsLink.replace(/\{u}/g, o), + l = "";return r.openLinksInNewWindow && (l = ' target="¨E95Eblank"'), t + '" + s + ""; + })), e = t.converter._dispatch("anchors.after", e, r, t); + });var u = /([*~_]+|\b)(((https?|ftp|dict):\/\/|www\.)[^'">\s]+?\.[^'">\s]+?)()(\1)?(?=\s|$)(?!["<>])/gi, + d = /([*~_]+|\b)(((https?|ftp|dict):\/\/|www\.)[^'">\s]+\.[^'">\s]+?)([.!?,()\[\]])?(\1)?(?=\s|$)(?!["<>])/gi, + p = /()<(((https?|ftp|dict):\/\/|www\.)[^'">\s]+)()>()/gi, + h = /(^|\s)(?:mailto:)?([A-Za-z0-9!#$%&'*+-/=?^_`{|}~.]+@[-a-z0-9]+(\.[-a-z0-9]+)*\.[a-z]+)(?=$|\s)/gim, + _ = /<()(?:mailto:)?([-.\w]+@[-a-z0-9]+(\.[-a-z0-9]+)*\.[a-z]+)>/gi, + g = function g(e) { + return function (r, t, n, s, o, i, l) { + var c = n = n.replace(a.helper.regexes.asteriskDashAndColon, a.helper.escapeCharactersCallback), + u = "", + d = "", + p = t || "", + h = l || "";return (/^www\./i.test(n) && (n = n.replace(/^www\./i, "http://www.")), e.excludeTrailingPunctuationFromURLs && i && (u = i), e.openLinksInNewWindow && (d = ' target="¨E95Eblank"'), p + '" + c + "" + u + h); + }; + }, + m = function m(e, r) { + return function (t, n, s) { + var o = "mailto:";return n = n || "", s = a.subParser("unescapeSpecialChars")(s, e, r), e.encodeEmails ? (o = a.helper.encodeEmailAddress(o + s), s = a.helper.encodeEmailAddress(s)) : o += s, n + '' + s + ""; + }; + };a.subParser("autoLinks", function (e, r, t) { + return e = t.converter._dispatch("autoLinks.before", e, r, t), e = e.replace(p, g(r)), e = e.replace(_, m(r, t)), e = t.converter._dispatch("autoLinks.after", e, r, t); + }), a.subParser("simplifiedAutoLinks", function (e, r, t) { + return r.simplifiedAutoLink ? (e = t.converter._dispatch("simplifiedAutoLinks.before", e, r, t), e = r.excludeTrailingPunctuationFromURLs ? e.replace(d, g(r)) : e.replace(u, g(r)), e = e.replace(h, m(r, t)), e = t.converter._dispatch("simplifiedAutoLinks.after", e, r, t)) : e; + }), a.subParser("blockGamut", function (e, r, t) { + return e = t.converter._dispatch("blockGamut.before", e, r, t), e = a.subParser("blockQuotes")(e, r, t), e = a.subParser("headers")(e, r, t), e = a.subParser("horizontalRule")(e, r, t), e = a.subParser("lists")(e, r, t), e = a.subParser("codeBlocks")(e, r, t), e = a.subParser("tables")(e, r, t), e = a.subParser("hashHTMLBlocks")(e, r, t), e = a.subParser("paragraphs")(e, r, t), e = t.converter._dispatch("blockGamut.after", e, r, t); + }), a.subParser("blockQuotes", function (e, r, t) { + e = t.converter._dispatch("blockQuotes.before", e, r, t), e += "\n\n";var n = /(^ {0,3}>[ \t]?.+\n(.+\n)*\n*)+/gm;return r.splitAdjacentBlockquotes && (n = /^ {0,3}>[\s\S]*?(?:\n\n)/gm), e = e.replace(n, function (e) { + return e = e.replace(/^[ \t]*>[ \t]?/gm, ""), e = e.replace(/¨0/g, ""), e = e.replace(/^[ \t]+$/gm, ""), e = a.subParser("githubCodeBlocks")(e, r, t), e = a.subParser("blockGamut")(e, r, t), e = e.replace(/(^|\n)/g, "$1 "), e = e.replace(/(\s*
[^\r]+?<\/pre>)/gm, function (e, r) {
+	          var t = r;return t = t.replace(/^  /gm, "¨0"), t = t.replace(/¨0/g, "");
+	        }), a.subParser("hashBlock")("
\n" + e + "\n
", r, t); + }), e = t.converter._dispatch("blockQuotes.after", e, r, t); + }), a.subParser("codeBlocks", function (e, r, t) { + e = t.converter._dispatch("codeBlocks.before", e, r, t);return e = (e += "¨0").replace(/(?:\n\n|^)((?:(?:[ ]{4}|\t).*\n+)+)(\n*[ ]{0,3}[^ \t\n]|(?=¨0))/g, function (e, n, s) { + var o = n, + i = s, + l = "\n";return o = a.subParser("outdent")(o, r, t), o = a.subParser("encodeCode")(o, r, t), o = a.subParser("detab")(o, r, t), o = o.replace(/^\n+/g, ""), o = o.replace(/\n+$/g, ""), r.omitExtraWLInCodeBlocks && (l = ""), o = "
" + o + l + "
", a.subParser("hashBlock")(o, r, t) + i; + }), e = e.replace(/¨0/, ""), e = t.converter._dispatch("codeBlocks.after", e, r, t); + }), a.subParser("codeSpans", function (e, r, t) { + return void 0 === (e = t.converter._dispatch("codeSpans.before", e, r, t)) && (e = ""), e = e.replace(/(^|[^\\])(`+)([^\r]*?[^`])\2(?!`)/gm, function (e, n, s, o) { + var i = o;return i = i.replace(/^([ \t]*)/g, ""), i = i.replace(/[ \t]*$/g, ""), i = a.subParser("encodeCode")(i, r, t), i = n + "" + i + "", i = a.subParser("hashHTMLSpans")(i, r, t); + }), e = t.converter._dispatch("codeSpans.after", e, r, t); + }), a.subParser("completeHTMLDocument", function (e, r, t) { + if (!r.completeHTMLDocument) return e;e = t.converter._dispatch("completeHTMLDocument.before", e, r, t);var a = "html", + n = "\n", + s = "", + o = '\n', + i = "", + l = "";void 0 !== t.metadata.parsed.doctype && (n = "\n", "html" !== (a = t.metadata.parsed.doctype.toString().toLowerCase()) && "html5" !== a || (o = ''));for (var c in t.metadata.parsed) { + if (t.metadata.parsed.hasOwnProperty(c)) switch (c.toLowerCase()) {case "doctype": + break;case "title": + s = "" + t.metadata.parsed.title + "\n";break;case "charset": + o = "html" === a || "html5" === a ? '\n' : '\n';break;case "language":case "lang": + i = ' lang="' + t.metadata.parsed[c] + '"', l += '\n';break;default: + l += '\n';} + }return e = n + "\n\n" + s + o + l + "\n\n" + e.trim() + "\n\n", e = t.converter._dispatch("completeHTMLDocument.after", e, r, t); + }), a.subParser("detab", function (e, r, t) { + return e = t.converter._dispatch("detab.before", e, r, t), e = e.replace(/\t(?=\t)/g, " "), e = e.replace(/\t/g, "¨A¨B"), e = e.replace(/¨B(.+?)¨A/g, function (e, r) { + for (var t = r, a = 4 - t.length % 4, n = 0; n < a; n++) { + t += " "; + }return t; + }), e = e.replace(/¨A/g, " "), e = e.replace(/¨B/g, ""), e = t.converter._dispatch("detab.after", e, r, t); + }), a.subParser("ellipsis", function (e, r, t) { + return e = t.converter._dispatch("ellipsis.before", e, r, t), e = e.replace(/\.\.\./g, "…"), e = t.converter._dispatch("ellipsis.after", e, r, t); + }), a.subParser("emoji", function (e, r, t) { + if (!r.emoji) return e;return e = (e = t.converter._dispatch("emoji.before", e, r, t)).replace(/:([\S]+?):/g, function (e, r) { + return a.helper.emojis.hasOwnProperty(r) ? a.helper.emojis[r] : e; + }), e = t.converter._dispatch("emoji.after", e, r, t); + }), a.subParser("encodeAmpsAndAngles", function (e, r, t) { + return e = t.converter._dispatch("encodeAmpsAndAngles.before", e, r, t), e = e.replace(/&(?!#?[xX]?(?:[0-9a-fA-F]+|\w+);)/g, "&"), e = e.replace(/<(?![a-z\/?$!])/gi, "<"), e = e.replace(//g, ">"), e = t.converter._dispatch("encodeAmpsAndAngles.after", e, r, t); + }), a.subParser("encodeBackslashEscapes", function (e, r, t) { + return e = t.converter._dispatch("encodeBackslashEscapes.before", e, r, t), e = e.replace(/\\(\\)/g, a.helper.escapeCharactersCallback), e = e.replace(/\\([`*_{}\[\]()>#+.!~=|-])/g, a.helper.escapeCharactersCallback), e = t.converter._dispatch("encodeBackslashEscapes.after", e, r, t); + }), a.subParser("encodeCode", function (e, r, t) { + return e = t.converter._dispatch("encodeCode.before", e, r, t), e = e.replace(/&/g, "&").replace(//g, ">").replace(/([*_{}\[\]\\=~-])/g, a.helper.escapeCharactersCallback), e = t.converter._dispatch("encodeCode.after", e, r, t); + }), a.subParser("escapeSpecialCharsWithinTagAttributes", function (e, r, t) { + return e = (e = t.converter._dispatch("escapeSpecialCharsWithinTagAttributes.before", e, r, t)).replace(/<\/?[a-z\d_:-]+(?:[\s]+[\s\S]+?)?>/gi, function (e) { + return e.replace(/(.)<\/?code>(?=.)/g, "$1`").replace(/([\\`*_~=|])/g, a.helper.escapeCharactersCallback); + }), e = e.replace(/-]|-[^>])(?:[^-]|-[^-])*)--)>/gi, function (e) { + return e.replace(/([\\`*_~=|])/g, a.helper.escapeCharactersCallback); + }), e = t.converter._dispatch("escapeSpecialCharsWithinTagAttributes.after", e, r, t); + }), a.subParser("githubCodeBlocks", function (e, r, t) { + return r.ghCodeBlocks ? (e = t.converter._dispatch("githubCodeBlocks.before", e, r, t), e += "¨0", e = e.replace(/(?:^|\n)(?: {0,3})(```+|~~~+)(?: *)([^\s`~]*)\n([\s\S]*?)\n(?: {0,3})\1/g, function (e, n, s, o) { + var i = r.omitExtraWLInCodeBlocks ? "" : "\n";return o = a.subParser("encodeCode")(o, r, t), o = a.subParser("detab")(o, r, t), o = o.replace(/^\n+/g, ""), o = o.replace(/\n+$/g, ""), o = "
" + o + i + "
", o = a.subParser("hashBlock")(o, r, t), "\n\n¨G" + (t.ghCodeBlocks.push({ text: e, codeblock: o }) - 1) + "G\n\n"; + }), e = e.replace(/¨0/, ""), t.converter._dispatch("githubCodeBlocks.after", e, r, t)) : e; + }), a.subParser("hashBlock", function (e, r, t) { + return e = t.converter._dispatch("hashBlock.before", e, r, t), e = e.replace(/(^\n+|\n+$)/g, ""), e = "\n\n¨K" + (t.gHtmlBlocks.push(e) - 1) + "K\n\n", e = t.converter._dispatch("hashBlock.after", e, r, t); + }), a.subParser("hashCodeTags", function (e, r, t) { + e = t.converter._dispatch("hashCodeTags.before", e, r, t);return e = a.helper.replaceRecursiveRegExp(e, function (e, n, s, o) { + var i = s + a.subParser("encodeCode")(n, r, t) + o;return "¨C" + (t.gHtmlSpans.push(i) - 1) + "C"; + }, "]*>", "", "gim"), e = t.converter._dispatch("hashCodeTags.after", e, r, t); + }), a.subParser("hashElement", function (e, r, t) { + return function (e, r) { + var a = r;return a = a.replace(/\n\n/g, "\n"), a = a.replace(/^\n/, ""), a = a.replace(/\n+$/g, ""), a = "\n\n¨K" + (t.gHtmlBlocks.push(a) - 1) + "K\n\n"; + }; + }), a.subParser("hashHTMLBlocks", function (e, r, t) { + e = t.converter._dispatch("hashHTMLBlocks.before", e, r, t);var n = ["pre", "div", "h1", "h2", "h3", "h4", "h5", "h6", "blockquote", "table", "dl", "ol", "ul", "script", "noscript", "form", "fieldset", "iframe", "math", "style", "section", "header", "footer", "nav", "article", "aside", "address", "audio", "canvas", "figure", "hgroup", "output", "video", "p"], + s = function s(e, r, a, n) { + var s = e;return -1 !== a.search(/\bmarkdown\b/) && (s = a + t.converter.makeHtml(r) + n), "\n\n¨K" + (t.gHtmlBlocks.push(s) - 1) + "K\n\n"; + };r.backslashEscapesHTMLTags && (e = e.replace(/\\<(\/?[^>]+?)>/g, function (e, r) { + return "<" + r + ">"; + }));for (var o = 0; o < n.length; ++o) { + for (var i, l = new RegExp("^ {0,3}(<" + n[o] + "\\b[^>]*>)", "im"), c = "<" + n[o] + "\\b[^>]*>", u = ""; -1 !== (i = a.helper.regexIndexOf(e, l));) { + var d = a.helper.splitAtIndex(e, i), + p = a.helper.replaceRecursiveRegExp(d[1], s, c, u, "im");if (p === d[1]) break;e = d[0].concat(p); + } + }return e = e.replace(/(\n {0,3}(<(hr)\b([^<>])*?\/?>)[ \t]*(?=\n{2,}))/g, a.subParser("hashElement")(e, r, t)), e = a.helper.replaceRecursiveRegExp(e, function (e) { + return "\n\n¨K" + (t.gHtmlBlocks.push(e) - 1) + "K\n\n"; + }, "^ {0,3}\x3c!--", "--\x3e", "gm"), e = e.replace(/(?:\n\n)( {0,3}(?:<([?%])[^\r]*?\2>)[ \t]*(?=\n{2,}))/g, a.subParser("hashElement")(e, r, t)), e = t.converter._dispatch("hashHTMLBlocks.after", e, r, t); + }), a.subParser("hashHTMLSpans", function (e, r, t) { + function a(e) { + return "¨C" + (t.gHtmlSpans.push(e) - 1) + "C"; + }return e = t.converter._dispatch("hashHTMLSpans.before", e, r, t), e = e.replace(/<[^>]+?\/>/gi, function (e) { + return a(e); + }), e = e.replace(/<([^>]+?)>[\s\S]*?<\/\1>/g, function (e) { + return a(e); + }), e = e.replace(/<([^>]+?)\s[^>]+?>[\s\S]*?<\/\1>/g, function (e) { + return a(e); + }), e = e.replace(/<[^>]+?>/gi, function (e) { + return a(e); + }), e = t.converter._dispatch("hashHTMLSpans.after", e, r, t); + }), a.subParser("unhashHTMLSpans", function (e, r, t) { + e = t.converter._dispatch("unhashHTMLSpans.before", e, r, t);for (var a = 0; a < t.gHtmlSpans.length; ++a) { + for (var n = t.gHtmlSpans[a], s = 0; /¨C(\d+)C/.test(n);) { + var o = RegExp.$1;if (n = n.replace("¨C" + o + "C", t.gHtmlSpans[o]), 10 === s) { + console.error("maximum nesting of 10 spans reached!!!");break; + }++s; + }e = e.replace("¨C" + a + "C", n); + }return e = t.converter._dispatch("unhashHTMLSpans.after", e, r, t); + }), a.subParser("hashPreCodeTags", function (e, r, t) { + e = t.converter._dispatch("hashPreCodeTags.before", e, r, t);return e = a.helper.replaceRecursiveRegExp(e, function (e, n, s, o) { + var i = s + a.subParser("encodeCode")(n, r, t) + o;return "\n\n¨G" + (t.ghCodeBlocks.push({ text: e, codeblock: i }) - 1) + "G\n\n"; + }, "^ {0,3}]*>\\s*]*>", "^ {0,3}\\s*
", "gim"), e = t.converter._dispatch("hashPreCodeTags.after", e, r, t); + }), a.subParser("headers", function (e, r, t) { + function n(e) { + var n, s;if (r.customizedHeaderId) { + var o = e.match(/\{([^{]+?)}\s*$/);o && o[1] && (e = o[1]); + }return n = e, s = a.helper.isString(r.prefixHeaderId) ? r.prefixHeaderId : !0 === r.prefixHeaderId ? "section-" : "", r.rawPrefixHeaderId || (n = s + n), n = r.ghCompatibleHeaderId ? n.replace(/ /g, "-").replace(/&/g, "").replace(/¨T/g, "").replace(/¨D/g, "").replace(/[&+$,\/:;=?@"#{}|^¨~\[\]`\\*)(%.!'<>]/g, "").toLowerCase() : r.rawHeaderId ? n.replace(/ /g, "-").replace(/&/g, "&").replace(/¨T/g, "¨").replace(/¨D/g, "$").replace(/["']/g, "-").toLowerCase() : n.replace(/[^\w]/g, "").toLowerCase(), r.rawPrefixHeaderId && (n = s + n), t.hashLinkCounts[n] ? n = n + "-" + t.hashLinkCounts[n]++ : t.hashLinkCounts[n] = 1, n; + }e = t.converter._dispatch("headers.before", e, r, t);var s = isNaN(parseInt(r.headerLevelStart)) ? 1 : parseInt(r.headerLevelStart), + o = r.smoothLivePreview ? /^(.+)[ \t]*\n={2,}[ \t]*\n+/gm : /^(.+)[ \t]*\n=+[ \t]*\n+/gm, + i = r.smoothLivePreview ? /^(.+)[ \t]*\n-{2,}[ \t]*\n+/gm : /^(.+)[ \t]*\n-+[ \t]*\n+/gm;e = (e = e.replace(o, function (e, o) { + var i = a.subParser("spanGamut")(o, r, t), + l = r.noHeaderId ? "" : ' id="' + n(o) + '"', + c = "" + i + "";return a.subParser("hashBlock")(c, r, t); + })).replace(i, function (e, o) { + var i = a.subParser("spanGamut")(o, r, t), + l = r.noHeaderId ? "" : ' id="' + n(o) + '"', + c = s + 1, + u = "" + i + "";return a.subParser("hashBlock")(u, r, t); + });var l = r.requireSpaceBeforeHeadingText ? /^(#{1,6})[ \t]+(.+?)[ \t]*#*\n+/gm : /^(#{1,6})[ \t]*(.+?)[ \t]*#*\n+/gm;return e = e.replace(l, function (e, o, i) { + var l = i;r.customizedHeaderId && (l = i.replace(/\s?\{([^{]+?)}\s*$/, ""));var c = a.subParser("spanGamut")(l, r, t), + u = r.noHeaderId ? "" : ' id="' + n(i) + '"', + d = s - 1 + o.length, + p = "" + c + "";return a.subParser("hashBlock")(p, r, t); + }), e = t.converter._dispatch("headers.after", e, r, t); + }), a.subParser("horizontalRule", function (e, r, t) { + e = t.converter._dispatch("horizontalRule.before", e, r, t);var n = a.subParser("hashBlock")("
", r, t);return e = e.replace(/^ {0,2}( ?-){3,}[ \t]*$/gm, n), e = e.replace(/^ {0,2}( ?\*){3,}[ \t]*$/gm, n), e = e.replace(/^ {0,2}( ?_){3,}[ \t]*$/gm, n), e = t.converter._dispatch("horizontalRule.after", e, r, t); + }), a.subParser("images", function (e, r, t) { + function n(e, r, n, s, o, i, l, c) { + var u = t.gUrls, + d = t.gTitles, + p = t.gDimensions;if (n = n.toLowerCase(), c || (c = ""), e.search(/\(? ?(['"].*['"])?\)$/m) > -1) s = "";else if ("" === s || null === s) { + if ("" !== n && null !== n || (n = r.toLowerCase().replace(/ ?\n/g, " ")), s = "#" + n, a.helper.isUndefined(u[n])) return e;s = u[n], a.helper.isUndefined(d[n]) || (c = d[n]), a.helper.isUndefined(p[n]) || (o = p[n].width, i = p[n].height); + }r = r.replace(/"/g, """).replace(a.helper.regexes.asteriskDashAndColon, a.helper.escapeCharactersCallback);var h = '' + r + '?(?: =([*\d]+[A-Za-z%]{0,4})x([*\d]+[A-Za-z%]{0,4}))?[ \t]*(?:(["'])([^"]*?)\6)?[ \t]?\)/g, function (e, r, t, a, s, o, i, l) { + return a = a.replace(/\s/g, ""), n(e, r, t, a, s, o, 0, l); + }), e = e.replace(/!\[([^\]]*?)][ \t]*()\([ \t]?<([^>]*)>(?: =([*\d]+[A-Za-z%]{0,4})x([*\d]+[A-Za-z%]{0,4}))?[ \t]*(?:(?:(["'])([^"]*?)\6))?[ \t]?\)/g, n), e = e.replace(/!\[([^\]]*?)][ \t]*()\([ \t]??(?: =([*\d]+[A-Za-z%]{0,4})x([*\d]+[A-Za-z%]{0,4}))?[ \t]*(?:(["'])([^"]*?)\6)?[ \t]?\)/g, n), e = e.replace(/!\[([^\[\]]+)]()()()()()/g, n), e = t.converter._dispatch("images.after", e, r, t); + }), a.subParser("italicsAndBold", function (e, r, t) { + function a(e, r, t) { + return r + e + t; + }return e = t.converter._dispatch("italicsAndBold.before", e, r, t), e = r.literalMidWordUnderscores ? (e = (e = e.replace(/\b___(\S[\s\S]*?)___\b/g, function (e, r) { + return a(r, "", ""); + })).replace(/\b__(\S[\s\S]*?)__\b/g, function (e, r) { + return a(r, "", ""); + })).replace(/\b_(\S[\s\S]*?)_\b/g, function (e, r) { + return a(r, "", ""); + }) : (e = (e = e.replace(/___(\S[\s\S]*?)___/g, function (e, r) { + return (/\S$/.test(r) ? a(r, "", "") : e + ); + })).replace(/__(\S[\s\S]*?)__/g, function (e, r) { + return (/\S$/.test(r) ? a(r, "", "") : e + ); + })).replace(/_([^\s_][\s\S]*?)_/g, function (e, r) { + return (/\S$/.test(r) ? a(r, "", "") : e + ); + }), e = r.literalMidWordAsterisks ? (e = (e = e.replace(/([^*]|^)\B\*\*\*(\S[\s\S]*?)\*\*\*\B(?!\*)/g, function (e, r, t) { + return a(t, r + "", ""); + })).replace(/([^*]|^)\B\*\*(\S[\s\S]*?)\*\*\B(?!\*)/g, function (e, r, t) { + return a(t, r + "", ""); + })).replace(/([^*]|^)\B\*(\S[\s\S]*?)\*\B(?!\*)/g, function (e, r, t) { + return a(t, r + "", ""); + }) : (e = (e = e.replace(/\*\*\*(\S[\s\S]*?)\*\*\*/g, function (e, r) { + return (/\S$/.test(r) ? a(r, "", "") : e + ); + })).replace(/\*\*(\S[\s\S]*?)\*\*/g, function (e, r) { + return (/\S$/.test(r) ? a(r, "", "") : e + ); + })).replace(/\*([^\s*][\s\S]*?)\*/g, function (e, r) { + return (/\S$/.test(r) ? a(r, "", "") : e + ); + }), e = t.converter._dispatch("italicsAndBold.after", e, r, t); + }), a.subParser("lists", function (e, r, t) { + function n(e, n) { + t.gListLevel++, e = e.replace(/\n{2,}$/, "\n");var s = /(\n)?(^ {0,3})([*+-]|\d+[.])[ \t]+((\[(x|X| )?])?[ \t]*[^\r]+?(\n{1,2}))(?=\n*(¨0| {0,3}([*+-]|\d+[.])[ \t]+))/gm, + o = /\n[ \t]*\n(?!¨0)/.test(e += "¨0");return r.disableForced4SpacesIndentedSublists && (s = /(\n)?(^ {0,3})([*+-]|\d+[.])[ \t]+((\[(x|X| )?])?[ \t]*[^\r]+?(\n{1,2}))(?=\n*(¨0|\2([*+-]|\d+[.])[ \t]+))/gm), e = e.replace(s, function (e, n, s, i, l, c, u) { + u = u && "" !== u.trim();var d = a.subParser("outdent")(l, r, t), + p = "";return c && r.tasklists && (p = ' class="task-list-item" style="list-style-type: none;"', d = d.replace(/^[ \t]*\[(x|X| )?]/m, function () { + var e = ' -1 ? (d = a.subParser("githubCodeBlocks")(d, r, t), d = a.subParser("blockGamut")(d, r, t)) : (d = (d = a.subParser("lists")(d, r, t)).replace(/\n$/, ""), d = (d = a.subParser("hashHTMLBlocks")(d, r, t)).replace(/\n\n+/g, "\n\n"), d = o ? a.subParser("paragraphs")(d, r, t) : a.subParser("spanGamut")(d, r, t)), d = d.replace("¨A", ""), d = "" + d + "\n"; + }), e = e.replace(/¨0/g, ""), t.gListLevel--, n && (e = e.replace(/\s+$/, "")), e; + }function s(e, r) { + if ("ol" === r) { + var t = e.match(/^ *(\d+)\./);if (t && "1" !== t[1]) return ' start="' + t[1] + '"'; + }return ""; + }function o(e, t, a) { + var o = r.disableForced4SpacesIndentedSublists ? /^ ?\d+\.[ \t]/gm : /^ {0,3}\d+\.[ \t]/gm, + i = r.disableForced4SpacesIndentedSublists ? /^ ?[*+-][ \t]/gm : /^ {0,3}[*+-][ \t]/gm, + l = "ul" === t ? o : i, + c = "";if (-1 !== e.search(l)) !function r(u) { + var d = u.search(l), + p = s(e, t);-1 !== d ? (c += "\n\n<" + t + p + ">\n" + n(u.slice(0, d), !!a) + "\n", l = "ul" === (t = "ul" === t ? "ol" : "ul") ? o : i, r(u.slice(d))) : c += "\n\n<" + t + p + ">\n" + n(u, !!a) + "\n"; + }(e);else { + var u = s(e, t);c = "\n\n<" + t + u + ">\n" + n(e, !!a) + "\n"; + }return c; + }return e = t.converter._dispatch("lists.before", e, r, t), e += "¨0", e = t.gListLevel ? e.replace(/^(( {0,3}([*+-]|\d+[.])[ \t]+)[^\r]+?(¨0|\n{2,}(?=\S)(?![ \t]*(?:[*+-]|\d+[.])[ \t]+)))/gm, function (e, r, t) { + return o(r, t.search(/[*+-]/g) > -1 ? "ul" : "ol", !0); + }) : e.replace(/(\n\n|^\n?)(( {0,3}([*+-]|\d+[.])[ \t]+)[^\r]+?(¨0|\n{2,}(?=\S)(?![ \t]*(?:[*+-]|\d+[.])[ \t]+)))/gm, function (e, r, t, a) { + return o(t, a.search(/[*+-]/g) > -1 ? "ul" : "ol", !1); + }), e = e.replace(/¨0/, ""), e = t.converter._dispatch("lists.after", e, r, t); + }), a.subParser("metadata", function (e, r, t) { + function a(e) { + t.metadata.raw = e, (e = (e = e.replace(/&/g, "&").replace(/"/g, """)).replace(/\n {4}/g, " ")).replace(/^([\S ]+): +([\s\S]+?)$/gm, function (e, r, a) { + return t.metadata.parsed[r] = a, ""; + }); + }return r.metadata ? (e = t.converter._dispatch("metadata.before", e, r, t), e = e.replace(/^\s*«««+(\S*?)\n([\s\S]+?)\n»»»+\n/, function (e, r, t) { + return a(t), "¨M"; + }), e = e.replace(/^\s*---+(\S*?)\n([\s\S]+?)\n---+\n/, function (e, r, n) { + return r && (t.metadata.format = r), a(n), "¨M"; + }), e = e.replace(/¨M/g, ""), e = t.converter._dispatch("metadata.after", e, r, t)) : e; + }), a.subParser("outdent", function (e, r, t) { + return e = t.converter._dispatch("outdent.before", e, r, t), e = e.replace(/^(\t|[ ]{1,4})/gm, "¨0"), e = e.replace(/¨0/g, ""), e = t.converter._dispatch("outdent.after", e, r, t); + }), a.subParser("paragraphs", function (e, r, t) { + for (var n = (e = (e = (e = t.converter._dispatch("paragraphs.before", e, r, t)).replace(/^\n+/g, "")).replace(/\n+$/g, "")).split(/\n{2,}/g), s = [], o = n.length, i = 0; i < o; i++) { + var l = n[i];l.search(/¨(K|G)(\d+)\1/g) >= 0 ? s.push(l) : l.search(/\S/) >= 0 && (l = (l = a.subParser("spanGamut")(l, r, t)).replace(/^([ \t]*)/g, "

"), l += "

", s.push(l)); + }for (o = s.length, i = 0; i < o; i++) { + for (var c = "", u = s[i], d = !1; /¨(K|G)(\d+)\1/.test(u);) { + var p = RegExp.$1, + h = RegExp.$2;c = (c = "K" === p ? t.gHtmlBlocks[h] : d ? a.subParser("encodeCode")(t.ghCodeBlocks[h].text, r, t) : t.ghCodeBlocks[h].codeblock).replace(/\$/g, "$$$$"), u = u.replace(/(\n\n)?¨(K|G)\d+\2(\n\n)?/, c), /^]*>\s*]*>/.test(u) && (d = !0); + }s[i] = u; + }return e = s.join("\n"), e = e.replace(/^\n+/g, ""), e = e.replace(/\n+$/g, ""), t.converter._dispatch("paragraphs.after", e, r, t); + }), a.subParser("runExtension", function (e, r, t, a) { + if (e.filter) r = e.filter(r, a.converter, t);else if (e.regex) { + var n = e.regex;n instanceof RegExp || (n = new RegExp(n, "g")), r = r.replace(n, e.replace); + }return r; + }), a.subParser("spanGamut", function (e, r, t) { + return e = t.converter._dispatch("spanGamut.before", e, r, t), e = a.subParser("codeSpans")(e, r, t), e = a.subParser("escapeSpecialCharsWithinTagAttributes")(e, r, t), e = a.subParser("encodeBackslashEscapes")(e, r, t), e = a.subParser("images")(e, r, t), e = a.subParser("anchors")(e, r, t), e = a.subParser("autoLinks")(e, r, t), e = a.subParser("simplifiedAutoLinks")(e, r, t), e = a.subParser("emoji")(e, r, t), e = a.subParser("underline")(e, r, t), e = a.subParser("italicsAndBold")(e, r, t), e = a.subParser("strikethrough")(e, r, t), e = a.subParser("ellipsis")(e, r, t), e = a.subParser("hashHTMLSpans")(e, r, t), e = a.subParser("encodeAmpsAndAngles")(e, r, t), r.simpleLineBreaks ? /\n\n¨K/.test(e) || (e = e.replace(/\n+/g, "
\n")) : e = e.replace(/ +\n/g, "
\n"), e = t.converter._dispatch("spanGamut.after", e, r, t); + }), a.subParser("strikethrough", function (e, r, t) { + return r.strikethrough && (e = (e = t.converter._dispatch("strikethrough.before", e, r, t)).replace(/(?:~){2}([\s\S]+?)(?:~){2}/g, function (e, n) { + return function (e) { + return r.simplifiedAutoLink && (e = a.subParser("simplifiedAutoLinks")(e, r, t)), "" + e + ""; + }(n); + }), e = t.converter._dispatch("strikethrough.after", e, r, t)), e; + }), a.subParser("stripLinkDefinitions", function (e, r, t) { + var n = function n(e, _n2, s, o, i, l, c) { + return _n2 = _n2.toLowerCase(), s.match(/^data:.+?\/.+?;base64,/) ? t.gUrls[_n2] = s.replace(/\s/g, "") : t.gUrls[_n2] = a.subParser("encodeAmpsAndAngles")(s, r, t), l ? l + c : (c && (t.gTitles[_n2] = c.replace(/"|'/g, """)), r.parseImgDimensions && o && i && (t.gDimensions[_n2] = { width: o, height: i }), ""); + };return e = (e += "¨0").replace(/^ {0,3}\[(.+)]:[ \t]*\n?[ \t]*?(?: =([*\d]+[A-Za-z%]{0,4})x([*\d]+[A-Za-z%]{0,4}))?[ \t]*\n?[ \t]*(?:(\n*)["|'(](.+?)["|')][ \t]*)?(?:\n\n|(?=¨0)|(?=\n\[))/gm, n), e = e.replace(/^ {0,3}\[(.+)]:[ \t]*\n?[ \t]*\s]+)>?(?: =([*\d]+[A-Za-z%]{0,4})x([*\d]+[A-Za-z%]{0,4}))?[ \t]*\n?[ \t]*(?:(\n*)["|'(](.+?)["|')][ \t]*)?(?:\n+|(?=¨0))/gm, n), e = e.replace(/¨0/, ""); + }), a.subParser("tables", function (e, r, t) { + function n(e) { + return (/^:[ \t]*--*$/.test(e) ? ' style="text-align:left;"' : /^--*[ \t]*:[ \t]*$/.test(e) ? ' style="text-align:right;"' : /^:[ \t]*--*[ \t]*:$/.test(e) ? ' style="text-align:center;"' : "" + ); + }function s(e, n) { + var s = "";return e = e.trim(), (r.tablesHeaderId || r.tableHeaderId) && (s = ' id="' + e.replace(/ /g, "_").toLowerCase() + '"'), e = a.subParser("spanGamut")(e, r, t), "" + e + "\n"; + }function o(e, n) { + return "" + a.subParser("spanGamut")(e, r, t) + "\n"; + }function i(e) { + var i, + l = e.split("\n");for (i = 0; i < l.length; ++i) { + /^ {0,3}\|/.test(l[i]) && (l[i] = l[i].replace(/^ {0,3}\|/, "")), /\|[ \t]*$/.test(l[i]) && (l[i] = l[i].replace(/\|[ \t]*$/, "")), l[i] = a.subParser("codeSpans")(l[i], r, t); + }var c = l[0].split("|").map(function (e) { + return e.trim(); + }), + u = l[1].split("|").map(function (e) { + return e.trim(); + }), + d = [], + p = [], + h = [], + _ = [];for (l.shift(), l.shift(), i = 0; i < l.length; ++i) { + "" !== l[i].trim() && d.push(l[i].split("|").map(function (e) { + return e.trim(); + })); + }if (c.length < u.length) return e;for (i = 0; i < u.length; ++i) { + h.push(n(u[i])); + }for (i = 0; i < c.length; ++i) { + a.helper.isUndefined(h[i]) && (h[i] = ""), p.push(s(c[i], h[i])); + }for (i = 0; i < d.length; ++i) { + for (var g = [], m = 0; m < p.length; ++m) { + a.helper.isUndefined(d[i][m]), g.push(o(d[i][m], h[m])); + }_.push(g); + }return function (e, r) { + for (var t = "\n\n\n", a = e.length, n = 0; n < a; ++n) { + t += e[n]; + }for (t += "\n\n\n", n = 0; n < r.length; ++n) { + t += "\n";for (var s = 0; s < a; ++s) { + t += r[n][s]; + }t += "\n"; + }return t += "\n
\n"; + }(p, _); + }if (!r.tables) return e;return e = t.converter._dispatch("tables.before", e, r, t), e = e.replace(/\\(\|)/g, a.helper.escapeCharactersCallback), e = e.replace(/^ {0,3}\|?.+\|.+\n {0,3}\|?[ \t]*:?[ \t]*(?:[-=]){2,}[ \t]*:?[ \t]*\|[ \t]*:?[ \t]*(?:[-=]){2,}[\s\S]+?(?:\n\n|¨0)/gm, i), e = e.replace(/^ {0,3}\|.+\|[ \t]*\n {0,3}\|[ \t]*:?[ \t]*(?:[-=]){2,}[ \t]*:?[ \t]*\|[ \t]*\n( {0,3}\|.+\|[ \t]*\n)*(?:\n|¨0)/gm, i), e = t.converter._dispatch("tables.after", e, r, t); + }), a.subParser("underline", function (e, r, t) { + return r.underline ? (e = t.converter._dispatch("underline.before", e, r, t), e = r.literalMidWordUnderscores ? (e = e.replace(/\b___(\S[\s\S]*?)___\b/g, function (e, r) { + return "" + r + ""; + })).replace(/\b__(\S[\s\S]*?)__\b/g, function (e, r) { + return "" + r + ""; + }) : (e = e.replace(/___(\S[\s\S]*?)___/g, function (e, r) { + return (/\S$/.test(r) ? "" + r + "" : e + ); + })).replace(/__(\S[\s\S]*?)__/g, function (e, r) { + return (/\S$/.test(r) ? "" + r + "" : e + ); + }), e = e.replace(/(_)/g, a.helper.escapeCharactersCallback), e = t.converter._dispatch("underline.after", e, r, t)) : e; + }), a.subParser("unescapeSpecialChars", function (e, r, t) { + return e = t.converter._dispatch("unescapeSpecialChars.before", e, r, t), e = e.replace(/¨E(\d+)E/g, function (e, r) { + var t = parseInt(r);return String.fromCharCode(t); + }), e = t.converter._dispatch("unescapeSpecialChars.after", e, r, t); + }), a.subParser("makeMarkdown.blockquote", function (e, r) { + var t = "";if (e.hasChildNodes()) for (var n = e.childNodes, s = n.length, o = 0; o < s; ++o) { + var i = a.subParser("makeMarkdown.node")(n[o], r);"" !== i && (t += i); + }return t = t.trim(), t = "> " + t.split("\n").join("\n> "); + }), a.subParser("makeMarkdown.codeBlock", function (e, r) { + var t = e.getAttribute("language"), + a = e.getAttribute("precodenum");return "```" + t + "\n" + r.preList[a] + "\n```"; + }), a.subParser("makeMarkdown.codeSpan", function (e) { + return "`" + e.innerHTML + "`"; + }), a.subParser("makeMarkdown.emphasis", function (e, r) { + var t = "";if (e.hasChildNodes()) { + t += "*";for (var n = e.childNodes, s = n.length, o = 0; o < s; ++o) { + t += a.subParser("makeMarkdown.node")(n[o], r); + }t += "*"; + }return t; + }), a.subParser("makeMarkdown.header", function (e, r, t) { + var n = new Array(t + 1).join("#"), + s = "";if (e.hasChildNodes()) { + s = n + " ";for (var o = e.childNodes, i = o.length, l = 0; l < i; ++l) { + s += a.subParser("makeMarkdown.node")(o[l], r); + } + }return s; + }), a.subParser("makeMarkdown.hr", function () { + return "---"; + }), a.subParser("makeMarkdown.image", function (e) { + var r = "";return e.hasAttribute("src") && (r += "![" + e.getAttribute("alt") + "](", r += "<" + e.getAttribute("src") + ">", e.hasAttribute("width") && e.hasAttribute("height") && (r += " =" + e.getAttribute("width") + "x" + e.getAttribute("height")), e.hasAttribute("title") && (r += ' "' + e.getAttribute("title") + '"'), r += ")"), r; + }), a.subParser("makeMarkdown.links", function (e, r) { + var t = "";if (e.hasChildNodes() && e.hasAttribute("href")) { + var n = e.childNodes, + s = n.length;t = "[";for (var o = 0; o < s; ++o) { + t += a.subParser("makeMarkdown.node")(n[o], r); + }t += "](", t += "<" + e.getAttribute("href") + ">", e.hasAttribute("title") && (t += ' "' + e.getAttribute("title") + '"'), t += ")"; + }return t; + }), a.subParser("makeMarkdown.list", function (e, r, t) { + var n = "";if (!e.hasChildNodes()) return "";for (var s = e.childNodes, o = s.length, i = e.getAttribute("start") || 1, l = 0; l < o; ++l) { + if (void 0 !== s[l].tagName && "li" === s[l].tagName.toLowerCase()) { + n += ("ol" === t ? i.toString() + ". " : "- ") + a.subParser("makeMarkdown.listItem")(s[l], r), ++i; + } + }return (n += "\n\x3c!-- --\x3e\n").trim(); + }), a.subParser("makeMarkdown.listItem", function (e, r) { + for (var t = "", n = e.childNodes, s = n.length, o = 0; o < s; ++o) { + t += a.subParser("makeMarkdown.node")(n[o], r); + }return (/\n$/.test(t) ? t = t.split("\n").join("\n ").replace(/^ {4}$/gm, "").replace(/\n\n+/g, "\n\n") : t += "\n", t); + }), a.subParser("makeMarkdown.node", function (e, r, t) { + t = t || !1;var n = "";if (3 === e.nodeType) return a.subParser("makeMarkdown.txt")(e, r);if (8 === e.nodeType) return "\x3c!--" + e.data + "--\x3e\n\n";if (1 !== e.nodeType) return "";switch (e.tagName.toLowerCase()) {case "h1": + t || (n = a.subParser("makeMarkdown.header")(e, r, 1) + "\n\n");break;case "h2": + t || (n = a.subParser("makeMarkdown.header")(e, r, 2) + "\n\n");break;case "h3": + t || (n = a.subParser("makeMarkdown.header")(e, r, 3) + "\n\n");break;case "h4": + t || (n = a.subParser("makeMarkdown.header")(e, r, 4) + "\n\n");break;case "h5": + t || (n = a.subParser("makeMarkdown.header")(e, r, 5) + "\n\n");break;case "h6": + t || (n = a.subParser("makeMarkdown.header")(e, r, 6) + "\n\n");break;case "p": + t || (n = a.subParser("makeMarkdown.paragraph")(e, r) + "\n\n");break;case "blockquote": + t || (n = a.subParser("makeMarkdown.blockquote")(e, r) + "\n\n");break;case "hr": + t || (n = a.subParser("makeMarkdown.hr")(e, r) + "\n\n");break;case "ol": + t || (n = a.subParser("makeMarkdown.list")(e, r, "ol") + "\n\n");break;case "ul": + t || (n = a.subParser("makeMarkdown.list")(e, r, "ul") + "\n\n");break;case "precode": + t || (n = a.subParser("makeMarkdown.codeBlock")(e, r) + "\n\n");break;case "pre": + t || (n = a.subParser("makeMarkdown.pre")(e, r) + "\n\n");break;case "table": + t || (n = a.subParser("makeMarkdown.table")(e, r) + "\n\n");break;case "code": + n = a.subParser("makeMarkdown.codeSpan")(e, r);break;case "em":case "i": + n = a.subParser("makeMarkdown.emphasis")(e, r);break;case "strong":case "b": + n = a.subParser("makeMarkdown.strong")(e, r);break;case "del": + n = a.subParser("makeMarkdown.strikethrough")(e, r);break;case "a": + n = a.subParser("makeMarkdown.links")(e, r);break;case "img": + n = a.subParser("makeMarkdown.image")(e, r);break;default: + n = e.outerHTML + "\n\n";}return n; + }), a.subParser("makeMarkdown.paragraph", function (e, r) { + var t = "";if (e.hasChildNodes()) for (var n = e.childNodes, s = n.length, o = 0; o < s; ++o) { + t += a.subParser("makeMarkdown.node")(n[o], r); + }return t = t.trim(); + }), a.subParser("makeMarkdown.pre", function (e, r) { + var t = e.getAttribute("prenum");return "
" + r.preList[t] + "
"; + }), a.subParser("makeMarkdown.strikethrough", function (e, r) { + var t = "";if (e.hasChildNodes()) { + t += "~~";for (var n = e.childNodes, s = n.length, o = 0; o < s; ++o) { + t += a.subParser("makeMarkdown.node")(n[o], r); + }t += "~~"; + }return t; + }), a.subParser("makeMarkdown.strong", function (e, r) { + var t = "";if (e.hasChildNodes()) { + t += "**";for (var n = e.childNodes, s = n.length, o = 0; o < s; ++o) { + t += a.subParser("makeMarkdown.node")(n[o], r); + }t += "**"; + }return t; + }), a.subParser("makeMarkdown.table", function (e, r) { + var t, + n, + s = "", + o = [[], []], + i = e.querySelectorAll("thead>tr>th"), + l = e.querySelectorAll("tbody>tr");for (t = 0; t < i.length; ++t) { + var c = a.subParser("makeMarkdown.tableCell")(i[t], r), + u = "---";if (i[t].hasAttribute("style")) { + switch (i[t].getAttribute("style").toLowerCase().replace(/\s/g, "")) {case "text-align:left;": + u = ":---";break;case "text-align:right;": + u = "---:";break;case "text-align:center;": + u = ":---:";} + }o[0][t] = c.trim(), o[1][t] = u; + }for (t = 0; t < l.length; ++t) { + var d = o.push([]) - 1, + p = l[t].getElementsByTagName("td");for (n = 0; n < i.length; ++n) { + var h = " ";void 0 !== p[n] && (h = a.subParser("makeMarkdown.tableCell")(p[n], r)), o[d].push(h); + } + }var _ = 3;for (t = 0; t < o.length; ++t) { + for (n = 0; n < o[t].length; ++n) { + var g = o[t][n].length;g > _ && (_ = g); + } + }for (t = 0; t < o.length; ++t) { + for (n = 0; n < o[t].length; ++n) { + 1 === t ? ":" === o[t][n].slice(-1) ? o[t][n] = a.helper.padEnd(o[t][n].slice(-1), _ - 1, "-") + ":" : o[t][n] = a.helper.padEnd(o[t][n], _, "-") : o[t][n] = a.helper.padEnd(o[t][n], _); + }s += "| " + o[t].join(" | ") + " |\n"; + }return s.trim(); + }), a.subParser("makeMarkdown.tableCell", function (e, r) { + var t = "";if (!e.hasChildNodes()) return "";for (var n = e.childNodes, s = n.length, o = 0; o < s; ++o) { + t += a.subParser("makeMarkdown.node")(n[o], r, !0); + }return t.trim(); + }), a.subParser("makeMarkdown.txt", function (e) { + var r = e.nodeValue;return r = r.replace(/ +/g, " "), r = r.replace(/¨NBSP;/g, " "), r = a.helper.unescapeHTMLEntities(r), r = r.replace(/([*_~|`])/g, "\\$1"), r = r.replace(/^(\s*)>/g, "\\$1>"), r = r.replace(/^#/gm, "\\#"), r = r.replace(/^(\s*)([-=]{3,})(\s*)$/, "$1\\$2$3"), r = r.replace(/^( {0,3}\d+)\./gm, "$1\\."), r = r.replace(/^( {0,3})([+-])/gm, "$1\\$2"), r = r.replace(/]([\s]*)\(/g, "\\]$1\\("), r = r.replace(/^ {0,3}\[([\S \t]*?)]:/gm, "\\[$1]:"); + });"function" == typeof undefined && undefined.amd ? undefined(function () { + return a; + }) : "undefined" != 'object' && module.exports ? module.exports = a : this.showdown = a; + }).call(commonjsGlobal); + + }); + + var md = /*#__PURE__*/Object.freeze({ + default: showdown_min, + __moduleExports: showdown_min + }); + + console.log("=== PureRead: Plugin load ==="); + + var plugins = { + pangu: pangu_min, + minimatch: minimatch_1, + beautify: be, + style: ss, + rdability: rda, + markdown: md + }; + + /** + * Get PureRead Plugin + * + * @param {string} plugin name, when undefined, return all plugin + * @return {object} all plugins + * {string} plgin + */ + function Plugin(type) { + var result = void 0; + if (type == undefined) { + result = plugins; + } else { + result = plugins[type]; + } + return result; + } + + exports.Plugin = Plugin; + + Object.defineProperty(exports, '__esModule', { value: true }); + +}))); diff --git a/src/vender/puread/puread.min.js b/src/vender/puread/puread.min.js index 922b745c..97987053 100644 --- a/src/vender/puread/puread.min.js +++ b/src/vender/puread/puread.min.js @@ -1 +1,1335 @@ -!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):t.PureRead=e()}(this,function(){"use strict";var t=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},e=function(){function t(t,e){for(var r=0;r?$|<[^/][-_a-zA-Z0-9]+>?$/gi);return e&&e.length>0?[1,e]:[-1,void 0]}function c(t){var e=s(t),r=a(e,2),n=r[0],i=r[1];if(2==n)return t;if(1==n){var o=i[0].trim().replace(/['"<>]/g,"").replace(/ /gi,"=").split("="),l=a(o,3),u=l[0],c=l[1],h=l[2];return c?"class"===c.toLowerCase()?c=u+"."+h:"id"===c.toLowerCase()&&(c=u+"#"+h):c=u,c}return null}function h(t){return/^(\[\[)[\[{'/]{1}[ \S]+[}'/\]]\]\]{1}($)/g.test(t)}function f(t){var e=[t.replace(/(^)\[\[|\]\]$/g,"")],r=e[0],n=e[1];switch(r[0]){case"{":r=r.replace(/^{|}$/g,""),t=new Function("return "+r)(),n=0;break;case"'":t=(t=r.replace(/^'|'$/g,"")).match(/^<[a-zA-Z0-9_-]+>/g).join("").replace(/<|>/g,"")+":contains("+t.replace(/<[/a-zA-Z0-9_-]+>/g,"")+")",n=1;break;case"/":t=r.replace(/^\/|\/$/g,"").replace(/\\{2}/g,"\\").replace(/'/g,'"'),n=2;break;case"[":r=r.replace(/^{|}$/g,""),t=new Function("return "+r)()[0],n=3;break;default:n=-1}return[t,n]}var d={url:"",target:"",matching:[],name:"",title:"",desc:"",exclude:[],include:"",avatar:[],paging:[]},p=void 0,m=void 0,v=void 0,g=void 0,y=function(){function n(){var e,r,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{global:[],custom:[],local:[]};t(this,n),this.url=(r=(e="/"!=(e=window.location.pathname)&&e.endsWith("/")?e=e.replace(/\/$/,""):e).replace(/\/[%@#.~a-zA-Z0-9_-]+$|^\/$/g,""),window.location.protocol+"//"+window.location.hostname+r+"/"),this.sites=i,this.current={},this.state="none",this.origins=[],g=location.href}return e(n,[{key:"SetURL",value:function(t){var e,r=u(t),n=(e="/"!=(e=r.pathname)&&e.endsWith("/")?e=e.replace(/\/$/,""):e).replace(/\/[%@#.~a-zA-Z0-9_-]+$|^\/$/g,"");this.url=r.protocol+"//"+r.hostname+n+"/",g=t}},{key:"SetMinimatch",value:function(t){p=t}},{key:"SetRdability",value:function(t){m=t}},{key:"SetMarkdown",value:function(t){v=t}},{key:"Readability",value:function(){try{var t=document.location,e={spec:t.href,host:t.host,prePath:t.protocol+"//"+t.host,scheme:t.protocol.substr(0,t.protocol.indexOf(":")),pathBase:t.protocol+"//"+t.host+t.pathname.substr(0,t.pathname.lastIndexOf("/")+1)},r=new m.Readability(e,document.cloneNode(!0)).parse();if(!r||""==r.content)throw"Readability error";this.Newsite("read",r.content),this.dom=$(r.content)[0],this.state="temp"}catch(t){var n=function(){var t=$("body"),e=!0,r=!1,n=void 0;try{for(var i,a=[".post-content",".entry-content",".post-article",".content-post",".article-entry",".article-content",".article-body",".markdown-body","[itemprop='articleBody']","article",".post",".content"][Symbol.iterator]();!(e=(i=a.next()).done);e=!0){var o=i.value,l=t.find(o);if(l.length>0)return l}}catch(t){r=!0,n=t}finally{try{!e&&a.return&&a.return()}finally{if(r)throw n}}return-1}();-1!=n?(this.Newsite("read",n[0].outerHTML),this.dom=n[0],this.state="temp"):this.current.site=l(d)}}},{key:"Getsite",value:function(t,e){return this.sites[t].find(function(t){return t[0]==e})}},{key:"Getsites",value:function(){var t=this,e=[],n=function(){if(p(location.href,"file://**/*.txt")||p(location.href,"http*://**/*.txt"))return function(){var t=location.pathname.split("/").pop(),e="file:"==location.protocol?"local":"remote",r={name:"txtread::"+e,title:"",desc:"",include:"<pre>",auto:!1,exclude:[]};"remote"==e&&(r.include="",r.html=$("body pre").html().replace(/\n/gi,"<br>"));return!$("title").html()&&$("head").append("<title>"+decodeURI(t.replace(".txt",""))+""),r}();if(p(location.href,"file://**/*.md")||p(location.href,"http*://**/*.md"))return function(){var t=location.pathname.split("/").pop(),e={name:"txtread::"+("file:"==location.protocol?"local":"remote"),title:"",desc:"",include:"",auto:!1,exclude:[]},r=(new v.default.Converter).makeHtml($("body pre").text());return e.html=r,!$("title").html()&&$("head").append("<title>"+decodeURI(t.replace(".md",""))+""),e}();var t=/<\S+ (class|id)=("|')?[\w-_=;:' ]+("|')?>?$|<[^/][-_a-zA-Z0-9]+>?$/gi,e={name:$("meta[name='simpread:name']").attr("content"),url:$("meta[name='simpread:url']").attr("content"),title:$("meta[name='simpread:title']").attr("content"),desc:$("meta[name='simpread:desc']").attr("content"),include:$("meta[name='simpread:include']").attr("content"),exp:$("meta[name='simpread:exclude']").attr("content"),auto:$("meta[name='simpread:auto']").attr("content"),exclude:[]};if(e.name&&e.include){if(e.url&&!p(location.href,e.url))return;!e.title&&(e.title=""),!e.desc&&(e.desc=""),!e.exp&&(e.exp=""),e.name="metaread::"+e.name,e.auto="true"==e.auto;var r=["title","desc","include","exp"].findIndex(function(r){return""!=e[r]&&!e[r].match(t)});return e.exclude.push(e.exp),delete e.exp,-1==r?e:void 0}return}();if(this.current.url=this.url,n)this.current.auto=n.auto,this.current.url=n.url,delete n.auto,delete n.url,this.current.site=r({},n),this.current.site.name.startsWith("metaread::")&&(this.state="meta"),this.current.site.name.startsWith("txtread::")&&(this.state="txt");else if(b("local",new Map(this.sites.local),this.url,e),b("global",new Map(this.sites.global),this.url,e),b("person",new Map(this.sites.person),this.url,e),b("custom",new Map(this.sites.custom),this.url,e),e.length>0){var i=void 0;if(e.forEach(function(e){e[1].active&&(i=e,t.current.url=i[0],t.current.site=t.Safesite(r({},i[1]),i[2],i[0]),t.state="adapter")}),!i){var a=e[0];a[1].active=!0,this.current.url=a[0],this.current.site=this.Safesite(r({},a[1]),a[2],a[0]),this.state="adapter"}}else{var o=function(){if(location.pathname.includes("thread")||location.pathname.includes("forum.php")){if($(".t_f").length>0&&$(".favatar").find(".authi").length>0&&$(".avatar").find("img").length>0)return{avatar:[{name:"[[{$('.favatar').find('.authi')}]]"},{url:"[[{$('.avatar').find('img')}]]"}],include:"[[{$('.t_f')}]]"}}else if(/\/t\/[\w-]+\/\d+/.test(location.pathname)&&$("meta[name=generator]").attr("content").includes("discourse"))return{avatar:[{name:"[[{$('.topic-avatar').find('.a[data-user-card]')}]]"},{url:"[[{$('.topic-avatar').find('img')}]]"}],include:"[[{$('.cooked')}]]"};return-1}();-1!=o?(this.Newmultisite("read",o),this.state="temp"):this.Readability()}this.current.site.matching=e}},{key:"Addsites",value:function(t){var e=0;if(0==this.sites.global.length)this.sites.global=this.Formatsites(t),e=this.sites.global.length;else{var r=function(t,e){var r=new Map(e),n=[].concat(o(r.keys())),i=0;return t.map(function(t){n.includes(t[0])?n.includes(t[0]):i++}),{count:i,newsites:t}}(this.Formatsites(t),this.sites.global);e=r.count,this.sites.global=r.newsites}return e}},{key:"Addlocalsites",value:function(t){return this.sites.local=[].concat(o(t)),this.sites.local}},{key:"Addallsites",value:function(t){return this.sites={global:[].concat(o(t.global)),person:[].concat(o(t.person)),custom:[].concat(o(t.custom)),local:[].concat(o(t.local))},this.sites}},{key:"Newsite",value:function(t,e){var n={mode:t,url:window.location.href,site:{name:"tempread::"+window.location.host,title:"<title>",desc:"",include:"",exclude:[]}};e&&(n.site.html=e),this.current.mode=n.mode,this.current.url=n.url,this.current.site=this.Safesite(r({},n.site),"local",n.url)}},{key:"Newmultisite",value:function(t,e){var n={mode:t,url:window.location.href,site:{name:"tempread::"+window.location.host,title:"<title>",desc:"",include:e.include,exclude:[],avatar:e.avatar}};this.current.mode=n.mode,this.current.url=n.url,this.current.site=this.Safesite(r({},n.site),"local",n.url)}},{key:"Updatesite",value:function(t,e,r){var n=this.sites[t].findIndex(function(t){return t[0]==e});-1==n&&(n=this.sites[t].length),this.sites[t].splice(n,1,r)}},{key:"Deletesite",value:function(t,e,r){var n=this.sites[t].findIndex(function(t){return t[0]==e});-1!=n&&this.sites[t].splice(n,1),r(n)}},{key:"Safesite",value:function(t,e,r){return t.url=r,t.target=e,""==t.name&&(t.name="tempread::"),(!t.avatar||0==t.avatar.length)&&(t.avatar=[{name:""},{url:""}]),(!t.paging||0==t.paging.length)&&(t.paging=[{prev:""},{next:""}]),t}},{key:"Cleansite",value:function(t){return delete t.url,delete t.html,delete t.target,delete t.matching,t.avatar&&t.avatar.length>0&&""==t.avatar[0].name&&delete t.avatar,t.paging&&t.paging.length>0&&""==t.paging[0].prev&&delete t.paging,t}},{key:"Formatsites",value:function(t){var e=new Map,r=!0,n=!1,i=void 0;try{for(var a,l=t.sites[Symbol.iterator]();!(r=(a=l.next()).done);r=!0){var u=a.value;if(0==w(u)){var s=u.url;delete u.url,e.set(s,u)}}}catch(t){n=!0,i=t}finally{try{!r&&l.return&&l.return()}finally{if(n)throw i}}return[].concat(o(e))}},{key:"Clearsites",value:function(t){t?this.sites[t]=[]:this.sites={global:[],custom:[],local:[]}}},{key:"Origins",value:function(t){var e=t.origins.map(function(t){return t.url});return(e=new Set(this.origins.concat(e))).forEach(function(t){""!=t.trim()&&t.trim().startsWith("http")&&t.trim().endsWith(".json")||e.delete(t)}),this.origins=[].concat(o(e)),this.origins}},{key:"Addorigins",value:function(t){return this.sites.custom=[].concat(o(t)),this.sites.custom}},{key:"Clearorigins",value:function(){var t=this.sites.custom.length;return this.sites.custom=[],t}}]),n}();function b(t,e,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[],i=function(t){var e=t.replace("www.","").match(/\.\S+\.\S+/g);return e?e[0].substr(1):t.replace("www.","")},a=u(g),s=[].concat(o(e.keys())),c=r.match(/[.a-zA-z0-9-_]+/g)[1].replace("www.",""),h=i(a.hostname),f=function(){return"/"==a.pathname||/\/(default|index|portal).[0-9a-zA-Z]+$/.test(a.pathname)},d=!0,m=!1,v=void 0;try{for(var y,b=s[Symbol.iterator]();!(d=(y=b.next()).done);d=!0){var w=y.value,$=e.get(w).name,k=i($);f()||w.endsWith("*")||w.replace(/^http[s]?:/,"")!=r.replace(/^http[s]?:/,"")?w.match(/\*/g)&&1==w.match(/\*/g).length&&!f()&&w.endsWith("*")&&c.includes(k)&&h==k&&r.includes($)?n.push([w,l(e.get(w)),t]):p(a.origin+a.pathname,w)&&n.push([w,l(e.get(w)),t]):n.push([w,l(e.get(w)),t])}}catch(t){m=!0,v=t}finally{try{!d&&b.return&&b.return()}finally{if(m)throw v}}}function w(t){if(!t.name||!t.url||!t.include)return-1;if(-1==s(t.title)[0]||-1==s(t.include)[0]||-1==s(t.desc)[0])return-2;if(t.paging){if(2!=t.paging.length)return-3;if(!t.paging[0].prev)return-4;if(!t.paging[1].next)return-5;if(-1==s(t.paging[0].prev)[0]||-1==s(t.paging[1].next)[0])return-6}if(t.avatar){if(2!=t.avatar.length)return-7;if(!t.avatar[0].name)return-8;if(!t.avatar[1].url)return-9;if(-1==s(t.avatar[0].name)[0]||-1==s(t.avatar[1].url)[0])return-10}return 0}function k(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"text",r=$("html");if(h(t)){var n=f(t),i=a(n,2),o=i[0],l=i[1];0==l?t=o:3==l&&(t=x(r.find(o)))}else"html"==e?t=x(r.find(t)):"multi"==e||(t=r.find(t).text().trim());return t}function x(t){var e="";switch(t.length){case 0:e="<sr-rd-content-error></sr-rd-content-error>";break;case 1:e=t.html().trim();break;default:e=t.map(function(t,e){return $(e).html()}).get().join("<br>")}return e}return function(r){function o(e){t(this,o);var r=i(this,(o.__proto__||Object.getPrototypeOf(o)).call(this,e));return r.version="0.0.4 build 0421",r.org_url=location.href,r.html={},r.plugin={},r.pure=!1,r}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(o,y),e(o,[{key:"Exist",value:function(){return this.org_url==location.href}},{key:"AddPlugin",value:function(t){this.plugin={minimatch:t.minimatch,pangu:t.pangu,beautify:t.beautify,stylesheet:t.style,rdability:t.rdability,markdown:t.markdown},n(o.prototype.__proto__||Object.getPrototypeOf(o.prototype),"SetMinimatch",this).call(this,this.plugin.minimatch),n(o.prototype.__proto__||Object.getPrototypeOf(o.prototype),"SetRdability",this).call(this,this.plugin.rdability),n(o.prototype.__proto__||Object.getPrototypeOf(o.prototype),"SetMarkdown",this).call(this,this.plugin.markdown)}},{key:"TempMode",value:function(t,e){this.state="temp",this.dom=e,this.Newsite(t,e.outerHTML)}},{key:"ReadMode",value:function(){var t,e,r,n,i;this.html=(t=this.current.site,e=l(t),r=c(""==t.title?"<title>":t.title),n=c(t.desc),i=c(t.include),e.title=""==t.title||"<title>"==t.title?$("head title").text():k(r),e.desc=k(n),e.include=""==t.include&&""!=t.html?t.html:k(i,"html"),e.avatar&&e.avatar.length>0&&""==e.avatar[0].name&&delete e.avatar,e.paging&&e.paging.length>0&&""==e.paging[0].prev&&delete e.paging,e.avatar&&e.avatar.forEach(function(t){var e=Object.keys(t).join(),r=t[e];t[e]=k(c(r),"html")}),e.paging&&e.paging.forEach(function(t){var e=Object.keys(t).join(),r=t[e];t[e]=k(c(r))}),e)}},{key:"Include",value:function(){var t=this.current.site.include,e=[],r=c(t);try{if(h(r)){var n=f(t),i=a(n,2),o=i[0],l=i[1];0==l?(t=t.replace(/\[\[{\$\(|}\]\]|\).html\(\)/g,""),e=$(f("[[["+t+"]]]")[0])):3==l&&(e=o)}else r&&(e=$("body").find(r))}catch(t){}return e}},{key:"Exclude",value:function(t){return function(t,e){var r=[],n="",i=!0,o=!1,l=void 0;try{for(var u,s=e[Symbol.iterator]();!(i=(u=s.next()).done);i=!0){var d=u.value;if(h(d)){var p=f(d),m=a(p,2),v=m[0],g=m[1];if(1==g)n=v;else if(2==g){var y=t.html().match(new RegExp(v,"g"));if(y&&y.length>0){var b=y.join("");n="*["+b+"]"}else n=void 0}else 3==g&&v.remove()}else n=c(d);n&&r.push(n)}}catch(t){o=!0,l=t}finally{try{!i&&s.return&&s.return()}finally{if(o)throw l}}return r.join(",")}(t,this.current.site.exclude)}},{key:"Beautify",value:function(t){this.plugin.beautify&&(this.plugin.beautify.cleanHTML(t,this.pure),this.plugin.beautify.specbeautify(this.current.site.name,t),this.plugin.beautify.removeSpareTag(this.current.site.name,t),this.plugin.beautify.htmlbeautify(t),this.plugin.beautify.commbeautify(this.current.site.name,t))}},{key:"Format",value:function(t){this.plugin.pangu&&this.plugin.pangu.spacingElementByClassName(t)}}]),o}()}); +(function (global, factory) { + typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : + typeof define === 'function' && define.amd ? define(factory) : + (global.PureRead = factory()); +}(this, (function () { 'use strict'; + + var classCallCheck = function (instance, Constructor) { + if (!(instance instanceof Constructor)) { + throw new TypeError("Cannot call a class as a function"); + } + }; + + var createClass = function () { + function defineProperties(target, props) { + for (var i = 0; i < props.length; i++) { + var descriptor = props[i]; + descriptor.enumerable = descriptor.enumerable || false; + descriptor.configurable = true; + if ("value" in descriptor) descriptor.writable = true; + Object.defineProperty(target, descriptor.key, descriptor); + } + } + + return function (Constructor, protoProps, staticProps) { + if (protoProps) defineProperties(Constructor.prototype, protoProps); + if (staticProps) defineProperties(Constructor, staticProps); + return Constructor; + }; + }(); + + var _extends = Object.assign || function (target) { + for (var i = 1; i < arguments.length; i++) { + var source = arguments[i]; + + for (var key in source) { + if (Object.prototype.hasOwnProperty.call(source, key)) { + target[key] = source[key]; + } + } + } + + return target; + }; + + var get = function get(object, property, receiver) { + if (object === null) object = Function.prototype; + var desc = Object.getOwnPropertyDescriptor(object, property); + + if (desc === undefined) { + var parent = Object.getPrototypeOf(object); + + if (parent === null) { + return undefined; + } else { + return get(parent, property, receiver); + } + } else if ("value" in desc) { + return desc.value; + } else { + var getter = desc.get; + + if (getter === undefined) { + return undefined; + } + + return getter.call(receiver); + } + }; + + var inherits = function (subClass, superClass) { + if (typeof superClass !== "function" && superClass !== null) { + throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); + } + + subClass.prototype = Object.create(superClass && superClass.prototype, { + constructor: { + value: subClass, + enumerable: false, + writable: true, + configurable: true + } + }); + if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; + }; + + var possibleConstructorReturn = function (self, call) { + if (!self) { + throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); + } + + return call && (typeof call === "object" || typeof call === "function") ? call : self; + }; + + var slicedToArray = function () { + function sliceIterator(arr, i) { + var _arr = []; + var _n = true; + var _d = false; + var _e = undefined; + + try { + for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { + _arr.push(_s.value); + + if (i && _arr.length === i) break; + } + } catch (err) { + _d = true; + _e = err; + } finally { + try { + if (!_n && _i["return"]) _i["return"](); + } finally { + if (_d) throw _e; + } + } + + return _arr; + } + + return function (arr, i) { + if (Array.isArray(arr)) { + return arr; + } else if (Symbol.iterator in Object(arr)) { + return sliceIterator(arr, i); + } else { + throw new TypeError("Invalid attempt to destructure non-iterable instance"); + } + }; + }(); + + var toConsumableArray = function (arr) { + if (Array.isArray(arr)) { + for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) arr2[i] = arr[i]; + + return arr2; + } else { + return Array.from(arr); + } + }; + + console.log("=== PureRead: Util load ==="); + + /** + * Deep clone object + * + * @param {object} target object + * @return {object} new target object + */ + function clone(target) { + return $.extend(true, {}, target); + } + + /** + * Get URI + * + * @return {string} e.g. current site url is http://www.cnbeta.com/articles/1234.html return http://www.cnbeta.com/articles/ + */ + function getURI() { + var name = function name(pathname) { + pathname = pathname != "/" && pathname.endsWith("/") ? pathname = pathname.replace(/\/$/, "") : pathname; + return pathname.replace(/\/[%@#.~a-zA-Z0-9_-]+$|^\/$/g, ""); + }, + path = name(window.location.pathname); + return window.location.protocol + "//" + window.location.hostname + path + "/"; + } + + /** + * Get url and parser location + * + * @param {string} url + */ + function getLocation(href) { + if (document) { + var a = document.createElement("a"); + a.href = href; + return a; + } else { + var match = href.match(/^(https?\:)\/\/(([^:\/?#]*)(?:\:([0-9]+))?)([\/]{0,1}[^?#]*)(\?[^#]*|)(#.*|)$/); + return match && { + href: href, + protocol: match[1], + host: match[2], + hostname: match[3], + port: match[4], + pathname: match[5], + search: match[6], + hash: match[7] + }; + } + } + + /** + * Verify html + * + * @param {string} input include html tag, e.g.: + <div class="article fmt article__content"> + * + * @return {array} 0: int include ( -1: fail; 0: empty html; 1: success; 2: special tag ) + * 1: result + */ + function verifyHtml(html) { + if (html == "") return [0, html];else if (specTest(html)) return [2, html]; + var item = html.match(/<\S+ (class|id)=("|')?[\w-_=;:' ]+("|')?>?$|<[^/][-_a-zA-Z0-9]+>?$/ig); + if (item && item.length > 0) { + return [1, item]; + } else { + return [-1, undefined]; + } + } + + /** + * Conver html to jquery object + * + * @param {string} input include html tag, e.g.: + <div class="article fmt article__content"> + * + * @return {string} formatting e.g.: + h2#news_title + div.introduction + div.content + div.clearfix + div.rating_box + span + special tag, @see specTest + e.g. [['<strong>▽</strong>']] [[[$('.article-btn')]]] + [[/src=\\S+(342459.png)\\S+'/]] [[{$('.content').html()}]] + * + */ + function selector(html) { + var _verifyHtml = verifyHtml(html), + _verifyHtml2 = slicedToArray(_verifyHtml, 2), + code = _verifyHtml2[0], + item = _verifyHtml2[1]; + + if (code == 2) return html;else if (code == 1) { + var _item$0$trim$replace$ = item[0].trim().replace(/['"<>]/g, "").replace(/ /ig, "=").split("="), + _item$0$trim$replace$2 = slicedToArray(_item$0$trim$replace$, 3), + tag = _item$0$trim$replace$2[0], + prop = _item$0$trim$replace$2[1], + value = _item$0$trim$replace$2[2]; // ["h2", "class", "title"] + + + if (!prop) prop = tag;else if (prop.toLowerCase() === "class") prop = tag + "." + value;else if (prop.toLowerCase() === "id") prop = tag + "#" + value; + return prop; + } else { + return null; + } + } + + /** + * Verify special action, action include: + - [[{juqery code}]] // new Function, e.g. $("xxx").xxx() return string + - [['text']] // remove '<text>' + - [[/regexp/]] // regexp e.g. $("sr-rd-content").find( "*[src='http://ifanr-cdn.b0.upaiyun.com/wp-content/uploads/2016/09/AppSo-qrcode-signature.jpg']" ) + - [[[juqery code]]] // new Function, e.g. $("xxx").find() return jquery object + + * + * @param {string} verify content + * @return {boolen} verify result + */ + function specTest(content) { + return (/^(\[\[)[\[{'/]{1}[ \S]+[}'/\]]\]\]{1}($)/g.test(content) + ); + } + + /** + * Exec special action, action include: @see specTest + * type: 0, 3 - be chiefly used in include logic + * type: 1, 2 - be chiefly used in exclude logic + * + * @param {string} content + * @return {array} 0: result; 1: type( include: -1:error 0:{} 1:'' 2:// 3:[]) + */ + function specAction(content) { + var _ref = [content.replace(/(^)\[\[|\]\]$/g, "")], + value = _ref[0], + type = _ref[1]; + + switch (value[0]) { + case "{": + value = value.replace(/^{|}$/g, ""); + content = function (v) { + return new Function("return " + v)(); + }(value); + type = 0; + break; + case "'": + content = value.replace(/^'|'$/g, ""); + var name = content.match(/^<[a-zA-Z0-9_-]+>/g).join("").replace(/<|>/g, ""); + var str = content.replace(/<[/a-zA-Z0-9_-]+>/g, ""); + content = name + ":contains(" + str + ")"; + type = 1; + break; + case "/": + content = value.replace(/^\/|\/$/g, "").replace(/\\{2}/g, "\\").replace(/'/g, '"'); + type = 2; + break; + case "[": + value = value.replace(/^{|}$/g, ""); + content = function (v) { + return new Function("return " + v)(); + }(value)[0]; + type = 3; + break; + default: + console.error("Not support current action.", content); + type = -1; + break; + } + return [content, type]; + } + + console.log("=== PureRead: AdapteSite load ==="); + + var site = { + url: "", + target: "", + matching: [], + name: "", // only read mode + title: "", // only read mode + desc: "", // only read mode + exclude: [], + include: "", + avatar: [], + paging: [] + }; + var minimatch = void 0, + rdability = void 0, + markdown = void 0, + host_href = void 0; + + var AdapteSite = function () { + function AdapteSite() { + var sites = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : { global: [], custom: [], local: [] }; + classCallCheck(this, AdapteSite); + + this.url = getURI(); + this.sites = sites; // include: global, custom, local, person + this.current = {}; + this.state = "none"; // include: meta, txt, adapter, none, temp + this.origins = []; + host_href = location.href; // origin url + } + + /** + * Set url + */ + + + createClass(AdapteSite, [{ + key: "SetURL", + value: function SetURL(value) { + var uri = getLocation(value); + // Clone util.getURI() source + var name = function name(pathname) { + pathname = pathname != "/" && pathname.endsWith("/") ? pathname = pathname.replace(/\/$/, "") : pathname; + return pathname.replace(/\/[%@#.~a-zA-Z0-9_-]+$|^\/$/g, ""); + }, + path = name(uri.pathname); + this.url = uri.protocol + "//" + uri.hostname + path + "/"; + host_href = value; + } + + /** + * Set global minimatch + */ + + }, { + key: "SetMinimatch", + value: function SetMinimatch(value) { + minimatch = value; + } + + /** + * Set global rdability + */ + + }, { + key: "SetRdability", + value: function SetRdability(value) { + rdability = value; + } + + /** + * Set global markdown + */ + + }, { + key: "SetMarkdown", + value: function SetMarkdown(value) { + markdown = value; + } + + /** + * Not adapter usage mozilla readability and readtmpl + */ + + }, { + key: "Readability", + value: function Readability() { + try { + var _location = document.location, + uri = { + spec: _location.href, + host: _location.host, + prePath: _location.protocol + "//" + _location.host, + scheme: _location.protocol.substr(0, _location.protocol.indexOf(":")), + pathBase: _location.protocol + "//" + _location.host + _location.pathname.substr(0, _location.pathname.lastIndexOf("/") + 1) + }, + article = new rdability.Readability(uri, document.cloneNode(true)).parse(); + if (article && article.content != "") { + console.warn("current parse is Readability", article); + this.Newsite("read", article.content); + this.dom = $(article.content)[0]; + this.state = "temp"; + } else throw "Readability error"; + } catch (error) { + var $dom = readtmpl(); + if ($dom != -1) { + this.Newsite("read", $dom[0].outerHTML); + this.dom = $dom[0]; + this.state = "temp"; + } else this.current.site = clone(site); + } + } + + /** + * Get site from url + * + * @param {string} include: global, custom, local + * @param {string} url + */ + + }, { + key: "Getsite", + value: function Getsite(type, url) { + return this.sites[type].find(function (item) { + return item[0] == url; + }); + } + + /** + * Get sites from url + */ + + }, { + key: "Getsites", + value: function Getsites() { + var _this = this; + + var matching = [], + meta = readmeta(); + this.current.url = this.url; + if (meta) { + this.current.auto = meta.auto; + this.current.url = meta.url; + delete meta.auto; + delete meta.url; + this.current.site = _extends({}, meta); + this.current.site.name.startsWith("metaread::") && (this.state = "meta"); + this.current.site.name.startsWith("txtread::") && (this.state = "txt"); + } else { + getsite("local", new Map(this.sites.local), this.url, matching); + getsite("global", new Map(this.sites.global), this.url, matching); + getsite("person", new Map(this.sites.person), this.url, matching); + getsite("custom", new Map(this.sites.custom), this.url, matching); + if (matching.length > 0) { + var found = void 0; + matching.forEach(function (site) { + if (site[1].active) { + found = site; + _this.current.url = found[0]; + _this.current.site = _this.Safesite(_extends({}, found[1]), found[2], found[0]); + _this.state = "adapter"; + } + }); + if (!found) { + var _found = matching[0]; + _found[1].active = true; + this.current.url = _found[0]; + this.current.site = this.Safesite(_extends({}, _found[1]), _found[2], _found[0]); + this.state = "adapter"; + } + } else { + var obj = readmulti(); + if (obj != -1) { + this.Newmultisite("read", obj); + this.state = "temp"; + } else { + this.Readability(); + } + } + } + this.current.site.matching = matching; + } + + /** + * Add new sites to this.sites.global( global sites ) + * + * @param {object} sites.[array] + * @return {int} update sites count + */ + + }, { + key: "Addsites", + value: function Addsites(result) { + var count = 0; + if (this.sites.global.length == 0) { + this.sites.global = this.Formatsites(result); + count = this.sites.global.length; + } else { + var obj = addsites(this.Formatsites(result), this.sites.global); + count = obj.count; + this.sites.global = obj.newsites; + } + return count; + } + + /** + * Add new sites to this.sites.local( local sites ) + * + * @param {object} new sites + * @return {array} this.sites.local + */ + + }, { + key: "Addlocalsites", + value: function Addlocalsites(new_sites) { + this.sites.local = [].concat(toConsumableArray(new_sites)); + return this.sites.local; + } + + /** + * Add all sites to this.sites + * + * @param {object} new sites + * @return {object} this.sites + */ + + }, { + key: "Addallsites", + value: function Addallsites(sites) { + this.sites = { + global: [].concat(toConsumableArray(sites.global)), + person: [].concat(toConsumableArray(sites.person)), + custom: [].concat(toConsumableArray(sites.custom)), + local: [].concat(toConsumableArray(sites.local)) + }; + return this.sites; + } + + /** + * Add new site( read only ) + * + * @param {string} include: focus, read + * @param {string} when read html is dom.outerHTML + */ + + }, { + key: "Newsite", + value: function Newsite(mode, html) { + var new_site = { mode: mode, url: window.location.href, site: { name: "tempread::" + window.location.host, title: "<title>", desc: "", include: "", exclude: [] } }; + html && (new_site.site.html = html); + this.current.mode = new_site.mode, this.current.url = new_site.url; + this.current.site = this.Safesite(_extends({}, new_site.site), "local", new_site.url); + console.log("【read only】current site object is ", this.current); + } + + /** + * Add new multi-site( read only ) + * + * @param {string} include: focus, read + * @param {object} multi-page, avator, include + */ + + }, { + key: "Newmultisite", + value: function Newmultisite(mode, multi) { + var new_site = { mode: mode, url: window.location.href, site: { name: "tempread::" + window.location.host, title: "<title>", desc: "", include: multi.include, exclude: [], avatar: multi.avatar } }; + this.current.mode = new_site.mode, this.current.url = new_site.url; + this.current.site = this.Safesite(_extends({}, new_site.site), "local", new_site.url); + console.log("【read only】current multi-site object is ", this.current); + } + + /** + * Update url and site from param + * + * @param {string} value is: global, custom, local + * @param {string} older url + * @param {array} [ url, new site] + */ + + }, { + key: "Updatesite", + value: function Updatesite(key, older, newer) { + var idx = this.sites[key].findIndex(function (item) { + return item[0] == older; + }); + idx == -1 && (idx = this.sites[key].length); + this.sites[key].splice(idx, 1, newer); + } + + /** + * Delete site from this.sites.local + * + * @param {string} value is: global, custom, local + * @param {string} older url + * @param {func} callback + */ + + }, { + key: "Deletesite", + value: function Deletesite(key, older, callback) { + var idx = this.sites[key].findIndex(function (item) { + return item[0] == older; + }); + idx != -1 && this.sites[key].splice(idx, 1); + callback(idx); + } + + /** + * Safe site, add all site props + * + * @param {object} modify site + * @param {string} target include: global custom local + * @param {string} url + * @returns {object} site + */ + + }, { + key: "Safesite", + value: function Safesite(site, target, url) { + site.url = url; + site.target = target; + site.name == "" && (site.name = "tempread::"); + (!site.avatar || site.avatar.length == 0) && (site.avatar = [{ name: "" }, { url: "" }]); + (!site.paging || site.paging.length == 0) && (site.paging = [{ prev: "" }, { next: "" }]); + return site; + } + + /** + * Clean useless site props + * + * @param {object} site + * @returns {object} site + */ + + }, { + key: "Cleansite", + value: function Cleansite(site) { + delete site.url; + delete site.html; + delete site.target; + delete site.matching; + site.avatar && site.avatar.length > 0 && site.avatar[0].name == "" && delete site.avatar; + site.paging && site.paging.length > 0 && site.paging[0].prev == "" && delete site.paging; + return site; + } + + /** + * Format sites object from local or remote json file + * + * @param {object} sites.[array] + * @return {array} foramat e.g. [[ <url>, object ],[ <url>, object ]] + */ + + }, { + key: "Formatsites", + value: function Formatsites(result) { + var format = new Map(); + var _iteratorNormalCompletion = true; + var _didIteratorError = false; + var _iteratorError = undefined; + + try { + for (var _iterator = result.sites[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { + var _site = _step.value; + + if (verifysite(_site) != 0) continue; + var url = _site.url; + delete _site.url; + format.set(url, _site); + } + } catch (err) { + _didIteratorError = true; + _iteratorError = err; + } finally { + try { + if (!_iteratorNormalCompletion && _iterator.return) { + _iterator.return(); + } + } finally { + if (_didIteratorError) { + throw _iteratorError; + } + } + } + + return [].concat(toConsumableArray(format)); + } + + /** + * Clear sites + * + * @param {string} site type, only include: global, custom. local + */ + + }, { + key: "Clearsites", + value: function Clearsites(type) { + type ? this.sites[type] = [] : this.sites = { global: [], custom: [], local: [] }; + } + + /** + * Add urls to origins + * + * @param {json} result json + */ + + }, { + key: "Origins", + value: function Origins(result) { + var urls = result.origins.map(function (item) { + return item.url; + }); + urls = new Set(this.origins.concat(urls)); + urls.forEach(function (item) { + if (item.trim() == "" || !item.trim().startsWith("http") || !item.trim().endsWith(".json")) urls.delete(item); + }); + this.origins = [].concat(toConsumableArray(urls)); + return this.origins; + } + + /** + * Add new sites to this.sites.custom( custom sites ) + * + * @param {object} new sites + * @return {array} this.sites.custom + */ + + }, { + key: "Addorigins", + value: function Addorigins(new_sites) { + this.sites.custom = [].concat(toConsumableArray(new_sites)); + return this.sites.custom; + } + + /** + * Clear origins + * + * @returns custom.length + */ + + }, { + key: "Clearorigins", + value: function Clearorigins() { + var len = this.sites.custom.length; + this.sites.custom = []; + return len; + } + }]); + return AdapteSite; + }(); + function readmeta() { + if (minimatch(location.href, "file://**/*.txt") || minimatch(location.href, "http*://**/*.txt")) { + return readtxt(); + } + if (minimatch(location.href, "file://**/*.md") || minimatch(location.href, "http*://**/*.md")) { + return readmd(); + } + var reg = /<\S+ (class|id)=("|')?[\w-_=;:' ]+("|')?>?$|<[^/][-_a-zA-Z0-9]+>?$/ig, + // from util.verifyHtml() + meta = { + name: $("meta[name='simpread:name']").attr("content"), + url: $("meta[name='simpread:url']").attr("content"), + title: $("meta[name='simpread:title']").attr("content"), + desc: $("meta[name='simpread:desc']").attr("content"), + include: $("meta[name='simpread:include']").attr("content"), + exp: $("meta[name='simpread:exclude']").attr("content"), + auto: $("meta[name='simpread:auto']").attr("content"), + exclude: [] + }; + if (meta.name && meta.include) { + if (meta.url && !minimatch(location.href, meta.url)) { + return undefined; + } + !meta.title && (meta.title = "<title>"); + !meta.desc && (meta.desc = ""); + !meta.exp && (meta.exp = ""); + meta.name = "metaread::" + meta.name; + meta.auto = meta.auto == "true" ? true : false; + var idx = ["title", "desc", "include", "exp"].findIndex(function (item) { + return meta[item] != "" && !meta[item].match(reg); + }); + meta.exclude.push(meta.exp); + delete meta.exp; + console.assert(idx == -1, "meta read mode error. ", meta); + return idx == -1 ? meta : undefined; + } else { + console.warn("current not found meta data", meta); + return undefined; + } + } + + /** + * Read txt, include: file and http + */ + function readtxt() { + var title = location.pathname.split("/").pop(), + type = location.protocol == "file:" ? "local" : "remote", + meta = { + name: "txtread::" + type, + title: "<title>", + desc: "", + include: "<pre>", + auto: false, + exclude: [] + }; + if (type == "remote") { + meta.include = ""; + meta.html = $("body pre").html().replace(/\n/ig, "<br>"); + } + !$("title").html() && $("head").append("<title>" + decodeURI(title.replace(".txt", "")) + ""); + return meta; + } + + /** + * Read Markdown, include: file and http + */ + function readmd() { + var title = location.pathname.split("/").pop(), + type = location.protocol == "file:" ? "local" : "remote", + meta = { + name: "txtread::" + type, + title: "", + desc: "", + include: "", + auto: false, + exclude: [] + }; + var converter = new markdown.default.Converter(), + html = converter.makeHtml($("body pre").text()); + meta.html = html; + !$("title").html() && $("head").append("<title>" + decodeURI(title.replace(".md", "")) + ""); + return meta; + } + + /** + * Read mode template, include: + * + * - Hexo + * - WordPress + * - Common( include
) + * + * @return {jquery} jquery object + */ + function readtmpl() { + var $root = $("body"), + selectors = [".post-content", ".entry-content", ".post-article", ".content-post", ".article-entry", ".article-content", ".article-body", ".markdown-body", "[itemprop='articleBody']", "article", ".post", ".content"]; + var _iteratorNormalCompletion2 = true; + var _didIteratorError2 = false; + var _iteratorError2 = undefined; + + try { + for (var _iterator2 = selectors[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) { + var selector$$1 = _step2.value; + + var $target = $root.find(selector$$1); + if ($target.length > 0) { + console.warn("current selector is", selector$$1); + return $target; + } + } + } catch (err) { + _didIteratorError2 = true; + _iteratorError2 = err; + } finally { + try { + if (!_iteratorNormalCompletion2 && _iterator2.return) { + _iterator2.return(); + } + } finally { + if (_didIteratorError2) { + throw _iteratorError2; + } + } + } + + return -1; + } + + /** + * Read mode multi template, include: + * + * - Discuz + * - Discourse + * + * @return {object} true: object; false: -1 + */ + function readmulti() { + if (location.pathname.includes("thread") || location.pathname.includes("forum.php")) { + if ($('.t_f').length > 0 && $('.favatar').find('.authi').length > 0 && $('.avatar').find('img').length > 0) { + return { + avatar: [{ "name": "[[{$('.favatar').find('.authi')}]]" }, { "url": "[[{$('.avatar').find('img')}]]" }], + include: "[[{$('.t_f')}]]" + }; + } + } else if (/\/t\/[\w-]+\/\d+/.test(location.pathname) && $('meta[name=generator]').attr("content").includes("discourse")) { + return { + avatar: [{ "name": "[[{$('.topic-avatar').find('.a[data-user-card]')}]]" }, { "url": "[[{$('.topic-avatar').find('img')}]]" }], + include: "[[{$('.cooked')}]]" + }; + } + return -1; + } + + /** + * Add new sites to old sites + * + * @param {array} new sites from local or remote + * @param {array} current sites from this.sites.global + * @return {object} count: new sites; forced: update sites( discard, all site must be forced update) + */ + function addsites(newsites, old) { + var oldsites = new Map(old), + urls = [].concat(toConsumableArray(oldsites.keys())); + var count = 0; + + newsites.map(function (site) { + if (!urls.includes(site[0])) { + count++; + } else if (urls.includes(site[0])) { + } + }); + return { count: count, newsites: newsites }; + } + + /** + * Find site by url from sites + * + * @param {string} type, include: global, local, custom + * @param {map} sites + * @param {string} url + * @param {array} matching sites + * + * @return {array} 0: current site; 1: current url, 2: type + */ + function getsite(type, sites, url) { + var matching = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : []; + + var domain = function domain(names) { + var arr = names.replace("www.", "").match(/\.\S+\.\S+/g); + if (arr) { + return arr[0].substr(1); + } else { + return names.replace("www.", ""); + } + }, + local = getLocation(host_href), + urls = [].concat(toConsumableArray(sites.keys())), + arr = url.match(/[.a-zA-z0-9-_]+/g), + uri = arr[1].replace("www.", ""), + hostname = domain(local.hostname), + isroot = function isroot() { + return local.pathname == "/" || /\/(default|index|portal).[0-9a-zA-Z]+$/.test(local.pathname); + }; + var _iteratorNormalCompletion3 = true; + var _didIteratorError3 = false; + var _iteratorError3 = undefined; + + try { + for (var _iterator3 = urls[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) { + var cur = _step3.value; + + var name = sites.get(cur).name, + sufname = domain(name); + if (!isroot() && !cur.endsWith("*") && cur.replace(/^http[s]?:/, "") == url.replace(/^http[s]?:/, "")) { + matching.push([cur, clone(sites.get(cur)), type]); + } else if (cur.match(/\*/g) && cur.match(/\*/g).length == 1 && !isroot() && cur.endsWith("*") && uri.includes(sufname) && hostname == sufname && url.includes(name)) { + // e.g. https://www.douban.com/* http://mp.weixin.qq.com/* + matching.push([cur, clone(sites.get(cur)), type]); + } else if (minimatch(local.origin + local.pathname, cur)) { + matching.push([cur, clone(sites.get(cur)), type]); + } + } + } catch (err) { + _didIteratorError3 = true; + _iteratorError3 = err; + } finally { + try { + if (!_iteratorNormalCompletion3 && _iterator3.return) { + _iterator3.return(); + } + } finally { + if (_didIteratorError3) { + throw _iteratorError3; + } + } + } + } + + /** + * Verify site validity, include: + * - name, url, include, error is -1 + * - title include desc, error is -2 + * - paging, error is -3 ~ -6 + * - avatar, error is -7 ~ -10 + * + * @param {object} site + */ + function verifysite(site) { + if (!site.name || !site.url || !site.include) return -1; + if (verifyHtml(site.title)[0] == -1 || verifyHtml(site.include)[0] == -1 || verifyHtml(site.desc)[0] == -1) { + return -2; + } + if (site.paging) { + if (site.paging.length != 2) return -3; + if (!site.paging[0].prev) return -4; + if (!site.paging[1].next) return -5; + if (verifyHtml(site.paging[0].prev)[0] == -1 || verifyHtml(site.paging[1].next)[0] == -1) { + return -6; + } + } + if (site.avatar) { + if (site.avatar.length != 2) return -7; + if (!site.avatar[0].name) return -8; + if (!site.avatar[1].url) return -9; + if (verifyHtml(site.avatar[0].name)[0] == -1 || verifyHtml(site.avatar[1].url)[0] == -1) { + return -10; + } + } + return 0; + } + + console.log("=== PureRead: PureRead load ==="); + + var PureRead = function (_AdapteSite) { + inherits(PureRead, _AdapteSite); + + function PureRead(sites) { + classCallCheck(this, PureRead); + + var _this = possibleConstructorReturn(this, (PureRead.__proto__ || Object.getPrototypeOf(PureRead)).call(this, sites)); + + _this.version = "0.0.4 build 0424"; + _this.org_url = location.href; + _this.html = {}; // clone site, include: title, desc, include, avatar, paging + _this.plugin = {}; + _this.pure = false; // when true, is remove style, class attr + _this.cleanup = false; // when true, call beautify.cleanHTML() + return _this; + } + + /** + * Verify current puread is same + * + * @return {boolean} true: same; false: not same; + */ + + + createClass(PureRead, [{ + key: 'Exist', + value: function Exist() { + return this.org_url == location.href; + } + + /** + * Add Plugin + * + * @param {object} plugin object + */ + + }, { + key: 'AddPlugin', + value: function AddPlugin(plugin) { + this.plugin = { + minimatch: plugin.minimatch, + pangu: plugin.pangu, + beautify: plugin.beautify, + stylesheet: plugin.style, + rdability: plugin.rdability, + markdown: plugin.markdown + }; + get(PureRead.prototype.__proto__ || Object.getPrototypeOf(PureRead.prototype), 'SetMinimatch', this).call(this, this.plugin.minimatch); + get(PureRead.prototype.__proto__ || Object.getPrototypeOf(PureRead.prototype), 'SetRdability', this).call(this, this.plugin.rdability); + get(PureRead.prototype.__proto__ || Object.getPrototypeOf(PureRead.prototype), 'SetMarkdown', this).call(this, this.plugin.markdown); + } + + /** + * Create temp read mode + * + * @param {string} include: read, focus + * @param {dom} html dom element + */ + + }, { + key: 'TempMode', + value: function TempMode(mode, dom) { + this.state = "temp"; + this.dom = dom; + this.Newsite(mode, dom.outerHTML); + } + + /** + * Get read mode html + */ + + }, { + key: 'ReadMode', + value: function ReadMode() { + this.html = wrap(this.current.site); + } + + /** + * Get highlight( focus ) jquery, only usage focus mode + * + * @return {jquery} jquery object + */ + + }, { + key: 'Include', + value: function Include() { + var include = this.current.site.include, + $focus = []; + var target = selector(include); + try { + if (specTest(target)) { + var _util$specAction = specAction(include), + _util$specAction2 = slicedToArray(_util$specAction, 2), + value = _util$specAction2[0], + state = _util$specAction2[1]; + + if (state == 0) { + include = include.replace(/\[\[{\$\(|}\]\]|\).html\(\)/g, ""); + $focus = $(specAction('[[[' + include + ']]]')[0]); + } else if (state == 3) { + $focus = value; + } + } else if (target) { + $focus = $("body").find(target); + } + } catch (error) { + console.error("Get $focus failed", error); + } + return $focus; + } + + /** + * Get exlcude jquery selector array list + * + * @param {jquery} jquery object + * @return {array} jquery selector + */ + + }, { + key: 'Exclude', + value: function Exclude($target) { + return excludeSelector($target, this.current.site.exclude); + } + + /** + * Beautify html + * + * @param {jquery} jquery + */ + + }, { + key: 'Beautify', + value: function Beautify($target) { + if (this.plugin.beautify) { + this.cleanup && this.plugin.beautify.cleanHTML($target, this.pure); + this.plugin.beautify.specbeautify(this.current.site.name, $target); + this.plugin.beautify.removeSpareTag(this.current.site.name, $target); + this.plugin.beautify.htmlbeautify($target); + this.plugin.beautify.commbeautify(this.current.site.name, $target); + } + } + + /** + * Format usage pangu plugin + * + * @param {string} class name + */ + + }, { + key: 'Format', + value: function Format(cls) { + this.plugin.pangu && this.plugin.pangu.spacingElementByClassName(cls); + } + }]); + return PureRead; + }(AdapteSite); + function wrap(site) { + var wrapper = clone(site), + title = selector(site.title == "" ? "" : site.title), + desc = selector(site.desc), + include = selector(site.include); + wrapper.title = site.title == "" || site.title == "<title>" ? $("head title").text() : query(title); + wrapper.desc = query(desc); + wrapper.include = site.include == "" && site.html != "" ? site.html : query(include, "html"); + wrapper.avatar && wrapper.avatar.length > 0 && wrapper.avatar[0].name == "" && delete wrapper.avatar; + wrapper.paging && wrapper.paging.length > 0 && wrapper.paging[0].prev == "" && delete wrapper.paging; + wrapper.avatar && wrapper.avatar.forEach(function (item) { + var key = Object.keys(item).join(), + value = item[key]; + item[key] = query(selector(value), "html"); + }); + wrapper.paging && wrapper.paging.forEach(function (item) { + var key = Object.keys(item).join(), + value = item[key]; + item[key] = query(selector(value)); + }); + return wrapper; + } + + /** + * Query content usage jquery + * + * @param {string} query content + * @param {string} type, incldue: text, html and multi + * @return {string} query result + */ + function query(content) { + var type = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "text"; + + var $root = $("html"); + if (specTest(content)) { + var _util$specAction3 = specAction(content), + _util$specAction4 = slicedToArray(_util$specAction3, 2), + value = _util$specAction4[0], + state = _util$specAction4[1]; + + if (state == 0) { + content = value; + } else if (state == 3) { + content = getcontent($root.find(value)); + } + } else if (type == "html") { + content = getcontent($root.find(content)); + } else if (type == "multi") { + // TO-DO + } else { + content = $root.find(content).text().trim(); + } + return content; + } + + /** + * Get content from current.site.include + * + * @param {jquery} jquery object e.g. $root.find( content ) + * @return {string} $target html + */ + function getcontent($target) { + var html = ""; + switch ($target.length) { + case 0: + html = "<sr-rd-content-error></sr-rd-content-error>"; + break; + case 1: + html = $target.html().trim(); + break; + default: + html = $target.map(function (index, item) { + return $(item).html(); + }).get().join("<br>"); + break; + } + return html; + } + + /** + * Get exclude tags list + * + * @param {jquery} jquery object + * @param {array} hidden html + * @return {string} tags list string + */ + function excludeSelector($target, exclude) { + var tags = [], + tag = ""; + var _iteratorNormalCompletion = true; + var _didIteratorError = false; + var _iteratorError = undefined; + + try { + for (var _iterator = exclude[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { + var content = _step.value; + + if (specTest(content)) { + var _util$specAction5 = specAction(content), + _util$specAction6 = slicedToArray(_util$specAction5, 2), + value = _util$specAction6[0], + type = _util$specAction6[1]; + + if (type == 1) { + tag = value; + } else if (type == 2) { + var arr = $target.html().match(new RegExp(value, "g")); + if (arr && arr.length > 0) { + var str = arr.join(""); + tag = '*[' + str + ']'; + } else { + tag = undefined; + } + } else if (type == 3) { + value.remove(); + } + } else { + tag = selector(content); + } + if (tag) tags.push(tag); + } + } catch (err) { + _didIteratorError = true; + _iteratorError = err; + } finally { + try { + if (!_iteratorNormalCompletion && _iterator.return) { + _iterator.return(); + } + } finally { + if (_didIteratorError) { + throw _iteratorError; + } + } + } + + return tags.join(","); + } + + return PureRead; + +}))); From c94d9c53e9e60fead09a67caa7a8e02534b30f65 Mon Sep 17 00:00:00 2001 From: Kenshin <fxblog@gmail.com> Date: Wed, 24 Apr 2019 10:15:46 +0800 Subject: [PATCH 25/43] Update puread files. --- src/vender/puread/puplugin.min.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/vender/puread/puplugin.min.js b/src/vender/puread/puplugin.min.js index b31e5f65..1dd28665 100644 --- a/src/vender/puread/puplugin.min.js +++ b/src/vender/puread/puplugin.min.js @@ -1893,7 +1893,7 @@ sina = $target.attr("real_src"), fixOverflowImgsize = function fixOverflowImgsize() { $img.removeClass("sr-rd-content-img-load"); - if ($img[0].clientWidth < 400) { + if ($img[0].clientWidth < 300 && $img[0].clientHeight < 300) { $img.parent().removeClass("sr-rd-content-center").addClass("sr-rd-content-center-small"); } else if ($img[0].clientWidth > 1000) { $img.css("zoom", "0.6"); From 3281a96f4d2543f010df5180edbe7c10fe5019db Mon Sep 17 00:00:00 2001 From: Kenshin <fxblog@gmail.com> Date: Wed, 24 Apr 2019 11:02:56 +0800 Subject: [PATCH 26/43] Optimize theme common css. --- src/assets/css/theme_common.css | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/assets/css/theme_common.css b/src/assets/css/theme_common.css index be3af248..5f1a6bde 100644 --- a/src/assets/css/theme_common.css +++ b/src/assets/css/theme_common.css @@ -13,8 +13,13 @@ sr-rd-title, sr-rd-desc, sr-rd-content { } sr-rd-title { - text-rendering: optimizelegibility; + display: -webkit-box; margin: 1em 0px 0.5em; + overflow : hidden; + text-overflow: ellipsis; + text-rendering: optimizelegibility; + -webkit-line-clamp: 3; + -webkit-box-orient: vertical; } sr-rd-content { From 23782db1cc8f71e52e3ef4574495fad6fd887bc3 Mon Sep 17 00:00:00 2001 From: Kenshin <fxblog@gmail.com> Date: Wed, 24 Apr 2019 11:30:11 +0800 Subject: [PATCH 27/43] Optimize theme common css. --- src/assets/css/theme_common.css | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/assets/css/theme_common.css b/src/assets/css/theme_common.css index 5f1a6bde..430be3b9 100644 --- a/src/assets/css/theme_common.css +++ b/src/assets/css/theme_common.css @@ -206,6 +206,14 @@ sr-rd-content p code { font-size: 1.1rem; } +sr-rd-content mark { + margin: 0 5px; + padding: 2px; + + background: #fffdd1; + border-bottom: 1px solid #ffedce; +} + .sr-rd-content-img { width: 90%; height: auto; From b5492ed715d95b86d648700ced60a51cb19beae4 Mon Sep 17 00:00:00 2001 From: Kenshin <fxblog@gmail.com> Date: Wed, 24 Apr 2019 11:32:42 +0800 Subject: [PATCH 28/43] Update bundle files. --- src/vender/puread/puplugin.min.js | 166 ++++++++++++++++-------------- 1 file changed, 87 insertions(+), 79 deletions(-) diff --git a/src/vender/puread/puplugin.min.js b/src/vender/puread/puplugin.min.js index 1dd28665..8ea51242 100644 --- a/src/vender/puread/puplugin.min.js +++ b/src/vender/puread/puplugin.min.js @@ -1572,10 +1572,10 @@ console.log("=== PureRead: Beautify load ==="); - /** - * Beautify html - * - * @param {string} storage.current.site.name + /** + * Beautify html + * + * @param {string} storage.current.site.name */ function specbeautify(name, $target) { switch (name) { @@ -1818,11 +1818,11 @@ } } - /** - * Remove spare tag - * - * @param {string} storage.current.site.name - * @param {jquery} jquery object + /** + * Remove spare tag + * + * @param {string} storage.current.site.name + * @param {jquery} jquery object */ function removeSpareTag(name, $target) { var remove = false, @@ -1846,13 +1846,13 @@ } } - /** - * Beautify html, incldue: - * - * - change all <blockquote> to <sr-blockquote> - * - remove useless <br> - * - * @param {jquery} jquery object + /** + * Beautify html, incldue: + * + * - change all <blockquote> to <sr-blockquote> + * - remove useless <br> + * + * @param {jquery} jquery object */ function htmlbeautify($target) { try { @@ -1869,16 +1869,16 @@ } } - /** - * Common Beautify html, include: - * - task: all webiste image, remove old image and create new image - * - task: all webiste sr-blockquote, remove style - * - task: all webiste iframe, embed add center style - * - task: all hr tag add simpread-hidden class - * - task: all pre/code tag remove class - * - task: all a tag remove style - * - * @param {jquery} + /** + * Common Beautify html, include: + * - task: all webiste image, remove old image and create new image + * - task: all webiste sr-blockquote, remove style + * - task: all webiste iframe, embed add center style + * - task: all hr tag add simpread-hidden class + * - task: all pre/code tag remove class + * - task: all a tag remove style + * + * @param {jquery} */ function commbeautify(name, $target) { $target.find("img:not(.sr-rd-content-nobeautify)").map(function (index, item) { @@ -1999,11 +1999,11 @@ $target.find("a").removeAttr("style"); } - /** - * Clean HTML usage $.parseHTML - * - * @param {jquery} $('sr-rd-content') - * @param {boolean} when true, is remove style, class attr + /** + * Clean HTML usage $.parseHTML + * + * @param {jquery} $('sr-rd-content') + * @param {boolean} when true, is remove style, class attr */ function cleanHTML($target, is_pure) { var clear = function clear(str) { @@ -2034,18 +2034,18 @@ orgHTML = $target.children().html(); } orgHTML = orgHTML.replace(/<!--[\S ]+-->/ig, ''); - /* - const lines = orgHTML.split( '\n' ); - let newLine = ''; - for( let i = 0; i < lines.length; i++ ) { - let str = lines[i]; - if ( !str.trim().startsWith( '<' ) ) { - newLine += `<p>${str}</p>` + '\n'; - } else if ( str.trim().length > 0 ) { - newLine += str + '\n'; - } - } - $target.html( clear( newLine ) ); + /* + const lines = orgHTML.split( '\n' ); + let newLine = ''; + for( let i = 0; i < lines.length; i++ ) { + let str = lines[i]; + if ( !str.trim().startsWith( '<' ) ) { + newLine += `<p>${str}</p>` + '\n'; + } else if ( str.trim().length > 0 ) { + newLine += str + '\n'; + } + } + $target.html( clear( newLine ) ); */ $target.html(clear(orgHTML)); is_pure && $target.find('pre code').each(function (idx, item) { @@ -2056,7 +2056,15 @@ } catch (error) { item.outerText = item.outerText; } - }); + }); + is_pure && $target.find('p').each( (idx,item)=>{ + var tag = item.tagName, + text = item.outerText, + html = item.outerHTML; + if ( text.trim() == "" && !html.includes( '<img' ) ) { + item.outerText = ""; + } + }); } var be = /*#__PURE__*/Object.freeze({ @@ -2264,45 +2272,45 @@ VerifyCustom: vfyCustom }); - /* - * Copyright (c) 2010 Arc90 Inc - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + /* + * Copyright (c) 2010 Arc90 Inc + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ /*eslint-env es6:false*/ - /* - * Copyright (c) 2010 Arc90 Inc - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + /* + * Copyright (c) 2010 Arc90 Inc + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ - /* - * This code is heavily based on Arc90's readability.js (1.7.1) script - * available at: http://code.google.com/p/arc90labs-readability + /* + * This code is heavily based on Arc90's readability.js (1.7.1) script + * available at: http://code.google.com/p/arc90labs-readability */ - /** - * Public constructor. - * @param {HTMLDocument} doc The document to parse. - * @param {Object} options The options object. + /** + * Public constructor. + * @param {HTMLDocument} doc The document to parse. + * @param {Object} options The options object. */ function Readability(a, b) { if (b && b.documentElement) a = b, b = arguments[2];else if (!a || !a.documentElement) throw new Error("First argument to Readability constructor should be a document object.");b = b || {}, this._doc = a, this._articleTitle = null, this._articleByline = null, this._articleDir = null, this._articleSiteName = null, this._attempts = [], this._debug = !!b.debug, this._maxElemsToParse = b.maxElemsToParse || this.DEFAULT_MAX_ELEMS_TO_PARSE, this._nbTopCandidates = b.nbTopCandidates || this.DEFAULT_N_TOP_CANDIDATES, this._charThreshold = b.charThreshold || this.DEFAULT_CHAR_THRESHOLD, this._classesToPreserve = this.CLASSES_TO_PRESERVE.concat(b.classesToPreserve || []), this._flags = this.FLAG_STRIP_UNLIKELYS | this.FLAG_WEIGHT_CLASSES | this.FLAG_CLEAN_CONDITIONALLY;var c;this._debug ? (c = function c(a) { From 2a7e8362a3a658bebfe008d13adc75d1c6562fec Mon Sep 17 00:00:00 2001 From: Kenshin <fxblog@gmail.com> Date: Wed, 24 Apr 2019 15:54:30 +0800 Subject: [PATCH 29/43] Update puread files. --- src/vender/puread/puplugin.min.js | 181 +++++++++++++++--------------- src/vender/puread/puread.min.js | 16 ++- 2 files changed, 106 insertions(+), 91 deletions(-) diff --git a/src/vender/puread/puplugin.min.js b/src/vender/puread/puplugin.min.js index 8ea51242..50131be5 100644 --- a/src/vender/puread/puplugin.min.js +++ b/src/vender/puread/puplugin.min.js @@ -1572,10 +1572,10 @@ console.log("=== PureRead: Beautify load ==="); - /** - * Beautify html - * - * @param {string} storage.current.site.name + /** + * Beautify html + * + * @param {string} storage.current.site.name */ function specbeautify(name, $target) { switch (name) { @@ -1818,11 +1818,11 @@ } } - /** - * Remove spare tag - * - * @param {string} storage.current.site.name - * @param {jquery} jquery object + /** + * Remove spare tag + * + * @param {string} storage.current.site.name + * @param {jquery} jquery object */ function removeSpareTag(name, $target) { var remove = false, @@ -1846,13 +1846,13 @@ } } - /** - * Beautify html, incldue: - * - * - change all <blockquote> to <sr-blockquote> - * - remove useless <br> - * - * @param {jquery} jquery object + /** + * Beautify html, incldue: + * + * - change all <blockquote> to <sr-blockquote> + * - remove useless <br> + * + * @param {jquery} jquery object */ function htmlbeautify($target) { try { @@ -1869,16 +1869,16 @@ } } - /** - * Common Beautify html, include: - * - task: all webiste image, remove old image and create new image - * - task: all webiste sr-blockquote, remove style - * - task: all webiste iframe, embed add center style - * - task: all hr tag add simpread-hidden class - * - task: all pre/code tag remove class - * - task: all a tag remove style - * - * @param {jquery} + /** + * Common Beautify html, include: + * - task: all webiste image, remove old image and create new image + * - task: all webiste sr-blockquote, remove style + * - task: all webiste iframe, embed add center style + * - task: all hr tag add simpread-hidden class + * - task: all pre/code tag remove class + * - task: all a tag remove style + * + * @param {jquery} */ function commbeautify(name, $target) { $target.find("img:not(.sr-rd-content-nobeautify)").map(function (index, item) { @@ -1999,13 +1999,14 @@ $target.find("a").removeAttr("style"); } - /** - * Clean HTML usage $.parseHTML - * - * @param {jquery} $('sr-rd-content') - * @param {boolean} when true, is remove style, class attr + /** + * Clean HTML usage $.parseHTML + * + * @param {jquery} $('sr-rd-content') + * @param {boolean} when true, is remove style, class attr + * @param {boolean} is_mathjax */ - function cleanHTML($target, is_pure) { + function cleanHTML($target, is_pure, is_mathjax) { var clear = function clear(str) { var parse = $.parseHTML(str); var newHTML = ''; @@ -2021,7 +2022,7 @@ //console.warn( 'bad tag ',tag, html, '|' + text + '|' ) // TO-DO } else { - is_pure ? newHTML += html.replace(/ (style|id|class)="[\w ;%@#!-:(),\u4e00-\u9fa5]*"/ig, "") : newHTML += html; + is_pure && is_mathjax == false ? newHTML += html.replace(/ (style|id|class)="[\w ;%@#!-:(),\u4e00-\u9fa5]*"/ig, "") : newHTML += html; } }); return newHTML; @@ -2034,37 +2035,37 @@ orgHTML = $target.children().html(); } orgHTML = orgHTML.replace(/<!--[\S ]+-->/ig, ''); - /* - const lines = orgHTML.split( '\n' ); - let newLine = ''; - for( let i = 0; i < lines.length; i++ ) { - let str = lines[i]; - if ( !str.trim().startsWith( '<' ) ) { - newLine += `<p>${str}</p>` + '\n'; - } else if ( str.trim().length > 0 ) { - newLine += str + '\n'; - } - } - $target.html( clear( newLine ) ); + /* + const lines = orgHTML.split( '\n' ); + let newLine = ''; + for( let i = 0; i < lines.length; i++ ) { + let str = lines[i]; + if ( !str.trim().startsWith( '<' ) ) { + newLine += `<p>${str}</p>` + '\n'; + } else if ( str.trim().length > 0 ) { + newLine += str + '\n'; + } + } + $target.html( clear( newLine ) ); */ $target.html(clear(orgHTML)); is_pure && $target.find('pre code').each(function (idx, item) { try { item.outerText = item.outerText.split('\n').filter(function (item) { return item.trim() != ""; - }).join('\n'); + }).join('\n') + '\n'; } catch (error) { item.outerText = item.outerText; } - }); - is_pure && $target.find('p').each( (idx,item)=>{ - var tag = item.tagName, - text = item.outerText, - html = item.outerHTML; - if ( text.trim() == "" && !html.includes( '<img' ) ) { - item.outerText = ""; - } - }); + }); + is_pure && $target.find('p').each(function (idx, item) { + var tag = item.tagName, + text = item.outerText, + html = item.outerHTML; + if (text.trim() == "" && !html.includes('<img')) { + item.outerText = ""; + } + }); } var be = /*#__PURE__*/Object.freeze({ @@ -2272,45 +2273,45 @@ VerifyCustom: vfyCustom }); - /* - * Copyright (c) 2010 Arc90 Inc - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + /* + * Copyright (c) 2010 Arc90 Inc + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ /*eslint-env es6:false*/ - /* - * Copyright (c) 2010 Arc90 Inc - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + /* + * Copyright (c) 2010 Arc90 Inc + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ - /* - * This code is heavily based on Arc90's readability.js (1.7.1) script - * available at: http://code.google.com/p/arc90labs-readability + /* + * This code is heavily based on Arc90's readability.js (1.7.1) script + * available at: http://code.google.com/p/arc90labs-readability */ - /** - * Public constructor. - * @param {HTMLDocument} doc The document to parse. - * @param {Object} options The options object. + /** + * Public constructor. + * @param {HTMLDocument} doc The document to parse. + * @param {Object} options The options object. */ function Readability(a, b) { if (b && b.documentElement) a = b, b = arguments[2];else if (!a || !a.documentElement) throw new Error("First argument to Readability constructor should be a document object.");b = b || {}, this._doc = a, this._articleTitle = null, this._articleByline = null, this._articleDir = null, this._articleSiteName = null, this._attempts = [], this._debug = !!b.debug, this._maxElemsToParse = b.maxElemsToParse || this.DEFAULT_MAX_ELEMS_TO_PARSE, this._nbTopCandidates = b.nbTopCandidates || this.DEFAULT_N_TOP_CANDIDATES, this._charThreshold = b.charThreshold || this.DEFAULT_CHAR_THRESHOLD, this._classesToPreserve = this.CLASSES_TO_PRESERVE.concat(b.classesToPreserve || []), this._flags = this.FLAG_STRIP_UNLIKELYS | this.FLAG_WEIGHT_CLASSES | this.FLAG_CLEAN_CONDITIONALLY;var c;this._debug ? (c = function c(a) { diff --git a/src/vender/puread/puread.min.js b/src/vender/puread/puread.min.js index 97987053..9c08a55f 100644 --- a/src/vender/puread/puread.min.js +++ b/src/vender/puread/puread.min.js @@ -392,6 +392,20 @@ markdown = value; } + /** + * is MathJax mode + */ + + }, { + key: "isMathJax", + value: function isMathJax() { + var is_mathjax = false; + $('head').find('style').each(function (idx, item) { + /.mathjax/ig.test(item.outerText) && (is_mathjax = true); + }); + return is_mathjax; + } + /** * Not adapter usage mozilla readability and readtmpl */ @@ -1169,7 +1183,7 @@ key: 'Beautify', value: function Beautify($target) { if (this.plugin.beautify) { - this.cleanup && this.plugin.beautify.cleanHTML($target, this.pure); + this.cleanup && this.plugin.beautify.cleanHTML($target, this.pure, this.isMathJax()); this.plugin.beautify.specbeautify(this.current.site.name, $target); this.plugin.beautify.removeSpareTag(this.current.site.name, $target); this.plugin.beautify.htmlbeautify($target); From d1ca716f8e366c0a3f71c28e540c560e4758e020 Mon Sep 17 00:00:00 2001 From: Kenshin <fxblog@gmail.com> Date: Wed, 24 Apr 2019 16:02:37 +0800 Subject: [PATCH 30/43] Update puread files. --- src/vender/puread/puread.min.js | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/vender/puread/puread.min.js b/src/vender/puread/puread.min.js index 9c08a55f..bc6cc2fb 100644 --- a/src/vender/puread/puread.min.js +++ b/src/vender/puread/puread.min.js @@ -340,6 +340,7 @@ this.current = {}; this.state = "none"; // include: meta, txt, adapter, none, temp this.origins = []; + this.mathjax = undefined; host_href = location.href; // origin url } @@ -399,11 +400,13 @@ }, { key: "isMathJax", value: function isMathJax() { - var is_mathjax = false; - $('head').find('style').each(function (idx, item) { - /.mathjax/ig.test(item.outerText) && (is_mathjax = true); - }); - return is_mathjax; + if (mathjax == undefined) { + mathjax = false; + $('head').find('style').each(function (idx, item) { + /.mathjax/ig.test(item.outerText) && (mathjax = true); + }); + } + return mathjax; } /** From f2b811281a3e3b4e7122357abc2af8eeed023352 Mon Sep 17 00:00:00 2001 From: Kenshin <fxblog@gmail.com> Date: Wed, 24 Apr 2019 16:06:35 +0800 Subject: [PATCH 31/43] Add puread parse engine config. --- src/contentscripts.js | 2 ++ src/module/labs.jsx | 22 ++++++++++++++++++++++ 2 files changed, 24 insertions(+) diff --git a/src/contentscripts.js b/src/contentscripts.js index 0c5358ae..d7da686e 100644 --- a/src/contentscripts.js +++ b/src/contentscripts.js @@ -267,6 +267,8 @@ function browserAction( is_update ) { */ function pRead() { pr = new PureRead( storage.sites ); + pr.cleanup = storage.read.cleanup == undefined ? true : storage.read.cleanup; + pr.pure = storage.read.pure == undefined ? false : storage.read.pure; pr.AddPlugin( puplugin.Plugin() ); pr.Getsites(); storage.puread = pr; diff --git a/src/module/labs.jsx b/src/module/labs.jsx index cf0a02ec..3135fa37 100644 --- a/src/module/labs.jsx +++ b/src/module/labs.jsx @@ -32,6 +32,7 @@ export default class LabsOpt extends React.Component { this.props.onChange && this.props.onChange( true ); model == "read" && state == "auto" && this.exclusionState( value ); model == "read" && state == "toc" && this.tocState( value ); + model == "read" && state == "cleanup" && this.cleanupState( value ); } changeExclusion( event ) { @@ -48,6 +49,10 @@ export default class LabsOpt extends React.Component { $( this.refs.toc ).velocity( value ? "slideDown" : "slideUp" ); } + cleanupState( value ) { + $( this.refs.cleanup ).velocity( value ? "slideDown" : "slideUp" ); + } + exclusionState( value ) { $( this.refs.exclusion ).velocity( value ? "slideDown" : "slideUp" ); $( this.refs.whitelist ).velocity( !value ? "slideDown" : "slideUp" ); @@ -61,6 +66,7 @@ export default class LabsOpt extends React.Component { componentDidMount() { this.exclusionState( this.props.read.auto ); this.tocState( this.props.read.toc ); + this.cleanupState( this.props.read.cleanup == undefined ? true : this.props.read.cleanup ); } onClick( state ) { @@ -199,6 +205,22 @@ export default class LabsOpt extends React.Component { </div> </div> + <div className="label">词法分析引擎 <a target="_blank" href="http://ksria.com/simpread/docs/#/词法分析引擎" style={{ color:' #FF5252', borderBottom: '2px dotted', fontSize: '10px', fontWeight: 'bold', cursor: 'pointer' }}>测试版</a></div> + <div style={{ 'padding-top': '10px', 'position': 'relative' }} className="lab"> + <Switch width="100%" checked={ this.props.read.cleanup == undefined ? true : this.props.read.cleanup } + thumbedColor="#3F51B5" trackedColor="#7986CB" + label="是否启用增强解析模式?" + desc="增强解析模式会对版面重新设计,包括:去除多余空格、优化版面结构等,此功能为测试版,遇到解析失败时,请关闭此功能。" + onChange={ (s)=>this.onChange(s, "read", "cleanup") } /> + <div ref="cleanup" style={{ 'padding-top': '10px', 'margin-bottom': '8px;' }}> + <Switch width="100%" checked={ this.props.read.pure } + thumbedColor="#3F51B5" trackedColor="#7986CB" + label="纯粹模式" + desc="比【增强解析模式】还要彻底优化版本,包括:字形、颜色、字号、代码段等,专治页面及不规范,如:微信订阅号,CSDN 等。" + onChange={ (s)=>this.onChange(s, "read", "pure") } /> + </div> + </div> + <div className="label">授权管理</div> <div style={{ 'padding-top': '10px' }} className="lab"> <Auth/> From 1b6031daf2065e534b4120ee8c753a202e56e3fa Mon Sep 17 00:00:00 2001 From: Kenshin <fxblog@gmail.com> Date: Wed, 24 Apr 2019 16:22:41 +0800 Subject: [PATCH 32/43] Update puread files. --- src/vender/puread/puread.min.js | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/vender/puread/puread.min.js b/src/vender/puread/puread.min.js index bc6cc2fb..628eee5a 100644 --- a/src/vender/puread/puread.min.js +++ b/src/vender/puread/puread.min.js @@ -400,13 +400,15 @@ }, { key: "isMathJax", value: function isMathJax() { - if (mathjax == undefined) { - mathjax = false; + var _this = this; + + if (this.mathjax == undefined) { + this.mathjax = false; $('head').find('style').each(function (idx, item) { - /.mathjax/ig.test(item.outerText) && (mathjax = true); + /.mathjax/ig.test(item.outerText) && (_this.mathjax = true); }); } - return mathjax; + return this.mathjax; } /** @@ -464,7 +466,7 @@ }, { key: "Getsites", value: function Getsites() { - var _this = this; + var _this2 = this; var matching = [], meta = readmeta(); @@ -487,9 +489,9 @@ matching.forEach(function (site) { if (site[1].active) { found = site; - _this.current.url = found[0]; - _this.current.site = _this.Safesite(_extends({}, found[1]), found[2], found[0]); - _this.state = "adapter"; + _this2.current.url = found[0]; + _this2.current.site = _this2.Safesite(_extends({}, found[1]), found[2], found[0]); + _this2.state = "adapter"; } }); if (!found) { From 5cf85f1a366e09f367bde8d97e6fe8134f358fd9 Mon Sep 17 00:00:00 2001 From: Kenshin <fxblog@gmail.com> Date: Thu, 25 Apr 2019 16:11:44 +0800 Subject: [PATCH 33/43] Add mathjax read mode workflow. --- src/read/read.jsx | 36 ++++++++++++++++++++++++++++++++---- 1 file changed, 32 insertions(+), 4 deletions(-) diff --git a/src/read/read.jsx b/src/read/read.jsx index 777b6bdc..c8e8e3c3 100644 --- a/src/read/read.jsx +++ b/src/read/read.jsx @@ -213,13 +213,41 @@ class Read extends React.Component { * */ function Render() { - storage.pr.ReadMode(); - if ( typeof storage.pr.html.include == "string" && storage.pr.html.include.startsWith( "<sr-rd-content-error>" ) ) { - storage.pr.Readability(); + const render = () => { storage.pr.ReadMode(); + ReactDOM.render( <Read read={ storage.current } wrapper={ storage.pr.html } />, getReadRoot() ); + }; + if ( storage.pr.isMathJax() && storage.pr.state == "temp" ) { + console.warn( '=== MathJax Mode ===' ) + const dom = storage.pr.MathJaxMode(); + console.log( 'current get dom is ', dom ) + if ( typeof dom == "undefined" ) { + new Notify().Render( "智能感知失败,请移动鼠标框选。" ); + Highlight().done( dom => { + storage.pr.TempMode( "read", dom ); + render(); + }); + return; + } else if ( typeof dom == "string" ) { + const html = storage.pr.GetDom( dom, "html" ); + storage.pr.Newsite( "read", html ); + render(); + } else { + storage.pr.TempMode( "read", dom[0] ); + render(); + } + } else { + console.warn( '=== Normal( Right ) ReadMode ===' ) + render(); + } + + if ( typeof storage.pr.html.include == "string" && storage.pr.html.include.startsWith( "<sr-rd-content-error>" ) ) { + console.warn( '=== Adapter failed call Readability View ===' ) + storage.pr.Readability(); + render(); } console.log( "current puread object is ", storage.pr ) - ReactDOM.render( <Read read={ storage.current } wrapper={ storage.pr.html } />, getReadRoot() ); + render(); } /** From 9f20512e5154ee51e555c22af3de2ab465e944fc Mon Sep 17 00:00:00 2001 From: Kenshin <fxblog@gmail.com> Date: Thu, 25 Apr 2019 16:23:48 +0800 Subject: [PATCH 34/43] Format source. --- src/read/read.jsx | 62 +++++++++++++++++++++++------------------------ 1 file changed, 31 insertions(+), 31 deletions(-) diff --git a/src/read/read.jsx b/src/read/read.jsx index c8e8e3c3..0bd3b60d 100644 --- a/src/read/read.jsx +++ b/src/read/read.jsx @@ -213,41 +213,15 @@ class Read extends React.Component { * */ function Render() { - const render = () => { - storage.pr.ReadMode(); - ReactDOM.render( <Read read={ storage.current } wrapper={ storage.pr.html } />, getReadRoot() ); - }; - if ( storage.pr.isMathJax() && storage.pr.state == "temp" ) { - console.warn( '=== MathJax Mode ===' ) - const dom = storage.pr.MathJaxMode(); - console.log( 'current get dom is ', dom ) - if ( typeof dom == "undefined" ) { - new Notify().Render( "智能感知失败,请移动鼠标框选。" ); - Highlight().done( dom => { - storage.pr.TempMode( "read", dom ); - render(); - }); - return; - } else if ( typeof dom == "string" ) { - const html = storage.pr.GetDom( dom, "html" ); - storage.pr.Newsite( "read", html ); - render(); - } else { - storage.pr.TempMode( "read", dom[0] ); - render(); - } - } else { - console.warn( '=== Normal( Right ) ReadMode ===' ) - render(); - } - + mathJaxMode(); + storage.pr.ReadMode(); if ( typeof storage.pr.html.include == "string" && storage.pr.html.include.startsWith( "<sr-rd-content-error>" ) ) { console.warn( '=== Adapter failed call Readability View ===' ) storage.pr.Readability(); - render(); + storage.pr.ReadMode(); } - console.log( "current puread object is ", storage.pr ) - render(); + console.warn( "=== Current PuRead object is ===", storage.pr ) + ReactDOM.render( <Read read={ storage.current } wrapper={ storage.pr.html } />, getReadRoot() ); } /** @@ -288,6 +262,32 @@ function Exit() { }).addClass( "simpread-read-root-hide" ); } +/** + * MathJax Mode + */ +function mathJaxMode() { + if ( storage.pr.isMathJax() && storage.pr.state == "temp" ) { + console.warn( '=== MathJax Mode ===' ) + const dom = storage.pr.MathJaxMode(); + console.log( 'current get dom is ', dom ) + if ( typeof dom == "undefined" ) { + new Notify().Render( "智能感知失败,请移动鼠标框选。" ); + Highlight().done( dom => { + storage.pr.TempMode( "read", dom ); + Render(); + }); + return; + } else if ( typeof dom == "string" ) { + const html = storage.pr.GetDom( dom, "html" ); + storage.pr.Newsite( "read", html ); + Render(); + } else { + storage.pr.TempMode( "read", dom[0] ); + Render(); + } + } +} + /** * Get read root * From 0401d87d2e00236d2c9ac7e6362627e7a480fb66 Mon Sep 17 00:00:00 2001 From: Kenshin <fxblog@gmail.com> Date: Thu, 25 Apr 2019 16:25:28 +0800 Subject: [PATCH 35/43] Format source. --- src/read/read.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/read/read.jsx b/src/read/read.jsx index 0bd3b60d..3eb7a323 100644 --- a/src/read/read.jsx +++ b/src/read/read.jsx @@ -219,7 +219,7 @@ function Render() { console.warn( '=== Adapter failed call Readability View ===' ) storage.pr.Readability(); storage.pr.ReadMode(); - } + } else console.warn( '=== Normal( Right ) Read mode ===' ) console.warn( "=== Current PuRead object is ===", storage.pr ) ReactDOM.render( <Read read={ storage.current } wrapper={ storage.pr.html } />, getReadRoot() ); } From 0d7a86a9386d309ed0935f60b670ea8cf34a1334 Mon Sep 17 00:00:00 2001 From: Kenshin <fxblog@gmail.com> Date: Thu, 25 Apr 2019 16:39:44 +0800 Subject: [PATCH 36/43] Format source. --- src/read/read.jsx | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/read/read.jsx b/src/read/read.jsx index 3eb7a323..feb5b042 100644 --- a/src/read/read.jsx +++ b/src/read/read.jsx @@ -274,16 +274,12 @@ function mathJaxMode() { new Notify().Render( "智能感知失败,请移动鼠标框选。" ); Highlight().done( dom => { storage.pr.TempMode( "read", dom ); - Render(); }); - return; } else if ( typeof dom == "string" ) { const html = storage.pr.GetDom( dom, "html" ); storage.pr.Newsite( "read", html ); - Render(); } else { storage.pr.TempMode( "read", dom[0] ); - Render(); } } } From 5653f0c80c0bfea7ebdd26a7a53cc68140b7a781 Mon Sep 17 00:00:00 2001 From: Kenshin <fxblog@gmail.com> Date: Thu, 25 Apr 2019 16:50:31 +0800 Subject: [PATCH 37/43] Format source. --- src/read/read.jsx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/read/read.jsx b/src/read/read.jsx index feb5b042..be6d7baf 100644 --- a/src/read/read.jsx +++ b/src/read/read.jsx @@ -211,9 +211,10 @@ class Read extends React.Component { /** * Render entry * + * @param {boolean} when true, @see mathJaxMode */ -function Render() { - mathJaxMode(); +function Render( notMathjax = false ) { + !notMathjax && mathJaxMode(); storage.pr.ReadMode(); if ( typeof storage.pr.html.include == "string" && storage.pr.html.include.startsWith( "<sr-rd-content-error>" ) ) { console.warn( '=== Adapter failed call Readability View ===' ) @@ -274,6 +275,7 @@ function mathJaxMode() { new Notify().Render( "智能感知失败,请移动鼠标框选。" ); Highlight().done( dom => { storage.pr.TempMode( "read", dom ); + Render( true ); }); } else if ( typeof dom == "string" ) { const html = storage.pr.GetDom( dom, "html" ); From 200ecacea26e1bd55f09d04fa39315994196f8bc Mon Sep 17 00:00:00 2001 From: Kenshin <fxblog@gmail.com> Date: Thu, 25 Apr 2019 18:37:22 +0800 Subject: [PATCH 38/43] Format source. --- src/read/read.jsx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/read/read.jsx b/src/read/read.jsx index be6d7baf..082bf13c 100644 --- a/src/read/read.jsx +++ b/src/read/read.jsx @@ -211,10 +211,10 @@ class Read extends React.Component { /** * Render entry * - * @param {boolean} when true, @see mathJaxMode + * @param {boolean} true: call mathJaxMode(); false: @see mathJaxMode */ -function Render( notMathjax = false ) { - !notMathjax && mathJaxMode(); +function Render( callMathjax = true ) { + callMathjax && mathJaxMode(); storage.pr.ReadMode(); if ( typeof storage.pr.html.include == "string" && storage.pr.html.include.startsWith( "<sr-rd-content-error>" ) ) { console.warn( '=== Adapter failed call Readability View ===' ) @@ -275,7 +275,7 @@ function mathJaxMode() { new Notify().Render( "智能感知失败,请移动鼠标框选。" ); Highlight().done( dom => { storage.pr.TempMode( "read", dom ); - Render( true ); + Render( false ); }); } else if ( typeof dom == "string" ) { const html = storage.pr.GetDom( dom, "html" ); From 1d8d5c2796ab2b09602aca097f4b615db3f3549a Mon Sep 17 00:00:00 2001 From: Kenshin <fxblog@gmail.com> Date: Thu, 25 Apr 2019 18:54:56 +0800 Subject: [PATCH 39/43] Format source. --- src/read/read.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/read/read.jsx b/src/read/read.jsx index 082bf13c..85d5a3b3 100644 --- a/src/read/read.jsx +++ b/src/read/read.jsx @@ -220,7 +220,7 @@ function Render( callMathjax = true ) { console.warn( '=== Adapter failed call Readability View ===' ) storage.pr.Readability(); storage.pr.ReadMode(); - } else console.warn( '=== Normal( Right ) Read mode ===' ) + } else console.warn( '=== Normal Read mode ===' ) console.warn( "=== Current PuRead object is ===", storage.pr ) ReactDOM.render( <Read read={ storage.current } wrapper={ storage.pr.html } />, getReadRoot() ); } From ea210e23c46a14de81100fff9f1d7469bc066819 Mon Sep 17 00:00:00 2001 From: Kenshin <fxblog@gmail.com> Date: Thu, 25 Apr 2019 18:55:08 +0800 Subject: [PATCH 40/43] Update puread files. --- src/vender/puread/puread.min.js | 98 +++++++++++++++++++++++++++------ 1 file changed, 80 insertions(+), 18 deletions(-) diff --git a/src/vender/puread/puread.min.js b/src/vender/puread/puread.min.js index 628eee5a..66c8702d 100644 --- a/src/vender/puread/puread.min.js +++ b/src/vender/puread/puread.min.js @@ -411,6 +411,40 @@ return this.mathjax; } + /** + * MathJax View + * + * @return {object} return type include: jquery; string e.g. <div id="xxxx"> ;undefined + */ + + }, { + key: "MathJaxMode", + value: function MathJaxMode() { + var $dom = readtmpl(); + if ($dom != -1) { + this.Newsite("read", $dom[0].outerHTML); + this.dom = $dom[0]; + this.state = "temp"; + return $dom; + } else { + var article = readmozilla(); + if (article && article.content != "") { + var a1 = article.content.replace('<div id="readability-page-1" class="page">', ''), + a2 = $(a1)[0], + a3 = a2.outerHTML.replace(a2.innerHTML, ""), + a4 = $(a3)[0], + tag = a4.tagName.toLowerCase(), + cls = a4.className, + id = a4.id; + if (id != "") { + return "<" + tag + " id=\"" + id + "\">"; + } else if (cls != "") { + return "<" + tag + " class=\"" + cls + "\">"; + } else return undefined; + } else return undefined; + } + } + /** * Not adapter usage mozilla readability and readtmpl */ @@ -419,17 +453,8 @@ key: "Readability", value: function Readability() { try { - var _location = document.location, - uri = { - spec: _location.href, - host: _location.host, - prePath: _location.protocol + "//" + _location.host, - scheme: _location.protocol.substr(0, _location.protocol.indexOf(":")), - pathBase: _location.protocol + "//" + _location.host + _location.pathname.substr(0, _location.pathname.lastIndexOf("/") + 1) - }, - article = new rdability.Readability(uri, document.cloneNode(true)).parse(); + var article = readmozilla(); if (article && article.content != "") { - console.warn("current parse is Readability", article); this.Newsite("read", article.content); this.dom = $(article.content)[0]; this.state = "temp"; @@ -501,6 +526,7 @@ this.current.site = this.Safesite(_extends({}, _found[1]), _found[2], _found[0]); this.state = "adapter"; } + console.log('%c Current parse is Adapter', 'background:#2196f3; color: #fff'); } else { var obj = readmulti(); if (obj != -1) { @@ -815,9 +841,9 @@ meta.exclude.push(meta.exp); delete meta.exp; console.assert(idx == -1, "meta read mode error. ", meta); + idx == -1 && console.log('%c Current parse is Meta', 'background:#2196f3; color: #fff', meta); return idx == -1 ? meta : undefined; } else { - console.warn("current not found meta data", meta); return undefined; } } @@ -841,6 +867,7 @@ meta.html = $("body pre").html().replace(/\n/ig, "<br>"); } !$("title").html() && $("head").append("<title>" + decodeURI(title.replace(".txt", "")) + ""); + console.log('%c Current parse is TXT', 'background:#2196f3; color: #fff', meta); return meta; } @@ -862,6 +889,7 @@ html = converter.makeHtml($("body pre").text()); meta.html = html; !$("title").html() && $("head").append("" + decodeURI(title.replace(".md", "")) + ""); + console.log('%c Current parse is Markdown', 'background:#2196f3; color: #fff', meta); return meta; } @@ -876,7 +904,7 @@ */ function readtmpl() { var $root = $("body"), - selectors = [".post-content", ".entry-content", ".post-article", ".content-post", ".article-entry", ".article-content", ".article-body", ".markdown-body", "[itemprop='articleBody']", "article", ".post", ".content"]; + selectors = ["[itemprop='articleBody']", "article", ".post-content", ".entry-content", ".post-article", ".content-post", ".article-entry", ".article-content", ".article-body", ".markdown-body", ".post", ".content"]; var _iteratorNormalCompletion2 = true; var _didIteratorError2 = false; var _iteratorError2 = undefined; @@ -887,7 +915,7 @@ var $target = $root.find(selector$$1); if ($target.length > 0) { - console.warn("current selector is", selector$$1); + console.log('%c Current parse is SimpRead', 'background:#2196f3; color: #fff', selector$$1); return $target; } } @@ -934,6 +962,25 @@ return -1; } + /** + * Read mode usage mozilla + * + * @return {object} article + */ + function readmozilla() { + var location = document.location, + uri = { + spec: location.href, + host: location.host, + prePath: location.protocol + "//" + location.host, + scheme: location.protocol.substr(0, location.protocol.indexOf(":")), + pathBase: location.protocol + "//" + location.host + location.pathname.substr(0, location.pathname.lastIndexOf("/") + 1) + }, + article = new rdability.Readability(uri, document.cloneNode(true)).parse(); + console.log('%c Current parse is Mozilla', 'background:#2196f3; color: #fff', article); + return article; + } + /** * Add new sites to old sites * @@ -1062,7 +1109,7 @@ var _this = possibleConstructorReturn(this, (PureRead.__proto__ || Object.getPrototypeOf(PureRead)).call(this, sites)); - _this.version = "0.0.4 build 0424"; + _this.version = "0.0.4 build 0425"; _this.org_url = location.href; _this.html = {}; // clone site, include: title, desc, include, avatar, paging _this.plugin = {}; @@ -1106,6 +1153,16 @@ get(PureRead.prototype.__proto__ || Object.getPrototypeOf(PureRead.prototype), 'SetMarkdown', this).call(this, this.plugin.markdown); } + /** + * Get read mode html + */ + + }, { + key: 'ReadMode', + value: function ReadMode() { + this.html = wrap(this.current.site); + } + /** * Create temp read mode * @@ -1122,13 +1179,18 @@ } /** - * Get read mode html + * Get Dom + * + * @param {string} html, e.g.
+ * @param {string} type, @see query */ }, { - key: 'ReadMode', - value: function ReadMode() { - this.html = wrap(this.current.site); + key: 'GetDom', + value: function GetDom(str, type) { + var include = selector(str), + dom = query(include, type); + return dom; } /** From 3e5b395c6ac90e90370b75e30468eb425bc5c047 Mon Sep 17 00:00:00 2001 From: Kenshin Date: Fri, 26 Apr 2019 11:05:30 +0800 Subject: [PATCH 41/43] Update puread files. --- src/vender/puread/puplugin.min.js | 55 ++++++++++++++++++------------- 1 file changed, 32 insertions(+), 23 deletions(-) diff --git a/src/vender/puread/puplugin.min.js b/src/vender/puread/puplugin.min.js index 50131be5..fc7db76f 100644 --- a/src/vender/puread/puplugin.min.js +++ b/src/vender/puread/puplugin.min.js @@ -2017,7 +2017,7 @@ if (tag == undefined) { newHTML += "

" + item.textContent.replace(/^\n|\n$/ig, "").trim() + "

"; } else if (tag == "PRE") { - newHTML += "
" + text.replace(//ig, '>') + "
"; + newHTML += html; } else if (text == "" && !html.includes('/ig, '>') + "\n"; + } + }); + // pre → code + if (isLi == false) { + $(pre).find('code').each(function (idx, item) { + isCode = true; + if (item.outerText.trim() != "") { + html += item.outerText.replace(//ig, '>') + "\n"; + } + }); + } + // only pre + if (!isLi && !isCode) { + html += pre.outerText.replace(//ig, '>') + "\n"; + } + $(pre).removeAttr('style').removeAttr('class').removeAttr('id').html(html); + }); + + // set origin html var orgHTML = $target.html(); if ($($target.children()).attr('id') == 'readability-page-1' && $target.children().children().length == 1) { orgHTML = $target.children().children().html(); @@ -2035,29 +2064,9 @@ orgHTML = $target.children().html(); } orgHTML = orgHTML.replace(//ig, ''); - /* - const lines = orgHTML.split( '\n' ); - let newLine = ''; - for( let i = 0; i < lines.length; i++ ) { - let str = lines[i]; - if ( !str.trim().startsWith( '<' ) ) { - newLine += `

${str}

` + '\n'; - } else if ( str.trim().length > 0 ) { - newLine += str + '\n'; - } - } - $target.html( clear( newLine ) ); - */ + // clean html $target.html(clear(orgHTML)); - is_pure && $target.find('pre code').each(function (idx, item) { - try { - item.outerText = item.outerText.split('\n').filter(function (item) { - return item.trim() != ""; - }).join('\n') + '\n'; - } catch (error) { - item.outerText = item.outerText; - } - }); + is_pure && $target.find('p').each(function (idx, item) { var tag = item.tagName, text = item.outerText, From b17578807b6c84629e6d7cd00ae3d929669c5dfc Mon Sep 17 00:00:00 2001 From: Kenshin Date: Sat, 27 Apr 2019 10:27:03 +0800 Subject: [PATCH 42/43] Update puread files. --- src/vender/puread/puplugin.min.js | 2 +- src/vender/puread/puread.min.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/vender/puread/puplugin.min.js b/src/vender/puread/puplugin.min.js index fc7db76f..e01ece2f 100644 --- a/src/vender/puread/puplugin.min.js +++ b/src/vender/puread/puplugin.min.js @@ -2035,7 +2035,7 @@ isCode = false; // pre → li $(pre).find('li').each(function (idx, item) { - isLi = true; + $(item).find('code').length > 0 && (isLi = true); if (item.outerText.trim() != "") { html += item.outerText.replace(/\n/ig, "").replace(//ig, '>') + "\n"; } diff --git a/src/vender/puread/puread.min.js b/src/vender/puread/puread.min.js index 66c8702d..28f5b454 100644 --- a/src/vender/puread/puread.min.js +++ b/src/vender/puread/puread.min.js @@ -404,8 +404,8 @@ if (this.mathjax == undefined) { this.mathjax = false; - $('head').find('style').each(function (idx, item) { - /.mathjax/ig.test(item.outerText) && (_this.mathjax = true); + $('body').find('script').each(function (idx, item) { + item.type.startsWith('math') && (_this.mathjax = true); }); } return this.mathjax; From b7368f73ce1b91ecc19a766c2027d981dd02daa3 Mon Sep 17 00:00:00 2001 From: Kenshin Date: Sat, 27 Apr 2019 11:34:39 +0800 Subject: [PATCH 43/43] Update puread files. --- src/vender/puread/puread.min.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/vender/puread/puread.min.js b/src/vender/puread/puread.min.js index 28f5b454..a57368b6 100644 --- a/src/vender/puread/puread.min.js +++ b/src/vender/puread/puread.min.js @@ -811,7 +811,7 @@ if (minimatch(location.href, "file://**/*.txt") || minimatch(location.href, "http*://**/*.txt")) { return readtxt(); } - if (minimatch(location.href, "file://**/*.md") || minimatch(location.href, "http*://**/*.md")) { + if ($($("body").children()[0]).is('pre') && (minimatch(location.href, "file://**/*.md") || minimatch(location.href, "http*://**/*.md"))) { return readmd(); } var reg = /<\S+ (class|id)=("|')?[\w-_=;:' ]+("|')?>?$|<[^/][-_a-zA-Z0-9]+>?$/ig, @@ -1109,7 +1109,7 @@ var _this = possibleConstructorReturn(this, (PureRead.__proto__ || Object.getPrototypeOf(PureRead)).call(this, sites)); - _this.version = "0.0.4 build 0425"; + _this.version = "0.0.4 build 0427"; _this.org_url = location.href; _this.html = {}; // clone site, include: title, desc, include, avatar, paging _this.plugin = {};