{"version":3,"sources":["webpack:///C:/a/2/s/Cognito.Web.Client/node_modules/.pnpm/@microsoft+dynamicproto-js@0.5.3/node_modules/@microsoft/dynamicproto-js/lib/dist/esm/dynamicproto-js.js"],"names":["_objGetPrototypeOf","Object","_dynamicNames","_hasOwnProperty","obj","prop","hasOwnProperty","call","_isFunction","value","_isObjectOrArrayPrototype","target","Array","_isObjectArrayOrFunctionPrototype","Function","_getObjProto","newProto","_isDynamicCandidate","funcName","skipOwn","_throwTypeError","message","TypeError","_hasVisited","values","lp","length","_getObjName","unknownValue","name","theClass","delegateFunc","classProto","thisTarget","thisProto","_checkPrototype","className","instFuncs","_getInstanceFuncs","_instFuncProxy","theFunc","apply","arguments","baseFuncs","baseProto","visited","push","_getBaseFuncs","proto","baseInstFuncs","_createDynamicPrototype","dynProtoProxy","_this","this","instFunc","protoFunc","instFuncTable","_populatePrototype"],"mappings":";;;;GAQA,IA6CIA,EAAqBC,OAAuB,eAK5CC,EAAgB,EAKpB,SAASC,EAAgBC,EAAKC,GAC1B,OAAOD,GAAOH,OAAgB,UAAEK,eAAeC,KAAKH,EAAKC,GAQ7D,SAASG,EAAYC,GACjB,MAvDc,mBAuDAA,EAMlB,SAASC,EAA0BC,GAC/B,OAAOA,IAAWA,IAAWV,OAAgB,WAAKU,IAAWC,MAAe,WAMhF,SAASC,EAAkCF,GACvC,OAAOD,EAA0BC,IAAWA,IAAWG,SAAkB,UAM7E,SAASC,EAAaJ,GAClB,GAAIA,EAAQ,CAER,GAAIX,EACA,OAAOA,EAAmBW,GAG9B,IAAIK,EAAWL,EAAiB,WAAKA,EAAgB,WAAKA,EAAkB,YAC5E,GAAIK,EACA,OAAOA,EAGf,OAAO,KAUX,SAASC,EAAoBN,EAAQO,EAAUC,GAC3C,MA5Gc,gBA4GND,GAA4BV,EAAYG,EAAOO,MAAeC,GAAWhB,EAAgBQ,EAAQO,IAO7G,SAASE,EAAgBC,GACrB,MAAM,IAAIC,UAAU,iBAAmBD,GA0B3C,SAASE,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.fa38e4d838ab7acb244a.js","sourcesContent":["/*!\n * Microsoft Dynamic Proto Utility, 0.5.3\n * Copyright (c) Microsoft and contributors. All rights reserved.\n */\n/**\r\n * Constant string defined to support minimization\r\n * @ignore\r\n */\r\nvar Constructor = 'constructor';\r\n/**\r\n * Constant string defined to support minimization\r\n * @ignore\r\n */\r\nvar Prototype = 'prototype';\r\n/**\r\n * Constant string defined to support minimization\r\n * @ignore\r\n */\r\nvar strFunction = 'function';\r\n/**\r\n * Used to define the name of the instance function lookup table\r\n * @ignore\r\n */\r\nvar DynInstFuncTable = '_dynInstFuncs';\r\n/**\r\n * Name used to tag the dynamic prototype function\r\n * @ignore\r\n */\r\nvar DynProxyTag = '_isDynProxy';\r\n/**\r\n * Name added to a prototype to define the dynamic prototype \"class\" name used to lookup the function table\r\n * @ignore\r\n */\r\nvar DynClassName = '_dynClass';\r\n/**\r\n * Prefix added to the classname to avoid any name clashes with other instance level properties\r\n * @ignore\r\n */\r\nvar DynClassNamePrefix = '_dynCls$';\r\n/**\r\n * Value used as the name of a class when it cannot be determined\r\n * @ignore\r\n */\r\nvar UnknownValue = '_unknown_';\r\n/**\r\n * Constant string defined to support minimization\r\n * @ignore\r\n */\r\nvar str__Proto = \"__proto__\";\r\n/**\r\n * Pre-lookup to check if we are running on a modern browser (i.e. not IE8)\r\n * @ignore\r\n */\r\nvar _objGetPrototypeOf = Object[\"getPrototypeOf\"];\r\n/**\r\n * Internal Global used to generate a unique dynamic class name, every new class will increase this value\r\n * @ignore\r\n */\r\nvar _dynamicNames = 0;\r\n/**\r\n * Helper to check if the object contains a property of the name\r\n * @ignore\r\n */\r\nfunction _hasOwnProperty(obj, prop) {\r\n return obj && Object[Prototype].hasOwnProperty.call(obj, prop);\r\n}\r\n/**\r\n * Checks if the passed of value is a function.\r\n * @param {any} value - Value to be checked.\r\n * @return {boolean} True if the value is a boolean, false otherwise.\r\n * @ignore\r\n */\r\nfunction _isFunction(value) {\r\n return typeof value === strFunction;\r\n}\r\n/**\r\n * Helper used to check whether the target is an Object prototype or Array prototype\r\n * @ignore\r\n */\r\nfunction _isObjectOrArrayPrototype(target) {\r\n return target && (target === Object[Prototype] || target === Array[Prototype]);\r\n}\r\n/**\r\n * Helper used to check whether the target is an Object prototype, Array prototype or Function prototype\r\n * @ignore\r\n */\r\nfunction _isObjectArrayOrFunctionPrototype(target) {\r\n return _isObjectOrArrayPrototype(target) || target === Function[Prototype];\r\n}\r\n/**\r\n * Helper used to get the prototype of the target object as getPrototypeOf is not available in an ES3 environment.\r\n * @ignore\r\n */\r\nfunction _getObjProto(target) {\r\n if (target) {\r\n // This method doesn't existing in older browsers (e.g. IE8)\r\n if (_objGetPrototypeOf) {\r\n return _objGetPrototypeOf(target);\r\n }\r\n // target[Constructor] May break if the constructor has been changed or removed\r\n var newProto = target[str__Proto] || target[Prototype] || target[Constructor];\r\n if (newProto) {\r\n return newProto;\r\n }\r\n }\r\n return null;\r\n}\r\n/**\r\n * Helper function to check whether the provided function name is a potential candidate for dynamic\r\n * callback and prototype generation.\r\n * @param target The target object, may be a prototpe or class object\r\n * @param funcName The function name\r\n * @param skipOwn Skips the check for own property\r\n * @ignore\r\n */\r\nfunction _isDynamicCandidate(target, funcName, skipOwn) {\r\n return (funcName !== Constructor && _isFunction(target[funcName]) && (skipOwn || _hasOwnProperty(target, funcName)));\r\n}\r\n/**\r\n * Helper to throw a TypeError exception\r\n * @param message the message\r\n * @ignore\r\n */\r\nfunction _throwTypeError(message) {\r\n throw new TypeError(\"DynamicProto: \" + message);\r\n}\r\n/**\r\n * Returns a collection of the instance functions that are defined directly on the thisTarget object, it does\r\n * not return any inherited functions\r\n * @param thisTarget The object to get the instance functions from\r\n * @ignore\r\n */\r\nfunction _getInstanceFuncs(thisTarget) {\r\n // Get the base proto\r\n var instFuncs = {};\r\n // Save any existing instance functions\r\n for (var name in thisTarget) {\r\n // Don't include any dynamic prototype instances - as we only want the real functions\r\n if (!instFuncs[name] && _isDynamicCandidate(thisTarget, name, false)) {\r\n // Create an instance callback for pasing the base function to the caller\r\n instFuncs[name] = thisTarget[name];\r\n }\r\n }\r\n return instFuncs;\r\n}\r\n/**\r\n * Returns whether the value is included in the array\r\n * @param values The array of values\r\n * @param value The value\r\n */\r\nfunction _hasVisited(values, value) {\r\n for (var lp = values.length - 1; lp >= 0; lp--) {\r\n if (values[lp] === value) {\r\n return true;\r\n }\r\n }\r\n return false;\r\n}\r\n/**\r\n * Returns an object that contains callback functions for all \"base/super\" functions, this is used to \"save\"\r\n * enabling calling super.xxx() functions without requiring that the base \"class\" has defined a prototype references\r\n * @param target The current instance\r\n * @ignore\r\n */\r\nfunction _getBaseFuncs(classProto, thisTarget, instFuncs) {\r\n function _instFuncProxy(target, theFunc) {\r\n return function () {\r\n return theFunc.apply(target, arguments);\r\n };\r\n }\r\n // Start creating a new baseFuncs by creating proxies for the instance functions (as they may get replaced)\r\n var baseFuncs = {};\r\n for (var name in instFuncs) {\r\n // Create an instance callback for pasing the base function to the caller\r\n baseFuncs[name] = _instFuncProxy(thisTarget, instFuncs[name]);\r\n }\r\n // Get the base prototype functions\r\n var baseProto = _getObjProto(classProto);\r\n var visited = [];\r\n // Don't include base object functions for Object, Array or Function\r\n while (baseProto && !_isObjectArrayOrFunctionPrototype(baseProto) && !_hasVisited(visited, baseProto)) {\r\n // look for prototype functions\r\n for (var name in baseProto) {\r\n // Don't include any dynamic prototype instances - as we only want the real functions\r\n // For IE 7/8 the prototype lookup doesn't provide the full chain so we need to bypass the \r\n // hasOwnProperty check we get all of the methods, main difference is that IE7/8 doesn't return\r\n // the Object prototype methods while bypassing the check\r\n if (!baseFuncs[name] && _isDynamicCandidate(baseProto, name, !_objGetPrototypeOf)) {\r\n // Create an instance callback for pasing the base function to the caller\r\n baseFuncs[name] = _instFuncProxy(thisTarget, baseProto[name]);\r\n }\r\n }\r\n // We need to find all possible functions that might be overloaded by walking the entire prototype chain\r\n // This avoids the caller from needing to check whether it's direct base class implements the function or not\r\n // by walking the entire chain it simplifies the usage and issues from upgrading any of the base classes.\r\n visited.push(baseProto);\r\n baseProto = _getObjProto(baseProto);\r\n }\r\n return baseFuncs;\r\n}\r\n/**\r\n * Add the required dynamic prototype methods to the the class prototype\r\n * @param proto The class prototype\r\n * @param className The instance classname\r\n * @param target The target instance\r\n * @param baseInstFuncs The base instance functions\r\n * @ignore\r\n */\r\nfunction _populatePrototype(proto, className, target, baseInstFuncs) {\r\n function _createDynamicPrototype(proto, funcName) {\r\n var dynProtoProxy = function () {\r\n var _this = this;\r\n // We need to check whether the class name is defined directly on this prototype otherwise\r\n // it will walk the proto chain and return any parent proto classname.\r\n if (_this && _hasOwnProperty(proto, DynClassName)) {\r\n var instFunc = ((_this[DynInstFuncTable] || {})[proto[DynClassName]] || {})[funcName];\r\n if (instFunc) {\r\n // Used the instance function property\r\n return instFunc.apply(_this, arguments);\r\n }\r\n // Avoid stack overflow from recursive calling the same function\r\n _throwTypeError(\"Missing [\" + funcName + \"] \" + strFunction);\r\n }\r\n var protoFunc = proto[funcName];\r\n // Check that the prototype function is not a self reference -- try to avoid stack overflow!\r\n if (protoFunc === dynProtoProxy) {\r\n // It is so lookup the base prototype\r\n protoFunc = _getObjProto(proto)[funcName];\r\n }\r\n if (!_isFunction(protoFunc)) {\r\n _throwTypeError(\"[\" + funcName + \"] is not a \" + strFunction);\r\n }\r\n return protoFunc.apply(_this, arguments);\r\n };\r\n // Tag this function as a proxy to support replacing dynamic proxy elements (primary use case is for unit testing\r\n // via which can dynamically replace the prototype function reference)\r\n dynProtoProxy[DynProxyTag] = 1;\r\n return dynProtoProxy;\r\n }\r\n if (!_isObjectOrArrayPrototype(proto)) {\r\n var instFuncTable = target[DynInstFuncTable] = target[DynInstFuncTable] || {};\r\n var instFuncs = instFuncTable[className] = (instFuncTable[className] || {}); // fetch and assign if as it may not exist yet\r\n for (var name in target) {\r\n // Only add overriden functions\r\n if (_isDynamicCandidate(target, name, false) && target[name] !== baseInstFuncs[name]) {\r\n // Save the instance Function to the lookup table and remove it from the instance as it's not a dynamic proto function\r\n instFuncs[name] = target[name];\r\n delete target[name];\r\n // Add a dynamic proto if one doesn't exist or if a prototype function exists and it's not a dynamic one\r\n if (!_hasOwnProperty(proto, name) || (proto[name] && !proto[name][DynProxyTag])) {\r\n proto[name] = _createDynamicPrototype(proto, name);\r\n }\r\n }\r\n }\r\n }\r\n}\r\n/**\r\n * Checks whether the passed prototype object appears to be correct by walking the prototype heirarchy of the instance\r\n * @param classProto The class prototype instance\r\n * @param thisTarget The current instance that will be checked whther the passed prototype instance is in the heirarchy\r\n * @ignore\r\n */\r\nfunction _checkPrototype(classProto, thisTarget) {\r\n var thisProto = _getObjProto(thisTarget);\r\n while (thisProto && !_isObjectArrayOrFunctionPrototype(thisProto)) {\r\n if (thisProto === classProto) {\r\n return true;\r\n }\r\n thisProto = _getObjProto(thisProto);\r\n }\r\n return false;\r\n}\r\n/**\r\n * Gets the current prototype name using the ES6 name if available otherwise falling back to a use unknown as the name.\r\n * It's not critical for this to return a name, it's used to decorate the generated unique name for easier debugging only.\r\n * @param target\r\n * @param unknownValue\r\n * @ignore\r\n */\r\nfunction _getObjName(target, unknownValue) {\r\n if (_hasOwnProperty(target, Prototype)) {\r\n // Look like a prototype\r\n return target.name || unknownValue || UnknownValue;\r\n }\r\n return (((target || {})[Constructor]) || {}).name || unknownValue || UnknownValue;\r\n}\r\n/**\r\n * Helper function when creating dynamic (inline) functions for classes, this helper performs the following tasks :-\r\n * - Saves references to all defined base class functions\r\n * - Calls the delegateFunc with the current target (this) and a base object reference that can be used to call all \"super\" functions.\r\n * - Will populate the class prototype for all overridden functions to support class extension that call the prototype instance.\r\n * Callers should use this helper when declaring all function within the constructor of a class, as mentioned above the delegateFunc is\r\n * passed both the target \"this\" and an object that can be used to call any base (super) functions, using this based object in place of\r\n * super.XXX() (which gets expanded to _super.prototype.XXX()) provides a better minification outcome and also ensures the correct \"this\"\r\n * context is maintained as TypeScript creates incorrect references using super.XXXX() for dynamically defined functions i.e. Functions\r\n * defined in the constructor or some other function (rather than declared as complete typescript functions).\r\n * ### Usage\r\n * ```typescript\r\n * import dynamicProto from \"@microsoft/dynamicproto-js\";\r\n * class ExampleClass extends BaseClass {\r\n * constructor() {\r\n * dynamicProto(ExampleClass, this, (_self, base) => {\r\n * // This will define a function that will be converted to a prototype function\r\n * _self.newFunc = () => {\r\n * // Access any \"this\" instance property\r\n * if (_self.someProperty) {\r\n * ...\r\n * }\r\n * }\r\n * // This will define a function that will be converted to a prototype function\r\n * _self.myFunction = () => {\r\n * // Access any \"this\" instance property\r\n * if (_self.someProperty) {\r\n * // Call the base version of the function that we are overriding\r\n * base.myFunction();\r\n * }\r\n * ...\r\n * }\r\n * _self.initialize = () => {\r\n * ...\r\n * }\r\n * // Warnings: While the following will work as _self is simply a reference to\r\n * // this, if anyone overrides myFunction() the overridden will be called first\r\n * // as the normal JavaScript method resolution will occur and the defined\r\n * // _self.initialize() function is actually gets removed from the instance and\r\n * // a proxy prototype version is created to reference the created method.\r\n * _self.initialize();\r\n * });\r\n * }\r\n * }\r\n * ```\r\n * @typeparam DPType This is the generic type of the class, used to keep intellisense valid\r\n * @typeparam DPCls The type that contains the prototype of the current class\r\n * @param theClass This is the current class instance which contains the prototype for the current class\r\n * @param target The current \"this\" (target) reference, when the class has been extended this.prototype will not be the 'theClass' value.\r\n * @param delegateFunc The callback function (closure) that will create the dynamic function\r\n */\r\nfunction dynamicProto(theClass, target, delegateFunc) {\r\n // Make sure that the passed theClass argument looks correct\r\n if (!_hasOwnProperty(theClass, Prototype)) {\r\n _throwTypeError(\"theClass is an invalid class definition.\");\r\n }\r\n // Quick check to make sure that the passed theClass argument looks correct (this is a common copy/paste error)\r\n var classProto = theClass[Prototype];\r\n if (!_checkPrototype(classProto, target)) {\r\n _throwTypeError(\"[\" + _getObjName(theClass) + \"] is not in class heirarchy of [\" + _getObjName(target) + \"]\");\r\n }\r\n var className = null;\r\n if (_hasOwnProperty(classProto, DynClassName)) {\r\n // Only grab the class name if it's defined on this prototype (i.e. don't walk the prototype chain)\r\n className = classProto[DynClassName];\r\n }\r\n else {\r\n // As not all browser support name on the prototype creating a unique dynamic one if we have not already\r\n // assigned one, so we can use a simple string as the lookup rather than an object for the dynamic instance\r\n // function table lookup.\r\n className = DynClassNamePrefix + _getObjName(theClass, \"_\") + \"$\" + _dynamicNames;\r\n _dynamicNames++;\r\n classProto[DynClassName] = className;\r\n }\r\n // Get the current instance functions\r\n var instFuncs = _getInstanceFuncs(target);\r\n // Get all of the functions for any base instance (before they are potentially overriden)\r\n var baseFuncs = _getBaseFuncs(classProto, target, instFuncs);\r\n // Execute the delegate passing in both the current target \"this\" and \"base\" function references\r\n // Note casting the same type as we don't actually have the base class here and this will provide some intellisense support\r\n delegateFunc(target, baseFuncs);\r\n // Populate the Prototype for any overidden instance functions\r\n _populatePrototype(classProto, className, target, instFuncs);\r\n}\n\nexport default dynamicProto;\n//# sourceMappingURL=dynamicproto-js.js.map\n"],"sourceRoot":""}