import{__exports as r}from"../../../_virtual/es.string.replace.mjs";import{__require as e}from"../internals/function-apply.mjs";import{__require as i}from"../internals/function-call.mjs";import{__require as n}from"../internals/function-uncurry-this.mjs";import{__require as t}from"../internals/fix-regexp-well-known-symbol-logic.mjs";import{__require as s}from"../internals/fails.mjs";import{__require as a}from"../internals/an-object.mjs";import{__require as o}from"../internals/is-callable.mjs";import{__require as m}from"../internals/is-object.mjs";import{__require as l}from"../internals/to-integer-or-infinity.mjs";import{__require as u}from"../internals/to-length.mjs";import{__require as f}from"../internals/to-string.mjs";import{__require as _}from"../internals/require-object-coercible.mjs";import{__require as p}from"../internals/advance-string-index.mjs";import{__require as c}from"../internals/get-method.mjs";import{__require as g}from"../internals/get-substitution.mjs";import{__require as j}from"../internals/regexp-get-flags.mjs";import{__require as v}from"../internals/regexp-exec-abstract.mjs";import{__require as q}from"../internals/well-known-symbol.mjs";var x;function d(){if(x)return r;x=1;var d=e(),h=i(),b=n(),$=t(),y=s(),w=a(),I=o(),k=m(),M=l(),O=u(),S=f(),z=_(),A=p(),B=c(),C=g(),D=j(),E=v(),F=q()("replace"),G=Math.max,H=Math.min,J=b([].concat),K=b([].push),L=b("".indexOf),N=b("".slice),P=function(r){return void 0===r?r:String(r)},Q="$0"==="a".replace(/./,"$0"),R=!!/./[F]&&""===/./[F]("a","$0");return $("replace",function(r,e,i){var n=R?"$":"$0";return[function(r,i){var n=z(this),t=k(r)?B(r,F):void 0;return t?h(t,r,n,i):h(e,S(n),r,i)},function(r,t){var s=w(this),a=S(r);if("string"==typeof t&&-1===L(t,n)&&-1===L(t,"$<")){var o=i(e,s,a,t);if(o.done)return o.value}var m=I(t);m||(t=S(t));var l,u=S(D(s)),f=-1!==L(u,"g");f&&(l=-1!==L(u,"u"),s.lastIndex=0);for(var _,p=[];null!==(_=E(s,a))&&(K(p,_),f);){""===S(_[0])&&(s.lastIndex=A(a,O(s.lastIndex),l))}for(var c="",g=0,j=0;j<p.length;j++){for(var v,q=S((_=p[j])[0]),x=G(H(M(_.index),a.length),0),h=[],b=1;b<_.length;b++)K(h,P(_[b]));var $=_.groups;if(m){var y=J([q],h,x,a);void 0!==$&&K(y,$),v=S(d(t,void 0,y))}else v=C(q,a,x,h,$,t);x>=g&&(c+=N(a,g,x)+v,g=x+q.length)}return c+N(a,g)}]},!!y(function(){var r=/./;return r.exec=function(){var r=[];return r.groups={a:"7"},r},"7"!=="".replace(r,"$<a>")})||!Q||R),r}export{d as __require};