/**
 * Minified by jsDelivr using Terser v5.39.0.
 * Original file: /npm/gulp-regex-replace@0.2.3/index.js
 *
 * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files
 */
"use strict";var through=require("through2"),gutil=require("gulp-util");function debug(e){1==gulpRegexReplace.debug&&console.log(e)}function findMatch(e,n){for(var r,u=[e];null!=(r=n.shift());)e=(u=findSingleMatch(e,r)).join(" ");return u}function regexMatch(e,n){var r=[];if(null==n)return null;for(var u=new RegExp(n,"g"),l=u.exec(e);null!=l&&""!=l[0];){var t,i;for(t=1==l.length?0:1;t<l.length;)i=l[t],r.push(i),t++;l=u.exec(e)}return r}function findSingleMatch(e,n){if(null==n)return null;var r,u=n;null!=n.exclude&&(r=n.exclude),null!=n.include&&(u=n.include);var l=regexMatch(e,r),t=regexMatch(e,u);return null!=l?t.filter((function(e){return l.indexOf(e)<0})):t}function isWord(e){return-1===e.indexOf(" ")&&-1===e.indexOf(".")&&-1===e.indexOf(",")&&-1===e.indexOf("=")&&-1===e.indexOf(";")}function shouldExclude(e,n){var r=!1;return n.forEach((function(n){if(null!=n&&null!=n&&""!=n){var u,l=new RegExp(n,"g").exec(e);if(null!=l)for(u=1==l.length?0:1;u<l.length;)e==l[u]&&(r=!0),u++}})),r}function convertString(e,n,r,u){if(n instanceof Array||(n=[n]),u instanceof Array||(u=[u]),null==n[0])return e;var l=e,t=findMatch(e,n);return null!=t&&t.forEach((function(e,n,i){var c,f=r;"function"==typeof r&&(f=r(e)),shouldExclude(e,u)||(isWord(e)?(debug("replacing word: "+e+" with "+f),c=new RegExp("\\b"+e+"\\b","g")):(debug("replacing: "+e+" with "+f),c=new RegExp(e,"g")),l=l.replace(c,f),t.forEach((function(e,n,r){r[n]=e.replace(c,f)})))})),l}var gulpRegexReplace=function(e){return e instanceof Array||(e=[e]),e.forEach((function(e,n,r){null==e&&(e={}),null==e.replace&&(e.replace="")})),through.obj((function(n,r,u){if(!("contents"in n))return this.push(n),u();if(n.isNull())return this.push(n),u();if(n.isStream())throw new gutil.PluginError("gulp-regex-replace","streams not implemented");if(n.isBuffer()){var l=String(n.contents);e.forEach((function(e,n,r){if(null==l)throw new gutil.PluginError("gulp-regex-replace","contents is null");l=convertString(l,e.regex,e.replace,e.exclude)})),n.contents=new Buffer(l)}return this.push(n),u()}))};module.exports=gulpRegexReplace;
//# sourceMappingURL=/sm/c26cbebd98c6f4b0feea58b24c3300431c10dc6cb667d7576a3102b7c7d2ff68.map