@inappstory/react-sdk 0.4.1-rc.0 → 0.4.2
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.js
CHANGED
|
@@ -19,7 +19,7 @@ object-assign
|
|
|
19
19
|
*
|
|
20
20
|
* This source code is licensed under the MIT license found in the
|
|
21
21
|
* LICENSE file in the root directory of this source tree.
|
|
22
|
-
*/i(1513);var r=i(9155),n=60103;if(t.Fragment=60107,"function"==typeof Symbol&&Symbol.for){var s=Symbol.for;n=s("react.element"),t.Fragment=s("react.fragment")}var o=r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,a=Object.prototype.hasOwnProperty,l={key:!0,ref:!0,__self:!0,__source:!0};function d(e,t,i){var r,s={},d=null,c=null;for(r in void 0!==i&&(d=""+i),void 0!==t.key&&(d=""+t.key),void 0!==t.ref&&(c=t.ref),t)a.call(t,r)&&!l.hasOwnProperty(r)&&(s[r]=t[r]);if(e&&e.defaultProps)for(r in t=e.defaultProps)void 0===s[r]&&(s[r]=t[r]);return{$$typeof:n,type:e,key:d,ref:c,props:s,_owner:o.current}}t.jsx=d,t.jsxs=d},1085:(e,t,i)=>{"use strict";e.exports=i(3335)},2591:(e,t,i)=>{"use strict";var r,n=function(){return void 0===r&&(r=Boolean(window&&document&&document.all&&!window.atob)),r},s=function(){var e={};return function(t){if(void 0===e[t]){var i=document.querySelector(t);if(window.HTMLIFrameElement&&i instanceof window.HTMLIFrameElement)try{i=i.contentDocument.head}catch(e){i=null}e[t]=i}return e[t]}}(),o=[];function a(e){for(var t=-1,i=0;i<o.length;i++)if(o[i].identifier===e){t=i;break}return t}function l(e,t){for(var i={},r=[],n=0;n<e.length;n++){var s=e[n],l=t.base?s[0]+t.base:s[0],d=i[l]||0,c="".concat(l," ").concat(d);i[l]=d+1;var u=a(c),h={css:s[1],media:s[2],sourceMap:s[3]};-1!==u?(o[u].references++,o[u].updater(h)):o.push({identifier:c,updater:v(h,t),references:1}),r.push(c)}return r}function d(e){var t=document.createElement("style"),r=e.attributes||{};if(void 0===r.nonce){var n=i.nc;n&&(r.nonce=n)}if(Object.keys(r).forEach((function(e){t.setAttribute(e,r[e])})),"function"==typeof e.insert)e.insert(t);else{var o=s(e.insert||"head");if(!o)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");o.appendChild(t)}return t}var c,u=(c=[],function(e,t){return c[e]=t,c.filter(Boolean).join("\n")});function h(e,t,i,r){var n=i?"":r.media?"@media ".concat(r.media," {").concat(r.css,"}"):r.css;if(e.styleSheet)e.styleSheet.cssText=u(t,n);else{var s=document.createTextNode(n),o=e.childNodes;o[t]&&e.removeChild(o[t]),o.length?e.insertBefore(s,o[t]):e.appendChild(s)}}function p(e,t,i){var r=i.css,n=i.media,s=i.sourceMap;if(n?e.setAttribute("media",n):e.removeAttribute("media"),s&&"undefined"!=typeof btoa&&(r+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(s))))," */")),e.styleSheet)e.styleSheet.cssText=r;else{for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(document.createTextNode(r))}}var f=null,g=0;function v(e,t){var i,r,n;if(t.singleton){var s=g++;i=f||(f=d(t)),r=h.bind(null,i,s,!1),n=h.bind(null,i,s,!0)}else i=d(t),r=p.bind(null,i,t),n=function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(i)};return r(e),function(t){if(t){if(t.css===e.css&&t.media===e.media&&t.sourceMap===e.sourceMap)return;r(e=t)}else n()}}e.exports=function(e,t){(t=t||{}).singleton||"boolean"==typeof t.singleton||(t.singleton=n());var i=l(e=e||[],t);return function(e){if(e=e||[],"[object Array]"===Object.prototype.toString.call(e)){for(var r=0;r<i.length;r++){var n=a(i[r]);o[n].references--}for(var s=l(e,t),d=0;d<i.length;d++){var c=a(i[d]);0===o[c].references&&(o[c].updater(),o.splice(c,1))}i=s}}}},4862:function(e,t){"use strict";var i;void 0===(i=function(){return function(e,t,i){let r,n;function s(){return i.userAgent.match(/ipad|iphone/i)}function o(e){r=t.createElement("textArea"),r.value=e,t.body.appendChild(r)}function a(){var i,n;s()?((i=t.createRange()).selectNodeContents(r),(n=e.getSelection())&&(n.removeAllRanges(),n.addRange(i)),r.setSelectionRange(0,999999)):r.select()}function l(){t.execCommand("copy"),t.body.removeChild(r)}return n=function(e){o(e),a(),l()},{copy:n}}(window,document,navigator)}.apply(t,[]))||(e.exports=i)},4026:(e,t,i)=>{"use strict";
|
|
22
|
+
*/i(1513);var r=i(9155),n=60103;if(t.Fragment=60107,"function"==typeof Symbol&&Symbol.for){var s=Symbol.for;n=s("react.element"),t.Fragment=s("react.fragment")}var o=r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,a=Object.prototype.hasOwnProperty,l={key:!0,ref:!0,__self:!0,__source:!0};function d(e,t,i){var r,s={},d=null,c=null;for(r in void 0!==i&&(d=""+i),void 0!==t.key&&(d=""+t.key),void 0!==t.ref&&(c=t.ref),t)a.call(t,r)&&!l.hasOwnProperty(r)&&(s[r]=t[r]);if(e&&e.defaultProps)for(r in t=e.defaultProps)void 0===s[r]&&(s[r]=t[r]);return{$$typeof:n,type:e,key:d,ref:c,props:s,_owner:o.current}}t.jsx=d,t.jsxs=d},1085:(e,t,i)=>{"use strict";e.exports=i(3335)},2591:(e,t,i)=>{"use strict";var r,n=function(){return void 0===r&&(r=Boolean(window&&document&&document.all&&!window.atob)),r},s=function(){var e={};return function(t){if(void 0===e[t]){var i=document.querySelector(t);if(window.HTMLIFrameElement&&i instanceof window.HTMLIFrameElement)try{i=i.contentDocument.head}catch(e){i=null}e[t]=i}return e[t]}}(),o=[];function a(e){for(var t=-1,i=0;i<o.length;i++)if(o[i].identifier===e){t=i;break}return t}function l(e,t){for(var i={},r=[],n=0;n<e.length;n++){var s=e[n],l=t.base?s[0]+t.base:s[0],d=i[l]||0,c="".concat(l," ").concat(d);i[l]=d+1;var u=a(c),h={css:s[1],media:s[2],sourceMap:s[3]};-1!==u?(o[u].references++,o[u].updater(h)):o.push({identifier:c,updater:v(h,t),references:1}),r.push(c)}return r}function d(e){var t=document.createElement("style"),r=e.attributes||{};if(void 0===r.nonce){var n=i.nc;n&&(r.nonce=n)}if(Object.keys(r).forEach((function(e){t.setAttribute(e,r[e])})),"function"==typeof e.insert)e.insert(t);else{var o=s(e.insert||"head");if(!o)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");o.appendChild(t)}return t}var c,u=(c=[],function(e,t){return c[e]=t,c.filter(Boolean).join("\n")});function h(e,t,i,r){var n=i?"":r.media?"@media ".concat(r.media," {").concat(r.css,"}"):r.css;if(e.styleSheet)e.styleSheet.cssText=u(t,n);else{var s=document.createTextNode(n),o=e.childNodes;o[t]&&e.removeChild(o[t]),o.length?e.insertBefore(s,o[t]):e.appendChild(s)}}function p(e,t,i){var r=i.css,n=i.media,s=i.sourceMap;if(n?e.setAttribute("media",n):e.removeAttribute("media"),s&&"undefined"!=typeof btoa&&(r+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(s))))," */")),e.styleSheet)e.styleSheet.cssText=r;else{for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(document.createTextNode(r))}}var f=null,g=0;function v(e,t){var i,r,n;if(t.singleton){var s=g++;i=f||(f=d(t)),r=h.bind(null,i,s,!1),n=h.bind(null,i,s,!0)}else i=d(t),r=p.bind(null,i,t),n=function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(i)};return r(e),function(t){if(t){if(t.css===e.css&&t.media===e.media&&t.sourceMap===e.sourceMap)return;r(e=t)}else n()}}e.exports=function(e,t){(t=t||{}).singleton||"boolean"==typeof t.singleton||(t.singleton=n());var i=l(e=e||[],t);return function(e){if(e=e||[],"[object Array]"===Object.prototype.toString.call(e)){for(var r=0;r<i.length;r++){var n=a(i[r]);o[n].references--}for(var s=l(e,t),d=0;d<i.length;d++){var c=a(i[d]);0===o[c].references&&(o[c].updater(),o.splice(c,1))}i=s}}}},4862:function(e,t){"use strict";var i;void 0===(i=function(){return function(e,t,i){let r,n;function s(){return i.userAgent.match(/ipad|iphone/i)}function o(e){r=t.createElement("textArea"),r.value=e,t.body.appendChild(r)}function a(){var i,n;s()?((i=t.createRange()).selectNodeContents(r),(n=e.getSelection())&&(n.removeAllRanges(),n.addRange(i)),r.setSelectionRange(0,999999)):r.select()}function l(){t.execCommand("copy"),t.body.removeChild(r)}return n=function(e){o(e),a(),l()},{copy:n}}(window,document,navigator)}.apply(t,[]))||(e.exports=i)},5845:(e,t,i)=>{"use strict";const r=document.querySelector("[nonce]");r&&(i.nc=r.nonce||r.getAttribute("nonce"))},4026:(e,t,i)=>{"use strict";
|
|
23
23
|
/**
|
|
24
24
|
* @license React
|
|
25
25
|
* use-sync-external-store-shim.production.min.js
|
|
@@ -37,14 +37,14 @@ object-assign
|
|
|
37
37
|
*
|
|
38
38
|
* This source code is licensed under the MIT license found in the
|
|
39
39
|
* LICENSE file in the root directory of this source tree.
|
|
40
|
-
*/var r=i(9155),n=i(8139);var s="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},o=n.useSyncExternalStore,a=r.useRef,l=r.useEffect,d=r.useMemo,c=r.useDebugValue;t.useSyncExternalStoreWithSelector=function(e,t,i,r,n){var u=a(null);if(null===u.current){var h={hasValue:!1,value:null};u.current=h}else h=u.current;u=d((function(){function e(e){if(!l){if(l=!0,o=e,e=r(e),void 0!==n&&h.hasValue){var t=h.value;if(n(t,e))return a=t}return a=e}if(t=a,s(o,e))return t;var i=r(e);return void 0!==n&&n(t,i)?t:(o=e,a=i)}var o,a,l=!1,d=void 0===i?null:i;return[function(){return e(t())},null===d?void 0:function(){return e(d())}]}),[t,i,r,n]);var p=o(e,u[0],u[1]);return l((function(){h.hasValue=!0,h.value=p}),[p]),c(p),p}},8139:(e,t,i)=>{"use strict";e.exports=i(4026)},7121:(e,t,i)=>{"use strict";e.exports=i(4965)},8384:e=>{"use strict";e.exports=n},1869:e=>{"use strict";e.exports=l},5729:e=>{"use strict";e.exports=a},5136:e=>{"use strict";e.exports=i},3107:e=>{"use strict";e.exports=o},992:e=>{"use strict";e.exports=s},2840:t=>{"use strict";t.exports=e},9780:e=>{"use strict";e.exports=c},9155:e=>{"use strict";e.exports=r},2265:e=>{"use strict";e.exports=d},7315:e=>{"use strict";e.exports=t}},h={};function p(e){var t=h[e];if(void 0!==t)return t.exports;var i=h[e]={id:e,loaded:!1,exports:{}};return u[e].call(i.exports,i,i.exports,p),i.loaded=!0,i.exports}p.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return p.d(t,{a:t}),t},p.d=(e,t)=>{for(var i in t)p.o(t,i)&&!p.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})},p.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),p.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),p.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},p.nmd=e=>(e.paths=[],e.children||(e.children=[]),e),p.nc=void 0;var f={};return(()=>{"use strict";p.r(f),p.d(f,{CloseButtonPosition:()=>B,FavoriteStoryList:()=>Sh,GoodsWidgetRenderingType:()=>re,IASContainer:()=>Eu,SharePageEvents:()=>fr,StoriesListCardCoverQuality:()=>H,StoriesListCardTitlePosition:()=>q,StoriesListCardTitleTextAlign:()=>$,StoriesListCardViewVariant:()=>W,StoriesListDirection:()=>Z,StoryList:()=>yh,StoryManager:()=>$s,StoryReaderSwipeStyle:()=>J,UGCStoryList:()=>wh,storyManager:()=>Xs});var e=p(2840);class t extends Error{constructor(e){super(`Invalid language tag: ${e}. The "lang" value must be comply with the RFC 5646 (also known as BCP 47). Examples of valid language tags include "en-US", "fr-FR", "es-ES", etc.`)}}const i="en-US";class r{constructor(e=i){const t=this.normalizeAndEnsureCompatibility(e),r=this.validateTag(t);this.parseTag(r)}isValidTag(e){return/^[a-z]+-[a-zA-Z]+$/.test(e)}toString(){return this.tag}normalizeAndEnsureCompatibility(e){const t=e.toLowerCase();return this.ensureBackwardCompatibility(t)}ensureBackwardCompatibility(e){var t;return null!==(t={ru:"ru-RU",en:"en-US"}[e])&&void 0!==t?t:e}validateTag(e){return this.isValidTag(e)?e:(console.error(new t(e).message),this.getNavigatorTag())}getNavigatorTag(){const e=navigator.language.toLowerCase();return this.isValidTag(e)?e:(console.error(`Invalid navigator language tag: ${e}`),i)}parseTag(e){const[t,i]=e.split("-");this.languageCode=t,this.countryCode=i.toUpperCase(),this.tag=`${this.languageCode}-${this.countryCode}`}}const n={apiKey:"",disableStatistic:!1,disableDeviceId:!1,lang:new r};var s=function(e,t){var i={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(i[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(r=Object.getOwnPropertySymbols(e);n<r.length;n++)t.indexOf(r[n])<0&&Object.prototype.propertyIsEnumerable.call(e,r[n])&&(i[r[n]]=e[r[n]])}return i};const o=(0,e.createStore)(n),a=(0,e.createEvent)();o.on(a,((e,t)=>{var{disableStatistic:i,disableDeviceId:n}=t,o=s(t,["disableStatistic","disableDeviceId"]);return Object.assign(Object.assign({disableStatistic:null!=i?i:e.disableStatistic,disableDeviceId:null!=n?n:e.disableDeviceId},o),{lang:new r(o.lang)})}));const l=(0,e.createEvent)();o.on(l,((e,{tags:t})=>Object.assign(Object.assign({},e),{tags:t})));const d=(0,e.createEvent)();o.on(d,((e,{userId:t})=>Object.assign(Object.assign({},e),{userId:t})));const c=(0,e.createEvent)();o.on(c,((e,{placeholders:t})=>Object.assign(Object.assign({},e),{placeholders:t})));const u=(0,e.createEvent)();o.on(u,((e,{imagePlaceholders:t})=>Object.assign(Object.assign({},e),{imagePlaceholders:t})));const h=(0,e.createEvent)();o.on(h,((e,{lang:t})=>Object.assign(Object.assign({},e),{lang:new r(t)})));const g=(0,e.createStore)(""),v=(0,e.createEvent)();(0,e.sample)({clock:v,target:g});const m=(0,e.createStore)({session:{id:"",expire_in:0},server_timestamp:0,content_base_url:"",user_key:"",share:!1,is_allow_profiling:!1,cache:[],placeholders:[],image_placeholders:[],editor:null,storyWidgetsResources:[],is_allow_ugc:!1}),y=(0,e.createEffect)();m.on(y.doneData,((e,t)=>t));const w=(0,e.createEvent)(),S=(0,e.createEvent)();m.on(S,(e=>{const t=Object.assign({},e);return t.session.id="",t}));const b=(0,e.createEffect)((e=>{N("session/update",e,(()=>{}))})).prepend((e=>({data:[[5,0,...e]]})));var _=p(7315);class x{static createFunctionWithTimeout(e,t){let i=!1;function r(){i||(i=!0,e())}return setTimeout(r,t||1e3),r}static convertModelToFormData(e,t,i){t instanceof Object&&Object.keys(t).forEach((r=>{const n=t[r];if(n instanceof Object&&!Array.isArray(n))return this.convertModelToFormData(e,n,r);i&&(r=`${i}[${r}]`),Array.isArray(n)?n.forEach((t=>{e.append(`${r}[]`,t)})):e.append(r,n)}))}}const C=e=>null==e;function k(e){const t=typeof e;return null!=e&&("object"===t||"function"===t)}function O(e,t){return Object.assign(Object.assign({},e),t)}function E(e){return e.replace(/^\//,"")}const A={baseUrl:"https://sdk.inappstory.ru",apiUrl:"https://api.inappstory.ru",faviconApiUrl:"https://favicon.inappstory.ru"};function L(e){if(e.length>32)try{const t=function(e){const t=(e=e.replace(new RegExp("-","g"),"+").replace(new RegExp("_","g"),"/")).length;return e=function(e,t,i){return void 0===t?e:t.length>=e.length?t:i?(e+t).slice(-e.length):(t+e).substring(0,e.length)}(new Array(t%4).fill("=").join(""),e,!1),window.atob(e)}(e),i=t.charCodeAt(13);if(i>0){let e=t.substr(14,i);e=e.replace(/\0+$/,"");const r="{QQN{xuV?1Dv16j3";let n=r,s=0;for(;n.length<i;)n+=r[s],s++,s===r.length&&(s=0);let o="";for(let t=0;t<i;t++)o+=String.fromCharCode(e.charCodeAt(t)^n.charCodeAt(t));return new URL(`https://${o}`).host}}catch(e){console.error(e)}return null}function M(e){const t=L(e);if(null!=t){const e=t.split(".").slice(1);A.baseUrl=`https://${["sdk",...e].join(".")}`,A.faviconApiUrl=`https://${["favicon",...e].join(".")}`,A.apiUrl=`https://${t}`}}function I(e){let t=e.length;for(let i=e.length-1;i>=0;i--){const r=e.charCodeAt(i);r>127&&r<=2047?t++:r>2047&&r<=65535&&(t+=2),r>=56320&&r<=57343&&i--}return t}class T{constructor(){return this._sdkConfigIsIncorrect=!1,this._userIdByteLimit=255,this._tagsByteLimit=4e3,this.userMessage="",this.tagsMessage="",T.instance||(T.instance=this),T.instance}static getInstance(){return T.instance?T.instance:new T}get sdkConfigIsIncorrect(){return this._sdkConfigIsIncorrect}get sdkConfigErrorsAsArray(){const e=[];return this.userMessage&&e.push(this.userMessage),this.tagsMessage&&e.push(this.tagsMessage),e}checkUserIdLength(e){this.userMessage="",null!=e&&I(String(e))>this._userIdByteLimit&&(console.error(`UserId is bigger then ${this._userIdByteLimit} bytes`),this._sdkConfigIsIncorrect=!0,this.userMessage=`UserId "${String(e)}" is bigger then ${this._userIdByteLimit} bytes`)}checkTagsLength(e){this.tagsMessage="",null!=e&&Array.isArray(e)&&I(e.join(","))>this._tagsByteLimit&&(console.error(`Tags (joined by ',') is bigger then ${this._tagsByteLimit} bytes`),this._sdkConfigIsIncorrect=!0,this.tagsMessage=`Tags (joined by ',') "${e.join(",")}" is bigger then ${this._tagsByteLimit} bytes`)}}var R=function(e,t,i,r){return new(i||(i=Promise))((function(n,s){function o(e){try{l(r.next(e))}catch(e){s(e)}}function a(e){try{l(r.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,a)}l((r=r.apply(e,t||[])).next())}))};const P=`InAppStoryWebSDK/${parseInt(401)} ${navigator.userAgent}`;const D=new class{constructor(){this._deviceInfoPromise=null,this._baseHeaders={},this.requestInterceptors=[],this.interceptors={request:{use:e=>{this.requestInterceptors.push(e)}}}}set deviceInfoPromise(e){this._deviceInfoPromise=e}set baseHeaders(e){this._baseHeaders=e}get baseURL(){return`${A.apiUrl}/v2/`}request(e){return R(this,void 0,void 0,(function*(){return new Promise(((t,i)=>{const r=()=>R(this,void 0,void 0,(function*(){try{if(k(e.headers)&&null!=e.headers||(e.headers={}),e.headers=O(this._baseHeaders,e.headers),this.requestInterceptors.length)for(const t of this.requestInterceptors)t(e);let i="";!C(e.params)&&k(e.params)&&(i=new URLSearchParams(Object.entries(e.params)).toString());let r=new URL(`${E(e.url)}${i?"?"+i:""}`,this.baseURL),n="get";C(e.method)||(n=e.method);let s={};!C(e.headers)&&k(e.headers)&&(s=e.headers);let o=null;!C(e.data)&&k(e.data)&&(o=JSON.stringify(e.data),s["Content-Type"]="application/json");try{if(T.getInstance().sdkConfigIsIncorrect)return void t({data:{name:"SDK config is incorrect",message:T.getInstance().sdkConfigErrorsAsArray.join(". "),status:400},headersRaw:{},headers:{},status:400,statusText:"SDK config is incorrect",ok:!1})}catch(e){console.error(e)}const a=yield fetch(r.toString(),{method:n,body:o,headers:s,credentials:"omit"}),l=yield a.json();t({data:l,headersRaw:a.headers,headers:Object.fromEntries([...a.headers]),status:a.status,statusText:a.statusText,ok:a.ok})}catch(e){i(e)}}));this._deviceInfoPromise?this._deviceInfoPromise.finally(r):r()}))}))}post(e,t){return R(this,void 0,void 0,(function*(){return this.request({method:"post",url:e,data:t})}))}get(e,t){return R(this,void 0,void 0,(function*(){return this.request({method:"get",url:e,params:t})}))}};function N(e,t,i){var r,n,s;if("sendBeacon"in navigator){const a=new URLSearchParams({access_token:o.getState().apiKey,session_id:null===(n=null===(r=m.getState())||void 0===r?void 0:r.session)||void 0===n?void 0:n.id,x_user_agent:P}),l=o.getState();null!=l.appPackageId&&a.append("x_app_package_id",l.appPackageId);const d=`${s=D.baseURL,s.replace(/\/$/,"")}/${E(e)}?${a.toString()}`,c=new FormData;Object.keys(t).forEach((e=>{x.convertModelToFormData(c,t[e],e)}));let u=!1;null!=Array.from&&null!=c.keys&&(u=0===Array.from(c.keys()).length),u||navigator.sendBeacon(d,c),i()}else D.post(e,t).then((()=>i()),(()=>i()))}D.interceptors.request.use((e=>{var t,i,r;const n=o.getState();return e.headers=O(null!==(t=e.headers)&&void 0!==t?t:{},{Authorization:`Bearer ${n.apiKey}`,"Accept-Language":n.lang||"en","Auth-Session-Id":null===(r=null===(i=m.getState())||void 0===i?void 0:i.session)||void 0===r?void 0:r.id,"X-Device-Id":g.getState(),"X-User-Id":n.userId?n.userId:"","X-Request-Id":(0,_.v4)(),"X-User-Agent":P}),null!=n.appPackageId&&(e.headers["X-App-Package-Id"]=n.appPackageId),n.disableDeviceId||(e.headers["X-Device-Id"]=g.getState()),e}));const F=D;var j;!function(e){e.EVENT_UPDATED_COMMON_OPTIONS="updatedCommonOptions",e.EVENT_UPDATED_STORIES_LIST_OPTIONS="updatedStoriesListOptions",e.EVENT_UPDATED_STORY_READER_OPTIONS="updatedStoryReaderOptions",e.EVENT_UPDATED_FAVORITE_READER_OPTIONS="updatedFavoriteReaderOptions",e.EVENT_UPDATED_GAME_READER_OPTIONS="updatedGameReaderOptions",e.EVENT_UPDATED_GOODS_WIDGET_OPTIONS="updatedGoodsWidgetOptions"}(j||(j={}));Error;var B,U=p(46),V=p.n(U);!function(e){e.LEFT="left",e.RIGHT="right"}(B||(B={}));const G={hasFavorite:!1,hasLike:!1,hasShare:!1,closeButtonPosition:B.RIGHT,loader:{default:{color:"white",accentColor:"transparent"},custom:null},closeButton:{svgSrc:{baseState:'<svg width="30" height="30" viewBox="0 0 30 30" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path d="M30 15.2115C30 23.4958 23.2843 30.2115 15 30.2115C6.71573 30.2115 0 23.4958 0 15.2115C0 6.92728 6.71573 0.211548 15 0.211548C23.2843 0.211548 30 6.92728 30 15.2115Z" fill="white"/>\n<path fill-rule="evenodd" clip-rule="evenodd" d="M9.8309 10.0424C10.0969 9.77646 10.5281 9.77646 10.7941 10.0424L15 14.2483L19.2059 10.0424C19.4719 9.77646 19.9031 9.77646 20.1691 10.0424C20.4351 10.3084 20.4351 10.7397 20.1691 11.0057L15.9632 15.2115L20.1691 19.4174C20.4351 19.6834 20.4351 20.1147 20.1691 20.3807C19.9031 20.6466 19.4719 20.6466 19.2059 20.3807L15 16.1748L10.7941 20.3807C10.5281 20.6466 10.0969 20.6466 9.8309 20.3807C9.56492 20.1147 9.56492 19.6834 9.8309 19.4174L14.0368 15.2115L9.8309 11.0057C9.56492 10.7397 9.56492 10.3084 9.8309 10.0424Z" fill="#C2C2C4"/>\n</svg>'}},forceDesktopMode:void 0};var z,W,$,q,H,Z,Q;!function(e){e.CENTER="center",e.LEFT="left",e.RIGHT="right"}(z||(z={})),function(e){e.CIRCLE="circle",e.QUAD="quad",e.RECTANGLE="rectangle"}(W||(W={})),function(e){e.LEFT="left",e.CENTER="center",e.RIGHT="right"}($||($={})),function(e){e.CARD_INSIDE_BOTTOM="cardInsideBottom",e.CARD_OUTSIDE_TOP="cardOutsideTop",e.CARD_OUTSIDE_BOTTOM="cardOutsideBottom"}(q||(q={})),function(e){e.Medium="medium",e.High="high"}(H||(H={})),function(e){e.COLUMN="vertical",e.ROW="horizontal"}(Z||(Z={})),function(e){e.START_LOADER="startLoad",e.END_LOADER="endLoad"}(Q||(Q={}));const X={direction:Z.ROW,card:{title:{font:'14px/1.2 system-ui, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"',color:"#ffffff",padding:15,textAlign:$.LEFT,position:q.CARD_INSIDE_BOTTOM,display:!0,lineClamp:3},gap:10,height:70,aspectRatio:null,coverQuality:H.High,variant:W.CIRCLE,border:{radius:0,color:"black",width:2,gap:3,gradient:null},boxShadow:null,dropShadow:null,opacity:null,mask:{color:null,linearGradient:null},svgMask:null,opened:{border:{radius:null,color:null,width:null,gap:null,gradient:null},boxShadow:null,dropShadow:null,opacity:null,mask:{color:null,linearGradient:null},svgMask:null},coverLazyLoading:!1},favoriteCard:{title:{content:"Избранное",font:"normal",color:"#000",padding:15,textAlign:$.LEFT,position:q.CARD_INSIDE_BOTTOM,display:!0,lineClamp:3},gap:10,height:70,aspectRatio:null,coverQuality:H.High,coverLazyLoading:!1,variant:W.CIRCLE,border:{radius:0,color:"black",width:2,gap:3,gradient:null},boxShadow:null,dropShadow:null,opacity:null,mask:{color:null,linearGradient:null},svgMask:null,opened:{border:{radius:null,color:null,width:null,gap:null,gradient:null},boxShadow:null,dropShadow:null,opacity:null,mask:{color:null,linearGradient:null},svgMask:null}},sidePadding:20,topPadding:20,bottomPadding:20,bottomMargin:17,layout:{height:0,backgroundColor:"transparent",sliderAlign:z.LEFT},navigation:{speed:300,showControls:!1,controlsSize:48,controlsBackgroundColor:"white",controlsColor:"black"},ugcCard:{title:{content:null,font:'14px/1.2 system-ui, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"',color:"#000",padding:15,textAlign:$.LEFT,position:q.CARD_INSIDE_BOTTOM,display:!0,lineClamp:3},gap:10,height:70,aspectRatio:null,coverQuality:H.High,coverLazyLoading:!1,variant:W.CIRCLE,border:{radius:0,color:"transparent",width:0,gap:0,gradient:null},boxShadow:null,dropShadow:null,opacity:null,mask:{color:null,linearGradient:null},svgMask:null,image:{svgSrc:{baseState:'<svg width="100" height="100" viewBox="0 0 100 100" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path d="M50 85.5C69.6061 85.5 85.5 69.6061 85.5 50C85.5 30.3939 69.6061 14.5 50 14.5C30.3939 14.5 14.5 30.3939 14.5 50C14.5 69.6061 30.3939 85.5 50 85.5Z" stroke="white" stroke-width="2"/>\n<path d="M50.5 34.5V65.5" stroke="white" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>\n<path d="M34.5 49.5H65.5" stroke="white" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>\n</svg>\n'}},backgroundColor:"#0c62f3"}},Y={label:"X",icon:{svgSrc:{baseState:'\n<svg width="50px" height="50px" viewBox="0 0 195 195" xmlns="http://www.w3.org/2000/svg">\n<g transform="matrix(.20227 0 0 .20302 -71 -26.7)">\n<circle cx="834.3" cy="610.6" r="481.3" stroke="#fff" strokeMiterlimit="10"/>\n<path d="m537.8 331.8 230 307.6-231.4 250.1h52.2l202.6-219 163.8 219h177.3l-243-324.9 215.5-232.8h-52l-187 201.7-150.7-201.7zm76.6 38.4h81.5l359.7 481h-81.5z" fill="#fff"/>\n</g>\n</svg>\n'}},getUrl:({url:e,text:t})=>`https://twitter.com/share?url=${e}&text=${t}`},K={targets:["vk","ok","facebook","x","linkedin","telegram"],targetParams:{vk:{label:"VK",icon:{svgSrc:{baseState:'\n<svg width="50px" height="50px" viewBox="0 0 48 48" xmlns="http://www.w3.org/2000/svg">\n<circle cx="24" cy="24" r="21.3" fill="#fff"/>\n<path d="M22.3.7a23.3 23.3 0 0 0-5 45.6A23.4 23.4 0 0 0 30.7 1.7C28 .8 25.2.6 22.3.7Zm1.8 14.5c1.2.1 1.8.3 2 .6l.3.6c.2.4.2.8 0 4.3 0 2.2 0 2.9.2 3.4s.7.8 1.1.6a8 8 0 0 0 1.8-2 29 29 0 0 0 3-5.8c.3-.4.5-.7.8-.8h7.1a.7.7 0 0 1 .5.8c0 .7-.8 2.2-2 4a92.7 92.7 0 0 1-3.5 4.8c-.3.5-.2 1 .2 1.6l1.4 1.4c1.8 1.7 2.6 2.6 3.3 3.6.4.7.6 1.2.5 1.7 0 .2-.2.5-.5.6-.4.2-.9.2-3.7.3H34l-.5-.1c-1-.4-1.8-1-3.5-3-.9-1-1.6-1.5-2-1.5-.5 0-1 .6-1.3 1.3-.1.5-.2.8-.2 1.7-.1 1-.2 1.2-.8 1.5H22a9.5 9.5 0 0 1-4.2-1.4c-1.9-1.1-3-2.2-4.4-3.8a48.7 48.7 0 0 1-7.2-12.5c-.1-.5 0-.9.5-1l3-.1h3c.5.3.7.5 1 1.4L16 22c.5.9 1 1.6 1.5 2 .6.6.9.7 1.3.7.3 0 .4-.1.6-.6.5-1 .6-4.8.1-6.3-.2-.8-.6-1.1-1.7-1.3-.2 0-.2-.2 0-.4.4-.6 1.1-.9 2.6-1H24Z" fill="#45668E"/>\n</svg>'}},getUrl:({url:e,text:t})=>`https://vk.com/share.php?url=${e}&title=${t}`},facebook:{label:"Facebook",icon:{svgSrc:{baseState:'\n<svg width="50px" height="50px" viewBox="126.4 2.3 589 589" xmlns="http://www.w3.org/2000/svg">\n<circle cx="420.9" cy="296.8" r="294.5" fill="#3c5a9a"/>\n<path d="M516.7 92.7h-65.2c-38.8 0-81.8 16.3-81.8 72.4.2 19.5 0 38.3 0 59.3h-44.8v71.3h46.2V501h84.8V294.4h56l5-70.2h-62.4V184c0-22.2 23-21 24.4-21h37.8V92.8z" fill="#fff"/>\n</svg>\n'}},getUrl:({url:e,text:t})=>`https://www.facebook.com/sharer.php?u=${e}&t=${t}`},x:Y,twitter:Y,linkedin:{label:"LinkedIn",icon:{svgSrc:{baseState:'\n<svg width="50px" height="50px" enableBackground="new 0 0 550 550" version="1.1" viewBox="0 0 550 550" xmlSpace="preserve" xmlns="http://www.w3.org/2000/svg" xmlnsXlink="http://www.w3.org/1999/xlink">\n<circle cx="275" cy="275" r="256" fill="#04689B"/>\n<path d="m219.2 366.5h-38.8v-124.3h38.8v124.3zm-20.4-139.9h-0.3c-14.1 0-23.2-9.5-23.2-21.6 0-12.3 9.4-21.6 23.7-21.6s23.1 9.3 23.4 21.5c0.1 12.2-9 21.7-23.6 21.7zm175.8 139.9h-44v-64.3c0-16.8-6.9-28.3-22-28.3-11.6 0-18 7.7-21 15.2-1.1 2.7-0.9 6.4-0.9 10.2v67.3h-43.7s0.6-113.9 0-124.3h43.6v19.5c2.6-8.5 16.5-20.7 38.8-20.7 27.6 0 49.3 17.9 49.3 56.4v69z" fill="#fff"/>\n</svg>\n'}},getUrl:({url:e,text:t})=>`https://www.linkedin.com/sharing/share-offsite/?url=${e}&title=${t}`},telegram:{label:"Telegram",icon:{svgSrc:{baseState:'<svg data-v-05f1b0f5="" data-v-b5b60290="" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 240 240" width="50px" height="50px"><defs data-v-05f1b0f5=""><linearGradient data-v-05f1b0f5="" id="a" x1="120" y1="240" x2="120" gradientUnits="userSpaceOnUse"><stop data-v-05f1b0f5="" offset="0" stop-color="#1d93d2"></stop><stop data-v-05f1b0f5="" offset="1" stop-color="#38b0e3"></stop></linearGradient></defs><circle data-v-05f1b0f5="" cx="120" cy="120" r="120" fill="url(#a)"></circle><path data-v-05f1b0f5="" d="m81.2 128.8 14.3 39.4s1.7 3.7 3.7 3.7 30.2-29.5 30.2-29.5l31.5-61-79.2 37.2Z" fill="#c8daea"></path><path data-v-05f1b0f5="" d="m100.1 138.9-2.7 29s-1.2 9 7.7 0 17.4-15.7 17.4-15.7" fill="#a9c6d8"></path><path data-v-05f1b0f5="" d="m81.5 130.2-29.3-9.6s-3.5-1.4-2.4-4.6c.3-.7.7-1.2 2.1-2.2C58.4 109.3 172 68.4 172 68.4s3.2-1 5.1-.3a2.8 2.8 0 0 1 2 2 9.4 9.4 0 0 1 .2 2.6l-.2 2.6c-.7 11.1-21.4 94.4-21.4 94.4s-1.2 5-5.7 5a8.1 8.1 0 0 1-5.9-2.2 797.1 797.1 0 0 0-45.5-32.2 1.3 1.3 0 0 1-.5-.9c-.1-.4.4-1 .4-1s52.4-46.6 53.8-51.5c.1-.4-.3-.6-.8-.4C150 87.8 89.6 125.9 83 130a3.2 3.2 0 0 1-1.5 0Z" fill="#fff"></path></svg>\n'}},getUrl:({url:e,text:t})=>`https://t.me/share/url?url=${e}&text=${t}`},ok:{label:"OK",icon:{svgSrc:{baseState:'\n<svg width="50px" height="50px" viewBox="0 0 388.4 387.1" xmlSpace="preserve" xmlns="http://www.w3.org/2000/svg">\n<path d="M331.7 330.2a194.2 193.5 0 0 1-273.9 1.1 194.2 193.5 0 0 1-2.6-272.9A194.2 193.5 0 0 1 329 54.2a194.2 193.5 0 0 1 5.7 273" fill="#faab62" style="mixBlendMode:normal"/>\n<path d="m328.7 327.1a189.2 188.5 0 0 1-266.9 1.2 189.2 188.5 0 0 1-2.5-266 189.2 188.5 0 0 1 266.7-4 189.2 188.5 0 0 1 5.6 265.9" fill="#f7931e" style="mixBlendMode:normal"/>\n<g fill="#fff" style="mixBlendMode:normal">\n<path d="m217.4 253.5c28-5.7 44.7-19 45.6-19.7a19 19 0 0 0-23.8-29.6c-0.2 0.1-18 13.8-47.5 13.8a84.5 84.5 0 0 1-47.8-13.8 19 19 0 0 0-23.8 29.6c1 0.7 18.4 14.3 47.1 19.9l-40 41.9a19 19 0 1 0 27.3 26.3l37.2-39.6 41 39.9a19 19 0 1 0 26.9-26.9z"/>\n<path transform="translate(-1.8 .2)" d="m194.5 57.9a69.9 69.9 0 1 0 0 139.8 69.9 69.9 0 0 0 0-139.8zm0 98.8a28.9 28.9 0 1 1 0-57.8 28.9 28.9 0 0 1 0 57.8z" style="mixBlendMode:normal"/>\n</g>\n</svg>\n'}},getUrl:({url:e,text:t})=>`https://connect.ok.ru/offer?url=${e}&title=${t}`}},copyButton:{label:"Copy link",svgSrc:{baseState:'<svg width="31.5px" height="35px" fill="none" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 18 20"><path d="M6.6 0a2 2 0 0 0-2 2v12c0 1.2.9 2 2 2h9a2 2 0 0 0 2-2V2a2 2 0 0 0-2-2h-9Zm0 2h9v12h-9V2Z" fill="currentColor"/><path d="M2.6 20a2 2 0 0 1-2-2V5h2v13h10v2h-10Z" fill="currentColor"/></svg>'}},downloadButton:{svgSrc:{baseState:'<svg width="30" height="30" viewBox="0 0 32 32" xml:space="preserve" xmlns="http://www.w3.org/2000/svg"><g fill="currentColor"><path d="M31 22a1 1 0 0 0-1 1v7H2v-7a1 1 0 0 0-2 0v8c0 .6.4 1 1 1h30c.6 0 1-.4 1-1v-8c0-.6-.4-1-1-1z"/><path d="M15.3 23.7c.4.4 1 .4 1.4 0l7-6.9c.4-.4.4-1 0-1.4a1 1 0 0 0-1.4 0L17 20.6V1a1 1 0 0 0-2 0v19.6l-5.3-5.2a1 1 0 0 0-1.4 0 1 1 0 0 0 0 1.4l7 7z"/></g></svg>'}},title:{favicon:{background:"white",display:!0},getValue:({url:e})=>e},background:"#202125",borderRadius:20,divider:{background:"#36373b"},text:{color:"white",font:"inherit"}};var J;!function(e){e.FLAT="flat",e.COVER="cover",e.CUBE="cube"}(J||(J={}));const ee={gameReaderOptions:{loader:{default:{color:"white",accentColor:"transparent"},custom:null}},scrollStyle:J.FLAT,timelineBlockTopOffset:8,actionPanelBottomOffset:0,borderRadius:12,loader:{default:{color:"white",accentColor:"transparent"},custom:null},recycleStoriesList:!1,closeOnLastSlideByTimer:!0,sharePanel:K,commonBackdrop:{color:"rgba(51, 51, 51, 1)",backdropFilter:null},slideBackdrop:{opacity:.56,blur:30,linearGradientOverlay:["rgba(0, 0, 0, 0.1) 0%","rgba(0, 0, 0, 0.9) 100%"]},faviconApiUrl:"",navigation:{prevButton:{svgSrc:{baseState:'<svg width="32" height="32" viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg">\n <path d="M19.8076 6.80761L9.20101 17.4142L7.7868 16L18.3934 5.3934L19.8076 6.80761Z" fill="currentColor" />\n <path d="M18.3934 26.6066L7.7868 16L9.20101 14.5858L19.8076 25.1924L18.3934 26.6066Z" fill="currentColor" />\n </svg>'}},nextButton:{svgSrc:{baseState:'<svg width="32" height="32" viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg">\n <path d="M12.1924 25.1924L22.799 14.5858L24.2132 16L13.6066 26.6066L12.1924 25.1924Z" fill="currentColor" />\n <path d="M13.6066 5.3934L24.2132 16L22.799 17.4142L12.1924 6.80761L13.6066 5.3934Z" fill="currentColor" />\n </svg>'}}},likeButton:{svgSrc:{baseState:'<svg width="30" height="30" viewBox="0 0 30 30" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path d="M6.96277 15.177L8.11552 15.1837C8.75334 15.1873 9.26846 15.7054 9.26846 16.3433V22.7329C9.26846 23.376 8.74519 23.8962 8.10215 23.8925L6.94939 23.8859C6.31157 23.8822 5.79645 23.3641 5.79645 22.7263V16.3366C5.79645 15.6936 6.31972 15.1733 6.96277 15.177Z" stroke="white" stroke-width="1.21546"/>\n<path d="M11.2546 15.0917L11.3801 23.0645C11.3867 23.4802 11.6013 23.8648 11.9516 24.0886C12.119 24.1955 12.4834 24.2735 12.4834 24.2735L13.1084 24.3569L13.9973 24.4541L15.9789 24.5912L17.4834 24.6365H18.9642L19.282 24.6229C19.7715 24.6018 20.258 24.5358 20.7354 24.4256L21.1038 24.3406C21.3122 24.2925 21.516 24.2263 21.7128 24.1428L21.7439 24.1295C22.0493 23.9999 22.3342 23.8269 22.59 23.6157L22.717 23.5108C22.873 23.382 23.0108 23.2326 23.1265 23.0666L23.1451 23.04C23.2426 22.9003 23.3217 22.7485 23.3804 22.5886L23.428 22.4586C23.5278 22.1867 23.5473 21.8918 23.4842 21.6092L23.4296 21.3645C23.4285 21.3594 23.4265 21.3544 23.4237 21.3499C23.4102 21.3285 23.4163 21.3002 23.4374 21.2862L23.7911 21.0504V21.0504C23.8452 21.0143 23.8957 20.9723 23.9416 20.9263V20.9263C23.99 20.8728 24.0444 20.8083 24.0805 20.7458L24.1361 20.6625C24.2924 20.3945 24.3931 20.0167 24.4083 19.7069L24.4118 19.6352C24.4205 19.458 24.4079 19.2804 24.3744 19.1062L24.3305 18.8986C24.325 18.8696 24.2749 18.7163 24.2611 18.6902L24.1718 18.5154C24.1644 18.5014 24.1898 18.473 24.1898 18.473L24.3653 18.2658C24.4983 18.1109 24.6033 17.9305 24.673 17.7386C24.7222 17.6035 24.7532 17.4657 24.775 17.3153L24.7889 17.1764L24.7957 17.0468C24.8164 16.8366 24.7978 16.6244 24.7409 16.421C24.6929 16.2496 24.6183 16.0868 24.5198 15.9385L24.1983 15.4542C24.1843 15.4367 24.1808 15.413 24.1891 15.3922L24.3081 15.1055C24.3652 14.9628 24.4224 14.6641 24.4391 14.4717L24.4307 14.2984C24.4026 14.0113 24.2405 13.6815 24.0757 13.4238L23.9912 13.3055C23.7236 12.9608 23.3474 12.7334 22.9388 12.5804L22.706 12.4932C22.3923 12.3758 22.0667 12.3327 21.7279 12.2916L21.3444 12.2597C20.89 12.2378 20.2444 12.2651 19.7945 12.3327L18.1092 12.5861C18.1014 12.5873 18.0935 12.5879 18.0857 12.5879H18.0692C17.991 12.5879 17.9276 12.5245 17.9276 12.4462C17.9276 12.4387 17.9282 12.4312 17.9293 12.4238L18.1222 11.3847L18.5408 9.72426C18.6303 9.39087 18.6888 9.04995 18.7158 8.70582L18.7581 8.1657C18.7857 7.81269 18.746 7.45764 18.6411 7.11944L18.6144 7.03332C18.52 6.72899 18.3649 6.44697 18.1583 6.20434L18.1116 6.14941C17.819 5.80563 17.4249 5.56351 16.9859 5.45788L16.7169 5.39313C16.4437 5.32739 16.1567 5.3518 15.8986 5.46269C15.6593 5.56548 15.4564 5.73766 15.316 5.95699L15.2994 5.98302C15.155 6.20866 15.0783 6.47094 15.0783 6.73882V7.10777C15.0783 7.45352 15.0109 7.79596 14.88 8.11598L14.1668 9.85969C13.9176 10.4691 13.6196 11.0573 13.2758 11.6188L12.5778 12.7586C12.4514 12.9651 12.3013 13.1561 12.1306 13.3278L12.0855 13.3731C11.6243 13.837 11.3317 14.442 11.2546 15.0917Z" stroke="white" stroke-width="1.21546"/>\n</svg>',activeState:'<svg width="30" height="30" viewBox="0 0 30 30" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path d="M6.96277 15.1771L8.11552 15.1838C8.75334 15.1875 9.26846 15.7056 9.26846 16.3434V22.733C9.26846 23.3761 8.74519 23.8964 8.10215 23.8926L6.94939 23.886C6.31157 23.8823 5.79645 23.3642 5.79645 22.7264V16.3368C5.79645 15.6937 6.31972 15.1734 6.96277 15.1771Z" fill="white" stroke="white" stroke-width="1.21546"/>\n<path d="M11.2546 15.0918L11.3801 23.0646C11.3867 23.4803 11.6013 23.8649 11.9516 24.0888C12.119 24.1957 12.4834 24.2737 12.4834 24.2737L13.1084 24.357L13.9973 24.4542L15.9789 24.5913L17.4834 24.6367H18.9642L19.282 24.623C19.7715 24.6019 20.258 24.5359 20.7354 24.4257L21.1038 24.3407C21.3122 24.2926 21.516 24.2264 21.7128 24.1429L21.7439 24.1297C22.0493 24.0001 22.3342 23.827 22.59 23.6158L22.717 23.5109C22.873 23.3821 23.0108 23.2327 23.1265 23.0668L23.1451 23.0401C23.2426 22.9004 23.3217 22.7487 23.3804 22.5887L23.428 22.4588C23.5278 22.1868 23.5473 21.892 23.4842 21.6093L23.4296 21.3647C23.4285 21.3595 23.4265 21.3545 23.4237 21.3501C23.4102 21.3286 23.4163 21.3004 23.4374 21.2863L23.7911 21.0505V21.0505C23.8452 21.0144 23.8957 20.9724 23.9416 20.9265V20.9265C23.99 20.8729 24.0444 20.8084 24.0805 20.7459L24.1361 20.6626C24.2924 20.3946 24.3931 20.0168 24.4083 19.707L24.4118 19.6353C24.4205 19.4581 24.4079 19.2805 24.3744 19.1063L24.3305 18.8987C24.325 18.8697 24.2749 18.7165 24.2611 18.6904L24.1718 18.5155C24.1644 18.5015 24.1898 18.4732 24.1898 18.4732L24.3653 18.2659C24.4983 18.1111 24.6033 17.9306 24.673 17.7387C24.7222 17.6036 24.7532 17.4658 24.775 17.3154L24.7889 17.1765L24.7957 17.0469C24.8164 16.8367 24.7978 16.6245 24.7409 16.4211C24.6929 16.2497 24.6183 16.0869 24.5198 15.9386L24.1983 15.4543C24.1843 15.4368 24.1808 15.4131 24.1891 15.3923L24.3081 15.1056C24.3652 14.9629 24.4224 14.6642 24.4391 14.4718L24.4307 14.2985C24.4026 14.0114 24.2405 13.6817 24.0757 13.4239L23.9912 13.3056C23.7236 12.9609 23.3474 12.7336 22.9388 12.5805L22.706 12.4934C22.3923 12.3759 22.0667 12.3329 21.7279 12.2918L21.3444 12.2598C20.89 12.2379 20.2444 12.2652 19.7945 12.3329L18.1092 12.5863C18.1014 12.5874 18.0935 12.588 18.0857 12.588H18.0692C17.991 12.588 17.9276 12.5246 17.9276 12.4464C17.9276 12.4389 17.9282 12.4313 17.9293 12.4239L18.1222 11.3849L18.5408 9.72438C18.6303 9.391 18.6888 9.05007 18.7158 8.70594L18.7581 8.16582C18.7857 7.81281 18.746 7.45776 18.6411 7.11956L18.6144 7.03344C18.52 6.72911 18.3649 6.4471 18.1583 6.20446L18.1116 6.14953C17.819 5.80575 17.4249 5.56363 16.9859 5.458L16.7169 5.39325C16.4437 5.32751 16.1567 5.35192 15.8986 5.46281C15.6593 5.5656 15.4564 5.73778 15.316 5.95711L15.2994 5.98314C15.155 6.20878 15.0783 6.47106 15.0783 6.73895V7.10789C15.0783 7.45364 15.0109 7.79608 14.88 8.1161L14.1668 9.85982C13.9176 10.4692 13.6196 11.0574 13.2758 11.6189L12.5778 12.7588C12.4514 12.9652 12.3013 13.1562 12.1306 13.3279L12.0855 13.3732C11.6243 13.8371 11.3317 14.4421 11.2546 15.0918Z" fill="white" stroke="white" stroke-width="1.21546"/>\n</svg>'}},dislikeButton:{svgSrc:{baseState:'<svg width="30" height="30" viewBox="0 0 30 30" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path d="M24.2033 13.6632C24.2033 14.3062 23.68 14.8265 23.037 14.8228L21.8842 14.8161C21.2464 14.8125 20.7313 14.2944 20.7313 13.6565V7.2669C20.7313 6.62385 21.2546 6.10359 21.8976 6.1073L23.0504 6.11395C23.6882 6.11762 24.2033 6.63572 24.2033 7.27355V13.6632Z" stroke="white" stroke-width="1.21547"/>\n<path d="M18.7451 14.9082L18.6196 6.93531C18.6131 6.51965 18.3984 6.13499 18.0481 5.91118C17.8808 5.80428 17.5164 5.72628 17.5164 5.72628L16.8914 5.64295L16.0025 5.54572L14.0208 5.4086L12.5164 5.36328H11.0356L10.7178 5.37695C10.2283 5.398 9.74173 5.46403 9.26432 5.57421L8.89596 5.65921C8.68758 5.7073 8.4838 5.7735 8.28695 5.85706L8.25581 5.87027C7.95049 5.99987 7.66551 6.17296 7.40975 6.38416L7.28278 6.48901C7.12677 6.61783 6.989 6.76725 6.87323 6.93318L6.85466 6.95981C6.75716 7.09955 6.67809 7.25128 6.6194 7.41124L6.57172 7.54119C6.47196 7.81311 6.45245 8.10797 6.51553 8.39066L6.57011 8.63528C6.57127 8.64045 6.57329 8.64539 6.5761 8.64989C6.58951 8.67134 6.58343 8.69958 6.56238 8.71361L6.20864 8.94944V8.94944C6.15453 8.98551 6.10408 9.0275 6.05811 9.07348V9.07348C6.00973 9.12703 5.95532 9.19155 5.91922 9.25403L5.86366 9.33737C5.70735 9.60533 5.60662 9.98309 5.59145 10.2929L5.58794 10.3646C5.57927 10.5418 5.59182 10.7194 5.62532 10.8937L5.66922 11.1012C5.6748 11.1302 5.72484 11.2835 5.73866 11.3096L5.82792 11.4845C5.83532 11.4984 5.80994 11.5268 5.80994 11.5268L5.63444 11.734C5.50143 11.8889 5.3965 12.0693 5.32674 12.2612C5.27758 12.3964 5.24658 12.5341 5.22478 12.6846L5.21089 12.8235L5.20405 12.953C5.18333 13.1632 5.20192 13.3755 5.25887 13.5788C5.30686 13.7503 5.38145 13.9131 5.47991 14.0614L5.80147 14.5456C5.81547 14.5631 5.81898 14.5868 5.81066 14.6076L5.69163 14.8944C5.63456 15.037 5.57739 15.3357 5.56065 15.5282L5.5691 15.7014C5.5972 15.9885 5.75924 16.3183 5.92402 16.576L6.00853 16.6943C6.2762 17.039 6.65231 17.2664 7.06099 17.4194L7.2938 17.5066C7.60742 17.624 7.93309 17.6671 8.27189 17.7082L8.65531 17.7401C9.10973 17.762 9.75538 17.7347 10.2053 17.6671L11.8906 17.4137C11.8984 17.4125 11.9062 17.4119 11.9141 17.4119H11.9305C12.0088 17.4119 12.0722 17.4753 12.0722 17.5536C12.0722 17.5611 12.0716 17.5686 12.0704 17.576L11.8775 18.6151L11.459 20.2756C11.3695 20.6089 11.3109 20.9499 11.284 21.294L11.2417 21.8341C11.214 22.1871 11.2537 22.5422 11.3586 22.8804L11.3853 22.9665C11.4797 23.2708 11.6349 23.5528 11.8414 23.7955L11.8882 23.8504C12.1808 24.1942 12.5749 24.4363 13.0138 24.5419L13.2829 24.6067C13.556 24.6724 13.8431 24.648 14.1012 24.5371C14.3404 24.4343 14.5434 24.2622 14.6837 24.0428L14.7004 24.0168C14.8448 23.7912 14.9215 23.5289 14.9215 23.261V22.892C14.9215 22.5463 14.9888 22.2039 15.1197 21.8838L15.8329 20.1401C16.0821 19.5308 16.3801 18.9425 16.7239 18.381L17.4219 17.2412C17.5483 17.0347 17.6984 16.8437 17.8691 16.6721L17.9142 16.6267C18.3755 16.1629 18.668 15.5578 18.7451 14.9082Z" stroke="white" stroke-width="1.21547"/>\n</svg>',activeState:'<svg width="30" height="30" viewBox="0 0 30 30" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path d="M24.2035 13.6629C24.2035 14.3059 23.6803 14.8262 23.0372 14.8225L21.8845 14.8158C21.2466 14.8122 20.7315 14.2941 20.7315 13.6562V7.26655C20.7315 6.62348 21.2548 6.10322 21.8978 6.10693L23.0506 6.11358C23.6884 6.11725 24.2035 6.63535 24.2035 7.27319V13.6629Z" fill="white" stroke="white" stroke-width="1.21547"/>\n<path d="M18.7454 14.9079L18.6199 6.93496C18.6133 6.51929 18.3987 6.13463 18.0484 5.91082C17.881 5.80392 17.5166 5.72592 17.5166 5.72592L16.8916 5.64258L16.0027 5.54536L14.021 5.40824L12.5166 5.36292H11.0358L10.718 5.37659C10.2285 5.39764 9.74192 5.46367 9.26451 5.57384L8.89614 5.65885C8.68776 5.70694 8.48398 5.77314 8.28713 5.8567L8.25599 5.86991C7.95066 5.99951 7.66569 6.1726 7.40992 6.3838L7.28295 6.48865C7.12694 6.61747 6.98917 6.7669 6.8734 6.93283L6.85483 6.95946C6.75733 7.0992 6.67826 7.25093 6.61957 7.41088L6.57189 7.54084C6.47212 7.81276 6.45262 8.10762 6.5157 8.39032L6.57028 8.63494C6.57143 8.64011 6.57346 8.64505 6.57627 8.64954C6.58968 8.671 6.5836 8.69923 6.56255 8.71327L6.2088 8.9491C6.1547 8.98517 6.10425 9.02716 6.05827 9.07314C6.0099 9.12669 5.95549 9.19121 5.91938 9.25369L5.86383 9.33703C5.70751 9.60499 5.60678 9.98276 5.59161 10.2926L5.58811 10.3643C5.57943 10.5415 5.59198 10.7191 5.62549 10.8933L5.66938 11.1009C5.67496 11.1299 5.72501 11.2831 5.73883 11.3092L5.82808 11.4841C5.83549 11.4981 5.8101 11.5264 5.8101 11.5264L5.63461 11.7337C5.50159 11.8886 5.39666 12.069 5.3269 12.2609C5.27775 12.396 5.24674 12.5338 5.22494 12.6842L5.21105 12.8231L5.20421 12.9527C5.18349 13.1629 5.20208 13.3751 5.25903 13.5785C5.30702 13.7499 5.38161 13.9128 5.48007 14.061L5.80163 14.5453C5.81564 14.5628 5.81915 14.5865 5.81082 14.6073L5.69179 14.894C5.63472 15.0367 5.57755 15.3354 5.56081 15.5279L5.56926 15.7011C5.59737 15.9882 5.7594 16.318 5.92419 16.5757L6.0087 16.694C6.27636 17.0387 6.65248 17.2661 7.06116 17.4191L7.29397 17.5063C7.6076 17.6237 7.93327 17.6668 8.27207 17.7079L8.65549 17.7398C9.10991 17.7617 9.75557 17.7344 10.2055 17.6668L11.8908 17.4134C11.8986 17.4122 11.9064 17.4116 11.9143 17.4116H11.9307C12.009 17.4116 12.0724 17.4751 12.0724 17.5533C12.0724 17.5608 12.0718 17.5683 12.0706 17.5757L11.8777 18.6148L11.4592 20.2753C11.3697 20.6087 11.3111 20.9496 11.2842 21.2937L11.2419 21.8339C11.2142 22.1869 11.2539 22.5419 11.3588 22.8801L11.3855 22.9662C11.4799 23.2706 11.6351 23.5526 11.8416 23.7952L11.8884 23.8502C12.181 24.1939 12.5751 24.4361 13.014 24.5417L13.2831 24.6064C13.5562 24.6722 13.8433 24.6478 14.1014 24.5369C14.3407 24.4341 14.5436 24.2619 14.6839 24.0426L14.7006 24.0166C14.845 23.7909 14.9217 23.5286 14.9217 23.2607V22.8918C14.9217 22.546 14.989 22.2036 15.1199 21.8836L15.8331 20.1399C16.0824 19.5305 16.3803 18.9422 16.7241 18.3808L17.4221 17.2409C17.5486 17.0344 17.6987 16.8434 17.8694 16.6718L17.9144 16.6264C18.3757 16.1626 18.6683 15.5575 18.7454 14.9079Z" fill="white" stroke="white" stroke-width="1.21547"/>\n</svg>'}},favoriteButton:{svgSrc:{baseState:'<svg width="30" height="30" viewBox="0 0 30 30" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path d="M7.49976 7.25225V23.2366C7.49976 24.6882 9.33429 25.321 10.2292 24.1782L13.7974 19.6218C14.4088 18.8411 15.5907 18.8411 16.2021 19.6218L19.7703 24.1782C20.6652 25.321 22.4998 24.6882 22.4998 23.2366V7.25225C22.4998 5.98711 21.4742 4.96152 20.209 4.96152H9.79048C8.52535 4.96152 7.49976 5.98712 7.49976 7.25225Z" stroke="white" stroke-width="1.29808"/>\n</svg>',activeState:'<svg width="30" height="30" viewBox="0 0 30 30" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path d="M7.49976 7.04073V23.0251C7.49976 24.4767 9.33429 25.1095 10.2292 23.9667L13.7974 19.4103C14.4088 18.6296 15.5907 18.6296 16.2021 19.4103L19.7703 23.9667C20.6652 25.1095 22.4998 24.4766 22.4998 23.0251V7.04072C22.4998 5.77559 21.4742 4.75 20.209 4.75H9.79048C8.52535 4.75 7.49976 5.77559 7.49976 7.04073Z" fill="white" stroke="white" stroke-width="1.29808"/>\n</svg>'}},muteButton:{svgSrc:{baseState:'<svg width="30" height="31" viewBox="0 0 30 31" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path d="M3.40625 13.5734V18.7664C3.40625 19.7239 4.18245 20.5001 5.13993 20.5001H8.04633C8.6342 20.5001 9.17511 20.8213 9.45654 21.3374L11.903 25.8242C12.271 26.4992 12.9783 26.9192 13.7471 26.9192C14.9072 26.9192 15.8477 25.9788 15.8477 24.8187V7.52486C15.8477 6.36469 14.9072 5.42416 13.747 5.42412C12.9783 5.42409 12.2709 5.84393 11.9028 6.51875L9.45651 11.0026C9.17509 11.5184 8.63442 11.8394 8.04683 11.8394H5.14027C4.1826 11.8394 3.40625 12.6157 3.40625 13.5734Z" fill="white"/>\n<path d="M19.8477 13.0466L26.0976 19.2966M26.0976 13.0466L19.8477 19.2966" stroke="white" stroke-width="1.2" stroke-linecap="round" stroke-linejoin="round"/>\n</svg>',activeState:'<svg width="30" height="30" viewBox="0 0 30 30" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path d="M3.40625 12.5733V17.7663C3.40625 18.7238 4.18245 19.5 5.13993 19.5H8.04633C8.6342 19.5 9.17511 19.8212 9.45654 20.3373L11.903 24.8241C12.271 25.4991 12.9783 25.919 13.7471 25.9191C14.9072 25.9191 15.8477 24.9787 15.8477 23.8186V6.52474C15.8477 5.36457 14.9072 4.42404 13.747 4.424C12.9783 4.42397 12.2709 4.84381 11.9028 5.51863L9.45651 10.0025C9.17509 10.5183 8.63442 10.8392 8.04683 10.8392H5.14027C4.1826 10.8392 3.40625 11.6156 3.40625 12.5733Z" fill="white"/>\n<path d="M19.8477 11.4215C20.6323 12.4661 21.0972 13.7645 21.0972 15.1715C21.0972 16.5785 20.6323 17.8769 19.8477 18.9215M22.3472 6.78613C24.6487 8.84608 26.0972 11.8396 26.0972 15.1715C26.0972 18.5034 24.6487 21.4969 22.3472 23.5569" stroke="white" stroke-width="1.2" stroke-linecap="round" stroke-linejoin="round"/>\n</svg>'}},shareButton:{svgSrc:{baseState:'<svg width="30" height="31" viewBox="0 0 30 31" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path fill-rule="evenodd" clip-rule="evenodd" d="M19.5 10.9038C20.8488 10.9038 21.9423 9.81036 21.9423 8.46151C21.9423 7.11266 20.8488 6.01921 19.5 6.01921C18.1512 6.01921 17.0577 7.11266 17.0577 8.46151C17.0577 9.81036 18.1512 10.9038 19.5 10.9038ZM19.5 12.2115C21.5711 12.2115 23.25 10.5326 23.25 8.46151C23.25 6.39045 21.5711 4.71151 19.5 4.71151C17.4289 4.71151 15.75 6.39045 15.75 8.46151C15.75 8.98692 15.8581 9.48709 16.0531 9.94101L12.288 12.4511C11.6202 11.8367 10.7288 11.4615 9.74976 11.4615C7.67869 11.4615 5.99976 13.1404 5.99976 15.2115C5.99976 17.2826 7.67869 18.9615 9.74976 18.9615C10.7325 18.9615 11.6269 18.5835 12.2956 17.9649L16.018 20.5665C15.8451 20.9977 15.75 21.4685 15.75 21.9615C15.75 24.0326 17.4289 25.7115 19.5 25.7115C21.5711 25.7115 23.25 24.0326 23.25 21.9615C23.25 19.8904 21.5711 18.2115 19.5 18.2115C18.3369 18.2115 17.2974 18.7411 16.6096 19.5722L13.0138 17.0591C13.3231 16.5138 13.4998 15.8833 13.4998 15.2115C13.4998 14.5368 13.3216 13.9037 13.0097 13.3567L16.667 10.9185C17.3545 11.7106 18.3688 12.2115 19.5 12.2115ZM12.1921 15.2115C12.1921 16.5604 11.0986 17.6538 9.74976 17.6538C8.40091 17.6538 7.30745 16.5604 7.30745 15.2115C7.30745 13.8627 8.40091 12.7692 9.74976 12.7692C11.0986 12.7692 12.1921 13.8627 12.1921 15.2115ZM21.9423 21.9615C21.9423 23.3104 20.8488 24.4038 19.5 24.4038C18.1512 24.4038 17.0577 23.3104 17.0577 21.9615C17.0577 20.6127 18.1512 19.5192 19.5 19.5192C20.8488 19.5192 21.9423 20.6127 21.9423 21.9615Z" fill="white"/>\n</svg>'}}};var te;!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"}(te||(te={}));const ie={title:{content:"Favorite",font:"1.4rem/1.2 InternalPrimaryFont",color:"white",backgroundColor:"#333333"},headerTopOffset:0,bottomOffset:0,backgroundColor:"#333333"};var re,ne=p(2743),se=p.n(ne);!function(e){e.DEFAULT="default",e.CUSTOM_CARD="customCard"}(re||(re={}));const oe={goodsWidgetRenderingType:re.DEFAULT,goodsList:{renderingType:re.DEFAULT,closeBackgroundColor:"#000000",substrateHeight:200,substrateColor:"#FFFFFF",dimColor:"rgba(0, 0, 0, 0.5)"},goodsCard:{mainTextColor:"#000000",oldPriceTextColor:"#CCCCCC",imageBackgroundColor:"transparent",imageCornerRadius:8},openGoodsWidgetHandler:e=>Promise.resolve(e),loader:{default:{color:"gray",accentColor:"transparent"}}},ae={loader:{default:{color:"white",accentColor:"transparent"},custom:null},backdropColor:"#1a1a1a",backdrop:{opacity:1,background:"#1a1a1a"},game:{backdropColor:"rgb(51, 51, 51)"},forceDesktopMode:G.forceDesktopMode,forceCheckOrientation:!0};class le extends U.EventEmitter{constructor(){super(),this._commonOptions=G,this._storiesListOptions=X,this._storyReaderOptions=ee,this._storyFavoriteReaderOptions=ie,this._goodsWidgetOptions=oe,this._gameReaderOptions=ae,this._mqls=new Map,this._composeOptionsOverrideByMediaQuery=this._composeOptionsOverrideByMediaQuery.bind(this)}setCommonOptions(e,t=!0){return this._commonOptions=se()(this._commonOptions,e),this.emit(j.EVENT_UPDATED_COMMON_OPTIONS,this.commonOptions),this}get commonOptions(){return this._commonOptions}setStoriesListOptions(e,t=!0){return this._storiesListOptions=se()(this._storiesListOptions,e),t&&this.emit(j.EVENT_UPDATED_STORIES_LIST_OPTIONS,this.storiesListOptions),this}get storiesListOptions(){return this._storiesListOptions}setStoryReaderOptions(e,t=!0){return this._storyReaderOptions=se()(this._storyReaderOptions,e,{arrayMerge:(e,t,i)=>t}),t&&this.emit(j.EVENT_UPDATED_STORY_READER_OPTIONS,{storyReaderOptions:this.storyReaderOptions,gameReaderOptions:this.gameReaderOptions,appearanceCommon:this.commonOptions}),this}get storyReaderOptions(){const e={closeButtonPosition:this.commonOptions.closeButtonPosition,closeButton:this.commonOptions.closeButton,loader:this.commonOptions.loader};return Object.assign(Object.assign({},e),this._storyReaderOptions)}setStoryFavoriteReaderOptions(e,t=!0){return this._storyFavoriteReaderOptions=se()(this._storyFavoriteReaderOptions,e),t&&this.emit(j.EVENT_UPDATED_FAVORITE_READER_OPTIONS,this.storyFavoriteReaderOptions),this}get storyFavoriteReaderOptions(){const e={closeButtonPosition:this.commonOptions.closeButtonPosition,closeButton:this.commonOptions.closeButton};return Object.assign(Object.assign({},e),this._storyFavoriteReaderOptions)}setGoodsWidgetOptions(e,t=!0){return this._goodsWidgetOptions=se()(this._goodsWidgetOptions,e),t&&this.emit(j.EVENT_UPDATED_GOODS_WIDGET_OPTIONS,this.goodsWidgetOptions),this}get goodsWidgetOptions(){return this._goodsWidgetOptions}setGameReaderOptions(e,t=!0){return this._gameReaderOptions=se()(this._gameReaderOptions,e),t&&this.emit(j.EVENT_UPDATED_GAME_READER_OPTIONS,this.gameReaderOptions),this}get gameReaderOptions(){const e={closeButtonPosition:this.commonOptions.closeButtonPosition,closeButton:this.commonOptions.closeButton,loader:this.commonOptions.loader,forceDesktopMode:this.commonOptions.forceDesktopMode};return Object.assign(Object.assign({},e),this._gameReaderOptions)}setOptionsOverrideByMediaQuery(e){return this.removeMediaQueryEventListeners(),this.initMediaQueries(e),this}initMediaQueries(e){for(const t of e){const e=this._composeMqlCondition(t);if(null!==e&&null!=window.matchMedia){const i=window.matchMedia(e);this._mqls.set(i,t),i.addEventListener("change",this._composeOptionsOverrideByMediaQuery)}}this._composeOptionsOverrideByMediaQuery()}_composeMqlCondition(e){let t=null;if(null!=e.viewportMinSize){if("number"==typeof e.viewportMinSize)t=`(min-width: ${e.viewportMinSize}px)`;else if("string"==typeof e.viewportMinSize)switch(e.viewportMinSize){case"sm":t="(min-width: 576px)";break;case"md":t="(min-width: 768px)";break;case"lg":t="(min-width: 992px)";break;case"xl":t="(min-width: 1200px)";break;default:t=null}null!=e.mediaQuery&&"string"==typeof e.mediaQuery&&e.mediaQuery.length>0&&(t=e.mediaQuery)}return t}_composeOptionsOverrideByMediaQuery(e){const t=new Set;for(const[e,i]of this._mqls)e.matches&&(null!=i.commonOptions&&(this.setCommonOptions(i.commonOptions,!1),t.add("commonOptions")),null!=i.storiesListOptions&&(this.setStoriesListOptions(i.storiesListOptions,!0),t.add("storiesListOptions")),null!=i.storyReaderOptions&&(this.setStoryReaderOptions(i.storyReaderOptions,!1),t.add("storyReaderOptions")),null!=i.storyFavoriteReaderOptions&&(this.setStoryFavoriteReaderOptions(i.storyFavoriteReaderOptions,!1),t.add("storyFavoriteReaderOptions")),null!=i.goodsWidgetOptions&&(this.setGoodsWidgetOptions(i.goodsWidgetOptions,!1),t.add("goodsWidgetOptions")),null!=i.gameReaderOptions&&(this.setGameReaderOptions(i.gameReaderOptions,!1),t.add("gameReaderOptions")));t.forEach((e=>{switch(e){case"commonOptions":this.setCommonOptions({});break;case"storiesListOptions":this.setStoriesListOptions({});break;case"storyReaderOptions":this.setStoryReaderOptions({});break;case"storyFavoriteReaderOptions":this.setStoryFavoriteReaderOptions({});break;case"goodsWidgetOptions":this.setGoodsWidgetOptions({});break;case"gameReaderOptions":this.setGameReaderOptions({})}}))}removeMediaQueryEventListeners(){for(const e of this._mqls.keys())e.removeEventListener("change",this._composeOptionsOverrideByMediaQuery);this._mqls.clear()}destroy(){this.removeMediaQueryEventListeners()}}class de extends U.EventEmitter{constructor(e,t){super(),this.iframe=e,this.origin=t,this.messageListener=this.messageListener.bind(this),window.addEventListener("message",this.messageListener,!1)}messageListener(e){if(e.origin!==this.origin)return;const[t,...i]=e.data;try{if(!Array.isArray(e.data))throw new Error(`Invalid MessageEvent data format ${e.data}`);this.emit(t,...i)}catch(e){console.error(e)}}sendMessage(e,t){var i;null===(i=this.iframe.contentWindow)||void 0===i||i.postMessage([e,t],this.origin)}destroy(){window.removeEventListener("message",this.messageListener,!1),this.removeAllListeners()}}var ce;!function(e){e.StartGame="startGame",e.GameComplete="gameComplete",e.GameInstanceEvent="gameInstanceEvent",e.OpenUrl="openUrl",e.SendApiRequest="sendApiRequest",e.StorySetLocalData="storySetLocalData",e.GameInstanceSetLocalData="gameInstanceSetLocalData",e.OpenSharePanel="openSharePanel"}(ce||(ce={}));var ue,he,pe,fe,ge,ve,me=p(1580),ye=p.n(me);!function(e){e.direct="direct",e.onboarding="onboarding",e.list="list",e.favorite="favorite"}(ue||(ue={})),function(e){e[e.default=0]="default",e[e.favorite=1]="favorite"}(he||(he={})),function(e){e[e.default=0]="default",e[e.onboarding=1]="onboarding",e[e.favorite=2]="favorite",e[e.direct=3]="direct"}(pe||(pe={})),function(e){e.list="list",e.favorite="favorite"}(fe||(fe={})),function(e){e.CLICK_ON_STORY="clickOnStoryLink"}(ge||(ge={})),function(e){e.TEXT="text",e.IMAGE="image"}(ve||(ve={}));var we=p(3142),Se=p.n(we);const be=(0,e.createStore)({default:{},user:{}}),{sdkPlaceholdersChanged:_e,addDefaultPlaceholders:xe}=(0,e.createApi)(be,{sdkPlaceholdersChanged:(e,t)=>({default:e.default,user:t}),addDefaultPlaceholders:(e,t)=>{let i={default:{},user:e.user};return Se()(t)&&t.forEach((e=>{ye()(e)&&void 0!==e.name&&void 0!==e.default_value&&(i.default[e.name]=e.default_value)})),i}});var Ce=p(3655),ke=p.n(Ce),Oe=p(8138),Ee=p.n(Oe),Ae=p(986),Le=p.n(Ae);const Me=(0,e.createStore)({default:{},user:{}}),{sdkImagePlaceholdersChanged:Ie,addDefaultImagePlaceholders:Te}=(0,e.createApi)(Me,{sdkImagePlaceholdersChanged:(e,t)=>({default:e.default,user:t}),addDefaultImagePlaceholders:(e,t)=>{let i={default:{},user:e.user};return Se()(t)&&t.forEach((e=>{ye()(e)&&void 0!==e.name&&void 0!==e.default_value&&(i.default[e.name]=e.default_value)})),i}});let Re,Pe=!0;function De(e){Re(e),Pe=e}function Ne(){return Re(Pe),Pe}Re=function(){};class Fe{constructor(){this.__lastUpdated=null,this._receiveTime=0,this._serverTimestamp=0,this.rawData={},this.myDictionary={}}get receiveTime(){return this._receiveTime}singleModelWrapper(){return""}attributes(){return["__lastUpdated"]}static prepareFromResponse(){}setAttributes(e){const t=this.attributes();let i=this;for(let r in e){let n=e[r];-1!==t.indexOf(r)&&(i[r]=n)}}static createInstance(e,t){const i=new e;let r=t;return""!==i.singleModelWrapper()&&void 0!==t[i.singleModelWrapper()]&&(r=t[i.singleModelWrapper()]),i.rawData=t,i.setAttributes(r),i._receiveTime=(new Date).getTime(),void 0!==t.server_timestamp&&(i._serverTimestamp=t.server_timestamp),i}static _fetch(e,t,i,r="get"){return new Promise(((e,t)=>{e({})}))}static _fetchList(e,t,i){return Promise.resolve({})}static emitEvent({type:e,event:t,eventData:i}){return Promise.resolve()}static update(e,t,i="post"){return Promise.resolve()}}class je extends Fe{attributes(){return["width","height","type","url"]}constructor(){super(),this._url=""}set url(e){this._url=e}get url(){let e=window.isSecureContext;return void 0===e&&"https:"===window.location.protocol&&(e=!0),e?this._url:this._url.replace(/^https:\/\//,"http://")}}const Be=p(3981);class Ue{constructor(){this.images=[],this.color="",this.gradient=!1}static createFromArray(e){const t=new Ue;for(let i in e)e.hasOwnProperty(i)&&t.images.push(je.createInstance(je,e[i]));return t}findOneByType(e){var t;return null!==(t=this.images.find((t=>t.type===e)))&&void 0!==t?t:null}findOneByCoverQuality(e){return this.findOneByType(this.mapCoverQualityToImageType(e))}findOneByWidth(e,t=!1){let i=null;return this.images.forEach((t=>{t.width===e&&(i=t)})),null!==i||t&&void 0!==(i=Be(this.images))?i:null}mapCoverQualityToImageType(e){switch(e){case H.Medium:return"m";case H.High:return"h"}}}var Ve=p(4871),Ge=p.n(Ve);function ze(e,t,i){return String(e).replace(new RegExp(function(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(t),"g"),(()=>i))}class We extends Fe{constructor(){super(...arguments),this._title="",this.title_color="",this.magazine_name="",this.is_opened=!1,this._slides_html=[],this.slides_duration=[],this.slides_screenshot_share=[],this.source="",this.favorite=!1,this.like=0,this.slides_count=null,this.deeplink=null,this.hide_in_reader=null,this.blank=!1,this.disable_close=!1,this.need_placeholders=null,this._placeholders={},this.favorite_cell=!1,this.ugc_card_cell=!1,this.slidesLoaded=!1,this._imageSrc=null,this._parsedIssueArticleIds=null,this._parsedArticleIds=null,this._parsedSlideImage=null,this._video_cover=null,this._videoCoverSrc=null}static fetch(e,t){return this.placeholders=t,this._fetch(We,`story/${e}`,{expand:"slides_html,slides_duration"})}static fetchList(e,t,i){this.placeholders=e;const r={tags:t};return void 0!==i&&(r.favorite=Number(i)),this._fetchList(We,"story",r)}static fetchWithSlides(e,t){return this.placeholders=t,Promise.all(e.map((e=>this.fetch(e,t))))}static fetchOnboardingList(e,t){return this.placeholders=e,this._fetchList(We,"story-onboarding",{tags:t})}static fetchOnboardingListWithSlides(e,t){return this.placeholders=t,Promise.all(e.map((e=>this.fetch(e,t))))}attributes(){return Ge()(super.attributes(),["title","title_color","source","magazine_name","background","background_color","id","image","display_to","display_from","slides_html","slides_duration","slides_screenshot_share","favorite","like","slides_count","deeplink","hide_in_reader","disable_close","like_functional","favorite_functional","share_functional","is_opened","tags","has_audio","has_placeholder","video_cover","need_placeholders","has_swipe_up","share_url","game_instance","blank","slidesLoaded"])}set image(e){this._image=Ue.createFromArray(e)}get image(){return this._image}get issueArticleIds(){return this.parseHtmlSlidesForLinks(),null!==this._parsedIssueArticleIds?this._parsedIssueArticleIds:[]}get articleIds(){return this.parseHtmlSlidesForLinks(),null!==this._parsedArticleIds?this._parsedArticleIds:[]}imagePerSlide(e){var t,i;return this.parseHtmlSlidesForMainImage(),null!==(i=null===(t=this._parsedSlideImage)||void 0===t?void 0:t[e])&&void 0!==i?i:null}parseHtmlSlidesForLinks(){null===this._parsedArticleIds&&null===this._parsedIssueArticleIds&&this.slides_html.forEach((e=>{const t=e.match(/<[^<]*narrative-element-link.*data-link-type="([a-z-]*)".*data-link-target="(\d+)"[^<]*>/i);if(null!==t){const e=t[1],i=parseInt(t[2]);"article"===e?(null===this._parsedArticleIds&&(this._parsedArticleIds=[]),-1===this._parsedArticleIds.indexOf(i)&&this._parsedArticleIds.push(i)):"issue-article"===e&&(null===this._parsedIssueArticleIds&&(this._parsedIssueArticleIds=[]),-1===this._parsedIssueArticleIds.indexOf(i)&&this._parsedIssueArticleIds.push(i))}}))}parseHtmlSlidesForMainImage(){!this._parsedSlideImage&&this.slides_html.length&&(this._parsedSlideImage=this.slides_html.map((e=>this.parseSlideNarrativeImageSrc(e)||this.parseSlideNarrativeVideoPosterSrc(e)||null)))}parseSlideNarrativeImageSrc(e){const t=e.match(/<[^<]*narrative-element-image.*<img[^<]*src="([^"]*)"[^<]*>/i);return null==t?void 0:t[1]}parseSlideNarrativeVideoPosterSrc(e){const t=e.match(/<[^<]*narrative-element-video.*<video[^<]*poster\-remote\-src="([^"]*)"[^<]*>/i);return null==t?void 0:t[1]}set video_cover(e){null!==e&&(this._video_cover=Ue.createFromArray(e))}get video_cover(){return this._video_cover}get videoCoverSrc(){if(!1===this._videoCoverSrc)return null;if(null===this._videoCoverSrc){const e=this.video_cover;if(null===e)return this._videoCoverSrc=!1,null;const t=e.findOneByType("h");if(null!==t)return t.url}return"string"==typeof this._videoCoverSrc?this._videoCoverSrc:null}get title(){return this._title}set title(e){if(!0===this.need_placeholders||!0===this.rawData.need_placeholders)for(let t in We.placeholders)We.placeholders.hasOwnProperty(t)&&(e=ze(e,`%${t}%`,We.placeholders[t]));this.rawData.title=e,this._title=e}get slides_html(){return this._slides_html}set slides_html(e){if(!0===this.need_placeholders||!0===this.rawData.need_placeholders)for(let t in We.placeholders)if(We.placeholders.hasOwnProperty(t))for(let i=0;i<e.length;i++)e[i]=ze(e[i],`%${t}%`,We.placeholders[t]);const t=null!==p.nc&&void 0!==p.nc?p.nc:"";for(let i=0;i<e.length;i++)e[i]=ze(e[i],"{{nonce}}",null!=t?t:"");this._slides_html=e}get isOpened(){return this.is_opened}set isOpened(e){this.is_opened=e,this.rawData.is_opened=e}}We.placeholders={};const $e=We;class qe{static create(e){const t=Fe.createInstance($e,{id:0,title:e.favoriteCard.title.content,title_color:e.favoriteCard.title.color,is_opened:!0,background_color:"white"});return t.favorite_cell=!0,t}}const He=/[\r\n%#()<>?[\\\]^`{|}]/g;function Ze(e,t="double"){return(e=(e=(e="double"===t?e.replace(/"/g,"'"):e.replace(/'/g,'"')).replace(/>\s{1,}</g,"><")).replace(/\s{2,}/g," ")).replace(He,encodeURIComponent)}class Qe{static create(e){let t=[];e.ugcCard.image&&e.ugcCard.image.svgSrc&&e.ugcCard.image.svgSrc.baseState&&t.push({width:100,height:100,type:"h",url:`data:image/svg+xml,${Ze(e.ugcCard.image.svgSrc.baseState)}`});const i=Fe.createInstance($e,{id:-100,title:e.ugcCard.title.content,title_color:e.ugcCard.title.color,is_opened:!1,background_color:e.ugcCard.backgroundColor,image:t});return i.ugc_card_cell=!0,i}}var Xe;!function(e){e[e.DEFAULT=0]="DEFAULT",e[e.UGC=1]="UGC"}(Xe||(Xe={}));const Ye=e=>({id:e,type:Xe.DEFAULT,title:null,title_color:null,background:null,background_color:null,image:null,display_to:null,display_from:null,slides_html:[],slides_screenshot_share:[],slides_duration:[],favorite:null,like:null,slides_count:0,deeplink:null,hide_in_reader:null,disable_close:null,like_functional:null,favorite_functional:null,share_functional:null,is_opened:null,tags:[],has_audio:null,video_cover:null,need_placeholders:null,has_swipe_up:null,slides_payload:[],game_instance:{id:null},share_url:null,slidesLoaded:!1}),Ke=(0,e.createStore)({}),Je=(0,e.createStore)({default:[]}),et=Je.map((e=>e[m.getState().user_key||"default"]||[]));var tt;!function(e){e.FEEDS="feeds",e.FAVORITE="favorite"}(tt||(tt={}));const it=(0,e.createStore)({default:{[tt.FEEDS]:{},[tt.FAVORITE]:[]}}),rt=it.map((e=>e[m.getState().user_key||"default"]||{})),nt=(0,e.createStore)({}),st=(0,e.createStore)({}),ot=(0,e.createStore)([]),at=(e,t)=>e.map((e=>t.find((t=>t.id===e)))).filter((e=>!!e));nt.on([rt,et],((e,t)=>{const i=rt.getState(),r=et.getState();return((e,t)=>{const i={};for(const[r,n]of Object.entries(e))i[r]=at(n,t);return i})(i[tt.FEEDS],r)})),st.on([rt,et],((e,t)=>{const i=rt.getState(),r={},n=et.getState();for(const e in i[tt.FEEDS])if("onboarding_"===e.substring(0,11)){const t=e.substring(11);r[t]=[],i[tt.FEEDS][e]&&Array.isArray(i[tt.FEEDS][e])&&(r[t]=n.filter((t=>-1!==i[tt.FEEDS][e].indexOf(t.id)&&!t.is_opened)))}return r})),ot.on([rt,et],((e,t)=>{var i;const r=null!==(i=rt.getState()[tt.FAVORITE])&&void 0!==i?i:[],n={};return et.getState().forEach((e=>{n[e.id]=e})),r.map((e=>n[e]))}));const lt=(0,e.createEffect)(),dt=(e,t="")=>(e.is_opened,e.is_opened),ct=et.map((e=>{const t={};return t[Xe.DEFAULT]=e.filter((e=>!e.slidesLoaded&&e.type===Xe.DEFAULT)).map((e=>e.id)),t[Xe.UGC]=e.filter((e=>!e.slidesLoaded&&e.type===Xe.UGC)).map((e=>e.id)),t})),{storyItemFavoriteChanged:ut,storyItemLikeChanged:ht,storyItemIsOpenedChanged:pt}=(Object.prototype.hasOwnProperty,(0,e.createApi)(Je,{storyItemFavoriteChanged:(e,{id:t,favorite:i})=>{const r=m.getState().user_key||"default",n=(e[r]||[]).slice(0),s=n.find((e=>e.id===t));return void 0!==s&&(s.favorite=i),Object.assign(Object.assign({},e),{[r]:n})},storyItemLikeChanged:(e,{id:t,like:i})=>{const r=m.getState().user_key||"default",n=(e[r]||[]).slice(0),s=n.find((e=>e.id===t));return void 0!==s&&(s.like=i),Object.assign(Object.assign({},e),{[r]:n})},storyItemIsOpenedChanged:(e,{id:t})=>{const i=m.getState().user_key||"default",r=(e[i]||[]).slice(0),n=r.find((e=>e.id===t));return void 0!==n&&(n.is_opened=!0),Object.assign(Object.assign({},e),{[i]:r})}}));class ft{constructor(e=0,t=0,i=0,r=0){this.x=e,this.y=t,this.width=i,this.height=r}overlaps(e){return this.x+this.width>=e.x&&this.x<=e.x+e.width&&this.y+this.height>=e.y&&this.y<=e.y+e.height}getIntersection(e){const t=Math.min(this.x+this.width,e.x+e.width),i=Math.max(this.x,e.x),r=Math.min(this.y+this.height,e.y+e.height),n=Math.max(this.y,e.y);return new ft(Math.min(t,i),Math.min(r,n),Math.max(0,t-i),Math.max(0,r-n))}getArea(){return this.width*this.height}getAreaFraction(e){return+(this.getArea()/e.getArea()*100).toFixed(2)}static clone(e){return new ft(e.x,e.y,e.width,e.height)}}class gt extends U.EventEmitter{calculate(e){const t=e.map((({id:e,areaFraction:t})=>({storyId:e,visibleArea:Math.round(t)/100})));0!==t.length&&this.emit("visibleAreaUpdated",t)}}class vt extends U.EventEmitter{constructor(){super(...arguments),this.storiesIds=new Set,this.getNewStoriesIds=e=>{const t=[];for(const i of e)this.storiesIds.has(i)||t.push(i);return t}}markStoryAsFullVisible(e){this.storiesIds.has(e)||(this.storiesIds.add(e),this.emit("flushThumbViews",[e]))}calculate(e){const t=this.getNewStoriesIds(e.map((({id:e})=>e)));t.forEach((e=>this.storiesIds.add(e))),0!==t.length&&this.emit("flushThumbViews",t)}}class mt extends U.EventEmitter{constructor(){super(),this.storyRects=[],this.viewport=new ft,this.feedImpressionMetric=new vt,this.visibleAreaMetric=new gt,this.filterStoryRectIntersections=e=>e.filter((e=>-100!==e.id&&0!==e.id&&e.areaFraction>0)),this.feedImpressionMetric.on("flushThumbViews",(e=>this.emit("flushThumbViews",e))),this.visibleAreaMetric.on("visibleAreaUpdated",(e=>this.emit("visibleAreaUpdated",e)))}calculate(e){const t=this.getScrollViewportByCalculationParams(e),i=this.getStoryRectIntersectionsWithViewport(t),r=this.filterStoryRectIntersections(i);this.calculateMetrics(r)}setViewport(e){this.viewport=e}setStoryRects(e){this.storyRects=e}markStoryAsFullVisible(e){this.feedImpressionMetric.markStoryAsFullVisible(e)}destroy(){this.removeAllListeners()}getScrollViewportByCalculationParams(e){const t=ft.clone(this.viewport);return t.x+=e.minOffsetLeft,t.y+=e.minOffsetTop,t.width+=e.maxOffsetLeft-e.minOffsetLeft,t.height+=e.maxOffsetTop-e.minOffsetTop,t}calculateMetrics(e){this.feedImpressionMetric.calculate(e),this.visibleAreaMetric.calculate(e)}getStoryRectIntersectionsWithViewport(e){const t=[];for(const i of this.storyRects)if(i.overlaps(e)){const r=i.getIntersection(e);t.push({id:i.id,areaFraction:r.getAreaFraction(i)})}else t.push({id:i.id,areaFraction:0});return t}}class yt extends ft{constructor(e,t=0,i=0,r=0,n=0){super(t,i,r,n),this.id=e}static clone(e){return new yt(e.id,e.x,e.y,e.width,e.height)}}const wt=Object.prototype.hasOwnProperty,St=()=>{const e=be.getState(),t=Me.getState(),i=[],r={};for(let t in e.default)wt.call(e.default,t)&&(r[t]={type:ve.TEXT,name:t,value:e.default[t]});for(let t in e.user)wt.call(e.user,t)&&(r[t]={type:ve.TEXT,name:t,value:e.user[t]});for(let e in r)wt.call(r,e)&&i.push(r[e]);const n={};for(let e in t.default)wt.call(t.default,e)&&(n[e]={type:ve.IMAGE,name:e,value:t.default[e]});for(let e in t.user)wt.call(t.user,e)&&(n[e]={type:ve.IMAGE,name:e,value:t.user[e]});for(let e in n)wt.call(n,e)&&i.push(n[e]);return i},bt=(e,t)=>{const i={};return i[Xe.DEFAULT]=[],i[Xe.UGC]=[],i[e]=t,{storyTypeIds:i,style:"",widgetsData:{}}},_t=(e,t)=>{let i;return i=null==t?bt(Xe.DEFAULT,[]):t,{ids:i.storyTypeIds[e],style:i.style,widgetsData:i.widgetsData}},xt=(0,e.createStore)({style:"",storyTypeIds:{[Xe.DEFAULT]:[],[Xe.UGC]:[]},widgetsData:{}}),Ct=(0,e.createEffect)(),kt=(0,e.createEvent)(),Ot=(e,t)=>{let i=[];switch(e){case pe.default:i=t?nt.getState()[t]:[];break;case pe.favorite:i=ot.getState();break;case pe.onboarding:i=t?st.getState()[t]:[]}return null!=i?i:[]},Et=e=>"{{__ugc__}}"===e?Xe.UGC:Xe.DEFAULT;var At=function(e,t,i,r){return new(i||(i=Promise))((function(n,s){function o(e){try{l(r.next(e))}catch(e){s(e)}}function a(e){try{l(r.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,a)}l((r=r.apply(e,t||[])).next())}))};var Lt=function(e,t,i,r){return new(i||(i=Promise))((function(n,s){function o(e){try{l(r.next(e))}catch(e){s(e)}}function a(e){try{l(r.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,a)}l((r=r.apply(e,t||[])).next())}))};const Mt=(e,t)=>Lt(void 0,void 0,void 0,(function*(){const e=yield(i={data:t},At(void 0,void 0,void 0,(function*(){var e,t,r,n,s,o,a,l,d;let c=!1,u="",h={url:null!==(t=null===(e=i.data)||void 0===e?void 0:e.url)&&void 0!==t?t:"",method:null!==(n=null===(r=i.data)||void 0===r?void 0:r.method)&&void 0!==n?n:"get"};-1!==["post","put","path"].indexOf(null===(s=i.data)||void 0===s?void 0:s.method)?h.data=null!==(a=null===(o=i.data)||void 0===o?void 0:o.data)&&void 0!==a?a:void 0:h.params=null!==(d=null===(l=i.data)||void 0===l?void 0:l.params)&&void 0!==d?d:void 0;const p={requestId:i.id};try{const e=yield F.request(h);p.data=e.data,p.status=e.status,p.headers=e.headers,c=!0}catch(e){p.data=e,p.status=400,p.headers=[{}],u=e.toString()}return{name:i.cb,payload:{requestId:i.id,success:c,data:p,err:u}}})));var i;if(e.payload.success)return e.payload.data;throw e.payload.err}));class It{constructor(e,t){this.storyManager=e,this.params=t,this.handleFlushThumbViews=this.handleFlushThumbViews.bind(this),this.handleVisibleAreaUpdated=this.handleVisibleAreaUpdated.bind(this)}create(){const e=new mt;return e.on("flushThumbViews",this.handleFlushThumbViews),e.on("visibleAreaUpdated",this.handleVisibleAreaUpdated),e}handleFlushThumbViews(e){const t=o.getState();this.params.listType!==Xe.DEFAULT||t.disableStatistic||b(e);const i=this.params.identityFields.feedSlug,r=this.params.identityFields.filter,n=Et(i),s={stories:e.map((e=>{const t={title:null,tags:[],slidesCount:null},i=et.getState().find((t=>t.id===e));return i&&(t.title=i.stat_title,t.tags=i.tags,t.slidesCount=i.slides_count,i.type===Xe.UGC&&(t.ugcPayload=ye()(i.payload)?i.payload:{})),Object.assign({id:e},t)})),feed:null,filter:null};n===Xe.DEFAULT?s.feed=i:n===Xe.UGC&&(s.filter=r),this.storyManager.emit("feedImpression",s)}handleVisibleAreaUpdated(e){const t=this.params.identityFields.feedSlug,i=this.params.identityFields.filter,r=Et(t),n={stories:e.map((({storyId:e,visibleArea:t})=>{const i={title:null,tags:[],slidesCount:null,visibleArea:t},r=et.getState().find((t=>t.id===e));return r&&(i.title=r.stat_title,i.tags=r.tags,i.slidesCount=r.slides_count,r.type===Xe.UGC&&(i.ugcPayload=ye()(r.payload)?r.payload:{})),Object.assign({id:e},i)})),feed:null,filter:null};r===Xe.DEFAULT?n.feed=t:r===Xe.UGC&&(n.filter=i),this.storyManager.emit("visibleAreaUpdated",n)}}const Tt=function(){var e="test";try{return localStorage.setItem(e,e),localStorage.removeItem(e),!0}catch(e){return!1}}();function Rt(e){let t=null;if(Tt){let i=window.localStorage.getItem(e);null!==i&&Ee()(i)&&i.trim().length>0&&(t=JSON.parse(i))}return t}function Pt(e,t){Tt&&window.localStorage.setItem(e,JSON.stringify(t))}var Dt=function(e,t,i,r){return new(i||(i=Promise))((function(n,s){function o(e){try{l(r.next(e))}catch(e){s(e)}}function a(e){try{l(r.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,a)}l((r=r.apply(e,t||[])).next())}))};let Nt=null;function Ft(){return Dt(this,void 0,void 0,(function*(){return null!=Nt?Nt:new Promise((e=>{!function(e,t){const i=new Image;i.onload=function(){var r=i.width>0&&i.height>0;t(e,r)},i.onerror=function(){t(e,!1)},i.src="data:image/webp;base64,"+{lossy:"UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA",lossless:"UklGRhoAAABXRUJQVlA4TA0AAAAvAAAAEAcQERGIiP4HAA==",alpha:"UklGRkoAAABXRUJQVlA4WAoAAAAQAAAAAAAAAAAAQUxQSAwAAAARBxAR/Q9ERP8DAABWUDggGAAAABQBAJ0BKgEAAQAAAP4AAA3AAP7mtQAAAA==",animation:"UklGRlIAAABXRUJQVlA4WAoAAAASAAAAAAAAAAAAQU5JTQYAAAD/////AABBTk1GJgAAAAAAAAAAAAAAAAAAAGQAAABWUDhMDQAAAC8AAAAQBxAREYiI/gcA"}[e]}("lossy",((t,i)=>{Nt=i,e(i)}))}))}))}var jt=function(e,t,i,r){return new(i||(i=Promise))((function(n,s){function o(e){try{l(r.next(e))}catch(e){s(e)}}function a(e){try{l(r.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,a)}l((r=r.apply(e,t||[])).next())}))};const Bt=p(7315);function Ut(){return jt(this,void 0,void 0,(function*(){const[e,t]=yield Promise.all([Gt(),Ft()]);return{method:"POST",url:"session/open",params:{expand:"cache,storyWidgetsResources",fields:"session,server_timestamp,user_key,share,preview_aspect_ratio,placeholders,image_placeholders,is_allow_ugc"},data:Vt(e,t)}}))}y.use((()=>jt(void 0,void 0,void 0,(function*(){return(yield F.request(yield Ut())).data})))),(0,e.sample)({clock:w,target:m});const Vt=(e,t)=>{"iOS"===e.os_name?window.isIos=!0:"Android"===e.os_name&&(window.Android=!0);const i=o.getState();return i&&i.userId&&(e.user_id=i.userId),e.features="animation,data,deeplink,placeholder,resetTimers,gameReader,sendApi,swipeUpItems,imgPlaceholder,vod",t&&(e.features+=",webp"),e},Gt=()=>jt(void 0,void 0,void 0,(function*(){return new Promise(((e,t)=>{let i=Rt("device_data"),r=null;if(null!==i&&(r=i.device_id),null!==i&&r&&Ee()(r)&&36===r.trim().length)v(r),e(i);else{const t={platform:"web",device_id:Bt.v4()};Pt("device_data",t),v(t.device_id),e(t)}}))}));var zt=function(e,t,i,r){return new(i||(i=Promise))((function(n,s){function o(e){try{l(r.next(e))}catch(e){s(e)}}function a(e){try{l(r.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,a)}l((r=r.apply(e,t||[])).next())}))};function Wt(e,t,i=!1,r,n,s){const o=["slides_html","slides_duration","slides_screenshot_share","slides_payload"];n&&o.push("share_url");const a={url:`${t===Hs?"ugc/":""}story/${e}`,method:"GET",params:{expand:o.join(",")}};return a.params&&(a.params.once=Number(s)),i||null!=a.params&&(a.params.fields=["id","slides_html","slides_duration","slides_screenshot_share","slides_payload"].join(",")),null!==r&&null!=a.params&&(a.params.session_id=r),a}lt.use((e=>zt(void 0,[e],void 0,(function*({listType:e}){return F.get("story",$t())}))));const $t=(e,t,i,r,n)=>{var s;let a=null===(s=o.getState())||void 0===s?void 0:s.tags;const l={};a&&Se()(a)&&a.length>0&&(l.tags=a.join(",")),void 0!==t&&Se()(t)&&t.length>0&&(l.tags=t.join(","));return null==r||"number"!=typeof r&&!(e=>!isNaN(parseFloat(e))&&isFinite(e))(r)||(l.limit=r),e&&(l.session_id=e),null!=i&&(l.test=i),null!=n&&ye()(n)&&(l.f=n),{params:l}},qt=(0,e.createEffect)();var Ht=function(e,t,i,r){return new(i||(i=Promise))((function(n,s){function o(e){try{l(r.next(e))}catch(e){s(e)}}function a(e){try{l(r.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,a)}l((r=r.apply(e,t||[])).next())}))};qt.use((()=>Ht(void 0,void 0,void 0,(function*(){return(yield F.request(yield function(){return Ht(this,void 0,void 0,(function*(){return{method:"GET",url:"ugc/editor-config",params:{}}}))}())).data})))),m.on(qt.doneData,((e,t)=>{const i=Object.assign({},e);return i.editor=t,i}));var Zt=function(e,t,i,r){return new(i||(i=Promise))((function(n,s){function o(e){try{l(r.next(e))}catch(e){s(e)}}function a(e){try{l(r.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,a)}l((r=r.apply(e,t||[])).next())}))};function Qt(e,t){const i={url:"story-context",method:"GET",params:{id:e.join(","),fields:["style","widgetsData"].join(",")}};return null!=t&&null!=i.params&&(i.params.session_id=t),i}Ct.use((e=>Zt(void 0,[e],void 0,(function*({ids:e}){return F.request(Qt(e))})))),(0,e.sample)({clock:Ct.done.filterMap((({params:e,result:t})=>{const i=t.data,r=Et(e.feedSlug);if(i&&ye()(i)){const t=bt(r,e.ids);return t.style=i.style,t.widgetsData=i.widgetsData,t}})),target:xt}),(0,e.sample)({clock:kt,target:xt});var Xt=p(3514),Yt=p.n(Xt);class Kt{constructor(){this.__lastUpdated=null,this._receiveTime=0,this._serverTimestamp=0,this.rawData={},this.myDictionary={}}get receiveTime(){return this._receiveTime}singleModelWrapper(){return""}attributes(){return["__lastUpdated"]}static prepareFromResponse(){}setAttributes(e){const t=this.attributes();let i=this;for(let r in e){let n=e[r];-1!==t.indexOf(r)&&(i[r]=n)}}static createInstance(e,t){const i=new e;let r=t;return""!==i.singleModelWrapper()&&void 0!==t[i.singleModelWrapper()]&&(r=t[i.singleModelWrapper()]),i.rawData=t,i.setAttributes(r),i._receiveTime=(new Date).getTime(),void 0!==t.server_timestamp&&(i._serverTimestamp=t.server_timestamp),i}static _fetch(e,t,i,r="get"){return new Promise(((n,s)=>{let o={url:t,method:r};-1!==["post","put","path"].indexOf(r)?o.data=i:o.params=i;F.request(o).then((function(t){let i,r;i=t.data,i&&(i.__lastUpdated=Date.now()),r=Kt.createInstance(e,i),n(r)})).catch(s)}))}static _fetchList(e,t,i){return new Promise(((r,n)=>{F.get(t,{params:i}).then((function(t){const i=t.data;let n=[];i.forEach((t=>{n.push(Kt.createInstance(e,t))}));let s={models:n,totalCount:Number(t.headers["x-pagination-total-count"]),currentPage:Number(t.headers["x-pagination-current-page"])};r(s)})).catch(n)}))}static emitEvent({type:e,event:t,eventData:i}){return new Promise(((r,n)=>{F.post(`${e}/event/${t}`,i).then((function(e){const t=e.data;r(t)})).catch(n)}))}static update(e,t,i="post"){let r={url:e,method:i};return-1!==["post","put","path"].indexOf(i)?r.data=t:r.params=t,new Promise(((e,t)=>{F.request(r).then((function(t){let i;i=t.data,e(i)})).catch(t)}))}}class Jt extends Kt{attributes(){return["width","height","type","url"]}constructor(){super(),this._url=""}set url(e){this._url=e}get url(){let e=window.isSecureContext;return void 0===e&&"https:"===window.location.protocol&&(e=!0),e?this._url:this._url.replace(/^https:\/\//,"http://")}}const ei=p(3981);class ti{constructor(){this.images=[],this.color="",this.gradient=!1}static createFromArray(e){const t=new ti;for(let i in e)e.hasOwnProperty(i)&&t.images.push(Jt.createInstance(Jt,e[i]));return t}findOneByType(e){let t=null;return this.images.forEach((i=>{i.type===e&&(t=i)})),t}findOneByWidth(e,t=!1){let i=null;return this.images.forEach((t=>{t.width===e&&(i=t)})),null!==i||t&&void 0!==(i=ei(this.images))?i:null}}class ii extends Kt{constructor(){super(...arguments),this._cover=null}attributes(){return Ge()(super.attributes(),["id","cover","hasFavorite"])}set cover(e){this._cover=ti.createFromArray(e)}get cover(){return this._cover}get coverSrc(){var e;const t=null===(e=this._cover)||void 0===e?void 0:e.findOneByType("h");return null==t?void 0:t.url}}const ri=Object.freeze({enter:13,tab:9,delete:46,esc:27,space:32,up:38,down:40,left:37,right:39,end:35,home:36,del:46,backspace:8,insert:45,pageup:33,pagedown:34});function ni(e){return Object.keys(e).reduce(((t,i)=>t+i.split(/(?=[A-Z])/).join("-").toLowerCase()+":"+e[i]+";"),"")}function si(e){let t=window.isSecureContext;return void 0===t&&"https:"===window.location.protocol&&(t=!0),t?e:e.replace(/^https:\/\//,"http://")}function oi(e){return e.map((e=>function(e){var t,i,r;if(!e.url)return null;let n={"font-family":null!==(t=e.family)&&void 0!==t?t:"normal",src:`url('${si(String(e.url))}')`,"font-style":null!==(i=e.style)&&void 0!==i?i:"normal","font-weight":null!==(r=e.weight)&&void 0!==r?r:"normal"};e.title&&(n.src+=`, local('${e.title}')`);return`@font-face {${ni(n)}}\n`}(e))).filter(Boolean).join("")}function ai(e){"fonts"in document?e.forEach((e=>{const t=new FontFace(e.family,`url(${e.url})`,{style:e.style,weight:e.weight,display:"block"});document.fonts.add&&document.fonts.add(t),t.load()})):function(e){const t=oi(e);if(null!=t){const e="stories-font-style";let i=document.getElementById(e);null===i?(i=document.createElement("style"),i.type="text/css",i.id=e,i.attributes.setNamedItem(document.createAttribute("scoped")),i.styleSheet?i.styleSheet.cssText=t:i.appendChild(document.createTextNode(t)),document.body.appendChild(i)):i.styleSheet?i.styleSheet.cssText=t:(i.textContent="",i.appendChild(document.createTextNode(t)))}}(e)}var li;function di(){if(window){var e,t=window.screen;return e="function"==typeof window.ScreenOrientation&&t.orientation instanceof ScreenOrientation&&"function"==typeof t.orientation.addEventListener&&null===t.orientation.onchange&&"string"==typeof t.orientation.type?t.orientation:function(){var e={90:li.LANDSCAPE_PRIMARY,"-90":li.LANDSCAPE_SECONDARY,0:li.PORTRAIT_PRIMARY,180:li.PORTRAIT_SECONDARY};function t(){}const i=new t,r=function(e){const t=["orientationchange","mozorientationchange","msorientationchange"],i=window.screen;for(let e=0;e<t.length;e++)if(null===i["on"+t[e]])return{delegate:i,event:t[e]};if(void 0!==window.onorientationchange)return{delegate:window,event:"orientationchange"};return{delegate:gi(e),event:"change"}}(i);return t.prototype.addEventListener=ci("addEventListener",r.delegate,r.event),t.prototype.dispatchEvent=ci("dispatchEvent",r.delegate,r.event),t.prototype.removeEventListener=ci("removeEventListener",r.delegate,r.event),t.prototype.lock=function(){var e,t="lockOrientation() is not available on this device.",i=window.screen;e=void 0===i?function(){return!1}:"function"==typeof i.msLockOrientation?i.msLockOrientation.bind(i):"function"==typeof i.mozLockOrientation?i.mozLockOrientation.bind(i):function(){return!1};return function(i){const r=window.Promise;return e(i)?r.resolve(i):r.reject(new Error(t))}}(),t.prototype.unlock=function(){var e=window.screen;return e&&e.orientation&&e.orientation.unlock.bind(e.orientation)||e.msUnlockOrientation&&e.msUnlockOrientation.bind(e)||e.mozUnlockOrientation&&e.mozUnlockOrientation.bind(e)||function(){}}(),Object.defineProperties(i,{onchange:{get:function(){return r.delegate["on"+r.event]||null},set:function(e){r.delegate["on"+r.event]=pi(e,i)}},type:{get:function(){var t=window.screen;return t.msOrientation||t.mozOrientation||e[window.orientation+""]||(vi().matches?"landscape-primary":"portrait-primary")}},angle:{value:0}}),i}(),e}}function ci(e,t,i){var r=this;return function(){var n=Array.prototype.slice.call(arguments);if("change"===(n[0].type?n[0].type:n[0])){n[0].type?n[0]=fi(i,n[0]):n[0]=i;var s,o,a=pi(n[1],r);return"addEventListener"===e&&function(e,t){var i=hi.indexOf(e);i>-1?ui[i]=t:(hi.push(e),ui.push(t))}(n[1],a),"removeEventListener"===e&&(s=n[1],(o=hi.indexOf(s))>-1&&(hi.splice(o,1),ui.splice(o,1))),n[1]=a,t[e].apply(t,n)}}}!function(e){e.LANDSCAPE_PRIMARY="landscape-primary",e.LANDSCAPE_SECONDARY="landscape-secondary",e.PORTRAIT_PRIMARY="portrait-primary",e.PORTRAIT_SECONDARY="portrait-secondary"}(li||(li={}));var ui=[],hi=[];function pi(e,t){var i=hi.indexOf(e);return i>-1?ui[i]:function(i){i.target!==t&&mi(i,"target",t),i.currentTarget!==t&&mi(i,"currentTarget",t),"change"!==i.type&&mi(i,"type","change"),e(i)}}function fi(e,t){var i;try{i=new Event(e,t)}catch(e){i={type:"change"}}return i}function gi(e){var t=Object.create({addEventListener:function(e,t){this.listeners[e]||(this.listeners[e]=[]),-1===this.listeners[e].indexOf(t)&&this.listeners[e].push(t)},dispatchEvent:function(t){this.listeners[t.type]&&(this.listeners[t.type].forEach((function(e){e(t)})),"function"==typeof e.onchange&&e.onchange(t))},removeEventListener:function(e,t){if(this.listeners[e]){var i=this.listeners[e].indexOf(t);i>-1&&this.listeners[e].splice(i,1)}}});t.listeners={};var i=vi();return i&&"boolean"==typeof i.matches&&i.addListener((function(){t.dispatchEvent(fi("change"))})),t}function vi(){return"function"!=typeof window.matchMedia?{}:window.matchMedia("(orientation: landscape)")}function mi(e,t,i){Object.defineProperty(e,t,{value:i})}var yi=function(e,t,i,r){return new(i||(i=Promise))((function(n,s){function o(e){try{l(r.next(e))}catch(e){s(e)}}function a(e){try{l(r.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,a)}l((r=r.apply(e,t||[])).next())}))};const wi=e=>yi(void 0,void 0,void 0,(function*(){return(yield fetch(e)).blob()})),Si=e=>yi(void 0,void 0,void 0,(function*(){const t=yield wi(e);return function(e,t=!0){return new Promise((function(i){var r=new FileReader;r.onloadend=function(){if(t){var e=String(r.result).replace("data:","").replace(/^.+,/,"");i(e)}else i(String(r.result))},r.readAsDataURL(e)}))}(new File([t],"image",{type:t.type,lastModified:(new Date).getTime()}),!1)}));function bi(e,t,i,r){var n=e.indexOf(i,t);if(-1===n)return null;for(var s="",o=n+i.length;o<e.length&&-1===r.indexOf(e[o]);o++)s+=e[o];return{foundAtIndex:n,value:s}}function _i(e,t){const i=document.createElementNS("http://www.w3.org/2000/svg",e);for(let e in t)i.setAttributeNS(null,e.replace(/[A-Z]/g,(function(e,t,i,r){return"-"+e.toLowerCase()})),t[e]);return i}var xi;function Ci(e,t,i,r,n,s,o,a,l,d){var c=_i("svg",{width:String(n),height:String(s),style:"background-color: #fff;"}),u=_i("foreignObject",{x:"0",y:"0",width:"100%",height:"100%"});c.appendChild(u);try{u.style.fontSize=document.body.style.fontSize}catch(e){console.error(e)}!function(){const h=t.cloneNode(!0);if(null!=r&&"string"==typeof r&&r.length>0){const e=Array.prototype.slice.call(h.querySelectorAll(r));for(let t=0;t<e.length;t++){const i=e[t];i&&i.style&&i.style.setProperty&&i.style.setProperty("display","none")}}u.appendChild(h);var p=[];(function(e){for(var t=[],i=0;;){var r=bi(e,i,"src: url(",[" ",")","\t"]);if(null==r)break;i=r.foundAtIndex+r.value.length,t.push(r.value.replace(/["']/g,""))}return t})(i).forEach((function(e){p.push(new Promise((function(t,r){Si(e).then((function(r){i=i.replace(e,r),t()})).catch((function(e){t()}))})))})),u.querySelectorAll("img").forEach((function(e){e.crossOrigin="Anonymous",p.push(new Promise((function(t,i){Si(e.src).then((function(i){e.onload=i=>e.decode().then((()=>t())),e.onerror=e=>{console.error(e),t()},e.src=i})).catch((function(e){t()}))})))})),u.querySelectorAll("video").forEach((function(e){var t;null===(t=e.parentNode)||void 0===t||t.removeChild(e)})),u.querySelectorAll(".narrative-element-video").forEach((function(e){e.classList.add("init")})),Promise.all(p).then((function(){const t=_i("style",{});t.textContent=i,c.appendChild(t);const r=(new XMLSerializer).serializeToString(c),u=new Image;u.onload=t=>{u.decode().then((function(){setTimeout((function(){const e=document.createElement("canvas"),t=e.getContext("2d");if(t){e.style.width=n+"px",e.style.height=s+"px",e.width=2*n,e.height=2*s,t.scale(2,2),t.drawImage(u,0,0);const i=e.toDataURL(o,a);wi(i).then((function(t){l(t),e.remove()}))}}),e===xi.IOS?200:void 0)})).catch((e=>{console.log({image:u,encodingError:e},"onDecodeError"),d("error render svg image: "+e)}))},u.onerror=e=>{d("error render svg image: "+e)},u.setAttribute("crossOrigin","Anonymous"),u.crossOrigin="Anonymous",u.src="data:image/svg+xml;base64,"+btoa(encodeURIComponent(r).replace(/%([0-9A-F]{2})/g,(function(e,t){return String.fromCharCode(parseInt(t,16))})))}))}()}function ki(e,t,i,r){return new Promise((function(n,s){null==r&&(r=""),function(e,t,i,r,n,s){Ci(e,t,i,r,t.clientWidth,t.clientHeight,"image/jpeg",1,n,s)}(e,t,i,r,(function(e){n(new File([e],"image.jpeg",{type:e.type,lastModified:(new Date).getTime()}))}),(function(){console.error("Image fail");const e=new Error;e.name="ImageFail",s(e)}))}))}function Oi(e){return"string"==typeof e&&(!isNaN(Number(e))&&!isNaN(parseFloat(e)))}!function(e){e[e.IOS=0]="IOS",e[e.ANDROID=1]="ANDROID",e[e.OTHER=2]="OTHER"}(xi||(xi={}));var Ei=function(e,t,i,r){return new(i||(i=Promise))((function(n,s){function o(e){try{l(r.next(e))}catch(e){s(e)}}function a(e){try{l(r.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,a)}l((r=r.apply(e,t||[])).next())}))};const Ai=(0,e.createEffect)((e=>Ei(void 0,[e],void 0,(function*({defaultList:e,onboardingList:t,favoriteList:i,onboardingTags:r,testKey:n,limit:s}){var o,a,l;const d=[],c=null===(a=null===(o=m.getState())||void 0===o?void 0:o.session)||void 0===a?void 0:a.id;let u=null;if(Yt()(c)&&(d.push(Li(yield Ut(),"session")),u="@{session.session.id}"),!1!==e&&ye()(e)&&Ee()(e.feedSlug)){const t=e.feedSlug,i=null!==(l=e.filter)&&void 0!==l?l:{};t===Hs?d.push(Li(function(e,t,i,r,n){const{params:s}=$t(i,r,n,null,t);return{method:"GET",url:"ugc/feed",params:s}}(0,i,u,[],n),`storyList_${t}`)):d.push(Li(function(e,t,i,r){const{params:n}=$t(t,i,r);return{method:"GET",url:`feed/${e}`,params:n}}(t,u,[],n),`storyList_${t}`))}i&&d.push(Li(function(e){const{params:t}=$t(e);return{method:"GET",url:"story",params:Object.assign(Object.assign({},t),{favorite:1})}}(u),"storyFavoriteList")),!1!==t&&Ee()(t)&&d.push(Li(function(e="onboarding",t,i,r){const{params:n}=$t(t,i,null,r);return{method:"GET",url:`feed/${e}/onboarding`,params:n}}(t,u,r,s),`storyOnboardingList_${t}`));let h=null;try{const e=yield F.post("composite",{compositeRequest:d});if(e.status>=200&&e.status<=299)if(e.data&&e.data.compositeResponse&&Array.isArray(e.data.compositeResponse)){if(e.data.success)return e.data.compositeResponse;for(const t of e.data.compositeResponse){const e=t.status;if(Le()(e)&&!(e>=200&&e<=299)){h={name:"networkError",networkStatus:e,networkMessage:String(t.body)};break}}}else h=e.data&&ye()(e.data)&&null!=e.data.name&&null!=e.data.message&&null!=e.data.status?{name:e.data.name,networkStatus:e.data.status,networkMessage:e.data.message}:{name:"networkError",networkStatus:null,networkMessage:"Invalid data in API response, data from response as json: "+JSON.stringify(e.data)};else h=e.data&&ye()(e.data)&&null!=e.data.name&&null!=e.data.message&&null!=e.data.status?{name:e.data.name,networkStatus:e.data.status,networkMessage:e.data.message}:{name:"networkError",networkStatus:e.status,networkMessage:"Invalid data in API response, data from response as json: "+JSON.stringify(e.data)}}catch(e){try{const t=e;if(t.response&&t.response.status)h={name:"networkError",networkStatus:t.response.status,networkMessage:t.response.statusText};else{let t="";window.navigator&&null!=window.navigator.onLine&&(t=" net::ERR_INTERNET_DISCONNECTED"),h={name:"error",networkStatus:null,networkMessage:e.toString()+t},console.error(e)}}catch(e){h={name:"error",networkStatus:null,networkMessage:e.toString()}}}if(null!==h)throw h;return[]})))),Li=(e,t)=>({path:e.url,qs:e.params,body:e.data,ref:t,method:e.method}),Mi=e=>{const t=be.getState();for(let i in t.user)Ti.call(t.user,i)&&(e=ze(e,`%${i}%`,t.user[i]));for(let i in t.default)Ti.call(t.default,i)&&(e=ze(e,`%${i}%`,t.default[i]));const i=Me.getState();for(let t in i.user)Ti.call(i.user,t)&&(e=ze(e,`%${t}%`,i.user[t]));for(let t in i.default)Ti.call(i.default,t)&&(e=ze(e,`%${t}%`,i.default[t]));return e},Ii=(e,t)=>Array.isArray(e)?e.map((e=>Object.assign(Object.assign({},e),{title:e.need_placeholders?Mi(e.title):e.title,slidesLoaded:!1,is_opened:dt(e),type:t}))):[];(0,e.sample)({clock:Ai.doneData.filterMap((e=>{var t;return null===(t=e.find((e=>"session"===e.ref)))||void 0===t?void 0:t.body})),target:m}),(0,e.sample)({clock:Ai.doneData.filterMap((e=>{var t,i;return null===(i=null===(t=e.find((e=>"session"===e.ref)))||void 0===t?void 0:t.body)||void 0===i?void 0:i.placeholders})),target:xe}),(0,e.sample)({clock:Ai.doneData.filterMap((e=>{var t,i;return null===(i=null===(t=e.find((e=>"session"===e.ref)))||void 0===t?void 0:t.body)||void 0===i?void 0:i.image_placeholders})),target:Te}),(0,e.sample)({clock:y.doneData.filterMap((e=>e.placeholders)),target:xe}),(0,e.sample)({clock:y.doneData.filterMap((e=>e.image_placeholders)),target:Te});const Ti=Object.prototype.hasOwnProperty;(0,e.sample)({source:Je,clock:m,fn:(e,t)=>{const i={};for(const r in e)Ti.call(e,r)&&(i[r]=e[r].map((e=>Object.assign(Object.assign({},e),{is_opened:dt(e,t.user_key),title:e.need_placeholders?Mi(e.title):e.title}))));return i},target:Je});const{storiesListIdsChanged:Ri}=(0,e.createApi)(it,{storiesListIdsChanged:(e,{storiesIdsUserEntity:t,feedSlug:i,storyList:r})=>{let n=m.getState().user_key||"default";const s=e[n]||{};return void 0===s[tt.FAVORITE]&&(s[tt.FAVORITE]=[]),void 0===s[tt.FEEDS]&&(s[tt.FEEDS]={}),t===tt.FEEDS&&i&&(s[tt.FEEDS][i]=r.map((e=>e.id))),t===tt.FAVORITE&&(s[tt.FAVORITE]=r.map((e=>e.id))),Object.assign(Object.assign({},e),{[n]:s})}}),{storiesListItemsAdded:Pi}=(0,e.createApi)(Je,{storiesListItemsAdded:(e,{storiesIdsUserEntity:t,feedSlug:i,storyList:r})=>{let n=m.getState().user_key||"default";const s=e[n]||[],o=s.map((e=>e.id));return Object.assign(Object.assign({},e),{[n]:[...s,...r.filter((e=>-1===o.indexOf(e.id)))]})}});(0,e.sample)({clock:Ai.doneData.filterMap((e=>{var t;let i=null;for(const r of e)if(r.ref&&Ee()(r.ref)){const e=r.ref.match(/^storyList_(.+)/);if(e&&Array.isArray(e)&&e[1]){let n=null===(t=r.body)||void 0===t?void 0:t.stories;const s=Et(e[1]);s===Xe.UGC&&(n=r.body);const o=Ii(n,s);i={storiesIdsUserEntity:tt.FEEDS,feedSlug:e[1],storyList:o}}}if(i)return i})),target:[Pi,Ri]}),(0,e.sample)({clock:Ai.doneData.filterMap((e=>{var t;let i=null;for(const r of e)if(r.ref&&Ee()(r.ref)){const e=r.ref.match(/^storyOnboardingList_(.+)/);if(e&&Array.isArray(e)&&e[1]){const n=Ii(null===(t=r.body)||void 0===t?void 0:t.stories,Xe.DEFAULT);i={storiesIdsUserEntity:tt.FEEDS,feedSlug:`onboarding_${e[1]}`,storyList:n}}}if(i)return i})),target:[Pi,Ri]}),(0,e.sample)({clock:Ai.doneData.filterMap((e=>{const t=e.find((e=>"storyFavoriteList"===e.ref));if(void 0===t)return;const i=Ii(t.body,Xe.DEFAULT);return{storiesIdsUserEntity:tt.FAVORITE,feedSlug:null,storyList:i}})),target:[Pi,Ri]});const Di=(0,e.createEffect)();Di.use((e=>Ei(void 0,void 0,void 0,(function*(){const t=e.ids.map((t=>Li(Wt(t,e.feedSlug),`storySlides_${t}`))),i=yield F.post("composite",{compositeRequest:t});return i.data&&i.data.success&&i.data.compositeResponse&&Array.isArray(i.data.compositeResponse)?i.data.compositeResponse:[]}))));const Ni=e=>e&&ye()(e)&&"id"in e,Fi=(0,e.createEffect)();Fi.use((e=>Ei(void 0,[e],void 0,(function*({ids:e,id:t,feedSlug:i}){const r=[Li(Wt(t,i),"storySlides"),Li(Qt(e),"storyContext")],n=yield F.post("composite",{compositeRequest:r});return n.data&&n.data.success&&n.data.compositeResponse&&Array.isArray(n.data.compositeResponse)?n.data.compositeResponse:[]})))),Je.on([Di.done,Fi.done],((e,{params:t,result:i})=>{const r=i;if(Array.isArray(r)){const i=Et(t.feedSlug),n=m.getState().user_key||"default",s=(e[n]||[]).slice(0).map((e=>{var t,n,s,o,a,l,d,c,u,h,p,f,g,v,m;for(let y=0;y<r.length;y++)if(Ni(null===(t=r[y])||void 0===t?void 0:t.body)&&(null===(s=null===(n=r[y])||void 0===n?void 0:n.body)||void 0===s?void 0:s.id)===e.id&&i===e.type)return Object.assign({},e,{slides_html:e.need_placeholders?Array.from(null!==(l=null===(a=null===(o=r[y])||void 0===o?void 0:o.body)||void 0===a?void 0:a.slides_html)&&void 0!==l?l:[]).map((e=>Mi(e))):Array.from(null!==(u=null===(c=null===(d=r[y])||void 0===d?void 0:d.body)||void 0===c?void 0:c.slides_html)&&void 0!==u?u:[]),slides_duration:null===(p=null===(h=r[y])||void 0===h?void 0:h.body)||void 0===p?void 0:p.slides_duration,slides_screenshot_share:null===(g=null===(f=r[y])||void 0===f?void 0:f.body)||void 0===g?void 0:g.slides_screenshot_share,slides_payload:null===(m=null===(v=r[y])||void 0===v?void 0:v.body)||void 0===m?void 0:m.slides_payload,slidesLoaded:!0,is_opened:dt(e)});return e}));return Object.assign(Object.assign({},e),{[n]:s})}return e})),(0,e.sample)({clock:Fi.done.filterMap((({params:e,result:t})=>{var i;const r=null===(i=t.find((e=>"storyContext"===e.ref)))||void 0===i?void 0:i.body,n=Et(e.feedSlug);if(r&&ye()(r)){const t=bt(n,e.ids);return t.widgetsData=r.widgetsData,t.style=r.style,t}})),target:xt});const ji=(0,e.createEffect)((e=>Ei(void 0,[e],void 0,(function*({id:e,feedSlug:t,fetchShareUrl:i}){var r,n;const s=[],o=null===(n=null===(r=m.getState())||void 0===r?void 0:r.session)||void 0===n?void 0:n.id;let a=null;Yt()(o)&&(s.push(Li(yield Ut(),"session")),a="@{session.session.id}"),s.push(Li(Wt(e,t,!0,a,i),"story")),s.push(Li(Qt([e],a),"storyContext"));const l=yield F.post("composite",{compositeRequest:s});if(l.data&&l.data.success&&l.data.compositeResponse&&Array.isArray(l.data.compositeResponse))return l.data.compositeResponse;if(l.data&&!l.data.success)throw Error("composite request error:"+JSON.stringify(l.data.compositeResponse));return[]}))));(0,e.sample)({clock:ji.doneData.filterMap((e=>{var t;const i=null===(t=e.find((e=>"session"===e.ref)))||void 0===t?void 0:t.body;if(i&&ye()(i)&&i)return i})),target:m}),(0,e.sample)({clock:ji.doneData.filterMap((e=>{var t,i;return null===(i=null===(t=e.find((e=>"session"===e.ref)))||void 0===t?void 0:t.body)||void 0===i?void 0:i.placeholders})),target:xe}),(0,e.sample)({clock:ji.doneData.filterMap((e=>{var t,i;return null===(i=null===(t=e.find((e=>"session"===e.ref)))||void 0===t?void 0:t.body)||void 0===i?void 0:i.image_placeholders})),target:Te}),(0,e.sample)({clock:ji.done.filterMap((({params:e,result:t})=>{var i;const r=null===(i=t.find((e=>"storyContext"===e.ref)))||void 0===i?void 0:i.body;if(r&&ye()(r)){const t=Et(e.feedSlug),i=bt(t,[e.id]);return i.widgetsData=r.widgetsData,i.style=r.style,i}})),target:xt}),Je.on(ji.done.filterMap((({params:e,result:t})=>{var i;const r=null===(i=t.find((e=>"story"===e.ref)))||void 0===i?void 0:i.body;if(r&&ye()(r))return r.type=Et(e.feedSlug),r})),((e,t)=>{if(!Ni(t))return;const i=m.getState().user_key||"default",r=(e[i]||[]).slice(0).filter((e=>e.id!==(null==t?void 0:t.id))).slice(0);return t=Object.assign(t,{slides_html:t.need_placeholders?Array.from(t.slides_html).map((e=>Mi(e))):Array.from(t.slides_html),slides_duration:t.slides_duration,slidesLoaded:!0,is_opened:dt(t)}),r.push(t),Object.assign(Object.assign({},e),{[i]:r})})),(0,e.sample)({source:Je,clock:be,fn:(e,t)=>{const i={};for(const t in e)Ti.call(e,t)&&(i[t]=e[t].map((e=>{var t;return Object.assign(Object.assign({},e),{slides_html:e.need_placeholders&&Array.isArray(e.slides_html)?e.slides_html.map((e=>Mi(e))):null!==(t=e.slides_html)&&void 0!==t?t:[]})})));return i},target:Je}),(0,e.sample)({source:m,clock:m,filter:e=>{var t;return Boolean(null===(t=null==e?void 0:e.session)||void 0===t?void 0:t.id)},target:(0,e.createEffect)((e=>{ai(e.cache.filter((e=>"font-face"===e.type)))}))});const{storyFeedsAdded:Bi}=(0,e.createApi)(Ke,{storyFeedsAdded:(e,t)=>t});(0,e.sample)({clock:Ai.doneData.filterMap((e=>{let t={};for(const i of e)if(i.ref&&Ee()(i.ref)){const e=i.ref.match(/^storyList_(.+)/);if(e&&Array.isArray(e)&&e[1]){const r=i.body;t[e[1]]=Kt.createInstance(ii,r)}}return t})),target:Bi});const Ui=p(4871);var Vi;!function(e){e.FONT="font-face"}(Vi||(Vi={}));class Gi extends Fe{attributes(){return Ui(super.attributes(),["weight","style","type","url","title","family","format"])}constructor(){super(),this._url=""}set url(e){this._url=e}get url(){let e=window.isSecureContext;return void 0===e&&"https:"===window.location.protocol&&(e=!0),e?this._url:this._url.replace(/^https:\/\//,"http://")}get isFont(){return this.type===Vi.FONT}get fontFaceAsCss(){var e,t,i;if(!this.isFont)return null;let r={"font-family":null!==(e=this.family)&&void 0!==e?e:"normal",src:`url('${this.url}')`,"font-style":null!==(t=this.style)&&void 0!==t?t:"normal","font-weight":null!==(i=this.weight)&&void 0!==i?i:"normal"};return this.title&&(r.src+=`, local('${this.title}')`),`@font-face {${ni(r)}}\n`}}p(3981);class zi{constructor(){this.resources=[]}static createFromArray(e){const t=new zi;for(let i in e)e.hasOwnProperty(i)&&t.resources.push(Gi.createInstance(Gi,e[i]));return t}get fontsCss(){let e="";return this.resources.forEach((t=>{if(t.isFont){let i=t.fontFaceAsCss;null!==i&&(e+=i)}})),e||null}}class Wi extends Fe{constructor(){super(),this.id=null,this.expire_in=null,this.closed=!1,this.is_allow_profiling=!1,this.preview_aspect_ratio=1,this._placeholders={}}singleModelWrapper(){return""}attributes(){return Ge()(super.attributes(),["server_timestamp","session","cache","share","user_key","placeholders","is_allow_profiling","preview_aspect_ratio"])}static fetch(e){return this._fetch(Wi,"session/open?expand=cache",e,"post")}static updateSession(e){return this.update("session/update",e)}set session(e){this.id=e.id,this.expire_in=e.expire_in,void 0!==e.closed&&(this.closed=e.closed)}set cache(e){this._projectResourceCache=zi.createFromArray(e)}get cache(){return this._projectResourceCache}set placeholders(e){Se()(e)&&e.forEach((e=>{ye()(e)&&void 0!==e.name&&void 0!==e.default_value&&(this._placeholders[e.name]=e.default_value)}))}get placeholders(){return this._placeholders}}var $i=function(e,t,i,r){return new(i||(i=Promise))((function(n,s){function o(e){try{l(r.next(e))}catch(e){s(e)}}function a(e){try{l(r.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,a)}l((r=r.apply(e,t||[])).next())}))};class qi{constructor(e){this.storyManager=e}loadStories(e){return $i(this,arguments,void 0,(function*({listType:e,identityFields:t,testKey:i,needFavorite:r=!0}){const n=e===Xe.DEFAULT&&r;yield Ai({defaultList:t,onboardingList:!1,favoriteList:n,testKey:i});const s=Ot(pe.default,t.feedSlug),o=t.feedSlug===Hs?Xe.UGC:Xe.DEFAULT;const a={stories:s.map((e=>{const t={title:null,tags:[],slidesCount:null};return e&&(t.title=e.stat_title,t.tags=e.tags,t.slidesCount=e.slides_count,e.type===Xe.UGC&&(t.ugcPayload=ye()(e.payload)?e.payload:{})),Object.assign({id:e.id},t)})),feed:null,filter:null};o===Xe.DEFAULT?a.feed=t.feedSlug:o===Xe.UGC&&(a.filter=t.filter),this.storyManager.emit("feedLoad",a);return{defaultStories:Ot(pe.default,t.feedSlug),favoriteStories:Ot(pe.favorite,t.feedSlug)}}))}observeDefaultStories(e){return nt.map((t=>{var i;return(null!==(i=t[e])&&void 0!==i?i:[]).map((e=>this.createStoryByData(Object.assign(Object.assign({},e),{slides_html:[]}))))}))}observeFavoriteStories(){return ot.map((e=>e.map((e=>this.createStoryByData(Object.assign(Object.assign({},e),{slides_html:[]}))))))}observeSession(){return m.map((e=>Fe.createInstance(Wi,e)))}createStoryByData(e){return e instanceof $e?e:Fe.createInstance($e,e)}}const Hi={addEventListeners(e,t,i){for(var r=0,n=t.length;r<n;r++)e.addEventListener(t[r],i,{passive:!1})},removeEventListeners(e,t,i){for(var r=0,n=t.length;r<n;r++)e.removeEventListener(t[r],i,{passive:!1})},emitEvent:function(e,t,i){if(e.componentInstance)e.componentInstance.$emit(t,i);else{let r;"function"==typeof window.CustomEvent?r=new window.CustomEvent(t,{detail:i}):(r=document.createEvent("CustomEvent"),r.initCustomEvent(t,!0,!0,i)),e.elm.dispatchEvent(r)}},addOnceEventListener:function(e,t,i,r){var n=s=>{i(s),e.removeEventListener(t,n,r)};e.addEventListener(t,n,r)}},Zi=Hi,Qi=Hi.addOnceEventListener,Xi=["mousedown","touchstart"],Yi=["mousemove","touchmove"],Ki=["mouseup","touchend"],Ji=["transitionend"];class er{constructor(e){this.lastClientX=0,this.lastClientY=0,this.pushed=!1,this.sliderApi=e,this.handleMouseDown=this.handleMouseDown.bind(this),this.handleMouseMove=this.handleMouseMove.bind(this),this.handleMouseUp=this.handleMouseUp.bind(this),this.handleAnimationEnd=this.handleAnimationEnd.bind(this),this.addEventListeners()}addEventListeners(){const e=this.sliderApi.getElementRef();Zi.addEventListeners(e,Xi,this.handleMouseDown),Zi.addEventListeners(e,Ji,this.handleAnimationEnd)}scrollTo(e){this.sliderApi.getElementRef().style.transform=`translate3d(${-e.x}px, ${-e.y}px, 0px)`,this.sliderApi.updatePosition(e.x,e.y),this.sliderApi.testAttraction(),this.sliderApi.emit("scroll",e)}scrollWithAnimation(e,t){const i=this.sliderApi.getCurrentPosition();if(i.x===e.x&&i.y===e.y)return;this.sliderApi.getElementRef().style.transitionDuration=`${t}ms`,this.scrollTo(e)}stopAnimation(){this.sliderApi.getElementRef().style.transitionDuration="0ms"}destroy(){const e=this.sliderApi.getElementRef();Zi.removeEventListeners(e,Xi,this.handleMouseDown),Zi.removeEventListeners(window,Ki,this.handleMouseUp),Zi.removeEventListeners(window,Yi,this.handleMouseMove),Zi.removeEventListeners(e,Ji,this.handleAnimationEnd)}handleAnimationEnd(){this.stopAnimation(),this.sliderApi.emit("scrollend",this.sliderApi.getCurrentPosition())}handleMouseDown(e){this.pushed=!0,this.stopAnimation();const{clientX:t,clientY:i}=this.extractPointerPosition(e);this.lastClientX=t,this.lastClientY=i,Zi.addEventListeners(window,Ki,this.handleMouseUp),Zi.addEventListeners(window,Yi,this.handleMouseMove)}handleMouseUp(){this.pushed&&(this.pushed=!1,this.sliderApi.setIsDragging(!1),this.sliderApi.emit("scrollend",this.sliderApi.getCurrentPosition()),Zi.removeEventListeners(window,Ki,this.handleMouseUp),Zi.removeEventListeners(window,Yi,this.handleMouseMove))}handleMouseMove(e){if(!this.pushed)return;const{clientX:t,clientY:i}=this.extractPointerPosition(e),r=t-this.lastClientX,n=i-this.lastClientY;this.lastClientX=t,this.lastClientY=i;const{x:s,y:o}=this.sliderApi.preparePosition(this.sliderApi.getCurrentPosition().x-r,this.sliderApi.getCurrentPosition().y-n);this.scrollTo({x:s,y:o}),!this.sliderApi.isDragging&&(Math.abs(r)>=1||Math.abs(n)>=1)&&(this.sliderApi.setIsDragging(!0),this.sliderApi.emit("scrollstart",this.sliderApi.getCurrentPosition()))}extractPointerPosition(e){return e instanceof MouseEvent?{clientX:e.clientX,clientY:e.clientY}:{clientX:e.touches[0].clientX,clientY:e.touches[0].clientY}}}var tr=p(2784),ir=p.n(tr);const rr=["scroll"];class nr{constructor(e){this.rafId=0,this.prevTranslateX=null,this.prevTranslateY=null,this.handleScroll=this.handleScroll.bind(this),this.sliderApi=e,this.handleNativeScrollEnd=ir()((()=>{this.sliderApi.emit("scrollend",this.sliderApi.getCurrentPosition()),this.sliderApi.setIsScrolling(!1)}),300),this.init(),this.addEventListeners()}destroy(){const e=this.sliderApi.getElementRef();Zi.removeEventListeners(e,rr,this.handleScroll)}init(){const e=this.sliderApi.getElementRef();e.style.overflowX=this.sliderApi.isHorizontal()?"scroll":"hidden",e.style.overflowY=this.sliderApi.isHorizontal()?"hidden":"scroll"}addEventListeners(){const e=this.sliderApi.getElementRef();Zi.addEventListeners(e,rr,this.handleScroll)}scrollTo(e){const t=this.sliderApi.getElementRef();t.scrollLeft=e.x,t.scrollTop=e.y,this.sliderApi.updatePosition(e.x,e.y),this.sliderApi.testAttraction(),this.sliderApi.emit("scroll",e)}scrollWithAnimation(e,t){this.performNativeAnimation(e.x,e.y,t)}stopAnimation(){}handleScroll(e){this.sliderApi.isScrolling||(this.sliderApi.emit("scrollstart",this.sliderApi.getCurrentPosition()),this.sliderApi.setIsScrolling(!0));const t=this.sliderApi.getElementRef();this.sliderApi.updatePosition(t.scrollLeft,t.scrollTop),this.sliderApi.testAttraction(),this.sliderApi.emit("scroll",{x:t.scrollLeft,y:t.scrollTop}),this.handleNativeScrollEnd()}performNativeAnimation(e,t,i){const r=this.sliderApi.getCurrentPosition().x,n=this.sliderApi.getCurrentPosition().y,s=e-r,o=t-n;if(Math.abs(s)<=1&&Math.abs(o)<=1)return;if(this.prevTranslateX===e&&this.prevTranslateY===t)return;this.prevTranslateX=e,this.prevTranslateY=t;let a=performance.now();cancelAnimationFrame(this.rafId);const l=e=>{const t=e-a,d=Math.min(t/i,1),c=d*s+r,u=d*o+n;this.scrollTo({x:c,y:u}),d<1?this.rafId=requestAnimationFrame(l):(this.prevTranslateX=null,this.prevTranslateY=null)};this.rafId=requestAnimationFrame(l)}}var sr;!function(e){e.Horizontal="horizontal",e.Vertical="vertical"}(sr||(sr={}));class or extends U.EventEmitter{constructor(){super(...arguments),this._isScrolling=!1,this._isDragging=!1,this.currentPosition={x:0,y:0},this.direction=sr.Horizontal,this.gap=20,this._reachBeginning=!0,this._reachEnd=!0,this.desktopMode=!0}get isDragging(){return this._isDragging}get isScrolling(){return this._isScrolling}get slides(){return Array.from(this.slider.children)}get elementRef(){return this.slider}get reachBeginning(){return this._reachBeginning}get reachEnd(){return this._reachEnd}get scrollWidth(){return this.slider.scrollWidth}mount(e){this.slider=e,this.changeScrollStrategy()}destroy(){this.removeAllListeners(),this.scrollStrategy.destroy()}getLength(){var e,t;return null!==(t=null===(e=this.slider)||void 0===e?void 0:e.children.length)&&void 0!==t?t:0}changeDirection(e){this.direction=e,this.scrollTo(0,0),this.changeScrollStrategy()}setGap(e){this.gap=e}setDesktopMode(e){this.desktopMode=e,this.changeScrollStrategy()}getGap(){return this.gap}scrollTo(e,t=300){const i=this.preparePosition(e,e);t>0?this.scrollStrategy.scrollWithAnimation(i,t):(this.scrollStrategy.scrollTo(i),this.emit("scrollend",this.currentPosition))}isHorizontal(){return this.direction===sr.Horizontal}updatePosition(e,t){this.currentPosition={x:e,y:t}}getElementRef(){return this.slider}getCurrentPosition(){return this.currentPosition}preparePosition(e,t){let i={x:e,y:t};return this.isHorizontal()?i.y=0:i.x=0,this.attractToBounds(i.x,i.y)}attractToBounds(e,t){return{x:this.attractToBoundsByX(e),y:this.attractToBoundsByY(t)}}attractToBoundsByX(e){return e<=0?0:e+this.slider.clientWidth>=this.slider.scrollWidth?this.slider.scrollWidth-this.slider.clientWidth:e}attractToBoundsByY(e){return e<=0?0:e+this.slider.clientHeight>=this.slider.scrollHeight?this.slider.scrollHeight-this.slider.clientHeight:e}testAttraction(){const{x:e,y:t}=this.getCurrentPosition(),i=e+this.slider.clientWidth>=Math.max(this.slider.scrollWidth-1,0),r=t+this.slider.clientHeight>=Math.max(this.slider.scrollHeight-1,0);this._reachBeginning=0===e&&0===t,this._reachEnd=this.isHorizontal()?i:r,this.emit("reachBeginning",this._reachBeginning),this.emit("reachEnd",this._reachEnd)}setIsScrolling(e){this._isScrolling=e}setIsDragging(e){this._isDragging=e}getSlidesPerView(){if(this.direction===sr.Horizontal&&this.slider.clientWidth){const e=this.slider.children[0].clientWidth+this.gap;return Math.round(this.slider.clientWidth/e)}if(this.direction===sr.Vertical&&this.slider.clientHeight){const e=this.slider.children[0].clientHeight+this.gap;return Math.round(this.slider.clientHeight/e)}return 1}changeScrollStrategy(){this.scrollStrategy&&this.scrollStrategy.destroy(),this.scrollStrategy=this.desktopMode?new er(this):new nr(this)}}const ar=(e,t,i,r)=>!(!e||t||i)&&(console.error(`Cannot open hidden story id ${r}`),!0),lr=(e,t,i)=>{var r;e.isDeeplink?dr(e,t,i):(null===(r=t.gameInstance)||void 0===r?void 0:r.id)?cr(e,t,i):ur(e,t,i)},dr=(e,t,i)=>{e.isDeeplink=!0,i.eventPublisher.emit("clickOnStoryDeepLink",e)},cr=(e,t,i)=>{var r;i.eventPublisher.emit("clickOnStoryGame",{id:t.id,gameInstanceId:null===(r=t.gameInstance)||void 0===r?void 0:r.id})},ur=(e,t,i)=>{const r={index:e.index,isDeeplink:!1,id:e.id,listType:pe.default,windowReferer:he.default};t.isFavoriteCard?i.eventPublisher.emit("clickOnFavoriteCellInternal",r):t.isUgcCard?i.eventPublisher.emit("clickOnUgcCardCellInternal",r):i.eventPublisher.emit("clickOnStoryInternal",r),i.eventPublisher.emit("clickOnStory",e)};class hr extends U.EventEmitter{update(){this.emit("update")}destroy(){this.removeAllListeners()}}class pr{constructor(){this.viewModels=new Map}set(e,t){if(this.viewModels.has(e)){this.viewModels.get(e).add(t)}else this.viewModels.set(e,new Set([t]))}getAllByName(e){var t;const i=null!==(t=this.viewModels.get(e))&&void 0!==t?t:new Set;return Array.from(i.values())}getAll(){const e=[];for(const t of this.viewModels.values())for(const i of t.values())e.push(i);return e}getOneByName(e){const t=this.getAllByName(e)[0];if(!t)throw new Error(`ViewModel <${e}> is undefined`);return t}has(e){return this.viewModels.has(e)}clear(){for(const e of this.getAll())e.destroy();this.viewModels.clear()}}var fr;!function(e){e.START_LOADING="startLoading",e.END_LOADING="endLoading",e.CLOSE_STORY_READER="closeStoryReader"}(fr||(fr={}));class gr extends hr{constructor(e,t){super(),this.storyListViewModel=e,this.story=t,this.id=this.story.id,this.title=this.story.title,this.titleColor=this.story.title_color,this.magazineName=this.story.magazine_name,this.background=this.story.background,this.backgroundColor=this.story.background_color,this.favorite=this.story.favorite,this.like=this.story.like,this.deeplink=this.story.deeplink,this.hideInReader=this.story.hide_in_reader,this.gameInstance=this.story.game_instance,this.hasAudio=this.story.has_audio,this.isFavoriteCard=this.story.favorite_cell,this.isUgcCard=this.story.ugc_card_cell,this.isOpened=this.story.is_opened,this.image=this.story.image,this.videoCover=this.story._video_cover,this.videoCoverSrc=this.story.videoCoverSrc}get options(){return this.storyListViewModel.options.card}get isTitleCardInner(){return this.options.title.position===q.CARD_INSIDE_BOTTOM}get isTitleCardOutsideTop(){return this.options.title.position===q.CARD_OUTSIDE_TOP}get isTitleCardOutsideBottom(){return this.options.title.position===q.CARD_OUTSIDE_BOTTOM}get aspectRatio(){var e,t;const{aspectRatio:i,variant:r}=this.options;if(i)return i;switch(r){case te.STYLE_CIRCLE:case te.STYLE_QUAD:return 1;case te.STYLE_RECTANGLE:return null!==(t=null===(e=this.storyListViewModel.session)||void 0===e?void 0:e.preview_aspect_ratio)&&void 0!==t?t:.8;default:return 1}}getImageSrc(){var e,t;return null===(t=null===(e=this.story.image)||void 0===e?void 0:e.findOneByCoverQuality(this.options.coverQuality))||void 0===t?void 0:t.url}onClick(e){this.storyListViewModel.onStoryClick(this,e)}}class vr extends gr{constructor(e,t){super(e,t)}getImageSrc(){var e,t;return null===(t=null===(e=this.story.image)||void 0===e?void 0:e.findOneByCoverQuality(this.storyListViewModel.options.favoriteCard.coverQuality))||void 0===t?void 0:t.url}}class mr extends gr{constructor(e,t,i){super(e,t),this.favoriteStories=i}}const yr=new U.EventEmitter;yr.setMaxListeners(50);var wr,Sr=function(e,t,i,r){return new(i||(i=Promise))((function(n,s){function o(e){try{l(r.next(e))}catch(e){s(e)}}function a(e){try{l(r.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,a)}l((r=r.apply(e,t||[])).next())}))};class br extends hr{set modeDesktop(e){this._modeDesktop!==e&&(this._modeDesktop=e,this.emit("update"))}get modeDesktop(){return this._modeDesktop}get session(){return this._session}get defaultStories(){return this._defaultStories.slice()}get favoriteStories(){return this._favoriteStories.slice()}get ugcCard(){return this._ugcCard}get favoriteCard(){return this._favoriteCard}constructor(e,t){super(),this.storiesService=e,this.params=t,this._defaultStories=[],this._favoriteStories=[],this._session=null,this._modeDesktop=!0,this.subscriptions=[],this.appearanceManager=new le,this.setDefaultStories=this.setDefaultStories.bind(this),this.setFavoriteStories=this.setFavoriteStories.bind(this),this.hanldeShowStory=this.hanldeShowStory.bind(this),this.handleCloseStory=this.handleCloseStory.bind(this),this.subscribeToStoriesService(),this.emit("create"),this.registerStoryReaderEvents()}get options(){return this.appearanceManager.storiesListOptions}get hasFavoriteCard(){return this.params.hasFavorite&&this._favoriteStories.length>0}get hasUgcCard(){return this.params.useUgcCard}get hasFavoriteStories(){return this.params.hasFavorite&&this.params.listType===Xe.DEFAULT}onStoryClick(e,t=0){((e,t)=>{const{deeplink:i,hideInReader:r,gameInstance:n}=e,s=Ee()(i)&&i.trim().length>0,o=null==n?void 0:n.id;if(ar(Boolean(r),s,o,e.id))return;const a={id:e.id,index:t.index,isDeeplink:s,url:s?i:void 0};lr(a,e,t)})(e,{eventPublisher:this,index:t})}destroy(){this.emit("destroy"),this.subscriptions.forEach((e=>e.unsubscribe())),this.removeAllListeners(),this.unregisterStoryReaderEvents(),this.subscriptions=[]}registerStoryReaderEvents(){yr.on("publicEvents.showStory",this.hanldeShowStory),yr.on("publicEvents.closeStory",this.handleCloseStory)}unregisterStoryReaderEvents(){yr.off("publicEvents.showStory",this.hanldeShowStory),yr.off("publicEvents.closeStory",this.handleCloseStory)}getAppearanceManager(){return this.appearanceManager}setAppearanceManager(e){this.appearanceManager=e,this.update()}reload(){return Sr(this,void 0,void 0,(function*(){yield this.loadStories({needFavorite:!1})}))}loadStories(e){return Sr(this,void 0,void 0,(function*(){var t;const i=Boolean(this.params.hasFavorite)&&e.needFavorite,r={feed:this.params.identityFields.feedSlug,filter:{},defaultListLength:0,favoriteListLength:0,success:!0,error:{name:"",networkStatus:200,networkMessage:""}};try{this.emit("startLoading");const{defaultStories:e,favoriteStories:t}=yield this.storiesService.loadStories(Object.assign(Object.assign({},this.params),{needFavorite:i}));r.success=!0,r.error=null,r.defaultListLength=e.length,this.params.hasFavorite&&this.params.listType===Xe.DEFAULT&&(r.favoriteListLength=t.length)}catch(e){console.error(e),r.success=!1,r.error={name:e.name,networkMessage:e.networkMessage,networkStatus:e.networkStatus}}finally{r.filter=null!==(t=this.params.identityFields.filter)&&void 0!==t?t:{},this.emit("endLoading",r)}}))}hanldeShowStory(e){this.emit("openStory",e.id)}handleCloseStory(e){this.emit("closeStory",e.id)}subscribeToStoriesService(){const e=this.storiesService.observeDefaultStories(this.params.identityFields.feedSlug).watch(this.setDefaultStories);if(this.hasFavoriteStories){const e=this.storiesService.observeFavoriteStories().watch(this.setFavoriteStories);this.subscriptions.push(e)}const t=this.storiesService.observeSession().watch((e=>{this._session=e,this.emit("update")}));this.subscriptions.push(e,t)}setUgcAndFavoriteStoryCards(){if(this._ugcCard=void 0,this._favoriteCard=void 0,this.hasUgcCard){const e=Qe.create(this.options);this._ugcCard=new gr(this,e)}if(this.hasFavoriteCard){const e=qe.create(this.options);this._favoriteCard=new mr(this,e,this.favoriteStories)}}setDefaultStories(e){this._defaultStories=e.map((e=>new gr(this,e))),this.setUgcAndFavoriteStoryCards(),this.emit("update")}setFavoriteStories(e){this._favoriteStories=e.map((e=>new vr(this,e))),this.setUgcAndFavoriteStoryCards(),this.emit("update")}}!function(e){e.STORY_LIST="storyList",e.STORY_READER="storyReader",e.GAME_READER="gameReader"}(wr||(wr={}));var _r=p(2438),xr=p.n(_r),Cr=function(e,t,i,r){return new(i||(i=Promise))((function(n,s){function o(e){try{l(r.next(e))}catch(e){s(e)}}function a(e){try{l(r.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,a)}l((r=r.apply(e,t||[])).next())}))};class kr extends Error{}class Or{fetchSessionAndStoriesCompositeFx(e){return Cr(this,void 0,void 0,(function*(){return Ai({defaultList:!1,onboardingList:e.onboardingList,favoriteList:!1,onboardingTags:e?e.customTags:void 0,limit:e?e.limit:void 0})}))}fetchSingleStoryWithoutContext(e,t,i){return Cr(this,void 0,void 0,(function*(){try{yield ji({id:e,feedSlug:t,fetchShareUrl:i});const r=et.getState().find((t=>t.id===e))||Ye(e);return r.slidesLoaded=!1,r}catch(t){return Ye(e)}}))}fetchSingleStoryContext(e,t){return Cr(this,void 0,void 0,(function*(){yield Ct({ids:[e],feedSlug:t});const i=et.getState().find((t=>t.id===e));if(!i)throw new Error;return i.slidesLoaded=!0,i}))}fetchStoriesSlides(e,t){return Cr(this,void 0,void 0,(function*(){const i=ct.getState()[e];i.length>0&&(yield Di({ids:i,feedSlug:t}))}))}fetchMultipleStoriesContext(e,t,i){return Cr(this,void 0,void 0,(function*(){const r=_t(t,xt.getState()),n=et.getState().find((i=>i.id===e&&i.type===t));let s=null!==r&&""!==r.style;const o=ct.getState()[t];t===Xe.DEFAULT&&o.length>0&&(null==r?void 0:r.ids)!==o&&(s=!1);const a=!s&&!(null==n?void 0:n.slidesLoaded),l=!s&&o.length;if(a){const r=t===Xe.DEFAULT?o:[];yield Fi({ids:r,id:e,feedSlug:i})}else if(l)yield Ct({ids:o,feedSlug:i});else{if(null==n?void 0:n.slidesLoaded)throw new kr;yield Di({ids:[e],feedSlug:i})}}))}getStoryContextInternalModel(e){const t=ct.getState()[e];return xt.getState()||bt(e,t)}static updateStoryLike(e,t){return Cr(this,void 0,void 0,(function*(){let i=!1;const r={like:void 0};let n="";try{const s=yield F.post(`story-like/${e}`,{value:t});void 0!==s.data.like?(i=!0,r.like=s.data.like,ht({id:e,like:r.like})):n="response.data.like is undefined"}catch(e){n=e.toString()}if(i)return r;throw n}))}static getStorySharePath(e){return Cr(this,void 0,void 0,(function*(){let t=!1;const i={url:void 0};let r="";try{const n=yield F.get(`story-share/${e}`,{});void 0!==n.data.url?(t=!0,i.url=n.data.url):r="response.data.url is undefined"}catch(e){r=e.toString()}if(t)return i;throw r}))}static markAsOpened(e){if(!Yt()(m.getState().user_key)){const t=`u/${m.getState().user_key}/s_opened`;let i=Rt(t);Se()(i)||(i=[]),i.push(e),i=xr()(i),Pt(t,i)}pt({id:e})}static setBookmark(e,t){return Cr(this,void 0,void 0,(function*(){let i=!1;const r={favorite:void 0};let n="";try{const s=yield F.post(`story-favorite/${e}`,{value:t});void 0!==s.data.favorite?(i=!0,r.favorite=Boolean(s.data.favorite),!1===r.favorite?Ri({storiesIdsUserEntity:tt.FAVORITE,feedSlug:null,storyList:ot.getState().filter((t=>t.id!==e))}):Ri({storiesIdsUserEntity:tt.FAVORITE,feedSlug:null,storyList:[...ot.getState(),...et.getState().filter((t=>t.id===e))]}),ut({id:e,favorite:r.favorite})):n="response.data.favorite is undefined"}catch(e){n=e.toString()}if(i)return r;throw n}))}}const Er=(0,e.createStore)({uiPaused:!1,timerPaused:!1,locked:!1,closeGestureInAction:!1}),Ar=Er.map((e=>e.uiPaused)),Lr=Er.map((e=>e.timerPaused)),Mr=(0,e.createStore)(!1),Ir=(0,e.createStore)(!0),Tr=(0,e.createStore)(!0),Rr=(0,e.createEvent)(),Pr=(0,e.createEvent)(),Dr=(0,e.createEvent)(),Nr=(0,e.createEvent)(),Fr=(0,e.createEvent)(),jr=(0,e.createEvent)(),Br=(0,e.createEvent)(),Ur=(0,e.createEvent)(),Vr=(0,e.createEvent)(),Gr=(0,e.createEvent)(),zr=(0,e.createEvent)(),Wr=(0,e.createEvent)(),$r=(0,e.createEvent)(),qr=(0,e.createEvent)(),Hr=t=>(0,e.sample)({source:Er,clock:t,filter:e=>!e.locked}),Zr=Hr(Br),Qr=Hr(Ur),Xr=Hr(Vr),Yr=Hr(Gr);Er.on(Xr,(e=>Object.assign(Object.assign({},e),{uiPaused:!0,timerPaused:!0}))).on(Yr,(e=>Object.assign(Object.assign({},e),{uiPaused:!1,timerPaused:!1}))).on(Zr,(e=>e.timerPaused?e:Object.assign(Object.assign({},e),{timerPaused:!0}))).on(Qr,(e=>e.timerPaused?Object.assign(Object.assign({},e),{timerPaused:!1}):e)).on(zr,(e=>Object.assign(Object.assign({},e),{uiPaused:!0,timerPaused:!0,locked:!0}))).on(Wr,(e=>Object.assign(Object.assign({},e),{uiPaused:!1,timerPaused:!1,locked:!1}))).on($r,(e=>Object.assign(Object.assign({},e),{timerPaused:!0,locked:!0}))).on(qr,(e=>Object.assign(Object.assign({},e),{timerPaused:!1,locked:!1}))),Mr.on(Rr,(e=>!0)).on(Pr,(e=>!1)),Ir.on(Dr,(()=>!0)).on(Nr,(()=>!1)),Tr.on(Fr,(()=>!0)).on(jr,(()=>!1));const Kr=(0,e.createStore)({rotating:!1});(0,e.createApi)(Kr,{enableRotating:e=>Object.assign(Object.assign({},e),{rotating:!0}),disableRotating:e=>Object.assign(Object.assign({},e),{rotating:!1})});class Jr{constructor(e,t,i){this.userKey=e,this.gameInstanceId=t,this.instanceUserData=i}set(e){const t=se()(this.get(),e);return window.localStorage.setItem(this.key,JSON.stringify(t)),t}get(){var e;let t={};const i=ye()(this.instanceUserData)?this.instanceUserData:{};try{const i=JSON.parse(null!==(e=window.localStorage.getItem(this.key))&&void 0!==e?e:"{}");ye()(i)&&(t=i)}catch(e){console.error(e)}return se()(t,i)}get key(){return`game_instance_data_${this.userKey}_${this.gameInstanceId}`}}class en{constructor(e,t){this.gameCenterMessageService=e,this.gameReaderViewModel=t}handle(e){const{id:t,callback:i}=JSON.parse(e),r=this.gameReaderViewModel.gameLaunch;if(!r)return;const n=new Jr(r.clientConfig.userKey,r.config.gameInstanceId,r.instanceUserData).get();this.gameCenterMessageService.sendMessage("cb",{cb:i,arguments:JSON.stringify([t,JSON.stringify(n)])})}}class tn{constructor(e,t){this.gameCenterMessageService=e,this.gameReaderViewModel=t}handle(e){const{gameInstanceId:t,data:i}=JSON.parse(e),r=this.gameReaderViewModel.gameLaunch;if(!r)return;const n=new Jr(r.clientConfig.userKey,r.config.gameInstanceId,r.instanceUserData).set(i);this.gameReaderViewModel.emit(ce.GameInstanceSetLocalData,{data:JSON.stringify(n)})}}var rn=function(e,t,i,r){return new(i||(i=Promise))((function(n,s){function o(e){try{l(r.next(e))}catch(e){s(e)}}function a(e){try{l(r.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,a)}l((r=r.apply(e,t||[])).next())}))};var nn,sn=function(e,t,i,r){return new(i||(i=Promise))((function(n,s){function o(e){try{l(r.next(e))}catch(e){s(e)}}function a(e){try{l(r.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,a)}l((r=r.apply(e,t||[])).next())}))};!function(e){e.Social="social",e.SlideScreenshot="slide-screenshot"}(nn||(nn={}));class on{constructor(e,t,i){this.gameCenterMessageService=e,this.gameReaderViewModel=t,this.desktopMode=i}handle(e,t){return sn(this,void 0,void 0,(function*(){var i,r,n;let s=null!==(i=null==t?void 0:t.url)&&void 0!==i?i:t.text,o=[];t.files&&Array.isArray(t.files)&&t.files.length>0&&(o=yield Promise.all(t.files.map((e=>(e=>rn(void 0,[e],void 0,(function*({file:e,name:t,type:i}){const r=yield fetch(`data:${i};base64,${e}`),n=yield r.blob();return new File([n],t,{type:i,lastModified:(new Date).getTime()})})))(e)))));const a={url:null!=s?s:void 0,files:o.length>0?o:void 0,text:null!==(r=t.text)&&void 0!==r?r:void 0,title:null!==(n=t.title)&&void 0!==n?n:void 0};if(!(a.files&&a.files.length>0||a.url))return void this.gameReaderViewModel.confirmSharingComplete({shareId:e,isSuccess:!1});let l=navigator.share;if(!navigator.share&&window.parent&&window.parent.navigator.share&&(l=window.parent.navigator.share),!this.desktopMode&&l)try{if(!l)return;l(a).then((()=>this.gameReaderViewModel.confirmSharingComplete({shareId:e,isSuccess:!0}))).catch((()=>this.gameReaderViewModel.confirmSharingComplete({shareId:e,isSuccess:!1})))}catch(t){console.error(t),this.openSharePanel({shareConfig:a,sharePath:s,shareId:e})}else this.openSharePanel({shareConfig:a,sharePath:s,shareId:e})}))}openSharePanel({shareConfig:e,sharePath:t,shareId:i}){let r=nn.Social,n=t;e.files&&e.files.length>0&&(r=nn.SlideScreenshot,n=URL.createObjectURL(e.files[0])),this.gameReaderViewModel.emit(ce.OpenSharePanel,{shareId:i,shareType:r,shareLink:n})}}class an{constructor(e){this.storyId=e}set(e){sessionStorage.setItem(this.key,JSON.stringify(e))}get(){var e;const t=null!==(e=sessionStorage.getItem(this.key))&&void 0!==e?e:"{}";return window.__activeNarrativeId?JSON.parse(t):{}}get key(){return`narrative_${this.storyId}_data`}}class ln{constructor(e,t){this.gameCenterMessageService=e,this.gameReaderViewModel=t}handle(e){const t=JSON.parse(e);if(!ye()(t))return;const{id:i,storyId:r,callback:n}=t;let s=new an(r).get();this.gameCenterMessageService.sendMessage("cb",{cb:n,arguments:JSON.stringify([i,JSON.stringify(s)])})}}class dn{constructor(e,t){this.gameCenterMessageService=e,this.gameReaderViewModel=t}handle(e){const t=JSON.parse(e);if(!ye()(t))return;const{storyId:i,data:r,sendToServer:n}=t;new an(i).set(r),n&&this.gameReaderViewModel.emit(ce.StorySetLocalData,{storyId:i,data:JSON.stringify(r)})}}const cn={id:"",isOpened:!1,type:nn.Social,link:""},un=(0,e.createStore)(cn),hn=un.map((e=>e.isOpened)),pn=(0,e.createEvent)(),fn=(0,e.createEvent)();un.on(pn,((e,t)=>Object.assign(Object.assign({},e),{link:t.link,type:t.type,id:t.id,isOpened:!0}))).on(fn,(e=>cn));var gn=function(e,t,i,r){return new(i||(i=Promise))((function(n,s){function o(e){try{l(r.next(e))}catch(e){s(e)}}function a(e){try{l(r.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,a)}l((r=r.apply(e,t||[])).next())}))};class vn{constructor(){this.type=vn.name}init(e){return gn(this,void 0,void 0,(function*(){}))}get firstElement(){var e;return null===(e=this.elements)||void 0===e?void 0:e.item(0)}get isInited(){return Boolean(this.firstElement)}pause(){}resume(){}destroy(){}getActiveElement(){var e;return null===(e=this.elements)||void 0===e?void 0:e.item(0)}getActiveElements(){return this.elements}refreshUserData(){}getType(){return this.type}}var mn=function(e,t,i,r){return new(i||(i=Promise))((function(n,s){function o(e){try{l(r.next(e))}catch(e){s(e)}}function a(e){try{l(r.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,a)}l((r=r.apply(e,t||[])).next())}))};class yn extends vn{constructor(e){super(),this.slideApi=e,this.type=yn.name}init(e){return mn(this,void 0,void 0,(function*(){this.elements=e.querySelectorAll(".narrative-element-copy");try{this.slideApi.WidgetCopy.initWidget(this.elements)}catch(e){console.error(e)}}))}refreshUserData(){this.elements&&this.slideApi.WidgetCopy.refreshUserData(this.elements)}click(e){this.slideApi.WidgetCopy.click(e)}}var wn=function(e,t,i,r){return new(i||(i=Promise))((function(n,s){function o(e){try{l(r.next(e))}catch(e){s(e)}}function a(e){try{l(r.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,a)}l((r=r.apply(e,t||[])).next())}))};class Sn extends vn{constructor(e){super(),this.slideApi=e,this.type=Sn.name}init(e){return wn(this,void 0,void 0,(function*(){this.elements=e.querySelectorAll(".narrative-element-data-input");try{this.slideApi.WidgetDataInput.initWidget(this.elements)}catch(e){console.error(e)}}))}refreshUserData(){this.elements&&this.slideApi.WidgetDataInput.refreshUserData(this.elements)}click(e){this.slideApi.WidgetDataInput.click(e)}setUserData(e,t=""){this.slideApi.WidgetDataInput.setUserData(e,t)}}var bn=function(e,t,i,r){return new(i||(i=Promise))((function(n,s){function o(e){try{l(r.next(e))}catch(e){s(e)}}function a(e){try{l(r.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,a)}l((r=r.apply(e,t||[])).next())}))};class _n extends vn{constructor(e){super(),this.slideApi=e,this.type=_n.name}init(e){return bn(this,void 0,void 0,(function*(){this.elements=e.querySelectorAll(".narrative-element-date-countdown");const t=Array.from(e.querySelectorAll(".narrative-slide.narrative-multi-slide"));try{if(!this.elements.length)return;this.slideApi.WidgetDateCountdown.initWidget(this.elements,t)}catch(e){console.error(e)}}))}pause(){try{if(!this.elements)return;this.slideApi.WidgetDateCountdown.pause(this.elements)}catch(e){console.error(e)}}resume(){try{if(!this.elements)return;this.slideApi.WidgetDateCountdown.resume(this.elements)}catch(e){console.error(e)}}refreshUserData(){this.elements&&this.slideApi.WidgetDateCountdown.refreshUserData(this.elements)}}var xn=function(e,t,i,r){return new(i||(i=Promise))((function(n,s){function o(e){try{l(r.next(e))}catch(e){s(e)}}function a(e){try{l(r.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,a)}l((r=r.apply(e,t||[])).next())}))};class Cn extends vn{constructor(e){super(),this.slideApi=e,this.type=Cn.name}init(e){return xn(this,void 0,void 0,(function*(){this.elements=e.querySelectorAll(".narrative-element-poll");try{if(!this.firstElement)return;this.slideApi.WidgetPoll.initWidget(this.firstElement)}catch(e){console.error(e)}}))}refreshUserData(){this.elements&&this.slideApi.WidgetPoll.refreshUserData(this.elements)}select(e){this.slideApi.WidgetPoll.select(e)}setUserData(e,t=""){this.slideApi.WidgetPoll.setUserData(e,t)}}var kn=function(e,t,i,r){return new(i||(i=Promise))((function(n,s){function o(e){try{l(r.next(e))}catch(e){s(e)}}function a(e){try{l(r.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,a)}l((r=r.apply(e,t||[])).next())}))};class On extends vn{constructor(e){super(),this.slideApi=e,this.type=On.name}init(e){return kn(this,void 0,void 0,(function*(){this.elements=e.querySelectorAll(".narrative-element-poll-layers");const t=e.querySelectorAll(".narrative-slide.narrative-multi-slide");try{if(!this.firstElement)return;this.slideApi.WidgetPollLayers.initWidget(this.firstElement,Array.from(t))}catch(e){console.error(e)}}))}refreshUserData(){this.elements&&this.slideApi.WidgetPollLayers.refreshUserData(this.elements)}select(e){this.slideApi.WidgetPollLayers.select(e)}}var En=function(e,t,i,r){return new(i||(i=Promise))((function(n,s){function o(e){try{l(r.next(e))}catch(e){s(e)}}function a(e){try{l(r.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,a)}l((r=r.apply(e,t||[])).next())}))};class An extends vn{constructor(e){super(),this.slideApi=e,this.type=An.name}init(e){return En(this,void 0,void 0,(function*(){var t;this.elements=e.querySelectorAll(".narrative-element-quest");const i=e.querySelectorAll(".narrative-slide"),r=null===(t=null==i?void 0:i.item(0))||void 0===t?void 0:t.getAttribute("data-quest-count");this.elements.length||null==r||(this.elements=i);try{if(!this.firstElement)return;yield this.slideApi.WidgetQuest.initWidget(this.firstElement)}catch(e){console.error(e)}}))}refreshUserData(){this.elements&&this.slideApi.WidgetQuest.refreshUserData(this.elements)}select(e){this.slideApi.WidgetQuest.select(e)}handleRouteClick({direction:e,slideIndex:t,slidesCount:i,onClick:r}){this.firstElement&&this.slideApi.WidgetQuest.handleRouteClick(this.firstElement,{direction:e,slideIndex:t,slideCount:i,click:r})}}var Ln=function(e,t,i,r){return new(i||(i=Promise))((function(n,s){function o(e){try{l(r.next(e))}catch(e){s(e)}}function a(e){try{l(r.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,a)}l((r=r.apply(e,t||[])).next())}))};class Mn extends vn{constructor(e){super(),this.slideApi=e,this.type=Mn.name}init(e){return Ln(this,void 0,void 0,(function*(){this.elements=e.querySelectorAll(".narrative-element-quiz");try{if(!this.firstElement)return;this.slideApi.WidgetQuiz.initWidget(this.firstElement)}catch(e){console.error(e)}}))}refreshUserData(){this.elements&&this.slideApi.WidgetQuiz.refreshUserData(this.elements)}select(e){this.slideApi.WidgetQuiz.select(e)}slideQuizIsDone(e){return this.slideApi.WidgetQuiz.slideQuizIsDone(e)}}var In=function(e,t,i,r){return new(i||(i=Promise))((function(n,s){function o(e){try{l(r.next(e))}catch(e){s(e)}}function a(e){try{l(r.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,a)}l((r=r.apply(e,t||[])).next())}))};class Tn extends vn{constructor(e){super(),this.slideApi=e,this.type=Tn.name}init(e){return In(this,void 0,void 0,(function*(){this.elements=e.querySelectorAll(".narrative-element-quiz-grouped");try{if(!this.firstElement)return;this.slideApi.WidgetQuizGrouped.initWidget(this.firstElement)}catch(e){console.error(e)}}))}refreshUserData(){this.elements&&this.slideApi.WidgetQuizGrouped.refreshUserData(this.elements)}select(e){this.slideApi.WidgetQuizGrouped.select(e)}slideQuizIsDone(e){return this.slideApi.WidgetQuizGrouped.slideQuizIsDone(e)}}var Rn=function(e,t,i,r){return new(i||(i=Promise))((function(n,s){function o(e){try{l(r.next(e))}catch(e){s(e)}}function a(e){try{l(r.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,a)}l((r=r.apply(e,t||[])).next())}))};class Pn extends vn{constructor(e){super(),this.slideApi=e,this.type=Pn.name,this.disableSwipeGesture=this.disableSwipeGesture.bind(this),this.enableSwipeGesture=this.enableSwipeGesture.bind(this)}init(e){return Rn(this,void 0,void 0,(function*(){this.elements=e.querySelectorAll(".narrative-element-range-slider"),this.slideContent=e;try{if(!this.firstElement)return;this.slideApi.WidgetRangeSlider.initWidget(this.firstElement),this.registerMouseAndTouchEvents()}catch(e){console.error(e)}}))}refreshUserData(){this.elements&&this.slideApi.WidgetRangeSlider.refreshUserData(this.elements)}click(e){this.slideApi.WidgetRangeSlider.click(e)}isClickCapturedBySlider(e){return this.slideApi.WidgetRangeSlider.isClickCapturedBySlider(e)}disableSwipeGesture(e){Nr()}enableSwipeGesture(e){Dr()}registerMouseAndTouchEvents(){this.slideContent.addEventListener("mouseup",this.enableSwipeGesture),this.slideContent.addEventListener("touchend",this.enableSwipeGesture),this.slideContent.addEventListener("mousedown",this.disableSwipeGesture),this.slideContent.addEventListener("touchstart",this.disableSwipeGesture)}unregisterMouseAndTouchEvents(){var e,t,i,r;null===(e=this.slideContent)||void 0===e||e.removeEventListener("mouseup",this.enableSwipeGesture),null===(t=this.slideContent)||void 0===t||t.removeEventListener("touchend",this.enableSwipeGesture),null===(i=this.slideContent)||void 0===i||i.removeEventListener("mousedown",this.disableSwipeGesture),null===(r=this.slideContent)||void 0===r||r.removeEventListener("touchstart",this.disableSwipeGesture)}destroy(){this.unregisterMouseAndTouchEvents()}}var Dn=function(e,t,i,r){return new(i||(i=Promise))((function(n,s){function o(e){try{l(r.next(e))}catch(e){s(e)}}function a(e){try{l(r.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,a)}l((r=r.apply(e,t||[])).next())}))};class Nn extends vn{constructor(e){super(),this.slideApi=e,this.type=Nn.name}init(e){return Dn(this,void 0,void 0,(function*(){this.elements=e.querySelectorAll(".narrative-element-rate");try{this.slideApi.WidgetRate.initWidget(this.elements)}catch(e){console.error(e)}}))}refreshUserData(){this.elements&&this.slideApi.WidgetRate.refreshUserData(this.elements)}select(e){this.slideApi.WidgetRate.select(e)}setUserData(e,t=""){this.slideApi.WidgetRate.setUserData(e,t)}}var Fn=function(e,t,i,r){return new(i||(i=Promise))((function(n,s){function o(e){try{l(r.next(e))}catch(e){s(e)}}function a(e){try{l(r.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,a)}l((r=r.apply(e,t||[])).next())}))};class jn extends vn{constructor(e){super(),this.slideApi=e,this.type=jn.name,this.handleShareComplete=this.handleShareComplete.bind(this)}init(e){return Fn(this,void 0,void 0,(function*(){this.elements=e.querySelectorAll(".narrative-element-share"),this.slideContent=e;const t=e.querySelectorAll(".narrative-slide.narrative-multi-slide");try{this.registerEvents(),this.slideApi.WidgetShare.initWidget(this.elements,Array.from(t))}catch(e){console.error(e)}}))}complete(e,t){this.slideApi.WidgetShare.complete(e,t)}refreshUserData(){this.elements&&this.slideApi.WidgetShare.refreshUserData(this.elements)}click(e){this.slideApi.WidgetShare.click(e)}destroy(){this.unregisterEvents()}registerEvents(){yr.on(`${jn.name}.shareComplete`,this.handleShareComplete)}unregisterEvents(){yr.off(`${jn.name}.shareComplete`,this.handleShareComplete)}handleShareComplete({shareId:e,result:t}){Re(`[Share Widget]: share complete, { shareId, result }: ${e}, ${t}}`),this.complete(e,t)}}var Bn=function(e,t,i,r){return new(i||(i=Promise))((function(n,s){function o(e){try{l(r.next(e))}catch(e){s(e)}}function a(e){try{l(r.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,a)}l((r=r.apply(e,t||[])).next())}))};class Un extends vn{constructor(e){super(),this.slideApi=e,this.type=Un.name}init(e){return Bn(this,void 0,void 0,(function*(){this.elements=e.querySelectorAll(".narrative-element-test");try{if(!this.firstElement)return;this.slideApi.WidgetTest.initWidget(this.firstElement)}catch(e){console.error(e)}}))}refreshUserData(){this.elements&&this.slideApi.WidgetTest.refreshUserData(this.elements)}select(e){this.slideApi.WidgetTest.select(e)}slideTestIsDone(e){return this.slideApi.WidgetTest.slideTestIsDone(e)}slideTestWithTimer(e){return this.slideApi.WidgetTest.slideTestWithTimer(e)}}var Vn=function(e,t,i,r){return new(i||(i=Promise))((function(n,s){function o(e){try{l(r.next(e))}catch(e){s(e)}}function a(e){try{l(r.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,a)}l((r=r.apply(e,t||[])).next())}))};class Gn extends vn{constructor(e){super(),this.slideApi=e,this.type=Gn.name}init(e){return Vn(this,void 0,void 0,(function*(){this.elements=e.querySelectorAll(".narrative-element-vote");try{if(!this.firstElement)return;this.slideApi.WidgetVote.initWidget(this.firstElement)}catch(e){console.error(e)}}))}refreshUserData(){this.elements&&this.slideApi.WidgetVote.refreshUserData(this.elements)}select(e){this.slideApi.WidgetVote.select(e)}}const zn={id:"",running:!1},Wn=(0,e.createStore)(zn),$n=(0,e.createEvent)(),qn=(0,e.createEvent)(),Hn=(0,e.createEvent)(),Zn=(0,e.createEffect)((({shareId:e,result:t})=>{Hn(),qr(),yr.emit(`${jn.name}.shareComplete`,{shareId:e,result:t})}));Wn.on($n,((e,t)=>Object.assign(Object.assign({},e),{id:t.id,running:!0}))).on(Hn,(()=>zn)),(0,e.sample)({clock:qn,source:Wn,filter:e=>e.running,fn:(e,t)=>({shareId:e.id,result:t.result}),target:Zn});const Qn={isOpened:!1,url:"",elementId:""},Xn=(0,e.createStore)(Qn),Yn=(Xn.map((e=>e.isOpened)),(0,e.createEvent)()),Kn=(0,e.createEvent)();(0,e.sample)({clock:Yn,target:Nr}),(0,e.sample)({clock:Kn,target:Dr}),Xn.on(Yn,((e,t)=>({url:t.url,elementId:t.elementId,isOpened:!0}))).on(Kn,(e=>Qn));const Jn=(0,e.createStore)({prevStoryId:-1,prevSlideIndex:-1}),es=(0,e.createEvent)(),ts=(0,e.createEvent)(),is=(0,e.createEvent)(),rs=(0,e.createEffect)((e=>{e.prevStoryId!==e.currentStoryId&&yr.emit("publicEvents.showStory",{id:e.currentStoryId,index:e.currentSlideIndex}),-1!==e.prevStoryId&&yr.emit("statistics.nextSlide",{fromStoryId:e.prevStoryId,fromSlideIndex:e.prevSlideIndex}),yr.emit("publicEvents.showSlide",{id:e.currentStoryId,index:e.currentSlideIndex}),is(e)}));Jn.on(is,((e,t)=>({prevStoryId:t.currentStoryId,prevSlideIndex:t.currentSlideIndex}))),Jn.reset(ts),(0,e.sample)({clock:es,source:Jn,fn:(e,t)=>Object.assign(Object.assign({},e),t),target:rs});class ns extends Fe{static sentData(e,t,i){return new Promise((r=>{i("apiRequest",{url:"story-data/"+e,method:"put",params:null,data:t,headers:null}).then((e=>{r({data:e.data,status:200,headers:[{}]})})).catch((e=>{r({data:e,status:400,headers:[{}]})}))}))}static sendApiRequest({url:e,method:t,params:i,headers:r,data:n,profilingKey:s},o){return new Promise((s=>{o("apiRequest",{url:e,method:t,params:i,data:n,headers:r}).then((e=>{s({data:e.data,status:200,headers:[{}]})})).catch((e=>{s({data:e,status:400,headers:[{}]})}))}))}static sendApiRequestPromise(e,t,i){const{id:r,url:n,method:s,params:o,headers:a,data:l,cb:d}=JSON.parse(e);return i("apiRequest",{url:n,method:s,params:o,data:l,headers:a}).then((e=>{let i=JSON.stringify({requestId:r,data:JSON.stringify(e.data),status:e.status,headers:e.headers});t(d,i)}),(e=>{let i=JSON.stringify({requestId:r,data:JSON.stringify(e),status:400,headers:[{}]});t(d,i)}))}}const ss=p(4871);class os extends Fe{constructor(){super(...arguments),this.style="",this.widgetsData={}}static fetch(e){return this._fetch(os,"story-context",{id:e.join(",")})}attributes(){return ss(super.attributes(),["style","widgetsData"])}}var as=function(e,t,i,r){return new(i||(i=Promise))((function(n,s){function o(e){try{l(r.next(e))}catch(e){s(e)}}function a(e){try{l(r.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,a)}l((r=r.apply(e,t||[])).next())}))};class ls extends hr{constructor(e,t,i){super(),this.storiesItem=e,this.storyReaderOptions=t,this._hasShare=i,this._muted=!0,this._activeSlideIndex=0,this.displayedSlides=[],this.displayedSlides=this.fillSlides(),this.redirectToSlide=this.redirectToSlide.bind(this),this.nextSlide=this.nextSlide.bind(this)}get id(){return this.storiesItem.id}get title(){return this.storiesItem.title}get slidesLoaded(){return this.storiesItem.slidesLoaded}get like(){return this.storiesItem.like}get favorite(){return this.storiesItem.favorite}get needBottomPanel(){return!this.storiesItem.blank&&(this.hasLike||this.hasFavorite||this.hasShare||this.hasAudio)}get hasLike(){return!!this.storiesItem.like_functional&&Boolean(this.storyReaderOptions.appearanceCommon.hasLike)}get hasShare(){return!!Boolean(this.storiesItem.share_functional)&&this._hasShare}get hasFavorite(){return!!this.storiesItem.favorite_functional&&Boolean(this.storyReaderOptions.appearanceCommon.hasFavorite)}get hasAudio(){return Boolean(this.storiesItem.has_audio)}get slides(){return this.displayedSlides}get activeSlideIndex(){return this._activeSlideIndex}get slidesCount(){var e;return null!==(e=this.storiesItem.slides_count)&&void 0!==e?e:0}get slidesDuration(){return this.storiesItem.slides_duration}get activeSlideDuration(){return this.slidesDuration[this.activeSlideIndex]}get hiddenTimeline(){return Array.isArray(this.storiesItem.slides_duration)&&1===this.storiesItem.slides_duration.length&&0===this.storiesItem.slides_duration[0]}get displayedSlideImage(){return this.storiesItem.blank?null:this.storiesItem.imagePerSlide(this.activeSlideIndex)}get isBlank(){return this.storiesItem.blank}get reachEnd(){return this.activeSlideIndex===this.slidesCount-1}get reachStart(){return 0===this.activeSlideIndex}get disableClose(){return this.storiesItem.disable_close}handleSlideClick(e){e.stopPropagation(),e.preventDefault()}nextSlide(){this.reachEnd||this.toSlide(this.activeSlideIndex+1)}prevSlide(){this.reachStart||this.toSlide(this.activeSlideIndex-1)}toSlide(e){this._activeSlideIndex=e,this.displayedSlides=this.fillSlides(),this.update()}updateStoriesItem(e){this.storiesItem=e,this.displayedSlides=this.fillSlides(),this.update()}fillSlides(){return this.slidesLoaded?Array.isArray(this.storiesItem.slides_html)?this.storiesItem.slides_html.slice(this._activeSlideIndex,this._activeSlideIndex+2):[]:[""]}setLike(e){this.updateStoryLike(e),yr.emit("publicEvents.likeStory",{id:this.id,index:this.activeSlideIndex,value:1===e})}setDislike(e){this.updateStoryLike(e),yr.emit("publicEvents.dislikeStory",{id:this.id,index:this.activeSlideIndex,value:-1===e})}setBookmark(e){return as(this,void 0,void 0,(function*(){const t=this.storiesItem.favorite;this.storiesItem.favorite=e,this.update();try{const t=yield Or.setBookmark(this.id,e);if(null==t.favorite)return;this.storiesItem.favorite=t.favorite,yr.emit("publicEvents.favoriteStory",{id:this.id,index:this.activeSlideIndex,value:t.favorite})}catch(e){this.storiesItem.favorite=t,console.error(e)}finally{this.update()}}))}share(){return as(this,void 0,void 0,(function*(){yr.emit("publicEvents.shareStory",{id:this.id,index:this.activeSlideIndex}),this.isShareAsScreenshot()?yr.emit("storySlide.performScreenShotShareAction",{shareId:"slide-screenshot-share",hideElementsSelector:""}):Ne()?this.performSessionShareAction():this.performWithoutSessionShareAction()}))}markAsOpened(){Or.markAsOpened(this.id),this.storiesItem.isOpened=!0}setOptions(e){this.storyReaderOptions=e,this.update()}updateStoryLike(e){return as(this,void 0,void 0,(function*(){try{const t=yield Or.updateStoryLike(this.id,e);null!=t.like&&(this.storiesItem.like=t.like)}catch(e){console.error(e)}finally{this.update()}}))}isShareAsScreenshot(){var e,t;const i=null!==(t=null===(e=this.storiesItem)||void 0===e?void 0:e.slides_screenshot_share)&&void 0!==t?t:[],r=this._activeSlideIndex;return Boolean(i[r])}performSessionShareAction(){return as(this,void 0,void 0,(function*(){try{const{url:e}=yield Or.getStorySharePath(this.id);if(!e)return;this.storiesItem.share_url=e,this.emitShareStoryWithPathEvent(e);const t={title:this.storiesItem.title,text:"",url:e};yr.emit("storySlide.performShareAction",{shareId:"story-share",config:t})}catch(e){console.error(e)}}))}performWithoutSessionShareAction(){const e=this.storiesItem.share_url;if(!e)return;this.emitShareStoryWithPathEvent(e);const t={title:this.storiesItem.title,text:"",url:e};yr.emit("storySlide.performShareAction",{shareId:"story-share",config:t})}redirectToSlide({slideIndex:e,layerIndex:t}){e!==this.activeSlideIndex&&this.toSlide(e)}emitShareStoryWithPathEvent(e){yr.emit("publicEvents.shareStoryWithPath",{id:this.id,index:this.activeSlideIndex,url:e})}}var ds=p(5136);class cs{constructor(e){this.window=e}get width(){const e=this.window.document.documentElement.clientWidth;return Math.abs(this.window.innerWidth-e)}setScrollbar(e=this.width){this._disableOverFlow(),this._setElementAttributes("body","paddingRight",(t=>t+e))}_disableOverFlow(){const e=this.window.document.body.style.overflow;e&&(this.window.document.body.dataset.overflow=e),this.window.document.body.style.overflow="hidden"}_setElementAttributes(e,t,i){const r=this.width;this.window.document.querySelectorAll(e).forEach((e=>{if(e!==this.window.document.body&&this.window.innerWidth>e.clientWidth+r)return;const n=e.style[t],s=this.window.getComputedStyle(e)[t];e.dataset[t]=n,e.style[t]=`${i(Number.parseFloat(s))}px`}))}resetScrollbar(){this._resetElementAttributes("body","overflow"),this._resetElementAttributes("body","paddingRight")}_resetElementAttributes(e,t){this.window.document.querySelectorAll(e).forEach((e=>{const i=e.dataset[t];void 0===i?e.style.removeProperty(t):(delete e.dataset[t],e.style[t]=i)}))}}var us=function(e,t,i,r){return new(i||(i=Promise))((function(n,s){function o(e){try{l(r.next(e))}catch(e){s(e)}}function a(e){try{l(r.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,a)}l((r=r.apply(e,t||[])).next())}))};class hs extends hr{constructor(e,t){super(),this.storyReaderStoriesService=e,this.statisticsService=t,this._stories=[],this.displayedStories=[],this._currentIndex=0,this.activeListType=pe.default,this._hasShare=!1,this._placeholders=[],this._appearanceManager=new le,this.scrollbarHelper=new cs(window),this.silentClose=!1,this._sourceInfo={},this.windowReferer=he.default,this.overrideStoryOptions=null,this.handleUpdateOptions=this.handleUpdateOptions.bind(this),this.handleStoryListEvents(),this.setAppearanceManager(new le),this.initSlideApi()}initSlideApi(){this.slideApiHandlers=new Ls(this),this.slideApi=(0,ds.getSlideApi)(this.slideApiHandlers)}handleStoryListEvents(){this.handleClickOnStoryInternal=this.handleClickOnStoryInternal.bind(this),yr.on(`${br.name}.clickOnStoryInternal`,this.handleClickOnStoryInternal)}handleClickOnStoryInternal({appearanceManager:e,payload:t,identityFields:i}){this.showMultipleStories(t,{identityFields:i})}get feedSlug(){var e,t;return null!==(t=null===(e=this.sourceInfo.identityFields)||void 0===e?void 0:e.feedSlug)&&void 0!==t?t:""}get widgetsData(){return ye()(this.narrativeContext.widgetsData)?this.narrativeContext.widgetsData:{}}get sourceInfo(){return this._sourceInfo}get options(){return this._options}get stories(){return this.displayedStories}get activeStory(){return this._activeStory}get currentIndex(){return this._currentIndex+1}get hasShare(){return this._hasShare}get placeholders(){return this._placeholders}get reachStart(){return 1===this.currentIndex}get reachEnd(){return this.currentIndex===this.displayedStories.length-2}get goodsWidgetOptions(){return this._appearanceManager.goodsWidgetOptions}setStories({listType:e,stories:t}){this.activeListType=e,this._stories=t.filter((e=>!e.hide_in_reader)).map((e=>Fe.createInstance($e,e))),this.displayedStories=[Fe.createInstance($e,{blank:!0,id:-1}),...this._stories,Fe.createInstance($e,{blank:!0,id:-2})].map((e=>new ls(e,this.options,this._hasShare))),this.setActiveStoryByIndex(this._currentIndex),this.update()}setNarrativeContext(e){this.narrativeContext=e instanceof os?e:Fe.createInstance(os,e.rawData),this.initStoryResources(this.narrativeContext)}setActiveStoryById(e){this._currentIndex=this._stories.findIndex((t=>t.id===e)),this._activeStory=this.displayedStories[this._currentIndex+1],this.setNarrativeStory(this._activeStory)}setActiveStoryByIndex(e){this._currentIndex=e,this._activeStory=this.displayedStories[this._currentIndex+1],this.setNarrativeStory(this._activeStory)}getDisplayedStoryByIndex(e){return this.displayedStories[e]}setNarrativeStory(e){this.slideApiHandlers.setNarrativeStory(e)}setAppearanceManager(e,t){this.overrideStoryOptions=null!=t?t:{},this._appearanceManager.off(j.EVENT_UPDATED_STORY_READER_OPTIONS,this.handleUpdateOptions),this._appearanceManager.off(j.EVENT_UPDATED_COMMON_OPTIONS,this.handleUpdateOptions),e.on(j.EVENT_UPDATED_STORY_READER_OPTIONS,this.handleUpdateOptions),e.on(j.EVENT_UPDATED_COMMON_OPTIONS,this.handleUpdateOptions),this._appearanceManager=e,this.handleUpdateOptions({storyReaderOptions:e.storyReaderOptions,appearanceCommon:e.commonOptions}),this.update()}getAppearanceManager(){return this._appearanceManager}handleUpdateOptions({storyReaderOptions:e,appearanceCommon:t}){const i=o.getState().lang.toString();this._options=Object.assign(Object.assign(Object.assign({},e),{appearanceCommon:t,faviconApiUrl:A.faviconApiUrl,language:i}),this.overrideStoryOptions);for(const e of this.displayedStories)e.setOptions(this._options);this.update()}open(e,t){this.windowReferer=e.windowReferer,this.setScrollBar(e.windowReferer),this.statisticsService.setSourceInfo(t),this._sourceInfo=t,this.setStories({listType:e.listType,stories:e.storyList}),this.setNarrativeContext({rawData:e.storyContext}),this.setActiveStoryById(e.id),this._hasShare=e.hasShare,this._placeholders=e.placeholders,this.activeListType=e.listType,this.statisticsService.init(),this.update()}setScrollBar(e){e===he.default&&this.scrollbarHelper.setScrollbar()}resetScrollBar(e){e===he.default&&this.scrollbarHelper.resetScrollbar()}initStoryResources(e){(new Ds).init(e)}setStoriesAndContext(e){this.setStories({listType:e.listType,stories:e.storyList}),this.setNarrativeContext({rawData:e.storyContext})}close(e="closeReaderByCloseBtn"){var t;if(!this.activeStory||(null===(t=this.activeStory)||void 0===t?void 0:t.disableClose))return;this.resetScrollBar(this.windowReferer);const i=this.activeStory.id,r=this.activeStory.activeSlideIndex;this.emit("closeStoryReader"),yr.emit("statistics.closeStoryReader",{storyId:i,slideIndex:r}),yr.emit("publicEvents.closeStory",{id:i,index:r,action:e}),Wr(),fn(),ts(),this.activeStory.markAsOpened(),this._sourceInfo={},this._activeStory=void 0,this.update()}canBeClosed(){return!(!this.activeStory||this.activeStory.isBlank)&&!this.activeStory.disableClose}showSingleStory(e,t,i){return us(this,void 0,void 0,(function*(){try{const r=(new Date).getTime(),n=yield this.storyReaderStoriesService.fetchSingleStoryWithoutContext(e,t,i),s=((e,t)=>({windowReferer:he.default,listType:pe.default,id:e,storyContext:xt.getState(),storyList:[t],hasShare:m.getState().share,placeholders:St()}))(e,n);this.open(s,{listType:pe.direct,feedSlug:t});const o=yield this.storyReaderStoriesService.fetchSingleStoryContext(e,t);this.sleep(r),this.setStoriesAndContext({listType:pe.direct,storyList:[o],storyContext:xt.getState()})}catch(e){console.error(e)}}))}showSingleStoryFromSharePage(e,t){return us(this,void 0,void 0,(function*(){try{return yield this.showSingleStory(e,"",t),t&&De(!1),!0}catch(e){return!1}}))}showOnboardingStories(e){return us(this,void 0,void 0,(function*(){let t="onboarding";e&&e.feed&&Ee()(e.feed)&&(t=e.feed),yield this.storyReaderStoriesService.fetchSessionAndStoriesCompositeFx({onboardingList:t,customTags:null==e?void 0:e.customTags,limit:null==e?void 0:e.limit});const i=Ot(pe.onboarding,t);return!!i.length&&(yield this.showMultipleStories({windowReferer:he.default,listType:pe.onboarding,id:i[0].id},{identityFields:{feedSlug:t}}),!0)}))}showMultipleStories(e,t){return us(this,void 0,void 0,(function*(){const i=t.identityFields.feedSlug;try{De(!0);const r=(new Date).getTime(),n=Et(i),s=((e,t,i)=>{const r=Ot(e.listType,i);let n=m.getState().share;return t===Xe.UGC&&(n=!1),Object.assign(Object.assign({},e),{storyContext:_t(t,xt.getState()||bt(t,r.map((e=>e.id)))),storyList:r,hasShare:n,placeholders:St()})})(e,n,i);this.open(s,{listType:e.listType,identityFields:t.identityFields}),yield this.storyReaderStoriesService.fetchMultipleStoriesContext(e.id,n,i),yield this.storyReaderStoriesService.fetchStoriesSlides(n,i);const o=this.storyReaderStoriesService.getStoryContextInternalModel(n);yield this.sleep(r),this.setStoriesAndContext({listType:e.listType,storyList:Ot(e.listType,i),storyContext:_t(n,o)})}catch(e){if(e instanceof kr)return;this.close()}}))}sleep(e){return us(this,void 0,void 0,(function*(){return new Promise((t=>{const i=Math.max(0,300-((new Date).getTime()-e));i?setTimeout(t,i):t()}))}))}nextStory(){var e;null===(e=this.activeStory)||void 0===e||e.markAsOpened(),this.setActiveStoryByIndex(this._currentIndex+1),this.update()}prevStory(){var e;null===(e=this.activeStory)||void 0===e||e.markAsOpened(),this.setActiveStoryByIndex(this._currentIndex-1),this.update()}destroy(){this._appearanceManager.off(j.EVENT_UPDATED_STORY_READER_OPTIONS,this.handleUpdateOptions),this._appearanceManager.off(j.EVENT_UPDATED_COMMON_OPTIONS,this.handleUpdateOptions),yr.off(`${br.name}.clickOnStoryInternal`,this.handleClickOnStoryInternal)}closeGoodsWidget(){yr.emit("goodsWidget.close")}}class ps{constructor(e,t){this.storyManager=e,this.statisticsService=t}handle(e){var t;e.dataForSending=this.statisticsService.getDataAndCleanupForBeaconFlush();const i=()=>this.storyManager.clickOnButtonAction({src:wr.STORY_READER,payload:e});!(null===(t=this.storyManager.getConfig())||void 0===t?void 0:t.disableStatistic)&&e.dataForSending&&ye()(e.dataForSending)&&Array.isArray(e.dataForSending.data)&&e.dataForSending.data.length>0?N("session/update",e.dataForSending,i):i()}}class fs{constructor(e){this.storyManager=e}handle(e,t,i){var r,n,s;const o=i.listType,a=null!==(n=null===(r=i.identityFields)||void 0===r?void 0:r.feedSlug)&&void 0!==n?n:"",l=null===(s=i.identityFields)||void 0===s?void 0:s.filter,d=Et(a),c={title:null,tags:[],slidesCount:null,feed:null,filter:null,source:null},u=et.getState().find((e=>e.id===t.id));if(u&&(c.title=u.stat_title,c.tags=u.tags,c.slidesCount=u.slides_count,u.type===Xe.UGC&&(c.ugcPayload=ye()(u.payload)?u.payload:{})),d===Xe.DEFAULT?c.feed=a:d===Xe.UGC&&(c.filter=l),o===pe.direct?c.source=ue.direct:o===pe.default?c.source=ue.list:o===pe.onboarding?c.source=ue.onboarding:o===pe.favorite&&(c.source=ue.favorite),null!=t.index&&-1===["clickOnStory","showStory"].indexOf(e)&&(t.payload=null,u&&u.slides_payload&&Array.isArray(u.slides_payload))){const e=u.slides_payload.find((e=>e.slide_index===t.index));null!=e&&e.payload&&(t.payload=e.payload)}this.storyManager.emit(e,Object.assign(Object.assign({},t),c))}}var gs=function(e,t,i,r){return new(i||(i=Promise))((function(n,s){function o(e){try{l(r.next(e))}catch(e){s(e)}}function a(e){try{l(r.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,a)}l((r=r.apply(e,t||[])).next())}))};class vs{constructor(e){this.storyManager=e}create(){const e=new Or,t=new Ps(this.storyManager);return this.storyReaderViewModel=new hs(e,t),this.storyManager.setViewModel(hs.name,this.storyReaderViewModel),this.handleStoryReaderViewModelEvents(t),this.storyReaderViewModel}handleStoryReaderViewModelEvents(e){this.handleEventBusEvents(),this.handlePublicEvents(e),this.handleGameCenterEvents()}handlePublicEvents(e){yr.on("publicEvents.clickOnButton",(t=>{new ps(this.storyManager,e).handle(t)})),this.subscribeToPublicEvents(),this.subscribeToWidgetEvent()}subscribeToWidgetEvent(){yr.on("publicEvents.widgetEvent",(e=>{const t=Ke.getState()[this.storyReaderViewModel.feedSlug];this.storyManager.emit("widgetEvent",{name:e.name,data:Object.assign(Object.assign({},e.devPayload),{feed_id:t})})}))}subscribeToPublicEvents(){const e=new fs(this.storyManager),t=["showSlide","showStory","closeStory","clickOnButton","likeStory","dislikeStory","favoriteStory","shareStory","shareStoryWithPath"];for(const i of t)yr.on(`publicEvents.${i}`,(t=>{const r=this.storyReaderViewModel.sourceInfo;e.handle(i,t,r)}))}handleEventBusEvents(){yr.on("storyReader.redirectToStory",(({storyId:e,feedSlug:t})=>{this.storyReaderViewModel.showSingleStory(e,t)}))}handleGameCenterEvents(){return gs(this,void 0,void 0,(function*(){yr.on("openGameCenter",(e=>gs(this,[e],void 0,(function*({gameId:e}){yield this.storyManager.openGame(e),zr(),yr.once(`${to.name}.gameComplete`,(()=>{Wr()}))}))))}))}}var ms=function(e,t,i,r){return new(i||(i=Promise))((function(n,s){function o(e){try{l(r.next(e))}catch(e){s(e)}}function a(e){try{l(r.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,a)}l((r=r.apply(e,t||[])).next())}))};class ys extends vn{constructor(e,t){super(),this.slideApi=e,this.layersManager=t,this.type=ys.name}init(e){return ms(this,void 0,void 0,(function*(){this.elements=e.querySelectorAll(".narrative-slide.narrative-multi-slide");try{if(!this.elements.length)return;this.slideApi.WidgetMultiSlide.init(Array.from(this.elements))}catch(e){console.error(e)}}))}destroy(){}}var ws=function(e,t,i,r){return new(i||(i=Promise))((function(n,s){function o(e){try{l(r.next(e))}catch(e){s(e)}}function a(e){try{l(r.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,a)}l((r=r.apply(e,t||[])).next())}))};class Ss extends vn{constructor(e){super(),this.slideApi=e,this.type=Ss.name,this.handleSwipeUpGesture=this.handleSwipeUpGesture.bind(this)}get swipeUpLinkTarget(){return this._swipeUpLinkTarget}get swipeUpElementId(){return this._swipeUpElementId}init(e){return ws(this,void 0,void 0,(function*(){var t,i;this.slideContent=e,this.elements=e.querySelectorAll(".narrative-element-swipe-up"),this.firstElement&&(this._swipeUpLinkTarget=decodeURIComponent(null!==(t=this.firstElement.getAttribute("data-link-target"))&&void 0!==t?t:""),this._swipeUpElementId=null!==(i=this.firstElement.getAttribute("data-element-id"))&&void 0!==i?i:void 0,yr.on("swipeController.swipeUp",this.handleSwipeUpGesture))}))}destroy(){yr.off("swipeController.swipeUp",this.handleSwipeUpGesture)}handleSwipeUpGesture(){if(!this._swipeUpLinkTarget||!this.slideContent||!this._swipeUpElementId)return;const e=this.slideContent.querySelector(`[data-element-id="${this._swipeUpElementId}"]`);e&&yr.emit("slide.openSwipeUpLink",{swipeUpLinkTarget:this._swipeUpLinkTarget,swipeUpElementId:this._swipeUpElementId,target:e})}}var bs=function(e,t,i,r){return new(i||(i=Promise))((function(n,s){function o(e){try{l(r.next(e))}catch(e){s(e)}}function a(e){try{l(r.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,a)}l((r=r.apply(e,t||[])).next())}))};class _s extends vn{constructor(e){super(),this.slideApi=e,this.type=_s.name,this.handleSwipeUpGesture=this.handleSwipeUpGesture.bind(this),this.handleClick=this.handleClick.bind(this)}get swipeUpLinkTarget(){return this._swipeUpLinkTarget}get swipeUpElementId(){return this._swipeUpElementId}init(e){return bs(this,void 0,void 0,(function*(){var t,i;this.slideContent=e,this.elements=e.querySelectorAll(".narrative-element-swipe-up-items"),this.firstElement&&(this._swipeUpLinkTarget=decodeURIComponent(null!==(t=this.firstElement.getAttribute("data-link-target"))&&void 0!==t?t:""),this._swipeUpElementId=null!==(i=this.firstElement.getAttribute("data-element-id"))&&void 0!==i?i:void 0,this.registerEvents())}))}destroy(){this.unregisterEvents()}close(){Kn(),Wr(),this.setGoodsElementOpacity(1)}registerEvents(){var e;yr.on("swipeController.swipeUp",this.handleSwipeUpGesture),yr.on("goods.close",this.handleSwipeUpGesture),null===(e=this.firstElement)||void 0===e||e.addEventListener("click",this.handleClick)}unregisterEvents(){var e;yr.off("swipeController.swipeUp",this.handleSwipeUpGesture),null===(e=this.firstElement)||void 0===e||e.removeEventListener("click",this.handleClick)}handleClick(e){e.preventDefault(),e.stopPropagation(),this.open()}handleSwipeUpGesture(){this.open()}open(){if(!this._swipeUpLinkTarget||!this.slideContent||!this._swipeUpElementId)return;const e=decodeURIComponent(this._swipeUpLinkTarget);zr(),Yn({url:e,elementId:this._swipeUpElementId}),this.setGoodsElementOpacity(0)}setGoodsElementOpacity(e){var t;const i=null===(t=this.slideContent)||void 0===t?void 0:t.querySelector(`[data-element-id="${this._swipeUpElementId}"]`);i&&i.style.setProperty("display",e>0?"block":"none")}}var xs,Cs=function(e,t,i,r){return new(i||(i=Promise))((function(n,s){function o(e){try{l(r.next(e))}catch(e){s(e)}}function a(e){try{l(r.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,a)}l((r=r.apply(e,t||[])).next())}))};!function(e){e.REFRESH_WIDGETS_STATE="REFRESH_WIDGETS_STATE"}(xs||(xs={}));class ks{constructor(e,t){this.slideApi=e,this.layersManager=t,this._widgets=[],this.showLayerByIndex=this.showLayerByIndex.bind(this),this.handleRefreshUserData=this.handleRefreshUserData.bind(this),this._widgets=[new yn(e),new Sn(e),new Cn(e),new On(e),new An(e),new Mn(e),new Tn(e),new Pn(e),new Nn(e),new jn(e),new Un(e),new Gn(e),new _n(e),new ys(e,this.layersManager),new Ss(e),new _s(e)]}get widgets(){return this._widgets}init(e){return Cs(this,void 0,void 0,(function*(){this.layersManager.init(e,this.slideApi.Animation),yr.on("storySlide.showLayer",this.showLayerByIndex),yr.on(xs.REFRESH_WIDGETS_STATE,this.handleRefreshUserData);for(const t of this._widgets)yield t.init(e);this.layersManager.init(e,this.slideApi.Animation)}))}pause(){for(const e of this._widgets)e.pause()}resume(){for(const e of this._widgets)e.resume()}findWidgetByType(e){const t=this._widgets.find((t=>e===t.getType()));if(null==t?void 0:t.firstElement)return t}stop(){for(const e of this._widgets)e.destroy();yr.off("storySlide.showLayer",this.showLayerByIndex),yr.off(xs.REFRESH_WIDGETS_STATE,this.handleRefreshUserData)}destroy(){this.stop(),this._widgets=[]}handleRefreshUserData(){this._widgets.forEach((e=>e.refreshUserData()))}showLayerByIndex({index:e}){this.layersManager.showLayerByIndex(e)}}class Os{constructor(){this.cache={}}set(e,t){this.cache[e]=t}clear(){this.cache={}}get(e){return this.cache[e]}}var Es=function(e,t,i,r){return new(i||(i=Promise))((function(n,s){function o(e){try{l(r.next(e))}catch(e){s(e)}}function a(e){try{l(r.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,a)}l((r=r.apply(e,t||[])).next())}))};class As{constructor(){this.actions=[]}push(e){this.actions.push(e)}exec(){for(const e of this.actions)e()}flush(){this.actions=[]}}class Ls{constructor(e){this.storyReaderViewModel=e,this.deferredActionsQueue=new As,this.slideLoaded=!1,this.activeSlideIndex=-1,this.narrativeStoryCache=new Os,this.handleSlideLoaded=this.handleSlideLoaded.bind(this),this.handleSlideStop=this.handleSlideStop.bind(this),this.handleStoryRepeat=this.handleStoryRepeat.bind(this),yr.on("slide.stop",this.handleSlideStop),yr.on("slide.loaded",this.handleSlideLoaded),yr.on("slideApiHandlers.repeatStory",this.handleStoryRepeat)}getStoryLocalData(){return Es(this,void 0,void 0,(function*(){if(!this.narrativeStory)return{};let e=sessionStorage.getItem("narrative_"+this.narrativeStory.id+"_data");return e?JSON.parse(e):{}}))}setStoryLocalData(e,t){if(!this.narrativeStory)return;let i=JSON.stringify(e);sessionStorage.setItem("narrative_"+this.narrativeStory.id+"_data",i),t&&Ne()&&ns.sentData(this.narrativeStory.id,{data:i},Mt)}getStoryServerData(e){var t,i;return null!==(i=null===(t=this.storyReaderViewModel.widgetsData._narrative_saved_data)||void 0===t?void 0:t[e])&&void 0!==i?i:null}updateStoryServerData(e,t){this.storyReaderViewModel.widgetsData._narrative_saved_data=t}getSlideDuration(e,t){var i,r,n;return null!==(n=null===(r=null===(i=this.storyReaderViewModel.widgetsData._narrative_slides_duration)||void 0===i?void 0:i[e])||void 0===r?void 0:r[t])&&void 0!==n?n:null}pauseUI(){Vr()}resumeUI(){Gr()}showStoryTextInput(e,t){yr.emit("storySlide.showInputModal",{id:e,config:t})}setStorySessionValue(e,t){this.narrativeStoryCache.set(e,t)}getStorySessionValue(e){return this.narrativeStoryCache.get(e)}getWidgetsSharedData(e,t){var i,r,n;const s=this.storyReaderViewModel.widgetsData;switch(t){case"rangeSlider":return null===(i=s._narrative_range_slider_data)||void 0===i?void 0:i[e];case"poll":return null===(r=s._narrative_poll_data)||void 0===r?void 0:r[e];case"vote":return null===(n=s._narrative_vote_data)||void 0===n?void 0:n[e]}return null}openUrl(e){this.narrativeStory&&(this.narrativeStory.markAsOpened(),yr.emit("statistics.transitionFromSlide",{storyId:this.narrativeStory.id,slideIndex:this.narrativeStory.activeSlideIndex}),window.open(e,"_parent"))}sendApiRequest(e,t,i,r,n,s){return ns.sendApiRequest({url:e,method:t,params:i,headers:r,data:n,profilingKey:s},Mt)}share(e,t){null==e&&(e="story-share"),yr.emit("storySlide.performShareAction",{shareId:e,config:t})}shareSlideScreenshot(e,t){null==e&&(e="slide-screenshot-share"),yr.emit("storySlide.performScreenShotShareAction",{shareId:e,hideElementsSelector:null!=t?t:""})}showLayer(e){yr.emit("storySlide.showLayer",{index:e})}showStorySlide(e){this.pushToDefferedActionsQueueOrExec((()=>{var t;null===(t=this.narrativeStory)||void 0===t||t.redirectToSlide({slideIndex:e})}))}storyShowNext(){yr.emit(`${hs.name}.showNextStory`)}showNextSlide(e){this.pushToDefferedActionsQueueOrExec((()=>{yr.emit("story.showNextSlideWithDelay",e)}))}sendStatisticEvent(e,t,i){yr.emit("publicEvents.widgetEvent",{name:e,devPayload:i})}destroy(){yr.off("slide.loaded",this.handleSlideLoaded),yr.off("slide.stop",this.handleSlideStop),yr.off("slideApiHandlers.repeatStory",this.handleStoryRepeat)}setNarrativeStory(e){this.narrativeStoryCache.clear(),this.narrativeStory=e,this.slideLoaded=!1}pushToDefferedActionsQueueOrExec(e){this.slideLoaded?e():this.deferredActionsQueue.push(e)}handleSlideLoaded(e){this.slideLoaded=!0,this.activeSlideIndex=e,this.deferredActionsQueue.exec(),this.deferredActionsQueue.flush()}handleSlideStop({slideIndex:e,storyId:t}){var i;this.activeSlideIndex===e&&(null===(i=this.narrativeStory)||void 0===i?void 0:i.id)===t&&(this.slideLoaded=!1)}handleStoryRepeat(e){return Es(this,arguments,void 0,(function*({storyId:e}){var t;let i={},r=yield this.getStoryLocalData();r=Object.assign({},null!==(t=this.getStoryServerData(e))&&void 0!==t?t:{},r);for(let e in r)r.hasOwnProperty(e)&&/^_gm_[A-z0-9-_]+_attempts$/.test(e)&&(i[e]=r[e]);yr.emit(xs.REFRESH_WIDGETS_STATE),this.updateStoryServerData(e,i),this.setStoryLocalData(i,!0),this.showStorySlide(0),this.showLayer(0)}))}}var Ms=function(e,t,i,r){return new(i||(i=Promise))((function(n,s){function o(e){try{l(r.next(e))}catch(e){s(e)}}function a(e){try{l(r.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,a)}l((r=r.apply(e,t||[])).next())}))};class Is{constructor(e){this.statisticsService=e,this.timerId=null}start(){this.schedule(1e4)}stop(){null!=this.timerId&&(clearTimeout(this.timerId),this.timerId=null)}flush(){return Ms(this,void 0,void 0,(function*(){Re(`[${Ps.name}]: flush statistics by timer`);let e={data:[]};const t=this.statisticsService.getData();t.length>0&&(e.data=t),yield this.statisticsService.sendStatisticsData(e),e.data.length>0?this.schedule(1e4):this.schedule(3e4)}))}schedule(e){Re(`[${Ps.name}]: schedule flush statistics on ${e}ms`),this.timerId=setTimeout((()=>this.flush()),e)}}class Ts{calculate(){const e=Date.now(),t=e-this.slideStartedAt;return this.slideStartedAt=e,t}init(){this.slideStartedAt=Date.now()}}var Rs=function(e,t,i,r){return new(i||(i=Promise))((function(n,s){function o(e){try{l(r.next(e))}catch(e){s(e)}}function a(e){try{l(r.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,a)}l((r=r.apply(e,t||[])).next())}))};class Ps extends(V()){constructor(e){super(),this.storyManager=e,this.lastStatSent=!1,this.lastStatLength=0,this.lastIndex=0,this.data=[],this.sourceInfo=null,this.handleCloseStoryReader=this.handleCloseStoryReader.bind(this),this.handleTransitionFromSlide=this.handleTransitionFromSlide.bind(this),this.handleNextSlide=this.handleNextSlide.bind(this),this.flushSheduler=new Is(this),this.slideDurationCalculator=new Ts}init(){this.data=[],this.lastStatSent=!1,this.lastStatLength=0,this.lastIndex=0,this.slideDurationCalculator.init(),this.flushSheduler.start(),this.registerEventListeners()}getData(){return this.data.slice()}setSourceInfo(e){this.sourceInfo=e}getDataAndCleanupForBeaconFlush(){if(!Ne())return null;const e={data:this.getData()};return this.lastStatSent=!0,this.lastStatLength=e.data.length,this.cleanupData(e.data.length),e}sendStatisticsData(e){return Rs(this,void 0,void 0,(function*(){try{if(!this.sourceInfo)throw new Error(`[${Ps.name}]: You need pass source info!`);this.lastStatLength=e.data.length,this.lastStatSent=!1,yield this.sendBeaconUpdate({statisticsUpdateDto:e,listType:Et(this.sourceInfo.feedSlug)}),this.lastStatSent=!0,this.cleanupData(e.data.length)}catch(e){console.error(e)}}))}registerEventListeners(){yr.on("statistics.nextSlide",this.handleNextSlide),yr.on("statistics.transitionFromSlide",this.handleTransitionFromSlide),yr.on("statistics.closeStoryReader",this.handleCloseStoryReader)}unregisterEventListeners(){yr.off("statistics.nextSlide",this.handleNextSlide),yr.off("statistics.transitionFromSlide",this.handleTransitionFromSlide),yr.off("statistics.closeStoryReader",this.handleCloseStoryReader)}handleNextSlide(e){if(!Ne())return;const t=this.slideDurationCalculator.calculate();this.addSlideEvent({action:1,storyId:e.fromStoryId,slideIndex:e.fromSlideIndex,slideDuration:t})}handleTransitionFromSlide(e){if(!Ne())return;const t=this.slideDurationCalculator.calculate();this.addSlideEvent({action:2,storyId:e.storyId,slideIndex:e.slideIndex,slideDuration:t})}handleCloseStoryReader(e){if(this.unregisterEventListeners(),!Ne())return;const t=this.slideDurationCalculator.calculate();this.addSlideEvent({action:1,storyId:e.storyId,slideIndex:e.slideIndex,slideDuration:t}),this.flushSheduler.stop(),this.flushStatisticsOnClose()}addSlideEvent(e){this.data.push([e.action,this.lastIndex,e.storyId,e.slideIndex,e.slideDuration]),this.lastIndex++}flushStatisticsOnClose(){return Rs(this,void 0,void 0,(function*(){const e={data:this.lastStatSent?this.data.slice():this.data.slice(this.lastStatLength)};yield this.sendStatisticsData(e)}))}cleanupData(e){this.data=this.data.slice(e)}sendBeaconUpdate(e){return Rs(this,arguments,void 0,(function*({listType:e,statisticsUpdateDto:t}){var i;if(0===t.data.length)return t;let r=!1,n="";if(e===Xe.UGC||(null===(i=this.storyManager.getConfig())||void 0===i?void 0:i.disableStatistic))r=!0;else try{N("session/update",t,(()=>{})),r=!0}catch(e){n=e.toString()}if(r)return t;throw n}))}}class Ds{init(e){const t="stories-slider-style";let i=document.getElementById(t),r="";null!==e&&(r=e.style);const n=null!==p.nc&&void 0!==p.nc?p.nc:"";null===i?(i=document.createElement("style"),i.type="text/css",i.id=t,i.attributes.setNamedItem(document.createAttribute("scoped")),i.setAttribute("nonce",n),i.styleSheet?i.styleSheet.cssText=r:i.appendChild(document.createTextNode(r)),document.head.appendChild(i)):i.styleSheet?i.styleSheet.cssText=r:(i.textContent="",i.appendChild(document.createTextNode(r)))}}var Ns=function(e,t,i,r){return new(i||(i=Promise))((function(n,s){function o(e){try{l(r.next(e))}catch(e){s(e)}}function a(e){try{l(r.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,a)}l((r=r.apply(e,t||[])).next())}))};class Fs{constructor(e){this.storyManager=e}create(e){const t=new qi(this.storyManager),i=new br(t,e);return this.storyManager.setViewModel(br.name,i),this.handleStoryListViewModelEvents(i,{listType:e.listType,identityFields:e.identityFields,isFavorite:e.isFavorite}),i}handleStoryListViewModelEvents(e,t){e.on("clickOnStoryInternal",(i=>Ns(this,void 0,void 0,(function*(){i.listType=t.isFavorite?pe.favorite:pe.default,i.windowReferer=t.isFavorite?he.favorite:he.default,yr.emit(`${br.name}.clickOnStoryInternal`,{appearanceManager:e.getAppearanceManager(),payload:i,identityFields:t.identityFields})})))).on("clickOnStoryDeepLink",(e=>{Or.markAsOpened(e.id),this.handleClickOnStoryDeepLink(e,{listType:t.listType})})).on("clickOnStoryGame",(({id:e,gameInstanceId:t})=>{Or.markAsOpened(e),this.storyManager.openGame(t)})).on("clickOnStory",(e=>this.handleClickOnStory(e,t.identityFields)))}handleClickOnStoryDeepLink(e,{listType:t}){var i;const r={data:[[1,0,e.id,0,0]]},n=()=>{e.isDeeplink&&e.url&&this.storyManager.clickOnButtonAction({src:wr.STORY_LIST,payload:e})};t===Xe.UGC||(null===(i=this.storyManager.getConfig())||void 0===i?void 0:i.disableStatistic)?n():N("session/update",r,vo.createFunctionWithTimeout(n,1e3))}handleClickOnStory(e,t){if(0===e.id)return void this.storyManager.emit("clickOnFavoriteCell",{feed:t.feedSlug});const i=t.feedSlug,r=t.filter,n=Et(i),s=et.getState().find((t=>t.id===e.id)),o={title:null,tags:[],slidesCount:null,feed:null,filter:null,source:null};s&&(o.title=s.stat_title,o.tags=s.tags,o.slidesCount=s.slides_count),n===Xe.DEFAULT?o.feed=i:n===Xe.UGC&&(o.filter=r),o.source=ue.list,this.storyManager.emit("clickOnStory",Object.assign(Object.assign({},e),o))}}const js=.53167701863;class Bs{constructor(e,t,i,r,n){this._vw=e,this._vh=t,this.actionPanelHeight=i,this.needBottomPanel=r,this.desktopMode=n,this.viewportRatio=1,this.slideRatio=.64516129032,this.viewportRatio=e/t}get shouldBeShownMobileFrame(){return this.viewportRatio<js}get vw(){return this._vw}get vh(){return this._vh}get shouldBeShownSafeAreaInsets(){return this.viewportRatio<js}getOffset(){const e=this.calculateStoryViewportHeight(!0),t=this.calculateHeight(!0),i=this._vw,r=this.calculateWidth(!0);let n="";return n=this.desktopMode?this.viewportRatio>this.slideRatio?Math.ceil(t-e)/2*-1+"px auto":`0 ${Math.ceil(r-i)/2*-1}px`:t>e?Math.ceil(t-e)/2*-1+"px auto":`0 ${Math.ceil(r-i)/2*-1}px`,n}getOffsetX(){const e=this.calculateWidth(!0),t=this.calculateStoryViewportHeight(!0),i=this.calculateHeight(!0);if(this.desktopMode)return this.viewportRatio>this.slideRatio?"0px":Math.ceil(e-this._vw)/2+"px";{const r=this._vw;return i>t?"0px":Math.ceil(e-r)/2+"px"}}getHeight(e=!1){return this.viewportRatio>this.slideRatio?`${this.calculateHeight(e)}px`:"100%"}getOffsetY(){const e=this.calculateStoryViewportHeight(!0);if(this.desktopMode)return this.viewportRatio>this.slideRatio?`${Math.ceil(this.calculateHeight()-e)}px`:"0px";{const t=this.calculateHeight();return t>e?Math.ceil(t-e)/2+"px":"0px"}}getWidth(e=!1){return this.viewportRatio>this.slideRatio?`${this.calculateWidth(e)}px`:"auto"}getFontSize(){return this.calculateWidth()/20+"px"}getViewportCorrectionPadding(){if(this.desktopMode)return{};const{paddingTop:e,paddingBottom:t}=this.calcFrameWidthByMobileAspectRatio();return{paddingTop:e+"px",paddingBottom:t+"px"}}calculateWidth(e=!1){return this.desktopMode?Math.ceil(this.calculateStoryViewportHeight(e)*this.slideRatio):this.viewportRatio>this.slideRatio?this._vw:Math.ceil(this.calculateStoryViewportHeight(e)*this.slideRatio)}calculateHeight(e=!1){return this.desktopMode?Math.ceil(this.calculateWidth(e)/this.slideRatio):Math.ceil(this._vw/this.slideRatio)}calculateStoryViewportHeight(e=!1){let t=this._vh;const i=this.needBottomPanel?this.actionPanelHeight:0;t-=e?i:0;const{paddingTop:r,paddingBottom:n}=this.calcFrameWidthByMobileAspectRatio();return this.desktopMode?t-=100:t-=r+n,t}calcFrameWidthByMobileAspectRatio(){if(this.desktopMode)return{paddingTop:0,paddingBottom:0};const e=this._vh-this._vw/js,t=Math.max(Math.min(e-this.actionPanelHeight,this.actionPanelHeight),0);return{paddingTop:Math.max(e-t,0),paddingBottom:t}}}var Us=function(e,t,i,r){return new(i||(i=Promise))((function(n,s){function o(e){try{l(r.next(e))}catch(e){s(e)}}function a(e){try{l(r.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,a)}l((r=r.apply(e,t||[])).next())}))};class Vs{static getUgcEditorConfig(){return Us(this,void 0,void 0,(function*(){var e,t;let i=m.getState();(null===(e=null==i?void 0:i.session)||void 0===e?void 0:e.id)||(yield y({})),(null==i?void 0:i.editor)||(yield qt({}));const r=o.getState(),n=m.getState(),s="0.4.1-rc.0";return{sessionId:n.session.id,apiKey:r.apiKey,editor:null!==(t=n.editor)&&void 0!==t?t:{},sdkVersion:s,appPackageId:r.appPackageId,deviceId:g.getState(),userId:null!=r.userId?String(r.userId):void 0,lang:r.lang.toString()}}))}}var Gs=function(e,t,i,r){return new(i||(i=Promise))((function(n,s){function o(e){try{l(r.next(e))}catch(e){s(e)}}function a(e){try{l(r.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,a)}l((r=r.apply(e,t||[])).next())}))};class zs extends U.EventEmitter{constructor(e,t,i,r){super(),this.storyManager=e,this.storyReaderViewModel=t,this.storyId=i,this.options=r,this.showSharePage=()=>Gs(this,void 0,void 0,(function*(){var e;this.handleStartLoad();const t=null===(e=this.storyManager.getConfig())||void 0===e?void 0:e.disableStatistic,i=yield this.storyReaderViewModel.showSingleStoryFromSharePage(this.storyId,t);this.handleEndLoad(i)})),this.handleCloseStoryReader=this.handleCloseStoryReader.bind(this),this.showSharePage(),this.storyReaderViewModel.once("closeStoryReader",this.handleCloseStoryReader)}closeStoryReader(){return Gs(this,void 0,void 0,(function*(){this.storyManager.closeStoryReader()}))}handleStartLoad(){setTimeout((()=>{var e;this.emit(fr.START_LOADING),ke()(null===(e=this.options)||void 0===e?void 0:e.handleStartLoad)&&this.options.handleStartLoad()}))}handleEndLoad(e){var t;this.emit(fr.END_LOADING,{result:e}),ke()(null===(t=this.options)||void 0===t?void 0:t.handleStopLoad)&&this.options.handleStopLoad(e)}handleCloseStoryReader(){var e,t,i;if(ke()(null===(e=this.options)||void 0===e?void 0:e.handleStoryReaderClose)||this.listenerCount(fr.CLOSE_STORY_READER)>0)try{ke()(null===(t=this.options)||void 0===t?void 0:t.handleStoryReaderClose)&&(null===(i=this.options)||void 0===i||i.handleStoryReaderClose()),this.emit(fr.CLOSE_STORY_READER)}catch(e){console.error(e)}else{const e=window.location;window.open(`${e.protocol}//${e.host}`,"_parent")}}}var Ws=function(e,t,i,r){return new(i||(i=Promise))((function(n,s){function o(e){try{l(r.next(e))}catch(e){s(e)}}function a(e){try{l(r.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,a)}l((r=r.apply(e,t||[])).next())}))};class $s{constructor(e){this.storyManager=e}get sdkVersionName(){return this.storyManager.sdkVersionName}get sdkVersionCode(){return this.storyManager.sdkVersionCode}set storyLinkClickHandler(e){this.storyManager.storyLinkClickHandler=e}getConfig(){return this.storyManager.getConfig()}showOnboardingStories(e){return Ws(this,void 0,void 0,(function*(){return this.storyManager.showOnboardingStories(e)}))}showStory(e){return Ws(this,void 0,void 0,(function*(){return this.storyManager.showStory(e)}))}closeAllReaders(){this.storyManager.closeAllReaders()}openGame(e){return Ws(this,arguments,void 0,(function*(e,t={}){return this.storyManager.openGame(e,t)}))}closeGame(){return Ws(this,void 0,void 0,(function*(){return this.storyManager.closeGame()}))}closeStoryReader(){return Ws(this,void 0,void 0,(function*(){return this.storyManager.closeStoryReader()}))}getUgcEditorConfig(){return this.storyManager.getUgcEditorConfig()}getNonce(){return this.storyManager.getNonce()}showSharePage(e,t){return this.storyManager.showSharePage(e,t)}closeGoodsWidget(){this.storyManager.closeGoodsWidget()}on(e,t){return this.storyManager.on(e,t),this}once(e,t){return this.storyManager.once(e,t),this}off(e,t){return this.storyManager.off(e,t),this}}var qs=function(e,t,i,r){return new(i||(i=Promise))((function(n,s){function o(e){try{l(r.next(e))}catch(e){s(e)}}function a(e){try{l(r.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,a)}l((r=r.apply(e,t||[])).next())}))};const Hs="{{__ugc__}}";class Zs extends U.EventEmitter{constructor(){return super(),this.viewModelStore=new pr,this.config=null,this.callbacks={},this.clickOnButtonAction=({src:e,payload:t})=>{if(ke()(this.callbacks.storyLinkClickHandler)||this.listenerCount(ge.CLICK_ON_STORY)>0){const i={src:e,srcRef:"default",data:t};try{ke()(this.callbacks.storyLinkClickHandler)&&this.callbacks.storyLinkClickHandler(i),this.emit(ge.CLICK_ON_STORY,i)}catch(e){console.error(e)}}else window.open(t.url,"_self")},this.isSingletonInstanceExists()||(Zs.instance=this),Zs.instance}static get combinedPlaceholders(){return St()}get sdkVersionName(){return"0.4.1-rc.0"}get sdkVersionCode(){return parseInt(401)}set storyLinkClickHandler(e){ke()(e)&&(this.callbacks.storyLinkClickHandler=e)}get storyReaderViewModel(){return this.viewModelStore.getOneByName(hs.name)}get gameReaderViewModel(){return this.viewModelStore.getOneByName(to.name)}static getInstance(){return Zs.instance?Zs.instance:null}setViewModel(e,t){this.viewModelStore.set(e,t)}getConfig(){return this.config}setConfig(e){this.setNonce(e.nonce),this.validateConfig(e),this.initializeConfig(e)}destroy(){if(null!=Zs.instance){Zs.instance=null,this.closeAllReaders();for(const e of this.viewModelStore.getAll())e.destroy()}}setTags(e){this.config&&(T.getInstance().checkTagsLength(e),l({tags:e}),this.config.tags=e)}setUserId(e){return qs(this,void 0,void 0,(function*(){(Ee()(e)||Le()(e))&&this.config&&(this.config.userId=e,T.getInstance().checkUserIdLength(e),d({userId:e}),S(),yield this.closeAllReaders(),yield this.reloadAllStoryLists())}))}setLang(e){Ee()(e)&&this.config&&(h({lang:e}),this.config.lang=e)}setApiKey(e){this.config&&(M(e),a({apiKey:e}),S(),this.config.apiKey=e)}setPlaceholders(e){ye()(e)&&this.config&&(c({placeholders:e}),_e(e),this.config.placeholders=e)}setImagePlaceholders(e){ye()(e)&&this.config&&(u({imagePlaceholders:e}),Ie(e),this.config.imagePlaceholders=e)}showOnboardingStories(e){return qs(this,void 0,void 0,(function*(){return this.storyReaderViewModel.showOnboardingStories(e)}))}showStory(e){return qs(this,void 0,void 0,(function*(){const t=this.storyReaderViewModel;return yield t.showSingleStory(e,"")}))}closeAllReaders(){this.storyReaderViewModel.close(),this.gameReaderViewModel.closeGame()}closeGoodsWidget(){this.storyReaderViewModel.closeGoodsWidget()}openGame(e){return qs(this,arguments,void 0,(function*(e,t={}){const i=this.gameReaderViewModel;try{if(i.isOpened)throw new Error(`Close the launched game with ID "${i.gameInstanceId}"`);yield i.openGame(e,t)}catch(e){console.error(e)}}))}closeGame(){return qs(this,void 0,void 0,(function*(){return this.gameReaderViewModel.closeGame()}))}closeStoryReader(){return qs(this,void 0,void 0,(function*(){this.storyReaderViewModel.close()}))}getUgcEditorConfig(){return qs(this,void 0,void 0,(function*(){return Vs.getUgcEditorConfig()}))}getNonce(){var e;return null===(e=this.config)||void 0===e?void 0:e.nonce}showSharePage(e,t){return new zs(this,this.storyReaderViewModel,e,t)}reloadAllStoryLists(){const e=this.viewModelStore.getAllByName(br.name);return Promise.all(e.map((e=>e.reload())))}isSingletonInstanceExists(){return!!Zs.instance&&(console.warn("StoryManager singleton is created multiple times\nuse IAS.StoryManager.getInstance() instead"),!0)}setNonce(e){if(this.config)if(e)this.config.nonce=e;else{const e=document.querySelector("[nonce]");this.config.nonce=(null==e?void 0:e.nonce)||(null==e?void 0:e.getAttribute("nonce"))||void 0}}validateConfig(e){if(e.disableDeviceId&&!e.userId)throw new Error("You must pass the `userId` value");T.getInstance().checkUserIdLength(e.userId),T.getInstance().checkTagsLength(e.tags)}initializeConfig(e){M(e.apiKey),a(e),e.placeholders&&_e(e.placeholders),e.imagePlaceholders&&Ie(e.imagePlaceholders),S(),e.disableStatistic="com.inappstory.webpreview"===e.appPackageId,this.config=e}}const Qs=new Zs,Xs=new $s(Qs);var Ys=function(e,t,i,r){return new(i||(i=Promise))((function(n,s){function o(e){try{l(r.next(e))}catch(e){s(e)}}function a(e){try{l(r.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,a)}l((r=r.apply(e,t||[])).next())}))};const Ks=(0,e.createEffect)((e=>Ys(void 0,[e],void 0,(function*({gameInstanceId:e,gameOptions:t}){var i,r;(null===(r=null===(i=m.getState())||void 0===i?void 0:i.session)||void 0===r?void 0:r.id)||(yield y({}));const n={};t&&ye()(t)&&null!=t.demoMode&&(n.demoMode=Boolean(t.demoMode));const s=yield F.post(`game/${e}/launch?expand=config`,n);if(!s.ok)throw new Error(JSON.stringify(s.data));return s.data.clientConfig=Js(),s.data})))),Js=()=>{let e=m.getState();const t=o.getState();return{sessionId:e.session.id,userKey:e.user_key,apiKey:t.apiKey,sdkVersion:"0.4.1-rc.0",apiBaseUrl:A.apiUrl,userAgent:P,appPackageId:t.appPackageId,deviceId:g.getState(),userId:t.userId?t.userId:"",lang:t.lang.toString(),placeholders:Zs.combinedPlaceholders}};var eo=function(e,t,i,r){return new(i||(i=Promise))((function(n,s){function o(e){try{l(r.next(e))}catch(e){s(e)}}function a(e){try{l(r.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,a)}l((r=r.apply(e,t||[])).next())}))};class to extends hr{constructor(e){super(),this.appearanceManager=e,this._isOpened=!1,this._isGameInited=!1,this._isGameLoading=!1,this._gameLaunch=null,this._gameLaunchError=null,this._closeBtnVisible=!1,this.initGameRetryAttempts=0,this.gameCenterMessageService=null,this.safeAreaInsets={top:0,bottom:0,left:0,right:0},this.openGameOptions={},this.desktopMode=!0,this._options=e.gameReaderOptions,this.setAppearanceManager(e),this.handleUpdateGameReaderOptions=this.handleUpdateGameReaderOptions.bind(this),this.handleVisibilityChange=this.handleVisibilityChange.bind(this)}destroy(){var e;this.appearanceManager.off(j.EVENT_UPDATED_GAME_READER_OPTIONS,this.handleUpdateGameReaderOptions),null===(e=this.gameCenterMessageService)||void 0===e||e.destroy(),document.removeEventListener("visibilitychange",this.handleVisibilityChange)}get closeBtnVisible(){return this._closeBtnVisible}get isGameLoading(){return this._isGameLoading}get isGameInited(){return this._isGameInited}get gameLaunchError(){return this._gameLaunchError}get gameLaunch(){return this._gameLaunch}get gameInstanceId(){return this._gameInstanceId}get isOpened(){return this._isOpened}get options(){return this._options}get sharePanelOptions(){return this.appearanceManager.storyReaderOptions.sharePanel}get backdrop(){var e;const t=this._options.backdrop;return{background:null==t?void 0:t.background,opacity:null!==(e=null==t?void 0:t.opacity)&&void 0!==e?e:0,filter:(null==t?void 0:t.blur)?`blur(${t.blur}px)`:"none"}}openGame(e,t){return eo(this,void 0,void 0,(function*(){this._gameInstanceId=e,this._isOpened=!0,this.openGameOptions=t,yield this.launchGameById(e)}))}closeGame(){return eo(this,void 0,void 0,(function*(){var e;return!!this._isOpened&&(this._isGameInited?null===(e=this.gameCenterMessageService)||void 0===e||e.sendMessage("cb",{cb:"closeGameReader"}):this.handleGameComplete(),!0)}))}reload(){this._gameLaunch=null,this.gameInstanceId?this.launchGameById(this.gameInstanceId):console.error("The game instance ID is undefined")}sendGameCenterEventByApiRequest(e,t){var i;null===(i=this.gameCenterMessageService)||void 0===i||i.sendMessage("cb",{cb:e,plainData:t})}setSafeAreaInsets(e){this.safeAreaInsets=e}setDesktopMode(e){this.desktopMode=e}setAppearanceManager(e){this.appearanceManager.off(j.EVENT_UPDATED_GAME_READER_OPTIONS,this.handleUpdateGameReaderOptions),this._options=e.gameReaderOptions,this.appearanceManager=e,this.handleAppearanceManagerEvents(),this.emit("update")}setGameCenterIframe(e){var t;if(!this._gameLaunch)throw new Error("GameCenter iframe setup error");if(this._isGameInited)return;null===(t=this.gameCenterMessageService)||void 0===t||t.destroy();const i=new URL(this._gameLaunch.url).origin;this.gameCenterMessageService=new de(e,i),this.initGameCenter(this.gameCenterMessageService,this._gameLaunch)}pauseGameUI(){var e;null===(e=this.gameCenterMessageService)||void 0===e||e.sendMessage("cb",{cb:"pauseUI",arguments:JSON.stringify([])})}resumeGameUI(){var e;null===(e=this.gameCenterMessageService)||void 0===e||e.sendMessage("cb",{cb:"resumeUI",arguments:JSON.stringify([])})}confirmSharingComplete({shareId:e,isSuccess:t}){var i;null===(i=this.gameCenterMessageService)||void 0===i||i.sendMessage("shareComplete",{id:e,isSuccess:t})}launchGameById(e){return eo(this,void 0,void 0,(function*(){try{this._gameLaunchError=null,this._isGameLoading=!0,this.emit("update"),this._gameLaunch=yield Ks({gameInstanceId:e,gameOptions:this.openGameOptions})}catch(e){this._gameLaunchError=e}finally{this.emit("update")}}))}initGameCenter(e,t){this.handleGameCenterEvents(e);const i=this.getGameConfig(t);e.sendMessage("cb",{cb:"initGame",arguments:JSON.stringify([i])})}getGameConfig(e){const t=e.screenOptions;let i;const r=document.querySelector("[nonce]");null!=r&&(i=r.nonce||r.getAttribute("nonce"));return se()(e.config,{clientConfig:Object.assign({fullScreen:!1,screenOrientation:t.orientation,safeAreaInsets:this.safeAreaInsets,nonce:i},e.clientConfig)})}handleGameCenterEvents(e){e.on("gameLoaded",this.handleGameLoaded.bind(this)).on("gameComplete",this.handleGameComplete.bind(this)).on("sendApiRequest",this.handleSendApiRequest.bind(this)).on("openUrl",this.handleOpenUrl.bind(this)).on("event",this.handleGameEvent.bind(this)).on("reloadGameReader",this.handleReloadGameReader.bind(this)).on("gameLoadFailed",this.handleGameLoadFailed.bind(this));const t={share:new on(e,this,this.desktopMode),storySetLocalData:new dn(e,this),storyGetLocalData:new ln(e,this),gameInstanceGetLocalData:new en(e,this),gameInstanceSetLocalData:new tn(e,this)};for(const[i,r]of Object.entries(t))e.on(i,((...e)=>r.handle(...e)))}handleGameLoaded(e){this._isGameInited=!0,this._isGameLoading=!1,this.emit(ce.StartGame),document.addEventListener("visibilitychange",this.handleVisibilityChange);const t=JSON.parse(e);ye()(t)&&(this._closeBtnVisible=Boolean(t.showClose),this.emit("update"))}handleAppearanceManagerEvents(){this.appearanceManager.on(j.EVENT_UPDATED_GAME_READER_OPTIONS,this.handleUpdateGameReaderOptions)}handleUpdateGameReaderOptions(e){this._options=e,this.emit("update")}handleVisibilityChange(){"hidden"===document.visibilityState?this.pauseGameUI():"visible"===document.visibilityState&&this.resumeGameUI()}handleGameComplete(e){var t;this._isGameInited=!1,this._isOpened=!1,this._gameLaunch=null,null===(t=this.gameCenterMessageService)||void 0===t||t.destroy(),this.emit(ce.GameComplete,e),this.emit("update"),yr.emit(`${to.name}.gameComplete`)}handleSendApiRequest(e){this.emit(ce.SendApiRequest,e)}handleOpenUrl(e){const{url:t}=JSON.parse(e);this.emit(ce.OpenUrl,{url:t})}handleGameEvent(e,t){this.emit(ce.GameInstanceEvent,{name:e,payload:t})}handleReloadGameReader(){const e=this._gameLaunch;this._gameLaunch=null,this.emit("update"),setTimeout((()=>{this._gameLaunch=e,this.emit("update")}))}handleGameLoadFailed(e,t){this.gameLaunch&&t&&this.initGameRetryAttempts<this.gameLaunch.canTryReloadCount?(this.initGameRetryAttempts++,this.handleReloadGameReader()):this._gameLaunchError=new Error(e)}}var io=function(e,t,i,r){return new(i||(i=Promise))((function(n,s){function o(e){try{l(r.next(e))}catch(e){s(e)}}function a(e){try{l(r.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,a)}l((r=r.apply(e,t||[])).next())}))};class ro extends Fe{static save(e,t,i){return io(this,void 0,void 0,(function*(){try{return{data:(yield i("apiRequest",{url:`game/${e}/instance-user-data`,method:"post",params:null,data:t,headers:null})).data,status:200,headers:[{}]}}catch(e){return{data:e,status:400,headers:[{}]}}}))}}var no=function(e,t,i,r){return new(i||(i=Promise))((function(n,s){function o(e){try{l(r.next(e))}catch(e){s(e)}}function a(e){try{l(r.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,a)}l((r=r.apply(e,t||[])).next())}))};class so{constructor(e){this.storyManager=e}create(){const e=new to(new le);return this.storyManager.setViewModel(to.name,e),this.handleGameReaderViewModelEvents(e),e}handleGameReaderViewModelEvents(e){e.on(ce.StartGame,(()=>this.storyManager.emit("startGame",{id:e.gameInstanceId}))).on(ce.GameInstanceEvent,(e=>this.storyManager.emit("gameEvent",e))).on(ce.GameComplete,(t=>{Yt()(t)?this.storyManager.emit("closeGame",{id:e.gameInstanceId}):this.storyManager.emit("finishGame",{id:e.gameInstanceId,result:t})})).on(ce.OpenUrl,(({url:t})=>{this.storyManager.clickOnButtonAction({src:wr.GAME_READER,payload:{url:t,gameInstanceId:e.gameInstanceId}})})).on(ce.SendApiRequest,(t=>no(this,void 0,void 0,(function*(){ns.sendApiRequestPromise(t,((t,i)=>e.sendGameCenterEventByApiRequest(t,i)),Mt)})))).on(ce.StorySetLocalData,(e=>no(this,[e],void 0,(function*({storyId:e,data:t}){ns.sentData(e,t,Mt)})))).on(ce.GameInstanceSetLocalData,(t=>no(this,[t],void 0,(function*({data:t}){ro.save(e.gameInstanceId,t,Mt)}))))}}Object.freeze({enter:13,tab:9,delete:46,esc:27,space:32,up:38,down:40,left:37,right:39,end:35,home:36,del:46,backspace:8,insert:45,pageup:33,pagedown:34});!function(){var e="test";try{return localStorage.setItem(e,e),localStorage.removeItem(e),!0}catch(e){return!1}}();var oo;function ao(e,t,i){var r=this;return function(){var n=Array.prototype.slice.call(arguments);if("change"===(n[0].type?n[0].type:n[0])){n[0].type?n[0]=ho(i,n[0]):n[0]=i;var s,o,a=uo(n[1],r);return"addEventListener"===e&&function(e,t){var i=co.indexOf(e);i>-1?lo[i]=t:(co.push(e),lo.push(t))}(n[1],a),"removeEventListener"===e&&(s=n[1],(o=co.indexOf(s))>-1&&(co.splice(o,1),lo.splice(o,1))),n[1]=a,t[e].apply(t,n)}}}!function(e){e.LANDSCAPE_PRIMARY="landscape-primary",e.LANDSCAPE_SECONDARY="landscape-secondary",e.PORTRAIT_PRIMARY="portrait-primary",e.PORTRAIT_SECONDARY="portrait-secondary"}(oo||(oo={}));var lo=[],co=[];function uo(e,t){var i=co.indexOf(e);return i>-1?lo[i]:function(i){i.target!==t&&go(i,"target",t),i.currentTarget!==t&&go(i,"currentTarget",t),"change"!==i.type&&go(i,"type","change"),e(i)}}function ho(e,t){var i;try{i=new Event(e,t)}catch(e){i={type:"change"}}return i}function po(e){var t=Object.create({addEventListener:function(e,t){this.listeners[e]||(this.listeners[e]=[]),-1===this.listeners[e].indexOf(t)&&this.listeners[e].push(t)},dispatchEvent:function(t){this.listeners[t.type]&&(this.listeners[t.type].forEach((function(e){e(t)})),"function"==typeof e.onchange&&e.onchange(t))},removeEventListener:function(e,t){if(this.listeners[e]){var i=this.listeners[e].indexOf(t);i>-1&&this.listeners[e].splice(i,1)}}});t.listeners={};var i=fo();return i&&"boolean"==typeof i.matches&&i.addListener((function(){t.dispatchEvent(ho("change"))})),t}function fo(){return"function"!=typeof window.matchMedia?{}:window.matchMedia("(orientation: landscape)")}function go(e,t,i){Object.defineProperty(e,t,{value:i})}class vo{static createFunctionWithTimeout(e,t){let i=!1;function r(){i||(i=!0,e())}return setTimeout(r,t||1e3),r}static convertModelToFormData(e,t,i){t instanceof Object&&Object.keys(t).forEach((r=>{const n=t[r];if(n instanceof Object&&!Array.isArray(n))return this.convertModelToFormData(e,n,r);i&&(r=`${i}[${r}]`),Array.isArray(n)?n.forEach((t=>{e.append(`${r}[]`,t)})):e.append(r,n)}))}}var mo=p(1085),yo=p(9155),wo=p.n(yo),So=p(8384),bo=p.n(So);var _o=function(e,t,i){var r=e.key+"-"+t.name;!1===i&&void 0===e.registered[r]&&(e.registered[r]=t.styles)};var xo={animationIterationCount:1,aspectRatio:1,borderImageOutset:1,borderImageSlice:1,borderImageWidth:1,boxFlex:1,boxFlexGroup:1,boxOrdinalGroup:1,columnCount:1,columns:1,flex:1,flexGrow:1,flexPositive:1,flexShrink:1,flexNegative:1,flexOrder:1,gridRow:1,gridRowEnd:1,gridRowSpan:1,gridRowStart:1,gridColumn:1,gridColumnEnd:1,gridColumnSpan:1,gridColumnStart:1,msGridRow:1,msGridRowSpan:1,msGridColumn:1,msGridColumnSpan:1,fontWeight:1,lineHeight:1,opacity:1,order:1,orphans:1,tabSize:1,widows:1,zIndex:1,zoom:1,WebkitLineClamp:1,fillOpacity:1,floodOpacity:1,stopOpacity:1,strokeDasharray:1,strokeDashoffset:1,strokeMiterlimit:1,strokeOpacity:1,strokeWidth:1};function Co(e){var t=Object.create(null);return function(i){return void 0===t[i]&&(t[i]=e(i)),t[i]}}var ko=/[A-Z]|^ms/g,Oo=/_EMO_([^_]+?)_([^]*?)_EMO_/g,Eo=function(e){return 45===e.charCodeAt(1)},Ao=function(e){return null!=e&&"boolean"!=typeof e},Lo=Co((function(e){return Eo(e)?e:e.replace(ko,"-$&").toLowerCase()})),Mo=function(e,t){switch(e){case"animation":case"animationName":if("string"==typeof t)return t.replace(Oo,(function(e,t,i){return To={name:t,styles:i,next:To},t}))}return 1===xo[e]||Eo(e)||"number"!=typeof t||0===t?t:t+"px"};function Io(e,t,i){if(null==i)return"";if(void 0!==i.__emotion_styles)return i;switch(typeof i){case"boolean":return"";case"object":if(1===i.anim)return To={name:i.name,styles:i.styles,next:To},i.name;if(void 0!==i.styles){var r=i.next;if(void 0!==r)for(;void 0!==r;)To={name:r.name,styles:r.styles,next:To},r=r.next;return i.styles+";"}return function(e,t,i){var r="";if(Array.isArray(i))for(var n=0;n<i.length;n++)r+=Io(e,t,i[n])+";";else for(var s in i){var o=i[s];if("object"!=typeof o)null!=t&&void 0!==t[o]?r+=s+"{"+t[o]+"}":Ao(o)&&(r+=Lo(s)+":"+Mo(s,o)+";");else if(!Array.isArray(o)||"string"!=typeof o[0]||null!=t&&void 0!==t[o[0]]){var a=Io(e,t,o);switch(s){case"animation":case"animationName":r+=Lo(s)+":"+a+";";break;default:r+=s+"{"+a+"}"}}else for(var l=0;l<o.length;l++)Ao(o[l])&&(r+=Lo(s)+":"+Mo(s,o[l])+";")}return r}(e,t,i);case"function":if(void 0!==e){var n=To,s=i(e);return To=n,Io(e,t,s)}}if(null==t)return i;var o=t[i];return void 0!==o?o:i}var To,Ro=/label:\s*([^\s;\n{]+)\s*(;|$)/g;var Po=!!yo.useInsertionEffect&&yo.useInsertionEffect,Do=Po||function(e){return e()},No=(Po||yo.useLayoutEffect,{}.hasOwnProperty),Fo=yo.createContext("undefined"!=typeof HTMLElement?bo()({key:"css"}):null);Fo.Provider;var jo=function(e){return(0,yo.forwardRef)((function(t,i){var r=(0,yo.useContext)(Fo);return e(t,r,i)}))};var Bo=yo.createContext({});var Uo="__EMOTION_TYPE_PLEASE_DO_NOT_USE__",Vo=function(e,t){var i={};for(var r in t)No.call(t,r)&&(i[r]=t[r]);return i[Uo]=e,i},Go=function(e){var t=e.cache,i=e.serialized,r=e.isStringTag;return _o(t,i,r),Do((function(){return function(e,t,i){_o(e,t,i);var r=e.key+"-"+t.name;if(void 0===e.inserted[t.name]){var n=t;do{e.insert(t===n?"."+r:"",n,e.sheet,!0),n=n.next}while(void 0!==n)}}(t,i,r)})),null},zo=jo((function(e,t,i){var r=e.css;"string"==typeof r&&void 0!==t.registered[r]&&(r=t.registered[r]);var n=e[Uo],s=[r],o="";"string"==typeof e.className?o=function(e,t,i){var r="";return i.split(" ").forEach((function(i){void 0!==e[i]?t.push(e[i]+";"):r+=i+" "})),r}(t.registered,s,e.className):null!=e.className&&(o=e.className+" ");var a=function(e,t,i){if(1===e.length&&"object"==typeof e[0]&&null!==e[0]&&void 0!==e[0].styles)return e[0];var r=!0,n="";To=void 0;var s=e[0];null==s||void 0===s.raw?(r=!1,n+=Io(i,t,s)):n+=s[0];for(var o=1;o<e.length;o++)n+=Io(i,t,e[o]),r&&(n+=s[o]);Ro.lastIndex=0;for(var a,l="";null!==(a=Ro.exec(n));)l+="-"+a[1];var d=function(e){for(var t,i=0,r=0,n=e.length;n>=4;++r,n-=4)t=1540483477*(65535&(t=255&e.charCodeAt(r)|(255&e.charCodeAt(++r))<<8|(255&e.charCodeAt(++r))<<16|(255&e.charCodeAt(++r))<<24))+(59797*(t>>>16)<<16),i=1540483477*(65535&(t^=t>>>24))+(59797*(t>>>16)<<16)^1540483477*(65535&i)+(59797*(i>>>16)<<16);switch(n){case 3:i^=(255&e.charCodeAt(r+2))<<16;case 2:i^=(255&e.charCodeAt(r+1))<<8;case 1:i=1540483477*(65535&(i^=255&e.charCodeAt(r)))+(59797*(i>>>16)<<16)}return(((i=1540483477*(65535&(i^=i>>>13))+(59797*(i>>>16)<<16))^i>>>15)>>>0).toString(36)}(n)+l;return{name:d,styles:n,next:To}}(s,void 0,yo.useContext(Bo));o+=t.key+"-"+a.name;var l={};for(var d in e)No.call(e,d)&&"css"!==d&&d!==Uo&&(l[d]=e[d]);return l.ref=i,l.className=o,yo.createElement(yo.Fragment,null,yo.createElement(Go,{cache:t,serialized:a,isStringTag:"string"==typeof n}),yo.createElement(n,l))}));var Wo=zo,$o=(p(5985),mo.Fragment);function qo(e,t,i){return No.call(t,"css")?mo.jsx(Wo,Vo(e,t),i):mo.jsx(e,t,i)}function Ho(e,t,i){return No.call(t,"css")?mo.jsxs(Wo,Vo(e,t),i):mo.jsxs(e,t,i)}var Zo=p(992),Qo=p.n(Zo),Xo=p(2591),Yo=p.n(Xo),Ko=p(4978),Jo={insert:"head",singleton:!1};Yo()(Ko.A,Jo);const ea=Ko.A.locals||{};var ta=p(1422),ia={insert:"head",singleton:!1};Yo()(ta.A,ia);const ra=ta.A.locals||{},na=({onClick:e,className:t})=>qo("div",{className:Qo()(ra.icon,t),onClick:e,children:qo("svg",{viewBox:"0 0 24 24",children:qo("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"})})});function sa(){var e,t,i,r,n,s,o,a,l,d,c;let u=null;try{u=(null===(e=window.parent)||void 0===e?void 0:e.innerWidth)||window.innerWidth||(null===(r=null===(i=null===(t=window.parent)||void 0===t?void 0:t.document)||void 0===i?void 0:i.documentElement)||void 0===r?void 0:r.clientWidth)||(null===(o=null===(s=null===(n=window.parent)||void 0===n?void 0:n.document)||void 0===s?void 0:s.body)||void 0===o?void 0:o.clientWidth)}catch(e){console.error(e)}return u||(null===(l=null===(a=window.document)||void 0===a?void 0:a.documentElement)||void 0===l?void 0:l.clientWidth)||(null===(c=null===(d=window.document)||void 0===d?void 0:d.body)||void 0===c?void 0:c.clientWidth)}function oa(){var e,t,i,r,n,s;let o=null;try{o=(null===(e=window.parent)||void 0===e?void 0:e.innerHeight)||(null===window||void 0===window?void 0:window.innerHeight)||(null===(r=null===(i=null===(t=window.parent)||void 0===t?void 0:t.document)||void 0===i?void 0:i.documentElement)||void 0===r?void 0:r.clientHeight)}catch(e){console.error(e)}return o||(null===(s=null===(n=null===window||void 0===window?void 0:window.document)||void 0===n?void 0:n.documentElement)||void 0===s?void 0:s.clientHeight)}var aa=p(6644),la={insert:"head",singleton:!1};Yo()(aa.A,la);const da=aa.A.locals||{},ca=310/480,ua=({desktopMode:e,children:t,verticalPadding:i,style:r,className:n})=>{const[s,o]=(0,yo.useState)({width:"0px",height:"0px"});(0,yo.useEffect)((()=>(a(),window.addEventListener("resize",a),()=>{window.removeEventListener("resize",a)})),[]);const a=()=>{const e=sa(),t=f(),i=e/oa(),r=d({aspectRatio:i,vh:t,vw:e}),n=l({aspectRatio:i,vh:t,vw:e});o({width:r,height:n})},l=({aspectRatio:e,vh:t,vw:i})=>{const r=h(e)||p();return e>ca&&!r?`${u({vh:t,vw:i})}px`:"100%"},d=({aspectRatio:e,vh:t,vw:i})=>e>ca&&!h(e)?`${c({aspectRatio:e,vh:t,vw:i})}px`:"auto",c=({aspectRatio:t,vh:i,vw:r})=>t>ca&&!e?r:Math.ceil(i*ca),u=({vh:t,vw:i})=>e?t:Math.ceil(i/ca),h=e=>e>ca&&e-ca<=.1,p=()=>{let e;return"matchMedia"in window&&void 0!==(e=window.matchMedia("(orientation: portrait)"))&&e.matches},f=()=>{let t=oa();return e?(t-=i,t):t};return qo("div",{className:Qo()(da["aspect-ratio-box"],n),style:Object.assign(Object.assign({},r),s),children:qo("div",{className:da["aspect-ratio-box-inside"],children:t})})};var ha=p(3639),pa={insert:"head",singleton:!1};Yo()(ha.A,pa);const fa=ha.A.locals||{},ga=di(),va=e=>{const[t,i]=(0,yo.useState)(!1),r=(0,yo.useCallback)((()=>{if(e.desktopMode)return;const t=ga.type!==e.orientation;e.onOrientationChange({type:ga.type,isWrong:t}),i(t)}),[e.desktopMode,e.orientation]);return(0,yo.useEffect)((()=>(r(),ga.addEventListener("change",r),()=>{ga.removeEventListener("change",r)})),[r]),t?qo("div",{className:fa["screen-orientation-lock"]}):null};var ma=p(5839),ya={insert:"head",singleton:!1};Yo()(ma.A,ya);const wa=ma.A.locals||{};var Sa=p(7231),ba={insert:"head",singleton:!1};Yo()(Sa.A,ba);const _a=Sa.A.locals||{},xa=({shareLink:e,sharePanelOptions:t,onDownloadClick:i})=>{var r,n,s,o;return Ho("div",{className:`${wa["share-panel__body"]} ${_a["share-panel__body_screenshot"]}`,children:[qo("div",{className:`${wa["share-panel-row"]} ${_a["share-panel-row"]}`,children:qo("a",{className:_a["share-panel-row__image-link"],onClick:i,href:e,download:"image.jpeg",children:qo("img",{src:e,className:_a["share-panel-row__image"]})})}),qo("div",{className:wa["share-panel-separator"],style:{background:null===(r=t.divider)||void 0===r?void 0:r.background}}),qo("div",{className:`${wa["share-panel-row"]} ${_a["share-panel-row"]}`,children:qo("a",{className:_a["share-item__download-button"],onClick:i,href:e,download:"image.jpeg",children:qo("div",{dangerouslySetInnerHTML:{__html:null!==(o=null===(s=null===(n=t.downloadButton)||void 0===n?void 0:n.svgSrc)||void 0===s?void 0:s.baseState)&&void 0!==o?o:""}})})})]})};var Ca=p(9749),ka={insert:"head",singleton:!1};Yo()(Ca.A,ka);const Oa=Ca.A.locals||{};var Ea=function(e,t){var i={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(i[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(r=Object.getOwnPropertySymbols(e);n<r.length;n++)t.indexOf(r[n])<0&&Object.prototype.propertyIsEnumerable.call(e,r[n])&&(i[r[n]]=e[r[n]])}return i};const Aa=p(4862),La=e=>{var t,i,r,n,s,o,a,l,d,c,u,{shareLink:h,sharePanelOptions:p,onShareComplete:f}=e,g=Ea(e,["shareLink","sharePanelOptions","onShareComplete"]);const v=()=>{try{return new URL(h).host}catch(e){return console.error(e),null}},m=()=>v()?"":encodeURIComponent(h),y=e=>{var t,i;const r=(()=>{try{return new URL(h)}catch(e){return console.error(e),null}})();if(!r)return"#";const n=null===(t=p.targetParams)||void 0===t?void 0:t[e];return null===(i=null==n?void 0:n.getUrl)||void 0===i?void 0:i.call(n,{url:r.toString(),text:m()})},w=null===(t=p.title)||void 0===t?void 0:t.favicon,S=p.text;return Ho("div",{className:wa["share-panel__body"],children:[Ho("div",{className:`${wa["share-panel-row"]} ${wa["title-row"]}`,children:[v()&&Boolean(null==w?void 0:w.display)&&qo("div",{className:wa["share-url-favicon"],style:{background:null==w?void 0:w.background},children:qo("img",{src:`${null!==(i=g.faviconApiUrl)&&void 0!==i?i:"https://favicon.inappstory.ru"}?sz=64&domain_url=${v()}`})}),qo("span",{className:wa.title,style:S,children:null===(n=null===(r=p.title)||void 0===r?void 0:r.getValue)||void 0===n?void 0:n.call(r,{url:h,text:m()})})]}),qo("div",{className:wa["share-panel-separator"],style:{background:null===(s=p.divider)||void 0===s?void 0:s.background}}),qo("div",{className:`${wa["share-panel-row"]} ${Oa["social-list"]}`,children:null===(o=p.targets)||void 0===o?void 0:o.map(((e,t)=>{var i,r,n;const s=null===(i=p.targetParams)||void 0===i?void 0:i[e],o=null!==(n=null===(r=null==s?void 0:s.icon)||void 0===r?void 0:r.svgSrc.baseState)&&void 0!==n?n:"<svg></svg>";return qo("div",{className:Oa["social-list__item"],children:Ho("a",{href:y(e),onClick:t=>((e,t,i)=>{Qi(window,"focus",f),window.open(e,t,i)})(y(e),"newwindow","width=650,height=570"),target:"_blank",rel:"noopener noreferrer",className:`${wa["share-item"]} ${Oa["share-item"]}`,children:[qo("div",{dangerouslySetInnerHTML:{__html:o}}),qo("span",{className:wa["share-item-title"],style:S,children:null==s?void 0:s.label})]})},t)}))}),qo("div",{className:wa["share-panel-separator"],style:{background:null===(a=p.divider)||void 0===a?void 0:a.background}}),qo("div",{className:wa["share-panel-row"],children:Ho("a",{className:`${wa["share-item"]} ${Oa["share-item"]}`,onClick:()=>{Aa.copy(h),f()},children:[qo("div",{dangerouslySetInnerHTML:{__html:null!==(c=null===(d=null===(l=p.copyButton)||void 0===l?void 0:l.svgSrc)||void 0===d?void 0:d.baseState)&&void 0!==c?c:""}}),qo("span",{className:wa["share-item-title"],style:S,children:null===(u=p.copyButton)||void 0===u?void 0:u.label})]})})]})};var Ma;!function(e){e.Social="social",e.SlideScreenshot="slide-screenshot"}(Ma||(Ma={}));const Ia=({shareType:e,shareLink:t,onShareCompelete:i,sharePanelOptions:r,className:n})=>{const[s,o]=(0,yo.useState)(!1),[a,l]=(0,yo.useState)(!0),d=()=>{o(!0),l(!1)};return Ho("div",{className:Qo()(wa["share-panel-wrapper"],n),onClick:e=>{e.stopPropagation()},onTouchStart:e=>{e.stopPropagation(),e.preventDefault()},children:[qo("div",{className:Qo()(wa["share-panel-backdrop"],{[wa.fadeIn]:a,[wa.fadeOut]:!a}),onClick:()=>{o(!1),l(!1)}}),Ho("div",{className:Qo()(wa["share-panel"],{[wa.slideIn]:a,[wa.slideOut]:!a}),onAnimationEnd:()=>{a||i(s)},style:{"--height":"100%",background:r.background,borderTopLeftRadius:r.borderRadius+"px",borderTopRightRadius:r.borderRadius+"px"},children:[e===Ma.SlideScreenshot&&qo(xa,{shareLink:t,onDownloadClick:d,sharePanelOptions:r}),e===Ma.Social&&qo(La,{shareLink:t,onShareComplete:d,sharePanelOptions:r}),qo("div",{className:wa["share-panel-separator"]})]})]})},Ta=({gameReaderViewModel:e})=>{var t,i,r,n;const{desktopMode:s}=Au(),o=(0,yo.useRef)(null),{sharePanelOpeningParams:a,handleShareComplete:l,closeSharePanel:d}=(e=>{const[t,i]=(0,yo.useState)(null);return(0,yo.useEffect)((()=>(null==e||e.on("openSharePanel",i),()=>{null==e||e.off("openSharePanel",i)})),[e]),{sharePanelOpeningParams:t,handleShareComplete:r=>{t&&e&&(e.confirmSharingComplete({shareId:t.shareId,isSuccess:r}),i(null))},closeSharePanel:()=>{i(null)}}})(e);Tu((()=>{c()}));const c=()=>{e.closeGame(),d()},{backdrop:u,options:h,gameLaunch:p,gameLaunchError:f,isGameLoading:g,closeBtnVisible:v,sharePanelOptions:m}=e,y=Qo()(ea["game-reader"],{[ea["desktop-mode"]]:s,[ea.loading]:!e.gameLaunchError&&e.isGameLoading}),w={background:u.background,opacity:u.opacity,filter:u.filter},S={backgroundColor:null===(t=h.game)||void 0===t?void 0:t.backdropColor,backgroundImage:(null===(i=null==p?void 0:p.splashScreen)||void 0===i?void 0:i.url)?`url(${p.splashScreen.url})`:void 0};return qo("div",{className:ea["game-reader-container"],children:Ho("div",{className:y,children:[qo("div",{className:ea["game-reader__backdrop"],style:w}),Ho(ua,{className:ea["game-box"],desktopMode:s,verticalPadding:100,style:S,children:[f&&qo(na,{className:ea.refresh,onClick:()=>{e.reload()}}),(g||v)&&qo("button",{onClick:c,className:ea["game-reader__close"],style:h.closeButtonPosition===B.LEFT?{left:"10px"}:{right:"10px"},dangerouslySetInnerHTML:{__html:null!==(n=null===(r=h.closeButton)||void 0===r?void 0:r.svgSrc.baseState)&&void 0!==n?n:""}}),p&&Ho($o,{children:[qo("iframe",{src:p.url,onLoad:t=>{o.current=t.target,e.setGameCenterIframe(o.current)},style:{opacity:g?0:1},frameBorder:"0",className:ea["game-iframe"],sandbox:"allow-same-origin allow-top-navigation allow-forms allow-scripts allow-downloads allow-top-navigation-to-custom-protocols",allow:"fullscreen"}),a&&qo(Ia,{shareType:a.shareType,shareLink:a.shareLink,onShareCompelete:l,sharePanelOptions:m})]})]}),p&&h.forceCheckOrientation&&qo(va,{orientation:oo.PORTRAIT_PRIMARY,desktopMode:s,onOrientationChange:({isWrong:t})=>{e.isGameInited&&(t?e.pauseGameUI():e.resumeGameUI())}})]})})};var Ra=p(1239),Pa={insert:"head",singleton:!1};Yo()(Ra.A,Pa);const Da=Ra.A.locals||{};class Na{constructor(e,t,i){this.storyReaderViewModel=e,this.storiesViewer=t,this.backdropRef=i,this.deltaValY=0,this.windowHeight=0,this.swipeUpGestureInAction=!1}get closeGestureInAction(){return Mr.getState()}startMove(){Pr(),this.windowHeight=this.storiesViewer.clientHeight,this.storiesViewer.style.setProperty("transition","")}move(e){e>10||this.closeGestureInAction?(Rr(),this.moveDownAndScaleReader(e)):(e<-10||this.swipeUpGestureInAction)&&this.moveUp(e)}endMove(){Ur(),this.deltaValY>=0?this.handleSwipeDown():this.handleSwipeUp(),Pr()}moveDownAndScaleReader(e){this.deltaValY=e/this.windowHeight;let t=1-(1-.9)*this.deltaValY;t>=1&&(t=1);let i=100*this.deltaValY*.45;i<=0&&(i=0),this.storiesViewer.style.setProperty("transform",`scale(${t}) translateY(${i}%)`)}moveUp(e){this.swipeUpGestureInAction=!0,this.deltaValY=e/this.windowHeight}returnToDefaultState(){this.storiesViewer.style.setProperty("transition","all .3s"),this.storiesViewer.style.setProperty("transform","scale(1) translateY(0%)")}closeStoryReader(){this.storiesViewer.style.setProperty("transition","opacity .3s"),this.storiesViewer.style.setProperty("opacity","0"),this.backdropRef.style.setProperty("transition","opacity .3s"),this.backdropRef.style.setProperty("opacity","0"),setTimeout((()=>{this.storyReaderViewModel.close("swipeDown")}),400)}handleSwipeDown(){this.deltaValY<=.15||!this.storyReaderViewModel.canBeClosed()?this.returnToDefaultState():this.closeStoryReader()}handleSwipeUp(){yr.emit("swipeController.swipeUp")}}const Fa=e=>{const[,t]=(0,yo.useState)(0);(0,yo.useEffect)((()=>{if(!e)return;const i=()=>t((e=>e+1));return e.on("update",i),()=>{e.off("update",i)}}),[e])};!function(){const e=window.requestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||window.msRequestAnimationFrame;window.requestAnimationFrame=e}();const ja=function(){let e,t=document.createElement("div"),i={transition:"transitionend",OTransition:"otransitionend",MozTransition:"transitionend",WebkitTransition:"webkitTransitionEnd"};for(e in i)if(i.hasOwnProperty(e)&&void 0!==t.style[e])return i[e]}();function Ba(e,t,i){return new Promise((r=>{let n=!1;const s=()=>{n=!0,clearTimeout(a),void 0!==ja&&e.removeEventListener(ja,o),e.style.setProperty("transition",`${t} 0ms`),r()},o=e=>{e.propertyName===t&&(n||s())};void 0!==ja&&e.addEventListener(ja,o,!1);const a=setTimeout((()=>{n||s()}),i+20);e.style.setProperty("transition",`${t} ${i}ms`)}))}class Ua extends U.EventEmitter{constructor(){super(...arguments),this.timer=null,this.currentProgress=0,this.progressBeforePause=0,this.timerPaused=!1,this.timeout=0,this.isCompleted=!0}get started(){return!this.isCompleted}setTimer(e){0!==e?(this.timer=setTimeout((()=>this.complete({})),e),this.currentProgress=0,this.cancelAnimationFcn=function(e){let t,i;if("performance"in window==0||"now"in window.performance==0){let e=Date.now();performance.timing&&performance.timing.navigationStart&&(e=performance.timing.navigationStart),i=Date.now()-e}else i=performance.now();return t=requestAnimationFrame((function r(n){let s;if(s=(n-i)/e.duration,s>1&&(s=1),e.forceEnd()&&(s=1),!e.paused()){let i=e.timing(s);e.draw(i),s<1&&(t=requestAnimationFrame(r))}})),()=>{cancelAnimationFrame(t)}}({duration:e,timing:e=>e,draw:e=>this.updateProgress(e),paused:()=>this.timerPaused,forceEnd:()=>!1})):this.forceEnd()}start(e){this.stop(),this.progressBeforePause=0,this.timeout=e,this.isCompleted=!1,this.emit("start"),this.setTimer(e)}stop(){this.isCompleted||(this.clearTimer(),this.timerPaused||(this.emit("stop"),this.isCompleted=!0))}pause(){this.isCompleted||(this.timerPaused=!0,this.stop(),this.progressBeforePause=this.currentProgress,this.emit("pause"))}resume(){if(!this.timerPaused)return;this.timerPaused=!1;const e=1-this.progressBeforePause,t=this.timeout*e;this.setTimer(t),this.emit("resume")}cancelAnimation(){var e;null===(e=this.cancelAnimationFcn)||void 0===e||e.call(this)}forceEnd(){this.complete({forceEnd:!0})}complete({forceEnd:e=!1}){this.isCompleted=!0,this.progressBeforePause=0,this.clearTimer(),this.emit("progress",100),this.emit("complete",{forceEnd:e})}clearTimer(){this.cancelAnimation(),null!==this.timer&&(clearTimeout(this.timer),this.timer=null)}updateProgress(e){const t=1-this.progressBeforePause;this.currentProgress=this.progressBeforePause+e*t;const i=100*this.currentProgress;this.emit("progress",i)}}function Va(e,t){e.forEach(t)}function Ga(e,t,i){if(!e)throw Error(`${i?i+": ":""}${t}`)}function za({node:e=[],from:t,source:i,parent:r=t||i,to:n,target:s,child:o=n||s,scope:a={},meta:l={},family:d={type:"regular"},regional:c}={}){const u=vl(r),h=vl(d.links),p=vl(d.owners),f=[];Va(e,(e=>e&&cl(f,e)));const g={id:pl(),seq:f,next:vl(o),meta:l,scope:a,family:{type:d.type||"crosslink",links:h,owners:p}};return Va(h,(e=>cl(Qa(e),g))),Va(p,(e=>cl(Xa(e),g))),Va(u,(e=>cl(e.next,g))),c&&fl&&gl(Ya(fl),[g]),g}function Wa(e){const t=()=>e();return t.unsubscribe=()=>e(),t}function $a(e,{scope:t,safe:i}={}){Ga(t||El||i,"scopeBind: scope not found");const r=t||El;return t=>{function i(){Al(o)}let n,s=0;const o=El;Al(r);try{n=e(t)}catch(e){n=e,s=1}if(i(),s)throw n;return n instanceof Promise&&n.then(i,i),n}}function qa({unit:e,fn:t,scope:i,batch:r}){const n=[Cl.run({fn:e=>t(e)})];r&&n.unshift(Cl.compute({priority:"sampler",batch:1})),il(e)&&n.unshift(Cl.mov({store:e.stateRef,to:"stack"}));const s=Array.isArray(e)?e:[e];if(i){const e=[],t=i.additionalLinks;return s.forEach((i=>{const r=t[i.graphite.id]||[];t[i.graphite.id]=r;const s=za({node:Ha(n,i),meta:{watchOp:i.kind}});r.push(s),e.push((()=>{const e=r.indexOf(s);-1!==e&&r.splice(e,1),Tl(s)}))})),Wa((()=>{e.forEach((e=>e()))}))}{const e=za({node:n,parent:s,family:{owners:s}});return Wa((()=>{Tl(e)}))}}function Ha(e,t){return il(t)?[Cl.mov({store:t.stateRef,to:"stack"}),...e]:e}"undefined"!=typeof Symbol&&Symbol.observable;const Za=e=>e.graphite||e,Qa=e=>e.family.owners,Xa=e=>e.family.links,Ya=e=>e.value,Ka=e=>e.subscribers,Ja=(e,t)=>Za(e).meta[t],el=e=>(yl(e)||ml(e))&&"kind"in e,tl=e=>t=>el(t)&&t.kind===e,il=tl("store"),rl=tl("event"),nl=tl("effect"),sl=e=>el(e)&&!!e.targetable,ol=tl("domain"),al=tl("scope");var ll={__proto__:null,unit:el,store:il,event:rl,effect:nl,targetable:sl,domain:ol,scope:al,attached:e=>nl(e)&&1==Ja(e,"attached")};const dl=(e,t)=>{const i=e.indexOf(t);-1!==i&&e.splice(i,1)},cl=(e,t)=>e.push(t),ul=()=>{let e=0;return()=>""+ ++e},hl=(ul(),ul()),pl=ul();ul();let fl=null;const gl=(e,t)=>{const i=Za(e);Va(t,(e=>{const t=Za(e);"domain"!==i.family.type&&(t.family.type="crosslink"),cl(Qa(t),i),cl(Xa(i),t)}))},vl=(e=[])=>(Array.isArray(e)?e:[e]).flat().map(Za),ml=e=>"object"==typeof e&&null!==e,yl=e=>"function"==typeof e,wl=(e,t,i,r)=>{const n={id:hl(),type:e,data:t};return i&&(n.order={priority:i},r&&(n.order.barrierID=++Sl)),n};let Sl=0;const bl=({from:e="store",store:t,target:i,to:r=(i?"store":"stack"),batch:n,priority:s})=>wl("mov",{from:e,store:t,to:r,target:i},s,n),_l=({fn:e,batch:t,priority:i,safe:r=0,filter:n=0,pure:s=0})=>wl("compute",{fn:e,safe:r,filter:n,pure:s},i,t),xl=({fn:e})=>_l({fn:e,priority:"effect"}),Cl={mov:bl,compute:_l,filter:({fn:e,pure:t})=>_l({fn:e,filter:1,pure:t}),run:xl};const kl=[];let Ol=0;for(;Ol<6;)cl(kl,{first:null,last:null,size:0}),Ol+=1;new Set;let El;const Al=e=>{El=e};const Ll=(e,t)=>{dl(e.next,t),dl(Qa(e),t),dl(Xa(e),t)},Ml=(e,t,i)=>{let r;e.next.length=0,e.seq.length=0,e.scope=null;let n=Xa(e);for(;r=n.pop();)Ll(r,e),(t||i&&"sample"!==e.meta.op||"crosslink"===r.family.type)&&Ml(r,t,"on"!==r.meta.op&&i);for(n=Qa(e);r=n.pop();)Ll(r,e),i&&"crosslink"===r.family.type&&Ml(r,t,"on"!==r.meta.op&&i)},Il=e=>e.clear(),Tl=(e,{deep:t}={})=>{let i=0;if(e.ownerSet&&e.ownerSet.delete(e),il(e))Il(Ka(e));else if(ol(e)){i=1;const t=e.history;Il(t.events),Il(t.effects),Il(t.stores),Il(t.domains)}Ml(Za(e),!!t,i)};za({node:[xl({fn:({fn:e,value:t})=>e(t)})],meta:{op:"fx",fx:"sidechain"}});var Rl=p(7121),Pl=p(8139);function Dl(e,t){const i=ll.unit(e);let r={};i?r={unit:e}:"@@unitShape"in e?"function"==typeof e["@@unitShape"]?r=e["@@unitShape"]():jl("expect @@unitShape to be a function"):r=e;const n=Array.isArray(r),s=yo.useRef({stale:1,justSubscribed:0,scope:t}),[o,a,l,d,c]=yo.useMemo((()=>{s.current.stale=1;const e=Array.isArray(r)?[]:{},n=[],o=[],a=[],l=[];for(const s in r){if(!{}.hasOwnProperty.call(r,s))continue;const d=r[s];ll.unit(d)||jl(`expect useUnit ${i?"argument":`value in key "${s}"`} to be a unit`),ll.event(d)||ll.effect(d)?(e[s]=t?$a(d,{scope:t}):d,a.push(s),l.push(d)):(e[s]=null,n.push(s),o.push(d))}return[e,n,o,a,l]}),[s,t,...Object.keys(r),...Object.values(r)]),u=yo.useRef({value:o,storeKeys:a,eventKeys:d,eventValues:c}),h=yo.useCallback((e=>{const i=s.current;return i.justSubscribed=1,qa({unit:l,fn:()=>{i.stale||(i.stale=1,e())},scope:t,batch:1})}),[l,t,u,s]),p=yo.useCallback((()=>{const e=u.current,r=s.current;let h,p=0;const f=e.value,g=e.storeKeys,v=e.eventKeys,m=e.eventValues,y=t!==r.scope;if(r.stale||r.justSubscribed||y){p=!r.justSubscribed||y,h=n?[...o]:{...o},g.length===a.length&&v.length===d.length||(p=1);for(let e=0;e<a.length;e++){const i=Vl(l[e],t),r=a[e];p||(p=g.includes(r)?f[r]!==i:1),h[r]=i}for(let e=0;e<d.length;e++){const t=c[e],i=d[e];p||(p=v.includes(i)?m[v.indexOf(i)]!==t:1)}}return p&&(e.value=h),e.storeKeys=a,e.eventKeys=d,e.eventValues=c,r.stale=0,r.justSubscribed=!p,r.scope=t,i?e.value.unit:e.value}),[h,l,c,t,u,s]);return Bl(h,p,p)}function Nl(e){const t=yo.useContext(Gl);return e&&!t&&jl("No scope found, consider adding <Provider> to app root"),t}function Fl(e,t){return Dl(e,Nl(null==t?void 0:t.forceScope))}const jl=e=>{throw Error(e)},{useSyncExternalStore:Bl}=("undefined"!=typeof window?yo.useLayoutEffect:yo.useEffect,Pl),{useSyncExternalStoreWithSelector:Ul}=Rl,Vl=(e,t)=>t?t.getState(e):e.getState(),Gl=yo.createContext(null),{Provider:zl}=Gl,Wl=e=>{const t=(0,yo.useRef)(null),i=(0,yo.useRef)(null),{desktopMode:r}=Au(),n=e.storyReaderViewModel.options;(({storyReaderViewModel:e,storiesViewerRef:t,backdropRef:i})=>{const r=(0,yo.useRef)(null);(0,yo.useEffect)((()=>{r.current=new Na(e,t.current,i.current)}),[]);const n=()=>{var e;t.current.classList.add(Da["no-select"]),null===(e=r.current)||void 0===e||e.startMove()},s=({y:e,lockX:t})=>{var i;t&&(null===(i=r.current)||void 0===i||i.move(e))},o=({lockX:e})=>{var t;e&&(null===(t=r.current)||void 0===t||t.endMove())},a=()=>{t.current.classList.remove(Da["no-select"])};(0,yo.useEffect)((()=>(yr.on("swipeController.startMove",n),yr.on("swipeController.move",s),yr.on("swipeController.endMove",o),yr.on("swipeController.beforeEndMove",a),()=>{yr.off("swipeController.startMove",n),yr.off("swipeController.move",s),yr.off("swipeController.endMove",o),yr.off("swipeController.beforeEndMove",a)})),[])})({storyReaderViewModel:e.storyReaderViewModel,backdropRef:t,storiesViewerRef:i}),Fa(e.storyReaderViewModel.activeStory);return Ho($o,{children:[Ho("div",{ref:i,className:Qo()("stories-viewer",Da["stories-viewer"],Da.slider3d),style:Object.assign(Object.assign({},{"--loaderBackgroundColor":null===(s=n.loader)||void 0===s?void 0:s.default.color,"--loaderBackgroundAccentColor":null===(o=n.loader)||void 0===o?void 0:o.default.accentColor,"--timelineBlockTopOffset":`${parseFloat(String(n.timelineBlockTopOffset))}px`,"--slideBorderRadius":`${parseFloat(String(n.borderRadius))}px`}),(()=>{var e,t,i,r;return{backgroundColor:null!==(t=null===(e=n.commonBackdrop)||void 0===e?void 0:e.color)&&void 0!==t?t:void 0,backdropFilter:null!==(r=null===(i=n.commonBackdrop)||void 0===i?void 0:i.backdropFilter)&&void 0!==r?r:void 0}})()),children:[r&&qo("div",{className:Da["stories-viewer-background"],style:(()=>{var t,i,r;const s=null===(t=e.storyReaderViewModel.activeStory)||void 0===t?void 0:t.displayedSlideImage,o=[];return null!=n.slideBackdrop&&Array.isArray(n.slideBackdrop.linearGradientOverlay)&&o.push(`linear-gradient(${n.slideBackdrop.linearGradientOverlay.join(", ")})`),null!=s&&o.push(`url(${s})`),{backgroundImage:o.join(", "),opacity:(null===(i=n.slideBackdrop)||void 0===i?void 0:i.opacity)||0,filter:(null===(r=n.slideBackdrop)||void 0===r?void 0:r.blur)?`blur(${n.slideBackdrop.blur}px)`:"none"}})()}),e.children]}),qo("div",{ref:t,className:Qo()(Da["stories-viewer-backdrop"],{[Da._desktopMode]:r})})]});var s,o};var $l=p(1425),ql={insert:"head",singleton:!1};Yo()($l.A,ql);const Hl=$l.A.locals||{};var Zl=p(6349),Ql={insert:"head",singleton:!1};Yo()(Zl.A,Ql);const Xl=Zl.A.locals||{};var Yl=p(9322),Kl={insert:"head",singleton:!1};Yo()(Yl.A,Kl);const Jl=Yl.A.locals||{},ed=e=>50+parseFloat(String(e)),td=({story:e,options:t})=>{const i=Fl(Tr),r=e.hasLike,n=e.hasShare,s=e.hasFavorite,o=e.hasAudio,a=e.needBottomPanel?ed(t.actionPanelBottomOffset):0;return qo("div",{className:Jl["stories-button-panel"],style:{height:`${a}px`,transform:`translateY(${a}px)`},children:e.needBottomPanel&&Ho("div",{className:Jl["stories-button-panel-actions"],children:[(()=>{if(!r)return null;const i=0===e.like||-1===e.like,n=0===e.like||1===e.like;return Ho("span",{children:[qo("span",{className:Qo()(Jl["button-panel-action"],{"like-up":i,"like-up-filled":1===e.like}),dangerouslySetInnerHTML:{__html:i?t.likeButton.svgSrc.baseState:t.likeButton.svgSrc.activeState},onClick:()=>{e.setLike(1===e.like?0:1)}}),qo("span",{className:Qo()(Jl["button-panel-action"],{"like-down":n,"like-down-filled":-1===e.like}),dangerouslySetInnerHTML:{__html:n?t.dislikeButton.svgSrc.baseState:t.dislikeButton.svgSrc.activeState},onClick:()=>{e.setDislike(-1===e.like?0:-1)}})]})})(),s&&qo("span",{children:qo("span",{className:Qo()(Jl["button-panel-action"],{bookmark:!e.favorite,"bookmark-filled":e.favorite}),dangerouslySetInnerHTML:{__html:e.favorite?t.favoriteButton.svgSrc.activeState:t.favoriteButton.svgSrc.baseState},onClick:()=>e.setBookmark(!e.favorite)})}),Ho("span",{className:Jl["right-container"],children:[o&&qo("span",{children:qo("span",{className:Qo()(Jl["button-panel-action"],{"muted-icon":i,"sound-icon":!i}),dangerouslySetInnerHTML:{__html:i?t.muteButton.svgSrc.baseState:t.muteButton.svgSrc.activeState},onClick:()=>{i?jr():Fr()}})}),n&&qo("span",{className:Jl["button-panel-action"],dangerouslySetInnerHTML:{__html:t.shareButton.svgSrc.baseState},onClick:()=>{e.share()}})]})]})})};var id=p(2208),rd={insert:"head",singleton:!1};Yo()(id.A,rd);const nd=id.A.locals||{},sd=e=>{var t,i;const r=Fl(Ar);return qo("div",{className:nd["story-header"],children:!e.closeDisabled&&qo("button",{className:Qo()(nd["stories-viewer__close"],{[nd["_paused-ui"]]:r}),style:"left"===e.options.closeButtonPosition?{left:"10px"}:{right:"10px"},onClick:t=>{t.stopPropagation(),t.preventDefault(),e.onClose()},dangerouslySetInnerHTML:{__html:null!==(i=null===(t=e.options.closeButton)||void 0===t?void 0:t.svgSrc.baseState)&&void 0!==i?i:""}})})};var od=p(9485),ad={insert:"head",singleton:!1};Yo()(od.A,ad);const ld=od.A.locals||{};class dd{constructor(e){this.animationApi=e,this.slideElement=null}init(e){this.slideElement=e.querySelector(".narrative-slide")}start(){try{if(!this.slideElement)return;this.animationApi.start(this.slideElement,!0)}catch(e){console.error(e)}}stop(){try{if(!this.slideElement)return;this.animationApi.stop(this.slideElement,!0)}catch(e){console.error(e)}}resume(){this.slideElement&&this.animationApi.resume(this.slideElement)}pause(){this.slideElement&&this.animationApi.pause(this.slideElement)}}var cd=function(e,t,i,r){return new(i||(i=Promise))((function(n,s){function o(e){try{l(r.next(e))}catch(e){s(e)}}function a(e){try{l(r.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,a)}l((r=r.apply(e,t||[])).next())}))};class ud{constructor(e){this.videoEl=e,this.parseDefaultMuted()}get $video(){return this.videoEl}get muted(){return this.videoEl.muted}get paused(){return this.videoEl.paused}start(){return cd(this,void 0,void 0,(function*(){this.videoEl.pause(),this.videoEl.currentTime=0,yield this.play()}))}play(){return cd(this,void 0,void 0,(function*(){const e=this.videoEl.play();e?yield e:yield new Promise((e=>{setTimeout(e,0)}))}))}pause(){this.videoEl.pause()}resume(){return cd(this,void 0,void 0,(function*(){this.videoEl.paused&&(yield this.videoEl.play())}))}stop(){this.videoEl.pause(),this.videoEl.currentTime=0}mute(){"1"!==this.videoEl.getAttribute("data-default-muted")&&(this.videoEl.muted=!0)}unmute(){"1"!==this.videoEl.getAttribute("data-default-muted")&&(this.videoEl.muted=!1)}load(){return cd(this,arguments,void 0,(function*(e=!0){return new Promise((t=>{const i=this.videoEl.oncanplaythrough?"canplaythrough":"canplay";this.videoEl.addEventListener(i,(()=>{requestAnimationFrame((()=>{requestAnimationFrame((()=>{t()}))}))}),{once:!0}),e&&this.videoEl.load()}))}))}on(e,t){return this.videoEl.addEventListener(e,t),this}once(e,t){return this.videoEl.addEventListener(e,t,{once:!0}),this}off(e,t){return this.videoEl.removeEventListener(e,t),this}parseDefaultMuted(){null===this.videoEl.getAttribute("data-default-muted")&&(this.videoEl.muted?this.videoEl.setAttribute("data-default-muted","1"):this.videoEl.setAttribute("data-default-muted","0"))}}var hd=p(3107),pd=function(e,t,i,r){return new(i||(i=Promise))((function(n,s){function o(e){try{l(r.next(e))}catch(e){s(e)}}function a(e){try{l(r.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,a)}l((r=r.apply(e,t||[])).next())}))};class fd extends ud{constructor(e){super(e),this._vodData=null,this.handlePlayerError=this.handlePlayerError.bind(this),this._vodData=fd.parseData(e)}get vodData(){return this._vodData}static get isBrowserSupported(){return hd.Player.isBrowserSupported()}load(){const e=Object.create(null,{load:{get:()=>super.load}});return pd(this,void 0,void 0,(function*(){try{fd.isBrowserSupported?(this.disableVideoPreload(),yield this.initPlayer()):(this.updateVideoSources(),yield e.load.call(this),console.error("[VOD]: Browser not supported!"))}catch(e){this.handlePlayerError({detail:e})}}))}stop(){var e;null===(e=this.player)||void 0===e||e.removeEventListener("error",this.handlePlayerError),super.stop()}static parseData(e){const t=e.getAttribute("data-vod");try{return t&&JSON.parse(t)}catch(e){return null}}initPlayer(){const e=Object.create(null,{stop:{get:()=>super.stop}});return pd(this,void 0,void 0,(function*(){this.player=new hd.Player,this.player.addEventListener("error",this.handlePlayerError),yield this.attachVideoElement(),yield this.loadVideo(),yield this.play(),e.stop.call(this)}))}disableVideoPreload(){this.videoEl.preload="none"}updateVideoSources(){this.videoEl.innerHTML="";for(const e of this.vodData.formats){const t=document.createElement("source");t.src=e.url,t.type=e.mimeType,t.width=e.width,t.height=e.height,this.videoEl.appendChild(t)}}handlePlayerError(e){const t=e.detail,i=`[VOD]: error code ${t.code}; object ${t}`;throw console.error(i),new Error(i)}attachVideoElement(){return pd(this,void 0,void 0,(function*(){yield this.player.attach(this.videoEl),Re("[VOD]: video element attached",this.videoEl)}))}loadVideo(){return pd(this,void 0,void 0,(function*(){const e=hd.Player.convertJsonToUri(this.vodData);yield this.player.load(e,0,"application/json"),Re(`[VOD]: video ${e} successful loaded`)}))}}var gd=function(e,t,i,r){return new(i||(i=Promise))((function(n,s){function o(e){try{l(r.next(e))}catch(e){s(e)}}function a(e){try{l(r.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,a)}l((r=r.apply(e,t||[])).next())}))};class vd{constructor(){this.videos=[]}init(e){return gd(this,void 0,void 0,(function*(){this.videos=[];for(const t of Array.from(e.querySelectorAll("video"))){const e=this.createVideoByElement(t);yield e.load(),this.videos.push(e)}}))}start(){return gd(this,void 0,void 0,(function*(){for(const e of this.videos)yield e.start()}))}pause(){for(const e of this.videos)e.pause()}resume(){return gd(this,void 0,void 0,(function*(){for(const e of this.videos)yield e.play()}))}stop(){for(const e of this.videos)e.stop()}static hasVideo(e){return Boolean(e.querySelector(".narrative-slide__with-video"))}mute(){for(const e of this.videos)e.mute()}unmute(){for(const e of this.videos)e.unmute()}createVideoByElement(e){return fd.parseData(e)?new fd(e):new ud(e)}}const md=function(){const e={step:1,maxSteps:100};var t=Object.prototype.hasOwnProperty;return function(r,n){n||(n={});var s={};for(var o in e)t.call(n,o)?s[o]=n[o]:s[o]=e[o];var a=Object.prototype.toString.call(r);"[object Array]"!==a&&"[object NodeList]"!==a&&"[object HTMLCollection]"!==a&&(r=[r]);for(var l=0;l<r.length;l++)i(r[l],s)};function i(e,t){if(!r(e)||e.getAttribute("textFitted"))return!1;var i,n,s,o;if(!r(n=e.parentElement))return!1;if(i=function(e){var t=window.getComputedStyle(e,null);return e.getBoundingClientRect().height-parseInt(t.getPropertyValue("padding-top"),10)-parseInt(t.getPropertyValue("padding-bottom"),10)}(n),i<=0)console.warn(`Set a static height and width on the target element ${e.outerHTML} before using textFit!`,e);else{e.setAttribute("textFitted","1");var a=t.step,l=o=parseFloat(window.getComputedStyle(e).fontSize);if(!(l<(s=o-a*t.maxSteps)))for(;l>=s;){if(!(e.getBoundingClientRect().height>i))break;l-=a,e.style.fontSize=l+"px"}}}function r(e){return"object"==typeof HTMLElement?e instanceof HTMLElement:e&&"object"==typeof e&&null!==e&&1===e.nodeType&&"string"==typeof e.nodeName}}();var yd=function(e,t,i,r){return new(i||(i=Promise))((function(n,s){function o(e){try{l(r.next(e))}catch(e){s(e)}}function a(e){try{l(r.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,a)}l((r=r.apply(e,t||[])).next())}))};class wd{constructor(e){this.layerManager=e,this.videoContexts=new Map,this.muted=!1,this.handleShowLayer=this.handleShowLayer.bind(this),this.handleHideLayer=this.handleHideLayer.bind(this),this.subscribeLayerManager()}init(){return yd(this,void 0,void 0,(function*(){for(const e of this.layerManager.getLayers()){const t=new vd;yield t.init(e),this.videoContexts.set(e,t)}}))}start(){return yd(this,void 0,void 0,(function*(){const e=this.getActiveVideoContext();yield null==e?void 0:e.start()}))}mute(){this.muted=!0;const e=this.getActiveVideoContext();null==e||e.mute()}unmute(){this.muted=!1;const e=this.getActiveVideoContext();null==e||e.unmute()}resume(){return yd(this,void 0,void 0,(function*(){const e=this.getActiveVideoContext();null==e||e.resume()}))}pause(){const e=this.getActiveVideoContext();null==e||e.pause()}stop(){for(const e of this.videoContexts.values())e.stop();this.videoContexts=new Map,this.unsubscribeLayerManager()}subscribeLayerManager(){this.layerManager.on("showLayer",this.handleShowLayer),this.layerManager.on("hideLayer",this.handleHideLayer)}unsubscribeLayerManager(){this.layerManager.off("showLayer",this.handleShowLayer),this.layerManager.off("hideLayer",this.handleHideLayer)}handleShowLayer({layer:e}){this.intheritMuted();const t=this.videoContexts.get(e);null==t||t.start()}handleHideLayer({layer:e}){const t=this.videoContexts.get(e);null==t||t.stop()}getActiveVideoContext(){const e=this.layerManager.activeLayer;if(e)return this.videoContexts.get(e)}intheritMuted(){this.muted?this.mute():this.unmute()}}var Sd=function(e,t,i,r){return new(i||(i=Promise))((function(n,s){function o(e){try{l(r.next(e))}catch(e){s(e)}}function a(e){try{l(r.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,a)}l((r=r.apply(e,t||[])).next())}))};class bd{constructor(e){this.videoContainer=e,this.videoContext=new vd}init(){return Sd(this,void 0,void 0,(function*(){yield this.videoContext.init(this.videoContainer)}))}start(){return Sd(this,void 0,void 0,(function*(){yield this.videoContext.start()}))}pause(){this.videoContext.pause()}resume(){return Sd(this,void 0,void 0,(function*(){yield this.videoContext.resume()}))}stop(){this.videoContext.stop()}mute(){this.videoContext.mute()}unmute(){this.videoContext.unmute()}}class _d{static create(e,t){return e.querySelectorAll(".narrative-slide.narrative-multi-slide").length>0?new wd(t):new bd(e)}}var xd,Cd=function(e,t,i,r){return new(i||(i=Promise))((function(n,s){function o(e){try{l(r.next(e))}catch(e){s(e)}}function a(e){try{l(r.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,a)}l((r=r.apply(e,t||[])).next())}))};!function(e){e.None="none",e.Loading="loading",e.Loaded="loaded",e.Started="started",e.Paused="paused",e.Error="error"}(xd||(xd={}));class kd extends U.EventEmitter{constructor(e,t,i,r){super(),this.widgetManager=e,this.animationApi=t,this.slideContent=i,this.layersManager=r,this._state=xd.None,this.videoManager=null,this.narrativeAnimationContext=new dd(this.animationApi)}get state(){return this._state}get meta(){return this._meta}get isNavigationDisabled(){const e=this.slideContent.querySelector(".narrative-slide");return!!e&&"1"===e.dataset.disableNavigation}get isVisible(){return this.state===xd.Loaded||this.state===xd.Started||this.state===xd.Paused}init(){return Cd(this,void 0,void 0,(function*(){this.videoManager=_d.create(this.slideContent,this.layersManager),this.slideContentInnerHTML=this.slideContent.innerHTML,Re(`[SLIDE][init]:${this.meta.currentStoryId}:${this.meta.currentSlideIndex}`),yield this.widgetManager.init(this.slideContent),yield this.load()}))}start(){return Cd(this,void 0,void 0,(function*(){var e;try{if(this.state!==xd.Loaded)throw new Error(`You must initialize the slide first. State: ${this.state}`);this.fitNarrativeTextLines(),yield null===(e=this.videoManager)||void 0===e?void 0:e.start(),this.narrativeAnimationContext.init(this.slideContent),this.narrativeAnimationContext.start(),Re(`[SLIDE][start]:${this.meta.currentStoryId}:${this.meta.currentSlideIndex}`),this.setState(xd.Started),yr.emit("slide.loaded",this.meta.currentSlideIndex)}catch(e){console.error(e)}}))}stop(){var e;this.state===xd.Started&&(this.narrativeAnimationContext.stop(),null===(e=this.videoManager)||void 0===e||e.stop(),yr.emit("slide.stop",{slideIndex:this.meta.currentSlideIndex,storyId:this.meta.currentStoryId}),Re(`[SLIDE][stop]:${this.meta.currentStoryId}:${this.meta.currentSlideIndex}`),this.widgetManager.stop(),this.resetSlideContentHTML(),this.setState(xd.None))}destroy(){this.removeAllListeners()}resume(){return Cd(this,void 0,void 0,(function*(){var e;try{if(this.state!==xd.Paused)return;yield null===(e=this.videoManager)||void 0===e?void 0:e.resume(),this.narrativeAnimationContext.resume(),this.widgetManager.resume(),Re(`[SLIDE][resume]:${this.meta.currentStoryId}:${this.meta.currentSlideIndex}`),this.setState(xd.Started)}catch(e){console.error(e)}}))}pause(){var e;this.state===xd.Started&&(null===(e=this.videoManager)||void 0===e||e.pause(),this.narrativeAnimationContext.pause(),this.widgetManager.pause(),Re(`[SLIDE][pause]:${this.meta.currentStoryId}:${this.meta.currentSlideIndex}`),this.setState(xd.Paused))}setMeta(e){this._meta=e,this.notifyPropertyChanged("meta")}mute(){var e;null===(e=this.videoManager)||void 0===e||e.mute()}unmute(){var e;null===(e=this.videoManager)||void 0===e||e.unmute()}resetSlideContentHTML(){this.slideContent.innerHTML=this.slideContentInnerHTML}containsCurrent(){var e;return null===(e=this.slideContent.querySelector(".narrative-slide"))||void 0===e?void 0:e.classList.contains("current")}setState(e){this._state=e,this.notifyPropertyChanged("state")}load(){return Cd(this,void 0,void 0,(function*(){if(this.state!==xd.Loaded)try{Re(`[SLIDE][start_load]:${this.meta.currentStoryId}:${this.meta.currentSlideIndex}`),yield this.loadResources(),yield this.sleepWhileSlideHasNoContent(),this.fitNarrativeTextLines(),this.setState(xd.Loaded),Re(`[SLIDE][end_load]:${this.meta.currentStoryId}:${this.meta.currentSlideIndex}`)}catch(e){console.error(e),this.setState(xd.Error)}}))}loadResources(){return Cd(this,void 0,void 0,(function*(){var e;yield this.loadMediaResources(this.slideContent),yield this.loadFonts(),vd.hasVideo(this.slideContent)&&(this.setState(xd.Loading),yield null===(e=this.videoManager)||void 0===e?void 0:e.init(this.slideContent))}))}loadFonts(){return new Promise((e=>{"fonts"in document?document.fonts.ready&&document.fonts.ready.catch(e).finally(e):e()}))}loadMediaResources(e){return new Promise((t=>function(e,t){const i=function(e){return new Promise((function(t,i){if("img"===e.tagName.toLowerCase()&&e instanceof HTMLImageElement){const i=()=>{requestAnimationFrame((()=>requestAnimationFrame((()=>{t(e),e.removeEventListener("load",i)}))))};e.addEventListener("load",i),e.complete&&0!==e.naturalHeight&&requestAnimationFrame((function(){requestAnimationFrame((function(){t(e)}))}))}else t(e);e.addEventListener("error",(function(e){var t=e.target instanceof HTMLImageElement;if(e&&e.target&&t&&e.target.style){e.target.style.display="none";var r=e.target.closest(".narrative-element-image");r&&(r.style.display="none")}i(e)}))}))},r=e.querySelectorAll("img,video");let n,s=[];for(n=0;n<r.length;++n)s.push(i(r[n]));s.length,Promise.all(s).then((e=>{t()}))}(e,t)))}fitNarrativeTextLines(){const e=Array.from(this.slideContent.querySelectorAll(".narrative-element-text-wrapper>.narrative-element-text-lines")).slice();md(e,{})}sleepWhileSlideHasNoContent(){return Cd(this,void 0,void 0,(function*(){let e=0;return new Promise((t=>{const i=()=>{e++,this.slideContent.getBoundingClientRect().height>0||e>10?t():requestAnimationFrame(i)};i()}))}))}notifyPropertyChanged(e,t,i){this.emit("propertyChanged",{propertyName:e,from:t,to:i})}}class Od extends(V()){constructor(){super(...arguments),this.layers=[]}init(e,t){this.layersContainer=e,this.animationApi=t,this.layers=Array.from(this.layersContainer.querySelectorAll(".narrative-slide.narrative-multi-slide")),this._activeLayer=this.layers.find((e=>!e.classList.value.includes("hidden")))}get activeLayer(){return this._activeLayer}getLayers(){return this.layers}hideLayer(e){this.animationApi.stop(e,!0),e.classList.add("hidden"),this.emit("hideLayer",{layer:e})}showLayer(e){yr.emit("story.showLayerByIndex"),e.classList.remove("hidden"),this.animationApi.start(e,!0),this._activeLayer=e,this.emit("showLayer",{layer:e})}hideAllLayers(){this.getLayers().forEach((e=>this.hideLayer(e)))}showLayerByIndex(e){const t=this.getLayers();t.forEach((e=>this.hideLayer(e)));const i=t[e];i&&this.showLayer(i)}hasValidMultiSlides(){let e=!0,t=this.layersContainer.querySelectorAll(".narrative-slide.narrative-multi-slide");const i=this.layersContainer.querySelectorAll(".narrative-slide.narrative-multi-slide:not(.hidden)");return t.length>0&&0===i.length&&(e=!1),e}}var Ed=function(e,t){var i={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(i[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(r=Object.getOwnPropertySymbols(e);n<r.length;n++)t.indexOf(r[n])<0&&Object.prototype.propertyIsEnumerable.call(e,r[n])&&(i[r[n]]=e[r[n]])}return i};const Ad=(e,t)=>{var i,r,n,s;const o=t.dataset;let a=null,l=null!==(i=o.elementId)&&void 0!==i?i:"";const d=null!==(r=o.linkType)&&void 0!==r?r:"",c=null!==(n=o.linkTarget)&&void 0!==n?n:"",u={url:()=>{a=decodeURIComponent(c),Ld({activeStory:e,url:a,elementId:l}),Md(e,{linkType:d,url:a,elementId:l})},customAction:()=>{a=c,Ld({activeStory:e,url:a,elementId:l}),Md(e,{linkType:d,url:a,elementId:l})},slide:()=>{e.redirectToSlide({slideIndex:parseInt(c),layerIndex:0})},story:()=>{const t=parseInt(c);Ld({activeStory:e,url:c,elementId:l}),yr.emit("storyReader.redirectToStory",{storyId:t,feedSlug:"default"})},game:()=>{Ld({activeStory:e,url:c,elementId:l}),yr.emit("openGameCenter",{gameId:c})},layer:()=>{yr.emit("storySlide.showLayer",{index:parseInt(c)})}};null===(s=u[d])||void 0===s||s.call(u)},Ld=({activeStory:e,url:t,elementId:i})=>{yr.emit("publicEvents.widgetEvent",{name:"w-link",devPayload:{story_id:e.id,slide_index:e.activeSlideIndex,widget_id:i,widget_label:"",widget_value:t}})},Md=(e,{linkType:t,url:i,elementId:r})=>{e.markAsOpened(),yr.emit("statistics.transitionFromSlide",{storyId:e.id,slideIndex:e.activeSlideIndex}),"url"===t&&yr.emit("publicEvents.clickOnButton",{id:e.id,index:e.activeSlideIndex,url:i,elementId:r})},Id=(e,t)=>{const i={".narrative-element-quiz":Mn.name,".narrative-element-test":Un.name,".narrative-element-quiz-grouped":Tn.name,".narrative-element-quest":An.name};for(const r of Object.keys(i)){if(e.closest(r)){const n=t.findWidgetByType(i[r]);return null==n||n.select(e),!1}}return!0},Td=(e,t)=>{const i=t.findWidgetByType(Cn.name),r=t.findWidgetByType(On.name);return(null==i?void 0:i.isInited)?(i.select(e),!1):!(null==r?void 0:r.isInited)||(r.select(e),!1)};var Rd;!function(e){e[e.ALLOW_ALL_CLICKS=0]="ALLOW_ALL_CLICKS",e[e.DENY_NEXT_CLICK=1]="DENY_NEXT_CLICK",e[e.DENY_ALL_CLICKS=2]="DENY_ALL_CLICKS"}(Rd||(Rd={}));const Pd=e=>e?Rd.ALLOW_ALL_CLICKS:Rd.DENY_NEXT_CLICK,Dd=e=>{var t,i;const r=e.firstElement;if(!r)return Rd.ALLOW_ALL_CLICKS;const n={[Mn.name]:()=>{const t=e.slideQuizIsDone(r);return Pd(t)},[Tn.name]:()=>{const t=e.slideQuizIsDone(r);return Pd(t)},[Un.name]:()=>{const t=e,i=t.slideTestIsDone(r);return t.slideTestWithTimer(r)&&!i?Rd.DENY_ALL_CLICKS:Pd(i)},[Pn.name]:()=>e.isClickCapturedBySlider(r)?Rd.DENY_ALL_CLICKS:Rd.ALLOW_ALL_CLICKS};return null!==(i=null===(t=n[e.getType()])||void 0===t?void 0:t.call(n))&&void 0!==i?i:Rd.ALLOW_ALL_CLICKS},Nd=({activeStory:e,desktopMode:t,geometry:i,navigationDisabled:r,widgetManager:n})=>{const s=(e,t=!1)=>{e<=.3?o():t||a()},o=()=>{e.reachStart?yr.emit(`${hs.name}.showPrevStory`):e.prevSlide()},a=()=>{e.reachEnd?yr.emit(`${hs.name}.showNextStory`):e.nextSlide()};return{handleSlideClick:o=>{const a=o.target;if(!a)return;const l=a.classList;if(l.contains("narrative-element-link")||l.contains("narrative-element-image")||l.contains("narrative-element-swipe-up"))return void Ad(e,a);if(!((e,t,i)=>{const r=e.classList,n={"narrative-element-quiz-next-button":()=>(t.nextSlide(),yr.emit("story.nextSlide"),!1),"narrative-element-test-next-button":()=>(t.prevSlide(),yr.emit("story.nextSlide"),!1),"narrative-element-quiz-answer":()=>Id(e,i),"narrative-element-test-answer":()=>Id(e,i),"narrative-element-data-input":()=>{var t;return null===(t=i.findWidgetByType(Sn.name))||void 0===t||t.click(e),!1},rangeslider:()=>!1,"narrative-element-range-slider-next-button":()=>{var t;return null===(t=i.findWidgetByType(Pn.name))||void 0===t||t.click(e),!1},"narrative-element-poll-button":()=>Td(e,i),"narrative-element-vote-answer":()=>{var t;return null===(t=i.findWidgetByType(Gn.name))||void 0===t||t.select(e),!1},"narrative-element-rate-input":()=>{var t;return null===(t=i.findWidgetByType(Nn.name))||void 0===t||t.select(e),!1},"narrative-element-copy":()=>{var t;return null===(t=i.findWidgetByType(yn.name))||void 0===t||t.click(e),!1},"narrative-element-share":()=>{var t;return null===(t=i.findWidgetByType(jn.name))||void 0===t||t.click(e),!1},"narrative-element-story-repeat":()=>(yr.emit("slideApiHandlers.repeatStory",{storyId:t.id}),!1)};for(const e of r)if(n[e])return n[e]();return!0})(a,e,n))return;let d=!1;for(const e of n.widgets){const t=Dd(e);if(t===Rd.DENY_ALL_CLICKS)return;t===Rd.DENY_NEXT_CLICK&&(d=!0)}if(r)return;const c=(e=>{var r;let n=0,s=0;return t?(n=parseFloat(i.getWidth()),s=e.nativeEvent.offsetX):(n=i.vw,s=e.nativeEvent.pageX||(null===(r=e.nativeEvent.touches)||void 0===r?void 0:r[0].pageX)),s/n})(o),u=n.findWidgetByType(An.name);(null==u?void 0:u.firstElement)?u.handleRouteClick({direction:c>=.3?"forward":"backward",slideIndex:e.activeSlideIndex,slidesCount:e.slidesCount,onClick:()=>s(c,d)}):s(c,d)}}},Fd=(e,t="",i="")=>{$r(),pn({link:i,type:e,id:t})};var jd=function(e,t,i,r){return new(i||(i=Promise))((function(n,s){function o(e){try{l(r.next(e))}catch(e){s(e)}}function a(e){try{l(r.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,a)}l((r=r.apply(e,t||[])).next())}))};const Bd=(e,t)=>jd(void 0,void 0,void 0,(function*(){const i=Ud();if(!i)throw new Error;try{$r(),$n({id:e}),yield i(t),qn({result:!0})}catch(e){if(e instanceof DOMException&&"AbortError"===e.name)return;throw e}finally{qn({result:!1})}})),Ud=()=>{var e,t;let i=null===(e=navigator.share)||void 0===e?void 0:e.bind(navigator);return!i&&(null===(t=window.parent)||void 0===t?void 0:t.navigator.share)&&(i=window.parent.navigator.share.bind(window.parent.navigator)),i};var Vd=function(e,t,i,r){return new(i||(i=Promise))((function(n,s){function o(e){try{l(r.next(e))}catch(e){s(e)}}function a(e){try{l(r.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,a)}l((r=r.apply(e,t||[])).next())}))};const Gd=e=>Vd(void 0,[e],void 0,(function*({shareId:e,hideElementsSelector:t,slideContent:i,desktopMode:r}){let n=null;try{const s=yield ki(xi.IOS,i,function(e){let t="";return Array.prototype.slice.call(window.document.styleSheets).forEach((i=>{e(i)&&(t+=Array.prototype.slice.call(i.rules).map((e=>e.cssText)).join(""))})),t}((function(e){return!0})),t),o={files:[s]};if(n=URL.createObjectURL(s),r)return void Fd(nn.SlideScreenshot,e,n);yield Bd(e,o)}catch(t){n&&Fd(nn.SlideScreenshot,e,n)}}));var zd=function(e,t,i,r){return new(i||(i=Promise))((function(n,s){function o(e){try{l(r.next(e))}catch(e){s(e)}}function a(e){try{l(r.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,a)}l((r=r.apply(e,t||[])).next())}))};const Wd=e=>{const t={};for(const[i,r]of Object.entries(null!=e?e:{}))null!==r&&(t[i]=r);return t},$d=e=>{const t=({shareId:t,config:i})=>{var r;r={shareId:t,config:i,desktopMode:e.desktopMode},zd(void 0,[r],void 0,(function*({shareId:e,config:t,desktopMode:i}){var r;null==e&&(e="story-share");const n=Wd(t),s=n.url=null!==(r=n.url)&&void 0!==r?r:n.text;try{if(i)return void Fd(nn.Social,e,s);yield Bd(e,n)}catch(t){Fd(nn.Social,e,s)}}))},i=({shareId:t,hideElementsSelector:i})=>{const r=e.slideContentRef.current;Gd({shareId:t,hideElementsSelector:i,slideContent:r,desktopMode:e.desktopMode})};(0,yo.useEffect)((()=>{if(e.state===xd.Started)return yr.on("storySlide.performShareAction",t),yr.on("storySlide.performScreenShotShareAction",i),()=>{yr.off("storySlide.performShareAction",t),yr.off("storySlide.performScreenShotShareAction",i)}}),[e.state])};var qd=p(8624),Hd={insert:"head",singleton:!1};Yo()(qd.A,Hd);qd.A.locals;var Zd=function(e,t){var i={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(i[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(r=Object.getOwnPropertySymbols(e);n<r.length;n++)t.indexOf(r[n])<0&&Object.prototype.propertyIsEnumerable.call(e,r[n])&&(i[r[n]]=e[r[n]])}return i};const Qd=e=>{var{geometry:t}=e,i=Zd(e,["geometry"]);const{desktopMode:r}=Au(),{slideContentRef:n,widgetManager:s,state:o,navigationDisabled:a,isVisible:l,needLoadingAnimation:d,needLoadingMask:c}=(e=>{var t,i,{activeSlideIndex:r,currentStoryId:n,activeStoryId:s,slidesLoaded:o,currentSlideIndex:a,needSlideInit:l}=e,d=Ed(e,["activeSlideIndex","currentStoryId","activeStoryId","slidesLoaded","currentSlideIndex","needSlideInit"]);const[c,u]=Fl([Tr,Lr]),[h,p]=(0,yo.useState)(xd.None),[f,g]=(0,yo.useState)({}),v=(0,yo.useRef)(null),m=(0,yo.useRef)(new Od).current,y=(0,yo.useRef)(new ks(d.slideApi,m)).current,[w,S]=(0,yo.useState)(null),b=s===n,_=b||l;(0,yo.useLayoutEffect)((()=>{const e=v.current,t=new kd(y,d.slideApi.Animation,e,m);return C(t),t.on("propertyChanged",(({propertyName:e})=>x(t,e))),S(t),()=>{t.stop(),t.destroy(),y.destroy()}}),[]),(0,yo.useLayoutEffect)((()=>{w&&_&&o&&h===xd.None&&0===a&&w.init(),w&&!_&&w.stop()}),[w,_,o,h,a]),(0,yo.useLayoutEffect)((()=>{w&&b&&(h===xd.Loaded&&0===a&&(w.start(),d.onSlideStarted({index:r,widgetManager:y,slideContent:v.current})),h===xd.Started&&1===a&&w.stop())}),[w,h,a,b]),(0,yo.useEffect)((()=>{w&&(u?w.pause():w.resume())}),[w,u,h]),(0,yo.useEffect)((()=>{w&&(c?w.mute():w.unmute())}),[w,c,h]),(0,yo.useEffect)((()=>{w&&C(w)}),[w,r,n,s,o,c,a]);const x=(e,t)=>{"state"===t&&p(e.state),"meta"===t&&g(e.meta)},C=e=>{e.setMeta({activeSlideIndex:r,currentSlideIndex:a+r,currentStoryId:n,activeStoryId:s,muted:c})},k=h===xd.Loading||h===xd.Error||!o,O=h===xd.Loading||h===xd.Error||!o;return{slideContentRef:v,widgetManager:y,state:h,navigationDisabled:null===(t=null==w?void 0:w.isNavigationDisabled)||void 0===t||t,needLoadingMask:k,isVisible:null!==(i=null==w?void 0:w.isVisible)&&void 0!==i&&i,needLoadingAnimation:O}})(Object.assign(Object.assign({},i),{activeStoryId:i.activeStory.id}));$d({slideContentRef:n,desktopMode:r,state:o}),(({state:e,activeStory:t})=>{(0,yo.useEffect)((()=>{if(e===xd.Started)return yr.on("slide.openSwipeUpLink",i),()=>{yr.off("slide.openSwipeUpLink",i)}}),[e]);const i=e=>{Ad(t,e.target)}})({state:o,activeStory:i.activeStory});const{handleSlideClick:u}=Nd({activeStory:i.activeStory,desktopMode:r,geometry:t,widgetManager:s,navigationDisabled:a});return Ho("div",{onClick:e=>{e.preventDefault(),e.stopPropagation(),i.clickDisabled||u(e)},className:`${ld["stories-slide"]} ${ld[`_position_${i.currentSlideIndex+1}`]} ${Qo()({[ld["_with-bottom-panel"]]:i.needBottomPanel,[ld["_desktop-mode"]]:r})}`,children:[qo("div",{className:ld["stories-slide-offset"],style:{margin:t.getOffset(),width:t.getWidth(),height:t.getHeight(),"--y-offset":t.getOffsetY(),"--x-offset":t.getOffsetX()},children:qo("div",{className:ld["stories-slide-box"],children:qo("div",{ref:n,dangerouslySetInnerHTML:{__html:i.slideHtml},className:`${ld["stories-slide-content"]} narrative-slide"`,style:{fontSize:t.getFontSize(),opacity:1}})})}),c&&qo("div",{className:ld["load-mask"],children:d&&qo("div",{className:ld["loading-spinner-default"]})})]})};var Xd=p(5196),Yd={insert:"head",singleton:!1};Yo()(Xd.A,Yd);const Kd=Xd.A.locals||{},Jd=(0,yo.forwardRef)(((e,t)=>{const{desktopMode:i}=Au(),r=Fl(Ar);return qo("div",{ref:t,className:Qo()(Kd["stories-pager"],{[Kd["_desktop-mode"]]:i,[Kd["_paused-ui"]]:r}),children:qo("div",{className:`${Kd["stories-pager__ticks"]} ${Qo()({[Kd.hiddenTimeline]:e.hiddenTimeline})}`,children:new Array(e.slidesLength).fill(0).map(((t,i)=>Ho("div",{className:Kd["stories-pager__tick"],children:[qo("div",{className:Qo()(Kd["stories-pager__tick-progress"],{[Kd._active]:i+1<=e.activeSlide})}),qo("div",{className:Kd["stories-pager__tick-progress-loader"],style:{display:i+1===e.activeSlide+1?"block":"none"}})]},i+1)))})})}));var ec=p(5729),tc=p.n(ec),ic=p(1869),rc=function(e,t,i,r){return new(i||(i=Promise))((function(n,s){function o(e){try{l(r.next(e))}catch(e){s(e)}}function a(e){try{l(r.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,a)}l((r=r.apply(e,t||[])).next())}))};const nc=e=>{const t=(0,yo.useRef)(null),i=(0,yo.useRef)(null);let r,n=(0,yo.useRef)(0),s=(0,yo.useRef)(0);const o=()=>{i.current&&(s.current=-1*function(e){const t=window.getComputedStyle(e),i=t.transform||t.webkitTransform||t.mozTransform;if("none"===i)return{x:0,y:0,z:0};const r=i.includes("3d")?"3d":"2d",n=i.match(/matrix.*\((.+)\)/)[1].split(", ");return"2d"===r?{x:isNaN(n[4])?0:n[4],y:isNaN(n[5])?0:n[5],z:0}:"3d"===r?{x:isNaN(n[12])?0:n[12],y:isNaN(n[13])?0:n[13],z:isNaN(n[14])?0:n[14]}:void 0}(i.current).x)},[a,l]=(0,yo.useState)(!1),[d,c]=(0,yo.useState)(!1),u=(0,yo.useRef)(!1),h=()=>{const t=yo.Children.count(e.children);return i.current&&t?i.current.scrollWidth/t:0};let p=!1;(0,yo.useEffect)((()=>{var e;return("ontouchstart"in window||window.navigator.msPointerEnabled||"ontouchstart"in document.documentElement)&&(p=!0),p||(i.current&&(r=null===(e=i.current.children[0])||void 0===e?void 0:e.offsetWidth),i.current&&(n.current=i.current.scrollWidth-i.current.clientWidth,o()),n.current===s.current?c(!1):c(!0),0===s.current?l(!1):l(!0)),()=>{}}),[]);let f=(0,yo.useRef)(!1),g=(0,yo.useRef)(0),v=0;const m=(0,yo.useRef)(!1),[y,w]=(0,yo.useState)(0),S=e=>{e<0&&(e=0),e>n.current&&(e=n.current),w(e)};(0,yo.useEffect)((()=>{y===n.current?c(!1):c(!0),l(0!==y)}),[y]);const b=e=>{if(!u.current)if(f.current){const t=e instanceof MouseEvent?e.pageX:e.touches&&e.touches[0].pageX;if(t!==g.current){m.current=!0,v=t;const e=g.current-v;let i=s.current+e;S(i)}}else m.current=!1},_=e=>{m.current&&e.preventDefault(),setTimeout((()=>{m.current=!1})),f.current=!1,document.removeEventListener("mousemove",b),document.removeEventListener("mouseup",_),document.removeEventListener("touchmove",b),document.removeEventListener("touchend",_)};return Ho(sc,{cssStyle:e.style,children:[qo(oc,{ref:t,onMouseDown:e=>{u.current||(e.preventDefault(),f.current=!0,g.current=e.pageX,i.current&&(n.current=i.current.scrollWidth-i.current.clientWidth),i.current&&o(),document.addEventListener("mousemove",b),document.addEventListener("mouseup",_))},onTouchStart:e=>{u.current||(e.preventDefault(),f.current=!0,g.current=e.touches&&e.touches[0].pageX,i.current&&(n.current=i.current.scrollWidth-i.current.clientWidth),i.current&&o(),document.addEventListener("touchmove",b),document.addEventListener("touchend",_))},onClickCapture:e=>{m.current&&(e.preventDefault(),e.stopPropagation())},children:qo(ac,{ref:i,style:{transform:`translateX(${-1*y}px)`},children:e.children})}),!p&&Ho($o,{children:[qo(dc,{position:lc.LEFT,show:a,onClick:e=>rc(void 0,void 0,void 0,(function*(){if(u.current)return;o();let e=s.current-h();S(e),u.current=!0,i.current&&(yield Ba(i.current,"transform",300)),u.current=!1})),children:qo("svg",{focusable:"false",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:qo("path",{d:"M15.41 7.41L14 6l-6 6 6 6 1.41-1.41L10.83 12z"})})}),qo(dc,{position:lc.RIGHT,show:d,onClick:e=>rc(void 0,void 0,void 0,(function*(){if(u.current)return;o();let e=s.current+h();S(e),u.current=!0,i.current&&(yield Ba(i.current,"transform",300)),u.current=!1})),children:qo("svg",{focusable:"false",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:qo("path",{d:"M10 6L8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"})})})]})]})},sc=tc()("div")({position:"relative"},(e=>Object.assign({},e.cssStyle))),oc=tc().div`
|
|
40
|
+
*/var r=i(9155),n=i(8139);var s="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},o=n.useSyncExternalStore,a=r.useRef,l=r.useEffect,d=r.useMemo,c=r.useDebugValue;t.useSyncExternalStoreWithSelector=function(e,t,i,r,n){var u=a(null);if(null===u.current){var h={hasValue:!1,value:null};u.current=h}else h=u.current;u=d((function(){function e(e){if(!l){if(l=!0,o=e,e=r(e),void 0!==n&&h.hasValue){var t=h.value;if(n(t,e))return a=t}return a=e}if(t=a,s(o,e))return t;var i=r(e);return void 0!==n&&n(t,i)?t:(o=e,a=i)}var o,a,l=!1,d=void 0===i?null:i;return[function(){return e(t())},null===d?void 0:function(){return e(d())}]}),[t,i,r,n]);var p=o(e,u[0],u[1]);return l((function(){h.hasValue=!0,h.value=p}),[p]),c(p),p}},8139:(e,t,i)=>{"use strict";e.exports=i(4026)},7121:(e,t,i)=>{"use strict";e.exports=i(4965)},8384:e=>{"use strict";e.exports=n},1869:e=>{"use strict";e.exports=l},5729:e=>{"use strict";e.exports=a},5136:e=>{"use strict";e.exports=i},3107:e=>{"use strict";e.exports=o},992:e=>{"use strict";e.exports=s},2840:t=>{"use strict";t.exports=e},9780:e=>{"use strict";e.exports=c},9155:e=>{"use strict";e.exports=r},2265:e=>{"use strict";e.exports=d},7315:e=>{"use strict";e.exports=t}},h={};function p(e){var t=h[e];if(void 0!==t)return t.exports;var i=h[e]={id:e,loaded:!1,exports:{}};return u[e].call(i.exports,i,i.exports,p),i.loaded=!0,i.exports}p.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return p.d(t,{a:t}),t},p.d=(e,t)=>{for(var i in t)p.o(t,i)&&!p.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})},p.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),p.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),p.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},p.nmd=e=>(e.paths=[],e.children||(e.children=[]),e),p.nc=void 0;var f={};return(()=>{"use strict";p.r(f),p.d(f,{CloseButtonPosition:()=>B,FavoriteStoryList:()=>bh,GoodsWidgetRenderingType:()=>re,IASContainer:()=>Au,SharePageEvents:()=>gr,StoriesListCardCoverQuality:()=>H,StoriesListCardTitlePosition:()=>q,StoriesListCardTitleTextAlign:()=>$,StoriesListCardViewVariant:()=>W,StoriesListDirection:()=>Z,StoryList:()=>wh,StoryManager:()=>qs,StoryReaderSwipeStyle:()=>J,UGCStoryList:()=>Sh,storyManager:()=>Ys});p(5845);var e=p(2840);class t extends Error{constructor(e){super(`Invalid language tag: ${e}. The "lang" value must be comply with the RFC 5646 (also known as BCP 47). Examples of valid language tags include "en-US", "fr-FR", "es-ES", etc.`)}}const i="en-US";class r{constructor(e=i){const t=this.normalizeAndEnsureCompatibility(e),r=this.validateTag(t);this.parseTag(r)}isValidTag(e){return/^[a-z]+-[a-zA-Z]+$/.test(e)}toString(){return this.tag}normalizeAndEnsureCompatibility(e){const t=e.toLowerCase();return this.ensureBackwardCompatibility(t)}ensureBackwardCompatibility(e){var t;return null!==(t={ru:"ru-RU",en:"en-US"}[e])&&void 0!==t?t:e}validateTag(e){return this.isValidTag(e)?e:(console.error(new t(e).message),this.getNavigatorTag())}getNavigatorTag(){const e=navigator.language.toLowerCase();return this.isValidTag(e)?e:(console.error(`Invalid navigator language tag: ${e}`),i)}parseTag(e){const[t,i]=e.split("-");this.languageCode=t,this.countryCode=i.toUpperCase(),this.tag=`${this.languageCode}-${this.countryCode}`}}const n={apiKey:"",disableStatistic:!1,disableDeviceId:!1,lang:new r};var s=function(e,t){var i={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(i[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(r=Object.getOwnPropertySymbols(e);n<r.length;n++)t.indexOf(r[n])<0&&Object.prototype.propertyIsEnumerable.call(e,r[n])&&(i[r[n]]=e[r[n]])}return i};const o=(0,e.createStore)(n),a=(0,e.createEvent)();o.on(a,((e,t)=>{var{disableStatistic:i,disableDeviceId:n}=t,o=s(t,["disableStatistic","disableDeviceId"]);return Object.assign(Object.assign({disableStatistic:null!=i?i:e.disableStatistic,disableDeviceId:null!=n?n:e.disableDeviceId},o),{lang:new r(o.lang)})}));const l=(0,e.createEvent)();o.on(l,((e,{tags:t})=>Object.assign(Object.assign({},e),{tags:t})));const d=(0,e.createEvent)();o.on(d,((e,{userId:t})=>Object.assign(Object.assign({},e),{userId:t})));const c=(0,e.createEvent)();o.on(c,((e,{placeholders:t})=>Object.assign(Object.assign({},e),{placeholders:t})));const u=(0,e.createEvent)();o.on(u,((e,{imagePlaceholders:t})=>Object.assign(Object.assign({},e),{imagePlaceholders:t})));const h=(0,e.createEvent)();o.on(h,((e,{lang:t})=>Object.assign(Object.assign({},e),{lang:new r(t)})));const g=(0,e.createStore)(""),v=(0,e.createEvent)();(0,e.sample)({clock:v,target:g});const m=(0,e.createStore)({session:{id:"",expire_in:0},server_timestamp:0,content_base_url:"",user_key:"",share:!1,is_allow_profiling:!1,cache:[],placeholders:[],image_placeholders:[],editor:null,storyWidgetsResources:[],is_allow_ugc:!1}),y=(0,e.createEffect)();m.on(y.doneData,((e,t)=>t));const w=(0,e.createEvent)(),S=(0,e.createEvent)();m.on(S,(e=>{const t=Object.assign({},e);return t.session.id="",t}));const b=(0,e.createEffect)((e=>{N("session/update",e,(()=>{}))})).prepend((e=>({data:[[5,0,...e]]})));var _=p(7315);class x{static createFunctionWithTimeout(e,t){let i=!1;function r(){i||(i=!0,e())}return setTimeout(r,t||1e3),r}static convertModelToFormData(e,t,i){t instanceof Object&&Object.keys(t).forEach((r=>{const n=t[r];if(n instanceof Object&&!Array.isArray(n))return this.convertModelToFormData(e,n,r);i&&(r=`${i}[${r}]`),Array.isArray(n)?n.forEach((t=>{e.append(`${r}[]`,t)})):e.append(r,n)}))}}const C=e=>null==e;function k(e){const t=typeof e;return null!=e&&("object"===t||"function"===t)}function O(e,t){return Object.assign(Object.assign({},e),t)}function E(e){return e.replace(/^\//,"")}const A={baseUrl:"https://sdk.inappstory.ru",apiUrl:"https://api.inappstory.ru",faviconApiUrl:"https://favicon.inappstory.ru"};function L(e){if(e.length>32)try{const t=function(e){const t=(e=e.replace(new RegExp("-","g"),"+").replace(new RegExp("_","g"),"/")).length;return e=function(e,t,i){return void 0===t?e:t.length>=e.length?t:i?(e+t).slice(-e.length):(t+e).substring(0,e.length)}(new Array(t%4).fill("=").join(""),e,!1),window.atob(e)}(e),i=t.charCodeAt(13);if(i>0){let e=t.substr(14,i);e=e.replace(/\0+$/,"");const r="{QQN{xuV?1Dv16j3";let n=r,s=0;for(;n.length<i;)n+=r[s],s++,s===r.length&&(s=0);let o="";for(let t=0;t<i;t++)o+=String.fromCharCode(e.charCodeAt(t)^n.charCodeAt(t));return new URL(`https://${o}`).host}}catch(e){console.error(e)}return null}function M(e){const t=L(e);if(null!=t){const e=t.split(".").slice(1);A.baseUrl=`https://${["sdk",...e].join(".")}`,A.faviconApiUrl=`https://${["favicon",...e].join(".")}`,A.apiUrl=`https://${t}`}}function I(e){let t=e.length;for(let i=e.length-1;i>=0;i--){const r=e.charCodeAt(i);r>127&&r<=2047?t++:r>2047&&r<=65535&&(t+=2),r>=56320&&r<=57343&&i--}return t}class T{constructor(){return this._sdkConfigIsIncorrect=!1,this._userIdByteLimit=255,this._tagsByteLimit=4e3,this.userMessage="",this.tagsMessage="",T.instance||(T.instance=this),T.instance}static getInstance(){return T.instance?T.instance:new T}get sdkConfigIsIncorrect(){return this._sdkConfigIsIncorrect}get sdkConfigErrorsAsArray(){const e=[];return this.userMessage&&e.push(this.userMessage),this.tagsMessage&&e.push(this.tagsMessage),e}checkUserIdLength(e){this.userMessage="",null!=e&&I(String(e))>this._userIdByteLimit&&(console.error(`UserId is bigger then ${this._userIdByteLimit} bytes`),this._sdkConfigIsIncorrect=!0,this.userMessage=`UserId "${String(e)}" is bigger then ${this._userIdByteLimit} bytes`)}checkTagsLength(e){this.tagsMessage="",null!=e&&Array.isArray(e)&&I(e.join(","))>this._tagsByteLimit&&(console.error(`Tags (joined by ',') is bigger then ${this._tagsByteLimit} bytes`),this._sdkConfigIsIncorrect=!0,this.tagsMessage=`Tags (joined by ',') "${e.join(",")}" is bigger then ${this._tagsByteLimit} bytes`)}}var R=function(e,t,i,r){return new(i||(i=Promise))((function(n,s){function o(e){try{l(r.next(e))}catch(e){s(e)}}function a(e){try{l(r.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,a)}l((r=r.apply(e,t||[])).next())}))};const P=`InAppStoryWebSDK/${parseInt(402)} ${navigator.userAgent}`;const D=new class{constructor(){this._deviceInfoPromise=null,this._baseHeaders={},this.requestInterceptors=[],this.interceptors={request:{use:e=>{this.requestInterceptors.push(e)}}}}set deviceInfoPromise(e){this._deviceInfoPromise=e}set baseHeaders(e){this._baseHeaders=e}get baseURL(){return`${A.apiUrl}/v2/`}request(e){return R(this,void 0,void 0,(function*(){return new Promise(((t,i)=>{const r=()=>R(this,void 0,void 0,(function*(){try{if(k(e.headers)&&null!=e.headers||(e.headers={}),e.headers=O(this._baseHeaders,e.headers),this.requestInterceptors.length)for(const t of this.requestInterceptors)t(e);let i="";!C(e.params)&&k(e.params)&&(i=new URLSearchParams(Object.entries(e.params)).toString());let r=new URL(`${E(e.url)}${i?"?"+i:""}`,this.baseURL),n="get";C(e.method)||(n=e.method);let s={};!C(e.headers)&&k(e.headers)&&(s=e.headers);let o=null;!C(e.data)&&k(e.data)&&(o=JSON.stringify(e.data),s["Content-Type"]="application/json");try{if(T.getInstance().sdkConfigIsIncorrect)return void t({data:{name:"SDK config is incorrect",message:T.getInstance().sdkConfigErrorsAsArray.join(". "),status:400},headersRaw:{},headers:{},status:400,statusText:"SDK config is incorrect",ok:!1})}catch(e){console.error(e)}const a=yield fetch(r.toString(),{method:n,body:o,headers:s,credentials:"omit"}),l=yield a.json();t({data:l,headersRaw:a.headers,headers:Object.fromEntries([...a.headers]),status:a.status,statusText:a.statusText,ok:a.ok})}catch(e){i(e)}}));this._deviceInfoPromise?this._deviceInfoPromise.finally(r):r()}))}))}post(e,t){return R(this,void 0,void 0,(function*(){return this.request({method:"post",url:e,data:t})}))}get(e,t){return R(this,void 0,void 0,(function*(){return this.request({method:"get",url:e,params:t})}))}};function N(e,t,i){var r,n,s;if("sendBeacon"in navigator){const a=new URLSearchParams({access_token:o.getState().apiKey,session_id:null===(n=null===(r=m.getState())||void 0===r?void 0:r.session)||void 0===n?void 0:n.id,x_user_agent:P}),l=o.getState();null!=l.appPackageId&&a.append("x_app_package_id",l.appPackageId);const d=`${s=D.baseURL,s.replace(/\/$/,"")}/${E(e)}?${a.toString()}`,c=new FormData;Object.keys(t).forEach((e=>{x.convertModelToFormData(c,t[e],e)}));let u=!1;null!=Array.from&&null!=c.keys&&(u=0===Array.from(c.keys()).length),u||navigator.sendBeacon(d,c),i()}else D.post(e,t).then((()=>i()),(()=>i()))}D.interceptors.request.use((e=>{var t,i,r;const n=o.getState();return e.headers=O(null!==(t=e.headers)&&void 0!==t?t:{},{Authorization:`Bearer ${n.apiKey}`,"Accept-Language":n.lang||"en","Auth-Session-Id":null===(r=null===(i=m.getState())||void 0===i?void 0:i.session)||void 0===r?void 0:r.id,"X-Device-Id":g.getState(),"X-User-Id":n.userId?n.userId:"","X-Request-Id":(0,_.v4)(),"X-User-Agent":P}),null!=n.appPackageId&&(e.headers["X-App-Package-Id"]=n.appPackageId),n.disableDeviceId||(e.headers["X-Device-Id"]=g.getState()),e}));const F=D;var j;!function(e){e.EVENT_UPDATED_COMMON_OPTIONS="updatedCommonOptions",e.EVENT_UPDATED_STORIES_LIST_OPTIONS="updatedStoriesListOptions",e.EVENT_UPDATED_STORY_READER_OPTIONS="updatedStoryReaderOptions",e.EVENT_UPDATED_FAVORITE_READER_OPTIONS="updatedFavoriteReaderOptions",e.EVENT_UPDATED_GAME_READER_OPTIONS="updatedGameReaderOptions",e.EVENT_UPDATED_GOODS_WIDGET_OPTIONS="updatedGoodsWidgetOptions"}(j||(j={}));Error;var B,U=p(46),V=p.n(U);!function(e){e.LEFT="left",e.RIGHT="right"}(B||(B={}));const G={hasFavorite:!1,hasLike:!1,hasShare:!1,closeButtonPosition:B.RIGHT,loader:{default:{color:"white",accentColor:"transparent"},custom:null},closeButton:{svgSrc:{baseState:'<svg width="30" height="30" viewBox="0 0 30 30" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path d="M30 15.2115C30 23.4958 23.2843 30.2115 15 30.2115C6.71573 30.2115 0 23.4958 0 15.2115C0 6.92728 6.71573 0.211548 15 0.211548C23.2843 0.211548 30 6.92728 30 15.2115Z" fill="white"/>\n<path fill-rule="evenodd" clip-rule="evenodd" d="M9.8309 10.0424C10.0969 9.77646 10.5281 9.77646 10.7941 10.0424L15 14.2483L19.2059 10.0424C19.4719 9.77646 19.9031 9.77646 20.1691 10.0424C20.4351 10.3084 20.4351 10.7397 20.1691 11.0057L15.9632 15.2115L20.1691 19.4174C20.4351 19.6834 20.4351 20.1147 20.1691 20.3807C19.9031 20.6466 19.4719 20.6466 19.2059 20.3807L15 16.1748L10.7941 20.3807C10.5281 20.6466 10.0969 20.6466 9.8309 20.3807C9.56492 20.1147 9.56492 19.6834 9.8309 19.4174L14.0368 15.2115L9.8309 11.0057C9.56492 10.7397 9.56492 10.3084 9.8309 10.0424Z" fill="#C2C2C4"/>\n</svg>'}},forceDesktopMode:void 0};var z,W,$,q,H,Z,Q;!function(e){e.CENTER="center",e.LEFT="left",e.RIGHT="right"}(z||(z={})),function(e){e.CIRCLE="circle",e.QUAD="quad",e.RECTANGLE="rectangle"}(W||(W={})),function(e){e.LEFT="left",e.CENTER="center",e.RIGHT="right"}($||($={})),function(e){e.CARD_INSIDE_BOTTOM="cardInsideBottom",e.CARD_OUTSIDE_TOP="cardOutsideTop",e.CARD_OUTSIDE_BOTTOM="cardOutsideBottom"}(q||(q={})),function(e){e.Medium="medium",e.High="high"}(H||(H={})),function(e){e.COLUMN="vertical",e.ROW="horizontal"}(Z||(Z={})),function(e){e.START_LOADER="startLoad",e.END_LOADER="endLoad"}(Q||(Q={}));const X={direction:Z.ROW,card:{title:{font:'14px/1.2 system-ui, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"',color:"#ffffff",padding:15,textAlign:$.LEFT,position:q.CARD_INSIDE_BOTTOM,display:!0,lineClamp:3},gap:10,height:70,aspectRatio:null,coverQuality:H.High,variant:W.CIRCLE,border:{radius:0,color:"black",width:2,gap:3,gradient:null},boxShadow:null,dropShadow:null,opacity:null,mask:{color:null,linearGradient:null},svgMask:null,opened:{border:{radius:null,color:null,width:null,gap:null,gradient:null},boxShadow:null,dropShadow:null,opacity:null,mask:{color:null,linearGradient:null},svgMask:null},coverLazyLoading:!1},favoriteCard:{title:{content:"Избранное",font:"normal",color:"#000",padding:15,textAlign:$.LEFT,position:q.CARD_INSIDE_BOTTOM,display:!0,lineClamp:3},gap:10,height:70,aspectRatio:null,coverQuality:H.High,coverLazyLoading:!1,variant:W.CIRCLE,border:{radius:0,color:"black",width:2,gap:3,gradient:null},boxShadow:null,dropShadow:null,opacity:null,mask:{color:null,linearGradient:null},svgMask:null,opened:{border:{radius:null,color:null,width:null,gap:null,gradient:null},boxShadow:null,dropShadow:null,opacity:null,mask:{color:null,linearGradient:null},svgMask:null}},sidePadding:20,topPadding:20,bottomPadding:20,bottomMargin:17,layout:{height:0,backgroundColor:"transparent",sliderAlign:z.LEFT},navigation:{speed:300,showControls:!1,controlsSize:48,controlsBackgroundColor:"white",controlsColor:"black"},ugcCard:{title:{content:null,font:'14px/1.2 system-ui, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"',color:"#000",padding:15,textAlign:$.LEFT,position:q.CARD_INSIDE_BOTTOM,display:!0,lineClamp:3},gap:10,height:70,aspectRatio:null,coverQuality:H.High,coverLazyLoading:!1,variant:W.CIRCLE,border:{radius:0,color:"transparent",width:0,gap:0,gradient:null},boxShadow:null,dropShadow:null,opacity:null,mask:{color:null,linearGradient:null},svgMask:null,image:{svgSrc:{baseState:'<svg width="100" height="100" viewBox="0 0 100 100" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path d="M50 85.5C69.6061 85.5 85.5 69.6061 85.5 50C85.5 30.3939 69.6061 14.5 50 14.5C30.3939 14.5 14.5 30.3939 14.5 50C14.5 69.6061 30.3939 85.5 50 85.5Z" stroke="white" stroke-width="2"/>\n<path d="M50.5 34.5V65.5" stroke="white" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>\n<path d="M34.5 49.5H65.5" stroke="white" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>\n</svg>\n'}},backgroundColor:"#0c62f3"}},Y={label:"X",icon:{svgSrc:{baseState:'\n<svg width="50px" height="50px" viewBox="0 0 195 195" xmlns="http://www.w3.org/2000/svg">\n<g transform="matrix(.20227 0 0 .20302 -71 -26.7)">\n<circle cx="834.3" cy="610.6" r="481.3" stroke="#fff" strokeMiterlimit="10"/>\n<path d="m537.8 331.8 230 307.6-231.4 250.1h52.2l202.6-219 163.8 219h177.3l-243-324.9 215.5-232.8h-52l-187 201.7-150.7-201.7zm76.6 38.4h81.5l359.7 481h-81.5z" fill="#fff"/>\n</g>\n</svg>\n'}},getUrl:({url:e,text:t})=>`https://twitter.com/share?url=${e}&text=${t}`},K={targets:["vk","ok","facebook","x","linkedin","telegram"],targetParams:{vk:{label:"VK",icon:{svgSrc:{baseState:'\n<svg width="50px" height="50px" viewBox="0 0 48 48" xmlns="http://www.w3.org/2000/svg">\n<circle cx="24" cy="24" r="21.3" fill="#fff"/>\n<path d="M22.3.7a23.3 23.3 0 0 0-5 45.6A23.4 23.4 0 0 0 30.7 1.7C28 .8 25.2.6 22.3.7Zm1.8 14.5c1.2.1 1.8.3 2 .6l.3.6c.2.4.2.8 0 4.3 0 2.2 0 2.9.2 3.4s.7.8 1.1.6a8 8 0 0 0 1.8-2 29 29 0 0 0 3-5.8c.3-.4.5-.7.8-.8h7.1a.7.7 0 0 1 .5.8c0 .7-.8 2.2-2 4a92.7 92.7 0 0 1-3.5 4.8c-.3.5-.2 1 .2 1.6l1.4 1.4c1.8 1.7 2.6 2.6 3.3 3.6.4.7.6 1.2.5 1.7 0 .2-.2.5-.5.6-.4.2-.9.2-3.7.3H34l-.5-.1c-1-.4-1.8-1-3.5-3-.9-1-1.6-1.5-2-1.5-.5 0-1 .6-1.3 1.3-.1.5-.2.8-.2 1.7-.1 1-.2 1.2-.8 1.5H22a9.5 9.5 0 0 1-4.2-1.4c-1.9-1.1-3-2.2-4.4-3.8a48.7 48.7 0 0 1-7.2-12.5c-.1-.5 0-.9.5-1l3-.1h3c.5.3.7.5 1 1.4L16 22c.5.9 1 1.6 1.5 2 .6.6.9.7 1.3.7.3 0 .4-.1.6-.6.5-1 .6-4.8.1-6.3-.2-.8-.6-1.1-1.7-1.3-.2 0-.2-.2 0-.4.4-.6 1.1-.9 2.6-1H24Z" fill="#45668E"/>\n</svg>'}},getUrl:({url:e,text:t})=>`https://vk.com/share.php?url=${e}&title=${t}`},facebook:{label:"Facebook",icon:{svgSrc:{baseState:'\n<svg width="50px" height="50px" viewBox="126.4 2.3 589 589" xmlns="http://www.w3.org/2000/svg">\n<circle cx="420.9" cy="296.8" r="294.5" fill="#3c5a9a"/>\n<path d="M516.7 92.7h-65.2c-38.8 0-81.8 16.3-81.8 72.4.2 19.5 0 38.3 0 59.3h-44.8v71.3h46.2V501h84.8V294.4h56l5-70.2h-62.4V184c0-22.2 23-21 24.4-21h37.8V92.8z" fill="#fff"/>\n</svg>\n'}},getUrl:({url:e,text:t})=>`https://www.facebook.com/sharer.php?u=${e}&t=${t}`},x:Y,twitter:Y,linkedin:{label:"LinkedIn",icon:{svgSrc:{baseState:'\n<svg width="50px" height="50px" enableBackground="new 0 0 550 550" version="1.1" viewBox="0 0 550 550" xmlSpace="preserve" xmlns="http://www.w3.org/2000/svg" xmlnsXlink="http://www.w3.org/1999/xlink">\n<circle cx="275" cy="275" r="256" fill="#04689B"/>\n<path d="m219.2 366.5h-38.8v-124.3h38.8v124.3zm-20.4-139.9h-0.3c-14.1 0-23.2-9.5-23.2-21.6 0-12.3 9.4-21.6 23.7-21.6s23.1 9.3 23.4 21.5c0.1 12.2-9 21.7-23.6 21.7zm175.8 139.9h-44v-64.3c0-16.8-6.9-28.3-22-28.3-11.6 0-18 7.7-21 15.2-1.1 2.7-0.9 6.4-0.9 10.2v67.3h-43.7s0.6-113.9 0-124.3h43.6v19.5c2.6-8.5 16.5-20.7 38.8-20.7 27.6 0 49.3 17.9 49.3 56.4v69z" fill="#fff"/>\n</svg>\n'}},getUrl:({url:e,text:t})=>`https://www.linkedin.com/sharing/share-offsite/?url=${e}&title=${t}`},telegram:{label:"Telegram",icon:{svgSrc:{baseState:'<svg data-v-05f1b0f5="" data-v-b5b60290="" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 240 240" width="50px" height="50px"><defs data-v-05f1b0f5=""><linearGradient data-v-05f1b0f5="" id="a" x1="120" y1="240" x2="120" gradientUnits="userSpaceOnUse"><stop data-v-05f1b0f5="" offset="0" stop-color="#1d93d2"></stop><stop data-v-05f1b0f5="" offset="1" stop-color="#38b0e3"></stop></linearGradient></defs><circle data-v-05f1b0f5="" cx="120" cy="120" r="120" fill="url(#a)"></circle><path data-v-05f1b0f5="" d="m81.2 128.8 14.3 39.4s1.7 3.7 3.7 3.7 30.2-29.5 30.2-29.5l31.5-61-79.2 37.2Z" fill="#c8daea"></path><path data-v-05f1b0f5="" d="m100.1 138.9-2.7 29s-1.2 9 7.7 0 17.4-15.7 17.4-15.7" fill="#a9c6d8"></path><path data-v-05f1b0f5="" d="m81.5 130.2-29.3-9.6s-3.5-1.4-2.4-4.6c.3-.7.7-1.2 2.1-2.2C58.4 109.3 172 68.4 172 68.4s3.2-1 5.1-.3a2.8 2.8 0 0 1 2 2 9.4 9.4 0 0 1 .2 2.6l-.2 2.6c-.7 11.1-21.4 94.4-21.4 94.4s-1.2 5-5.7 5a8.1 8.1 0 0 1-5.9-2.2 797.1 797.1 0 0 0-45.5-32.2 1.3 1.3 0 0 1-.5-.9c-.1-.4.4-1 .4-1s52.4-46.6 53.8-51.5c.1-.4-.3-.6-.8-.4C150 87.8 89.6 125.9 83 130a3.2 3.2 0 0 1-1.5 0Z" fill="#fff"></path></svg>\n'}},getUrl:({url:e,text:t})=>`https://t.me/share/url?url=${e}&text=${t}`},ok:{label:"OK",icon:{svgSrc:{baseState:'\n<svg width="50px" height="50px" viewBox="0 0 388.4 387.1" xmlSpace="preserve" xmlns="http://www.w3.org/2000/svg">\n<path d="M331.7 330.2a194.2 193.5 0 0 1-273.9 1.1 194.2 193.5 0 0 1-2.6-272.9A194.2 193.5 0 0 1 329 54.2a194.2 193.5 0 0 1 5.7 273" fill="#faab62" style="mixBlendMode:normal"/>\n<path d="m328.7 327.1a189.2 188.5 0 0 1-266.9 1.2 189.2 188.5 0 0 1-2.5-266 189.2 188.5 0 0 1 266.7-4 189.2 188.5 0 0 1 5.6 265.9" fill="#f7931e" style="mixBlendMode:normal"/>\n<g fill="#fff" style="mixBlendMode:normal">\n<path d="m217.4 253.5c28-5.7 44.7-19 45.6-19.7a19 19 0 0 0-23.8-29.6c-0.2 0.1-18 13.8-47.5 13.8a84.5 84.5 0 0 1-47.8-13.8 19 19 0 0 0-23.8 29.6c1 0.7 18.4 14.3 47.1 19.9l-40 41.9a19 19 0 1 0 27.3 26.3l37.2-39.6 41 39.9a19 19 0 1 0 26.9-26.9z"/>\n<path transform="translate(-1.8 .2)" d="m194.5 57.9a69.9 69.9 0 1 0 0 139.8 69.9 69.9 0 0 0 0-139.8zm0 98.8a28.9 28.9 0 1 1 0-57.8 28.9 28.9 0 0 1 0 57.8z" style="mixBlendMode:normal"/>\n</g>\n</svg>\n'}},getUrl:({url:e,text:t})=>`https://connect.ok.ru/offer?url=${e}&title=${t}`}},copyButton:{label:"Copy link",svgSrc:{baseState:'<svg width="31.5px" height="35px" fill="none" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 18 20"><path d="M6.6 0a2 2 0 0 0-2 2v12c0 1.2.9 2 2 2h9a2 2 0 0 0 2-2V2a2 2 0 0 0-2-2h-9Zm0 2h9v12h-9V2Z" fill="currentColor"/><path d="M2.6 20a2 2 0 0 1-2-2V5h2v13h10v2h-10Z" fill="currentColor"/></svg>'}},downloadButton:{svgSrc:{baseState:'<svg width="30" height="30" viewBox="0 0 32 32" xml:space="preserve" xmlns="http://www.w3.org/2000/svg"><g fill="currentColor"><path d="M31 22a1 1 0 0 0-1 1v7H2v-7a1 1 0 0 0-2 0v8c0 .6.4 1 1 1h30c.6 0 1-.4 1-1v-8c0-.6-.4-1-1-1z"/><path d="M15.3 23.7c.4.4 1 .4 1.4 0l7-6.9c.4-.4.4-1 0-1.4a1 1 0 0 0-1.4 0L17 20.6V1a1 1 0 0 0-2 0v19.6l-5.3-5.2a1 1 0 0 0-1.4 0 1 1 0 0 0 0 1.4l7 7z"/></g></svg>'}},title:{favicon:{background:"white",display:!0},getValue:({url:e})=>e},background:"#202125",borderRadius:20,divider:{background:"#36373b"},text:{color:"white",font:"inherit"}};var J;!function(e){e.FLAT="flat",e.COVER="cover",e.CUBE="cube"}(J||(J={}));const ee={gameReaderOptions:{loader:{default:{color:"white",accentColor:"transparent"},custom:null}},scrollStyle:J.FLAT,timelineBlockTopOffset:8,actionPanelBottomOffset:0,borderRadius:12,loader:{default:{color:"white",accentColor:"transparent"},custom:null},recycleStoriesList:!1,closeOnLastSlideByTimer:!0,sharePanel:K,commonBackdrop:{color:"rgba(51, 51, 51, 1)",backdropFilter:null},slideBackdrop:{opacity:.56,blur:30,linearGradientOverlay:["rgba(0, 0, 0, 0.1) 0%","rgba(0, 0, 0, 0.9) 100%"]},faviconApiUrl:"",navigation:{prevButton:{svgSrc:{baseState:'<svg width="32" height="32" viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg">\n <path d="M19.8076 6.80761L9.20101 17.4142L7.7868 16L18.3934 5.3934L19.8076 6.80761Z" fill="currentColor" />\n <path d="M18.3934 26.6066L7.7868 16L9.20101 14.5858L19.8076 25.1924L18.3934 26.6066Z" fill="currentColor" />\n </svg>'}},nextButton:{svgSrc:{baseState:'<svg width="32" height="32" viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg">\n <path d="M12.1924 25.1924L22.799 14.5858L24.2132 16L13.6066 26.6066L12.1924 25.1924Z" fill="currentColor" />\n <path d="M13.6066 5.3934L24.2132 16L22.799 17.4142L12.1924 6.80761L13.6066 5.3934Z" fill="currentColor" />\n </svg>'}}},likeButton:{svgSrc:{baseState:'<svg width="30" height="30" viewBox="0 0 30 30" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path d="M6.96277 15.177L8.11552 15.1837C8.75334 15.1873 9.26846 15.7054 9.26846 16.3433V22.7329C9.26846 23.376 8.74519 23.8962 8.10215 23.8925L6.94939 23.8859C6.31157 23.8822 5.79645 23.3641 5.79645 22.7263V16.3366C5.79645 15.6936 6.31972 15.1733 6.96277 15.177Z" stroke="white" stroke-width="1.21546"/>\n<path d="M11.2546 15.0917L11.3801 23.0645C11.3867 23.4802 11.6013 23.8648 11.9516 24.0886C12.119 24.1955 12.4834 24.2735 12.4834 24.2735L13.1084 24.3569L13.9973 24.4541L15.9789 24.5912L17.4834 24.6365H18.9642L19.282 24.6229C19.7715 24.6018 20.258 24.5358 20.7354 24.4256L21.1038 24.3406C21.3122 24.2925 21.516 24.2263 21.7128 24.1428L21.7439 24.1295C22.0493 23.9999 22.3342 23.8269 22.59 23.6157L22.717 23.5108C22.873 23.382 23.0108 23.2326 23.1265 23.0666L23.1451 23.04C23.2426 22.9003 23.3217 22.7485 23.3804 22.5886L23.428 22.4586C23.5278 22.1867 23.5473 21.8918 23.4842 21.6092L23.4296 21.3645C23.4285 21.3594 23.4265 21.3544 23.4237 21.3499C23.4102 21.3285 23.4163 21.3002 23.4374 21.2862L23.7911 21.0504V21.0504C23.8452 21.0143 23.8957 20.9723 23.9416 20.9263V20.9263C23.99 20.8728 24.0444 20.8083 24.0805 20.7458L24.1361 20.6625C24.2924 20.3945 24.3931 20.0167 24.4083 19.7069L24.4118 19.6352C24.4205 19.458 24.4079 19.2804 24.3744 19.1062L24.3305 18.8986C24.325 18.8696 24.2749 18.7163 24.2611 18.6902L24.1718 18.5154C24.1644 18.5014 24.1898 18.473 24.1898 18.473L24.3653 18.2658C24.4983 18.1109 24.6033 17.9305 24.673 17.7386C24.7222 17.6035 24.7532 17.4657 24.775 17.3153L24.7889 17.1764L24.7957 17.0468C24.8164 16.8366 24.7978 16.6244 24.7409 16.421C24.6929 16.2496 24.6183 16.0868 24.5198 15.9385L24.1983 15.4542C24.1843 15.4367 24.1808 15.413 24.1891 15.3922L24.3081 15.1055C24.3652 14.9628 24.4224 14.6641 24.4391 14.4717L24.4307 14.2984C24.4026 14.0113 24.2405 13.6815 24.0757 13.4238L23.9912 13.3055C23.7236 12.9608 23.3474 12.7334 22.9388 12.5804L22.706 12.4932C22.3923 12.3758 22.0667 12.3327 21.7279 12.2916L21.3444 12.2597C20.89 12.2378 20.2444 12.2651 19.7945 12.3327L18.1092 12.5861C18.1014 12.5873 18.0935 12.5879 18.0857 12.5879H18.0692C17.991 12.5879 17.9276 12.5245 17.9276 12.4462C17.9276 12.4387 17.9282 12.4312 17.9293 12.4238L18.1222 11.3847L18.5408 9.72426C18.6303 9.39087 18.6888 9.04995 18.7158 8.70582L18.7581 8.1657C18.7857 7.81269 18.746 7.45764 18.6411 7.11944L18.6144 7.03332C18.52 6.72899 18.3649 6.44697 18.1583 6.20434L18.1116 6.14941C17.819 5.80563 17.4249 5.56351 16.9859 5.45788L16.7169 5.39313C16.4437 5.32739 16.1567 5.3518 15.8986 5.46269C15.6593 5.56548 15.4564 5.73766 15.316 5.95699L15.2994 5.98302C15.155 6.20866 15.0783 6.47094 15.0783 6.73882V7.10777C15.0783 7.45352 15.0109 7.79596 14.88 8.11598L14.1668 9.85969C13.9176 10.4691 13.6196 11.0573 13.2758 11.6188L12.5778 12.7586C12.4514 12.9651 12.3013 13.1561 12.1306 13.3278L12.0855 13.3731C11.6243 13.837 11.3317 14.442 11.2546 15.0917Z" stroke="white" stroke-width="1.21546"/>\n</svg>',activeState:'<svg width="30" height="30" viewBox="0 0 30 30" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path d="M6.96277 15.1771L8.11552 15.1838C8.75334 15.1875 9.26846 15.7056 9.26846 16.3434V22.733C9.26846 23.3761 8.74519 23.8964 8.10215 23.8926L6.94939 23.886C6.31157 23.8823 5.79645 23.3642 5.79645 22.7264V16.3368C5.79645 15.6937 6.31972 15.1734 6.96277 15.1771Z" fill="white" stroke="white" stroke-width="1.21546"/>\n<path d="M11.2546 15.0918L11.3801 23.0646C11.3867 23.4803 11.6013 23.8649 11.9516 24.0888C12.119 24.1957 12.4834 24.2737 12.4834 24.2737L13.1084 24.357L13.9973 24.4542L15.9789 24.5913L17.4834 24.6367H18.9642L19.282 24.623C19.7715 24.6019 20.258 24.5359 20.7354 24.4257L21.1038 24.3407C21.3122 24.2926 21.516 24.2264 21.7128 24.1429L21.7439 24.1297C22.0493 24.0001 22.3342 23.827 22.59 23.6158L22.717 23.5109C22.873 23.3821 23.0108 23.2327 23.1265 23.0668L23.1451 23.0401C23.2426 22.9004 23.3217 22.7487 23.3804 22.5887L23.428 22.4588C23.5278 22.1868 23.5473 21.892 23.4842 21.6093L23.4296 21.3647C23.4285 21.3595 23.4265 21.3545 23.4237 21.3501C23.4102 21.3286 23.4163 21.3004 23.4374 21.2863L23.7911 21.0505V21.0505C23.8452 21.0144 23.8957 20.9724 23.9416 20.9265V20.9265C23.99 20.8729 24.0444 20.8084 24.0805 20.7459L24.1361 20.6626C24.2924 20.3946 24.3931 20.0168 24.4083 19.707L24.4118 19.6353C24.4205 19.4581 24.4079 19.2805 24.3744 19.1063L24.3305 18.8987C24.325 18.8697 24.2749 18.7165 24.2611 18.6904L24.1718 18.5155C24.1644 18.5015 24.1898 18.4732 24.1898 18.4732L24.3653 18.2659C24.4983 18.1111 24.6033 17.9306 24.673 17.7387C24.7222 17.6036 24.7532 17.4658 24.775 17.3154L24.7889 17.1765L24.7957 17.0469C24.8164 16.8367 24.7978 16.6245 24.7409 16.4211C24.6929 16.2497 24.6183 16.0869 24.5198 15.9386L24.1983 15.4543C24.1843 15.4368 24.1808 15.4131 24.1891 15.3923L24.3081 15.1056C24.3652 14.9629 24.4224 14.6642 24.4391 14.4718L24.4307 14.2985C24.4026 14.0114 24.2405 13.6817 24.0757 13.4239L23.9912 13.3056C23.7236 12.9609 23.3474 12.7336 22.9388 12.5805L22.706 12.4934C22.3923 12.3759 22.0667 12.3329 21.7279 12.2918L21.3444 12.2598C20.89 12.2379 20.2444 12.2652 19.7945 12.3329L18.1092 12.5863C18.1014 12.5874 18.0935 12.588 18.0857 12.588H18.0692C17.991 12.588 17.9276 12.5246 17.9276 12.4464C17.9276 12.4389 17.9282 12.4313 17.9293 12.4239L18.1222 11.3849L18.5408 9.72438C18.6303 9.391 18.6888 9.05007 18.7158 8.70594L18.7581 8.16582C18.7857 7.81281 18.746 7.45776 18.6411 7.11956L18.6144 7.03344C18.52 6.72911 18.3649 6.4471 18.1583 6.20446L18.1116 6.14953C17.819 5.80575 17.4249 5.56363 16.9859 5.458L16.7169 5.39325C16.4437 5.32751 16.1567 5.35192 15.8986 5.46281C15.6593 5.5656 15.4564 5.73778 15.316 5.95711L15.2994 5.98314C15.155 6.20878 15.0783 6.47106 15.0783 6.73895V7.10789C15.0783 7.45364 15.0109 7.79608 14.88 8.1161L14.1668 9.85982C13.9176 10.4692 13.6196 11.0574 13.2758 11.6189L12.5778 12.7588C12.4514 12.9652 12.3013 13.1562 12.1306 13.3279L12.0855 13.3732C11.6243 13.8371 11.3317 14.4421 11.2546 15.0918Z" fill="white" stroke="white" stroke-width="1.21546"/>\n</svg>'}},dislikeButton:{svgSrc:{baseState:'<svg width="30" height="30" viewBox="0 0 30 30" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path d="M24.2033 13.6632C24.2033 14.3062 23.68 14.8265 23.037 14.8228L21.8842 14.8161C21.2464 14.8125 20.7313 14.2944 20.7313 13.6565V7.2669C20.7313 6.62385 21.2546 6.10359 21.8976 6.1073L23.0504 6.11395C23.6882 6.11762 24.2033 6.63572 24.2033 7.27355V13.6632Z" stroke="white" stroke-width="1.21547"/>\n<path d="M18.7451 14.9082L18.6196 6.93531C18.6131 6.51965 18.3984 6.13499 18.0481 5.91118C17.8808 5.80428 17.5164 5.72628 17.5164 5.72628L16.8914 5.64295L16.0025 5.54572L14.0208 5.4086L12.5164 5.36328H11.0356L10.7178 5.37695C10.2283 5.398 9.74173 5.46403 9.26432 5.57421L8.89596 5.65921C8.68758 5.7073 8.4838 5.7735 8.28695 5.85706L8.25581 5.87027C7.95049 5.99987 7.66551 6.17296 7.40975 6.38416L7.28278 6.48901C7.12677 6.61783 6.989 6.76725 6.87323 6.93318L6.85466 6.95981C6.75716 7.09955 6.67809 7.25128 6.6194 7.41124L6.57172 7.54119C6.47196 7.81311 6.45245 8.10797 6.51553 8.39066L6.57011 8.63528C6.57127 8.64045 6.57329 8.64539 6.5761 8.64989C6.58951 8.67134 6.58343 8.69958 6.56238 8.71361L6.20864 8.94944V8.94944C6.15453 8.98551 6.10408 9.0275 6.05811 9.07348V9.07348C6.00973 9.12703 5.95532 9.19155 5.91922 9.25403L5.86366 9.33737C5.70735 9.60533 5.60662 9.98309 5.59145 10.2929L5.58794 10.3646C5.57927 10.5418 5.59182 10.7194 5.62532 10.8937L5.66922 11.1012C5.6748 11.1302 5.72484 11.2835 5.73866 11.3096L5.82792 11.4845C5.83532 11.4984 5.80994 11.5268 5.80994 11.5268L5.63444 11.734C5.50143 11.8889 5.3965 12.0693 5.32674 12.2612C5.27758 12.3964 5.24658 12.5341 5.22478 12.6846L5.21089 12.8235L5.20405 12.953C5.18333 13.1632 5.20192 13.3755 5.25887 13.5788C5.30686 13.7503 5.38145 13.9131 5.47991 14.0614L5.80147 14.5456C5.81547 14.5631 5.81898 14.5868 5.81066 14.6076L5.69163 14.8944C5.63456 15.037 5.57739 15.3357 5.56065 15.5282L5.5691 15.7014C5.5972 15.9885 5.75924 16.3183 5.92402 16.576L6.00853 16.6943C6.2762 17.039 6.65231 17.2664 7.06099 17.4194L7.2938 17.5066C7.60742 17.624 7.93309 17.6671 8.27189 17.7082L8.65531 17.7401C9.10973 17.762 9.75538 17.7347 10.2053 17.6671L11.8906 17.4137C11.8984 17.4125 11.9062 17.4119 11.9141 17.4119H11.9305C12.0088 17.4119 12.0722 17.4753 12.0722 17.5536C12.0722 17.5611 12.0716 17.5686 12.0704 17.576L11.8775 18.6151L11.459 20.2756C11.3695 20.6089 11.3109 20.9499 11.284 21.294L11.2417 21.8341C11.214 22.1871 11.2537 22.5422 11.3586 22.8804L11.3853 22.9665C11.4797 23.2708 11.6349 23.5528 11.8414 23.7955L11.8882 23.8504C12.1808 24.1942 12.5749 24.4363 13.0138 24.5419L13.2829 24.6067C13.556 24.6724 13.8431 24.648 14.1012 24.5371C14.3404 24.4343 14.5434 24.2622 14.6837 24.0428L14.7004 24.0168C14.8448 23.7912 14.9215 23.5289 14.9215 23.261V22.892C14.9215 22.5463 14.9888 22.2039 15.1197 21.8838L15.8329 20.1401C16.0821 19.5308 16.3801 18.9425 16.7239 18.381L17.4219 17.2412C17.5483 17.0347 17.6984 16.8437 17.8691 16.6721L17.9142 16.6267C18.3755 16.1629 18.668 15.5578 18.7451 14.9082Z" stroke="white" stroke-width="1.21547"/>\n</svg>',activeState:'<svg width="30" height="30" viewBox="0 0 30 30" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path d="M24.2035 13.6629C24.2035 14.3059 23.6803 14.8262 23.0372 14.8225L21.8845 14.8158C21.2466 14.8122 20.7315 14.2941 20.7315 13.6562V7.26655C20.7315 6.62348 21.2548 6.10322 21.8978 6.10693L23.0506 6.11358C23.6884 6.11725 24.2035 6.63535 24.2035 7.27319V13.6629Z" fill="white" stroke="white" stroke-width="1.21547"/>\n<path d="M18.7454 14.9079L18.6199 6.93496C18.6133 6.51929 18.3987 6.13463 18.0484 5.91082C17.881 5.80392 17.5166 5.72592 17.5166 5.72592L16.8916 5.64258L16.0027 5.54536L14.021 5.40824L12.5166 5.36292H11.0358L10.718 5.37659C10.2285 5.39764 9.74192 5.46367 9.26451 5.57384L8.89614 5.65885C8.68776 5.70694 8.48398 5.77314 8.28713 5.8567L8.25599 5.86991C7.95066 5.99951 7.66569 6.1726 7.40992 6.3838L7.28295 6.48865C7.12694 6.61747 6.98917 6.7669 6.8734 6.93283L6.85483 6.95946C6.75733 7.0992 6.67826 7.25093 6.61957 7.41088L6.57189 7.54084C6.47212 7.81276 6.45262 8.10762 6.5157 8.39032L6.57028 8.63494C6.57143 8.64011 6.57346 8.64505 6.57627 8.64954C6.58968 8.671 6.5836 8.69923 6.56255 8.71327L6.2088 8.9491C6.1547 8.98517 6.10425 9.02716 6.05827 9.07314C6.0099 9.12669 5.95549 9.19121 5.91938 9.25369L5.86383 9.33703C5.70751 9.60499 5.60678 9.98276 5.59161 10.2926L5.58811 10.3643C5.57943 10.5415 5.59198 10.7191 5.62549 10.8933L5.66938 11.1009C5.67496 11.1299 5.72501 11.2831 5.73883 11.3092L5.82808 11.4841C5.83549 11.4981 5.8101 11.5264 5.8101 11.5264L5.63461 11.7337C5.50159 11.8886 5.39666 12.069 5.3269 12.2609C5.27775 12.396 5.24674 12.5338 5.22494 12.6842L5.21105 12.8231L5.20421 12.9527C5.18349 13.1629 5.20208 13.3751 5.25903 13.5785C5.30702 13.7499 5.38161 13.9128 5.48007 14.061L5.80163 14.5453C5.81564 14.5628 5.81915 14.5865 5.81082 14.6073L5.69179 14.894C5.63472 15.0367 5.57755 15.3354 5.56081 15.5279L5.56926 15.7011C5.59737 15.9882 5.7594 16.318 5.92419 16.5757L6.0087 16.694C6.27636 17.0387 6.65248 17.2661 7.06116 17.4191L7.29397 17.5063C7.6076 17.6237 7.93327 17.6668 8.27207 17.7079L8.65549 17.7398C9.10991 17.7617 9.75557 17.7344 10.2055 17.6668L11.8908 17.4134C11.8986 17.4122 11.9064 17.4116 11.9143 17.4116H11.9307C12.009 17.4116 12.0724 17.4751 12.0724 17.5533C12.0724 17.5608 12.0718 17.5683 12.0706 17.5757L11.8777 18.6148L11.4592 20.2753C11.3697 20.6087 11.3111 20.9496 11.2842 21.2937L11.2419 21.8339C11.2142 22.1869 11.2539 22.5419 11.3588 22.8801L11.3855 22.9662C11.4799 23.2706 11.6351 23.5526 11.8416 23.7952L11.8884 23.8502C12.181 24.1939 12.5751 24.4361 13.014 24.5417L13.2831 24.6064C13.5562 24.6722 13.8433 24.6478 14.1014 24.5369C14.3407 24.4341 14.5436 24.2619 14.6839 24.0426L14.7006 24.0166C14.845 23.7909 14.9217 23.5286 14.9217 23.2607V22.8918C14.9217 22.546 14.989 22.2036 15.1199 21.8836L15.8331 20.1399C16.0824 19.5305 16.3803 18.9422 16.7241 18.3808L17.4221 17.2409C17.5486 17.0344 17.6987 16.8434 17.8694 16.6718L17.9144 16.6264C18.3757 16.1626 18.6683 15.5575 18.7454 14.9079Z" fill="white" stroke="white" stroke-width="1.21547"/>\n</svg>'}},favoriteButton:{svgSrc:{baseState:'<svg width="30" height="30" viewBox="0 0 30 30" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path d="M7.49976 7.25225V23.2366C7.49976 24.6882 9.33429 25.321 10.2292 24.1782L13.7974 19.6218C14.4088 18.8411 15.5907 18.8411 16.2021 19.6218L19.7703 24.1782C20.6652 25.321 22.4998 24.6882 22.4998 23.2366V7.25225C22.4998 5.98711 21.4742 4.96152 20.209 4.96152H9.79048C8.52535 4.96152 7.49976 5.98712 7.49976 7.25225Z" stroke="white" stroke-width="1.29808"/>\n</svg>',activeState:'<svg width="30" height="30" viewBox="0 0 30 30" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path d="M7.49976 7.04073V23.0251C7.49976 24.4767 9.33429 25.1095 10.2292 23.9667L13.7974 19.4103C14.4088 18.6296 15.5907 18.6296 16.2021 19.4103L19.7703 23.9667C20.6652 25.1095 22.4998 24.4766 22.4998 23.0251V7.04072C22.4998 5.77559 21.4742 4.75 20.209 4.75H9.79048C8.52535 4.75 7.49976 5.77559 7.49976 7.04073Z" fill="white" stroke="white" stroke-width="1.29808"/>\n</svg>'}},muteButton:{svgSrc:{baseState:'<svg width="30" height="31" viewBox="0 0 30 31" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path d="M3.40625 13.5734V18.7664C3.40625 19.7239 4.18245 20.5001 5.13993 20.5001H8.04633C8.6342 20.5001 9.17511 20.8213 9.45654 21.3374L11.903 25.8242C12.271 26.4992 12.9783 26.9192 13.7471 26.9192C14.9072 26.9192 15.8477 25.9788 15.8477 24.8187V7.52486C15.8477 6.36469 14.9072 5.42416 13.747 5.42412C12.9783 5.42409 12.2709 5.84393 11.9028 6.51875L9.45651 11.0026C9.17509 11.5184 8.63442 11.8394 8.04683 11.8394H5.14027C4.1826 11.8394 3.40625 12.6157 3.40625 13.5734Z" fill="white"/>\n<path d="M19.8477 13.0466L26.0976 19.2966M26.0976 13.0466L19.8477 19.2966" stroke="white" stroke-width="1.2" stroke-linecap="round" stroke-linejoin="round"/>\n</svg>',activeState:'<svg width="30" height="30" viewBox="0 0 30 30" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path d="M3.40625 12.5733V17.7663C3.40625 18.7238 4.18245 19.5 5.13993 19.5H8.04633C8.6342 19.5 9.17511 19.8212 9.45654 20.3373L11.903 24.8241C12.271 25.4991 12.9783 25.919 13.7471 25.9191C14.9072 25.9191 15.8477 24.9787 15.8477 23.8186V6.52474C15.8477 5.36457 14.9072 4.42404 13.747 4.424C12.9783 4.42397 12.2709 4.84381 11.9028 5.51863L9.45651 10.0025C9.17509 10.5183 8.63442 10.8392 8.04683 10.8392H5.14027C4.1826 10.8392 3.40625 11.6156 3.40625 12.5733Z" fill="white"/>\n<path d="M19.8477 11.4215C20.6323 12.4661 21.0972 13.7645 21.0972 15.1715C21.0972 16.5785 20.6323 17.8769 19.8477 18.9215M22.3472 6.78613C24.6487 8.84608 26.0972 11.8396 26.0972 15.1715C26.0972 18.5034 24.6487 21.4969 22.3472 23.5569" stroke="white" stroke-width="1.2" stroke-linecap="round" stroke-linejoin="round"/>\n</svg>'}},shareButton:{svgSrc:{baseState:'<svg width="30" height="31" viewBox="0 0 30 31" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path fill-rule="evenodd" clip-rule="evenodd" d="M19.5 10.9038C20.8488 10.9038 21.9423 9.81036 21.9423 8.46151C21.9423 7.11266 20.8488 6.01921 19.5 6.01921C18.1512 6.01921 17.0577 7.11266 17.0577 8.46151C17.0577 9.81036 18.1512 10.9038 19.5 10.9038ZM19.5 12.2115C21.5711 12.2115 23.25 10.5326 23.25 8.46151C23.25 6.39045 21.5711 4.71151 19.5 4.71151C17.4289 4.71151 15.75 6.39045 15.75 8.46151C15.75 8.98692 15.8581 9.48709 16.0531 9.94101L12.288 12.4511C11.6202 11.8367 10.7288 11.4615 9.74976 11.4615C7.67869 11.4615 5.99976 13.1404 5.99976 15.2115C5.99976 17.2826 7.67869 18.9615 9.74976 18.9615C10.7325 18.9615 11.6269 18.5835 12.2956 17.9649L16.018 20.5665C15.8451 20.9977 15.75 21.4685 15.75 21.9615C15.75 24.0326 17.4289 25.7115 19.5 25.7115C21.5711 25.7115 23.25 24.0326 23.25 21.9615C23.25 19.8904 21.5711 18.2115 19.5 18.2115C18.3369 18.2115 17.2974 18.7411 16.6096 19.5722L13.0138 17.0591C13.3231 16.5138 13.4998 15.8833 13.4998 15.2115C13.4998 14.5368 13.3216 13.9037 13.0097 13.3567L16.667 10.9185C17.3545 11.7106 18.3688 12.2115 19.5 12.2115ZM12.1921 15.2115C12.1921 16.5604 11.0986 17.6538 9.74976 17.6538C8.40091 17.6538 7.30745 16.5604 7.30745 15.2115C7.30745 13.8627 8.40091 12.7692 9.74976 12.7692C11.0986 12.7692 12.1921 13.8627 12.1921 15.2115ZM21.9423 21.9615C21.9423 23.3104 20.8488 24.4038 19.5 24.4038C18.1512 24.4038 17.0577 23.3104 17.0577 21.9615C17.0577 20.6127 18.1512 19.5192 19.5 19.5192C20.8488 19.5192 21.9423 20.6127 21.9423 21.9615Z" fill="white"/>\n</svg>'}}};var te;!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"}(te||(te={}));const ie={title:{content:"Favorite",font:"1.4rem/1.2 InternalPrimaryFont",color:"white",backgroundColor:"#333333"},headerTopOffset:0,bottomOffset:0,backgroundColor:"#333333"};var re,ne=p(2743),se=p.n(ne);!function(e){e.DEFAULT="default",e.CUSTOM_CARD="customCard"}(re||(re={}));const oe={goodsWidgetRenderingType:re.DEFAULT,goodsList:{renderingType:re.DEFAULT,closeBackgroundColor:"#000000",substrateHeight:200,substrateColor:"#FFFFFF",dimColor:"rgba(0, 0, 0, 0.5)"},goodsCard:{mainTextColor:"#000000",oldPriceTextColor:"#CCCCCC",imageBackgroundColor:"transparent",imageCornerRadius:8},openGoodsWidgetHandler:e=>Promise.resolve(e),loader:{default:{color:"gray",accentColor:"transparent"}}},ae={loader:{default:{color:"white",accentColor:"transparent"},custom:null},backdropColor:"#1a1a1a",backdrop:{opacity:1,background:"#1a1a1a"},game:{backdropColor:"rgb(51, 51, 51)"},forceDesktopMode:G.forceDesktopMode,forceCheckOrientation:!0};class le extends U.EventEmitter{constructor(){super(),this._commonOptions=G,this._storiesListOptions=X,this._storyReaderOptions=ee,this._storyFavoriteReaderOptions=ie,this._goodsWidgetOptions=oe,this._gameReaderOptions=ae,this._mqls=new Map,this._composeOptionsOverrideByMediaQuery=this._composeOptionsOverrideByMediaQuery.bind(this)}setCommonOptions(e,t=!0){return this._commonOptions=se()(this._commonOptions,e),this.emit(j.EVENT_UPDATED_COMMON_OPTIONS,this.commonOptions),this}get commonOptions(){return this._commonOptions}setStoriesListOptions(e,t=!0){return this._storiesListOptions=se()(this._storiesListOptions,e),t&&this.emit(j.EVENT_UPDATED_STORIES_LIST_OPTIONS,this.storiesListOptions),this}get storiesListOptions(){return this._storiesListOptions}setStoryReaderOptions(e,t=!0){return this._storyReaderOptions=se()(this._storyReaderOptions,e,{arrayMerge:(e,t,i)=>t}),t&&this.emit(j.EVENT_UPDATED_STORY_READER_OPTIONS,{storyReaderOptions:this.storyReaderOptions,gameReaderOptions:this.gameReaderOptions,appearanceCommon:this.commonOptions}),this}get storyReaderOptions(){const e={closeButtonPosition:this.commonOptions.closeButtonPosition,closeButton:this.commonOptions.closeButton,loader:this.commonOptions.loader};return Object.assign(Object.assign({},e),this._storyReaderOptions)}setStoryFavoriteReaderOptions(e,t=!0){return this._storyFavoriteReaderOptions=se()(this._storyFavoriteReaderOptions,e),t&&this.emit(j.EVENT_UPDATED_FAVORITE_READER_OPTIONS,this.storyFavoriteReaderOptions),this}get storyFavoriteReaderOptions(){const e={closeButtonPosition:this.commonOptions.closeButtonPosition,closeButton:this.commonOptions.closeButton};return Object.assign(Object.assign({},e),this._storyFavoriteReaderOptions)}setGoodsWidgetOptions(e,t=!0){return this._goodsWidgetOptions=se()(this._goodsWidgetOptions,e),t&&this.emit(j.EVENT_UPDATED_GOODS_WIDGET_OPTIONS,this.goodsWidgetOptions),this}get goodsWidgetOptions(){return this._goodsWidgetOptions}setGameReaderOptions(e,t=!0){return this._gameReaderOptions=se()(this._gameReaderOptions,e),t&&this.emit(j.EVENT_UPDATED_GAME_READER_OPTIONS,this.gameReaderOptions),this}get gameReaderOptions(){const e={closeButtonPosition:this.commonOptions.closeButtonPosition,closeButton:this.commonOptions.closeButton,loader:this.commonOptions.loader,forceDesktopMode:this.commonOptions.forceDesktopMode};return Object.assign(Object.assign({},e),this._gameReaderOptions)}setOptionsOverrideByMediaQuery(e){return this.removeMediaQueryEventListeners(),this.initMediaQueries(e),this}initMediaQueries(e){for(const t of e){const e=this._composeMqlCondition(t);if(null!==e&&null!=window.matchMedia){const i=window.matchMedia(e);this._mqls.set(i,t),i.addEventListener("change",this._composeOptionsOverrideByMediaQuery)}}this._composeOptionsOverrideByMediaQuery()}_composeMqlCondition(e){let t=null;if(null!=e.viewportMinSize){if("number"==typeof e.viewportMinSize)t=`(min-width: ${e.viewportMinSize}px)`;else if("string"==typeof e.viewportMinSize)switch(e.viewportMinSize){case"sm":t="(min-width: 576px)";break;case"md":t="(min-width: 768px)";break;case"lg":t="(min-width: 992px)";break;case"xl":t="(min-width: 1200px)";break;default:t=null}null!=e.mediaQuery&&"string"==typeof e.mediaQuery&&e.mediaQuery.length>0&&(t=e.mediaQuery)}return t}_composeOptionsOverrideByMediaQuery(e){const t=new Set;for(const[e,i]of this._mqls)e.matches&&(null!=i.commonOptions&&(this.setCommonOptions(i.commonOptions,!1),t.add("commonOptions")),null!=i.storiesListOptions&&(this.setStoriesListOptions(i.storiesListOptions,!0),t.add("storiesListOptions")),null!=i.storyReaderOptions&&(this.setStoryReaderOptions(i.storyReaderOptions,!1),t.add("storyReaderOptions")),null!=i.storyFavoriteReaderOptions&&(this.setStoryFavoriteReaderOptions(i.storyFavoriteReaderOptions,!1),t.add("storyFavoriteReaderOptions")),null!=i.goodsWidgetOptions&&(this.setGoodsWidgetOptions(i.goodsWidgetOptions,!1),t.add("goodsWidgetOptions")),null!=i.gameReaderOptions&&(this.setGameReaderOptions(i.gameReaderOptions,!1),t.add("gameReaderOptions")));t.forEach((e=>{switch(e){case"commonOptions":this.setCommonOptions({});break;case"storiesListOptions":this.setStoriesListOptions({});break;case"storyReaderOptions":this.setStoryReaderOptions({});break;case"storyFavoriteReaderOptions":this.setStoryFavoriteReaderOptions({});break;case"goodsWidgetOptions":this.setGoodsWidgetOptions({});break;case"gameReaderOptions":this.setGameReaderOptions({})}}))}removeMediaQueryEventListeners(){for(const e of this._mqls.keys())e.removeEventListener("change",this._composeOptionsOverrideByMediaQuery);this._mqls.clear()}destroy(){this.removeMediaQueryEventListeners()}}class de extends U.EventEmitter{constructor(e,t){super(),this.iframe=e,this.origin=t,this.messageListener=this.messageListener.bind(this),window.addEventListener("message",this.messageListener,!1)}messageListener(e){if(e.origin!==this.origin)return;const[t,...i]=e.data;try{if(!Array.isArray(e.data))throw new Error(`Invalid MessageEvent data format ${e.data}`);this.emit(t,...i)}catch(e){console.error(e)}}sendMessage(e,t){var i;null===(i=this.iframe.contentWindow)||void 0===i||i.postMessage([e,t],this.origin)}destroy(){window.removeEventListener("message",this.messageListener,!1),this.removeAllListeners()}}var ce;!function(e){e.StartGame="startGame",e.GameComplete="gameComplete",e.GameInstanceEvent="gameInstanceEvent",e.OpenUrl="openUrl",e.SendApiRequest="sendApiRequest",e.StorySetLocalData="storySetLocalData",e.GameInstanceSetLocalData="gameInstanceSetLocalData",e.OpenSharePanel="openSharePanel"}(ce||(ce={}));var ue,he,pe,fe,ge,ve,me=p(1580),ye=p.n(me);!function(e){e.direct="direct",e.onboarding="onboarding",e.list="list",e.favorite="favorite"}(ue||(ue={})),function(e){e[e.default=0]="default",e[e.favorite=1]="favorite"}(he||(he={})),function(e){e[e.default=0]="default",e[e.onboarding=1]="onboarding",e[e.favorite=2]="favorite",e[e.direct=3]="direct"}(pe||(pe={})),function(e){e.list="list",e.favorite="favorite"}(fe||(fe={})),function(e){e.CLICK_ON_STORY="clickOnStoryLink"}(ge||(ge={})),function(e){e.TEXT="text",e.IMAGE="image"}(ve||(ve={}));var we=p(3142),Se=p.n(we);const be=(0,e.createStore)({default:{},user:{}}),{sdkPlaceholdersChanged:_e,addDefaultPlaceholders:xe}=(0,e.createApi)(be,{sdkPlaceholdersChanged:(e,t)=>({default:e.default,user:t}),addDefaultPlaceholders:(e,t)=>{let i={default:{},user:e.user};return Se()(t)&&t.forEach((e=>{ye()(e)&&void 0!==e.name&&void 0!==e.default_value&&(i.default[e.name]=e.default_value)})),i}});var Ce=p(3655),ke=p.n(Ce),Oe=p(8138),Ee=p.n(Oe),Ae=p(986),Le=p.n(Ae);const Me=(0,e.createStore)({default:{},user:{}}),{sdkImagePlaceholdersChanged:Ie,addDefaultImagePlaceholders:Te}=(0,e.createApi)(Me,{sdkImagePlaceholdersChanged:(e,t)=>({default:e.default,user:t}),addDefaultImagePlaceholders:(e,t)=>{let i={default:{},user:e.user};return Se()(t)&&t.forEach((e=>{ye()(e)&&void 0!==e.name&&void 0!==e.default_value&&(i.default[e.name]=e.default_value)})),i}});let Re,Pe=!0;function De(e){Re(e),Pe=e}function Ne(){return Re(Pe),Pe}Re=function(){};class Fe{constructor(){this.__lastUpdated=null,this._receiveTime=0,this._serverTimestamp=0,this.rawData={},this.myDictionary={}}get receiveTime(){return this._receiveTime}singleModelWrapper(){return""}attributes(){return["__lastUpdated"]}static prepareFromResponse(){}setAttributes(e){const t=this.attributes();let i=this;for(let r in e){let n=e[r];-1!==t.indexOf(r)&&(i[r]=n)}}static createInstance(e,t){const i=new e;let r=t;return""!==i.singleModelWrapper()&&void 0!==t[i.singleModelWrapper()]&&(r=t[i.singleModelWrapper()]),i.rawData=t,i.setAttributes(r),i._receiveTime=(new Date).getTime(),void 0!==t.server_timestamp&&(i._serverTimestamp=t.server_timestamp),i}static _fetch(e,t,i,r="get"){return new Promise(((e,t)=>{e({})}))}static _fetchList(e,t,i){return Promise.resolve({})}static emitEvent({type:e,event:t,eventData:i}){return Promise.resolve()}static update(e,t,i="post"){return Promise.resolve()}}class je extends Fe{attributes(){return["width","height","type","url"]}constructor(){super(),this._url=""}set url(e){this._url=e}get url(){let e=window.isSecureContext;return void 0===e&&"https:"===window.location.protocol&&(e=!0),e?this._url:this._url.replace(/^https:\/\//,"http://")}}const Be=p(3981);class Ue{constructor(){this.images=[],this.color="",this.gradient=!1}static createFromArray(e){const t=new Ue;for(let i in e)e.hasOwnProperty(i)&&t.images.push(je.createInstance(je,e[i]));return t}findOneByType(e){var t;return null!==(t=this.images.find((t=>t.type===e)))&&void 0!==t?t:null}findOneByCoverQuality(e){return this.findOneByType(this.mapCoverQualityToImageType(e))}findOneByWidth(e,t=!1){let i=null;return this.images.forEach((t=>{t.width===e&&(i=t)})),null!==i||t&&void 0!==(i=Be(this.images))?i:null}mapCoverQualityToImageType(e){switch(e){case H.Medium:return"m";case H.High:return"h"}}}var Ve=p(4871),Ge=p.n(Ve);function ze(e,t,i){return String(e).replace(new RegExp(function(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(t),"g"),(()=>i))}const We=()=>null!==p.nc&&void 0!==p.nc?p.nc:"";class $e extends Fe{constructor(){super(...arguments),this._title="",this.title_color="",this.magazine_name="",this.is_opened=!1,this._slides_html=[],this.slides_duration=[],this.slides_screenshot_share=[],this.source="",this.favorite=!1,this.like=0,this.slides_count=null,this.deeplink=null,this.hide_in_reader=null,this.blank=!1,this.disable_close=!1,this.need_placeholders=null,this._placeholders={},this.favorite_cell=!1,this.ugc_card_cell=!1,this.slidesLoaded=!1,this._imageSrc=null,this._parsedIssueArticleIds=null,this._parsedArticleIds=null,this._parsedSlideImage=null,this._video_cover=null,this._videoCoverSrc=null}static fetch(e,t){return this.placeholders=t,this._fetch($e,`story/${e}`,{expand:"slides_html,slides_duration"})}static fetchList(e,t,i){this.placeholders=e;const r={tags:t};return void 0!==i&&(r.favorite=Number(i)),this._fetchList($e,"story",r)}static fetchWithSlides(e,t){return this.placeholders=t,Promise.all(e.map((e=>this.fetch(e,t))))}static fetchOnboardingList(e,t){return this.placeholders=e,this._fetchList($e,"story-onboarding",{tags:t})}static fetchOnboardingListWithSlides(e,t){return this.placeholders=t,Promise.all(e.map((e=>this.fetch(e,t))))}attributes(){return Ge()(super.attributes(),["title","title_color","source","magazine_name","background","background_color","id","image","display_to","display_from","slides_html","slides_duration","slides_screenshot_share","favorite","like","slides_count","deeplink","hide_in_reader","disable_close","like_functional","favorite_functional","share_functional","is_opened","tags","has_audio","has_placeholder","video_cover","need_placeholders","has_swipe_up","share_url","game_instance","blank","slidesLoaded"])}set image(e){this._image=Ue.createFromArray(e)}get image(){return this._image}get issueArticleIds(){return this.parseHtmlSlidesForLinks(),null!==this._parsedIssueArticleIds?this._parsedIssueArticleIds:[]}get articleIds(){return this.parseHtmlSlidesForLinks(),null!==this._parsedArticleIds?this._parsedArticleIds:[]}imagePerSlide(e){var t,i;return this.parseHtmlSlidesForMainImage(),null!==(i=null===(t=this._parsedSlideImage)||void 0===t?void 0:t[e])&&void 0!==i?i:null}parseHtmlSlidesForLinks(){null===this._parsedArticleIds&&null===this._parsedIssueArticleIds&&this.slides_html.forEach((e=>{const t=e.match(/<[^<]*narrative-element-link.*data-link-type="([a-z-]*)".*data-link-target="(\d+)"[^<]*>/i);if(null!==t){const e=t[1],i=parseInt(t[2]);"article"===e?(null===this._parsedArticleIds&&(this._parsedArticleIds=[]),-1===this._parsedArticleIds.indexOf(i)&&this._parsedArticleIds.push(i)):"issue-article"===e&&(null===this._parsedIssueArticleIds&&(this._parsedIssueArticleIds=[]),-1===this._parsedIssueArticleIds.indexOf(i)&&this._parsedIssueArticleIds.push(i))}}))}parseHtmlSlidesForMainImage(){!this._parsedSlideImage&&this.slides_html.length&&(this._parsedSlideImage=this.slides_html.map((e=>this.parseSlideNarrativeImageSrc(e)||this.parseSlideNarrativeVideoPosterSrc(e)||null)))}parseSlideNarrativeImageSrc(e){const t=e.match(/<[^<]*narrative-element-image.*<img[^<]*src="([^"]*)"[^<]*>/i);return null==t?void 0:t[1]}parseSlideNarrativeVideoPosterSrc(e){const t=e.match(/<[^<]*narrative-element-video.*<video[^<]*poster\-remote\-src="([^"]*)"[^<]*>/i);return null==t?void 0:t[1]}set video_cover(e){null!==e&&(this._video_cover=Ue.createFromArray(e))}get video_cover(){return this._video_cover}get videoCoverSrc(){if(!1===this._videoCoverSrc)return null;if(null===this._videoCoverSrc){const e=this.video_cover;if(null===e)return this._videoCoverSrc=!1,null;const t=e.findOneByType("h");if(null!==t)return t.url}return"string"==typeof this._videoCoverSrc?this._videoCoverSrc:null}get title(){return this._title}set title(e){if(!0===this.need_placeholders||!0===this.rawData.need_placeholders)for(let t in $e.placeholders)$e.placeholders.hasOwnProperty(t)&&(e=ze(e,`%${t}%`,$e.placeholders[t]));this.rawData.title=e,this._title=e}get slides_html(){return this._slides_html}set slides_html(e){if(!0===this.need_placeholders||!0===this.rawData.need_placeholders)for(let t in $e.placeholders)if($e.placeholders.hasOwnProperty(t))for(let i=0;i<e.length;i++)e[i]=ze(e[i],`%${t}%`,$e.placeholders[t]);const t=We();for(let i=0;i<e.length;i++)e[i]=ze(e[i],"{{nonce}}",null!=t?t:"");this._slides_html=e}get isOpened(){return this.is_opened}set isOpened(e){this.is_opened=e,this.rawData.is_opened=e}}$e.placeholders={};const qe=$e;class He{static create(e){const t=Fe.createInstance(qe,{id:0,title:e.favoriteCard.title.content,title_color:e.favoriteCard.title.color,is_opened:!0,background_color:"white"});return t.favorite_cell=!0,t}}const Ze=/[\r\n%#()<>?[\\\]^`{|}]/g;function Qe(e,t="double"){return(e=(e=(e="double"===t?e.replace(/"/g,"'"):e.replace(/'/g,'"')).replace(/>\s{1,}</g,"><")).replace(/\s{2,}/g," ")).replace(Ze,encodeURIComponent)}class Xe{static create(e){let t=[];e.ugcCard.image&&e.ugcCard.image.svgSrc&&e.ugcCard.image.svgSrc.baseState&&t.push({width:100,height:100,type:"h",url:`data:image/svg+xml,${Qe(e.ugcCard.image.svgSrc.baseState)}`});const i=Fe.createInstance(qe,{id:-100,title:e.ugcCard.title.content,title_color:e.ugcCard.title.color,is_opened:!1,background_color:e.ugcCard.backgroundColor,image:t});return i.ugc_card_cell=!0,i}}var Ye;!function(e){e[e.DEFAULT=0]="DEFAULT",e[e.UGC=1]="UGC"}(Ye||(Ye={}));const Ke=e=>({id:e,type:Ye.DEFAULT,title:null,title_color:null,background:null,background_color:null,image:null,display_to:null,display_from:null,slides_html:[],slides_screenshot_share:[],slides_duration:[],favorite:null,like:null,slides_count:0,deeplink:null,hide_in_reader:null,disable_close:null,like_functional:null,favorite_functional:null,share_functional:null,is_opened:null,tags:[],has_audio:null,video_cover:null,need_placeholders:null,has_swipe_up:null,slides_payload:[],game_instance:{id:null},share_url:null,slidesLoaded:!1}),Je=(0,e.createStore)({}),et=(0,e.createStore)({default:[]}),tt=et.map((e=>e[m.getState().user_key||"default"]||[]));var it;!function(e){e.FEEDS="feeds",e.FAVORITE="favorite"}(it||(it={}));const rt=(0,e.createStore)({default:{[it.FEEDS]:{},[it.FAVORITE]:[]}}),nt=rt.map((e=>e[m.getState().user_key||"default"]||{})),st=(0,e.createStore)({}),ot=(0,e.createStore)({}),at=(0,e.createStore)([]),lt=(e,t)=>e.map((e=>t.find((t=>t.id===e)))).filter((e=>!!e));st.on([nt,tt],((e,t)=>{const i=nt.getState(),r=tt.getState();return((e,t)=>{const i={};for(const[r,n]of Object.entries(e))i[r]=lt(n,t);return i})(i[it.FEEDS],r)})),ot.on([nt,tt],((e,t)=>{const i=nt.getState(),r={},n=tt.getState();for(const e in i[it.FEEDS])if("onboarding_"===e.substring(0,11)){const t=e.substring(11);r[t]=[],i[it.FEEDS][e]&&Array.isArray(i[it.FEEDS][e])&&(r[t]=n.filter((t=>-1!==i[it.FEEDS][e].indexOf(t.id)&&!t.is_opened)))}return r})),at.on([nt,tt],((e,t)=>{var i;const r=null!==(i=nt.getState()[it.FAVORITE])&&void 0!==i?i:[],n={};return tt.getState().forEach((e=>{n[e.id]=e})),r.map((e=>n[e]))}));const dt=(0,e.createEffect)(),ct=(e,t="")=>(e.is_opened,e.is_opened),ut=tt.map((e=>{const t={};return t[Ye.DEFAULT]=e.filter((e=>!e.slidesLoaded&&e.type===Ye.DEFAULT)).map((e=>e.id)),t[Ye.UGC]=e.filter((e=>!e.slidesLoaded&&e.type===Ye.UGC)).map((e=>e.id)),t})),{storyItemFavoriteChanged:ht,storyItemLikeChanged:pt,storyItemIsOpenedChanged:ft}=(Object.prototype.hasOwnProperty,(0,e.createApi)(et,{storyItemFavoriteChanged:(e,{id:t,favorite:i})=>{const r=m.getState().user_key||"default",n=(e[r]||[]).slice(0),s=n.find((e=>e.id===t));return void 0!==s&&(s.favorite=i),Object.assign(Object.assign({},e),{[r]:n})},storyItemLikeChanged:(e,{id:t,like:i})=>{const r=m.getState().user_key||"default",n=(e[r]||[]).slice(0),s=n.find((e=>e.id===t));return void 0!==s&&(s.like=i),Object.assign(Object.assign({},e),{[r]:n})},storyItemIsOpenedChanged:(e,{id:t})=>{const i=m.getState().user_key||"default",r=(e[i]||[]).slice(0),n=r.find((e=>e.id===t));return void 0!==n&&(n.is_opened=!0),Object.assign(Object.assign({},e),{[i]:r})}}));class gt{constructor(e=0,t=0,i=0,r=0){this.x=e,this.y=t,this.width=i,this.height=r}overlaps(e){return this.x+this.width>=e.x&&this.x<=e.x+e.width&&this.y+this.height>=e.y&&this.y<=e.y+e.height}getIntersection(e){const t=Math.min(this.x+this.width,e.x+e.width),i=Math.max(this.x,e.x),r=Math.min(this.y+this.height,e.y+e.height),n=Math.max(this.y,e.y);return new gt(Math.min(t,i),Math.min(r,n),Math.max(0,t-i),Math.max(0,r-n))}getArea(){return this.width*this.height}getAreaFraction(e){return+(this.getArea()/e.getArea()*100).toFixed(2)}static clone(e){return new gt(e.x,e.y,e.width,e.height)}}class vt extends U.EventEmitter{calculate(e){const t=e.map((({id:e,areaFraction:t})=>({storyId:e,visibleArea:Math.round(t)/100})));0!==t.length&&this.emit("visibleAreaUpdated",t)}}class mt extends U.EventEmitter{constructor(){super(...arguments),this.storiesIds=new Set,this.getNewStoriesIds=e=>{const t=[];for(const i of e)this.storiesIds.has(i)||t.push(i);return t}}markStoryAsFullVisible(e){this.storiesIds.has(e)||(this.storiesIds.add(e),this.emit("flushThumbViews",[e]))}calculate(e){const t=this.getNewStoriesIds(e.map((({id:e})=>e)));t.forEach((e=>this.storiesIds.add(e))),0!==t.length&&this.emit("flushThumbViews",t)}}class yt extends U.EventEmitter{constructor(){super(),this.storyRects=[],this.viewport=new gt,this.feedImpressionMetric=new mt,this.visibleAreaMetric=new vt,this.filterStoryRectIntersections=e=>e.filter((e=>-100!==e.id&&0!==e.id&&e.areaFraction>0)),this.feedImpressionMetric.on("flushThumbViews",(e=>this.emit("flushThumbViews",e))),this.visibleAreaMetric.on("visibleAreaUpdated",(e=>this.emit("visibleAreaUpdated",e)))}calculate(e){const t=this.getScrollViewportByCalculationParams(e),i=this.getStoryRectIntersectionsWithViewport(t),r=this.filterStoryRectIntersections(i);this.calculateMetrics(r)}setViewport(e){this.viewport=e}setStoryRects(e){this.storyRects=e}markStoryAsFullVisible(e){this.feedImpressionMetric.markStoryAsFullVisible(e)}destroy(){this.removeAllListeners()}getScrollViewportByCalculationParams(e){const t=gt.clone(this.viewport);return t.x+=e.minOffsetLeft,t.y+=e.minOffsetTop,t.width+=e.maxOffsetLeft-e.minOffsetLeft,t.height+=e.maxOffsetTop-e.minOffsetTop,t}calculateMetrics(e){this.feedImpressionMetric.calculate(e),this.visibleAreaMetric.calculate(e)}getStoryRectIntersectionsWithViewport(e){const t=[];for(const i of this.storyRects)if(i.overlaps(e)){const r=i.getIntersection(e);t.push({id:i.id,areaFraction:r.getAreaFraction(i)})}else t.push({id:i.id,areaFraction:0});return t}}class wt extends gt{constructor(e,t=0,i=0,r=0,n=0){super(t,i,r,n),this.id=e}static clone(e){return new wt(e.id,e.x,e.y,e.width,e.height)}}const St=Object.prototype.hasOwnProperty,bt=()=>{const e=be.getState(),t=Me.getState(),i=[],r={};for(let t in e.default)St.call(e.default,t)&&(r[t]={type:ve.TEXT,name:t,value:e.default[t]});for(let t in e.user)St.call(e.user,t)&&(r[t]={type:ve.TEXT,name:t,value:e.user[t]});for(let e in r)St.call(r,e)&&i.push(r[e]);const n={};for(let e in t.default)St.call(t.default,e)&&(n[e]={type:ve.IMAGE,name:e,value:t.default[e]});for(let e in t.user)St.call(t.user,e)&&(n[e]={type:ve.IMAGE,name:e,value:t.user[e]});for(let e in n)St.call(n,e)&&i.push(n[e]);return i},_t=(e,t)=>{const i={};return i[Ye.DEFAULT]=[],i[Ye.UGC]=[],i[e]=t,{storyTypeIds:i,style:"",widgetsData:{}}},xt=(e,t)=>{let i;return i=null==t?_t(Ye.DEFAULT,[]):t,{ids:i.storyTypeIds[e],style:i.style,widgetsData:i.widgetsData}},Ct=(0,e.createStore)({style:"",storyTypeIds:{[Ye.DEFAULT]:[],[Ye.UGC]:[]},widgetsData:{}}),kt=(0,e.createEffect)(),Ot=(0,e.createEvent)(),Et=(e,t)=>{let i=[];switch(e){case pe.default:i=t?st.getState()[t]:[];break;case pe.favorite:i=at.getState();break;case pe.onboarding:i=t?ot.getState()[t]:[]}return null!=i?i:[]},At=e=>"{{__ugc__}}"===e?Ye.UGC:Ye.DEFAULT;var Lt=function(e,t,i,r){return new(i||(i=Promise))((function(n,s){function o(e){try{l(r.next(e))}catch(e){s(e)}}function a(e){try{l(r.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,a)}l((r=r.apply(e,t||[])).next())}))};var Mt=function(e,t,i,r){return new(i||(i=Promise))((function(n,s){function o(e){try{l(r.next(e))}catch(e){s(e)}}function a(e){try{l(r.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,a)}l((r=r.apply(e,t||[])).next())}))};const It=(e,t)=>Mt(void 0,void 0,void 0,(function*(){const e=yield(i={data:t},Lt(void 0,void 0,void 0,(function*(){var e,t,r,n,s,o,a,l,d;let c=!1,u="",h={url:null!==(t=null===(e=i.data)||void 0===e?void 0:e.url)&&void 0!==t?t:"",method:null!==(n=null===(r=i.data)||void 0===r?void 0:r.method)&&void 0!==n?n:"get"};-1!==["post","put","path"].indexOf(null===(s=i.data)||void 0===s?void 0:s.method)?h.data=null!==(a=null===(o=i.data)||void 0===o?void 0:o.data)&&void 0!==a?a:void 0:h.params=null!==(d=null===(l=i.data)||void 0===l?void 0:l.params)&&void 0!==d?d:void 0;const p={requestId:i.id};try{const e=yield F.request(h);p.data=e.data,p.status=e.status,p.headers=e.headers,c=!0}catch(e){p.data=e,p.status=400,p.headers=[{}],u=e.toString()}return{name:i.cb,payload:{requestId:i.id,success:c,data:p,err:u}}})));var i;if(e.payload.success)return e.payload.data;throw e.payload.err}));class Tt{constructor(e,t){this.storyManager=e,this.params=t,this.handleFlushThumbViews=this.handleFlushThumbViews.bind(this),this.handleVisibleAreaUpdated=this.handleVisibleAreaUpdated.bind(this)}create(){const e=new yt;return e.on("flushThumbViews",this.handleFlushThumbViews),e.on("visibleAreaUpdated",this.handleVisibleAreaUpdated),e}handleFlushThumbViews(e){const t=o.getState();this.params.listType!==Ye.DEFAULT||t.disableStatistic||b(e);const i=this.params.identityFields.feedSlug,r=this.params.identityFields.filter,n=At(i),s={stories:e.map((e=>{const t={title:null,tags:[],slidesCount:null},i=tt.getState().find((t=>t.id===e));return i&&(t.title=i.stat_title,t.tags=i.tags,t.slidesCount=i.slides_count,i.type===Ye.UGC&&(t.ugcPayload=ye()(i.payload)?i.payload:{})),Object.assign({id:e},t)})),feed:null,filter:null};n===Ye.DEFAULT?s.feed=i:n===Ye.UGC&&(s.filter=r),this.storyManager.emit("feedImpression",s)}handleVisibleAreaUpdated(e){const t=this.params.identityFields.feedSlug,i=this.params.identityFields.filter,r=At(t),n={stories:e.map((({storyId:e,visibleArea:t})=>{const i={title:null,tags:[],slidesCount:null,visibleArea:t},r=tt.getState().find((t=>t.id===e));return r&&(i.title=r.stat_title,i.tags=r.tags,i.slidesCount=r.slides_count,r.type===Ye.UGC&&(i.ugcPayload=ye()(r.payload)?r.payload:{})),Object.assign({id:e},i)})),feed:null,filter:null};r===Ye.DEFAULT?n.feed=t:r===Ye.UGC&&(n.filter=i),this.storyManager.emit("visibleAreaUpdated",n)}}const Rt=function(){var e="test";try{return localStorage.setItem(e,e),localStorage.removeItem(e),!0}catch(e){return!1}}();function Pt(e){let t=null;if(Rt){let i=window.localStorage.getItem(e);null!==i&&Ee()(i)&&i.trim().length>0&&(t=JSON.parse(i))}return t}function Dt(e,t){Rt&&window.localStorage.setItem(e,JSON.stringify(t))}var Nt=function(e,t,i,r){return new(i||(i=Promise))((function(n,s){function o(e){try{l(r.next(e))}catch(e){s(e)}}function a(e){try{l(r.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,a)}l((r=r.apply(e,t||[])).next())}))};let Ft=null;function jt(){return Nt(this,void 0,void 0,(function*(){return null!=Ft?Ft:new Promise((e=>{!function(e,t){const i=new Image;i.onload=function(){var r=i.width>0&&i.height>0;t(e,r)},i.onerror=function(){t(e,!1)},i.src="data:image/webp;base64,"+{lossy:"UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA",lossless:"UklGRhoAAABXRUJQVlA4TA0AAAAvAAAAEAcQERGIiP4HAA==",alpha:"UklGRkoAAABXRUJQVlA4WAoAAAAQAAAAAAAAAAAAQUxQSAwAAAARBxAR/Q9ERP8DAABWUDggGAAAABQBAJ0BKgEAAQAAAP4AAA3AAP7mtQAAAA==",animation:"UklGRlIAAABXRUJQVlA4WAoAAAASAAAAAAAAAAAAQU5JTQYAAAD/////AABBTk1GJgAAAAAAAAAAAAAAAAAAAGQAAABWUDhMDQAAAC8AAAAQBxAREYiI/gcA"}[e]}("lossy",((t,i)=>{Ft=i,e(i)}))}))}))}var Bt=function(e,t,i,r){return new(i||(i=Promise))((function(n,s){function o(e){try{l(r.next(e))}catch(e){s(e)}}function a(e){try{l(r.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,a)}l((r=r.apply(e,t||[])).next())}))};const Ut=p(7315);function Vt(){return Bt(this,void 0,void 0,(function*(){const[e,t]=yield Promise.all([zt(),jt()]);return{method:"POST",url:"session/open",params:{expand:"cache,storyWidgetsResources",fields:"session,server_timestamp,user_key,share,preview_aspect_ratio,placeholders,image_placeholders,is_allow_ugc"},data:Gt(e,t)}}))}y.use((()=>Bt(void 0,void 0,void 0,(function*(){return(yield F.request(yield Vt())).data})))),(0,e.sample)({clock:w,target:m});const Gt=(e,t)=>{"iOS"===e.os_name?window.isIos=!0:"Android"===e.os_name&&(window.Android=!0);const i=o.getState();return i&&i.userId&&(e.user_id=i.userId),e.features="animation,data,deeplink,placeholder,resetTimers,gameReader,sendApi,swipeUpItems,imgPlaceholder,vod",t&&(e.features+=",webp"),e},zt=()=>Bt(void 0,void 0,void 0,(function*(){return new Promise(((e,t)=>{let i=Pt("device_data"),r=null;if(null!==i&&(r=i.device_id),null!==i&&r&&Ee()(r)&&36===r.trim().length)v(r),e(i);else{const t={platform:"web",device_id:Ut.v4()};Dt("device_data",t),v(t.device_id),e(t)}}))}));var Wt=function(e,t,i,r){return new(i||(i=Promise))((function(n,s){function o(e){try{l(r.next(e))}catch(e){s(e)}}function a(e){try{l(r.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,a)}l((r=r.apply(e,t||[])).next())}))};function $t(e,t,i=!1,r,n,s){const o=["slides_html","slides_duration","slides_screenshot_share","slides_payload"];n&&o.push("share_url");const a={url:`${t===Zs?"ugc/":""}story/${e}`,method:"GET",params:{expand:o.join(",")}};return a.params&&(a.params.once=Number(s)),i||null!=a.params&&(a.params.fields=["id","slides_html","slides_duration","slides_screenshot_share","slides_payload"].join(",")),null!==r&&null!=a.params&&(a.params.session_id=r),a}dt.use((e=>Wt(void 0,[e],void 0,(function*({listType:e}){return F.get("story",qt())}))));const qt=(e,t,i,r,n)=>{var s;let a=null===(s=o.getState())||void 0===s?void 0:s.tags;const l={};a&&Se()(a)&&a.length>0&&(l.tags=a.join(",")),void 0!==t&&Se()(t)&&t.length>0&&(l.tags=t.join(","));return null==r||"number"!=typeof r&&!(e=>!isNaN(parseFloat(e))&&isFinite(e))(r)||(l.limit=r),e&&(l.session_id=e),null!=i&&(l.test=i),null!=n&&ye()(n)&&(l.f=n),{params:l}},Ht=(0,e.createEffect)();var Zt=function(e,t,i,r){return new(i||(i=Promise))((function(n,s){function o(e){try{l(r.next(e))}catch(e){s(e)}}function a(e){try{l(r.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,a)}l((r=r.apply(e,t||[])).next())}))};Ht.use((()=>Zt(void 0,void 0,void 0,(function*(){return(yield F.request(yield function(){return Zt(this,void 0,void 0,(function*(){return{method:"GET",url:"ugc/editor-config",params:{}}}))}())).data})))),m.on(Ht.doneData,((e,t)=>{const i=Object.assign({},e);return i.editor=t,i}));var Qt=function(e,t,i,r){return new(i||(i=Promise))((function(n,s){function o(e){try{l(r.next(e))}catch(e){s(e)}}function a(e){try{l(r.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,a)}l((r=r.apply(e,t||[])).next())}))};function Xt(e,t){const i={url:"story-context",method:"GET",params:{id:e.join(","),fields:["style","widgetsData"].join(",")}};return null!=t&&null!=i.params&&(i.params.session_id=t),i}kt.use((e=>Qt(void 0,[e],void 0,(function*({ids:e}){return F.request(Xt(e))})))),(0,e.sample)({clock:kt.done.filterMap((({params:e,result:t})=>{const i=t.data,r=At(e.feedSlug);if(i&&ye()(i)){const t=_t(r,e.ids);return t.style=i.style,t.widgetsData=i.widgetsData,t}})),target:Ct}),(0,e.sample)({clock:Ot,target:Ct});var Yt=p(3514),Kt=p.n(Yt);class Jt{constructor(){this.__lastUpdated=null,this._receiveTime=0,this._serverTimestamp=0,this.rawData={},this.myDictionary={}}get receiveTime(){return this._receiveTime}singleModelWrapper(){return""}attributes(){return["__lastUpdated"]}static prepareFromResponse(){}setAttributes(e){const t=this.attributes();let i=this;for(let r in e){let n=e[r];-1!==t.indexOf(r)&&(i[r]=n)}}static createInstance(e,t){const i=new e;let r=t;return""!==i.singleModelWrapper()&&void 0!==t[i.singleModelWrapper()]&&(r=t[i.singleModelWrapper()]),i.rawData=t,i.setAttributes(r),i._receiveTime=(new Date).getTime(),void 0!==t.server_timestamp&&(i._serverTimestamp=t.server_timestamp),i}static _fetch(e,t,i,r="get"){return new Promise(((n,s)=>{let o={url:t,method:r};-1!==["post","put","path"].indexOf(r)?o.data=i:o.params=i;F.request(o).then((function(t){let i,r;i=t.data,i&&(i.__lastUpdated=Date.now()),r=Jt.createInstance(e,i),n(r)})).catch(s)}))}static _fetchList(e,t,i){return new Promise(((r,n)=>{F.get(t,{params:i}).then((function(t){const i=t.data;let n=[];i.forEach((t=>{n.push(Jt.createInstance(e,t))}));let s={models:n,totalCount:Number(t.headers["x-pagination-total-count"]),currentPage:Number(t.headers["x-pagination-current-page"])};r(s)})).catch(n)}))}static emitEvent({type:e,event:t,eventData:i}){return new Promise(((r,n)=>{F.post(`${e}/event/${t}`,i).then((function(e){const t=e.data;r(t)})).catch(n)}))}static update(e,t,i="post"){let r={url:e,method:i};return-1!==["post","put","path"].indexOf(i)?r.data=t:r.params=t,new Promise(((e,t)=>{F.request(r).then((function(t){let i;i=t.data,e(i)})).catch(t)}))}}class ei extends Jt{attributes(){return["width","height","type","url"]}constructor(){super(),this._url=""}set url(e){this._url=e}get url(){let e=window.isSecureContext;return void 0===e&&"https:"===window.location.protocol&&(e=!0),e?this._url:this._url.replace(/^https:\/\//,"http://")}}const ti=p(3981);class ii{constructor(){this.images=[],this.color="",this.gradient=!1}static createFromArray(e){const t=new ii;for(let i in e)e.hasOwnProperty(i)&&t.images.push(ei.createInstance(ei,e[i]));return t}findOneByType(e){let t=null;return this.images.forEach((i=>{i.type===e&&(t=i)})),t}findOneByWidth(e,t=!1){let i=null;return this.images.forEach((t=>{t.width===e&&(i=t)})),null!==i||t&&void 0!==(i=ti(this.images))?i:null}}class ri extends Jt{constructor(){super(...arguments),this._cover=null}attributes(){return Ge()(super.attributes(),["id","cover","hasFavorite"])}set cover(e){this._cover=ii.createFromArray(e)}get cover(){return this._cover}get coverSrc(){var e;const t=null===(e=this._cover)||void 0===e?void 0:e.findOneByType("h");return null==t?void 0:t.url}}const ni=Object.freeze({enter:13,tab:9,delete:46,esc:27,space:32,up:38,down:40,left:37,right:39,end:35,home:36,del:46,backspace:8,insert:45,pageup:33,pagedown:34});function si(e){return Object.keys(e).reduce(((t,i)=>t+i.split(/(?=[A-Z])/).join("-").toLowerCase()+":"+e[i]+";"),"")}function oi(e){let t=window.isSecureContext;return void 0===t&&"https:"===window.location.protocol&&(t=!0),t?e:e.replace(/^https:\/\//,"http://")}function ai(e){return e.map((e=>function(e){var t,i,r;if(!e.url)return null;let n={"font-family":null!==(t=e.family)&&void 0!==t?t:"normal",src:`url('${oi(String(e.url))}')`,"font-style":null!==(i=e.style)&&void 0!==i?i:"normal","font-weight":null!==(r=e.weight)&&void 0!==r?r:"normal"};e.title&&(n.src+=`, local('${e.title}')`);return`@font-face {${si(n)}}\n`}(e))).filter(Boolean).join("")}function li(e){"fonts"in document?e.forEach((e=>{const t=new FontFace(e.family,`url(${e.url})`,{style:e.style,weight:e.weight,display:"block"});document.fonts.add&&document.fonts.add(t),t.load()})):function(e){const t=ai(e);if(null!=t){const e="stories-font-style";let i=document.getElementById(e);null===i?(i=document.createElement("style"),i.type="text/css",i.id=e,i.attributes.setNamedItem(document.createAttribute("scoped")),i.styleSheet?i.styleSheet.cssText=t:i.appendChild(document.createTextNode(t)),document.body.appendChild(i)):i.styleSheet?i.styleSheet.cssText=t:(i.textContent="",i.appendChild(document.createTextNode(t)))}}(e)}var di;function ci(){if(window){var e,t=window.screen;return e="function"==typeof window.ScreenOrientation&&t.orientation instanceof ScreenOrientation&&"function"==typeof t.orientation.addEventListener&&null===t.orientation.onchange&&"string"==typeof t.orientation.type?t.orientation:function(){var e={90:di.LANDSCAPE_PRIMARY,"-90":di.LANDSCAPE_SECONDARY,0:di.PORTRAIT_PRIMARY,180:di.PORTRAIT_SECONDARY};function t(){}const i=new t,r=function(e){const t=["orientationchange","mozorientationchange","msorientationchange"],i=window.screen;for(let e=0;e<t.length;e++)if(null===i["on"+t[e]])return{delegate:i,event:t[e]};if(void 0!==window.onorientationchange)return{delegate:window,event:"orientationchange"};return{delegate:vi(e),event:"change"}}(i);return t.prototype.addEventListener=ui("addEventListener",r.delegate,r.event),t.prototype.dispatchEvent=ui("dispatchEvent",r.delegate,r.event),t.prototype.removeEventListener=ui("removeEventListener",r.delegate,r.event),t.prototype.lock=function(){var e,t="lockOrientation() is not available on this device.",i=window.screen;e=void 0===i?function(){return!1}:"function"==typeof i.msLockOrientation?i.msLockOrientation.bind(i):"function"==typeof i.mozLockOrientation?i.mozLockOrientation.bind(i):function(){return!1};return function(i){const r=window.Promise;return e(i)?r.resolve(i):r.reject(new Error(t))}}(),t.prototype.unlock=function(){var e=window.screen;return e&&e.orientation&&e.orientation.unlock.bind(e.orientation)||e.msUnlockOrientation&&e.msUnlockOrientation.bind(e)||e.mozUnlockOrientation&&e.mozUnlockOrientation.bind(e)||function(){}}(),Object.defineProperties(i,{onchange:{get:function(){return r.delegate["on"+r.event]||null},set:function(e){r.delegate["on"+r.event]=fi(e,i)}},type:{get:function(){var t=window.screen;return t.msOrientation||t.mozOrientation||e[window.orientation+""]||(mi().matches?"landscape-primary":"portrait-primary")}},angle:{value:0}}),i}(),e}}function ui(e,t,i){var r=this;return function(){var n=Array.prototype.slice.call(arguments);if("change"===(n[0].type?n[0].type:n[0])){n[0].type?n[0]=gi(i,n[0]):n[0]=i;var s,o,a=fi(n[1],r);return"addEventListener"===e&&function(e,t){var i=pi.indexOf(e);i>-1?hi[i]=t:(pi.push(e),hi.push(t))}(n[1],a),"removeEventListener"===e&&(s=n[1],(o=pi.indexOf(s))>-1&&(pi.splice(o,1),hi.splice(o,1))),n[1]=a,t[e].apply(t,n)}}}!function(e){e.LANDSCAPE_PRIMARY="landscape-primary",e.LANDSCAPE_SECONDARY="landscape-secondary",e.PORTRAIT_PRIMARY="portrait-primary",e.PORTRAIT_SECONDARY="portrait-secondary"}(di||(di={}));var hi=[],pi=[];function fi(e,t){var i=pi.indexOf(e);return i>-1?hi[i]:function(i){i.target!==t&&yi(i,"target",t),i.currentTarget!==t&&yi(i,"currentTarget",t),"change"!==i.type&&yi(i,"type","change"),e(i)}}function gi(e,t){var i;try{i=new Event(e,t)}catch(e){i={type:"change"}}return i}function vi(e){var t=Object.create({addEventListener:function(e,t){this.listeners[e]||(this.listeners[e]=[]),-1===this.listeners[e].indexOf(t)&&this.listeners[e].push(t)},dispatchEvent:function(t){this.listeners[t.type]&&(this.listeners[t.type].forEach((function(e){e(t)})),"function"==typeof e.onchange&&e.onchange(t))},removeEventListener:function(e,t){if(this.listeners[e]){var i=this.listeners[e].indexOf(t);i>-1&&this.listeners[e].splice(i,1)}}});t.listeners={};var i=mi();return i&&"boolean"==typeof i.matches&&i.addListener((function(){t.dispatchEvent(gi("change"))})),t}function mi(){return"function"!=typeof window.matchMedia?{}:window.matchMedia("(orientation: landscape)")}function yi(e,t,i){Object.defineProperty(e,t,{value:i})}var wi=function(e,t,i,r){return new(i||(i=Promise))((function(n,s){function o(e){try{l(r.next(e))}catch(e){s(e)}}function a(e){try{l(r.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,a)}l((r=r.apply(e,t||[])).next())}))};const Si=e=>wi(void 0,void 0,void 0,(function*(){return(yield fetch(e)).blob()})),bi=e=>wi(void 0,void 0,void 0,(function*(){const t=yield Si(e);return function(e,t=!0){return new Promise((function(i){var r=new FileReader;r.onloadend=function(){if(t){var e=String(r.result).replace("data:","").replace(/^.+,/,"");i(e)}else i(String(r.result))},r.readAsDataURL(e)}))}(new File([t],"image",{type:t.type,lastModified:(new Date).getTime()}),!1)}));function _i(e,t,i,r){var n=e.indexOf(i,t);if(-1===n)return null;for(var s="",o=n+i.length;o<e.length&&-1===r.indexOf(e[o]);o++)s+=e[o];return{foundAtIndex:n,value:s}}function xi(e,t){const i=document.createElementNS("http://www.w3.org/2000/svg",e);for(let e in t)i.setAttributeNS(null,e.replace(/[A-Z]/g,(function(e,t,i,r){return"-"+e.toLowerCase()})),t[e]);return i}var Ci;function ki(e,t,i,r,n,s,o,a,l,d){var c=xi("svg",{width:String(n),height:String(s),style:"background-color: #fff;"}),u=xi("foreignObject",{x:"0",y:"0",width:"100%",height:"100%"});c.appendChild(u);try{u.style.fontSize=document.body.style.fontSize}catch(e){console.error(e)}!function(){const h=t.cloneNode(!0);if(null!=r&&"string"==typeof r&&r.length>0){const e=Array.prototype.slice.call(h.querySelectorAll(r));for(let t=0;t<e.length;t++){const i=e[t];i&&i.style&&i.style.setProperty&&i.style.setProperty("display","none")}}u.appendChild(h);var p=[];(function(e){for(var t=[],i=0;;){var r=_i(e,i,"src: url(",[" ",")","\t"]);if(null==r)break;i=r.foundAtIndex+r.value.length,t.push(r.value.replace(/["']/g,""))}return t})(i).forEach((function(e){p.push(new Promise((function(t,r){bi(e).then((function(r){i=i.replace(e,r),t()})).catch((function(e){t()}))})))})),u.querySelectorAll("img").forEach((function(e){e.crossOrigin="Anonymous",p.push(new Promise((function(t,i){bi(e.src).then((function(i){e.onload=i=>e.decode().then((()=>t())),e.onerror=e=>{console.error(e),t()},e.src=i})).catch((function(e){t()}))})))})),u.querySelectorAll("video").forEach((function(e){var t;null===(t=e.parentNode)||void 0===t||t.removeChild(e)})),u.querySelectorAll(".narrative-element-video").forEach((function(e){e.classList.add("init")})),Promise.all(p).then((function(){const t=xi("style",{});t.textContent=i,c.appendChild(t);const r=(new XMLSerializer).serializeToString(c),u=new Image;u.onload=t=>{u.decode().then((function(){setTimeout((function(){const e=document.createElement("canvas"),t=e.getContext("2d");if(t){e.style.width=n+"px",e.style.height=s+"px",e.width=2*n,e.height=2*s,t.scale(2,2),t.drawImage(u,0,0);const i=e.toDataURL(o,a);Si(i).then((function(t){l(t),e.remove()}))}}),e===Ci.IOS?200:void 0)})).catch((e=>{console.log({image:u,encodingError:e},"onDecodeError"),d("error render svg image: "+e)}))},u.onerror=e=>{d("error render svg image: "+e)},u.setAttribute("crossOrigin","Anonymous"),u.crossOrigin="Anonymous",u.src="data:image/svg+xml;base64,"+btoa(encodeURIComponent(r).replace(/%([0-9A-F]{2})/g,(function(e,t){return String.fromCharCode(parseInt(t,16))})))}))}()}function Oi(e,t,i,r){return new Promise((function(n,s){null==r&&(r=""),function(e,t,i,r,n,s){ki(e,t,i,r,t.clientWidth,t.clientHeight,"image/jpeg",1,n,s)}(e,t,i,r,(function(e){n(new File([e],"image.jpeg",{type:e.type,lastModified:(new Date).getTime()}))}),(function(){console.error("Image fail");const e=new Error;e.name="ImageFail",s(e)}))}))}function Ei(e){return"string"==typeof e&&(!isNaN(Number(e))&&!isNaN(parseFloat(e)))}!function(e){e[e.IOS=0]="IOS",e[e.ANDROID=1]="ANDROID",e[e.OTHER=2]="OTHER"}(Ci||(Ci={}));var Ai=function(e,t,i,r){return new(i||(i=Promise))((function(n,s){function o(e){try{l(r.next(e))}catch(e){s(e)}}function a(e){try{l(r.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,a)}l((r=r.apply(e,t||[])).next())}))};const Li=(0,e.createEffect)((e=>Ai(void 0,[e],void 0,(function*({defaultList:e,onboardingList:t,favoriteList:i,onboardingTags:r,testKey:n,limit:s}){var o,a,l;const d=[],c=null===(a=null===(o=m.getState())||void 0===o?void 0:o.session)||void 0===a?void 0:a.id;let u=null;if(Kt()(c)&&(d.push(Mi(yield Vt(),"session")),u="@{session.session.id}"),!1!==e&&ye()(e)&&Ee()(e.feedSlug)){const t=e.feedSlug,i=null!==(l=e.filter)&&void 0!==l?l:{};t===Zs?d.push(Mi(function(e,t,i,r,n){const{params:s}=qt(i,r,n,null,t);return{method:"GET",url:"ugc/feed",params:s}}(0,i,u,[],n),`storyList_${t}`)):d.push(Mi(function(e,t,i,r){const{params:n}=qt(t,i,r);return{method:"GET",url:`feed/${e}`,params:n}}(t,u,[],n),`storyList_${t}`))}i&&d.push(Mi(function(e){const{params:t}=qt(e);return{method:"GET",url:"story",params:Object.assign(Object.assign({},t),{favorite:1})}}(u),"storyFavoriteList")),!1!==t&&Ee()(t)&&d.push(Mi(function(e="onboarding",t,i,r){const{params:n}=qt(t,i,null,r);return{method:"GET",url:`feed/${e}/onboarding`,params:n}}(t,u,r,s),`storyOnboardingList_${t}`));let h=null;try{const e=yield F.post("composite",{compositeRequest:d});if(e.status>=200&&e.status<=299)if(e.data&&e.data.compositeResponse&&Array.isArray(e.data.compositeResponse)){if(e.data.success)return e.data.compositeResponse;for(const t of e.data.compositeResponse){const e=t.status;if(Le()(e)&&!(e>=200&&e<=299)){h={name:"networkError",networkStatus:e,networkMessage:String(t.body)};break}}}else h=e.data&&ye()(e.data)&&null!=e.data.name&&null!=e.data.message&&null!=e.data.status?{name:e.data.name,networkStatus:e.data.status,networkMessage:e.data.message}:{name:"networkError",networkStatus:null,networkMessage:"Invalid data in API response, data from response as json: "+JSON.stringify(e.data)};else h=e.data&&ye()(e.data)&&null!=e.data.name&&null!=e.data.message&&null!=e.data.status?{name:e.data.name,networkStatus:e.data.status,networkMessage:e.data.message}:{name:"networkError",networkStatus:e.status,networkMessage:"Invalid data in API response, data from response as json: "+JSON.stringify(e.data)}}catch(e){try{const t=e;if(t.response&&t.response.status)h={name:"networkError",networkStatus:t.response.status,networkMessage:t.response.statusText};else{let t="";window.navigator&&null!=window.navigator.onLine&&(t=" net::ERR_INTERNET_DISCONNECTED"),h={name:"error",networkStatus:null,networkMessage:e.toString()+t},console.error(e)}}catch(e){h={name:"error",networkStatus:null,networkMessage:e.toString()}}}if(null!==h)throw h;return[]})))),Mi=(e,t)=>({path:e.url,qs:e.params,body:e.data,ref:t,method:e.method}),Ii=e=>{const t=be.getState();for(let i in t.user)Ri.call(t.user,i)&&(e=ze(e,`%${i}%`,t.user[i]));for(let i in t.default)Ri.call(t.default,i)&&(e=ze(e,`%${i}%`,t.default[i]));const i=Me.getState();for(let t in i.user)Ri.call(i.user,t)&&(e=ze(e,`%${t}%`,i.user[t]));for(let t in i.default)Ri.call(i.default,t)&&(e=ze(e,`%${t}%`,i.default[t]));return e},Ti=(e,t)=>Array.isArray(e)?e.map((e=>Object.assign(Object.assign({},e),{title:e.need_placeholders?Ii(e.title):e.title,slidesLoaded:!1,is_opened:ct(e),type:t}))):[];(0,e.sample)({clock:Li.doneData.filterMap((e=>{var t;return null===(t=e.find((e=>"session"===e.ref)))||void 0===t?void 0:t.body})),target:m}),(0,e.sample)({clock:Li.doneData.filterMap((e=>{var t,i;return null===(i=null===(t=e.find((e=>"session"===e.ref)))||void 0===t?void 0:t.body)||void 0===i?void 0:i.placeholders})),target:xe}),(0,e.sample)({clock:Li.doneData.filterMap((e=>{var t,i;return null===(i=null===(t=e.find((e=>"session"===e.ref)))||void 0===t?void 0:t.body)||void 0===i?void 0:i.image_placeholders})),target:Te}),(0,e.sample)({clock:y.doneData.filterMap((e=>e.placeholders)),target:xe}),(0,e.sample)({clock:y.doneData.filterMap((e=>e.image_placeholders)),target:Te});const Ri=Object.prototype.hasOwnProperty;(0,e.sample)({source:et,clock:m,fn:(e,t)=>{const i={};for(const r in e)Ri.call(e,r)&&(i[r]=e[r].map((e=>Object.assign(Object.assign({},e),{is_opened:ct(e,t.user_key),title:e.need_placeholders?Ii(e.title):e.title}))));return i},target:et});const{storiesListIdsChanged:Pi}=(0,e.createApi)(rt,{storiesListIdsChanged:(e,{storiesIdsUserEntity:t,feedSlug:i,storyList:r})=>{let n=m.getState().user_key||"default";const s=e[n]||{};return void 0===s[it.FAVORITE]&&(s[it.FAVORITE]=[]),void 0===s[it.FEEDS]&&(s[it.FEEDS]={}),t===it.FEEDS&&i&&(s[it.FEEDS][i]=r.map((e=>e.id))),t===it.FAVORITE&&(s[it.FAVORITE]=r.map((e=>e.id))),Object.assign(Object.assign({},e),{[n]:s})}}),{storiesListItemsAdded:Di}=(0,e.createApi)(et,{storiesListItemsAdded:(e,{storiesIdsUserEntity:t,feedSlug:i,storyList:r})=>{let n=m.getState().user_key||"default";const s=e[n]||[],o=s.map((e=>e.id));return Object.assign(Object.assign({},e),{[n]:[...s,...r.filter((e=>-1===o.indexOf(e.id)))]})}});(0,e.sample)({clock:Li.doneData.filterMap((e=>{var t;let i=null;for(const r of e)if(r.ref&&Ee()(r.ref)){const e=r.ref.match(/^storyList_(.+)/);if(e&&Array.isArray(e)&&e[1]){let n=null===(t=r.body)||void 0===t?void 0:t.stories;const s=At(e[1]);s===Ye.UGC&&(n=r.body);const o=Ti(n,s);i={storiesIdsUserEntity:it.FEEDS,feedSlug:e[1],storyList:o}}}if(i)return i})),target:[Di,Pi]}),(0,e.sample)({clock:Li.doneData.filterMap((e=>{var t;let i=null;for(const r of e)if(r.ref&&Ee()(r.ref)){const e=r.ref.match(/^storyOnboardingList_(.+)/);if(e&&Array.isArray(e)&&e[1]){const n=Ti(null===(t=r.body)||void 0===t?void 0:t.stories,Ye.DEFAULT);i={storiesIdsUserEntity:it.FEEDS,feedSlug:`onboarding_${e[1]}`,storyList:n}}}if(i)return i})),target:[Di,Pi]}),(0,e.sample)({clock:Li.doneData.filterMap((e=>{const t=e.find((e=>"storyFavoriteList"===e.ref));if(void 0===t)return;const i=Ti(t.body,Ye.DEFAULT);return{storiesIdsUserEntity:it.FAVORITE,feedSlug:null,storyList:i}})),target:[Di,Pi]});const Ni=(0,e.createEffect)();Ni.use((e=>Ai(void 0,void 0,void 0,(function*(){const t=e.ids.map((t=>Mi($t(t,e.feedSlug),`storySlides_${t}`))),i=yield F.post("composite",{compositeRequest:t});return i.data&&i.data.success&&i.data.compositeResponse&&Array.isArray(i.data.compositeResponse)?i.data.compositeResponse:[]}))));const Fi=e=>e&&ye()(e)&&"id"in e,ji=(0,e.createEffect)();ji.use((e=>Ai(void 0,[e],void 0,(function*({ids:e,id:t,feedSlug:i}){const r=[Mi($t(t,i),"storySlides"),Mi(Xt(e),"storyContext")],n=yield F.post("composite",{compositeRequest:r});return n.data&&n.data.success&&n.data.compositeResponse&&Array.isArray(n.data.compositeResponse)?n.data.compositeResponse:[]})))),et.on([Ni.done,ji.done],((e,{params:t,result:i})=>{const r=i;if(Array.isArray(r)){const i=At(t.feedSlug),n=m.getState().user_key||"default",s=(e[n]||[]).slice(0).map((e=>{var t,n,s,o,a,l,d,c,u,h,p,f,g,v,m;for(let y=0;y<r.length;y++)if(Fi(null===(t=r[y])||void 0===t?void 0:t.body)&&(null===(s=null===(n=r[y])||void 0===n?void 0:n.body)||void 0===s?void 0:s.id)===e.id&&i===e.type)return Object.assign({},e,{slides_html:e.need_placeholders?Array.from(null!==(l=null===(a=null===(o=r[y])||void 0===o?void 0:o.body)||void 0===a?void 0:a.slides_html)&&void 0!==l?l:[]).map((e=>Ii(e))):Array.from(null!==(u=null===(c=null===(d=r[y])||void 0===d?void 0:d.body)||void 0===c?void 0:c.slides_html)&&void 0!==u?u:[]),slides_duration:null===(p=null===(h=r[y])||void 0===h?void 0:h.body)||void 0===p?void 0:p.slides_duration,slides_screenshot_share:null===(g=null===(f=r[y])||void 0===f?void 0:f.body)||void 0===g?void 0:g.slides_screenshot_share,slides_payload:null===(m=null===(v=r[y])||void 0===v?void 0:v.body)||void 0===m?void 0:m.slides_payload,slidesLoaded:!0,is_opened:ct(e)});return e}));return Object.assign(Object.assign({},e),{[n]:s})}return e})),(0,e.sample)({clock:ji.done.filterMap((({params:e,result:t})=>{var i;const r=null===(i=t.find((e=>"storyContext"===e.ref)))||void 0===i?void 0:i.body,n=At(e.feedSlug);if(r&&ye()(r)){const t=_t(n,e.ids);return t.widgetsData=r.widgetsData,t.style=r.style,t}})),target:Ct});const Bi=(0,e.createEffect)((e=>Ai(void 0,[e],void 0,(function*({id:e,feedSlug:t,fetchShareUrl:i}){var r,n;const s=[],o=null===(n=null===(r=m.getState())||void 0===r?void 0:r.session)||void 0===n?void 0:n.id;let a=null;Kt()(o)&&(s.push(Mi(yield Vt(),"session")),a="@{session.session.id}"),s.push(Mi($t(e,t,!0,a,i),"story")),s.push(Mi(Xt([e],a),"storyContext"));const l=yield F.post("composite",{compositeRequest:s});if(l.data&&l.data.success&&l.data.compositeResponse&&Array.isArray(l.data.compositeResponse))return l.data.compositeResponse;if(l.data&&!l.data.success)throw Error("composite request error:"+JSON.stringify(l.data.compositeResponse));return[]}))));(0,e.sample)({clock:Bi.doneData.filterMap((e=>{var t;const i=null===(t=e.find((e=>"session"===e.ref)))||void 0===t?void 0:t.body;if(i&&ye()(i)&&i)return i})),target:m}),(0,e.sample)({clock:Bi.doneData.filterMap((e=>{var t,i;return null===(i=null===(t=e.find((e=>"session"===e.ref)))||void 0===t?void 0:t.body)||void 0===i?void 0:i.placeholders})),target:xe}),(0,e.sample)({clock:Bi.doneData.filterMap((e=>{var t,i;return null===(i=null===(t=e.find((e=>"session"===e.ref)))||void 0===t?void 0:t.body)||void 0===i?void 0:i.image_placeholders})),target:Te}),(0,e.sample)({clock:Bi.done.filterMap((({params:e,result:t})=>{var i;const r=null===(i=t.find((e=>"storyContext"===e.ref)))||void 0===i?void 0:i.body;if(r&&ye()(r)){const t=At(e.feedSlug),i=_t(t,[e.id]);return i.widgetsData=r.widgetsData,i.style=r.style,i}})),target:Ct}),et.on(Bi.done.filterMap((({params:e,result:t})=>{var i;const r=null===(i=t.find((e=>"story"===e.ref)))||void 0===i?void 0:i.body;if(r&&ye()(r))return r.type=At(e.feedSlug),r})),((e,t)=>{if(!Fi(t))return;const i=m.getState().user_key||"default",r=(e[i]||[]).slice(0).filter((e=>e.id!==(null==t?void 0:t.id))).slice(0);return t=Object.assign(t,{slides_html:t.need_placeholders?Array.from(t.slides_html).map((e=>Ii(e))):Array.from(t.slides_html),slides_duration:t.slides_duration,slidesLoaded:!0,is_opened:ct(t)}),r.push(t),Object.assign(Object.assign({},e),{[i]:r})})),(0,e.sample)({source:et,clock:be,fn:(e,t)=>{const i={};for(const t in e)Ri.call(e,t)&&(i[t]=e[t].map((e=>{var t;return Object.assign(Object.assign({},e),{slides_html:e.need_placeholders&&Array.isArray(e.slides_html)?e.slides_html.map((e=>Ii(e))):null!==(t=e.slides_html)&&void 0!==t?t:[]})})));return i},target:et}),(0,e.sample)({source:m,clock:m,filter:e=>{var t;return Boolean(null===(t=null==e?void 0:e.session)||void 0===t?void 0:t.id)},target:(0,e.createEffect)((e=>{li(e.cache.filter((e=>"font-face"===e.type)))}))});const{storyFeedsAdded:Ui}=(0,e.createApi)(Je,{storyFeedsAdded:(e,t)=>t});(0,e.sample)({clock:Li.doneData.filterMap((e=>{let t={};for(const i of e)if(i.ref&&Ee()(i.ref)){const e=i.ref.match(/^storyList_(.+)/);if(e&&Array.isArray(e)&&e[1]){const r=i.body;t[e[1]]=Jt.createInstance(ri,r)}}return t})),target:Ui});const Vi=p(4871);var Gi;!function(e){e.FONT="font-face"}(Gi||(Gi={}));class zi extends Fe{attributes(){return Vi(super.attributes(),["weight","style","type","url","title","family","format"])}constructor(){super(),this._url=""}set url(e){this._url=e}get url(){let e=window.isSecureContext;return void 0===e&&"https:"===window.location.protocol&&(e=!0),e?this._url:this._url.replace(/^https:\/\//,"http://")}get isFont(){return this.type===Gi.FONT}get fontFaceAsCss(){var e,t,i;if(!this.isFont)return null;let r={"font-family":null!==(e=this.family)&&void 0!==e?e:"normal",src:`url('${this.url}')`,"font-style":null!==(t=this.style)&&void 0!==t?t:"normal","font-weight":null!==(i=this.weight)&&void 0!==i?i:"normal"};return this.title&&(r.src+=`, local('${this.title}')`),`@font-face {${si(r)}}\n`}}p(3981);class Wi{constructor(){this.resources=[]}static createFromArray(e){const t=new Wi;for(let i in e)e.hasOwnProperty(i)&&t.resources.push(zi.createInstance(zi,e[i]));return t}get fontsCss(){let e="";return this.resources.forEach((t=>{if(t.isFont){let i=t.fontFaceAsCss;null!==i&&(e+=i)}})),e||null}}class $i extends Fe{constructor(){super(),this.id=null,this.expire_in=null,this.closed=!1,this.is_allow_profiling=!1,this.preview_aspect_ratio=1,this._placeholders={}}singleModelWrapper(){return""}attributes(){return Ge()(super.attributes(),["server_timestamp","session","cache","share","user_key","placeholders","is_allow_profiling","preview_aspect_ratio"])}static fetch(e){return this._fetch($i,"session/open?expand=cache",e,"post")}static updateSession(e){return this.update("session/update",e)}set session(e){this.id=e.id,this.expire_in=e.expire_in,void 0!==e.closed&&(this.closed=e.closed)}set cache(e){this._projectResourceCache=Wi.createFromArray(e)}get cache(){return this._projectResourceCache}set placeholders(e){Se()(e)&&e.forEach((e=>{ye()(e)&&void 0!==e.name&&void 0!==e.default_value&&(this._placeholders[e.name]=e.default_value)}))}get placeholders(){return this._placeholders}}var qi=function(e,t,i,r){return new(i||(i=Promise))((function(n,s){function o(e){try{l(r.next(e))}catch(e){s(e)}}function a(e){try{l(r.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,a)}l((r=r.apply(e,t||[])).next())}))};class Hi{constructor(e){this.storyManager=e}loadStories(e){return qi(this,arguments,void 0,(function*({listType:e,identityFields:t,testKey:i,needFavorite:r=!0}){const n=e===Ye.DEFAULT&&r;yield Li({defaultList:t,onboardingList:!1,favoriteList:n,testKey:i});const s=Et(pe.default,t.feedSlug),o=t.feedSlug===Zs?Ye.UGC:Ye.DEFAULT;const a={stories:s.map((e=>{const t={title:null,tags:[],slidesCount:null};return e&&(t.title=e.stat_title,t.tags=e.tags,t.slidesCount=e.slides_count,e.type===Ye.UGC&&(t.ugcPayload=ye()(e.payload)?e.payload:{})),Object.assign({id:e.id},t)})),feed:null,filter:null};o===Ye.DEFAULT?a.feed=t.feedSlug:o===Ye.UGC&&(a.filter=t.filter),this.storyManager.emit("feedLoad",a);return{defaultStories:Et(pe.default,t.feedSlug),favoriteStories:Et(pe.favorite,t.feedSlug)}}))}observeDefaultStories(e){return st.map((t=>{var i;return(null!==(i=t[e])&&void 0!==i?i:[]).map((e=>this.createStoryByData(Object.assign(Object.assign({},e),{slides_html:[]}))))}))}observeFavoriteStories(){return at.map((e=>e.map((e=>this.createStoryByData(Object.assign(Object.assign({},e),{slides_html:[]}))))))}observeSession(){return m.map((e=>Fe.createInstance($i,e)))}createStoryByData(e){return e instanceof qe?e:Fe.createInstance(qe,e)}}const Zi={addEventListeners(e,t,i){for(var r=0,n=t.length;r<n;r++)e.addEventListener(t[r],i,{passive:!1})},removeEventListeners(e,t,i){for(var r=0,n=t.length;r<n;r++)e.removeEventListener(t[r],i,{passive:!1})},emitEvent:function(e,t,i){if(e.componentInstance)e.componentInstance.$emit(t,i);else{let r;"function"==typeof window.CustomEvent?r=new window.CustomEvent(t,{detail:i}):(r=document.createEvent("CustomEvent"),r.initCustomEvent(t,!0,!0,i)),e.elm.dispatchEvent(r)}},addOnceEventListener:function(e,t,i,r){var n=s=>{i(s),e.removeEventListener(t,n,r)};e.addEventListener(t,n,r)}},Qi=Zi,Xi=Zi.addOnceEventListener,Yi=["mousedown","touchstart"],Ki=["mousemove","touchmove"],Ji=["mouseup","touchend"],er=["transitionend"];class tr{constructor(e){this.lastClientX=0,this.lastClientY=0,this.pushed=!1,this.sliderApi=e,this.handleMouseDown=this.handleMouseDown.bind(this),this.handleMouseMove=this.handleMouseMove.bind(this),this.handleMouseUp=this.handleMouseUp.bind(this),this.handleAnimationEnd=this.handleAnimationEnd.bind(this),this.addEventListeners()}addEventListeners(){const e=this.sliderApi.getElementRef();Qi.addEventListeners(e,Yi,this.handleMouseDown),Qi.addEventListeners(e,er,this.handleAnimationEnd)}scrollTo(e){this.sliderApi.getElementRef().style.transform=`translate3d(${-e.x}px, ${-e.y}px, 0px)`,this.sliderApi.updatePosition(e.x,e.y),this.sliderApi.testAttraction(),this.sliderApi.emit("scroll",e)}scrollWithAnimation(e,t){const i=this.sliderApi.getCurrentPosition();if(i.x===e.x&&i.y===e.y)return;this.sliderApi.getElementRef().style.transitionDuration=`${t}ms`,this.scrollTo(e)}stopAnimation(){this.sliderApi.getElementRef().style.transitionDuration="0ms"}destroy(){const e=this.sliderApi.getElementRef();Qi.removeEventListeners(e,Yi,this.handleMouseDown),Qi.removeEventListeners(window,Ji,this.handleMouseUp),Qi.removeEventListeners(window,Ki,this.handleMouseMove),Qi.removeEventListeners(e,er,this.handleAnimationEnd)}handleAnimationEnd(){this.stopAnimation(),this.sliderApi.emit("scrollend",this.sliderApi.getCurrentPosition())}handleMouseDown(e){this.pushed=!0,this.stopAnimation();const{clientX:t,clientY:i}=this.extractPointerPosition(e);this.lastClientX=t,this.lastClientY=i,Qi.addEventListeners(window,Ji,this.handleMouseUp),Qi.addEventListeners(window,Ki,this.handleMouseMove)}handleMouseUp(){this.pushed&&(this.pushed=!1,this.sliderApi.setIsDragging(!1),this.sliderApi.emit("scrollend",this.sliderApi.getCurrentPosition()),Qi.removeEventListeners(window,Ji,this.handleMouseUp),Qi.removeEventListeners(window,Ki,this.handleMouseMove))}handleMouseMove(e){if(!this.pushed)return;const{clientX:t,clientY:i}=this.extractPointerPosition(e),r=t-this.lastClientX,n=i-this.lastClientY;this.lastClientX=t,this.lastClientY=i;const{x:s,y:o}=this.sliderApi.preparePosition(this.sliderApi.getCurrentPosition().x-r,this.sliderApi.getCurrentPosition().y-n);this.scrollTo({x:s,y:o}),!this.sliderApi.isDragging&&(Math.abs(r)>=1||Math.abs(n)>=1)&&(this.sliderApi.setIsDragging(!0),this.sliderApi.emit("scrollstart",this.sliderApi.getCurrentPosition()))}extractPointerPosition(e){return e instanceof MouseEvent?{clientX:e.clientX,clientY:e.clientY}:{clientX:e.touches[0].clientX,clientY:e.touches[0].clientY}}}var ir=p(2784),rr=p.n(ir);const nr=["scroll"];class sr{constructor(e){this.rafId=0,this.prevTranslateX=null,this.prevTranslateY=null,this.handleScroll=this.handleScroll.bind(this),this.sliderApi=e,this.handleNativeScrollEnd=rr()((()=>{this.sliderApi.emit("scrollend",this.sliderApi.getCurrentPosition()),this.sliderApi.setIsScrolling(!1)}),300),this.init(),this.addEventListeners()}destroy(){const e=this.sliderApi.getElementRef();Qi.removeEventListeners(e,nr,this.handleScroll)}init(){const e=this.sliderApi.getElementRef();e.style.overflowX=this.sliderApi.isHorizontal()?"scroll":"hidden",e.style.overflowY=this.sliderApi.isHorizontal()?"hidden":"scroll"}addEventListeners(){const e=this.sliderApi.getElementRef();Qi.addEventListeners(e,nr,this.handleScroll)}scrollTo(e){const t=this.sliderApi.getElementRef();t.scrollLeft=e.x,t.scrollTop=e.y,this.sliderApi.updatePosition(e.x,e.y),this.sliderApi.testAttraction(),this.sliderApi.emit("scroll",e)}scrollWithAnimation(e,t){this.performNativeAnimation(e.x,e.y,t)}stopAnimation(){}handleScroll(e){this.sliderApi.isScrolling||(this.sliderApi.emit("scrollstart",this.sliderApi.getCurrentPosition()),this.sliderApi.setIsScrolling(!0));const t=this.sliderApi.getElementRef();this.sliderApi.updatePosition(t.scrollLeft,t.scrollTop),this.sliderApi.testAttraction(),this.sliderApi.emit("scroll",{x:t.scrollLeft,y:t.scrollTop}),this.handleNativeScrollEnd()}performNativeAnimation(e,t,i){const r=this.sliderApi.getCurrentPosition().x,n=this.sliderApi.getCurrentPosition().y,s=e-r,o=t-n;if(Math.abs(s)<=1&&Math.abs(o)<=1)return;if(this.prevTranslateX===e&&this.prevTranslateY===t)return;this.prevTranslateX=e,this.prevTranslateY=t;let a=performance.now();cancelAnimationFrame(this.rafId);const l=e=>{const t=e-a,d=Math.min(t/i,1),c=d*s+r,u=d*o+n;this.scrollTo({x:c,y:u}),d<1?this.rafId=requestAnimationFrame(l):(this.prevTranslateX=null,this.prevTranslateY=null)};this.rafId=requestAnimationFrame(l)}}var or;!function(e){e.Horizontal="horizontal",e.Vertical="vertical"}(or||(or={}));class ar extends U.EventEmitter{constructor(){super(...arguments),this._isScrolling=!1,this._isDragging=!1,this.currentPosition={x:0,y:0},this.direction=or.Horizontal,this.gap=20,this._reachBeginning=!0,this._reachEnd=!0,this.desktopMode=!0}get isDragging(){return this._isDragging}get isScrolling(){return this._isScrolling}get slides(){return Array.from(this.slider.children)}get elementRef(){return this.slider}get reachBeginning(){return this._reachBeginning}get reachEnd(){return this._reachEnd}get scrollWidth(){return this.slider.scrollWidth}mount(e){this.slider=e,this.changeScrollStrategy()}destroy(){this.removeAllListeners(),this.scrollStrategy.destroy()}getLength(){var e,t;return null!==(t=null===(e=this.slider)||void 0===e?void 0:e.children.length)&&void 0!==t?t:0}changeDirection(e){this.direction=e,this.scrollTo(0,0),this.changeScrollStrategy()}setGap(e){this.gap=e}setDesktopMode(e){this.desktopMode=e,this.changeScrollStrategy()}getGap(){return this.gap}scrollTo(e,t=300){const i=this.preparePosition(e,e);t>0?this.scrollStrategy.scrollWithAnimation(i,t):(this.scrollStrategy.scrollTo(i),this.emit("scrollend",this.currentPosition))}isHorizontal(){return this.direction===or.Horizontal}updatePosition(e,t){this.currentPosition={x:e,y:t}}getElementRef(){return this.slider}getCurrentPosition(){return this.currentPosition}preparePosition(e,t){let i={x:e,y:t};return this.isHorizontal()?i.y=0:i.x=0,this.attractToBounds(i.x,i.y)}attractToBounds(e,t){return{x:this.attractToBoundsByX(e),y:this.attractToBoundsByY(t)}}attractToBoundsByX(e){return e<=0?0:e+this.slider.clientWidth>=this.slider.scrollWidth?this.slider.scrollWidth-this.slider.clientWidth:e}attractToBoundsByY(e){return e<=0?0:e+this.slider.clientHeight>=this.slider.scrollHeight?this.slider.scrollHeight-this.slider.clientHeight:e}testAttraction(){const{x:e,y:t}=this.getCurrentPosition(),i=e+this.slider.clientWidth>=Math.max(this.slider.scrollWidth-1,0),r=t+this.slider.clientHeight>=Math.max(this.slider.scrollHeight-1,0);this._reachBeginning=0===e&&0===t,this._reachEnd=this.isHorizontal()?i:r,this.emit("reachBeginning",this._reachBeginning),this.emit("reachEnd",this._reachEnd)}setIsScrolling(e){this._isScrolling=e}setIsDragging(e){this._isDragging=e}getSlidesPerView(){if(this.direction===or.Horizontal&&this.slider.clientWidth){const e=this.slider.children[0].clientWidth+this.gap;return Math.round(this.slider.clientWidth/e)}if(this.direction===or.Vertical&&this.slider.clientHeight){const e=this.slider.children[0].clientHeight+this.gap;return Math.round(this.slider.clientHeight/e)}return 1}changeScrollStrategy(){this.scrollStrategy&&this.scrollStrategy.destroy(),this.scrollStrategy=this.desktopMode?new tr(this):new sr(this)}}const lr=(e,t,i,r)=>!(!e||t||i)&&(console.error(`Cannot open hidden story id ${r}`),!0),dr=(e,t,i)=>{var r;e.isDeeplink?cr(e,t,i):(null===(r=t.gameInstance)||void 0===r?void 0:r.id)?ur(e,t,i):hr(e,t,i)},cr=(e,t,i)=>{e.isDeeplink=!0,i.eventPublisher.emit("clickOnStoryDeepLink",e)},ur=(e,t,i)=>{var r;i.eventPublisher.emit("clickOnStoryGame",{id:t.id,gameInstanceId:null===(r=t.gameInstance)||void 0===r?void 0:r.id})},hr=(e,t,i)=>{const r={index:e.index,isDeeplink:!1,id:e.id,listType:pe.default,windowReferer:he.default};t.isFavoriteCard?i.eventPublisher.emit("clickOnFavoriteCellInternal",r):t.isUgcCard?i.eventPublisher.emit("clickOnUgcCardCellInternal",r):i.eventPublisher.emit("clickOnStoryInternal",r),i.eventPublisher.emit("clickOnStory",e)};class pr extends U.EventEmitter{update(){this.emit("update")}destroy(){this.removeAllListeners()}}class fr{constructor(){this.viewModels=new Map}set(e,t){if(this.viewModels.has(e)){this.viewModels.get(e).add(t)}else this.viewModels.set(e,new Set([t]))}getAllByName(e){var t;const i=null!==(t=this.viewModels.get(e))&&void 0!==t?t:new Set;return Array.from(i.values())}getAll(){const e=[];for(const t of this.viewModels.values())for(const i of t.values())e.push(i);return e}getOneByName(e){const t=this.getAllByName(e)[0];if(!t)throw new Error(`ViewModel <${e}> is undefined`);return t}has(e){return this.viewModels.has(e)}clear(){for(const e of this.getAll())e.destroy();this.viewModels.clear()}}var gr;!function(e){e.START_LOADING="startLoading",e.END_LOADING="endLoading",e.CLOSE_STORY_READER="closeStoryReader"}(gr||(gr={}));class vr extends pr{constructor(e,t){super(),this.storyListViewModel=e,this.story=t,this.id=this.story.id,this.title=this.story.title,this.titleColor=this.story.title_color,this.magazineName=this.story.magazine_name,this.background=this.story.background,this.backgroundColor=this.story.background_color,this.favorite=this.story.favorite,this.like=this.story.like,this.deeplink=this.story.deeplink,this.hideInReader=this.story.hide_in_reader,this.gameInstance=this.story.game_instance,this.hasAudio=this.story.has_audio,this.isFavoriteCard=this.story.favorite_cell,this.isUgcCard=this.story.ugc_card_cell,this.isOpened=this.story.is_opened,this.image=this.story.image,this.videoCover=this.story._video_cover,this.videoCoverSrc=this.story.videoCoverSrc}get options(){return this.storyListViewModel.options.card}get isTitleCardInner(){return this.options.title.position===q.CARD_INSIDE_BOTTOM}get isTitleCardOutsideTop(){return this.options.title.position===q.CARD_OUTSIDE_TOP}get isTitleCardOutsideBottom(){return this.options.title.position===q.CARD_OUTSIDE_BOTTOM}get aspectRatio(){var e,t;const{aspectRatio:i,variant:r}=this.options;if(i)return i;switch(r){case te.STYLE_CIRCLE:case te.STYLE_QUAD:return 1;case te.STYLE_RECTANGLE:return null!==(t=null===(e=this.storyListViewModel.session)||void 0===e?void 0:e.preview_aspect_ratio)&&void 0!==t?t:.8;default:return 1}}getImageSrc(){var e,t;return null===(t=null===(e=this.story.image)||void 0===e?void 0:e.findOneByCoverQuality(this.options.coverQuality))||void 0===t?void 0:t.url}onClick(e){this.storyListViewModel.onStoryClick(this,e)}}class mr extends vr{constructor(e,t){super(e,t)}getImageSrc(){var e,t;return null===(t=null===(e=this.story.image)||void 0===e?void 0:e.findOneByCoverQuality(this.storyListViewModel.options.favoriteCard.coverQuality))||void 0===t?void 0:t.url}}class yr extends vr{constructor(e,t,i){super(e,t),this.favoriteStories=i}}const wr=new U.EventEmitter;wr.setMaxListeners(50);var Sr,br=function(e,t,i,r){return new(i||(i=Promise))((function(n,s){function o(e){try{l(r.next(e))}catch(e){s(e)}}function a(e){try{l(r.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,a)}l((r=r.apply(e,t||[])).next())}))};class _r extends pr{set modeDesktop(e){this._modeDesktop!==e&&(this._modeDesktop=e,this.emit("update"))}get modeDesktop(){return this._modeDesktop}get session(){return this._session}get defaultStories(){return this._defaultStories.slice()}get favoriteStories(){return this._favoriteStories.slice()}get ugcCard(){return this._ugcCard}get favoriteCard(){return this._favoriteCard}constructor(e,t){super(),this.storiesService=e,this.params=t,this._defaultStories=[],this._favoriteStories=[],this._session=null,this._modeDesktop=!0,this.subscriptions=[],this.appearanceManager=new le,this.setDefaultStories=this.setDefaultStories.bind(this),this.setFavoriteStories=this.setFavoriteStories.bind(this),this.hanldeShowStory=this.hanldeShowStory.bind(this),this.handleCloseStory=this.handleCloseStory.bind(this),this.subscribeToStoriesService(),this.emit("create"),this.registerStoryReaderEvents()}get options(){return this.appearanceManager.storiesListOptions}get hasFavoriteCard(){return this.params.hasFavorite&&this._favoriteStories.length>0}get hasUgcCard(){return this.params.useUgcCard}get hasFavoriteStories(){return this.params.hasFavorite&&this.params.listType===Ye.DEFAULT}onStoryClick(e,t=0){((e,t)=>{const{deeplink:i,hideInReader:r,gameInstance:n}=e,s=Ee()(i)&&i.trim().length>0,o=null==n?void 0:n.id;if(lr(Boolean(r),s,o,e.id))return;const a={id:e.id,index:t.index,isDeeplink:s,url:s?i:void 0};dr(a,e,t)})(e,{eventPublisher:this,index:t})}destroy(){this.emit("destroy"),this.subscriptions.forEach((e=>e.unsubscribe())),this.removeAllListeners(),this.unregisterStoryReaderEvents(),this.subscriptions=[]}registerStoryReaderEvents(){wr.on("publicEvents.showStory",this.hanldeShowStory),wr.on("publicEvents.closeStory",this.handleCloseStory)}unregisterStoryReaderEvents(){wr.off("publicEvents.showStory",this.hanldeShowStory),wr.off("publicEvents.closeStory",this.handleCloseStory)}getAppearanceManager(){return this.appearanceManager}setAppearanceManager(e){this.appearanceManager=e,this.update()}reload(){return br(this,void 0,void 0,(function*(){yield this.loadStories({needFavorite:!1})}))}loadStories(e){return br(this,void 0,void 0,(function*(){var t;const i=Boolean(this.params.hasFavorite)&&e.needFavorite,r={feed:this.params.identityFields.feedSlug,filter:{},defaultListLength:0,favoriteListLength:0,success:!0,error:{name:"",networkStatus:200,networkMessage:""}};try{this.emit("startLoading");const{defaultStories:e,favoriteStories:t}=yield this.storiesService.loadStories(Object.assign(Object.assign({},this.params),{needFavorite:i}));r.success=!0,r.error=null,r.defaultListLength=e.length,this.params.hasFavorite&&this.params.listType===Ye.DEFAULT&&(r.favoriteListLength=t.length)}catch(e){console.error(e),r.success=!1,r.error={name:e.name,networkMessage:e.networkMessage,networkStatus:e.networkStatus}}finally{r.filter=null!==(t=this.params.identityFields.filter)&&void 0!==t?t:{},this.emit("endLoading",r)}}))}hanldeShowStory(e){this.emit("openStory",e.id)}handleCloseStory(e){this.emit("closeStory",e.id)}subscribeToStoriesService(){const e=this.storiesService.observeDefaultStories(this.params.identityFields.feedSlug).watch(this.setDefaultStories);if(this.hasFavoriteStories){const e=this.storiesService.observeFavoriteStories().watch(this.setFavoriteStories);this.subscriptions.push(e)}const t=this.storiesService.observeSession().watch((e=>{this._session=e,this.emit("update")}));this.subscriptions.push(e,t)}setUgcAndFavoriteStoryCards(){if(this._ugcCard=void 0,this._favoriteCard=void 0,this.hasUgcCard){const e=Xe.create(this.options);this._ugcCard=new vr(this,e)}if(this.hasFavoriteCard){const e=He.create(this.options);this._favoriteCard=new yr(this,e,this.favoriteStories)}}setDefaultStories(e){this._defaultStories=e.map((e=>new vr(this,e))),this.setUgcAndFavoriteStoryCards(),this.emit("update")}setFavoriteStories(e){this._favoriteStories=e.map((e=>new mr(this,e))),this.setUgcAndFavoriteStoryCards(),this.emit("update")}}!function(e){e.STORY_LIST="storyList",e.STORY_READER="storyReader",e.GAME_READER="gameReader"}(Sr||(Sr={}));var xr=p(2438),Cr=p.n(xr),kr=function(e,t,i,r){return new(i||(i=Promise))((function(n,s){function o(e){try{l(r.next(e))}catch(e){s(e)}}function a(e){try{l(r.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,a)}l((r=r.apply(e,t||[])).next())}))};class Or extends Error{}class Er{fetchSessionAndStoriesCompositeFx(e){return kr(this,void 0,void 0,(function*(){return Li({defaultList:!1,onboardingList:e.onboardingList,favoriteList:!1,onboardingTags:e?e.customTags:void 0,limit:e?e.limit:void 0})}))}fetchSingleStoryWithoutContext(e,t,i){return kr(this,void 0,void 0,(function*(){try{yield Bi({id:e,feedSlug:t,fetchShareUrl:i});const r=tt.getState().find((t=>t.id===e))||Ke(e);return r.slidesLoaded=!1,r}catch(t){return Ke(e)}}))}fetchSingleStoryContext(e,t){return kr(this,void 0,void 0,(function*(){yield kt({ids:[e],feedSlug:t});const i=tt.getState().find((t=>t.id===e));if(!i)throw new Error;return i.slidesLoaded=!0,i}))}fetchStoriesSlides(e,t){return kr(this,void 0,void 0,(function*(){const i=ut.getState()[e];i.length>0&&(yield Ni({ids:i,feedSlug:t}))}))}fetchMultipleStoriesContext(e,t,i){return kr(this,void 0,void 0,(function*(){const r=xt(t,Ct.getState()),n=tt.getState().find((i=>i.id===e&&i.type===t));let s=null!==r&&""!==r.style;const o=ut.getState()[t];t===Ye.DEFAULT&&o.length>0&&(null==r?void 0:r.ids)!==o&&(s=!1);const a=!s&&!(null==n?void 0:n.slidesLoaded),l=!s&&o.length;if(a){const r=t===Ye.DEFAULT?o:[];yield ji({ids:r,id:e,feedSlug:i})}else if(l)yield kt({ids:o,feedSlug:i});else{if(null==n?void 0:n.slidesLoaded)throw new Or;yield Ni({ids:[e],feedSlug:i})}}))}getStoryContextInternalModel(e){const t=ut.getState()[e];return Ct.getState()||_t(e,t)}static updateStoryLike(e,t){return kr(this,void 0,void 0,(function*(){let i=!1;const r={like:void 0};let n="";try{const s=yield F.post(`story-like/${e}`,{value:t});void 0!==s.data.like?(i=!0,r.like=s.data.like,pt({id:e,like:r.like})):n="response.data.like is undefined"}catch(e){n=e.toString()}if(i)return r;throw n}))}static getStorySharePath(e){return kr(this,void 0,void 0,(function*(){let t=!1;const i={url:void 0};let r="";try{const n=yield F.get(`story-share/${e}`,{});void 0!==n.data.url?(t=!0,i.url=n.data.url):r="response.data.url is undefined"}catch(e){r=e.toString()}if(t)return i;throw r}))}static markAsOpened(e){if(!Kt()(m.getState().user_key)){const t=`u/${m.getState().user_key}/s_opened`;let i=Pt(t);Se()(i)||(i=[]),i.push(e),i=Cr()(i),Dt(t,i)}ft({id:e})}static setBookmark(e,t){return kr(this,void 0,void 0,(function*(){let i=!1;const r={favorite:void 0};let n="";try{const s=yield F.post(`story-favorite/${e}`,{value:t});void 0!==s.data.favorite?(i=!0,r.favorite=Boolean(s.data.favorite),!1===r.favorite?Pi({storiesIdsUserEntity:it.FAVORITE,feedSlug:null,storyList:at.getState().filter((t=>t.id!==e))}):Pi({storiesIdsUserEntity:it.FAVORITE,feedSlug:null,storyList:[...at.getState(),...tt.getState().filter((t=>t.id===e))]}),ht({id:e,favorite:r.favorite})):n="response.data.favorite is undefined"}catch(e){n=e.toString()}if(i)return r;throw n}))}}const Ar=(0,e.createStore)({uiPaused:!1,timerPaused:!1,locked:!1,closeGestureInAction:!1}),Lr=Ar.map((e=>e.uiPaused)),Mr=Ar.map((e=>e.timerPaused)),Ir=(0,e.createStore)(!1),Tr=(0,e.createStore)(!0),Rr=(0,e.createStore)(!0),Pr=(0,e.createEvent)(),Dr=(0,e.createEvent)(),Nr=(0,e.createEvent)(),Fr=(0,e.createEvent)(),jr=(0,e.createEvent)(),Br=(0,e.createEvent)(),Ur=(0,e.createEvent)(),Vr=(0,e.createEvent)(),Gr=(0,e.createEvent)(),zr=(0,e.createEvent)(),Wr=(0,e.createEvent)(),$r=(0,e.createEvent)(),qr=(0,e.createEvent)(),Hr=(0,e.createEvent)(),Zr=t=>(0,e.sample)({source:Ar,clock:t,filter:e=>!e.locked}),Qr=Zr(Ur),Xr=Zr(Vr),Yr=Zr(Gr),Kr=Zr(zr);Ar.on(Yr,(e=>Object.assign(Object.assign({},e),{uiPaused:!0,timerPaused:!0}))).on(Kr,(e=>Object.assign(Object.assign({},e),{uiPaused:!1,timerPaused:!1}))).on(Qr,(e=>e.timerPaused?e:Object.assign(Object.assign({},e),{timerPaused:!0}))).on(Xr,(e=>e.timerPaused?Object.assign(Object.assign({},e),{timerPaused:!1}):e)).on(Wr,(e=>Object.assign(Object.assign({},e),{uiPaused:!0,timerPaused:!0,locked:!0}))).on($r,(e=>Object.assign(Object.assign({},e),{uiPaused:!1,timerPaused:!1,locked:!1}))).on(qr,(e=>Object.assign(Object.assign({},e),{timerPaused:!0,locked:!0}))).on(Hr,(e=>Object.assign(Object.assign({},e),{timerPaused:!1,locked:!1}))),Ir.on(Pr,(e=>!0)).on(Dr,(e=>!1)),Tr.on(Nr,(()=>!0)).on(Fr,(()=>!1)),Rr.on(jr,(()=>!0)).on(Br,(()=>!1));const Jr=(0,e.createStore)({rotating:!1});(0,e.createApi)(Jr,{enableRotating:e=>Object.assign(Object.assign({},e),{rotating:!0}),disableRotating:e=>Object.assign(Object.assign({},e),{rotating:!1})});class en{constructor(e,t,i){this.userKey=e,this.gameInstanceId=t,this.instanceUserData=i}set(e){const t=se()(this.get(),e);return window.localStorage.setItem(this.key,JSON.stringify(t)),t}get(){var e;let t={};const i=ye()(this.instanceUserData)?this.instanceUserData:{};try{const i=JSON.parse(null!==(e=window.localStorage.getItem(this.key))&&void 0!==e?e:"{}");ye()(i)&&(t=i)}catch(e){console.error(e)}return se()(t,i)}get key(){return`game_instance_data_${this.userKey}_${this.gameInstanceId}`}}class tn{constructor(e,t){this.gameCenterMessageService=e,this.gameReaderViewModel=t}handle(e){const{id:t,callback:i}=JSON.parse(e),r=this.gameReaderViewModel.gameLaunch;if(!r)return;const n=new en(r.clientConfig.userKey,r.config.gameInstanceId,r.instanceUserData).get();this.gameCenterMessageService.sendMessage("cb",{cb:i,arguments:JSON.stringify([t,JSON.stringify(n)])})}}class rn{constructor(e,t){this.gameCenterMessageService=e,this.gameReaderViewModel=t}handle(e){const{gameInstanceId:t,data:i}=JSON.parse(e),r=this.gameReaderViewModel.gameLaunch;if(!r)return;const n=new en(r.clientConfig.userKey,r.config.gameInstanceId,r.instanceUserData).set(i);this.gameReaderViewModel.emit(ce.GameInstanceSetLocalData,{data:JSON.stringify(n)})}}var nn=function(e,t,i,r){return new(i||(i=Promise))((function(n,s){function o(e){try{l(r.next(e))}catch(e){s(e)}}function a(e){try{l(r.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,a)}l((r=r.apply(e,t||[])).next())}))};var sn,on=function(e,t,i,r){return new(i||(i=Promise))((function(n,s){function o(e){try{l(r.next(e))}catch(e){s(e)}}function a(e){try{l(r.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,a)}l((r=r.apply(e,t||[])).next())}))};!function(e){e.Social="social",e.SlideScreenshot="slide-screenshot"}(sn||(sn={}));class an{constructor(e,t,i){this.gameCenterMessageService=e,this.gameReaderViewModel=t,this.desktopMode=i}handle(e,t){return on(this,void 0,void 0,(function*(){var i,r,n;let s=null!==(i=null==t?void 0:t.url)&&void 0!==i?i:t.text,o=[];t.files&&Array.isArray(t.files)&&t.files.length>0&&(o=yield Promise.all(t.files.map((e=>(e=>nn(void 0,[e],void 0,(function*({file:e,name:t,type:i}){const r=yield fetch(`data:${i};base64,${e}`),n=yield r.blob();return new File([n],t,{type:i,lastModified:(new Date).getTime()})})))(e)))));const a={url:null!=s?s:void 0,files:o.length>0?o:void 0,text:null!==(r=t.text)&&void 0!==r?r:void 0,title:null!==(n=t.title)&&void 0!==n?n:void 0};if(!(a.files&&a.files.length>0||a.url))return void this.gameReaderViewModel.confirmSharingComplete({shareId:e,isSuccess:!1});let l=navigator.share;if(!navigator.share&&window.parent&&window.parent.navigator.share&&(l=window.parent.navigator.share),!this.desktopMode&&l)try{if(!l)return;l(a).then((()=>this.gameReaderViewModel.confirmSharingComplete({shareId:e,isSuccess:!0}))).catch((()=>this.gameReaderViewModel.confirmSharingComplete({shareId:e,isSuccess:!1})))}catch(t){console.error(t),this.openSharePanel({shareConfig:a,sharePath:s,shareId:e})}else this.openSharePanel({shareConfig:a,sharePath:s,shareId:e})}))}openSharePanel({shareConfig:e,sharePath:t,shareId:i}){let r=sn.Social,n=t;e.files&&e.files.length>0&&(r=sn.SlideScreenshot,n=URL.createObjectURL(e.files[0])),this.gameReaderViewModel.emit(ce.OpenSharePanel,{shareId:i,shareType:r,shareLink:n})}}class ln{constructor(e){this.storyId=e}set(e){sessionStorage.setItem(this.key,JSON.stringify(e))}get(){var e;const t=null!==(e=sessionStorage.getItem(this.key))&&void 0!==e?e:"{}";return window.__activeNarrativeId?JSON.parse(t):{}}get key(){return`narrative_${this.storyId}_data`}}class dn{constructor(e,t){this.gameCenterMessageService=e,this.gameReaderViewModel=t}handle(e){const t=JSON.parse(e);if(!ye()(t))return;const{id:i,storyId:r,callback:n}=t;let s=new ln(r).get();this.gameCenterMessageService.sendMessage("cb",{cb:n,arguments:JSON.stringify([i,JSON.stringify(s)])})}}class cn{constructor(e,t){this.gameCenterMessageService=e,this.gameReaderViewModel=t}handle(e){const t=JSON.parse(e);if(!ye()(t))return;const{storyId:i,data:r,sendToServer:n}=t;new ln(i).set(r),n&&this.gameReaderViewModel.emit(ce.StorySetLocalData,{storyId:i,data:JSON.stringify(r)})}}const un={id:"",isOpened:!1,type:sn.Social,link:""},hn=(0,e.createStore)(un),pn=hn.map((e=>e.isOpened)),fn=(0,e.createEvent)(),gn=(0,e.createEvent)();hn.on(fn,((e,t)=>Object.assign(Object.assign({},e),{link:t.link,type:t.type,id:t.id,isOpened:!0}))).on(gn,(e=>un));var vn=function(e,t,i,r){return new(i||(i=Promise))((function(n,s){function o(e){try{l(r.next(e))}catch(e){s(e)}}function a(e){try{l(r.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,a)}l((r=r.apply(e,t||[])).next())}))};class mn{constructor(){this.type=mn.name}init(e){return vn(this,void 0,void 0,(function*(){}))}get firstElement(){var e;return null===(e=this.elements)||void 0===e?void 0:e.item(0)}get isInited(){return Boolean(this.firstElement)}pause(){}resume(){}destroy(){}getActiveElement(){var e;return null===(e=this.elements)||void 0===e?void 0:e.item(0)}getActiveElements(){return this.elements}refreshUserData(){}getType(){return this.type}}var yn=function(e,t,i,r){return new(i||(i=Promise))((function(n,s){function o(e){try{l(r.next(e))}catch(e){s(e)}}function a(e){try{l(r.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,a)}l((r=r.apply(e,t||[])).next())}))};class wn extends mn{constructor(e){super(),this.slideApi=e,this.type=wn.name}init(e){return yn(this,void 0,void 0,(function*(){this.elements=e.querySelectorAll(".narrative-element-copy");try{this.slideApi.WidgetCopy.initWidget(this.elements)}catch(e){console.error(e)}}))}refreshUserData(){this.elements&&this.slideApi.WidgetCopy.refreshUserData(this.elements)}click(e){this.slideApi.WidgetCopy.click(e)}}var Sn=function(e,t,i,r){return new(i||(i=Promise))((function(n,s){function o(e){try{l(r.next(e))}catch(e){s(e)}}function a(e){try{l(r.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,a)}l((r=r.apply(e,t||[])).next())}))};class bn extends mn{constructor(e){super(),this.slideApi=e,this.type=bn.name}init(e){return Sn(this,void 0,void 0,(function*(){this.elements=e.querySelectorAll(".narrative-element-data-input");try{this.slideApi.WidgetDataInput.initWidget(this.elements)}catch(e){console.error(e)}}))}refreshUserData(){this.elements&&this.slideApi.WidgetDataInput.refreshUserData(this.elements)}click(e){this.slideApi.WidgetDataInput.click(e)}setUserData(e,t=""){this.slideApi.WidgetDataInput.setUserData(e,t)}}var _n=function(e,t,i,r){return new(i||(i=Promise))((function(n,s){function o(e){try{l(r.next(e))}catch(e){s(e)}}function a(e){try{l(r.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,a)}l((r=r.apply(e,t||[])).next())}))};class xn extends mn{constructor(e){super(),this.slideApi=e,this.type=xn.name}init(e){return _n(this,void 0,void 0,(function*(){this.elements=e.querySelectorAll(".narrative-element-date-countdown");const t=Array.from(e.querySelectorAll(".narrative-slide.narrative-multi-slide"));try{if(!this.elements.length)return;this.slideApi.WidgetDateCountdown.initWidget(this.elements,t)}catch(e){console.error(e)}}))}pause(){try{if(!this.elements)return;this.slideApi.WidgetDateCountdown.pause(this.elements)}catch(e){console.error(e)}}resume(){try{if(!this.elements)return;this.slideApi.WidgetDateCountdown.resume(this.elements)}catch(e){console.error(e)}}refreshUserData(){this.elements&&this.slideApi.WidgetDateCountdown.refreshUserData(this.elements)}}var Cn=function(e,t,i,r){return new(i||(i=Promise))((function(n,s){function o(e){try{l(r.next(e))}catch(e){s(e)}}function a(e){try{l(r.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,a)}l((r=r.apply(e,t||[])).next())}))};class kn extends mn{constructor(e){super(),this.slideApi=e,this.type=kn.name}init(e){return Cn(this,void 0,void 0,(function*(){this.elements=e.querySelectorAll(".narrative-element-poll");try{if(!this.firstElement)return;this.slideApi.WidgetPoll.initWidget(this.firstElement)}catch(e){console.error(e)}}))}refreshUserData(){this.elements&&this.slideApi.WidgetPoll.refreshUserData(this.elements)}select(e){this.slideApi.WidgetPoll.select(e)}setUserData(e,t=""){this.slideApi.WidgetPoll.setUserData(e,t)}}var On=function(e,t,i,r){return new(i||(i=Promise))((function(n,s){function o(e){try{l(r.next(e))}catch(e){s(e)}}function a(e){try{l(r.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,a)}l((r=r.apply(e,t||[])).next())}))};class En extends mn{constructor(e){super(),this.slideApi=e,this.type=En.name}init(e){return On(this,void 0,void 0,(function*(){this.elements=e.querySelectorAll(".narrative-element-poll-layers");const t=e.querySelectorAll(".narrative-slide.narrative-multi-slide");try{if(!this.firstElement)return;this.slideApi.WidgetPollLayers.initWidget(this.firstElement,Array.from(t))}catch(e){console.error(e)}}))}refreshUserData(){this.elements&&this.slideApi.WidgetPollLayers.refreshUserData(this.elements)}select(e){this.slideApi.WidgetPollLayers.select(e)}}var An=function(e,t,i,r){return new(i||(i=Promise))((function(n,s){function o(e){try{l(r.next(e))}catch(e){s(e)}}function a(e){try{l(r.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,a)}l((r=r.apply(e,t||[])).next())}))};class Ln extends mn{constructor(e){super(),this.slideApi=e,this.type=Ln.name}init(e){return An(this,void 0,void 0,(function*(){var t;this.elements=e.querySelectorAll(".narrative-element-quest");const i=e.querySelectorAll(".narrative-slide"),r=null===(t=null==i?void 0:i.item(0))||void 0===t?void 0:t.getAttribute("data-quest-count");this.elements.length||null==r||(this.elements=i);try{if(!this.firstElement)return;yield this.slideApi.WidgetQuest.initWidget(this.firstElement)}catch(e){console.error(e)}}))}refreshUserData(){this.elements&&this.slideApi.WidgetQuest.refreshUserData(this.elements)}select(e){this.slideApi.WidgetQuest.select(e)}handleRouteClick({direction:e,slideIndex:t,slidesCount:i,onClick:r}){this.firstElement&&this.slideApi.WidgetQuest.handleRouteClick(this.firstElement,{direction:e,slideIndex:t,slideCount:i,click:r})}}var Mn=function(e,t,i,r){return new(i||(i=Promise))((function(n,s){function o(e){try{l(r.next(e))}catch(e){s(e)}}function a(e){try{l(r.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,a)}l((r=r.apply(e,t||[])).next())}))};class In extends mn{constructor(e){super(),this.slideApi=e,this.type=In.name}init(e){return Mn(this,void 0,void 0,(function*(){this.elements=e.querySelectorAll(".narrative-element-quiz");try{if(!this.firstElement)return;this.slideApi.WidgetQuiz.initWidget(this.firstElement)}catch(e){console.error(e)}}))}refreshUserData(){this.elements&&this.slideApi.WidgetQuiz.refreshUserData(this.elements)}select(e){this.slideApi.WidgetQuiz.select(e)}slideQuizIsDone(e){return this.slideApi.WidgetQuiz.slideQuizIsDone(e)}}var Tn=function(e,t,i,r){return new(i||(i=Promise))((function(n,s){function o(e){try{l(r.next(e))}catch(e){s(e)}}function a(e){try{l(r.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,a)}l((r=r.apply(e,t||[])).next())}))};class Rn extends mn{constructor(e){super(),this.slideApi=e,this.type=Rn.name}init(e){return Tn(this,void 0,void 0,(function*(){this.elements=e.querySelectorAll(".narrative-element-quiz-grouped");try{if(!this.firstElement)return;this.slideApi.WidgetQuizGrouped.initWidget(this.firstElement)}catch(e){console.error(e)}}))}refreshUserData(){this.elements&&this.slideApi.WidgetQuizGrouped.refreshUserData(this.elements)}select(e){this.slideApi.WidgetQuizGrouped.select(e)}slideQuizIsDone(e){return this.slideApi.WidgetQuizGrouped.slideQuizIsDone(e)}}var Pn=function(e,t,i,r){return new(i||(i=Promise))((function(n,s){function o(e){try{l(r.next(e))}catch(e){s(e)}}function a(e){try{l(r.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,a)}l((r=r.apply(e,t||[])).next())}))};class Dn extends mn{constructor(e){super(),this.slideApi=e,this.type=Dn.name,this.disableSwipeGesture=this.disableSwipeGesture.bind(this),this.enableSwipeGesture=this.enableSwipeGesture.bind(this)}init(e){return Pn(this,void 0,void 0,(function*(){this.elements=e.querySelectorAll(".narrative-element-range-slider"),this.slideContent=e;try{if(!this.firstElement)return;this.slideApi.WidgetRangeSlider.initWidget(this.firstElement),this.registerMouseAndTouchEvents()}catch(e){console.error(e)}}))}refreshUserData(){this.elements&&this.slideApi.WidgetRangeSlider.refreshUserData(this.elements)}click(e){this.slideApi.WidgetRangeSlider.click(e)}isClickCapturedBySlider(e){return this.slideApi.WidgetRangeSlider.isClickCapturedBySlider(e)}disableSwipeGesture(e){Fr()}enableSwipeGesture(e){Nr()}registerMouseAndTouchEvents(){this.slideContent.addEventListener("mouseup",this.enableSwipeGesture),this.slideContent.addEventListener("touchend",this.enableSwipeGesture),this.slideContent.addEventListener("mousedown",this.disableSwipeGesture),this.slideContent.addEventListener("touchstart",this.disableSwipeGesture)}unregisterMouseAndTouchEvents(){var e,t,i,r;null===(e=this.slideContent)||void 0===e||e.removeEventListener("mouseup",this.enableSwipeGesture),null===(t=this.slideContent)||void 0===t||t.removeEventListener("touchend",this.enableSwipeGesture),null===(i=this.slideContent)||void 0===i||i.removeEventListener("mousedown",this.disableSwipeGesture),null===(r=this.slideContent)||void 0===r||r.removeEventListener("touchstart",this.disableSwipeGesture)}destroy(){this.unregisterMouseAndTouchEvents()}}var Nn=function(e,t,i,r){return new(i||(i=Promise))((function(n,s){function o(e){try{l(r.next(e))}catch(e){s(e)}}function a(e){try{l(r.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,a)}l((r=r.apply(e,t||[])).next())}))};class Fn extends mn{constructor(e){super(),this.slideApi=e,this.type=Fn.name}init(e){return Nn(this,void 0,void 0,(function*(){this.elements=e.querySelectorAll(".narrative-element-rate");try{this.slideApi.WidgetRate.initWidget(this.elements)}catch(e){console.error(e)}}))}refreshUserData(){this.elements&&this.slideApi.WidgetRate.refreshUserData(this.elements)}select(e){this.slideApi.WidgetRate.select(e)}setUserData(e,t=""){this.slideApi.WidgetRate.setUserData(e,t)}}var jn=function(e,t,i,r){return new(i||(i=Promise))((function(n,s){function o(e){try{l(r.next(e))}catch(e){s(e)}}function a(e){try{l(r.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,a)}l((r=r.apply(e,t||[])).next())}))};class Bn extends mn{constructor(e){super(),this.slideApi=e,this.type=Bn.name,this.handleShareComplete=this.handleShareComplete.bind(this)}init(e){return jn(this,void 0,void 0,(function*(){this.elements=e.querySelectorAll(".narrative-element-share"),this.slideContent=e;const t=e.querySelectorAll(".narrative-slide.narrative-multi-slide");try{this.registerEvents(),this.slideApi.WidgetShare.initWidget(this.elements,Array.from(t))}catch(e){console.error(e)}}))}complete(e,t){this.slideApi.WidgetShare.complete(e,t)}refreshUserData(){this.elements&&this.slideApi.WidgetShare.refreshUserData(this.elements)}click(e){this.slideApi.WidgetShare.click(e)}destroy(){this.unregisterEvents()}registerEvents(){wr.on(`${Bn.name}.shareComplete`,this.handleShareComplete)}unregisterEvents(){wr.off(`${Bn.name}.shareComplete`,this.handleShareComplete)}handleShareComplete({shareId:e,result:t}){Re(`[Share Widget]: share complete, { shareId, result }: ${e}, ${t}}`),this.complete(e,t)}}var Un=function(e,t,i,r){return new(i||(i=Promise))((function(n,s){function o(e){try{l(r.next(e))}catch(e){s(e)}}function a(e){try{l(r.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,a)}l((r=r.apply(e,t||[])).next())}))};class Vn extends mn{constructor(e){super(),this.slideApi=e,this.type=Vn.name}init(e){return Un(this,void 0,void 0,(function*(){this.elements=e.querySelectorAll(".narrative-element-test");try{if(!this.firstElement)return;this.slideApi.WidgetTest.initWidget(this.firstElement)}catch(e){console.error(e)}}))}refreshUserData(){this.elements&&this.slideApi.WidgetTest.refreshUserData(this.elements)}select(e){this.slideApi.WidgetTest.select(e)}slideTestIsDone(e){return this.slideApi.WidgetTest.slideTestIsDone(e)}slideTestWithTimer(e){return this.slideApi.WidgetTest.slideTestWithTimer(e)}}var Gn=function(e,t,i,r){return new(i||(i=Promise))((function(n,s){function o(e){try{l(r.next(e))}catch(e){s(e)}}function a(e){try{l(r.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,a)}l((r=r.apply(e,t||[])).next())}))};class zn extends mn{constructor(e){super(),this.slideApi=e,this.type=zn.name}init(e){return Gn(this,void 0,void 0,(function*(){this.elements=e.querySelectorAll(".narrative-element-vote");try{if(!this.firstElement)return;this.slideApi.WidgetVote.initWidget(this.firstElement)}catch(e){console.error(e)}}))}refreshUserData(){this.elements&&this.slideApi.WidgetVote.refreshUserData(this.elements)}select(e){this.slideApi.WidgetVote.select(e)}}const Wn={id:"",running:!1},$n=(0,e.createStore)(Wn),qn=(0,e.createEvent)(),Hn=(0,e.createEvent)(),Zn=(0,e.createEvent)(),Qn=(0,e.createEffect)((({shareId:e,result:t})=>{Zn(),Hr(),wr.emit(`${Bn.name}.shareComplete`,{shareId:e,result:t})}));$n.on(qn,((e,t)=>Object.assign(Object.assign({},e),{id:t.id,running:!0}))).on(Zn,(()=>Wn)),(0,e.sample)({clock:Hn,source:$n,filter:e=>e.running,fn:(e,t)=>({shareId:e.id,result:t.result}),target:Qn});const Xn={isOpened:!1,url:"",elementId:""},Yn=(0,e.createStore)(Xn),Kn=(Yn.map((e=>e.isOpened)),(0,e.createEvent)()),Jn=(0,e.createEvent)();(0,e.sample)({clock:Kn,target:Fr}),(0,e.sample)({clock:Jn,target:Nr}),Yn.on(Kn,((e,t)=>({url:t.url,elementId:t.elementId,isOpened:!0}))).on(Jn,(e=>Xn));const es=(0,e.createStore)({prevStoryId:-1,prevSlideIndex:-1}),ts=(0,e.createEvent)(),is=(0,e.createEvent)(),rs=(0,e.createEvent)(),ns=(0,e.createEffect)((e=>{e.prevStoryId!==e.currentStoryId&&wr.emit("publicEvents.showStory",{id:e.currentStoryId,index:e.currentSlideIndex}),-1!==e.prevStoryId&&wr.emit("statistics.nextSlide",{fromStoryId:e.prevStoryId,fromSlideIndex:e.prevSlideIndex}),wr.emit("publicEvents.showSlide",{id:e.currentStoryId,index:e.currentSlideIndex}),rs(e)}));es.on(rs,((e,t)=>({prevStoryId:t.currentStoryId,prevSlideIndex:t.currentSlideIndex}))),es.reset(is),(0,e.sample)({clock:ts,source:es,fn:(e,t)=>Object.assign(Object.assign({},e),t),target:ns});class ss extends Fe{static sentData(e,t,i){return new Promise((r=>{i("apiRequest",{url:"story-data/"+e,method:"put",params:null,data:t,headers:null}).then((e=>{r({data:e.data,status:200,headers:[{}]})})).catch((e=>{r({data:e,status:400,headers:[{}]})}))}))}static sendApiRequest({url:e,method:t,params:i,headers:r,data:n,profilingKey:s},o){return new Promise((s=>{o("apiRequest",{url:e,method:t,params:i,data:n,headers:r}).then((e=>{s({data:e.data,status:200,headers:[{}]})})).catch((e=>{s({data:e,status:400,headers:[{}]})}))}))}static sendApiRequestPromise(e,t,i){const{id:r,url:n,method:s,params:o,headers:a,data:l,cb:d}=JSON.parse(e);return i("apiRequest",{url:n,method:s,params:o,data:l,headers:a}).then((e=>{let i=JSON.stringify({requestId:r,data:JSON.stringify(e.data),status:e.status,headers:e.headers});t(d,i)}),(e=>{let i=JSON.stringify({requestId:r,data:JSON.stringify(e),status:400,headers:[{}]});t(d,i)}))}}const os=p(4871);class as extends Fe{constructor(){super(...arguments),this.style="",this.widgetsData={}}static fetch(e){return this._fetch(as,"story-context",{id:e.join(",")})}attributes(){return os(super.attributes(),["style","widgetsData"])}}var ls=function(e,t,i,r){return new(i||(i=Promise))((function(n,s){function o(e){try{l(r.next(e))}catch(e){s(e)}}function a(e){try{l(r.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,a)}l((r=r.apply(e,t||[])).next())}))};class ds extends pr{constructor(e,t,i){super(),this.storiesItem=e,this.storyReaderOptions=t,this._hasShare=i,this._muted=!0,this._activeSlideIndex=0,this.displayedSlides=[],this.displayedSlides=this.fillSlides(),this.redirectToSlide=this.redirectToSlide.bind(this),this.nextSlide=this.nextSlide.bind(this)}get id(){return this.storiesItem.id}get title(){return this.storiesItem.title}get slidesLoaded(){return this.storiesItem.slidesLoaded}get like(){return this.storiesItem.like}get favorite(){return this.storiesItem.favorite}get needBottomPanel(){return!this.storiesItem.blank&&(this.hasLike||this.hasFavorite||this.hasShare||this.hasAudio)}get hasLike(){return!!this.storiesItem.like_functional&&Boolean(this.storyReaderOptions.appearanceCommon.hasLike)}get hasShare(){return!!Boolean(this.storiesItem.share_functional)&&this._hasShare}get hasFavorite(){return!!this.storiesItem.favorite_functional&&Boolean(this.storyReaderOptions.appearanceCommon.hasFavorite)}get hasAudio(){return Boolean(this.storiesItem.has_audio)}get slides(){return this.displayedSlides}get activeSlideIndex(){return this._activeSlideIndex}get slidesCount(){var e;return null!==(e=this.storiesItem.slides_count)&&void 0!==e?e:0}get slidesDuration(){return this.storiesItem.slides_duration}get activeSlideDuration(){return this.slidesDuration[this.activeSlideIndex]}get hiddenTimeline(){return Array.isArray(this.storiesItem.slides_duration)&&1===this.storiesItem.slides_duration.length&&0===this.storiesItem.slides_duration[0]}get displayedSlideImage(){return this.storiesItem.blank?null:this.storiesItem.imagePerSlide(this.activeSlideIndex)}get isBlank(){return this.storiesItem.blank}get reachEnd(){return this.activeSlideIndex===this.slidesCount-1}get reachStart(){return 0===this.activeSlideIndex}get disableClose(){return this.storiesItem.disable_close}handleSlideClick(e){e.stopPropagation(),e.preventDefault()}nextSlide(){this.reachEnd||this.toSlide(this.activeSlideIndex+1)}prevSlide(){this.reachStart||this.toSlide(this.activeSlideIndex-1)}toSlide(e){this._activeSlideIndex=e,this.displayedSlides=this.fillSlides(),this.update()}updateStoriesItem(e){this.storiesItem=e,this.displayedSlides=this.fillSlides(),this.update()}fillSlides(){return this.slidesLoaded?Array.isArray(this.storiesItem.slides_html)?this.storiesItem.slides_html.slice(this._activeSlideIndex,this._activeSlideIndex+2):[]:[""]}setLike(e){this.updateStoryLike(e),wr.emit("publicEvents.likeStory",{id:this.id,index:this.activeSlideIndex,value:1===e})}setDislike(e){this.updateStoryLike(e),wr.emit("publicEvents.dislikeStory",{id:this.id,index:this.activeSlideIndex,value:-1===e})}setBookmark(e){return ls(this,void 0,void 0,(function*(){const t=this.storiesItem.favorite;this.storiesItem.favorite=e,this.update();try{const t=yield Er.setBookmark(this.id,e);if(null==t.favorite)return;this.storiesItem.favorite=t.favorite,wr.emit("publicEvents.favoriteStory",{id:this.id,index:this.activeSlideIndex,value:t.favorite})}catch(e){this.storiesItem.favorite=t,console.error(e)}finally{this.update()}}))}share(){return ls(this,void 0,void 0,(function*(){wr.emit("publicEvents.shareStory",{id:this.id,index:this.activeSlideIndex}),this.isShareAsScreenshot()?wr.emit("storySlide.performScreenShotShareAction",{shareId:"slide-screenshot-share",hideElementsSelector:""}):Ne()?this.performSessionShareAction():this.performWithoutSessionShareAction()}))}markAsOpened(){Er.markAsOpened(this.id),this.storiesItem.isOpened=!0}setOptions(e){this.storyReaderOptions=e,this.update()}updateStoryLike(e){return ls(this,void 0,void 0,(function*(){try{const t=yield Er.updateStoryLike(this.id,e);null!=t.like&&(this.storiesItem.like=t.like)}catch(e){console.error(e)}finally{this.update()}}))}isShareAsScreenshot(){var e,t;const i=null!==(t=null===(e=this.storiesItem)||void 0===e?void 0:e.slides_screenshot_share)&&void 0!==t?t:[],r=this._activeSlideIndex;return Boolean(i[r])}performSessionShareAction(){return ls(this,void 0,void 0,(function*(){try{const{url:e}=yield Er.getStorySharePath(this.id);if(!e)return;this.storiesItem.share_url=e,this.emitShareStoryWithPathEvent(e);const t={title:this.storiesItem.title,text:"",url:e};wr.emit("storySlide.performShareAction",{shareId:"story-share",config:t})}catch(e){console.error(e)}}))}performWithoutSessionShareAction(){const e=this.storiesItem.share_url;if(!e)return;this.emitShareStoryWithPathEvent(e);const t={title:this.storiesItem.title,text:"",url:e};wr.emit("storySlide.performShareAction",{shareId:"story-share",config:t})}redirectToSlide({slideIndex:e,layerIndex:t}){e!==this.activeSlideIndex&&this.toSlide(e)}emitShareStoryWithPathEvent(e){wr.emit("publicEvents.shareStoryWithPath",{id:this.id,index:this.activeSlideIndex,url:e})}}var cs=p(5136);class us{constructor(e){this.window=e}get width(){const e=this.window.document.documentElement.clientWidth;return Math.abs(this.window.innerWidth-e)}setScrollbar(e=this.width){this._disableOverFlow(),this._setElementAttributes("body","paddingRight",(t=>t+e))}_disableOverFlow(){const e=this.window.document.body.style.overflow;e&&(this.window.document.body.dataset.overflow=e),this.window.document.body.style.overflow="hidden"}_setElementAttributes(e,t,i){const r=this.width;this.window.document.querySelectorAll(e).forEach((e=>{if(e!==this.window.document.body&&this.window.innerWidth>e.clientWidth+r)return;const n=e.style[t],s=this.window.getComputedStyle(e)[t];e.dataset[t]=n,e.style[t]=`${i(Number.parseFloat(s))}px`}))}resetScrollbar(){this._resetElementAttributes("body","overflow"),this._resetElementAttributes("body","paddingRight")}_resetElementAttributes(e,t){this.window.document.querySelectorAll(e).forEach((e=>{const i=e.dataset[t];void 0===i?e.style.removeProperty(t):(delete e.dataset[t],e.style[t]=i)}))}}var hs=function(e,t,i,r){return new(i||(i=Promise))((function(n,s){function o(e){try{l(r.next(e))}catch(e){s(e)}}function a(e){try{l(r.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,a)}l((r=r.apply(e,t||[])).next())}))};class ps extends pr{constructor(e,t){super(),this.storyReaderStoriesService=e,this.statisticsService=t,this._stories=[],this.displayedStories=[],this._currentIndex=0,this.activeListType=pe.default,this._hasShare=!1,this._placeholders=[],this._appearanceManager=new le,this.scrollbarHelper=new us(window),this.silentClose=!1,this._sourceInfo={},this.windowReferer=he.default,this.overrideStoryOptions=null,this.handleUpdateOptions=this.handleUpdateOptions.bind(this),this.handleStoryListEvents(),this.setAppearanceManager(new le),this.initSlideApi()}initSlideApi(){this.slideApiHandlers=new Ms(this),this.slideApi=(0,cs.getSlideApi)(this.slideApiHandlers)}handleStoryListEvents(){this.handleClickOnStoryInternal=this.handleClickOnStoryInternal.bind(this),wr.on(`${_r.name}.clickOnStoryInternal`,this.handleClickOnStoryInternal)}handleClickOnStoryInternal({appearanceManager:e,payload:t,identityFields:i}){this.showMultipleStories(t,{identityFields:i})}get feedSlug(){var e,t;return null!==(t=null===(e=this.sourceInfo.identityFields)||void 0===e?void 0:e.feedSlug)&&void 0!==t?t:""}get widgetsData(){return ye()(this.narrativeContext.widgetsData)?this.narrativeContext.widgetsData:{}}get sourceInfo(){return this._sourceInfo}get options(){return this._options}get stories(){return this.displayedStories}get activeStory(){return this._activeStory}get currentIndex(){return this._currentIndex+1}get hasShare(){return this._hasShare}get placeholders(){return this._placeholders}get reachStart(){return 1===this.currentIndex}get reachEnd(){return this.currentIndex===this.displayedStories.length-2}get goodsWidgetOptions(){return this._appearanceManager.goodsWidgetOptions}setStories({listType:e,stories:t}){this.activeListType=e,this._stories=t.filter((e=>!e.hide_in_reader)).map((e=>Fe.createInstance(qe,e))),this.displayedStories=[Fe.createInstance(qe,{blank:!0,id:-1}),...this._stories,Fe.createInstance(qe,{blank:!0,id:-2})].map((e=>new ds(e,this.options,this._hasShare))),this.setActiveStoryByIndex(this._currentIndex),this.update()}setNarrativeContext(e){this.narrativeContext=e instanceof as?e:Fe.createInstance(as,e.rawData),this.initStoryResources(this.narrativeContext)}setActiveStoryById(e){this._currentIndex=this._stories.findIndex((t=>t.id===e)),this._activeStory=this.displayedStories[this._currentIndex+1],this.setNarrativeStory(this._activeStory)}setActiveStoryByIndex(e){this._currentIndex=e,this._activeStory=this.displayedStories[this._currentIndex+1],this.setNarrativeStory(this._activeStory)}getDisplayedStoryByIndex(e){return this.displayedStories[e]}setNarrativeStory(e){this.slideApiHandlers.setNarrativeStory(e)}setAppearanceManager(e,t){this.overrideStoryOptions=null!=t?t:{},this._appearanceManager.off(j.EVENT_UPDATED_STORY_READER_OPTIONS,this.handleUpdateOptions),this._appearanceManager.off(j.EVENT_UPDATED_COMMON_OPTIONS,this.handleUpdateOptions),e.on(j.EVENT_UPDATED_STORY_READER_OPTIONS,this.handleUpdateOptions),e.on(j.EVENT_UPDATED_COMMON_OPTIONS,this.handleUpdateOptions),this._appearanceManager=e,this.handleUpdateOptions({storyReaderOptions:e.storyReaderOptions,appearanceCommon:e.commonOptions}),this.update()}getAppearanceManager(){return this._appearanceManager}handleUpdateOptions({storyReaderOptions:e,appearanceCommon:t}){const i=o.getState().lang.toString();this._options=Object.assign(Object.assign(Object.assign({},e),{appearanceCommon:t,faviconApiUrl:A.faviconApiUrl,language:i}),this.overrideStoryOptions);for(const e of this.displayedStories)e.setOptions(this._options);this.update()}open(e,t){this.windowReferer=e.windowReferer,this.setScrollBar(e.windowReferer),this.statisticsService.setSourceInfo(t),this._sourceInfo=t,this.setStories({listType:e.listType,stories:e.storyList}),this.setNarrativeContext({rawData:e.storyContext}),this.setActiveStoryById(e.id),this._hasShare=e.hasShare,this._placeholders=e.placeholders,this.activeListType=e.listType,this.statisticsService.init(),this.update()}setScrollBar(e){e===he.default&&this.scrollbarHelper.setScrollbar()}resetScrollBar(e){e===he.default&&this.scrollbarHelper.resetScrollbar()}initStoryResources(e){(new Ns).init(e)}setStoriesAndContext(e){this.setStories({listType:e.listType,stories:e.storyList}),this.setNarrativeContext({rawData:e.storyContext})}close(e="closeReaderByCloseBtn"){var t;if(!this.activeStory||(null===(t=this.activeStory)||void 0===t?void 0:t.disableClose))return;this.resetScrollBar(this.windowReferer);const i=this.activeStory.id,r=this.activeStory.activeSlideIndex;this.emit("closeStoryReader"),wr.emit("statistics.closeStoryReader",{storyId:i,slideIndex:r}),wr.emit("publicEvents.closeStory",{id:i,index:r,action:e}),$r(),gn(),is(),this.activeStory.markAsOpened(),this._sourceInfo={},this._activeStory=void 0,this.update()}canBeClosed(){return!(!this.activeStory||this.activeStory.isBlank)&&!this.activeStory.disableClose}showSingleStory(e,t,i){return hs(this,void 0,void 0,(function*(){try{const r=(new Date).getTime(),n=yield this.storyReaderStoriesService.fetchSingleStoryWithoutContext(e,t,i),s=((e,t)=>({windowReferer:he.default,listType:pe.default,id:e,storyContext:Ct.getState(),storyList:[t],hasShare:m.getState().share,placeholders:bt()}))(e,n);this.open(s,{listType:pe.direct,feedSlug:t});const o=yield this.storyReaderStoriesService.fetchSingleStoryContext(e,t);this.sleep(r),this.setStoriesAndContext({listType:pe.direct,storyList:[o],storyContext:Ct.getState()})}catch(e){console.error(e)}}))}showSingleStoryFromSharePage(e,t){return hs(this,void 0,void 0,(function*(){try{return yield this.showSingleStory(e,"",t),t&&De(!1),!0}catch(e){return!1}}))}showOnboardingStories(e){return hs(this,void 0,void 0,(function*(){let t="onboarding";e&&e.feed&&Ee()(e.feed)&&(t=e.feed),yield this.storyReaderStoriesService.fetchSessionAndStoriesCompositeFx({onboardingList:t,customTags:null==e?void 0:e.customTags,limit:null==e?void 0:e.limit});const i=Et(pe.onboarding,t);return!!i.length&&(yield this.showMultipleStories({windowReferer:he.default,listType:pe.onboarding,id:i[0].id},{identityFields:{feedSlug:t}}),!0)}))}showMultipleStories(e,t){return hs(this,void 0,void 0,(function*(){const i=t.identityFields.feedSlug;try{De(!0);const r=(new Date).getTime(),n=At(i),s=((e,t,i)=>{const r=Et(e.listType,i);let n=m.getState().share;return t===Ye.UGC&&(n=!1),Object.assign(Object.assign({},e),{storyContext:xt(t,Ct.getState()||_t(t,r.map((e=>e.id)))),storyList:r,hasShare:n,placeholders:bt()})})(e,n,i);this.open(s,{listType:e.listType,identityFields:t.identityFields}),yield this.storyReaderStoriesService.fetchMultipleStoriesContext(e.id,n,i),yield this.storyReaderStoriesService.fetchStoriesSlides(n,i);const o=this.storyReaderStoriesService.getStoryContextInternalModel(n);yield this.sleep(r),this.setStoriesAndContext({listType:e.listType,storyList:Et(e.listType,i),storyContext:xt(n,o)})}catch(e){if(e instanceof Or)return;this.close()}}))}sleep(e){return hs(this,void 0,void 0,(function*(){return new Promise((t=>{const i=Math.max(0,300-((new Date).getTime()-e));i?setTimeout(t,i):t()}))}))}nextStory(){var e;null===(e=this.activeStory)||void 0===e||e.markAsOpened(),this.setActiveStoryByIndex(this._currentIndex+1),this.update()}prevStory(){var e;null===(e=this.activeStory)||void 0===e||e.markAsOpened(),this.setActiveStoryByIndex(this._currentIndex-1),this.update()}destroy(){this._appearanceManager.off(j.EVENT_UPDATED_STORY_READER_OPTIONS,this.handleUpdateOptions),this._appearanceManager.off(j.EVENT_UPDATED_COMMON_OPTIONS,this.handleUpdateOptions),wr.off(`${_r.name}.clickOnStoryInternal`,this.handleClickOnStoryInternal)}closeGoodsWidget(){wr.emit("goodsWidget.close")}}class fs{constructor(e,t){this.storyManager=e,this.statisticsService=t}handle(e){var t;e.dataForSending=this.statisticsService.getDataAndCleanupForBeaconFlush();const i=()=>this.storyManager.clickOnButtonAction({src:Sr.STORY_READER,payload:e});!(null===(t=this.storyManager.getConfig())||void 0===t?void 0:t.disableStatistic)&&e.dataForSending&&ye()(e.dataForSending)&&Array.isArray(e.dataForSending.data)&&e.dataForSending.data.length>0?N("session/update",e.dataForSending,i):i()}}class gs{constructor(e){this.storyManager=e}handle(e,t,i){var r,n,s;const o=i.listType,a=null!==(n=null===(r=i.identityFields)||void 0===r?void 0:r.feedSlug)&&void 0!==n?n:"",l=null===(s=i.identityFields)||void 0===s?void 0:s.filter,d=At(a),c={title:null,tags:[],slidesCount:null,feed:null,filter:null,source:null},u=tt.getState().find((e=>e.id===t.id));if(u&&(c.title=u.stat_title,c.tags=u.tags,c.slidesCount=u.slides_count,u.type===Ye.UGC&&(c.ugcPayload=ye()(u.payload)?u.payload:{})),d===Ye.DEFAULT?c.feed=a:d===Ye.UGC&&(c.filter=l),o===pe.direct?c.source=ue.direct:o===pe.default?c.source=ue.list:o===pe.onboarding?c.source=ue.onboarding:o===pe.favorite&&(c.source=ue.favorite),null!=t.index&&-1===["clickOnStory","showStory"].indexOf(e)&&(t.payload=null,u&&u.slides_payload&&Array.isArray(u.slides_payload))){const e=u.slides_payload.find((e=>e.slide_index===t.index));null!=e&&e.payload&&(t.payload=e.payload)}this.storyManager.emit(e,Object.assign(Object.assign({},t),c))}}var vs=function(e,t,i,r){return new(i||(i=Promise))((function(n,s){function o(e){try{l(r.next(e))}catch(e){s(e)}}function a(e){try{l(r.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,a)}l((r=r.apply(e,t||[])).next())}))};class ms{constructor(e){this.storyManager=e}create(){const e=new Er,t=new Ds(this.storyManager);return this.storyReaderViewModel=new ps(e,t),this.storyManager.setViewModel(ps.name,this.storyReaderViewModel),this.handleStoryReaderViewModelEvents(t),this.storyReaderViewModel}handleStoryReaderViewModelEvents(e){this.handleEventBusEvents(),this.handlePublicEvents(e),this.handleGameCenterEvents()}handlePublicEvents(e){wr.on("publicEvents.clickOnButton",(t=>{new fs(this.storyManager,e).handle(t)})),this.subscribeToPublicEvents(),this.subscribeToWidgetEvent()}subscribeToWidgetEvent(){wr.on("publicEvents.widgetEvent",(e=>{const t=Je.getState()[this.storyReaderViewModel.feedSlug];this.storyManager.emit("widgetEvent",{name:e.name,data:Object.assign(Object.assign({},e.devPayload),{feed_id:t})})}))}subscribeToPublicEvents(){const e=new gs(this.storyManager),t=["showSlide","showStory","closeStory","clickOnButton","likeStory","dislikeStory","favoriteStory","shareStory","shareStoryWithPath"];for(const i of t)wr.on(`publicEvents.${i}`,(t=>{const r=this.storyReaderViewModel.sourceInfo;e.handle(i,t,r)}))}handleEventBusEvents(){wr.on("storyReader.redirectToStory",(({storyId:e,feedSlug:t})=>{this.storyReaderViewModel.showSingleStory(e,t)}))}handleGameCenterEvents(){return vs(this,void 0,void 0,(function*(){wr.on("openGameCenter",(e=>vs(this,[e],void 0,(function*({gameId:e}){yield this.storyManager.openGame(e),Wr(),wr.once(`${io.name}.gameComplete`,(()=>{$r()}))}))))}))}}var ys=function(e,t,i,r){return new(i||(i=Promise))((function(n,s){function o(e){try{l(r.next(e))}catch(e){s(e)}}function a(e){try{l(r.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,a)}l((r=r.apply(e,t||[])).next())}))};class ws extends mn{constructor(e,t){super(),this.slideApi=e,this.layersManager=t,this.type=ws.name}init(e){return ys(this,void 0,void 0,(function*(){this.elements=e.querySelectorAll(".narrative-slide.narrative-multi-slide");try{if(!this.elements.length)return;this.slideApi.WidgetMultiSlide.init(Array.from(this.elements))}catch(e){console.error(e)}}))}destroy(){}}var Ss=function(e,t,i,r){return new(i||(i=Promise))((function(n,s){function o(e){try{l(r.next(e))}catch(e){s(e)}}function a(e){try{l(r.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,a)}l((r=r.apply(e,t||[])).next())}))};class bs extends mn{constructor(e){super(),this.slideApi=e,this.type=bs.name,this.handleSwipeUpGesture=this.handleSwipeUpGesture.bind(this)}get swipeUpLinkTarget(){return this._swipeUpLinkTarget}get swipeUpElementId(){return this._swipeUpElementId}init(e){return Ss(this,void 0,void 0,(function*(){var t,i;this.slideContent=e,this.elements=e.querySelectorAll(".narrative-element-swipe-up"),this.firstElement&&(this._swipeUpLinkTarget=decodeURIComponent(null!==(t=this.firstElement.getAttribute("data-link-target"))&&void 0!==t?t:""),this._swipeUpElementId=null!==(i=this.firstElement.getAttribute("data-element-id"))&&void 0!==i?i:void 0,wr.on("swipeController.swipeUp",this.handleSwipeUpGesture))}))}destroy(){wr.off("swipeController.swipeUp",this.handleSwipeUpGesture)}handleSwipeUpGesture(){if(!this._swipeUpLinkTarget||!this.slideContent||!this._swipeUpElementId)return;const e=this.slideContent.querySelector(`[data-element-id="${this._swipeUpElementId}"]`);e&&wr.emit("slide.openSwipeUpLink",{swipeUpLinkTarget:this._swipeUpLinkTarget,swipeUpElementId:this._swipeUpElementId,target:e})}}var _s=function(e,t,i,r){return new(i||(i=Promise))((function(n,s){function o(e){try{l(r.next(e))}catch(e){s(e)}}function a(e){try{l(r.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,a)}l((r=r.apply(e,t||[])).next())}))};class xs extends mn{constructor(e){super(),this.slideApi=e,this.type=xs.name,this.handleSwipeUpGesture=this.handleSwipeUpGesture.bind(this),this.handleClick=this.handleClick.bind(this)}get swipeUpLinkTarget(){return this._swipeUpLinkTarget}get swipeUpElementId(){return this._swipeUpElementId}init(e){return _s(this,void 0,void 0,(function*(){var t,i;this.slideContent=e,this.elements=e.querySelectorAll(".narrative-element-swipe-up-items"),this.firstElement&&(this._swipeUpLinkTarget=decodeURIComponent(null!==(t=this.firstElement.getAttribute("data-link-target"))&&void 0!==t?t:""),this._swipeUpElementId=null!==(i=this.firstElement.getAttribute("data-element-id"))&&void 0!==i?i:void 0,this.registerEvents())}))}destroy(){this.unregisterEvents()}close(){Jn(),$r(),this.setGoodsElementOpacity(1)}registerEvents(){var e;wr.on("swipeController.swipeUp",this.handleSwipeUpGesture),wr.on("goods.close",this.handleSwipeUpGesture),null===(e=this.firstElement)||void 0===e||e.addEventListener("click",this.handleClick)}unregisterEvents(){var e;wr.off("swipeController.swipeUp",this.handleSwipeUpGesture),null===(e=this.firstElement)||void 0===e||e.removeEventListener("click",this.handleClick)}handleClick(e){e.preventDefault(),e.stopPropagation(),this.open()}handleSwipeUpGesture(){this.open()}open(){if(!this._swipeUpLinkTarget||!this.slideContent||!this._swipeUpElementId)return;const e=decodeURIComponent(this._swipeUpLinkTarget);Wr(),Kn({url:e,elementId:this._swipeUpElementId}),this.setGoodsElementOpacity(0)}setGoodsElementOpacity(e){var t;const i=null===(t=this.slideContent)||void 0===t?void 0:t.querySelector(`[data-element-id="${this._swipeUpElementId}"]`);i&&i.style.setProperty("display",e>0?"block":"none")}}var Cs,ks=function(e,t,i,r){return new(i||(i=Promise))((function(n,s){function o(e){try{l(r.next(e))}catch(e){s(e)}}function a(e){try{l(r.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,a)}l((r=r.apply(e,t||[])).next())}))};!function(e){e.REFRESH_WIDGETS_STATE="REFRESH_WIDGETS_STATE"}(Cs||(Cs={}));class Os{constructor(e,t){this.slideApi=e,this.layersManager=t,this._widgets=[],this.showLayerByIndex=this.showLayerByIndex.bind(this),this.handleRefreshUserData=this.handleRefreshUserData.bind(this),this._widgets=[new wn(e),new bn(e),new kn(e),new En(e),new Ln(e),new In(e),new Rn(e),new Dn(e),new Fn(e),new Bn(e),new Vn(e),new zn(e),new xn(e),new ws(e,this.layersManager),new bs(e),new xs(e)]}get widgets(){return this._widgets}init(e){return ks(this,void 0,void 0,(function*(){this.layersManager.init(e,this.slideApi.Animation),wr.on("storySlide.showLayer",this.showLayerByIndex),wr.on(Cs.REFRESH_WIDGETS_STATE,this.handleRefreshUserData);for(const t of this._widgets)yield t.init(e);this.layersManager.init(e,this.slideApi.Animation)}))}pause(){for(const e of this._widgets)e.pause()}resume(){for(const e of this._widgets)e.resume()}findWidgetByType(e){const t=this._widgets.find((t=>e===t.getType()));if(null==t?void 0:t.firstElement)return t}stop(){for(const e of this._widgets)e.destroy();wr.off("storySlide.showLayer",this.showLayerByIndex),wr.off(Cs.REFRESH_WIDGETS_STATE,this.handleRefreshUserData)}destroy(){this.stop(),this._widgets=[]}handleRefreshUserData(){this._widgets.forEach((e=>e.refreshUserData()))}showLayerByIndex({index:e}){this.layersManager.showLayerByIndex(e)}}class Es{constructor(){this.cache={}}set(e,t){this.cache[e]=t}clear(){this.cache={}}get(e){return this.cache[e]}}var As=function(e,t,i,r){return new(i||(i=Promise))((function(n,s){function o(e){try{l(r.next(e))}catch(e){s(e)}}function a(e){try{l(r.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,a)}l((r=r.apply(e,t||[])).next())}))};class Ls{constructor(){this.actions=[]}push(e){this.actions.push(e)}exec(){for(const e of this.actions)e()}flush(){this.actions=[]}}class Ms{constructor(e){this.storyReaderViewModel=e,this.deferredActionsQueue=new Ls,this.slideLoaded=!1,this.activeSlideIndex=-1,this.narrativeStoryCache=new Es,this.handleSlideLoaded=this.handleSlideLoaded.bind(this),this.handleSlideStop=this.handleSlideStop.bind(this),this.handleStoryRepeat=this.handleStoryRepeat.bind(this),wr.on("slide.stop",this.handleSlideStop),wr.on("slide.loaded",this.handleSlideLoaded),wr.on("slideApiHandlers.repeatStory",this.handleStoryRepeat)}getStoryLocalData(){return As(this,void 0,void 0,(function*(){if(!this.narrativeStory)return{};let e=sessionStorage.getItem("narrative_"+this.narrativeStory.id+"_data");return e?JSON.parse(e):{}}))}setStoryLocalData(e,t){if(!this.narrativeStory)return;let i=JSON.stringify(e);sessionStorage.setItem("narrative_"+this.narrativeStory.id+"_data",i),t&&Ne()&&ss.sentData(this.narrativeStory.id,{data:i},It)}getStoryServerData(e){var t,i;return null!==(i=null===(t=this.storyReaderViewModel.widgetsData._narrative_saved_data)||void 0===t?void 0:t[e])&&void 0!==i?i:null}updateStoryServerData(e,t){this.storyReaderViewModel.widgetsData._narrative_saved_data=t}getSlideDuration(e,t){var i,r,n;return null!==(n=null===(r=null===(i=this.storyReaderViewModel.widgetsData._narrative_slides_duration)||void 0===i?void 0:i[e])||void 0===r?void 0:r[t])&&void 0!==n?n:null}pauseUI(){Gr()}resumeUI(){zr()}showStoryTextInput(e,t){wr.emit("storySlide.showInputModal",{id:e,config:t})}setStorySessionValue(e,t){this.narrativeStoryCache.set(e,t)}getStorySessionValue(e){return this.narrativeStoryCache.get(e)}getWidgetsSharedData(e,t){var i,r,n;const s=this.storyReaderViewModel.widgetsData;switch(t){case"rangeSlider":return null===(i=s._narrative_range_slider_data)||void 0===i?void 0:i[e];case"poll":return null===(r=s._narrative_poll_data)||void 0===r?void 0:r[e];case"vote":return null===(n=s._narrative_vote_data)||void 0===n?void 0:n[e]}return null}openUrl(e){this.narrativeStory&&(this.narrativeStory.markAsOpened(),wr.emit("statistics.transitionFromSlide",{storyId:this.narrativeStory.id,slideIndex:this.narrativeStory.activeSlideIndex}),window.open(e,"_parent"))}sendApiRequest(e,t,i,r,n,s){return ss.sendApiRequest({url:e,method:t,params:i,headers:r,data:n,profilingKey:s},It)}share(e,t){null==e&&(e="story-share"),wr.emit("storySlide.performShareAction",{shareId:e,config:t})}shareSlideScreenshot(e,t){null==e&&(e="slide-screenshot-share"),wr.emit("storySlide.performScreenShotShareAction",{shareId:e,hideElementsSelector:null!=t?t:""})}showLayer(e){wr.emit("storySlide.showLayer",{index:e})}showStorySlide(e){this.pushToDefferedActionsQueueOrExec((()=>{var t;null===(t=this.narrativeStory)||void 0===t||t.redirectToSlide({slideIndex:e})}))}storyShowNext(){wr.emit(`${ps.name}.showNextStory`)}showNextSlide(e){this.pushToDefferedActionsQueueOrExec((()=>{wr.emit("story.showNextSlideWithDelay",e)}))}sendStatisticEvent(e,t,i){wr.emit("publicEvents.widgetEvent",{name:e,devPayload:i})}destroy(){wr.off("slide.loaded",this.handleSlideLoaded),wr.off("slide.stop",this.handleSlideStop),wr.off("slideApiHandlers.repeatStory",this.handleStoryRepeat)}setNarrativeStory(e){this.narrativeStoryCache.clear(),this.narrativeStory=e,this.slideLoaded=!1}pushToDefferedActionsQueueOrExec(e){this.slideLoaded?e():this.deferredActionsQueue.push(e)}handleSlideLoaded(e){this.slideLoaded=!0,this.activeSlideIndex=e,this.deferredActionsQueue.exec(),this.deferredActionsQueue.flush()}handleSlideStop({slideIndex:e,storyId:t}){var i;this.activeSlideIndex===e&&(null===(i=this.narrativeStory)||void 0===i?void 0:i.id)===t&&(this.slideLoaded=!1)}handleStoryRepeat(e){return As(this,arguments,void 0,(function*({storyId:e}){var t;let i={},r=yield this.getStoryLocalData();r=Object.assign({},null!==(t=this.getStoryServerData(e))&&void 0!==t?t:{},r);for(let e in r)r.hasOwnProperty(e)&&/^_gm_[A-z0-9-_]+_attempts$/.test(e)&&(i[e]=r[e]);wr.emit(Cs.REFRESH_WIDGETS_STATE),this.updateStoryServerData(e,i),this.setStoryLocalData(i,!0),this.showStorySlide(0),this.showLayer(0)}))}}var Is=function(e,t,i,r){return new(i||(i=Promise))((function(n,s){function o(e){try{l(r.next(e))}catch(e){s(e)}}function a(e){try{l(r.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,a)}l((r=r.apply(e,t||[])).next())}))};class Ts{constructor(e){this.statisticsService=e,this.timerId=null}start(){this.schedule(1e4)}stop(){null!=this.timerId&&(clearTimeout(this.timerId),this.timerId=null)}flush(){return Is(this,void 0,void 0,(function*(){Re(`[${Ds.name}]: flush statistics by timer`);let e={data:[]};const t=this.statisticsService.getData();t.length>0&&(e.data=t),yield this.statisticsService.sendStatisticsData(e),e.data.length>0?this.schedule(1e4):this.schedule(3e4)}))}schedule(e){Re(`[${Ds.name}]: schedule flush statistics on ${e}ms`),this.timerId=setTimeout((()=>this.flush()),e)}}class Rs{calculate(){const e=Date.now(),t=e-this.slideStartedAt;return this.slideStartedAt=e,t}init(){this.slideStartedAt=Date.now()}}var Ps=function(e,t,i,r){return new(i||(i=Promise))((function(n,s){function o(e){try{l(r.next(e))}catch(e){s(e)}}function a(e){try{l(r.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,a)}l((r=r.apply(e,t||[])).next())}))};class Ds extends(V()){constructor(e){super(),this.storyManager=e,this.lastStatSent=!1,this.lastStatLength=0,this.lastIndex=0,this.data=[],this.sourceInfo=null,this.handleCloseStoryReader=this.handleCloseStoryReader.bind(this),this.handleTransitionFromSlide=this.handleTransitionFromSlide.bind(this),this.handleNextSlide=this.handleNextSlide.bind(this),this.flushSheduler=new Ts(this),this.slideDurationCalculator=new Rs}init(){this.data=[],this.lastStatSent=!1,this.lastStatLength=0,this.lastIndex=0,this.slideDurationCalculator.init(),this.flushSheduler.start(),this.registerEventListeners()}getData(){return this.data.slice()}setSourceInfo(e){this.sourceInfo=e}getDataAndCleanupForBeaconFlush(){if(!Ne())return null;const e={data:this.getData()};return this.lastStatSent=!0,this.lastStatLength=e.data.length,this.cleanupData(e.data.length),e}sendStatisticsData(e){return Ps(this,void 0,void 0,(function*(){try{if(!this.sourceInfo)throw new Error(`[${Ds.name}]: You need pass source info!`);this.lastStatLength=e.data.length,this.lastStatSent=!1,yield this.sendBeaconUpdate({statisticsUpdateDto:e,listType:At(this.sourceInfo.feedSlug)}),this.lastStatSent=!0,this.cleanupData(e.data.length)}catch(e){console.error(e)}}))}registerEventListeners(){wr.on("statistics.nextSlide",this.handleNextSlide),wr.on("statistics.transitionFromSlide",this.handleTransitionFromSlide),wr.on("statistics.closeStoryReader",this.handleCloseStoryReader)}unregisterEventListeners(){wr.off("statistics.nextSlide",this.handleNextSlide),wr.off("statistics.transitionFromSlide",this.handleTransitionFromSlide),wr.off("statistics.closeStoryReader",this.handleCloseStoryReader)}handleNextSlide(e){if(!Ne())return;const t=this.slideDurationCalculator.calculate();this.addSlideEvent({action:1,storyId:e.fromStoryId,slideIndex:e.fromSlideIndex,slideDuration:t})}handleTransitionFromSlide(e){if(!Ne())return;const t=this.slideDurationCalculator.calculate();this.addSlideEvent({action:2,storyId:e.storyId,slideIndex:e.slideIndex,slideDuration:t})}handleCloseStoryReader(e){if(this.unregisterEventListeners(),!Ne())return;const t=this.slideDurationCalculator.calculate();this.addSlideEvent({action:1,storyId:e.storyId,slideIndex:e.slideIndex,slideDuration:t}),this.flushSheduler.stop(),this.flushStatisticsOnClose()}addSlideEvent(e){this.data.push([e.action,this.lastIndex,e.storyId,e.slideIndex,e.slideDuration]),this.lastIndex++}flushStatisticsOnClose(){return Ps(this,void 0,void 0,(function*(){const e={data:this.lastStatSent?this.data.slice():this.data.slice(this.lastStatLength)};yield this.sendStatisticsData(e)}))}cleanupData(e){this.data=this.data.slice(e)}sendBeaconUpdate(e){return Ps(this,arguments,void 0,(function*({listType:e,statisticsUpdateDto:t}){var i;if(0===t.data.length)return t;let r=!1,n="";if(e===Ye.UGC||(null===(i=this.storyManager.getConfig())||void 0===i?void 0:i.disableStatistic))r=!0;else try{N("session/update",t,(()=>{})),r=!0}catch(e){n=e.toString()}if(r)return t;throw n}))}}class Ns{init(e){const t="stories-slider-style";let i=document.getElementById(t),r="";null!==e&&(r=e.style),null===i?(i=document.createElement("style"),i.type="text/css",i.id=t,i.attributes.setNamedItem(document.createAttribute("scoped")),i.setAttribute("nonce",We()),i.styleSheet?i.styleSheet.cssText=r:i.appendChild(document.createTextNode(r)),document.head.appendChild(i)):i.styleSheet?i.styleSheet.cssText=r:(i.textContent="",i.appendChild(document.createTextNode(r)))}}var Fs=function(e,t,i,r){return new(i||(i=Promise))((function(n,s){function o(e){try{l(r.next(e))}catch(e){s(e)}}function a(e){try{l(r.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,a)}l((r=r.apply(e,t||[])).next())}))};class js{constructor(e){this.storyManager=e}create(e){const t=new Hi(this.storyManager),i=new _r(t,e);return this.storyManager.setViewModel(_r.name,i),this.handleStoryListViewModelEvents(i,{listType:e.listType,identityFields:e.identityFields,isFavorite:e.isFavorite}),i}handleStoryListViewModelEvents(e,t){e.on("clickOnStoryInternal",(i=>Fs(this,void 0,void 0,(function*(){i.listType=t.isFavorite?pe.favorite:pe.default,i.windowReferer=t.isFavorite?he.favorite:he.default,wr.emit(`${_r.name}.clickOnStoryInternal`,{appearanceManager:e.getAppearanceManager(),payload:i,identityFields:t.identityFields})})))).on("clickOnStoryDeepLink",(e=>{Er.markAsOpened(e.id),this.handleClickOnStoryDeepLink(e,{listType:t.listType})})).on("clickOnStoryGame",(({id:e,gameInstanceId:t})=>{Er.markAsOpened(e),this.storyManager.openGame(t)})).on("clickOnStory",(e=>this.handleClickOnStory(e,t.identityFields)))}handleClickOnStoryDeepLink(e,{listType:t}){var i;const r={data:[[1,0,e.id,0,0]]},n=()=>{e.isDeeplink&&e.url&&this.storyManager.clickOnButtonAction({src:Sr.STORY_LIST,payload:e})};t===Ye.UGC||(null===(i=this.storyManager.getConfig())||void 0===i?void 0:i.disableStatistic)?n():N("session/update",r,mo.createFunctionWithTimeout(n,1e3))}handleClickOnStory(e,t){if(0===e.id)return void this.storyManager.emit("clickOnFavoriteCell",{feed:t.feedSlug});const i=t.feedSlug,r=t.filter,n=At(i),s=tt.getState().find((t=>t.id===e.id)),o={title:null,tags:[],slidesCount:null,feed:null,filter:null,source:null};s&&(o.title=s.stat_title,o.tags=s.tags,o.slidesCount=s.slides_count),n===Ye.DEFAULT?o.feed=i:n===Ye.UGC&&(o.filter=r),o.source=ue.list,this.storyManager.emit("clickOnStory",Object.assign(Object.assign({},e),o))}}const Bs=.53167701863;class Us{constructor(e,t,i,r,n){this._vw=e,this._vh=t,this.actionPanelHeight=i,this.needBottomPanel=r,this.desktopMode=n,this.viewportRatio=1,this.slideRatio=.64516129032,this.viewportRatio=e/t}get shouldBeShownMobileFrame(){return this.viewportRatio<Bs}get vw(){return this._vw}get vh(){return this._vh}get shouldBeShownSafeAreaInsets(){return this.viewportRatio<Bs}getOffset(){const e=this.calculateStoryViewportHeight(!0),t=this.calculateHeight(!0),i=this._vw,r=this.calculateWidth(!0);let n="";return n=this.desktopMode?this.viewportRatio>this.slideRatio?Math.ceil(t-e)/2*-1+"px auto":`0 ${Math.ceil(r-i)/2*-1}px`:t>e?Math.ceil(t-e)/2*-1+"px auto":`0 ${Math.ceil(r-i)/2*-1}px`,n}getOffsetX(){const e=this.calculateWidth(!0),t=this.calculateStoryViewportHeight(!0),i=this.calculateHeight(!0);if(this.desktopMode)return this.viewportRatio>this.slideRatio?"0px":Math.ceil(e-this._vw)/2+"px";{const r=this._vw;return i>t?"0px":Math.ceil(e-r)/2+"px"}}getHeight(e=!1){return this.viewportRatio>this.slideRatio?`${this.calculateHeight(e)}px`:"100%"}getOffsetY(){const e=this.calculateStoryViewportHeight(!0);if(this.desktopMode)return this.viewportRatio>this.slideRatio?`${Math.ceil(this.calculateHeight()-e)}px`:"0px";{const t=this.calculateHeight();return t>e?Math.ceil(t-e)/2+"px":"0px"}}getWidth(e=!1){return this.viewportRatio>this.slideRatio?`${this.calculateWidth(e)}px`:"auto"}getFontSize(){return this.calculateWidth()/20+"px"}getViewportCorrectionPadding(){if(this.desktopMode)return{};const{paddingTop:e,paddingBottom:t}=this.calcFrameWidthByMobileAspectRatio();return{paddingTop:e+"px",paddingBottom:t+"px"}}calculateWidth(e=!1){return this.desktopMode?Math.ceil(this.calculateStoryViewportHeight(e)*this.slideRatio):this.viewportRatio>this.slideRatio?this._vw:Math.ceil(this.calculateStoryViewportHeight(e)*this.slideRatio)}calculateHeight(e=!1){return this.desktopMode?Math.ceil(this.calculateWidth(e)/this.slideRatio):Math.ceil(this._vw/this.slideRatio)}calculateStoryViewportHeight(e=!1){let t=this._vh;const i=this.needBottomPanel?this.actionPanelHeight:0;t-=e?i:0;const{paddingTop:r,paddingBottom:n}=this.calcFrameWidthByMobileAspectRatio();return this.desktopMode?t-=100:t-=r+n,t}calcFrameWidthByMobileAspectRatio(){if(this.desktopMode)return{paddingTop:0,paddingBottom:0};const e=this._vh-this._vw/Bs,t=Math.max(Math.min(e-this.actionPanelHeight,this.actionPanelHeight),0);return{paddingTop:Math.max(e-t,0),paddingBottom:t}}}var Vs=function(e,t,i,r){return new(i||(i=Promise))((function(n,s){function o(e){try{l(r.next(e))}catch(e){s(e)}}function a(e){try{l(r.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,a)}l((r=r.apply(e,t||[])).next())}))};class Gs{static getUgcEditorConfig(){return Vs(this,void 0,void 0,(function*(){var e,t;let i=m.getState();(null===(e=null==i?void 0:i.session)||void 0===e?void 0:e.id)||(yield y({})),(null==i?void 0:i.editor)||(yield Ht({}));const r=o.getState(),n=m.getState(),s="0.4.2";return{sessionId:n.session.id,apiKey:r.apiKey,editor:null!==(t=n.editor)&&void 0!==t?t:{},sdkVersion:s,appPackageId:r.appPackageId,deviceId:g.getState(),userId:null!=r.userId?String(r.userId):void 0,lang:r.lang.toString()}}))}}var zs=function(e,t,i,r){return new(i||(i=Promise))((function(n,s){function o(e){try{l(r.next(e))}catch(e){s(e)}}function a(e){try{l(r.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,a)}l((r=r.apply(e,t||[])).next())}))};class Ws extends U.EventEmitter{constructor(e,t,i,r){super(),this.storyManager=e,this.storyReaderViewModel=t,this.storyId=i,this.options=r,this.showSharePage=()=>zs(this,void 0,void 0,(function*(){var e;this.handleStartLoad();const t=null===(e=this.storyManager.getConfig())||void 0===e?void 0:e.disableStatistic,i=yield this.storyReaderViewModel.showSingleStoryFromSharePage(this.storyId,t);this.handleEndLoad(i)})),this.handleCloseStoryReader=this.handleCloseStoryReader.bind(this),this.showSharePage(),this.storyReaderViewModel.once("closeStoryReader",this.handleCloseStoryReader)}closeStoryReader(){return zs(this,void 0,void 0,(function*(){this.storyManager.closeStoryReader()}))}handleStartLoad(){setTimeout((()=>{var e;this.emit(gr.START_LOADING),ke()(null===(e=this.options)||void 0===e?void 0:e.handleStartLoad)&&this.options.handleStartLoad()}))}handleEndLoad(e){var t;this.emit(gr.END_LOADING,{result:e}),ke()(null===(t=this.options)||void 0===t?void 0:t.handleStopLoad)&&this.options.handleStopLoad(e)}handleCloseStoryReader(){var e,t,i;if(ke()(null===(e=this.options)||void 0===e?void 0:e.handleStoryReaderClose)||this.listenerCount(gr.CLOSE_STORY_READER)>0)try{ke()(null===(t=this.options)||void 0===t?void 0:t.handleStoryReaderClose)&&(null===(i=this.options)||void 0===i||i.handleStoryReaderClose()),this.emit(gr.CLOSE_STORY_READER)}catch(e){console.error(e)}else{const e=window.location;window.open(`${e.protocol}//${e.host}`,"_parent")}}}var $s=function(e,t,i,r){return new(i||(i=Promise))((function(n,s){function o(e){try{l(r.next(e))}catch(e){s(e)}}function a(e){try{l(r.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,a)}l((r=r.apply(e,t||[])).next())}))};class qs{constructor(e){this.storyManager=e}get sdkVersionName(){return this.storyManager.sdkVersionName}get sdkVersionCode(){return this.storyManager.sdkVersionCode}set storyLinkClickHandler(e){this.storyManager.storyLinkClickHandler=e}getConfig(){return this.storyManager.getConfig()}showOnboardingStories(e){return $s(this,void 0,void 0,(function*(){return this.storyManager.showOnboardingStories(e)}))}showStory(e){return $s(this,void 0,void 0,(function*(){return this.storyManager.showStory(e)}))}closeAllReaders(){this.storyManager.closeAllReaders()}openGame(e){return $s(this,arguments,void 0,(function*(e,t={}){return this.storyManager.openGame(e,t)}))}closeGame(){return $s(this,void 0,void 0,(function*(){return this.storyManager.closeGame()}))}closeStoryReader(){return $s(this,void 0,void 0,(function*(){return this.storyManager.closeStoryReader()}))}getUgcEditorConfig(){return this.storyManager.getUgcEditorConfig()}showSharePage(e,t){return this.storyManager.showSharePage(e,t)}closeGoodsWidget(){this.storyManager.closeGoodsWidget()}on(e,t){return this.storyManager.on(e,t),this}once(e,t){return this.storyManager.once(e,t),this}off(e,t){return this.storyManager.off(e,t),this}}var Hs=function(e,t,i,r){return new(i||(i=Promise))((function(n,s){function o(e){try{l(r.next(e))}catch(e){s(e)}}function a(e){try{l(r.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,a)}l((r=r.apply(e,t||[])).next())}))};const Zs="{{__ugc__}}";class Qs extends U.EventEmitter{constructor(){return super(),this.viewModelStore=new fr,this.config=null,this.callbacks={},this.clickOnButtonAction=({src:e,payload:t})=>{if(ke()(this.callbacks.storyLinkClickHandler)||this.listenerCount(ge.CLICK_ON_STORY)>0){const i={src:e,srcRef:"default",data:t};try{ke()(this.callbacks.storyLinkClickHandler)&&this.callbacks.storyLinkClickHandler(i),this.emit(ge.CLICK_ON_STORY,i)}catch(e){console.error(e)}}else window.open(t.url,"_self")},this.isSingletonInstanceExists()||(Qs.instance=this),Qs.instance}static get combinedPlaceholders(){return bt()}get sdkVersionName(){return"0.4.2"}get sdkVersionCode(){return parseInt(402)}set storyLinkClickHandler(e){ke()(e)&&(this.callbacks.storyLinkClickHandler=e)}get storyReaderViewModel(){return this.viewModelStore.getOneByName(ps.name)}get gameReaderViewModel(){return this.viewModelStore.getOneByName(io.name)}static getInstance(){return Qs.instance?Qs.instance:null}setViewModel(e,t){this.viewModelStore.set(e,t)}getConfig(){return this.config}setConfig(e){this.validateConfig(e),this.initializeConfig(e)}destroy(){if(null!=Qs.instance){Qs.instance=null,this.closeAllReaders();for(const e of this.viewModelStore.getAll())e.destroy()}}setTags(e){this.config&&(T.getInstance().checkTagsLength(e),l({tags:e}),this.config.tags=e)}setUserId(e){return Hs(this,void 0,void 0,(function*(){(Ee()(e)||Le()(e))&&this.config&&(this.config.userId=e,T.getInstance().checkUserIdLength(e),d({userId:e}),S(),yield this.closeAllReaders(),yield this.reloadAllStoryLists())}))}setLang(e){Ee()(e)&&this.config&&(h({lang:e}),this.config.lang=e)}setApiKey(e){this.config&&(M(e),a({apiKey:e}),S(),this.config.apiKey=e)}setPlaceholders(e){ye()(e)&&this.config&&(c({placeholders:e}),_e(e),this.config.placeholders=e)}setImagePlaceholders(e){ye()(e)&&this.config&&(u({imagePlaceholders:e}),Ie(e),this.config.imagePlaceholders=e)}showOnboardingStories(e){return Hs(this,void 0,void 0,(function*(){return this.storyReaderViewModel.showOnboardingStories(e)}))}showStory(e){return Hs(this,void 0,void 0,(function*(){const t=this.storyReaderViewModel;return yield t.showSingleStory(e,"")}))}closeAllReaders(){this.storyReaderViewModel.close(),this.gameReaderViewModel.closeGame()}closeGoodsWidget(){this.storyReaderViewModel.closeGoodsWidget()}openGame(e){return Hs(this,arguments,void 0,(function*(e,t={}){const i=this.gameReaderViewModel;try{if(i.isOpened)throw new Error(`Close the launched game with ID "${i.gameInstanceId}"`);yield i.openGame(e,t)}catch(e){console.error(e)}}))}closeGame(){return Hs(this,void 0,void 0,(function*(){return this.gameReaderViewModel.closeGame()}))}closeStoryReader(){return Hs(this,void 0,void 0,(function*(){this.storyReaderViewModel.close()}))}getUgcEditorConfig(){return Hs(this,void 0,void 0,(function*(){return Gs.getUgcEditorConfig()}))}showSharePage(e,t){return new Ws(this,this.storyReaderViewModel,e,t)}reloadAllStoryLists(){const e=this.viewModelStore.getAllByName(_r.name);return Promise.all(e.map((e=>e.reload())))}isSingletonInstanceExists(){return!!Qs.instance&&(console.warn("StoryManager singleton is created multiple times\nuse IAS.StoryManager.getInstance() instead"),!0)}validateConfig(e){if(e.disableDeviceId&&!e.userId)throw new Error("You must pass the `userId` value");T.getInstance().checkUserIdLength(e.userId),T.getInstance().checkTagsLength(e.tags)}initializeConfig(e){M(e.apiKey),a(e),e.placeholders&&_e(e.placeholders),e.imagePlaceholders&&Ie(e.imagePlaceholders),S(),e.disableStatistic="com.inappstory.webpreview"===e.appPackageId,this.config=e}}const Xs=new Qs,Ys=new qs(Xs);var Ks=function(e,t,i,r){return new(i||(i=Promise))((function(n,s){function o(e){try{l(r.next(e))}catch(e){s(e)}}function a(e){try{l(r.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,a)}l((r=r.apply(e,t||[])).next())}))};const Js=(0,e.createEffect)((e=>Ks(void 0,[e],void 0,(function*({gameInstanceId:e,gameOptions:t}){var i,r;(null===(r=null===(i=m.getState())||void 0===i?void 0:i.session)||void 0===r?void 0:r.id)||(yield y({}));const n={};t&&ye()(t)&&null!=t.demoMode&&(n.demoMode=Boolean(t.demoMode));const s=yield F.post(`game/${e}/launch?expand=config`,n);if(!s.ok)throw new Error(JSON.stringify(s.data));return s.data.clientConfig=eo(),s.data})))),eo=()=>{let e=m.getState();const t=o.getState();return{sessionId:e.session.id,userKey:e.user_key,apiKey:t.apiKey,sdkVersion:"0.4.2",apiBaseUrl:A.apiUrl,userAgent:P,appPackageId:t.appPackageId,deviceId:g.getState(),userId:t.userId?t.userId:"",lang:t.lang.toString(),placeholders:Qs.combinedPlaceholders}};var to=function(e,t,i,r){return new(i||(i=Promise))((function(n,s){function o(e){try{l(r.next(e))}catch(e){s(e)}}function a(e){try{l(r.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,a)}l((r=r.apply(e,t||[])).next())}))};class io extends pr{constructor(e){super(),this.appearanceManager=e,this._isOpened=!1,this._isGameInited=!1,this._isGameLoading=!1,this._gameLaunch=null,this._gameLaunchError=null,this._closeBtnVisible=!1,this.initGameRetryAttempts=0,this.gameCenterMessageService=null,this.safeAreaInsets={top:0,bottom:0,left:0,right:0},this.openGameOptions={},this.desktopMode=!0,this._options=e.gameReaderOptions,this.setAppearanceManager(e),this.handleUpdateGameReaderOptions=this.handleUpdateGameReaderOptions.bind(this),this.handleVisibilityChange=this.handleVisibilityChange.bind(this)}destroy(){var e;this.appearanceManager.off(j.EVENT_UPDATED_GAME_READER_OPTIONS,this.handleUpdateGameReaderOptions),null===(e=this.gameCenterMessageService)||void 0===e||e.destroy(),document.removeEventListener("visibilitychange",this.handleVisibilityChange)}get closeBtnVisible(){return this._closeBtnVisible}get isGameLoading(){return this._isGameLoading}get isGameInited(){return this._isGameInited}get gameLaunchError(){return this._gameLaunchError}get gameLaunch(){return this._gameLaunch}get gameInstanceId(){return this._gameInstanceId}get isOpened(){return this._isOpened}get options(){return this._options}get sharePanelOptions(){return this.appearanceManager.storyReaderOptions.sharePanel}get backdrop(){var e;const t=this._options.backdrop;return{background:null==t?void 0:t.background,opacity:null!==(e=null==t?void 0:t.opacity)&&void 0!==e?e:0,filter:(null==t?void 0:t.blur)?`blur(${t.blur}px)`:"none"}}openGame(e,t){return to(this,void 0,void 0,(function*(){this._gameInstanceId=e,this._isOpened=!0,this.openGameOptions=t,yield this.launchGameById(e)}))}closeGame(){return to(this,void 0,void 0,(function*(){var e;return!!this._isOpened&&(this._isGameInited?null===(e=this.gameCenterMessageService)||void 0===e||e.sendMessage("cb",{cb:"closeGameReader"}):this.handleGameComplete(),!0)}))}reload(){this._gameLaunch=null,this.gameInstanceId?this.launchGameById(this.gameInstanceId):console.error("The game instance ID is undefined")}sendGameCenterEventByApiRequest(e,t){var i;null===(i=this.gameCenterMessageService)||void 0===i||i.sendMessage("cb",{cb:e,plainData:t})}setSafeAreaInsets(e){this.safeAreaInsets=e}setDesktopMode(e){this.desktopMode=e}setAppearanceManager(e){this.appearanceManager.off(j.EVENT_UPDATED_GAME_READER_OPTIONS,this.handleUpdateGameReaderOptions),this._options=e.gameReaderOptions,this.appearanceManager=e,this.handleAppearanceManagerEvents(),this.emit("update")}setGameCenterIframe(e){var t;if(!this._gameLaunch)throw new Error("GameCenter iframe setup error");if(this._isGameInited)return;null===(t=this.gameCenterMessageService)||void 0===t||t.destroy();const i=new URL(this._gameLaunch.url).origin;this.gameCenterMessageService=new de(e,i),this.initGameCenter(this.gameCenterMessageService,this._gameLaunch)}pauseGameUI(){var e;null===(e=this.gameCenterMessageService)||void 0===e||e.sendMessage("cb",{cb:"pauseUI",arguments:JSON.stringify([])})}resumeGameUI(){var e;null===(e=this.gameCenterMessageService)||void 0===e||e.sendMessage("cb",{cb:"resumeUI",arguments:JSON.stringify([])})}confirmSharingComplete({shareId:e,isSuccess:t}){var i;null===(i=this.gameCenterMessageService)||void 0===i||i.sendMessage("shareComplete",{id:e,isSuccess:t})}launchGameById(e){return to(this,void 0,void 0,(function*(){try{this._gameLaunchError=null,this._isGameLoading=!0,this.emit("update"),this._gameLaunch=yield Js({gameInstanceId:e,gameOptions:this.openGameOptions})}catch(e){this._gameLaunchError=e}finally{this.emit("update")}}))}initGameCenter(e,t){this.handleGameCenterEvents(e);const i=this.getGameConfig(t);e.sendMessage("cb",{cb:"initGame",arguments:JSON.stringify([i])})}getGameConfig(e){const t=e.screenOptions;return se()(e.config,{clientConfig:Object.assign({fullScreen:!1,screenOrientation:t.orientation,safeAreaInsets:this.safeAreaInsets,nonce:We()},e.clientConfig)})}handleGameCenterEvents(e){e.on("gameLoaded",this.handleGameLoaded.bind(this)).on("gameComplete",this.handleGameComplete.bind(this)).on("sendApiRequest",this.handleSendApiRequest.bind(this)).on("openUrl",this.handleOpenUrl.bind(this)).on("event",this.handleGameEvent.bind(this)).on("reloadGameReader",this.handleReloadGameReader.bind(this)).on("gameLoadFailed",this.handleGameLoadFailed.bind(this));const t={share:new an(e,this,this.desktopMode),storySetLocalData:new cn(e,this),storyGetLocalData:new dn(e,this),gameInstanceGetLocalData:new tn(e,this),gameInstanceSetLocalData:new rn(e,this)};for(const[i,r]of Object.entries(t))e.on(i,((...e)=>r.handle(...e)))}handleGameLoaded(e){this._isGameInited=!0,this._isGameLoading=!1,this.emit(ce.StartGame),document.addEventListener("visibilitychange",this.handleVisibilityChange);const t=JSON.parse(e);ye()(t)&&(this._closeBtnVisible=Boolean(t.showClose),this.emit("update"))}handleAppearanceManagerEvents(){this.appearanceManager.on(j.EVENT_UPDATED_GAME_READER_OPTIONS,this.handleUpdateGameReaderOptions)}handleUpdateGameReaderOptions(e){this._options=e,this.emit("update")}handleVisibilityChange(){"hidden"===document.visibilityState?this.pauseGameUI():"visible"===document.visibilityState&&this.resumeGameUI()}handleGameComplete(e){var t;this._isGameInited=!1,this._isOpened=!1,this._gameLaunch=null,null===(t=this.gameCenterMessageService)||void 0===t||t.destroy(),this.emit(ce.GameComplete,e),this.emit("update"),wr.emit(`${io.name}.gameComplete`)}handleSendApiRequest(e){this.emit(ce.SendApiRequest,e)}handleOpenUrl(e){const{url:t}=JSON.parse(e);this.emit(ce.OpenUrl,{url:t})}handleGameEvent(e,t){this.emit(ce.GameInstanceEvent,{name:e,payload:t})}handleReloadGameReader(){const e=this._gameLaunch;this._gameLaunch=null,this.emit("update"),setTimeout((()=>{this._gameLaunch=e,this.emit("update")}))}handleGameLoadFailed(e,t){this.gameLaunch&&t&&this.initGameRetryAttempts<this.gameLaunch.canTryReloadCount?(this.initGameRetryAttempts++,this.handleReloadGameReader()):this._gameLaunchError=new Error(e)}}var ro=function(e,t,i,r){return new(i||(i=Promise))((function(n,s){function o(e){try{l(r.next(e))}catch(e){s(e)}}function a(e){try{l(r.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,a)}l((r=r.apply(e,t||[])).next())}))};class no extends Fe{static save(e,t,i){return ro(this,void 0,void 0,(function*(){try{return{data:(yield i("apiRequest",{url:`game/${e}/instance-user-data`,method:"post",params:null,data:t,headers:null})).data,status:200,headers:[{}]}}catch(e){return{data:e,status:400,headers:[{}]}}}))}}var so=function(e,t,i,r){return new(i||(i=Promise))((function(n,s){function o(e){try{l(r.next(e))}catch(e){s(e)}}function a(e){try{l(r.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,a)}l((r=r.apply(e,t||[])).next())}))};class oo{constructor(e){this.storyManager=e}create(){const e=new io(new le);return this.storyManager.setViewModel(io.name,e),this.handleGameReaderViewModelEvents(e),e}handleGameReaderViewModelEvents(e){e.on(ce.StartGame,(()=>this.storyManager.emit("startGame",{id:e.gameInstanceId}))).on(ce.GameInstanceEvent,(e=>this.storyManager.emit("gameEvent",e))).on(ce.GameComplete,(t=>{Kt()(t)?this.storyManager.emit("closeGame",{id:e.gameInstanceId}):this.storyManager.emit("finishGame",{id:e.gameInstanceId,result:t})})).on(ce.OpenUrl,(({url:t})=>{this.storyManager.clickOnButtonAction({src:Sr.GAME_READER,payload:{url:t,gameInstanceId:e.gameInstanceId}})})).on(ce.SendApiRequest,(t=>so(this,void 0,void 0,(function*(){ss.sendApiRequestPromise(t,((t,i)=>e.sendGameCenterEventByApiRequest(t,i)),It)})))).on(ce.StorySetLocalData,(e=>so(this,[e],void 0,(function*({storyId:e,data:t}){ss.sentData(e,t,It)})))).on(ce.GameInstanceSetLocalData,(t=>so(this,[t],void 0,(function*({data:t}){no.save(e.gameInstanceId,t,It)}))))}}Object.freeze({enter:13,tab:9,delete:46,esc:27,space:32,up:38,down:40,left:37,right:39,end:35,home:36,del:46,backspace:8,insert:45,pageup:33,pagedown:34});!function(){var e="test";try{return localStorage.setItem(e,e),localStorage.removeItem(e),!0}catch(e){return!1}}();var ao;function lo(e,t,i){var r=this;return function(){var n=Array.prototype.slice.call(arguments);if("change"===(n[0].type?n[0].type:n[0])){n[0].type?n[0]=po(i,n[0]):n[0]=i;var s,o,a=ho(n[1],r);return"addEventListener"===e&&function(e,t){var i=uo.indexOf(e);i>-1?co[i]=t:(uo.push(e),co.push(t))}(n[1],a),"removeEventListener"===e&&(s=n[1],(o=uo.indexOf(s))>-1&&(uo.splice(o,1),co.splice(o,1))),n[1]=a,t[e].apply(t,n)}}}!function(e){e.LANDSCAPE_PRIMARY="landscape-primary",e.LANDSCAPE_SECONDARY="landscape-secondary",e.PORTRAIT_PRIMARY="portrait-primary",e.PORTRAIT_SECONDARY="portrait-secondary"}(ao||(ao={}));var co=[],uo=[];function ho(e,t){var i=uo.indexOf(e);return i>-1?co[i]:function(i){i.target!==t&&vo(i,"target",t),i.currentTarget!==t&&vo(i,"currentTarget",t),"change"!==i.type&&vo(i,"type","change"),e(i)}}function po(e,t){var i;try{i=new Event(e,t)}catch(e){i={type:"change"}}return i}function fo(e){var t=Object.create({addEventListener:function(e,t){this.listeners[e]||(this.listeners[e]=[]),-1===this.listeners[e].indexOf(t)&&this.listeners[e].push(t)},dispatchEvent:function(t){this.listeners[t.type]&&(this.listeners[t.type].forEach((function(e){e(t)})),"function"==typeof e.onchange&&e.onchange(t))},removeEventListener:function(e,t){if(this.listeners[e]){var i=this.listeners[e].indexOf(t);i>-1&&this.listeners[e].splice(i,1)}}});t.listeners={};var i=go();return i&&"boolean"==typeof i.matches&&i.addListener((function(){t.dispatchEvent(po("change"))})),t}function go(){return"function"!=typeof window.matchMedia?{}:window.matchMedia("(orientation: landscape)")}function vo(e,t,i){Object.defineProperty(e,t,{value:i})}class mo{static createFunctionWithTimeout(e,t){let i=!1;function r(){i||(i=!0,e())}return setTimeout(r,t||1e3),r}static convertModelToFormData(e,t,i){t instanceof Object&&Object.keys(t).forEach((r=>{const n=t[r];if(n instanceof Object&&!Array.isArray(n))return this.convertModelToFormData(e,n,r);i&&(r=`${i}[${r}]`),Array.isArray(n)?n.forEach((t=>{e.append(`${r}[]`,t)})):e.append(r,n)}))}}var yo=p(1085),wo=p(9155),So=p.n(wo),bo=p(8384),_o=p.n(bo);var xo=function(e,t,i){var r=e.key+"-"+t.name;!1===i&&void 0===e.registered[r]&&(e.registered[r]=t.styles)};var Co={animationIterationCount:1,aspectRatio:1,borderImageOutset:1,borderImageSlice:1,borderImageWidth:1,boxFlex:1,boxFlexGroup:1,boxOrdinalGroup:1,columnCount:1,columns:1,flex:1,flexGrow:1,flexPositive:1,flexShrink:1,flexNegative:1,flexOrder:1,gridRow:1,gridRowEnd:1,gridRowSpan:1,gridRowStart:1,gridColumn:1,gridColumnEnd:1,gridColumnSpan:1,gridColumnStart:1,msGridRow:1,msGridRowSpan:1,msGridColumn:1,msGridColumnSpan:1,fontWeight:1,lineHeight:1,opacity:1,order:1,orphans:1,tabSize:1,widows:1,zIndex:1,zoom:1,WebkitLineClamp:1,fillOpacity:1,floodOpacity:1,stopOpacity:1,strokeDasharray:1,strokeDashoffset:1,strokeMiterlimit:1,strokeOpacity:1,strokeWidth:1};function ko(e){var t=Object.create(null);return function(i){return void 0===t[i]&&(t[i]=e(i)),t[i]}}var Oo=/[A-Z]|^ms/g,Eo=/_EMO_([^_]+?)_([^]*?)_EMO_/g,Ao=function(e){return 45===e.charCodeAt(1)},Lo=function(e){return null!=e&&"boolean"!=typeof e},Mo=ko((function(e){return Ao(e)?e:e.replace(Oo,"-$&").toLowerCase()})),Io=function(e,t){switch(e){case"animation":case"animationName":if("string"==typeof t)return t.replace(Eo,(function(e,t,i){return Ro={name:t,styles:i,next:Ro},t}))}return 1===Co[e]||Ao(e)||"number"!=typeof t||0===t?t:t+"px"};function To(e,t,i){if(null==i)return"";if(void 0!==i.__emotion_styles)return i;switch(typeof i){case"boolean":return"";case"object":if(1===i.anim)return Ro={name:i.name,styles:i.styles,next:Ro},i.name;if(void 0!==i.styles){var r=i.next;if(void 0!==r)for(;void 0!==r;)Ro={name:r.name,styles:r.styles,next:Ro},r=r.next;return i.styles+";"}return function(e,t,i){var r="";if(Array.isArray(i))for(var n=0;n<i.length;n++)r+=To(e,t,i[n])+";";else for(var s in i){var o=i[s];if("object"!=typeof o)null!=t&&void 0!==t[o]?r+=s+"{"+t[o]+"}":Lo(o)&&(r+=Mo(s)+":"+Io(s,o)+";");else if(!Array.isArray(o)||"string"!=typeof o[0]||null!=t&&void 0!==t[o[0]]){var a=To(e,t,o);switch(s){case"animation":case"animationName":r+=Mo(s)+":"+a+";";break;default:r+=s+"{"+a+"}"}}else for(var l=0;l<o.length;l++)Lo(o[l])&&(r+=Mo(s)+":"+Io(s,o[l])+";")}return r}(e,t,i);case"function":if(void 0!==e){var n=Ro,s=i(e);return Ro=n,To(e,t,s)}}if(null==t)return i;var o=t[i];return void 0!==o?o:i}var Ro,Po=/label:\s*([^\s;\n{]+)\s*(;|$)/g;var Do=!!wo.useInsertionEffect&&wo.useInsertionEffect,No=Do||function(e){return e()},Fo=(Do||wo.useLayoutEffect,{}.hasOwnProperty),jo=wo.createContext("undefined"!=typeof HTMLElement?_o()({key:"css"}):null);jo.Provider;var Bo=function(e){return(0,wo.forwardRef)((function(t,i){var r=(0,wo.useContext)(jo);return e(t,r,i)}))};var Uo=wo.createContext({});var Vo="__EMOTION_TYPE_PLEASE_DO_NOT_USE__",Go=function(e,t){var i={};for(var r in t)Fo.call(t,r)&&(i[r]=t[r]);return i[Vo]=e,i},zo=function(e){var t=e.cache,i=e.serialized,r=e.isStringTag;return xo(t,i,r),No((function(){return function(e,t,i){xo(e,t,i);var r=e.key+"-"+t.name;if(void 0===e.inserted[t.name]){var n=t;do{e.insert(t===n?"."+r:"",n,e.sheet,!0),n=n.next}while(void 0!==n)}}(t,i,r)})),null},Wo=Bo((function(e,t,i){var r=e.css;"string"==typeof r&&void 0!==t.registered[r]&&(r=t.registered[r]);var n=e[Vo],s=[r],o="";"string"==typeof e.className?o=function(e,t,i){var r="";return i.split(" ").forEach((function(i){void 0!==e[i]?t.push(e[i]+";"):r+=i+" "})),r}(t.registered,s,e.className):null!=e.className&&(o=e.className+" ");var a=function(e,t,i){if(1===e.length&&"object"==typeof e[0]&&null!==e[0]&&void 0!==e[0].styles)return e[0];var r=!0,n="";Ro=void 0;var s=e[0];null==s||void 0===s.raw?(r=!1,n+=To(i,t,s)):n+=s[0];for(var o=1;o<e.length;o++)n+=To(i,t,e[o]),r&&(n+=s[o]);Po.lastIndex=0;for(var a,l="";null!==(a=Po.exec(n));)l+="-"+a[1];var d=function(e){for(var t,i=0,r=0,n=e.length;n>=4;++r,n-=4)t=1540483477*(65535&(t=255&e.charCodeAt(r)|(255&e.charCodeAt(++r))<<8|(255&e.charCodeAt(++r))<<16|(255&e.charCodeAt(++r))<<24))+(59797*(t>>>16)<<16),i=1540483477*(65535&(t^=t>>>24))+(59797*(t>>>16)<<16)^1540483477*(65535&i)+(59797*(i>>>16)<<16);switch(n){case 3:i^=(255&e.charCodeAt(r+2))<<16;case 2:i^=(255&e.charCodeAt(r+1))<<8;case 1:i=1540483477*(65535&(i^=255&e.charCodeAt(r)))+(59797*(i>>>16)<<16)}return(((i=1540483477*(65535&(i^=i>>>13))+(59797*(i>>>16)<<16))^i>>>15)>>>0).toString(36)}(n)+l;return{name:d,styles:n,next:Ro}}(s,void 0,wo.useContext(Uo));o+=t.key+"-"+a.name;var l={};for(var d in e)Fo.call(e,d)&&"css"!==d&&d!==Vo&&(l[d]=e[d]);return l.ref=i,l.className=o,wo.createElement(wo.Fragment,null,wo.createElement(zo,{cache:t,serialized:a,isStringTag:"string"==typeof n}),wo.createElement(n,l))}));var $o=Wo,qo=(p(5985),yo.Fragment);function Ho(e,t,i){return Fo.call(t,"css")?yo.jsx($o,Go(e,t),i):yo.jsx(e,t,i)}function Zo(e,t,i){return Fo.call(t,"css")?yo.jsxs($o,Go(e,t),i):yo.jsxs(e,t,i)}var Qo=p(992),Xo=p.n(Qo),Yo=p(2591),Ko=p.n(Yo),Jo=p(4978),ea={insert:"head",singleton:!1};Ko()(Jo.A,ea);const ta=Jo.A.locals||{};var ia=p(1422),ra={insert:"head",singleton:!1};Ko()(ia.A,ra);const na=ia.A.locals||{},sa=({onClick:e,className:t})=>Ho("div",{className:Xo()(na.icon,t),onClick:e,children:Ho("svg",{viewBox:"0 0 24 24",children:Ho("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"})})});function oa(){var e,t,i,r,n,s,o,a,l,d,c;let u=null;try{u=(null===(e=window.parent)||void 0===e?void 0:e.innerWidth)||window.innerWidth||(null===(r=null===(i=null===(t=window.parent)||void 0===t?void 0:t.document)||void 0===i?void 0:i.documentElement)||void 0===r?void 0:r.clientWidth)||(null===(o=null===(s=null===(n=window.parent)||void 0===n?void 0:n.document)||void 0===s?void 0:s.body)||void 0===o?void 0:o.clientWidth)}catch(e){console.error(e)}return u||(null===(l=null===(a=window.document)||void 0===a?void 0:a.documentElement)||void 0===l?void 0:l.clientWidth)||(null===(c=null===(d=window.document)||void 0===d?void 0:d.body)||void 0===c?void 0:c.clientWidth)}function aa(){var e,t,i,r,n,s;let o=null;try{o=(null===(e=window.parent)||void 0===e?void 0:e.innerHeight)||(null===window||void 0===window?void 0:window.innerHeight)||(null===(r=null===(i=null===(t=window.parent)||void 0===t?void 0:t.document)||void 0===i?void 0:i.documentElement)||void 0===r?void 0:r.clientHeight)}catch(e){console.error(e)}return o||(null===(s=null===(n=null===window||void 0===window?void 0:window.document)||void 0===n?void 0:n.documentElement)||void 0===s?void 0:s.clientHeight)}var la=p(6644),da={insert:"head",singleton:!1};Ko()(la.A,da);const ca=la.A.locals||{},ua=310/480,ha=({desktopMode:e,children:t,verticalPadding:i,style:r,className:n})=>{const[s,o]=(0,wo.useState)({width:"0px",height:"0px"});(0,wo.useEffect)((()=>(a(),window.addEventListener("resize",a),()=>{window.removeEventListener("resize",a)})),[]);const a=()=>{const e=oa(),t=f(),i=e/aa(),r=d({aspectRatio:i,vh:t,vw:e}),n=l({aspectRatio:i,vh:t,vw:e});o({width:r,height:n})},l=({aspectRatio:e,vh:t,vw:i})=>{const r=h(e)||p();return e>ua&&!r?`${u({vh:t,vw:i})}px`:"100%"},d=({aspectRatio:e,vh:t,vw:i})=>e>ua&&!h(e)?`${c({aspectRatio:e,vh:t,vw:i})}px`:"auto",c=({aspectRatio:t,vh:i,vw:r})=>t>ua&&!e?r:Math.ceil(i*ua),u=({vh:t,vw:i})=>e?t:Math.ceil(i/ua),h=e=>e>ua&&e-ua<=.1,p=()=>{let e;return"matchMedia"in window&&void 0!==(e=window.matchMedia("(orientation: portrait)"))&&e.matches},f=()=>{let t=aa();return e?(t-=i,t):t};return Ho("div",{className:Xo()(ca["aspect-ratio-box"],n),style:Object.assign(Object.assign({},r),s),children:Ho("div",{className:ca["aspect-ratio-box-inside"],children:t})})};var pa=p(3639),fa={insert:"head",singleton:!1};Ko()(pa.A,fa);const ga=pa.A.locals||{},va=ci(),ma=e=>{const[t,i]=(0,wo.useState)(!1),r=(0,wo.useCallback)((()=>{if(e.desktopMode)return;const t=va.type!==e.orientation;e.onOrientationChange({type:va.type,isWrong:t}),i(t)}),[e.desktopMode,e.orientation]);return(0,wo.useEffect)((()=>(r(),va.addEventListener("change",r),()=>{va.removeEventListener("change",r)})),[r]),t?Ho("div",{className:ga["screen-orientation-lock"]}):null};var ya=p(5839),wa={insert:"head",singleton:!1};Ko()(ya.A,wa);const Sa=ya.A.locals||{};var ba=p(7231),_a={insert:"head",singleton:!1};Ko()(ba.A,_a);const xa=ba.A.locals||{},Ca=({shareLink:e,sharePanelOptions:t,onDownloadClick:i})=>{var r,n,s,o;return Zo("div",{className:`${Sa["share-panel__body"]} ${xa["share-panel__body_screenshot"]}`,children:[Ho("div",{className:`${Sa["share-panel-row"]} ${xa["share-panel-row"]}`,children:Ho("a",{className:xa["share-panel-row__image-link"],onClick:i,href:e,download:"image.jpeg",children:Ho("img",{src:e,className:xa["share-panel-row__image"]})})}),Ho("div",{className:Sa["share-panel-separator"],style:{background:null===(r=t.divider)||void 0===r?void 0:r.background}}),Ho("div",{className:`${Sa["share-panel-row"]} ${xa["share-panel-row"]}`,children:Ho("a",{className:xa["share-item__download-button"],onClick:i,href:e,download:"image.jpeg",children:Ho("div",{dangerouslySetInnerHTML:{__html:null!==(o=null===(s=null===(n=t.downloadButton)||void 0===n?void 0:n.svgSrc)||void 0===s?void 0:s.baseState)&&void 0!==o?o:""}})})})]})};var ka=p(9749),Oa={insert:"head",singleton:!1};Ko()(ka.A,Oa);const Ea=ka.A.locals||{};var Aa=function(e,t){var i={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(i[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(r=Object.getOwnPropertySymbols(e);n<r.length;n++)t.indexOf(r[n])<0&&Object.prototype.propertyIsEnumerable.call(e,r[n])&&(i[r[n]]=e[r[n]])}return i};const La=p(4862),Ma=e=>{var t,i,r,n,s,o,a,l,d,c,u,{shareLink:h,sharePanelOptions:p,onShareComplete:f}=e,g=Aa(e,["shareLink","sharePanelOptions","onShareComplete"]);const v=()=>{try{return new URL(h).host}catch(e){return console.error(e),null}},m=()=>v()?"":encodeURIComponent(h),y=e=>{var t,i;const r=(()=>{try{return new URL(h)}catch(e){return console.error(e),null}})();if(!r)return"#";const n=null===(t=p.targetParams)||void 0===t?void 0:t[e];return null===(i=null==n?void 0:n.getUrl)||void 0===i?void 0:i.call(n,{url:r.toString(),text:m()})},w=null===(t=p.title)||void 0===t?void 0:t.favicon,S=p.text;return Zo("div",{className:Sa["share-panel__body"],children:[Zo("div",{className:`${Sa["share-panel-row"]} ${Sa["title-row"]}`,children:[v()&&Boolean(null==w?void 0:w.display)&&Ho("div",{className:Sa["share-url-favicon"],style:{background:null==w?void 0:w.background},children:Ho("img",{src:`${null!==(i=g.faviconApiUrl)&&void 0!==i?i:"https://favicon.inappstory.ru"}?sz=64&domain_url=${v()}`})}),Ho("span",{className:Sa.title,style:S,children:null===(n=null===(r=p.title)||void 0===r?void 0:r.getValue)||void 0===n?void 0:n.call(r,{url:h,text:m()})})]}),Ho("div",{className:Sa["share-panel-separator"],style:{background:null===(s=p.divider)||void 0===s?void 0:s.background}}),Ho("div",{className:`${Sa["share-panel-row"]} ${Ea["social-list"]}`,children:null===(o=p.targets)||void 0===o?void 0:o.map(((e,t)=>{var i,r,n;const s=null===(i=p.targetParams)||void 0===i?void 0:i[e],o=null!==(n=null===(r=null==s?void 0:s.icon)||void 0===r?void 0:r.svgSrc.baseState)&&void 0!==n?n:"<svg></svg>";return Ho("div",{className:Ea["social-list__item"],children:Zo("a",{href:y(e),onClick:t=>((e,t,i)=>{Xi(window,"focus",f),window.open(e,t,i)})(y(e),"newwindow","width=650,height=570"),target:"_blank",rel:"noopener noreferrer",className:`${Sa["share-item"]} ${Ea["share-item"]}`,children:[Ho("div",{dangerouslySetInnerHTML:{__html:o}}),Ho("span",{className:Sa["share-item-title"],style:S,children:null==s?void 0:s.label})]})},t)}))}),Ho("div",{className:Sa["share-panel-separator"],style:{background:null===(a=p.divider)||void 0===a?void 0:a.background}}),Ho("div",{className:Sa["share-panel-row"],children:Zo("a",{className:`${Sa["share-item"]} ${Ea["share-item"]}`,onClick:()=>{La.copy(h),f()},children:[Ho("div",{dangerouslySetInnerHTML:{__html:null!==(c=null===(d=null===(l=p.copyButton)||void 0===l?void 0:l.svgSrc)||void 0===d?void 0:d.baseState)&&void 0!==c?c:""}}),Ho("span",{className:Sa["share-item-title"],style:S,children:null===(u=p.copyButton)||void 0===u?void 0:u.label})]})})]})};var Ia;!function(e){e.Social="social",e.SlideScreenshot="slide-screenshot"}(Ia||(Ia={}));const Ta=({shareType:e,shareLink:t,onShareCompelete:i,sharePanelOptions:r,className:n})=>{const[s,o]=(0,wo.useState)(!1),[a,l]=(0,wo.useState)(!0),d=()=>{o(!0),l(!1)};return Zo("div",{className:Xo()(Sa["share-panel-wrapper"],n),onClick:e=>{e.stopPropagation()},onTouchStart:e=>{e.stopPropagation(),e.preventDefault()},children:[Ho("div",{className:Xo()(Sa["share-panel-backdrop"],{[Sa.fadeIn]:a,[Sa.fadeOut]:!a}),onClick:()=>{o(!1),l(!1)}}),Zo("div",{className:Xo()(Sa["share-panel"],{[Sa.slideIn]:a,[Sa.slideOut]:!a}),onAnimationEnd:()=>{a||i(s)},style:{"--height":"100%",background:r.background,borderTopLeftRadius:r.borderRadius+"px",borderTopRightRadius:r.borderRadius+"px"},children:[e===Ia.SlideScreenshot&&Ho(Ca,{shareLink:t,onDownloadClick:d,sharePanelOptions:r}),e===Ia.Social&&Ho(Ma,{shareLink:t,onShareComplete:d,sharePanelOptions:r}),Ho("div",{className:Sa["share-panel-separator"]})]})]})},Ra=({gameReaderViewModel:e})=>{var t,i,r,n;const{desktopMode:s}=Lu(),o=(0,wo.useRef)(null),{sharePanelOpeningParams:a,handleShareComplete:l,closeSharePanel:d}=(e=>{const[t,i]=(0,wo.useState)(null);return(0,wo.useEffect)((()=>(null==e||e.on("openSharePanel",i),()=>{null==e||e.off("openSharePanel",i)})),[e]),{sharePanelOpeningParams:t,handleShareComplete:r=>{t&&e&&(e.confirmSharingComplete({shareId:t.shareId,isSuccess:r}),i(null))},closeSharePanel:()=>{i(null)}}})(e);Ru((()=>{c()}));const c=()=>{e.closeGame(),d()},{backdrop:u,options:h,gameLaunch:p,gameLaunchError:f,isGameLoading:g,closeBtnVisible:v,sharePanelOptions:m}=e,y=Xo()(ta["game-reader"],{[ta["desktop-mode"]]:s,[ta.loading]:!e.gameLaunchError&&e.isGameLoading}),w={background:u.background,opacity:u.opacity,filter:u.filter},S={backgroundColor:null===(t=h.game)||void 0===t?void 0:t.backdropColor,backgroundImage:(null===(i=null==p?void 0:p.splashScreen)||void 0===i?void 0:i.url)?`url(${p.splashScreen.url})`:void 0};return Ho("div",{className:ta["game-reader-container"],children:Zo("div",{className:y,children:[Ho("div",{className:ta["game-reader__backdrop"],style:w}),Zo(ha,{className:ta["game-box"],desktopMode:s,verticalPadding:100,style:S,children:[f&&Ho(sa,{className:ta.refresh,onClick:()=>{e.reload()}}),(g||v)&&Ho("button",{onClick:c,className:ta["game-reader__close"],style:h.closeButtonPosition===B.LEFT?{left:"10px"}:{right:"10px"},dangerouslySetInnerHTML:{__html:null!==(n=null===(r=h.closeButton)||void 0===r?void 0:r.svgSrc.baseState)&&void 0!==n?n:""}}),p&&Zo(qo,{children:[Ho("iframe",{src:p.url,onLoad:t=>{o.current=t.target,e.setGameCenterIframe(o.current)},style:{opacity:g?0:1},frameBorder:"0",className:ta["game-iframe"],sandbox:"allow-same-origin allow-top-navigation allow-forms allow-scripts allow-downloads allow-top-navigation-to-custom-protocols",allow:"fullscreen"}),a&&Ho(Ta,{shareType:a.shareType,shareLink:a.shareLink,onShareCompelete:l,sharePanelOptions:m})]})]}),p&&h.forceCheckOrientation&&Ho(ma,{orientation:ao.PORTRAIT_PRIMARY,desktopMode:s,onOrientationChange:({isWrong:t})=>{e.isGameInited&&(t?e.pauseGameUI():e.resumeGameUI())}})]})})};var Pa=p(1239),Da={insert:"head",singleton:!1};Ko()(Pa.A,Da);const Na=Pa.A.locals||{};class Fa{constructor(e,t,i){this.storyReaderViewModel=e,this.storiesViewer=t,this.backdropRef=i,this.deltaValY=0,this.windowHeight=0,this.swipeUpGestureInAction=!1}get closeGestureInAction(){return Ir.getState()}startMove(){Dr(),this.windowHeight=this.storiesViewer.clientHeight,this.storiesViewer.style.setProperty("transition","")}move(e){e>10||this.closeGestureInAction?(Pr(),this.moveDownAndScaleReader(e)):(e<-10||this.swipeUpGestureInAction)&&this.moveUp(e)}endMove(){Vr(),this.deltaValY>=0?this.handleSwipeDown():this.handleSwipeUp(),Dr()}moveDownAndScaleReader(e){this.deltaValY=e/this.windowHeight;let t=1-(1-.9)*this.deltaValY;t>=1&&(t=1);let i=100*this.deltaValY*.45;i<=0&&(i=0),this.storiesViewer.style.setProperty("transform",`scale(${t}) translateY(${i}%)`)}moveUp(e){this.swipeUpGestureInAction=!0,this.deltaValY=e/this.windowHeight}returnToDefaultState(){this.storiesViewer.style.setProperty("transition","all .3s"),this.storiesViewer.style.setProperty("transform","scale(1) translateY(0%)")}closeStoryReader(){this.storiesViewer.style.setProperty("transition","opacity .3s"),this.storiesViewer.style.setProperty("opacity","0"),this.backdropRef.style.setProperty("transition","opacity .3s"),this.backdropRef.style.setProperty("opacity","0"),setTimeout((()=>{this.storyReaderViewModel.close("swipeDown")}),400)}handleSwipeDown(){this.deltaValY<=.15||!this.storyReaderViewModel.canBeClosed()?this.returnToDefaultState():this.closeStoryReader()}handleSwipeUp(){wr.emit("swipeController.swipeUp")}}const ja=e=>{const[,t]=(0,wo.useState)(0);(0,wo.useEffect)((()=>{if(!e)return;const i=()=>t((e=>e+1));return e.on("update",i),()=>{e.off("update",i)}}),[e])};!function(){const e=window.requestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||window.msRequestAnimationFrame;window.requestAnimationFrame=e}();const Ba=function(){let e,t=document.createElement("div"),i={transition:"transitionend",OTransition:"otransitionend",MozTransition:"transitionend",WebkitTransition:"webkitTransitionEnd"};for(e in i)if(i.hasOwnProperty(e)&&void 0!==t.style[e])return i[e]}();function Ua(e,t,i){return new Promise((r=>{let n=!1;const s=()=>{n=!0,clearTimeout(a),void 0!==Ba&&e.removeEventListener(Ba,o),e.style.setProperty("transition",`${t} 0ms`),r()},o=e=>{e.propertyName===t&&(n||s())};void 0!==Ba&&e.addEventListener(Ba,o,!1);const a=setTimeout((()=>{n||s()}),i+20);e.style.setProperty("transition",`${t} ${i}ms`)}))}class Va extends U.EventEmitter{constructor(){super(...arguments),this.timer=null,this.currentProgress=0,this.progressBeforePause=0,this.timerPaused=!1,this.timeout=0,this.isCompleted=!0}get started(){return!this.isCompleted}setTimer(e){0!==e?(this.timer=setTimeout((()=>this.complete({})),e),this.currentProgress=0,this.cancelAnimationFcn=function(e){let t,i;if("performance"in window==0||"now"in window.performance==0){let e=Date.now();performance.timing&&performance.timing.navigationStart&&(e=performance.timing.navigationStart),i=Date.now()-e}else i=performance.now();return t=requestAnimationFrame((function r(n){let s;if(s=(n-i)/e.duration,s>1&&(s=1),e.forceEnd()&&(s=1),!e.paused()){let i=e.timing(s);e.draw(i),s<1&&(t=requestAnimationFrame(r))}})),()=>{cancelAnimationFrame(t)}}({duration:e,timing:e=>e,draw:e=>this.updateProgress(e),paused:()=>this.timerPaused,forceEnd:()=>!1})):this.forceEnd()}start(e){this.stop(),this.progressBeforePause=0,this.timeout=e,this.isCompleted=!1,this.emit("start"),this.setTimer(e)}stop(){this.isCompleted||(this.clearTimer(),this.timerPaused||(this.emit("stop"),this.isCompleted=!0))}pause(){this.isCompleted||(this.timerPaused=!0,this.stop(),this.progressBeforePause=this.currentProgress,this.emit("pause"))}resume(){if(!this.timerPaused)return;this.timerPaused=!1;const e=1-this.progressBeforePause,t=this.timeout*e;this.setTimer(t),this.emit("resume")}cancelAnimation(){var e;null===(e=this.cancelAnimationFcn)||void 0===e||e.call(this)}forceEnd(){this.complete({forceEnd:!0})}complete({forceEnd:e=!1}){this.isCompleted=!0,this.progressBeforePause=0,this.clearTimer(),this.emit("progress",100),this.emit("complete",{forceEnd:e})}clearTimer(){this.cancelAnimation(),null!==this.timer&&(clearTimeout(this.timer),this.timer=null)}updateProgress(e){const t=1-this.progressBeforePause;this.currentProgress=this.progressBeforePause+e*t;const i=100*this.currentProgress;this.emit("progress",i)}}function Ga(e,t){e.forEach(t)}function za(e,t,i){if(!e)throw Error(`${i?i+": ":""}${t}`)}function Wa({node:e=[],from:t,source:i,parent:r=t||i,to:n,target:s,child:o=n||s,scope:a={},meta:l={},family:d={type:"regular"},regional:c}={}){const u=ml(r),h=ml(d.links),p=ml(d.owners),f=[];Ga(e,(e=>e&&ul(f,e)));const g={id:fl(),seq:f,next:ml(o),meta:l,scope:a,family:{type:d.type||"crosslink",links:h,owners:p}};return Ga(h,(e=>ul(Xa(e),g))),Ga(p,(e=>ul(Ya(e),g))),Ga(u,(e=>ul(e.next,g))),c&&gl&&vl(Ka(gl),[g]),g}function $a(e){const t=()=>e();return t.unsubscribe=()=>e(),t}function qa(e,{scope:t,safe:i}={}){za(t||Al||i,"scopeBind: scope not found");const r=t||Al;return t=>{function i(){Ll(o)}let n,s=0;const o=Al;Ll(r);try{n=e(t)}catch(e){n=e,s=1}if(i(),s)throw n;return n instanceof Promise&&n.then(i,i),n}}function Ha({unit:e,fn:t,scope:i,batch:r}){const n=[kl.run({fn:e=>t(e)})];r&&n.unshift(kl.compute({priority:"sampler",batch:1})),rl(e)&&n.unshift(kl.mov({store:e.stateRef,to:"stack"}));const s=Array.isArray(e)?e:[e];if(i){const e=[],t=i.additionalLinks;return s.forEach((i=>{const r=t[i.graphite.id]||[];t[i.graphite.id]=r;const s=Wa({node:Za(n,i),meta:{watchOp:i.kind}});r.push(s),e.push((()=>{const e=r.indexOf(s);-1!==e&&r.splice(e,1),Rl(s)}))})),$a((()=>{e.forEach((e=>e()))}))}{const e=Wa({node:n,parent:s,family:{owners:s}});return $a((()=>{Rl(e)}))}}function Za(e,t){return rl(t)?[kl.mov({store:t.stateRef,to:"stack"}),...e]:e}"undefined"!=typeof Symbol&&Symbol.observable;const Qa=e=>e.graphite||e,Xa=e=>e.family.owners,Ya=e=>e.family.links,Ka=e=>e.value,Ja=e=>e.subscribers,el=(e,t)=>Qa(e).meta[t],tl=e=>(wl(e)||yl(e))&&"kind"in e,il=e=>t=>tl(t)&&t.kind===e,rl=il("store"),nl=il("event"),sl=il("effect"),ol=e=>tl(e)&&!!e.targetable,al=il("domain"),ll=il("scope");var dl={__proto__:null,unit:tl,store:rl,event:nl,effect:sl,targetable:ol,domain:al,scope:ll,attached:e=>sl(e)&&1==el(e,"attached")};const cl=(e,t)=>{const i=e.indexOf(t);-1!==i&&e.splice(i,1)},ul=(e,t)=>e.push(t),hl=()=>{let e=0;return()=>""+ ++e},pl=(hl(),hl()),fl=hl();hl();let gl=null;const vl=(e,t)=>{const i=Qa(e);Ga(t,(e=>{const t=Qa(e);"domain"!==i.family.type&&(t.family.type="crosslink"),ul(Xa(t),i),ul(Ya(i),t)}))},ml=(e=[])=>(Array.isArray(e)?e:[e]).flat().map(Qa),yl=e=>"object"==typeof e&&null!==e,wl=e=>"function"==typeof e,Sl=(e,t,i,r)=>{const n={id:pl(),type:e,data:t};return i&&(n.order={priority:i},r&&(n.order.barrierID=++bl)),n};let bl=0;const _l=({from:e="store",store:t,target:i,to:r=(i?"store":"stack"),batch:n,priority:s})=>Sl("mov",{from:e,store:t,to:r,target:i},s,n),xl=({fn:e,batch:t,priority:i,safe:r=0,filter:n=0,pure:s=0})=>Sl("compute",{fn:e,safe:r,filter:n,pure:s},i,t),Cl=({fn:e})=>xl({fn:e,priority:"effect"}),kl={mov:_l,compute:xl,filter:({fn:e,pure:t})=>xl({fn:e,filter:1,pure:t}),run:Cl};const Ol=[];let El=0;for(;El<6;)ul(Ol,{first:null,last:null,size:0}),El+=1;new Set;let Al;const Ll=e=>{Al=e};const Ml=(e,t)=>{cl(e.next,t),cl(Xa(e),t),cl(Ya(e),t)},Il=(e,t,i)=>{let r;e.next.length=0,e.seq.length=0,e.scope=null;let n=Ya(e);for(;r=n.pop();)Ml(r,e),(t||i&&"sample"!==e.meta.op||"crosslink"===r.family.type)&&Il(r,t,"on"!==r.meta.op&&i);for(n=Xa(e);r=n.pop();)Ml(r,e),i&&"crosslink"===r.family.type&&Il(r,t,"on"!==r.meta.op&&i)},Tl=e=>e.clear(),Rl=(e,{deep:t}={})=>{let i=0;if(e.ownerSet&&e.ownerSet.delete(e),rl(e))Tl(Ja(e));else if(al(e)){i=1;const t=e.history;Tl(t.events),Tl(t.effects),Tl(t.stores),Tl(t.domains)}Il(Qa(e),!!t,i)};Wa({node:[Cl({fn:({fn:e,value:t})=>e(t)})],meta:{op:"fx",fx:"sidechain"}});var Pl=p(7121),Dl=p(8139);function Nl(e,t){const i=dl.unit(e);let r={};i?r={unit:e}:"@@unitShape"in e?"function"==typeof e["@@unitShape"]?r=e["@@unitShape"]():Bl("expect @@unitShape to be a function"):r=e;const n=Array.isArray(r),s=wo.useRef({stale:1,justSubscribed:0,scope:t}),[o,a,l,d,c]=wo.useMemo((()=>{s.current.stale=1;const e=Array.isArray(r)?[]:{},n=[],o=[],a=[],l=[];for(const s in r){if(!{}.hasOwnProperty.call(r,s))continue;const d=r[s];dl.unit(d)||Bl(`expect useUnit ${i?"argument":`value in key "${s}"`} to be a unit`),dl.event(d)||dl.effect(d)?(e[s]=t?qa(d,{scope:t}):d,a.push(s),l.push(d)):(e[s]=null,n.push(s),o.push(d))}return[e,n,o,a,l]}),[s,t,...Object.keys(r),...Object.values(r)]),u=wo.useRef({value:o,storeKeys:a,eventKeys:d,eventValues:c}),h=wo.useCallback((e=>{const i=s.current;return i.justSubscribed=1,Ha({unit:l,fn:()=>{i.stale||(i.stale=1,e())},scope:t,batch:1})}),[l,t,u,s]),p=wo.useCallback((()=>{const e=u.current,r=s.current;let h,p=0;const f=e.value,g=e.storeKeys,v=e.eventKeys,m=e.eventValues,y=t!==r.scope;if(r.stale||r.justSubscribed||y){p=!r.justSubscribed||y,h=n?[...o]:{...o},g.length===a.length&&v.length===d.length||(p=1);for(let e=0;e<a.length;e++){const i=Gl(l[e],t),r=a[e];p||(p=g.includes(r)?f[r]!==i:1),h[r]=i}for(let e=0;e<d.length;e++){const t=c[e],i=d[e];p||(p=v.includes(i)?m[v.indexOf(i)]!==t:1)}}return p&&(e.value=h),e.storeKeys=a,e.eventKeys=d,e.eventValues=c,r.stale=0,r.justSubscribed=!p,r.scope=t,i?e.value.unit:e.value}),[h,l,c,t,u,s]);return Ul(h,p,p)}function Fl(e){const t=wo.useContext(zl);return e&&!t&&Bl("No scope found, consider adding <Provider> to app root"),t}function jl(e,t){return Nl(e,Fl(null==t?void 0:t.forceScope))}const Bl=e=>{throw Error(e)},{useSyncExternalStore:Ul}=("undefined"!=typeof window?wo.useLayoutEffect:wo.useEffect,Dl),{useSyncExternalStoreWithSelector:Vl}=Pl,Gl=(e,t)=>t?t.getState(e):e.getState(),zl=wo.createContext(null),{Provider:Wl}=zl,$l=e=>{const t=(0,wo.useRef)(null),i=(0,wo.useRef)(null),{desktopMode:r}=Lu(),n=e.storyReaderViewModel.options;(({storyReaderViewModel:e,storiesViewerRef:t,backdropRef:i})=>{const r=(0,wo.useRef)(null);(0,wo.useEffect)((()=>{r.current=new Fa(e,t.current,i.current)}),[]);const n=()=>{var e;t.current.classList.add(Na["no-select"]),null===(e=r.current)||void 0===e||e.startMove()},s=({y:e,lockX:t})=>{var i;t&&(null===(i=r.current)||void 0===i||i.move(e))},o=({lockX:e})=>{var t;e&&(null===(t=r.current)||void 0===t||t.endMove())},a=()=>{t.current.classList.remove(Na["no-select"])};(0,wo.useEffect)((()=>(wr.on("swipeController.startMove",n),wr.on("swipeController.move",s),wr.on("swipeController.endMove",o),wr.on("swipeController.beforeEndMove",a),()=>{wr.off("swipeController.startMove",n),wr.off("swipeController.move",s),wr.off("swipeController.endMove",o),wr.off("swipeController.beforeEndMove",a)})),[])})({storyReaderViewModel:e.storyReaderViewModel,backdropRef:t,storiesViewerRef:i}),ja(e.storyReaderViewModel.activeStory);return Zo(qo,{children:[Zo("div",{ref:i,className:Xo()("stories-viewer",Na["stories-viewer"],Na.slider3d),style:Object.assign(Object.assign({},{"--loaderBackgroundColor":null===(s=n.loader)||void 0===s?void 0:s.default.color,"--loaderBackgroundAccentColor":null===(o=n.loader)||void 0===o?void 0:o.default.accentColor,"--timelineBlockTopOffset":`${parseFloat(String(n.timelineBlockTopOffset))}px`,"--slideBorderRadius":`${parseFloat(String(n.borderRadius))}px`}),(()=>{var e,t,i,r;return{backgroundColor:null!==(t=null===(e=n.commonBackdrop)||void 0===e?void 0:e.color)&&void 0!==t?t:void 0,backdropFilter:null!==(r=null===(i=n.commonBackdrop)||void 0===i?void 0:i.backdropFilter)&&void 0!==r?r:void 0}})()),children:[r&&Ho("div",{className:Na["stories-viewer-background"],style:(()=>{var t,i,r;const s=null===(t=e.storyReaderViewModel.activeStory)||void 0===t?void 0:t.displayedSlideImage,o=[];return null!=n.slideBackdrop&&Array.isArray(n.slideBackdrop.linearGradientOverlay)&&o.push(`linear-gradient(${n.slideBackdrop.linearGradientOverlay.join(", ")})`),null!=s&&o.push(`url(${s})`),{backgroundImage:o.join(", "),opacity:(null===(i=n.slideBackdrop)||void 0===i?void 0:i.opacity)||0,filter:(null===(r=n.slideBackdrop)||void 0===r?void 0:r.blur)?`blur(${n.slideBackdrop.blur}px)`:"none"}})()}),e.children]}),Ho("div",{ref:t,className:Xo()(Na["stories-viewer-backdrop"],{[Na._desktopMode]:r})})]});var s,o};var ql=p(1425),Hl={insert:"head",singleton:!1};Ko()(ql.A,Hl);const Zl=ql.A.locals||{};var Ql=p(6349),Xl={insert:"head",singleton:!1};Ko()(Ql.A,Xl);const Yl=Ql.A.locals||{};var Kl=p(9322),Jl={insert:"head",singleton:!1};Ko()(Kl.A,Jl);const ed=Kl.A.locals||{},td=e=>50+parseFloat(String(e)),id=({story:e,options:t})=>{const i=jl(Rr),r=e.hasLike,n=e.hasShare,s=e.hasFavorite,o=e.hasAudio,a=e.needBottomPanel?td(t.actionPanelBottomOffset):0;return Ho("div",{className:ed["stories-button-panel"],style:{height:`${a}px`,transform:`translateY(${a}px)`},children:e.needBottomPanel&&Zo("div",{className:ed["stories-button-panel-actions"],children:[(()=>{if(!r)return null;const i=0===e.like||-1===e.like,n=0===e.like||1===e.like;return Zo("span",{children:[Ho("span",{className:Xo()(ed["button-panel-action"],{"like-up":i,"like-up-filled":1===e.like}),dangerouslySetInnerHTML:{__html:i?t.likeButton.svgSrc.baseState:t.likeButton.svgSrc.activeState},onClick:()=>{e.setLike(1===e.like?0:1)}}),Ho("span",{className:Xo()(ed["button-panel-action"],{"like-down":n,"like-down-filled":-1===e.like}),dangerouslySetInnerHTML:{__html:n?t.dislikeButton.svgSrc.baseState:t.dislikeButton.svgSrc.activeState},onClick:()=>{e.setDislike(-1===e.like?0:-1)}})]})})(),s&&Ho("span",{children:Ho("span",{className:Xo()(ed["button-panel-action"],{bookmark:!e.favorite,"bookmark-filled":e.favorite}),dangerouslySetInnerHTML:{__html:e.favorite?t.favoriteButton.svgSrc.activeState:t.favoriteButton.svgSrc.baseState},onClick:()=>e.setBookmark(!e.favorite)})}),Zo("span",{className:ed["right-container"],children:[o&&Ho("span",{children:Ho("span",{className:Xo()(ed["button-panel-action"],{"muted-icon":i,"sound-icon":!i}),dangerouslySetInnerHTML:{__html:i?t.muteButton.svgSrc.baseState:t.muteButton.svgSrc.activeState},onClick:()=>{i?Br():jr()}})}),n&&Ho("span",{className:ed["button-panel-action"],dangerouslySetInnerHTML:{__html:t.shareButton.svgSrc.baseState},onClick:()=>{e.share()}})]})]})})};var rd=p(2208),nd={insert:"head",singleton:!1};Ko()(rd.A,nd);const sd=rd.A.locals||{},od=e=>{var t,i;const r=jl(Lr);return Ho("div",{className:sd["story-header"],children:!e.closeDisabled&&Ho("button",{className:Xo()(sd["stories-viewer__close"],{[sd["_paused-ui"]]:r}),style:"left"===e.options.closeButtonPosition?{left:"10px"}:{right:"10px"},onClick:t=>{t.stopPropagation(),t.preventDefault(),e.onClose()},dangerouslySetInnerHTML:{__html:null!==(i=null===(t=e.options.closeButton)||void 0===t?void 0:t.svgSrc.baseState)&&void 0!==i?i:""}})})};var ad=p(9485),ld={insert:"head",singleton:!1};Ko()(ad.A,ld);const dd=ad.A.locals||{};class cd{constructor(e){this.animationApi=e,this.slideElement=null}init(e){this.slideElement=e.querySelector(".narrative-slide")}start(){try{if(!this.slideElement)return;this.animationApi.start(this.slideElement,!0)}catch(e){console.error(e)}}stop(){try{if(!this.slideElement)return;this.animationApi.stop(this.slideElement,!0)}catch(e){console.error(e)}}resume(){this.slideElement&&this.animationApi.resume(this.slideElement)}pause(){this.slideElement&&this.animationApi.pause(this.slideElement)}}var ud=function(e,t,i,r){return new(i||(i=Promise))((function(n,s){function o(e){try{l(r.next(e))}catch(e){s(e)}}function a(e){try{l(r.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,a)}l((r=r.apply(e,t||[])).next())}))};class hd{constructor(e){this.videoEl=e,this.parseDefaultMuted()}get $video(){return this.videoEl}get muted(){return this.videoEl.muted}get paused(){return this.videoEl.paused}start(){return ud(this,void 0,void 0,(function*(){this.videoEl.pause(),this.videoEl.currentTime=0,yield this.play()}))}play(){return ud(this,void 0,void 0,(function*(){const e=this.videoEl.play();e?yield e:yield new Promise((e=>{setTimeout(e,0)}))}))}pause(){this.videoEl.pause()}resume(){return ud(this,void 0,void 0,(function*(){this.videoEl.paused&&(yield this.videoEl.play())}))}stop(){this.videoEl.pause(),this.videoEl.currentTime=0}mute(){"1"!==this.videoEl.getAttribute("data-default-muted")&&(this.videoEl.muted=!0)}unmute(){"1"!==this.videoEl.getAttribute("data-default-muted")&&(this.videoEl.muted=!1)}load(){return ud(this,arguments,void 0,(function*(e=!0){return new Promise((t=>{const i=this.videoEl.oncanplaythrough?"canplaythrough":"canplay";this.videoEl.addEventListener(i,(()=>{requestAnimationFrame((()=>{requestAnimationFrame((()=>{t()}))}))}),{once:!0}),e&&this.videoEl.load()}))}))}on(e,t){return this.videoEl.addEventListener(e,t),this}once(e,t){return this.videoEl.addEventListener(e,t,{once:!0}),this}off(e,t){return this.videoEl.removeEventListener(e,t),this}parseDefaultMuted(){null===this.videoEl.getAttribute("data-default-muted")&&(this.videoEl.muted?this.videoEl.setAttribute("data-default-muted","1"):this.videoEl.setAttribute("data-default-muted","0"))}}var pd=p(3107),fd=function(e,t,i,r){return new(i||(i=Promise))((function(n,s){function o(e){try{l(r.next(e))}catch(e){s(e)}}function a(e){try{l(r.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,a)}l((r=r.apply(e,t||[])).next())}))};class gd extends hd{constructor(e){super(e),this._vodData=null,this.handlePlayerError=this.handlePlayerError.bind(this),this._vodData=gd.parseData(e)}get vodData(){return this._vodData}static get isBrowserSupported(){return pd.Player.isBrowserSupported()}load(){const e=Object.create(null,{load:{get:()=>super.load}});return fd(this,void 0,void 0,(function*(){try{gd.isBrowserSupported?(this.disableVideoPreload(),yield this.initPlayer()):(this.updateVideoSources(),yield e.load.call(this),console.error("[VOD]: Browser not supported!"))}catch(e){this.handlePlayerError({detail:e})}}))}stop(){var e;null===(e=this.player)||void 0===e||e.removeEventListener("error",this.handlePlayerError),super.stop()}static parseData(e){const t=e.getAttribute("data-vod");try{return t&&JSON.parse(t)}catch(e){return null}}initPlayer(){const e=Object.create(null,{stop:{get:()=>super.stop}});return fd(this,void 0,void 0,(function*(){this.player=new pd.Player,this.player.addEventListener("error",this.handlePlayerError),yield this.attachVideoElement(),yield this.loadVideo(),yield this.play(),e.stop.call(this)}))}disableVideoPreload(){this.videoEl.preload="none"}updateVideoSources(){this.videoEl.innerHTML="";for(const e of this.vodData.formats){const t=document.createElement("source");t.src=e.url,t.type=e.mimeType,t.width=e.width,t.height=e.height,this.videoEl.appendChild(t)}}handlePlayerError(e){const t=e.detail,i=`[VOD]: error code ${t.code}; object ${t}`;throw console.error(i),new Error(i)}attachVideoElement(){return fd(this,void 0,void 0,(function*(){yield this.player.attach(this.videoEl),Re("[VOD]: video element attached",this.videoEl)}))}loadVideo(){return fd(this,void 0,void 0,(function*(){const e=pd.Player.convertJsonToUri(this.vodData);yield this.player.load(e,0,"application/json"),Re(`[VOD]: video ${e} successful loaded`)}))}}var vd=function(e,t,i,r){return new(i||(i=Promise))((function(n,s){function o(e){try{l(r.next(e))}catch(e){s(e)}}function a(e){try{l(r.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,a)}l((r=r.apply(e,t||[])).next())}))};class md{constructor(){this.videos=[]}init(e){return vd(this,void 0,void 0,(function*(){this.videos=[];for(const t of Array.from(e.querySelectorAll("video"))){const e=this.createVideoByElement(t);yield e.load(),this.videos.push(e)}}))}start(){return vd(this,void 0,void 0,(function*(){for(const e of this.videos)yield e.start()}))}pause(){for(const e of this.videos)e.pause()}resume(){return vd(this,void 0,void 0,(function*(){for(const e of this.videos)yield e.play()}))}stop(){for(const e of this.videos)e.stop()}static hasVideo(e){return Boolean(e.querySelector(".narrative-slide__with-video"))}mute(){for(const e of this.videos)e.mute()}unmute(){for(const e of this.videos)e.unmute()}createVideoByElement(e){return gd.parseData(e)?new gd(e):new hd(e)}}const yd=function(){const e={step:1,maxSteps:100};var t=Object.prototype.hasOwnProperty;return function(r,n){n||(n={});var s={};for(var o in e)t.call(n,o)?s[o]=n[o]:s[o]=e[o];var a=Object.prototype.toString.call(r);"[object Array]"!==a&&"[object NodeList]"!==a&&"[object HTMLCollection]"!==a&&(r=[r]);for(var l=0;l<r.length;l++)i(r[l],s)};function i(e,t){if(!r(e)||e.getAttribute("textFitted"))return!1;var i,n,s,o;if(!r(n=e.parentElement))return!1;if(i=function(e){var t=window.getComputedStyle(e,null);return e.getBoundingClientRect().height-parseInt(t.getPropertyValue("padding-top"),10)-parseInt(t.getPropertyValue("padding-bottom"),10)}(n),i<=0)console.warn(`Set a static height and width on the target element ${e.outerHTML} before using textFit!`,e);else{e.setAttribute("textFitted","1");var a=t.step,l=o=parseFloat(window.getComputedStyle(e).fontSize);if(!(l<(s=o-a*t.maxSteps)))for(;l>=s;){if(!(e.getBoundingClientRect().height>i))break;l-=a,e.style.fontSize=l+"px"}}}function r(e){return"object"==typeof HTMLElement?e instanceof HTMLElement:e&&"object"==typeof e&&null!==e&&1===e.nodeType&&"string"==typeof e.nodeName}}();var wd=function(e,t,i,r){return new(i||(i=Promise))((function(n,s){function o(e){try{l(r.next(e))}catch(e){s(e)}}function a(e){try{l(r.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,a)}l((r=r.apply(e,t||[])).next())}))};class Sd{constructor(e){this.layerManager=e,this.videoContexts=new Map,this.muted=!1,this.handleShowLayer=this.handleShowLayer.bind(this),this.handleHideLayer=this.handleHideLayer.bind(this),this.subscribeLayerManager()}init(){return wd(this,void 0,void 0,(function*(){for(const e of this.layerManager.getLayers()){const t=new md;yield t.init(e),this.videoContexts.set(e,t)}}))}start(){return wd(this,void 0,void 0,(function*(){const e=this.getActiveVideoContext();yield null==e?void 0:e.start()}))}mute(){this.muted=!0;const e=this.getActiveVideoContext();null==e||e.mute()}unmute(){this.muted=!1;const e=this.getActiveVideoContext();null==e||e.unmute()}resume(){return wd(this,void 0,void 0,(function*(){const e=this.getActiveVideoContext();null==e||e.resume()}))}pause(){const e=this.getActiveVideoContext();null==e||e.pause()}stop(){for(const e of this.videoContexts.values())e.stop();this.videoContexts=new Map,this.unsubscribeLayerManager()}subscribeLayerManager(){this.layerManager.on("showLayer",this.handleShowLayer),this.layerManager.on("hideLayer",this.handleHideLayer)}unsubscribeLayerManager(){this.layerManager.off("showLayer",this.handleShowLayer),this.layerManager.off("hideLayer",this.handleHideLayer)}handleShowLayer({layer:e}){this.intheritMuted();const t=this.videoContexts.get(e);null==t||t.start()}handleHideLayer({layer:e}){const t=this.videoContexts.get(e);null==t||t.stop()}getActiveVideoContext(){const e=this.layerManager.activeLayer;if(e)return this.videoContexts.get(e)}intheritMuted(){this.muted?this.mute():this.unmute()}}var bd=function(e,t,i,r){return new(i||(i=Promise))((function(n,s){function o(e){try{l(r.next(e))}catch(e){s(e)}}function a(e){try{l(r.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,a)}l((r=r.apply(e,t||[])).next())}))};class _d{constructor(e){this.videoContainer=e,this.videoContext=new md}init(){return bd(this,void 0,void 0,(function*(){yield this.videoContext.init(this.videoContainer)}))}start(){return bd(this,void 0,void 0,(function*(){yield this.videoContext.start()}))}pause(){this.videoContext.pause()}resume(){return bd(this,void 0,void 0,(function*(){yield this.videoContext.resume()}))}stop(){this.videoContext.stop()}mute(){this.videoContext.mute()}unmute(){this.videoContext.unmute()}}class xd{static create(e,t){return e.querySelectorAll(".narrative-slide.narrative-multi-slide").length>0?new Sd(t):new _d(e)}}var Cd,kd=function(e,t,i,r){return new(i||(i=Promise))((function(n,s){function o(e){try{l(r.next(e))}catch(e){s(e)}}function a(e){try{l(r.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,a)}l((r=r.apply(e,t||[])).next())}))};!function(e){e.None="none",e.Loading="loading",e.Loaded="loaded",e.Started="started",e.Paused="paused",e.Error="error"}(Cd||(Cd={}));class Od extends U.EventEmitter{constructor(e,t,i,r){super(),this.widgetManager=e,this.animationApi=t,this.slideContent=i,this.layersManager=r,this._state=Cd.None,this.videoManager=null,this.narrativeAnimationContext=new cd(this.animationApi)}get state(){return this._state}get meta(){return this._meta}get isNavigationDisabled(){const e=this.slideContent.querySelector(".narrative-slide");return!!e&&"1"===e.dataset.disableNavigation}get isVisible(){return this.state===Cd.Loaded||this.state===Cd.Started||this.state===Cd.Paused}init(){return kd(this,void 0,void 0,(function*(){this.videoManager=xd.create(this.slideContent,this.layersManager),this.slideContentInnerHTML=this.slideContent.innerHTML,Re(`[SLIDE][init]:${this.meta.currentStoryId}:${this.meta.currentSlideIndex}`),yield this.widgetManager.init(this.slideContent),yield this.load()}))}start(){return kd(this,void 0,void 0,(function*(){var e;try{if(this.state!==Cd.Loaded)throw new Error(`You must initialize the slide first. State: ${this.state}`);this.fitNarrativeTextLines(),yield null===(e=this.videoManager)||void 0===e?void 0:e.start(),this.narrativeAnimationContext.init(this.slideContent),this.narrativeAnimationContext.start(),Re(`[SLIDE][start]:${this.meta.currentStoryId}:${this.meta.currentSlideIndex}`),this.setState(Cd.Started),wr.emit("slide.loaded",this.meta.currentSlideIndex)}catch(e){console.error(e)}}))}stop(){var e;this.state===Cd.Started&&(this.narrativeAnimationContext.stop(),null===(e=this.videoManager)||void 0===e||e.stop(),wr.emit("slide.stop",{slideIndex:this.meta.currentSlideIndex,storyId:this.meta.currentStoryId}),Re(`[SLIDE][stop]:${this.meta.currentStoryId}:${this.meta.currentSlideIndex}`),this.widgetManager.stop(),this.resetSlideContentHTML(),this.setState(Cd.None))}destroy(){this.removeAllListeners()}resume(){return kd(this,void 0,void 0,(function*(){var e;try{if(this.state!==Cd.Paused)return;yield null===(e=this.videoManager)||void 0===e?void 0:e.resume(),this.narrativeAnimationContext.resume(),this.widgetManager.resume(),Re(`[SLIDE][resume]:${this.meta.currentStoryId}:${this.meta.currentSlideIndex}`),this.setState(Cd.Started)}catch(e){console.error(e)}}))}pause(){var e;this.state===Cd.Started&&(null===(e=this.videoManager)||void 0===e||e.pause(),this.narrativeAnimationContext.pause(),this.widgetManager.pause(),Re(`[SLIDE][pause]:${this.meta.currentStoryId}:${this.meta.currentSlideIndex}`),this.setState(Cd.Paused))}setMeta(e){this._meta=e,this.notifyPropertyChanged("meta")}mute(){var e;null===(e=this.videoManager)||void 0===e||e.mute()}unmute(){var e;null===(e=this.videoManager)||void 0===e||e.unmute()}resetSlideContentHTML(){this.slideContent.innerHTML=this.slideContentInnerHTML}containsCurrent(){var e;return null===(e=this.slideContent.querySelector(".narrative-slide"))||void 0===e?void 0:e.classList.contains("current")}setState(e){this._state=e,this.notifyPropertyChanged("state")}load(){return kd(this,void 0,void 0,(function*(){if(this.state!==Cd.Loaded)try{Re(`[SLIDE][start_load]:${this.meta.currentStoryId}:${this.meta.currentSlideIndex}`),yield this.loadResources(),yield this.sleepWhileSlideHasNoContent(),this.fitNarrativeTextLines(),this.setState(Cd.Loaded),Re(`[SLIDE][end_load]:${this.meta.currentStoryId}:${this.meta.currentSlideIndex}`)}catch(e){console.error(e),this.setState(Cd.Error)}}))}loadResources(){return kd(this,void 0,void 0,(function*(){var e;yield this.loadMediaResources(this.slideContent),yield this.loadFonts(),md.hasVideo(this.slideContent)&&(this.setState(Cd.Loading),yield null===(e=this.videoManager)||void 0===e?void 0:e.init(this.slideContent))}))}loadFonts(){return new Promise((e=>{"fonts"in document?document.fonts.ready&&document.fonts.ready.catch(e).finally(e):e()}))}loadMediaResources(e){return new Promise((t=>function(e,t){const i=function(e){return new Promise((function(t,i){if("img"===e.tagName.toLowerCase()&&e instanceof HTMLImageElement){const i=()=>{requestAnimationFrame((()=>requestAnimationFrame((()=>{t(e),e.removeEventListener("load",i)}))))};e.addEventListener("load",i),e.complete&&0!==e.naturalHeight&&requestAnimationFrame((function(){requestAnimationFrame((function(){t(e)}))}))}else t(e);e.addEventListener("error",(function(e){var t=e.target instanceof HTMLImageElement;if(e&&e.target&&t&&e.target.style){e.target.style.display="none";var r=e.target.closest(".narrative-element-image");r&&(r.style.display="none")}i(e)}))}))},r=e.querySelectorAll("img,video");let n,s=[];for(n=0;n<r.length;++n)s.push(i(r[n]));s.length,Promise.all(s).then((e=>{t()}))}(e,t)))}fitNarrativeTextLines(){const e=Array.from(this.slideContent.querySelectorAll(".narrative-element-text-wrapper>.narrative-element-text-lines")).slice();yd(e,{})}sleepWhileSlideHasNoContent(){return kd(this,void 0,void 0,(function*(){let e=0;return new Promise((t=>{const i=()=>{e++,this.slideContent.getBoundingClientRect().height>0||e>10?t():requestAnimationFrame(i)};i()}))}))}notifyPropertyChanged(e,t,i){this.emit("propertyChanged",{propertyName:e,from:t,to:i})}}class Ed extends(V()){constructor(){super(...arguments),this.layers=[]}init(e,t){this.layersContainer=e,this.animationApi=t,this.layers=Array.from(this.layersContainer.querySelectorAll(".narrative-slide.narrative-multi-slide")),this._activeLayer=this.layers.find((e=>!e.classList.value.includes("hidden")))}get activeLayer(){return this._activeLayer}getLayers(){return this.layers}hideLayer(e){this.animationApi.stop(e,!0),e.classList.add("hidden"),this.emit("hideLayer",{layer:e})}showLayer(e){wr.emit("story.showLayerByIndex"),e.classList.remove("hidden"),this.animationApi.start(e,!0),this._activeLayer=e,this.emit("showLayer",{layer:e})}hideAllLayers(){this.getLayers().forEach((e=>this.hideLayer(e)))}showLayerByIndex(e){const t=this.getLayers();t.forEach((e=>this.hideLayer(e)));const i=t[e];i&&this.showLayer(i)}hasValidMultiSlides(){let e=!0,t=this.layersContainer.querySelectorAll(".narrative-slide.narrative-multi-slide");const i=this.layersContainer.querySelectorAll(".narrative-slide.narrative-multi-slide:not(.hidden)");return t.length>0&&0===i.length&&(e=!1),e}}var Ad=function(e,t){var i={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(i[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(r=Object.getOwnPropertySymbols(e);n<r.length;n++)t.indexOf(r[n])<0&&Object.prototype.propertyIsEnumerable.call(e,r[n])&&(i[r[n]]=e[r[n]])}return i};const Ld=(e,t)=>{var i,r,n,s;const o=t.dataset;let a=null,l=null!==(i=o.elementId)&&void 0!==i?i:"";const d=null!==(r=o.linkType)&&void 0!==r?r:"",c=null!==(n=o.linkTarget)&&void 0!==n?n:"",u={url:()=>{a=decodeURIComponent(c),Md({activeStory:e,url:a,elementId:l}),Id(e,{linkType:d,url:a,elementId:l})},customAction:()=>{a=c,Md({activeStory:e,url:a,elementId:l}),Id(e,{linkType:d,url:a,elementId:l})},slide:()=>{e.redirectToSlide({slideIndex:parseInt(c),layerIndex:0})},story:()=>{const t=parseInt(c);Md({activeStory:e,url:c,elementId:l}),wr.emit("storyReader.redirectToStory",{storyId:t,feedSlug:"default"})},game:()=>{Md({activeStory:e,url:c,elementId:l}),wr.emit("openGameCenter",{gameId:c})},layer:()=>{wr.emit("storySlide.showLayer",{index:parseInt(c)})}};null===(s=u[d])||void 0===s||s.call(u)},Md=({activeStory:e,url:t,elementId:i})=>{wr.emit("publicEvents.widgetEvent",{name:"w-link",devPayload:{story_id:e.id,slide_index:e.activeSlideIndex,widget_id:i,widget_label:"",widget_value:t}})},Id=(e,{linkType:t,url:i,elementId:r})=>{e.markAsOpened(),wr.emit("statistics.transitionFromSlide",{storyId:e.id,slideIndex:e.activeSlideIndex}),"url"===t&&wr.emit("publicEvents.clickOnButton",{id:e.id,index:e.activeSlideIndex,url:i,elementId:r})},Td=(e,t)=>{const i={".narrative-element-quiz":In.name,".narrative-element-test":Vn.name,".narrative-element-quiz-grouped":Rn.name,".narrative-element-quest":Ln.name};for(const r of Object.keys(i)){if(e.closest(r)){const n=t.findWidgetByType(i[r]);return null==n||n.select(e),!1}}return!0},Rd=(e,t)=>{const i=t.findWidgetByType(kn.name),r=t.findWidgetByType(En.name);return(null==i?void 0:i.isInited)?(i.select(e),!1):!(null==r?void 0:r.isInited)||(r.select(e),!1)};var Pd;!function(e){e[e.ALLOW_ALL_CLICKS=0]="ALLOW_ALL_CLICKS",e[e.DENY_NEXT_CLICK=1]="DENY_NEXT_CLICK",e[e.DENY_ALL_CLICKS=2]="DENY_ALL_CLICKS"}(Pd||(Pd={}));const Dd=e=>e?Pd.ALLOW_ALL_CLICKS:Pd.DENY_NEXT_CLICK,Nd=e=>{var t,i;const r=e.firstElement;if(!r)return Pd.ALLOW_ALL_CLICKS;const n={[In.name]:()=>{const t=e.slideQuizIsDone(r);return Dd(t)},[Rn.name]:()=>{const t=e.slideQuizIsDone(r);return Dd(t)},[Vn.name]:()=>{const t=e,i=t.slideTestIsDone(r);return t.slideTestWithTimer(r)&&!i?Pd.DENY_ALL_CLICKS:Dd(i)},[Dn.name]:()=>e.isClickCapturedBySlider(r)?Pd.DENY_ALL_CLICKS:Pd.ALLOW_ALL_CLICKS};return null!==(i=null===(t=n[e.getType()])||void 0===t?void 0:t.call(n))&&void 0!==i?i:Pd.ALLOW_ALL_CLICKS},Fd=({activeStory:e,desktopMode:t,geometry:i,navigationDisabled:r,widgetManager:n})=>{const s=(e,t=!1)=>{e<=.3?o():t||a()},o=()=>{e.reachStart?wr.emit(`${ps.name}.showPrevStory`):e.prevSlide()},a=()=>{e.reachEnd?wr.emit(`${ps.name}.showNextStory`):e.nextSlide()};return{handleSlideClick:o=>{const a=o.target;if(!a)return;const l=a.classList;if(l.contains("narrative-element-link")||l.contains("narrative-element-image")||l.contains("narrative-element-swipe-up"))return void Ld(e,a);if(!((e,t,i)=>{const r=e.classList,n={"narrative-element-quiz-next-button":()=>(t.nextSlide(),wr.emit("story.nextSlide"),!1),"narrative-element-test-next-button":()=>(t.prevSlide(),wr.emit("story.nextSlide"),!1),"narrative-element-quiz-answer":()=>Td(e,i),"narrative-element-test-answer":()=>Td(e,i),"narrative-element-data-input":()=>{var t;return null===(t=i.findWidgetByType(bn.name))||void 0===t||t.click(e),!1},rangeslider:()=>!1,"narrative-element-range-slider-next-button":()=>{var t;return null===(t=i.findWidgetByType(Dn.name))||void 0===t||t.click(e),!1},"narrative-element-poll-button":()=>Rd(e,i),"narrative-element-vote-answer":()=>{var t;return null===(t=i.findWidgetByType(zn.name))||void 0===t||t.select(e),!1},"narrative-element-rate-input":()=>{var t;return null===(t=i.findWidgetByType(Fn.name))||void 0===t||t.select(e),!1},"narrative-element-copy":()=>{var t;return null===(t=i.findWidgetByType(wn.name))||void 0===t||t.click(e),!1},"narrative-element-share":()=>{var t;return null===(t=i.findWidgetByType(Bn.name))||void 0===t||t.click(e),!1},"narrative-element-story-repeat":()=>(wr.emit("slideApiHandlers.repeatStory",{storyId:t.id}),!1)};for(const e of r)if(n[e])return n[e]();return!0})(a,e,n))return;let d=!1;for(const e of n.widgets){const t=Nd(e);if(t===Pd.DENY_ALL_CLICKS)return;t===Pd.DENY_NEXT_CLICK&&(d=!0)}if(r)return;const c=(e=>{var r;let n=0,s=0;return t?(n=parseFloat(i.getWidth()),s=e.nativeEvent.offsetX):(n=i.vw,s=e.nativeEvent.pageX||(null===(r=e.nativeEvent.touches)||void 0===r?void 0:r[0].pageX)),s/n})(o),u=n.findWidgetByType(Ln.name);(null==u?void 0:u.firstElement)?u.handleRouteClick({direction:c>=.3?"forward":"backward",slideIndex:e.activeSlideIndex,slidesCount:e.slidesCount,onClick:()=>s(c,d)}):s(c,d)}}},jd=(e,t="",i="")=>{qr(),fn({link:i,type:e,id:t})};var Bd=function(e,t,i,r){return new(i||(i=Promise))((function(n,s){function o(e){try{l(r.next(e))}catch(e){s(e)}}function a(e){try{l(r.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,a)}l((r=r.apply(e,t||[])).next())}))};const Ud=(e,t)=>Bd(void 0,void 0,void 0,(function*(){const i=Vd();if(!i)throw new Error;try{qr(),qn({id:e}),yield i(t),Hn({result:!0})}catch(e){if(e instanceof DOMException&&"AbortError"===e.name)return;throw e}finally{Hn({result:!1})}})),Vd=()=>{var e,t;let i=null===(e=navigator.share)||void 0===e?void 0:e.bind(navigator);return!i&&(null===(t=window.parent)||void 0===t?void 0:t.navigator.share)&&(i=window.parent.navigator.share.bind(window.parent.navigator)),i};var Gd=function(e,t,i,r){return new(i||(i=Promise))((function(n,s){function o(e){try{l(r.next(e))}catch(e){s(e)}}function a(e){try{l(r.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,a)}l((r=r.apply(e,t||[])).next())}))};const zd=e=>Gd(void 0,[e],void 0,(function*({shareId:e,hideElementsSelector:t,slideContent:i,desktopMode:r}){let n=null;try{const s=yield Oi(Ci.IOS,i,function(e){let t="";return Array.prototype.slice.call(window.document.styleSheets).forEach((i=>{e(i)&&(t+=Array.prototype.slice.call(i.rules).map((e=>e.cssText)).join(""))})),t}((function(e){return!0})),t),o={files:[s]};if(n=URL.createObjectURL(s),r)return void jd(sn.SlideScreenshot,e,n);yield Ud(e,o)}catch(t){n&&jd(sn.SlideScreenshot,e,n)}}));var Wd=function(e,t,i,r){return new(i||(i=Promise))((function(n,s){function o(e){try{l(r.next(e))}catch(e){s(e)}}function a(e){try{l(r.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,a)}l((r=r.apply(e,t||[])).next())}))};const $d=e=>{const t={};for(const[i,r]of Object.entries(null!=e?e:{}))null!==r&&(t[i]=r);return t},qd=e=>{const t=({shareId:t,config:i})=>{var r;r={shareId:t,config:i,desktopMode:e.desktopMode},Wd(void 0,[r],void 0,(function*({shareId:e,config:t,desktopMode:i}){var r;null==e&&(e="story-share");const n=$d(t),s=n.url=null!==(r=n.url)&&void 0!==r?r:n.text;try{if(i)return void jd(sn.Social,e,s);yield Ud(e,n)}catch(t){jd(sn.Social,e,s)}}))},i=({shareId:t,hideElementsSelector:i})=>{const r=e.slideContentRef.current;zd({shareId:t,hideElementsSelector:i,slideContent:r,desktopMode:e.desktopMode})};(0,wo.useEffect)((()=>{if(e.state===Cd.Started)return wr.on("storySlide.performShareAction",t),wr.on("storySlide.performScreenShotShareAction",i),()=>{wr.off("storySlide.performShareAction",t),wr.off("storySlide.performScreenShotShareAction",i)}}),[e.state])};var Hd=p(8624),Zd={insert:"head",singleton:!1};Ko()(Hd.A,Zd);Hd.A.locals;var Qd=function(e,t){var i={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(i[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(r=Object.getOwnPropertySymbols(e);n<r.length;n++)t.indexOf(r[n])<0&&Object.prototype.propertyIsEnumerable.call(e,r[n])&&(i[r[n]]=e[r[n]])}return i};const Xd=e=>{var{geometry:t}=e,i=Qd(e,["geometry"]);const{desktopMode:r}=Lu(),{slideContentRef:n,widgetManager:s,state:o,navigationDisabled:a,isVisible:l,needLoadingAnimation:d,needLoadingMask:c}=(e=>{var t,i,{activeSlideIndex:r,currentStoryId:n,activeStoryId:s,slidesLoaded:o,currentSlideIndex:a,needSlideInit:l}=e,d=Ad(e,["activeSlideIndex","currentStoryId","activeStoryId","slidesLoaded","currentSlideIndex","needSlideInit"]);const[c,u]=jl([Rr,Mr]),[h,p]=(0,wo.useState)(Cd.None),[f,g]=(0,wo.useState)({}),v=(0,wo.useRef)(null),m=(0,wo.useRef)(new Ed).current,y=(0,wo.useRef)(new Os(d.slideApi,m)).current,[w,S]=(0,wo.useState)(null),b=s===n,_=b||l;(0,wo.useLayoutEffect)((()=>{const e=v.current,t=new Od(y,d.slideApi.Animation,e,m);return C(t),t.on("propertyChanged",(({propertyName:e})=>x(t,e))),S(t),()=>{t.stop(),t.destroy(),y.destroy()}}),[]),(0,wo.useLayoutEffect)((()=>{w&&_&&o&&h===Cd.None&&0===a&&w.init(),w&&!_&&w.stop()}),[w,_,o,h,a]),(0,wo.useLayoutEffect)((()=>{w&&b&&(h===Cd.Loaded&&0===a&&(w.start(),d.onSlideStarted({index:r,widgetManager:y,slideContent:v.current})),h===Cd.Started&&1===a&&w.stop())}),[w,h,a,b]),(0,wo.useEffect)((()=>{w&&(u?w.pause():w.resume())}),[w,u,h]),(0,wo.useEffect)((()=>{w&&(c?w.mute():w.unmute())}),[w,c,h]),(0,wo.useEffect)((()=>{w&&C(w)}),[w,r,n,s,o,c,a]);const x=(e,t)=>{"state"===t&&p(e.state),"meta"===t&&g(e.meta)},C=e=>{e.setMeta({activeSlideIndex:r,currentSlideIndex:a+r,currentStoryId:n,activeStoryId:s,muted:c})},k=h===Cd.Loading||h===Cd.Error||!o,O=h===Cd.Loading||h===Cd.Error||!o;return{slideContentRef:v,widgetManager:y,state:h,navigationDisabled:null===(t=null==w?void 0:w.isNavigationDisabled)||void 0===t||t,needLoadingMask:k,isVisible:null!==(i=null==w?void 0:w.isVisible)&&void 0!==i&&i,needLoadingAnimation:O}})(Object.assign(Object.assign({},i),{activeStoryId:i.activeStory.id}));qd({slideContentRef:n,desktopMode:r,state:o}),(({state:e,activeStory:t})=>{(0,wo.useEffect)((()=>{if(e===Cd.Started)return wr.on("slide.openSwipeUpLink",i),()=>{wr.off("slide.openSwipeUpLink",i)}}),[e]);const i=e=>{Ld(t,e.target)}})({state:o,activeStory:i.activeStory});const{handleSlideClick:u}=Fd({activeStory:i.activeStory,desktopMode:r,geometry:t,widgetManager:s,navigationDisabled:a});return Zo("div",{onClick:e=>{e.preventDefault(),e.stopPropagation(),i.clickDisabled||u(e)},className:`${dd["stories-slide"]} ${dd[`_position_${i.currentSlideIndex+1}`]} ${Xo()({[dd["_with-bottom-panel"]]:i.needBottomPanel,[dd["_desktop-mode"]]:r})}`,children:[Ho("div",{className:dd["stories-slide-offset"],style:{margin:t.getOffset(),width:t.getWidth(),height:t.getHeight(),"--y-offset":t.getOffsetY(),"--x-offset":t.getOffsetX()},children:Ho("div",{className:dd["stories-slide-box"],children:Ho("div",{ref:n,dangerouslySetInnerHTML:{__html:i.slideHtml},className:`${dd["stories-slide-content"]} narrative-slide"`,style:{fontSize:t.getFontSize(),opacity:1}})})}),c&&Ho("div",{className:dd["load-mask"],children:d&&Ho("div",{className:dd["loading-spinner-default"]})})]})};var Yd=p(5196),Kd={insert:"head",singleton:!1};Ko()(Yd.A,Kd);const Jd=Yd.A.locals||{},ec=(0,wo.forwardRef)(((e,t)=>{const{desktopMode:i}=Lu(),r=jl(Lr);return Ho("div",{ref:t,className:Xo()(Jd["stories-pager"],{[Jd["_desktop-mode"]]:i,[Jd["_paused-ui"]]:r}),children:Ho("div",{className:`${Jd["stories-pager__ticks"]} ${Xo()({[Jd.hiddenTimeline]:e.hiddenTimeline})}`,children:new Array(e.slidesLength).fill(0).map(((t,i)=>Zo("div",{className:Jd["stories-pager__tick"],children:[Ho("div",{className:Xo()(Jd["stories-pager__tick-progress"],{[Jd._active]:i+1<=e.activeSlide})}),Ho("div",{className:Jd["stories-pager__tick-progress-loader"],style:{display:i+1===e.activeSlide+1?"block":"none"}})]},i+1)))})})}));var tc=p(5729),ic=p.n(tc),rc=p(1869),nc=function(e,t,i,r){return new(i||(i=Promise))((function(n,s){function o(e){try{l(r.next(e))}catch(e){s(e)}}function a(e){try{l(r.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,a)}l((r=r.apply(e,t||[])).next())}))};const sc=e=>{const t=(0,wo.useRef)(null),i=(0,wo.useRef)(null);let r,n=(0,wo.useRef)(0),s=(0,wo.useRef)(0);const o=()=>{i.current&&(s.current=-1*function(e){const t=window.getComputedStyle(e),i=t.transform||t.webkitTransform||t.mozTransform;if("none"===i)return{x:0,y:0,z:0};const r=i.includes("3d")?"3d":"2d",n=i.match(/matrix.*\((.+)\)/)[1].split(", ");return"2d"===r?{x:isNaN(n[4])?0:n[4],y:isNaN(n[5])?0:n[5],z:0}:"3d"===r?{x:isNaN(n[12])?0:n[12],y:isNaN(n[13])?0:n[13],z:isNaN(n[14])?0:n[14]}:void 0}(i.current).x)},[a,l]=(0,wo.useState)(!1),[d,c]=(0,wo.useState)(!1),u=(0,wo.useRef)(!1),h=()=>{const t=wo.Children.count(e.children);return i.current&&t?i.current.scrollWidth/t:0};let p=!1;(0,wo.useEffect)((()=>{var e;return("ontouchstart"in window||window.navigator.msPointerEnabled||"ontouchstart"in document.documentElement)&&(p=!0),p||(i.current&&(r=null===(e=i.current.children[0])||void 0===e?void 0:e.offsetWidth),i.current&&(n.current=i.current.scrollWidth-i.current.clientWidth,o()),n.current===s.current?c(!1):c(!0),0===s.current?l(!1):l(!0)),()=>{}}),[]);let f=(0,wo.useRef)(!1),g=(0,wo.useRef)(0),v=0;const m=(0,wo.useRef)(!1),[y,w]=(0,wo.useState)(0),S=e=>{e<0&&(e=0),e>n.current&&(e=n.current),w(e)};(0,wo.useEffect)((()=>{y===n.current?c(!1):c(!0),l(0!==y)}),[y]);const b=e=>{if(!u.current)if(f.current){const t=e instanceof MouseEvent?e.pageX:e.touches&&e.touches[0].pageX;if(t!==g.current){m.current=!0,v=t;const e=g.current-v;let i=s.current+e;S(i)}}else m.current=!1},_=e=>{m.current&&e.preventDefault(),setTimeout((()=>{m.current=!1})),f.current=!1,document.removeEventListener("mousemove",b),document.removeEventListener("mouseup",_),document.removeEventListener("touchmove",b),document.removeEventListener("touchend",_)};return Zo(oc,{cssStyle:e.style,children:[Ho(ac,{ref:t,onMouseDown:e=>{u.current||(e.preventDefault(),f.current=!0,g.current=e.pageX,i.current&&(n.current=i.current.scrollWidth-i.current.clientWidth),i.current&&o(),document.addEventListener("mousemove",b),document.addEventListener("mouseup",_))},onTouchStart:e=>{u.current||(e.preventDefault(),f.current=!0,g.current=e.touches&&e.touches[0].pageX,i.current&&(n.current=i.current.scrollWidth-i.current.clientWidth),i.current&&o(),document.addEventListener("touchmove",b),document.addEventListener("touchend",_))},onClickCapture:e=>{m.current&&(e.preventDefault(),e.stopPropagation())},children:Ho(lc,{ref:i,style:{transform:`translateX(${-1*y}px)`},children:e.children})}),!p&&Zo(qo,{children:[Ho(cc,{position:dc.LEFT,show:a,onClick:e=>nc(void 0,void 0,void 0,(function*(){if(u.current)return;o();let e=s.current-h();S(e),u.current=!0,i.current&&(yield Ua(i.current,"transform",300)),u.current=!1})),children:Ho("svg",{focusable:"false",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:Ho("path",{d:"M15.41 7.41L14 6l-6 6 6 6 1.41-1.41L10.83 12z"})})}),Ho(cc,{position:dc.RIGHT,show:d,onClick:e=>nc(void 0,void 0,void 0,(function*(){if(u.current)return;o();let e=s.current+h();S(e),u.current=!0,i.current&&(yield Ua(i.current,"transform",300)),u.current=!1})),children:Ho("svg",{focusable:"false",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:Ho("path",{d:"M10 6L8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"})})})]})]})},oc=ic()("div")({position:"relative"},(e=>Object.assign({},e.cssStyle))),ac=ic().div`
|
|
41
41
|
position: relative;
|
|
42
42
|
overflow: hidden;
|
|
43
|
-
`,
|
|
43
|
+
`,lc=ic().div`
|
|
44
44
|
display: flex;
|
|
45
45
|
flex-wrap: nowrap;
|
|
46
46
|
cursor: pointer;
|
|
47
|
-
`;var
|
|
47
|
+
`;var dc;!function(e){e[e.LEFT=0]="LEFT",e[e.RIGHT=1]="RIGHT"}(dc||(dc={}));const cc=ic().span`
|
|
48
48
|
width: 36px;
|
|
49
49
|
height: 36px;
|
|
50
50
|
color: #757575;
|
|
@@ -83,7 +83,7 @@ object-assign
|
|
|
83
83
|
display: none !important;
|
|
84
84
|
}
|
|
85
85
|
|
|
86
|
-
${e=>{if(e.show)return
|
|
86
|
+
${e=>{if(e.show)return rc.css`
|
|
87
87
|
opacity: .9;
|
|
88
88
|
|
|
89
89
|
&:hover {
|
|
@@ -91,10 +91,10 @@ object-assign
|
|
|
91
91
|
}
|
|
92
92
|
`}};
|
|
93
93
|
|
|
94
|
-
${e=>e.position===
|
|
94
|
+
${e=>e.position===dc.RIGHT?rc.css`right: -18px`:e.position===dc.LEFT?rc.css`left: -18px`:void 0};
|
|
95
95
|
|
|
96
96
|
|
|
97
|
-
`,
|
|
97
|
+
`,uc=ic()("div")({},(e=>Object.assign({color:e.color,font:e.font},e.cssStyle))),hc=({goods:e,onClick:t,options:i})=>{const{imgSrc:r,title:n,subTitle:s,price:o,oldPrice:a,sku:l}=e;return Zo(pc,{color:i.mainTextColor,onClick:()=>t(e),onTouchStart:()=>t(e),children:[Ho(vc,{borderRadius:i.imageCornerRadius,backgroundColor:i.imageBackgroundColor,children:r&&Ho("img",{src:r,alt:n})}),Ho(gc,{font:i.subtitleFont,children:s}),Ho(gc,{font:i.titleFont,children:n}),Zo(fc,{children:[Ho(gc,{font:i.priceFont,children:o}),Ho(gc,{isOldPrice:!0,font:i.oldPriceFont,color:i.oldPriceTextColor,children:a})]})]})},pc=ic().div`
|
|
98
98
|
width: 100px;
|
|
99
99
|
|
|
100
100
|
&:first-of-type{
|
|
@@ -106,17 +106,17 @@ object-assign
|
|
|
106
106
|
}
|
|
107
107
|
|
|
108
108
|
color: ${e=>e.color};
|
|
109
|
-
`,
|
|
109
|
+
`,fc=ic().div`
|
|
110
110
|
display: flex;
|
|
111
111
|
|
|
112
112
|
& > div:not(:last-child) {
|
|
113
113
|
margin-right: 0.5rem;
|
|
114
114
|
}
|
|
115
|
-
`,
|
|
116
|
-
${e=>{if(e.isOldPrice)return
|
|
115
|
+
`,gc=ic()((({children:e,style:t,color:i,font:r,className:n})=>Ho(uc,{className:n,color:i,font:r,cssStyle:t,children:e})))`
|
|
116
|
+
${e=>{if(e.isOldPrice)return rc.css`
|
|
117
117
|
text-decoration: line-through;
|
|
118
118
|
`}}
|
|
119
|
-
`,
|
|
119
|
+
`,vc=ic().figure`
|
|
120
120
|
margin: 0;
|
|
121
121
|
margin-bottom: 0.5rem;
|
|
122
122
|
|
|
@@ -136,11 +136,11 @@ object-assign
|
|
|
136
136
|
}
|
|
137
137
|
|
|
138
138
|
|
|
139
|
-
`,
|
|
139
|
+
`,mc=e=>{const t=e.goodsWidgetOptions,i=t.goodsWidgetRenderingType||t.goodsList.renderingType;let r=[];return i===re.DEFAULT?r=e.goodsList.map(((i,r)=>Ho(hc,{options:t.goodsCard,goods:i,onClick:e.onGoodsCardClick},r))):i===re.CUSTOM_CARD&&ke()(t.getCardHtml)&&(r=e.goodsList.map(((i,r)=>{var n,s;return Ho(pc,{dangerouslySetInnerHTML:{__html:null!==(s=null===(n=t.getCardHtml)||void 0===n?void 0:n.call(t,i,r))&&void 0!==s?s:""},onClick:()=>e.onGoodsCardClick(i)},r)}))),Ho(sc,{style:{marginTop:"-15px"},children:r})};var yc=function(e,t){var i={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(i[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(r=Object.getOwnPropertySymbols(e);n<r.length;n++)t.indexOf(r[n])<0&&Object.prototype.propertyIsEnumerable.call(e,r[n])&&(i[r[n]]=e[r[n]])}return i};const wc=e=>{var{arrowColor:t}=e,i=yc(e,["arrowColor"]);return Ho("svg",Object.assign({},i,{width:"32",height:"12.5",viewBox:"0 0 64 25",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:Ho("path",{d:"M56.293 1.23375C58.054 -0.41125 60.846 -0.41125 62.607 1.23375C64.464 2.96775 64.464 5.85675 62.607 7.59075L35.157 23.2288C33.396 24.8738 30.604 24.8738 28.843 23.2288L1.393 7.59075C0.494002 6.75175 0 5.62775 0 4.41275C0 3.19775 0.494002 2.07375 1.393 1.23475C3.154 -0.410251 5.946 -0.410251 7.707 1.23475L32 13.9237L56.293 1.23375Z",fill:t})}))},Sc=({closeImage:e,arrowColor:t,onClick:i})=>Ho(bc,{onClick:i,onTouchStart:i,children:e?Ho("div",{dangerouslySetInnerHTML:{__html:e}}):Ho(wc,{arrowColor:t})}),bc=ic().div`
|
|
140
140
|
margin: auto auto 10px;
|
|
141
141
|
padding: 10px;
|
|
142
142
|
cursor: pointer;
|
|
143
|
-
`,
|
|
143
|
+
`,_c=({isLoading:e,backgroundColor:t="white",accentBackgroundColor:i="transparent"})=>e?Ho(Cc,{border:`solid 2px ${t}`,borderColor:`${i} ${t} ${t} ${t}`}):null,xc=rc.keyframes`
|
|
144
144
|
from {
|
|
145
145
|
-webkit-transform: rotate(0deg);
|
|
146
146
|
transform: rotate(0deg);
|
|
@@ -149,7 +149,7 @@ object-assign
|
|
|
149
149
|
-webkit-transform: rotate(359deg);
|
|
150
150
|
transform: rotate(359deg);
|
|
151
151
|
}
|
|
152
|
-
`,
|
|
152
|
+
`,Cc=ic().div`
|
|
153
153
|
position: absolute;
|
|
154
154
|
top: calc(50% - 2rem / 2);
|
|
155
155
|
left: calc(50% - 2rem / 2);
|
|
@@ -157,11 +157,11 @@ object-assign
|
|
|
157
157
|
width: 2rem;
|
|
158
158
|
height: 2rem;
|
|
159
159
|
border-radius: 50%;
|
|
160
|
-
animation: ${
|
|
160
|
+
animation: ${xc} .6s infinite linear;
|
|
161
161
|
|
|
162
162
|
border: ${e=>e.border};
|
|
163
163
|
border-color: ${e=>e.borderColor};
|
|
164
|
-
`;var
|
|
164
|
+
`;var kc;!function(e){e[e.IN=0]="IN",e[e.OUT=1]="OUT"}(kc||(kc={}));const Oc=({goodsWidgetOptions:e,onClose:t,onGoodsCardClick:i,goods:r})=>{const n=(0,wo.useRef)(null),[s,o]=(0,wo.useState)(kc.IN),a=e,{dimColor:l,substrateHeight:d,substrateColor:c,closeImage:u,closeBackgroundColor:h}=a.goodsList,p=()=>{o(kc.OUT)};(0,wo.useEffect)((()=>(wr.addListener("goodsWidget.close",p),()=>{wr.removeListener("goodsWidget.close",p)})),[]),(0,wo.useEffect)((()=>{const e=n.current;if(s===kc.OUT)return e.addEventListener("animationend",t),()=>{e.removeEventListener("animationend",t)}}),[s]);const f=a.loader.custom?Ho("div",{dangerouslySetInnerHTML:{__html:a.loader.custom}}):Ho(_c,{isLoading:!r,backgroundColor:a.loader.default.color,accentBackgroundColor:a.loader.default.accentColor});return Zo(Mc,{ref:n,fade:s,marginTop:0,children:[Ho(Ic,{backgroundColor:l,onClick:p,onTouchStart:p}),Zo(Tc,{height:d,backgroundColor:c,children:[f,r&&Ho(mc,{goodsList:r,onGoodsCardClick:i,goodsWidgetOptions:e}),Ho(Sc,{onClick:p,closeImage:u,arrowColor:h})]})]})},Ec=rc.keyframes`
|
|
165
165
|
from {
|
|
166
166
|
opacity: 0;
|
|
167
167
|
}
|
|
@@ -169,7 +169,7 @@ object-assign
|
|
|
169
169
|
to {
|
|
170
170
|
opacity: 1;
|
|
171
171
|
}
|
|
172
|
-
`,
|
|
172
|
+
`,Ac=rc.keyframes`
|
|
173
173
|
from {
|
|
174
174
|
opacity: 1;
|
|
175
175
|
}
|
|
@@ -177,7 +177,7 @@ object-assign
|
|
|
177
177
|
to {
|
|
178
178
|
opacity: 0;
|
|
179
179
|
}
|
|
180
|
-
`,
|
|
180
|
+
`,Lc="300ms",Mc=ic().div`
|
|
181
181
|
position: relative;
|
|
182
182
|
margin-left: auto;
|
|
183
183
|
margin-right: auto;
|
|
@@ -188,15 +188,15 @@ object-assign
|
|
|
188
188
|
height: 100%;
|
|
189
189
|
margin-top: ${e=>e.marginTop}px;
|
|
190
190
|
|
|
191
|
-
animation: ${e=>e.fade===
|
|
192
|
-
`,
|
|
191
|
+
animation: ${e=>e.fade===kc.IN?rc.css`${Lc} ${Ec}`:rc.css`${Lc} normal forwards ${Ac}`};
|
|
192
|
+
`,Ic=ic().div`
|
|
193
193
|
flex: 1;
|
|
194
194
|
background-color: ${e=>e.backgroundColor};
|
|
195
|
-
`,
|
|
195
|
+
`,Tc=ic().div`
|
|
196
196
|
position: relative;
|
|
197
197
|
display: flex;
|
|
198
198
|
flex-direction: column;
|
|
199
199
|
|
|
200
200
|
height: ${e=>e.height}px;
|
|
201
201
|
background-color: ${e=>e.backgroundColor?e.backgroundColor:"white"};
|
|
202
|
-
`;var Tc=p(2843),Rc={insert:"head",singleton:!1};Yo()(Tc.A,Rc);const Pc=Tc.A.locals||{};var Dc=function(e,t,i,r){return new(i||(i=Promise))((function(n,s){function o(e){try{l(r.next(e))}catch(e){s(e)}}function a(e){try{l(r.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,a)}l((r=r.apply(e,t||[])).next())}))};let Nc=null;const Fc=e=>{const[t,i]=(0,yo.useState)([]);(0,yo.useEffect)((()=>{yr.emit("publicEvents.widgetEvent",{name:"w-goods-open",devPayload:{story_id:e.story.id,slide_index:e.story.activeSlideIndex,widget_id:e.elementId}})}),[]),(0,yo.useEffect)((()=>{e.url&&r()}),[e.url]);const r=()=>Dc(void 0,void 0,void 0,(function*(){const t=n(),r=yield e.goodsWidgetOptions.openGoodsWidgetHandler(t);i(r)})),n=()=>{try{return JSON.parse(e.url).map((e=>({sku:e,title:"",subTitle:"",price:"",oldPrice:"",rawData:{}})))}catch(e){return console.error(e),[]}};return qo("div",{className:Pc["goods-container"],children:qo(ic.CacheProvider,{value:(null==Nc&&(Nc=bo()({key:"ias-widget-goods",nonce:o.getState().nonce})),Nc),children:qo(kc,{goods:t,goodsWidgetOptions:e.goodsWidgetOptions,onClose:e.onClose,onGoodsCardClick:t=>{var i,r;yr.emit("publicEvents.widgetEvent",{name:"w-goods-click",devPayload:{story_id:e.story.id,slide_index:e.story.activeSlideIndex,widget_id:e.elementId,widget_value:t.sku}}),null===(r=(i=e.goodsWidgetOptions).itemClickHandler)||void 0===r||r.call(i,t)}})})})},jc={247:"9999",376:"99 99 99",971:"99 999 9999",93:"99 999 9999",1268:"999 9999",1264:"999 9999",355:"999 999 999",374:"99 999 999",599:"999 9999",244:"999 999 999",672:"9 99 999",54:"999 999 9999",1684:"999 9999",43:"999 999 9999",61:"9 9999 9999",297:"999 9999",994:"99 999 99 99",387:"99 999 999",1246:"999 9999",880:"99 999 999",32:"999 999 999",226:"99 99 9999",359:"999 999 999",973:"9999 9999",257:"99 99 9999",229:"99 99 9999",1441:"999 9999",673:"999 9999",591:"9 999 9999",55:"99 99999 9999",1242:"999 9999",975:"99 999 999",267:"99 999 999",375:"99 999 99 99",501:"999 9999",243:"999 999 999",236:"99 99 9999",242:"99 999 9999",41:"99 999 9999",225:"99 999 999",682:"99 999",56:"9 9999 9999",237:"9999 9999",86:"999 9999 9999",57:"999 999 9999",506:"9999 9999",53:"9 999 9999",238:"999 99 99",357:"99 999 999",420:"999 999 999",49:"9999 999 9999",253:"99 99 99 99",45:"99 99 99 99",1767:"999 9999",1809:"999 9999",1829:"999 9999",1849:"999 9999",213:"99 999 9999",593:"99 999 9999",372:"9999 9999",20:"999 999 9999",291:"9 999 999",34:"999 999 999",251:"99 999 9999",358:"999 999 99 99",679:"99 99999",500:"99999",691:"999 9999",298:"999 999",262:"99999 9999",33:"999 999 999",508:"99 9999",590:"999 999 999",241:"9 99 99 99",1473:"999 9999",995:"999 999 999",594:"99999 9999",233:"999 999 999",350:"999 99999",299:"99 99 99",220:"999 99 99",224:"99 999 999",240:"99 999 9999",30:"999 999 9999",502:"9 999 9999",1671:"999 9999",245:"9 999999",592:"999 9999",852:"9999 9999",504:"9999 9999",385:"99 999 999",509:"99 99 9999",36:"999 999 999",628:"99 999 9999",62:"99 999 99",353:"999 999 999",972:"99 999 9999",91:"9999 999 999",246:"999 9999",964:"999 999 9999",98:"999 999 9999",354:"999 9999",39:"999 9999 999",1876:"999 9999",962:"9 9999 9999",81:"99 9999 9999",254:"999 999999",996:"999 999 999",855:"99 999 999",686:"99 999",269:"99 99999",1869:"999 9999",850:"999 999 9999",82:"99 999 9999",965:"9999 9999",1345:"999 9999",76:"99 999 99 99",77:"99 999 99 99",856:"99 99 999 999",961:"99 999 999",1758:"999 9999",423:"999 999 9999",94:"99 999 9999",231:"99 999 999",266:"9 999 9999",370:"999 99 999",352:"999 999 999",371:"99 999 999",218:"99 999 9999",212:"99 9999 999",377:"9999 9999",373:"9999 9999",382:"99 999 999",261:"99 99 99999",692:"999 9999",389:"99 999 999",223:"99 99 9999",95:"99 999 999",976:"99 99 9999",853:"9999 9999",1670:"999 9999",596:"999 99 99 99",222:"99 99 9999",1664:"999 9999",356:"9999 9999",230:"999 9999",960:"999 9999",265:"99 999 9999",52:"999 999 9999",60:"99 999 9999",258:"99 999 999",264:"99 999 9999",687:"99 9999",227:"99 99 9999",234:"999 999 9999",505:"9999 9999",31:"99 999 9999",47:"999 99 999",977:"99 999 999",674:"999 9999",683:"9999",64:"999 999 999",968:"99 999 999",507:"999 9999",51:"999 999 999",689:"99 99 99",675:"999 99 999",63:"999 999 9999",92:"999 999 9999",48:"999 999 999",970:"99 999 9999",351:"99 999 9999",680:"999 9999",595:"999 999 999",974:"9999 9999",40:"99 999 9999",381:"99 999 9999",7:"999 999 99 99",250:"999 999 999",966:"99 999 9999",677:"999 9999",248:"9 999 999",249:"99 999 9999",46:"99 999 9999",65:"9999 9999",290:"99 999",386:"99 999 999",421:"999 999 999",232:"99 999999",378:"9999 999999",221:"99 999 9999",252:"99 999 999",597:"999 9999",211:"99 999 9999",239:"99 99999",503:"99 99 9999",1721:"999 9999",963:"99 9999 999",268:"99 99 9999",1649:"999 9999",235:"99 99 99 99",228:"99 999 999",66:"99 999 9999",992:"99 999 9999",690:"9999",670:"999 9999",993:"9 999 9999",216:"99 999 999",676:"99999",90:"999 999 9999",1868:"999 9999",688:"99 9999",886:"999 999 999",255:"99 999 9999",380:"99 999 99 99",256:"999 999 999",44:"99 9999 9999",598:"9 999 99 99",998:"99 999 9999",396:"999 99999",1784:"999 9999",58:"999 999 9999",1284:"999 9999",1340:"999 9999",84:"99 9999 999",678:"99 99999",681:"99 9999",685:"99 9999",967:"999 999 999",27:"99 999 9999",260:"99 999 9999",263:"9 999999",1:"999 999 9999",383:"9999 9999"};class Bc{static isEmailValid(e){return/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(e)}static isTelephoneValid(e,t){return e?e.replace(/\s/g,"").length===t.length&&t.length>0:/^\d+$/.test(t)}}const Uc=e=>{switch(e){case"":default:return"text";case"tel":return"tel";case"email":return"email"}},Vc=e=>{const[t,i]=(0,yo.useState)({countryCode:"",phone:""}),[r,n]=(0,yo.useState)(""),[s,o]=(0,yo.useState)(!0),a=i=>{var r;const n=Uc(null!==(r=null==e?void 0:e.configV2.main.input.type)&&void 0!==r?r:"");return"email"===n?Bc.isEmailValid(i):"tel"!==n||Bc.isTelephoneValid((()=>{var e;const i=t.countryCode.substring(1);return i&&null!==(e=jc[i])&&void 0!==e?e:""})(),t.phone)};return{value:r,telephone:t,isValid:s,handleTelephoneChange:e=>{i(e),e.phone.length>0?n(e.countryCode+e.phone):n("")},handleChange:e=>{n(e.trim())},handleSubmit:e=>{const t=a(r);o(t),t&&e({value:r})},reset:()=>{o(!0),n(""),i({countryCode:"",phone:""})}}};var Gc=p(2372),zc={insert:"head",singleton:!1};Yo()(Gc.A,zc);const Wc=Gc.A.locals||{},$c=(0,yo.forwardRef)(((e,t)=>{const i=(0,yo.useRef)(null);return(0,yo.useEffect)((()=>{var e;null===(e=i.current)||void 0===e||e.focus()}),[]),qo("input",{type:"email",className:Qo()(Wc.input,Wc.input_centered),placeholder:e.placeholder,value:e.value,ref:i,onChange:t=>e.onChange(t.target.value)})}));var qc=p(2265),Hc=p.n(qc);const Zc=(0,yo.forwardRef)(((e,t)=>{const i=(0,yo.useRef)(null),r=(0,yo.useRef)(null),n=t=>{const i=t.target;i&&(i.value=i.value.replace(/\D/g,""),e.onChange({countryCode:e.value.countryCode,phone:i.value}))};(0,yo.useEffect)((()=>{(()=>{let t=i.current;e.value.countryCode.length&&(t=r.current),null==t||t.focus()})()}),[]);const s=e.value.countryCode.substring(1),o=s?jc[s]:"";return Ho("div",{className:Wc["input-group"],children:[Ho("div",{className:Wc["input-group__prepend"],children:[qo(Hc(),{type:"tel",mask:"+999",maskChar:null,className:Wc.input,onChange:t=>{e.onChange({countryCode:t.currentTarget.value,phone:e.value.phone})},value:e.value.countryCode,placeholder:"+",inputRef:i}),qo("div",{className:Wc["input-group__separator"]})]}),o?qo(Hc(),{type:"tel",className:Wc.input,mask:o,maskChar:"-",alwaysShowMask:!0,placeholder:e.placeholder,inputRef:r,value:e.value.phone,onChange:n}):qo("input",{type:"tel",className:Wc.input,placeholder:e.placeholder,ref:r,value:e.value.phone,onChange:n})]})})),Qc=(0,yo.forwardRef)(((e,t)=>{const i=(0,yo.useRef)(null),r=(0,yo.useRef)(null);(0,yo.useEffect)((()=>{var t;r.current.dataset.replicatedValue=e.value,null===(t=i.current)||void 0===t||t.focus()}),[]);return qo("div",{className:Wc["textarea-grow-wrap"],ref:r,style:e.style,children:qo("textarea",{className:Wc.input,placeholder:e.placeholder,rows:1,ref:i,maxLength:e.maxLength,value:e.value,onChange:t=>e.onChange(t.target.value),onInput:e=>{r.current.dataset.replicatedValue=e.currentTarget.value}})})}));var Xc=function(e,t){var i={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(i[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(r=Object.getOwnPropertySymbols(e);n<r.length;n++)t.indexOf(r[n])<0&&Object.prototype.propertyIsEnumerable.call(e,r[n])&&(i[r[n]]=e[r[n]])}return i};const Yc=e=>{var{form:t,config:i}=e,r=Xc(e,["form","config"]);const[n,s]=(0,yo.useState)(!0),{getMainStyle:o,getMainElementsStyle:a,getQuestionStyle:l,getInputWrapperStyle:d,getButtonStyle:c,getTextareaStyle:u}=(({config:e})=>{const t=t=>t*(e.size.viewportWidth/(e.size.viewportWidth/e.size.fontSize));return{getMainStyle:()=>{const i=e.configV2.main;return{width:`${e.size.absolute.width}px`,height:"auto",left:e.size.absolute.center.x-e.size.absolute.width/2-e.size.slideOffsetX+"px",top:e.size.absolute.center.y-e.size.absolute.height/2-e.size.slideOffsetY+"px",backgroundColor:`${i.background.color}`,border:`${i.border.visible&&`${t(i.border.width)}px solid ${i.border.color}`}`,borderRadius:`${t(i.border.radius)}px`}},getMainElementsStyle:()=>{const i=e.configV2.main;return{width:"100%",padding:`${t(i.padding.top)}px ${t(i.padding.right)}px ${t(i.padding.bottom)}px ${t(i.padding.left)}px`}},getQuestionStyle:()=>{const i=e.configV2.main.question;return{padding:`${t(i.padding.top)}px ${t(i.padding.right)}px ${t(i.padding.bottom)}px ${t(i.padding.left)}px`,color:`${i.text.color}`,fontSize:`${t(i.text.size)}px`,lineHeight:`${i.text.lineHeight}`,textAlign:`${i.text.align}`,fontFamily:`${i.text.type}`,fontWeight:`${i.text.weight}`,fontStyle:`${i.text.style}`}},getInputWrapperStyle:()=>{const i=e.configV2.main.input;let r=e.configV2.main.input.text.maxLines;return r=r>0?r:1,{padding:`${t(i.padding.top)}px ${t(i.padding.right)}px ${t(i.padding.bottom)}px ${t(i.padding.left)}px`,backgroundColor:`${i.background.color}`,border:`${t(i.border.width)}px solid ${i.border.color}`,borderRadius:`${t(i.border.radius)}px`,lineHeight:`${i.text.lineHeight}`,maxHeight:i.text.lineHeight*r+"em",fontSize:`${t(i.text.size)}px`,overflowY:"scroll",scrollbarWidth:"none"}},getButtonStyle:()=>{const i=e.configV2.main.button;return{padding:`${t(i.padding.top)}px ${t(i.padding.right)}px ${t(i.padding.bottom)}px ${t(i.padding.left)}px`,backgroundColor:`${i.background.color}`,border:`${t(i.border.width)}px solid ${i.border.color}`,color:`${i.text.color}`,fontSize:`${t(i.text.size)}px`,lineHeight:`${i.text.lineHeight}`,textAlign:`${i.text.align}`,fontFamily:`${i.text.type}`,fontWeight:`${i.text.weight}`,fontStyle:`${i.text.style}`}},getTextareaStyle:()=>{const i=e.configV2.main.input;return{color:`${i.text.color}`,fontSize:`${t(i.text.size)}px`,lineHeight:`${i.text.lineHeight}`,textAlign:`${i.text.align}`,fontFamily:`${i.text.type}`,fontWeight:`${i.text.weight}`,fontStyle:`${i.text.style}`}}}})({config:i}),h=Math.max(i.configV2.main.input.text.limit,0),p=String(i.configV2.main.input.text.placeholder).trim(),f=String(i.configV2.main.button.text.value).trim(),g=String(i.configV2.main.question.text.value).trim(),v=Uc(i.configV2.main.input.type),m=({value:e})=>{r.onComplete({result:!0,value:e}),s(!1)};return Ho("div",{className:Wc.wrapper,children:[qo("div",{className:Qo()(Wc.backdrop,{[Wc.fadeIn]:n,[Wc.fadeOut]:!n}),onAnimationEnd:()=>{n||r.onClose()},onClick:()=>{r.onComplete({result:!1,value:t.value}),s(!1)}}),Ho("div",{className:Wc.main,style:o(),children:[Ho("div",{className:Wc["main-elements"],style:a(),children:[qo("div",{className:Wc.question,style:l(),children:g}),Ho("div",{className:Qo()(Wc["input-wrapper"],{[Wc["is-invalid"]]:!t.isValid}),style:d(),children:["text"===v&&qo(Qc,{value:t.value,onChange:t.handleChange,style:u(),placeholder:p,maxLength:h}),"email"===v&&qo($c,{value:t.value,onChange:t.handleChange,placeholder:p}),"tel"===v&&qo(Zc,{value:t.telephone,onChange:t.handleTelephoneChange,placeholder:p})]})]}),t.value.trim().length>0&&qo("div",{className:Wc["button-wrapper"],children:qo("button",{className:Wc.button,style:c(),onClick:()=>t.handleSubmit(m),children:f})})]})]})},Kc=({slideGeometry:e,widgetManager:t,storyRef:i})=>{const[r,n]=(0,yo.useState)(null),[s,o]=(0,yo.useState)(null),a=Vc(s);(0,yo.useEffect)((()=>(yr.on("storySlide.showInputModal",l),()=>{yr.off("storySlide.showInputModal",l)})),[]);const l=({id:t,config:r})=>{zr(),Nr(),n(t),(t=>{t.size.fontSize=parseFloat(e.getFontSize()),t.size.viewportWidth=e.calculateWidth();const r=i.current.getBoundingClientRect();t.size.slideOffsetX=r.x,t.size.slideOffsetY=r.y,t.size.slideHeight=r.height,o(t)})(r)};return(0,yo.useLayoutEffect)((()=>()=>{a.reset()}),[r]),s?qo(Yc,{form:a,config:s,onComplete:e=>{if(!r)throw new Error;((e,i)=>{var r,n,s;null===(r=null==t?void 0:t.findWidgetByType(Sn.name))||void 0===r||r.setUserData(e,i),null===(n=null==t?void 0:t.findWidgetByType(Cn.name))||void 0===n||n.setUserData(e,i),null===(s=null==t?void 0:t.findWidgetByType(Nn.name))||void 0===s||s.setUserData(e,i)})(r,e.result?e.value:""),Wr()},onClose:()=>{o(null),Dr()}}):null};var Jc=function(e,t){var i={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(i[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(r=Object.getOwnPropertySymbols(e);n<r.length;n++)t.indexOf(r[n])<0&&Object.prototype.propertyIsEnumerable.call(e,r[n])&&(i[r[n]]=e[r[n]])}return i};const eu=e=>{var{story:t,slideGeometry:i,className:r}=e,n=Jc(e,["story","slideGeometry","className"]);const s=(0,yo.useRef)(null),[o,a]=(0,yo.useState)(null),l=Fl(Xn),d=(0,yo.useRef)(null);Fa(t);const c=n.index===n.nextFlippingStoryIndex,u=t===n.activeStory&&-1===n.nextFlippingStoryIndex,{timer:h}=(({story:e,progressBarRef:t,activeStory:i})=>{const r=Fl(Lr),n=(0,yo.useRef)(new Ua).current;return(0,yo.useEffect)((()=>{const i=e=>{var i;null===(i=t.current)||void 0===i||i.style.setProperty("--tick",e+"%")},r=({forceEnd:t})=>{t||(e.reachEnd?yr.emit(`${hs.name}.showNextStory`,{action:"auto"}):e.nextSlide())},s=()=>{var e;null===(e=t.current)||void 0===e||e.style.setProperty("--tick","0%")};return n.on("start",s),n.on("stop",s),n.on("progress",i),n.on("complete",r),()=>{n.off("start",s),n.off("progress",i),n.off("complete",r),n.off("stop",s)}}),[e]),(0,yo.useEffect)((()=>{r?n.pause():n.resume()}),[r]),{timer:n}})({activeStory:n.activeStory,story:t,progressBarRef:d});(({timer:e,story:t,needSubscription:i})=>{const r=i=>{i?e.start(i):t.nextSlide()},n=()=>{e.start(t.activeSlideDuration)};(0,yo.useLayoutEffect)((()=>{if(i)return yr.on("story.showNextSlideWithDelay",r),yr.on("story.showLayerByIndex",n),()=>{yr.off("story.showNextSlideWithDelay",r),yr.off("story.showLayerByIndex",n)}}),[t,i])})({timer:h,story:t,needSubscription:u||c}),(0,yo.useEffect)((()=>{u||h.stop()}),[u]),(0,yo.useEffect)((()=>()=>{h.stop()}),[t.activeSlideIndex]);const p=e=>{a(e.widgetManager),es({currentSlideIndex:e.index,currentStoryId:n.activeStory.id});const i=t.slidesDuration[t.activeSlideIndex];h.started||h.start(i)};return Ho("div",{ref:s,className:Qo()(Xl["stories-item"],Xl.slider3d__item,r),style:n.style,children:[qo(sd,{closeDisabled:t.disableClose,options:n.storyReaderOptions,onClose:n.onClose}),qo(Jd,{ref:d,hiddenTimeline:t.hiddenTimeline||!t.slidesLoaded,slidesLength:t.slidesCount,activeSlide:t.activeSlideIndex}),t.slides.map(((e,r)=>qo(Qd,{clickDisabled:n.slideClickDisabled,onSlideStarted:p,needBottomPanel:t.needBottomPanel,activeSlideIndex:t.activeSlideIndex,currentSlideIndex:r,needSlideInit:c,activeStory:n.activeStory,currentStoryId:t.id,geometry:i,slideHtml:e,slidesLoaded:t.slidesLoaded,slideApi:n.slideApi},e))),qo(td,{story:t,options:n.storyReaderOptions}),l.isOpened&&n.activeStory===t&&qo(Fc,{url:l.url,story:t,elementId:l.elementId,goodsWidgetOptions:n.goodsWidgetOptions,onClose:()=>{var e;null===(e=null==o?void 0:o.findWidgetByType(_s.name))||void 0===e||e.close()}}),n.activeStory===t&&qo(Kc,{storyRef:s,slideGeometry:i,widgetManager:o})]})},tu=({className:e,style:t})=>qo("div",{className:Qo()(Xl["stories-item"],e),style:t,children:qo("div",{className:`${ld["stories-slide"]} ${ld._dummy}`})});var iu=p(827),ru={insert:"head",singleton:!1};Yo()(iu.A,ru);const nu=iu.A.locals||{};var su=function(e,t){var i={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(i[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(r=Object.getOwnPropertySymbols(e);n<r.length;n++)t.indexOf(r[n])<0&&Object.prototype.propertyIsEnumerable.call(e,r[n])&&(i[r[n]]=e[r[n]])}return i};const ou=e=>{var{width:t,navigationOptions:i,onNext:r,onPrev:n}=e,s=su(e,["width","navigationOptions","onNext","onPrev"]);const{desktopMode:o}=Au(),[a,l]=Fl([Ar,hn]),d=a||l;return Ho("div",{className:Qo()({[nu._desktop_mode]:o}),children:[qo("div",{className:nu.slider3d__btn_next,style:{transform:`translateY(-50%) translateX(calc(${t/2}px + 100%))`},children:qo("button",{className:nu["btn-icon"],onClick:e=>{e.stopPropagation(),e.preventDefault(),r()},disabled:s.isNextStoryBlank||d,dangerouslySetInnerHTML:{__html:i.nextButton.svgSrc.baseState}})}),qo("div",{className:nu.slider3d__btn_prev,style:{transform:`translateY(-50%) translateX(calc(-${t/2}px - 200%))`},children:qo("button",{className:nu["btn-icon"],onClick:e=>{e.stopPropagation(),e.preventDefault(),n()},disabled:s.isPrevStoryBlank||d,dangerouslySetInnerHTML:{__html:i.prevButton.svgSrc.baseState}})})]})},au=350,lu=1,du="linear",cu=1.6,uu=(Math.tan(.375*Math.PI),lu);class hu extends U.EventEmitter{constructor(){super(),this._rotating=!1,this._currentAngle=0,this.sliderWidth=0,this.transformStyle=te.SWIPE_FLAT,this.perspective=0,this.angle=0,this.depth=0,this.rotationTransform="",this.rotationTransition="",this.newAngle=0,this.angleDelta=0,this.deltaVal=0,this.startAt=0,this.sliderS=0,this.onTransitionEnd=this.onTransitionEnd.bind(this)}get rotating(){return this._rotating}get prevStoryBlank(){return this.rotater.children.item(0)===this.leftSlideEl}get nextStoryBlank(){const e=this.rotater.children.length-1;return this.rotater.children.item(e)===this.rightSlideEl}setTransformStyle(){}init3DSlider({rotater:e,innerSlider:t,transformStyle:i}){this.rotater=e,this._innerSlider=t,this.transformStyle=i,e.addEventListener("transitionend",this.onTransitionEnd,!1);let r=this._innerSlider.clientWidth;r>0&&(this.sliderWidth=r),!this._innerSlider.clientWidth&&this.sliderWidth&&(r=this.sliderWidth),this.angle=45,this.transformStyle===te.SWIPE_CUBE&&(this.perspective=r*cu,this.depth=r/2/Math.tan(this.angle/2*Math.PI/180))}getStoryStyle(e,t){return{display:Math.abs(e-t)<=1?"block":"none",transition:"flat"===this.transformStyle||"cover"===this.transformStyle?"inherit":"",transform:"flat"===this.transformStyle?`translateZ(0) translateX(${-100*t+100*e}%)`:"cover"===this.transformStyle?`translateZ(0) translateX(${0===e?-10:-100*t+100*e}%) scale(${0===e?.9:1})`:"rotateY("+e*this.angle+`deg) translateZ(${this.depth}px)`}}destroy(){this.rotater.removeEventListener("transitionend",this.onTransitionEnd,!1)}updateRotater({touchmove:e}={touchmove:!1}){const t=this.rotater;null!=t&&(t.style.setProperty("transition",this.rotationTransition),t.style.setProperty("transform",this.rotationTransform))}refreshSlidesLinks(){this.leftSlideEl=this.rotater.querySelector("._transform_left"),this.centralSlideEl=this.rotater.querySelector("._transform_front"),this.rightSlideEl=this.rotater.querySelector("._transform_right")}storiesItemClass({id:e,index:t,currentIndex:i}){return{_active:!0,_transform_front:t===i,_transform_left:t+1===i,_transform_right:t-1===i}}rotateSlider(e,t=!1){t&&(this._currentAngle=0),this._rotating=!0,Nr();const i=this._currentAngle+e*this.angle,r=-1*i,n=au/1e3;return this.transformStyle===te.SWIPE_CUBE&&(this.rotationTransform=`rotateY(${r}deg)`),this._currentAngle=i,t?(this.rotationTransition="transform 0s",this.updateRotater(),this._rotating=!1,Dr(),Promise.resolve(e)):new Promise(((t,i)=>{let r=({propertyName:i,elapsedTime:s})=>{Re(`transitionend:rotater elapsedTime: ${s} transitionTime: ${n} propertyName: ${i}`),Math.round(100*s)/100===n&&"transform"===i&&(this.rotationTransition="transform 0s",this.updateRotater(),this._rotating=!1,Dr(),Re(`release this._rotating is: ${this._rotating}`),t(e),this.off("transitionend:rotater",r))};this.on("transitionend:rotater",r),this.rotationTransition=`transform ${n}s ${du}`,this.updateRotater()}))}rotateSliderFlat(e,t=!1){this._rotating=!0,Nr();let i="",r="",n="";if(0===e?(n="translateZ(0) translateX(-100%)",i="translateZ(0) translateX(0%)",r="translateZ(0) translateX(100%)"):e>0?(n="translateZ(0) translateX(-200%)",i="translateZ(0) translateX(-100%)",r="translateZ(0) translateX(0%)"):(i="translateZ(0) translateX(100%)",n="translateZ(0) translateX(0%)",r="translateZ(0) translateX(200%)"),t)return this.rotationTransition="transform 0s",this.updateRotater(),this.applyTransformToElements({leftStoriesTransform:n,rightStoriesTransform:r,centralStoriesTransform:i}),this._rotating=!1,Dr(),Promise.resolve(e);const s=au/1e3;return new Promise(((t,o)=>{let a=({propertyName:i,elapsedTime:r})=>{Math.round(100*r)/100===s&&"transform"===i&&(this.rotationTransition="transform 0s",this.updateRotater(),this._rotating=!1,Dr(),this.off("transitionend:rotater",a),t(e))};this.on("transitionend:rotater",a),this.rotationTransition=`transform ${s}s ${du}`,this.updateRotater(),this.applyTransformToElements({leftStoriesTransform:n,rightStoriesTransform:r,centralStoriesTransform:i})}))}rotateSliderCover(e,t=!1){this._rotating=!0,Nr();let i="",r="",n="";if(0===e?(n="translateZ(0) translateX(-10%) scale(.9)",i="translateZ(0) translateX(0%) scale(1)",r="translateZ(0) translateX(100%) scale(1)"):e>0?(n="translateZ(0) translateX(-20%) scale(.8)",i="translateZ(0) translateX(-10%) scale(.9)",r="translateZ(0) translateX(0%) scale(1)"):(i="translateZ(0) translateX(100%) scale(1)",n="translateZ(0) translateX(0%) scale(1)",r="translateZ(0) translateX(200%)"),t)return this.rotationTransition="transform 0s",this.updateRotater(),this.applyTransformToElements({leftStoriesTransform:n,rightStoriesTransform:r,centralStoriesTransform:i}),this._rotating=!1,Dr(),Promise.resolve(e);const s=au/1e3;return new Promise(((t,o)=>{let a=({propertyName:i,elapsedTime:r})=>{Math.round(100*r)/100===s&&"transform"===i&&(this.rotationTransition="transform 0s",this.updateRotater(),this._rotating=!1,Dr(),this.off("transitionend:rotater",a),t(e))};this.on("transitionend:rotater",a),this.rotationTransition=`transform ${s}s ${du}`,this.updateRotater(),this.applyTransformToElements({leftStoriesTransform:n,rightStoriesTransform:r,centralStoriesTransform:i})}))}rotateTo(e){let t="",i="",r="";this.transformStyle===te.SWIPE_FLAT?(r=`translateZ(0) translateX(${-100*(1+e)}%)`,t=`translateZ(0) translateX(${-100*e}%)`,i=`translateZ(0) translateX(${100*(1-e)}%)`,this.applyTransformToElements({leftStoriesTransform:r,rightStoriesTransform:i,centralStoriesTransform:t})):this.transformStyle===te.SWIPE_COVER?(r=`translateZ(0) translateX(${-100*(.1- -1*e/10)}%) scale(${Math.min(.9+-1*e/10,1)})`,t=`translateZ(0) translateX(${e<=0?-100*e:-100*(0- -1*e/10)}%) scale(${e<=0?1:1+-1*e/10})`,i=`translateZ(0) translateX(${100*(1-e)}%) scale(1)`,this.applyTransformToElements({leftStoriesTransform:r,rightStoriesTransform:i,centralStoriesTransform:t})):this.rotationTransform=`rotateY(${e}deg)`,this.updateRotater({touchmove:!0})}applyTransformToElements({leftStoriesTransform:e,rightStoriesTransform:t,centralStoriesTransform:i}){var r,n,s;null===(r=this.centralSlideEl)||void 0===r||r.style.setProperty("transform",i),null===(n=this.rightSlideEl)||void 0===n||n.style.setProperty("transform",t),null===(s=this.leftSlideEl)||void 0===s||s.style.setProperty("transform",e)}navigateSlider(e){return this.transformStyle===te.SWIPE_FLAT?this.rotateSliderFlat(e):this.transformStyle===te.SWIPE_COVER?this.rotateSliderCover(e):this.rotateSlider(e)}startMove(){var e,t;this.newAngle=0,this.angleDelta=0,this.deltaVal=0,this.startAt=Date.now(),this.sliderS=null!==(t=null===(e=this._innerSlider)||void 0===e?void 0:e.clientWidth)&&void 0!==t?t:0}move(e){this._rotating=!0,Nr(),this.deltaVal=e/this.sliderS*uu,this.newAngle=this._currentAngle+this.deltaVal*this.angle,this.angleDelta=this.newAngle-this._currentAngle;let t=this.deltaVal;if(this.transformStyle===te.SWIPE_FLAT||this.transformStyle===te.SWIPE_COVER)(this.nextStoryBlank||this.prevStoryBlank)&&(this.deltaVal>=.05&&this.nextStoryBlank?this.deltaVal=.05:this.deltaVal<=-.05&&this.prevStoryBlank&&(this.deltaVal=-.05),t=this.deltaVal);else{(this.nextStoryBlank||this.prevStoryBlank)&&(this.angleDelta>=5&&this.nextStoryBlank?this.newAngle=this._currentAngle+5:this.angleDelta<=-5&&this.prevStoryBlank&&(this.newAngle=this._currentAngle-5));t=-1*this.newAngle}this.rotateTo(t)}endMove(){if(!this.deltaVal)return;this._rotating=!1;const e=Date.now();let t=Math.round(this.angleDelta/this.angle);e-this.startAt<=500&&0===t&&(t=this.deltaVal<0?-1:1),(t<0&&this.prevStoryBlank||t>0&&this.nextStoryBlank)&&(t=0),0===t?this.navigateSlider(0).then((()=>Ur())):this.emit("swipeEnd",t)}onTransitionEnd(e){this.emit("transitionend:rotater",{propertyName:e.propertyName,elapsedTime:e.elapsedTime})}}var pu=function(e,t,i,r){return new(i||(i=Promise))((function(n,s){function o(e){try{l(r.next(e))}catch(e){s(e)}}function a(e){try{l(r.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,a)}l((r=r.apply(e,t||[])).next())}))};const fu=({storyReaderViewModel:e,storyNavigation:t})=>{const i=(0,yo.useRef)(null),r=(0,yo.useRef)(null),n=(0,yo.useRef)(null),s=(0,yo.useRef)(new hu).current;(({rotationSliderEngine:e})=>{const t=()=>{e.startMove()},i=({startX:t,x:i,lockX:r})=>{if(r)return;const n=t-i;e.move(n)},r=({lockX:t})=>{t||e.endMove()};(0,yo.useEffect)((()=>(yr.on("swipeController.startMove",t),yr.on("swipeController.move",i),yr.on("swipeController.endMove",r),()=>{yr.off("swipeController.startMove",t),yr.off("swipeController.move",i),yr.off("swipeController.endMove",r)})),[])})({rotationSliderEngine:s});const o=e.options.scrollStyle,a=e.stories,l=e.currentIndex;(0,yo.useEffect)((()=>{const e=()=>{s.init3DSlider({rotater:r.current,innerSlider:i.current,transformStyle:o})};return e(),window.addEventListener("resize",e),()=>{s.destroy(),window.removeEventListener("resize",e)}}),[o]),(0,yo.useEffect)((()=>{s.refreshSlidesLinks()}),[l]),(0,yo.useEffect)((()=>{s.rotateSlider(l,!0)}),[a.length,o]),(0,yo.useEffect)((()=>{d(t.nextFlippingStoryIndex)}),[t.nextFlippingStoryIndex]),(0,yo.useEffect)((()=>(s.on("swipeEnd",t.handleSwipeEnd),()=>{s.off("swipeEnd",t.handleSwipeEnd)})),[]);const d=e=>pu(void 0,void 0,void 0,(function*(){if(-1===e)return;const i=l<e?1:-1;yield s.navigateSlider(i),t.handleStoryFlippingTransitionEnd()}));return{innerSliderRef:i,rotaterRef:r,slider3dInnerRef:n,engine:s,getStoryClassName:(e,t)=>Qo()(s.storiesItemClass({id:e.id,index:t,currentIndex:l})),getStoryStyle:e=>s.getStoryStyle(e,l)}},gu=e=>{const[t,i]=(0,yo.useState)("lastSlideClick"),[r,n]=(0,yo.useState)(-1);(0,yo.useEffect)((()=>(yr.on(`${hs.name}.showNextStory`,a),yr.on(`${hs.name}.showPrevStory`,l),()=>{yr.off(`${hs.name}.showNextStory`,a),yr.off(`${hs.name}.showPrevStory`,l)})),[]);const s=t=>{yr.emit("publicEvents.closeStory",{id:e.activeStory.id,index:e.activeStory.activeSlideIndex,action:t})},o=(t,r="lastSlideClick")=>{i(r),n(t),e.setNarrativeStory(e.getDisplayedStoryByIndex(t))},a=t=>{const i=null==t?void 0:t.action;e.reachEnd?(t=>{"auto"!==t?(s("closeStoryByScrolling"),e.close("lastSlideClick")):e.options.closeOnLastSlideByTimer&&(s("closeStoryByScrolling"),e.close("auto"))})(i):o(e.currentIndex+1,i)},l=t=>{e.reachStart||o(e.currentIndex-1,null==t?void 0:t.action)};return{nextFlippingStoryIndex:r,nextStory:a,prevStory:l,handleStoryFlippingTransitionEnd:()=>{"swipe"===t&&Ur(),s(t);1===(e.currentIndex<r?1:-1)?e.nextStory():e.prevStory(),n(-1)},handleSwipeEnd:t=>{o(e.currentIndex+t,"swipe")}}},vu=e=>{const{desktopMode:t}=Au(),i=gu(e.storyReaderViewModel),[r,n]=Fl([Ar,Mr]),{isOpened:s,sharePanelOpeningParams:o,handleShareComplete:a}=(()=>{const{isOpened:e,id:t,type:i,link:r}=Fl(un);return{isOpened:e,sharePanelOpeningParams:{shareId:t,shareType:i,shareLink:r},handleShareComplete:e=>{qr(),yr.emit(`${jn.name}.shareComplete`,{shareId:t,result:e}),fn()},closeSharePanel:()=>{qr(),fn()}}})(),l=fu({storyReaderViewModel:e.storyReaderViewModel,storyNavigation:i}),d=e.storyReaderViewModel.options,c=ed(e.storyReaderViewModel.options.actionPanelBottomOffset),u=e.storyReaderViewModel.activeStory,h=i=>new Bs(e.viewport.vw,e.viewport.vh,c,i.needBottomPanel,t),p=(0,yo.useMemo)((()=>h(u)),[u,e.viewport]);return Ho($o,{children:[Ho("div",{className:Qo()(Hl.slider3d__wrapper,{[Hl["slider3d__wrapper_swipe-up"]]:n,[Hl._desktop_mode]:t}),style:Object.assign({WebkitPerspective:`${l.engine.perspective}px`,perspective:`${l.engine.perspective}px`,width:p.getWidth(),backgroundColor:p.shouldBeShownSafeAreaInsets&&"#000"},p.getViewportCorrectionPadding()),ref:l.innerSliderRef,children:[qo("div",{className:Hl.slider3d__inner,style:{transform:`translateZ(-${l.engine.depth}px)`},ref:l.slider3dInnerRef,children:qo("div",{className:Qo()(Hl["stories-face"],Hl.slider3d__rotater),ref:l.rotaterRef,children:e.storyReaderViewModel.stories.map(((t,n)=>t.isBlank?qo(tu,{className:l.getStoryClassName(t,n),style:Object.assign(Object.assign({},l.getStoryStyle(n)),{bottom:0})},t.id):qo(eu,{slideClickDisabled:r||l.engine.rotating,index:n,story:t,activeStory:u,nextFlippingStoryIndex:i.nextFlippingStoryIndex,slideGeometry:h(t),className:l.getStoryClassName(t,n),style:Object.assign(Object.assign({},l.getStoryStyle(n)),{bottom:t.needBottomPanel?`${c}px`:0}),storyReaderOptions:d,goodsWidgetOptions:e.storyReaderViewModel.goodsWidgetOptions,onClose:e.onCloseStory,slideApi:e.slideApi},t.id)))})}),s&&qo(Ia,{className:Hl["share-panel-wrapper"],shareType:o.shareType,shareLink:o.shareLink,onShareCompelete:a,sharePanelOptions:d.sharePanel})]}),qo(ou,{isNextStoryBlank:e.storyReaderViewModel.reachEnd,isPrevStoryBlank:e.storyReaderViewModel.reachStart,navigationOptions:d.navigation,width:parseFloat(p.getWidth()),onNext:i.nextStory,onPrev:i.prevStory})]})},mu=(function(){if(window){var e,t=window.screen;e="function"==typeof window.ScreenOrientation&&t.orientation instanceof ScreenOrientation&&"function"==typeof t.orientation.addEventListener&&null===t.orientation.onchange&&"string"==typeof t.orientation.type?t.orientation:function(){var e={90:oo.LANDSCAPE_PRIMARY,"-90":oo.LANDSCAPE_SECONDARY,0:oo.PORTRAIT_PRIMARY,180:oo.PORTRAIT_SECONDARY};function t(){}var i=new t,r=function(e){for(var t=["orientationchange","mozorientationchange","msorientationchange"],i=window.screen,r=0;r<t.length;r++)if(null===i["on"+t[r]])return{delegate:i,event:t[r]};if(void 0!==window.onorientationchange)return{delegate:window,event:"orientationchange"};return{delegate:po(e),event:"change"}}(i);return t.prototype.addEventListener=ao("addEventListener",r.delegate,r.event),t.prototype.dispatchEvent=ao("dispatchEvent",r.delegate,r.event),t.prototype.removeEventListener=ao("removeEventListener",r.delegate,r.event),t.prototype.lock=function(){var e,t="lockOrientation() is not available on this device.",i=window.screen;e=void 0===i?function(){return!1}:"function"==typeof i.msLockOrientation?i.msLockOrientation.bind(i):"function"==typeof i.mozLockOrientation?i.mozLockOrientation.bind(i):function(){return!1};return function(i){const r=window.Promise;return e(i)?r.resolve(i):r.reject(new Error(t))}}(),t.prototype.unlock=function(){var e=window.screen;return e&&e.orientation&&e.orientation.unlock.bind(e.orientation)||e.msUnlockOrientation&&e.msUnlockOrientation.bind(e)||e.mozUnlockOrientation&&e.mozUnlockOrientation.bind(e)||function(){}}(),Object.defineProperties(i,{onchange:{get:function(){return r.delegate["on"+r.event]||null},set:function(e){r.delegate["on"+r.event]=uo(e,i)}},type:{get:function(){var t=window.screen;return t.msOrientation||t.mozOrientation||e[window.orientation+""]||(fo().matches?"landscape-primary":"portrait-primary")}},angle:{value:0}}),i}()}}(),()=>{const e=sa();return{vh:oa(),vw:e}}),yu=Math.tan(.375*Math.PI),wu=!!(()=>{let e=!1;try{const t=Object.defineProperty({},"passive",{get:function(){e=!0}}),i=()=>{};window.addEventListener("test",i,t),window.removeEventListener("test",i)}catch(e){}return e})()&&{passive:!0};class Su extends U.EventEmitter{constructor(){super(),this.startValX=0,this.startValY=0,this.globalHorizontalSwipeGesture=!1,this.globalVerticalSwipeGesture=!1,this.enabled=!0,this.touchGestureRegistered=!1,this.handleMouseDown=this.handleMouseDown.bind(this),this.handleMouseMove=this.handleMouseMove.bind(this),this.handleMouseUp=this.handleMouseUp.bind(this),window.addEventListener("mousedown",this.handleMouseDown,!1),window.addEventListener("touchstart",this.handleMouseDown,wu)}enable(){this.enabled=!0}disable(){this.enabled=!1}handleMouseDown(e){qn({result:!1}),this.enabled&&Ir.getState()&&(this.pauseMouseDownTimer(),this.initStartPoint(e),this.globalHorizontalSwipeGesture=!1,this.globalVerticalSwipeGesture=!1,yr.emit("swipeController.startMove"),this.registerMoveAndUpEvents())}pauseMouseDownTimer(){this.touchGestureTimerId=setTimeout((()=>{Br(),this.touchGestureRegistered=!0}),200)}resumeMouseDownTimer(e){this.touchGestureRegistered?e.preventDefault():clearTimeout(this.touchGestureTimerId)}initStartPoint(e){this.startValX=e.pageX||e.touches&&e.touches[0].pageX,this.startValY=e.pageY||e.touches&&e.touches[0].pageY}handleMouseMove(e){let t=e.pageX||e.touches&&e.touches[0].pageX,i=e.pageY||e.touches&&e.touches[0].pageY,r=t-this.startValX,n=i-this.startValY,s=Math.abs(r/n),o=(Math.abs(n/r),!1),a=!1,l=!1;Math.abs(r)>0||Math.abs(n)>0?(o=!0,s<=yu&&(a=!0)):l=!0,a&&!this.globalHorizontalSwipeGesture?this.moveVertical(n):o&&!this.globalVerticalSwipeGesture&&this.moveHorizontal(t)}handleMouseUp(e){this.resumeMouseDownTimer(e),window.removeEventListener("mousemove",this.handleMouseMove),window.removeEventListener("touchmove",this.handleMouseMove,wu),window.removeEventListener("mouseup",this.handleMouseUp),window.removeEventListener("touchend",this.handleMouseUp),yr.emit("swipeController.beforeEndMove"),this.touchGestureRegistered=!1,this.globalHorizontalSwipeGesture||this.globalVerticalSwipeGesture?this.globalVerticalSwipeGesture?this.completeVerticalSwipe(e):this.completeHorizontalSwipe():Ur()}moveVertical(e){this.globalVerticalSwipeGesture=!0,yr.emit("swipeController.move",{startY:this.startValY,startX:this.startValX,y:e,x:0,lockY:!1,lockX:!0})}moveHorizontal(e){this.globalHorizontalSwipeGesture=!0,yr.emit("swipeController.move",{startY:this.startValY,startX:this.startValX,y:0,x:e,lockY:!0,lockX:!1})}completeVerticalSwipe(e){yr.emit("swipeController.endMove",{lockY:!1,lockX:!0}),this.globalVerticalSwipeGesture=!1}completeHorizontalSwipe(){yr.emit("swipeController.endMove",{lockY:!0,lockX:!1}),this.globalHorizontalSwipeGesture=!1}registerMoveAndUpEvents(){window.addEventListener("mousemove",this.handleMouseMove,!1),window.addEventListener("touchmove",this.handleMouseMove,wu),window.addEventListener("mouseup",this.handleMouseUp,!1),window.addEventListener("touchend",this.handleMouseUp,!1)}destroy(){window.removeEventListener("mousedown",this.handleMouseDown),window.removeEventListener("touchstart",this.handleMouseDown,wu)}}const bu=({storyReaderViewModel:e,desktopMode:t})=>{const i=(()=>{const[e,t]=(0,yo.useState)((()=>mu())),i=(0,yo.useCallback)((()=>{t(mu())}),[]);return(0,yo.useEffect)((()=>(window.addEventListener("resize",i),()=>{window.removeEventListener("resize",i)})),[]),e})();(()=>{const e=()=>{"hidden"===document.visibilityState&&Br(),"visible"===document.visibilityState&&Ur()};(0,yo.useEffect)((()=>(document.addEventListener("visibilitychange",e),()=>{document.removeEventListener("visibilitychange",e)})),[])})(),(()=>{const{desktopMode:e}=Au(),[t,i]=Fl([hn,Ir]),r=(0,yo.useRef)();(0,yo.useEffect)((()=>(r.current=new Su,()=>{var e;null===(e=r.current)||void 0===e||e.destroy()})),[]),(0,yo.useEffect)((()=>{const n=r.current;n&&(e||t||!i?n.disable():n.enable())}),[e,t,i])})(),Tu((()=>{e.close("closeReaderByEscBtn")}));return Ho(Wl,{storyReaderViewModel:e,children:[qo(vu,{viewport:i,storyReaderViewModel:e,slideApi:e.slideApi,onCloseStory:()=>{e.close()}}),qo(va,{orientation:li.PORTRAIT_PRIMARY,desktopMode:t,onOrientationChange:({isWrong:e})=>{e?zr():Wr()}})]})};var _u=p(763),xu={insert:"head",singleton:!1};Yo()(_u.A,xu);_u.A.locals;const Cu=({storyManager:e,appearanceManager:t,desktopMode:i})=>{const[,r]=(0,yo.useState)(0),[n,s]=(0,yo.useState)(null),o=(()=>{const e=(0,yo.useRef)();return e.current||(e.current=(()=>{const e=getComputedStyle(document.documentElement),t=t=>parseFloat(e.getPropertyValue(t)),i=t("--ias-sat"),r=t("--ias-sab");return{left:t("--ias-sal"),right:t("--ias-sar"),top:i,bottom:r}})()),e.current})(),a=()=>requestAnimationFrame((()=>r((e=>++e))));return(0,yo.useEffect)((()=>{const i=new so(e).create();return i.setSafeAreaInsets(o),i.on("update",a),i.setAppearanceManager(t),s(i),()=>{i.destroy()}}),[e]),(0,yo.useEffect)((()=>{null==n||n.setDesktopMode(i)}),[n,i]),n},ku=wo().createContext({storyManager:Qs,desktopMode:!1});let Ou=!1;const Eu=e=>{Ru(e.config),Pu(e);const t=Du(e),i=Iu(),r=(({storyManager:e,appearanceManager:t})=>{const[,i]=(0,yo.useState)(0),[r,n]=(0,yo.useState)(null),s=()=>requestAnimationFrame((()=>i((e=>++e))));return(0,yo.useEffect)((()=>{const i=new vs(e).create();return i.setAppearanceManager(t),i.on("update",s),n(i),()=>{i.destroy()}}),[e]),r})({storyManager:Qs,appearanceManager:t}),n=Cu({storyManager:Qs,appearanceManager:t,desktopMode:i});return(0,yo.useEffect)((()=>{if(Ou)throw new Error("There can only be one instance of <IASContainer /> per application");return Ou=!0,()=>{Ou=!1}}),[]),Ho(ku.Provider,{value:{storyManager:Qs,desktopMode:i},children:[(null==n?void 0:n.isOpened)&&qo(Ta,{gameReaderViewModel:n}),(null==r?void 0:r.activeStory)&&qo(bu,{storyReaderViewModel:r,desktopMode:i}),e.children]})},Au=()=>(0,yo.useContext)(ku);var Lu=p(3643);const Mu=p.n(Lu)().getParser(window.navigator.userAgent).parse(),Iu=()=>{const[e,t]=(0,yo.useState)(!1);(0,yo.useLayoutEffect)((()=>(i(),window.addEventListener("resize",i),()=>{window.removeEventListener("resize",i)})),[]);const i=()=>{"mobile"===Mu.parsedResult.platform.type?t(!1):t(!0)};return e},Tu=e=>{const t=t=>{t.keyCode===ri.esc&&e()};(0,yo.useEffect)((()=>(window.addEventListener("keydown",t),()=>{window.removeEventListener("keydown",t)})),[])},Ru=e=>{(0,yo.useEffect)((()=>{e.lang&&Qs.setLang(e.lang)}),[e.lang]),(0,yo.useEffect)((()=>{Qs.setApiKey(e.apiKey)}),[e.apiKey]),(0,yo.useEffect)((()=>{e.userId&&Qs.setUserId(e.userId)}),[e.userId]),(0,yo.useEffect)((()=>{e.tags&&Qs.setTags(e.tags)}),[JSON.stringify(e.tags)]),(0,yo.useEffect)((()=>{e.placeholders&&Qs.setPlaceholders(e.placeholders)}),[JSON.stringify(e.placeholders)]),(0,yo.useEffect)((()=>{e.imagePlaceholders&&Qs.setImagePlaceholders(e.imagePlaceholders)}),[JSON.stringify(e.imagePlaceholders)]),(0,yo.useEffect)((()=>{e.nonce&&Qs.setNonce(e.nonce)}),[e.nonce]),(0,yo.useEffect)((()=>{Qs.setConfig(e)}),[])},Pu=({onClickOnStory:e,onShowStory:t,onCloseStory:i,onShowSlide:r,onClickOnButton:n,onLikeStory:s,onDislikeStory:o,onFavoriteStory:a,onShareStory:l,onShareStoryWithPath:d,onFeedImpression:c,onVisibleAreaUpdated:u,onWidgetEvent:h})=>{(0,yo.useEffect)((()=>(e&&Qs.on("clickOnStory",e),t&&Qs.on("showStory",t),i&&Qs.on("closeStory",i),r&&Qs.on("showSlide",r),n&&Qs.on("clickOnButton",n),s&&Qs.on("likeStory",s),o&&Qs.on("dislikeStory",o),a&&Qs.on("favoriteStory",a),l&&Qs.on("shareStory",l),d&&Qs.on("shareStoryWithPath",d),c&&Qs.on("feedImpression",c),u&&Qs.on("visibleAreaUpdated",u),h&&Qs.on("widgetEvent",h),()=>{e&&Qs.off("clickOnStory",e),t&&Qs.off("showStory",t),i&&Qs.off("closeStory",i),r&&Qs.off("showSlide",r),n&&Qs.off("clickOnButton",n),s&&Qs.off("likeStory",s),o&&Qs.off("dislikeStory",o),a&&Qs.off("favoriteStory",a),l&&Qs.off("shareStory",l),d&&Qs.off("shareStoryWithPath",d),c&&Qs.off("feedImpression",c),u&&Qs.off("visibleAreaUpdated",u),h&&Qs.off("widgetEvent",h)})),[e,t,i,r,n,s,o,a,l,d,c,u,h])},Du=({commonOptions:e,gameReaderOptions:t,storyReaderOptions:i,goodsWidgetOptions:r})=>{const n=(0,yo.useRef)(new le).current;return(0,yo.useEffect)((()=>{e&&n.setCommonOptions(e)}),[JSON.stringify(e)]),(0,yo.useEffect)((()=>{t&&n.setGameReaderOptions(t)}),[JSON.stringify(t)]),(0,yo.useEffect)((()=>{r&&n.setGoodsWidgetOptions(r)}),[JSON.stringify(r),null==r?void 0:r.itemClickHandler,null==r?void 0:r.openGoodsWidgetHandler]),(0,yo.useEffect)((()=>{i&&n.setStoryReaderOptions(i)}),[JSON.stringify(i)]),n};var Nu=function(e,t){var i={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(i[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(r=Object.getOwnPropertySymbols(e);n<r.length;n++)t.indexOf(r[n])<0&&Object.prototype.propertyIsEnumerable.call(e,r[n])&&(i[r[n]]=e[r[n]])}return i};const Fu=e=>{var{listType:t,feedSlug:i,testKey:r,storyManager:n,options:s,optionsOverrideByMediaQuery:o,filter:a,useUgcCard:l=!1,hasFavorite:d,isFavorite:c}=e,u=Nu(e,["listType","feedSlug","testKey","storyManager","options","optionsOverrideByMediaQuery","filter","useUgcCard","hasFavorite","isFavorite"]);const[,h]=(0,yo.useState)(0),[p,f]=(0,yo.useState)(),{desktopMode:g}=Au(),v=((e,t)=>{const i=(0,yo.useRef)(new le).current;return(0,yo.useEffect)((()=>{e&&i.setStoriesListOptions(e)}),[JSON.stringify(e)]),(0,yo.useEffect)((()=>{t&&i.setOptionsOverrideByMediaQuery(t.map((({mediaQuery:e,viewportMinSize:t,options:i})=>({viewportMinSize:t,mediaQuery:e,storiesListOptions:i}))))}),[JSON.stringify(t)]),i})(s,o),m=()=>{requestAnimationFrame((()=>h((e=>++e))))},y=()=>{var e;null===(e=u.onLoadStart)||void 0===e||e.call(u)},w=e=>{var t;null===(t=u.onLoadEnd)||void 0===t||t.call(u,e)};return(0,yo.useEffect)((()=>{const e=new Fs(n).create({listType:t,testKey:r,identityFields:{feedSlug:i,filter:a},useUgcCard:l,isFavorite:c,hasFavorite:d});return e.setAppearanceManager(v),e.on("update",m),c||(e.on("startLoading",y),e.on("endLoading",w),e.loadStories({needFavorite:!0})),f(e),()=>{e.destroy()}}),[n,r,i,a,v]),(0,yo.useEffect)((()=>{if(p)return u.onFavoriteCardClick&&p.on("clickOnFavoriteCellInternal",u.onFavoriteCardClick),u.onUgcCardClick&&p.on("clickOnUgcCardCellInternal",u.onUgcCardClick),()=>{u.onFavoriteCardClick&&p.off("clickOnFavoriteCellInternal",u.onFavoriteCardClick),u.onUgcCardClick&&p.off("clickOnUgcCardCellInternal",u.onUgcCardClick)}}),[p,u.onUgcCardClick,u.onFavoriteCardClick]),(0,yo.useEffect)((()=>{p&&(p.modeDesktop=g)}),[g,p]),{storyListViewModel:p,appearanceManager:v}};function ju(e){return!/^(-?\d|--)/.test(e)}function Bu(e){const t=[];let i="",r="",n=7;for(let s,o=0;s=e.charAt(o);o++)if(/[a-zA-Z\d\xa0-\uffff_-]/.test(s)&&7===n)i+=s;else if("\\"===s&&7===n)n=6;else if(" "===s&&7===n){if(""!==i){if(!ju(i))return null;t.push(i),i=""}}else if(6===n)/[0-9a-f]/i.test(s)?(r+=s,n=8):(i+=s,n=7);else{if(8!==n)return null;/[0-9a-f]/i.test(s)&&r.length<6?r+=s:(i+=String.fromCodePoint(parseInt(r,16)),i+=s,r="",n=7)}if(""!==i){if(!ju(i))return null;t.push(i)}return t.join(" ")}function Uu(e,t){let i=t,r="";const n={"font-family":[]};for(let t,s=0;t=e.charAt(s);s+=1)if(4!==i||'"'!==t&&"'"!==t)if(3===i&&","===t)i=4,r="";else if(4===i&&","===t){const e=Bu(r);e&&n["font-family"].push(e),r=""}else if(5===i&&" "===t)/^(?:\+|-)?(?:[0-9]*\.)?[0-9]+(?:deg|grad|rad|turn)$/.test(r)?(n["font-style"]+=" "+r,r=""):s-=1,i=1;else if(1!==i||" "!==t&&"/"!==t)2===i&&" "===t?(/^(?:\+|-)?([0-9]*\.)?[0-9]+(?:em|ex|ch|rem|vh|vw|vmin|vmax|px|mm|cm|in|pt|pc|%)?$/.test(r)&&(n["line-height"]=r),i=4,r=""):r+=t;else{if(/^(?:(?:xx|x)-large|(?:xx|s)-small|small|large|medium)$/.test(r)||/^(?:larg|small)er$/.test(r)||/^(?:\+|-)?(?:[0-9]*\.)?[0-9]+(?:em|ex|ch|rem|vh|vw|vmin|vmax|px|mm|cm|in|pt|pc|%)$/.test(r))i="/"===t?2:4,n["font-size"]=r;else if(/^italic$/.test(r))n["font-style"]=r;else if(/^oblique$/.test(r))n["font-style"]=r,i=5;else if(/^small-caps$/.test(r))n["font-variant"]=r;else if(/^(?:bold(?:er)?|lighter|normal)$/.test(r))n["font-weight"]=r;else if(/^[+-]?(?:[0-9]*\.)?[0-9]+(?:e[+-]?(?:0|[1-9][0-9]*))?$/.test(r)){const e=parseFloat(r);e>=1&&e<=1e3&&(n["font-weight"]=r)}else/^(?:(?:ultra|extra|semi)-)?(?:condensed|expanded)$/.test(r)&&(n["font-stretch"]=r);r=""}else{let o=s+1;do{if(o=e.indexOf(t,o)+1,!o)return null}while("\\"===e.charAt(o-2));n["font-family"].push(e.slice(s+1,o-1).replace(/\\('|")/g,"$1")),s=o-1,i=3,r=""}if(3===i&&!/^\s*$/.test(r))return null;if(4===i){const e=Bu(r);e&&n["font-family"].push(e)}return n}var Vu=p(9780),Gu=p.n(Vu);class zu{toString(){return`${this.fontStyle} ${this.fontVariant} ${this.fontWeight} ${this.fontSize}px/${this.lineHeight} ${this.fontFamily.join(", ")}`}clone(){const e=new zu;return e.fontStyle=this.fontStyle,e.fontVariant=this.fontVariant,e.fontWeight=this.fontWeight,e.fontSize=this.fontSize,e.lineHeight=this.lineHeight,e.fontFamily=this.fontFamily.slice(),e}}class Wu{constructor(e,t){this.obj=e,this.cardTitleOptions=t,this.cardTitleFont=this.getCardTitleParsedFont(t.font)}getCardTitleFont(){return this.cardTitleFont.clone()}getScaledFontSizeInWebView(){const e=this.measureScaledFontSizeInWebView(this.cardTitleFont.fontSize)/this.cardTitleFont.fontSize;return this.cardTitleFont.fontSize/e}getStoryTitleBlockHeight(){if(!this.isOutsideTitle())return 0;const e=this.cardTitleOptions.padding;let t={top:0,bottom:0};try{if("number"==typeof e)t.top=e,t.bottom=e;else{const i=Gu()(e);t.top=parseFloat(i.top),t.bottom=parseFloat(i.bottom)}}catch(e){console.error(e)}const i=this.cardTitleOptions.lineClamp,r=Math.round(this.cardTitleFont.fontSize*this.cardTitleFont.lineHeight*100)/100;return t.top+t.bottom+i*r}measureScaledFontSizeInWebView(e){const t=document.createElement("span");t.style.fontSize=e+"px",t.style.display="none",this.obj.append(t);const i=getComputedStyle(t).fontSize;return this.obj.removeChild(t),parseFloat(i)||e}isOutsideTitle(){return this.cardTitleOptions.display&&(this.cardTitleOptions.position===q.CARD_OUTSIDE_TOP||this.cardTitleOptions.position===q.CARD_OUTSIDE_BOTTOM)}getCardTitleParsedFont(e){const t=new zu;t.fontStyle="normal",t.fontVariant="normal",t.fontWeight="normal",t.fontSize=14,t.lineHeight=1.2,t.fontFamily=["system-ui",'"Segoe UI"',"Roboto","Helvetica","Arial","sans-serif",'"Apple Color Emoji"','"Segoe UI Emoji"','"Segoe UI Symbol"'];try{const i=function(e){const t=Uu(e,1);return null!==t&&t["font-size"]&&t["font-family"].length?t:null}(e);if(null!=i["font-style"]&&(t.fontStyle=i["font-style"]),null!=i["font-variant"]&&(t.fontVariant=i["font-variant"]),null!=i["font-weight"]&&(t.fontWeight=i["font-weight"]),null!=i["font-size"]){const e=parseFloat(i["font-size"]);String(`${e}px`)===i["font-size"]&&(t.fontSize=e)}if(null!=i["line-height"]){const e=parseFloat(i["line-height"]);String(`${e}px`)===i["line-height"]?t.lineHeight=Math.round(e/t.fontSize*100)/100:String(e)===i["line-height"]&&(t.lineHeight=parseFloat(i["line-height"]))}null!=i["font-family"]&&Array.isArray(i["font-family"])&&(t.fontFamily=i["font-family"])}catch(e){console.error(e)}return t}}class $u{constructor(e){this.storiesListOptions=e}getStoriesListStyleOptions(e){var t,i,r,n,s,o;let a={storiesHeight:null!==(i=null===(t=this.storiesListOptions.card)||void 0===t?void 0:t.height)&&void 0!==i?i:70,storiesLayoutHeight:null!==(n=null===(r=this.storiesListOptions.layout)||void 0===r?void 0:r.height)&&void 0!==n?n:0,storiesListTopPadding:null!==(s=this.storiesListOptions.topPadding)&&void 0!==s?s:0,storiesListBottomPadding:null!==(o=this.storiesListOptions.bottomPadding)&&void 0!==o?o:0},l=parseFloat(a.storiesHeight),d=l;if(parseFloat(a.storiesLayoutHeight))return l=parseFloat(a.storiesLayoutHeight),{storiesListHeight:l,storiesListInnerHeight:d};return l+=parseFloat(a.storiesListTopPadding)+parseFloat(a.storiesListBottomPadding)+e,d+=e,{storiesListHeight:l,storiesListInnerHeight:d}}}const qu=(e,t,i)=>{const r=(e,t)=>{const i=e.getCardTitleFont();i.fontSize=e.getScaledFontSizeInWebView(),t.card.title.font=i.toString()},n=(e,t)=>{const i=new $u(t),{storiesListHeight:r,storiesListInnerHeight:n}=i.getStoriesListStyleOptions(e.getStoryTitleBlockHeight()),s=t.layout.height;t.layout.height=Le()(s)?`${r}px`:s},s=t=>{((e,t)=>{const i=new Wu(e,t.card.title);r(i,t),n(i,t)})(e.current,t),i.emit("update")};(0,yo.useLayoutEffect)((()=>(s(t.storiesListOptions),t.on(j.EVENT_UPDATED_STORIES_LIST_OPTIONS,s),()=>{t.off(j.EVENT_UPDATED_STORIES_LIST_OPTIONS,s)})),[t,i])},Hu=(e,t)=>{const[i,r]=(0,yo.useState)(!1),[n,s]=(0,yo.useState)(null),{ref:o}=(e=>{const t=(0,yo.useRef)(null);return(0,yo.useEffect)((()=>{if(!t.current)return;const i=new or;return i.mount(t.current),e(i),()=>{i.destroy()}}),[]),{ref:t}})((e=>{s(e),e.addListener("scrollstart",(()=>r(!0))),e.addListener("scrollend",(()=>setTimeout((()=>r(!1)),100)))}));(0,yo.useEffect)((()=>{n&&(n.setGap(e.options.card.gap),n.setDesktopMode(e.modeDesktop),n.changeDirection(e.options.direction))}),[n,e.options.card.gap,e.modeDesktop,e.options.direction]);const a=(0,yo.useCallback)(ir()((()=>{null==n||n.testAttraction(),null==n||n.emit("scroll")}),0),[n,t]);return(0,yo.useEffect)((()=>(null==n||n.scrollTo(0,0),a(),window.addEventListener("resize",a),()=>{window.addEventListener("resize",a)})),[n,a]),{sliderRef:o,slider:n,isScrolling:i}};var Zu=p(5213),Qu={insert:"head",singleton:!1};Yo()(Zu.A,Qu);const Xu=Zu.A.locals||{},Yu=({slider:e,storyListViewModel:t,isFavorite:i,listType:r,identityFields:n,storyManager:s})=>{const o=(({storyManager:e,listType:t,identityFields:i})=>{const[r,n]=(0,yo.useState)();return(0,yo.useEffect)((()=>{const r=new It(e,{listType:t,identityFields:i}).create();return n(r),()=>{r.destroy()}}),[i.feedSlug,i.filter]),r})({listType:r,identityFields:n,storyManager:s});(0,yo.useEffect)((()=>{if(!e||i||!o)return;let t=0,r=0,n=0,s=0;const l=({x:e,y:i})=>{t=e,n=i,r=e,s=i},d=({x:e,y:i})=>{t=Math.min(e,t),r=Math.max(e,r),n=Math.min(i,n),s=Math.max(i,s),o.calculate({minOffsetLeft:t,maxOffsetLeft:r,minOffsetTop:n,maxOffsetTop:s})};e.addListener("scrollstart",l),e.addListener("scrollend",d);const c=ir()(a,600,{leading:!1});return window.addEventListener("scroll",c),window.addEventListener("resize",c),()=>{null==e||e.removeListener("scrollstart",l),null==e||e.removeListener("scrollend",d),window.removeEventListener("scroll",c),window.removeEventListener("resize",c)}}),[e,i]),(0,yo.useEffect)((()=>{i||a()}),[t.options.direction,t.options.card.aspectRatio,t.options.card.height,t.session,i,o]);const a=()=>{if(!e||!o)return;const t=e.elementRef.getBoundingClientRect(),{x:i,y:r}=e.getCurrentPosition();l(t),o.calculate({minOffsetLeft:i,maxOffsetLeft:i,minOffsetTop:r,maxOffsetTop:r})};(0,yo.useEffect)((()=>{if(!o)return;const e=e=>o.markStoryAsFullVisible(e);return t.on("openStory",e),()=>{t.off("openStory",e)}}),[t]);const l=e=>{const{left:t,top:i,width:r,height:n}=e,s=new ft(t,i,r,n);d(s),u(s)},d=e=>{const t=new ft(0,0,window.innerWidth,window.innerHeight),i=c(t,e);h(i,e),o.setViewport(i)},c=(e,t)=>{let i=new ft;return t.overlaps(e)?(i=t.getIntersection(e),i):i},u=t=>{if(!e)return;const i=e.slides,r=[];i.forEach(((e,n)=>{const s=Number(e.dataset.id),o=new yt(s,e.offsetLeft,e.offsetTop,e.clientWidth,e.clientHeight);r.push(o),o.x+=t.x,o.y+=t.y,f(o,n,i.length-1)})),o.setStoryRects(r)},h=(e,t)=>{if(t.width<768)return;const i=p();e.x+=i.left,e.y+=i.top,e.height-=i.top+i.bottom,e.width-=i.left+i.right},p=()=>{const e=t.options.sidePadding,i={left:e,right:e,top:t.options.topPadding,bottom:t.options.bottomPadding};return"vertical"===t.options.direction&&(i.left=0,i.right=0),i},f=(e,t,i)=>{const r=p();e.x+=r.left,0===t&&(e.x+=r.left,e.width-=r.left),t===i&&(e.width-=r.right)}},Ku=(e,t,i)=>{(0,yo.useEffect)((()=>{if(e)return t.on("closeStory",r),()=>{t.off("closeStory",r)}}),[e]);const r=r=>{if(!e)return;const n=e.slides.find((e=>Number(e.dataset.id)===r));if(!n||((e,t)=>{const r=new ft(t.offsetLeft,t.offsetTop,t.clientWidth,t.clientHeight),{x:n,y:s}=e.getCurrentPosition(),o=i.current.getBoundingClientRect(),a=new ft(o.x+n,o.y+s,o.width,o.height);return r.overlaps(a)})(e,n))return;const s="horizontal"===t.options.direction?n.offsetLeft:n.offsetTop;e.scrollTo(s)}},Ju=(0,yo.forwardRef)(((e,t)=>{const i=e.sliderOptions.card,r=e.sliderOptions.favoriteCard,n=i.border,s=i.opened.border,o=e.sliderOptions.navigation,a=()=>{var e,t,i;return(null!==(e=s.radius)&&void 0!==e?e:n.radius)-parseFloat(null!==(t=s.width)&&void 0!==t?t:n.width)-parseFloat(null!==(i=s.gap)&&void 0!==i?i:n.gap)};return qo("div",{ref:t,className:e.className,style:Object.assign(Object.assign({},(()=>{var t,l,d,c,u,h,p,f,g,v,m,y,w,S,b,_,x,C,k,O,E;const A=e=>{let t="";return null!=e&&Array.isArray(e.linearGradient)&&(t=e.linearGradient.map((({direction:e,points:t})=>`linear-gradient(${[e,t].filter(Boolean).join(", ")})`)).join(", ")),t};let L={"--storiesBorderNotReadColor":n.color,"--storiesBorderReadColor":null!==(t=s.color)&&void 0!==t?t:n.color,"--storiesBorderNotReadGradientColor":null==n?void 0:n.gradient,"--storiesBorderReadGradientColor":null!==(l=null==s?void 0:s.gradient)&&void 0!==l?l:null==n?void 0:n.gradient,"--storiesListCardFavoriteGradientColor":null===(d=e.sliderOptions.favoriteCard.border)||void 0===d?void 0:d.gradient,"--storiesListCardUgcGradientColor":null===(c=e.sliderOptions.ugcCard.border)||void 0===c?void 0:c.gradient,"--storiesGap":i.gap+"px","--storiesHeight":i.height+"px","--storiesListSidePadding":e.sliderOptions.sidePadding+"px","--storiesListBorderNotReadWidth":n.width+"px","--storiesListBorderReadWidth":(null!==(u=s.width)&&void 0!==u?u:s.width)+"px","--storiesListBorderGapNotRead":n.gap+"px","--storiesListBorderGapRead":(null!==(h=s.gap)&&void 0!==h?h:s.gap)+"px","--storiesListBorderRadius":n.radius+"px","--storiesListBorderRadiusRead":(null!==(p=s.radius)&&void 0!==p?p:s.radius)+"px","--storiesListItemMaskColor":i.mask.color,"--storiesListItemOpenedMaskColor":null!==(f=i.opened.mask.color)&&void 0!==f?f:i.mask.color,"--storiesListItemMaskLinearGradient":A(i.mask),"--storiesListItemOpenedMaskLinearGradient":A(null!=(null===(v=null===(g=i.opened)||void 0===g?void 0:g.mask)||void 0===v?void 0:v.linearGradient)?i.opened.mask:i.mask),"--storiesListCardFavoriteTitle":Oi(r.title.padding.toString())?r.title.padding+"px":r.title.padding,"--storiesListCardFavoriteGap":Oi(r.gap.toString())?r.gap+"px":r.gap,"--storiesListCardUgcMaskColor":e.sliderOptions.ugcCard.mask.color,"--storiesListCardUgcMaskLinearGradient":A(e.sliderOptions.ugcCard.mask),"--storiesListItemTitleColor":i.title.color,"--storiesListItemTitleFontFamily":"InternalPrimaryFont","--storiesListItemTitleFont":i.title.font,"--storiesListItemTitlePadding":Oi(i.title.padding.toString())?i.title.padding+"px":i.title.padding,"--storiesListControlsSize":Oi(o.controlsSize.toString())?o.controlsSize+"px":o.controlsSize,"--storiesListControlsBackgroundColor":o.controlsBackgroundColor,"--storiesListControlsColor":o.controlsColor,"--storiesListInnerBorderRadiusNotRead":n.radius-parseFloat(n.width)-parseFloat(n.gap)+"px","--storiesListInnerBorderRadiusRead":a()+"px","--storiesListCardDropShadow":i.dropShadow,"--storiesListCardOpenedDropShadow":null!==(m=i.opened.dropShadow)&&void 0!==m?m:i.dropShadow,"--storiesListCardFavoriteDropShadow":e.sliderOptions.favoriteCard.dropShadow,"--storiesListCardUgcDropShadow":e.sliderOptions.ugcCard.dropShadow,"--storiesListCardMask":(null===(y=i.svgMask)||void 0===y?void 0:y.cardMask)?`url("data:image/svg+xml,${Ze(null===(w=i.svgMask)||void 0===w?void 0:w.cardMask)}")`:null,"--storiesListCardOpenedMask":(null===(S=i.opened.svgMask)||void 0===S?void 0:S.cardMask)?`url("data:image/svg+xml,${Ze(null===(b=i.opened.svgMask)||void 0===b?void 0:b.cardMask)}")`:null,"--storiesListCardFavoriteMask":(null===(_=e.sliderOptions.ugcCard.svgMask)||void 0===_?void 0:_.cardMask)?`url("data:image/svg+xml,${Ze(null===(x=e.sliderOptions.ugcCard.svgMask)||void 0===x?void 0:x.cardMask)}")`:null},M=null;return M=null===(C=i.svgMask)||void 0===C?void 0:C.overlayMask,null!=M&&Array.isArray(M)&&M.forEach(((e,t)=>L[`--storiesListCardOverlay${t}Mask`]=e.mask?`url("data:image/svg+xml,${Ze(e.mask)}")`:null)),M=null===(k=i.opened.svgMask)||void 0===k?void 0:k.overlayMask,null!=M&&Array.isArray(M)&&M.forEach(((e,t)=>L[`--storiesListCardOpenedOverlay${t}Mask`]=e.mask?`url("data:image/svg+xml,${Ze(e.mask)}")`:null)),M=null===(O=e.sliderOptions.favoriteCard.svgMask)||void 0===O?void 0:O.overlayMask,null!=M&&Array.isArray(M)&&M.forEach(((e,t)=>L[`--storiesListCardFavoriteOverlay${t}Mask`]=e.mask?`url("data:image/svg+xml,${Ze(e.mask)}")`:null)),M=null===(E=e.sliderOptions.ugcCard.svgMask)||void 0===E?void 0:E.overlayMask,null!=M&&Array.isArray(M)&&M.forEach(((e,t)=>L[`--storiesListCardUgcOverlay${t}Mask`]=e.mask?`url("data:image/svg+xml,${Ze(e.mask)}")`:null)),L})()),e.style),children:e.children})})),eh=navigator.vendor&&navigator.vendor.indexOf("Apple")>-1&&navigator.userAgent&&-1==navigator.userAgent.indexOf("CriOS")&&-1==navigator.userAgent.indexOf("FxiOS"),th=({videoCoverSrc:e,onVideoCoverLoaded:t})=>{const i=(0,yo.useRef)(null);return(0,yo.useEffect)((()=>{(()=>{if(!e)return;const r=i.current,n=()=>{r.play().then((()=>{if(eh){let e=1;const i=()=>{e>=2&&(r.removeEventListener("timeupdate",i),r.currentTime=0,t()),e++};r.addEventListener("timeupdate",i,!1)}else t()})).catch((e=>{console.error(e)})),r.removeEventListener("canplaythrough",n)};r.addEventListener("canplaythrough",n),r.load()})()}),[]),qo("video",{ref:i,src:e,loop:!0,muted:!0,playsInline:!0,"webkit-playsinline":"true",preload:"auto"})},ih=({story:e,cardOptions:t,favoriteCardOptions:i,ugcCardOptions:r})=>{const n=(e,t)=>null!=t&&Array.isArray(t)?t.map(((t,i)=>s(t,e,i))):[],s=(e,t,i)=>({maskImage:`var(--${t}${i}Mask)`,WebKitMaskImage:`var(--${t}${i}Mask)`,background:e.background});return{getAllCardsOverlayMaskStyles:()=>{let s=[];var o;return e.isFavoriteCard&&(s=s.concat(n("storiesListCardFavoriteOverlay",null===(o=i.svgMask)||void 0===o?void 0:o.overlayMask))),s=e.isUgcCard?s.concat((()=>{var e;return n("storiesListCardUgcOverlay",null===(e=r.svgMask)||void 0===e?void 0:e.overlayMask)})()):e.isOpened?s.concat((()=>{var e;return n("storiesListCardOpenedOverlay",null===(e=t.opened.svgMask)||void 0===e?void 0:e.overlayMask)})()):s.concat((()=>{var e;return n("storiesListCardOverlay",null===(e=t.svgMask)||void 0===e?void 0:e.overlayMask)})()),s}}};var rh=p(6892),nh={insert:"head",singleton:!1};Yo()(rh.A,nh);const sh=rh.A.locals||{},oh=({story:e,cardOptions:t,favoriteCardOptions:i,ugcCardOptions:r,isScrolling:n,wrapperStyle:s,children:o,onClick:a})=>{const l={story:e,cardOptions:t,favoriteCardOptions:i,ugcCardOptions:r},[d,c]=(0,yo.useState)(!1),{getAllCardsOverlayMaskStyles:u}=ih(l),{getCardTitleAlignClass:h,getTitleStyle:p,getTitleWrapperStyle:f}=(({story:e,cardOptions:t,favoriteCardOptions:i,ugcCardOptions:r})=>({getCardTitleAlignClass:()=>({[sh["align-left"]]:t.title.textAlign===$.LEFT,[sh["align-center"]]:t.title.textAlign===$.CENTER,[sh["align-right"]]:t.title.textAlign===$.RIGHT}),getTitleStyle:()=>{let i={};return e.titleColor&&e.isTitleCardInner&&Object.assign(i,{color:e.titleColor}),i.WebkitLineClamp=String(parseInt(t.title.lineClamp)),i},getTitleWrapperStyle:()=>{let t={};return e.titleColor&&e.isFavoriteCard&&(t=Object.assign(Object.assign({},t),{color:i.title.color})),e.titleColor&&e.isUgcCard&&(t=Object.assign(Object.assign({},t),{color:r.title.color})),t}}))(l),{getSlideClassList:g,getSlideStyleList:v,getSlideWrapperStyle:m}=(({story:e,cardOptions:t,favoriteCardOptions:i,ugcCardOptions:r})=>{const n=e.aspectRatio;return{getSlideClassList:()=>{var n,s;const o=e.background;let a="";void 0!==o&&(a=sh[`_background-color-${o.color}`+(!0===o.gradient?"-gradient":"")]);const l=(()=>{let n;return n=e.isFavoriteCard?i:e.isUgcCard?r:e.isOpened&&t.opened||t,n})(),d=Boolean(l.dropShadow),c=Boolean(null===(n=l.svgMask)||void 0===n?void 0:n.cardMask),u=Boolean(null===(s=l.border)||void 0===s?void 0:s.gradient);return[a,{[sh["_is-read"]]:e.isOpened},{[sh["_format-rectangle"]]:t.variant===te.STYLE_RECTANGLE},{[sh["_format-circle"]]:t.variant===te.STYLE_CIRCLE},{[sh["_format-quad"]]:t.variant===te.STYLE_QUAD},{[sh["_favorite-cell"]]:e.isFavoriteCard},{[sh["_ugc-cell"]]:e.isUgcCard},{[sh["_has-drop-shadow"]]:d},{[sh["_has-card-svg-mask"]]:c},{[sh["_has-border-gradient-color"]]:u}]},getSlideStyleList:()=>{const i={width:n*t.height+"px",opacity:null!==t.opacity?t.opacity:1,boxShadow:t.boxShadow||"unset",height:`${t.height}px`};return e.isOpened&&(i.boxShadow=t.opened.boxShadow||i.boxShadow,i.opacity=null!==t.opened.opacity?t.opened.opacity:i.opacity),i},getSlideWrapperStyle:()=>{let e={};return e.width=n*t.height+"px",e}}})(l),y=e.getImageSrc();return Ho("a",{"data-id":e.id,className:Qo()(sh["stories-slide-wrapper"],{[sh.isTitleCardOutsideTop]:e.isTitleCardOutsideTop,[sh.isTitleCardOutsideBottom]:e.isTitleCardOutsideBottom}),style:Object.assign(Object.assign({},m()),s),rel:"noreferrer",onClick:t=>{n||(t.stopPropagation(),t.preventDefault(),a(e))},children:[t.title.display&&e.isTitleCardOutsideTop&&qo("div",{className:Qo()(sh["stories-slide__content"],sh.__position_outside_top),style:f(),children:qo("div",{className:Qo()(sh["stories-slide__title"],sh.clamp,h()),style:p(),children:e.title})}),Ho("div",{className:Qo()(sh["stories-slide"],g()),style:v(),children:[Ho("div",{className:sh["stories-slide__inner"],children:[qo("div",{className:sh["stories-slide-image"],style:{backgroundColor:e.backgroundColor?e.backgroundColor:"transparent"},children:qo("div",{className:sh["stories-slide-image__wrap"],children:Ho("div",{className:Qo()(sh["stories-slide-image__image"],sh._mode_list,{[sh["video-loaded"]]:d,[sh["ugc-card-cell"]]:e.isUgcCard}),children:[y&&qo("img",{src:y,alt:e.title,loading:t.coverLazyLoading?"lazy":"eager"}),e.videoCoverSrc&&qo(th,{onVideoCoverLoaded:()=>c(!0),videoCoverSrc:e.videoCoverSrc}),o]})})}),qo("div",{className:sh["stories-slide__mask"]}),t.title.display&&e.isTitleCardInner&&qo("div",{className:sh["stories-slide__content"],style:f(),children:qo("div",{className:Qo()(sh["stories-slide__title"],sh.clamp,h()),style:p(),children:e.title})})]}),u().map(((e,t)=>qo("div",{style:e,className:sh["card-overlay-svg-mask"]},t)))]}),t.title.display&&e.isTitleCardOutsideBottom&&qo("div",{className:Qo()(sh["stories-slide__content"],sh.__position_outside_bottom),style:f(),children:qo("div",{className:Qo()(sh["stories-slide__title"],sh.clamp,h()),style:p(),children:e.title})})]})};var ah=p(1980),lh={insert:"head",singleton:!1};Yo()(ah.A,lh);const dh=ah.A.locals||{};var ch=function(e,t){var i={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(i[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(r=Object.getOwnPropertySymbols(e);n<r.length;n++)t.indexOf(r[n])<0&&Object.prototype.propertyIsEnumerable.call(e,r[n])&&(i[r[n]]=e[r[n]])}return i};const uh=e=>{var{sliderDirection:t,slider:i}=e,r=ch(e,["sliderDirection","slider"]);const[n,s]=(0,yo.useState)(!0),[o,a]=(0,yo.useState)(!1);(0,yo.useEffect)((()=>(i.on("scroll",l),()=>{i.off("scroll",l)})),[i]);const l=()=>{s(i.reachBeginning),a(i.reachEnd)},d=e=>{const{x:n,y:s}=i.getCurrentPosition(),o=t===sr.Horizontal?n:s,a=i.getSlidesPerView(),l=(()=>{var e;return(null===(e=i.slides[0])||void 0===e?void 0:e.clientWidth)+i.getGap()})(),d=(()=>{var e;return(null===(e=i.slides[0])||void 0===e?void 0:e.clientHeight)+i.getGap()})(),c=o+e*a*(t===sr.Horizontal?l:d);i.scrollTo(c,r.navigationOptions.speed)};return r.navigationView?r.navigationView({defaultStyles:dh,reachStart:n,reachEnd:o,onPrev:()=>d(-1),onNext:()=>d(1),slider:{direction:t,viewport:i.elementRef.getBoundingClientRect()}}):r.navigationOptions.showControls?Ho("div",{className:Qo()(dh["stories-list-controls"],dh[t]),children:[qo("div",{onClick:()=>d(-1),className:Qo()(dh["control-start"],{active:n}),children:qo("div",{className:dh["control-icon"]})}),qo("div",{onClick:()=>d(1),className:Qo()(dh["control-end"],{active:o}),children:qo("div",{className:dh["control-icon"]})})]}):null};var hh=p(7966),ph={insert:"head",singleton:!1};Yo()(hh.A,ph);const fh=hh.A.locals||{},gh=({favoriteStories:e,cardOptions:t})=>{const i=e=>({paddingTop:1/e.aspectRatio*100+"%"}),r=e=>{const t=e.getImageSrc(),i={};return t?i.backgroundImage=`url('${t}')`:i.backgroundColor=e.backgroundColor,i};return qo("div",{className:fh["favorite-images-wrapper"],children:e.slice(0,4).map(((e,n)=>qo("div",{className:fh["favorite-image-wrapper"],children:qo("div",{style:i(e),className:Qo()(fh["favorite-image"],{[fh.circle_style]:t.variant===te.STYLE_CIRCLE}),children:qo("div",{className:fh["favorite-image-item"],style:r(e)})})},n)))})};var vh=function(e,t){var i={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(i[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(r=Object.getOwnPropertySymbols(e);n<r.length;n++)t.indexOf(r[n])<0&&Object.prototype.propertyIsEnumerable.call(e,r[n])&&(i[r[n]]=e[r[n]])}return i};const mh=(0,yo.forwardRef)(((e,t)=>{var{onLoadStart:i,onLoadEnd:r,isFavorite:n=!1,storyListViewModel:s}=e,o=vh(e,["onLoadStart","onLoadEnd","isFavorite","storyListViewModel"]);const a=(0,yo.useRef)(null),l=(0,yo.useRef)(null),d=(({isFavorite:e,storyListViewModel:t})=>{let i=[];return e?i=t.favoriteStories:(i=t.defaultStories,t.favoriteCard&&i.push(t.favoriteCard),t.ugcCard&&i.unshift(t.ugcCard)),i})({isFavorite:n,storyListViewModel:s});((e,t)=>{(0,yo.useImperativeHandle)(e,(()=>({reload:t.reload.bind(t)})),[t])})(t,s),qu(a,o.appearanceManager,s);const{sliderRef:c,slider:u,isScrolling:h}=Hu(s,d.length);Yu({slider:u,storyListViewModel:s,isFavorite:n,listType:o.listType,identityFields:{feedSlug:o.feedSlug,filter:o.filter},storyManager:o.storyManager}),((e,t,i)=>{(0,yo.useEffect)((()=>{e&&t.modeDesktop&&r(e,i.current)}),[e,t.modeDesktop]);const r=(e,i)=>{if(t.options.layout.sliderAlign!==z.CENTER)return;let r=e.scrollWidth;if(r>0&&r<i.clientWidth){let t=i.clientWidth-r/2;e.scrollTo(t)}}})(u,s,l),Ku(u,s,l);const{getRootStyle:p,getStoryWrapperStyle:f,viewportInnerClassList:g,viewportInnerStyle:v}={getRootStyle:()=>({"--background-color":m.options.layout.backgroundColor,paddingLeft:m.options.sidePadding+"px",paddingRight:m.options.sidePadding+"px","--storiesListTopPadding":m.options.topPadding+"px","--storiesListBottomPadding":m.options.bottomPadding+"px","--storiesListSidePadding":m.options.sidePadding+"px",backgroundColor:m.options.layout.backgroundColor}),getStoryWrapperStyle:(e,t)=>{let i={marginRight:"0",paddingLeft:"0",paddingRight:"0"};return"vertical"===m.options.direction||(e!==t-1?i.marginRight=m.options.card.gap+"px":i.paddingRight=m.options.sidePadding+"px",0===e&&(i.paddingLeft=m.options.sidePadding+"px")),i},viewportInnerClassList:(m=s).modeDesktop?Qo()(Xu["stories-list__viewport-inner"],Xu["mode-desktop"],{[Xu["with-list-controls"]]:m.options.navigation.showControls,[Xu.isTitleCardOutsideTop]:m.options.card.title.position===q.CARD_OUTSIDE_TOP,[Xu.isTitleCardOutsideBottom]:m.options.card.title.position===q.CARD_OUTSIDE_BOTTOM,[Xu.isVerticalDirection]:"vertical"===m.options.direction}):Qo()(Xu["stories-list__viewport-inner"],Object.assign(Object.assign({},{[Xu["align-left"]]:m.options.layout.sliderAlign===z.LEFT,[Xu["align-center"]]:m.options.layout.sliderAlign===z.CENTER,[Xu["align-right"]]:m.options.layout.sliderAlign===z.RIGHT}),{[Xu.isTitleCardOutsideTop]:m.options.card.title.position===q.CARD_OUTSIDE_TOP,[Xu.isTitleCardOutsideBottom]:m.options.card.title.position===q.CARD_OUTSIDE_BOTTOM,[Xu.isVerticalDirection]:"vertical"===m.options.direction})),viewportInnerStyle:{height:m.options.layout.height,gap:"vertical"===m.options.direction?`${m.options.card.gap}px`:0}};var m;const y=s.options.card,w=s.options.favoriteCard,S=s.options.ugcCard;return Ho(Ju,{className:Qo()(Xu["stories-list-wrapper"],{[Xu["mode-desktop"]]:s.modeDesktop,[Xu["with-list-controls"]]:s.options.navigation.showControls}),style:p(),sliderOptions:s.options,ref:a,children:[qo("div",{className:Xu["stories-list"],children:qo("div",{ref:l,className:Qo()(Xu["stories-list__viewport"],{[Xu["mode-desktop"]]:s.modeDesktop}),style:"horizontal"===s.options.direction?{marginLeft:-s.options.sidePadding+"px",marginRight:-s.options.sidePadding+"px"}:{},children:qo("div",{ref:c,className:g,style:v,children:d.map(((e,t)=>{var i;const r=e.isFavoriteCard&&s.favoriteCard,n=o.storyCardView&&!r;return r&&o.favoriteCardView?qo(wo().Fragment,{children:o.favoriteCardView(s.favoriteCard)},t):qo(wo().Fragment,{children:n?null===(i=o.storyCardView)||void 0===i?void 0:i.call(o,e):qo(oh,{story:e,cardOptions:y,favoriteCardOptions:w,ugcCardOptions:S,wrapperStyle:f(t,d.length),isScrolling:h,onClick:e=>s.onStoryClick(e,t),children:r&&qo(gh,{favoriteStories:s.favoriteCard.favoriteStories,cardOptions:y})},t)},t)}))})})}),u&&qo(uh,{navigationOptions:s.options.navigation,navigationView:o.navigationView,sliderDirection:s.options.direction,storiesLength:d.length,slider:u})]})})),yh=(0,yo.forwardRef)(((e,t)=>{var i,r;const{storyManager:n}=Au(),s=null!==(i=e.feedSlug)&&void 0!==i?i:"default",o=Xe.DEFAULT,{storyListViewModel:a,appearanceManager:l}=Fu(Object.assign(Object.assign({},e),{storyManager:n,feedSlug:s,listType:o,hasFavorite:Boolean(e.hasFavorite),isFavorite:!1}));return a?qo(mh,Object.assign({},e,{appearanceManager:l,storyManager:n,feedSlug:null!==(r=e.feedSlug)&&void 0!==r?r:"default",listType:Xe.DEFAULT,storyListViewModel:a,ref:t})):null})),wh=(0,yo.forwardRef)(((e,t)=>{const{storyManager:i}=Au(),r=Hs,n=Xe.UGC,{storyListViewModel:s,appearanceManager:o}=Fu(Object.assign(Object.assign({},e),{storyManager:i,feedSlug:r,listType:n,isFavorite:!1,hasFavorite:!1}));return s?qo(mh,Object.assign({},e,{ref:t,appearanceManager:o,storyManager:i,listType:Xe.UGC,feedSlug:Hs,storyListViewModel:s})):null})),Sh=e=>{const{storyManager:t}=Au(),i="default",r=Xe.DEFAULT,{storyListViewModel:n,appearanceManager:s}=Fu(Object.assign(Object.assign({},e),{storyManager:t,feedSlug:i,listType:r,isFavorite:!0,hasFavorite:!0}));return n?qo(mh,Object.assign({},e,{appearanceManager:s,storyManager:t,feedSlug:i,listType:r,storyListViewModel:n,isFavorite:!0})):null}})(),f})()));
|
|
202
|
+
`;var Rc=p(2843),Pc={insert:"head",singleton:!1};Ko()(Rc.A,Pc);const Dc=Rc.A.locals||{};var Nc=function(e,t,i,r){return new(i||(i=Promise))((function(n,s){function o(e){try{l(r.next(e))}catch(e){s(e)}}function a(e){try{l(r.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,a)}l((r=r.apply(e,t||[])).next())}))};let Fc=null;const jc=e=>{const[t,i]=(0,wo.useState)([]);(0,wo.useEffect)((()=>{wr.emit("publicEvents.widgetEvent",{name:"w-goods-open",devPayload:{story_id:e.story.id,slide_index:e.story.activeSlideIndex,widget_id:e.elementId}})}),[]),(0,wo.useEffect)((()=>{e.url&&r()}),[e.url]);const r=()=>Nc(void 0,void 0,void 0,(function*(){const t=n(),r=yield e.goodsWidgetOptions.openGoodsWidgetHandler(t);i(r)})),n=()=>{try{return JSON.parse(e.url).map((e=>({sku:e,title:"",subTitle:"",price:"",oldPrice:"",rawData:{}})))}catch(e){return console.error(e),[]}};return Ho("div",{className:Dc["goods-container"],children:Ho(rc.CacheProvider,{value:(null==Fc&&(Fc=_o()({key:"ias-widget-goods",nonce:We()})),Fc),children:Ho(Oc,{goods:t,goodsWidgetOptions:e.goodsWidgetOptions,onClose:e.onClose,onGoodsCardClick:t=>{var i,r;wr.emit("publicEvents.widgetEvent",{name:"w-goods-click",devPayload:{story_id:e.story.id,slide_index:e.story.activeSlideIndex,widget_id:e.elementId,widget_value:t.sku}}),null===(r=(i=e.goodsWidgetOptions).itemClickHandler)||void 0===r||r.call(i,t)}})})})},Bc={247:"9999",376:"99 99 99",971:"99 999 9999",93:"99 999 9999",1268:"999 9999",1264:"999 9999",355:"999 999 999",374:"99 999 999",599:"999 9999",244:"999 999 999",672:"9 99 999",54:"999 999 9999",1684:"999 9999",43:"999 999 9999",61:"9 9999 9999",297:"999 9999",994:"99 999 99 99",387:"99 999 999",1246:"999 9999",880:"99 999 999",32:"999 999 999",226:"99 99 9999",359:"999 999 999",973:"9999 9999",257:"99 99 9999",229:"99 99 9999",1441:"999 9999",673:"999 9999",591:"9 999 9999",55:"99 99999 9999",1242:"999 9999",975:"99 999 999",267:"99 999 999",375:"99 999 99 99",501:"999 9999",243:"999 999 999",236:"99 99 9999",242:"99 999 9999",41:"99 999 9999",225:"99 999 999",682:"99 999",56:"9 9999 9999",237:"9999 9999",86:"999 9999 9999",57:"999 999 9999",506:"9999 9999",53:"9 999 9999",238:"999 99 99",357:"99 999 999",420:"999 999 999",49:"9999 999 9999",253:"99 99 99 99",45:"99 99 99 99",1767:"999 9999",1809:"999 9999",1829:"999 9999",1849:"999 9999",213:"99 999 9999",593:"99 999 9999",372:"9999 9999",20:"999 999 9999",291:"9 999 999",34:"999 999 999",251:"99 999 9999",358:"999 999 99 99",679:"99 99999",500:"99999",691:"999 9999",298:"999 999",262:"99999 9999",33:"999 999 999",508:"99 9999",590:"999 999 999",241:"9 99 99 99",1473:"999 9999",995:"999 999 999",594:"99999 9999",233:"999 999 999",350:"999 99999",299:"99 99 99",220:"999 99 99",224:"99 999 999",240:"99 999 9999",30:"999 999 9999",502:"9 999 9999",1671:"999 9999",245:"9 999999",592:"999 9999",852:"9999 9999",504:"9999 9999",385:"99 999 999",509:"99 99 9999",36:"999 999 999",628:"99 999 9999",62:"99 999 99",353:"999 999 999",972:"99 999 9999",91:"9999 999 999",246:"999 9999",964:"999 999 9999",98:"999 999 9999",354:"999 9999",39:"999 9999 999",1876:"999 9999",962:"9 9999 9999",81:"99 9999 9999",254:"999 999999",996:"999 999 999",855:"99 999 999",686:"99 999",269:"99 99999",1869:"999 9999",850:"999 999 9999",82:"99 999 9999",965:"9999 9999",1345:"999 9999",76:"99 999 99 99",77:"99 999 99 99",856:"99 99 999 999",961:"99 999 999",1758:"999 9999",423:"999 999 9999",94:"99 999 9999",231:"99 999 999",266:"9 999 9999",370:"999 99 999",352:"999 999 999",371:"99 999 999",218:"99 999 9999",212:"99 9999 999",377:"9999 9999",373:"9999 9999",382:"99 999 999",261:"99 99 99999",692:"999 9999",389:"99 999 999",223:"99 99 9999",95:"99 999 999",976:"99 99 9999",853:"9999 9999",1670:"999 9999",596:"999 99 99 99",222:"99 99 9999",1664:"999 9999",356:"9999 9999",230:"999 9999",960:"999 9999",265:"99 999 9999",52:"999 999 9999",60:"99 999 9999",258:"99 999 999",264:"99 999 9999",687:"99 9999",227:"99 99 9999",234:"999 999 9999",505:"9999 9999",31:"99 999 9999",47:"999 99 999",977:"99 999 999",674:"999 9999",683:"9999",64:"999 999 999",968:"99 999 999",507:"999 9999",51:"999 999 999",689:"99 99 99",675:"999 99 999",63:"999 999 9999",92:"999 999 9999",48:"999 999 999",970:"99 999 9999",351:"99 999 9999",680:"999 9999",595:"999 999 999",974:"9999 9999",40:"99 999 9999",381:"99 999 9999",7:"999 999 99 99",250:"999 999 999",966:"99 999 9999",677:"999 9999",248:"9 999 999",249:"99 999 9999",46:"99 999 9999",65:"9999 9999",290:"99 999",386:"99 999 999",421:"999 999 999",232:"99 999999",378:"9999 999999",221:"99 999 9999",252:"99 999 999",597:"999 9999",211:"99 999 9999",239:"99 99999",503:"99 99 9999",1721:"999 9999",963:"99 9999 999",268:"99 99 9999",1649:"999 9999",235:"99 99 99 99",228:"99 999 999",66:"99 999 9999",992:"99 999 9999",690:"9999",670:"999 9999",993:"9 999 9999",216:"99 999 999",676:"99999",90:"999 999 9999",1868:"999 9999",688:"99 9999",886:"999 999 999",255:"99 999 9999",380:"99 999 99 99",256:"999 999 999",44:"99 9999 9999",598:"9 999 99 99",998:"99 999 9999",396:"999 99999",1784:"999 9999",58:"999 999 9999",1284:"999 9999",1340:"999 9999",84:"99 9999 999",678:"99 99999",681:"99 9999",685:"99 9999",967:"999 999 999",27:"99 999 9999",260:"99 999 9999",263:"9 999999",1:"999 999 9999",383:"9999 9999"};class Uc{static isEmailValid(e){return/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(e)}static isTelephoneValid(e,t){return e?e.replace(/\s/g,"").length===t.length&&t.length>0:/^\d+$/.test(t)}}const Vc=e=>{switch(e){case"":default:return"text";case"tel":return"tel";case"email":return"email"}},Gc=e=>{const[t,i]=(0,wo.useState)({countryCode:"",phone:""}),[r,n]=(0,wo.useState)(""),[s,o]=(0,wo.useState)(!0),a=i=>{var r;const n=Vc(null!==(r=null==e?void 0:e.configV2.main.input.type)&&void 0!==r?r:"");return"email"===n?Uc.isEmailValid(i):"tel"!==n||Uc.isTelephoneValid((()=>{var e;const i=t.countryCode.substring(1);return i&&null!==(e=Bc[i])&&void 0!==e?e:""})(),t.phone)};return{value:r,telephone:t,isValid:s,handleTelephoneChange:e=>{i(e),e.phone.length>0?n(e.countryCode+e.phone):n("")},handleChange:e=>{n(e.trim())},handleSubmit:e=>{const t=a(r);o(t),t&&e({value:r})},reset:()=>{o(!0),n(""),i({countryCode:"",phone:""})}}};var zc=p(2372),Wc={insert:"head",singleton:!1};Ko()(zc.A,Wc);const $c=zc.A.locals||{},qc=(0,wo.forwardRef)(((e,t)=>{const i=(0,wo.useRef)(null);return(0,wo.useEffect)((()=>{var e;null===(e=i.current)||void 0===e||e.focus()}),[]),Ho("input",{type:"email",className:Xo()($c.input,$c.input_centered),placeholder:e.placeholder,value:e.value,ref:i,onChange:t=>e.onChange(t.target.value)})}));var Hc=p(2265),Zc=p.n(Hc);const Qc=(0,wo.forwardRef)(((e,t)=>{const i=(0,wo.useRef)(null),r=(0,wo.useRef)(null),n=t=>{const i=t.target;i&&(i.value=i.value.replace(/\D/g,""),e.onChange({countryCode:e.value.countryCode,phone:i.value}))};(0,wo.useEffect)((()=>{(()=>{let t=i.current;e.value.countryCode.length&&(t=r.current),null==t||t.focus()})()}),[]);const s=e.value.countryCode.substring(1),o=s?Bc[s]:"";return Zo("div",{className:$c["input-group"],children:[Zo("div",{className:$c["input-group__prepend"],children:[Ho(Zc(),{type:"tel",mask:"+999",maskChar:null,className:$c.input,onChange:t=>{e.onChange({countryCode:t.currentTarget.value,phone:e.value.phone})},value:e.value.countryCode,placeholder:"+",inputRef:i}),Ho("div",{className:$c["input-group__separator"]})]}),o?Ho(Zc(),{type:"tel",className:$c.input,mask:o,maskChar:"-",alwaysShowMask:!0,placeholder:e.placeholder,inputRef:r,value:e.value.phone,onChange:n}):Ho("input",{type:"tel",className:$c.input,placeholder:e.placeholder,ref:r,value:e.value.phone,onChange:n})]})})),Xc=(0,wo.forwardRef)(((e,t)=>{const i=(0,wo.useRef)(null),r=(0,wo.useRef)(null);(0,wo.useEffect)((()=>{var t;r.current.dataset.replicatedValue=e.value,null===(t=i.current)||void 0===t||t.focus()}),[]);return Ho("div",{className:$c["textarea-grow-wrap"],ref:r,style:e.style,children:Ho("textarea",{className:$c.input,placeholder:e.placeholder,rows:1,ref:i,maxLength:e.maxLength,value:e.value,onChange:t=>e.onChange(t.target.value),onInput:e=>{r.current.dataset.replicatedValue=e.currentTarget.value}})})}));var Yc=function(e,t){var i={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(i[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(r=Object.getOwnPropertySymbols(e);n<r.length;n++)t.indexOf(r[n])<0&&Object.prototype.propertyIsEnumerable.call(e,r[n])&&(i[r[n]]=e[r[n]])}return i};const Kc=e=>{var{form:t,config:i}=e,r=Yc(e,["form","config"]);const[n,s]=(0,wo.useState)(!0),{getMainStyle:o,getMainElementsStyle:a,getQuestionStyle:l,getInputWrapperStyle:d,getButtonStyle:c,getTextareaStyle:u}=(({config:e})=>{const t=t=>t*(e.size.viewportWidth/(e.size.viewportWidth/e.size.fontSize));return{getMainStyle:()=>{const i=e.configV2.main;return{width:`${e.size.absolute.width}px`,height:"auto",left:e.size.absolute.center.x-e.size.absolute.width/2-e.size.slideOffsetX+"px",top:e.size.absolute.center.y-e.size.absolute.height/2-e.size.slideOffsetY+"px",backgroundColor:`${i.background.color}`,border:`${i.border.visible&&`${t(i.border.width)}px solid ${i.border.color}`}`,borderRadius:`${t(i.border.radius)}px`}},getMainElementsStyle:()=>{const i=e.configV2.main;return{width:"100%",padding:`${t(i.padding.top)}px ${t(i.padding.right)}px ${t(i.padding.bottom)}px ${t(i.padding.left)}px`}},getQuestionStyle:()=>{const i=e.configV2.main.question;return{padding:`${t(i.padding.top)}px ${t(i.padding.right)}px ${t(i.padding.bottom)}px ${t(i.padding.left)}px`,color:`${i.text.color}`,fontSize:`${t(i.text.size)}px`,lineHeight:`${i.text.lineHeight}`,textAlign:`${i.text.align}`,fontFamily:`${i.text.type}`,fontWeight:`${i.text.weight}`,fontStyle:`${i.text.style}`}},getInputWrapperStyle:()=>{const i=e.configV2.main.input;let r=e.configV2.main.input.text.maxLines;return r=r>0?r:1,{padding:`${t(i.padding.top)}px ${t(i.padding.right)}px ${t(i.padding.bottom)}px ${t(i.padding.left)}px`,backgroundColor:`${i.background.color}`,border:`${t(i.border.width)}px solid ${i.border.color}`,borderRadius:`${t(i.border.radius)}px`,lineHeight:`${i.text.lineHeight}`,maxHeight:i.text.lineHeight*r+"em",fontSize:`${t(i.text.size)}px`,overflowY:"scroll",scrollbarWidth:"none"}},getButtonStyle:()=>{const i=e.configV2.main.button;return{padding:`${t(i.padding.top)}px ${t(i.padding.right)}px ${t(i.padding.bottom)}px ${t(i.padding.left)}px`,backgroundColor:`${i.background.color}`,border:`${t(i.border.width)}px solid ${i.border.color}`,color:`${i.text.color}`,fontSize:`${t(i.text.size)}px`,lineHeight:`${i.text.lineHeight}`,textAlign:`${i.text.align}`,fontFamily:`${i.text.type}`,fontWeight:`${i.text.weight}`,fontStyle:`${i.text.style}`}},getTextareaStyle:()=>{const i=e.configV2.main.input;return{color:`${i.text.color}`,fontSize:`${t(i.text.size)}px`,lineHeight:`${i.text.lineHeight}`,textAlign:`${i.text.align}`,fontFamily:`${i.text.type}`,fontWeight:`${i.text.weight}`,fontStyle:`${i.text.style}`}}}})({config:i}),h=Math.max(i.configV2.main.input.text.limit,0),p=String(i.configV2.main.input.text.placeholder).trim(),f=String(i.configV2.main.button.text.value).trim(),g=String(i.configV2.main.question.text.value).trim(),v=Vc(i.configV2.main.input.type),m=({value:e})=>{r.onComplete({result:!0,value:e}),s(!1)};return Zo("div",{className:$c.wrapper,children:[Ho("div",{className:Xo()($c.backdrop,{[$c.fadeIn]:n,[$c.fadeOut]:!n}),onAnimationEnd:()=>{n||r.onClose()},onClick:()=>{r.onComplete({result:!1,value:t.value}),s(!1)}}),Zo("div",{className:$c.main,style:o(),children:[Zo("div",{className:$c["main-elements"],style:a(),children:[Ho("div",{className:$c.question,style:l(),children:g}),Zo("div",{className:Xo()($c["input-wrapper"],{[$c["is-invalid"]]:!t.isValid}),style:d(),children:["text"===v&&Ho(Xc,{value:t.value,onChange:t.handleChange,style:u(),placeholder:p,maxLength:h}),"email"===v&&Ho(qc,{value:t.value,onChange:t.handleChange,placeholder:p}),"tel"===v&&Ho(Qc,{value:t.telephone,onChange:t.handleTelephoneChange,placeholder:p})]})]}),t.value.trim().length>0&&Ho("div",{className:$c["button-wrapper"],children:Ho("button",{className:$c.button,style:c(),onClick:()=>t.handleSubmit(m),children:f})})]})]})},Jc=({slideGeometry:e,widgetManager:t,storyRef:i})=>{const[r,n]=(0,wo.useState)(null),[s,o]=(0,wo.useState)(null),a=Gc(s);(0,wo.useEffect)((()=>(wr.on("storySlide.showInputModal",l),()=>{wr.off("storySlide.showInputModal",l)})),[]);const l=({id:t,config:r})=>{Wr(),Fr(),n(t),(t=>{t.size.fontSize=parseFloat(e.getFontSize()),t.size.viewportWidth=e.calculateWidth();const r=i.current.getBoundingClientRect();t.size.slideOffsetX=r.x,t.size.slideOffsetY=r.y,t.size.slideHeight=r.height,o(t)})(r)};return(0,wo.useLayoutEffect)((()=>()=>{a.reset()}),[r]),s?Ho(Kc,{form:a,config:s,onComplete:e=>{if(!r)throw new Error;((e,i)=>{var r,n,s;null===(r=null==t?void 0:t.findWidgetByType(bn.name))||void 0===r||r.setUserData(e,i),null===(n=null==t?void 0:t.findWidgetByType(kn.name))||void 0===n||n.setUserData(e,i),null===(s=null==t?void 0:t.findWidgetByType(Fn.name))||void 0===s||s.setUserData(e,i)})(r,e.result?e.value:""),$r()},onClose:()=>{o(null),Nr()}}):null};var eu=function(e,t){var i={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(i[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(r=Object.getOwnPropertySymbols(e);n<r.length;n++)t.indexOf(r[n])<0&&Object.prototype.propertyIsEnumerable.call(e,r[n])&&(i[r[n]]=e[r[n]])}return i};const tu=e=>{var{story:t,slideGeometry:i,className:r}=e,n=eu(e,["story","slideGeometry","className"]);const s=(0,wo.useRef)(null),[o,a]=(0,wo.useState)(null),l=jl(Yn),d=(0,wo.useRef)(null);ja(t);const c=n.index===n.nextFlippingStoryIndex,u=t===n.activeStory&&-1===n.nextFlippingStoryIndex,{timer:h}=(({story:e,progressBarRef:t,activeStory:i})=>{const r=jl(Mr),n=(0,wo.useRef)(new Va).current;return(0,wo.useEffect)((()=>{const i=e=>{var i;null===(i=t.current)||void 0===i||i.style.setProperty("--tick",e+"%")},r=({forceEnd:t})=>{t||(e.reachEnd?wr.emit(`${ps.name}.showNextStory`,{action:"auto"}):e.nextSlide())},s=()=>{var e;null===(e=t.current)||void 0===e||e.style.setProperty("--tick","0%")};return n.on("start",s),n.on("stop",s),n.on("progress",i),n.on("complete",r),()=>{n.off("start",s),n.off("progress",i),n.off("complete",r),n.off("stop",s)}}),[e]),(0,wo.useEffect)((()=>{r?n.pause():n.resume()}),[r]),{timer:n}})({activeStory:n.activeStory,story:t,progressBarRef:d});(({timer:e,story:t,needSubscription:i})=>{const r=i=>{i?e.start(i):t.nextSlide()},n=()=>{e.start(t.activeSlideDuration)};(0,wo.useLayoutEffect)((()=>{if(i)return wr.on("story.showNextSlideWithDelay",r),wr.on("story.showLayerByIndex",n),()=>{wr.off("story.showNextSlideWithDelay",r),wr.off("story.showLayerByIndex",n)}}),[t,i])})({timer:h,story:t,needSubscription:u||c}),(0,wo.useEffect)((()=>{u||h.stop()}),[u]),(0,wo.useEffect)((()=>()=>{h.stop()}),[t.activeSlideIndex]);const p=e=>{a(e.widgetManager),ts({currentSlideIndex:e.index,currentStoryId:n.activeStory.id});const i=t.slidesDuration[t.activeSlideIndex];h.started||h.start(i)};return Zo("div",{ref:s,className:Xo()(Yl["stories-item"],Yl.slider3d__item,r),style:n.style,children:[Ho(od,{closeDisabled:t.disableClose,options:n.storyReaderOptions,onClose:n.onClose}),Ho(ec,{ref:d,hiddenTimeline:t.hiddenTimeline||!t.slidesLoaded,slidesLength:t.slidesCount,activeSlide:t.activeSlideIndex}),t.slides.map(((e,r)=>Ho(Xd,{clickDisabled:n.slideClickDisabled,onSlideStarted:p,needBottomPanel:t.needBottomPanel,activeSlideIndex:t.activeSlideIndex,currentSlideIndex:r,needSlideInit:c,activeStory:n.activeStory,currentStoryId:t.id,geometry:i,slideHtml:e,slidesLoaded:t.slidesLoaded,slideApi:n.slideApi},e))),Ho(id,{story:t,options:n.storyReaderOptions}),l.isOpened&&n.activeStory===t&&Ho(jc,{url:l.url,story:t,elementId:l.elementId,goodsWidgetOptions:n.goodsWidgetOptions,onClose:()=>{var e;null===(e=null==o?void 0:o.findWidgetByType(xs.name))||void 0===e||e.close()}}),n.activeStory===t&&Ho(Jc,{storyRef:s,slideGeometry:i,widgetManager:o})]})},iu=({className:e,style:t})=>Ho("div",{className:Xo()(Yl["stories-item"],e),style:t,children:Ho("div",{className:`${dd["stories-slide"]} ${dd._dummy}`})});var ru=p(827),nu={insert:"head",singleton:!1};Ko()(ru.A,nu);const su=ru.A.locals||{};var ou=function(e,t){var i={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(i[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(r=Object.getOwnPropertySymbols(e);n<r.length;n++)t.indexOf(r[n])<0&&Object.prototype.propertyIsEnumerable.call(e,r[n])&&(i[r[n]]=e[r[n]])}return i};const au=e=>{var{width:t,navigationOptions:i,onNext:r,onPrev:n}=e,s=ou(e,["width","navigationOptions","onNext","onPrev"]);const{desktopMode:o}=Lu(),[a,l]=jl([Lr,pn]),d=a||l;return Zo("div",{className:Xo()({[su._desktop_mode]:o}),children:[Ho("div",{className:su.slider3d__btn_next,style:{transform:`translateY(-50%) translateX(calc(${t/2}px + 100%))`},children:Ho("button",{className:su["btn-icon"],onClick:e=>{e.stopPropagation(),e.preventDefault(),r()},disabled:s.isNextStoryBlank||d,dangerouslySetInnerHTML:{__html:i.nextButton.svgSrc.baseState}})}),Ho("div",{className:su.slider3d__btn_prev,style:{transform:`translateY(-50%) translateX(calc(-${t/2}px - 200%))`},children:Ho("button",{className:su["btn-icon"],onClick:e=>{e.stopPropagation(),e.preventDefault(),n()},disabled:s.isPrevStoryBlank||d,dangerouslySetInnerHTML:{__html:i.prevButton.svgSrc.baseState}})})]})},lu=350,du=1,cu="linear",uu=1.6,hu=(Math.tan(.375*Math.PI),du);class pu extends U.EventEmitter{constructor(){super(),this._rotating=!1,this._currentAngle=0,this.sliderWidth=0,this.transformStyle=te.SWIPE_FLAT,this.perspective=0,this.angle=0,this.depth=0,this.rotationTransform="",this.rotationTransition="",this.newAngle=0,this.angleDelta=0,this.deltaVal=0,this.startAt=0,this.sliderS=0,this.onTransitionEnd=this.onTransitionEnd.bind(this)}get rotating(){return this._rotating}get prevStoryBlank(){return this.rotater.children.item(0)===this.leftSlideEl}get nextStoryBlank(){const e=this.rotater.children.length-1;return this.rotater.children.item(e)===this.rightSlideEl}setTransformStyle(){}init3DSlider({rotater:e,innerSlider:t,transformStyle:i}){this.rotater=e,this._innerSlider=t,this.transformStyle=i,e.addEventListener("transitionend",this.onTransitionEnd,!1);let r=this._innerSlider.clientWidth;r>0&&(this.sliderWidth=r),!this._innerSlider.clientWidth&&this.sliderWidth&&(r=this.sliderWidth),this.angle=45,this.transformStyle===te.SWIPE_CUBE&&(this.perspective=r*uu,this.depth=r/2/Math.tan(this.angle/2*Math.PI/180))}getStoryStyle(e,t){return{display:Math.abs(e-t)<=1?"block":"none",transition:"flat"===this.transformStyle||"cover"===this.transformStyle?"inherit":"",transform:"flat"===this.transformStyle?`translateZ(0) translateX(${-100*t+100*e}%)`:"cover"===this.transformStyle?`translateZ(0) translateX(${0===e?-10:-100*t+100*e}%) scale(${0===e?.9:1})`:"rotateY("+e*this.angle+`deg) translateZ(${this.depth}px)`}}destroy(){this.rotater.removeEventListener("transitionend",this.onTransitionEnd,!1)}updateRotater({touchmove:e}={touchmove:!1}){const t=this.rotater;null!=t&&(t.style.setProperty("transition",this.rotationTransition),t.style.setProperty("transform",this.rotationTransform))}refreshSlidesLinks(){this.leftSlideEl=this.rotater.querySelector("._transform_left"),this.centralSlideEl=this.rotater.querySelector("._transform_front"),this.rightSlideEl=this.rotater.querySelector("._transform_right")}storiesItemClass({id:e,index:t,currentIndex:i}){return{_active:!0,_transform_front:t===i,_transform_left:t+1===i,_transform_right:t-1===i}}rotateSlider(e,t=!1){t&&(this._currentAngle=0),this._rotating=!0,Fr();const i=this._currentAngle+e*this.angle,r=-1*i,n=lu/1e3;return this.transformStyle===te.SWIPE_CUBE&&(this.rotationTransform=`rotateY(${r}deg)`),this._currentAngle=i,t?(this.rotationTransition="transform 0s",this.updateRotater(),this._rotating=!1,Nr(),Promise.resolve(e)):new Promise(((t,i)=>{let r=({propertyName:i,elapsedTime:s})=>{Re(`transitionend:rotater elapsedTime: ${s} transitionTime: ${n} propertyName: ${i}`),Math.round(100*s)/100===n&&"transform"===i&&(this.rotationTransition="transform 0s",this.updateRotater(),this._rotating=!1,Nr(),Re(`release this._rotating is: ${this._rotating}`),t(e),this.off("transitionend:rotater",r))};this.on("transitionend:rotater",r),this.rotationTransition=`transform ${n}s ${cu}`,this.updateRotater()}))}rotateSliderFlat(e,t=!1){this._rotating=!0,Fr();let i="",r="",n="";if(0===e?(n="translateZ(0) translateX(-100%)",i="translateZ(0) translateX(0%)",r="translateZ(0) translateX(100%)"):e>0?(n="translateZ(0) translateX(-200%)",i="translateZ(0) translateX(-100%)",r="translateZ(0) translateX(0%)"):(i="translateZ(0) translateX(100%)",n="translateZ(0) translateX(0%)",r="translateZ(0) translateX(200%)"),t)return this.rotationTransition="transform 0s",this.updateRotater(),this.applyTransformToElements({leftStoriesTransform:n,rightStoriesTransform:r,centralStoriesTransform:i}),this._rotating=!1,Nr(),Promise.resolve(e);const s=lu/1e3;return new Promise(((t,o)=>{let a=({propertyName:i,elapsedTime:r})=>{Math.round(100*r)/100===s&&"transform"===i&&(this.rotationTransition="transform 0s",this.updateRotater(),this._rotating=!1,Nr(),this.off("transitionend:rotater",a),t(e))};this.on("transitionend:rotater",a),this.rotationTransition=`transform ${s}s ${cu}`,this.updateRotater(),this.applyTransformToElements({leftStoriesTransform:n,rightStoriesTransform:r,centralStoriesTransform:i})}))}rotateSliderCover(e,t=!1){this._rotating=!0,Fr();let i="",r="",n="";if(0===e?(n="translateZ(0) translateX(-10%) scale(.9)",i="translateZ(0) translateX(0%) scale(1)",r="translateZ(0) translateX(100%) scale(1)"):e>0?(n="translateZ(0) translateX(-20%) scale(.8)",i="translateZ(0) translateX(-10%) scale(.9)",r="translateZ(0) translateX(0%) scale(1)"):(i="translateZ(0) translateX(100%) scale(1)",n="translateZ(0) translateX(0%) scale(1)",r="translateZ(0) translateX(200%)"),t)return this.rotationTransition="transform 0s",this.updateRotater(),this.applyTransformToElements({leftStoriesTransform:n,rightStoriesTransform:r,centralStoriesTransform:i}),this._rotating=!1,Nr(),Promise.resolve(e);const s=lu/1e3;return new Promise(((t,o)=>{let a=({propertyName:i,elapsedTime:r})=>{Math.round(100*r)/100===s&&"transform"===i&&(this.rotationTransition="transform 0s",this.updateRotater(),this._rotating=!1,Nr(),this.off("transitionend:rotater",a),t(e))};this.on("transitionend:rotater",a),this.rotationTransition=`transform ${s}s ${cu}`,this.updateRotater(),this.applyTransformToElements({leftStoriesTransform:n,rightStoriesTransform:r,centralStoriesTransform:i})}))}rotateTo(e){let t="",i="",r="";this.transformStyle===te.SWIPE_FLAT?(r=`translateZ(0) translateX(${-100*(1+e)}%)`,t=`translateZ(0) translateX(${-100*e}%)`,i=`translateZ(0) translateX(${100*(1-e)}%)`,this.applyTransformToElements({leftStoriesTransform:r,rightStoriesTransform:i,centralStoriesTransform:t})):this.transformStyle===te.SWIPE_COVER?(r=`translateZ(0) translateX(${-100*(.1- -1*e/10)}%) scale(${Math.min(.9+-1*e/10,1)})`,t=`translateZ(0) translateX(${e<=0?-100*e:-100*(0- -1*e/10)}%) scale(${e<=0?1:1+-1*e/10})`,i=`translateZ(0) translateX(${100*(1-e)}%) scale(1)`,this.applyTransformToElements({leftStoriesTransform:r,rightStoriesTransform:i,centralStoriesTransform:t})):this.rotationTransform=`rotateY(${e}deg)`,this.updateRotater({touchmove:!0})}applyTransformToElements({leftStoriesTransform:e,rightStoriesTransform:t,centralStoriesTransform:i}){var r,n,s;null===(r=this.centralSlideEl)||void 0===r||r.style.setProperty("transform",i),null===(n=this.rightSlideEl)||void 0===n||n.style.setProperty("transform",t),null===(s=this.leftSlideEl)||void 0===s||s.style.setProperty("transform",e)}navigateSlider(e){return this.transformStyle===te.SWIPE_FLAT?this.rotateSliderFlat(e):this.transformStyle===te.SWIPE_COVER?this.rotateSliderCover(e):this.rotateSlider(e)}startMove(){var e,t;this.newAngle=0,this.angleDelta=0,this.deltaVal=0,this.startAt=Date.now(),this.sliderS=null!==(t=null===(e=this._innerSlider)||void 0===e?void 0:e.clientWidth)&&void 0!==t?t:0}move(e){this._rotating=!0,Fr(),this.deltaVal=e/this.sliderS*hu,this.newAngle=this._currentAngle+this.deltaVal*this.angle,this.angleDelta=this.newAngle-this._currentAngle;let t=this.deltaVal;if(this.transformStyle===te.SWIPE_FLAT||this.transformStyle===te.SWIPE_COVER)(this.nextStoryBlank||this.prevStoryBlank)&&(this.deltaVal>=.05&&this.nextStoryBlank?this.deltaVal=.05:this.deltaVal<=-.05&&this.prevStoryBlank&&(this.deltaVal=-.05),t=this.deltaVal);else{(this.nextStoryBlank||this.prevStoryBlank)&&(this.angleDelta>=5&&this.nextStoryBlank?this.newAngle=this._currentAngle+5:this.angleDelta<=-5&&this.prevStoryBlank&&(this.newAngle=this._currentAngle-5));t=-1*this.newAngle}this.rotateTo(t)}endMove(){if(!this.deltaVal)return;this._rotating=!1;const e=Date.now();let t=Math.round(this.angleDelta/this.angle);e-this.startAt<=500&&0===t&&(t=this.deltaVal<0?-1:1),(t<0&&this.prevStoryBlank||t>0&&this.nextStoryBlank)&&(t=0),0===t?this.navigateSlider(0).then((()=>Vr())):this.emit("swipeEnd",t)}onTransitionEnd(e){this.emit("transitionend:rotater",{propertyName:e.propertyName,elapsedTime:e.elapsedTime})}}var fu=function(e,t,i,r){return new(i||(i=Promise))((function(n,s){function o(e){try{l(r.next(e))}catch(e){s(e)}}function a(e){try{l(r.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,a)}l((r=r.apply(e,t||[])).next())}))};const gu=({storyReaderViewModel:e,storyNavigation:t})=>{const i=(0,wo.useRef)(null),r=(0,wo.useRef)(null),n=(0,wo.useRef)(null),s=(0,wo.useRef)(new pu).current;(({rotationSliderEngine:e})=>{const t=()=>{e.startMove()},i=({startX:t,x:i,lockX:r})=>{if(r)return;const n=t-i;e.move(n)},r=({lockX:t})=>{t||e.endMove()};(0,wo.useEffect)((()=>(wr.on("swipeController.startMove",t),wr.on("swipeController.move",i),wr.on("swipeController.endMove",r),()=>{wr.off("swipeController.startMove",t),wr.off("swipeController.move",i),wr.off("swipeController.endMove",r)})),[])})({rotationSliderEngine:s});const o=e.options.scrollStyle,a=e.stories,l=e.currentIndex;(0,wo.useEffect)((()=>{const e=()=>{s.init3DSlider({rotater:r.current,innerSlider:i.current,transformStyle:o})};return e(),window.addEventListener("resize",e),()=>{s.destroy(),window.removeEventListener("resize",e)}}),[o]),(0,wo.useEffect)((()=>{s.refreshSlidesLinks()}),[l]),(0,wo.useEffect)((()=>{s.rotateSlider(l,!0)}),[a.length,o]),(0,wo.useEffect)((()=>{d(t.nextFlippingStoryIndex)}),[t.nextFlippingStoryIndex]),(0,wo.useEffect)((()=>(s.on("swipeEnd",t.handleSwipeEnd),()=>{s.off("swipeEnd",t.handleSwipeEnd)})),[]);const d=e=>fu(void 0,void 0,void 0,(function*(){if(-1===e)return;const i=l<e?1:-1;yield s.navigateSlider(i),t.handleStoryFlippingTransitionEnd()}));return{innerSliderRef:i,rotaterRef:r,slider3dInnerRef:n,engine:s,getStoryClassName:(e,t)=>Xo()(s.storiesItemClass({id:e.id,index:t,currentIndex:l})),getStoryStyle:e=>s.getStoryStyle(e,l)}},vu=e=>{const[t,i]=(0,wo.useState)("lastSlideClick"),[r,n]=(0,wo.useState)(-1);(0,wo.useEffect)((()=>(wr.on(`${ps.name}.showNextStory`,a),wr.on(`${ps.name}.showPrevStory`,l),()=>{wr.off(`${ps.name}.showNextStory`,a),wr.off(`${ps.name}.showPrevStory`,l)})),[]);const s=t=>{wr.emit("publicEvents.closeStory",{id:e.activeStory.id,index:e.activeStory.activeSlideIndex,action:t})},o=(t,r="lastSlideClick")=>{i(r),n(t),e.setNarrativeStory(e.getDisplayedStoryByIndex(t))},a=t=>{const i=null==t?void 0:t.action;e.reachEnd?(t=>{"auto"!==t?(s("closeStoryByScrolling"),e.close("lastSlideClick")):e.options.closeOnLastSlideByTimer&&(s("closeStoryByScrolling"),e.close("auto"))})(i):o(e.currentIndex+1,i)},l=t=>{e.reachStart||o(e.currentIndex-1,null==t?void 0:t.action)};return{nextFlippingStoryIndex:r,nextStory:a,prevStory:l,handleStoryFlippingTransitionEnd:()=>{"swipe"===t&&Vr(),s(t);1===(e.currentIndex<r?1:-1)?e.nextStory():e.prevStory(),n(-1)},handleSwipeEnd:t=>{o(e.currentIndex+t,"swipe")}}},mu=e=>{const{desktopMode:t}=Lu(),i=vu(e.storyReaderViewModel),[r,n]=jl([Lr,Ir]),{isOpened:s,sharePanelOpeningParams:o,handleShareComplete:a}=(()=>{const{isOpened:e,id:t,type:i,link:r}=jl(hn);return{isOpened:e,sharePanelOpeningParams:{shareId:t,shareType:i,shareLink:r},handleShareComplete:e=>{Hr(),wr.emit(`${Bn.name}.shareComplete`,{shareId:t,result:e}),gn()},closeSharePanel:()=>{Hr(),gn()}}})(),l=gu({storyReaderViewModel:e.storyReaderViewModel,storyNavigation:i}),d=e.storyReaderViewModel.options,c=td(e.storyReaderViewModel.options.actionPanelBottomOffset),u=e.storyReaderViewModel.activeStory,h=i=>new Us(e.viewport.vw,e.viewport.vh,c,i.needBottomPanel,t),p=(0,wo.useMemo)((()=>h(u)),[u,e.viewport]);return Zo(qo,{children:[Zo("div",{className:Xo()(Zl.slider3d__wrapper,{[Zl["slider3d__wrapper_swipe-up"]]:n,[Zl._desktop_mode]:t}),style:Object.assign({WebkitPerspective:`${l.engine.perspective}px`,perspective:`${l.engine.perspective}px`,width:p.getWidth(),backgroundColor:p.shouldBeShownSafeAreaInsets&&"#000"},p.getViewportCorrectionPadding()),ref:l.innerSliderRef,children:[Ho("div",{className:Zl.slider3d__inner,style:{transform:`translateZ(-${l.engine.depth}px)`},ref:l.slider3dInnerRef,children:Ho("div",{className:Xo()(Zl["stories-face"],Zl.slider3d__rotater),ref:l.rotaterRef,children:e.storyReaderViewModel.stories.map(((t,n)=>t.isBlank?Ho(iu,{className:l.getStoryClassName(t,n),style:Object.assign(Object.assign({},l.getStoryStyle(n)),{bottom:0})},t.id):Ho(tu,{slideClickDisabled:r||l.engine.rotating,index:n,story:t,activeStory:u,nextFlippingStoryIndex:i.nextFlippingStoryIndex,slideGeometry:h(t),className:l.getStoryClassName(t,n),style:Object.assign(Object.assign({},l.getStoryStyle(n)),{bottom:t.needBottomPanel?`${c}px`:0}),storyReaderOptions:d,goodsWidgetOptions:e.storyReaderViewModel.goodsWidgetOptions,onClose:e.onCloseStory,slideApi:e.slideApi},t.id)))})}),s&&Ho(Ta,{className:Zl["share-panel-wrapper"],shareType:o.shareType,shareLink:o.shareLink,onShareCompelete:a,sharePanelOptions:d.sharePanel})]}),Ho(au,{isNextStoryBlank:e.storyReaderViewModel.reachEnd,isPrevStoryBlank:e.storyReaderViewModel.reachStart,navigationOptions:d.navigation,width:parseFloat(p.getWidth()),onNext:i.nextStory,onPrev:i.prevStory})]})},yu=(function(){if(window){var e,t=window.screen;e="function"==typeof window.ScreenOrientation&&t.orientation instanceof ScreenOrientation&&"function"==typeof t.orientation.addEventListener&&null===t.orientation.onchange&&"string"==typeof t.orientation.type?t.orientation:function(){var e={90:ao.LANDSCAPE_PRIMARY,"-90":ao.LANDSCAPE_SECONDARY,0:ao.PORTRAIT_PRIMARY,180:ao.PORTRAIT_SECONDARY};function t(){}var i=new t,r=function(e){for(var t=["orientationchange","mozorientationchange","msorientationchange"],i=window.screen,r=0;r<t.length;r++)if(null===i["on"+t[r]])return{delegate:i,event:t[r]};if(void 0!==window.onorientationchange)return{delegate:window,event:"orientationchange"};return{delegate:fo(e),event:"change"}}(i);return t.prototype.addEventListener=lo("addEventListener",r.delegate,r.event),t.prototype.dispatchEvent=lo("dispatchEvent",r.delegate,r.event),t.prototype.removeEventListener=lo("removeEventListener",r.delegate,r.event),t.prototype.lock=function(){var e,t="lockOrientation() is not available on this device.",i=window.screen;e=void 0===i?function(){return!1}:"function"==typeof i.msLockOrientation?i.msLockOrientation.bind(i):"function"==typeof i.mozLockOrientation?i.mozLockOrientation.bind(i):function(){return!1};return function(i){const r=window.Promise;return e(i)?r.resolve(i):r.reject(new Error(t))}}(),t.prototype.unlock=function(){var e=window.screen;return e&&e.orientation&&e.orientation.unlock.bind(e.orientation)||e.msUnlockOrientation&&e.msUnlockOrientation.bind(e)||e.mozUnlockOrientation&&e.mozUnlockOrientation.bind(e)||function(){}}(),Object.defineProperties(i,{onchange:{get:function(){return r.delegate["on"+r.event]||null},set:function(e){r.delegate["on"+r.event]=ho(e,i)}},type:{get:function(){var t=window.screen;return t.msOrientation||t.mozOrientation||e[window.orientation+""]||(go().matches?"landscape-primary":"portrait-primary")}},angle:{value:0}}),i}()}}(),()=>{const e=oa();return{vh:aa(),vw:e}}),wu=Math.tan(.375*Math.PI),Su=!!(()=>{let e=!1;try{const t=Object.defineProperty({},"passive",{get:function(){e=!0}}),i=()=>{};window.addEventListener("test",i,t),window.removeEventListener("test",i)}catch(e){}return e})()&&{passive:!0};class bu extends U.EventEmitter{constructor(){super(),this.startValX=0,this.startValY=0,this.globalHorizontalSwipeGesture=!1,this.globalVerticalSwipeGesture=!1,this.enabled=!0,this.touchGestureRegistered=!1,this.handleMouseDown=this.handleMouseDown.bind(this),this.handleMouseMove=this.handleMouseMove.bind(this),this.handleMouseUp=this.handleMouseUp.bind(this),window.addEventListener("mousedown",this.handleMouseDown,!1),window.addEventListener("touchstart",this.handleMouseDown,Su)}enable(){this.enabled=!0}disable(){this.enabled=!1}handleMouseDown(e){Hn({result:!1}),this.enabled&&Tr.getState()&&(this.pauseMouseDownTimer(),this.initStartPoint(e),this.globalHorizontalSwipeGesture=!1,this.globalVerticalSwipeGesture=!1,wr.emit("swipeController.startMove"),this.registerMoveAndUpEvents())}pauseMouseDownTimer(){this.touchGestureTimerId=setTimeout((()=>{Ur(),this.touchGestureRegistered=!0}),200)}resumeMouseDownTimer(e){this.touchGestureRegistered?e.preventDefault():clearTimeout(this.touchGestureTimerId)}initStartPoint(e){this.startValX=e.pageX||e.touches&&e.touches[0].pageX,this.startValY=e.pageY||e.touches&&e.touches[0].pageY}handleMouseMove(e){let t=e.pageX||e.touches&&e.touches[0].pageX,i=e.pageY||e.touches&&e.touches[0].pageY,r=t-this.startValX,n=i-this.startValY,s=Math.abs(r/n),o=(Math.abs(n/r),!1),a=!1,l=!1;Math.abs(r)>0||Math.abs(n)>0?(o=!0,s<=wu&&(a=!0)):l=!0,a&&!this.globalHorizontalSwipeGesture?this.moveVertical(n):o&&!this.globalVerticalSwipeGesture&&this.moveHorizontal(t)}handleMouseUp(e){this.resumeMouseDownTimer(e),window.removeEventListener("mousemove",this.handleMouseMove),window.removeEventListener("touchmove",this.handleMouseMove,Su),window.removeEventListener("mouseup",this.handleMouseUp),window.removeEventListener("touchend",this.handleMouseUp),wr.emit("swipeController.beforeEndMove"),this.touchGestureRegistered=!1,this.globalHorizontalSwipeGesture||this.globalVerticalSwipeGesture?this.globalVerticalSwipeGesture?this.completeVerticalSwipe(e):this.completeHorizontalSwipe():Vr()}moveVertical(e){this.globalVerticalSwipeGesture=!0,wr.emit("swipeController.move",{startY:this.startValY,startX:this.startValX,y:e,x:0,lockY:!1,lockX:!0})}moveHorizontal(e){this.globalHorizontalSwipeGesture=!0,wr.emit("swipeController.move",{startY:this.startValY,startX:this.startValX,y:0,x:e,lockY:!0,lockX:!1})}completeVerticalSwipe(e){wr.emit("swipeController.endMove",{lockY:!1,lockX:!0}),this.globalVerticalSwipeGesture=!1}completeHorizontalSwipe(){wr.emit("swipeController.endMove",{lockY:!0,lockX:!1}),this.globalHorizontalSwipeGesture=!1}registerMoveAndUpEvents(){window.addEventListener("mousemove",this.handleMouseMove,!1),window.addEventListener("touchmove",this.handleMouseMove,Su),window.addEventListener("mouseup",this.handleMouseUp,!1),window.addEventListener("touchend",this.handleMouseUp,!1)}destroy(){window.removeEventListener("mousedown",this.handleMouseDown),window.removeEventListener("touchstart",this.handleMouseDown,Su)}}const _u=({storyReaderViewModel:e,desktopMode:t})=>{const i=(()=>{const[e,t]=(0,wo.useState)((()=>yu())),i=(0,wo.useCallback)((()=>{t(yu())}),[]);return(0,wo.useEffect)((()=>(window.addEventListener("resize",i),()=>{window.removeEventListener("resize",i)})),[]),e})();(()=>{const e=()=>{"hidden"===document.visibilityState&&Ur(),"visible"===document.visibilityState&&Vr()};(0,wo.useEffect)((()=>(document.addEventListener("visibilitychange",e),()=>{document.removeEventListener("visibilitychange",e)})),[])})(),(()=>{const{desktopMode:e}=Lu(),[t,i]=jl([pn,Tr]),r=(0,wo.useRef)();(0,wo.useEffect)((()=>(r.current=new bu,()=>{var e;null===(e=r.current)||void 0===e||e.destroy()})),[]),(0,wo.useEffect)((()=>{const n=r.current;n&&(e||t||!i?n.disable():n.enable())}),[e,t,i])})(),Ru((()=>{e.close("closeReaderByEscBtn")}));return Zo($l,{storyReaderViewModel:e,children:[Ho(mu,{viewport:i,storyReaderViewModel:e,slideApi:e.slideApi,onCloseStory:()=>{e.close()}}),Ho(ma,{orientation:di.PORTRAIT_PRIMARY,desktopMode:t,onOrientationChange:({isWrong:e})=>{e?Wr():$r()}})]})};var xu=p(763),Cu={insert:"head",singleton:!1};Ko()(xu.A,Cu);xu.A.locals;const ku=({storyManager:e,appearanceManager:t,desktopMode:i})=>{const[,r]=(0,wo.useState)(0),[n,s]=(0,wo.useState)(null),o=(()=>{const e=(0,wo.useRef)();return e.current||(e.current=(()=>{const e=getComputedStyle(document.documentElement),t=t=>parseFloat(e.getPropertyValue(t)),i=t("--ias-sat"),r=t("--ias-sab");return{left:t("--ias-sal"),right:t("--ias-sar"),top:i,bottom:r}})()),e.current})(),a=()=>requestAnimationFrame((()=>r((e=>++e))));return(0,wo.useEffect)((()=>{const i=new oo(e).create();return i.setSafeAreaInsets(o),i.on("update",a),i.setAppearanceManager(t),s(i),()=>{i.destroy()}}),[e]),(0,wo.useEffect)((()=>{null==n||n.setDesktopMode(i)}),[n,i]),n},Ou=So().createContext({storyManager:Xs,desktopMode:!1});let Eu=!1;const Au=e=>{Pu(e.config),Du(e);const t=Nu(e),i=Tu(),r=(({storyManager:e,appearanceManager:t})=>{const[,i]=(0,wo.useState)(0),[r,n]=(0,wo.useState)(null),s=()=>requestAnimationFrame((()=>i((e=>++e))));return(0,wo.useEffect)((()=>{const i=new ms(e).create();return i.setAppearanceManager(t),i.on("update",s),n(i),()=>{i.destroy()}}),[e]),r})({storyManager:Xs,appearanceManager:t}),n=ku({storyManager:Xs,appearanceManager:t,desktopMode:i});return(0,wo.useEffect)((()=>{if(Eu)throw new Error("There can only be one instance of <IASContainer /> per application");return Eu=!0,()=>{Eu=!1}}),[]),Zo(Ou.Provider,{value:{storyManager:Xs,desktopMode:i},children:[(null==n?void 0:n.isOpened)&&Ho(Ra,{gameReaderViewModel:n}),(null==r?void 0:r.activeStory)&&Ho(_u,{storyReaderViewModel:r,desktopMode:i}),e.children]})},Lu=()=>(0,wo.useContext)(Ou);var Mu=p(3643);const Iu=p.n(Mu)().getParser(window.navigator.userAgent).parse(),Tu=()=>{const[e,t]=(0,wo.useState)(!1);(0,wo.useLayoutEffect)((()=>(i(),window.addEventListener("resize",i),()=>{window.removeEventListener("resize",i)})),[]);const i=()=>{"mobile"===Iu.parsedResult.platform.type?t(!1):t(!0)};return e},Ru=e=>{const t=t=>{t.keyCode===ni.esc&&e()};(0,wo.useEffect)((()=>(window.addEventListener("keydown",t),()=>{window.removeEventListener("keydown",t)})),[])},Pu=e=>{(0,wo.useEffect)((()=>{e.lang&&Xs.setLang(e.lang)}),[e.lang]),(0,wo.useEffect)((()=>{Xs.setApiKey(e.apiKey)}),[e.apiKey]),(0,wo.useEffect)((()=>{e.userId&&Xs.setUserId(e.userId)}),[e.userId]),(0,wo.useEffect)((()=>{e.tags&&Xs.setTags(e.tags)}),[JSON.stringify(e.tags)]),(0,wo.useEffect)((()=>{e.placeholders&&Xs.setPlaceholders(e.placeholders)}),[JSON.stringify(e.placeholders)]),(0,wo.useEffect)((()=>{e.imagePlaceholders&&Xs.setImagePlaceholders(e.imagePlaceholders)}),[JSON.stringify(e.imagePlaceholders)]),(0,wo.useEffect)((()=>{Xs.setConfig(e)}),[])},Du=({onClickOnStory:e,onShowStory:t,onCloseStory:i,onShowSlide:r,onClickOnButton:n,onLikeStory:s,onDislikeStory:o,onFavoriteStory:a,onShareStory:l,onShareStoryWithPath:d,onFeedImpression:c,onVisibleAreaUpdated:u,onWidgetEvent:h})=>{(0,wo.useEffect)((()=>(e&&Xs.on("clickOnStory",e),t&&Xs.on("showStory",t),i&&Xs.on("closeStory",i),r&&Xs.on("showSlide",r),n&&Xs.on("clickOnButton",n),s&&Xs.on("likeStory",s),o&&Xs.on("dislikeStory",o),a&&Xs.on("favoriteStory",a),l&&Xs.on("shareStory",l),d&&Xs.on("shareStoryWithPath",d),c&&Xs.on("feedImpression",c),u&&Xs.on("visibleAreaUpdated",u),h&&Xs.on("widgetEvent",h),()=>{e&&Xs.off("clickOnStory",e),t&&Xs.off("showStory",t),i&&Xs.off("closeStory",i),r&&Xs.off("showSlide",r),n&&Xs.off("clickOnButton",n),s&&Xs.off("likeStory",s),o&&Xs.off("dislikeStory",o),a&&Xs.off("favoriteStory",a),l&&Xs.off("shareStory",l),d&&Xs.off("shareStoryWithPath",d),c&&Xs.off("feedImpression",c),u&&Xs.off("visibleAreaUpdated",u),h&&Xs.off("widgetEvent",h)})),[e,t,i,r,n,s,o,a,l,d,c,u,h])},Nu=({commonOptions:e,gameReaderOptions:t,storyReaderOptions:i,goodsWidgetOptions:r})=>{const n=(0,wo.useRef)(new le).current;return(0,wo.useEffect)((()=>{e&&n.setCommonOptions(e)}),[JSON.stringify(e)]),(0,wo.useEffect)((()=>{t&&n.setGameReaderOptions(t)}),[JSON.stringify(t)]),(0,wo.useEffect)((()=>{r&&n.setGoodsWidgetOptions(r)}),[JSON.stringify(r),null==r?void 0:r.itemClickHandler,null==r?void 0:r.openGoodsWidgetHandler]),(0,wo.useEffect)((()=>{i&&n.setStoryReaderOptions(i)}),[JSON.stringify(i)]),n};var Fu=function(e,t){var i={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(i[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(r=Object.getOwnPropertySymbols(e);n<r.length;n++)t.indexOf(r[n])<0&&Object.prototype.propertyIsEnumerable.call(e,r[n])&&(i[r[n]]=e[r[n]])}return i};const ju=e=>{var{listType:t,feedSlug:i,testKey:r,storyManager:n,options:s,optionsOverrideByMediaQuery:o,filter:a,useUgcCard:l=!1,hasFavorite:d,isFavorite:c}=e,u=Fu(e,["listType","feedSlug","testKey","storyManager","options","optionsOverrideByMediaQuery","filter","useUgcCard","hasFavorite","isFavorite"]);const[,h]=(0,wo.useState)(0),[p,f]=(0,wo.useState)(),{desktopMode:g}=Lu(),v=((e,t)=>{const i=(0,wo.useRef)(new le).current;return(0,wo.useEffect)((()=>{e&&i.setStoriesListOptions(e)}),[JSON.stringify(e)]),(0,wo.useEffect)((()=>{t&&i.setOptionsOverrideByMediaQuery(t.map((({mediaQuery:e,viewportMinSize:t,options:i})=>({viewportMinSize:t,mediaQuery:e,storiesListOptions:i}))))}),[JSON.stringify(t)]),i})(s,o),m=()=>{requestAnimationFrame((()=>h((e=>++e))))},y=()=>{var e;null===(e=u.onLoadStart)||void 0===e||e.call(u)},w=e=>{var t;null===(t=u.onLoadEnd)||void 0===t||t.call(u,e)};return(0,wo.useEffect)((()=>{const e=new js(n).create({listType:t,testKey:r,identityFields:{feedSlug:i,filter:a},useUgcCard:l,isFavorite:c,hasFavorite:d});return e.setAppearanceManager(v),e.on("update",m),c||(e.on("startLoading",y),e.on("endLoading",w),e.loadStories({needFavorite:!0})),f(e),()=>{e.destroy()}}),[n,r,i,a,v]),(0,wo.useEffect)((()=>{if(p)return u.onFavoriteCardClick&&p.on("clickOnFavoriteCellInternal",u.onFavoriteCardClick),u.onUgcCardClick&&p.on("clickOnUgcCardCellInternal",u.onUgcCardClick),()=>{u.onFavoriteCardClick&&p.off("clickOnFavoriteCellInternal",u.onFavoriteCardClick),u.onUgcCardClick&&p.off("clickOnUgcCardCellInternal",u.onUgcCardClick)}}),[p,u.onUgcCardClick,u.onFavoriteCardClick]),(0,wo.useEffect)((()=>{p&&(p.modeDesktop=g)}),[g,p]),{storyListViewModel:p,appearanceManager:v}};function Bu(e){return!/^(-?\d|--)/.test(e)}function Uu(e){const t=[];let i="",r="",n=7;for(let s,o=0;s=e.charAt(o);o++)if(/[a-zA-Z\d\xa0-\uffff_-]/.test(s)&&7===n)i+=s;else if("\\"===s&&7===n)n=6;else if(" "===s&&7===n){if(""!==i){if(!Bu(i))return null;t.push(i),i=""}}else if(6===n)/[0-9a-f]/i.test(s)?(r+=s,n=8):(i+=s,n=7);else{if(8!==n)return null;/[0-9a-f]/i.test(s)&&r.length<6?r+=s:(i+=String.fromCodePoint(parseInt(r,16)),i+=s,r="",n=7)}if(""!==i){if(!Bu(i))return null;t.push(i)}return t.join(" ")}function Vu(e,t){let i=t,r="";const n={"font-family":[]};for(let t,s=0;t=e.charAt(s);s+=1)if(4!==i||'"'!==t&&"'"!==t)if(3===i&&","===t)i=4,r="";else if(4===i&&","===t){const e=Uu(r);e&&n["font-family"].push(e),r=""}else if(5===i&&" "===t)/^(?:\+|-)?(?:[0-9]*\.)?[0-9]+(?:deg|grad|rad|turn)$/.test(r)?(n["font-style"]+=" "+r,r=""):s-=1,i=1;else if(1!==i||" "!==t&&"/"!==t)2===i&&" "===t?(/^(?:\+|-)?([0-9]*\.)?[0-9]+(?:em|ex|ch|rem|vh|vw|vmin|vmax|px|mm|cm|in|pt|pc|%)?$/.test(r)&&(n["line-height"]=r),i=4,r=""):r+=t;else{if(/^(?:(?:xx|x)-large|(?:xx|s)-small|small|large|medium)$/.test(r)||/^(?:larg|small)er$/.test(r)||/^(?:\+|-)?(?:[0-9]*\.)?[0-9]+(?:em|ex|ch|rem|vh|vw|vmin|vmax|px|mm|cm|in|pt|pc|%)$/.test(r))i="/"===t?2:4,n["font-size"]=r;else if(/^italic$/.test(r))n["font-style"]=r;else if(/^oblique$/.test(r))n["font-style"]=r,i=5;else if(/^small-caps$/.test(r))n["font-variant"]=r;else if(/^(?:bold(?:er)?|lighter|normal)$/.test(r))n["font-weight"]=r;else if(/^[+-]?(?:[0-9]*\.)?[0-9]+(?:e[+-]?(?:0|[1-9][0-9]*))?$/.test(r)){const e=parseFloat(r);e>=1&&e<=1e3&&(n["font-weight"]=r)}else/^(?:(?:ultra|extra|semi)-)?(?:condensed|expanded)$/.test(r)&&(n["font-stretch"]=r);r=""}else{let o=s+1;do{if(o=e.indexOf(t,o)+1,!o)return null}while("\\"===e.charAt(o-2));n["font-family"].push(e.slice(s+1,o-1).replace(/\\('|")/g,"$1")),s=o-1,i=3,r=""}if(3===i&&!/^\s*$/.test(r))return null;if(4===i){const e=Uu(r);e&&n["font-family"].push(e)}return n}var Gu=p(9780),zu=p.n(Gu);class Wu{toString(){return`${this.fontStyle} ${this.fontVariant} ${this.fontWeight} ${this.fontSize}px/${this.lineHeight} ${this.fontFamily.join(", ")}`}clone(){const e=new Wu;return e.fontStyle=this.fontStyle,e.fontVariant=this.fontVariant,e.fontWeight=this.fontWeight,e.fontSize=this.fontSize,e.lineHeight=this.lineHeight,e.fontFamily=this.fontFamily.slice(),e}}class $u{constructor(e,t){this.obj=e,this.cardTitleOptions=t,this.cardTitleFont=this.getCardTitleParsedFont(t.font)}getCardTitleFont(){return this.cardTitleFont.clone()}getScaledFontSizeInWebView(){const e=this.measureScaledFontSizeInWebView(this.cardTitleFont.fontSize)/this.cardTitleFont.fontSize;return this.cardTitleFont.fontSize/e}getStoryTitleBlockHeight(){if(!this.isOutsideTitle())return 0;const e=this.cardTitleOptions.padding;let t={top:0,bottom:0};try{if("number"==typeof e)t.top=e,t.bottom=e;else{const i=zu()(e);t.top=parseFloat(i.top),t.bottom=parseFloat(i.bottom)}}catch(e){console.error(e)}const i=this.cardTitleOptions.lineClamp,r=Math.round(this.cardTitleFont.fontSize*this.cardTitleFont.lineHeight*100)/100;return t.top+t.bottom+i*r}measureScaledFontSizeInWebView(e){const t=document.createElement("span");t.style.fontSize=e+"px",t.style.display="none",this.obj.append(t);const i=getComputedStyle(t).fontSize;return this.obj.removeChild(t),parseFloat(i)||e}isOutsideTitle(){return this.cardTitleOptions.display&&(this.cardTitleOptions.position===q.CARD_OUTSIDE_TOP||this.cardTitleOptions.position===q.CARD_OUTSIDE_BOTTOM)}getCardTitleParsedFont(e){const t=new Wu;t.fontStyle="normal",t.fontVariant="normal",t.fontWeight="normal",t.fontSize=14,t.lineHeight=1.2,t.fontFamily=["system-ui",'"Segoe UI"',"Roboto","Helvetica","Arial","sans-serif",'"Apple Color Emoji"','"Segoe UI Emoji"','"Segoe UI Symbol"'];try{const i=function(e){const t=Vu(e,1);return null!==t&&t["font-size"]&&t["font-family"].length?t:null}(e);if(null!=i["font-style"]&&(t.fontStyle=i["font-style"]),null!=i["font-variant"]&&(t.fontVariant=i["font-variant"]),null!=i["font-weight"]&&(t.fontWeight=i["font-weight"]),null!=i["font-size"]){const e=parseFloat(i["font-size"]);String(`${e}px`)===i["font-size"]&&(t.fontSize=e)}if(null!=i["line-height"]){const e=parseFloat(i["line-height"]);String(`${e}px`)===i["line-height"]?t.lineHeight=Math.round(e/t.fontSize*100)/100:String(e)===i["line-height"]&&(t.lineHeight=parseFloat(i["line-height"]))}null!=i["font-family"]&&Array.isArray(i["font-family"])&&(t.fontFamily=i["font-family"])}catch(e){console.error(e)}return t}}class qu{constructor(e){this.storiesListOptions=e}getStoriesListStyleOptions(e){var t,i,r,n,s,o;let a={storiesHeight:null!==(i=null===(t=this.storiesListOptions.card)||void 0===t?void 0:t.height)&&void 0!==i?i:70,storiesLayoutHeight:null!==(n=null===(r=this.storiesListOptions.layout)||void 0===r?void 0:r.height)&&void 0!==n?n:0,storiesListTopPadding:null!==(s=this.storiesListOptions.topPadding)&&void 0!==s?s:0,storiesListBottomPadding:null!==(o=this.storiesListOptions.bottomPadding)&&void 0!==o?o:0},l=parseFloat(a.storiesHeight),d=l;if(parseFloat(a.storiesLayoutHeight))return l=parseFloat(a.storiesLayoutHeight),{storiesListHeight:l,storiesListInnerHeight:d};return l+=parseFloat(a.storiesListTopPadding)+parseFloat(a.storiesListBottomPadding)+e,d+=e,{storiesListHeight:l,storiesListInnerHeight:d}}}const Hu=(e,t,i)=>{const r=(e,t)=>{const i=e.getCardTitleFont();i.fontSize=e.getScaledFontSizeInWebView(),t.card.title.font=i.toString()},n=(e,t)=>{const i=new qu(t),{storiesListHeight:r,storiesListInnerHeight:n}=i.getStoriesListStyleOptions(e.getStoryTitleBlockHeight()),s=t.layout.height;t.layout.height=Le()(s)?`${r}px`:s},s=t=>{((e,t)=>{const i=new $u(e,t.card.title);r(i,t),n(i,t)})(e.current,t),i.emit("update")};(0,wo.useLayoutEffect)((()=>(s(t.storiesListOptions),t.on(j.EVENT_UPDATED_STORIES_LIST_OPTIONS,s),()=>{t.off(j.EVENT_UPDATED_STORIES_LIST_OPTIONS,s)})),[t,i])},Zu=(e,t)=>{const[i,r]=(0,wo.useState)(!1),[n,s]=(0,wo.useState)(null),{ref:o}=(e=>{const t=(0,wo.useRef)(null);return(0,wo.useEffect)((()=>{if(!t.current)return;const i=new ar;return i.mount(t.current),e(i),()=>{i.destroy()}}),[]),{ref:t}})((e=>{s(e),e.addListener("scrollstart",(()=>r(!0))),e.addListener("scrollend",(()=>setTimeout((()=>r(!1)),100)))}));(0,wo.useEffect)((()=>{n&&(n.setGap(e.options.card.gap),n.setDesktopMode(e.modeDesktop),n.changeDirection(e.options.direction))}),[n,e.options.card.gap,e.modeDesktop,e.options.direction]);const a=(0,wo.useCallback)(rr()((()=>{null==n||n.testAttraction(),null==n||n.emit("scroll")}),0),[n,t]);return(0,wo.useEffect)((()=>(null==n||n.scrollTo(0,0),a(),window.addEventListener("resize",a),()=>{window.addEventListener("resize",a)})),[n,a]),{sliderRef:o,slider:n,isScrolling:i}};var Qu=p(5213),Xu={insert:"head",singleton:!1};Ko()(Qu.A,Xu);const Yu=Qu.A.locals||{},Ku=({slider:e,storyListViewModel:t,isFavorite:i,listType:r,identityFields:n,storyManager:s})=>{const o=(({storyManager:e,listType:t,identityFields:i})=>{const[r,n]=(0,wo.useState)();return(0,wo.useEffect)((()=>{const r=new Tt(e,{listType:t,identityFields:i}).create();return n(r),()=>{r.destroy()}}),[i.feedSlug,i.filter]),r})({listType:r,identityFields:n,storyManager:s});(0,wo.useEffect)((()=>{if(!e||i||!o)return;let t=0,r=0,n=0,s=0;const l=({x:e,y:i})=>{t=e,n=i,r=e,s=i},d=({x:e,y:i})=>{t=Math.min(e,t),r=Math.max(e,r),n=Math.min(i,n),s=Math.max(i,s),o.calculate({minOffsetLeft:t,maxOffsetLeft:r,minOffsetTop:n,maxOffsetTop:s})};e.addListener("scrollstart",l),e.addListener("scrollend",d);const c=rr()(a,600,{leading:!1});return window.addEventListener("scroll",c),window.addEventListener("resize",c),()=>{null==e||e.removeListener("scrollstart",l),null==e||e.removeListener("scrollend",d),window.removeEventListener("scroll",c),window.removeEventListener("resize",c)}}),[e,i]),(0,wo.useEffect)((()=>{i||a()}),[t.options.direction,t.options.card.aspectRatio,t.options.card.height,t.session,i,o]);const a=()=>{if(!e||!o)return;const t=e.elementRef.getBoundingClientRect(),{x:i,y:r}=e.getCurrentPosition();l(t),o.calculate({minOffsetLeft:i,maxOffsetLeft:i,minOffsetTop:r,maxOffsetTop:r})};(0,wo.useEffect)((()=>{if(!o)return;const e=e=>o.markStoryAsFullVisible(e);return t.on("openStory",e),()=>{t.off("openStory",e)}}),[t]);const l=e=>{const{left:t,top:i,width:r,height:n}=e,s=new gt(t,i,r,n);d(s),u(s)},d=e=>{const t=new gt(0,0,window.innerWidth,window.innerHeight),i=c(t,e);h(i,e),o.setViewport(i)},c=(e,t)=>{let i=new gt;return t.overlaps(e)?(i=t.getIntersection(e),i):i},u=t=>{if(!e)return;const i=e.slides,r=[];i.forEach(((e,n)=>{const s=Number(e.dataset.id),o=new wt(s,e.offsetLeft,e.offsetTop,e.clientWidth,e.clientHeight);r.push(o),o.x+=t.x,o.y+=t.y,f(o,n,i.length-1)})),o.setStoryRects(r)},h=(e,t)=>{if(t.width<768)return;const i=p();e.x+=i.left,e.y+=i.top,e.height-=i.top+i.bottom,e.width-=i.left+i.right},p=()=>{const e=t.options.sidePadding,i={left:e,right:e,top:t.options.topPadding,bottom:t.options.bottomPadding};return"vertical"===t.options.direction&&(i.left=0,i.right=0),i},f=(e,t,i)=>{const r=p();e.x+=r.left,0===t&&(e.x+=r.left,e.width-=r.left),t===i&&(e.width-=r.right)}},Ju=(e,t,i)=>{(0,wo.useEffect)((()=>{if(e)return t.on("closeStory",r),()=>{t.off("closeStory",r)}}),[e]);const r=r=>{if(!e)return;const n=e.slides.find((e=>Number(e.dataset.id)===r));if(!n||((e,t)=>{const r=new gt(t.offsetLeft,t.offsetTop,t.clientWidth,t.clientHeight),{x:n,y:s}=e.getCurrentPosition(),o=i.current.getBoundingClientRect(),a=new gt(o.x+n,o.y+s,o.width,o.height);return r.overlaps(a)})(e,n))return;const s="horizontal"===t.options.direction?n.offsetLeft:n.offsetTop;e.scrollTo(s)}},eh=(0,wo.forwardRef)(((e,t)=>{const i=e.sliderOptions.card,r=e.sliderOptions.favoriteCard,n=i.border,s=i.opened.border,o=e.sliderOptions.navigation,a=()=>{var e,t,i;return(null!==(e=s.radius)&&void 0!==e?e:n.radius)-parseFloat(null!==(t=s.width)&&void 0!==t?t:n.width)-parseFloat(null!==(i=s.gap)&&void 0!==i?i:n.gap)};return Ho("div",{ref:t,className:e.className,style:Object.assign(Object.assign({},(()=>{var t,l,d,c,u,h,p,f,g,v,m,y,w,S,b,_,x,C,k,O,E;const A=e=>{let t="";return null!=e&&Array.isArray(e.linearGradient)&&(t=e.linearGradient.map((({direction:e,points:t})=>`linear-gradient(${[e,t].filter(Boolean).join(", ")})`)).join(", ")),t};let L={"--storiesBorderNotReadColor":n.color,"--storiesBorderReadColor":null!==(t=s.color)&&void 0!==t?t:n.color,"--storiesBorderNotReadGradientColor":null==n?void 0:n.gradient,"--storiesBorderReadGradientColor":null!==(l=null==s?void 0:s.gradient)&&void 0!==l?l:null==n?void 0:n.gradient,"--storiesListCardFavoriteGradientColor":null===(d=e.sliderOptions.favoriteCard.border)||void 0===d?void 0:d.gradient,"--storiesListCardUgcGradientColor":null===(c=e.sliderOptions.ugcCard.border)||void 0===c?void 0:c.gradient,"--storiesGap":i.gap+"px","--storiesHeight":i.height+"px","--storiesListSidePadding":e.sliderOptions.sidePadding+"px","--storiesListBorderNotReadWidth":n.width+"px","--storiesListBorderReadWidth":(null!==(u=s.width)&&void 0!==u?u:s.width)+"px","--storiesListBorderGapNotRead":n.gap+"px","--storiesListBorderGapRead":(null!==(h=s.gap)&&void 0!==h?h:s.gap)+"px","--storiesListBorderRadius":n.radius+"px","--storiesListBorderRadiusRead":(null!==(p=s.radius)&&void 0!==p?p:s.radius)+"px","--storiesListItemMaskColor":i.mask.color,"--storiesListItemOpenedMaskColor":null!==(f=i.opened.mask.color)&&void 0!==f?f:i.mask.color,"--storiesListItemMaskLinearGradient":A(i.mask),"--storiesListItemOpenedMaskLinearGradient":A(null!=(null===(v=null===(g=i.opened)||void 0===g?void 0:g.mask)||void 0===v?void 0:v.linearGradient)?i.opened.mask:i.mask),"--storiesListCardFavoriteTitle":Ei(r.title.padding.toString())?r.title.padding+"px":r.title.padding,"--storiesListCardFavoriteGap":Ei(r.gap.toString())?r.gap+"px":r.gap,"--storiesListCardUgcMaskColor":e.sliderOptions.ugcCard.mask.color,"--storiesListCardUgcMaskLinearGradient":A(e.sliderOptions.ugcCard.mask),"--storiesListItemTitleColor":i.title.color,"--storiesListItemTitleFontFamily":"InternalPrimaryFont","--storiesListItemTitleFont":i.title.font,"--storiesListItemTitlePadding":Ei(i.title.padding.toString())?i.title.padding+"px":i.title.padding,"--storiesListControlsSize":Ei(o.controlsSize.toString())?o.controlsSize+"px":o.controlsSize,"--storiesListControlsBackgroundColor":o.controlsBackgroundColor,"--storiesListControlsColor":o.controlsColor,"--storiesListInnerBorderRadiusNotRead":n.radius-parseFloat(n.width)-parseFloat(n.gap)+"px","--storiesListInnerBorderRadiusRead":a()+"px","--storiesListCardDropShadow":i.dropShadow,"--storiesListCardOpenedDropShadow":null!==(m=i.opened.dropShadow)&&void 0!==m?m:i.dropShadow,"--storiesListCardFavoriteDropShadow":e.sliderOptions.favoriteCard.dropShadow,"--storiesListCardUgcDropShadow":e.sliderOptions.ugcCard.dropShadow,"--storiesListCardMask":(null===(y=i.svgMask)||void 0===y?void 0:y.cardMask)?`url("data:image/svg+xml,${Qe(null===(w=i.svgMask)||void 0===w?void 0:w.cardMask)}")`:null,"--storiesListCardOpenedMask":(null===(S=i.opened.svgMask)||void 0===S?void 0:S.cardMask)?`url("data:image/svg+xml,${Qe(null===(b=i.opened.svgMask)||void 0===b?void 0:b.cardMask)}")`:null,"--storiesListCardFavoriteMask":(null===(_=e.sliderOptions.ugcCard.svgMask)||void 0===_?void 0:_.cardMask)?`url("data:image/svg+xml,${Qe(null===(x=e.sliderOptions.ugcCard.svgMask)||void 0===x?void 0:x.cardMask)}")`:null},M=null;return M=null===(C=i.svgMask)||void 0===C?void 0:C.overlayMask,null!=M&&Array.isArray(M)&&M.forEach(((e,t)=>L[`--storiesListCardOverlay${t}Mask`]=e.mask?`url("data:image/svg+xml,${Qe(e.mask)}")`:null)),M=null===(k=i.opened.svgMask)||void 0===k?void 0:k.overlayMask,null!=M&&Array.isArray(M)&&M.forEach(((e,t)=>L[`--storiesListCardOpenedOverlay${t}Mask`]=e.mask?`url("data:image/svg+xml,${Qe(e.mask)}")`:null)),M=null===(O=e.sliderOptions.favoriteCard.svgMask)||void 0===O?void 0:O.overlayMask,null!=M&&Array.isArray(M)&&M.forEach(((e,t)=>L[`--storiesListCardFavoriteOverlay${t}Mask`]=e.mask?`url("data:image/svg+xml,${Qe(e.mask)}")`:null)),M=null===(E=e.sliderOptions.ugcCard.svgMask)||void 0===E?void 0:E.overlayMask,null!=M&&Array.isArray(M)&&M.forEach(((e,t)=>L[`--storiesListCardUgcOverlay${t}Mask`]=e.mask?`url("data:image/svg+xml,${Qe(e.mask)}")`:null)),L})()),e.style),children:e.children})})),th=navigator.vendor&&navigator.vendor.indexOf("Apple")>-1&&navigator.userAgent&&-1==navigator.userAgent.indexOf("CriOS")&&-1==navigator.userAgent.indexOf("FxiOS"),ih=({videoCoverSrc:e,onVideoCoverLoaded:t})=>{const i=(0,wo.useRef)(null);return(0,wo.useEffect)((()=>{(()=>{if(!e)return;const r=i.current,n=()=>{r.play().then((()=>{if(th){let e=1;const i=()=>{e>=2&&(r.removeEventListener("timeupdate",i),r.currentTime=0,t()),e++};r.addEventListener("timeupdate",i,!1)}else t()})).catch((e=>{console.error(e)})),r.removeEventListener("canplaythrough",n)};r.addEventListener("canplaythrough",n),r.load()})()}),[]),Ho("video",{ref:i,src:e,loop:!0,muted:!0,playsInline:!0,"webkit-playsinline":"true",preload:"auto"})},rh=({story:e,cardOptions:t,favoriteCardOptions:i,ugcCardOptions:r})=>{const n=(e,t)=>null!=t&&Array.isArray(t)?t.map(((t,i)=>s(t,e,i))):[],s=(e,t,i)=>({maskImage:`var(--${t}${i}Mask)`,WebKitMaskImage:`var(--${t}${i}Mask)`,background:e.background});return{getAllCardsOverlayMaskStyles:()=>{let s=[];var o;return e.isFavoriteCard&&(s=s.concat(n("storiesListCardFavoriteOverlay",null===(o=i.svgMask)||void 0===o?void 0:o.overlayMask))),s=e.isUgcCard?s.concat((()=>{var e;return n("storiesListCardUgcOverlay",null===(e=r.svgMask)||void 0===e?void 0:e.overlayMask)})()):e.isOpened?s.concat((()=>{var e;return n("storiesListCardOpenedOverlay",null===(e=t.opened.svgMask)||void 0===e?void 0:e.overlayMask)})()):s.concat((()=>{var e;return n("storiesListCardOverlay",null===(e=t.svgMask)||void 0===e?void 0:e.overlayMask)})()),s}}};var nh=p(6892),sh={insert:"head",singleton:!1};Ko()(nh.A,sh);const oh=nh.A.locals||{},ah=({story:e,cardOptions:t,favoriteCardOptions:i,ugcCardOptions:r,isScrolling:n,wrapperStyle:s,children:o,onClick:a})=>{const l={story:e,cardOptions:t,favoriteCardOptions:i,ugcCardOptions:r},[d,c]=(0,wo.useState)(!1),{getAllCardsOverlayMaskStyles:u}=rh(l),{getCardTitleAlignClass:h,getTitleStyle:p,getTitleWrapperStyle:f}=(({story:e,cardOptions:t,favoriteCardOptions:i,ugcCardOptions:r})=>({getCardTitleAlignClass:()=>({[oh["align-left"]]:t.title.textAlign===$.LEFT,[oh["align-center"]]:t.title.textAlign===$.CENTER,[oh["align-right"]]:t.title.textAlign===$.RIGHT}),getTitleStyle:()=>{let i={};return e.titleColor&&e.isTitleCardInner&&Object.assign(i,{color:e.titleColor}),i.WebkitLineClamp=String(parseInt(t.title.lineClamp)),i},getTitleWrapperStyle:()=>{let t={};return e.titleColor&&e.isFavoriteCard&&(t=Object.assign(Object.assign({},t),{color:i.title.color})),e.titleColor&&e.isUgcCard&&(t=Object.assign(Object.assign({},t),{color:r.title.color})),t}}))(l),{getSlideClassList:g,getSlideStyleList:v,getSlideWrapperStyle:m}=(({story:e,cardOptions:t,favoriteCardOptions:i,ugcCardOptions:r})=>{const n=e.aspectRatio;return{getSlideClassList:()=>{var n,s;const o=e.background;let a="";void 0!==o&&(a=oh[`_background-color-${o.color}`+(!0===o.gradient?"-gradient":"")]);const l=(()=>{let n;return n=e.isFavoriteCard?i:e.isUgcCard?r:e.isOpened&&t.opened||t,n})(),d=Boolean(l.dropShadow),c=Boolean(null===(n=l.svgMask)||void 0===n?void 0:n.cardMask),u=Boolean(null===(s=l.border)||void 0===s?void 0:s.gradient);return[a,{[oh["_is-read"]]:e.isOpened},{[oh["_format-rectangle"]]:t.variant===te.STYLE_RECTANGLE},{[oh["_format-circle"]]:t.variant===te.STYLE_CIRCLE},{[oh["_format-quad"]]:t.variant===te.STYLE_QUAD},{[oh["_favorite-cell"]]:e.isFavoriteCard},{[oh["_ugc-cell"]]:e.isUgcCard},{[oh["_has-drop-shadow"]]:d},{[oh["_has-card-svg-mask"]]:c},{[oh["_has-border-gradient-color"]]:u}]},getSlideStyleList:()=>{const i={width:n*t.height+"px",opacity:null!==t.opacity?t.opacity:1,boxShadow:t.boxShadow||"unset",height:`${t.height}px`};return e.isOpened&&(i.boxShadow=t.opened.boxShadow||i.boxShadow,i.opacity=null!==t.opened.opacity?t.opened.opacity:i.opacity),i},getSlideWrapperStyle:()=>{let e={};return e.width=n*t.height+"px",e}}})(l),y=e.getImageSrc();return Zo("a",{"data-id":e.id,className:Xo()(oh["stories-slide-wrapper"],{[oh.isTitleCardOutsideTop]:e.isTitleCardOutsideTop,[oh.isTitleCardOutsideBottom]:e.isTitleCardOutsideBottom}),style:Object.assign(Object.assign({},m()),s),rel:"noreferrer",onClick:t=>{n||(t.stopPropagation(),t.preventDefault(),a(e))},children:[t.title.display&&e.isTitleCardOutsideTop&&Ho("div",{className:Xo()(oh["stories-slide__content"],oh.__position_outside_top),style:f(),children:Ho("div",{className:Xo()(oh["stories-slide__title"],oh.clamp,h()),style:p(),children:e.title})}),Zo("div",{className:Xo()(oh["stories-slide"],g()),style:v(),children:[Zo("div",{className:oh["stories-slide__inner"],children:[Ho("div",{className:oh["stories-slide-image"],style:{backgroundColor:e.backgroundColor?e.backgroundColor:"transparent"},children:Ho("div",{className:oh["stories-slide-image__wrap"],children:Zo("div",{className:Xo()(oh["stories-slide-image__image"],oh._mode_list,{[oh["video-loaded"]]:d,[oh["ugc-card-cell"]]:e.isUgcCard}),children:[y&&Ho("img",{src:y,alt:e.title,loading:t.coverLazyLoading?"lazy":"eager"}),e.videoCoverSrc&&Ho(ih,{onVideoCoverLoaded:()=>c(!0),videoCoverSrc:e.videoCoverSrc}),o]})})}),Ho("div",{className:oh["stories-slide__mask"]}),t.title.display&&e.isTitleCardInner&&Ho("div",{className:oh["stories-slide__content"],style:f(),children:Ho("div",{className:Xo()(oh["stories-slide__title"],oh.clamp,h()),style:p(),children:e.title})})]}),u().map(((e,t)=>Ho("div",{style:e,className:oh["card-overlay-svg-mask"]},t)))]}),t.title.display&&e.isTitleCardOutsideBottom&&Ho("div",{className:Xo()(oh["stories-slide__content"],oh.__position_outside_bottom),style:f(),children:Ho("div",{className:Xo()(oh["stories-slide__title"],oh.clamp,h()),style:p(),children:e.title})})]})};var lh=p(1980),dh={insert:"head",singleton:!1};Ko()(lh.A,dh);const ch=lh.A.locals||{};var uh=function(e,t){var i={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(i[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(r=Object.getOwnPropertySymbols(e);n<r.length;n++)t.indexOf(r[n])<0&&Object.prototype.propertyIsEnumerable.call(e,r[n])&&(i[r[n]]=e[r[n]])}return i};const hh=e=>{var{sliderDirection:t,slider:i}=e,r=uh(e,["sliderDirection","slider"]);const[n,s]=(0,wo.useState)(!0),[o,a]=(0,wo.useState)(!1);(0,wo.useEffect)((()=>(i.on("scroll",l),()=>{i.off("scroll",l)})),[i]);const l=()=>{s(i.reachBeginning),a(i.reachEnd)},d=e=>{const{x:n,y:s}=i.getCurrentPosition(),o=t===or.Horizontal?n:s,a=i.getSlidesPerView(),l=(()=>{var e;return(null===(e=i.slides[0])||void 0===e?void 0:e.clientWidth)+i.getGap()})(),d=(()=>{var e;return(null===(e=i.slides[0])||void 0===e?void 0:e.clientHeight)+i.getGap()})(),c=o+e*a*(t===or.Horizontal?l:d);i.scrollTo(c,r.navigationOptions.speed)};return r.navigationView?r.navigationView({defaultStyles:ch,reachStart:n,reachEnd:o,onPrev:()=>d(-1),onNext:()=>d(1),slider:{direction:t,viewport:i.elementRef.getBoundingClientRect()}}):r.navigationOptions.showControls?Zo("div",{className:Xo()(ch["stories-list-controls"],ch[t]),children:[Ho("div",{onClick:()=>d(-1),className:Xo()(ch["control-start"],{active:n}),children:Ho("div",{className:ch["control-icon"]})}),Ho("div",{onClick:()=>d(1),className:Xo()(ch["control-end"],{active:o}),children:Ho("div",{className:ch["control-icon"]})})]}):null};var ph=p(7966),fh={insert:"head",singleton:!1};Ko()(ph.A,fh);const gh=ph.A.locals||{},vh=({favoriteStories:e,cardOptions:t})=>{const i=e=>({paddingTop:1/e.aspectRatio*100+"%"}),r=e=>{const t=e.getImageSrc(),i={};return t?i.backgroundImage=`url('${t}')`:i.backgroundColor=e.backgroundColor,i};return Ho("div",{className:gh["favorite-images-wrapper"],children:e.slice(0,4).map(((e,n)=>Ho("div",{className:gh["favorite-image-wrapper"],children:Ho("div",{style:i(e),className:Xo()(gh["favorite-image"],{[gh.circle_style]:t.variant===te.STYLE_CIRCLE}),children:Ho("div",{className:gh["favorite-image-item"],style:r(e)})})},n)))})};var mh=function(e,t){var i={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(i[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(r=Object.getOwnPropertySymbols(e);n<r.length;n++)t.indexOf(r[n])<0&&Object.prototype.propertyIsEnumerable.call(e,r[n])&&(i[r[n]]=e[r[n]])}return i};const yh=(0,wo.forwardRef)(((e,t)=>{var{onLoadStart:i,onLoadEnd:r,isFavorite:n=!1,storyListViewModel:s}=e,o=mh(e,["onLoadStart","onLoadEnd","isFavorite","storyListViewModel"]);const a=(0,wo.useRef)(null),l=(0,wo.useRef)(null),d=(({isFavorite:e,storyListViewModel:t})=>{let i=[];return e?i=t.favoriteStories:(i=t.defaultStories,t.favoriteCard&&i.push(t.favoriteCard),t.ugcCard&&i.unshift(t.ugcCard)),i})({isFavorite:n,storyListViewModel:s});((e,t)=>{(0,wo.useImperativeHandle)(e,(()=>({reload:t.reload.bind(t)})),[t])})(t,s),Hu(a,o.appearanceManager,s);const{sliderRef:c,slider:u,isScrolling:h}=Zu(s,d.length);Ku({slider:u,storyListViewModel:s,isFavorite:n,listType:o.listType,identityFields:{feedSlug:o.feedSlug,filter:o.filter},storyManager:o.storyManager}),((e,t,i)=>{(0,wo.useEffect)((()=>{e&&t.modeDesktop&&r(e,i.current)}),[e,t.modeDesktop]);const r=(e,i)=>{if(t.options.layout.sliderAlign!==z.CENTER)return;let r=e.scrollWidth;if(r>0&&r<i.clientWidth){let t=i.clientWidth-r/2;e.scrollTo(t)}}})(u,s,l),Ju(u,s,l);const{getRootStyle:p,getStoryWrapperStyle:f,viewportInnerClassList:g,viewportInnerStyle:v}={getRootStyle:()=>({"--background-color":m.options.layout.backgroundColor,paddingLeft:m.options.sidePadding+"px",paddingRight:m.options.sidePadding+"px","--storiesListTopPadding":m.options.topPadding+"px","--storiesListBottomPadding":m.options.bottomPadding+"px","--storiesListSidePadding":m.options.sidePadding+"px",backgroundColor:m.options.layout.backgroundColor}),getStoryWrapperStyle:(e,t)=>{let i={marginRight:"0",paddingLeft:"0",paddingRight:"0"};return"vertical"===m.options.direction||(e!==t-1?i.marginRight=m.options.card.gap+"px":i.paddingRight=m.options.sidePadding+"px",0===e&&(i.paddingLeft=m.options.sidePadding+"px")),i},viewportInnerClassList:(m=s).modeDesktop?Xo()(Yu["stories-list__viewport-inner"],Yu["mode-desktop"],{[Yu["with-list-controls"]]:m.options.navigation.showControls,[Yu.isTitleCardOutsideTop]:m.options.card.title.position===q.CARD_OUTSIDE_TOP,[Yu.isTitleCardOutsideBottom]:m.options.card.title.position===q.CARD_OUTSIDE_BOTTOM,[Yu.isVerticalDirection]:"vertical"===m.options.direction}):Xo()(Yu["stories-list__viewport-inner"],Object.assign(Object.assign({},{[Yu["align-left"]]:m.options.layout.sliderAlign===z.LEFT,[Yu["align-center"]]:m.options.layout.sliderAlign===z.CENTER,[Yu["align-right"]]:m.options.layout.sliderAlign===z.RIGHT}),{[Yu.isTitleCardOutsideTop]:m.options.card.title.position===q.CARD_OUTSIDE_TOP,[Yu.isTitleCardOutsideBottom]:m.options.card.title.position===q.CARD_OUTSIDE_BOTTOM,[Yu.isVerticalDirection]:"vertical"===m.options.direction})),viewportInnerStyle:{height:m.options.layout.height,gap:"vertical"===m.options.direction?`${m.options.card.gap}px`:0}};var m;const y=s.options.card,w=s.options.favoriteCard,S=s.options.ugcCard;return Zo(eh,{className:Xo()(Yu["stories-list-wrapper"],{[Yu["mode-desktop"]]:s.modeDesktop,[Yu["with-list-controls"]]:s.options.navigation.showControls}),style:p(),sliderOptions:s.options,ref:a,children:[Ho("div",{className:Yu["stories-list"],children:Ho("div",{ref:l,className:Xo()(Yu["stories-list__viewport"],{[Yu["mode-desktop"]]:s.modeDesktop}),style:"horizontal"===s.options.direction?{marginLeft:-s.options.sidePadding+"px",marginRight:-s.options.sidePadding+"px"}:{},children:Ho("div",{ref:c,className:g,style:v,children:d.map(((e,t)=>{var i;const r=e.isFavoriteCard&&s.favoriteCard,n=o.storyCardView&&!r;return r&&o.favoriteCardView?Ho(So().Fragment,{children:o.favoriteCardView(s.favoriteCard)},t):Ho(So().Fragment,{children:n?null===(i=o.storyCardView)||void 0===i?void 0:i.call(o,e):Ho(ah,{story:e,cardOptions:y,favoriteCardOptions:w,ugcCardOptions:S,wrapperStyle:f(t,d.length),isScrolling:h,onClick:e=>s.onStoryClick(e,t),children:r&&Ho(vh,{favoriteStories:s.favoriteCard.favoriteStories,cardOptions:y})},t)},t)}))})})}),u&&Ho(hh,{navigationOptions:s.options.navigation,navigationView:o.navigationView,sliderDirection:s.options.direction,storiesLength:d.length,slider:u})]})})),wh=(0,wo.forwardRef)(((e,t)=>{var i,r;const{storyManager:n}=Lu(),s=null!==(i=e.feedSlug)&&void 0!==i?i:"default",o=Ye.DEFAULT,{storyListViewModel:a,appearanceManager:l}=ju(Object.assign(Object.assign({},e),{storyManager:n,feedSlug:s,listType:o,hasFavorite:Boolean(e.hasFavorite),isFavorite:!1}));return a?Ho(yh,Object.assign({},e,{appearanceManager:l,storyManager:n,feedSlug:null!==(r=e.feedSlug)&&void 0!==r?r:"default",listType:Ye.DEFAULT,storyListViewModel:a,ref:t})):null})),Sh=(0,wo.forwardRef)(((e,t)=>{const{storyManager:i}=Lu(),r=Zs,n=Ye.UGC,{storyListViewModel:s,appearanceManager:o}=ju(Object.assign(Object.assign({},e),{storyManager:i,feedSlug:r,listType:n,isFavorite:!1,hasFavorite:!1}));return s?Ho(yh,Object.assign({},e,{ref:t,appearanceManager:o,storyManager:i,listType:Ye.UGC,feedSlug:Zs,storyListViewModel:s})):null})),bh=e=>{const{storyManager:t}=Lu(),i="default",r=Ye.DEFAULT,{storyListViewModel:n,appearanceManager:s}=ju(Object.assign(Object.assign({},e),{storyManager:t,feedSlug:i,listType:r,isFavorite:!0,hasFavorite:!0}));return n?Ho(yh,Object.assign({},e,{appearanceManager:s,storyManager:t,feedSlug:i,listType:r,storyListViewModel:n,isFavorite:!0})):null}})(),f})()));
|