"use strict";var $=require("../internals/export"),getBuiltIn=require("../internals/get-built-in"),apply=require("../internals/function-apply"),call=require("../internals/function-call"),uncurryThis=require("../internals/function-uncurry-this"),fails=require("../internals/fails"),isCallable=require("../internals/is-callable"),isSymbol=require("../internals/is-symbol"),arraySlice=require("../internals/array-slice"),getReplacerFunction=require("../internals/get-json-replacer-function"),NATIVE_SYMBOL=require("../internals/symbol-constructor-detection"),$String=String,$stringify=getBuiltIn("JSON","stringify"),exec=uncurryThis(/./.exec),charAt=uncurryThis("".charAt),charCodeAt=uncurryThis("".charCodeAt),replace=uncurryThis("".replace),numberToString=uncurryThis(1..toString),tester=/[\uD800-\uDFFF]/g,low=/^[\uD800-\uDBFF]$/,hi=/^[\uDC00-\uDFFF]$/,WRONG_SYMBOLS_CONVERSION=!NATIVE_SYMBOL||fails((function(){var r=getBuiltIn("Symbol")("stringify detection");return"[null]"!==$stringify([r])||"{}"!==$stringify({a:r})||"{}"!==$stringify(Object(r))})),ILL_FORMED_UNICODE=fails((function(){return'"\\udf06\\ud834"'!==$stringify("\udf06\ud834")||'"\\udead"'!==$stringify("\udead")})),stringifyWithSymbolsFix=function(r,i){var e=arraySlice(arguments),n=getReplacerFunction(i);if(isCallable(n)||void 0!==r&&!isSymbol(r))return e[1]=function(r,i){if(isCallable(n)&&(i=call(n,this,$String(r),i)),!isSymbol(i))return i},apply($stringify,null,e)},fixIllFormed=function(r,i,e){var n=charAt(e,i-1),t=charAt(e,i+1);return exec(low,r)&&!exec(hi,t)||exec(hi,r)&&!exec(low,n)?"\\u"+numberToString(charCodeAt(r,0),16):r};$stringify&&$({target:"JSON",stat:!0,arity:3,forced:WRONG_SYMBOLS_CONVERSION||ILL_FORMED_UNICODE},{stringify:function(r,i,e){var n=arraySlice(arguments),t=apply(WRONG_SYMBOLS_CONVERSION?stringifyWithSymbolsFix:$stringify,null,n);return ILL_FORMED_UNICODE&&"string"==typeof t?replace(t,tester,fixIllFormed):t}});