import{s as e}from"./micromark-util-chunked-3k3e5hER.js";import{c as t}from"./micromark-util-classify-character-D70wJgn_.js";import{r}from"./micromark-util-resolve-all-U8fstr8o.js";function n(n){let s=(n||{}).singleTilde;const o={name:"strikethrough",tokenize:function(e,r,n){const o=this.previous,i=this.events;let u=0;return function(t){if(126===o&&"characterEscape"!==i[i.length-1][1].type)return n(t);return e.enter("strikethroughSequenceTemporary"),a(t)};function a(i){const c=t(o);if(126===i)return u>1?n(i):(e.consume(i),u++,a);if(u<2&&!s)return n(i);const l=e.exit("strikethroughSequenceTemporary"),h=t(i);return l._open=!h||2===h&&Boolean(c),l._close=!c||2===c&&Boolean(h),r(i)}},resolveAll:function(t,n){let s=-1;for(;++s<t.length;)if("enter"===t[s][0]&&"strikethroughSequenceTemporary"===t[s][1].type&&t[s][1]._close){let o=s;for(;o--;)if("exit"===t[o][0]&&"strikethroughSequenceTemporary"===t[o][1].type&&t[o][1]._open&&t[s][1].end.offset-t[s][1].start.offset===t[o][1].end.offset-t[o][1].start.offset){t[s][1].type="strikethroughSequence",t[o][1].type="strikethroughSequence";const i={type:"strikethrough",start:Object.assign({},t[o][1].start),end:Object.assign({},t[s][1].end)},u={type:"strikethroughText",start:Object.assign({},t[o][1].end),end:Object.assign({},t[s][1].start)},a=[["enter",i,n],["enter",t[o][1],n],["exit",t[o][1],n],["enter",u,n]],c=n.parser.constructs.insideSpan.null;c&&e(a,a.length,0,r(c,t.slice(o+1,s),n)),e(a,a.length,0,[["exit",u,n],["enter",t[s][1],n],["exit",t[s][1],n],["exit",i,n]]),e(t,o-1,s-o+3,a),s=o+a.length-2;break}}s=-1;for(;++s<t.length;)"strikethroughSequenceTemporary"===t[s][1].type&&(t[s][1].type="data");return t}};return null==s&&(s=!0),{text:{126:o},insideSpan:{null:[o]},attentionMarkers:{null:[126]}}}export{n as g};
