"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.lockFeatureProcess=exports.isFloatingInteractionIconVisible=exports.LockFeatureMap=exports.FloatingInteractionIconSystemKey=void 0;var _events=_interopRequireDefault(require("./events"));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function _createForOfIteratorHelper(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=_unsupportedIterableToArray(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,o=function(){};return{s:o,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,u=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return a=e.done,e},e:function(e){u=!0,i=e},f:function(){try{a||null==r.return||r.return()}finally{if(u)throw i}}}}function _unsupportedIterableToArray(e,t){if(e){if("string"==typeof e)return _arrayLikeToArray(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?_arrayLikeToArray(e,t):void 0}}function _arrayLikeToArray(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}var LockFeatureMap=Object.freeze({Comment:"Comment",Question:"Question",Questionnaire:"Questionnaire",CheckIn:"CheckIn",Lottery:"Lottery",Thumb:"Thumb",Luckymoney:"Luckymoney",Reservation:"Reservation",Coupon:"Coupon"});exports.LockFeatureMap=LockFeatureMap;var FloatingInteractionIconSystemKey=Object.freeze({QUESTION:"QUESTION",QUESTIONNAIRE:"QUESTIONNAIRE",CHECKIN:"CHECKIN",LOTTERY:"LOTTERY",LUCKYMONEY:"LUCKYMONEY",COUPON:"COUPON"});exports.FloatingInteractionIconSystemKey=FloatingInteractionIconSystemKey;var FLOATING_INTERACTION_ICON_SYSTEM_KEY_SET=new Set(Object.values(FloatingInteractionIconSystemKey)),normalizeFloatingInteractionIconKey=function(e){if(!e)return"";var t=String(e).trim();if(FLOATING_INTERACTION_ICON_SYSTEM_KEY_SET.has(t))return t;if(t.startsWith("SYS:")){var r=t.slice(4);if(FLOATING_INTERACTION_ICON_SYSTEM_KEY_SET.has(r))return r}return""},getSdkOptions=function(e){var t,r,n;return(null==e||null===(t=e.store)||void 0===t||null===(r=t.get)||void 0===r||null===(n=r.call(t,"mainInfo"))||void 0===n?void 0:n.options)||{}},lockFeatureProcess=function(e,t){var r,n=(arguments.length>2&&void 0!==arguments[2]?arguments[2]:{}).emitEvent,o=void 0===n||n,i=getSdkOptions(e).disableFeatureProcess;return r=Array.isArray(i)?i.includes(t):Boolean(i),o&&null!=e&&e.emitEvent&&e.emitEvent(_events.default.PUBLIC.feature.click,{feature:t,status:r}),r};exports.lockFeatureProcess=lockFeatureProcess;var isFloatingInteractionIconVisible=function(e,t){var r=getSdkOptions(e).floatingInteractionIcons;if(!Array.isArray(r)||0===r.length)return!0;var n,o=_createForOfIteratorHelper(r);try{for(o.s();!(n=o.n()).done;){var i=n.value;if(normalizeFloatingInteractionIconKey(null==i?void 0:i.key)===t)return!1!==(null==i?void 0:i.visible)}}catch(e){o.e(e)}finally{o.f()}return!0};exports.isFloatingInteractionIconVisible=isFloatingInteractionIconVisible;