@inappstory/js-sdk 3.7.0-rc.5 → 3.7.0-rc.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.esm.mjs
CHANGED
|
@@ -2100,7 +2100,7 @@ class StoryManagerAdapter {
|
|
|
2100
2100
|
return StoryManagerAdapter.instance;
|
|
2101
2101
|
}
|
|
2102
2102
|
get sdkVersionName() {
|
|
2103
|
-
const sdkVersionName = "3.7.0-rc.
|
|
2103
|
+
const sdkVersionName = "3.7.0-rc.6";
|
|
2104
2104
|
return sdkVersionName || "0.0.0";
|
|
2105
2105
|
}
|
|
2106
2106
|
get sdkVersionCode() {
|
package/dist/index.umd.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("@inappstory/react-sdk"),require("react/jsx-runtime"),require("react-dom/client"),require("react"),require("react-dom"));else if("function"==typeof define&&define.amd)define(["@inappstory/react-sdk","react/jsx-runtime","react-dom/client","react","react-dom"],t);else{var r="object"==typeof exports?t(require("@inappstory/react-sdk"),require("react/jsx-runtime"),require("react-dom/client"),require("react"),require("react-dom")):t(e["@inappstory/react-sdk"],e["react/jsx-runtime"],e["react-dom/client"],e.react,e["react-dom"]);for(var n in r)("object"==typeof exports?exports:e)[n]=r[n]}}(self,((e,t,r,n,o)=>(()=>{var a={432:(e,t,r)=>{"use strict";r.d(t,{A:()=>a});var n=r(935),o=r.n(n)()((function(e){return e[1]}));o.push([e.id,".favorite-story-list-modal--xWjHA{position:fixed;inset:0px;z-index:1090}.favorite-story-list-modal--xWjHA .container--GZBjv{width:100%;height:100%;background:var(--storiesFavoriteBackgroundColor, #333333);display:flex;flex-direction:column;position:relative;overflow-y:auto}.favorite-story-list-modal--xWjHA .header--TjHMD{display:flex;align-content:center;justify-content:center;align-items:center;flex-shrink:0;position:-webkit-sticky;position:sticky;top:0;z-index:100;background:var(--storiesFavoriteTitleBackgroundColor, #333333);box-shadow:0 1px 1px 0 rgba(0,0,0,.14),0 2px 1px -1px rgba(0,0,0,.12),0 1px 3px 0 rgba(0,0,0,.2);padding-top:var(--storiesFavoriteHeaderTopOffset, 0px);margin-bottom:25px}.favorite-story-list-modal--xWjHA .header--TjHMD .title--Dk04x{margin-top:1rem;margin-bottom:1rem;font-size:1.2em;color:var(--storiesFavoriteTitleColor, white);font-family:var(--storiesFavoriteTitleFontFamily);font-weight:normal;font-size:1.4rem;line-height:normal;font:var(--storiesFavoriteTitleFont, normal)}@media(min-width: 640px){.favorite-story-list-modal--xWjHA .header--TjHMD .title--Dk04x{margin-top:25px;margin-bottom:25px}}@media(min-width: 640px){.favorite-story-list-modal--xWjHA .header--TjHMD{margin-bottom:50px}}.favorite-story-list-modal--xWjHA .header__close-btn--Jojm-{border:0;padding:0;background:rgba(0,0,0,0);position:absolute;top:50%;transform:translateY(-50%);z-index:1140;pointer-events:all;cursor:pointer;outline:none;right:10px;width:30px;height:30px;display:flex;justify-content:center;align-items:center}.favorite-story-list-modal--xWjHA .header__close-btn--Jojm-:focus{outline:none}.favorite-story-list-modal--xWjHA .header__close-btn--Jojm- svg{overflow:visible}.favorite-story-list-modal--xWjHA .footer--edEpn{width:100%;height:25px}@media(min-width: 640px){.favorite-story-list-modal--xWjHA .footer--edEpn{height:50px}}.favorite-story-list-modal--xWjHA .bottom-offset--baiTh{position:-webkit-sticky;position:sticky;z-index:100;background:inherit;bottom:0;width:100%;height:var(--storiesFavoriteBottomOffset, 0px)}.favorite-story-list-modal--xWjHA .content--qCPkX{display:flex;justify-content:center;width:100%;padding:0 25px 25px;box-sizing:border-box}.favorite-story-list-modal--xWjHA .content--qCPkX .favorite-story-list--MISMx{width:100%}@media(min-width: 640px){.favorite-story-list-modal--xWjHA .content--qCPkX .favorite-story-list--MISMx{max-width:640px}}@media(min-width: 768px){.favorite-story-list-modal--xWjHA .content--qCPkX .favorite-story-list--MISMx{max-width:768px}}@media(min-width: 1024px){.favorite-story-list-modal--xWjHA .content--qCPkX .favorite-story-list--MISMx{max-width:1024px}}@media(min-width: 1280px){.favorite-story-list-modal--xWjHA .content--qCPkX .favorite-story-list--MISMx{max-width:1280px}}",""]),o.locals={"favorite-story-list-modal":"favorite-story-list-modal--xWjHA",container:"container--GZBjv",header:"header--TjHMD",title:"title--Dk04x","header__close-btn":"header__close-btn--Jojm-",footer:"footer--edEpn","bottom-offset":"bottom-offset--baiTh",content:"content--qCPkX","favorite-story-list":"favorite-story-list--MISMx"};const a=o},935:e=>{"use strict";e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var r=e(t);return t[2]?"@media ".concat(t[2]," {").concat(r,"}"):r})).join("")},t.i=function(e,r,n){"string"==typeof e&&(e=[[null,e,""]]);var o={};if(n)for(var a=0;a<this.length;a++){var i=this[a][0];null!=i&&(o[i]=!0)}for(var s=0;s<e.length;s++){var c=[].concat(e[s]);n&&o[c[0]]||(r&&(c[2]?c[2]="".concat(r," and ").concat(c[2]):c[2]=r),t.push(c))}},t}},46:e=>{"use strict";var t,r="object"==typeof Reflect?Reflect:null,n=r&&"function"==typeof r.apply?r.apply:function(e,t,r){return Function.prototype.apply.call(e,t,r)};t=r&&"function"==typeof r.ownKeys?r.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var o=Number.isNaN||function(e){return e!=e};function a(){a.init.call(this)}e.exports=a,e.exports.once=function(e,t){return new Promise((function(r,n){function o(r){e.removeListener(t,a),n(r)}function a(){"function"==typeof e.removeListener&&e.removeListener("error",o),r([].slice.call(arguments))}g(e,t,a,{once:!0}),"error"!==t&&function(e,t,r){"function"==typeof e.on&&g(e,"error",t,r)}(e,o,{once:!0})}))},a.EventEmitter=a,a.prototype._events=void 0,a.prototype._eventsCount=0,a.prototype._maxListeners=void 0;var i=10;function s(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function c(e){return void 0===e._maxListeners?a.defaultMaxListeners:e._maxListeners}function l(e,t,r,n){var o,a,i,l;if(s(r),void 0===(a=e._events)?(a=e._events=Object.create(null),e._eventsCount=0):(void 0!==a.newListener&&(e.emit("newListener",t,r.listener?r.listener:r),a=e._events),i=a[t]),void 0===i)i=a[t]=r,++e._eventsCount;else if("function"==typeof i?i=a[t]=n?[r,i]:[i,r]:n?i.unshift(r):i.push(r),(o=c(e))>0&&i.length>o&&!i.warned){i.warned=!0;var d=new Error("Possible EventEmitter memory leak detected. "+i.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");d.name="MaxListenersExceededWarning",d.emitter=e,d.type=t,d.count=i.length,l=d,console&&console.warn&&console.warn(l)}return e}function d(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function u(e,t,r){var n={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},o=d.bind(n);return o.listener=r,n.wrapFn=o,o}function p(e,t,r){var n=e._events;if(void 0===n)return[];var o=n[t];return void 0===o?[]:"function"==typeof o?r?[o.listener||o]:[o]:r?function(e){for(var t=new Array(e.length),r=0;r<t.length;++r)t[r]=e[r].listener||e[r];return t}(o):h(o,o.length)}function f(e){var t=this._events;if(void 0!==t){var r=t[e];if("function"==typeof r)return 1;if(void 0!==r)return r.length}return 0}function h(e,t){for(var r=new Array(t),n=0;n<t;++n)r[n]=e[n];return r}function g(e,t,r,n){if("function"==typeof e.on)n.once?e.once(t,r):e.on(t,r);else{if("function"!=typeof e.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof e);e.addEventListener(t,(function o(a){n.once&&e.removeEventListener(t,o),r(a)}))}}Object.defineProperty(a,"defaultMaxListeners",{enumerable:!0,get:function(){return i},set:function(e){if("number"!=typeof e||e<0||o(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");i=e}}),a.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},a.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||o(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this},a.prototype.getMaxListeners=function(){return c(this)},a.prototype.emit=function(e){for(var t=[],r=1;r<arguments.length;r++)t.push(arguments[r]);var o="error"===e,a=this._events;if(void 0!==a)o=o&&void 0===a.error;else if(!o)return!1;if(o){var i;if(t.length>0&&(i=t[0]),i instanceof Error)throw i;var s=new Error("Unhandled error."+(i?" ("+i.message+")":""));throw s.context=i,s}var c=a[e];if(void 0===c)return!1;if("function"==typeof c)n(c,this,t);else{var l=c.length,d=h(c,l);for(r=0;r<l;++r)n(d[r],this,t)}return!0},a.prototype.addListener=function(e,t){return l(this,e,t,!1)},a.prototype.on=a.prototype.addListener,a.prototype.prependListener=function(e,t){return l(this,e,t,!0)},a.prototype.once=function(e,t){return s(t),this.on(e,u(this,e,t)),this},a.prototype.prependOnceListener=function(e,t){return s(t),this.prependListener(e,u(this,e,t)),this},a.prototype.removeListener=function(e,t){var r,n,o,a,i;if(s(t),void 0===(n=this._events))return this;if(void 0===(r=n[e]))return this;if(r===t||r.listener===t)0==--this._eventsCount?this._events=Object.create(null):(delete n[e],n.removeListener&&this.emit("removeListener",e,r.listener||t));else if("function"!=typeof r){for(o=-1,a=r.length-1;a>=0;a--)if(r[a]===t||r[a].listener===t){i=r[a].listener,o=a;break}if(o<0)return this;0===o?r.shift():function(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}(r,o),1===r.length&&(n[e]=r[0]),void 0!==n.removeListener&&this.emit("removeListener",e,i||t)}return this},a.prototype.off=a.prototype.removeListener,a.prototype.removeAllListeners=function(e){var t,r,n;if(void 0===(r=this._events))return this;if(void 0===r.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==r[e]&&(0==--this._eventsCount?this._events=Object.create(null):delete r[e]),this;if(0===arguments.length){var o,a=Object.keys(r);for(n=0;n<a.length;++n)"removeListener"!==(o=a[n])&&this.removeAllListeners(o);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(t=r[e]))this.removeListener(e,t);else if(void 0!==t)for(n=t.length-1;n>=0;n--)this.removeListener(e,t[n]);return this},a.prototype.listeners=function(e){return p(this,e,!0)},a.prototype.rawListeners=function(e){return p(this,e,!1)},a.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):f.call(e,t)},a.prototype.listenerCount=f,a.prototype.eventNames=function(){return this._eventsCount>0?t(this._events):[]}},650:(e,t,r)=>{var n=r(942).Symbol;e.exports=n},379:(e,t,r)=>{var n=r(650),o=r(870),a=r(5),i=n?n.toStringTag:void 0;e.exports=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":i&&i in Object(e)?o(e):a(e)}},967:(e,t,r)=>{var n="object"==typeof r.g&&r.g&&r.g.Object===Object&&r.g;e.exports=n},870:(e,t,r)=>{var n=r(650),o=Object.prototype,a=o.hasOwnProperty,i=o.toString,s=n?n.toStringTag:void 0;e.exports=function(e){var t=a.call(e,s),r=e[s];try{e[s]=void 0;var n=!0}catch(e){}var o=i.call(e);return n&&(t?e[s]=r:delete e[s]),o}},5:e=>{var t=Object.prototype.toString;e.exports=function(e){return t.call(e)}},942:(e,t,r)=>{var n=r(967),o="object"==typeof self&&self&&self.Object===Object&&self,a=n||o||Function("return this")();e.exports=a},655:(e,t,r)=>{var n=r(379),o=r(580);e.exports=function(e){if(!o(e))return!1;var t=n(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t}},580:e=>{e.exports=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}},591:(e,t,r)=>{"use strict";var n,o=function(){return void 0===n&&(n=Boolean(window&&document&&document.all&&!window.atob)),n},a=function(){var e={};return function(t){if(void 0===e[t]){var r=document.querySelector(t);if(window.HTMLIFrameElement&&r instanceof window.HTMLIFrameElement)try{r=r.contentDocument.head}catch(e){r=null}e[t]=r}return e[t]}}(),i=[];function s(e){for(var t=-1,r=0;r<i.length;r++)if(i[r].identifier===e){t=r;break}return t}function c(e,t){for(var r={},n=[],o=0;o<e.length;o++){var a=e[o],c=t.base?a[0]+t.base:a[0],l=r[c]||0,d="".concat(c," ").concat(l);r[c]=l+1;var u=s(d),p={css:a[1],media:a[2],sourceMap:a[3]};-1!==u?(i[u].references++,i[u].updater(p)):i.push({identifier:d,updater:y(p,t),references:1}),n.push(d)}return n}function l(e){var t=document.createElement("style"),n=e.attributes||{};if(void 0===n.nonce){var o=r.nc;o&&(n.nonce=o)}if(Object.keys(n).forEach((function(e){t.setAttribute(e,n[e])})),"function"==typeof e.insert)e.insert(t);else{var i=a(e.insert||"head");if(!i)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");i.appendChild(t)}return t}var d,u=(d=[],function(e,t){return d[e]=t,d.filter(Boolean).join("\n")});function p(e,t,r,n){var o=r?"":n.media?"@media ".concat(n.media," {").concat(n.css,"}"):n.css;if(e.styleSheet)e.styleSheet.cssText=u(t,o);else{var a=document.createTextNode(o),i=e.childNodes;i[t]&&e.removeChild(i[t]),i.length?e.insertBefore(a,i[t]):e.appendChild(a)}}function f(e,t,r){var n=r.css,o=r.media,a=r.sourceMap;if(o?e.setAttribute("media",o):e.removeAttribute("media"),a&&"undefined"!=typeof btoa&&(n+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(a))))," */")),e.styleSheet)e.styleSheet.cssText=n;else{for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(document.createTextNode(n))}}var h=null,g=0;function y(e,t){var r,n,o;if(t.singleton){var a=g++;r=h||(h=l(t)),n=p.bind(null,r,a,!1),o=p.bind(null,r,a,!0)}else r=l(t),n=f.bind(null,r,t),o=function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(r)};return n(e),function(t){if(t){if(t.css===e.css&&t.media===e.media&&t.sourceMap===e.sourceMap)return;n(e=t)}else o()}}e.exports=function(e,t){(t=t||{}).singleton||"boolean"==typeof t.singleton||(t.singleton=o());var r=c(e=e||[],t);return function(e){if(e=e||[],"[object Array]"===Object.prototype.toString.call(e)){for(var n=0;n<r.length;n++){var o=s(r[n]);i[o].references--}for(var a=c(e,t),l=0;l<r.length;l++){var d=s(r[l]);0===i[d].references&&(i[d].updater(),i.splice(d,1))}r=a}}}},494:t=>{"use strict";t.exports=e},155:e=>{"use strict";e.exports=n},514:e=>{"use strict";e.exports=o},236:e=>{"use strict";e.exports=r},272:e=>{"use strict";e.exports=t}},i={};function s(e){var t=i[e];if(void 0!==t)return t.exports;var r=i[e]={id:e,exports:{}};return a[e](r,r.exports,s),r.exports}s.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return s.d(t,{a:t}),t},s.d=(e,t)=>{for(var r in t)s.o(t,r)&&!s.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},s.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),s.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),s.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},s.nc=void 0;var c={};return(()=>{"use strict";s.r(c),s.d(c,{AppearanceManager:()=>e.AppearanceManager,CloseButtonPosition:()=>e.CloseButtonPosition,GoodsWidgetRenderingType:()=>e.GoodsWidgetRenderingType,IamCheckDisplayTimeRangeError:()=>e.IamCheckDisplayTimeRangeError,IamFrequencyLimitError:()=>e.IamFrequencyLimitError,IamMessageLimitExceededError:()=>e.IamMessageLimitExceededError,IamMessageOpenError:()=>e.IamMessageOpenError,IamNotFoundByEventError:()=>e.IamNotFoundByEventError,IamNotFoundByIdError:()=>e.IamNotFoundByIdError,IamNotFoundLimitError:()=>e.IamNotFoundLimitError,IamOtherReaderIsOpenError:()=>e.IamOtherReaderIsOpenError,IamShowOnlyIfLoadedError:()=>e.IamShowOnlyIfLoadedError,IasNetworkError:()=>e.IasNetworkError,InAppStoryManager:()=>D,StoriesListCardCoverQuality:()=>e.StoriesListCardCoverQuality,StoriesListCardTitlePosition:()=>e.StoriesListCardTitlePosition,StoriesListCardTitleTextAlign:()=>e.StoriesListCardTitleTextAlign,StoriesListCardViewVariant:()=>e.StoriesListCardViewVariant,StoriesListDirection:()=>e.StoriesListDirection,StoryReaderSwipeStyle:()=>e.StoryReaderSwipeStyle});var e=s(494);class t extends Error{constructor(e){super(`Appearance Manager must be an object, but passed ${e.toUpperCase()}. Please check your code.`),this.name="IasAppearanceManagerTypeofError"}}const r=e=>{if(null==e||"object"!=typeof e)throw new t(null==e?"null":typeof e)};class n extends Error{constructor(){super("[IAS]: The <StoryManager> instance has been destroyed, you must create a new instance"),this.name="IasInAppStoryManagerReferenceError"}}class o extends Error{constructor(e){super(`[IAS]: Mount point ${e} is not present in DOM at initialization time`),this.name="IasMountPointReferenceError"}}var a=s(46);class i extends a.EventEmitter{constructor(e,t){super(),Object.defineProperty(this,"_mountSelector",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"app",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"_mountPoint",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this._mountPoint=this.getMountPoint(e),this.app.addItem(this).catch(console.error)}get mountPoint(){return this._mountPoint}get mountSelector(){return this._mountSelector}destroy(){this.app.removeItem(this)}getMountPoint(e){const t=document.querySelector(e);if(!t)throw new o(e);return t}}class l extends i{constructor(e,t,n,o){super(e,n),Object.defineProperty(this,"_appearanceManager",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"params",{enumerable:!0,configurable:!0,writable:!0,value:o}),Object.defineProperty(this,"_ugcCardClickHandler",{enumerable:!0,configurable:!0,writable:!0,value:()=>{}}),Object.defineProperty(this,"_api",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),r(t)}get appearanceManager(){return this._appearanceManager}get type(){return e.StoryFeedType.DEFAULT}get identityFields(){return{feedSlug:this.feedSlug}}get feedSlug(){var e;return null===(e=this.params)||void 0===e?void 0:e.feed}get testKey(){var e;return null===(e=this.params)||void 0===e?void 0:e.testKey}get useUgcCard(){var e;return Boolean(null===(e=this.params)||void 0===e?void 0:e.useUgcCard)}set ugcCardClickHandler(e){this._ugcCardClickHandler=e}get ugcCardClickHandler(){return this._ugcCardClickHandler}set api(e){this._api=e}async reload(){var e;return null===(e=this._api)||void 0===e?void 0:e.reload()}}class d extends l{constructor(t,n,o,a){super(t,n,o,{feed:e.UGCFeedSlug,testKey:null==a?void 0:a.testKey,useUgcCard:null==a?void 0:a.useUgcCard}),Object.defineProperty(this,"ugcParams",{enumerable:!0,configurable:!0,writable:!0,value:a}),r(n)}get type(){return e.StoryFeedType.UGC}get filter(){var e;return null===(e=this.ugcParams)||void 0===e?void 0:e.filter}}var u=s(272),p=s(236),f=s(155),h=s(591),g=s.n(h),y=s(432),v={insert:"head",singleton:!1};g()(y.A,v);const m=y.A.locals||{};var b;!function(e){e.LTR="ltr",e.RTL="rtl"}(b||(b={}));const S=({open:t,options:r,storyListOptions:n,onClose:o})=>{var a,i;(0,f.useLayoutEffect)((()=>{if(!t)return;const e=document.documentElement.style.overflow;return document.documentElement.style.overflow="hidden",()=>{document.documentElement.style.overflow=e}}),[t]);return t?(0,u.jsx)("div",{className:m["favorite-story-list-modal"],style:(()=>{var e,t,n,o;return{"--storiesFavoriteTitleColor":r.title.color,"--storiesFavoriteTitleFontFamily":"InternalPrimaryFont","--storiesFavoriteTitleFont":r.title.font,"--storiesFavoriteTitleBackgroundColor":r.title.backgroundColor,"--storiesFavoriteHeaderTopOffset":parseFloat(null!==(t=null===(e=r.headerTopOffset)||void 0===e?void 0:e.toString())&&void 0!==t?t:"0")+"px","--storiesFavoriteBottomOffset":parseFloat(null!==(o=null===(n=r.bottomOffset)||void 0===n?void 0:n.toString())&&void 0!==o?o:"0")+"px","--storiesFavoriteBackgroundColor":r.backgroundColor}})(),children:(0,u.jsxs)("div",{className:m.container,children:[(0,u.jsxs)("div",{className:m.header,children:[(0,u.jsx)("p",{className:m.title,children:r.title.content}),(0,u.jsx)("button",{onClick:e=>{e.preventDefault(),e.stopPropagation(),o()},className:m["header__close-btn"],style:(()=>{var t;const n="start"===r.closeButtonPosition||"left"===r.closeButtonPosition,o=(null===(t=e.storyManager.getConfig())||void 0===t?void 0:t.dir)===b.LTR;return{[n&&o||!n&&!o?"left":"right"]:"10px"}})(),dangerouslySetInnerHTML:{__html:null!==(i=null===(a=r.closeButton)||void 0===a?void 0:a.svgSrc.baseState)&&void 0!==i?i:""}})]}),(0,u.jsx)("div",{className:m.content,children:(0,u.jsx)("div",{className:m["favorite-story-list"],children:(0,u.jsx)(e.FavoriteStoryList,{options:Object.assign(Object.assign(Object.assign({},n),{sidePadding:0}),{direction:e.StoriesListDirection.COLUMN,layout:{height:"auto"}})})})}),(0,u.jsx)("div",{className:m.footer}),(0,u.jsx)("div",{className:m["bottom-offset"]})]})}):null};var M=s(514);const w=e=>{(0,f.useEffect)((()=>{const t=e.mountPoint,r=()=>{console.warn(`[IAS]: The node has been removed from DOM. Unsafe destruction of story feed ${e.mountSelector}`),e.destroy()};if(!document.body.contains(t))return void r();const n=new MutationObserver((()=>{document.body.contains(t)||(r(),n.disconnect())}));return n.observe(document.body,{childList:!0,subtree:!0}),()=>{n.disconnect()}}),[e])};var x;!function(e){e.START_LOADER="startLoad",e.END_LOADER="endLoad"}(x||(x={}));const C=({storyList:t,onStoryCardClick:r,onFavoriteCardClick:n})=>{const[o,a]=(0,f.useState)(t.appearanceManager.storiesListOptions),i=(0,f.useRef)(null);return w(t),(0,f.useEffect)((()=>{t.api=i.current}),[]),(0,f.useEffect)((()=>(t.appearanceManager.on(e.AppearanceManagerEvents.EVENT_UPDATED_STORIES_LIST_OPTIONS,a),()=>{t.appearanceManager.off(e.AppearanceManagerEvents.EVENT_UPDATED_STORIES_LIST_OPTIONS,a)})),[t.appearanceManager]),(0,M.createPortal)((0,u.jsx)(e.StoryList,{ref:i,options:o,hasFavorite:t.appearanceManager.commonOptions.hasFavorite,testKey:t.testKey,useUgcCard:t.useUgcCard,feedSlug:t.feedSlug,onLoadStart:()=>{t.emit(x.START_LOADER)},onLoadEnd:e=>{t.emit(x.END_LOADER,e)},onUgcCardClick:()=>{t.ugcCardClickHandler()},onFavoriteCardClick:n,onStoryCardClick:r}),t.mountPoint)};var L;!function(e){e.START_LOADER="startLoad",e.END_LOADER="endLoad"}(L||(L={}));const E=({ugcStoryList:t,onStoryCardClick:r})=>{const[n,o]=(0,f.useState)(t.appearanceManager.storiesListOptions),a=(0,f.useRef)(null);return w(t),(0,f.useEffect)((()=>{t.api=a.current}),[]),(0,f.useEffect)((()=>(t.appearanceManager.on(e.AppearanceManagerEvents.EVENT_UPDATED_STORIES_LIST_OPTIONS,o),()=>{t.appearanceManager.off(e.AppearanceManagerEvents.EVENT_UPDATED_STORIES_LIST_OPTIONS,o)})),[t.appearanceManager]),(0,M.createPortal)((0,u.jsx)(e.UGCStoryList,{ref:a,options:n,filter:t.filter,testKey:t.testKey,useUgcCard:t.useUgcCard,onStoryCardClick:r,onLoadStart:()=>{t.emit(L.START_LOADER)},onLoadEnd:e=>{t.emit(L.END_LOADER,e)},onUgcCardClick:()=>{t.ugcCardClickHandler()}}),t.mountPoint)},O=t=>{const[r,n]=(0,f.useState)(!1);return(0,u.jsxs)(e.IASContainer,{config:t.storyManagerConfigDto,storyReaderOptions:t.appearanceManager.storyReaderOptions,commonOptions:t.appearanceManager.commonOptions,gameReaderOptions:t.appearanceManager.gameReaderOptions,goodsWidgetOptions:t.appearanceManager.goodsWidgetOptions,children:[t.items.map((e=>e instanceof d?(0,u.jsx)(E,{ugcStoryList:e,onStoryCardClick:()=>{t.onAppearanceManagerChange(e.appearanceManager)}},e.mountSelector):e instanceof l?(0,u.jsx)(C,{onFavoriteCardClick:()=>{n(!0)},onStoryCardClick:()=>{t.onAppearanceManagerChange(e.appearanceManager)},storyList:e},e.mountSelector):void 0)),(0,u.jsx)(S,{open:r,onClose:()=>n(!1),options:t.appearanceManager.storyFavoriteReaderOptions,storyListOptions:t.appearanceManager.storiesListOptions})]})};class j{constructor(){Object.defineProperty(this,"_items",{enumerable:!0,configurable:!0,writable:!0,value:[]})}get items(){return this._items}addItem(e){this._items.push(e)}removeItem(e){const t=this._items.findIndex((t=>t===e));-1!==t&&this._items.splice(t,1)}destroy(){this._items=[]}}class A{constructor(t){Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"root",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"storyManagerConfigDto",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"appearanceManager",{enumerable:!0,configurable:!0,writable:!0,value:new e.AppearanceManager}),Object.defineProperty(this,"rootElement",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"appItemManager",{enumerable:!0,configurable:!0,writable:!0,value:new j}),this.createAppRoot(),this.handleAppearanceManagerUpdate=this.handleAppearanceManagerUpdate.bind(this),this.setAppearanceManager=this.setAppearanceManager.bind(this)}async addItem(e){try{this.appItemManager.addItem(e),await this.storyManager.waitStoryManagerConfig(),this.render()}catch(t){throw this.removeItem(e),t}}async removeItem(e){this.appItemManager.removeItem(e),this.render()}setStoryManagerConfig(e){this.storyManagerConfigDto=Object.assign(Object.assign({},this.storyManagerConfigDto),e),this.render()}setAppearanceManager(e){r(e),this.unscubscribeToAppearanceManagerEvents(),this.appearanceManager=e,this.subscribeToAppearanceManagerEvents(),this.render()}render(){var e;null===(e=this.root)||void 0===e||e.render((0,u.jsx)(O,{storyManagerConfigDto:this.storyManagerConfigDto,appearanceManager:this.appearanceManager,items:this.appItemManager.items.slice(),onAppearanceManagerChange:this.setAppearanceManager}))}destroy(){this.rootElement&&this.root&&(this.appItemManager.destroy(),this.unscubscribeToAppearanceManagerEvents(),this.root.unmount(),document.body.removeChild(this.rootElement),this.rootElement=null,this.root=null)}createAppRoot(){this.rootElement=document.createElement("div"),this.rootElement.id="ias-app",document.body.append(this.rootElement),this.root=(0,p.createRoot)(this.rootElement)}subscribeToAppearanceManagerEvents(){this.appearanceManager.on(e.AppearanceManagerEvents.UPDATE,this.handleAppearanceManagerUpdate)}unscubscribeToAppearanceManagerEvents(){this.appearanceManager.off(e.AppearanceManagerEvents.UPDATE,this.handleAppearanceManagerUpdate)}handleAppearanceManagerUpdate(){this.render()}}var _,I=s(655),T=s.n(I);!function(e){e.START_LOADING="startLoading",e.END_LOADING="endLoading",e.CLOSE_STORY_READER="closeStoryReader"}(_||(_={}));class P extends a.EventEmitter{constructor(e,t,n,o,a){super(),Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(this,"app",{enumerable:!0,configurable:!0,writable:!0,value:o}),Object.defineProperty(this,"options",{enumerable:!0,configurable:!0,writable:!0,value:a}),r(t),this.handleCloseStoryReader=this.handleCloseStoryReader.bind(this),this.showSharePage(e,t)}async showSharePage(e,t){try{this.app.setAppearanceManager(t),this.handleStartLoad(),await this.storyManager.showSharePage(e),this.storyManager.once("closeStoryReader",this.handleCloseStoryReader),this.handleEndLoad(!0)}catch(e){this.handleEndLoad(!1)}}async closeStoryReader(){this.storyManager.closeStoryReader()}handleStartLoad(){setTimeout((()=>{var e;this.emit(_.START_LOADING),T()(null===(e=this.options)||void 0===e?void 0:e.handleStartLoad)&&this.options.handleStartLoad()}))}handleEndLoad(e){var t;this.emit(_.END_LOADING,{result:e}),T()(null===(t=this.options)||void 0===t?void 0:t.handleStopLoad)&&this.options.handleStopLoad(e)}handleCloseStoryReader(){var e,t,r;if(T()(null===(e=this.options)||void 0===e?void 0:e.handleStoryReaderClose)||this.listenerCount(_.CLOSE_STORY_READER)>0)try{T()(null===(t=this.options)||void 0===t?void 0:t.handleStoryReaderClose)&&(null===(r=this.options)||void 0===r||r.handleStoryReaderClose()),this.emit(_.CLOSE_STORY_READER)}catch(e){console.error(e)}else{const e=window.location;window.open(`${e.protocol}//${e.host}`,"_parent")}}}class k extends a.EventEmitter{constructor(t,n,o,a){super(),Object.defineProperty(this,"appearanceManager",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(this,"app",{enumerable:!0,configurable:!0,writable:!0,value:o}),Object.defineProperty(this,"options",{enumerable:!0,configurable:!0,writable:!0,value:a}),Object.defineProperty(this,"stackedStoryListViewModel",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),r(t),this.handleUpdate=this.handleUpdate.bind(this),this.stackedStoryListViewModel=new e.StackedStoryListViewModel(this.options),this.stackedStoryListViewModel.on("update",this.handleUpdate),this.loadStories().catch(console.error)}get stories(){return this.stackedStoryListViewModel.stories}get length(){return this.stackedStoryListViewModel.length}get activeIndex(){return this.stackedStoryListViewModel.activeIndex}get feedCoverSrc(){return this.stackedStoryListViewModel.feedCoverSrc}get top(){return this.stackedStoryListViewModel.top}async reload(){return this.stackedStoryListViewModel.reload()}destroy(){this.stackedStoryListViewModel.destroy(),this.stackedStoryListViewModel.removeAllListeners()}showStory(e){this.app.setAppearanceManager(this.appearanceManager),this.stackedStoryListViewModel.showStory(e)}on(e,t){return"update"===e?super.on(e,t):(this.stackedStoryListViewModel.on(e,t),this)}once(e,t){return this.stackedStoryListViewModel.once(e,t),this}off(e,t){return this.stackedStoryListViewModel.off(e,t),this}handleUpdate(e){this.emit("update",{id:e.id,title:e.title,titleColor:e.titleColor,hasAudio:e.hasAudio,hasSwipeUp:e.hasSwipeUp,isOpened:e.isOpened,deeplink:e.deeplink,gameInstanceId:e.gameInstanceId,hideInReader:e.hideInReader,hide_timeline:e.hideTimeline,cover:e.getCover(this.appearanceManager.storiesListOptions.card.coverQuality)})}async loadStories(){await this.storyManager.waitStoryManagerConfig(),this.stackedStoryListViewModel.loadStories()}}const R=()=>{if(!D.instance)throw new n};class D{constructor(t){return Object.defineProperty(this,"storyManagerConfigDto",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"__IAS_INTERNAL_API__",{enumerable:!0,configurable:!0,writable:!0,value:e.__IAS_INTERNAL_API__}),Object.defineProperty(this,"app",{enumerable:!0,configurable:!0,writable:!0,value:new A(e.storyManager)}),Object.defineProperty(this,"StoriesList",{enumerable:!0,configurable:!0,writable:!0,value:class extends l{constructor(e,t,r){R(),super(e,t,D.instance.app,r)}}}),Object.defineProperty(this,"UGCStoriesList",{enumerable:!0,configurable:!0,writable:!0,value:class extends d{constructor(e,t,r){R(),super(e,t,D.instance.app,r)}}}),Object.defineProperty(this,"SharePage",{enumerable:!0,configurable:!0,writable:!0,value:class extends P{constructor(t,r,n){R(),super(t,r,e.storyManager,D.instance.app,n)}}}),Object.defineProperty(this,"StackedStoryList",{enumerable:!0,configurable:!0,writable:!0,value:class extends k{constructor(t,r){R(),super(t,e.storyManager,D.instance.app,r)}}}),Object.defineProperty(this,"inAppMessaging",{enumerable:!0,configurable:!0,writable:!0,value:e.storyManager.inAppMessaging}),D.instance?(console.warn("StoryManager singleton is created multiple times\nuse IAS.StoryManager.getInstance() instead"),D.instance):(e.storyManager.setUserAgent(`InAppStoryJSSDK/${this.sdkVersionCode}`),D.instance=this,this.app.setStoryManagerConfig(t),D.instance)}get sdkVersionName(){return"3.7.0-rc.5"}get sdkVersionCode(){return parseInt(30700)}set storyLinkClickHandler(t){e.storyManager.storyLinkClickHandler=t}static getInstance(){return D.instance?D.instance:null}static use(t,r){t.install({INTERNAL_API:e.__IAS_INTERNAL_API__,HOST:D},r)}getConfig(){return e.storyManager.getConfig()}async showOnboardingStories(t,r){return R(),this.app.setAppearanceManager(t),e.storyManager.showOnboardingStories(r)}async showStory(t,r){R(),this.app.setAppearanceManager(r),await e.storyManager.showStory(t)}async showStoryOnce(t,r){return R(),this.app.setAppearanceManager(r),e.storyManager.showStoryOnce(t)}async showSharePage(t,r){return R(),this.app.setAppearanceManager(r),e.storyManager.showSharePage(t)}closeAllReaders(){e.storyManager.closeAllReaders()}async openGame(t,r,n={}){return R(),this.app.setAppearanceManager(r),e.storyManager.openGame(t,n)}async closeGame(){return e.storyManager.closeGame()}async closeStoryReader(){return e.storyManager.closeStoryReader()}getUgcEditorConfig(){return e.storyManager.getUgcEditorConfig()}closeGoodsWidget(){e.storyManager.closeGoodsWidget()}setLang(e){this.storyManagerConfigDto.lang=e,this.app.setStoryManagerConfig(this.storyManagerConfigDto)}getNonce(){return e.storyManager.getNonce()}async setUserId(e,t){R(),this.storyManagerConfigDto.userId=e,this.storyManagerConfigDto.userIdSign=t,this.app.setStoryManagerConfig(this.storyManagerConfigDto)}async userLogoug(){return this.setUserId("")}setTags(e){R(),this.storyManagerConfigDto.tags=e,this.app.setStoryManagerConfig(this.storyManagerConfigDto)}setPlaceholders(e){R(),this.storyManagerConfigDto.placeholders=e,this.app.setStoryManagerConfig(this.storyManagerConfigDto)}setImagePlaceholders(e){R(),this.storyManagerConfigDto.imagePlaceholders=e,this.app.setStoryManagerConfig(this.storyManagerConfigDto)}on(t,r){return e.storyManager.on(t,r),this}once(t,r){return e.storyManager.once(t,r),this}off(t,r){return e.storyManager.off(t,r),this}destroy(){null!=D.instance&&(D.instance=null,this.closeAllReaders(),this.app.destroy())}}})(),c})()));
|
|
1
|
+
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("@inappstory/react-sdk"),require("react/jsx-runtime"),require("react-dom/client"),require("react"),require("react-dom"));else if("function"==typeof define&&define.amd)define(["@inappstory/react-sdk","react/jsx-runtime","react-dom/client","react","react-dom"],t);else{var r="object"==typeof exports?t(require("@inappstory/react-sdk"),require("react/jsx-runtime"),require("react-dom/client"),require("react"),require("react-dom")):t(e["@inappstory/react-sdk"],e["react/jsx-runtime"],e["react-dom/client"],e.react,e["react-dom"]);for(var n in r)("object"==typeof exports?exports:e)[n]=r[n]}}(self,((e,t,r,n,o)=>(()=>{var a={432:(e,t,r)=>{"use strict";r.d(t,{A:()=>a});var n=r(935),o=r.n(n)()((function(e){return e[1]}));o.push([e.id,".favorite-story-list-modal--xWjHA{position:fixed;inset:0px;z-index:1090}.favorite-story-list-modal--xWjHA .container--GZBjv{width:100%;height:100%;background:var(--storiesFavoriteBackgroundColor, #333333);display:flex;flex-direction:column;position:relative;overflow-y:auto}.favorite-story-list-modal--xWjHA .header--TjHMD{display:flex;align-content:center;justify-content:center;align-items:center;flex-shrink:0;position:-webkit-sticky;position:sticky;top:0;z-index:100;background:var(--storiesFavoriteTitleBackgroundColor, #333333);box-shadow:0 1px 1px 0 rgba(0,0,0,.14),0 2px 1px -1px rgba(0,0,0,.12),0 1px 3px 0 rgba(0,0,0,.2);padding-top:var(--storiesFavoriteHeaderTopOffset, 0px);margin-bottom:25px}.favorite-story-list-modal--xWjHA .header--TjHMD .title--Dk04x{margin-top:1rem;margin-bottom:1rem;font-size:1.2em;color:var(--storiesFavoriteTitleColor, white);font-family:var(--storiesFavoriteTitleFontFamily);font-weight:normal;font-size:1.4rem;line-height:normal;font:var(--storiesFavoriteTitleFont, normal)}@media(min-width: 640px){.favorite-story-list-modal--xWjHA .header--TjHMD .title--Dk04x{margin-top:25px;margin-bottom:25px}}@media(min-width: 640px){.favorite-story-list-modal--xWjHA .header--TjHMD{margin-bottom:50px}}.favorite-story-list-modal--xWjHA .header__close-btn--Jojm-{border:0;padding:0;background:rgba(0,0,0,0);position:absolute;top:50%;transform:translateY(-50%);z-index:1140;pointer-events:all;cursor:pointer;outline:none;right:10px;width:30px;height:30px;display:flex;justify-content:center;align-items:center}.favorite-story-list-modal--xWjHA .header__close-btn--Jojm-:focus{outline:none}.favorite-story-list-modal--xWjHA .header__close-btn--Jojm- svg{overflow:visible}.favorite-story-list-modal--xWjHA .footer--edEpn{width:100%;height:25px}@media(min-width: 640px){.favorite-story-list-modal--xWjHA .footer--edEpn{height:50px}}.favorite-story-list-modal--xWjHA .bottom-offset--baiTh{position:-webkit-sticky;position:sticky;z-index:100;background:inherit;bottom:0;width:100%;height:var(--storiesFavoriteBottomOffset, 0px)}.favorite-story-list-modal--xWjHA .content--qCPkX{display:flex;justify-content:center;width:100%;padding:0 25px 25px;box-sizing:border-box}.favorite-story-list-modal--xWjHA .content--qCPkX .favorite-story-list--MISMx{width:100%}@media(min-width: 640px){.favorite-story-list-modal--xWjHA .content--qCPkX .favorite-story-list--MISMx{max-width:640px}}@media(min-width: 768px){.favorite-story-list-modal--xWjHA .content--qCPkX .favorite-story-list--MISMx{max-width:768px}}@media(min-width: 1024px){.favorite-story-list-modal--xWjHA .content--qCPkX .favorite-story-list--MISMx{max-width:1024px}}@media(min-width: 1280px){.favorite-story-list-modal--xWjHA .content--qCPkX .favorite-story-list--MISMx{max-width:1280px}}",""]),o.locals={"favorite-story-list-modal":"favorite-story-list-modal--xWjHA",container:"container--GZBjv",header:"header--TjHMD",title:"title--Dk04x","header__close-btn":"header__close-btn--Jojm-",footer:"footer--edEpn","bottom-offset":"bottom-offset--baiTh",content:"content--qCPkX","favorite-story-list":"favorite-story-list--MISMx"};const a=o},935:e=>{"use strict";e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var r=e(t);return t[2]?"@media ".concat(t[2]," {").concat(r,"}"):r})).join("")},t.i=function(e,r,n){"string"==typeof e&&(e=[[null,e,""]]);var o={};if(n)for(var a=0;a<this.length;a++){var i=this[a][0];null!=i&&(o[i]=!0)}for(var s=0;s<e.length;s++){var c=[].concat(e[s]);n&&o[c[0]]||(r&&(c[2]?c[2]="".concat(r," and ").concat(c[2]):c[2]=r),t.push(c))}},t}},46:e=>{"use strict";var t,r="object"==typeof Reflect?Reflect:null,n=r&&"function"==typeof r.apply?r.apply:function(e,t,r){return Function.prototype.apply.call(e,t,r)};t=r&&"function"==typeof r.ownKeys?r.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var o=Number.isNaN||function(e){return e!=e};function a(){a.init.call(this)}e.exports=a,e.exports.once=function(e,t){return new Promise((function(r,n){function o(r){e.removeListener(t,a),n(r)}function a(){"function"==typeof e.removeListener&&e.removeListener("error",o),r([].slice.call(arguments))}g(e,t,a,{once:!0}),"error"!==t&&function(e,t,r){"function"==typeof e.on&&g(e,"error",t,r)}(e,o,{once:!0})}))},a.EventEmitter=a,a.prototype._events=void 0,a.prototype._eventsCount=0,a.prototype._maxListeners=void 0;var i=10;function s(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function c(e){return void 0===e._maxListeners?a.defaultMaxListeners:e._maxListeners}function l(e,t,r,n){var o,a,i,l;if(s(r),void 0===(a=e._events)?(a=e._events=Object.create(null),e._eventsCount=0):(void 0!==a.newListener&&(e.emit("newListener",t,r.listener?r.listener:r),a=e._events),i=a[t]),void 0===i)i=a[t]=r,++e._eventsCount;else if("function"==typeof i?i=a[t]=n?[r,i]:[i,r]:n?i.unshift(r):i.push(r),(o=c(e))>0&&i.length>o&&!i.warned){i.warned=!0;var d=new Error("Possible EventEmitter memory leak detected. "+i.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");d.name="MaxListenersExceededWarning",d.emitter=e,d.type=t,d.count=i.length,l=d,console&&console.warn&&console.warn(l)}return e}function d(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function u(e,t,r){var n={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},o=d.bind(n);return o.listener=r,n.wrapFn=o,o}function p(e,t,r){var n=e._events;if(void 0===n)return[];var o=n[t];return void 0===o?[]:"function"==typeof o?r?[o.listener||o]:[o]:r?function(e){for(var t=new Array(e.length),r=0;r<t.length;++r)t[r]=e[r].listener||e[r];return t}(o):h(o,o.length)}function f(e){var t=this._events;if(void 0!==t){var r=t[e];if("function"==typeof r)return 1;if(void 0!==r)return r.length}return 0}function h(e,t){for(var r=new Array(t),n=0;n<t;++n)r[n]=e[n];return r}function g(e,t,r,n){if("function"==typeof e.on)n.once?e.once(t,r):e.on(t,r);else{if("function"!=typeof e.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof e);e.addEventListener(t,(function o(a){n.once&&e.removeEventListener(t,o),r(a)}))}}Object.defineProperty(a,"defaultMaxListeners",{enumerable:!0,get:function(){return i},set:function(e){if("number"!=typeof e||e<0||o(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");i=e}}),a.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},a.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||o(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this},a.prototype.getMaxListeners=function(){return c(this)},a.prototype.emit=function(e){for(var t=[],r=1;r<arguments.length;r++)t.push(arguments[r]);var o="error"===e,a=this._events;if(void 0!==a)o=o&&void 0===a.error;else if(!o)return!1;if(o){var i;if(t.length>0&&(i=t[0]),i instanceof Error)throw i;var s=new Error("Unhandled error."+(i?" ("+i.message+")":""));throw s.context=i,s}var c=a[e];if(void 0===c)return!1;if("function"==typeof c)n(c,this,t);else{var l=c.length,d=h(c,l);for(r=0;r<l;++r)n(d[r],this,t)}return!0},a.prototype.addListener=function(e,t){return l(this,e,t,!1)},a.prototype.on=a.prototype.addListener,a.prototype.prependListener=function(e,t){return l(this,e,t,!0)},a.prototype.once=function(e,t){return s(t),this.on(e,u(this,e,t)),this},a.prototype.prependOnceListener=function(e,t){return s(t),this.prependListener(e,u(this,e,t)),this},a.prototype.removeListener=function(e,t){var r,n,o,a,i;if(s(t),void 0===(n=this._events))return this;if(void 0===(r=n[e]))return this;if(r===t||r.listener===t)0==--this._eventsCount?this._events=Object.create(null):(delete n[e],n.removeListener&&this.emit("removeListener",e,r.listener||t));else if("function"!=typeof r){for(o=-1,a=r.length-1;a>=0;a--)if(r[a]===t||r[a].listener===t){i=r[a].listener,o=a;break}if(o<0)return this;0===o?r.shift():function(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}(r,o),1===r.length&&(n[e]=r[0]),void 0!==n.removeListener&&this.emit("removeListener",e,i||t)}return this},a.prototype.off=a.prototype.removeListener,a.prototype.removeAllListeners=function(e){var t,r,n;if(void 0===(r=this._events))return this;if(void 0===r.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==r[e]&&(0==--this._eventsCount?this._events=Object.create(null):delete r[e]),this;if(0===arguments.length){var o,a=Object.keys(r);for(n=0;n<a.length;++n)"removeListener"!==(o=a[n])&&this.removeAllListeners(o);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(t=r[e]))this.removeListener(e,t);else if(void 0!==t)for(n=t.length-1;n>=0;n--)this.removeListener(e,t[n]);return this},a.prototype.listeners=function(e){return p(this,e,!0)},a.prototype.rawListeners=function(e){return p(this,e,!1)},a.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):f.call(e,t)},a.prototype.listenerCount=f,a.prototype.eventNames=function(){return this._eventsCount>0?t(this._events):[]}},650:(e,t,r)=>{var n=r(942).Symbol;e.exports=n},379:(e,t,r)=>{var n=r(650),o=r(870),a=r(5),i=n?n.toStringTag:void 0;e.exports=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":i&&i in Object(e)?o(e):a(e)}},967:(e,t,r)=>{var n="object"==typeof r.g&&r.g&&r.g.Object===Object&&r.g;e.exports=n},870:(e,t,r)=>{var n=r(650),o=Object.prototype,a=o.hasOwnProperty,i=o.toString,s=n?n.toStringTag:void 0;e.exports=function(e){var t=a.call(e,s),r=e[s];try{e[s]=void 0;var n=!0}catch(e){}var o=i.call(e);return n&&(t?e[s]=r:delete e[s]),o}},5:e=>{var t=Object.prototype.toString;e.exports=function(e){return t.call(e)}},942:(e,t,r)=>{var n=r(967),o="object"==typeof self&&self&&self.Object===Object&&self,a=n||o||Function("return this")();e.exports=a},655:(e,t,r)=>{var n=r(379),o=r(580);e.exports=function(e){if(!o(e))return!1;var t=n(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t}},580:e=>{e.exports=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}},591:(e,t,r)=>{"use strict";var n,o=function(){return void 0===n&&(n=Boolean(window&&document&&document.all&&!window.atob)),n},a=function(){var e={};return function(t){if(void 0===e[t]){var r=document.querySelector(t);if(window.HTMLIFrameElement&&r instanceof window.HTMLIFrameElement)try{r=r.contentDocument.head}catch(e){r=null}e[t]=r}return e[t]}}(),i=[];function s(e){for(var t=-1,r=0;r<i.length;r++)if(i[r].identifier===e){t=r;break}return t}function c(e,t){for(var r={},n=[],o=0;o<e.length;o++){var a=e[o],c=t.base?a[0]+t.base:a[0],l=r[c]||0,d="".concat(c," ").concat(l);r[c]=l+1;var u=s(d),p={css:a[1],media:a[2],sourceMap:a[3]};-1!==u?(i[u].references++,i[u].updater(p)):i.push({identifier:d,updater:y(p,t),references:1}),n.push(d)}return n}function l(e){var t=document.createElement("style"),n=e.attributes||{};if(void 0===n.nonce){var o=r.nc;o&&(n.nonce=o)}if(Object.keys(n).forEach((function(e){t.setAttribute(e,n[e])})),"function"==typeof e.insert)e.insert(t);else{var i=a(e.insert||"head");if(!i)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");i.appendChild(t)}return t}var d,u=(d=[],function(e,t){return d[e]=t,d.filter(Boolean).join("\n")});function p(e,t,r,n){var o=r?"":n.media?"@media ".concat(n.media," {").concat(n.css,"}"):n.css;if(e.styleSheet)e.styleSheet.cssText=u(t,o);else{var a=document.createTextNode(o),i=e.childNodes;i[t]&&e.removeChild(i[t]),i.length?e.insertBefore(a,i[t]):e.appendChild(a)}}function f(e,t,r){var n=r.css,o=r.media,a=r.sourceMap;if(o?e.setAttribute("media",o):e.removeAttribute("media"),a&&"undefined"!=typeof btoa&&(n+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(a))))," */")),e.styleSheet)e.styleSheet.cssText=n;else{for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(document.createTextNode(n))}}var h=null,g=0;function y(e,t){var r,n,o;if(t.singleton){var a=g++;r=h||(h=l(t)),n=p.bind(null,r,a,!1),o=p.bind(null,r,a,!0)}else r=l(t),n=f.bind(null,r,t),o=function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(r)};return n(e),function(t){if(t){if(t.css===e.css&&t.media===e.media&&t.sourceMap===e.sourceMap)return;n(e=t)}else o()}}e.exports=function(e,t){(t=t||{}).singleton||"boolean"==typeof t.singleton||(t.singleton=o());var r=c(e=e||[],t);return function(e){if(e=e||[],"[object Array]"===Object.prototype.toString.call(e)){for(var n=0;n<r.length;n++){var o=s(r[n]);i[o].references--}for(var a=c(e,t),l=0;l<r.length;l++){var d=s(r[l]);0===i[d].references&&(i[d].updater(),i.splice(d,1))}r=a}}}},494:t=>{"use strict";t.exports=e},155:e=>{"use strict";e.exports=n},514:e=>{"use strict";e.exports=o},236:e=>{"use strict";e.exports=r},272:e=>{"use strict";e.exports=t}},i={};function s(e){var t=i[e];if(void 0!==t)return t.exports;var r=i[e]={id:e,exports:{}};return a[e](r,r.exports,s),r.exports}s.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return s.d(t,{a:t}),t},s.d=(e,t)=>{for(var r in t)s.o(t,r)&&!s.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},s.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),s.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),s.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},s.nc=void 0;var c={};return(()=>{"use strict";s.r(c),s.d(c,{AppearanceManager:()=>e.AppearanceManager,CloseButtonPosition:()=>e.CloseButtonPosition,GoodsWidgetRenderingType:()=>e.GoodsWidgetRenderingType,IamCheckDisplayTimeRangeError:()=>e.IamCheckDisplayTimeRangeError,IamFrequencyLimitError:()=>e.IamFrequencyLimitError,IamMessageLimitExceededError:()=>e.IamMessageLimitExceededError,IamMessageOpenError:()=>e.IamMessageOpenError,IamNotFoundByEventError:()=>e.IamNotFoundByEventError,IamNotFoundByIdError:()=>e.IamNotFoundByIdError,IamNotFoundLimitError:()=>e.IamNotFoundLimitError,IamOtherReaderIsOpenError:()=>e.IamOtherReaderIsOpenError,IamShowOnlyIfLoadedError:()=>e.IamShowOnlyIfLoadedError,IasNetworkError:()=>e.IasNetworkError,InAppStoryManager:()=>D,StoriesListCardCoverQuality:()=>e.StoriesListCardCoverQuality,StoriesListCardTitlePosition:()=>e.StoriesListCardTitlePosition,StoriesListCardTitleTextAlign:()=>e.StoriesListCardTitleTextAlign,StoriesListCardViewVariant:()=>e.StoriesListCardViewVariant,StoriesListDirection:()=>e.StoriesListDirection,StoryReaderSwipeStyle:()=>e.StoryReaderSwipeStyle});var e=s(494);class t extends Error{constructor(e){super(`Appearance Manager must be an object, but passed ${e.toUpperCase()}. Please check your code.`),this.name="IasAppearanceManagerTypeofError"}}const r=e=>{if(null==e||"object"!=typeof e)throw new t(null==e?"null":typeof e)};class n extends Error{constructor(){super("[IAS]: The <StoryManager> instance has been destroyed, you must create a new instance"),this.name="IasInAppStoryManagerReferenceError"}}class o extends Error{constructor(e){super(`[IAS]: Mount point ${e} is not present in DOM at initialization time`),this.name="IasMountPointReferenceError"}}var a=s(46);class i extends a.EventEmitter{constructor(e,t){super(),Object.defineProperty(this,"_mountSelector",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"app",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"_mountPoint",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this._mountPoint=this.getMountPoint(e),this.app.addItem(this).catch(console.error)}get mountPoint(){return this._mountPoint}get mountSelector(){return this._mountSelector}destroy(){this.app.removeItem(this)}getMountPoint(e){const t=document.querySelector(e);if(!t)throw new o(e);return t}}class l extends i{constructor(e,t,n,o){super(e,n),Object.defineProperty(this,"_appearanceManager",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"params",{enumerable:!0,configurable:!0,writable:!0,value:o}),Object.defineProperty(this,"_ugcCardClickHandler",{enumerable:!0,configurable:!0,writable:!0,value:()=>{}}),Object.defineProperty(this,"_api",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),r(t)}get appearanceManager(){return this._appearanceManager}get type(){return e.StoryFeedType.DEFAULT}get identityFields(){return{feedSlug:this.feedSlug}}get feedSlug(){var e;return null===(e=this.params)||void 0===e?void 0:e.feed}get testKey(){var e;return null===(e=this.params)||void 0===e?void 0:e.testKey}get useUgcCard(){var e;return Boolean(null===(e=this.params)||void 0===e?void 0:e.useUgcCard)}set ugcCardClickHandler(e){this._ugcCardClickHandler=e}get ugcCardClickHandler(){return this._ugcCardClickHandler}set api(e){this._api=e}async reload(){var e;return null===(e=this._api)||void 0===e?void 0:e.reload()}}class d extends l{constructor(t,n,o,a){super(t,n,o,{feed:e.UGCFeedSlug,testKey:null==a?void 0:a.testKey,useUgcCard:null==a?void 0:a.useUgcCard}),Object.defineProperty(this,"ugcParams",{enumerable:!0,configurable:!0,writable:!0,value:a}),r(n)}get type(){return e.StoryFeedType.UGC}get filter(){var e;return null===(e=this.ugcParams)||void 0===e?void 0:e.filter}}var u=s(272),p=s(236),f=s(155),h=s(591),g=s.n(h),y=s(432),v={insert:"head",singleton:!1};g()(y.A,v);const m=y.A.locals||{};var b;!function(e){e.LTR="ltr",e.RTL="rtl"}(b||(b={}));const S=({open:t,options:r,storyListOptions:n,onClose:o})=>{var a,i;(0,f.useLayoutEffect)((()=>{if(!t)return;const e=document.documentElement.style.overflow;return document.documentElement.style.overflow="hidden",()=>{document.documentElement.style.overflow=e}}),[t]);return t?(0,u.jsx)("div",{className:m["favorite-story-list-modal"],style:(()=>{var e,t,n,o;return{"--storiesFavoriteTitleColor":r.title.color,"--storiesFavoriteTitleFontFamily":"InternalPrimaryFont","--storiesFavoriteTitleFont":r.title.font,"--storiesFavoriteTitleBackgroundColor":r.title.backgroundColor,"--storiesFavoriteHeaderTopOffset":parseFloat(null!==(t=null===(e=r.headerTopOffset)||void 0===e?void 0:e.toString())&&void 0!==t?t:"0")+"px","--storiesFavoriteBottomOffset":parseFloat(null!==(o=null===(n=r.bottomOffset)||void 0===n?void 0:n.toString())&&void 0!==o?o:"0")+"px","--storiesFavoriteBackgroundColor":r.backgroundColor}})(),children:(0,u.jsxs)("div",{className:m.container,children:[(0,u.jsxs)("div",{className:m.header,children:[(0,u.jsx)("p",{className:m.title,children:r.title.content}),(0,u.jsx)("button",{onClick:e=>{e.preventDefault(),e.stopPropagation(),o()},className:m["header__close-btn"],style:(()=>{var t;const n="start"===r.closeButtonPosition||"left"===r.closeButtonPosition,o=(null===(t=e.storyManager.getConfig())||void 0===t?void 0:t.dir)===b.LTR;return{[n&&o||!n&&!o?"left":"right"]:"10px"}})(),dangerouslySetInnerHTML:{__html:null!==(i=null===(a=r.closeButton)||void 0===a?void 0:a.svgSrc.baseState)&&void 0!==i?i:""}})]}),(0,u.jsx)("div",{className:m.content,children:(0,u.jsx)("div",{className:m["favorite-story-list"],children:(0,u.jsx)(e.FavoriteStoryList,{options:Object.assign(Object.assign(Object.assign({},n),{sidePadding:0}),{direction:e.StoriesListDirection.COLUMN,layout:{height:"auto"}})})})}),(0,u.jsx)("div",{className:m.footer}),(0,u.jsx)("div",{className:m["bottom-offset"]})]})}):null};var M=s(514);const w=e=>{(0,f.useEffect)((()=>{const t=e.mountPoint,r=()=>{console.warn(`[IAS]: The node has been removed from DOM. Unsafe destruction of story feed ${e.mountSelector}`),e.destroy()};if(!document.body.contains(t))return void r();const n=new MutationObserver((()=>{document.body.contains(t)||(r(),n.disconnect())}));return n.observe(document.body,{childList:!0,subtree:!0}),()=>{n.disconnect()}}),[e])};var x;!function(e){e.START_LOADER="startLoad",e.END_LOADER="endLoad"}(x||(x={}));const C=({storyList:t,onStoryCardClick:r,onFavoriteCardClick:n})=>{const[o,a]=(0,f.useState)(t.appearanceManager.storiesListOptions),i=(0,f.useRef)(null);return w(t),(0,f.useEffect)((()=>{t.api=i.current}),[]),(0,f.useEffect)((()=>(t.appearanceManager.on(e.AppearanceManagerEvents.EVENT_UPDATED_STORIES_LIST_OPTIONS,a),()=>{t.appearanceManager.off(e.AppearanceManagerEvents.EVENT_UPDATED_STORIES_LIST_OPTIONS,a)})),[t.appearanceManager]),(0,M.createPortal)((0,u.jsx)(e.StoryList,{ref:i,options:o,hasFavorite:t.appearanceManager.commonOptions.hasFavorite,testKey:t.testKey,useUgcCard:t.useUgcCard,feedSlug:t.feedSlug,onLoadStart:()=>{t.emit(x.START_LOADER)},onLoadEnd:e=>{t.emit(x.END_LOADER,e)},onUgcCardClick:()=>{t.ugcCardClickHandler()},onFavoriteCardClick:n,onStoryCardClick:r}),t.mountPoint)};var L;!function(e){e.START_LOADER="startLoad",e.END_LOADER="endLoad"}(L||(L={}));const E=({ugcStoryList:t,onStoryCardClick:r})=>{const[n,o]=(0,f.useState)(t.appearanceManager.storiesListOptions),a=(0,f.useRef)(null);return w(t),(0,f.useEffect)((()=>{t.api=a.current}),[]),(0,f.useEffect)((()=>(t.appearanceManager.on(e.AppearanceManagerEvents.EVENT_UPDATED_STORIES_LIST_OPTIONS,o),()=>{t.appearanceManager.off(e.AppearanceManagerEvents.EVENT_UPDATED_STORIES_LIST_OPTIONS,o)})),[t.appearanceManager]),(0,M.createPortal)((0,u.jsx)(e.UGCStoryList,{ref:a,options:n,filter:t.filter,testKey:t.testKey,useUgcCard:t.useUgcCard,onStoryCardClick:r,onLoadStart:()=>{t.emit(L.START_LOADER)},onLoadEnd:e=>{t.emit(L.END_LOADER,e)},onUgcCardClick:()=>{t.ugcCardClickHandler()}}),t.mountPoint)},O=t=>{const[r,n]=(0,f.useState)(!1);return(0,u.jsxs)(e.IASContainer,{config:t.storyManagerConfigDto,storyReaderOptions:t.appearanceManager.storyReaderOptions,commonOptions:t.appearanceManager.commonOptions,gameReaderOptions:t.appearanceManager.gameReaderOptions,goodsWidgetOptions:t.appearanceManager.goodsWidgetOptions,children:[t.items.map((e=>e instanceof d?(0,u.jsx)(E,{ugcStoryList:e,onStoryCardClick:()=>{t.onAppearanceManagerChange(e.appearanceManager)}},e.mountSelector):e instanceof l?(0,u.jsx)(C,{onFavoriteCardClick:()=>{n(!0)},onStoryCardClick:()=>{t.onAppearanceManagerChange(e.appearanceManager)},storyList:e},e.mountSelector):void 0)),(0,u.jsx)(S,{open:r,onClose:()=>n(!1),options:t.appearanceManager.storyFavoriteReaderOptions,storyListOptions:t.appearanceManager.storiesListOptions})]})};class j{constructor(){Object.defineProperty(this,"_items",{enumerable:!0,configurable:!0,writable:!0,value:[]})}get items(){return this._items}addItem(e){this._items.push(e)}removeItem(e){const t=this._items.findIndex((t=>t===e));-1!==t&&this._items.splice(t,1)}destroy(){this._items=[]}}class A{constructor(t){Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"root",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"storyManagerConfigDto",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"appearanceManager",{enumerable:!0,configurable:!0,writable:!0,value:new e.AppearanceManager}),Object.defineProperty(this,"rootElement",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"appItemManager",{enumerable:!0,configurable:!0,writable:!0,value:new j}),this.createAppRoot(),this.handleAppearanceManagerUpdate=this.handleAppearanceManagerUpdate.bind(this),this.setAppearanceManager=this.setAppearanceManager.bind(this)}async addItem(e){try{this.appItemManager.addItem(e),await this.storyManager.waitStoryManagerConfig(),this.render()}catch(t){throw this.removeItem(e),t}}async removeItem(e){this.appItemManager.removeItem(e),this.render()}setStoryManagerConfig(e){this.storyManagerConfigDto=Object.assign(Object.assign({},this.storyManagerConfigDto),e),this.render()}setAppearanceManager(e){r(e),this.unscubscribeToAppearanceManagerEvents(),this.appearanceManager=e,this.subscribeToAppearanceManagerEvents(),this.render()}render(){var e;null===(e=this.root)||void 0===e||e.render((0,u.jsx)(O,{storyManagerConfigDto:this.storyManagerConfigDto,appearanceManager:this.appearanceManager,items:this.appItemManager.items.slice(),onAppearanceManagerChange:this.setAppearanceManager}))}destroy(){this.rootElement&&this.root&&(this.appItemManager.destroy(),this.unscubscribeToAppearanceManagerEvents(),this.root.unmount(),document.body.removeChild(this.rootElement),this.rootElement=null,this.root=null)}createAppRoot(){this.rootElement=document.createElement("div"),this.rootElement.id="ias-app",document.body.append(this.rootElement),this.root=(0,p.createRoot)(this.rootElement)}subscribeToAppearanceManagerEvents(){this.appearanceManager.on(e.AppearanceManagerEvents.UPDATE,this.handleAppearanceManagerUpdate)}unscubscribeToAppearanceManagerEvents(){this.appearanceManager.off(e.AppearanceManagerEvents.UPDATE,this.handleAppearanceManagerUpdate)}handleAppearanceManagerUpdate(){this.render()}}var _,I=s(655),T=s.n(I);!function(e){e.START_LOADING="startLoading",e.END_LOADING="endLoading",e.CLOSE_STORY_READER="closeStoryReader"}(_||(_={}));class P extends a.EventEmitter{constructor(e,t,n,o,a){super(),Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(this,"app",{enumerable:!0,configurable:!0,writable:!0,value:o}),Object.defineProperty(this,"options",{enumerable:!0,configurable:!0,writable:!0,value:a}),r(t),this.handleCloseStoryReader=this.handleCloseStoryReader.bind(this),this.showSharePage(e,t)}async showSharePage(e,t){try{this.app.setAppearanceManager(t),this.handleStartLoad(),await this.storyManager.showSharePage(e),this.storyManager.once("closeStoryReader",this.handleCloseStoryReader),this.handleEndLoad(!0)}catch(e){this.handleEndLoad(!1)}}async closeStoryReader(){this.storyManager.closeStoryReader()}handleStartLoad(){setTimeout((()=>{var e;this.emit(_.START_LOADING),T()(null===(e=this.options)||void 0===e?void 0:e.handleStartLoad)&&this.options.handleStartLoad()}))}handleEndLoad(e){var t;this.emit(_.END_LOADING,{result:e}),T()(null===(t=this.options)||void 0===t?void 0:t.handleStopLoad)&&this.options.handleStopLoad(e)}handleCloseStoryReader(){var e,t,r;if(T()(null===(e=this.options)||void 0===e?void 0:e.handleStoryReaderClose)||this.listenerCount(_.CLOSE_STORY_READER)>0)try{T()(null===(t=this.options)||void 0===t?void 0:t.handleStoryReaderClose)&&(null===(r=this.options)||void 0===r||r.handleStoryReaderClose()),this.emit(_.CLOSE_STORY_READER)}catch(e){console.error(e)}else{const e=window.location;window.open(`${e.protocol}//${e.host}`,"_parent")}}}class k extends a.EventEmitter{constructor(t,n,o,a){super(),Object.defineProperty(this,"appearanceManager",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(this,"app",{enumerable:!0,configurable:!0,writable:!0,value:o}),Object.defineProperty(this,"options",{enumerable:!0,configurable:!0,writable:!0,value:a}),Object.defineProperty(this,"stackedStoryListViewModel",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),r(t),this.handleUpdate=this.handleUpdate.bind(this),this.stackedStoryListViewModel=new e.StackedStoryListViewModel(this.options),this.stackedStoryListViewModel.on("update",this.handleUpdate),this.loadStories().catch(console.error)}get stories(){return this.stackedStoryListViewModel.stories}get length(){return this.stackedStoryListViewModel.length}get activeIndex(){return this.stackedStoryListViewModel.activeIndex}get feedCoverSrc(){return this.stackedStoryListViewModel.feedCoverSrc}get top(){return this.stackedStoryListViewModel.top}async reload(){return this.stackedStoryListViewModel.reload()}destroy(){this.stackedStoryListViewModel.destroy(),this.stackedStoryListViewModel.removeAllListeners()}showStory(e){this.app.setAppearanceManager(this.appearanceManager),this.stackedStoryListViewModel.showStory(e)}on(e,t){return"update"===e?super.on(e,t):(this.stackedStoryListViewModel.on(e,t),this)}once(e,t){return this.stackedStoryListViewModel.once(e,t),this}off(e,t){return this.stackedStoryListViewModel.off(e,t),this}handleUpdate(e){this.emit("update",{id:e.id,title:e.title,titleColor:e.titleColor,hasAudio:e.hasAudio,hasSwipeUp:e.hasSwipeUp,isOpened:e.isOpened,deeplink:e.deeplink,gameInstanceId:e.gameInstanceId,hideInReader:e.hideInReader,hide_timeline:e.hideTimeline,cover:e.getCover(this.appearanceManager.storiesListOptions.card.coverQuality)})}async loadStories(){await this.storyManager.waitStoryManagerConfig(),this.stackedStoryListViewModel.loadStories()}}const R=()=>{if(!D.instance)throw new n};class D{constructor(t){return Object.defineProperty(this,"storyManagerConfigDto",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"__IAS_INTERNAL_API__",{enumerable:!0,configurable:!0,writable:!0,value:e.__IAS_INTERNAL_API__}),Object.defineProperty(this,"app",{enumerable:!0,configurable:!0,writable:!0,value:new A(e.storyManager)}),Object.defineProperty(this,"StoriesList",{enumerable:!0,configurable:!0,writable:!0,value:class extends l{constructor(e,t,r){R(),super(e,t,D.instance.app,r)}}}),Object.defineProperty(this,"UGCStoriesList",{enumerable:!0,configurable:!0,writable:!0,value:class extends d{constructor(e,t,r){R(),super(e,t,D.instance.app,r)}}}),Object.defineProperty(this,"SharePage",{enumerable:!0,configurable:!0,writable:!0,value:class extends P{constructor(t,r,n){R(),super(t,r,e.storyManager,D.instance.app,n)}}}),Object.defineProperty(this,"StackedStoryList",{enumerable:!0,configurable:!0,writable:!0,value:class extends k{constructor(t,r){R(),super(t,e.storyManager,D.instance.app,r)}}}),Object.defineProperty(this,"inAppMessaging",{enumerable:!0,configurable:!0,writable:!0,value:e.storyManager.inAppMessaging}),D.instance?(console.warn("StoryManager singleton is created multiple times\nuse IAS.StoryManager.getInstance() instead"),D.instance):(e.storyManager.setUserAgent(`InAppStoryJSSDK/${this.sdkVersionCode}`),D.instance=this,this.app.setStoryManagerConfig(t),D.instance)}get sdkVersionName(){return"3.7.0-rc.6"}get sdkVersionCode(){return parseInt(30700)}set storyLinkClickHandler(t){e.storyManager.storyLinkClickHandler=t}static getInstance(){return D.instance?D.instance:null}static use(t,r){t.install({INTERNAL_API:e.__IAS_INTERNAL_API__,HOST:D},r)}getConfig(){return e.storyManager.getConfig()}async showOnboardingStories(t,r){return R(),this.app.setAppearanceManager(t),e.storyManager.showOnboardingStories(r)}async showStory(t,r){R(),this.app.setAppearanceManager(r),await e.storyManager.showStory(t)}async showStoryOnce(t,r){return R(),this.app.setAppearanceManager(r),e.storyManager.showStoryOnce(t)}async showSharePage(t,r){return R(),this.app.setAppearanceManager(r),e.storyManager.showSharePage(t)}closeAllReaders(){e.storyManager.closeAllReaders()}async openGame(t,r,n={}){return R(),this.app.setAppearanceManager(r),e.storyManager.openGame(t,n)}async closeGame(){return e.storyManager.closeGame()}async closeStoryReader(){return e.storyManager.closeStoryReader()}getUgcEditorConfig(){return e.storyManager.getUgcEditorConfig()}closeGoodsWidget(){e.storyManager.closeGoodsWidget()}setLang(e){this.storyManagerConfigDto.lang=e,this.app.setStoryManagerConfig(this.storyManagerConfigDto)}getNonce(){return e.storyManager.getNonce()}async setUserId(e,t){R(),this.storyManagerConfigDto.userId=e,this.storyManagerConfigDto.userIdSign=t,this.app.setStoryManagerConfig(this.storyManagerConfigDto)}async userLogoug(){return this.setUserId("")}setTags(e){R(),this.storyManagerConfigDto.tags=e,this.app.setStoryManagerConfig(this.storyManagerConfigDto)}setPlaceholders(e){R(),this.storyManagerConfigDto.placeholders=e,this.app.setStoryManagerConfig(this.storyManagerConfigDto)}setImagePlaceholders(e){R(),this.storyManagerConfigDto.imagePlaceholders=e,this.app.setStoryManagerConfig(this.storyManagerConfigDto)}on(t,r){return e.storyManager.on(t,r),this}once(t,r){return e.storyManager.once(t,r),this}off(t,r){return e.storyManager.off(t,r),this}destroy(){null!=D.instance&&(D.instance=null,this.closeAllReaders(),this.app.destroy())}}})(),c})()));
|
|
@@ -176,12 +176,10 @@ export declare class InAppStoryManager {
|
|
|
176
176
|
* Opens a game by its instance ID.
|
|
177
177
|
* @param gameInstanceId Game instance identifier
|
|
178
178
|
* @param appearanceManager Appearance manager instance
|
|
179
|
-
* @param gameOptions Optional game parameters
|
|
180
179
|
*/
|
|
181
180
|
openGame(
|
|
182
181
|
gameInstanceId: string | number,
|
|
183
|
-
appearanceManager: AppearanceManager
|
|
184
|
-
gameOptions?: { demoMode?: boolean }
|
|
182
|
+
appearanceManager: AppearanceManager
|
|
185
183
|
): Promise<void>;
|
|
186
184
|
|
|
187
185
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inappstory/js-sdk",
|
|
3
|
-
"version": "3.7.0-rc.
|
|
3
|
+
"version": "3.7.0-rc.6",
|
|
4
4
|
"description": "JS SDK",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"stories",
|
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
"Samsung >= 5"
|
|
59
59
|
],
|
|
60
60
|
"dependencies": {
|
|
61
|
-
"@inappstory/react-sdk": "^1.8.0-rc.
|
|
61
|
+
"@inappstory/react-sdk": "^1.8.0-rc.6",
|
|
62
62
|
"react": "^18.2.0",
|
|
63
63
|
"react-dom": "^18.2.0"
|
|
64
64
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import*as e from"react/jsx-runtime";import*as t from"react";import*as r from"mobx-react-lite";import*as n from"classnames";import*as i from"mobx";import*as a from"uuid";import*as s from"react-dom/client";import*as o from"@inappstory/slide-api";var l={371:(e,t,r)=>{r.d(t,{A:()=>a});var n=r(935),i=r.n(n)()((function(e){return e[1]}));i.push([e.id,".banner--EtvvP{width:100%;height:100%;position:relative;border-radius:var(--banner-border-radius, 0px);overflow:hidden}.banner-slides--3xhGF{position:relative;width:100%;height:100%;display:block}",""]),i.locals={banner:"banner--EtvvP","banner-slides":"banner-slides--3xhGF"};const a=i},369:(e,t,r)=>{r.d(t,{A:()=>a});var n=r(935),i=r.n(n)()((function(e){return e[1]}));i.push([e.id,".banner-place--6ZUZe{width:100%;height:100%;position:relative}.banner-slider__slider_visible--1nA2b{border:solid 1px green}",""]),i.locals={"banner-place":"banner-place--6ZUZe","banner-slider__slider_visible":"banner-slider__slider_visible--1nA2b"};const a=i},41:(e,t,r)=>{r.d(t,{A:()=>a});var n=r(935),i=r.n(n)()((function(e){return e[1]}));i.push([e.id,".slider--ggy2P{width:100%;height:100%;overflow:hidden;position:relative;justify-content:center}.slider__track--JSOcI{display:flex;transition:transform .3s ease;width:100%;height:100%;will-change:transform}.slider__slide--oGmUT{width:100%;height:100%;flex-shrink:0;position:relative;display:flex;align-items:center;justify-content:center;transform:translateZ(0)}",""]),i.locals={slider:"slider--ggy2P",slider__track:"slider__track--JSOcI",slider__slide:"slider__slide--oGmUT"};const a=i},379:(e,t,r)=>{r.d(t,{A:()=>a});var n=r(935),i=r.n(n)()((function(e){return e[1]}));i.push([e.id,".slider__controls-btn--HubN5{position:absolute;top:50%;z-index:1;width:24px;height:24px;margin-top:-9px;transition:all .2s ease-in-out;cursor:pointer;padding:0;background-color:rgba(0,0,0,0);color:#0c62f3;border:0;outline:0}.slider__controls-btn--prev--kfXCq{left:1.5rem}.slider__controls-btn--next--Jzq3Q{right:1.5rem}.slider__controls-btn--HubN5{transition:opacity .3s ease-in-out}.slider__controls-btn--disabled--m1P4q{opacity:0;pointer-events:none}",""]),i.locals={"slider__controls-btn":"slider__controls-btn--HubN5","slider__controls-btn--prev":"slider__controls-btn--prev--kfXCq","slider__controls-btn--next":"slider__controls-btn--next--Jzq3Q","slider__controls-btn--disabled":"slider__controls-btn--disabled--m1P4q"};const a=i},55:(e,t,r)=>{r.d(t,{A:()=>a});var n=r(935),i=r.n(n)()((function(e){return e[1]}));i.push([e.id,".slider-bullets--XDc5n{position:absolute;z-index:2;bottom:1.5rem;left:50%;display:inline-flex;list-style:none;transform:translate3d(-50%, 0, 0)}.slider-bullets__bullet--83aBh{background-color:var(--ias-banners-pagination-inactive-color, hsla(0, 0%, 100%, 0.5));width:var(--ias-banners-pagination-width, 8px);height:var(--ias-banners-pagination-height, 8px);padding:0;border-radius:50%;border:2px solid rgba(0,0,0,0);cursor:pointer;line-height:0;box-shadow:0 .25em .5em 0 rgba(0,0,0,.1);margin:0 .25em;transition:transform 100ms ease-in;transform:scale(0.8)}.slider-bullets__bullet--active--RDBez{background-color:#0c62f3;transform:scale(1)}",""]),i.locals={"slider-bullets":"slider-bullets--XDc5n","slider-bullets__bullet":"slider-bullets__bullet--83aBh","slider-bullets__bullet--active":"slider-bullets__bullet--active--RDBez"};const a=i},126:(e,t,r)=>{r.d(t,{A:()=>a});var n=r(935),i=r.n(n)()((function(e){return e[1]}));i.push([e.id,".loader--4uMcs{position:absolute;z-index:10001;top:0;bottom:0;left:0;right:0;display:flex;justify-content:center;align-items:center;background:var(--loader-background, black)}.loader--4uMcs .loader__refresh-btn--5nwxY{color:#fff;cursor:pointer;position:absolute;left:50%;top:50%;transform:translate3d(-50%, -50%, 0);pointer-events:auto;padding:20px;width:32px;height:32px;box-sizing:content-box}.loader--4uMcs .loader__spinner--NRm8E{-ms-flex-negative:0;flex-shrink:0;display:inline-block;width:32px;height:32px;border-radius:50%;border:solid 2px var(--loaderBackgroundColor, white);border-color:var(--loaderBackgroundAccentColor, transparent) var(--loaderBackgroundColor, white) var(--loaderBackgroundColor, white) var(--loaderBackgroundColor, white);-webkit-animation:loading-spinner--LnXd0 .6s infinite linear;animation:loading-spinner--LnXd0 .6s infinite linear}@keyframes loading-spinner--LnXd0{from{-webkit-transform:rotate(0deg);transform:rotate(0deg)}to{-webkit-transform:rotate(359deg);transform:rotate(359deg)}}",""]),i.locals={loader:"loader--4uMcs","loader__refresh-btn":"loader__refresh-btn--5nwxY",loader__spinner:"loader__spinner--NRm8E","loading-spinner":"loading-spinner--LnXd0"};const a=i},81:(e,t,r)=>{r.d(t,{A:()=>a});var n=r(935),i=r.n(n)()((function(e){return e[1]}));i.push([e.id,".icon--5RBkn{width:2rem;height:2rem}",""]),i.locals={icon:"icon--5RBkn"};const a=i},935:e=>{e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var r=e(t);return t[2]?"@media ".concat(t[2]," {").concat(r,"}"):r})).join("")},t.i=function(e,r,n){"string"==typeof e&&(e=[[null,e,""]]);var i={};if(n)for(var a=0;a<this.length;a++){var s=this[a][0];null!=s&&(i[s]=!0)}for(var o=0;o<e.length;o++){var l=[].concat(e[o]);n&&i[l[0]]||(r&&(l[2]?l[2]="".concat(r," and ").concat(l[2]):l[2]=r),t.push(l))}},t}},46:e=>{var t,r="object"==typeof Reflect?Reflect:null,n=r&&"function"==typeof r.apply?r.apply:function(e,t,r){return Function.prototype.apply.call(e,t,r)};t=r&&"function"==typeof r.ownKeys?r.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var i=Number.isNaN||function(e){return e!=e};function a(){a.init.call(this)}e.exports=a,e.exports.once=function(e,t){return new Promise((function(r,n){function i(r){e.removeListener(t,a),n(r)}function a(){"function"==typeof e.removeListener&&e.removeListener("error",i),r([].slice.call(arguments))}f(e,t,a,{once:!0}),"error"!==t&&function(e,t,r){"function"==typeof e.on&&f(e,"error",t,{once:!0})}(e,i)}))},a.EventEmitter=a,a.prototype._events=void 0,a.prototype._eventsCount=0,a.prototype._maxListeners=void 0;var s=10;function o(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function l(e){return void 0===e._maxListeners?a.defaultMaxListeners:e._maxListeners}function c(e,t,r,n){var i,a,s,c;if(o(r),void 0===(a=e._events)?(a=e._events=Object.create(null),e._eventsCount=0):(void 0!==a.newListener&&(e.emit("newListener",t,r.listener?r.listener:r),a=e._events),s=a[t]),void 0===s)s=a[t]=r,++e._eventsCount;else if("function"==typeof s?s=a[t]=n?[r,s]:[s,r]:n?s.unshift(r):s.push(r),(i=l(e))>0&&s.length>i&&!s.warned){s.warned=!0;var d=new Error("Possible EventEmitter memory leak detected. "+s.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");d.name="MaxListenersExceededWarning",d.emitter=e,d.type=t,d.count=s.length,c=d,console&&console.warn&&console.warn(c)}return e}function d(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function h(e,t,r){var n={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},i=d.bind(n);return i.listener=r,n.wrapFn=i,i}function u(e,t,r){var n=e._events;if(void 0===n)return[];var i=n[t];return void 0===i?[]:"function"==typeof i?r?[i.listener||i]:[i]:r?function(e){for(var t=new Array(e.length),r=0;r<t.length;++r)t[r]=e[r].listener||e[r];return t}(i):b(i,i.length)}function p(e){var t=this._events;if(void 0!==t){var r=t[e];if("function"==typeof r)return 1;if(void 0!==r)return r.length}return 0}function b(e,t){for(var r=new Array(t),n=0;n<t;++n)r[n]=e[n];return r}function f(e,t,r,n){if("function"==typeof e.on)n.once?e.once(t,r):e.on(t,r);else{if("function"!=typeof e.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof e);e.addEventListener(t,(function i(a){n.once&&e.removeEventListener(t,i),r(a)}))}}Object.defineProperty(a,"defaultMaxListeners",{enumerable:!0,get:function(){return s},set:function(e){if("number"!=typeof e||e<0||i(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");s=e}}),a.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},a.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||i(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this},a.prototype.getMaxListeners=function(){return l(this)},a.prototype.emit=function(e){for(var t=[],r=1;r<arguments.length;r++)t.push(arguments[r]);var i="error"===e,a=this._events;if(void 0!==a)i=i&&void 0===a.error;else if(!i)return!1;if(i){var s;if(t.length>0&&(s=t[0]),s instanceof Error)throw s;var o=new Error("Unhandled error."+(s?" ("+s.message+")":""));throw o.context=s,o}var l=a[e];if(void 0===l)return!1;if("function"==typeof l)n(l,this,t);else{var c=l.length,d=b(l,c);for(r=0;r<c;++r)n(d[r],this,t)}return!0},a.prototype.addListener=function(e,t){return c(this,e,t,!1)},a.prototype.on=a.prototype.addListener,a.prototype.prependListener=function(e,t){return c(this,e,t,!0)},a.prototype.once=function(e,t){return o(t),this.on(e,h(this,e,t)),this},a.prototype.prependOnceListener=function(e,t){return o(t),this.prependListener(e,h(this,e,t)),this},a.prototype.removeListener=function(e,t){var r,n,i,a,s;if(o(t),void 0===(n=this._events))return this;if(void 0===(r=n[e]))return this;if(r===t||r.listener===t)0==--this._eventsCount?this._events=Object.create(null):(delete n[e],n.removeListener&&this.emit("removeListener",e,r.listener||t));else if("function"!=typeof r){for(i=-1,a=r.length-1;a>=0;a--)if(r[a]===t||r[a].listener===t){s=r[a].listener,i=a;break}if(i<0)return this;0===i?r.shift():function(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}(r,i),1===r.length&&(n[e]=r[0]),void 0!==n.removeListener&&this.emit("removeListener",e,s||t)}return this},a.prototype.off=a.prototype.removeListener,a.prototype.removeAllListeners=function(e){var t,r,n;if(void 0===(r=this._events))return this;if(void 0===r.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==r[e]&&(0==--this._eventsCount?this._events=Object.create(null):delete r[e]),this;if(0===arguments.length){var i,a=Object.keys(r);for(n=0;n<a.length;++n)"removeListener"!==(i=a[n])&&this.removeAllListeners(i);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(t=r[e]))this.removeListener(e,t);else if(void 0!==t)for(n=t.length-1;n>=0;n--)this.removeListener(e,t[n]);return this},a.prototype.listeners=function(e){return u(this,e,!0)},a.prototype.rawListeners=function(e){return u(this,e,!1)},a.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):p.call(e,t)},a.prototype.listenerCount=p,a.prototype.eventNames=function(){return this._eventsCount>0?t(this._events):[]}},591:(e,t,r)=>{var n,i=function(){var e={};return function(t){if(void 0===e[t]){var r=document.querySelector(t);if(window.HTMLIFrameElement&&r instanceof window.HTMLIFrameElement)try{r=r.contentDocument.head}catch(e){r=null}e[t]=r}return e[t]}}(),a=[];function s(e){for(var t=-1,r=0;r<a.length;r++)if(a[r].identifier===e){t=r;break}return t}function o(e,t){for(var r={},n=[],i=0;i<e.length;i++){var o=e[i],l=t.base?o[0]+t.base:o[0],c=r[l]||0,d="".concat(l," ").concat(c);r[l]=c+1;var h=s(d),u={css:o[1],media:o[2],sourceMap:o[3]};-1!==h?(a[h].references++,a[h].updater(u)):a.push({identifier:d,updater:f(u,t),references:1}),n.push(d)}return n}function l(e){var t=document.createElement("style"),n=e.attributes||{};if(void 0===n.nonce){var a=r.nc;a&&(n.nonce=a)}if(Object.keys(n).forEach((function(e){t.setAttribute(e,n[e])})),"function"==typeof e.insert)e.insert(t);else{var s=i(e.insert||"head");if(!s)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");s.appendChild(t)}return t}var c,d=(c=[],function(e,t){return c[e]=t,c.filter(Boolean).join("\n")});function h(e,t,r,n){var i=r?"":n.media?"@media ".concat(n.media," {").concat(n.css,"}"):n.css;if(e.styleSheet)e.styleSheet.cssText=d(t,i);else{var a=document.createTextNode(i),s=e.childNodes;s[t]&&e.removeChild(s[t]),s.length?e.insertBefore(a,s[t]):e.appendChild(a)}}function u(e,t,r){var n=r.css,i=r.media,a=r.sourceMap;if(i?e.setAttribute("media",i):e.removeAttribute("media"),a&&"undefined"!=typeof btoa&&(n+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(a))))," */")),e.styleSheet)e.styleSheet.cssText=n;else{for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(document.createTextNode(n))}}var p=null,b=0;function f(e,t){var r,n,i;if(t.singleton){var a=b++;r=p||(p=l(t)),n=h.bind(null,r,a,!1),i=h.bind(null,r,a,!0)}else r=l(t),n=u.bind(null,r,t),i=function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(r)};return n(e),function(t){if(t){if(t.css===e.css&&t.media===e.media&&t.sourceMap===e.sourceMap)return;n(e=t)}else i()}}e.exports=function(e,t){(t=t||{}).singleton||"boolean"==typeof t.singleton||(t.singleton=(void 0===n&&(n=Boolean(window&&document&&document.all&&!window.atob)),n));var r=o(e=e||[],t);return function(e){if(e=e||[],"[object Array]"===Object.prototype.toString.call(e)){for(var n=0;n<r.length;n++){var i=s(r[n]);a[i].references--}for(var l=o(e,t),c=0;c<r.length;c++){var d=s(r[c]);0===a[d].references&&(a[d].updater(),a.splice(d,1))}r=l}}}},968:(e,t,r)=>{const n=document.querySelector("[nonce]");n&&(r.nc=n.nonce||n.getAttribute("nonce"))}},c={};function d(e){var t=c[e];if(void 0!==t)return t.exports;var r=c[e]={id:e,exports:{}};return l[e](r,r.exports,d),r.exports}d.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return d.d(t,{a:t}),t},d.d=(e,t)=>{for(var r in t)d.o(t,r)&&!d.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},d.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),d.nc=void 0;var h={};(()=>{d.d(h,{RE:()=>je,Sr:()=>Ie,YL:()=>Jt,Ay:()=>Zt}),d(968);const l=(e=>{var t={};return d.d(t,e),t})({jsx:()=>e.jsx,jsxs:()=>e.jsxs}),c=(e=>{var t={};return d.d(t,e),t})({useEffect:()=>t.useEffect,useLayoutEffect:()=>t.useLayoutEffect,useRef:()=>t.useRef,useState:()=>t.useState}),u=(e=>{var t={};return d.d(t,e),t})({observer:()=>r.observer});var p=d(591),b=d.n(p),f=d(371);b()(f.A,{insert:"head",singleton:!1});const m=f.A.locals||{};var v=d(126);b()(v.A,{insert:"head",singleton:!1});const y=v.A.locals||{};var g=d(81);b()(g.A,{insert:"head",singleton:!1});const w=g.A.locals||{},S=(e=>{var t={};return d.d(t,e),t})({default:()=>n.default}),P=({onClick:e,className:t})=>(0,l.jsx)("div",{className:(0,S.default)(w.icon,t),onClick:e,children:(0,l.jsx)("svg",{viewBox:"0 0 24 24",children:(0,l.jsx)("path",{fill:"currentColor",d:"M17.65,6.35C16.2,4.9 14.21,4 12,4A8,8 0 0,0 4,12A8,8 0 0,0 12,20C15.73,20 18.84,17.45 19.73,14H17.65C16.83,16.33 14.61,18 12,18A6,6 0 0,1 6,12A6,6 0 0,1 12,6C13.66,6 15.14,6.69 16.22,7.78L13,11H20V4L17.65,6.35Z"})})}),_=(0,u.observer)((e=>{const t=e.needShowErrorScreen,r=e.needShowLoaderScreen;return r||t?(0,l.jsx)("div",{className:(0,S.default)(y.loader),style:{"--loader-background":e.background,"--loaderBackgroundColor":e.color},onClick:e=>{e.preventDefault()},children:t?(0,l.jsx)(P,{className:y["loader__refresh-btn"],onClick:t=>{t.stopPropagation(),e.onReload()}}):r&&(0,l.jsx)("div",{className:y.loader__spinner})}):null})),x=()=>null!==d.nc&&void 0!==d.nc?d.nc:"";class E extends HTMLElement{constructor(){super(...arguments),Object.defineProperty(this,"styleElement",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"banner",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"mountPoint",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"handleClick",{enumerable:!0,configurable:!0,writable:!0,value:e=>{var t;this.shadowRoot&&"true"===this.shadowRoot.host.getAttribute("allow-click")&&(null===(t=this.banner)||void 0===t||t.activeSlide.onClick({event:e,currentTarget:this.shadowRoot.host}))}})}setBanner(e){this.banner=e}setStyle(e){var t;this.styleElement&&this.styleElement.parentNode&&this.styleElement.parentNode.removeChild(this.styleElement);const r=document.createElement("style");r.textContent=e,r.setAttribute("nonce",x()),this.styleElement=r,null===(t=this.shadowRoot)||void 0===t||t.prepend(r)}async init(){this.mountPoint&&this.banner&&(this.mountPoint.addEventListener("click",this.handleClick),await this.banner.attachRoot(this.mountPoint))}destroy(){var e,t;null===(e=this.banner)||void 0===e||e.detachRoot(),null===(t=this.mountPoint)||void 0===t||t.removeEventListener("click",this.handleClick)}connectedCallback(){if(this.shadowRoot)return;const e=this.attachShadow({mode:"open"});this.mountPoint=document.createElement("div"),this.mountPoint.style.height="100%",this.mountPoint.style.width="100%",e.appendChild(this.mountPoint)}disconnectedCallback(){}}function T(e){const t=e.match(/^rgba?\((\d+),\s*(\d+),\s*(\d+)(?:,\s*[\d.]+)?\)$/i);if(t){const[e,r,n,i]=t.map(Number);return(299*r+587*n+114*i)/1e3>128}if(e.startsWith("#")){const t=e.slice(1);let r,n,i;if(3===t.length)r=parseInt(t[0]+t[0],16),n=parseInt(t[1]+t[1],16),i=parseInt(t[2]+t[2],16);else{if(6!==t.length)return!1;r=parseInt(t.slice(0,2),16),n=parseInt(t.slice(2,4),16),i=parseInt(t.slice(4,6),16)}return(299*r+587*n+114*i)/1e3>128}return!0}customElements.get("banner-slides-container")||customElements.define("banner-slides-container",E);const O=(0,u.observer)((e=>{var{banner:t}=e,r=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(n=Object.getOwnPropertySymbols(e);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]])}return r}(e,["banner"]);const n=(0,c.useRef)(null),i=(0,c.useRef)(null),a=t.canBeShown;return(0,c.useLayoutEffect)((()=>{n.current&&n.current.setStyle(t.context.style)}),[t.context.style]),(0,c.useLayoutEffect)((()=>{if(!n.current)return;const e=n.current;return e.setBanner(t),e.init(),()=>{e.destroy()}}),[t]),(0,c.useEffect)((()=>{if(r.isActive&&a)return t.start(),()=>{t.stop()}}),[t,r.isActive,a]),(0,l.jsxs)("div",{className:(0,S.default)(m.banner,"ias-banner",r.className),ref:i,style:{height:t.width/t.contentRatio+"px",opacity:a?1:0,background:t.appearance.background,"--banner-border-radius":`${r.clientAppearance.borderRadius}px`},children:[(0,l.jsx)("banner-slides-container",{class:m["banner-slides"],ref:n,"allow-click":r.allowClick.toString(),dir:t.dir}),(0,l.jsx)(_,{needShowErrorScreen:t.needShowErrorScreen,needShowLoaderScreen:t.needShowLoaderScreen,onReload:async()=>{t.activeSlide.restart()},background:t.appearance.background,color:T(t.appearance.background)?"black":"white"})]})}));var j=d(369);b()(j.A,{insert:"head",singleton:!1});const I=j.A.locals||{},L=e=>((0,c.useEffect)((()=>(e.onLoadStart&&e.bannerPlace.on(ye.LoadStart,e.onLoadStart),e.onLoadEnd&&e.bannerPlace.on(ye.LoadEnd,e.onLoadEnd),e.onLoadError&&e.bannerPlace.on(ye.LoadError,e.onLoadError),e.onActiveIndexChange&&e.bannerPlace.on(ye.ActiveIndexChange,e.onActiveIndexChange),e.onAutoplayTimeLeft&&e.bannerPlace.on(ye.AutoplayTimeLeft,e.onAutoplayTimeLeft),e.onAutoplayTimerTick&&e.bannerPlace.on(ye.AutoplayTimerTick,e.onAutoplayTimerTick),e.onShowBanner&&e.bannerPlace.on(ye.ShowBanner,e.onShowBanner),e.onShowBannerFailed&&e.bannerPlace.on(ye.ShowBannerFailed,e.onShowBannerFailed),e.onBannerWidget&&e.bannerPlace.on(ye.BannerWidget,e.onBannerWidget),()=>{e.onLoadStart&&e.bannerPlace.off(ye.LoadStart,e.onLoadStart),e.onLoadEnd&&e.bannerPlace.off(ye.LoadEnd,e.onLoadEnd),e.onLoadError&&e.bannerPlace.off(ye.LoadError,e.onLoadError),e.onActiveIndexChange&&e.bannerPlace.off(ye.ActiveIndexChange,e.onActiveIndexChange),e.onAutoplayTimeLeft&&e.bannerPlace.off(ye.AutoplayTimeLeft,e.onAutoplayTimeLeft),e.onAutoplayTimerTick&&e.bannerPlace.off(ye.AutoplayTimerTick,e.onAutoplayTimerTick),e.onShowBanner&&e.bannerPlace.off(ye.ShowBanner,e.onShowBanner),e.onShowBannerFailed&&e.bannerPlace.off(ye.ShowBannerFailed,e.onShowBannerFailed),e.onBannerWidget&&e.bannerPlace.off(ye.BannerWidget,e.onBannerWidget)})),[e.bannerPlace,e.onLoadStart,e.onLoadError,e.onLoadEnd,e.onActiveIndexChange,e.onAutoplayTimeLeft,e.onAutoplayTimerTick,e.onShowBanner,e.onShowBannerFailed,e.onBannerWidget]),(0,c.useEffect)((()=>{(async e=>{try{await e.fetchBanners()}catch(e){console.error(e)}})(e.bannerPlace)}),[e.bannerPlace]),e.bannerPlace.banners);class C{constructor(e){Object.defineProperty(this,"slider",{enumerable:!0,configurable:!0,writable:!0,value:e})}isPaused(){return this.slider.autoplay.paused}resume(){this.slider.autoplay.resume()}pause(){this.slider.autoplay.pause()}start(){this.slider.autoplay.start()}setDelay(e){this.slider.autoplay.setDelay(e)}stop(){this.slider.autoplay.stop()}}class k{constructor(e){Object.defineProperty(this,"slider",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"autoplay",{enumerable:!0,configurable:!0,writable:!0,value:new C(this.slider)})}getTotalPages(){return this.slider.totalPages}getActiveIndex(){return this.slider.realIndex}toNextSlide(){this.slider.toNextSlide()}toPrevSlide(){this.slider.toPrevSlide()}slideTo(e,t){this.slider.slideToLoop(e,t)}enableHorizontalSwipeGesture(){this.slider.enableHorizontalSwipeGesture()}disableHorizontalSwipeGesture(){this.slider.disableHorizontalSwipeGesture()}updateSize(){this.slider.updateSize()}}var A=d(55);b()(A.A,{insert:"head",singleton:!1});const B=A.A.locals||{},M=e=>{const[t,r]=(0,c.useState)(-1);return(0,c.useEffect)((()=>{e.activeIndex===t&&r(-1)}),[e.activeIndex,t]),e.totalPages>1&&(0,l.jsx)("div",{className:(0,S.default)(B["slider-bullets"],"ias-banners-bullets"),children:Array.from({length:e.totalPages}).map(((t,n)=>(0,l.jsx)("div",{className:(0,S.default)("ias-banners__bullet",B["slider-bullets__bullet"],{[B["slider-bullets__bullet--active"]]:n===e.activeIndex,"ias-banners__bullet--active":n===e.activeIndex}),onClick:()=>(t=>{r(t),e.onClick(t)})(n)},n)))})};var R=d(41);b()(R.A,{insert:"head",singleton:!1});const D=R.A.locals||{};var N=d(379);b()(N.A,{insert:"head",singleton:!1});const W=N.A.locals||{},z=e=>(0,l.jsxs)("div",{children:[(0,l.jsx)("button",{onClick:e.onPrevClick,className:(0,S.default)("ias-banners__controls-btn","ias-banners__controls-btn--prev",W["slider__controls-btn"],W["slider__controls-btn--prev"],{[W["slider__controls-btn--disabled"]]:e.prevDisabled,"ias-banners__controls-btn--disabled":e.prevDisabled}),children:(0,l.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 24 24",children:(0,l.jsx)("path",{d:"M0 12l10.975 11 2.848-2.828-6.176-6.176H24v-3.992H7.646l6.176-6.176L10.975 1 0 12z",fill:"currentColor"})})}),(0,l.jsx)("button",{onClick:e.onNextClick,className:(0,S.default)("ias-banners__controls-btn","ias-banners__controls-btn--next",W["slider__controls-btn"],W["slider__controls-btn--next"],{[W["slider__controls-btn--disabled"]]:e.nextDisabled,"ias-banners__controls-btn--disabled":e.nextDisabled}),children:(0,l.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 24 24",children:(0,l.jsx)("path",{d:"M13.025 1l-2.847 2.828 6.176 6.176h-16.354v3.992h16.354l-6.176 6.176 2.847 2.828 10.975-11z",fill:"currentColor"})})})]});class F{constructor(e){Object.defineProperty(this,"slider",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"_enabled",{enumerable:!0,configurable:!0,writable:!0,value:!1})}get enabled(){return this._enabled}update(){const e=this.slider.options.loop&&this.canUseLoop();this._enabled?e||(this._enabled=!1,this.destroy()):e&&(this._enabled=!0)}applyLoopFix({targetIndex:e,direction:t}){if(!this.enabled)return!1;const r="next"===t||!t,n="prev"!==t&&t?[]:this.getPrependSlidesIndexes(e),i=r?this.getAppendSlidesIndexes(e):[];return this.moveSlides(n,i),this.adjustPosition(n,i),n.length>0||i.length>0}destroy(){this.resetSlidesOrder()}resetSlidesOrder(){const e=[];this.slider.slides.forEach((t=>{const r=+t.dataset.index;e[r]=t})),e.forEach((e=>{this.slider.track.append(e)}))}canUseLoop(){return!(this.slider.slides.length<this.slider.options.slidesPerView+1&&(console.warn("IAS Banners Loop Warning: The number of slides is not enough for loop mode, it will be disabled or not function properly. You need to add more slides (or make duplicates) or lower the values of slidesPerView parameters"),1))}getPrependSlidesIndexes(e){const t=this.slider.track.children,r=[];if(e<1)for(let n=0;n<1-e;n++){const e=t.length-n-1;r.push(e)}return r}getAppendSlidesIndexes(e){const t=[];if(e+this.slider.options.slidesPerView>this.slider.slides.length-1){const r=Math.max(e-(this.slider.slides.length-2),1);for(let e=0;e<r;e++){const r=e;t.push(r)}}return t}moveSlides(e,t){const r=this.slider.track,n=this.slider.slides.slice();e.forEach((e=>{r.prepend(n[e])})),t.forEach((e=>{r.append(n[e])}))}adjustPosition(e,t){e.length>0?this.slider.slideTo(this.slider.activeIndex+e.length,0):t.length>0&&this.slider.slideTo(this.slider.activeIndex-t.length,0)}}var U;!function(e){e.TouchStart="touchStart",e.TouchMove="touchMove",e.TouchEnd="touchEnd",e.ReachStart="reachStart",e.ReachEnd="reachEnd",e.ActiveIndexChange="activeIndexChange",e.RealIndexChnage="realIndexChange",e.TransitionStart="transitionStart",e.TransitionEnd="transitionend",e.Resize="resize",e.SlidesUpdated="slidesUpdated",e.AutoplayTimeLeft="autoplayTimeLeft",e.AutoplayTimerTick="autoplayTimerTick"}(U||(U={}));class V{constructor(e,t){Object.defineProperty(this,"slider",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"loopModule",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"startX",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"startTranslateX",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"isTouched",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_isMoved",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_enabled",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"startDirection",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"onTouchStart",{enumerable:!0,configurable:!0,writable:!0,value:e=>{!this.slider.animating&&this._enabled&&(e.stopPropagation(),this.startX=e instanceof MouseEvent?e.pageX:e.touches[0].clientX,this.startTranslateX=this.slider.currentTranslateX,this.isTouched=!0,this.setGrabCursor(!1))}}),Object.defineProperty(this,"onTouchMove",{enumerable:!0,configurable:!0,writable:!0,value:e=>{if(!this.isTouched)return;e.stopPropagation();let t=(e instanceof MouseEvent?e.pageX:e.touches[0].clientX)-this.startX;if(t*=1,!(Math.abs(t)>20||this._isMoved))return;this.setGrabCursor(!0),this._isMoved||(this.slider.emit(U.TouchStart),this.slider.autoplay.pause(),this.slider.lockActiveIndex(),this.startDirection=this.getSwipeDirection(t)),this._isMoved=!0;const r="next"===this.startDirection?20:-20;this.slider.emit(U.TouchMove);let n=this.startTranslateX+t+r;this.applyLoopFix(n),n=this.startTranslateX+t+r,this.setTranslate(n)}}),Object.defineProperty(this,"onTouchEnd",{enumerable:!0,configurable:!0,writable:!0,value:()=>{this.isTouched&&(this.slider.unlockActiveIndex(),this.updateActiveIndex(),this.unsetGrabCursor(),this.isTouched=!1,this._isMoved=!1,this.slider.emit(U.TouchEnd),this.slider.autoplay.resume())}}),this.slider.track.addEventListener("mousedown",this.onTouchStart,{passive:!0}),document.addEventListener("mousemove",this.onTouchMove,{passive:!0}),document.addEventListener("mouseup",this.onTouchEnd),this.slider.track.addEventListener("touchstart",this.onTouchStart,{passive:!0}),document.addEventListener("touchmove",this.onTouchMove,{passive:!0}),document.addEventListener("touchend",this.onTouchEnd)}get isMoved(){return this._isMoved}enableHorizontalSwipeGesture(){this._enabled=!0}disableHorizontalSwipeGesture(){this._enabled=!1}destroy(){this.slider.track.removeEventListener("touchstart",this.onTouchStart),document.removeEventListener("touchmove",this.onTouchMove),document.removeEventListener("touchend",this.onTouchEnd),this.slider.track.removeEventListener("mousedown",this.onTouchStart),document.removeEventListener("mousemove",this.onTouchMove),document.removeEventListener("mouseup",this.onTouchEnd)}setTranslate(e){e=this.applyEdgeResistance(e),this.slider.setTranslate(e)}applyLoopFix(e){if(!this.loopModule.enabled)return;e=-e;const t=this.slider.slideWidth+this.slider.options.spaceBetween,r=this.slider.getMinTranslate(),n=Math.abs(this.slider.getSlideOffset(this.slider.slides.length-this.slider.options.slidesPerView));e<r?this.loopModule.applyLoopFix({targetIndex:0,direction:"prev"})&&(this.startTranslateX-=t):e>n&&this.loopModule.applyLoopFix({targetIndex:this.slider.slides.length-this.slider.options.slidesPerView,direction:"next"})&&(this.startTranslateX+=t)}updateActiveIndex(){var e;if(!this.slider.slides.length)return;const{currentTranslateX:t,slides:r,options:n}=this.slider,i=(null===(e=r[0])||void 0===e?void 0:e.clientWidth)+n.spaceBetween;let a=-Math.round(t/i);const s=this.slider.totalPages-1;a=Math.min(s,Math.max(0,a)),this.slider.slideTo(a)}setGrabCursor(e){this.slider.track.style.cursor="move",this.slider.track.style.cursor=e?"grabbing":"grab"}unsetGrabCursor(){this.slider.track.style.cursor=""}getResistanceCoeff(e){const t=Math.min(Math.abs(e)/(.5*this.slider.slides[0].clientWidth),1);return.3+.7*Math.exp(3*-t)}applyEdgeResistance(e){if(this.loopModule.enabled)return e;e=-e;const t=this.slider.getMinTranslate(),r=-this.slider.getMaxTranslate();if(e>r){const t=e-r;e=r+t*this.getResistanceCoeff(t)}else if(e<t){const r=t-e;e=t-r*this.getResistanceCoeff(r)}return-e}getSwipeDirection(e){return e>0?"prev":"next"}}var q,$=d(46);!function(e){e.Start="start",e.Stop="stop",e.Pause="pause",e.Resume="resume",e.Progress="progress",e.Complete="complete"}(q||(q={}));class H extends $.EventEmitter{constructor(){super(...arguments),Object.defineProperty(this,"timerId",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"currentProgress",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"progressBeforePause",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"timerPaused",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"timeout",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"isCompleted",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"enabled",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"rafId",{enumerable:!0,configurable:!0,writable:!0,value:0})}get started(){return!this.isCompleted}get paused(){return this.timerPaused}setTimer(e){0!==e?(this.timerId=setTimeout((()=>this.complete({})),e),this.currentProgress=0,this.runTimerTicks(e)):this.forceEnd()}start(e){this.timerPaused||(this.stop(),this.progressBeforePause=0,this.timeout=e,this.enabled&&(this.isCompleted=!1,this.emit(q.Start),this.setTimer(e)))}restart(){this.stop(),this.start(this.timeout)}stop(){this.isCompleted||(this.clearTimer(),this.emit(q.Stop),this.isCompleted=!0,this.timerPaused=!1)}pause(){this.isCompleted||(this.timerPaused=!0,this.clearTimer(),this.progressBeforePause=this.currentProgress,this.emit(q.Pause))}resume(){if(!this.timerPaused)return;this.timerPaused=!1;const e=1-this.progressBeforePause,t=this.timeout*e;this.setTimer(t),this.emit(q.Resume)}forceEnd(){this.complete({forceEnd:!0})}disable(){this.enabled=!1,this.stop()}enable(){this.enabled=!0,this.start(this.timeout)}complete({forceEnd:e=!1}){this.isCompleted=!0,this.progressBeforePause=0,this.clearTimer(),this.emit(q.Complete,{forceEnd:e})}clearTimer(){cancelAnimationFrame(this.rafId),null!==this.timerId&&(clearTimeout(this.timerId),this.timerId=null)}updateProgress(e){const t=1-this.progressBeforePause;this.currentProgress=this.progressBeforePause+e*t;const r=100*this.currentProgress;this.emit(q.Progress,{percents:r,totalTime:this.timeout,currentTime:this.currentProgress*this.timeout})}runTimerTicks(e){const t=performance.now(),r=n=>{let i=(n-t)/e;i>1&&(i=1);const a=i;this.updateProgress(a),i<1&&(this.rafId=requestAnimationFrame(r))};this.rafId=requestAnimationFrame(r)}}class G{constructor(e,t){Object.defineProperty(this,"slider",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"loopModule",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"timer",{enumerable:!0,configurable:!0,writable:!0,value:new H}),Object.defineProperty(this,"delay",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"handleTimerComplete",{enumerable:!0,configurable:!0,writable:!0,value:({forceEnd:e})=>{e||this.slider.emit(U.AutoplayTimeLeft)}}),Object.defineProperty(this,"handleTimerProgress",{enumerable:!0,configurable:!0,writable:!0,value:e=>{this.slider.emit(U.AutoplayTimerTick,{currentTime:e.currentTime,totalTime:e.totalTime,percents:e.percents})}}),this.timer.on(q.Complete,this.handleTimerComplete),this.timer.on(q.Progress,this.handleTimerProgress)}get paused(){return this.timer.paused}start(){this.slider.options.autoplay&&(this.stop(),this.timer.start(this.delay))}stop(){this.timer.stop()}pause(){this.slider.options.autoplay&&this.timer.pause()}resume(){this.slider.options.autoplay&&this.timer.resume()}setDelay(e){this.delay=e}destroy(){this.timer.off(q.Complete,this.handleTimerComplete),this.timer.off(q.Progress,this.handleTimerProgress),this.stop()}}class X extends $.EventEmitter{constructor(e,t={}){super(),Object.defineProperty(this,"track",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"container",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"options",{enumerable:!0,configurable:!0,writable:!0,value:{autoplay:!1,speed:300,delay:3e3,loop:!1,slidesPerView:1,spaceBetween:0,initialSlide:0,updateOnWindowResize:!0}}),Object.defineProperty(this,"isAnimating",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_activeIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"_realIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"_currentTranslateX",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"_reachEnd",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"_reachStart",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"loopModule",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"touchModule",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_slideWidth",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"autoplay",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_activeIndexLocked",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"handleResize",{enumerable:!0,configurable:!0,writable:!0,value:()=>{this.updateSize(),this.emit(U.Resize)}}),this.track=e,this.container=e.parentElement,this.loopModule=new F(this),this.touchModule=new V(this,this.loopModule),this.autoplay=new G(this,this.loopModule),this.options.updateOnWindowResize&&window.addEventListener("resize",this.handleResize),this.collectSlides(),this.update(t)}get activeIndex(){return this._activeIndex}get realIndex(){return this._realIndex}get reachEnd(){return this._reachEnd}get reachStart(){return this._reachStart}get slidesEl(){return this.track}get slides(){return Array.from(this.track.children)}get allSlides(){return this.slides}get animating(){return this.isAnimating}get currentTranslateX(){return this._currentTranslateX}get isMoved(){return this.touchModule.isMoved}get slideWidth(){return this._slideWidth}get totalPages(){return this.loopModule.enabled?this.slides.length:Math.max(this.slides.length-this.options.slidesPerView+1,1)}async slideToLoop(e,t=this.options.speed){if(!this.loopModule.enabled)return this.slideTo(e,t);if(this.isAnimating)return;const r=this.getPhysicalIndexByRealIndex(e),n=this.slides.length-r<this.options.slidesPerView,i=r-this._activeIndex-1<this.options.slidesPerView?"next":"prev";if(n){const e="next"===i?r+1:r-this.slides.length+1;this.loopModule.applyLoopFix({targetIndex:e,direction:i})}const a=this.getPhysicalIndexByRealIndex(e);requestAnimationFrame((()=>this.slideTo(a)))}async slideTo(e,t=this.options.speed){e=this.clamp(e,0,this.totalPages-1),this.isAnimating||(this.isAnimating=!0,await this.performTranslateToSlide(e,t),this._activeIndexLocked||this.updateIndexes(e),this.isAnimating=!1)}lockActiveIndex(){this._activeIndexLocked=!0}unlockActiveIndex(){this._activeIndexLocked=!1}toNextSlide(){this.isAnimating||(this.loopModule.enabled?this.toNextSlideByLoop():this.slideTo(this.normalizeIndex(this._realIndex+1)))}toPrevSlide(){this.isAnimating||(this.loopModule.enabled?this.toPrevSlideByLoop():this.slideTo(this.normalizeIndex(this._realIndex-1)))}update(e){this.options=this.normalizeOptions(Object.assign(Object.assign({},this.options),e)),this.setupTrackStyles();const t=this.slideWidth;this.calculateSlideWidths(),t!==this.slideWidth&&this.emit(U.SlidesUpdated),this.loopModule.update(),this.slideTo(this._activeIndex,0),this.testAttraction()}destroy(){window.removeEventListener("resize",this.handleResize),this.autoplay.destroy(),this.touchModule.destroy(),this.track.removeAttribute("style"),this._activeIndex=0,this._activeIndexLocked=!1,this.isAnimating=!1}isSlideVisible(e){const t=this.getPhysicalIndexByRealIndex(e);return t>=this._activeIndex&&t<this._activeIndex+this.options.slidesPerView}getVisibleSlideIndexes(){return this.slides.slice(this._activeIndex,this._activeIndex+this.options.slidesPerView).map((e=>+e.dataset.index))}getPhysicalIndexByRealIndex(e){const t=this.normalizeIndex(e);return this.slides.findIndex((e=>e.dataset.index===t.toString()))}getMinTranslate(){return 0}getMaxTranslate(){return this.getSlideOffset(this.totalPages-1)}setTranslate(e){this.track.style.transform=`translate3d(${e}px, 0px, 0px)`,this._currentTranslateX=e,this.testAttraction()}enableHorizontalSwipeGesture(){this.touchModule.enableHorizontalSwipeGesture()}disableHorizontalSwipeGesture(){this.touchModule.disableHorizontalSwipeGesture()}getSlideOffset(e){return this.slides.length?-e*(this.slides[0].clientWidth+this.options.spaceBetween):0}updateSize(){const e=this.slideWidth;this.calculateSlideWidths(),e!==this.slideWidth&&this.emit(U.SlidesUpdated),this.slideTo(this._activeIndex,0)}getTrackWidth(){return this.track.clientWidth-this.options.spaceBetween*(this.options.slidesPerView-1)}toNextSlideByLoop(){this.isAnimating||(this.loopModule.applyLoopFix({targetIndex:this._activeIndex,direction:"next"}),requestAnimationFrame((()=>this.slideTo(this._activeIndex+1))))}toPrevSlideByLoop(){this.isAnimating||(this.loopModule.applyLoopFix({targetIndex:this._activeIndex,direction:"prev"}),requestAnimationFrame((()=>this.slideTo(this._activeIndex-1))))}updateIndexes(e){if(!this.slides.length)return;const t=+this.slides[e].dataset.index,r=this._realIndex,n=this._activeIndex;this._realIndex=t,this._activeIndex=e,r!==t&&this.emit(U.RealIndexChnage,t),n!==e&&this.emit(U.ActiveIndexChange,e)}setupTrackStyles(){Object.assign(this.track.style,{display:"flex",transition:`transform ${this.options.speed}ms ease`,gap:`${this.options.spaceBetween}px`}),this.container.style.overflow="hidden"}collectSlides(){this.slides.forEach(((e,t)=>{e.dataset.index=t.toString()}))}calculateSlideWidths(){this._slideWidth=Math.ceil(this.getTrackWidth()/this.options.slidesPerView),this.slides.forEach((e=>{e.style.width=`${this._slideWidth}px`}))}translateSlidesTrack(e,t){this.track.style.transitionDuration=`${t}ms`,this.setTranslate(this.getSlideOffset(e))}async performTranslateToSlide(e,t){if(0===t)this.translateSlidesTrack(e,0);else{if(this._activeIndex===e&&!this.touchModule.isMoved)return;this.translateSlidesTrack(e,t),this.emit(U.TransitionStart),await this.waitTransitionEnd(),this.emit(U.TransitionEnd)}}waitTransitionEnd(){return new Promise((e=>{this.track.addEventListener("transitionend",(t=>{"transform"===t.propertyName&&(this.track.style.transitionDuration="0ms",e())}),{once:!0})}))}testAttraction(){const e=this.getMinTranslate(),t=this.getMaxTranslate();let r=!this.loopModule.enabled&&this._currentTranslateX>=e,n=!this.loopModule.enabled&&this._currentTranslateX<=t;this.options.slidesPerView===this.slides.length&&(r=!0,n=!0),r!==this._reachStart&&(this._reachStart=r,this.emit(U.ReachStart,r)),n!==this._reachEnd&&(this._reachEnd=n,this.emit(U.ReachEnd,n))}normalizeOptions(e){var t,r,n,i,a,s,o,l;return{autoplay:null!==(t=e.autoplay)&&void 0!==t?t:this.options.autoplay,speed:null!==(r=e.speed)&&void 0!==r?r:this.options.speed,delay:null!==(n=e.delay)&&void 0!==n?n:this.options.delay,loop:null!==(i=e.loop)&&void 0!==i?i:this.options.loop,slidesPerView:Math.max(Math.min(this.track.children.length,null!==(a=e.slidesPerView)&&void 0!==a?a:this.options.slidesPerView),0),spaceBetween:null!==(s=e.spaceBetween)&&void 0!==s?s:this.options.spaceBetween,initialSlide:null!==(o=e.initialSlide)&&void 0!==o?o:this.options.initialSlide,updateOnWindowResize:null!==(l=e.updateOnWindowResize)&&void 0!==l?l:this.options.updateOnWindowResize}}normalizeIndex(e){const t=this.slides.length;return(e%t+t)%t}clamp(e,t,r){return Math.max(t,Math.min(e,r))}}const Q=(0,u.observer)((e=>{const[t,r]=(0,c.useState)(null),n=(0,c.useRef)(null);return(0,c.useEffect)((()=>{if(!n.current||!e.slidesCount)return;const t=new X(n.current,{autoplay:e.autoplay,speed:e.speed,loop:e.loop,slidesPerView:e.slidesPerView,spaceBetween:e.spaceBetween});return e.onInit(t),r(t),()=>{null==t||t.destroy()}}),[e.slidesCount]),(0,c.useEffect)((()=>{t&&t.update({autoplay:e.autoplay,speed:e.speed,loop:e.loop,slidesPerView:e.slidesPerView,spaceBetween:e.spaceBetween})}),[t,e.autoplay,e.speed,e.loop,e.slidesPerView,e.spaceBetween,e.slidesCount]),(0,l.jsxs)("div",{className:D.slider,style:{"--slider-border-radius":`${e.borderRadius}px`},children:[(0,l.jsx)("div",{ref:n,className:D.slider__track,children:e.children}),t&&e.pagination.enabled&&(0,l.jsx)(M,{totalPages:t.totalPages,activeIndex:t.realIndex,onClick:r=>{e.loop?t.slideToLoop(r):t.slideTo(r)}}),t&&e.navigation.enabled&&(0,l.jsx)(z,{onPrevClick:()=>{t.toPrevSlide()},onNextClick:()=>{t.toNextSlide()},nextDisabled:t.reachEnd,prevDisabled:t.reachStart})]})})),Y=e=>(0,l.jsx)("div",{className:(0,S.default)(D.slider__slide,e.className),style:e.style,children:e.children}),J=(e=>{var t={};return d.d(t,e),t})({action:()=>i.action,computed:()=>i.computed,observable:()=>i.observable,reaction:()=>i.reaction});var Z=function(e,t,r){for(var n=arguments.length>2,i=0;i<t.length;i++)r=n?t[i].call(e,r):t[i].call(e);return n?r:void 0};let K=(()=>{var e,t;let r,n=[],i=[];return e=class{get _context(){return function(e,t,r,n){if("a"===r&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?n:"a"===r?n.call(e):n?n.value:t.get(e)}(this,t,"f")}set _context(e){!function(e,t,r,n,i){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!i)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");"a"===n?i.call(e,r):i?i.value=r:t.set(e,r)}(this,t,e,"f")}constructor(e){t.set(this,Z(this,n,void 0)),Object.defineProperty(this,"id",{enumerable:!0,configurable:!0,writable:!0,value:Z(this,i)}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"displayFrom",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"displayTo",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"appearance",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"slides",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_wasShown",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_frequencyLimit",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"_openTime",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"_isOnceOpened",{enumerable:!0,configurable:!0,writable:!0,value:!1}),this.id=e.id,this.name=e.name,this.displayFrom=e.displayFrom,this.displayTo=e.displayTo,this.slides=e.slides,this._context=e.context,this.appearance=e.appearance}get context(){return this._context}get withinDisplayTimeRange(){return(!this.displayFrom||Date.now()>=this.displayFrom)&&(!this.displayTo||Date.now()<=this.displayTo)}get wasShown(){return this._wasShown}get frequencyLimitTimeExceeded(){return null===this._frequencyLimit?this._isOnceOpened:0!==this._frequencyLimit&&Math.trunc(this.timeSinceLastShow/1e3)<=this._frequencyLimit}get timeSinceLastShow(){return Date.now()-this._openTime}get openTime(){return this._openTime}updatePlaceholders(e){for(const t of this.slides)t.updatePlaceholders(e)}markWasShown(){this._wasShown=!0}markAsOpened(){this._openTime=Date.now(),this._isOnceOpened=!0}},t=new WeakMap,(()=>{const t="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;r=[J.observable],function(e,t,r,n,i,a){function s(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var o,l=n.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?n.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,n.name):{}),u=!1,p=r.length-1;p>=0;p--){var b={};for(var f in n)b[f]="access"===f?{}:n[f];for(var f in n.access)b.access[f]=n.access[f];b.addInitializer=function(e){if(u)throw new TypeError("Cannot add initializers after decoration has completed");a.push(s(e||null))};var m=(0,r[p])("accessor"===l?{get:h.get,set:h.set}:h[c],b);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw new TypeError("Object expected");(o=s(m.get))&&(h.get=o),(o=s(m.set))&&(h.set=o),(o=s(m.init))&&i.unshift(o)}else(o=s(m))&&("field"===l?i.unshift(o):h[c]=o)}d&&Object.defineProperty(d,n.name,h),u=!0}(e,null,r,{kind:"accessor",name:"_context",static:!1,private:!1,access:{has:e=>"_context"in e,get:e=>e._context,set:(e,t)=>{e._context=t}},metadata:t},n,i),t&&Object.defineProperty(e,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:t})})(),e})();class ee{constructor(e){var t;Object.defineProperty(this,"contentRatio",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"background",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.contentRatio=null!==(t=e.content_ratio)&&void 0!==t?t:1,this.background=this.mapBackgroundDtoToModel(e.background)}mapBackgroundDtoToModel(e){if(!e||0===e.alpha)return"transparent";if("solid"in e)return this.applyAlphaToColor(e.solid,e.alpha);if("linear_gradient"in e){const{angle:t,color_step_list:r}=e.linear_gradient;return`linear-gradient(${t}deg, ${r.map((t=>`${this.applyAlphaToColor(t.color,e.alpha)} ${t.position}%`)).join(", ")})`}return"transparent"}applyAlphaToColor(e,t){if(e.startsWith("#")){const r=e.slice(1),n=3===r.length;return`rgba(${parseInt(n?r[0]+r[0]:r.slice(0,2),16)}, ${parseInt(n?r[1]+r[1]:r.slice(2,4),16)}, ${parseInt(n?r[2]+r[2]:r.slice(4,6),16)}, ${t})`}return e}}class te{constructor(e,t){Object.defineProperty(this,"widgetsData",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"style",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.style=t.style,this.widgetsData=this.mapBannerContextDto(e,t)}mapBannerContextDto(e,t){var r;const n={},i=null!==(r=t.widgetsData)&&void 0!==r?r:{};for(const t in i)Array.isArray(i[t])||(n[t]=i[t][e]);return n}updateNarrativeSavedData(e){this.widgetsData._narrative_saved_data=e}}function re(e,t,r){return String(e).replace(new RegExp(function(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(t),"g"),(()=>r))}var ne=function(e,t,r){for(var n=arguments.length>2,i=0;i<t.length;i++)r=n?t[i].call(e,r):t[i].call(e);return n?r:void 0};let ie=(()=>{var e,t;let r,n=[],i=[];return e=class{get _html(){return function(e,t,r,n){if("a"===r&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?n:"a"===r?n.call(e):n?n.value:t.get(e)}(this,t,"f")}set _html(e){!function(e,t,r,n,i){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!i)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");"a"===n?i.call(e,r):i?i.value=r:t.set(e,r)}(this,t,e,"f")}get html(){return this._html}get payload(){return this._payload}constructor(e){t.set(this,ne(this,n,void 0)),Object.defineProperty(this,"_payload",{enumerable:!0,configurable:!0,writable:!0,value:ne(this,i)}),this._html=this.replaceSlideNonce(e.html),this._payload=e.payload}updatePlaceholders(e){let t=this._html;for(const r of e)t=re(t,`%${r.key}%`,r.value);this._html=t}replaceSlideNonce(e){var t;return re(e,"{{nonce}}",null!==(t=x())&&void 0!==t?t:"")}},t=new WeakMap,(()=>{const t="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;r=[J.observable],function(e,t,r,n,i,a){function s(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var o,l=n.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?n.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,n.name):{}),u=!1,p=r.length-1;p>=0;p--){var b={};for(var f in n)b[f]="access"===f?{}:n[f];for(var f in n.access)b.access[f]=n.access[f];b.addInitializer=function(e){if(u)throw new TypeError("Cannot add initializers after decoration has completed");a.push(s(e||null))};var m=(0,r[p])("accessor"===l?{get:h.get,set:h.set}:h[c],b);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw new TypeError("Object expected");(o=s(m.get))&&(h.get=o),(o=s(m.set))&&(h.set=o),(o=s(m.init))&&i.unshift(o)}else(o=s(m))&&("field"===l?i.unshift(o):h[c]=o)}d&&Object.defineProperty(d,n.name,h),u=!0}(e,null,r,{kind:"accessor",name:"_html",static:!1,private:!1,access:{has:e=>"_html"in e,get:e=>e._html,set:(e,t)=>{e._html=t}},metadata:t},n,i),t&&Object.defineProperty(e,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:t})})(),e})();var ae=function(e,t,r){for(var n=arguments.length>2,i=0;i<t.length;i++)r=n?t[i].call(e,r):t[i].call(e);return n?r:void 0};let se=(()=>{var e,t;let r,n=[],i=[];return e=class{get _banners(){return function(e,t,r,n){if("a"===r&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?n:"a"===r?n.call(e):n?n.value:t.get(e)}(this,t,"f")}set _banners(e){!function(e,t,r,n,i){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!i)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");"a"===n?i.call(e,r):i?i.value=r:t.set(e,r)}(this,t,e,"f")}constructor(e){Object.defineProperty(this,"id",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"style",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),t.set(this,ae(this,n,[])),ae(this,i),this.id=e.id,this._banners=e.banners,this.style=e.style,this.updatePlaceholders(e.placeholders)}get banners(){return this._banners}updatePlaceholders(e){for(const t of this._banners)t.updatePlaceholders(e)}},t=new WeakMap,(()=>{const t="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;r=[J.observable],function(e,t,r,n,i,a){function s(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var o,l=n.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?n.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,n.name):{}),u=!1,p=r.length-1;p>=0;p--){var b={};for(var f in n)b[f]="access"===f?{}:n[f];for(var f in n.access)b.access[f]=n.access[f];b.addInitializer=function(e){if(u)throw new TypeError("Cannot add initializers after decoration has completed");a.push(s(e||null))};var m=(0,r[p])("accessor"===l?{get:h.get,set:h.set}:h[c],b);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw new TypeError("Object expected");(o=s(m.get))&&(h.get=o),(o=s(m.set))&&(h.set=o),(o=s(m.init))&&i.unshift(o)}else(o=s(m))&&("field"===l?i.unshift(o):h[c]=o)}d&&Object.defineProperty(d,n.name,h),u=!0}(e,null,r,{kind:"accessor",name:"_banners",static:!1,private:!1,access:{has:e=>"_banners"in e,get:e=>e._banners,set:(e,t)=>{e._banners=t}},metadata:t},n,i),t&&Object.defineProperty(e,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:t})})(),e})();const oe=(e,t)=>{if("number"==typeof e)return e;if("string"==typeof e){const t=parseFloat(e);if(!isNaN(t))return t}return t};var le=function(e,t,r,n,i,a){function s(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var o,l=n.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?n.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,n.name):{}),u=!1,p=r.length-1;p>=0;p--){var b={};for(var f in n)b[f]="access"===f?{}:n[f];for(var f in n.access)b.access[f]=n.access[f];b.addInitializer=function(e){if(u)throw new TypeError("Cannot add initializers after decoration has completed");a.push(s(e||null))};var m=(0,r[p])("accessor"===l?{get:h.get,set:h.set}:h[c],b);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw new TypeError("Object expected");(o=s(m.get))&&(h.get=o),(o=s(m.set))&&(h.set=o),(o=s(m.init))&&i.unshift(o)}else(o=s(m))&&("field"===l?i.unshift(o):h[c]=o)}d&&Object.defineProperty(d,n.name,h),u=!0},ce=function(e,t,r){for(var n=arguments.length>2,i=0;i<t.length;i++)r=n?t[i].call(e,r):t[i].call(e);return n?r:void 0},de=function(e,t,r,n){if("a"===r&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?n:"a"===r?n.call(e):n?n.value:t.get(e)},he=function(e,t,r,n,i){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!i)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?i.call(e,r):i?i.value=r:t.set(e,r),r};let ue=(()=>{var e,t;let r,n=[],i=[];return e=class{get borderRadius(){return de(this,t,"f")}set borderRadius(e){he(this,t,e,"f")}update(e){this.borderRadius=oe(null==e?void 0:e.borderRadius,this.borderRadius)}constructor(){t.set(this,ce(this,n,12)),ce(this,i)}},t=new WeakMap,(()=>{const t="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;r=[J.observable],le(e,null,r,{kind:"accessor",name:"borderRadius",static:!1,private:!1,access:{has:e=>"borderRadius"in e,get:e=>e.borderRadius,set:(e,t)=>{e.borderRadius=t}},metadata:t},n,i),t&&Object.defineProperty(e,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:t})})(),e})(),pe=(()=>{var e,t,r,n,i,a,s,o;let l,c,d,h,u,p,b,f=[],m=[],v=[],y=[],g=[],w=[],S=[],P=[],_=[],x=[],E=[],T=[],O=[],j=[];return e=class{get loop(){return de(this,t,"f")}set loop(e){he(this,t,e,"f")}get gap(){return de(this,r,"f")}set gap(e){he(this,r,e,"f")}get autoplay(){return de(this,n,"f")}set autoplay(e){he(this,n,e,"f")}get animationSpeed(){return de(this,i,"f")}set animationSpeed(e){he(this,i,e,"f")}get slidesPerView(){return de(this,a,"f")}set slidesPerView(e){he(this,a,e,"f")}get navigation(){return de(this,s,"f")}set navigation(e){he(this,s,e,"f")}get pagination(){return de(this,o,"f")}set pagination(e){he(this,o,e,"f")}constructor(e){t.set(this,ce(this,f,!0)),r.set(this,(ce(this,m),ce(this,v,16))),n.set(this,(ce(this,y),ce(this,g,!0))),i.set(this,(ce(this,w),ce(this,S,300))),a.set(this,(ce(this,P),ce(this,_,1))),s.set(this,(ce(this,x),ce(this,E,{enabled:!0}))),o.set(this,(ce(this,T),ce(this,O,{enabled:!0}))),Object.defineProperty(this,"banner",{enumerable:!0,configurable:!0,writable:!0,value:(ce(this,j),new ue)}),e&&this.update(e)}update(e){var t,r,n,i,a,s;this.loop=null!==(t=null==e?void 0:e.loop)&&void 0!==t?t:this.loop,this.gap=oe(null==e?void 0:e.gap,this.gap),this.autoplay=null!==(r=null==e?void 0:e.autoplay)&&void 0!==r?r:this.autoplay,this.animationSpeed=oe(null==e?void 0:e.animationSpeed,this.animationSpeed),this.slidesPerView=Math.max(oe(null==e?void 0:e.slidesPerView,this.slidesPerView),0),this.navigation={enabled:null!==(i=null===(n=null==e?void 0:e.navigation)||void 0===n?void 0:n.enabled)&&void 0!==i?i:this.navigation.enabled},this.pagination={enabled:null!==(s=null===(a=null==e?void 0:e.pagination)||void 0===a?void 0:a.enabled)&&void 0!==s?s:this.pagination.enabled},this.banner.update(e.banner)}},t=new WeakMap,r=new WeakMap,n=new WeakMap,i=new WeakMap,a=new WeakMap,s=new WeakMap,o=new WeakMap,(()=>{const t="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;l=[J.observable],c=[J.observable],d=[J.observable],h=[J.observable],u=[J.observable],p=[J.observable],b=[J.observable],le(e,null,l,{kind:"accessor",name:"loop",static:!1,private:!1,access:{has:e=>"loop"in e,get:e=>e.loop,set:(e,t)=>{e.loop=t}},metadata:t},f,m),le(e,null,c,{kind:"accessor",name:"gap",static:!1,private:!1,access:{has:e=>"gap"in e,get:e=>e.gap,set:(e,t)=>{e.gap=t}},metadata:t},v,y),le(e,null,d,{kind:"accessor",name:"autoplay",static:!1,private:!1,access:{has:e=>"autoplay"in e,get:e=>e.autoplay,set:(e,t)=>{e.autoplay=t}},metadata:t},g,w),le(e,null,h,{kind:"accessor",name:"animationSpeed",static:!1,private:!1,access:{has:e=>"animationSpeed"in e,get:e=>e.animationSpeed,set:(e,t)=>{e.animationSpeed=t}},metadata:t},S,P),le(e,null,u,{kind:"accessor",name:"slidesPerView",static:!1,private:!1,access:{has:e=>"slidesPerView"in e,get:e=>e.slidesPerView,set:(e,t)=>{e.slidesPerView=t}},metadata:t},_,x),le(e,null,p,{kind:"accessor",name:"navigation",static:!1,private:!1,access:{has:e=>"navigation"in e,get:e=>e.navigation,set:(e,t)=>{e.navigation=t}},metadata:t},E,T),le(e,null,b,{kind:"accessor",name:"pagination",static:!1,private:!1,access:{has:e=>"pagination"in e,get:e=>e.pagination,set:(e,t)=>{e.pagination=t}},metadata:t},O,j),t&&Object.defineProperty(e,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:t})})(),e})();const be=(e=>{var t={};return d.d(t,e),t})({v4:()=>a.v4});class fe{constructor(e){Object.defineProperty(this,"payload",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"eventId",{enumerable:!0,configurable:!0,writable:!0,value:(0,be.v4)()})}get type(){return"view"}toQueryParams(){return{ei:this.eventId,ii:this.payload.iterationId,si:this.payload.slideIndex,st:this.payload.slideTotal}}}class me{constructor(e){Object.defineProperty(this,"payload",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"eventId",{enumerable:!0,configurable:!0,writable:!0,value:(0,be.v4)()})}get type(){return this.payload.type}toQueryParams(){return Object.assign({ei:this.eventId,ii:this.payload.iterationId,si:this.payload.slideIndex,st:this.payload.slideTotal,d:this.payload.durationMs},this.payload.widgetPayload)}}class ve{constructor(){Object.defineProperty(this,"autoplay",{enumerable:!0,configurable:!0,writable:!0,value:{isPaused:function(){return!1},resume:function(){},pause:function(){},start:function(){},stop:function(){},setDelay:function(){}}})}updateSize(){}enableHorizontalSwipeGesture(){}disableHorizontalSwipeGesture(){}getTotalPages(){return 1}getActiveIndex(){return 0}toNextSlide(){}toPrevSlide(){}slideTo(e,t){}}var ye,ge=function(e,t,r,n,i,a){function s(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var o,l=n.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?n.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,n.name):{}),u=!1,p=r.length-1;p>=0;p--){var b={};for(var f in n)b[f]="access"===f?{}:n[f];for(var f in n.access)b.access[f]=n.access[f];b.addInitializer=function(e){if(u)throw new TypeError("Cannot add initializers after decoration has completed");a.push(s(e||null))};var m=(0,r[p])("accessor"===l?{get:h.get,set:h.set}:h[c],b);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw new TypeError("Object expected");(o=s(m.get))&&(h.get=o),(o=s(m.set))&&(h.set=o),(o=s(m.init))&&i.unshift(o)}else(o=s(m))&&("field"===l?i.unshift(o):h[c]=o)}d&&Object.defineProperty(d,n.name,h),u=!0},we=function(e,t,r){for(var n=arguments.length>2,i=0;i<t.length;i++)r=n?t[i].call(e,r):t[i].call(e);return n?r:void 0},Se=function(e,t,r,n){if("a"===r&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?n:"a"===r?n.call(e):n?n.value:t.get(e)},Pe=function(e,t,r,n,i){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!i)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?i.call(e,r):i?i.value=r:t.set(e,r),r};!function(e){e.LoadStart="loadStart",e.LoadEnd="loadEnd",e.LoadError="loadError",e.ActiveIndexChange="activeIndexChange",e.AutoplayTimeLeft="autoplayTimeLeft",e.AutoplayTimerTick="autoplayTimerTick",e.ShowBanner="showBanner",e.ShowBannerFailed="showBannerFailed",e.BannerWidget="bannerWidget"}(ye||(ye={}));let _e=(()=>{var e,t,r,n,i,a;let s,o,l,c,d,h=$.EventEmitter,u=[],p=[],b=[],f=[],m=[],v=[],y=[],g=[],w=[],S=[];return e=class extends h{get _banners(){return Se(this,t,"f")}set _banners(e){Pe(this,t,e,"f")}get _bannerPlace(){return Se(this,r,"f")}set _bannerPlace(e){Pe(this,r,e,"f")}get _isLoading(){return Se(this,n,"f")}set _isLoading(e){Pe(this,n,e,"f")}get _isLoaded(){return Se(this,i,"f")}set _isLoaded(e){Pe(this,i,e,"f")}get _error(){return Se(this,a,"f")}set _error(e){Pe(this,a,e,"f")}constructor(e,s,o,l,c){super(),Object.defineProperty(this,"placeId",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"ctx",{enumerable:!0,configurable:!0,writable:!0,value:s}),Object.defineProperty(this,"bannerStatisticService",{enumerable:!0,configurable:!0,writable:!0,value:o}),Object.defineProperty(this,"bannerStore",{enumerable:!0,configurable:!0,writable:!0,value:l}),Object.defineProperty(this,"bannerViewModelFactory",{enumerable:!0,configurable:!0,writable:!0,value:c}),t.set(this,we(this,u,[])),r.set(this,(we(this,p),we(this,b,null))),n.set(this,(we(this,f),we(this,m,!1))),i.set(this,(we(this,v),we(this,y,!1))),a.set(this,(we(this,g),we(this,w,null))),Object.defineProperty(this,"appearance",{enumerable:!0,configurable:!0,writable:!0,value:(we(this,S),new pe)}),Object.defineProperty(this,"sliderController",{enumerable:!0,configurable:!0,writable:!0,value:new ve}),this.ctx.addBannerPlace(this)}get id(){return this.placeId}get banners(){return this._banners}get contentRatio(){const e=this._banners.map((e=>e.contentRatio));return this.median(e)}get isLoaded(){return this._isLoaded}get isLoading(){return this._isLoading}get error(){return this._error}get slider(){return this.sliderController}get activeIndex(){return this.sliderController.getActiveIndex()}get activeBanner(){return this._banners[this.activeIndex]}get paginationBullets(){return this.sliderController.getTotalPages()}refreshSizes(){this._banners.forEach((e=>e.refreshSizes()))}setSliderController(e){this.sliderController=e}updateAppearance(e){this.appearance.update(e)}resume(){for(const e of this._banners)e.resumeByUser();this.appearance.autoplay&&this.slider.autoplay.resume()}pause(){for(const e of this._banners)e.pauseByUser();this.appearance.autoplay&&this.slider.autoplay.pause()}async reload(){this.bannerStore.removeBannerPlaceById(this.id),await Promise.all(this._banners.map((e=>e.destroy()))),this._banners=[],await this.fetchBanners()}destroy(){this.sliderController=new ve;for(const e of this._banners)e.destroy();this._banners=[],this.ctx.removeBannerPlace(this)}notifyTimerEnd(){var e;null===(e=this.activeBanner)||void 0===e||e.notifyTimerEnd()}showNext(){this.sliderController.toNextSlide()}showPrevious(){this.sliderController.toPrevSlide()}showByIndex(e,t){this.sliderController.slideTo(e,t)}async updateUserData(e){return this.bannerStore.updateBannerUserData(this.id,e)}async fetchBanners(){try{return this._isLoading?[]:(this._isLoading=!0,this._isLoaded=!1,this._error=null,this.emit(ye.LoadStart),this._bannerPlace=await this.bannerStore.getBannerPlaceById({placeId:this.placeId}),this._banners=this.filterBannersByTimeRange(this._bannerPlace.banners).map((e=>this.bannerViewModelFactory.create(this,e))),await Promise.allSettled(this._banners.map((e=>e.waitInit()))),this._isLoaded=!0,this._banners)}catch(e){throw this.emit(ye.LoadError,e),this._error=e,e}finally{this.emit(ye.LoadEnd),this._isLoading=!1}}filterBannersByTimeRange(e){return e.filter((e=>e.withinDisplayTimeRange))}median(e){const t=[...e].sort(((e,t)=>e-t)),r=Math.floor(t.length/2);return t.length%2==0?(t[r-1]+t[r])/2:t[r]}},t=new WeakMap,r=new WeakMap,n=new WeakMap,i=new WeakMap,a=new WeakMap,(()=>{var t;const r="function"==typeof Symbol&&Symbol.metadata?Object.create(null!==(t=h[Symbol.metadata])&&void 0!==t?t:null):void 0;s=[J.observable],o=[J.observable],l=[J.observable],c=[J.observable],d=[J.observable],ge(e,null,s,{kind:"accessor",name:"_banners",static:!1,private:!1,access:{has:e=>"_banners"in e,get:e=>e._banners,set:(e,t)=>{e._banners=t}},metadata:r},u,p),ge(e,null,o,{kind:"accessor",name:"_bannerPlace",static:!1,private:!1,access:{has:e=>"_bannerPlace"in e,get:e=>e._bannerPlace,set:(e,t)=>{e._bannerPlace=t}},metadata:r},b,f),ge(e,null,l,{kind:"accessor",name:"_isLoading",static:!1,private:!1,access:{has:e=>"_isLoading"in e,get:e=>e._isLoading,set:(e,t)=>{e._isLoading=t}},metadata:r},m,v),ge(e,null,c,{kind:"accessor",name:"_isLoaded",static:!1,private:!1,access:{has:e=>"_isLoaded"in e,get:e=>e._isLoaded,set:(e,t)=>{e._isLoaded=t}},metadata:r},y,g),ge(e,null,d,{kind:"accessor",name:"_error",static:!1,private:!1,access:{has:e=>"_error"in e,get:e=>e._error,set:(e,t)=>{e._error=t}},metadata:r},w,S),r&&Object.defineProperty(e,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:r})})(),e})();const xe=(0,u.observer)((e=>{const t=L(e),r=(0,c.useRef)(null),n=t[0];return e.bannerPlace.error?null:(0,l.jsx)("div",{className:I["banner-place"],ref:r,children:!n||e.bannerPlace.isLoading?(0,l.jsx)(_,{needShowErrorScreen:!1,needShowLoaderScreen:!0,onReload:()=>{}}):(0,l.jsx)(O,{index:0,isActive:!0,canBeInited:!0,banner:n,allowClick:!0,clientAppearance:e.bannerPlace.appearance.banner})})})),Ee=(0,u.observer)((e=>{const t=(0,c.useRef)(null),r=L(e);var n;n=e,(0,c.useEffect)((()=>{n.appearance&&n.bannerPlace.updateAppearance(n.appearance)}),[n.bannerPlace,JSON.stringify(n.appearance)]);const{realIndex:i,allowClick:a,slider:s,isAnimating:o,setSlider:d,isMoved:h}=(e=>{const t=(0,c.useRef)(null),[r,n]=(0,c.useState)(!1),[i,a]=(0,c.useState)(!1),[s,o]=(0,c.useState)(!1),[l,d]=(0,c.useState)(!0),[h,u]=(0,c.useState)(null),[p,b]=(0,c.useState)(0),[f,m]=(0,c.useState)(0),[v,y]=(0,c.useState)(!0),[g,w]=(0,c.useState)(!0),S=()=>{clearTimeout(t.current),d(!1),o(!0),((e,t)=>{e.getVisibleSlideIndexes().map((e=>t.banners[e])).forEach((e=>e.pause()))})(h,e)},P=()=>{t.current=setTimeout((()=>d(!0)),100),o(!1),((e,t)=>{t.banners.forEach((e=>e.resume()))})(0,e)},_=()=>{a(!0),d(!1)},x=()=>{a(!1),d(!0)},E=t=>{m(t),e.emit(ye.ActiveIndexChange,t)},T=e=>{b(e)},O=()=>{h&&y(h.reachStart)},j=()=>{h&&w(h.reachEnd)},I=()=>{},L=()=>{e.refreshSizes(),requestAnimationFrame((()=>{e.refreshSizes(),n((e=>!e))}))},C=()=>{e.emit(ye.AutoplayTimeLeft),e.notifyTimerEnd()},A=t=>{e.emit(ye.AutoplayTimerTick,Object.assign(Object.assign({},t),{bannerIndex:e.activeIndex}))};return(0,c.useEffect)((()=>{if(!h)return;const t=new k(h);e.setSliderController(t)}),[e,h]),(0,c.useEffect)((()=>{h&&e&&e.banners[h.realIndex].markAsOpened()}),[e,h]),(0,c.useEffect)((()=>{if(h)return h.on(U.TouchStart,S),h.on(U.TouchEnd,P),h.on(U.TransitionStart,_),h.on(U.TransitionEnd,x),h.on(U.RealIndexChnage,E),h.on(U.ActiveIndexChange,T),h.on(U.ReachStart,O),h.on(U.ReachEnd,j),h.on(U.Resize,I),h.on(U.SlidesUpdated,L),h.on(U.AutoplayTimeLeft,C),h.on(U.AutoplayTimerTick,A),O(),j(),()=>{h.off(U.TouchStart,S),h.off(U.TouchEnd,P),h.off(U.TransitionStart,_),h.off(U.TransitionEnd,x),h.off(U.RealIndexChnage,E),h.off(U.ActiveIndexChange,T),h.off(U.ReachStart,O),h.off(U.ReachEnd,j),h.off(U.Resize,I),h.off(U.SlidesUpdated,L),h.off(U.AutoplayTimeLeft,C),h.off(U.AutoplayTimerTick,A)}}),[e,h]),{reachStart:v,reachEnd:g,activeIndex:p,realIndex:f,isMoved:s,isAnimating:i,slider:h,setSlider:u,allowClick:l}})(e.bannerPlace);(({bannerPlace:e,bannerPlaceRef:t,slider:r})=>{const[n,i]=(0,c.useState)(!1);(0,c.useEffect)((()=>((async(e=5e3)=>new Promise(((r,n)=>{const i=setTimeout((()=>{n(new Error("[IAS]: Timeout while waiting for BannerPlace clientWidth"))}),e),a=()=>{if(t.current&&t.current.clientWidth>0)return clearTimeout(i),void r();requestAnimationFrame(a)};requestAnimationFrame(a)})))().then((()=>{i(!0)})).catch(console.error),()=>{i(!1)})),[e.isLoaded]),(0,c.useEffect)((()=>{r&&n&&(r.updateSize(),e.refreshSizes(),requestAnimationFrame((()=>{e.refreshSizes()})))}),[r,e,n])})({bannerPlace:e.bannerPlace,slider:s,bannerPlaceRef:t});const u=e.bannerPlace.appearance;return(0,l.jsx)("div",{className:(0,S.default)(I["banner-place"],e.className),style:e.style,ref:t,children:(0,l.jsx)(Q,{onInit:d,autoplay:u.autoplay,speed:u.animationSpeed,loop:u.loop,slidesPerView:u.slidesPerView,spaceBetween:u.gap,slidesCount:r.length,navigation:u.navigation,pagination:u.pagination,children:r.map(((e,t)=>{const r=Boolean(null==s?void 0:s.isSlideVisible(t));return(0,l.jsx)(Y,{children:(0,l.jsx)(O,{index:t,isActive:r,canBeInited:r,banner:e,className:I["banner-slider__slide"],allowClick:a,clientAppearance:u.banner})},e.id)}))})})})),Te=(e=>{var t={};return d.d(t,e),t})({createRoot:()=>s.createRoot});class Oe{constructor(e,t,r){Object.defineProperty(this,"mountPoint",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"bannerPlace",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"params",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"root",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"rootElement",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.rootElement=document.createElement("div"),this.rootElement.style.width="100%",this.rootElement.style.height="100%",e.appendChild(this.rootElement),this.root=(0,Te.createRoot)(this.rootElement)}get activeIndex(){return this.bannerPlace.activeIndex}get activeBanner(){return this.bannerPlace.activeBanner}get isLoaded(){return this.bannerPlace.isLoaded}get id(){return this.bannerPlace.id}get banners(){return this.bannerPlace.banners}get appearance(){return this.bannerPlace.appearance}get contentRatio(){return this.bannerPlace.contentRatio}get isLoading(){return this.bannerPlace.isLoading}get error(){return this.bannerPlace.error}get slider(){return this.bannerPlace.slider}get paginationBullets(){return this.bannerPlace.slider.getTotalPages()}refreshSizes(){}emit(e,...t){}setSliderController(e){this.bannerPlace.setSliderController(e)}updateAppearance(e){this.bannerPlace.updateAppearance(e)}resume(){this.bannerPlace.resume()}pause(){this.bannerPlace.pause()}reload(){return this.bannerPlace.reload()}destroy(){setTimeout((()=>{this.root.unmount()})),this.mountPoint.removeChild(this.rootElement),this.bannerPlace.destroy()}fetchBanners(){return this.bannerPlace.fetchBanners()}updateUserData(e){return Promise.resolve()}notifyTimerEnd(){this.bannerPlace.notifyTimerEnd()}showNext(){this.bannerPlace.showNext()}showPrevious(){this.bannerPlace.showPrevious()}showByIndex(e,t){this.bannerPlace.showByIndex(e,t)}on(e,t){return this.bannerPlace.on(e,t),this}once(e,t){return this.bannerPlace.once(e,t),this}off(e,t){return this.bannerPlace.off(e,t),this}render(){var e;this.root.render((0,l.jsx)(Ee,{appearance:null===(e=this.params)||void 0===e?void 0:e.appearance,bannerPlace:this.bannerPlace}))}}const je=e=>{const[t,r]=(0,c.useState)(null);return(0,c.useEffect)((()=>{var t;const n=Qt().createBannerPlace(e.placeId);return r(n),null===(t=e.onReady)||void 0===t||t.call(e,n),()=>{n.destroy()}}),[e.placeId]),t?(0,l.jsx)(Ee,Object.assign({bannerPlace:t},e)):null},Ie=e=>{const[t,r]=(0,c.useState)(null);return(0,c.useEffect)((()=>{var t;const n=Qt().createBannerPreviewPlace(e.bannerId);return r(n),null===(t=e.onReady)||void 0===t||t.call(e,n),()=>{n.destroy()}}),[e.bannerId]),t?(0,l.jsx)(xe,Object.assign({bannerPlace:t},e)):null};var Le=function(e,t,r,n,i,a){function s(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var o,l=n.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?n.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,n.name):{}),u=!1,p=r.length-1;p>=0;p--){var b={};for(var f in n)b[f]="access"===f?{}:n[f];for(var f in n.access)b.access[f]=n.access[f];b.addInitializer=function(e){if(u)throw new TypeError("Cannot add initializers after decoration has completed");a.push(s(e||null))};var m=(0,r[p])("accessor"===l?{get:h.get,set:h.set}:h[c],b);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw new TypeError("Object expected");(o=s(m.get))&&(h.get=o),(o=s(m.set))&&(h.set=o),(o=s(m.init))&&i.unshift(o)}else(o=s(m))&&("field"===l?i.unshift(o):h[c]=o)}d&&Object.defineProperty(d,n.name,h),u=!0},Ce=function(e,t,r){for(var n=arguments.length>2,i=0;i<t.length;i++)r=n?t[i].call(e,r):t[i].call(e);return n?r:void 0},ke=function(e,t,r,n){if("a"===r&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?n:"a"===r?n.call(e):n?n.value:t.get(e)},Ae=function(e,t,r,n,i){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!i)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?i.call(e,r):i?i.value=r:t.set(e,r),r};let Be=(()=>{var e,t,r,n,i;let a,s,o,l,c=$.EventEmitter,d=[],h=[],u=[],p=[],b=[],f=[],m=[],v=[];return e=class extends c{get _banners(){return ke(this,t,"f")}set _banners(e){Ae(this,t,e,"f")}get _isLoading(){return ke(this,r,"f")}set _isLoading(e){Ae(this,r,e,"f")}get _isLoaded(){return ke(this,n,"f")}set _isLoaded(e){Ae(this,n,e,"f")}get _error(){return ke(this,i,"f")}set _error(e){Ae(this,i,e,"f")}constructor(e,a,s,o){super(),Object.defineProperty(this,"bannerId",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"ctx",{enumerable:!0,configurable:!0,writable:!0,value:a}),Object.defineProperty(this,"bannerStore",{enumerable:!0,configurable:!0,writable:!0,value:s}),Object.defineProperty(this,"bannerViewModelFactory",{enumerable:!0,configurable:!0,writable:!0,value:o}),t.set(this,Ce(this,d,[])),r.set(this,(Ce(this,h),Ce(this,u,!1))),n.set(this,(Ce(this,p),Ce(this,b,!1))),i.set(this,(Ce(this,f),Ce(this,m,null))),Object.defineProperty(this,"appearance",{enumerable:!0,configurable:!0,writable:!0,value:(Ce(this,v),new pe)}),this.ctx.addBannerPlace(this)}get activeIndex(){return 0}get activeBanner(){return this._banners[0]}get id(){return"__BANNER_PREVIEW__"}get slider(){return new ve}get banners(){return this._banners}get isLoading(){return this._isLoading}get isLoaded(){return this._isLoaded}get contentRatio(){var e,t;return null!==(t=null===(e=this._banners[0])||void 0===e?void 0:e.contentRatio)&&void 0!==t?t:1}get paginationBullets(){return 1}get error(){return this._error}refreshSizes(){this._banners.forEach((e=>e.refreshSizes()))}setSliderController(e){}updateAppearance(e){this.appearance.update(e)}resume(){for(const e of this._banners)e.resume()}pause(){for(const e of this._banners)e.pause()}async reload(){this.bannerStore.removeBannerPlaceById(this.id),await Promise.all(this._banners.map((e=>e.destroy()))),this._banners=[],await this.fetchBanners()}destroy(){for(const e of this._banners)e.destroy();this._banners=[],this.ctx.removeBannerPlace(this)}async updateUserData(e){return this.bannerStore.updateBannerUserData(this.id,e)}notifyTimerEnd(){}showNext(){}showPrevious(){}showByIndex(e,t){}async fetchBanners(){try{if(this._isLoading)return[];this._error=null,this._isLoading=!0,this._isLoaded=!1,this.emit(ye.LoadStart);const e=await this.bannerStore.getBannerById(this.bannerId);return this._banners=[this.bannerViewModelFactory.create(this,e)],this._isLoaded=!0,this._banners}catch(e){throw this.emit(ye.LoadError,e),this._error=e,e}finally{this.emit(ye.LoadEnd),this._isLoading=!1}}},t=new WeakMap,r=new WeakMap,n=new WeakMap,i=new WeakMap,(()=>{var t;const r="function"==typeof Symbol&&Symbol.metadata?Object.create(null!==(t=c[Symbol.metadata])&&void 0!==t?t:null):void 0;a=[J.observable],s=[J.observable],o=[J.observable],l=[J.observable],Le(e,null,a,{kind:"accessor",name:"_banners",static:!1,private:!1,access:{has:e=>"_banners"in e,get:e=>e._banners,set:(e,t)=>{e._banners=t}},metadata:r},d,h),Le(e,null,s,{kind:"accessor",name:"_isLoading",static:!1,private:!1,access:{has:e=>"_isLoading"in e,get:e=>e._isLoading,set:(e,t)=>{e._isLoading=t}},metadata:r},u,p),Le(e,null,o,{kind:"accessor",name:"_isLoaded",static:!1,private:!1,access:{has:e=>"_isLoaded"in e,get:e=>e._isLoaded,set:(e,t)=>{e._isLoaded=t}},metadata:r},b,f),Le(e,null,l,{kind:"accessor",name:"_error",static:!1,private:!1,access:{has:e=>"_error"in e,get:e=>e._error,set:(e,t)=>{e._error=t}},metadata:r},m,v),r&&Object.defineProperty(e,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:r})})(),e})();class Me{constructor(e){Object.defineProperty(this,"bannerStatisticApi",{enumerable:!0,configurable:!0,writable:!0,value:e})}async sendViewEvent(e,t){const r=new fe(t);await this.bannerStatisticApi.sendViewEvent(e,r)}async sendWidgetEvent(e,t){const r=new me(t);await this.bannerStatisticApi.sendWidgetEvent(e,r)}}class Re{constructor(){Object.defineProperty(this,"cache",{enumerable:!0,configurable:!0,writable:!0,value:{}})}set(e,t){this.cache[e]=t}clear(){this.cache={}}get(e){return this.cache[e]}}class De{constructor(e,t,r){Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"bannerPlaceViewModel",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"banner",{enumerable:!0,configurable:!0,writable:!0,value:r})}async handle(e){try{const t=this.storyManager.gameReader;await t.openGame(e.gameInstanceId),this.bannerPlaceViewModel.pause(),t.once("close",(()=>{this.bannerPlaceViewModel.resume()}))}catch(e){console.error(e)}}}var Ne,We,ze,Fe,Ue,Ve,qe,$e,He,Ge,Xe,Qe,Ye,Je,Ze,Ke,et,tt;!function(e){e.LEFT="left",e.RIGHT="right",e.START="start",e.END="end"}(Ne||(Ne={})),Ne.END,function(e){e.DEFAULT="default",e.CUSTOM_CARD="customCard"}(We||(We={})),We.DEFAULT,We.DEFAULT,function(e){e.CENTER="center",e.LEFT="left",e.RIGHT="right",e.START="start",e.END="end"}(ze||(ze={})),function(e){e.CIRCLE="circle",e.QUAD="quad",e.RECTANGLE="rectangle"}(Fe||(Fe={})),function(e){e.LEFT="left",e.RIGHT="right",e.START="start",e.END="end",e.CENTER="center"}(Ue||(Ue={})),function(e){e.CARD_INSIDE_BOTTOM="cardInsideBottom",e.CARD_OUTSIDE_TOP="cardOutsideTop",e.CARD_OUTSIDE_BOTTOM="cardOutsideBottom"}(Ve||(Ve={})),function(e){e.Medium="medium",e.High="high"}(qe||(qe={})),function(e){e.COLUMN="vertical",e.ROW="horizontal"}($e||($e={})),function(e){e.START_LOADER="startLoad",e.END_LOADER="endLoad"}(He||(He={})),$e.ROW,Ue.START,Ve.CARD_INSIDE_BOTTOM,qe.High,Fe.RECTANGLE,Ue.START,Ve.CARD_INSIDE_BOTTOM,qe.High,Fe.CIRCLE,ze.START,Ue.START,Ve.CARD_INSIDE_BOTTOM,qe.High,Fe.CIRCLE,function(e){e.WidgetEvent="widgetEvent",e.ClickOnButton="clickOnButton"}(Ge||(Ge={})),function(e){e.STORY_LIST="storyList",e.STORY_READER="storyReader",e.GAME_READER="gameReader",e.STACK_STORY_LIST="stackStoryList",e.IAM_READER="iamReader",e.BANNERS="banners"}(Xe||(Xe={})),function(e){e.FLAT="flat",e.COVER="cover",e.CUBE="cube"}(Qe||(Qe={})),function(e){e.Classic="classic",e.Modern="modern"}(Ye||(Ye={})),Qe.FLAT,Ye.Classic,function(e){e.STYLE_CIRCLE="circle",e.STYLE_QUAD="quad",e.STYLE_RECTANGLE="rectangle",e.SWIPE_CUBE="cube",e.SWIPE_FLAT="flat",e.SWIPE_COVER="cover",e.CLOSE_BUTTON_LEFT="left",e.CLOSE_BUTTON_RIGHT="right"}(Je||(Je={})),function(e){e.direct="direct",e.onboarding="onboarding",e.list="list",e.favorite="favorite"}(Ze||(Ze={})),function(e){e[e.default=0]="default",e[e.favorite=1]="favorite",e[e.stacked=2]="stacked"}(Ke||(Ke={})),function(e){e.LTR="ltr",e.RTL="rtl"}(et||(et={})),function(e){e.StoryList="storyList",e.StoryReader="storyReader",e.GameReader="gameReader",e.StackStoryList="stackStoryList",e.IamReader="iamReader",e.Banners="banners"}(tt||(tt={}));class rt{constructor(e,t){Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"banner",{enumerable:!0,configurable:!0,writable:!0,value:t})}handle(e){try{const t=decodeURIComponent(e.linkTarget),r={src:tt.Banners,data:{id:this.banner.id,index:this.banner.activeSlideIndex,url:t,elementId:e.elementId}};this.storyManager.storyLinkClickHandler(r),this.storyManager.emit("clickOnButton",r)}catch(t){t instanceof URIError?console.error(`[Banners]: the URL <${e.linkTarget}> has an invalid format`):console.error(t)}}}class nt{constructor(e,t,r){Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"bannerPlace",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"banner",{enumerable:!0,configurable:!0,writable:!0,value:r})}async handle(e){try{const t={src:tt.Banners,data:{id:this.banner.id,index:this.banner.activeSlideIndex,url:e.storyId.toString()}};this.storyManager.storyLinkClickHandler(t),this.storyManager.emit("clickOnButton",t),this.bannerPlace.pause(),await this.storyManager.storyReader.showStory(e.storyId),this.storyManager.storyReader.once("closeStoryReader",(()=>{this.bannerPlace.resume()}))}catch(e){console.error(e)}}}class it{constructor(){Object.defineProperty(this,"textArea",{enumerable:!0,configurable:!0,writable:!0,value:null})}async copy(e){try{navigator.clipboard&&window.isSecureContext?await navigator.clipboard.writeText(e):this.copyLegacy(e)}catch(t){this.copyLegacy(e)}}isIOS(){return/ipad|iphone/i.test(navigator.userAgent)}createTextArea(e){this.textArea=document.createElement("textarea"),this.textArea.value=e,document.body.appendChild(this.textArea)}selectText(){if(this.textArea)if(this.isIOS()){const e=document.createRange();e.selectNodeContents(this.textArea);const t=window.getSelection();t&&(t.removeAllRanges(),t.addRange(e)),this.textArea.setSelectionRange(0,999999)}else this.textArea.select()}copyLegacy(e){this.createTextArea(e),this.selectText();try{document.execCommand("copy")}catch(e){console.error("Copy failed:",e)}this.textArea&&(document.body.removeChild(this.textArea),this.textArea=null)}}let at;at=function(){};class st{constructor(e){Object.defineProperty(this,"bannerPlace",{enumerable:!0,configurable:!0,writable:!0,value:e})}manageTimer(e,t){if(!this.bannerPlace.slider)return;const r=this.bannerPlace.slider.autoplay;switch(e){case"start":this.startTimer(r,t);break;case"pause":r.pause();break;case"stop":case"before_start":r.stop()}}startTimer(e,t){e.isPaused()?e.resume():(e.setDelay(t),e.start())}}class ot{constructor(e){Object.defineProperty(this,"payload",{enumerable:!0,configurable:!0,writable:!0,value:e})}}Object.defineProperty(ot,"name",{enumerable:!0,configurable:!0,writable:!0,value:"bannerWidget"});class lt{constructor(e){Object.defineProperty(this,"payload",{enumerable:!0,configurable:!0,writable:!0,value:e})}}Object.defineProperty(lt,"name",{enumerable:!0,configurable:!0,writable:!0,value:"showBanner"});class ct{constructor(e){Object.defineProperty(this,"payload",{enumerable:!0,configurable:!0,writable:!0,value:e})}}Object.defineProperty(ct,"name",{enumerable:!0,configurable:!0,writable:!0,value:"showBannerFailed"});class dt{constructor(e,t,r,n){Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"bannerPlace",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"banner",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"bannerStatisticService",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(this,"sessionNarrativeDataCache",{enumerable:!0,configurable:!0,writable:!0,value:new Re}),Object.defineProperty(this,"narrativeDataCache",{enumerable:!0,configurable:!0,writable:!0,value:new Re})}updateCardServerDataLocally(e){this.banner.context.updateNarrativeSavedData(e)}updateTimeline(e,t,r,n,i,a){[...arguments].join(", "),this.banner.id,"before_start"!==t&&(i?this.banner.showLoaderScreen():this.banner.activeSlide.inited&&this.banner.hideLoaderScreen(),a?this.banner.showErrorScreen():this.banner.hideErrorScreen()),new st(this.bannerPlace).manageTimer(t,n)}clearNarrativeSessionDataCache(){this.sessionNarrativeDataCache.clear()}disableVerticalSwipeGesture(){}enableVerticalSwipeGesture(){}disableHorizontalSwipeGesture(){this.bannerPlace.slider.disableHorizontalSwipeGesture()}enableHorizontalSwipeGesture(){this.bannerPlace.slider.enableHorizontalSwipeGesture()}async getCardLocalData(){const e=this.narrativeDataCache.get(`banner_${this.banner.id}_data_${this.storyManager.rootStore.sessionStore.userId}`);return e?JSON.parse(e):{}}setCardLocalData(e,t){const r=JSON.stringify(e);this.narrativeDataCache.set(`banner_${this.banner.id}_data_${this.storyManager.rootStore.sessionStore.userId}`,r),this.banner.context.updateNarrativeSavedData(r),t&&this.banner.updateUserData(r).catch(console.error)}getCardServerData(e){var t;return null!==(t=this.banner.context.widgetsData._narrative_saved_data)&&void 0!==t?t:null}getSlideDuration(e,t){var r,n;return null!==(n=null===(r=this.banner.context.widgetsData._narrative_slides_duration)||void 0===r?void 0:r[t])&&void 0!==n?n:null}pauseUI(){this.banner.pause()}resumeUI(){this.banner.resume()}showCardTextInput(e,t){}setCardSessionValue(e,t){this.sessionNarrativeDataCache.set(e,t)}getCardSessionValue(e){return this.sessionNarrativeDataCache.get(e)}getWidgetsSharedData(e,t){const r=this.banner.context.widgetsData;switch(t){case"rangeSlider":return r._narrative_range_slider_data;case"poll":return r._narrative_poll_data;case"vote":return r._narrative_vote_data}return null}async sendApiRequest(e,t,r,n,i,a){var s,o,l;try{const a=await this.storyManager.httpClient.request({url:e,method:t,params:null!=r?r:{},headers:null!=n?n:{},data:null!=i?i:{}});return{status:a.status,headers:a.headers,data:a.data}}catch(e){if(e instanceof Error&&"IasNetworkError"===e.name)return{status:null!==(s=e.networkStatus)&&void 0!==s?s:400,headers:null===(o=e.response)||void 0===o?void 0:o.headers,data:null===(l=e.response)||void 0===l?void 0:l.data}}}share(e,t){}shareSlideScreenshot(e,t,r){}showLayer(e){this.banner.showLayerByIndex(e)}showCardSlide(e){this.bannerPlace.slider.slideTo(e)}cardShowNext(){this.bannerPlace.slider.toNextSlide()}showNextSlide(){this.bannerPlace.slider.toNextSlide()}sendStatisticEvent(e,t,r,n){this.bannerStatisticService.sendWidgetEvent(this.banner.id,{iterationId:this.banner.iterationId,type:e,slideIndex:this.banner.activeSlideIndex,slideTotal:this.banner.slides.length,durationMs:this.banner.durationMs,widgetPayload:t}),this.bannerPlace.emit(ot.name,new ot({id:this.banner.id,bannerPlace:this.bannerPlace.id,widgetEventName:e,widgetData:null!=r?r:{}}).payload),this.storyManager.emit("widgetEvent",{name:e,data:r})}async resetCard(e){this.updateCardServerDataLocally({}),this.setCardLocalData({},!0),this.showCardSlide(0),this.showLayer(0)}getCardFonts(){var e,t;return null!==(t=null===(e=this.storyManager.rootStore.sessionStore.session)||void 0===e?void 0:e.fontsResources)&&void 0!==t?t:[]}showToast(e){this.banner.showToast({content:e})}closeCard(e){}openStory(e,t){new nt(this.storyManager,this.bannerPlace,this.banner).handle({storyId:e,slideIndex:t})}openGame(e){new De(this.storyManager,this.bannerPlace,this.banner).handle({gameInstanceId:e})}writeToClipboard(e){(new it).copy(e.textValue)}openUrl(e){"swipeUpItems"!==e.type&&new rt(this.storyManager,this.banner).handle({elementId:e.elementId,linkTarget:e.link.target})}}var ht;!function(e){e.Top="top",e.Bottom="bottom"}(ht||(ht={}));const ut=ht.Bottom;class pt{constructor(e){Object.defineProperty(this,"options",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"timeoutId",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"duration",{enumerable:!0,configurable:!0,writable:!0,value:3e3}),Object.defineProperty(this,"content",{enumerable:!0,configurable:!0,writable:!0,value:""}),Object.defineProperty(this,"position",{enumerable:!0,configurable:!0,writable:!0,value:ut}),Object.defineProperty(this,"mountPoint",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"toastContainer",{enumerable:!0,configurable:!0,writable:!0,value:null}),this.initializeOptions(e),this.mountPoint=e.mountPoint}show(e){return this.content=e,this.destroy(),this.createAndShowToast(),!0}hide(){return!!this.toastContainer&&(clearTimeout(this.timeoutId),this.toastContainer.className+=" toast_fadeout",this.addAnimationEndListeners(this.toastContainer,(()=>{var e,t;null===(t=null===(e=this.toastContainer)||void 0===e?void 0:e.parentNode)||void 0===t||t.removeChild(this.toastContainer),this.toastContainer=null})),!0)}destroy(){var e;this.toastContainer&&(clearTimeout(this.timeoutId),null===(e=this.toastContainer.parentNode)||void 0===e||e.removeChild(this.toastContainer),this.toastContainer=null)}initializeOptions(e){if(e.duration&&(this.duration="string"==typeof e.duration?parseFloat(e.duration):e.duration),e.position){const t=e.position.toLowerCase();this.position="top"===t||"bottom"===t?t:ut}}createAndShowToast(){const e=this.createToastContainer(),t=this.createToastElement(),r=this.createToastTextElement();t.appendChild(r),e.appendChild(t),this.mountPoint.appendChild(e),this.timeoutId=window.setTimeout((()=>this.hide()),this.duration),this.toastContainer=e}createToastContainer(){const e=document.createElement("div");return e.id="toast_container",e.className="toast_fadein",e.style.zIndex="1130",e}createToastElement(){const e=document.createElement("div");return e.id="toast",e}createToastTextElement(){const e=document.createElement("span");return e.innerHTML=this.content,e}addAnimationEndListeners(e,t){["animationend","webkitAnimationEnd","msAnimationEnd","oAnimationEnd"].forEach((r=>{e.addEventListener(r,t,{once:!0})}))}}const bt=(e=>{var t={};return d.d(t,e),t})({SlideApi:()=>o.SlideApi}),ft=(new Error("timeout while waiting for mutex to become available"),new Error("mutex already locked"),new Error("request for lock canceled"));class mt{constructor(e,t=ft){this._value=e,this._cancelError=t,this._queue=[],this._weightedWaiters=[]}acquire(e=1,t=0){if(e<=0)throw new Error(`invalid weight ${e}: must be positive`);return new Promise(((r,n)=>{const i={resolve:r,reject:n,weight:e,priority:t},a=vt(this._queue,(e=>t<=e.priority));-1===a&&e<=this._value?this._dispatchItem(i):this._queue.splice(a+1,0,i)}))}runExclusive(e){return function(e,t,r,n){return new(r||(r=Promise))((function(i,a){function s(e){try{l(n.next(e))}catch(e){a(e)}}function o(e){try{l(n.throw(e))}catch(e){a(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,o)}l((n=n.apply(e,t||[])).next())}))}(this,arguments,void 0,(function*(e,t=1,r=0){const[n,i]=yield this.acquire(t,r);try{return yield e(n)}finally{i()}}))}waitForUnlock(e=1,t=0){if(e<=0)throw new Error(`invalid weight ${e}: must be positive`);return this._couldLockImmediately(e,t)?Promise.resolve():new Promise((r=>{this._weightedWaiters[e-1]||(this._weightedWaiters[e-1]=[]),function(e,t){const r=vt(e,(e=>t.priority<=e.priority));e.splice(r+1,0,t)}(this._weightedWaiters[e-1],{resolve:r,priority:t})}))}isLocked(){return this._value<=0}getValue(){return this._value}setValue(e){this._value=e,this._dispatchQueue()}release(e=1){if(e<=0)throw new Error(`invalid weight ${e}: must be positive`);this._value+=e,this._dispatchQueue()}cancel(){this._queue.forEach((e=>e.reject(this._cancelError))),this._queue=[]}_dispatchQueue(){for(this._drainUnlockWaiters();this._queue.length>0&&this._queue[0].weight<=this._value;)this._dispatchItem(this._queue.shift()),this._drainUnlockWaiters()}_dispatchItem(e){const t=this._value;this._value-=e.weight,e.resolve([t,this._newReleaser(e.weight)])}_newReleaser(e){let t=!1;return()=>{t||(t=!0,this.release(e))}}_drainUnlockWaiters(){if(0===this._queue.length)for(let e=this._value;e>0;e--){const t=this._weightedWaiters[e-1];t&&(t.forEach((e=>e.resolve())),this._weightedWaiters[e-1]=[])}else{const e=this._queue[0].priority;for(let t=this._value;t>0;t--){const r=this._weightedWaiters[t-1];if(!r)continue;const n=r.findIndex((t=>t.priority<=e));(-1===n?r:r.splice(0,n)).forEach((e=>e.resolve()))}}}_couldLockImmediately(e,t){return(0===this._queue.length||this._queue[0].priority<t)&&e<=this._value}}function vt(e,t){for(let r=e.length-1;r>=0;r--)if(t(e[r]))return r;return-1}class yt{constructor(e){this._semaphore=new mt(1,e)}acquire(){return function(e,t,r,n){return new(r||(r=Promise))((function(i,a){function s(e){try{l(n.next(e))}catch(e){a(e)}}function o(e){try{l(n.throw(e))}catch(e){a(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,o)}l((n=n.apply(e,t||[])).next())}))}(this,arguments,void 0,(function*(e=0){const[,t]=yield this._semaphore.acquire(1,e);return t}))}runExclusive(e,t=0){return this._semaphore.runExclusive((()=>e()),1,t)}isLocked(){return this._semaphore.isLocked()}waitForUnlock(e=0){return this._semaphore.waitForUnlock(1,e)}release(){this._semaphore.isLocked()&&this._semaphore.release()}cancel(){return this._semaphore.cancel()}}class gt{constructor(e,t,r){Object.defineProperty(this,"banner",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"bannerSlide",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"slideApi",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"mutex",{enumerable:!0,configurable:!0,writable:!0,value:new yt}),Object.defineProperty(this,"_inited",{enumerable:!0,configurable:!0,writable:!0,value:!1})}get html(){return this.bannerSlide.html}get state(){return this.slideApi.state}get inited(){return this._inited}get payload(){return this.bannerSlide.payload}notifyTimerEnd(){this.slideApi.slideTimerEnd()}async init(){const e=await this.mutex.acquire();if(this._inited)return;let t=this.banner.needShowLoaderScreen,r=Date.now();const n=setTimeout((()=>{this.banner.showLoaderScreen(),t=!0,r=Date.now()}),500);try{this.banner.id,await this.slideApi.showSlide(this.html),this._inited=!0}catch(e){throw this.handleSlideError(e),e}finally{clearTimeout(n),await this.cleanupLoaderIfNeeded(Date.now()-r,t),e()}}async start(){const e=await this.mutex.acquire();try{this.banner.id,await this.slideApi.slideStart({muted:!0})}catch(e){throw this.handleSlideError(e),e}finally{e()}}async restart(){const e=await this.mutex.acquire();try{this.banner.hideErrorScreen(),this.banner.showLoaderScreen(),await this.slideApi.slideRestart({muted:!0})}catch(e){throw this.handleSlideError(e),e}finally{this.banner.hideLoaderScreen(),e()}}async resume(){const e=await this.mutex.acquire();try{this.banner.id,await this.slideApi.slideAppResume()}catch(e){this.handleSlideError(e)}finally{e()}}async pause(){const e=await this.mutex.acquire();try{this.banner.id,await this.slideApi.slideAppPause()}catch(e){this.handleSlideError(e)}finally{e()}}async pauseByUser(){const e=await this.mutex.acquire();try{this.banner.id,await this.slideApi.slideUserPause()}catch(e){this.handleSlideError(e)}finally{e()}}async resumeByUser(){const e=await this.mutex.acquire();try{this.banner.id,await this.slideApi.slideUserResume()}catch(e){this.handleSlideError(e)}finally{e()}}async stop(e){const t=await this.mutex.acquire();try{this.banner.id,await this.slideApi.slideStop(e)}catch(e){this.handleSlideError(e)}finally{t()}}refreshSizes(){this.slideApi.refreshSizes()}onClick({event:e,currentTarget:t}){if(e.target)try{e.preventDefault(),e.stopPropagation();const r=this.getNavigationDirection(e,t);this.slideApi.slideClickHandler(e.target,r>0?"forward":"backward")}catch(e){console.error(e)}}async destroy(){await this.stop({prepareForRestart:2})}showLayerByIndex(e){this.slideApi.showLayer(e)}handleSlideError(e){console.error(e),this.banner.showErrorScreen()}getNavigationDirection(e,t){const r=this.getClickPosition(e,t),n="ltr"===this.slideApi.layoutDirection?1:-1;return r>=.3?n:-n}getClickPosition(e,t){const r=t.getBoundingClientRect(),n=r.width;if(n<=0)return 0;let i;if(e instanceof MouseEvent)i=e.pageX-r.left;else{if(!(e.touches&&e.touches.length>0))return 0;i=e.touches[0].pageX-r.left}return Math.max(0,Math.min(1,i/n))}delay(e){return new Promise((t=>setTimeout(t,e)))}async cleanupLoaderIfNeeded(e,t){t&&(await this.delay(Math.max(500-e,0)),this.banner.hideLoaderScreen())}}class wt{get html(){return""}get state(){return 0}async init(){}async start(){}async restart(){}async resume(){}async pause(){}async resumeByUser(){}async pauseByUser(){}async stop(e){}onClick({event:e,currentTarget:t}){}async destroy(){}showLayerByIndex(e){}refreshSizes(){}notifyTimerEnd(){}}var St=function(e,t,r){for(var n=arguments.length>2,i=0;i<t.length;i++)r=n?t[i].call(e,r):t[i].call(e);return n?r:void 0},Pt=function(e,t,r,n,i,a){function s(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var o,l=n.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?n.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,n.name):{}),u=!1,p=r.length-1;p>=0;p--){var b={};for(var f in n)b[f]="access"===f?{}:n[f];for(var f in n.access)b.access[f]=n.access[f];b.addInitializer=function(e){if(u)throw new TypeError("Cannot add initializers after decoration has completed");a.push(s(e||null))};var m=(0,r[p])("accessor"===l?{get:h.get,set:h.set}:h[c],b);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw new TypeError("Object expected");(o=s(m.get))&&(h.get=o),(o=s(m.set))&&(h.set=o),(o=s(m.init))&&i.unshift(o)}else(o=s(m))&&("field"===l?i.unshift(o):h[c]=o)}d&&Object.defineProperty(d,n.name,h),u=!0},_t=function(e,t,r,n){if("a"===r&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?n:"a"===r?n.call(e):n?n.value:t.get(e)},xt=function(e,t,r,n,i){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!i)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?i.call(e,r):i?i.value=r:t.set(e,r),r};let Et=(()=>{var e,t,r,n,i,a;let s,o,l,c,d,h,u,p,b,f,m,v,y=[],g=[],w=[],S=[],P=[],_=[],E=[],T=[],O=[],j=[],I=[];return e=class{get _$root(){return _t(this,t,"f")}set _$root(e){xt(this,t,e,"f")}get _needShowErrorScreen(){return _t(this,r,"f")}set _needShowErrorScreen(e){xt(this,r,e,"f")}get _needShowLoaderScreen(){return _t(this,n,"f")}set _needShowLoaderScreen(e){xt(this,n,e,"f")}get _width(){return _t(this,i,"f")}set _width(e){xt(this,i,e,"f")}get _slides(){return _t(this,a,"f")}set _slides(e){xt(this,a,e,"f")}constructor(e,s,o,l,c){Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:(St(this,y),e)}),Object.defineProperty(this,"bannerPlace",{enumerable:!0,configurable:!0,writable:!0,value:s}),Object.defineProperty(this,"banner",{enumerable:!0,configurable:!0,writable:!0,value:o}),Object.defineProperty(this,"bannerStatisticService",{enumerable:!0,configurable:!0,writable:!0,value:l}),Object.defineProperty(this,"bannerStore",{enumerable:!0,configurable:!0,writable:!0,value:c}),t.set(this,St(this,g,null)),r.set(this,(St(this,w),St(this,S,!1))),n.set(this,(St(this,P),St(this,_,!1))),i.set(this,(St(this,E),St(this,T,0))),a.set(this,(St(this,O),St(this,j,[]))),Object.defineProperty(this,"slideApi",{enumerable:!0,configurable:!0,writable:!0,value:(St(this,I),null)}),Object.defineProperty(this,"slideApiImpl",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"locked",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"toast",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"_iterationId",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"_startTime",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"_initPromise",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_initPromiseResolver",{enumerable:!0,configurable:!0,writable:!0,value:()=>{}}),Object.defineProperty(this,"attachRoot",{enumerable:!0,configurable:!0,writable:!0,value:async e=>{this._$root||(this._$root=e,this.slideApi=this.createSlideApi(e),this._slides=[new gt(this,this.banner.slides[0],this.slideApi)],await this.init())}}),Object.defineProperty(this,"handleVisibilityChange",{enumerable:!0,configurable:!0,writable:!0,value:()=>{this.locked||("hidden"===document.visibilityState&&this.pause(),"visible"===document.visibilityState&&this.resume())}}),this.slideApiImpl=new dt(this.storyManager,this.bannerPlace,this,this.bannerStatisticService),this._initPromise=new Promise((e=>{this._initPromiseResolver=e}))}get id(){return this.banner.id}get context(){return this.banner.context}get appearance(){return this.banner.appearance}get contentRatio(){return this.banner.appearance.contentRatio}get name(){return this.banner.name}get dir(){return this.storyManager.config.dir}get slides(){return this._slides}get activeSlideIndex(){return 0}get width(){return this._width}get activeSlide(){var e;return null!==(e=this._slides[this.activeSlideIndex])&&void 0!==e?e:new wt}get needShowErrorScreen(){return this._needShowErrorScreen}get needShowLoaderScreen(){return this._needShowLoaderScreen}get canBeShown(){return Boolean(this._$root)}get iterationId(){return this._iterationId}get durationMs(){return Date.now()-this._startTime}async init(){this.showLoaderScreen(),await this.activeSlide.init(),this._initPromiseResolver()}async start(){if(!this._$root)throw new Error(`[IAS]: Slide API mount point not found for banner with ID ${this.id}`);document.addEventListener("visibilitychange",this.handleVisibilityChange);try{await this.activeSlide.start(),this._startTime=Date.now(),this.markAsOpened(),this.emitShowBannerEvent()}catch(e){this.emitShowBannerFailedEvent(e)}}refreshSizes(){this.activeSlide.refreshSizes()}async restart(){try{await this.activeSlide.restart(),this._startTime=Date.now(),this.markAsOpened(),this.emitShowBannerEvent()}catch(e){this.emitShowBannerFailedEvent(e)}}async resume(){await this.activeSlide.resume()}async pause(){await this.activeSlide.pause()}async resumeByUser(){await this.activeSlide.resumeByUser()}async pauseByUser(){await this.activeSlide.pauseByUser()}async stop(){var e;this.slideApiImpl.clearNarrativeSessionDataCache(),document.removeEventListener("visibilitychange",this.handleVisibilityChange),null===(e=this.toast)||void 0===e||e.destroy(),await this.activeSlide.stop({prepareForRestart:1})}async destroy(){var e,t;document.removeEventListener("visibilitychange",this.handleVisibilityChange);const r=this.activeSlide;this._slides=[],this._$root=null,await r.destroy(),null===(e=this.slideApi)||void 0===e||e.destroy(),null===(t=this.toast)||void 0===t||t.destroy()}showLayerByIndex(e){this.activeSlide.showLayerByIndex(e)}showToast(e){if(!this._$root)return;const t=this._$root;this.toast=new pt(Object.assign({mountPoint:t},e)),this.toast.show(e.content)}detachRoot(){var e;this._$root=null,null===(e=this.slideApi)||void 0===e||e.destroy()}showErrorScreen(){this._needShowErrorScreen=!0}showLoaderScreen(){this._needShowLoaderScreen=!0}hideLoaderScreen(){this._needShowLoaderScreen=!1}hideErrorScreen(){this._needShowErrorScreen=!1}markAsOpened(){this._iterationId=(0,be.v4)(),this.banner.markAsOpened(),this.markWasShown()}waitInit(){return this._initPromise}notifyTimerEnd(){this.activeSlide.notifyTimerEnd()}async markWasShown(){!this.banner.wasShown&&this._iterationId&&(this.banner.markWasShown(),this.bannerStatisticService.sendViewEvent(this.id,{iterationId:this._iterationId,slideIndex:this.activeSlideIndex,slideTotal:this.banner.slides.length}))}async updateUserData(e){return this.bannerStore.updateBannerUserData(this.id,e)}createSlideApi(e){return new bt.SlideApi(this.slideApiImpl,{root:e,slideRatio:this.banner.appearance.contentRatio,isFullscreen:!1,nonce:x(),viewport:window,userResizeHandler:e=>{this._width=e.viewportWidth},VODPlayer:this.storyManager.globalProperties.$videoOnDemand,overlappingActionBarHeight:0})}emitShowBannerEvent(){this.bannerPlace.emit(lt.name,new lt({id:this.id,bannerPlace:this.bannerPlace.id,payload:this.activeSlide.payload}).payload)}emitShowBannerFailedEvent(e){this.bannerPlace.emit(ct.name,new ct({id:this.id,bannerPlace:this.bannerPlace.id,error:e,payload:this.activeSlide.payload}).payload)}},t=new WeakMap,r=new WeakMap,n=new WeakMap,i=new WeakMap,a=new WeakMap,(()=>{const t="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;s=[J.observable],o=[J.observable],l=[J.observable],c=[J.observable],d=[J.observable],h=[J.computed],u=[J.computed],p=[J.computed],b=[J.action],f=[J.action],m=[J.action],v=[J.action],Pt(e,null,s,{kind:"accessor",name:"_$root",static:!1,private:!1,access:{has:e=>"_$root"in e,get:e=>e._$root,set:(e,t)=>{e._$root=t}},metadata:t},g,w),Pt(e,null,o,{kind:"accessor",name:"_needShowErrorScreen",static:!1,private:!1,access:{has:e=>"_needShowErrorScreen"in e,get:e=>e._needShowErrorScreen,set:(e,t)=>{e._needShowErrorScreen=t}},metadata:t},S,P),Pt(e,null,l,{kind:"accessor",name:"_needShowLoaderScreen",static:!1,private:!1,access:{has:e=>"_needShowLoaderScreen"in e,get:e=>e._needShowLoaderScreen,set:(e,t)=>{e._needShowLoaderScreen=t}},metadata:t},_,E),Pt(e,null,c,{kind:"accessor",name:"_width",static:!1,private:!1,access:{has:e=>"_width"in e,get:e=>e._width,set:(e,t)=>{e._width=t}},metadata:t},T,O),Pt(e,null,d,{kind:"accessor",name:"_slides",static:!1,private:!1,access:{has:e=>"_slides"in e,get:e=>e._slides,set:(e,t)=>{e._slides=t}},metadata:t},j,I),Pt(e,null,h,{kind:"getter",name:"activeSlide",static:!1,private:!1,access:{has:e=>"activeSlide"in e,get:e=>e.activeSlide},metadata:t},null,y),Pt(e,null,u,{kind:"getter",name:"needShowLoaderScreen",static:!1,private:!1,access:{has:e=>"needShowLoaderScreen"in e,get:e=>e.needShowLoaderScreen},metadata:t},null,y),Pt(e,null,p,{kind:"getter",name:"canBeShown",static:!1,private:!1,access:{has:e=>"canBeShown"in e,get:e=>e.canBeShown},metadata:t},null,y),Pt(e,null,b,{kind:"method",name:"showErrorScreen",static:!1,private:!1,access:{has:e=>"showErrorScreen"in e,get:e=>e.showErrorScreen},metadata:t},null,y),Pt(e,null,f,{kind:"method",name:"showLoaderScreen",static:!1,private:!1,access:{has:e=>"showLoaderScreen"in e,get:e=>e.showLoaderScreen},metadata:t},null,y),Pt(e,null,m,{kind:"method",name:"hideLoaderScreen",static:!1,private:!1,access:{has:e=>"hideLoaderScreen"in e,get:e=>e.hideLoaderScreen},metadata:t},null,y),Pt(e,null,v,{kind:"method",name:"hideErrorScreen",static:!1,private:!1,access:{has:e=>"hideErrorScreen"in e,get:e=>e.hideErrorScreen},metadata:t},null,y),t&&Object.defineProperty(e,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:t})})(),e})();class Tt{constructor(e,t,r){Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"bannerStore",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"bannerStatisticService",{enumerable:!0,configurable:!0,writable:!0,value:r})}create(e,t){return new Et(this.storyManager,e,t,this.bannerStatisticService,this.bannerStore)}}function Ot(e,t){let r=null;return async function(...t){return r||(r=(async()=>{try{return await e.apply(this,t)}catch(e){throw e}finally{r=null}})(),r)}}class jt extends Error{constructor(e){super(`[IAS]: Banner with ID ${e} not found`),this.name="IasBannerNotFoundError"}}class It extends Error{constructor(e){super(`[IAS]: Banner slot with ID ${e} not found`),this.name="IasBannerPlaceNotFoundError"}}var Lt=function(e,t,r){for(var n=arguments.length>2,i=0;i<t.length;i++)r=n?t[i].call(e,r):t[i].call(e);return n?r:void 0},Ct=function(e,t,r,n,i,a){function s(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var o,l=n.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?n.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,n.name):{}),u=!1,p=r.length-1;p>=0;p--){var b={};for(var f in n)b[f]="access"===f?{}:n[f];for(var f in n.access)b.access[f]=n.access[f];b.addInitializer=function(e){if(u)throw new TypeError("Cannot add initializers after decoration has completed");a.push(s(e||null))};var m=(0,r[p])("accessor"===l?{get:h.get,set:h.set}:h[c],b);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw new TypeError("Object expected");(o=s(m.get))&&(h.get=o),(o=s(m.set))&&(h.set=o),(o=s(m.init))&&i.unshift(o)}else(o=s(m))&&("field"===l?i.unshift(o):h[c]=o)}d&&Object.defineProperty(d,n.name,h),u=!0};let kt=(()=>{var e;let t,r,n,i,a=[];return e=class{constructor(e){Object.defineProperty(this,"httpClient",{enumerable:!0,configurable:!0,writable:!0,value:(Lt(this,a),e)})}async fetchBannerPlaceById(e){const t=await this.httpClient.get(`banner/place/${e.placeId}`,{expand:"banners.slides",tags:e.tags.join(",")});if(t.data)return t.data;throw new It(e.placeId)}async fetchBannerById(e){const t=await this.httpClient.get(`banner/${e}`,{expand:"slides"});if(t.data)return t.data;throw new jt(e)}async fetchContextWithStyles({needFetchStyles:e}){return(await this.httpClient.get("banner/context",{fields:"widgetsData"+(e?",style":"")})).data}async updateUserData(e,t){try{await this.httpClient.request({url:`banner/${e}/data`,method:"put",data:{data:t}})}catch(e){console.error(e)}}},(()=>{const s="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;t=[Ot],r=[Ot],n=[Ot],i=[Ot],Ct(e,null,t,{kind:"method",name:"fetchBannerPlaceById",static:!1,private:!1,access:{has:e=>"fetchBannerPlaceById"in e,get:e=>e.fetchBannerPlaceById},metadata:s},null,a),Ct(e,null,r,{kind:"method",name:"fetchBannerById",static:!1,private:!1,access:{has:e=>"fetchBannerById"in e,get:e=>e.fetchBannerById},metadata:s},null,a),Ct(e,null,n,{kind:"method",name:"fetchContextWithStyles",static:!1,private:!1,access:{has:e=>"fetchContextWithStyles"in e,get:e=>e.fetchContextWithStyles},metadata:s},null,a),Ct(e,null,i,{kind:"method",name:"updateUserData",static:!1,private:!1,access:{has:e=>"updateUserData"in e,get:e=>e.updateUserData},metadata:s},null,a),s&&Object.defineProperty(e,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:s})})(),e})();class At{constructor(e,t){Object.defineProperty(this,"httpClient",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:t})}async sendShowBannerEvent(e){throw new Error("Method not implemented.")}async sendClickOnBannerEvent(e){throw new Error("Method not implemented.")}async sendBannerCTREvent(e){throw new Error("Method not implemented.")}async sendViewEvent(e,t){await this.sendStatisticsEvent(e,t)}async sendWidgetEvent(e,t){await this.sendStatisticsEvent(e,t)}async sendStatisticsEvent(e,t){try{if(this.storyManager.isStatisticsDisabled)return void console.log("[BANNER STATISTICS]",Object.assign({bannerId:e,type:t.type},t.toQueryParams()));await this.httpClient.post(`/banner/${e}/event/${t.type}`,{},t.toQueryParams())}catch(e){console.error(e)}}}var Bt;!function(e){e[e.Base=0]="Base",e[e.Dynamic=1]="Dynamic",e[e.Game=2]="Game",e[e.Story=3]="Story",e[e.IAM=4]="IAM"}(Bt||(Bt={}));var Mt=function(e,t,r,n,i,a){function s(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var o,l=n.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?n.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,n.name):{}),u=!1,p=r.length-1;p>=0;p--){var b={};for(var f in n)b[f]="access"===f?{}:n[f];for(var f in n.access)b.access[f]=n.access[f];b.addInitializer=function(e){if(u)throw new TypeError("Cannot add initializers after decoration has completed");a.push(s(e||null))};var m=(0,r[p])("accessor"===l?{get:h.get,set:h.set}:h[c],b);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw new TypeError("Object expected");(o=s(m.get))&&(h.get=o),(o=s(m.set))&&(h.set=o),(o=s(m.init))&&i.unshift(o)}else(o=s(m))&&("field"===l?i.unshift(o):h[c]=o)}d&&Object.defineProperty(d,n.name,h),u=!0};(()=>{var e;let t,r,n=[];e=class{async fetchBannerPlaceById(e){return{id:"default",appearance:{single_banner_aspect_ratio:2,banners_gap:16,corner_radius:16,loop:!0,autoplay:!0,autoplay_delay:1e3,animation_speed:300},banners:[]}}async fetchContext(){return{style:"",widgetsData:{}}}updateUserData(e,t){throw new Error("Method not implemented.")}fetchBannerById(e){throw new Error("Method not implemented.")}constructor(){!function(e,t,r){for(var n=arguments.length>2,i=0;i<t.length;i++)r=n?t[i].call(e,r):t[i].call(e)}(this,n)}},(()=>{const i="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;t=[Ot],r=[Ot],Mt(e,null,t,{kind:"method",name:"fetchBannerPlaceById",static:!1,private:!1,access:{has:e=>"fetchBannerPlaceById"in e,get:e=>e.fetchBannerPlaceById},metadata:i},null,n),Mt(e,null,r,{kind:"method",name:"fetchContext",static:!1,private:!1,access:{has:e=>"fetchContext"in e,get:e=>e.fetchContext},metadata:i},null,n),i&&Object.defineProperty(e,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:i})})()})();class Rt{constructor(e,t){Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"bannerStore",{enumerable:!0,configurable:!0,writable:!0,value:t})}createBannerPlace(e,t){var r;const n=new At(this.storyManager.httpClient,this.storyManager),i=new Me(n),a=new Tt(this.storyManager,this.bannerStore,i);return new _e(null!==(r=null==t?void 0:t.toString())&&void 0!==r?r:"default",e,i,this.bannerStore,a)}createBannerPreviewPlace(e,t){const r=new At(this.storyManager.httpClient,this.storyManager),n=new Me(r),i=new Tt(this.storyManager,this.bannerStore,n);return new Be(t.toString(),e,this.bannerStore,i)}}class Dt{static toDomain(e,t){return new K({id:e.id,name:e.name,slides:e.slides.map((e=>{var t;return new ie({html:e.html,duration:e.duration,payload:null===(t=e.event_payload)||void 0===t?void 0:t.payload})})),displayFrom:e.display_from,displayTo:e.display_to,appearance:new ee(e.appearance),context:new te(e.id,t),frequencyLimit:e.frequency_limit})}}class Nt{static toDomain(e,t,r){const n=e.banners.map((e=>Dt.toDomain(e,t)));return new se({id:e.id,banners:n,placeholders:r,style:t.style})}}var Wt=function(e,t,r){for(var n=arguments.length>2,i=0;i<t.length;i++)r=n?t[i].call(e,r):t[i].call(e);return n?r:void 0},zt=function(e,t,r,n,i,a){function s(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var o,l=n.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?n.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,n.name):{}),u=!1,p=r.length-1;p>=0;p--){var b={};for(var f in n)b[f]="access"===f?{}:n[f];for(var f in n.access)b.access[f]=n.access[f];b.addInitializer=function(e){if(u)throw new TypeError("Cannot add initializers after decoration has completed");a.push(s(e||null))};var m=(0,r[p])("accessor"===l?{get:h.get,set:h.set}:h[c],b);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw new TypeError("Object expected");(o=s(m.get))&&(h.get=o),(o=s(m.set))&&(h.set=o),(o=s(m.init))&&i.unshift(o)}else(o=s(m))&&("field"===l?i.unshift(o):h[c]=o)}d&&Object.defineProperty(d,n.name,h),u=!0},Ft=function(e,t,r,n){if("a"===r&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?n:"a"===r?n.call(e):n?n.value:t.get(e)},Ut=function(e,t,r,n,i){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!i)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?i.call(e,r):i?i.value=r:t.set(e,r),r};let Vt=(()=>{var e,t,r;let n,i,a,s,o=[],l=[],c=[],d=[],h=[];return e=class{get _bannerPlaces(){return Ft(this,t,"f")}set _bannerPlaces(e){Ut(this,t,e,"f")}get _banners(){return Ft(this,r,"f")}set _banners(e){Ut(this,r,e,"f")}constructor(e,n){Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:(Wt(this,o),e)}),Object.defineProperty(this,"bannerApi",{enumerable:!0,configurable:!0,writable:!0,value:n}),t.set(this,Wt(this,l,J.observable.map())),r.set(this,(Wt(this,c),Wt(this,d,J.observable.map()))),Object.defineProperty(this,"bannerCSS",{enumerable:!0,configurable:!0,writable:!0,value:(Wt(this,h),"")}),(0,J.reaction)((()=>e.rootStore.placeholderStore.placeholders),(e=>{for(const t of this._bannerPlaces.values())t.updatePlaceholders(e)}))}get bannerPlaces(){return Array.from(this._bannerPlaces.values())}async getBannerById(e){if(this._banners.has(e))return this._banners.get(e);await this.storyManager.waitStoryManagerConfig();const t=await this.fetchBannerContext(),r=await this.bannerApi.fetchBannerById(e);return this.addBanner(r,t)}async getBannerPlaceById(e){if(this._bannerPlaces.has(e.placeId))return this._bannerPlaces.get(e.placeId);await this.storyManager.waitStoryManagerConfig();const t=await this.fetchBannerContext(),r=await this.bannerApi.fetchBannerPlaceById({placeId:e.placeId,tags:this.storyManager.config.tags});return this.addBannerPlace(r,t)}clearCache(){this._bannerPlaces=J.observable.map(),this._banners=J.observable.map()}removeBannerPlaceById(e){this._bannerPlaces.delete(e)}async updateBannerUserData(e,t){if(!this.storyManager.isStatisticsDisabled)return this.bannerApi.updateUserData(e,t);console.log("[IAM]: update user data",{bannerId:e,payload:t})}async fetchBannerContext(){await this.storyManager.rootStore.sessionStore.open();const e=await this.bannerApi.fetchContextWithStyles({needFetchStyles:!this.bannerCSS});return this.bannerCSS&&(e.style=this.bannerCSS),e}addBannerPlace(e,t){const r=this.storyManager.rootStore.placeholderStore.placeholders,n=Nt.toDomain(e,t,r);return this._bannerPlaces.set(e.id,n),n}addBanner(e,t){const r=this.storyManager.rootStore.placeholderStore.placeholders,n=Dt.toDomain(e,t);return n.updatePlaceholders(r),this._banners.set(n.id,n),n}},t=new WeakMap,r=new WeakMap,(()=>{const t="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;n=[J.observable],i=[J.observable],a=[J.computed],s=[Ot],zt(e,null,n,{kind:"accessor",name:"_bannerPlaces",static:!1,private:!1,access:{has:e=>"_bannerPlaces"in e,get:e=>e._bannerPlaces,set:(e,t)=>{e._bannerPlaces=t}},metadata:t},l,c),zt(e,null,i,{kind:"accessor",name:"_banners",static:!1,private:!1,access:{has:e=>"_banners"in e,get:e=>e._banners,set:(e,t)=>{e._banners=t}},metadata:t},d,h),zt(e,null,a,{kind:"getter",name:"bannerPlaces",static:!1,private:!1,access:{has:e=>"bannerPlaces"in e,get:e=>e.bannerPlaces},metadata:t},null,o),zt(e,null,s,{kind:"method",name:"getBannerPlaceById",static:!1,private:!1,access:{has:e=>"getBannerPlaceById"in e,get:e=>e.getBannerPlaceById},metadata:t},null,o),t&&Object.defineProperty(e,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:t})})(),e})();class qt{constructor(e){Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"bannerStore",{enumerable:!0,configurable:!0,writable:!0,value:void 0});const t=new kt(e.httpClient);this.bannerStore=new Vt(this.storyManager,t)}}class $t extends Error{constructor(){super("[IAS]: you must create an instance of BannersProvider"),this.name="IasBannersProviderReferenceError"}}class Ht extends Error{constructor(e){super(`[IAS]: Mount point ${e} is not present in DOM at initialization time`),this.name="IasMountPointReferenceError"}}class Gt extends Oe{render(){this.root.render((0,l.jsx)(xe,{bannerPlace:this.bannerPlace}))}}class Xt{constructor(e){Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"bannerPlaces",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"bannerPlaceViewModelFactory",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"rootStore",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"reloadAllBanners",{enumerable:!0,configurable:!0,writable:!0,value:()=>{this.rootStore.bannerStore.clearCache(),this.bannerPlaces.forEach((e=>{e.reload().catch(console.error)}))}}),this.rootStore=new qt(e),this.bannerPlaceViewModelFactory=new Rt(e,this.rootStore.bannerStore),this.storyManager.rootStore.storyManagerConfigStore.waitStoryManagerConfig().then((()=>{this.storyManager.config.on("requestSDKReload",this.reloadAllBanners)}))}addBannerPlace(e){this.bannerPlaces.push(e)}removeBannerPlace(e){const t=this.bannerPlaces.indexOf(e);-1!==t&&this.bannerPlaces.splice(t,1)}clear(){for(const e of this.bannerPlaces)e.destroy();this.bannerPlaces=[]}createBannerPlace(e){return this.bannerPlaceViewModelFactory.createBannerPlace(this,e)}createBannerPreviewPlace(e){return this.bannerPlaceViewModelFactory.createBannerPreviewPlace(this,e)}static create(e){return Xt.instance||(Xt.instance=new Xt(e)),Xt.instance}mountBannerPlace(e,t){const r=document.querySelector(e);if(!r)throw new Ht(e);const n=this.createBannerPlace(null==t?void 0:t.placeId),i=new Oe(r,n,t);return i.render(),i}mountBannerPreviewPlace(e,t){const r=document.querySelector(e);if(!r)throw new Ht(e);const n=this.createBannerPreviewPlace(t.bannerId),i=new Gt(r,n);return i.render(),i}}const Qt=()=>{if(!Xt.instance)throw new $t;return Xt.instance},Yt=Xt;class Jt{constructor(){Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ias-banners"})}install(e){const t=Yt.create(e.INTERNAL_API);e.HOST.prototype.banners=t}uninstall(){}}const Zt=new Jt})();var u=h.RE,p=h.Sr,b=h.YL,f=h.Ay;export{u as IasBannerPlace,p as IasBannerPreview,b as IasBannersPlugin,f as default};
|
|
1
|
+
import*as e from"react/jsx-runtime";import*as t from"react";import*as r from"mobx-react-lite";import*as n from"classnames";import*as i from"mobx";import*as a from"uuid";import*as s from"react-dom/client";import*as o from"@inappstory/slide-api";var l={371:(e,t,r)=>{r.d(t,{A:()=>a});var n=r(935),i=r.n(n)()((function(e){return e[1]}));i.push([e.id,".banner--EtvvP{width:100%;height:100%;position:relative;border-radius:var(--banner-border-radius, 0px);overflow:hidden}.banner-slides--3xhGF{position:relative;width:100%;height:100%;display:block}",""]),i.locals={banner:"banner--EtvvP","banner-slides":"banner-slides--3xhGF"};const a=i},369:(e,t,r)=>{r.d(t,{A:()=>a});var n=r(935),i=r.n(n)()((function(e){return e[1]}));i.push([e.id,".banner-place--6ZUZe{width:100%;height:100%;position:relative}.banner-slider__slider_visible--1nA2b{border:solid 1px green}",""]),i.locals={"banner-place":"banner-place--6ZUZe","banner-slider__slider_visible":"banner-slider__slider_visible--1nA2b"};const a=i},41:(e,t,r)=>{r.d(t,{A:()=>a});var n=r(935),i=r.n(n)()((function(e){return e[1]}));i.push([e.id,".slider--ggy2P{width:100%;height:100%;overflow:hidden;position:relative;justify-content:center;user-select:none}.slider__track--JSOcI{display:flex;transition:transform .3s ease;width:100%;height:100%;will-change:transform}.slider__slide--oGmUT{width:100%;flex-shrink:0;position:relative;display:flex;transform:translateZ(0)}",""]),i.locals={slider:"slider--ggy2P",slider__track:"slider__track--JSOcI",slider__slide:"slider__slide--oGmUT"};const a=i},379:(e,t,r)=>{r.d(t,{A:()=>a});var n=r(935),i=r.n(n)()((function(e){return e[1]}));i.push([e.id,".slider__controls-btn--HubN5{position:absolute;top:50%;z-index:1;width:24px;height:24px;margin-top:-9px;transition:all .2s ease-in-out;cursor:pointer;padding:0;background-color:rgba(0,0,0,0);color:#0c62f3;border:0;outline:0}.slider__controls-btn--prev--kfXCq{left:1.5rem}.slider__controls-btn--next--Jzq3Q{right:1.5rem}.slider__controls-btn--HubN5{transition:opacity .3s ease-in-out}.slider__controls-btn--disabled--m1P4q{opacity:0;pointer-events:none}",""]),i.locals={"slider__controls-btn":"slider__controls-btn--HubN5","slider__controls-btn--prev":"slider__controls-btn--prev--kfXCq","slider__controls-btn--next":"slider__controls-btn--next--Jzq3Q","slider__controls-btn--disabled":"slider__controls-btn--disabled--m1P4q"};const a=i},55:(e,t,r)=>{r.d(t,{A:()=>a});var n=r(935),i=r.n(n)()((function(e){return e[1]}));i.push([e.id,".slider-bullets--XDc5n{position:absolute;z-index:2;bottom:1.5rem;left:50%;display:inline-flex;list-style:none;transform:translate3d(-50%, 0, 0)}.slider-bullets__bullet--83aBh{background-color:var(--ias-banners-pagination-inactive-color, hsla(0, 0%, 100%, 0.5));width:var(--ias-banners-pagination-width, 8px);height:var(--ias-banners-pagination-height, 8px);padding:0;border-radius:50%;border:2px solid rgba(0,0,0,0);cursor:pointer;line-height:0;box-shadow:0 .25em .5em 0 rgba(0,0,0,.1);margin:0 .25em;transition:transform 100ms ease-in;transform:scale(0.8)}.slider-bullets__bullet--active--RDBez{background-color:#0c62f3;transform:scale(1)}",""]),i.locals={"slider-bullets":"slider-bullets--XDc5n","slider-bullets__bullet":"slider-bullets__bullet--83aBh","slider-bullets__bullet--active":"slider-bullets__bullet--active--RDBez"};const a=i},126:(e,t,r)=>{r.d(t,{A:()=>a});var n=r(935),i=r.n(n)()((function(e){return e[1]}));i.push([e.id,".loader--4uMcs{position:absolute;z-index:10001;top:0;bottom:0;left:0;right:0;display:flex;justify-content:center;align-items:center;background:var(--loader-background, black)}.loader--4uMcs .loader__refresh-btn--5nwxY{color:#fff;cursor:pointer;position:absolute;left:50%;top:50%;transform:translate3d(-50%, -50%, 0);pointer-events:auto;padding:20px;width:32px;height:32px;box-sizing:content-box}.loader--4uMcs .loader__spinner--NRm8E{-ms-flex-negative:0;flex-shrink:0;display:inline-block;width:32px;height:32px;border-radius:50%;border:solid 2px var(--loaderBackgroundColor, white);border-color:var(--loaderBackgroundAccentColor, transparent) var(--loaderBackgroundColor, white) var(--loaderBackgroundColor, white) var(--loaderBackgroundColor, white);-webkit-animation:loading-spinner--LnXd0 .6s infinite linear;animation:loading-spinner--LnXd0 .6s infinite linear}@keyframes loading-spinner--LnXd0{from{-webkit-transform:rotate(0deg);transform:rotate(0deg)}to{-webkit-transform:rotate(359deg);transform:rotate(359deg)}}",""]),i.locals={loader:"loader--4uMcs","loader__refresh-btn":"loader__refresh-btn--5nwxY",loader__spinner:"loader__spinner--NRm8E","loading-spinner":"loading-spinner--LnXd0"};const a=i},81:(e,t,r)=>{r.d(t,{A:()=>a});var n=r(935),i=r.n(n)()((function(e){return e[1]}));i.push([e.id,".icon--5RBkn{width:2rem;height:2rem}",""]),i.locals={icon:"icon--5RBkn"};const a=i},935:e=>{e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var r=e(t);return t[2]?"@media ".concat(t[2]," {").concat(r,"}"):r})).join("")},t.i=function(e,r,n){"string"==typeof e&&(e=[[null,e,""]]);var i={};if(n)for(var a=0;a<this.length;a++){var s=this[a][0];null!=s&&(i[s]=!0)}for(var o=0;o<e.length;o++){var l=[].concat(e[o]);n&&i[l[0]]||(r&&(l[2]?l[2]="".concat(r," and ").concat(l[2]):l[2]=r),t.push(l))}},t}},46:e=>{var t,r="object"==typeof Reflect?Reflect:null,n=r&&"function"==typeof r.apply?r.apply:function(e,t,r){return Function.prototype.apply.call(e,t,r)};t=r&&"function"==typeof r.ownKeys?r.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var i=Number.isNaN||function(e){return e!=e};function a(){a.init.call(this)}e.exports=a,e.exports.once=function(e,t){return new Promise((function(r,n){function i(r){e.removeListener(t,a),n(r)}function a(){"function"==typeof e.removeListener&&e.removeListener("error",i),r([].slice.call(arguments))}f(e,t,a,{once:!0}),"error"!==t&&function(e,t,r){"function"==typeof e.on&&f(e,"error",t,{once:!0})}(e,i)}))},a.EventEmitter=a,a.prototype._events=void 0,a.prototype._eventsCount=0,a.prototype._maxListeners=void 0;var s=10;function o(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function l(e){return void 0===e._maxListeners?a.defaultMaxListeners:e._maxListeners}function c(e,t,r,n){var i,a,s,c;if(o(r),void 0===(a=e._events)?(a=e._events=Object.create(null),e._eventsCount=0):(void 0!==a.newListener&&(e.emit("newListener",t,r.listener?r.listener:r),a=e._events),s=a[t]),void 0===s)s=a[t]=r,++e._eventsCount;else if("function"==typeof s?s=a[t]=n?[r,s]:[s,r]:n?s.unshift(r):s.push(r),(i=l(e))>0&&s.length>i&&!s.warned){s.warned=!0;var d=new Error("Possible EventEmitter memory leak detected. "+s.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");d.name="MaxListenersExceededWarning",d.emitter=e,d.type=t,d.count=s.length,c=d,console&&console.warn&&console.warn(c)}return e}function d(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function h(e,t,r){var n={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},i=d.bind(n);return i.listener=r,n.wrapFn=i,i}function u(e,t,r){var n=e._events;if(void 0===n)return[];var i=n[t];return void 0===i?[]:"function"==typeof i?r?[i.listener||i]:[i]:r?function(e){for(var t=new Array(e.length),r=0;r<t.length;++r)t[r]=e[r].listener||e[r];return t}(i):b(i,i.length)}function p(e){var t=this._events;if(void 0!==t){var r=t[e];if("function"==typeof r)return 1;if(void 0!==r)return r.length}return 0}function b(e,t){for(var r=new Array(t),n=0;n<t;++n)r[n]=e[n];return r}function f(e,t,r,n){if("function"==typeof e.on)n.once?e.once(t,r):e.on(t,r);else{if("function"!=typeof e.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof e);e.addEventListener(t,(function i(a){n.once&&e.removeEventListener(t,i),r(a)}))}}Object.defineProperty(a,"defaultMaxListeners",{enumerable:!0,get:function(){return s},set:function(e){if("number"!=typeof e||e<0||i(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");s=e}}),a.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},a.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||i(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this},a.prototype.getMaxListeners=function(){return l(this)},a.prototype.emit=function(e){for(var t=[],r=1;r<arguments.length;r++)t.push(arguments[r]);var i="error"===e,a=this._events;if(void 0!==a)i=i&&void 0===a.error;else if(!i)return!1;if(i){var s;if(t.length>0&&(s=t[0]),s instanceof Error)throw s;var o=new Error("Unhandled error."+(s?" ("+s.message+")":""));throw o.context=s,o}var l=a[e];if(void 0===l)return!1;if("function"==typeof l)n(l,this,t);else{var c=l.length,d=b(l,c);for(r=0;r<c;++r)n(d[r],this,t)}return!0},a.prototype.addListener=function(e,t){return c(this,e,t,!1)},a.prototype.on=a.prototype.addListener,a.prototype.prependListener=function(e,t){return c(this,e,t,!0)},a.prototype.once=function(e,t){return o(t),this.on(e,h(this,e,t)),this},a.prototype.prependOnceListener=function(e,t){return o(t),this.prependListener(e,h(this,e,t)),this},a.prototype.removeListener=function(e,t){var r,n,i,a,s;if(o(t),void 0===(n=this._events))return this;if(void 0===(r=n[e]))return this;if(r===t||r.listener===t)0==--this._eventsCount?this._events=Object.create(null):(delete n[e],n.removeListener&&this.emit("removeListener",e,r.listener||t));else if("function"!=typeof r){for(i=-1,a=r.length-1;a>=0;a--)if(r[a]===t||r[a].listener===t){s=r[a].listener,i=a;break}if(i<0)return this;0===i?r.shift():function(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}(r,i),1===r.length&&(n[e]=r[0]),void 0!==n.removeListener&&this.emit("removeListener",e,s||t)}return this},a.prototype.off=a.prototype.removeListener,a.prototype.removeAllListeners=function(e){var t,r,n;if(void 0===(r=this._events))return this;if(void 0===r.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==r[e]&&(0==--this._eventsCount?this._events=Object.create(null):delete r[e]),this;if(0===arguments.length){var i,a=Object.keys(r);for(n=0;n<a.length;++n)"removeListener"!==(i=a[n])&&this.removeAllListeners(i);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(t=r[e]))this.removeListener(e,t);else if(void 0!==t)for(n=t.length-1;n>=0;n--)this.removeListener(e,t[n]);return this},a.prototype.listeners=function(e){return u(this,e,!0)},a.prototype.rawListeners=function(e){return u(this,e,!1)},a.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):p.call(e,t)},a.prototype.listenerCount=p,a.prototype.eventNames=function(){return this._eventsCount>0?t(this._events):[]}},591:(e,t,r)=>{var n,i=function(){var e={};return function(t){if(void 0===e[t]){var r=document.querySelector(t);if(window.HTMLIFrameElement&&r instanceof window.HTMLIFrameElement)try{r=r.contentDocument.head}catch(e){r=null}e[t]=r}return e[t]}}(),a=[];function s(e){for(var t=-1,r=0;r<a.length;r++)if(a[r].identifier===e){t=r;break}return t}function o(e,t){for(var r={},n=[],i=0;i<e.length;i++){var o=e[i],l=t.base?o[0]+t.base:o[0],c=r[l]||0,d="".concat(l," ").concat(c);r[l]=c+1;var h=s(d),u={css:o[1],media:o[2],sourceMap:o[3]};-1!==h?(a[h].references++,a[h].updater(u)):a.push({identifier:d,updater:f(u,t),references:1}),n.push(d)}return n}function l(e){var t=document.createElement("style"),n=e.attributes||{};if(void 0===n.nonce){var a=r.nc;a&&(n.nonce=a)}if(Object.keys(n).forEach((function(e){t.setAttribute(e,n[e])})),"function"==typeof e.insert)e.insert(t);else{var s=i(e.insert||"head");if(!s)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");s.appendChild(t)}return t}var c,d=(c=[],function(e,t){return c[e]=t,c.filter(Boolean).join("\n")});function h(e,t,r,n){var i=r?"":n.media?"@media ".concat(n.media," {").concat(n.css,"}"):n.css;if(e.styleSheet)e.styleSheet.cssText=d(t,i);else{var a=document.createTextNode(i),s=e.childNodes;s[t]&&e.removeChild(s[t]),s.length?e.insertBefore(a,s[t]):e.appendChild(a)}}function u(e,t,r){var n=r.css,i=r.media,a=r.sourceMap;if(i?e.setAttribute("media",i):e.removeAttribute("media"),a&&"undefined"!=typeof btoa&&(n+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(a))))," */")),e.styleSheet)e.styleSheet.cssText=n;else{for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(document.createTextNode(n))}}var p=null,b=0;function f(e,t){var r,n,i;if(t.singleton){var a=b++;r=p||(p=l(t)),n=h.bind(null,r,a,!1),i=h.bind(null,r,a,!0)}else r=l(t),n=u.bind(null,r,t),i=function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(r)};return n(e),function(t){if(t){if(t.css===e.css&&t.media===e.media&&t.sourceMap===e.sourceMap)return;n(e=t)}else i()}}e.exports=function(e,t){(t=t||{}).singleton||"boolean"==typeof t.singleton||(t.singleton=(void 0===n&&(n=Boolean(window&&document&&document.all&&!window.atob)),n));var r=o(e=e||[],t);return function(e){if(e=e||[],"[object Array]"===Object.prototype.toString.call(e)){for(var n=0;n<r.length;n++){var i=s(r[n]);a[i].references--}for(var l=o(e,t),c=0;c<r.length;c++){var d=s(r[c]);0===a[d].references&&(a[d].updater(),a.splice(d,1))}r=l}}}},968:(e,t,r)=>{const n=document.querySelector("[nonce]");n&&(r.nc=n.nonce||n.getAttribute("nonce"))}},c={};function d(e){var t=c[e];if(void 0!==t)return t.exports;var r=c[e]={id:e,exports:{}};return l[e](r,r.exports,d),r.exports}d.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return d.d(t,{a:t}),t},d.d=(e,t)=>{for(var r in t)d.o(t,r)&&!d.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},d.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),d.nc=void 0;var h={};(()=>{d.d(h,{RE:()=>je,Sr:()=>Ie,YL:()=>Jt,Ay:()=>Zt}),d(968);const l=(e=>{var t={};return d.d(t,e),t})({jsx:()=>e.jsx,jsxs:()=>e.jsxs}),c=(e=>{var t={};return d.d(t,e),t})({useEffect:()=>t.useEffect,useLayoutEffect:()=>t.useLayoutEffect,useRef:()=>t.useRef,useState:()=>t.useState}),u=(e=>{var t={};return d.d(t,e),t})({observer:()=>r.observer});var p=d(591),b=d.n(p),f=d(371);b()(f.A,{insert:"head",singleton:!1});const m=f.A.locals||{};var v=d(126);b()(v.A,{insert:"head",singleton:!1});const y=v.A.locals||{};var g=d(81);b()(g.A,{insert:"head",singleton:!1});const w=g.A.locals||{},S=(e=>{var t={};return d.d(t,e),t})({default:()=>n.default}),P=({onClick:e,className:t})=>(0,l.jsx)("div",{className:(0,S.default)(w.icon,t),onClick:e,children:(0,l.jsx)("svg",{viewBox:"0 0 24 24",children:(0,l.jsx)("path",{fill:"currentColor",d:"M17.65,6.35C16.2,4.9 14.21,4 12,4A8,8 0 0,0 4,12A8,8 0 0,0 12,20C15.73,20 18.84,17.45 19.73,14H17.65C16.83,16.33 14.61,18 12,18A6,6 0 0,1 6,12A6,6 0 0,1 12,6C13.66,6 15.14,6.69 16.22,7.78L13,11H20V4L17.65,6.35Z"})})}),_=(0,u.observer)((e=>{const t=e.needShowErrorScreen,r=e.needShowLoaderScreen;return r||t?(0,l.jsx)("div",{className:(0,S.default)(y.loader),style:{"--loader-background":e.background,"--loaderBackgroundColor":e.color},onClick:e=>{e.preventDefault()},children:t?(0,l.jsx)(P,{className:y["loader__refresh-btn"],onClick:t=>{t.stopPropagation(),e.onReload()}}):r&&(0,l.jsx)("div",{className:y.loader__spinner})}):null})),x=()=>null!==d.nc&&void 0!==d.nc?d.nc:"";class E extends HTMLElement{constructor(){super(...arguments),Object.defineProperty(this,"styleElement",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"banner",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"mountPoint",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"handleClick",{enumerable:!0,configurable:!0,writable:!0,value:e=>{var t;this.shadowRoot&&"true"===this.shadowRoot.host.getAttribute("allow-click")&&(null===(t=this.banner)||void 0===t||t.activeSlide.onClick({event:e,currentTarget:this.shadowRoot.host}))}})}setBanner(e){this.banner=e}setStyle(e){var t;this.styleElement&&this.styleElement.parentNode&&this.styleElement.parentNode.removeChild(this.styleElement);const r=document.createElement("style");r.textContent=e,r.setAttribute("nonce",x()),this.styleElement=r,null===(t=this.shadowRoot)||void 0===t||t.prepend(r)}async init(){this.mountPoint&&this.banner&&(this.mountPoint.addEventListener("click",this.handleClick),await this.banner.attachRoot(this.mountPoint))}destroy(){var e,t;null===(e=this.banner)||void 0===e||e.detachRoot(),null===(t=this.mountPoint)||void 0===t||t.removeEventListener("click",this.handleClick)}connectedCallback(){if(this.shadowRoot)return;const e=this.attachShadow({mode:"open"});this.mountPoint=document.createElement("div"),this.mountPoint.style.height="100%",this.mountPoint.style.width="100%",e.appendChild(this.mountPoint)}disconnectedCallback(){}}function T(e){const t=e.match(/^rgba?\((\d+),\s*(\d+),\s*(\d+)(?:,\s*[\d.]+)?\)$/i);if(t){const[e,r,n,i]=t.map(Number);return(299*r+587*n+114*i)/1e3>128}if(e.startsWith("#")){const t=e.slice(1);let r,n,i;if(3===t.length)r=parseInt(t[0]+t[0],16),n=parseInt(t[1]+t[1],16),i=parseInt(t[2]+t[2],16);else{if(6!==t.length)return!1;r=parseInt(t.slice(0,2),16),n=parseInt(t.slice(2,4),16),i=parseInt(t.slice(4,6),16)}return(299*r+587*n+114*i)/1e3>128}return!0}customElements.get("banner-slides-container")||customElements.define("banner-slides-container",E);const O=(0,u.observer)((e=>{var{banner:t}=e,r=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(n=Object.getOwnPropertySymbols(e);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]])}return r}(e,["banner"]);const n=(0,c.useRef)(null),i=(0,c.useRef)(null),a=t.canBeShown;return(0,c.useLayoutEffect)((()=>{n.current&&n.current.setStyle(t.context.style)}),[t.context.style]),(0,c.useLayoutEffect)((()=>{if(!n.current)return;const e=n.current;return e.setBanner(t),e.init(),()=>{e.destroy()}}),[t]),(0,c.useEffect)((()=>{if(r.isActive&&a)return t.start(),()=>{t.stop()}}),[t,r.isActive,a]),(0,l.jsxs)("div",{className:(0,S.default)(m.banner,"ias-banner",r.className),ref:i,style:{height:t.width/t.contentRatio+"px",opacity:a?1:0,background:t.appearance.background,"--banner-border-radius":`${r.clientAppearance.borderRadius}px`},children:[(0,l.jsx)("banner-slides-container",{class:m["banner-slides"],ref:n,"allow-click":r.allowClick.toString(),dir:t.dir}),(0,l.jsx)(_,{needShowErrorScreen:t.needShowErrorScreen,needShowLoaderScreen:t.needShowLoaderScreen,onReload:async()=>{t.activeSlide.restart()},background:t.appearance.background,color:T(t.appearance.background)?"black":"white"})]})}));var j=d(369);b()(j.A,{insert:"head",singleton:!1});const I=j.A.locals||{},L=e=>((0,c.useEffect)((()=>(e.onLoadStart&&e.bannerPlace.on(ye.LoadStart,e.onLoadStart),e.onLoadEnd&&e.bannerPlace.on(ye.LoadEnd,e.onLoadEnd),e.onLoadError&&e.bannerPlace.on(ye.LoadError,e.onLoadError),e.onActiveIndexChange&&e.bannerPlace.on(ye.ActiveIndexChange,e.onActiveIndexChange),e.onAutoplayTimeLeft&&e.bannerPlace.on(ye.AutoplayTimeLeft,e.onAutoplayTimeLeft),e.onAutoplayTimerTick&&e.bannerPlace.on(ye.AutoplayTimerTick,e.onAutoplayTimerTick),e.onShowBanner&&e.bannerPlace.on(ye.ShowBanner,e.onShowBanner),e.onShowBannerFailed&&e.bannerPlace.on(ye.ShowBannerFailed,e.onShowBannerFailed),e.onBannerWidget&&e.bannerPlace.on(ye.BannerWidget,e.onBannerWidget),()=>{e.onLoadStart&&e.bannerPlace.off(ye.LoadStart,e.onLoadStart),e.onLoadEnd&&e.bannerPlace.off(ye.LoadEnd,e.onLoadEnd),e.onLoadError&&e.bannerPlace.off(ye.LoadError,e.onLoadError),e.onActiveIndexChange&&e.bannerPlace.off(ye.ActiveIndexChange,e.onActiveIndexChange),e.onAutoplayTimeLeft&&e.bannerPlace.off(ye.AutoplayTimeLeft,e.onAutoplayTimeLeft),e.onAutoplayTimerTick&&e.bannerPlace.off(ye.AutoplayTimerTick,e.onAutoplayTimerTick),e.onShowBanner&&e.bannerPlace.off(ye.ShowBanner,e.onShowBanner),e.onShowBannerFailed&&e.bannerPlace.off(ye.ShowBannerFailed,e.onShowBannerFailed),e.onBannerWidget&&e.bannerPlace.off(ye.BannerWidget,e.onBannerWidget)})),[e.bannerPlace,e.onLoadStart,e.onLoadError,e.onLoadEnd,e.onActiveIndexChange,e.onAutoplayTimeLeft,e.onAutoplayTimerTick,e.onShowBanner,e.onShowBannerFailed,e.onBannerWidget]),(0,c.useEffect)((()=>{(async e=>{try{await e.fetchBanners()}catch(e){console.error(e)}})(e.bannerPlace)}),[e.bannerPlace]),e.bannerPlace.banners);class C{constructor(e){Object.defineProperty(this,"slider",{enumerable:!0,configurable:!0,writable:!0,value:e})}isPaused(){return this.slider.autoplay.paused}resume(){this.slider.autoplay.resume()}pause(){this.slider.autoplay.pause()}start(){this.slider.autoplay.start()}setDelay(e){this.slider.autoplay.setDelay(e)}stop(){this.slider.autoplay.stop()}}class k{constructor(e){Object.defineProperty(this,"slider",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"autoplay",{enumerable:!0,configurable:!0,writable:!0,value:new C(this.slider)})}getTotalPages(){return this.slider.totalPages}getActiveIndex(){return this.slider.realIndex}toNextSlide(){this.slider.toNextSlide()}toPrevSlide(){this.slider.toPrevSlide()}slideTo(e,t){this.slider.slideToLoop(e,t)}enableHorizontalSwipeGesture(){this.slider.enableHorizontalSwipeGesture()}disableHorizontalSwipeGesture(){this.slider.disableHorizontalSwipeGesture()}updateSize(){this.slider.updateSize()}}var A=d(55);b()(A.A,{insert:"head",singleton:!1});const B=A.A.locals||{},M=e=>{const[t,r]=(0,c.useState)(-1);return(0,c.useEffect)((()=>{e.activeIndex===t&&r(-1)}),[e.activeIndex,t]),e.totalPages>1&&(0,l.jsx)("div",{className:(0,S.default)(B["slider-bullets"],"ias-banners-bullets"),children:Array.from({length:e.totalPages}).map(((t,n)=>(0,l.jsx)("div",{className:(0,S.default)("ias-banners__bullet",B["slider-bullets__bullet"],{[B["slider-bullets__bullet--active"]]:n===e.activeIndex,"ias-banners__bullet--active":n===e.activeIndex}),onClick:()=>(t=>{r(t),e.onClick(t)})(n)},n)))})};var R=d(41);b()(R.A,{insert:"head",singleton:!1});const D=R.A.locals||{};var N=d(379);b()(N.A,{insert:"head",singleton:!1});const W=N.A.locals||{},z=e=>(0,l.jsxs)("div",{children:[(0,l.jsx)("button",{onClick:e.onPrevClick,className:(0,S.default)("ias-banners__controls-btn","ias-banners__controls-btn--prev",W["slider__controls-btn"],W["slider__controls-btn--prev"],{[W["slider__controls-btn--disabled"]]:e.prevDisabled,"ias-banners__controls-btn--disabled":e.prevDisabled}),children:(0,l.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 24 24",children:(0,l.jsx)("path",{d:"M0 12l10.975 11 2.848-2.828-6.176-6.176H24v-3.992H7.646l6.176-6.176L10.975 1 0 12z",fill:"currentColor"})})}),(0,l.jsx)("button",{onClick:e.onNextClick,className:(0,S.default)("ias-banners__controls-btn","ias-banners__controls-btn--next",W["slider__controls-btn"],W["slider__controls-btn--next"],{[W["slider__controls-btn--disabled"]]:e.nextDisabled,"ias-banners__controls-btn--disabled":e.nextDisabled}),children:(0,l.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 24 24",children:(0,l.jsx)("path",{d:"M13.025 1l-2.847 2.828 6.176 6.176h-16.354v3.992h16.354l-6.176 6.176 2.847 2.828 10.975-11z",fill:"currentColor"})})})]});class F{constructor(e){Object.defineProperty(this,"slider",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"_enabled",{enumerable:!0,configurable:!0,writable:!0,value:!1})}get enabled(){return this._enabled}update(){const e=this.slider.options.loop&&this.canUseLoop();this._enabled?e||(this._enabled=!1,this.destroy()):e&&(this._enabled=!0)}applyLoopFix({targetIndex:e,direction:t}){if(!this.enabled)return!1;const r="next"===t||!t,n="prev"!==t&&t?[]:this.getPrependSlidesIndexes(e),i=r?this.getAppendSlidesIndexes(e):[];return this.moveSlides(n,i),this.adjustPosition(n,i),n.length>0||i.length>0}destroy(){this.resetSlidesOrder()}resetSlidesOrder(){const e=[];this.slider.slides.forEach((t=>{const r=+t.dataset.index;e[r]=t})),e.forEach((e=>{this.slider.track.append(e)}))}canUseLoop(){return!(this.slider.slides.length<this.slider.options.slidesPerView+1&&(console.warn("IAS Banners Loop Warning: The number of slides is not enough for loop mode, it will be disabled or not function properly. You need to add more slides (or make duplicates) or lower the values of slidesPerView parameters"),1))}getPrependSlidesIndexes(e){const t=this.slider.track.children,r=[];if(e<1)for(let n=0;n<1-e;n++){const e=t.length-n-1;r.push(e)}return r}getAppendSlidesIndexes(e){const t=[];if(e+this.slider.options.slidesPerView>this.slider.slides.length-1){const r=Math.max(e-(this.slider.slides.length-2),1);for(let e=0;e<r;e++){const r=e;t.push(r)}}return t}moveSlides(e,t){const r=this.slider.track,n=this.slider.slides.slice();e.forEach((e=>{r.prepend(n[e])})),t.forEach((e=>{r.append(n[e])}))}adjustPosition(e,t){e.length>0?this.slider.slideTo(this.slider.activeIndex+e.length,0):t.length>0&&this.slider.slideTo(this.slider.activeIndex-t.length,0)}}var U;!function(e){e.TouchStart="touchStart",e.TouchMove="touchMove",e.TouchEnd="touchEnd",e.ReachStart="reachStart",e.ReachEnd="reachEnd",e.ActiveIndexChange="activeIndexChange",e.RealIndexChnage="realIndexChange",e.TransitionStart="transitionStart",e.TransitionEnd="transitionend",e.Resize="resize",e.SlidesUpdated="slidesUpdated",e.AutoplayTimeLeft="autoplayTimeLeft",e.AutoplayTimerTick="autoplayTimerTick"}(U||(U={}));class V{constructor(e,t){Object.defineProperty(this,"slider",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"loopModule",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"startX",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"startTranslateX",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"isTouched",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_isMoved",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_enabled",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"startDirection",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"onTouchStart",{enumerable:!0,configurable:!0,writable:!0,value:e=>{!this.slider.animating&&this._enabled&&(e.stopPropagation(),this.startX=e instanceof MouseEvent?e.pageX:e.touches[0].clientX,this.startTranslateX=this.slider.currentTranslateX,this.isTouched=!0,this.setGrabCursor(!1))}}),Object.defineProperty(this,"onTouchMove",{enumerable:!0,configurable:!0,writable:!0,value:e=>{if(!this.isTouched)return;e.stopPropagation();let t=(e instanceof MouseEvent?e.pageX:e.touches[0].clientX)-this.startX;if(t*=1,!(Math.abs(t)>20||this._isMoved))return;this.setGrabCursor(!0),this._isMoved||(this.slider.emit(U.TouchStart),this.slider.autoplay.pause(),this.slider.lockActiveIndex(),this.startDirection=this.getSwipeDirection(t)),this._isMoved=!0;const r="next"===this.startDirection?20:-20;this.slider.emit(U.TouchMove);let n=this.startTranslateX+t+r;this.applyLoopFix(n),n=this.startTranslateX+t+r,this.setTranslate(n)}}),Object.defineProperty(this,"onTouchEnd",{enumerable:!0,configurable:!0,writable:!0,value:()=>{this.isTouched&&(this.slider.unlockActiveIndex(),this.updateActiveIndex(),this.unsetGrabCursor(),this.isTouched=!1,this._isMoved=!1,this.slider.emit(U.TouchEnd),this.slider.autoplay.resume())}}),this.slider.track.addEventListener("mousedown",this.onTouchStart,{passive:!0}),document.addEventListener("mousemove",this.onTouchMove,{passive:!0}),document.addEventListener("mouseup",this.onTouchEnd),this.slider.track.addEventListener("touchstart",this.onTouchStart,{passive:!0}),document.addEventListener("touchmove",this.onTouchMove,{passive:!0}),document.addEventListener("touchend",this.onTouchEnd)}get isMoved(){return this._isMoved}enableHorizontalSwipeGesture(){this._enabled=!0}disableHorizontalSwipeGesture(){this._enabled=!1}destroy(){this.slider.track.removeEventListener("touchstart",this.onTouchStart),document.removeEventListener("touchmove",this.onTouchMove),document.removeEventListener("touchend",this.onTouchEnd),this.slider.track.removeEventListener("mousedown",this.onTouchStart),document.removeEventListener("mousemove",this.onTouchMove),document.removeEventListener("mouseup",this.onTouchEnd)}setTranslate(e){e=this.applyEdgeResistance(e),this.slider.setTranslate(e)}applyLoopFix(e){if(!this.loopModule.enabled)return;e=-e;const t=this.slider.slideWidth+this.slider.options.spaceBetween,r=this.slider.getMinTranslate(),n=Math.abs(this.slider.getSlideOffset(this.slider.slides.length-this.slider.options.slidesPerView));e<r?this.loopModule.applyLoopFix({targetIndex:0,direction:"prev"})&&(this.startTranslateX-=t):e>n&&this.loopModule.applyLoopFix({targetIndex:this.slider.slides.length-this.slider.options.slidesPerView,direction:"next"})&&(this.startTranslateX+=t)}updateActiveIndex(){var e;if(!this.slider.slides.length)return;const{currentTranslateX:t,slides:r,options:n}=this.slider,i=(null===(e=r[0])||void 0===e?void 0:e.clientWidth)+n.spaceBetween;let a=-Math.round(t/i);const s=this.slider.totalPages-1;a=Math.min(s,Math.max(0,a)),this.slider.slideTo(a)}setGrabCursor(e){this.slider.track.style.cursor="move",this.slider.track.style.cursor=e?"grabbing":"grab"}unsetGrabCursor(){this.slider.track.style.cursor=""}getResistanceCoeff(e){const t=Math.min(Math.abs(e)/(.5*this.slider.slides[0].clientWidth),1);return.3+.7*Math.exp(3*-t)}applyEdgeResistance(e){if(this.loopModule.enabled)return e;e=-e;const t=this.slider.getMinTranslate(),r=-this.slider.getMaxTranslate();if(e>r){const t=e-r;e=r+t*this.getResistanceCoeff(t)}else if(e<t){const r=t-e;e=t-r*this.getResistanceCoeff(r)}return-e}getSwipeDirection(e){return e>0?"prev":"next"}}var q,$=d(46);!function(e){e.Start="start",e.Stop="stop",e.Pause="pause",e.Resume="resume",e.Progress="progress",e.Complete="complete"}(q||(q={}));class H extends $.EventEmitter{constructor(){super(...arguments),Object.defineProperty(this,"timerId",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"currentProgress",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"progressBeforePause",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"timerPaused",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"timeout",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"isCompleted",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"enabled",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"rafId",{enumerable:!0,configurable:!0,writable:!0,value:0})}get started(){return!this.isCompleted}get paused(){return this.timerPaused}setTimer(e){0!==e?(this.timerId=setTimeout((()=>this.complete({})),e),this.currentProgress=0,this.runTimerTicks(e)):this.forceEnd()}start(e){this.timerPaused||(this.stop(),this.progressBeforePause=0,this.timeout=e,this.enabled&&(this.isCompleted=!1,this.emit(q.Start),this.setTimer(e)))}restart(){this.stop(),this.start(this.timeout)}stop(){this.isCompleted||(this.clearTimer(),this.emit(q.Stop),this.isCompleted=!0,this.timerPaused=!1)}pause(){this.isCompleted||(this.timerPaused=!0,this.clearTimer(),this.progressBeforePause=this.currentProgress,this.emit(q.Pause))}resume(){if(!this.timerPaused)return;this.timerPaused=!1;const e=1-this.progressBeforePause,t=this.timeout*e;this.setTimer(t),this.emit(q.Resume)}forceEnd(){this.complete({forceEnd:!0})}disable(){this.enabled=!1,this.stop()}enable(){this.enabled=!0,this.start(this.timeout)}complete({forceEnd:e=!1}){this.isCompleted=!0,this.progressBeforePause=0,this.clearTimer(),this.emit(q.Complete,{forceEnd:e})}clearTimer(){cancelAnimationFrame(this.rafId),null!==this.timerId&&(clearTimeout(this.timerId),this.timerId=null)}updateProgress(e){const t=1-this.progressBeforePause;this.currentProgress=this.progressBeforePause+e*t;const r=100*this.currentProgress;this.emit(q.Progress,{percents:r,totalTime:this.timeout,currentTime:this.currentProgress*this.timeout})}runTimerTicks(e){const t=performance.now(),r=n=>{let i=(n-t)/e;i>1&&(i=1);const a=i;this.updateProgress(a),i<1&&(this.rafId=requestAnimationFrame(r))};this.rafId=requestAnimationFrame(r)}}class G{constructor(e,t){Object.defineProperty(this,"slider",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"loopModule",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"timer",{enumerable:!0,configurable:!0,writable:!0,value:new H}),Object.defineProperty(this,"delay",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"handleTimerComplete",{enumerable:!0,configurable:!0,writable:!0,value:({forceEnd:e})=>{e||this.slider.emit(U.AutoplayTimeLeft)}}),Object.defineProperty(this,"handleTimerProgress",{enumerable:!0,configurable:!0,writable:!0,value:e=>{this.slider.emit(U.AutoplayTimerTick,{currentTime:e.currentTime,totalTime:e.totalTime,percents:e.percents})}}),this.timer.on(q.Complete,this.handleTimerComplete),this.timer.on(q.Progress,this.handleTimerProgress)}get paused(){return this.timer.paused}start(){this.slider.options.autoplay&&(this.stop(),this.timer.start(this.delay))}stop(){this.timer.stop()}pause(){this.slider.options.autoplay&&this.timer.pause()}resume(){this.slider.options.autoplay&&this.timer.resume()}setDelay(e){this.delay=e}destroy(){this.timer.off(q.Complete,this.handleTimerComplete),this.timer.off(q.Progress,this.handleTimerProgress),this.stop()}}class X extends $.EventEmitter{constructor(e,t={}){super(),Object.defineProperty(this,"track",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"container",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"options",{enumerable:!0,configurable:!0,writable:!0,value:{autoplay:!1,speed:300,delay:3e3,loop:!1,slidesPerView:1,spaceBetween:0,initialSlide:0,updateOnWindowResize:!0}}),Object.defineProperty(this,"isAnimating",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_activeIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"_realIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"_currentTranslateX",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"_reachEnd",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"_reachStart",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"loopModule",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"touchModule",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_slideWidth",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"autoplay",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_activeIndexLocked",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"handleResize",{enumerable:!0,configurable:!0,writable:!0,value:()=>{this.updateSize(),this.emit(U.Resize)}}),this.track=e,this.container=e.parentElement,this.loopModule=new F(this),this.touchModule=new V(this,this.loopModule),this.autoplay=new G(this,this.loopModule),this.options.updateOnWindowResize&&window.addEventListener("resize",this.handleResize),this.collectSlides(),this.update(t)}get activeIndex(){return this._activeIndex}get realIndex(){return this._realIndex}get reachEnd(){return this._reachEnd}get reachStart(){return this._reachStart}get slidesEl(){return this.track}get slides(){return Array.from(this.track.children)}get allSlides(){return this.slides}get animating(){return this.isAnimating}get currentTranslateX(){return this._currentTranslateX}get isMoved(){return this.touchModule.isMoved}get slideWidth(){return this._slideWidth}get totalPages(){return this.loopModule.enabled?this.slides.length:Math.max(this.slides.length-this.options.slidesPerView+1,1)}async slideToLoop(e,t=this.options.speed){if(!this.loopModule.enabled)return this.slideTo(e,t);if(this.isAnimating)return;const r=this.getPhysicalIndexByRealIndex(e),n=this.slides.length-r<this.options.slidesPerView,i=r-this._activeIndex-1<this.options.slidesPerView?"next":"prev";if(n){const e="next"===i?r+1:r-this.slides.length+1;this.loopModule.applyLoopFix({targetIndex:e,direction:i})}const a=this.getPhysicalIndexByRealIndex(e);requestAnimationFrame((()=>this.slideTo(a)))}async slideTo(e,t=this.options.speed){e=this.clamp(e,0,this.totalPages-1),this.isAnimating||(this.isAnimating=!0,await this.performTranslateToSlide(e,t),this._activeIndexLocked||this.updateIndexes(e),this.isAnimating=!1)}lockActiveIndex(){this._activeIndexLocked=!0}unlockActiveIndex(){this._activeIndexLocked=!1}toNextSlide(){this.isAnimating||(this.loopModule.enabled?this.toNextSlideByLoop():this.slideTo(this.normalizeIndex(this._realIndex+1)))}toPrevSlide(){this.isAnimating||(this.loopModule.enabled?this.toPrevSlideByLoop():this.slideTo(this.normalizeIndex(this._realIndex-1)))}update(e){this.options=this.normalizeOptions(Object.assign(Object.assign({},this.options),e)),this.setupTrackStyles();const t=this.slideWidth;this.calculateSlideWidths(),t!==this.slideWidth&&this.emit(U.SlidesUpdated),this.loopModule.update(),this.slideTo(this._activeIndex,0),this.testAttraction()}destroy(){window.removeEventListener("resize",this.handleResize),this.autoplay.destroy(),this.touchModule.destroy(),this.track.removeAttribute("style"),this._activeIndex=0,this._activeIndexLocked=!1,this.isAnimating=!1}isSlideVisible(e){const t=this.getPhysicalIndexByRealIndex(e);return t>=this._activeIndex&&t<this._activeIndex+this.options.slidesPerView}getVisibleSlideIndexes(){return this.slides.slice(this._activeIndex,this._activeIndex+this.options.slidesPerView).map((e=>+e.dataset.index))}getPhysicalIndexByRealIndex(e){const t=this.normalizeIndex(e);return this.slides.findIndex((e=>e.dataset.index===t.toString()))}getMinTranslate(){return 0}getMaxTranslate(){return this.getSlideOffset(this.totalPages-1)}setTranslate(e){this.track.style.transform=`translate3d(${e}px, 0px, 0px)`,this._currentTranslateX=e,this.testAttraction()}enableHorizontalSwipeGesture(){this.touchModule.enableHorizontalSwipeGesture()}disableHorizontalSwipeGesture(){this.touchModule.disableHorizontalSwipeGesture()}getSlideOffset(e){return this.slides.length?-e*(this.slides[0].clientWidth+this.options.spaceBetween):0}updateSize(){const e=this.slideWidth;this.calculateSlideWidths(),e!==this.slideWidth&&this.emit(U.SlidesUpdated),this.slideTo(this._activeIndex,0)}getTrackWidth(){return this.track.clientWidth-this.options.spaceBetween*(this.options.slidesPerView-1)}toNextSlideByLoop(){this.isAnimating||(this.loopModule.applyLoopFix({targetIndex:this._activeIndex,direction:"next"}),requestAnimationFrame((()=>this.slideTo(this._activeIndex+1))))}toPrevSlideByLoop(){this.isAnimating||(this.loopModule.applyLoopFix({targetIndex:this._activeIndex,direction:"prev"}),requestAnimationFrame((()=>this.slideTo(this._activeIndex-1))))}updateIndexes(e){if(!this.slides.length)return;const t=+this.slides[e].dataset.index,r=this._realIndex,n=this._activeIndex;this._realIndex=t,this._activeIndex=e,r!==t&&this.emit(U.RealIndexChnage,t),n!==e&&this.emit(U.ActiveIndexChange,e)}setupTrackStyles(){Object.assign(this.track.style,{display:"flex",transition:`transform ${this.options.speed}ms ease`,gap:`${this.options.spaceBetween}px`}),this.container.style.overflow="hidden"}collectSlides(){this.slides.forEach(((e,t)=>{e.dataset.index=t.toString()}))}calculateSlideWidths(){this._slideWidth=Math.ceil(this.getTrackWidth()/this.options.slidesPerView),this.slides.forEach((e=>{e.style.width=`${this._slideWidth}px`}))}translateSlidesTrack(e,t){this.track.style.transitionDuration=`${t}ms`,this.setTranslate(this.getSlideOffset(e))}async performTranslateToSlide(e,t){if(0===t)this.translateSlidesTrack(e,0);else{if(this._activeIndex===e&&!this.touchModule.isMoved)return;this.translateSlidesTrack(e,t),this.emit(U.TransitionStart),await this.waitTransitionEnd(),this.emit(U.TransitionEnd)}}waitTransitionEnd(){return new Promise((e=>{this.track.addEventListener("transitionend",(t=>{"transform"===t.propertyName&&(this.track.style.transitionDuration="0ms",e())}),{once:!0})}))}testAttraction(){const e=this.getMinTranslate(),t=this.getMaxTranslate();let r=!this.loopModule.enabled&&this._currentTranslateX>=e,n=!this.loopModule.enabled&&this._currentTranslateX<=t;this.options.slidesPerView===this.slides.length&&(r=!0,n=!0),r!==this._reachStart&&(this._reachStart=r,this.emit(U.ReachStart,r)),n!==this._reachEnd&&(this._reachEnd=n,this.emit(U.ReachEnd,n))}normalizeOptions(e){var t,r,n,i,a,s,o,l;return{autoplay:null!==(t=e.autoplay)&&void 0!==t?t:this.options.autoplay,speed:null!==(r=e.speed)&&void 0!==r?r:this.options.speed,delay:null!==(n=e.delay)&&void 0!==n?n:this.options.delay,loop:null!==(i=e.loop)&&void 0!==i?i:this.options.loop,slidesPerView:Math.max(Math.min(this.track.children.length,null!==(a=e.slidesPerView)&&void 0!==a?a:this.options.slidesPerView),0),spaceBetween:null!==(s=e.spaceBetween)&&void 0!==s?s:this.options.spaceBetween,initialSlide:null!==(o=e.initialSlide)&&void 0!==o?o:this.options.initialSlide,updateOnWindowResize:null!==(l=e.updateOnWindowResize)&&void 0!==l?l:this.options.updateOnWindowResize}}normalizeIndex(e){const t=this.slides.length;return(e%t+t)%t}clamp(e,t,r){return Math.max(t,Math.min(e,r))}}const Q=(0,u.observer)((e=>{const[t,r]=(0,c.useState)(null),n=(0,c.useRef)(null);return(0,c.useEffect)((()=>{if(!n.current||!e.slidesCount)return;const t=new X(n.current,{autoplay:e.autoplay,speed:e.speed,loop:e.loop,slidesPerView:e.slidesPerView,spaceBetween:e.spaceBetween});return e.onInit(t),r(t),()=>{null==t||t.destroy()}}),[e.slidesCount]),(0,c.useEffect)((()=>{t&&t.update({autoplay:e.autoplay,speed:e.speed,loop:e.loop,slidesPerView:e.slidesPerView,spaceBetween:e.spaceBetween})}),[t,e.autoplay,e.speed,e.loop,e.slidesPerView,e.spaceBetween,e.slidesCount]),(0,l.jsxs)("div",{className:D.slider,style:{"--slider-border-radius":`${e.borderRadius}px`},children:[(0,l.jsx)("div",{ref:n,className:D.slider__track,children:e.children}),t&&e.pagination.enabled&&(0,l.jsx)(M,{totalPages:t.totalPages,activeIndex:t.realIndex,onClick:r=>{e.loop?t.slideToLoop(r):t.slideTo(r)}}),t&&e.navigation.enabled&&(0,l.jsx)(z,{onPrevClick:()=>{t.toPrevSlide()},onNextClick:()=>{t.toNextSlide()},nextDisabled:t.reachEnd,prevDisabled:t.reachStart})]})})),Y=e=>(0,l.jsx)("div",{className:(0,S.default)(D.slider__slide,e.className),style:e.style,children:e.children}),J=(e=>{var t={};return d.d(t,e),t})({action:()=>i.action,computed:()=>i.computed,observable:()=>i.observable,reaction:()=>i.reaction});var Z=function(e,t,r){for(var n=arguments.length>2,i=0;i<t.length;i++)r=n?t[i].call(e,r):t[i].call(e);return n?r:void 0};let K=(()=>{var e,t;let r,n=[],i=[];return e=class{get _context(){return function(e,t,r,n){if("a"===r&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?n:"a"===r?n.call(e):n?n.value:t.get(e)}(this,t,"f")}set _context(e){!function(e,t,r,n,i){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!i)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");"a"===n?i.call(e,r):i?i.value=r:t.set(e,r)}(this,t,e,"f")}constructor(e){t.set(this,Z(this,n,void 0)),Object.defineProperty(this,"id",{enumerable:!0,configurable:!0,writable:!0,value:Z(this,i)}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"displayFrom",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"displayTo",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"appearance",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"slides",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_wasShown",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_frequencyLimit",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"_openTime",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"_isOnceOpened",{enumerable:!0,configurable:!0,writable:!0,value:!1}),this.id=e.id,this.name=e.name,this.displayFrom=e.displayFrom,this.displayTo=e.displayTo,this.slides=e.slides,this._context=e.context,this.appearance=e.appearance}get context(){return this._context}get withinDisplayTimeRange(){return(!this.displayFrom||Date.now()>=this.displayFrom)&&(!this.displayTo||Date.now()<=this.displayTo)}get wasShown(){return this._wasShown}get frequencyLimitTimeExceeded(){return null===this._frequencyLimit?this._isOnceOpened:0!==this._frequencyLimit&&Math.trunc(this.timeSinceLastShow/1e3)<=this._frequencyLimit}get timeSinceLastShow(){return Date.now()-this._openTime}get openTime(){return this._openTime}updatePlaceholders(e){for(const t of this.slides)t.updatePlaceholders(e)}markWasShown(){this._wasShown=!0}markAsOpened(){this._openTime=Date.now(),this._isOnceOpened=!0}},t=new WeakMap,(()=>{const t="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;r=[J.observable],function(e,t,r,n,i,a){function s(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var o,l=n.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?n.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,n.name):{}),u=!1,p=r.length-1;p>=0;p--){var b={};for(var f in n)b[f]="access"===f?{}:n[f];for(var f in n.access)b.access[f]=n.access[f];b.addInitializer=function(e){if(u)throw new TypeError("Cannot add initializers after decoration has completed");a.push(s(e||null))};var m=(0,r[p])("accessor"===l?{get:h.get,set:h.set}:h[c],b);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw new TypeError("Object expected");(o=s(m.get))&&(h.get=o),(o=s(m.set))&&(h.set=o),(o=s(m.init))&&i.unshift(o)}else(o=s(m))&&("field"===l?i.unshift(o):h[c]=o)}d&&Object.defineProperty(d,n.name,h),u=!0}(e,null,r,{kind:"accessor",name:"_context",static:!1,private:!1,access:{has:e=>"_context"in e,get:e=>e._context,set:(e,t)=>{e._context=t}},metadata:t},n,i),t&&Object.defineProperty(e,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:t})})(),e})();class ee{constructor(e){var t;Object.defineProperty(this,"contentRatio",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"background",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.contentRatio=null!==(t=e.content_ratio)&&void 0!==t?t:1,this.background=this.mapBackgroundDtoToModel(e.background)}mapBackgroundDtoToModel(e){if(!e||0===e.alpha)return"transparent";if("solid"in e)return this.applyAlphaToColor(e.solid,e.alpha);if("linear_gradient"in e){const{angle:t,color_step_list:r}=e.linear_gradient;return`linear-gradient(${t}deg, ${r.map((t=>`${this.applyAlphaToColor(t.color,e.alpha)} ${t.position}%`)).join(", ")})`}return"transparent"}applyAlphaToColor(e,t){if(e.startsWith("#")){const r=e.slice(1),n=3===r.length;return`rgba(${parseInt(n?r[0]+r[0]:r.slice(0,2),16)}, ${parseInt(n?r[1]+r[1]:r.slice(2,4),16)}, ${parseInt(n?r[2]+r[2]:r.slice(4,6),16)}, ${t})`}return e}}class te{constructor(e,t){Object.defineProperty(this,"widgetsData",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"style",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.style=t.style,this.widgetsData=this.mapBannerContextDto(e,t)}mapBannerContextDto(e,t){var r;const n={},i=null!==(r=t.widgetsData)&&void 0!==r?r:{};for(const t in i)Array.isArray(i[t])||(n[t]=i[t][e]);return n}updateNarrativeSavedData(e){this.widgetsData._narrative_saved_data=e}}function re(e,t,r){return String(e).replace(new RegExp(function(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(t),"g"),(()=>r))}var ne=function(e,t,r){for(var n=arguments.length>2,i=0;i<t.length;i++)r=n?t[i].call(e,r):t[i].call(e);return n?r:void 0};let ie=(()=>{var e,t;let r,n=[],i=[];return e=class{get _html(){return function(e,t,r,n){if("a"===r&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?n:"a"===r?n.call(e):n?n.value:t.get(e)}(this,t,"f")}set _html(e){!function(e,t,r,n,i){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!i)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");"a"===n?i.call(e,r):i?i.value=r:t.set(e,r)}(this,t,e,"f")}get html(){return this._html}get payload(){return this._payload}constructor(e){t.set(this,ne(this,n,void 0)),Object.defineProperty(this,"_payload",{enumerable:!0,configurable:!0,writable:!0,value:ne(this,i)}),this._html=this.replaceSlideNonce(e.html),this._payload=e.payload}updatePlaceholders(e){let t=this._html;for(const r of e)t=re(t,`%${r.key}%`,r.value);this._html=t}replaceSlideNonce(e){var t;return re(e,"{{nonce}}",null!==(t=x())&&void 0!==t?t:"")}},t=new WeakMap,(()=>{const t="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;r=[J.observable],function(e,t,r,n,i,a){function s(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var o,l=n.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?n.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,n.name):{}),u=!1,p=r.length-1;p>=0;p--){var b={};for(var f in n)b[f]="access"===f?{}:n[f];for(var f in n.access)b.access[f]=n.access[f];b.addInitializer=function(e){if(u)throw new TypeError("Cannot add initializers after decoration has completed");a.push(s(e||null))};var m=(0,r[p])("accessor"===l?{get:h.get,set:h.set}:h[c],b);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw new TypeError("Object expected");(o=s(m.get))&&(h.get=o),(o=s(m.set))&&(h.set=o),(o=s(m.init))&&i.unshift(o)}else(o=s(m))&&("field"===l?i.unshift(o):h[c]=o)}d&&Object.defineProperty(d,n.name,h),u=!0}(e,null,r,{kind:"accessor",name:"_html",static:!1,private:!1,access:{has:e=>"_html"in e,get:e=>e._html,set:(e,t)=>{e._html=t}},metadata:t},n,i),t&&Object.defineProperty(e,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:t})})(),e})();var ae=function(e,t,r){for(var n=arguments.length>2,i=0;i<t.length;i++)r=n?t[i].call(e,r):t[i].call(e);return n?r:void 0};let se=(()=>{var e,t;let r,n=[],i=[];return e=class{get _banners(){return function(e,t,r,n){if("a"===r&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?n:"a"===r?n.call(e):n?n.value:t.get(e)}(this,t,"f")}set _banners(e){!function(e,t,r,n,i){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!i)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");"a"===n?i.call(e,r):i?i.value=r:t.set(e,r)}(this,t,e,"f")}constructor(e){Object.defineProperty(this,"id",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"style",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),t.set(this,ae(this,n,[])),ae(this,i),this.id=e.id,this._banners=e.banners,this.style=e.style,this.updatePlaceholders(e.placeholders)}get banners(){return this._banners}updatePlaceholders(e){for(const t of this._banners)t.updatePlaceholders(e)}},t=new WeakMap,(()=>{const t="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;r=[J.observable],function(e,t,r,n,i,a){function s(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var o,l=n.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?n.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,n.name):{}),u=!1,p=r.length-1;p>=0;p--){var b={};for(var f in n)b[f]="access"===f?{}:n[f];for(var f in n.access)b.access[f]=n.access[f];b.addInitializer=function(e){if(u)throw new TypeError("Cannot add initializers after decoration has completed");a.push(s(e||null))};var m=(0,r[p])("accessor"===l?{get:h.get,set:h.set}:h[c],b);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw new TypeError("Object expected");(o=s(m.get))&&(h.get=o),(o=s(m.set))&&(h.set=o),(o=s(m.init))&&i.unshift(o)}else(o=s(m))&&("field"===l?i.unshift(o):h[c]=o)}d&&Object.defineProperty(d,n.name,h),u=!0}(e,null,r,{kind:"accessor",name:"_banners",static:!1,private:!1,access:{has:e=>"_banners"in e,get:e=>e._banners,set:(e,t)=>{e._banners=t}},metadata:t},n,i),t&&Object.defineProperty(e,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:t})})(),e})();const oe=(e,t)=>{if("number"==typeof e)return e;if("string"==typeof e){const t=parseFloat(e);if(!isNaN(t))return t}return t};var le=function(e,t,r,n,i,a){function s(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var o,l=n.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?n.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,n.name):{}),u=!1,p=r.length-1;p>=0;p--){var b={};for(var f in n)b[f]="access"===f?{}:n[f];for(var f in n.access)b.access[f]=n.access[f];b.addInitializer=function(e){if(u)throw new TypeError("Cannot add initializers after decoration has completed");a.push(s(e||null))};var m=(0,r[p])("accessor"===l?{get:h.get,set:h.set}:h[c],b);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw new TypeError("Object expected");(o=s(m.get))&&(h.get=o),(o=s(m.set))&&(h.set=o),(o=s(m.init))&&i.unshift(o)}else(o=s(m))&&("field"===l?i.unshift(o):h[c]=o)}d&&Object.defineProperty(d,n.name,h),u=!0},ce=function(e,t,r){for(var n=arguments.length>2,i=0;i<t.length;i++)r=n?t[i].call(e,r):t[i].call(e);return n?r:void 0},de=function(e,t,r,n){if("a"===r&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?n:"a"===r?n.call(e):n?n.value:t.get(e)},he=function(e,t,r,n,i){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!i)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?i.call(e,r):i?i.value=r:t.set(e,r),r};let ue=(()=>{var e,t;let r,n=[],i=[];return e=class{get borderRadius(){return de(this,t,"f")}set borderRadius(e){he(this,t,e,"f")}update(e){this.borderRadius=oe(null==e?void 0:e.borderRadius,this.borderRadius)}constructor(){t.set(this,ce(this,n,12)),ce(this,i)}},t=new WeakMap,(()=>{const t="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;r=[J.observable],le(e,null,r,{kind:"accessor",name:"borderRadius",static:!1,private:!1,access:{has:e=>"borderRadius"in e,get:e=>e.borderRadius,set:(e,t)=>{e.borderRadius=t}},metadata:t},n,i),t&&Object.defineProperty(e,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:t})})(),e})(),pe=(()=>{var e,t,r,n,i,a,s,o;let l,c,d,h,u,p,b,f=[],m=[],v=[],y=[],g=[],w=[],S=[],P=[],_=[],x=[],E=[],T=[],O=[],j=[];return e=class{get loop(){return de(this,t,"f")}set loop(e){he(this,t,e,"f")}get gap(){return de(this,r,"f")}set gap(e){he(this,r,e,"f")}get autoplay(){return de(this,n,"f")}set autoplay(e){he(this,n,e,"f")}get animationSpeed(){return de(this,i,"f")}set animationSpeed(e){he(this,i,e,"f")}get slidesPerView(){return de(this,a,"f")}set slidesPerView(e){he(this,a,e,"f")}get navigation(){return de(this,s,"f")}set navigation(e){he(this,s,e,"f")}get pagination(){return de(this,o,"f")}set pagination(e){he(this,o,e,"f")}constructor(e){t.set(this,ce(this,f,!0)),r.set(this,(ce(this,m),ce(this,v,16))),n.set(this,(ce(this,y),ce(this,g,!0))),i.set(this,(ce(this,w),ce(this,S,300))),a.set(this,(ce(this,P),ce(this,_,1))),s.set(this,(ce(this,x),ce(this,E,{enabled:!0}))),o.set(this,(ce(this,T),ce(this,O,{enabled:!0}))),Object.defineProperty(this,"banner",{enumerable:!0,configurable:!0,writable:!0,value:(ce(this,j),new ue)}),e&&this.update(e)}update(e){var t,r,n,i,a,s;this.loop=null!==(t=null==e?void 0:e.loop)&&void 0!==t?t:this.loop,this.gap=oe(null==e?void 0:e.gap,this.gap),this.autoplay=null!==(r=null==e?void 0:e.autoplay)&&void 0!==r?r:this.autoplay,this.animationSpeed=oe(null==e?void 0:e.animationSpeed,this.animationSpeed),this.slidesPerView=Math.max(oe(null==e?void 0:e.slidesPerView,this.slidesPerView),0),this.navigation={enabled:null!==(i=null===(n=null==e?void 0:e.navigation)||void 0===n?void 0:n.enabled)&&void 0!==i?i:this.navigation.enabled},this.pagination={enabled:null!==(s=null===(a=null==e?void 0:e.pagination)||void 0===a?void 0:a.enabled)&&void 0!==s?s:this.pagination.enabled},this.banner.update(e.banner)}},t=new WeakMap,r=new WeakMap,n=new WeakMap,i=new WeakMap,a=new WeakMap,s=new WeakMap,o=new WeakMap,(()=>{const t="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;l=[J.observable],c=[J.observable],d=[J.observable],h=[J.observable],u=[J.observable],p=[J.observable],b=[J.observable],le(e,null,l,{kind:"accessor",name:"loop",static:!1,private:!1,access:{has:e=>"loop"in e,get:e=>e.loop,set:(e,t)=>{e.loop=t}},metadata:t},f,m),le(e,null,c,{kind:"accessor",name:"gap",static:!1,private:!1,access:{has:e=>"gap"in e,get:e=>e.gap,set:(e,t)=>{e.gap=t}},metadata:t},v,y),le(e,null,d,{kind:"accessor",name:"autoplay",static:!1,private:!1,access:{has:e=>"autoplay"in e,get:e=>e.autoplay,set:(e,t)=>{e.autoplay=t}},metadata:t},g,w),le(e,null,h,{kind:"accessor",name:"animationSpeed",static:!1,private:!1,access:{has:e=>"animationSpeed"in e,get:e=>e.animationSpeed,set:(e,t)=>{e.animationSpeed=t}},metadata:t},S,P),le(e,null,u,{kind:"accessor",name:"slidesPerView",static:!1,private:!1,access:{has:e=>"slidesPerView"in e,get:e=>e.slidesPerView,set:(e,t)=>{e.slidesPerView=t}},metadata:t},_,x),le(e,null,p,{kind:"accessor",name:"navigation",static:!1,private:!1,access:{has:e=>"navigation"in e,get:e=>e.navigation,set:(e,t)=>{e.navigation=t}},metadata:t},E,T),le(e,null,b,{kind:"accessor",name:"pagination",static:!1,private:!1,access:{has:e=>"pagination"in e,get:e=>e.pagination,set:(e,t)=>{e.pagination=t}},metadata:t},O,j),t&&Object.defineProperty(e,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:t})})(),e})();const be=(e=>{var t={};return d.d(t,e),t})({v4:()=>a.v4});class fe{constructor(e){Object.defineProperty(this,"payload",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"eventId",{enumerable:!0,configurable:!0,writable:!0,value:(0,be.v4)()})}get type(){return"view"}toQueryParams(){return{ei:this.eventId,ii:this.payload.iterationId,si:this.payload.slideIndex,st:this.payload.slideTotal}}}class me{constructor(e){Object.defineProperty(this,"payload",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"eventId",{enumerable:!0,configurable:!0,writable:!0,value:(0,be.v4)()})}get type(){return this.payload.type}toQueryParams(){return Object.assign({ei:this.eventId,ii:this.payload.iterationId,si:this.payload.slideIndex,st:this.payload.slideTotal,d:this.payload.durationMs},this.payload.widgetPayload)}}class ve{constructor(){Object.defineProperty(this,"autoplay",{enumerable:!0,configurable:!0,writable:!0,value:{isPaused:function(){return!1},resume:function(){},pause:function(){},start:function(){},stop:function(){},setDelay:function(){}}})}updateSize(){}enableHorizontalSwipeGesture(){}disableHorizontalSwipeGesture(){}getTotalPages(){return 1}getActiveIndex(){return 0}toNextSlide(){}toPrevSlide(){}slideTo(e,t){}}var ye,ge=function(e,t,r,n,i,a){function s(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var o,l=n.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?n.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,n.name):{}),u=!1,p=r.length-1;p>=0;p--){var b={};for(var f in n)b[f]="access"===f?{}:n[f];for(var f in n.access)b.access[f]=n.access[f];b.addInitializer=function(e){if(u)throw new TypeError("Cannot add initializers after decoration has completed");a.push(s(e||null))};var m=(0,r[p])("accessor"===l?{get:h.get,set:h.set}:h[c],b);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw new TypeError("Object expected");(o=s(m.get))&&(h.get=o),(o=s(m.set))&&(h.set=o),(o=s(m.init))&&i.unshift(o)}else(o=s(m))&&("field"===l?i.unshift(o):h[c]=o)}d&&Object.defineProperty(d,n.name,h),u=!0},we=function(e,t,r){for(var n=arguments.length>2,i=0;i<t.length;i++)r=n?t[i].call(e,r):t[i].call(e);return n?r:void 0},Se=function(e,t,r,n){if("a"===r&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?n:"a"===r?n.call(e):n?n.value:t.get(e)},Pe=function(e,t,r,n,i){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!i)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?i.call(e,r):i?i.value=r:t.set(e,r),r};!function(e){e.LoadStart="loadStart",e.LoadEnd="loadEnd",e.LoadError="loadError",e.ActiveIndexChange="activeIndexChange",e.AutoplayTimeLeft="autoplayTimeLeft",e.AutoplayTimerTick="autoplayTimerTick",e.ShowBanner="showBanner",e.ShowBannerFailed="showBannerFailed",e.BannerWidget="bannerWidget"}(ye||(ye={}));let _e=(()=>{var e,t,r,n,i,a;let s,o,l,c,d,h=$.EventEmitter,u=[],p=[],b=[],f=[],m=[],v=[],y=[],g=[],w=[],S=[];return e=class extends h{get _banners(){return Se(this,t,"f")}set _banners(e){Pe(this,t,e,"f")}get _bannerPlace(){return Se(this,r,"f")}set _bannerPlace(e){Pe(this,r,e,"f")}get _isLoading(){return Se(this,n,"f")}set _isLoading(e){Pe(this,n,e,"f")}get _isLoaded(){return Se(this,i,"f")}set _isLoaded(e){Pe(this,i,e,"f")}get _error(){return Se(this,a,"f")}set _error(e){Pe(this,a,e,"f")}constructor(e,s,o,l,c){super(),Object.defineProperty(this,"placeId",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"ctx",{enumerable:!0,configurable:!0,writable:!0,value:s}),Object.defineProperty(this,"bannerStatisticService",{enumerable:!0,configurable:!0,writable:!0,value:o}),Object.defineProperty(this,"bannerStore",{enumerable:!0,configurable:!0,writable:!0,value:l}),Object.defineProperty(this,"bannerViewModelFactory",{enumerable:!0,configurable:!0,writable:!0,value:c}),t.set(this,we(this,u,[])),r.set(this,(we(this,p),we(this,b,null))),n.set(this,(we(this,f),we(this,m,!1))),i.set(this,(we(this,v),we(this,y,!1))),a.set(this,(we(this,g),we(this,w,null))),Object.defineProperty(this,"appearance",{enumerable:!0,configurable:!0,writable:!0,value:(we(this,S),new pe)}),Object.defineProperty(this,"sliderController",{enumerable:!0,configurable:!0,writable:!0,value:new ve}),this.ctx.addBannerPlace(this)}get id(){return this.placeId}get banners(){return this._banners}get contentRatio(){const e=this._banners.map((e=>e.contentRatio));return this.median(e)}get isLoaded(){return this._isLoaded}get isLoading(){return this._isLoading}get error(){return this._error}get slider(){return this.sliderController}get activeIndex(){return this.sliderController.getActiveIndex()}get activeBanner(){return this._banners[this.activeIndex]}get paginationBullets(){return this.sliderController.getTotalPages()}refreshSizes(){this._banners.forEach((e=>e.refreshSizes()))}setSliderController(e){this.sliderController=e}updateAppearance(e){this.appearance.update(e)}resume(){for(const e of this._banners)e.resumeByUser();this.appearance.autoplay&&this.slider.autoplay.resume()}pause(){for(const e of this._banners)e.pauseByUser();this.appearance.autoplay&&this.slider.autoplay.pause()}async reload(){this.bannerStore.removeBannerPlaceById(this.id),await Promise.all(this._banners.map((e=>e.destroy()))),this._banners=[],await this.fetchBanners()}destroy(){this.sliderController=new ve;for(const e of this._banners)e.destroy();this._banners=[],this.ctx.removeBannerPlace(this)}notifyTimerEnd(){var e;null===(e=this.activeBanner)||void 0===e||e.notifyTimerEnd()}showNext(){this.sliderController.toNextSlide()}showPrevious(){this.sliderController.toPrevSlide()}showByIndex(e,t){this.sliderController.slideTo(e,t)}async updateUserData(e){return this.bannerStore.updateBannerUserData(this.id,e)}async fetchBanners(){try{return this._isLoading?[]:(this._isLoading=!0,this._isLoaded=!1,this._error=null,this.emit(ye.LoadStart),this._bannerPlace=await this.bannerStore.getBannerPlaceById({placeId:this.placeId}),this._banners=this.filterBannersByTimeRange(this._bannerPlace.banners).map((e=>this.bannerViewModelFactory.create(this,e))),await Promise.allSettled(this._banners.map((e=>e.waitInit()))),this._isLoaded=!0,this._banners)}catch(e){throw this.emit(ye.LoadError,e),this._error=e,e}finally{this.emit(ye.LoadEnd),this._isLoading=!1}}filterBannersByTimeRange(e){return e.filter((e=>e.withinDisplayTimeRange))}median(e){const t=[...e].sort(((e,t)=>e-t)),r=Math.floor(t.length/2);return t.length%2==0?(t[r-1]+t[r])/2:t[r]}},t=new WeakMap,r=new WeakMap,n=new WeakMap,i=new WeakMap,a=new WeakMap,(()=>{var t;const r="function"==typeof Symbol&&Symbol.metadata?Object.create(null!==(t=h[Symbol.metadata])&&void 0!==t?t:null):void 0;s=[J.observable],o=[J.observable],l=[J.observable],c=[J.observable],d=[J.observable],ge(e,null,s,{kind:"accessor",name:"_banners",static:!1,private:!1,access:{has:e=>"_banners"in e,get:e=>e._banners,set:(e,t)=>{e._banners=t}},metadata:r},u,p),ge(e,null,o,{kind:"accessor",name:"_bannerPlace",static:!1,private:!1,access:{has:e=>"_bannerPlace"in e,get:e=>e._bannerPlace,set:(e,t)=>{e._bannerPlace=t}},metadata:r},b,f),ge(e,null,l,{kind:"accessor",name:"_isLoading",static:!1,private:!1,access:{has:e=>"_isLoading"in e,get:e=>e._isLoading,set:(e,t)=>{e._isLoading=t}},metadata:r},m,v),ge(e,null,c,{kind:"accessor",name:"_isLoaded",static:!1,private:!1,access:{has:e=>"_isLoaded"in e,get:e=>e._isLoaded,set:(e,t)=>{e._isLoaded=t}},metadata:r},y,g),ge(e,null,d,{kind:"accessor",name:"_error",static:!1,private:!1,access:{has:e=>"_error"in e,get:e=>e._error,set:(e,t)=>{e._error=t}},metadata:r},w,S),r&&Object.defineProperty(e,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:r})})(),e})();const xe=(0,u.observer)((e=>{const t=L(e),r=(0,c.useRef)(null),n=t[0];return e.bannerPlace.error?null:(0,l.jsx)("div",{className:I["banner-place"],ref:r,children:!n||e.bannerPlace.isLoading?(0,l.jsx)(_,{needShowErrorScreen:!1,needShowLoaderScreen:!0,onReload:()=>{}}):(0,l.jsx)(O,{index:0,isActive:!0,canBeInited:!0,banner:n,allowClick:!0,clientAppearance:e.bannerPlace.appearance.banner})})})),Ee=(0,u.observer)((e=>{const t=(0,c.useRef)(null),r=L(e);var n;n=e,(0,c.useEffect)((()=>{n.appearance&&n.bannerPlace.updateAppearance(n.appearance)}),[n.bannerPlace,JSON.stringify(n.appearance)]);const{realIndex:i,allowClick:a,slider:s,isAnimating:o,setSlider:d,isMoved:h}=(e=>{const t=(0,c.useRef)(null),[r,n]=(0,c.useState)(!1),[i,a]=(0,c.useState)(!1),[s,o]=(0,c.useState)(!1),[l,d]=(0,c.useState)(!0),[h,u]=(0,c.useState)(null),[p,b]=(0,c.useState)(0),[f,m]=(0,c.useState)(0),[v,y]=(0,c.useState)(!0),[g,w]=(0,c.useState)(!0),S=()=>{clearTimeout(t.current),d(!1),o(!0),((e,t)=>{e.getVisibleSlideIndexes().map((e=>t.banners[e])).forEach((e=>e.pause()))})(h,e)},P=()=>{t.current=setTimeout((()=>d(!0)),100),o(!1),((e,t)=>{t.banners.forEach((e=>e.resume()))})(0,e)},_=()=>{a(!0),d(!1)},x=()=>{a(!1),d(!0)},E=t=>{m(t),e.emit(ye.ActiveIndexChange,t)},T=e=>{b(e)},O=()=>{h&&y(h.reachStart)},j=()=>{h&&w(h.reachEnd)},I=()=>{},L=()=>{e.refreshSizes(),requestAnimationFrame((()=>{e.refreshSizes(),n((e=>!e))}))},C=()=>{e.emit(ye.AutoplayTimeLeft),e.notifyTimerEnd()},A=t=>{e.emit(ye.AutoplayTimerTick,Object.assign(Object.assign({},t),{bannerIndex:e.activeIndex}))};return(0,c.useEffect)((()=>{if(!h)return;const t=new k(h);e.setSliderController(t)}),[e,h]),(0,c.useEffect)((()=>{h&&e&&e.banners[h.realIndex].markAsOpened()}),[e,h]),(0,c.useEffect)((()=>{if(h)return h.on(U.TouchStart,S),h.on(U.TouchEnd,P),h.on(U.TransitionStart,_),h.on(U.TransitionEnd,x),h.on(U.RealIndexChnage,E),h.on(U.ActiveIndexChange,T),h.on(U.ReachStart,O),h.on(U.ReachEnd,j),h.on(U.Resize,I),h.on(U.SlidesUpdated,L),h.on(U.AutoplayTimeLeft,C),h.on(U.AutoplayTimerTick,A),O(),j(),()=>{h.off(U.TouchStart,S),h.off(U.TouchEnd,P),h.off(U.TransitionStart,_),h.off(U.TransitionEnd,x),h.off(U.RealIndexChnage,E),h.off(U.ActiveIndexChange,T),h.off(U.ReachStart,O),h.off(U.ReachEnd,j),h.off(U.Resize,I),h.off(U.SlidesUpdated,L),h.off(U.AutoplayTimeLeft,C),h.off(U.AutoplayTimerTick,A)}}),[e,h]),{reachStart:v,reachEnd:g,activeIndex:p,realIndex:f,isMoved:s,isAnimating:i,slider:h,setSlider:u,allowClick:l}})(e.bannerPlace);(({bannerPlace:e,bannerPlaceRef:t,slider:r})=>{const[n,i]=(0,c.useState)(!1);(0,c.useEffect)((()=>((async(e=5e3)=>new Promise(((r,n)=>{const i=setTimeout((()=>{n(new Error("[IAS]: Timeout while waiting for BannerPlace clientWidth"))}),e),a=()=>{if(t.current&&t.current.clientWidth>0)return clearTimeout(i),void r();requestAnimationFrame(a)};requestAnimationFrame(a)})))().then((()=>{i(!0)})).catch(console.error),()=>{i(!1)})),[e.isLoaded]),(0,c.useEffect)((()=>{r&&n&&(r.updateSize(),e.refreshSizes(),requestAnimationFrame((()=>{e.refreshSizes()})))}),[r,e,n])})({bannerPlace:e.bannerPlace,slider:s,bannerPlaceRef:t});const u=e.bannerPlace.appearance;return(0,l.jsx)("div",{className:(0,S.default)(I["banner-place"],e.className),style:e.style,ref:t,children:(0,l.jsx)(Q,{onInit:d,autoplay:u.autoplay,speed:u.animationSpeed,loop:u.loop,slidesPerView:u.slidesPerView,spaceBetween:u.gap,slidesCount:r.length,navigation:u.navigation,pagination:u.pagination,children:r.map(((e,t)=>{const r=Boolean(null==s?void 0:s.isSlideVisible(t));return(0,l.jsx)(Y,{children:(0,l.jsx)(O,{index:t,isActive:r,canBeInited:r,banner:e,className:I["banner-slider__slide"],allowClick:a,clientAppearance:u.banner})},e.id)}))})})})),Te=(e=>{var t={};return d.d(t,e),t})({createRoot:()=>s.createRoot});class Oe{constructor(e,t,r){Object.defineProperty(this,"mountPoint",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"bannerPlace",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"params",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"root",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"rootElement",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.rootElement=document.createElement("div"),this.rootElement.style.width="100%",this.rootElement.style.height="100%",e.appendChild(this.rootElement),this.root=(0,Te.createRoot)(this.rootElement)}get activeIndex(){return this.bannerPlace.activeIndex}get activeBanner(){return this.bannerPlace.activeBanner}get isLoaded(){return this.bannerPlace.isLoaded}get id(){return this.bannerPlace.id}get banners(){return this.bannerPlace.banners}get appearance(){return this.bannerPlace.appearance}get contentRatio(){return this.bannerPlace.contentRatio}get isLoading(){return this.bannerPlace.isLoading}get error(){return this.bannerPlace.error}get slider(){return this.bannerPlace.slider}get paginationBullets(){return this.bannerPlace.slider.getTotalPages()}refreshSizes(){}emit(e,...t){}setSliderController(e){this.bannerPlace.setSliderController(e)}updateAppearance(e){this.bannerPlace.updateAppearance(e)}resume(){this.bannerPlace.resume()}pause(){this.bannerPlace.pause()}reload(){return this.bannerPlace.reload()}destroy(){setTimeout((()=>{this.root.unmount()})),this.mountPoint.removeChild(this.rootElement),this.bannerPlace.destroy()}fetchBanners(){return this.bannerPlace.fetchBanners()}updateUserData(e){return Promise.resolve()}notifyTimerEnd(){this.bannerPlace.notifyTimerEnd()}showNext(){this.bannerPlace.showNext()}showPrevious(){this.bannerPlace.showPrevious()}showByIndex(e,t){this.bannerPlace.showByIndex(e,t)}on(e,t){return this.bannerPlace.on(e,t),this}once(e,t){return this.bannerPlace.once(e,t),this}off(e,t){return this.bannerPlace.off(e,t),this}render(){var e;this.root.render((0,l.jsx)(Ee,{appearance:null===(e=this.params)||void 0===e?void 0:e.appearance,bannerPlace:this.bannerPlace}))}}const je=e=>{const[t,r]=(0,c.useState)(null);return(0,c.useEffect)((()=>{var t;const n=Qt().createBannerPlace(e.placeId);return r(n),null===(t=e.onReady)||void 0===t||t.call(e,n),()=>{n.destroy()}}),[e.placeId]),t?(0,l.jsx)(Ee,Object.assign({bannerPlace:t},e)):null},Ie=e=>{const[t,r]=(0,c.useState)(null);return(0,c.useEffect)((()=>{var t;const n=Qt().createBannerPreviewPlace(e.bannerId);return r(n),null===(t=e.onReady)||void 0===t||t.call(e,n),()=>{n.destroy()}}),[e.bannerId]),t?(0,l.jsx)(xe,Object.assign({bannerPlace:t},e)):null};var Le=function(e,t,r,n,i,a){function s(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var o,l=n.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?n.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,n.name):{}),u=!1,p=r.length-1;p>=0;p--){var b={};for(var f in n)b[f]="access"===f?{}:n[f];for(var f in n.access)b.access[f]=n.access[f];b.addInitializer=function(e){if(u)throw new TypeError("Cannot add initializers after decoration has completed");a.push(s(e||null))};var m=(0,r[p])("accessor"===l?{get:h.get,set:h.set}:h[c],b);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw new TypeError("Object expected");(o=s(m.get))&&(h.get=o),(o=s(m.set))&&(h.set=o),(o=s(m.init))&&i.unshift(o)}else(o=s(m))&&("field"===l?i.unshift(o):h[c]=o)}d&&Object.defineProperty(d,n.name,h),u=!0},Ce=function(e,t,r){for(var n=arguments.length>2,i=0;i<t.length;i++)r=n?t[i].call(e,r):t[i].call(e);return n?r:void 0},ke=function(e,t,r,n){if("a"===r&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?n:"a"===r?n.call(e):n?n.value:t.get(e)},Ae=function(e,t,r,n,i){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!i)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?i.call(e,r):i?i.value=r:t.set(e,r),r};let Be=(()=>{var e,t,r,n,i;let a,s,o,l,c=$.EventEmitter,d=[],h=[],u=[],p=[],b=[],f=[],m=[],v=[];return e=class extends c{get _banners(){return ke(this,t,"f")}set _banners(e){Ae(this,t,e,"f")}get _isLoading(){return ke(this,r,"f")}set _isLoading(e){Ae(this,r,e,"f")}get _isLoaded(){return ke(this,n,"f")}set _isLoaded(e){Ae(this,n,e,"f")}get _error(){return ke(this,i,"f")}set _error(e){Ae(this,i,e,"f")}constructor(e,a,s,o){super(),Object.defineProperty(this,"bannerId",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"ctx",{enumerable:!0,configurable:!0,writable:!0,value:a}),Object.defineProperty(this,"bannerStore",{enumerable:!0,configurable:!0,writable:!0,value:s}),Object.defineProperty(this,"bannerViewModelFactory",{enumerable:!0,configurable:!0,writable:!0,value:o}),t.set(this,Ce(this,d,[])),r.set(this,(Ce(this,h),Ce(this,u,!1))),n.set(this,(Ce(this,p),Ce(this,b,!1))),i.set(this,(Ce(this,f),Ce(this,m,null))),Object.defineProperty(this,"appearance",{enumerable:!0,configurable:!0,writable:!0,value:(Ce(this,v),new pe)}),this.ctx.addBannerPlace(this)}get activeIndex(){return 0}get activeBanner(){return this._banners[0]}get id(){return"__BANNER_PREVIEW__"}get slider(){return new ve}get banners(){return this._banners}get isLoading(){return this._isLoading}get isLoaded(){return this._isLoaded}get contentRatio(){var e,t;return null!==(t=null===(e=this._banners[0])||void 0===e?void 0:e.contentRatio)&&void 0!==t?t:1}get paginationBullets(){return 1}get error(){return this._error}refreshSizes(){this._banners.forEach((e=>e.refreshSizes()))}setSliderController(e){}updateAppearance(e){this.appearance.update(e)}resume(){for(const e of this._banners)e.resume()}pause(){for(const e of this._banners)e.pause()}async reload(){this.bannerStore.removeBannerPlaceById(this.id),await Promise.all(this._banners.map((e=>e.destroy()))),this._banners=[],await this.fetchBanners()}destroy(){for(const e of this._banners)e.destroy();this._banners=[],this.ctx.removeBannerPlace(this)}async updateUserData(e){return this.bannerStore.updateBannerUserData(this.id,e)}notifyTimerEnd(){}showNext(){}showPrevious(){}showByIndex(e,t){}async fetchBanners(){try{if(this._isLoading)return[];this._error=null,this._isLoading=!0,this._isLoaded=!1,this.emit(ye.LoadStart);const e=await this.bannerStore.getBannerById(this.bannerId);return this._banners=[this.bannerViewModelFactory.create(this,e)],this._isLoaded=!0,this._banners}catch(e){throw this.emit(ye.LoadError,e),this._error=e,e}finally{this.emit(ye.LoadEnd),this._isLoading=!1}}},t=new WeakMap,r=new WeakMap,n=new WeakMap,i=new WeakMap,(()=>{var t;const r="function"==typeof Symbol&&Symbol.metadata?Object.create(null!==(t=c[Symbol.metadata])&&void 0!==t?t:null):void 0;a=[J.observable],s=[J.observable],o=[J.observable],l=[J.observable],Le(e,null,a,{kind:"accessor",name:"_banners",static:!1,private:!1,access:{has:e=>"_banners"in e,get:e=>e._banners,set:(e,t)=>{e._banners=t}},metadata:r},d,h),Le(e,null,s,{kind:"accessor",name:"_isLoading",static:!1,private:!1,access:{has:e=>"_isLoading"in e,get:e=>e._isLoading,set:(e,t)=>{e._isLoading=t}},metadata:r},u,p),Le(e,null,o,{kind:"accessor",name:"_isLoaded",static:!1,private:!1,access:{has:e=>"_isLoaded"in e,get:e=>e._isLoaded,set:(e,t)=>{e._isLoaded=t}},metadata:r},b,f),Le(e,null,l,{kind:"accessor",name:"_error",static:!1,private:!1,access:{has:e=>"_error"in e,get:e=>e._error,set:(e,t)=>{e._error=t}},metadata:r},m,v),r&&Object.defineProperty(e,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:r})})(),e})();class Me{constructor(e){Object.defineProperty(this,"bannerStatisticApi",{enumerable:!0,configurable:!0,writable:!0,value:e})}async sendViewEvent(e,t){const r=new fe(t);await this.bannerStatisticApi.sendViewEvent(e,r)}async sendWidgetEvent(e,t){const r=new me(t);await this.bannerStatisticApi.sendWidgetEvent(e,r)}}class Re{constructor(){Object.defineProperty(this,"cache",{enumerable:!0,configurable:!0,writable:!0,value:{}})}set(e,t){this.cache[e]=t}clear(){this.cache={}}get(e){return this.cache[e]}}class De{constructor(e,t,r){Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"bannerPlaceViewModel",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"banner",{enumerable:!0,configurable:!0,writable:!0,value:r})}async handle(e){try{const t=this.storyManager.gameReader;await t.openGame(e.gameInstanceId),this.bannerPlaceViewModel.pause(),t.once("close",(()=>{this.bannerPlaceViewModel.resume()}))}catch(e){console.error(e)}}}var Ne,We,ze,Fe,Ue,Ve,qe,$e,He,Ge,Xe,Qe,Ye,Je,Ze,Ke,et,tt;!function(e){e.LEFT="left",e.RIGHT="right",e.START="start",e.END="end"}(Ne||(Ne={})),Ne.END,function(e){e.DEFAULT="default",e.CUSTOM_CARD="customCard"}(We||(We={})),We.DEFAULT,We.DEFAULT,function(e){e.CENTER="center",e.LEFT="left",e.RIGHT="right",e.START="start",e.END="end"}(ze||(ze={})),function(e){e.CIRCLE="circle",e.QUAD="quad",e.RECTANGLE="rectangle"}(Fe||(Fe={})),function(e){e.LEFT="left",e.RIGHT="right",e.START="start",e.END="end",e.CENTER="center"}(Ue||(Ue={})),function(e){e.CARD_INSIDE_BOTTOM="cardInsideBottom",e.CARD_OUTSIDE_TOP="cardOutsideTop",e.CARD_OUTSIDE_BOTTOM="cardOutsideBottom"}(Ve||(Ve={})),function(e){e.Medium="medium",e.High="high"}(qe||(qe={})),function(e){e.COLUMN="vertical",e.ROW="horizontal"}($e||($e={})),function(e){e.START_LOADER="startLoad",e.END_LOADER="endLoad"}(He||(He={})),$e.ROW,Ue.START,Ve.CARD_INSIDE_BOTTOM,qe.High,Fe.RECTANGLE,Ue.START,Ve.CARD_INSIDE_BOTTOM,qe.High,Fe.CIRCLE,ze.START,Ue.START,Ve.CARD_INSIDE_BOTTOM,qe.High,Fe.CIRCLE,function(e){e.WidgetEvent="widgetEvent",e.ClickOnButton="clickOnButton"}(Ge||(Ge={})),function(e){e.STORY_LIST="storyList",e.STORY_READER="storyReader",e.GAME_READER="gameReader",e.STACK_STORY_LIST="stackStoryList",e.IAM_READER="iamReader",e.BANNERS="banners"}(Xe||(Xe={})),function(e){e.FLAT="flat",e.COVER="cover",e.CUBE="cube"}(Qe||(Qe={})),function(e){e.Classic="classic",e.Modern="modern"}(Ye||(Ye={})),Qe.FLAT,Ye.Classic,function(e){e.STYLE_CIRCLE="circle",e.STYLE_QUAD="quad",e.STYLE_RECTANGLE="rectangle",e.SWIPE_CUBE="cube",e.SWIPE_FLAT="flat",e.SWIPE_COVER="cover",e.CLOSE_BUTTON_LEFT="left",e.CLOSE_BUTTON_RIGHT="right"}(Je||(Je={})),function(e){e.direct="direct",e.onboarding="onboarding",e.list="list",e.favorite="favorite"}(Ze||(Ze={})),function(e){e[e.default=0]="default",e[e.favorite=1]="favorite",e[e.stacked=2]="stacked"}(Ke||(Ke={})),function(e){e.LTR="ltr",e.RTL="rtl"}(et||(et={})),function(e){e.StoryList="storyList",e.StoryReader="storyReader",e.GameReader="gameReader",e.StackStoryList="stackStoryList",e.IamReader="iamReader",e.Banners="banners"}(tt||(tt={}));class rt{constructor(e,t){Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"banner",{enumerable:!0,configurable:!0,writable:!0,value:t})}handle(e){try{const t=decodeURIComponent(e.linkTarget),r={src:tt.Banners,data:{id:this.banner.id,index:this.banner.activeSlideIndex,url:t,elementId:e.elementId}};this.storyManager.storyLinkClickHandler(r),this.storyManager.emit("clickOnButton",r)}catch(t){t instanceof URIError?console.error(`[Banners]: the URL <${e.linkTarget}> has an invalid format`):console.error(t)}}}class nt{constructor(e,t,r){Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"bannerPlace",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"banner",{enumerable:!0,configurable:!0,writable:!0,value:r})}async handle(e){try{const t={src:tt.Banners,data:{id:this.banner.id,index:this.banner.activeSlideIndex,url:e.storyId.toString()}};this.storyManager.storyLinkClickHandler(t),this.storyManager.emit("clickOnButton",t),this.bannerPlace.pause(),await this.storyManager.storyReader.showStory(e.storyId),this.storyManager.storyReader.once("closeStoryReader",(()=>{this.bannerPlace.resume()}))}catch(e){console.error(e)}}}class it{constructor(){Object.defineProperty(this,"textArea",{enumerable:!0,configurable:!0,writable:!0,value:null})}async copy(e){try{navigator.clipboard&&window.isSecureContext?await navigator.clipboard.writeText(e):this.copyLegacy(e)}catch(t){this.copyLegacy(e)}}isIOS(){return/ipad|iphone/i.test(navigator.userAgent)}createTextArea(e){this.textArea=document.createElement("textarea"),this.textArea.value=e,document.body.appendChild(this.textArea)}selectText(){if(this.textArea)if(this.isIOS()){const e=document.createRange();e.selectNodeContents(this.textArea);const t=window.getSelection();t&&(t.removeAllRanges(),t.addRange(e)),this.textArea.setSelectionRange(0,999999)}else this.textArea.select()}copyLegacy(e){this.createTextArea(e),this.selectText();try{document.execCommand("copy")}catch(e){console.error("Copy failed:",e)}this.textArea&&(document.body.removeChild(this.textArea),this.textArea=null)}}let at;at=function(){};class st{constructor(e){Object.defineProperty(this,"bannerPlace",{enumerable:!0,configurable:!0,writable:!0,value:e})}manageTimer(e,t){if(!this.bannerPlace.slider)return;const r=this.bannerPlace.slider.autoplay;switch(e){case"start":this.startTimer(r,t);break;case"pause":r.pause();break;case"stop":case"before_start":r.stop()}}startTimer(e,t){e.isPaused()?e.resume():(e.setDelay(t),e.start())}}class ot{constructor(e){Object.defineProperty(this,"payload",{enumerable:!0,configurable:!0,writable:!0,value:e})}}Object.defineProperty(ot,"name",{enumerable:!0,configurable:!0,writable:!0,value:"bannerWidget"});class lt{constructor(e){Object.defineProperty(this,"payload",{enumerable:!0,configurable:!0,writable:!0,value:e})}}Object.defineProperty(lt,"name",{enumerable:!0,configurable:!0,writable:!0,value:"showBanner"});class ct{constructor(e){Object.defineProperty(this,"payload",{enumerable:!0,configurable:!0,writable:!0,value:e})}}Object.defineProperty(ct,"name",{enumerable:!0,configurable:!0,writable:!0,value:"showBannerFailed"});class dt{constructor(e,t,r,n){Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"bannerPlace",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"banner",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"bannerStatisticService",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(this,"sessionNarrativeDataCache",{enumerable:!0,configurable:!0,writable:!0,value:new Re}),Object.defineProperty(this,"narrativeDataCache",{enumerable:!0,configurable:!0,writable:!0,value:new Re})}updateCardServerDataLocally(e){this.banner.context.updateNarrativeSavedData(e)}updateTimeline(e,t,r,n,i,a){[...arguments].join(", "),this.banner.id,"before_start"!==t&&(i?this.banner.showLoaderScreen():this.banner.activeSlide.inited&&this.banner.hideLoaderScreen(),a?this.banner.showErrorScreen():this.banner.hideErrorScreen()),new st(this.bannerPlace).manageTimer(t,n)}clearNarrativeSessionDataCache(){this.sessionNarrativeDataCache.clear()}disableVerticalSwipeGesture(){}enableVerticalSwipeGesture(){}disableHorizontalSwipeGesture(){this.bannerPlace.slider.disableHorizontalSwipeGesture()}enableHorizontalSwipeGesture(){this.bannerPlace.slider.enableHorizontalSwipeGesture()}async getCardLocalData(){const e=this.narrativeDataCache.get(`banner_${this.banner.id}_data_${this.storyManager.rootStore.sessionStore.userId}`);return e?JSON.parse(e):{}}setCardLocalData(e,t){const r=JSON.stringify(e);this.narrativeDataCache.set(`banner_${this.banner.id}_data_${this.storyManager.rootStore.sessionStore.userId}`,r),this.banner.context.updateNarrativeSavedData(r),t&&this.banner.updateUserData(r).catch(console.error)}getCardServerData(e){var t;return null!==(t=this.banner.context.widgetsData._narrative_saved_data)&&void 0!==t?t:null}getSlideDuration(e,t){var r,n;return null!==(n=null===(r=this.banner.context.widgetsData._narrative_slides_duration)||void 0===r?void 0:r[t])&&void 0!==n?n:null}pauseUI(){this.banner.pause()}resumeUI(){this.banner.resume()}showCardTextInput(e,t){}setCardSessionValue(e,t){this.sessionNarrativeDataCache.set(e,t)}getCardSessionValue(e){return this.sessionNarrativeDataCache.get(e)}getWidgetsSharedData(e,t){const r=this.banner.context.widgetsData;switch(t){case"rangeSlider":return r._narrative_range_slider_data;case"poll":return r._narrative_poll_data;case"vote":return r._narrative_vote_data}return null}async sendApiRequest(e,t,r,n,i,a){var s,o,l;try{const a=await this.storyManager.httpClient.request({url:e,method:t,params:null!=r?r:{},headers:null!=n?n:{},data:null!=i?i:{}});return{status:a.status,headers:a.headers,data:a.data}}catch(e){if(e instanceof Error&&"IasNetworkError"===e.name)return{status:null!==(s=e.networkStatus)&&void 0!==s?s:400,headers:null===(o=e.response)||void 0===o?void 0:o.headers,data:null===(l=e.response)||void 0===l?void 0:l.data}}}share(e,t){}shareSlideScreenshot(e,t,r){}showLayer(e){this.banner.showLayerByIndex(e)}showCardSlide(e){this.bannerPlace.slider.slideTo(e)}cardShowNext(){this.bannerPlace.slider.toNextSlide()}showNextSlide(){this.bannerPlace.slider.toNextSlide()}sendStatisticEvent(e,t,r,n){this.bannerStatisticService.sendWidgetEvent(this.banner.id,{iterationId:this.banner.iterationId,type:e,slideIndex:this.banner.activeSlideIndex,slideTotal:this.banner.slides.length,durationMs:this.banner.durationMs,widgetPayload:t}),this.bannerPlace.emit(ot.name,new ot({id:this.banner.id,bannerPlace:this.bannerPlace.id,widgetEventName:e,widgetData:null!=r?r:{}}).payload),this.storyManager.emit("widgetEvent",{name:e,data:r})}async resetCard(e){this.updateCardServerDataLocally({}),this.setCardLocalData({},!0),this.showCardSlide(0),this.showLayer(0)}getCardFonts(){var e,t;return null!==(t=null===(e=this.storyManager.rootStore.sessionStore.session)||void 0===e?void 0:e.fontsResources)&&void 0!==t?t:[]}showToast(e){this.banner.showToast({content:e})}closeCard(e){}openStory(e,t){new nt(this.storyManager,this.bannerPlace,this.banner).handle({storyId:e,slideIndex:t})}openGame(e){new De(this.storyManager,this.bannerPlace,this.banner).handle({gameInstanceId:e})}writeToClipboard(e){(new it).copy(e.textValue)}openUrl(e){"swipeUpItems"!==e.type&&new rt(this.storyManager,this.banner).handle({elementId:e.elementId,linkTarget:e.link.target})}}var ht;!function(e){e.Top="top",e.Bottom="bottom"}(ht||(ht={}));const ut=ht.Bottom;class pt{constructor(e){Object.defineProperty(this,"options",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"timeoutId",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"duration",{enumerable:!0,configurable:!0,writable:!0,value:3e3}),Object.defineProperty(this,"content",{enumerable:!0,configurable:!0,writable:!0,value:""}),Object.defineProperty(this,"position",{enumerable:!0,configurable:!0,writable:!0,value:ut}),Object.defineProperty(this,"mountPoint",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"toastContainer",{enumerable:!0,configurable:!0,writable:!0,value:null}),this.initializeOptions(e),this.mountPoint=e.mountPoint}show(e){return this.content=e,this.destroy(),this.createAndShowToast(),!0}hide(){return!!this.toastContainer&&(clearTimeout(this.timeoutId),this.toastContainer.className+=" toast_fadeout",this.addAnimationEndListeners(this.toastContainer,(()=>{var e,t;null===(t=null===(e=this.toastContainer)||void 0===e?void 0:e.parentNode)||void 0===t||t.removeChild(this.toastContainer),this.toastContainer=null})),!0)}destroy(){var e;this.toastContainer&&(clearTimeout(this.timeoutId),null===(e=this.toastContainer.parentNode)||void 0===e||e.removeChild(this.toastContainer),this.toastContainer=null)}initializeOptions(e){if(e.duration&&(this.duration="string"==typeof e.duration?parseFloat(e.duration):e.duration),e.position){const t=e.position.toLowerCase();this.position="top"===t||"bottom"===t?t:ut}}createAndShowToast(){const e=this.createToastContainer(),t=this.createToastElement(),r=this.createToastTextElement();t.appendChild(r),e.appendChild(t),this.mountPoint.appendChild(e),this.timeoutId=window.setTimeout((()=>this.hide()),this.duration),this.toastContainer=e}createToastContainer(){const e=document.createElement("div");return e.id="toast_container",e.className="toast_fadein",e.style.zIndex="1130",e}createToastElement(){const e=document.createElement("div");return e.id="toast",e}createToastTextElement(){const e=document.createElement("span");return e.innerHTML=this.content,e}addAnimationEndListeners(e,t){["animationend","webkitAnimationEnd","msAnimationEnd","oAnimationEnd"].forEach((r=>{e.addEventListener(r,t,{once:!0})}))}}const bt=(e=>{var t={};return d.d(t,e),t})({SlideApi:()=>o.SlideApi}),ft=(new Error("timeout while waiting for mutex to become available"),new Error("mutex already locked"),new Error("request for lock canceled"));class mt{constructor(e,t=ft){this._value=e,this._cancelError=t,this._queue=[],this._weightedWaiters=[]}acquire(e=1,t=0){if(e<=0)throw new Error(`invalid weight ${e}: must be positive`);return new Promise(((r,n)=>{const i={resolve:r,reject:n,weight:e,priority:t},a=vt(this._queue,(e=>t<=e.priority));-1===a&&e<=this._value?this._dispatchItem(i):this._queue.splice(a+1,0,i)}))}runExclusive(e){return function(e,t,r,n){return new(r||(r=Promise))((function(i,a){function s(e){try{l(n.next(e))}catch(e){a(e)}}function o(e){try{l(n.throw(e))}catch(e){a(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,o)}l((n=n.apply(e,t||[])).next())}))}(this,arguments,void 0,(function*(e,t=1,r=0){const[n,i]=yield this.acquire(t,r);try{return yield e(n)}finally{i()}}))}waitForUnlock(e=1,t=0){if(e<=0)throw new Error(`invalid weight ${e}: must be positive`);return this._couldLockImmediately(e,t)?Promise.resolve():new Promise((r=>{this._weightedWaiters[e-1]||(this._weightedWaiters[e-1]=[]),function(e,t){const r=vt(e,(e=>t.priority<=e.priority));e.splice(r+1,0,t)}(this._weightedWaiters[e-1],{resolve:r,priority:t})}))}isLocked(){return this._value<=0}getValue(){return this._value}setValue(e){this._value=e,this._dispatchQueue()}release(e=1){if(e<=0)throw new Error(`invalid weight ${e}: must be positive`);this._value+=e,this._dispatchQueue()}cancel(){this._queue.forEach((e=>e.reject(this._cancelError))),this._queue=[]}_dispatchQueue(){for(this._drainUnlockWaiters();this._queue.length>0&&this._queue[0].weight<=this._value;)this._dispatchItem(this._queue.shift()),this._drainUnlockWaiters()}_dispatchItem(e){const t=this._value;this._value-=e.weight,e.resolve([t,this._newReleaser(e.weight)])}_newReleaser(e){let t=!1;return()=>{t||(t=!0,this.release(e))}}_drainUnlockWaiters(){if(0===this._queue.length)for(let e=this._value;e>0;e--){const t=this._weightedWaiters[e-1];t&&(t.forEach((e=>e.resolve())),this._weightedWaiters[e-1]=[])}else{const e=this._queue[0].priority;for(let t=this._value;t>0;t--){const r=this._weightedWaiters[t-1];if(!r)continue;const n=r.findIndex((t=>t.priority<=e));(-1===n?r:r.splice(0,n)).forEach((e=>e.resolve()))}}}_couldLockImmediately(e,t){return(0===this._queue.length||this._queue[0].priority<t)&&e<=this._value}}function vt(e,t){for(let r=e.length-1;r>=0;r--)if(t(e[r]))return r;return-1}class yt{constructor(e){this._semaphore=new mt(1,e)}acquire(){return function(e,t,r,n){return new(r||(r=Promise))((function(i,a){function s(e){try{l(n.next(e))}catch(e){a(e)}}function o(e){try{l(n.throw(e))}catch(e){a(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,o)}l((n=n.apply(e,t||[])).next())}))}(this,arguments,void 0,(function*(e=0){const[,t]=yield this._semaphore.acquire(1,e);return t}))}runExclusive(e,t=0){return this._semaphore.runExclusive((()=>e()),1,t)}isLocked(){return this._semaphore.isLocked()}waitForUnlock(e=0){return this._semaphore.waitForUnlock(1,e)}release(){this._semaphore.isLocked()&&this._semaphore.release()}cancel(){return this._semaphore.cancel()}}class gt{constructor(e,t,r){Object.defineProperty(this,"banner",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"bannerSlide",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"slideApi",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"mutex",{enumerable:!0,configurable:!0,writable:!0,value:new yt}),Object.defineProperty(this,"_inited",{enumerable:!0,configurable:!0,writable:!0,value:!1})}get html(){return this.bannerSlide.html}get state(){return this.slideApi.state}get inited(){return this._inited}get payload(){return this.bannerSlide.payload}notifyTimerEnd(){this.slideApi.slideTimerEnd()}async init(){const e=await this.mutex.acquire();if(this._inited)return;let t=this.banner.needShowLoaderScreen,r=Date.now();const n=setTimeout((()=>{this.banner.showLoaderScreen(),t=!0,r=Date.now()}),500);try{this.banner.id,await this.slideApi.showSlide(this.html),this._inited=!0}catch(e){throw this.handleSlideError(e),e}finally{clearTimeout(n),await this.cleanupLoaderIfNeeded(Date.now()-r,t),e()}}async start(){const e=await this.mutex.acquire();try{this.banner.id,await this.slideApi.slideStart({muted:!0})}catch(e){throw this.handleSlideError(e),e}finally{e()}}async restart(){const e=await this.mutex.acquire();try{this.banner.hideErrorScreen(),this.banner.showLoaderScreen(),await this.slideApi.slideRestart({muted:!0})}catch(e){throw this.handleSlideError(e),e}finally{this.banner.hideLoaderScreen(),e()}}async resume(){const e=await this.mutex.acquire();try{this.banner.id,await this.slideApi.slideAppResume()}catch(e){this.handleSlideError(e)}finally{e()}}async pause(){const e=await this.mutex.acquire();try{this.banner.id,await this.slideApi.slideAppPause()}catch(e){this.handleSlideError(e)}finally{e()}}async pauseByUser(){const e=await this.mutex.acquire();try{this.banner.id,await this.slideApi.slideUserPause()}catch(e){this.handleSlideError(e)}finally{e()}}async resumeByUser(){const e=await this.mutex.acquire();try{this.banner.id,await this.slideApi.slideUserResume()}catch(e){this.handleSlideError(e)}finally{e()}}async stop(e){const t=await this.mutex.acquire();try{this.banner.id,await this.slideApi.slideStop(e)}catch(e){this.handleSlideError(e)}finally{t()}}refreshSizes(){this.slideApi.refreshSizes()}onClick({event:e,currentTarget:t}){if(e.target)try{e.preventDefault(),e.stopPropagation();const r=this.getNavigationDirection(e,t);this.slideApi.slideClickHandler(e.target,r>0?"forward":"backward")}catch(e){console.error(e)}}async destroy(){await this.stop({prepareForRestart:2})}showLayerByIndex(e){this.slideApi.showLayer(e)}handleSlideError(e){console.error(e),this.banner.showErrorScreen()}getNavigationDirection(e,t){const r=this.getClickPosition(e,t),n="ltr"===this.slideApi.layoutDirection?1:-1;return r>=.3?n:-n}getClickPosition(e,t){const r=t.getBoundingClientRect(),n=r.width;if(n<=0)return 0;let i;if(e instanceof MouseEvent)i=e.pageX-r.left;else{if(!(e.touches&&e.touches.length>0))return 0;i=e.touches[0].pageX-r.left}return Math.max(0,Math.min(1,i/n))}delay(e){return new Promise((t=>setTimeout(t,e)))}async cleanupLoaderIfNeeded(e,t){t&&(await this.delay(Math.max(500-e,0)),this.banner.hideLoaderScreen())}}class wt{get html(){return""}get state(){return 0}async init(){}async start(){}async restart(){}async resume(){}async pause(){}async resumeByUser(){}async pauseByUser(){}async stop(e){}onClick({event:e,currentTarget:t}){}async destroy(){}showLayerByIndex(e){}refreshSizes(){}notifyTimerEnd(){}}var St=function(e,t,r){for(var n=arguments.length>2,i=0;i<t.length;i++)r=n?t[i].call(e,r):t[i].call(e);return n?r:void 0},Pt=function(e,t,r,n,i,a){function s(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var o,l=n.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?n.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,n.name):{}),u=!1,p=r.length-1;p>=0;p--){var b={};for(var f in n)b[f]="access"===f?{}:n[f];for(var f in n.access)b.access[f]=n.access[f];b.addInitializer=function(e){if(u)throw new TypeError("Cannot add initializers after decoration has completed");a.push(s(e||null))};var m=(0,r[p])("accessor"===l?{get:h.get,set:h.set}:h[c],b);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw new TypeError("Object expected");(o=s(m.get))&&(h.get=o),(o=s(m.set))&&(h.set=o),(o=s(m.init))&&i.unshift(o)}else(o=s(m))&&("field"===l?i.unshift(o):h[c]=o)}d&&Object.defineProperty(d,n.name,h),u=!0},_t=function(e,t,r,n){if("a"===r&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?n:"a"===r?n.call(e):n?n.value:t.get(e)},xt=function(e,t,r,n,i){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!i)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?i.call(e,r):i?i.value=r:t.set(e,r),r};let Et=(()=>{var e,t,r,n,i,a;let s,o,l,c,d,h,u,p,b,f,m,v,y=[],g=[],w=[],S=[],P=[],_=[],E=[],T=[],O=[],j=[],I=[];return e=class{get _$root(){return _t(this,t,"f")}set _$root(e){xt(this,t,e,"f")}get _needShowErrorScreen(){return _t(this,r,"f")}set _needShowErrorScreen(e){xt(this,r,e,"f")}get _needShowLoaderScreen(){return _t(this,n,"f")}set _needShowLoaderScreen(e){xt(this,n,e,"f")}get _width(){return _t(this,i,"f")}set _width(e){xt(this,i,e,"f")}get _slides(){return _t(this,a,"f")}set _slides(e){xt(this,a,e,"f")}constructor(e,s,o,l,c){Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:(St(this,y),e)}),Object.defineProperty(this,"bannerPlace",{enumerable:!0,configurable:!0,writable:!0,value:s}),Object.defineProperty(this,"banner",{enumerable:!0,configurable:!0,writable:!0,value:o}),Object.defineProperty(this,"bannerStatisticService",{enumerable:!0,configurable:!0,writable:!0,value:l}),Object.defineProperty(this,"bannerStore",{enumerable:!0,configurable:!0,writable:!0,value:c}),t.set(this,St(this,g,null)),r.set(this,(St(this,w),St(this,S,!1))),n.set(this,(St(this,P),St(this,_,!1))),i.set(this,(St(this,E),St(this,T,0))),a.set(this,(St(this,O),St(this,j,[]))),Object.defineProperty(this,"slideApi",{enumerable:!0,configurable:!0,writable:!0,value:(St(this,I),null)}),Object.defineProperty(this,"slideApiImpl",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"locked",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"toast",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"_iterationId",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"_startTime",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"_initPromise",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_initPromiseResolver",{enumerable:!0,configurable:!0,writable:!0,value:()=>{}}),Object.defineProperty(this,"attachRoot",{enumerable:!0,configurable:!0,writable:!0,value:async e=>{this._$root||(this._$root=e,this.slideApi=this.createSlideApi(e),this._slides=[new gt(this,this.banner.slides[0],this.slideApi)],await this.init())}}),Object.defineProperty(this,"handleVisibilityChange",{enumerable:!0,configurable:!0,writable:!0,value:()=>{this.locked||("hidden"===document.visibilityState&&this.pause(),"visible"===document.visibilityState&&this.resume())}}),this.slideApiImpl=new dt(this.storyManager,this.bannerPlace,this,this.bannerStatisticService),this._initPromise=new Promise((e=>{this._initPromiseResolver=e}))}get id(){return this.banner.id}get context(){return this.banner.context}get appearance(){return this.banner.appearance}get contentRatio(){return this.banner.appearance.contentRatio}get name(){return this.banner.name}get dir(){return this.storyManager.config.dir}get slides(){return this._slides}get activeSlideIndex(){return 0}get width(){return this._width}get activeSlide(){var e;return null!==(e=this._slides[this.activeSlideIndex])&&void 0!==e?e:new wt}get needShowErrorScreen(){return this._needShowErrorScreen}get needShowLoaderScreen(){return this._needShowLoaderScreen}get canBeShown(){return Boolean(this._$root)}get iterationId(){return this._iterationId}get durationMs(){return Date.now()-this._startTime}async init(){this.showLoaderScreen(),await this.activeSlide.init(),this._initPromiseResolver()}async start(){if(!this._$root)throw new Error(`[IAS]: Slide API mount point not found for banner with ID ${this.id}`);document.addEventListener("visibilitychange",this.handleVisibilityChange);try{await this.activeSlide.start(),this._startTime=Date.now(),this.markAsOpened(),this.emitShowBannerEvent()}catch(e){this.emitShowBannerFailedEvent(e)}}refreshSizes(){this.activeSlide.refreshSizes()}async restart(){try{await this.activeSlide.restart(),this._startTime=Date.now(),this.markAsOpened(),this.emitShowBannerEvent()}catch(e){this.emitShowBannerFailedEvent(e)}}async resume(){await this.activeSlide.resume()}async pause(){await this.activeSlide.pause()}async resumeByUser(){await this.activeSlide.resumeByUser()}async pauseByUser(){await this.activeSlide.pauseByUser()}async stop(){var e;this.slideApiImpl.clearNarrativeSessionDataCache(),document.removeEventListener("visibilitychange",this.handleVisibilityChange),null===(e=this.toast)||void 0===e||e.destroy(),await this.activeSlide.stop({prepareForRestart:1})}async destroy(){var e,t;document.removeEventListener("visibilitychange",this.handleVisibilityChange);const r=this.activeSlide;this._slides=[],this._$root=null,await r.destroy(),null===(e=this.slideApi)||void 0===e||e.destroy(),null===(t=this.toast)||void 0===t||t.destroy()}showLayerByIndex(e){this.activeSlide.showLayerByIndex(e)}showToast(e){if(!this._$root)return;const t=this._$root;this.toast=new pt(Object.assign({mountPoint:t},e)),this.toast.show(e.content)}detachRoot(){var e;this._$root=null,null===(e=this.slideApi)||void 0===e||e.destroy()}showErrorScreen(){this._needShowErrorScreen=!0}showLoaderScreen(){this._needShowLoaderScreen=!0}hideLoaderScreen(){this._needShowLoaderScreen=!1}hideErrorScreen(){this._needShowErrorScreen=!1}markAsOpened(){this._iterationId=(0,be.v4)(),this.banner.markAsOpened(),this.markWasShown()}waitInit(){return this._initPromise}notifyTimerEnd(){this.activeSlide.notifyTimerEnd()}async markWasShown(){!this.banner.wasShown&&this._iterationId&&(this.banner.markWasShown(),this.bannerStatisticService.sendViewEvent(this.id,{iterationId:this._iterationId,slideIndex:this.activeSlideIndex,slideTotal:this.banner.slides.length}))}async updateUserData(e){return this.bannerStore.updateBannerUserData(this.id,e)}createSlideApi(e){return new bt.SlideApi(this.slideApiImpl,{root:e,slideRatio:this.banner.appearance.contentRatio,isFullscreen:!1,nonce:x(),viewport:window,userResizeHandler:e=>{this._width=e.viewportWidth},VODPlayer:this.storyManager.globalProperties.$videoOnDemand,overlappingActionBarHeight:0})}emitShowBannerEvent(){this.bannerPlace.emit(lt.name,new lt({id:this.id,bannerPlace:this.bannerPlace.id,payload:this.activeSlide.payload}).payload)}emitShowBannerFailedEvent(e){this.bannerPlace.emit(ct.name,new ct({id:this.id,bannerPlace:this.bannerPlace.id,error:e,payload:this.activeSlide.payload}).payload)}},t=new WeakMap,r=new WeakMap,n=new WeakMap,i=new WeakMap,a=new WeakMap,(()=>{const t="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;s=[J.observable],o=[J.observable],l=[J.observable],c=[J.observable],d=[J.observable],h=[J.computed],u=[J.computed],p=[J.computed],b=[J.action],f=[J.action],m=[J.action],v=[J.action],Pt(e,null,s,{kind:"accessor",name:"_$root",static:!1,private:!1,access:{has:e=>"_$root"in e,get:e=>e._$root,set:(e,t)=>{e._$root=t}},metadata:t},g,w),Pt(e,null,o,{kind:"accessor",name:"_needShowErrorScreen",static:!1,private:!1,access:{has:e=>"_needShowErrorScreen"in e,get:e=>e._needShowErrorScreen,set:(e,t)=>{e._needShowErrorScreen=t}},metadata:t},S,P),Pt(e,null,l,{kind:"accessor",name:"_needShowLoaderScreen",static:!1,private:!1,access:{has:e=>"_needShowLoaderScreen"in e,get:e=>e._needShowLoaderScreen,set:(e,t)=>{e._needShowLoaderScreen=t}},metadata:t},_,E),Pt(e,null,c,{kind:"accessor",name:"_width",static:!1,private:!1,access:{has:e=>"_width"in e,get:e=>e._width,set:(e,t)=>{e._width=t}},metadata:t},T,O),Pt(e,null,d,{kind:"accessor",name:"_slides",static:!1,private:!1,access:{has:e=>"_slides"in e,get:e=>e._slides,set:(e,t)=>{e._slides=t}},metadata:t},j,I),Pt(e,null,h,{kind:"getter",name:"activeSlide",static:!1,private:!1,access:{has:e=>"activeSlide"in e,get:e=>e.activeSlide},metadata:t},null,y),Pt(e,null,u,{kind:"getter",name:"needShowLoaderScreen",static:!1,private:!1,access:{has:e=>"needShowLoaderScreen"in e,get:e=>e.needShowLoaderScreen},metadata:t},null,y),Pt(e,null,p,{kind:"getter",name:"canBeShown",static:!1,private:!1,access:{has:e=>"canBeShown"in e,get:e=>e.canBeShown},metadata:t},null,y),Pt(e,null,b,{kind:"method",name:"showErrorScreen",static:!1,private:!1,access:{has:e=>"showErrorScreen"in e,get:e=>e.showErrorScreen},metadata:t},null,y),Pt(e,null,f,{kind:"method",name:"showLoaderScreen",static:!1,private:!1,access:{has:e=>"showLoaderScreen"in e,get:e=>e.showLoaderScreen},metadata:t},null,y),Pt(e,null,m,{kind:"method",name:"hideLoaderScreen",static:!1,private:!1,access:{has:e=>"hideLoaderScreen"in e,get:e=>e.hideLoaderScreen},metadata:t},null,y),Pt(e,null,v,{kind:"method",name:"hideErrorScreen",static:!1,private:!1,access:{has:e=>"hideErrorScreen"in e,get:e=>e.hideErrorScreen},metadata:t},null,y),t&&Object.defineProperty(e,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:t})})(),e})();class Tt{constructor(e,t,r){Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"bannerStore",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"bannerStatisticService",{enumerable:!0,configurable:!0,writable:!0,value:r})}create(e,t){return new Et(this.storyManager,e,t,this.bannerStatisticService,this.bannerStore)}}function Ot(e,t){let r=null;return async function(...t){return r||(r=(async()=>{try{return await e.apply(this,t)}catch(e){throw e}finally{r=null}})(),r)}}class jt extends Error{constructor(e){super(`[IAS]: Banner with ID ${e} not found`),this.name="IasBannerNotFoundError"}}class It extends Error{constructor(e){super(`[IAS]: Banner slot with ID ${e} not found`),this.name="IasBannerPlaceNotFoundError"}}var Lt=function(e,t,r){for(var n=arguments.length>2,i=0;i<t.length;i++)r=n?t[i].call(e,r):t[i].call(e);return n?r:void 0},Ct=function(e,t,r,n,i,a){function s(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var o,l=n.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?n.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,n.name):{}),u=!1,p=r.length-1;p>=0;p--){var b={};for(var f in n)b[f]="access"===f?{}:n[f];for(var f in n.access)b.access[f]=n.access[f];b.addInitializer=function(e){if(u)throw new TypeError("Cannot add initializers after decoration has completed");a.push(s(e||null))};var m=(0,r[p])("accessor"===l?{get:h.get,set:h.set}:h[c],b);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw new TypeError("Object expected");(o=s(m.get))&&(h.get=o),(o=s(m.set))&&(h.set=o),(o=s(m.init))&&i.unshift(o)}else(o=s(m))&&("field"===l?i.unshift(o):h[c]=o)}d&&Object.defineProperty(d,n.name,h),u=!0};let kt=(()=>{var e;let t,r,n,i,a=[];return e=class{constructor(e){Object.defineProperty(this,"httpClient",{enumerable:!0,configurable:!0,writable:!0,value:(Lt(this,a),e)})}async fetchBannerPlaceById(e){const t=await this.httpClient.get(`banner/place/${e.placeId}`,{expand:"banners.slides",tags:e.tags.join(",")});if(t.data)return t.data;throw new It(e.placeId)}async fetchBannerById(e){const t=await this.httpClient.get(`banner/${e}`,{expand:"slides"});if(t.data)return t.data;throw new jt(e)}async fetchContextWithStyles({needFetchStyles:e}){return(await this.httpClient.get("banner/context",{fields:"widgetsData"+(e?",style":"")})).data}async updateUserData(e,t){try{await this.httpClient.request({url:`banner/${e}/data`,method:"put",data:{data:t}})}catch(e){console.error(e)}}},(()=>{const s="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;t=[Ot],r=[Ot],n=[Ot],i=[Ot],Ct(e,null,t,{kind:"method",name:"fetchBannerPlaceById",static:!1,private:!1,access:{has:e=>"fetchBannerPlaceById"in e,get:e=>e.fetchBannerPlaceById},metadata:s},null,a),Ct(e,null,r,{kind:"method",name:"fetchBannerById",static:!1,private:!1,access:{has:e=>"fetchBannerById"in e,get:e=>e.fetchBannerById},metadata:s},null,a),Ct(e,null,n,{kind:"method",name:"fetchContextWithStyles",static:!1,private:!1,access:{has:e=>"fetchContextWithStyles"in e,get:e=>e.fetchContextWithStyles},metadata:s},null,a),Ct(e,null,i,{kind:"method",name:"updateUserData",static:!1,private:!1,access:{has:e=>"updateUserData"in e,get:e=>e.updateUserData},metadata:s},null,a),s&&Object.defineProperty(e,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:s})})(),e})();class At{constructor(e,t){Object.defineProperty(this,"httpClient",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:t})}async sendShowBannerEvent(e){throw new Error("Method not implemented.")}async sendClickOnBannerEvent(e){throw new Error("Method not implemented.")}async sendBannerCTREvent(e){throw new Error("Method not implemented.")}async sendViewEvent(e,t){await this.sendStatisticsEvent(e,t)}async sendWidgetEvent(e,t){await this.sendStatisticsEvent(e,t)}async sendStatisticsEvent(e,t){try{if(this.storyManager.isStatisticsDisabled)return void console.log("[BANNER STATISTICS]",Object.assign({bannerId:e,type:t.type},t.toQueryParams()));await this.httpClient.post(`/banner/${e}/event/${t.type}`,{},t.toQueryParams())}catch(e){console.error(e)}}}var Bt;!function(e){e[e.Base=0]="Base",e[e.Dynamic=1]="Dynamic",e[e.Game=2]="Game",e[e.Story=3]="Story",e[e.IAM=4]="IAM"}(Bt||(Bt={}));var Mt=function(e,t,r,n,i,a){function s(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var o,l=n.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?n.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,n.name):{}),u=!1,p=r.length-1;p>=0;p--){var b={};for(var f in n)b[f]="access"===f?{}:n[f];for(var f in n.access)b.access[f]=n.access[f];b.addInitializer=function(e){if(u)throw new TypeError("Cannot add initializers after decoration has completed");a.push(s(e||null))};var m=(0,r[p])("accessor"===l?{get:h.get,set:h.set}:h[c],b);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw new TypeError("Object expected");(o=s(m.get))&&(h.get=o),(o=s(m.set))&&(h.set=o),(o=s(m.init))&&i.unshift(o)}else(o=s(m))&&("field"===l?i.unshift(o):h[c]=o)}d&&Object.defineProperty(d,n.name,h),u=!0};(()=>{var e;let t,r,n=[];e=class{async fetchBannerPlaceById(e){return{id:"default",appearance:{single_banner_aspect_ratio:2,banners_gap:16,corner_radius:16,loop:!0,autoplay:!0,autoplay_delay:1e3,animation_speed:300},banners:[]}}async fetchContext(){return{style:"",widgetsData:{}}}updateUserData(e,t){throw new Error("Method not implemented.")}fetchBannerById(e){throw new Error("Method not implemented.")}constructor(){!function(e,t,r){for(var n=arguments.length>2,i=0;i<t.length;i++)r=n?t[i].call(e,r):t[i].call(e)}(this,n)}},(()=>{const i="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;t=[Ot],r=[Ot],Mt(e,null,t,{kind:"method",name:"fetchBannerPlaceById",static:!1,private:!1,access:{has:e=>"fetchBannerPlaceById"in e,get:e=>e.fetchBannerPlaceById},metadata:i},null,n),Mt(e,null,r,{kind:"method",name:"fetchContext",static:!1,private:!1,access:{has:e=>"fetchContext"in e,get:e=>e.fetchContext},metadata:i},null,n),i&&Object.defineProperty(e,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:i})})()})();class Rt{constructor(e,t){Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"bannerStore",{enumerable:!0,configurable:!0,writable:!0,value:t})}createBannerPlace(e,t){var r;const n=new At(this.storyManager.httpClient,this.storyManager),i=new Me(n),a=new Tt(this.storyManager,this.bannerStore,i);return new _e(null!==(r=null==t?void 0:t.toString())&&void 0!==r?r:"default",e,i,this.bannerStore,a)}createBannerPreviewPlace(e,t){const r=new At(this.storyManager.httpClient,this.storyManager),n=new Me(r),i=new Tt(this.storyManager,this.bannerStore,n);return new Be(t.toString(),e,this.bannerStore,i)}}class Dt{static toDomain(e,t){return new K({id:e.id,name:e.name,slides:e.slides.map((e=>{var t;return new ie({html:e.html,duration:e.duration,payload:null===(t=e.event_payload)||void 0===t?void 0:t.payload})})),displayFrom:e.display_from,displayTo:e.display_to,appearance:new ee(e.appearance),context:new te(e.id,t),frequencyLimit:e.frequency_limit})}}class Nt{static toDomain(e,t,r){const n=e.banners.map((e=>Dt.toDomain(e,t)));return new se({id:e.id,banners:n,placeholders:r,style:t.style})}}var Wt=function(e,t,r){for(var n=arguments.length>2,i=0;i<t.length;i++)r=n?t[i].call(e,r):t[i].call(e);return n?r:void 0},zt=function(e,t,r,n,i,a){function s(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var o,l=n.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?n.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,n.name):{}),u=!1,p=r.length-1;p>=0;p--){var b={};for(var f in n)b[f]="access"===f?{}:n[f];for(var f in n.access)b.access[f]=n.access[f];b.addInitializer=function(e){if(u)throw new TypeError("Cannot add initializers after decoration has completed");a.push(s(e||null))};var m=(0,r[p])("accessor"===l?{get:h.get,set:h.set}:h[c],b);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw new TypeError("Object expected");(o=s(m.get))&&(h.get=o),(o=s(m.set))&&(h.set=o),(o=s(m.init))&&i.unshift(o)}else(o=s(m))&&("field"===l?i.unshift(o):h[c]=o)}d&&Object.defineProperty(d,n.name,h),u=!0},Ft=function(e,t,r,n){if("a"===r&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?n:"a"===r?n.call(e):n?n.value:t.get(e)},Ut=function(e,t,r,n,i){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!i)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?i.call(e,r):i?i.value=r:t.set(e,r),r};let Vt=(()=>{var e,t,r;let n,i,a,s,o=[],l=[],c=[],d=[],h=[];return e=class{get _bannerPlaces(){return Ft(this,t,"f")}set _bannerPlaces(e){Ut(this,t,e,"f")}get _banners(){return Ft(this,r,"f")}set _banners(e){Ut(this,r,e,"f")}constructor(e,n){Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:(Wt(this,o),e)}),Object.defineProperty(this,"bannerApi",{enumerable:!0,configurable:!0,writable:!0,value:n}),t.set(this,Wt(this,l,J.observable.map())),r.set(this,(Wt(this,c),Wt(this,d,J.observable.map()))),Object.defineProperty(this,"bannerCSS",{enumerable:!0,configurable:!0,writable:!0,value:(Wt(this,h),"")}),(0,J.reaction)((()=>e.rootStore.placeholderStore.placeholders),(e=>{for(const t of this._bannerPlaces.values())t.updatePlaceholders(e)}))}get bannerPlaces(){return Array.from(this._bannerPlaces.values())}async getBannerById(e){if(this._banners.has(e))return this._banners.get(e);await this.storyManager.waitStoryManagerConfig();const t=await this.fetchBannerContext(),r=await this.bannerApi.fetchBannerById(e);return this.addBanner(r,t)}async getBannerPlaceById(e){if(this._bannerPlaces.has(e.placeId))return this._bannerPlaces.get(e.placeId);await this.storyManager.waitStoryManagerConfig();const t=await this.fetchBannerContext(),r=await this.bannerApi.fetchBannerPlaceById({placeId:e.placeId,tags:this.storyManager.config.tags});return this.addBannerPlace(r,t)}clearCache(){this._bannerPlaces=J.observable.map(),this._banners=J.observable.map()}removeBannerPlaceById(e){this._bannerPlaces.delete(e)}async updateBannerUserData(e,t){if(!this.storyManager.isStatisticsDisabled)return this.bannerApi.updateUserData(e,t);console.log("[IAM]: update user data",{bannerId:e,payload:t})}async fetchBannerContext(){await this.storyManager.rootStore.sessionStore.open();const e=await this.bannerApi.fetchContextWithStyles({needFetchStyles:!this.bannerCSS});return this.bannerCSS&&(e.style=this.bannerCSS),e}addBannerPlace(e,t){const r=this.storyManager.rootStore.placeholderStore.placeholders,n=Nt.toDomain(e,t,r);return this._bannerPlaces.set(e.id,n),n}addBanner(e,t){const r=this.storyManager.rootStore.placeholderStore.placeholders,n=Dt.toDomain(e,t);return n.updatePlaceholders(r),this._banners.set(n.id,n),n}},t=new WeakMap,r=new WeakMap,(()=>{const t="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;n=[J.observable],i=[J.observable],a=[J.computed],s=[Ot],zt(e,null,n,{kind:"accessor",name:"_bannerPlaces",static:!1,private:!1,access:{has:e=>"_bannerPlaces"in e,get:e=>e._bannerPlaces,set:(e,t)=>{e._bannerPlaces=t}},metadata:t},l,c),zt(e,null,i,{kind:"accessor",name:"_banners",static:!1,private:!1,access:{has:e=>"_banners"in e,get:e=>e._banners,set:(e,t)=>{e._banners=t}},metadata:t},d,h),zt(e,null,a,{kind:"getter",name:"bannerPlaces",static:!1,private:!1,access:{has:e=>"bannerPlaces"in e,get:e=>e.bannerPlaces},metadata:t},null,o),zt(e,null,s,{kind:"method",name:"getBannerPlaceById",static:!1,private:!1,access:{has:e=>"getBannerPlaceById"in e,get:e=>e.getBannerPlaceById},metadata:t},null,o),t&&Object.defineProperty(e,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:t})})(),e})();class qt{constructor(e){Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"bannerStore",{enumerable:!0,configurable:!0,writable:!0,value:void 0});const t=new kt(e.httpClient);this.bannerStore=new Vt(this.storyManager,t)}}class $t extends Error{constructor(){super("[IAS]: you must create an instance of BannersProvider"),this.name="IasBannersProviderReferenceError"}}class Ht extends Error{constructor(e){super(`[IAS]: Mount point ${e} is not present in DOM at initialization time`),this.name="IasMountPointReferenceError"}}class Gt extends Oe{render(){this.root.render((0,l.jsx)(xe,{bannerPlace:this.bannerPlace}))}}class Xt{constructor(e){Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"bannerPlaces",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"bannerPlaceViewModelFactory",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"rootStore",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"reloadAllBanners",{enumerable:!0,configurable:!0,writable:!0,value:()=>{this.rootStore.bannerStore.clearCache(),this.bannerPlaces.forEach((e=>{e.reload().catch(console.error)}))}}),this.rootStore=new qt(e),this.bannerPlaceViewModelFactory=new Rt(e,this.rootStore.bannerStore),this.storyManager.rootStore.storyManagerConfigStore.waitStoryManagerConfig().then((()=>{this.storyManager.config.on("requestSDKReload",this.reloadAllBanners)}))}addBannerPlace(e){this.bannerPlaces.push(e)}removeBannerPlace(e){const t=this.bannerPlaces.indexOf(e);-1!==t&&this.bannerPlaces.splice(t,1)}clear(){for(const e of this.bannerPlaces)e.destroy();this.bannerPlaces=[]}createBannerPlace(e){return this.bannerPlaceViewModelFactory.createBannerPlace(this,e)}createBannerPreviewPlace(e){return this.bannerPlaceViewModelFactory.createBannerPreviewPlace(this,e)}static create(e){return Xt.instance||(Xt.instance=new Xt(e)),Xt.instance}mountBannerPlace(e,t){const r=document.querySelector(e);if(!r)throw new Ht(e);const n=this.createBannerPlace(null==t?void 0:t.placeId),i=new Oe(r,n,t);return i.render(),i}mountBannerPreviewPlace(e,t){const r=document.querySelector(e);if(!r)throw new Ht(e);const n=this.createBannerPreviewPlace(t.bannerId),i=new Gt(r,n);return i.render(),i}}const Qt=()=>{if(!Xt.instance)throw new $t;return Xt.instance},Yt=Xt;class Jt{constructor(){Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ias-banners"})}install(e){const t=Yt.create(e.INTERNAL_API);e.HOST.prototype.banners=t}uninstall(){}}const Zt=new Jt})();var u=h.RE,p=h.Sr,b=h.YL,f=h.Ay;export{u as IasBannerPlace,p as IasBannerPreview,b as IasBannersPlugin,f as default};
|