import{c as n,b as t,j as e,u as r,a as u,d as i}from"./micromark-util-character-DUwsRT9L.js";const o={tokenize:function(n,t,e){let r=0;return function t(i){if((87===i||119===i)&&r<3)return r++,n.consume(i),t;if(46===i&&3===r)return n.consume(i),u;return e(i)};function u(n){return null===n?e(n):t(n)}},partial:!0},l={tokenize:function(n,t,i){let o,l,c;return f;function f(t){return 46===t||95===t?n.check(a,m,s)(t):null===t||e(t)||r(t)||45!==t&&u(t)?m(t):(c=!0,n.consume(t),f)}function s(t){return 95===t?o=!0:(l=o,o=void 0),n.consume(t),f}function m(n){return l||o||!c?i(n):t(n)}},partial:!0},c={tokenize:function(n,t){let u=0,i=0;return o;function o(c){return 40===c?(u++,n.consume(c),o):41===c&&i<u?l(c):33===c||34===c||38===c||39===c||41===c||42===c||44===c||46===c||58===c||59===c||60===c||63===c||93===c||95===c||126===c?n.check(a,t,l)(c):null===c||e(c)||r(c)?t(c):(n.consume(c),o)}function l(t){return 41===t&&i++,n.consume(t),o}},partial:!0},a={tokenize:function(n,u,i){return o;function o(t){return 33===t||34===t||39===t||41===t||42===t||44===t||46===t||58===t||59===t||63===t||95===t||126===t?(n.consume(t),o):38===t?(n.consume(t),c):93===t?(n.consume(t),l):60===t||null===t||e(t)||r(t)?u(t):i(t)}function l(n){return null===n||40===n||91===n||e(n)||r(n)?u(n):o(n)}function c(n){return t(n)?a(n):i(n)}function a(e){return 59===e?(n.consume(e),o):t(e)?(n.consume(e),a):i(e)}},partial:!0},f={tokenize:function(t,e,r){return function(n){return t.consume(n),u};function u(t){return n(t)?r(t):e(t)}},partial:!0},s={name:"wwwAutolink",tokenize:function(n,t,e){const r=this;return function(t){if(87!==t&&119!==t||!v.call(r,r.previous)||z(r.events))return e(t);return n.enter("literalAutolink"),n.enter("literalAutolinkWww"),n.check(o,n.attempt(l,n.attempt(c,u),e),e)(t)};function u(e){return n.exit("literalAutolinkWww"),n.exit("literalAutolink"),t(e)}},previous:v},m={name:"protocolAutolink",tokenize:function(n,o,a){const f=this;let s="",m=!1;return function(t){if((72===t||104===t)&&g.call(f,f.previous)&&!z(f.events))return n.enter("literalAutolink"),n.enter("literalAutolinkHttp"),s+=String.fromCodePoint(t),n.consume(t),k;return a(t)};function k(e){if(t(e)&&s.length<5)return s+=String.fromCodePoint(e),n.consume(e),k;if(58===e){const t=s.toLowerCase();if("http"===t||"https"===t)return n.consume(e),p}return a(e)}function p(t){return 47===t?(n.consume(t),m?A:(m=!0,p)):a(t)}function A(t){return null===t||i(t)||e(t)||r(t)||u(t)?a(t):n.attempt(l,n.attempt(c,h),a)(t)}function h(t){return n.exit("literalAutolinkHttp"),n.exit("literalAutolink"),o(t)}},previous:g},k={name:"emailAutolink",tokenize:function(e,r,u){const i=this;let o,l;return function(n){if(!x(n)||!w.call(i,i.previous)||z(i.events))return u(n);return e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),c(n)};function c(n){return x(n)?(e.consume(n),c):64===n?(e.consume(n),a):u(n)}function a(t){return 46===t?e.check(f,m,s)(t):45===t||95===t||n(t)?(l=!0,e.consume(t),a):m(t)}function s(n){return e.consume(n),o=!0,a}function m(n){return l&&o&&t(i.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),r(n)):u(n)}},previous:w},p={};function A(){return{text:p}}let h=48;for(;h<123;)p[h]=k,h++,58===h?h=65:91===h&&(h=97);function v(n){return null===n||40===n||42===n||95===n||91===n||93===n||126===n||e(n)}function g(n){return!t(n)}function w(n){return!(47===n||x(n))}function x(t){return 43===t||45===t||46===t||95===t||n(t)}function z(n){let t=n.length,e=!1;for(;t--;){const r=n[t][1];if(("labelLink"===r.type||"labelImage"===r.type)&&!r._balanced){e=!0;break}if(r._gfmAutolinkLiteralWalkedInto){e=!1;break}}return n.length>0&&!e&&(n[n.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),e}p[43]=k,p[45]=k,p[46]=k,p[95]=k,p[72]=[k,m],p[104]=[k,m],p[87]=[k,s],p[119]=[k,s];export{A as g};
