{"ast":null,"code":"\"use strict\";\n\nvar _Object$defineProperty = require(\"@babel/runtime-corejs3/core-js-stable/object/define-property\");\nvar _interopRequireDefault = require(\"@babel/runtime-corejs3/helpers/interopRequireDefault\");\n_Object$defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = void 0;\nvar _ParseUser = _interopRequireDefault(require(\"./ParseUser\"));\n/* global FB */\n\nlet initialized = false;\nlet requestedPermissions;\nlet initOptions;\nconst provider = {\n authenticate(options) {\n if (typeof FB === 'undefined') {\n options.error(this, 'Facebook SDK not found.');\n }\n FB.login(response => {\n if (response.authResponse) {\n if (options.success) {\n options.success(this, {\n id: response.authResponse.userID,\n access_token: response.authResponse.accessToken,\n expiration_date: new Date(response.authResponse.expiresIn * 1000 + new Date().getTime()).toJSON()\n });\n }\n } else {\n if (options.error) {\n options.error(this, response);\n }\n }\n }, {\n scope: requestedPermissions\n });\n },\n restoreAuthentication(authData) {\n if (authData) {\n const newOptions = {};\n if (initOptions) {\n for (const key in initOptions) {\n newOptions[key] = initOptions[key];\n }\n }\n // Suppress checks for login status from the browser.\n newOptions.status = false;\n\n // If the user doesn't match the one known by the FB SDK, log out.\n // Most of the time, the users will match -- it's only in cases where\n // the FB SDK knows of a different user than the one being restored\n // from a Parse User that logged in with username/password.\n const existingResponse = FB.getAuthResponse();\n if (existingResponse && existingResponse.userID !== authData.id) {\n FB.logout();\n }\n FB.init(newOptions);\n }\n return true;\n },\n getAuthType() {\n return 'facebook';\n },\n deauthenticate() {\n this.restoreAuthentication(null);\n }\n};\n\n/**\n * Provides a set of utilities for using Parse with Facebook.\n *\n * @class Parse.FacebookUtils\n * @static\n * @hideconstructor\n */\nconst FacebookUtils = {\n /**\n * Initializes Parse Facebook integration. Call this function after you\n * have loaded the Facebook Javascript SDK with the same parameters\n * as you would pass to\n * \n * FB.init(). Parse.FacebookUtils will invoke FB.init() for you\n * with these arguments.\n *\n * @function init\n * @name Parse.FacebookUtils.init\n * @param {object} options Facebook options argument as described here:\n * \n * FB.init(). The status flag will be coerced to 'false' because it\n * interferes with Parse Facebook integration. Call FB.getLoginStatus()\n * explicitly if this behavior is required by your application.\n */\n init(options) {\n if (typeof FB === 'undefined') {\n throw new Error('The Facebook JavaScript SDK must be loaded before calling init.');\n }\n initOptions = {};\n if (options) {\n for (const key in options) {\n initOptions[key] = options[key];\n }\n }\n if (initOptions.status && typeof console !== 'undefined') {\n const warn = console.warn || console.log || function () {}; // eslint-disable-line no-console\n warn.call(console, 'The \"status\" flag passed into' + ' FB.init, when set to true, can interfere with Parse Facebook' + ' integration, so it has been suppressed. Please call' + ' FB.getLoginStatus() explicitly if you require this behavior.');\n }\n initOptions.status = false;\n FB.init(initOptions);\n _ParseUser.default._registerAuthenticationProvider(provider);\n initialized = true;\n },\n /**\n * Gets whether the user has their account linked to Facebook.\n *\n * @function isLinked\n * @name Parse.FacebookUtils.isLinked\n * @param {Parse.User} user User to check for a facebook link.\n * The user must be logged in on this device.\n * @returns {boolean} true if the user has their account\n * linked to Facebook.\n */\n isLinked(user) {\n return user._isLinked('facebook');\n },\n /**\n * Logs in a user using Facebook. This method delegates to the Facebook\n * SDK to authenticate the user, and then automatically logs in (or\n * creates, in the case where it is a new user) a Parse.User.\n *\n * Standard API:\n *\n * logIn(permission: string, authData: Object);\n *\n * Advanced API: Used for handling your own oAuth tokens\n * {@link https://docs.parseplatform.org/rest/guide/#linking-users}\n *\n * logIn(authData: Object, options?: Object);\n *\n * @function logIn\n * @name Parse.FacebookUtils.logIn\n * @param {(string | object)} permissions The permissions required for Facebook\n * log in. This is a comma-separated string of permissions.\n * Alternatively, supply a Facebook authData object as described in our\n * REST API docs if you want to handle getting facebook auth tokens\n * yourself.\n * @param {object} options MasterKey / SessionToken. Alternatively can be used for authData if permissions is a string\n * @returns {Promise}\n */\n logIn(permissions, options) {\n if (!permissions || typeof permissions === 'string') {\n if (!initialized) {\n throw new Error('You must initialize FacebookUtils before calling logIn.');\n }\n requestedPermissions = permissions;\n return _ParseUser.default.logInWith('facebook', options);\n }\n return _ParseUser.default.logInWith('facebook', {\n authData: permissions\n }, options);\n },\n /**\n * Links Facebook to an existing PFUser. This method delegates to the\n * Facebook SDK to authenticate the user, and then automatically links\n * the account to the Parse.User.\n *\n * Standard API:\n *\n * link(user: Parse.User, permission: string, authData?: Object);\n *\n * Advanced API: Used for handling your own oAuth tokens\n * {@link https://docs.parseplatform.org/rest/guide/#linking-users}\n *\n * link(user: Parse.User, authData: Object, options?: FullOptions);\n *\n * @function link\n * @name Parse.FacebookUtils.link\n * @param {Parse.User} user User to link to Facebook. This must be the\n * current user.\n * @param {(string | object)} permissions The permissions required for Facebook\n * log in. This is a comma-separated string of permissions.\n * Alternatively, supply a Facebook authData object as described in our\n * REST API docs if you want to handle getting facebook auth tokens\n * yourself.\n * @param {object} options MasterKey / SessionToken. Alternatively can be used for authData if permissions is a string\n * @returns {Promise}\n */\n link(user, permissions, options) {\n if (!permissions || typeof permissions === 'string') {\n if (!initialized) {\n throw new Error('You must initialize FacebookUtils before calling link.');\n }\n requestedPermissions = permissions;\n return user.linkWith('facebook', options);\n }\n return user.linkWith('facebook', {\n authData: permissions\n }, options);\n },\n /**\n * Unlinks the Parse.User from a Facebook account.\n *\n * @function unlink\n * @name Parse.FacebookUtils.unlink\n * @param {Parse.User} user User to unlink from Facebook. This must be the\n * current user.\n * @param {object} options Standard options object with success and error\n * callbacks.\n * @returns {Promise}\n */\n unlink: function (user, options) {\n if (!initialized) {\n throw new Error('You must initialize FacebookUtils before calling unlink.');\n }\n return user._unlinkFrom('facebook', options);\n },\n // Used for testing purposes\n _getAuthProvider() {\n return provider;\n }\n};\nvar _default = exports.default = FacebookUtils;","map":{"version":3,"names":["_Object$defineProperty","require","_interopRequireDefault","exports","value","default","_ParseUser","initialized","requestedPermissions","initOptions","provider","authenticate","options","FB","error","login","response","authResponse","success","id","userID","access_token","accessToken","expiration_date","Date","expiresIn","getTime","toJSON","scope","restoreAuthentication","authData","newOptions","key","status","existingResponse","getAuthResponse","logout","init","getAuthType","deauthenticate","FacebookUtils","Error","console","warn","log","call","_registerAuthenticationProvider","isLinked","user","_isLinked","logIn","permissions","logInWith","link","linkWith","unlink","_unlinkFrom","_getAuthProvider","_default"],"sources":["F:/workspace/202226701027/huinongbao-app/node_modules/parse/lib/browser/FacebookUtils.js"],"sourcesContent":["\"use strict\";\n\nvar _Object$defineProperty = require(\"@babel/runtime-corejs3/core-js-stable/object/define-property\");\nvar _interopRequireDefault = require(\"@babel/runtime-corejs3/helpers/interopRequireDefault\");\n_Object$defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = void 0;\nvar _ParseUser = _interopRequireDefault(require(\"./ParseUser\"));\n/* global FB */\n\nlet initialized = false;\nlet requestedPermissions;\nlet initOptions;\nconst provider = {\n authenticate(options) {\n if (typeof FB === 'undefined') {\n options.error(this, 'Facebook SDK not found.');\n }\n FB.login(response => {\n if (response.authResponse) {\n if (options.success) {\n options.success(this, {\n id: response.authResponse.userID,\n access_token: response.authResponse.accessToken,\n expiration_date: new Date(response.authResponse.expiresIn * 1000 + new Date().getTime()).toJSON()\n });\n }\n } else {\n if (options.error) {\n options.error(this, response);\n }\n }\n }, {\n scope: requestedPermissions\n });\n },\n restoreAuthentication(authData) {\n if (authData) {\n const newOptions = {};\n if (initOptions) {\n for (const key in initOptions) {\n newOptions[key] = initOptions[key];\n }\n }\n // Suppress checks for login status from the browser.\n newOptions.status = false;\n\n // If the user doesn't match the one known by the FB SDK, log out.\n // Most of the time, the users will match -- it's only in cases where\n // the FB SDK knows of a different user than the one being restored\n // from a Parse User that logged in with username/password.\n const existingResponse = FB.getAuthResponse();\n if (existingResponse && existingResponse.userID !== authData.id) {\n FB.logout();\n }\n FB.init(newOptions);\n }\n return true;\n },\n getAuthType() {\n return 'facebook';\n },\n deauthenticate() {\n this.restoreAuthentication(null);\n }\n};\n\n/**\n * Provides a set of utilities for using Parse with Facebook.\n *\n * @class Parse.FacebookUtils\n * @static\n * @hideconstructor\n */\nconst FacebookUtils = {\n /**\n * Initializes Parse Facebook integration. Call this function after you\n * have loaded the Facebook Javascript SDK with the same parameters\n * as you would pass to\n * \n * FB.init(). Parse.FacebookUtils will invoke FB.init() for you\n * with these arguments.\n *\n * @function init\n * @name Parse.FacebookUtils.init\n * @param {object} options Facebook options argument as described here:\n * \n * FB.init(). The status flag will be coerced to 'false' because it\n * interferes with Parse Facebook integration. Call FB.getLoginStatus()\n * explicitly if this behavior is required by your application.\n */\n init(options) {\n if (typeof FB === 'undefined') {\n throw new Error('The Facebook JavaScript SDK must be loaded before calling init.');\n }\n initOptions = {};\n if (options) {\n for (const key in options) {\n initOptions[key] = options[key];\n }\n }\n if (initOptions.status && typeof console !== 'undefined') {\n const warn = console.warn || console.log || function () {}; // eslint-disable-line no-console\n warn.call(console, 'The \"status\" flag passed into' + ' FB.init, when set to true, can interfere with Parse Facebook' + ' integration, so it has been suppressed. Please call' + ' FB.getLoginStatus() explicitly if you require this behavior.');\n }\n initOptions.status = false;\n FB.init(initOptions);\n _ParseUser.default._registerAuthenticationProvider(provider);\n initialized = true;\n },\n /**\n * Gets whether the user has their account linked to Facebook.\n *\n * @function isLinked\n * @name Parse.FacebookUtils.isLinked\n * @param {Parse.User} user User to check for a facebook link.\n * The user must be logged in on this device.\n * @returns {boolean} true if the user has their account\n * linked to Facebook.\n */\n isLinked(user) {\n return user._isLinked('facebook');\n },\n /**\n * Logs in a user using Facebook. This method delegates to the Facebook\n * SDK to authenticate the user, and then automatically logs in (or\n * creates, in the case where it is a new user) a Parse.User.\n *\n * Standard API:\n *\n * logIn(permission: string, authData: Object);\n *\n * Advanced API: Used for handling your own oAuth tokens\n * {@link https://docs.parseplatform.org/rest/guide/#linking-users}\n *\n * logIn(authData: Object, options?: Object);\n *\n * @function logIn\n * @name Parse.FacebookUtils.logIn\n * @param {(string | object)} permissions The permissions required for Facebook\n * log in. This is a comma-separated string of permissions.\n * Alternatively, supply a Facebook authData object as described in our\n * REST API docs if you want to handle getting facebook auth tokens\n * yourself.\n * @param {object} options MasterKey / SessionToken. Alternatively can be used for authData if permissions is a string\n * @returns {Promise}\n */\n logIn(permissions, options) {\n if (!permissions || typeof permissions === 'string') {\n if (!initialized) {\n throw new Error('You must initialize FacebookUtils before calling logIn.');\n }\n requestedPermissions = permissions;\n return _ParseUser.default.logInWith('facebook', options);\n }\n return _ParseUser.default.logInWith('facebook', {\n authData: permissions\n }, options);\n },\n /**\n * Links Facebook to an existing PFUser. This method delegates to the\n * Facebook SDK to authenticate the user, and then automatically links\n * the account to the Parse.User.\n *\n * Standard API:\n *\n * link(user: Parse.User, permission: string, authData?: Object);\n *\n * Advanced API: Used for handling your own oAuth tokens\n * {@link https://docs.parseplatform.org/rest/guide/#linking-users}\n *\n * link(user: Parse.User, authData: Object, options?: FullOptions);\n *\n * @function link\n * @name Parse.FacebookUtils.link\n * @param {Parse.User} user User to link to Facebook. This must be the\n * current user.\n * @param {(string | object)} permissions The permissions required for Facebook\n * log in. This is a comma-separated string of permissions.\n * Alternatively, supply a Facebook authData object as described in our\n * REST API docs if you want to handle getting facebook auth tokens\n * yourself.\n * @param {object} options MasterKey / SessionToken. Alternatively can be used for authData if permissions is a string\n * @returns {Promise}\n */\n link(user, permissions, options) {\n if (!permissions || typeof permissions === 'string') {\n if (!initialized) {\n throw new Error('You must initialize FacebookUtils before calling link.');\n }\n requestedPermissions = permissions;\n return user.linkWith('facebook', options);\n }\n return user.linkWith('facebook', {\n authData: permissions\n }, options);\n },\n /**\n * Unlinks the Parse.User from a Facebook account.\n *\n * @function unlink\n * @name Parse.FacebookUtils.unlink\n * @param {Parse.User} user User to unlink from Facebook. This must be the\n * current user.\n * @param {object} options Standard options object with success and error\n * callbacks.\n * @returns {Promise}\n */\n unlink: function (user, options) {\n if (!initialized) {\n throw new Error('You must initialize FacebookUtils before calling unlink.');\n }\n return user._unlinkFrom('facebook', options);\n },\n // Used for testing purposes\n _getAuthProvider() {\n return provider;\n }\n};\nvar _default = exports.default = FacebookUtils;"],"mappings":"AAAA,YAAY;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AAEG,WAAW,EAAEvC,OAAO,EAAE;IAC/B,IAAI,CAACuC,WAAW,IAAI,OAAOA,WAAW,KAAK,QAAQ,EAAE;MACnD,IAAI,CAAC5C,WAAW,EAAE;QAChB,MAAM,IAAIkC,KAAK,CAAC,wDAAwD,CAAC;MAC3E;MACAjC,oBAAoB,GAAG2C,WAAW;MAClC,OAAOH,IAAI,CAACM,QAAQ,CAAC,UAAU,EAAE1C,OAAO,CAAC;IAC3C;IACA,OAAOoC,IAAI,CAACM,QAAQ,CAAC,UAAU,EAAE;MAC/BxB,QAAQ,EAAEqB;IACZ,CAAC,EAAEvC,OAAO,CAAC;EACb,CAAC;EACD;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACE2C,MAAM,EAAE,SAAAA,CAAUP,IAAI,EAAEpC,OAAO,EAAE;IAC/B,IAAI,CAACL,WAAW,EAAE;MAChB,MAAM,IAAIkC,KAAK,CAAC,0DAA0D,CAAC;IAC7E;IACA,OAAOO,IAAI,CAACQ,WAAW,CAAC,UAAU,EAAE5C,OAAO,CAAC;EAC9C,CAAC;EACD;EACA6C,gBAAgBA,CAAA,EAAG;IACjB,OAAO/C,QAAQ;EACjB;AACF,CAAC;AACD,IAAIgD,QAAQ,GAAGvD,OAAO,CAACE,OAAO,GAAGmC,aAAa","ignoreList":[]},"metadata":{},"sourceType":"script","externalDependencies":[]}