@inappstory/js-sdk 3.0.0 → 3.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.esm.mjs +1 -1
- package/dist/index.umd.js +1 -1
- package/package.json +3 -5
package/dist/index.esm.mjs
CHANGED
|
@@ -28,4 +28,4 @@ var i=r(1649);var n="function"==typeof Object.is?Object.is:function(e,t){return
|
|
|
28
28
|
* This source code is licensed under the MIT license found in the
|
|
29
29
|
* LICENSE file in the root directory of this source tree.
|
|
30
30
|
*/
|
|
31
|
-
var i=r(1649),n=r(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=i.useRef,l=i.useEffect,d=i.useMemo,c=i.useDebugValue;t.useSyncExternalStoreWithSelector=function(e,t,r,i,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=i(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 r=i(e);return void 0!==n&&n(t,r)?(o=e,t):(o=e,a=r)}var o,a,l=!1,d=void 0===r?null:r;return[function(){return e(t())},null===d?void 0:function(){return e(d())}]}),[t,r,i,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,r)=>{e.exports=r(3296)},7121:(e,t,r)=>{e.exports=r(1435)},1649:t=>{t.exports=e},37:e=>{e.exports=t}},p={};function f(e){var t=p[e];if(void 0!==t)return t.exports;var r=p[e]={id:e,loaded:!1,exports:{}};return h[e].call(r.exports,r,r.exports,f),r.loaded=!0,r.exports}f.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return f.d(t,{a:t}),t},f.d=(e,t)=>{for(var r in t)f.o(t,r)&&!f.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},f.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),f.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),f.nmd=e=>(e.paths=[],e.children||(e.children=[]),e),f.nc=void 0;var g={};(()=>{f.d(g,{hS:()=>te,KL:()=>Se,Yb:()=>X,Tg:()=>we,WH:()=>be,lV:()=>ve,ws:()=>zt,Jf:()=>ue,SK:()=>oe,tI:()=>se,Uy:()=>ne,SP:()=>ie,Jj:()=>ae,pt:()=>le,nN:()=>de,mk:()=>re,ex:()=>ge,Bq:()=>Mp,I7:()=>v,yx:()=>pe,qz:()=>he,KO:()=>fe});const e=(e=>{var t={};return f.d(t,e),t})({createApi:()=>r.createApi,createEffect:()=>r.createEffect,createEvent:()=>r.createEvent,createStore:()=>r.createStore,sample:()=>r.sample});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 h="en-US";class p{constructor(e=h){Object.defineProperty(this,"languageCode",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"countryCode",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"tag",{enumerable:!0,configurable:!0,writable:!0,value:void 0});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}`),h)}parseTag(e){const[t,r]=e.split("-");this.languageCode=t,this.countryCode=r.toUpperCase(),this.tag=`${this.languageCode}-${this.countryCode}`}}const v={apiKey:"",disableStatistic:!1,disableDeviceId:!1,lang:new p};var m=function(e,t){var r={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(r[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(i=Object.getOwnPropertySymbols(e);n<i.length;n++)t.indexOf(i[n])<0&&Object.prototype.propertyIsEnumerable.call(e,i[n])&&(r[i[n]]=e[i[n]])}return r};const y=(0,e.createStore)(v),b=(0,e.createEvent)();y.on(b,((e,t)=>{var{disableStatistic:r,disableDeviceId:i}=t,n=m(t,["disableStatistic","disableDeviceId"]);return Object.assign(Object.assign({disableStatistic:null!=r?r:e.disableStatistic,disableDeviceId:null!=i?i:e.disableDeviceId},n),{lang:new p(n.lang)})}));const w=(0,e.createEvent)();y.on(w,((e,{tags:t})=>Object.assign(Object.assign({},e),{tags:t})));const S=(0,e.createEvent)();y.on(S,((e,t)=>Object.assign(Object.assign({},e),t)));const _=(0,e.createEvent)();y.on(_,((e,{placeholders:t})=>Object.assign(Object.assign({},e),{placeholders:t})));const x=(0,e.createEvent)();y.on(x,((e,{imagePlaceholders:t})=>Object.assign(Object.assign({},e),{imagePlaceholders:t})));const O=(0,e.createEvent)();y.on(O,((e,{lang:t})=>Object.assign(Object.assign({},e),{lang:new p(t)})));const C=(0,e.createStore)(""),k=(0,e.createEvent)();(0,e.sample)({clock:k,target:C});const L=(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}),A=(0,e.createEffect)(),M=(0,e.createEvent)(),E=(0,e.createEvent)();L.on(E,(e=>{const t=Object.assign({},e);return t.session.id="",t}));const P=(0,e.createEffect)((e=>{K("session/update",e,(()=>{}))})).prepend((e=>({data:[[5,0,...e]]})));L.map((e=>e.storyWidgetsResources));var j=f(37);class I{static createFunctionWithTimeout(e,t){let r=!1;function i(){r||(r=!0,e())}return setTimeout(i,t||1e3),i}static convertModelToFormData(e,t,r){t instanceof Object&&Object.keys(t).forEach((i=>{const n=t[i];if(n instanceof Object&&!Array.isArray(n))return this.convertModelToFormData(e,n,i);r&&(i=`${r}[${i}]`),Array.isArray(n)?n.forEach((t=>{e.append(`${i}[]`,t)})):e.append(i,n)}))}}const T=e=>null==e;function R(e){const t=typeof e;return null!=e&&("object"===t||"function"===t)}function D(e,t){return Object.assign(Object.assign({},e),t)}function B(e){return e.replace(/^\//,"")}const N={baseUrl:"https://cdn.inappstory.ru",apiUrl:"https://api.inappstory.ru",faviconApiUrl:"https://favicon.inappstory.ru"};function F(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,r){return void 0===t?e:t.length>=e.length?t:r?(e+t).slice(-e.length):(t+e).substring(0,e.length)}(new Array(t%4).fill("=").join(""),e,!1),window.atob(e)}(e),r=t.charCodeAt(13);if(r>0){let e=t.substr(14,r);e=e.replace(/\0+$/,"");const i="{QQN{xuV?1Dv16j3";let n=i,s=0;for(;n.length<r;)n+=i[s],s++,s===i.length&&(s=0);let o="";for(let t=0;t<r;t++)o+=String.fromCharCode(e.charCodeAt(t)^n.charCodeAt(t));return new URL(`https://${o}`).host}}catch(e){console.error(e)}return null}function U(e){const t=F(e);if(null!=t){const e=t.split(".").slice(1);N.baseUrl=`https://${["cdn",...e].join(".")}`,N.faviconApiUrl=`https://${["favicon",...e].join(".")}`,N.apiUrl=`https://${t}`}}function V(e){let t=e.length;for(let r=e.length-1;r>=0;r--){const i=e.charCodeAt(r);i>127&&i<=2047?t++:i>2047&&i<=65535&&(t+=2),i>=56320&&i<=57343&&r--}return t}class z{constructor(){return Object.defineProperty(this,"_sdkConfigIsIncorrect",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_userIdByteLimit",{enumerable:!0,configurable:!0,writable:!0,value:255}),Object.defineProperty(this,"_tagsByteLimit",{enumerable:!0,configurable:!0,writable:!0,value:4e3}),Object.defineProperty(this,"userMessage",{enumerable:!0,configurable:!0,writable:!0,value:""}),Object.defineProperty(this,"tagsMessage",{enumerable:!0,configurable:!0,writable:!0,value:""}),z.instance||(z.instance=this),z.instance}static getInstance(){return z.instance?z.instance:new z}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&&V(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)&&V(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 G=f(1580),W=f.n(G);class $ extends Error{constructor(e,t,r){super(),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"networkStatus",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"networkMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.name=e,this.networkStatus=t,this.networkMessage=r,console.error({name:e,networkStatus:t,networkMessage:r})}static containErrorDataInResponse(e){const t=e.data;return t&&W()(t)&&null!=t.name&&null!=t.message&&null!=t.status}static createByRequestError(e){return $.containErrorDataInResponse(e)?new $(e.data.name,e.data.status,e.data.message):new $("networkError",null,"Invalid data in API response, data from response as json: "+JSON.stringify(e.data))}static createByFetchError(e){if(e.response&&e.response.status)return new $("networkError",e.response.status,e.response.statusText);{let t="";return window.navigator&&!window.navigator.onLine&&(t=" net::ERR_INTERNET_DISCONNECTED"),new $("error",null,e.toString()+t)}}}var H=function(e,t,r,i){return new(r||(r=Promise))((function(n,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}l((i=i.apply(e,t||[])).next())}))};const q=`InAppStoryWebSDK/${parseInt(3e4)} ${(e=>{let t="";for(let r=0;r<e.length;r++){t+=e.charCodeAt(r)<=255?e[r]:"?"}return t})(navigator.userAgent)}`;const Q=new class{constructor(){Object.defineProperty(this,"_deviceInfoPromise",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"_baseHeaders",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"requestInterceptors",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"interceptors",{enumerable:!0,configurable:!0,writable:!0,value:{request:{use:e=>{this.requestInterceptors.push(e)}}}})}set deviceInfoPromise(e){this._deviceInfoPromise=e}set baseHeaders(e){this._baseHeaders=e}get baseURL(){return`${N.apiUrl}/v2/`}request(e){return H(this,void 0,void 0,(function*(){return new Promise(((t,r)=>{const i=()=>H(this,void 0,void 0,(function*(){try{if(R(e.headers)&&null!=e.headers||(e.headers={}),e.headers=D(this._baseHeaders,e.headers),this.requestInterceptors.length)for(const t of this.requestInterceptors)t(e);let i="";!T(e.params)&&R(e.params)&&(i=new URLSearchParams(Object.entries(e.params)).toString());let n=new URL(`${B(e.url)}${i?"?"+i:""}`,this.baseURL),s="get";T(e.method)||(s=e.method);let o={};!T(e.headers)&&R(e.headers)&&(o=e.headers);let a=null;!T(e.data)&&R(e.data)&&(a=JSON.stringify(e.data),o["Content-Type"]="application/json");try{if(z.getInstance().sdkConfigIsIncorrect)return void t({data:{name:"SDK config is incorrect",message:z.getInstance().sdkConfigErrorsAsArray.join(". "),status:400},headersRaw:{},headers:{},status:400,statusText:"SDK config is incorrect",ok:!1})}catch(e){console.error(e)}const l=yield fetch(n.toString(),{method:s,body:a,headers:o,credentials:"omit"}),d={data:yield l.json(),headersRaw:l.headers,headers:Object.fromEntries([...l.headers]),status:l.status,statusText:l.statusText,ok:l.ok};if(!l.ok)return void r($.createByRequestError(d));t(d)}catch(e){r($.createByFetchError(e))}}));this._deviceInfoPromise?this._deviceInfoPromise.finally(i):i()}))}))}post(e,t){return H(this,arguments,void 0,(function*(e,t,r={}){return this.request({method:"post",url:e,data:t,params:r})}))}get(e,t){return H(this,void 0,void 0,(function*(){return this.request({method:"get",url:e,params:t})}))}};function K(e,t,r){var i,n,s;if("sendBeacon"in navigator){const o=new URLSearchParams({access_token:y.getState().apiKey,session_id:null===(n=null===(i=L.getState())||void 0===i?void 0:i.session)||void 0===n?void 0:n.id,x_user_agent:q}),a=y.getState();null!=a.appPackageId&&o.append("x_app_package_id",a.appPackageId);const l=`${s=Q.baseURL,s.replace(/\/$/,"")}/${B(e)}?${o.toString()}`,d=new FormData;Object.keys(t).forEach((e=>{I.convertModelToFormData(d,t[e],e)}));let c=!1;null!=Array.from&&null!=d.keys&&(c=0===Array.from(d.keys()).length),c||navigator.sendBeacon(l,d),r()}else Q.post(e,t).then((()=>r()),(()=>r()))}Q.interceptors.request.use((e=>{var t,r,i;const n=y.getState();return e.headers=D(null!==(t=e.headers)&&void 0!==t?t:{},{Authorization:`Bearer ${n.apiKey}`,"Accept-Language":n.lang.toString(),"Auth-Session-Id":null===(i=null===(r=L.getState())||void 0===r?void 0:r.session)||void 0===i?void 0:i.id,"X-User-Id":n.userId?n.userId:"","X-Request-Id":(0,j.v4)(),"X-User-Agent":q}),null!=n.appPackageId&&(e.headers["X-App-Package-Id"]=n.appPackageId),n.disableDeviceId||(e.headers["X-Device-Id"]=C.getState()),e}));const Y=Q;var Z;!function(e){e.UPDATE="update",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",e.EVENT_UPDATED_INAPPMESSAGING_WIDGET_OPTIONS="updatedInAppMessagingWidgetOptions"}(Z||(Z={}));Error;var X,J=f(46),ee=f.n(J);!function(e){e.LEFT="left",e.RIGHT="right",e.START="start",e.END="end"}(X||(X={}));const te={hasFavorite:!1,hasLike:!1,hasShare:!1,closeButtonPosition:X.END,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 re,ie,ne,se,oe,ae,le;!function(e){e.CENTER="center",e.LEFT="left",e.RIGHT="right",e.START="start",e.END="end"}(re||(re={})),function(e){e.CIRCLE="circle",e.QUAD="quad",e.RECTANGLE="rectangle"}(ie||(ie={})),function(e){e.LEFT="left",e.RIGHT="right",e.START="start",e.END="end",e.CENTER="center"}(ne||(ne={})),function(e){e.CARD_INSIDE_BOTTOM="cardInsideBottom",e.CARD_OUTSIDE_TOP="cardOutsideTop",e.CARD_OUTSIDE_BOTTOM="cardOutsideBottom"}(se||(se={})),function(e){e.Medium="medium",e.High="high"}(oe||(oe={})),function(e){e.COLUMN="vertical",e.ROW="horizontal"}(ae||(ae={})),function(e){e.START_LOADER="startLoad",e.END_LOADER="endLoad"}(le||(le={}));const de={direction:ae.ROW,card:{title:{font:'16px system-ui, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"',padding:10.6,textAlign:ne.START,position:se.CARD_INSIDE_BOTTOM,display:!0,lineClamp:4},gap:10,height:178,aspectRatio:null,coverQuality:oe.High,variant:ie.RECTANGLE,border:{radius:21,color:"black",width:2,gap:5},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:"Favorite",font:"normal",color:"white",padding:15,textAlign:ne.START,position:se.CARD_INSIDE_BOTTOM,display:!0,lineClamp:3},gap:10,height:70,aspectRatio:null,coverQuality:oe.High,coverLazyLoading:!1,variant:ie.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:re.START},navigation:{speed:300,showControls:!1,controlsSize:48,controlsBackgroundColor:"white",controlsColor:"black"},autoScrollOnStoryClose:!0,ugcCard:{title:{content:null,font:'16px system-ui, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"',color:"#000",padding:15,textAlign:ne.START,position:se.CARD_INSIDE_BOTTOM,display:!0,lineClamp:3},gap:10,height:70,aspectRatio:null,coverQuality:oe.High,coverLazyLoading:!1,variant:ie.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"}},ce={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}`},ue={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:ce,twitter:ce,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="30px" height="30px" 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>',doneState:'<svg width="30px" height="30px" fill="none" viewBox="0 0 386 264" xmlns="http://www.w3.org/2000/svg">\n<path d="m379.05 7.3156c8.855 8.8533 8.855 23.207 0 32.06l-210.67 210.67c-17.707 17.707-46.414 17.707-64.121 0l-97.319-97.319c-8.8531-8.855-8.8531-23.208 0-32.061 8.853-8.853 23.207-8.853 32.06 0l97.319 97.319 210.67-210.67c8.852-8.8531 23.206-8.8531 32.058 0z" clip-rule="evenodd" fill="currentColor" fill-rule="evenodd"/>\n</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 he;!function(e){e.FLAT="flat",e.COVER="cover",e.CUBE="cube"}(he||(he={}));const pe={gameReaderOptions:{loader:{default:{color:"white",accentColor:"transparent"},custom:null}},scrollStyle:he.FLAT,timelineBlockTopOffset:8,actionPanelBottomOffset:0,borderRadius:12,loader:{default:{color:"white",accentColor:"transparent"},custom:null},recycleStoriesList:!1,closeOnLastSlideByTimer:!0,sharePanel:ue,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 fe;!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"}(fe||(fe={}));const ge={title:{content:"Favorite",font:"1.4rem/1.2 InternalPrimaryFont",color:"white",backgroundColor:"#333333"},headerTopOffset:0,bottomOffset:0,backgroundColor:"#333333"};var ve,me=f(2743),ye=f.n(me);!function(e){e.DEFAULT="default",e.CUSTOM_CARD="customCard"}(ve||(ve={}));const be={goodsWidgetRenderingType:ve.DEFAULT,goodsList:{renderingType:ve.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"}}},we={borderRadius:5,loader:{default:{color:"white",accentColor:"transparent"},custom:null},backdropColor:"#1a1a1a",backdrop:{opacity:1,background:"#1a1a1a"},game:{backdropColor:"rgb(51, 51, 51)"},forceDesktopMode:te.forceDesktopMode,forceCheckOrientation:!0};class Se extends J.EventEmitter{constructor(){super(),Object.defineProperty(this,"_commonOptions",{enumerable:!0,configurable:!0,writable:!0,value:te}),Object.defineProperty(this,"_storiesListOptions",{enumerable:!0,configurable:!0,writable:!0,value:de}),Object.defineProperty(this,"_storyReaderOptions",{enumerable:!0,configurable:!0,writable:!0,value:pe}),Object.defineProperty(this,"_storyFavoriteReaderOptions",{enumerable:!0,configurable:!0,writable:!0,value:ge}),Object.defineProperty(this,"_goodsWidgetOptions",{enumerable:!0,configurable:!0,writable:!0,value:be}),Object.defineProperty(this,"_gameReaderOptions",{enumerable:!0,configurable:!0,writable:!0,value:we})}setCommonOptions(e,t=!0){return this._commonOptions=ye()(this._commonOptions,e),this.emit(Z.UPDATE,this.commonOptions),this}get commonOptions(){return this._commonOptions}setStoriesListOptions(e,t=!0){return this._storiesListOptions=ye()(this._storiesListOptions,e),t&&(this.emit(Z.UPDATE,this.storiesListOptions),this.emit(Z.EVENT_UPDATED_STORIES_LIST_OPTIONS,this.storiesListOptions)),this}get storiesListOptions(){return this._storiesListOptions}setStoryReaderOptions(e,t=!0){return this._storyReaderOptions=ye()(this._storyReaderOptions,e,{arrayMerge:(e,t,r)=>t}),t&&this.emit(Z.UPDATE,{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=ye()(this._storyFavoriteReaderOptions,e),t&&this.emit(Z.UPDATE,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=ye()(this._goodsWidgetOptions,e),t&&this.emit(Z.UPDATE,this.goodsWidgetOptions),this}get goodsWidgetOptions(){return this._goodsWidgetOptions}setGameReaderOptions(e,t=!0){return this._gameReaderOptions=ye()(this._gameReaderOptions,e),t&&this.emit(Z.UPDATE,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)}}class _e extends J.EventEmitter{constructor(e,t){super(),Object.defineProperty(this,"iframe",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"origin",{enumerable:!0,configurable:!0,writable:!0,value:t}),this.messageListener=this.messageListener.bind(this),window.addEventListener("message",this.messageListener,!1)}messageListener(e){if(e.origin!==this.origin)return;const[t,...r]=e.data;try{if(!Array.isArray(e.data))throw new Error(`Invalid MessageEvent data format ${e.data}`);this.emit(t,...r)}catch(e){console.error(e)}}sendMessage(e,t){var r;null===(r=this.iframe.contentWindow)||void 0===r||r.postMessage([e,t],this.origin)}pauseGameUI(){null==this||this.sendMessage("cb",{cb:"pauseUI",arguments:JSON.stringify([])})}resumeGameUI(){null==this||this.sendMessage("cb",{cb:"resumeUI",arguments:JSON.stringify([])})}shareComplete(e,t){this.sendMessage("shareComplete",{id:e,isSuccess:t})}closeGameReader(){this.sendMessage("closeGameReader")}initGame(e){this.sendMessage("cb",{cb:"initGame",arguments:JSON.stringify([e])})}sendGameCenterEventByApiRequest(e,t){this.sendMessage("cb",{cb:e,plainData:t})}notifyGameCanBeStarted(){this.sendMessage("gameShouldForeground")}destroy(){window.removeEventListener("message",this.messageListener,!1),this.removeAllListeners()}}class xe{constructor(e,t,r){Object.defineProperty(this,"userKey",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"gameInstanceId",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"instanceUserData",{enumerable:!0,configurable:!0,writable:!0,value:r})}set(e){return window.localStorage.setItem(this.key,JSON.stringify(e)),e}get(){var e;let t={};const r=W()(this.instanceUserData)?this.instanceUserData:{};try{const r=JSON.parse(null!==(e=window.localStorage.getItem(this.key))&&void 0!==e?e:"{}");W()(r)&&(t=r)}catch(e){console.error(e)}return ye()(t,r)}get key(){return`game_instance_data_${this.userKey}_${this.gameInstanceId}`}}class Oe{constructor(e,t){Object.defineProperty(this,"gameCenterMessageService",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"gameReaderViewModel",{enumerable:!0,configurable:!0,writable:!0,value:t})}handle(e){const{id:t,callback:r}=JSON.parse(e),i=this.gameReaderViewModel.gameLaunch;if(!i)return;const n=new xe(i.clientConfig.userKey,i.config.gameInstanceId,i.instanceUserData).get();this.gameCenterMessageService.sendMessage("cb",{cb:r,arguments:JSON.stringify([t,JSON.stringify(n)])})}}var Ce=f(3142),ke=f.n(Ce);const Le=(0,e.createStore)({default:{},user:{}}),{sdkImagePlaceholdersChanged:Ae,addDefaultImagePlaceholders:Me}=(0,e.createApi)(Le,{sdkImagePlaceholdersChanged:(e,t)=>({default:e.default,user:t}),addDefaultImagePlaceholders:(e,t)=>{let r={default:{},user:e.user};return ke()(t)&&t.forEach((e=>{W()(e)&&void 0!==e.name&&void 0!==e.default_value&&(r.default[e.name]=e.default_value)})),r}}),Ee=(0,e.createStore)({default:{},user:{}}),{sdkPlaceholdersChanged:Pe,addDefaultPlaceholders:je}=(0,e.createApi)(Ee,{sdkPlaceholdersChanged:(e,t)=>({default:e.default,user:t}),addDefaultPlaceholders:(e,t)=>{let r={default:{},user:e.user};return ke()(t)&&t.forEach((e=>{W()(e)&&void 0!==e.name&&void 0!==e.default_value&&(r.default[e.name]=e.default_value)})),r}});var Ie,Te,Re,De,Be,Ne;!function(e){e.direct="direct",e.onboarding="onboarding",e.list="list",e.favorite="favorite"}(Ie||(Ie={})),function(e){e[e.default=0]="default",e[e.favorite=1]="favorite",e[e.stacked=2]="stacked"}(Te||(Te={})),function(e){e[e.default=0]="default",e[e.onboarding=1]="onboarding",e[e.favorite=2]="favorite",e[e.direct=3]="direct"}(Re||(Re={})),function(e){e.list="list",e.favorite="favorite"}(De||(De={})),function(e){e.CLICK_ON_STORY="clickOnStoryLink"}(Be||(Be={})),function(e){e.TEXT="text",e.IMAGE="image"}(Ne||(Ne={}));const Fe=Object.prototype.hasOwnProperty,Ue=()=>{const e=Ee.getState(),t=Le.getState(),r=[],i={};for(let t in e.default)Fe.call(e.default,t)&&(i[t]={type:Ne.TEXT,name:t,value:e.default[t]});for(let t in e.user)Fe.call(e.user,t)&&(i[t]={type:Ne.TEXT,name:t,value:e.user[t]});for(let e in i)Fe.call(i,e)&&r.push(i[e]);const n={};for(let e in t.default)Fe.call(t.default,e)&&(n[e]={type:Ne.IMAGE,name:e,value:t.default[e]});for(let e in t.user)Fe.call(t.user,e)&&(n[e]={type:Ne.IMAGE,name:e,value:t.user[e]});for(let e in n)Fe.call(n,e)&&r.push(n[e]);return r},Ve=(0,e.createStore)({style:"",widgetsData:{}}),ze=(0,e.createEffect)(),Ge=(0,e.createEffect)();var We;!function(e){e[e.DEFAULT=0]="DEFAULT",e[e.UGC=1]="UGC"}(We||(We={}));const $e=e=>({id:e,type:We.DEFAULT,title:null,title_color:null,background:{},background_color:null,image:null,display_to:null,display_from:null,favorite:null,like:null,deeplink:null,hide_in_reader:null,hide_timeline:!1,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,game_instance:{id:null},share_url:null,slidesLoaded:!1,error:null,slides_count:0,slides:[]}),He=(0,e.createStore)({}),qe=(0,e.createStore)({default:[]}),Qe=qe.map((e=>e[L.getState().user_key||"default"]||[]));var Ke;!function(e){e.FEEDS="feeds",e.FAVORITE="favorite"}(Ke||(Ke={}));const Ye=(0,e.createStore)({default:{[Ke.FEEDS]:{},[Ke.FAVORITE]:[]}}),Ze=Ye.map((e=>e[L.getState().user_key||"default"]||{})),Xe=(0,e.createStore)({}),Je=(0,e.createStore)({}),et=(0,e.createStore)([]),tt=(e,t)=>e.map((e=>t.find((t=>t.id===e)))).filter((e=>!!e));Xe.on([Ze,Qe],((e,t)=>{const r=Ze.getState(),i=Qe.getState();return((e,t)=>{const r={};for(const[i,n]of Object.entries(e))r[i]=tt(n,t);return r})(r[Ke.FEEDS],i)})),Je.on([Ze,Qe],((e,t)=>{const r=Ze.getState(),i={};for(const e in r[Ke.FEEDS])if("onboarding_"===e.substring(0,11)){const t=e.substring(11);if(i[t]=[],r[Ke.FEEDS][e]&&Array.isArray(r[Ke.FEEDS][e])){const n={};Qe.getState().filter((e=>!e.is_opened)).forEach((e=>{n[e.id]=e})),i[t]=r[Ke.FEEDS][e].filter((e=>n[e])).map((e=>n[e]))}}return i})),et.on([Ze,Qe],((e,t)=>{var r;const i=null!==(r=Ze.getState()[Ke.FAVORITE])&&void 0!==r?r:[],n={};return Qe.getState().forEach((e=>{n[e.id]=e})),i.map((e=>n[e]))}));const rt=(e,t="")=>e.is_opened,{storyItemFavoriteChanged:it,storyItemLikeChanged:nt,storyItemIsOpenedChanged:st}=(Qe.map((e=>{const t={};return t[We.DEFAULT]=e.filter((e=>!e.slidesLoaded&&e.type===We.DEFAULT)).map((e=>e.id)),t[We.UGC]=e.filter((e=>!e.slidesLoaded&&e.type===We.UGC)).map((e=>e.id)),t})),Object.prototype.hasOwnProperty,(0,e.createApi)(qe,{storyItemFavoriteChanged:(e,{id:t,favorite:r})=>{const i=L.getState().user_key||"default",n=(e[i]||[]).slice(0),s=n.find((e=>e.id===t));return void 0!==s&&(s.favorite=r),Object.assign(Object.assign({},e),{[i]:n})},storyItemLikeChanged:(e,{id:t,like:r})=>{const i=L.getState().user_key||"default",n=(e[i]||[]).slice(0),s=n.find((e=>e.id===t));return void 0!==s&&(s.like=r),Object.assign(Object.assign({},e),{[i]:n})},storyItemIsOpenedChanged:(e,{id:t})=>{const r=L.getState().user_key||"default",i=(e[r]||[]).slice(0),n=i.find((e=>e.id===t));return void 0!==n&&(n.is_opened=!0),Object.assign(Object.assign({},e),{[r]:i})}}));var ot=f(4871),at=f.n(ot);let lt,dt=!0;function ct(e){lt(e),dt=e}function ut(){return lt(dt),dt}lt=function(){};class ht{constructor(){Object.defineProperty(this,"__lastUpdated",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"_receiveTime",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"_serverTimestamp",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"rawData",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"myDictionary",{enumerable:!0,configurable:!0,writable:!0,value:{}})}get receiveTime(){return this._receiveTime}singleModelWrapper(){return""}attributes(){return["__lastUpdated"]}static prepareFromResponse(){}setAttributes(e){const t=this.attributes();let r=this;for(let i in e){let n=e[i];-1!==t.indexOf(i)&&(r[i]=n)}}static createInstance(e,t){const r=new e;let i=t;return""!==r.singleModelWrapper()&&void 0!==t[r.singleModelWrapper()]&&(i=t[r.singleModelWrapper()]),r.rawData=t,r.setAttributes(i),r._receiveTime=(new Date).getTime(),void 0!==t.server_timestamp&&(r._serverTimestamp=t.server_timestamp),r}static _fetch(e,t,r,i="get"){return new Promise(((n,s)=>{let o={url:t,method:i};-1!==["post","put","path"].indexOf(i)?o.data=r:o.params=r;Y.request(o).then((function(t){let r,i;r=t.data,r&&(r.__lastUpdated=Date.now()),i=ht.createInstance(e,r),n(i)})).catch(s)}))}static _fetchList(e,t,r){return new Promise(((i,n)=>{Y.get(t,{params:r}).then((function(t){const r=t.data;let n=[];r.forEach((t=>{n.push(ht.createInstance(e,t))}));let s={models:n,totalCount:Number(t.headers["x-pagination-total-count"]),currentPage:Number(t.headers["x-pagination-current-page"])};i(s)})).catch(n)}))}static emitEvent({type:e,event:t,eventData:r}){return new Promise(((i,n)=>{Y.post(`${e}/event/${t}`,r).then((function(e){const t=e.data;i(t)})).catch(n)}))}static update(e,t,r="post"){let i={url:e,method:r};return-1!==["post","put","path"].indexOf(r)?i.data=t:i.params=t,new Promise(((e,t)=>{Y.request(i).then((function(t){let r;r=t.data,e(r)})).catch(t)}))}}var pt;!function(e){e[e.BottomSheet=1]="BottomSheet",e[e.Modal=2]="Modal",e[e.Fullscreen=3]="Fullscreen"}(pt||(pt={}));const ft=(e,t)=>{let r=[];switch(e){case Re.default:r=t?Xe.getState()[t]:[];break;case Re.favorite:r=et.getState();break;case Re.onboarding:r=t?Je.getState()[t]:[];break;case Re.direct:r=Qe.getState()}return null!=r?r:[]},gt="{{__ugc__}}",vt=e=>e===gt?We.UGC:We.DEFAULT,mt=e=>({windowReferer:Te.default,listType:Re.direct,id:e.id,storyContext:Ve.getState(),storyList:[e],hasShare:L.getState().share,placeholders:Ue()}),yt=e=>"{{__ugc__}}"===e?We.UGC:We.DEFAULT;var bt=function(e,t,r,i){return new(r||(r=Promise))((function(n,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}l((i=i.apply(e,t||[])).next())}))};var wt=function(e,t,r,i){return new(r||(r=Promise))((function(n,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}l((i=i.apply(e,t||[])).next())}))};const St=(e,t)=>wt(void 0,void 0,void 0,(function*(){const e=yield(r={data:t},bt(void 0,void 0,void 0,(function*(){var e,t,i,n,s,o,a,l,d;let c=!1,u="",h={url:null!==(t=null===(e=r.data)||void 0===e?void 0:e.url)&&void 0!==t?t:"",method:null!==(n=null===(i=r.data)||void 0===i?void 0:i.method)&&void 0!==n?n:"get"};-1!==["post","put","path"].indexOf(null===(s=r.data)||void 0===s?void 0:s.method)?h.data=null!==(a=null===(o=r.data)||void 0===o?void 0:o.data)&&void 0!==a?a:void 0:h.params=null!==(d=null===(l=r.data)||void 0===l?void 0:l.params)&&void 0!==d?d:void 0;const p={requestId:r.id};try{const e=yield Y.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:r.cb,payload:{requestId:r.id,success:c,data:p,err:u}}})));var r;if(e.payload.success)return e.payload.data;throw e.payload.err}));class _t{constructor(){Object.defineProperty(this,"rawData",{enumerable:!0,configurable:!0,writable:!0,value:{}})}singleModelWrapper(){return""}attributes(){return[]}setAttributes(e){const t=this.attributes();let r=this;for(let i in e){let n=e[i];-1!==t.indexOf(i)&&(r[i]=n)}}static createInstance(e,t){const r=new e;let i=t;return""!==r.singleModelWrapper()&&void 0!==t[r.singleModelWrapper()]&&(i=t[r.singleModelWrapper()]),r.rawData=t,r.setAttributes(i),r}}var xt=function(e,t,r,i){return new(r||(r=Promise))((function(n,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}l((i=i.apply(e,t||[])).next())}))};class Ot extends _t{static save(e,t,r){return xt(this,void 0,void 0,(function*(){try{return{data:(yield r("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:[{}]}}}))}}class Ct{constructor(e,t){Object.defineProperty(this,"gameCenterMessageService",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"gameReaderViewModel",{enumerable:!0,configurable:!0,writable:!0,value:t})}handle(e){const{gameInstanceId:t,data:r}=JSON.parse(e),i=this.gameReaderViewModel.gameLaunch;if(!i)return;const n=new xe(i.clientConfig.userKey,i.config.gameInstanceId,i.instanceUserData).set(r);Ot.save(this.gameReaderViewModel.gameInstanceId,JSON.stringify(n),St)}}var kt=function(e,t,r,i){return new(r||(r=Promise))((function(n,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}l((i=i.apply(e,t||[])).next())}))};var Lt;!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"}(Lt||(Lt={}));var At,Mt=function(e,t,r,i){return new(r||(r=Promise))((function(n,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}l((i=i.apply(e,t||[])).next())}))};!function(e){e.Social="social",e.SlideScreenshot="slide-screenshot"}(At||(At={}));class Et{constructor(e,t,r){Object.defineProperty(this,"gameCenterMessageService",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"gameReaderViewModel",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"desktopMode",{enumerable:!0,configurable:!0,writable:!0,value:r})}handle(e,t){return Mt(this,void 0,void 0,(function*(){var r,i,n;let s=null!==(r=null==t?void 0:t.url)&&void 0!==r?r:t.text,o=[];t.files&&Array.isArray(t.files)&&t.files.length>0&&(o=yield Promise.all(t.files.map((e=>(e=>kt(void 0,[e],void 0,(function*({file:e,name:t,type:r}){const i=yield fetch(`data:${r};base64,${e}`),n=yield i.blob();return new File([n],t,{type:r,lastModified:(new Date).getTime()})})))(e)))));const a={url:null!=s?s:void 0,files:o.length>0?o:void 0,text:null!==(i=t.text)&&void 0!==i?i: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:r}){let i=At.Social,n=t;e.files&&e.files.length>0&&(i=At.SlideScreenshot,n=URL.createObjectURL(e.files[0])),this.gameReaderViewModel.emit(Lt.OpenSharePanel,{shareId:r,shareType:i,shareLink:n})}}class Pt{constructor(e){Object.defineProperty(this,"storyId",{enumerable:!0,configurable:!0,writable:!0,value: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 jt{constructor(e,t){Object.defineProperty(this,"gameCenterMessageService",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"gameReaderViewModel",{enumerable:!0,configurable:!0,writable:!0,value:t})}handle(e){const t=JSON.parse(e);if(!W()(t))return;const{id:r,storyId:i,callback:n}=t;let s=new Pt(i).get();this.gameCenterMessageService.sendMessage("cb",{cb:n,arguments:JSON.stringify([r,JSON.stringify(s)])})}}class It extends _t{static sentData(e,t,r){return new Promise((i=>{r("apiRequest",{url:"story-data/"+e,method:"put",params:null,data:t,headers:null}).then((e=>{i({data:e.data,status:200,headers:[{}]})})).catch((e=>{i({data:e,status:400,headers:[{}]})}))}))}static sendApiRequest({url:e,method:t,params:r,headers:i,data:n,profilingKey:s},o){return new Promise((s=>{o("apiRequest",{url:e,method:t,params:r,data:n,headers:i}).then((e=>{s({data:e.data,status:200,headers:[{}]})})).catch((e=>{s({data:e,status:400,headers:[{}]})}))}))}static sendApiRequestPromise(e,t,r){const{id:i,url:n,method:s,params:o,headers:a,data:l,cb:d}=JSON.parse(e);return r("apiRequest",{url:n,method:s,params:o,data:l,headers:a}).then((e=>{let r=JSON.stringify({requestId:i,data:JSON.stringify(e.data),status:e.status,headers:e.headers});t(d,r)}),(e=>{let r=JSON.stringify({requestId:i,data:JSON.stringify(e),status:400,headers:[{}]});t(d,r)}))}}class Tt{constructor(){}handle(e){const t=JSON.parse(e);if(!W()(t))return;const{storyId:r,data:i,sendToServer:n}=t;new Pt(r).set(i),n&&It.sentData(r,JSON.stringify(i),St)}}var Rt=f(3655),Dt=f.n(Rt),Bt=f(8138),Nt=f.n(Bt),Ft=f(986),Ut=f.n(Ft);class Vt extends J.EventEmitter{}var zt,Gt,Wt=function(e,t,r,i){return new(r||(r=Promise))((function(n,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}l((i=i.apply(e,t||[])).next())}))};class $t{constructor(){Object.defineProperty(this,"viewModels",{enumerable:!0,configurable:!0,writable:!0,value:new Map}),Object.defineProperty(this,"observersByKey",{enumerable:!0,configurable:!0,writable:!0,value:new Map})}set(e,t){this.viewModels.set(e,t),this.notifyViewModelSet(e)}get(e){return this.viewModels.get(e)}wait(e){return Wt(this,void 0,void 0,(function*(){const t=this.viewModels.get(e);return t||new Promise((t=>{let r=this.observersByKey.get(e);r||(r=[]);const i=()=>{const n=this.viewModels.get(e);if(!n)throw new Error;r.splice(r.indexOf(i),1),t(n)};r.push(i),this.observersByKey.set(e,r)}))}))}getAll(){return Array.from(this.viewModels.values())}getAllOfType(e){return Array.from(this.viewModels.values()).filter(e)}has(e){return this.viewModels.has(e)}delete(e){this.viewModels.delete(e)}clear(){this.viewModels.clear()}notifyViewModelSet(e){var t;null===(t=this.observersByKey.get(e))||void 0===t||t.forEach((e=>e()))}}class Ht{constructor(e){Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:e})}createStoryReader(){return new Mo(this.storyManager).create()}createGameReader(){return new Ba(this.storyManager).create()}createStoryList(){return new Vo(this.storyManager).create()}}!function(e){e.START_LOADING="startLoading",e.END_LOADING="endLoading",e.CLOSE_STORY_READER="closeStoryReader"}(zt||(zt={}));class qt extends Vt{constructor(e,t){super(),Object.defineProperty(this,"storyListViewModel",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"story",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"id",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"title",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"titleColor",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"magazineName",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"backgroundColor",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"background",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"favorite",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"like",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"deeplink",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"hideInReader",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"gameInstance",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"hasAudio",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"isFavoriteCard",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"isUgcCard",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"isOpened",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"image",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"videoCoverSrc",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"videoCover",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),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}getAspectRatio(e){var t,r;switch(e){case fe.STYLE_CIRCLE:case fe.STYLE_QUAD:return 1;case fe.STYLE_RECTANGLE:return null!==(r=null===(t=this.storyListViewModel.session)||void 0===t?void 0:t.preview_aspect_ratio)&&void 0!==r?r:.8;default:return 1}}getImageSrcByCoverQuality(e){var t,r;return null===(r=null===(t=this.story.image)||void 0===t?void 0:t.findOneByCoverQuality(e))||void 0===r?void 0:r.url}onClick(e){this.storyListViewModel.onStoryClick(this,e)}destroy(){}}class Qt extends qt{constructor(e,t){super(e,t)}getImageSrcByCoverQuality(e){var t,r;return null===(r=null===(t=this.story.image)||void 0===t?void 0:t.findOneByCoverQuality(e))||void 0===r?void 0:r.url}}!function(e){e.STORY_LIST="storyList",e.STORY_READER="storyReader",e.GAME_READER="gameReader",e.STACK_STORY_LIST="stackStoryList"}(Gt||(Gt={}));class Kt{constructor(e,t){Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"statisticsService",{enumerable:!0,configurable:!0,writable:!0,value:t})}handle(e){var t;e.dataForSending=ut()?{data:this.statisticsService.getData()}:null;const r=()=>this.storyManager.clickOnButtonAction({src:Gt.STORY_READER,payload:e});!(null===(t=this.storyManager.getConfig())||void 0===t?void 0:t.disableStatistic)&&e.dataForSending&&W()(e.dataForSending)&&Array.isArray(e.dataForSending.data)&&e.dataForSending.data.length>0?(this.statisticsService.cleanupData(),K("session/update",e.dataForSending,r)):r()}}class Yt{constructor(e){Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:e})}handle(e,t,r){var i,n;const s=r.listType,o=null!==(i=r.feedSlug)&&void 0!==i?i:"",a=r.filter,l=yt(o),d={title:null,tags:[],slidesCount:null,feed:null,filter:null,source:null},c=Qe.getState().find((e=>e.id===t.id));if(c&&(d.title=c.stat_title,d.tags=c.tags,d.slidesCount=c.slides_count,c.type===We.UGC&&(d.ugcPayload=W()(c.payload)?c.payload:{})),l===We.DEFAULT?d.feed=o:l===We.UGC&&(d.filter=a),s===Re.direct?d.source=Ie.direct:s===Re.default?d.source=Ie.list:s===Re.onboarding?d.source=Ie.onboarding:s===Re.favorite&&(d.source=Ie.favorite),null!=t.index&&-1===["clickOnStory","showStory"].indexOf(e)){t.payload=null;const e=null===(n=null==c?void 0:c.slides[t.index])||void 0===n?void 0:n.event_payload;(null==e?void 0:e.payload)&&(t.payload=e.payload)}this.storyManager.emit(e,Object.assign(Object.assign({},t),d))}}function Zt(e,t,r){return String(e).replace(new RegExp(function(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(t),"g"),(()=>r))}const Xt=()=>null!==f.nc&&void 0!==f.nc?f.nc:"";class Jt extends _t{attributes(){return["width","height","type","url"]}constructor(){super(),Object.defineProperty(this,"width",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"height",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"type",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_url",{enumerable:!0,configurable:!0,writable:!0,value:""})}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://")}}var er=f(3981),tr=f.n(er);class rr{constructor(){Object.defineProperty(this,"images",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"color",{enumerable:!0,configurable:!0,writable:!0,value:""}),Object.defineProperty(this,"gradient",{enumerable:!0,configurable:!0,writable:!0,value:!1})}static createFromArray(e){const t=new rr;for(let r in e)e.hasOwnProperty(r)&&t.images.push(Jt.createInstance(Jt,e[r]));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){var r;let i=null;return this.images.forEach((t=>{t.width===e&&(i=t)})),null!==i?i:(i=null!==(r=tr()(this.images))&&void 0!==r?r:null,t&&null!=i?i:null)}mapCoverQualityToImageType(e){switch(e){case oe.Medium:return"m";case oe.High:return"h"}}}class ir extends _t{constructor(){super(...arguments),Object.defineProperty(this,"_title",{enumerable:!0,configurable:!0,writable:!0,value:""}),Object.defineProperty(this,"title_color",{enumerable:!0,configurable:!0,writable:!0,value:""}),Object.defineProperty(this,"magazine_name",{enumerable:!0,configurable:!0,writable:!0,value:""}),Object.defineProperty(this,"is_opened",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"background",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"background_color",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"id",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"slides_count",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"_slides",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"source",{enumerable:!0,configurable:!0,writable:!0,value:""}),Object.defineProperty(this,"favorite",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"like",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"deeplink",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"hide_in_reader",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"blank",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"disable_close",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"share_url",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"like_functional",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"favorite_functional",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"share_functional",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"need_placeholders",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"game_instance",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"hide_timeline",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"tags",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"has_audio",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"has_placeholder",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"has_swipe_up",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_placeholders",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"favorite_cell",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"ugc_card_cell",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"slidesLoaded",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"error",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"_image",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_parsedSlideImage",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"_video_cover",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"_videoCoverSrc",{enumerable:!0,configurable:!0,writable:!0,value:null})}attributes(){return at()(super.attributes(),["title","title_color","source","magazine_name","background","background_color","id","image","display_to","display_from","favorite","like","deeplink","hide_in_reader","hide_timeline","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","slides","slides_count","slidesLoaded","error"])}set image(e){this._image=rr.createFromArray(e)}get image(){return this._image}imagePerSlide(e){var t,r;return this.parseHtmlSlidesForMainImage(),null!==(r=null===(t=this._parsedSlideImage)||void 0===t?void 0:t[e])&&void 0!==r?r:null}parseHtmlSlidesForMainImage(){!this._parsedSlideImage&&this.slides_count&&(this._parsedSlideImage=this.slides.map((e=>this.parseSlideNarrativeImageSrc(e.html)||this.parseSlideNarrativeVideoPosterSrc(e.html)||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=rr.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 ir.placeholders)ir.placeholders.hasOwnProperty(t)&&(e=Zt(e,`%${t}%`,ir.placeholders[t]));this.rawData.title=e,this._title=e}get slides(){return this._slides}set slides(e){var t;for(const r of e)r.html=Zt(r.html,"{{nonce}}",null!==(t=Xt())&&void 0!==t?t:"");this._slides=e}get isOpened(){return this.is_opened}set isOpened(e){this.is_opened=e,this.rawData.is_opened=e}}Object.defineProperty(ir,"placeholders",{enumerable:!0,configurable:!0,writable:!0,value:{}});const nr=ir,sr=f(4871);class or extends _t{constructor(){super(...arguments),Object.defineProperty(this,"style",{enumerable:!0,configurable:!0,writable:!0,value:""}),Object.defineProperty(this,"widgetsData",{enumerable:!0,configurable:!0,writable:!0,value:{}})}attributes(){return sr(super.attributes(),["style","widgetsData"])}}const ar=new J.EventEmitter;ar.setMaxListeners(50);const lr=(0,e.createStore)({uiPaused:!1,timerPaused:!1,locked:!1,closeGestureInAction:!1}),dr=lr.map((e=>e.uiPaused)),cr=lr.map((e=>e.timerPaused)),ur=(0,e.createStore)(!1),hr=(0,e.createStore)(!0),pr=(0,e.createStore)(!0),fr=(0,e.createEvent)(),gr=(0,e.createEvent)(),vr=(0,e.createEvent)(),mr=(0,e.createEvent)(),yr=(0,e.createEvent)(),br=(0,e.createEvent)(),wr=(0,e.createEvent)(),Sr=(0,e.createEvent)(),_r=(0,e.createEvent)(),xr=(0,e.createEvent)(),Or=(0,e.createEvent)(),Cr=(0,e.createEvent)(),kr=(0,e.createEvent)(),Lr=(0,e.createEvent)(),Ar=t=>(0,e.sample)({source:lr,clock:t,filter:e=>!e.locked}),Mr=Ar(wr),Er=Ar(Sr),Pr=Ar(_r),jr=Ar(xr);lr.on(Pr,(e=>Object.assign(Object.assign({},e),{uiPaused:!0,timerPaused:!0}))).on(jr,(e=>Object.assign(Object.assign({},e),{uiPaused:!1,timerPaused:!1}))).on(Mr,(e=>e.timerPaused?e:Object.assign(Object.assign({},e),{timerPaused:!0}))).on(Er,(e=>e.timerPaused?Object.assign(Object.assign({},e),{timerPaused:!1}):e)).on(Or,(e=>Object.assign(Object.assign({},e),{uiPaused:!0,timerPaused:!0,locked:!0}))).on(Cr,(e=>Object.assign(Object.assign({},e),{uiPaused:!1,timerPaused:!1,locked:!1}))).on(kr,(e=>Object.assign(Object.assign({},e),{timerPaused:!0,locked:!0}))).on(Lr,(e=>Object.assign(Object.assign({},e),{timerPaused:!1,locked:!1}))),ur.on(fr,(e=>!0)).on(gr,(e=>!1)),hr.on(vr,(()=>!0)).on(mr,(()=>!1)),pr.on(yr,(()=>!0)).on(br,(()=>!1));const Ir={id:"",isOpened:!1,type:At.Social,link:""},Tr=(0,e.createStore)(Ir),Rr=Tr.map((e=>e.isOpened)),Dr=(0,e.createEvent)(),Br=(0,e.createEvent)();Tr.on(Dr,((e,t)=>Object.assign(Object.assign({},e),{link:t.link,type:t.type,text:t.text,id:t.id,isOpened:!0}))).on(Br,(e=>Ir));class Nr extends(ee()){constructor(e){super(),Object.defineProperty(this,"story",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"layersContainer",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"animationApi",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_activeLayer",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"initialLayer",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"layers",{enumerable:!0,configurable:!0,writable:!0,value:[]})}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"))),this.initialLayer=this._activeLayer}reset(){var e;this.hideAllLayers(),null===(e=this.initialLayer)||void 0===e||e.classList.remove("hidden")}get activeLayer(){return this._activeLayer}getLayers(){return this.layers}hideLayer(e){e.classList.contains("hidden")||(this.animationApi.stop(e,!0),e.classList.add("hidden"),this.emit("hideLayer",{layer:e}))}showLayer(e){this.startTimer(),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 r=t[e];r&&this.showLayer(r)}hasValidMultiSlides(){let e=!0,t=this.layersContainer.querySelectorAll(".narrative-slide.narrative-multi-slide");const r=this.layersContainer.querySelectorAll(".narrative-slide.narrative-multi-slide:not(.hidden)");return t.length>0&&0===r.length&&(e=!1),e}startTimer(){var e;this.story.timer.start(null!==(e=this.story.activeSlide.duration)&&void 0!==e?e:0)}}const Fr=function(){const e={step:1,maxSteps:100};var t=Object.prototype.hasOwnProperty;return function(i,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(i);"[object Array]"!==a&&"[object NodeList]"!==a&&"[object HTMLCollection]"!==a&&(i=[i]);for(var l=0;l<i.length;l++)r(i[l],s)};function r(e,t){if(!i(e)||e.getAttribute("textFitted"))return!1;var r,n,s,o;if(!i(n=e.parentElement))return!1;if(r=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),r<=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>r))break;l-=a,e.style.fontSize=l+"px"}}}function i(e){return"object"==typeof HTMLElement?e instanceof HTMLElement:e&&"object"==typeof e&&null!==e&&1===e.nodeType&&"string"==typeof e.nodeName}}();var Ur=function(e,t,r,i){return new(r||(r=Promise))((function(n,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}l((i=i.apply(e,t||[])).next())}))};class Vr{constructor(e){Object.defineProperty(this,"videoEl",{enumerable:!0,configurable:!0,writable:!0,value:e}),this.parseDefaultMuted()}get $video(){return this.videoEl}get muted(){return this.videoEl.muted}get paused(){return this.videoEl.paused}start(){return Ur(this,void 0,void 0,(function*(){this.videoEl.pause(),this.videoEl.currentTime=0,yield this.play()}))}play(){return Ur(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 Ur(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 Ur(this,arguments,void 0,(function*(e=!0){return new Promise((t=>{const r=this.videoEl.oncanplaythrough?"canplaythrough":"canplay";this.videoEl.addEventListener(r,(()=>{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}destroy(){return Ur(this,void 0,void 0,(function*(){return Promise.resolve()}))}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"))}}const zr=(e=>{var t={};return f.d(t,e),t})({Player:()=>i.Player});var Gr=function(e,t,r,i){return new(r||(r=Promise))((function(n,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}l((i=i.apply(e,t||[])).next())}))};class Wr extends Vr{constructor(e){super(e),Object.defineProperty(this,"player",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_vodData",{enumerable:!0,configurable:!0,writable:!0,value:null}),this.handlePlayerError=this.handlePlayerError.bind(this),this._vodData=Wr.parseData(e)}get vodData(){return this._vodData}static get isBrowserSupported(){return zr.Player.isBrowserSupported()}load(){const e=Object.create(null,{load:{get:()=>super.load}});return Gr(this,void 0,void 0,(function*(){try{Wr.isBrowserSupported?(this.disableVideoPreload(),yield this.initPlayer()):(this.updateVideoSources(),yield e.load.call(this),console.error("[VOD]: Browser not supported!"))}catch(e){throw this.handlePlayerError({detail:e}),e}}))}destroy(){return Gr(this,void 0,void 0,(function*(){var e;this.stop(),null===(e=this.player)||void 0===e||e.removeEventListener("error",this.handlePlayerError),yield this.detachVideoElement(),yield this.player.destroy()}))}static parseData(e){const t=e.getAttribute("data-vod");try{return t&&JSON.parse(t)}catch(e){return null}}initPlayer(){return Gr(this,void 0,void 0,(function*(){this.player=new zr.Player,this.player.addEventListener("error",this.handlePlayerError),yield this.attachVideoElement(),yield this.loadVideo(),yield this.play(),this.stop()}))}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){this.detachVideoElement().catch(console.error);const t=e.detail,r=`[VOD]: error code ${t.code}; object ${t}`;console.error(r)}attachVideoElement(){return Gr(this,void 0,void 0,(function*(){yield this.player.attach(this.videoEl),lt("[VOD]: video element attached",this.videoEl)}))}loadVideo(){return Gr(this,void 0,void 0,(function*(){const e=zr.Player.convertJsonToUri(this.vodData);yield this.player.load(e,0,"application/json"),lt(`[VOD]: video ${e} successful loaded`)}))}detachVideoElement(){return Gr(this,void 0,void 0,(function*(){yield this.player.detach(this.videoEl),lt("[VOD]: video element detached",this.videoEl)}))}}var $r=function(e,t,r,i){return new(r||(r=Promise))((function(n,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}l((i=i.apply(e,t||[])).next())}))};class Hr{constructor(){Object.defineProperty(this,"videos",{enumerable:!0,configurable:!0,writable:!0,value:[]})}init(e){return $r(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 $r(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 $r(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()}destroy(){return $r(this,void 0,void 0,(function*(){for(const e of this.videos)yield e.destroy()}))}createVideoByElement(e){return Wr.parseData(e)?new Wr(e):new Vr(e)}}var qr=function(e,t,r,i){return new(r||(r=Promise))((function(n,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}l((i=i.apply(e,t||[])).next())}))};class Qr{constructor(e){Object.defineProperty(this,"layerManager",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"videoContexts",{enumerable:!0,configurable:!0,writable:!0,value:new Map}),Object.defineProperty(this,"muted",{enumerable:!0,configurable:!0,writable:!0,value:!1}),this.handleShowLayer=this.handleShowLayer.bind(this),this.handleHideLayer=this.handleHideLayer.bind(this),this.subscribeLayerManager()}init(){return qr(this,void 0,void 0,(function*(){for(const e of this.layerManager.getLayers()){const t=new Hr;yield t.init(e),this.videoContexts.set(e,t)}}))}start(){return qr(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 qr(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()}destroy(){return qr(this,void 0,void 0,(function*(){for(const e of this.videoContexts.values())yield e.destroy();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 Kr=function(e,t,r,i){return new(r||(r=Promise))((function(n,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}l((i=i.apply(e,t||[])).next())}))};class Yr{constructor(e){Object.defineProperty(this,"videoContainer",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"videoContext",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.videoContext=new Hr}init(){return Kr(this,void 0,void 0,(function*(){yield this.videoContext.init(this.videoContainer)}))}start(){return Kr(this,void 0,void 0,(function*(){yield this.videoContext.start()}))}pause(){this.videoContext.pause()}resume(){return Kr(this,void 0,void 0,(function*(){yield this.videoContext.resume()}))}stop(){this.videoContext.stop()}mute(){this.videoContext.mute()}unmute(){this.videoContext.unmute()}destroy(){return Kr(this,void 0,void 0,(function*(){return this.videoContext.destroy()}))}}class Zr{static create(e,t){return e.querySelectorAll(".narrative-slide.narrative-multi-slide").length>0?new Qr(t):new Yr(e)}}var Xr,Jr=function(e,t,r,i){return new(r||(r=Promise))((function(n,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}l((i=i.apply(e,t||[])).next())}))};!function(e){e.REFRESH_WIDGETS_STATE="REFRESH_WIDGETS_STATE"}(Xr||(Xr={}));class ei{constructor(e,t,r){Object.defineProperty(this,"slideApi",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"layersManager",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"story",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"_widgets",{enumerable:!0,configurable:!0,writable:!0,value:new Map}),this.showLayerByIndex=this.showLayerByIndex.bind(this),this.handleRefreshUserData=this.handleRefreshUserData.bind(this);for(const t of ei.widgetClasses.values()){const i=new t(e,r);this._widgets.set(i.getType(),i)}}static register(e){ei.widgetClasses.add(e)}get widgets(){return Array.from(this._widgets.values())}init(e){return Jr(this,void 0,void 0,(function*(){this.layersManager.init(e,this.slideApi.Animation),ar.on(ro.ShowLayer,this.showLayerByIndex),ar.on(Xr.REFRESH_WIDGETS_STATE,this.handleRefreshUserData);for(const t of this._widgets.values())yield t.init(e);this.layersManager.init(e,this.slideApi.Animation)}))}pause(){for(const e of this._widgets.values())e.pause()}resume(){for(const e of this._widgets.values())e.resume()}findWidgetByType(e){const t=this._widgets.get(e);if(null==t?void 0:t.firstElement)return t}stop(){for(const e of this._widgets.values())e.destroy();ar.off(ro.ShowLayer,this.showLayerByIndex),ar.off(Xr.REFRESH_WIDGETS_STATE,this.handleRefreshUserData)}destroy(){this.stop()}handleRefreshUserData(){this._widgets.forEach((e=>e.refreshUserData()))}showLayerByIndex({index:e}){this.layersManager.showLayerByIndex(e)}}Object.defineProperty(ei,"widgetClasses",{enumerable:!0,configurable:!0,writable:!0,value:new Set});class ti{constructor(){Object.defineProperty(this,"type",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"elements",{enumerable:!0,configurable:!0,writable:!0,value:void 0})}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(){if(!this.type)throw new Error("[StoryWidget]: widget must have a type");return this.type}setUserData(e,t){}}var ri=function(e,t,r,i){return new(r||(r=Promise))((function(n,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}l((i=i.apply(e,t||[])).next())}))};class ii extends ti{constructor(e){super(),Object.defineProperty(this,"slideApi",{enumerable:!0,configurable:!0,writable:!0,value:e}),this.type=ii.name}init(e){return ri(this,void 0,void 0,(function*(){this.elements=e.querySelectorAll(".narrative-element-barcode");try{this.slideApi.WidgetBarcode.initWidget(this.elements)}catch(e){console.error(e)}}))}refreshUserData(){this.elements&&this.slideApi.WidgetBarcode.refreshUserData(this.elements)}click(e){e.target===this.firstElement&&(this.slideApi.WidgetBarcode.click(e.target),e.navigationController.preventDefault())}}var ni=function(e,t,r,i){return new(r||(r=Promise))((function(n,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}l((i=i.apply(e,t||[])).next())}))};class si extends ti{constructor(e){super(),Object.defineProperty(this,"slideApi",{enumerable:!0,configurable:!0,writable:!0,value:e}),this.type=si.name}init(e){return ni(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){e.target===this.firstElement&&(this.slideApi.WidgetCopy.click(e.target),e.navigationController.preventDefault())}}var oi=function(e,t,r,i){return new(r||(r=Promise))((function(n,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}l((i=i.apply(e,t||[])).next())}))};class ai extends ti{constructor(e){super(),Object.defineProperty(this,"slideApi",{enumerable:!0,configurable:!0,writable:!0,value:e}),this.type=ai.name}init(e){return oi(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){e.target===this.firstElement&&(this.slideApi.WidgetDataInput.click(e.target),e.navigationController.preventDefault())}setUserData(e,t=""){this.slideApi.WidgetDataInput.setUserData(e,t)}}var li=function(e,t,r,i){return new(r||(r=Promise))((function(n,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}l((i=i.apply(e,t||[])).next())}))};class di extends ti{constructor(e){super(),Object.defineProperty(this,"slideApi",{enumerable:!0,configurable:!0,writable:!0,value:e}),this.type=di.name}init(e){return li(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)}click(){}}var ci=function(e,t,r,i){return new(r||(r=Promise))((function(n,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}l((i=i.apply(e,t||[])).next())}))};class ui extends ti{constructor(e){super(),Object.defineProperty(this,"slideApi",{enumerable:!0,configurable:!0,writable:!0,value:e}),this.type=ui.name}init(e){return ci(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)}}))}click(){}destroy(){}}var hi=function(e,t,r,i){return new(r||(r=Promise))((function(n,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}l((i=i.apply(e,t||[])).next())}))};class pi extends ti{constructor(e){super(),Object.defineProperty(this,"slideApi",{enumerable:!0,configurable:!0,writable:!0,value:e}),this.type=pi.name}init(e){return hi(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)}click(e){e.target.classList.contains("narrative-element-poll-button")&&(this.select(e.target),e.navigationController.preventDefault())}}var fi=function(e,t,r,i){return new(r||(r=Promise))((function(n,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}l((i=i.apply(e,t||[])).next())}))};class gi extends ti{constructor(e){super(),Object.defineProperty(this,"slideApi",{enumerable:!0,configurable:!0,writable:!0,value:e}),this.type=gi.name}init(e){return fi(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)}click(e){e.target.classList.contains("narrative-element-poll-button")&&(this.select(e.target),e.navigationController.preventDefault())}}var vi=function(e,t,r,i){return new(r||(r=Promise))((function(n,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}l((i=i.apply(e,t||[])).next())}))};class mi extends ti{constructor(e,t){super(),Object.defineProperty(this,"slideApi",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"story",{enumerable:!0,configurable:!0,writable:!0,value:t}),this.type=mi.name}init(e){return vi(this,void 0,void 0,(function*(){var t;this.elements=e.querySelectorAll(".narrative-element-quest");const r=e.querySelectorAll(".narrative-slide"),i=null===(t=null==r?void 0:r.item(0))||void 0===t?void 0:t.getAttribute("data-quest-count");this.elements.length||null==i||(this.elements=r);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)}click(e){e.target.classList.contains("narrative-element-test-answer")?this.handleTestAnswer(e):this.handleRouteClick(e)}handleTestAnswer(e){this.select(e.target),e.navigationController.preventDefault()}handleRouteClick(e){e.navigationController.navigationDisabled||(e.navigationController.preventDefault(),this.slideApi.WidgetQuest.handleRouteClick(this.firstElement,{direction:e.navigationController.direction>0?"forward":"backward",slideIndex:this.story.activeSlideIndex,slideCount:this.story.slidesCount,click:()=>{e.navigationController.navigate()}}))}}var yi=function(e,t,r,i){return new(r||(r=Promise))((function(n,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}l((i=i.apply(e,t||[])).next())}))};class bi extends ti{constructor(e,t){super(),Object.defineProperty(this,"slideApi",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"story",{enumerable:!0,configurable:!0,writable:!0,value:t}),this.type=bi.name}init(e){return yi(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)}click(e){e.target.classList.contains("narrative-element-quiz-next-button")?this.handleNextButton(e):e.target.classList.contains("narrative-element-quiz-answer")?this.handleAnswer(e):this.handleQuizIsDone(e)}handleQuizIsDone(e){this.slideQuizIsDone(this.firstElement)||e.navigationController.disableNextClick()}handleNextButton(e){this.story.nextSlide(),e.navigationController.preventDefault()}handleAnswer(e){this.select(e.target),e.navigationController.preventDefault()}}var wi=function(e,t,r,i){return new(r||(r=Promise))((function(n,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}l((i=i.apply(e,t||[])).next())}))};class Si extends ti{constructor(e,t){super(),Object.defineProperty(this,"slideApi",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"story",{enumerable:!0,configurable:!0,writable:!0,value:t}),this.type=Si.name}init(e){return wi(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)}click(e){e.target.classList.contains("narrative-element-quiz-next-button")?this.handleNextButton(e):e.target.classList.contains("narrative-element-quiz-answer")?this.handleAnswer(e):this.handleQuizIsDone(e)}handleNextButton(e){this.story.nextSlide(),e.navigationController.preventDefault()}handleQuizIsDone(e){this.slideQuizIsDone(this.firstElement)||e.navigationController.disableNextClick()}handleAnswer(e){this.select(e.target),e.navigationController.preventDefault()}}var _i=function(e,t,r,i){return new(r||(r=Promise))((function(n,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}l((i=i.apply(e,t||[])).next())}))};class xi extends ti{constructor(e){super(),Object.defineProperty(this,"slideApi",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"slideContent",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.type=xi.name,this.disableSwipeGesture=this.disableSwipeGesture.bind(this),this.enableSwipeGesture=this.enableSwipeGesture.bind(this)}init(e){return _i(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){e.target.classList.contains("rangeslider")?this.handleClickSlider(e):e.target.classList.contains("narrative-element-range-slider-next-button")?this.handleClickSliderNextButton(e):this.handleCaptureClick(e)}isClickCapturedBySlider(e){return this.slideApi.WidgetRangeSlider.isClickCapturedBySlider(e)}destroy(){this.unregisterMouseAndTouchEvents()}handleClickSlider(e){e.navigationController.preventDefault()}handleCaptureClick(e){this.isClickCapturedBySlider(this.firstElement)&&e.navigationController.preventDefault()}handleClickSliderNextButton(e){this.slideApi.WidgetRangeSlider.click(e.target),e.navigationController.preventDefault()}disableSwipeGesture(e){mr()}enableSwipeGesture(e){vr()}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,r,i;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===(r=this.slideContent)||void 0===r||r.removeEventListener("mousedown",this.disableSwipeGesture),null===(i=this.slideContent)||void 0===i||i.removeEventListener("touchstart",this.disableSwipeGesture)}}var Oi=function(e,t,r,i){return new(r||(r=Promise))((function(n,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}l((i=i.apply(e,t||[])).next())}))};class Ci extends ti{constructor(e){super(),Object.defineProperty(this,"slideApi",{enumerable:!0,configurable:!0,writable:!0,value:e}),this.type=Ci.name}init(e){return Oi(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)}}))}click(e){e.target.classList.contains("narrative-element-rate-input")&&(this.select(e.target),e.navigationController.preventDefault())}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 ki=function(e,t,r,i){return new(r||(r=Promise))((function(n,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}l((i=i.apply(e,t||[])).next())}))};class Li extends ti{constructor(e){super(),Object.defineProperty(this,"slideApi",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"slideContent",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.type=Li.name,this.handleShareComplete=this.handleShareComplete.bind(this)}init(e){return ki(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){e.target===this.firstElement&&(this.slideApi.WidgetShare.click(e.target),e.navigationController.preventDefault())}destroy(){this.unregisterEvents()}registerEvents(){ar.on(`${Li.name}.shareComplete`,this.handleShareComplete)}unregisterEvents(){ar.off(`${Li.name}.shareComplete`,this.handleShareComplete)}handleShareComplete({shareId:e,result:t}){lt(`[Share Widget]: share complete, { shareId, result }: ${e}, ${t}}`),this.complete(e,t)}}var Ai,Mi=function(e,t,r,i){return new(r||(r=Promise))((function(n,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}l((i=i.apply(e,t||[])).next())}))};!function(e){e.Open="open"}(Ai||(Ai={}));class Ei extends ti{constructor(e){super(),Object.defineProperty(this,"slideApi",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"_swipeUpLinkTarget",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_swipeUpElementId",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"slideContent",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"eventEmitter",{enumerable:!0,configurable:!0,writable:!0,value:new J.EventEmitter}),this.type=Ei.name,this.handleSwipeUpGesture=this.handleSwipeUpGesture.bind(this),this.handleClick=this.handleClick.bind(this)}get targetUrl(){var e;return decodeURIComponent(null!==(e=this._swipeUpLinkTarget)&&void 0!==e?e:"")}get elementId(){return this._swipeUpElementId}init(e){return Mi(this,void 0,void 0,(function*(){var t,r;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!==(r=this.firstElement.getAttribute("data-element-id"))&&void 0!==r?r:void 0,this.registerEvents())}))}click(e){}destroy(){this.unregisterEvents()}close(){vr(),Cr(),this.setGoodsElementOpacity(1)}on(e,t){this.eventEmitter.on(e,t)}off(e,t){this.eventEmitter.off(e,t)}registerEvents(){var e;ar.on("swipeController.swipeUp",this.handleSwipeUpGesture),ar.on("goods.close",this.handleSwipeUpGesture),null===(e=this.firstElement)||void 0===e||e.addEventListener("click",this.handleClick)}unregisterEvents(){var e;ar.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(){this._swipeUpLinkTarget&&this.slideContent&&this._swipeUpElementId&&(mr(),Or(),this.eventEmitter.emit(Ai.Open),this.setGoodsElementOpacity(0))}setGoodsElementOpacity(e){var t;const r=null===(t=this.slideContent)||void 0===t?void 0:t.querySelector(`[data-element-id="${this._swipeUpElementId}"]`);r&&r.style.setProperty("display",e>0?"block":"none")}}var Pi=function(e,t,r,i){return new(r||(r=Promise))((function(n,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}l((i=i.apply(e,t||[])).next())}))};class ji extends ti{constructor(e,t){super(),Object.defineProperty(this,"slideApi",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"story",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"_swipeUpLinkTarget",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_swipeUpElementId",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"slideContent",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.type=ji.name,this.handleSwipeUpGesture=this.handleSwipeUpGesture.bind(this)}get swipeUpLinkTarget(){return this._swipeUpLinkTarget}get swipeUpElementId(){return this._swipeUpElementId}init(e){return Pi(this,void 0,void 0,(function*(){var t,r;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!==(r=this.firstElement.getAttribute("data-element-id"))&&void 0!==r?r:void 0,ar.on("swipeController.swipeUp",this.handleSwipeUpGesture))}))}click(e){}destroy(){ar.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&&Ys(this.story,e)}}var Ii=function(e,t,r,i){return new(r||(r=Promise))((function(n,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}l((i=i.apply(e,t||[])).next())}))};class Ti extends ti{constructor(e){super(),Object.defineProperty(this,"slideApi",{enumerable:!0,configurable:!0,writable:!0,value:e}),this.type=Ti.name}init(e){return Ii(this,void 0,void 0,(function*(){this.elements=e.querySelectorAll(".narrative-element-vote");try{if(!this.firstElement)return;this.slideApi.WidgetVote.initWidget(this.firstElement);const e="narrative-element-quiz-next-button",t=this.firstElement.querySelector(`.${e}`);t&&t.classList.remove(e)}catch(e){console.error(e)}}))}refreshUserData(){this.elements&&this.slideApi.WidgetVote.refreshUserData(this.elements)}select(e){this.slideApi.WidgetVote.select(e)}click(e){if(e.target.classList.contains("narrative-element-vote-next-button")){if(!this.slideApi.WidgetVote.click(e.target))return void e.navigationController.preventDefault()}e.target.classList.contains("narrative-element-vote-answer")&&(this.slideApi.WidgetVote.select(e.target),e.navigationController.preventDefault())}}var Ri=function(e,t,r,i){return new(r||(r=Promise))((function(n,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}l((i=i.apply(e,t||[])).next())}))};class Di extends ti{constructor(e,t){super(),Object.defineProperty(this,"slideApi",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"story",{enumerable:!0,configurable:!0,writable:!0,value:t}),this.type=Di.name}init(e){return Ri(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)}click(e){e.target.classList.contains("narrative-element-test-next-button")?this.handleNextButton(e):e.target.classList.contains("narrative-element-test-answer")?this.handleAnswer(e):this.handleTestIsDone(e)}handleNextButton(e){this.story.nextSlide(),e.navigationController.preventDefault()}handleAnswer(e){this.select(e.target),e.navigationController.preventDefault()}handleTestIsDone(e){const t=this.slideTestIsDone(this.firstElement);!this.slideTestWithTimer(this.firstElement)||t?t||e.navigationController.disableNextClick():e.navigationController.preventDefault()}}var Bi,Ni=function(e,t,r,i){return new(r||(r=Promise))((function(n,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}l((i=i.apply(e,t||[])).next())}))};class Fi extends ti{constructor(e,t){super(),Object.defineProperty(this,"slideApi",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"story",{enumerable:!0,configurable:!0,writable:!0,value:t}),this.type=Fi.name}init(e){return Ni(this,void 0,void 0,(function*(){this.elements=e.querySelectorAll(".narrative-element-story-repeat")}))}click(e){e.target===this.firstElement&&(this.story.reset().catch(console.error),e.navigationController.preventDefault())}}ei.register(ii),ei.register(si),ei.register(ai),ei.register(di),ei.register(ui),ei.register(pi),ei.register(gi),ei.register(mi),ei.register(bi),ei.register(Si),ei.register(xi),ei.register(Ci),ei.register(Li),ei.register(Ei),ei.register(ji),ei.register(Ti),ei.register(Di),ei.register(Fi),function(e){e[e.None=0]="None",e[e.DisableNext=1]="DisableNext",e[e.DisablePrev=2]="DisablePrev"}(Bi||(Bi={}));class Ui{constructor(e,t,r,i,n){Object.defineProperty(this,"slide",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"event",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"geometry",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"dir",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(this,"desktopMode",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(this,"_mode",{enumerable:!0,configurable:!0,writable:!0,value:Bi.None}),Object.defineProperty(this,"_defaultPrevented",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_direction",{enumerable:!0,configurable:!0,writable:!0,value:0}),this._direction=this.calcDirection()}get mode(){return this._mode}get direction(){return this._direction}get defaultPrevented(){return this._defaultPrevented||this.slide.navigationDisabled}get navigationDisabled(){return this.slide.navigationDisabled}preventDefault(){this._defaultPrevented=!0}disableNextClick(){this._mode=Bi.DisableNext}navigate(){this.direction<0?this.toPrev():this.mode!==Bi.DisableNext&&this.toNext()}toPrev(){"ltr"===this.dir?this.prevSlideOrStory():this.nextSlideOrStory()}toNext(){"ltr"===this.dir?this.nextSlideOrStory():this.prevSlideOrStory()}prevSlideOrStory(){this.slide.story.reachStart?ar.emit(`${Ao.name}.showPrevStory`):this.slide.story.prevSlide()}nextSlideOrStory(){this.slide.story.reachEnd?ar.emit(`${Ao.name}.showNextStory`):this.slide.story.nextSlide()}calcClickPosition(){var e;let t=0,r=0;return this.desktopMode?(t=this.geometry.calculateWidth(),r=this.event.nativeEvent.offsetX):(t=this.geometry.vw,r=this.event.nativeEvent.pageX||(null===(e=this.event.nativeEvent.touches)||void 0===e?void 0:e[0].pageX)),r/t}calcDirection(){return this.calcClickPosition()<=.3?-1:1}}const Vi={id:"",running:!1},zi=(0,e.createStore)(Vi),Gi=(0,e.createEvent)(),Wi=(0,e.createEvent)(),$i=(0,e.createEvent)(),Hi=(0,e.createEffect)((({shareId:e,result:t})=>{$i(),Lr(),ar.emit(`${Li.name}.shareComplete`,{shareId:e,result:t})}));zi.on(Gi,((e,t)=>Object.assign(Object.assign({},e),{id:t.id,running:!0}))).on($i,(()=>Vi)),(0,e.sample)({clock:Wi,source:zi,filter:e=>e.running,fn:(e,t)=>({shareId:e.id,result:t.result}),target:Hi});class qi{init(e){var t;const r="stories-slider-style";let i=document.getElementById(r),n="";null!==e&&(n=null!==(t=e.style)&&void 0!==t?t:""),null===i?(i=document.createElement("style"),i.type="text/css",i.id=r,i.attributes.setNamedItem(document.createAttribute("scoped")),i.setAttribute("nonce",Xt()),i.styleSheet?i.styleSheet.cssText=n:i.appendChild(document.createTextNode(n)),document.head.appendChild(i)):i.styleSheet?i.styleSheet.cssText=n:(i.textContent="",i.appendChild(document.createTextNode(n)))}}class Qi{constructor(){Object.defineProperty(this,"cache",{enumerable:!0,configurable:!0,writable:!0,value:{}})}set(e,t){this.cache[e]=t}clear(){this.cache={}}get(e){return this.cache[e]}}class Ki{constructor(){Object.defineProperty(this,"actions",{enumerable:!0,configurable:!0,writable:!0,value:[]})}push(e){this.actions.push(e)}exec(){for(const e of this.actions)e()}flush(){this.actions=[]}}var Yi=function(e,t,r,i){return new(r||(r=Promise))((function(n,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}l((i=i.apply(e,t||[])).next())}))};class Zi{constructor(e){Object.defineProperty(this,"statisticsService",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"timerId",{enumerable:!0,configurable:!0,writable:!0,value:null})}start(){this.schedule(1e4)}stop(){null!=this.timerId&&(clearTimeout(this.timerId),this.timerId=null)}flush(){return Yi(this,void 0,void 0,(function*(){lt(`[${sn.name}]: flush statistics by timer`);this.statisticsService.getData().length>0?this.schedule(1e4):this.schedule(3e4),yield this.statisticsService.sendData()}))}schedule(e){lt(`[${sn.name}]: schedule flush statistics on ${e}ms`),this.timerId=setTimeout((()=>this.flush()),e)}}class Xi{constructor(){Object.defineProperty(this,"slideStartedAt",{enumerable:!0,configurable:!0,writable:!0,value:void 0})}calculate(){const e=Date.now(),t=e-this.slideStartedAt;return this.slideStartedAt=e,t}init(){this.slideStartedAt=Date.now()}}class Ji{constructor(e){Object.defineProperty(this,"statisticsService",{enumerable:!0,configurable:!0,writable:!0,value:e}),this.handle=this.handle.bind(this),ar.on(rn.CloseStoryReader,this.handle)}handle(e){this.statisticsService.addSlideEvent({action:1,storyId:e.storyId,slideIndex:e.slideIndex})}destroy(){ar.off(rn.CloseStoryReader,this.handle)}}class en{constructor(e){Object.defineProperty(this,"statisticsService",{enumerable:!0,configurable:!0,writable:!0,value:e}),this.handle=this.handle.bind(this),ar.on(rn.NextSlide,this.handle)}handle(e){this.statisticsService.addSlideEvent({action:1,storyId:e.fromStoryId,slideIndex:e.fromSlideIndex})}destroy(){ar.off(rn.NextSlide,this.handle)}}class tn{constructor(e){Object.defineProperty(this,"statisticsService",{enumerable:!0,configurable:!0,writable:!0,value:e}),this.handle=this.handle.bind(this),ar.on(rn.TransitionFromSlide,this.handle)}handle(e){this.statisticsService.addSlideEvent({action:2,storyId:e.storyId,slideIndex:e.slideIndex})}destroy(){ar.off(rn.TransitionFromSlide,this.handle)}}var rn,nn=function(e,t,r,i){return new(r||(r=Promise))((function(n,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}l((i=i.apply(e,t||[])).next())}))};!function(e){e.CloseStoryReader="statistics.closeStoryReader",e.NextSlide="statistics.nextSlide",e.TransitionFromSlide="statistics.transitionFromSlide"}(rn||(rn={}));class sn extends(ee()){constructor(e){super(),Object.defineProperty(this,"beaconService",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"lastIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"sourceInfo",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"flushSheduler",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"slideDurationCalculator",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"events",{enumerable:!0,configurable:!0,writable:!0,value:[]}),this.flushSheduler=new Zi(this),this.slideDurationCalculator=new Xi}init(e){this.data=[],this.sourceInfo=e,this.lastIndex=0,this.slideDurationCalculator.init(),this.flushSheduler.start(),this.events=[new Ji(this),new en(this),new tn(this)]}getData(){return this.data.slice()}getLastIndex(){return this.lastIndex}cleanupData(){this.data=[]}addSlideEvent(e){if(!ut())return;const t=this.slideDurationCalculator.calculate();this.data.push([e.action,this.lastIndex,e.storyId,e.slideIndex,t]),this.lastIndex++}sendData(){return nn(this,void 0,void 0,(function*(){const e=this.getData();if(e.length)try{if(!this.sourceInfo)throw new Error(`[${sn.name}]: You need pass source info!`);this.cleanupData(),yield this.beaconService.updateStatistics({updateDto:{data:e},listType:vt(this.sourceInfo.feedSlug)})}catch(t){this.data.push(...e),console.error(t)}}))}destroy(){return nn(this,void 0,void 0,(function*(){this.events.forEach((e=>e.destroy())),this.flushSheduler.stop(),yield this.sendData()}))}}var on=function(e,t,r,i){return new(r||(r=Promise))((function(n,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}l((i=i.apply(e,t||[])).next())}))};class an{constructor(e){Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:e})}updateStatistics(e){return on(this,arguments,void 0,(function*({listType:e,updateDto:t}){var r;if(0===t.data.length)return t;let i=!1,n="";if(e===We.UGC||(null===(r=this.storyManager.getConfig())||void 0===r?void 0:r.disableStatistic))i=!0;else try{K("session/update",t,(()=>{})),i=!0}catch(e){n=e.toString()}if(i)return t;throw n}))}}var ln=function(e,t,r,i){return new(r||(r=Promise))((function(n,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}l((i=i.apply(e,t||[])).next())}))};class dn{constructor(e){Object.defineProperty(this,"storyReaderViewModel",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"deferredActionsQueue",{enumerable:!0,configurable:!0,writable:!0,value:new Ki}),Object.defineProperty(this,"narrativeStoryCache",{enumerable:!0,configurable:!0,writable:!0,value:new Qi}),Object.defineProperty(this,"activeStorySlide",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"activeStory",{enumerable:!0,configurable:!0,writable:!0,value:null})}lock(e){if(this.activeStorySlide&&this.activeStorySlide!==e)throw new Error(`[SlideApi]: The resource is locked by story with ID ${this.activeStorySlide.story.id} and slide index ${this.activeStorySlide.index}`);this.activeStorySlide=e}unlock(e){this.activeStorySlide===e&&(this.activeStorySlide=null)}exec(){this.activeStorySlide&&(this.deferredActionsQueue.exec(),this.deferredActionsQueue.flush())}getStoryLocalData(){return ln(this,void 0,void 0,(function*(){if(!this.activeStory)return{};let e=sessionStorage.getItem("narrative_"+this.activeStory.id+"_data");return e?JSON.parse(e):{}}))}setStoryLocalData(e,t){if(!this.activeStory)return;let r=JSON.stringify(e);sessionStorage.setItem("narrative_"+this.activeStory.id+"_data",r),t&&ut()&&It.sentData(this.activeStory.id,{data:r},St)}getStoryServerData(e){var t,r;return null!==(r=null===(t=this.storyReaderViewModel.widgetsData._narrative_saved_data)||void 0===t?void 0:t[e])&&void 0!==r?r:null}updateStoryServerData(e,t){this.storyReaderViewModel.widgetsData._narrative_saved_data=t}getSlideDuration(e,t){var r,i,n;return null!==(n=null===(i=null===(r=this.storyReaderViewModel.widgetsData._narrative_slides_duration)||void 0===r?void 0:r[e])||void 0===i?void 0:i[t])&&void 0!==n?n:null}pauseUI(){_r()}resumeUI(){xr()}showStoryTextInput(e,t){ar.emit(ro.ShowInputModal,{id:e,config:t})}setStorySessionValue(e,t){this.narrativeStoryCache.set(e,t)}getStorySessionValue(e){return this.narrativeStoryCache.get(e)}getWidgetsSharedData(e,t){var r,i,n;const s=this.storyReaderViewModel.widgetsData;switch(t){case"rangeSlider":return null===(r=s._narrative_range_slider_data)||void 0===r?void 0:r[e];case"poll":return null===(i=s._narrative_poll_data)||void 0===i?void 0:i[e];case"vote":return null===(n=s._narrative_vote_data)||void 0===n?void 0:n[e]}return null}openUrl(e){this.activeStory&&(this.activeStory.markAsOpened(),ar.emit(rn.TransitionFromSlide,{storyId:this.activeStory.id,slideIndex:this.activeStory.activeSlideIndex}),window.open(e,"_parent"))}sendApiRequest(e,t,r,i,n,s){return It.sendApiRequest({url:e,method:t,params:r,headers:i,data:n,profilingKey:s},St)}share(e,t){null==e&&(e="story-share"),ar.emit(ro.PerformShareAction,{shareId:e,config:t})}shareSlideScreenshot(e,t,r){null==e&&(e="slide-screenshot-share"),ar.emit(ro.PerformScreenShotShareAction,{shareId:e,hideElementsSelector:null!=t?t:"",shareText:r})}showLayer(e){ar.emit(ro.ShowLayer,{index:e})}showStorySlide(e){this.pushToDefferedActionsQueueOrExec((()=>{var t;null===(t=this.activeStory)||void 0===t||t.redirectToSlide({slideIndex:e})}))}storyShowNext(){ar.emit(`${Ao.name}.showNextStory`)}showNextSlide(e){this.pushToDefferedActionsQueueOrExec((()=>{e?this.activeStory.timer.start(e):this.activeStory.nextSlide()}))}sendStatisticEvent(e,t,r){ar.emit("publicEvents.widgetEvent",{name:e,devPayload:r})}destroy(){}setActiveStory(e){this.narrativeStoryCache.clear(),this.activeStory=e,this.activeStorySlide&&this.unlock(this.activeStorySlide)}resetStory(e){return ln(this,void 0,void 0,(function*(){var t;let r={},i=yield this.getStoryLocalData();i=Object.assign({},null!==(t=this.getStoryServerData(e))&&void 0!==t?t:{},i);for(let e in i)i.hasOwnProperty(e)&&/^_gm_[A-z0-9-_]+_attempts$/.test(e)&&(r[e]=i[e]);ar.emit(Xr.REFRESH_WIDGETS_STATE),this.updateStoryServerData(e,r),this.setStoryLocalData(r,!0),this.showStorySlide(0),this.showLayer(0)}))}pushToDefferedActionsQueueOrExec(e){this.activeStorySlide?e():this.deferredActionsQueue.push(e)}getStoryFonts(){const e=L.getState().cache;return null!=e&&Array.isArray(e)?L.getState().cache.filter((e=>"font-face"===e.type)):[]}updateTimeline(e,t,r,i,n,s){}showToast(e){ar.emit(ro.ShowToast,{content:e})}}const cn=function(){var e="test";try{return localStorage.setItem(e,e),localStorage.removeItem(e),!0}catch(e){return!1}}();function un(e){let t=null;if(cn){let r=window.localStorage.getItem(e);null!==r&&Nt()(r)&&r.trim().length>0&&(t=JSON.parse(r))}return t}function hn(e,t){cn&&window.localStorage.setItem(e,JSON.stringify(t))}var pn=function(e,t,r,i){return new(r||(r=Promise))((function(n,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}l((i=i.apply(e,t||[])).next())}))};let fn=null;function gn(){return pn(this,void 0,void 0,(function*(){return null!=fn?fn:new Promise((e=>{!function(e,t){const r=new Image;r.onload=function(){var i=r.width>0&&r.height>0;t(e,i)},r.onerror=function(){t(e,!1)},r.src="data:image/webp;base64,"+{lossy:"UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA",lossless:"UklGRhoAAABXRUJQVlA4TA0AAAAvAAAAEAcQERGIiP4HAA==",alpha:"UklGRkoAAABXRUJQVlA4WAoAAAAQAAAAAAAAAAAAQUxQSAwAAAARBxAR/Q9ERP8DAABWUDggGAAAABQBAJ0BKgEAAQAAAP4AAA3AAP7mtQAAAA==",animation:"UklGRlIAAABXRUJQVlA4WAoAAAASAAAAAAAAAAAAQU5JTQYAAAD/////AABBTk1GJgAAAAAAAAAAAAAAAAAAAGQAAABWUDhMDQAAAC8AAAAQBxAREYiI/gcA"}[e]}("lossy",((t,r)=>{fn=r,e(r)}))}))}))}var vn=function(e,t,r,i){return new(r||(r=Promise))((function(n,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}l((i=i.apply(e,t||[])).next())}))};const mn=new class{openSession(e){return vn(this,void 0,void 0,(function*(){var t;return(yield Y.post(e.url,null!==(t=e.data)&&void 0!==t?t:{},e.params)).data}))}};function yn(e,t,r=!1,i,n){const s=["slides"];i&&s.push("share_url");const o={url:`${t===gt?"ugc/":""}story/${e}`,method:"GET",params:{expand:s.join(",")}};return o.params.once=Number(Boolean(n)),r||null!=o.params&&(o.params.fields=["id","slides"].join(",")),o}const bn=(e,t,r,i)=>{var n;let s=null===(n=y.getState())||void 0===n?void 0:n.tags;const o={};s&&ke()(s)&&s.length>0&&(o.tags=s.join(",")),void 0!==e&&ke()(e)&&e.length>0&&(o.tags=e.join(","));return null==r||"number"!=typeof r&&!(e=>!isNaN(parseFloat(e))&&isFinite(e))(r)||(o.limit=r),null!=t&&(o.test=t),null!=i&&W()(i)&&(o.f=JSON.stringify(i)),{params:o}};var wn=function(e,t,r,i){return new(r||(r=Promise))((function(n,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}l((i=i.apply(e,t||[])).next())}))};ze.use((e=>wn(void 0,void 0,void 0,(function*(){return Ve.getState().style||(yield Ge()),xn.fetchStoryContext(e)})))),Ge.use((()=>wn(void 0,void 0,void 0,(function*(){return xn.fetchStoryStyles()}))));Ve.on([ze.doneData,Ge.doneData],((e,t)=>{var r;const i=Object.assign(Object.assign({},e),{widgetsData:Object.assign({},e.widgetsData)});return i.style=null!==(r=null==t?void 0:t.style)&&void 0!==r?r:e.style,i.widgetsData=t.widgetsData?((e,t)=>{for(const[r,i]of Object.entries(t)){const t=Array.isArray(i)?{}:i;e[r]=Object.assign(Object.assign({},e[r]),t)}return e})(i.widgetsData,t.widgetsData):i.widgetsData,i}));class Sn extends Error{constructor(e){super(`Story with ID ${e} has already been shown to the user`),this.name=Sn.name}}var _n=function(e,t,r,i){return new(r||(r=Promise))((function(n,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}l((i=i.apply(e,t||[])).next())}))};const xn=new class{fetchUgcFeed(e){return _n(this,arguments,void 0,(function*({filter:e,testKey:t}){var r;const i=function(e,t,r,i){const{params:n}=bn(r,i,null,t);return{method:"GET",url:"ugc/feed",params:n}}(0,e,[],t);return(yield Y.get(i.url,null!==(r=i.params)&&void 0!==r?r:{})).data}))}fetchFeed(e){return _n(this,arguments,void 0,(function*({feedSlug:e,testKey:t}){var r;const i=function(e,t,r){const{params:i}=bn(t,r);return{method:"GET",url:`feed/${e}`,params:i}}(e,[],t),n=yield Y.get(i.url,null!==(r=i.params)&&void 0!==r?r:{});return n.data.feedSlug=e,n.data}))}fetchFavoriteList(){return _n(this,void 0,void 0,(function*(){var e;const t=function(){const{params:e}=bn();return{method:"GET",url:"story",params:Object.assign(Object.assign({},e),{favorite:1})}}();return(yield Y.get(t.url,null!==(e=t.params)&&void 0!==e?e:{})).data}))}fetchOnboardingList(e){return _n(this,arguments,void 0,(function*({onboardingList:e,onboardingTags:t,limit:r}){var i;const n=function(e="onboarding",t,r){const{params:i}=bn(t,null,r);return{method:"GET",url:`feed/${e}/onboarding`,params:i}}(e,t,r),s=yield Y.get(n.url,null!==(i=n.params)&&void 0!==i?i:{});return s.data.feedSlug=e,s.data}))}fetchStorySlides(e){return _n(this,arguments,void 0,(function*({id:e,feedSlug:t}){var r;const i=yn(e,t);return(yield Y.get(i.url,null!==(r=i.params)&&void 0!==r?r:{})).data}))}fetchStory(e){return _n(this,arguments,void 0,(function*({id:e,feedSlug:t,fetchShareUrl:r,once:i}){var n;const s=yn(e,t,!0,r,i),o=yield Y.get(s.url,null!==(n=s.params)&&void 0!==n?n:{});if(204===o.status&&i)throw new Sn(e.toString());return o.data}))}fetchStoryContext(e){return _n(this,arguments,void 0,(function*({ids:e}){var t;const r=function(e){return{url:"story-context",method:"GET",params:{id:e.join(","),fields:"widgetsData"}}}(e);return(yield Y.get(r.url,null!==(t=r.params)&&void 0!==t?t:{})).data}))}fetchStoryStyles(){return _n(this,void 0,void 0,(function*(){var e;const t={url:"story-context",method:"GET",params:{fields:"style"}};return(yield Y.get(t.url,null!==(e=t.params)&&void 0!==e?e:{})).data}))}},On=/[\r\n%#()<>?[\\\]^`{|}]/g;function Cn(e,t="double"){return(e=(e=(e="double"===t?e.replace(/"/g,"'"):e.replace(/'/g,'"')).replace(/>\s{1,}</g,"><")).replace(/\s{2,}/g," ")).replace(On,encodeURIComponent)}const kn=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});var Ln;!function(e){e.LANDSCAPE_PRIMARY="landscape-primary",e.LANDSCAPE_SECONDARY="landscape-secondary",e.PORTRAIT_PRIMARY="portrait-primary",e.PORTRAIT_SECONDARY="portrait-secondary"}(Ln||(Ln={}));var An=function(e,t,r,i){return new(r||(r=Promise))((function(n,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}l((i=i.apply(e,t||[])).next())}))};const Mn=e=>An(void 0,void 0,void 0,(function*(){return(yield fetch(e)).blob()})),En=e=>An(void 0,void 0,void 0,(function*(){const t=yield Mn(e);return function(e,t=!0){return new Promise((function(r){var i=new FileReader;i.onloadend=function(){if(t){var e=String(i.result).replace("data:","").replace(/^.+,/,"");r(e)}else r(String(i.result))},i.readAsDataURL(e)}))}(new File([t],"image",{type:t.type,lastModified:(new Date).getTime()}),!1)}));function Pn(e,t,r,i){var n=e.indexOf(r,t);if(-1===n)return null;for(var s="",o=n+r.length;o<e.length&&-1===i.indexOf(e[o]);o++)s+=e[o];return{foundAtIndex:n,value:s}}function jn(e,t){const r=document.createElementNS("http://www.w3.org/2000/svg",e);for(let e in t)r.setAttributeNS(null,e.replace(/[A-Z]/g,(function(e,t,r,i){return"-"+e.toLowerCase()})),t[e]);return r}var In;function Tn(e,t,r,i,n,s,o,a,l,d){var c=jn("svg",{width:String(n),height:String(s),style:"background-color: #fff;"}),u=jn("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!=i&&"string"==typeof i&&i.length>0){const e=Array.prototype.slice.call(h.querySelectorAll(i));for(let t=0;t<e.length;t++){const r=e[t];r&&r.style&&r.style.setProperty&&r.style.setProperty("display","none")}}u.appendChild(h);var p=[];(function(e){for(var t=[],r=0;;){var i=Pn(e,r,"src: url(",[" ",")","\t"]);if(null==i)break;r=i.foundAtIndex+i.value.length,t.push(i.value.replace(/["']/g,""))}return t})(r).forEach((function(e){p.push(new Promise((function(t,i){En(e).then((function(i){r=r.replace(e,i),t()})).catch((function(e){t()}))})))})),u.querySelectorAll("img").forEach((function(e){e.crossOrigin="Anonymous",p.push(new Promise((function(t,r){En(e.src).then((function(r){e.onload=r=>e.decode().then((()=>t())),e.onerror=e=>{console.error(e),t()},e.decoding="sync",e.src=r})).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=jn("style",{});t.textContent=r,c.appendChild(t);const i=(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 r=e.toDataURL(o,a);Mn(r).then((function(t){l(t),e.remove()}))}}),e===In.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.decoding="sync",u.src="data:image/svg+xml;base64,"+btoa(encodeURIComponent(i).replace(/%([0-9A-F]{2})/g,(function(e,t){return String.fromCharCode(parseInt(t,16))})))}))}()}function Rn(e,t,r,i){return new Promise((function(n,s){null==i&&(i=""),function(e,t,r,i,n,s){Tn(e,t,r,i,t.clientWidth,t.clientHeight,"image/jpeg",1,n,s)}(e,t,r,i,(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 Dn(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"}(In||(In={}));const Bn=()=>{let e=!1;try{const t=Object.defineProperty({},"passive",{get:function(){e=!0}}),r=()=>{};window.addEventListener("test",r,t),window.removeEventListener("test",r)}catch(e){}return e},Nn=!!Bn()&&{passive:!0};!function(){const e=window.requestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||window.msRequestAnimationFrame;window.requestAnimationFrame=e}();const Fn=function(){let e,t=document.createElement("div"),r={transition:"transitionend",OTransition:"otransitionend",MozTransition:"transitionend",WebkitTransition:"webkitTransitionEnd"};for(e in r)if(r.hasOwnProperty(e)&&void 0!==t.style[e])return r[e]}();function Un(e,t,r){return new Promise((i=>{let n=!1;const s=()=>{n=!0,clearTimeout(a),void 0!==Fn&&e.removeEventListener(Fn,o),e.style.setProperty("transition",`${t} 0ms`),i()},o=e=>{e.propertyName===t&&(n||s())};void 0!==Fn&&e.addEventListener(Fn,o,!1);const a=setTimeout((()=>{n||s()}),r+20);e.style.setProperty("transition",`${t} ${r}ms`)}))}var Vn=function(e,t,r,i){return new(r||(r=Promise))((function(n,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}l((i=i.apply(e,t||[])).next())}))};const zn=(e,...t)=>Vn(void 0,[e,...t],void 0,(function*(e,t=300){return new Promise((r=>{const i=Math.max(0,t-((new Date).getTime()-e));i?setTimeout(r,i):r()}))}));var Gn=function(e,t,r,i){return new(r||(r=Promise))((function(n,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}l((i=i.apply(e,t||[])).next())}))};class Wn{fetchStoryAndContextById(e){return Gn(this,arguments,void 0,(function*({storyId:e,feed:t,fetchShareUrl:r,once:i}){try{const n=(new Date).getTime();return yield A(),yield ze({ids:[e],feedSlug:t}),yield as({id:e,feedSlug:t,fetchShareUrl:r,once:i}),yield zn(n),this.getOrCreateDirectStoryById(e)}catch(t){if(i)throw t;const r=this.getOrCreateDirectStoryById(e);return r.error=t,r}}))}fetchStoriesSlidesAndContextByStoryId(e){return Gn(this,arguments,void 0,(function*({storyId:e,listType:t,feed:r=""}){const i=this.getVisibleStoriesByListTypeAndFeed(t,r),n=i.findIndex((t=>t.id===e));return yield this.fetchStoriesSlidesAndContextByRange({stories:i,storyIndex:n,listType:t,feed:r}),this.getStoriesWithSlidesAndContext({listType:t,feed:r})}))}fetchStoriesSlidesAndContextByNextStoryIndex(e){return Gn(this,arguments,void 0,(function*({nextStoryIndex:e,listType:t,feed:r}){const i=this.getVisibleStoriesByListTypeAndFeed(t,r);return yield this.fetchStoriesSlidesAndContextByRange({stories:i,storyIndex:e,listType:t,feed:r}),this.getStoriesWithSlidesAndContext({listType:t,feed:r})}))}getOrCreateDirectStoryById(e){var t;return null!==(t=ft(Re.direct).find((t=>t.id===e||t.string_id===e.toString())))&&void 0!==t?t:$e(e)}getStoriesWithSlidesAndContext({listType:e,feed:t}){return{storyList:ft(e,t).filter((e=>!e.hide_in_reader)),storyContext:Ve.getState(),listType:e}}fetchStoriesSlidesAndContextByRange(e){return Gn(this,void 0,void 0,(function*(){const t=this.getStoryIdsByStoriesRange(e.stories,e.storyIndex);if(!t.length)return null;yield this.fetchSlidesAndContext({feed:e.feed,storyIds:t})}))}getStoryIdsByStoriesRange(e,t){const r=t-2,i=t+2;return e.slice(Math.max(r,0),i+1).filter((e=>!e.slidesLoaded)).map((e=>e.id))}fetchSlidesAndContext(e){return Gn(this,arguments,void 0,(function*({feed:e,storyIds:t}){const r=(new Date).getTime();try{yield ze({ids:t,feedSlug:e}),yield Promise.allSettled(t.map((t=>os({id:t,feedSlug:e})))),yield zn(r)}catch(e){}}))}getVisibleStoriesByListTypeAndFeed(e,t){return ft(e,t).filter((e=>!e.hide_in_reader))}}var $n=function(e,t,r,i){return new(r||(r=Promise))((function(n,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}l((i=i.apply(e,t||[])).next())}))};const Hn=f(37);A.use((()=>$n(void 0,void 0,void 0,(function*(){const e=L.getState();if(e.session.id)return e;const t=yield function(){return $n(this,void 0,void 0,(function*(){const[e,t]=yield Promise.all([Qn(),gn()]);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:qn(e,t)}}))}();return mn.openSession(t)})))),(0,e.sample)({clock:M,target:L});const qn=(e,t)=>{"iOS"===e.os_name?window.isIos=!0:"Android"===e.os_name&&(window.Android=!0);const r=y.getState();return r&&r.userId&&(e.user_id=r.userId,e.user_sign=r.userIdSign),e.features="animation,data,deeplink,placeholder,resetTimers,gameReader,sendApi,swipeUpItems,imgPlaceholder,vod,closeStoryApi",t&&(e.features+=",webp"),e},Qn=()=>$n(void 0,void 0,void 0,(function*(){return new Promise(((e,t)=>{let r=un("device_data"),i=null;if(null!==r&&(i=r.device_id),null!==r&&i&&Nt()(i)&&36===i.trim().length)k(i),e(r);else{const t={platform:"web",device_id:Hn.v4()};hn("device_data",t),k(t.device_id),e(t)}}))})),Kn=(0,e.createEffect)();var Yn=function(e,t,r,i){return new(r||(r=Promise))((function(n,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}l((i=i.apply(e,t||[])).next())}))};Kn.use((()=>Yn(void 0,void 0,void 0,(function*(){return(yield Y.request(yield function(){return Yn(this,void 0,void 0,(function*(){return{method:"GET",url:"ugc/editor-config",params:{}}}))}())).data})))),L.on(Kn.doneData,((e,t)=>{const r=Object.assign({},e);return r.editor=t,r}));class Zn extends ht{attributes(){return["width","height","type","url"]}constructor(){super(),Object.defineProperty(this,"width",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"height",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"type",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_url",{enumerable:!0,configurable:!0,writable:!0,value:""})}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 Xn=f(3981);class Jn{constructor(){Object.defineProperty(this,"images",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"color",{enumerable:!0,configurable:!0,writable:!0,value:""}),Object.defineProperty(this,"gradient",{enumerable:!0,configurable:!0,writable:!0,value:!1})}static createFromArray(e){const t=new Jn;for(let r in e)e.hasOwnProperty(r)&&t.images.push(Zn.createInstance(Zn,e[r]));return t}findOneByType(e){let t=null;return this.images.forEach((r=>{r.type===e&&(t=r)})),t}findOneByWidth(e,t=!1){let r=null;return this.images.forEach((t=>{t.width===e&&(r=t)})),null!==r||t&&void 0!==(r=Xn(this.images))?r:null}}class es extends ht{constructor(){super(...arguments),Object.defineProperty(this,"id",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"feedSlug",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_cover",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"hasFavorite",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"stories",{enumerable:!0,configurable:!0,writable:!0,value:[]})}attributes(){return at()(super.attributes(),["id","cover","hasFavorite","stories"])}set cover(e){this._cover=Jn.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}}var ts=function(e,t,r,i){return new(r||(r=Promise))((function(n,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}l((i=i.apply(e,t||[])).next())}))};const rs=(0,e.createEffect)((e=>ts(void 0,void 0,void 0,(function*(){return xn.fetchUgcFeed(e)})))),is=(0,e.createEffect)((e=>ts(void 0,void 0,void 0,(function*(){return xn.fetchFeed(e)})))),ns=(0,e.createEffect)((()=>ts(void 0,void 0,void 0,(function*(){return xn.fetchFavoriteList()})))),ss=(0,e.createEffect)((e=>ts(void 0,void 0,void 0,(function*(){return xn.fetchOnboardingList(e)})))),os=(0,e.createEffect)((e=>ts(void 0,void 0,void 0,(function*(){return xn.fetchStorySlides(e)})))),as=(0,e.createEffect)((e=>ts(void 0,void 0,void 0,(function*(){return xn.fetchStory(e)})))),ls=(0,e.createEvent)(),ds=(0,e.createEffect)((e=>ts(void 0,[e],void 0,(function*({defaultList:e,onboardingList:t,favoriteList:r,onboardingTags:i,testKey:n,limit:s}){var o;if(yield A(),!1!==e&&W()(e)&&Nt()(e.feedSlug)){const t=e.feedSlug,r=null!==(o=e.filter)&&void 0!==o?o:{};t===gt?yield rs({filter:r,testKey:n}):yield is({feedSlug:t,testKey:n})}r&&(yield ns()),!1!==t&&Nt()(t)&&(yield ss({onboardingList:t,onboardingTags:i,limit:s}))})))),cs=e=>{const t=Ee.getState();for(let r in t.user)hs.call(t.user,r)&&(e=Zt(e,`%${r}%`,t.user[r]));for(let r in t.default)hs.call(t.default,r)&&(e=Zt(e,`%${r}%`,t.default[r]));const r=Le.getState();for(let t in r.user)hs.call(r.user,t)&&(e=Zt(e,`%${t}%`,r.user[t]));for(let t in r.default)hs.call(r.default,t)&&(e=Zt(e,`%${t}%`,r.default[t]));return e},us=(e,t)=>Array.isArray(e)?e.map((e=>Object.assign(Object.assign({},e),{title:e.need_placeholders?cs(e.title):e.title,slidesLoaded:!1,is_opened:rt(e),type:t}))):[];(0,e.sample)({clock:A.doneData,filter:L.map((e=>!e.session.id)),target:L}),(0,e.sample)({clock:L.map((e=>e.placeholders)),target:je}),(0,e.sample)({clock:L.map((e=>e.image_placeholders)),target:Me});const hs=Object.prototype.hasOwnProperty;(0,e.sample)({source:qe,clock:L,fn:(e,t)=>{const r={};for(const i in e)hs.call(e,i)&&(r[i]=e[i].map((e=>Object.assign(Object.assign({},e),{is_opened:rt(e,t.user_key),title:e.need_placeholders?cs(e.title):e.title}))));return r},target:qe});const{storiesListIdsChanged:ps}=(0,e.createApi)(Ye,{storiesListIdsChanged:(e,{storiesIdsUserEntity:t,feedSlug:r,storyList:i})=>{let n=L.getState().user_key||"default";const s=e[n]||{};return void 0===s[Ke.FAVORITE]&&(s[Ke.FAVORITE]=[]),void 0===s[Ke.FEEDS]&&(s[Ke.FEEDS]={}),t===Ke.FEEDS&&r&&(s[Ke.FEEDS][r]=i.map((e=>e.id))),t===Ke.FAVORITE&&(s[Ke.FAVORITE]=i.map((e=>e.id))),Object.assign(Object.assign({},e),{[n]:s})}}),{storiesListItemsAdded:fs}=(0,e.createApi)(qe,{storiesListItemsAdded:(e,{storiesIdsUserEntity:t,feedSlug:r,storyList:i})=>{let n=L.getState().user_key||"default";const s=e[n]||[],o=s.map((e=>e.id));return Object.assign(Object.assign({},e),{[n]:[...s,...i.filter((e=>-1===o.indexOf(e.id))).map((e=>Object.assign(Object.assign({},e),{slides:[]})))]})}}),{storyFeedsAdded:gs}=(0,e.createApi)(He,{storyFeedsAdded:(e,t)=>Object.assign(Object.assign({},e),t)});(0,e.sample)({clock:is.doneData.map((e=>{let t={};return t[e.feedSlug]=ht.createInstance(es,e),t})),target:[gs]}),(0,e.sample)({clock:rs.doneData.map((e=>{let t={};return t[gt]=ht.createInstance(es,e),t})),target:[gs]}),(0,e.sample)({clock:is.doneData.map((e=>{const t=us(e.stories,We.DEFAULT);return{storiesIdsUserEntity:Ke.FEEDS,feedSlug:e.feedSlug,storyList:t}})),target:[fs,ps]}),(0,e.sample)({clock:rs.doneData.map((e=>{const t=us(e,We.UGC);return{storiesIdsUserEntity:Ke.FEEDS,feedSlug:gt,storyList:t}})),target:[fs,ps]}),(0,e.sample)({clock:ss.doneData.map((e=>{const t=us(e.stories,We.DEFAULT);return{storiesIdsUserEntity:Ke.FEEDS,feedSlug:`onboarding_${e.feedSlug}`,storyList:t}})),target:[fs,ps]}),(0,e.sample)({clock:ns.doneData.map((e=>{const t=us(e,We.DEFAULT);return{storiesIdsUserEntity:Ke.FAVORITE,feedSlug:null,storyList:t}})),target:[fs,ps]});const vs=(e,t)=>Object.assign(Object.assign({},e),{slidesLoaded:!0,error:null,is_opened:rt(e),slides:t.slides.map((t=>Object.assign(Object.assign({},t),{html:e.need_placeholders?cs(t.html):t.html})))}),ms=()=>L.getState().user_key||"default",ys=(e,t)=>(e[t]||[]).slice(),bs=(e,t)=>e.findIndex((e=>e.id===t)),ws=(e,t)=>{const r=ms(),i=ys(e,r),n=bs(i,t.id);return-1===n?i.push(vs(t,t)):i[n]=vs(i[n],t),Object.assign(Object.assign({},e),{[r]:i})},Ss=(e,{params:{id:t},error:r})=>{const i=ms(),n=ys(e,i),s=bs(n,t);if(-1===s){const e=$e(t);e.error=r,n.push(e)}else n[s]=Object.assign(Object.assign({},n[s]),{slidesLoaded:!1,error:r});return Object.assign(Object.assign({},e),{[i]:n})};qe.on(ze.fail,((e,{params:{ids:t},error:r})=>{const i=ms(),n=ys(e,i);for(const e of t){const t=bs(n,e);if(-1===t){const t=$e(e);t.error=r,n.push(t)}else n[t]=Object.assign(Object.assign({},n[t]),{slidesLoaded:!1,error:r})}return Object.assign(Object.assign({},e),{[i]:n})})),qe.on(os.doneData,ws),qe.on(as.doneData,ws),qe.on(os.fail,Ss),qe.on(as.fail,Ss),qe.on(ls,((e,{id:t,story:r})=>{const i=ms(),n=ys(e,i),s=bs(n,t);return-1===s?e:(n[s]=Object.assign(Object.assign({},n[s]),r),Object.assign(Object.assign({},e),{[i]:n}))})),(0,e.sample)({source:qe,clock:Ee,fn:e=>{const t={};for(const r in e)hs.call(e,r)&&(t[r]=e[r].map((e=>Object.assign(Object.assign({},e),{slides:e.slides.map((t=>Object.assign(Object.assign({},t),{html:e.need_placeholders?cs(t.html):t.html})))}))));return t},target:qe});var _s=f(3514),xs=f.n(_s),Os=f(2438),Cs=f.n(Os),ks=function(e,t,r,i){return new(r||(r=Promise))((function(n,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}l((i=i.apply(e,t||[])).next())}))};class Ls{static updateStoryLike(e,t){return ks(this,void 0,void 0,(function*(){let r=!1;const i={like:void 0};let n="";try{const s=yield Y.post(`story-like/${e}`,{value:t});void 0!==s.data.like?(r=!0,i.like=s.data.like,nt({id:e,like:i.like})):n="response.data.like is undefined"}catch(e){n=e.toString()}if(r)return i;throw n}))}static getStorySharePath(e){return ks(this,void 0,void 0,(function*(){let t=!1;const r={url:void 0};let i="";try{const n=yield Y.get(`story-share/${e}`,{});void 0!==n.data.url?(t=!0,r.url=n.data.url):i="response.data.url is undefined"}catch(e){i=e.toString()}if(t)return r;throw i}))}static markAsOpened(e){if(!xs()(L.getState().user_key)){const t=`u/${L.getState().user_key}/s_opened`;let r=un(t);ke()(r)||(r=[]),r.push(e),r=Cs()(r),hn(t,r)}st({id:e})}static setBookmark(e,t){return ks(this,void 0,void 0,(function*(){let r=!1;const i={favorite:void 0};let n="";try{const s=yield Y.post(`story-favorite/${e}`,{value:t});void 0!==s.data.favorite?(r=!0,i.favorite=Boolean(s.data.favorite),!1===i.favorite?ps({storiesIdsUserEntity:Ke.FAVORITE,feedSlug:null,storyList:et.getState().filter((t=>t.id!==e))}):ps({storiesIdsUserEntity:Ke.FAVORITE,feedSlug:null,storyList:[...et.getState(),...Qe.getState().filter((t=>t.id===e))]}),it({id:e,favorite:i.favorite})):n="response.data.favorite is undefined"}catch(e){n=e.toString()}if(r)return i;throw n}))}}class As{constructor(){Object.defineProperty(this,"prevStoryId",{enumerable:!0,configurable:!0,writable:!0,value:-1}),Object.defineProperty(this,"prevSlideIndex",{enumerable:!0,configurable:!0,writable:!0,value:-1})}update({currentSlideIndex:e,currentStoryId:t}){this.prevStoryId!==t&&ar.emit("publicEvents.showStory",{id:t,index:e}),-1!==this.prevStoryId&&ar.emit(rn.NextSlide,{fromStoryId:this.prevStoryId,fromSlideIndex:this.prevSlideIndex}),ar.emit("publicEvents.showSlide",{id:t,index:e}),this.prevStoryId=t,this.prevSlideIndex=e}reset(){this.prevStoryId=-1,this.prevSlideIndex=-1}}var Ms=function(e,t,r,i){return new(r||(r=Promise))((function(n,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}l((i=i.apply(e,t||[])).next())}))};class Es extends Error{constructor(){super("The list of onboarding stories is empty")}}class Ps{constructor(e,t){Object.defineProperty(this,"showMultipleStoriesStrategy",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:t})}show(e){return Ms(this,void 0,void 0,(function*(){let t="onboarding";e.feed&&(t=e.feed),yield ds({defaultList:!1,favoriteList:!1,onboardingList:t,onboardingTags:e.customTags,limit:e.limit});const r=ft(Re.onboarding,t);if(!r.length)throw new Es;this.emitFeedLoad(t,r),yield this.showMultipleStoriesStrategy.show({windowReferer:Te.default,listType:Re.onboarding,storyId:r[0].id,feed:t})}))}emitFeedLoad(e,t){const r={stories:t.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),Object.assign({id:e.id},t)})),feed:null,filter:null};r.feed=e,this.storyManager.emit("feedLoad",r)}reload(e){return Ms(this,void 0,void 0,(function*(){this.showMultipleStoriesStrategy.reload(e)}))}}var js=function(e,t,r,i){return new(r||(r=Promise))((function(n,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}l((i=i.apply(e,t||[])).next())}))};class Is{constructor(e,t){Object.defineProperty(this,"storyReaderViewModel",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"storyReaderStoriesService",{enumerable:!0,configurable:!0,writable:!0,value:t})}show(e){return js(this,void 0,void 0,(function*(){const t=vt(e.feed),r=((e,t,r)=>{const i=ft(e.listType,r);let n=L.getState().share;return t===We.UGC&&(n=!1),Object.assign(Object.assign({},e),{id:e.storyId,storyContext:Ve.getState(),storyList:i,hasShare:n,placeholders:Ue()})})(e,t,e.feed);this.storyReaderViewModel.open(r,{listType:e.listType,feedSlug:e.feed,filter:e.filter});const i=yield this.storyReaderStoriesService.fetchStoriesSlidesAndContextByStoryId({storyId:e.storyId,listType:e.listType,feed:e.feed});this.storyReaderViewModel.setStoriesAndContext(i)}))}reload(e){return js(this,void 0,void 0,(function*(){const t=yield this.storyReaderStoriesService.fetchStoriesSlidesAndContextByStoryId(e);this.storyReaderViewModel.setStoriesAndContext(t)}))}}var Ts=function(e,t,r,i){return new(r||(r=Promise))((function(n,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}l((i=i.apply(e,t||[])).next())}))};class Rs{constructor(e){Object.defineProperty(this,"showStoryStrategy",{enumerable:!0,configurable:!0,writable:!0,value:e})}show(e){return Ts(this,void 0,void 0,(function*(){try{return yield this.showStoryStrategy.show({storyId:e.storyId,feed:"",fetchShareUrl:e.fetchShareUrl}),e.fetchShareUrl&&ct(!1),!0}catch(e){return!1}}))}reload(e){return Ts(this,void 0,void 0,(function*(){return this.showStoryStrategy.reload(e)}))}}var Ds=function(e,t,r,i){return new(r||(r=Promise))((function(n,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}l((i=i.apply(e,t||[])).next())}))};class Bs{constructor(e,t){Object.defineProperty(this,"storyReaderViewModel",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"storyReaderStoriesService",{enumerable:!0,configurable:!0,writable:!0,value:t})}show(e){return Ds(this,void 0,void 0,(function*(){var t;try{let r=this.storyReaderStoriesService.getOrCreateDirectStoryById(e.storyId);if(r.is_opened)throw new Sn(e.storyId.toString());if(!r.slidesLoaded){if(r=null!==(t=yield this.storyReaderStoriesService.fetchStoryAndContextById({storyId:e.storyId,feed:"",once:!0,listType:Re.direct}))&&void 0!==t?t:r,r.error)throw r.error;r.slidesLoaded=!1}const i=mt(r);this.storyReaderViewModel.open(i,{listType:Re.direct,feedSlug:"",once:!0}),r.slidesLoaded||(yield zn((new Date).getTime()),r.slidesLoaded=!0,this.storyReaderViewModel.setStoriesAndContext({listType:Re.direct,storyList:[r],storyContext:Ve.getState()}))}catch(e){throw this.storyReaderViewModel.close(),e}}))}reload(e){return Ds(this,void 0,void 0,(function*(){var t;const r=yield this.storyReaderStoriesService.fetchStoryAndContextById(Object.assign(Object.assign({},e),{feed:null!==(t=e.feed)&&void 0!==t?t:""}));this.storyReaderViewModel.setStoriesAndContext({listType:Re.direct,storyList:[r],storyContext:Ve.getState()})}))}}var Ns,Fs=function(e,t,r,i){return new(r||(r=Promise))((function(n,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}l((i=i.apply(e,t||[])).next())}))};class Us{constructor(e,t){Object.defineProperty(this,"storyReaderViewModel",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"storyReaderStoriesService",{enumerable:!0,configurable:!0,writable:!0,value:t})}show(e){return Fs(this,void 0,void 0,(function*(){var t,r;let i=this.storyReaderStoriesService.getOrCreateDirectStoryById(e.storyId);if(!i.slidesLoaded){if(i=yield this.storyReaderStoriesService.fetchStoryAndContextById({storyId:e.storyId,feed:null!==(t=e.feed)&&void 0!==t?t:"",listType:Re.direct,fetchShareUrl:e.fetchShareUrl}),i.error)throw i.error;i.slidesLoaded=!1}const n=mt(i);this.storyReaderViewModel.open(n,{listType:Re.direct,feedSlug:null!==(r=e.feed)&&void 0!==r?r:"",fetchShareUrl:e.fetchShareUrl}),i.slidesLoaded||(yield zn((new Date).getTime()),i.slidesLoaded=!0,this.storyReaderViewModel.setStoriesAndContext({listType:Re.direct,storyList:[i],storyContext:Ve.getState()}))}))}reload(e){return Fs(this,void 0,void 0,(function*(){var t;const r=yield this.storyReaderStoriesService.fetchStoryAndContextById(Object.assign(Object.assign({},e),{feed:null!==(t=e.feed)&&void 0!==t?t:""}));this.storyReaderViewModel.setStoriesAndContext({listType:Re.direct,storyList:[r],storyContext:Ve.getState()})}))}}!function(e){e[e.ShowStory=0]="ShowStory",e[e.ShowStoryOnce=1]="ShowStoryOnce",e[e.ShowStoryFromSharePage=2]="ShowStoryFromSharePage",e[e.ShowOnboardingStories=3]="ShowOnboardingStories",e[e.ShowMultipleStories=4]="ShowMultipleStories"}(Ns||(Ns={}));class Vs{create(e,t,r,i){switch(e){case Ns.ShowStory:return new Us(t,r);case Ns.ShowStoryOnce:return new Bs(t,r);case Ns.ShowStoryFromSharePage:return new Rs(new Us(t,r));case Ns.ShowOnboardingStories:return new Ps(new Is(t,r),i);case Ns.ShowMultipleStories:return new Is(t,r);default:throw new Error(`Strategy for type "${e}" not found.`)}}}const zs=.53167701863,Gs=.64516129032;class Ws{constructor(e,t,r){Object.defineProperty(this,"_vw",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"_vh",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"padding",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"viewportRatio",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.viewportRatio=e/t}get vw(){return this._vw}get vh(){return this._vh}get vhWitoutPadding(){return this._vh-this.padding.top-this.padding.bottom}getOffset(e){const t=this._vw,r=this.vhWitoutPadding-e,i=this.calculateWidthWithActionPanel(e),n=this.calculateHeightWithActionPanel(e);return this.viewportRatio>Gs?Math.ceil(n-r)/2*-1+"px auto":`0 ${Math.ceil(i-t)/2*-1}px`}getOffsetX(e){const t=this.calculateWidthWithActionPanel(e);return this.viewportRatio>Gs?"0px":Math.ceil(t-this._vw)/2+"px"}getOffsetY(e){const t=this.vhWitoutPadding-e;return this.viewportRatio>Gs?`${Math.ceil(this.calculateHeight()-t)}px`:"0px"}getWidth(){return this.viewportRatio>Gs?`${this.calculateWidth()}px`:"auto"}getHeight(){return this.viewportRatio>Gs?`${this.calculateHeight()}px`:"100%"}getFontSize(){return this.calculateWidth()/20+"px"}calculateWidth(){return Math.ceil(this.vhWitoutPadding*Gs)}calculateHeight(){return Math.ceil(this.calculateWidth()/Gs)}calculateWidthWithActionPanel(e){const t=this.vhWitoutPadding-e;return Math.ceil(t*Gs)}calculateHeightWithActionPanel(e){return Math.ceil(this.calculateWidthWithActionPanel(e)/Gs)}}class $s{constructor(e,t,r){Object.defineProperty(this,"_vw",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"_vh",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"padding",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"viewportRatio",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.viewportRatio=e/t}get vw(){return this._vw}get vh(){return this._vh}get vhWitoutPadding(){return this._vh-this.padding.top-this.padding.bottom}getOffset(e){const t=this._vw,r=this.vhWitoutPadding-e,i=this.calculateWidthWithActionPanel(e),n=this.calculateHeight();return n>r?Math.ceil(n-r)/2*-1+"px auto":`0 ${Math.ceil(i-t)/2*-1}px`}getOffsetX(e){const t=this.calculateWidthWithActionPanel(e),r=this.vhWitoutPadding-e,i=this.calculateHeight(),n=this._vw;return i>r?"0px":Math.ceil(t-n)/2+"px"}getOffsetY(e){const t=this.vhWitoutPadding-e,r=this.calculateHeight();return r>t?Math.ceil(r-t)/2+"px":"0px"}getWidth(){return this.viewportRatio>Gs?`${this.calculateWidth()}px`:"auto"}getHeight(){return this.viewportRatio>Gs?`${this.calculateHeight()}px`:"100%"}getFontSize(){return this.calculateWidth()/20+"px"}calculateWidth(){return this.viewportRatio>Gs?this._vw:Math.ceil(this.vhWitoutPadding*Gs)}calculateHeight(){return Math.ceil(this._vw/Gs)}calculateWidthWithActionPanel(e){const t=this.vhWitoutPadding-e;return this.viewportRatio>Gs?this._vw:Math.ceil(t*Gs)}}class Hs{constructor(e){Object.defineProperty(this,"safeAreaFrameCalculator",{enumerable:!0,configurable:!0,writable:!0,value:e})}create(e){const t=e.vw/e.vh;return e.desktopMode&&t>Gs?this.createDesktopStoryGeometry(e):this.createMobileStoryGeometry(e)}createDesktopStoryGeometry(e){return new Ws(e.vw,e.vh,{top:50,bottom:50})}createMobileStoryGeometry(e){var t,r;const{paddingTop:i,paddingBottom:n}=this.safeAreaFrameCalculator.getViewportCorrectionPadding();return new $s(e.vw,e.vh,{top:null!==(t=parseFloat(i))&&void 0!==t?t:0,bottom:null!==(r=parseFloat(n))&&void 0!==r?r:0})}}class qs{constructor(e,t,r){Object.defineProperty(this,"_vw",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"_vh",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"actionPanelHeight",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"viewportRatio",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.viewportRatio=e/t}get shouldBeShownSafeAreaInsets(){return this.viewportRatio<zs}getViewportCorrectionPadding(){const{paddingTop:e,paddingBottom:t}=this.calcFrameWidthByMobileAspectRatio();return{paddingTop:e+"px",paddingBottom:t+"px"}}calcFrameWidthByMobileAspectRatio(){const e=this._vh-this._vw/zs,t=Math.max(Math.min(e-this.actionPanelHeight,this.actionPanelHeight),0);return{paddingTop:Math.max(e-t,0),paddingBottom:t}}}class Qs extends J.EventEmitter{constructor(){super(...arguments),Object.defineProperty(this,"timer",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"currentProgress",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"progressBeforePause",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"timerPaused",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"cancelAnimationFcn",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"timeout",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"isCompleted",{enumerable:!0,configurable:!0,writable:!0,value:!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,r;if("performance"in window==0||"now"in window.performance==0){let e=Date.now();performance.timing&&performance.timing.navigationStart&&(e=performance.timing.navigationStart),r=Date.now()-e}else r=performance.now();return t=requestAnimationFrame((function i(n){let s;if(s=(n-r)/e.duration,s>1&&(s=1),e.forceEnd()&&(s=1),!e.paused()){let r=e.timing(s);e.draw(r),s<1&&(t=requestAnimationFrame(i))}})),()=>{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 r=100*this.currentProgress;this.emit("progress",r)}}var Ks;!function(e){e.None="none",e.Init="init",e.StartLoading="startLoading",e.Loading="loading",e.Loaded="loaded",e.Starting="starting",e.Started="started",e.Paused="paused",e.Error="error",e.Destroyed="destroyed"}(Ks||(Ks={}));const Ys=(e,t)=>{var r,i,n,s;const o=t.dataset;let a=null;const l=null!==(r=o.elementId)&&void 0!==r?r:"",d=null!==(i=o.linkType)&&void 0!==i?i:"",c=null!==(n=o.linkTarget)&&void 0!==n?n:"",u={url:()=>{a=decodeURIComponent(c),Zs({activeStory:e,url:a,elementId:l}),Xs(e,{linkType:d,url:a,elementId:l})},customAction:()=>{a=c,Zs({activeStory:e,url:a,elementId:l}),Xs(e,{linkType:d,url:a,elementId:l})},slide:()=>{e.redirectToSlide({slideIndex:parseInt(c),layerIndex:0})},story:()=>{const t=parseInt(c);Zs({activeStory:e,url:c,elementId:l}),ar.emit(`${Ao.name}.redirectToStory`,{storyId:t,feedSlug:"default"})},game:()=>{Zs({activeStory:e,url:c,elementId:l}),ar.emit(`${Da.name}.openGame`,{gameId:c})},layer:()=>{ar.emit(ro.ShowLayer,{index:parseInt(c)})},closeStory:()=>{ar.emit(`${Ao.name}.closeStory`)}};null===(s=u[d])||void 0===s||s.call(u)},Zs=({activeStory:e,url:t,elementId:r})=>{ar.emit("publicEvents.widgetEvent",{name:"w-link",devPayload:{story_id:e.id,slide_index:e.activeSlideIndex,widget_id:r,widget_label:"",widget_value:t}})},Xs=(e,{linkType:t,url:r,elementId:i})=>{e.markAsOpened(),ar.emit(rn.TransitionFromSlide,{storyId:e.id,slideIndex:e.activeSlideIndex}),"url"===t&&ar.emit("publicEvents.clickOnButton",{id:e.id,index:e.activeSlideIndex,url:r,elementId:i})};var Js=function(e,t,r,i){return new(r||(r=Promise))((function(n,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}l((i=i.apply(e,t||[])).next())}))};class eo{constructor(e){Object.defineProperty(this,"animationApi",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"slideElement",{enumerable:!0,configurable:!0,writable:!0,value: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)}}const to=(e=>{var t={};return f.d(t,e),t})({action:()=>n.action,computed:()=>n.computed,observable:()=>n.observable});var ro,io,no=function(e,t,r){for(var i=arguments.length>2,n=0;n<t.length;n++)r=i?t[n].call(e,r):t[n].call(e);return i?r:void 0},so=function(e,t,r,i,n,s){function o(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var a,l=i.kind,d="getter"===l?"get":"setter"===l?"set":"value",c=!t&&e?i.static?e:e.prototype:null,u=t||(c?Object.getOwnPropertyDescriptor(c,i.name):{}),h=!1,p=r.length-1;p>=0;p--){var f={};for(var g in i)f[g]="access"===g?{}:i[g];for(var g in i.access)f.access[g]=i.access[g];f.addInitializer=function(e){if(h)throw new TypeError("Cannot add initializers after decoration has completed");s.push(o(e||null))};var v=(0,r[p])("accessor"===l?{get:u.get,set:u.set}:u[d],f);if("accessor"===l){if(void 0===v)continue;if(null===v||"object"!=typeof v)throw new TypeError("Object expected");(a=o(v.get))&&(u.get=a),(a=o(v.set))&&(u.set=a),(a=o(v.init))&&n.unshift(a)}else(a=o(v))&&("field"===l?n.unshift(a):u[d]=a)}c&&Object.defineProperty(c,i.name,u),h=!0},oo=function(e,t,r,i){return new(r||(r=Promise))((function(n,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}l((i=i.apply(e,t||[])).next())}))},ao=function(e,t,r,i){if("a"===r&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?i:"a"===r?i.call(e):i?i.value:t.get(e)},lo=function(e,t,r,i,n){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!n)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?n.call(e,r):n?n.value=r:t.set(e,r),r};!function(e){e.PerformShareAction="performShareAction",e.PerformScreenShotShareAction="performScreenShotShareAction",e.ShowToast="showToast",e.ShowInputModal="showInputModal",e.ShowLayer="showLayer"}(ro||(ro={})),function(e){e.Start="start",e.ChangeState="changeState"}(io||(io={}));let co=(()=>{var e,t,r;let i,n,s,o,a,l,d,c,u,h,p=J.EventEmitter,f=[],g=[],v=[],m=[],y=[];return e=class extends p{get _state(){return ao(this,t,"f")}set _state(e){lo(this,t,e,"f")}get _muted(){return ao(this,r,"f")}set _muted(e){lo(this,r,e,"f")}constructor(e,i,n,s,o,a,l){super(),Object.defineProperty(this,"_story",{enumerable:!0,configurable:!0,writable:!0,value:(no(this,f),e)}),Object.defineProperty(this,"_index",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(this,"widgetManager",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(this,"animationApi",{enumerable:!0,configurable:!0,writable:!0,value:s}),Object.defineProperty(this,"layersManager",{enumerable:!0,configurable:!0,writable:!0,value:o}),Object.defineProperty(this,"slideApiHandlers",{enumerable:!0,configurable:!0,writable:!0,value:a}),Object.defineProperty(this,"slideDto",{enumerable:!0,configurable:!0,writable:!0,value:l}),Object.defineProperty(this,"id",{enumerable:!0,configurable:!0,writable:!0,value:Date.now()}),t.set(this,no(this,g,Ks.None)),Object.defineProperty(this,"videoManager",{enumerable:!0,configurable:!0,writable:!0,value:(no(this,v),null)}),Object.defineProperty(this,"narrativeAnimationContext",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),r.set(this,no(this,m,!1)),Object.defineProperty(this,"_navigationDisabled",{enumerable:!0,configurable:!0,writable:!0,value:(no(this,y),!1)}),Object.defineProperty(this,"slideContent",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"slideContentInnerHTML",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.narrativeAnimationContext=new eo(this.animationApi)}get state(){return this._state}get index(){return this._index}get story(){return this._story}get muted(){return this._muted}get navigationDisabled(){return this._navigationDisabled}get widgets(){return this.widgetManager.widgets.filter((e=>e.isInited))}get timeline(){return this.slideDto.timeline}get duration(){return this.slideDto.duration}get screenshotShare(){return this.slideDto.screenshot_share}get html(){return this.slideDto.html}get eventPayload(){return this.slideDto.event_payload}findWidgetByType(e){return this.widgetManager.findWidgetByType(e)}resume(){return oo(this,void 0,void 0,(function*(){var e;try{if(this.state!==Ks.Paused)return;yield null===(e=this.videoManager)||void 0===e?void 0:e.resume(),this.narrativeAnimationContext.resume(),this.widgetManager.resume(),lt(`[SLIDE][resume]:${this.story.id}:${this.index}`),this.setState(Ks.Started)}catch(e){console.error(e)}}))}pause(){var e;this.state===Ks.Started&&(null===(e=this.videoManager)||void 0===e||e.pause(),this.narrativeAnimationContext.pause(),this.widgetManager.pause(),lt(`[SLIDE][pause]:${this.story.id}:${this.index}`),this.setState(Ks.Paused))}mute(){var e;this._muted=!0,null===(e=this.videoManager)||void 0===e||e.mute()}unmute(){var e;this._muted=!1,null===(e=this.videoManager)||void 0===e||e.unmute()}showLayerByIndex(e){this.layersManager.showLayerByIndex(e)}reload(){return oo(this,void 0,void 0,(function*(){yield this.load(),this.state===Ks.Loaded&&this.start()}))}init(e){return oo(this,void 0,void 0,(function*(){this._state===Ks.None&&(this.setState(Ks.Init),this.slideContent=e,this.slideContentInnerHTML=this.slideContent.innerHTML,this.parseNavigationDisable(),this.videoManager=Zr.create(this.slideContent,this.layersManager),this.narrativeAnimationContext.init(this.slideContent),lt(`[SLIDE][init]:${this.story.id}:${this.index}`),yield this.widgetManager.init(this.slideContent),yield this.load())}))}start(){return oo(this,void 0,void 0,(function*(){var e;try{if(this.state===Ks.Starting)return;if(this.state!==Ks.Loaded)throw new Error(`You must initialize the slide first. State: ${this.state}`);this.setState(Ks.Starting),yield null===(e=this.videoManager)||void 0===e?void 0:e.start(),this.narrativeAnimationContext.start(),lt(`[SLIDE][start]:${this.story.id}:${this.index}`),this.setState(Ks.Started),this.slideApiHandlers.lock(this),this.slideApiHandlers.exec(),this.story.updateNavigationHistory(),this.startTimer(),this.emit(io.Start)}catch(e){console.error(e)}}))}stop(){var e;this.state===Ks.Started&&(this.narrativeAnimationContext.stop(),this.slideApiHandlers.unlock(this),lt(`[SLIDE][stop]:${this.story.id}:${this.index}`),this.widgetManager.stop(),this.resetSlideContentHTML(),this.setState(Ks.None),null===(e=this.videoManager)||void 0===e||e.destroy().catch(console.error))}setUserData(e,t){for(const r of this.widgets)r.setUserData(e,t)}resetSlideContentHTML(){this.slideContent.innerHTML=this.slideContentInnerHTML}setState(e){this._state=e,this.changeTimelineVisibilityByState(),this.emit(io.ChangeState,e)}load(){return oo(this,void 0,void 0,(function*(){var e;if(this.state!==Ks.Loaded)try{lt(`[SLIDE][start_load]:${this.story.id}:${this.index}`),this.setState(Ks.StartLoading),yield this.loadResources(),yield(e=this.slideContent,Js(void 0,void 0,void 0,(function*(){let t=0;return new Promise((r=>{const i=()=>{t++,e.getBoundingClientRect().height>0||t>10?r():requestAnimationFrame(i)};i()}))}))),this.fitNarrativeTextLines(),this.setState(Ks.Loaded),lt(`[SLIDE][end_load]:${this.story.id}:${this.index}`)}catch(e){console.error(e),this.setState(Ks.Error)}}))}loadResources(){return oo(this,void 0,void 0,(function*(){return new Promise(((e,t)=>oo(this,void 0,void 0,(function*(){var r;let i=setTimeout((()=>{lt("[SLIDE]: Resources were not loaded"),t()}),4e3);try{yield this.loadMediaResources(this.slideContent),yield this.loadFonts(),Hr.hasVideo(this.slideContent)&&(this.setState(Ks.Loading),yield null===(r=this.videoManager)||void 0===r?void 0:r.init(this.slideContent)),e()}catch(e){t(e)}finally{clearTimeout(i)}}))))}))}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 r=function(e){return new Promise((function(t,r){if("img"===e.tagName.toLowerCase()&&e instanceof HTMLImageElement){const r=()=>{requestAnimationFrame((()=>requestAnimationFrame((()=>{t(e),e.removeEventListener("load",r)}))))};e.addEventListener("load",r),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 i=e.target.closest(".narrative-element-image");i&&(i.style.display="none")}r(e)}))}))},i=e.querySelectorAll("img,video");let n,s=[];for(n=0;n<i.length;++n)s.push(r(i[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();Fr(e,{})}parseNavigationDisable(){const e=this.slideContent.querySelector(".narrative-slide");if(!e)return!1;this._navigationDisabled="1"===e.dataset.disableNavigation}changeTimelineVisibilityByState(){this.state===Ks.Error||this.state===Ks.Loading?this.story.hideTimeline():this.story.showTimeline()}startTimer(){var e;this.story.timer.started||this.story.timer.start(null!==(e=this.duration)&&void 0!==e?e:0)}},t=new WeakMap,r=new WeakMap,(()=>{var t;const r="function"==typeof Symbol&&Symbol.metadata?Object.create(null!==(t=p[Symbol.metadata])&&void 0!==t?t:null):void 0;i=[to.observable],n=[to.observable],s=[to.computed],o=[to.computed],a=[to.action],l=[to.action],d=[to.action],c=[to.action],u=[to.action],h=[to.action],so(e,null,i,{kind:"accessor",name:"_state",static:!1,private:!1,access:{has:e=>"_state"in e,get:e=>e._state,set:(e,t)=>{e._state=t}},metadata:r},g,v),so(e,null,n,{kind:"accessor",name:"_muted",static:!1,private:!1,access:{has:e=>"_muted"in e,get:e=>e._muted,set:(e,t)=>{e._muted=t}},metadata:r},m,y),so(e,null,s,{kind:"getter",name:"state",static:!1,private:!1,access:{has:e=>"state"in e,get:e=>e.state},metadata:r},null,f),so(e,null,o,{kind:"getter",name:"muted",static:!1,private:!1,access:{has:e=>"muted"in e,get:e=>e.muted},metadata:r},null,f),so(e,null,a,{kind:"method",name:"resume",static:!1,private:!1,access:{has:e=>"resume"in e,get:e=>e.resume},metadata:r},null,f),so(e,null,l,{kind:"method",name:"pause",static:!1,private:!1,access:{has:e=>"pause"in e,get:e=>e.pause},metadata:r},null,f),so(e,null,d,{kind:"method",name:"mute",static:!1,private:!1,access:{has:e=>"mute"in e,get:e=>e.mute},metadata:r},null,f),so(e,null,c,{kind:"method",name:"unmute",static:!1,private:!1,access:{has:e=>"unmute"in e,get:e=>e.unmute},metadata:r},null,f),so(e,null,u,{kind:"method",name:"start",static:!1,private:!1,access:{has:e=>"start"in e,get:e=>e.start},metadata:r},null,f),so(e,null,h,{kind:"method",name:"stop",static:!1,private:!1,access:{has:e=>"stop"in e,get:e=>e.stop},metadata:r},null,f),r&&Object.defineProperty(e,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:r})})(),e})();class uo{create({story:e,slideApi:t,slideApiHandlers:r,slideDto:i,index:n}){const s=new Nr(e),o=new ei(t,s,e);return new co(e,n,o,t.Animation,s,r,i)}}var ho=function(e,t,r){for(var i=arguments.length>2,n=0;n<t.length;n++)r=i?t[n].call(e,r):t[n].call(e);return i?r:void 0},po=function(e,t,r,i,n,s){function o(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var a,l=i.kind,d="getter"===l?"get":"setter"===l?"set":"value",c=!t&&e?i.static?e:e.prototype:null,u=t||(c?Object.getOwnPropertyDescriptor(c,i.name):{}),h=!1,p=r.length-1;p>=0;p--){var f={};for(var g in i)f[g]="access"===g?{}:i[g];for(var g in i.access)f.access[g]=i.access[g];f.addInitializer=function(e){if(h)throw new TypeError("Cannot add initializers after decoration has completed");s.push(o(e||null))};var v=(0,r[p])("accessor"===l?{get:u.get,set:u.set}:u[d],f);if("accessor"===l){if(void 0===v)continue;if(null===v||"object"!=typeof v)throw new TypeError("Object expected");(a=o(v.get))&&(u.get=a),(a=o(v.set))&&(u.set=a),(a=o(v.init))&&n.unshift(a)}else(a=o(v))&&("field"===l?n.unshift(a):u[d]=a)}c&&Object.defineProperty(c,i.name,u),h=!0},fo=function(e,t,r,i){return new(r||(r=Promise))((function(n,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}l((i=i.apply(e,t||[])).next())}))},go=function(e,t,r,i){if("a"===r&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?i:"a"===r?i.call(e):i?i.value:t.get(e)},vo=function(e,t,r,i,n){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!n)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?n.call(e,r):n?n.value=r:t.set(e,r),r};let mo=(()=>{var e,t,r,i,n,s,o,a;let l,d,c,u,h,p,f,g,v,m,y,b,w,S,_,x,O,C,k,A,M,E,P,j,I,T,R,D,B,N,F,U,V,z,G,W,$=Vt,H=[],q=[],Q=[],K=[],Y=[],Z=[],X=[],J=[],ee=[],te=[],re=[],ie=[],ne=[],se=[],oe=[];return e=class extends ${get storiesItem(){return go(this,t,"f")}set storiesItem(e){vo(this,t,e,"f")}get _activeSlideIndex(){return go(this,r,"f")}set _activeSlideIndex(e){vo(this,r,e,"f")}get _displayedSlides(){return go(this,i,"f")}set _displayedSlides(e){vo(this,i,e,"f")}get _hiddenTimeline(){return go(this,n,"f")}set _hiddenTimeline(e){vo(this,n,e,"f")}get slides(){return go(this,s,"f")}set slides(e){vo(this,s,e,"f")}get _like(){return go(this,o,"f")}set _like(e){vo(this,o,e,"f")}get _favorite(){return go(this,a,"f")}set _favorite(e){vo(this,a,e,"f")}constructor(e,l,d,c){super(),Object.defineProperty(this,"slideApi",{enumerable:!0,configurable:!0,writable:!0,value:(ho(this,H),l)}),Object.defineProperty(this,"slideApiHandlers",{enumerable:!0,configurable:!0,writable:!0,value:d}),Object.defineProperty(this,"navigationHistory",{enumerable:!0,configurable:!0,writable:!0,value:c}),t.set(this,ho(this,q,void 0)),r.set(this,(ho(this,Q),ho(this,K,0))),i.set(this,(ho(this,Y),ho(this,Z,[]))),n.set(this,(ho(this,X),ho(this,J,!1))),s.set(this,(ho(this,ee),ho(this,te,[]))),o.set(this,(ho(this,re),ho(this,ie,0))),a.set(this,(ho(this,ne),ho(this,se,!1))),Object.defineProperty(this,"_hasShare",{enumerable:!0,configurable:!0,writable:!0,value:(ho(this,oe),!1)}),Object.defineProperty(this,"_timer",{enumerable:!0,configurable:!0,writable:!0,value:new Qs}),this.updateStoriesItem(e),this.redirectToSlide=this.redirectToSlide.bind(this),this.nextSlide=this.nextSlide.bind(this),this._hasShare=L.getState().share}get id(){return this.storiesItem.id}get title(){return this.storiesItem.title}get slidesLoaded(){return this.storiesItem.slidesLoaded}get like(){return this._like}get favorite(){return this._favorite}get hasLike(){return Boolean(this.storiesItem.like_functional)}get hasShare(){return!!Boolean(this.storiesItem.share_functional)&&this._hasShare}get hasFavorite(){return Boolean(this.storiesItem.favorite_functional)}get hasAudio(){return Boolean(this.storiesItem.has_audio)}get displayedSlides(){return this._displayedSlides}get activeSlideIndex(){return this._activeSlideIndex}get activeSlide(){return this.slides[this._activeSlideIndex]}get slidesCount(){var e;return null!==(e=this.storiesItem.slides_count)&&void 0!==e?e:0}get hiddenTimeline(){return 1===this.storiesItem.slides.length&&0===this.storiesItem.slides[0].duration||this.storiesItem.hide_timeline||this._hiddenTimeline||!this.slidesLoaded}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}get error(){return this.storiesItem.error}get timer(){return this._timer}nextSlide(){this.reachEnd||this.toSlide(this.activeSlideIndex+1)}prevSlide(){this.reachStart||this.toSlide(this.activeSlideIndex-1)}toSlide(e){this._activeSlideIndex=e,this._displayedSlides=this.getDisplayedSlides(),this.timer.stop()}updateStoriesItem(e){this.storiesItem=e,this.slides=this.createSlidesViewModelsByDto(e.slides),this._like=this.storiesItem.like,this._favorite=this.storiesItem.favorite,this._displayedSlides=this.getDisplayedSlides()}updateNavigationHistory(){this.navigationHistory.update({currentSlideIndex:this.activeSlideIndex,currentStoryId:this.id})}setLike(e){this.updateStoryLike(e),ar.emit("publicEvents.likeStory",{id:this.id,index:this.activeSlideIndex,value:1===e})}setDislike(e){this.updateStoryLike(e),ar.emit("publicEvents.dislikeStory",{id:this.id,index:this.activeSlideIndex,value:-1===e})}setBookmark(e){return fo(this,void 0,void 0,(function*(){const t=this.storiesItem.favorite;this.storiesItem.favorite=e,this._favorite=e;try{const t=yield Ls.setBookmark(this.id,e);if(null==t.favorite)return;this.storiesItem.favorite=t.favorite,this._favorite=t.favorite,ar.emit("publicEvents.favoriteStory",{id:this.id,index:this.activeSlideIndex,value:t.favorite})}catch(e){this.storiesItem.favorite=t,this._favorite=t,console.error(e)}}))}share(){return fo(this,void 0,void 0,(function*(){var e;ar.emit("publicEvents.shareStory",{id:this.id,index:this.activeSlideIndex}),(null===(e=this.activeSlide)||void 0===e?void 0:e.screenshotShare)?ar.emit(ro.PerformScreenShotShareAction,{shareId:"slide-screenshot-share",hideElementsSelector:""}):ut()?yield this.performSessionShareAction():this.performWithoutSessionShareAction()}))}markAsOpened(){this.storiesItem.isOpened||(Ls.markAsOpened(this.id),this.storiesItem.isOpened=!0)}hideTimeline(){this._hiddenTimeline=!0}showTimeline(){this._hiddenTimeline=!1}reset(){return this.slideApiHandlers.resetStory(this.id)}redirectToSlide({slideIndex:e,layerIndex:t}){e!==this.activeSlideIndex&&this.toSlide(e)}destroy(){}getDisplayedSlides(){const e=new uo;return this.slidesLoaded?this.slides.slice(this._activeSlideIndex,this._activeSlideIndex+2):[e.create({story:this,index:0,slideApi:this.slideApi,slideApiHandlers:this.slideApiHandlers,slideDto:{index:0,timeline:{foreground:"",background:""},duration:0,screenshot_share:!1,html:""}})]}createSlidesViewModelsByDto(e){if(this.slides.length===e.length)return this.slides;const t=new uo;return e.map(((e,r)=>t.create({story:this,index:r,slideApi:this.slideApi,slideApiHandlers:this.slideApiHandlers,slideDto:e})))}updateStoryLike(e){return fo(this,void 0,void 0,(function*(){try{const t=yield Ls.updateStoryLike(this.id,e);null!=t.like&&(this.storiesItem.like=t.like,this._like=t.like)}catch(e){console.error(e)}}))}performSessionShareAction(){return fo(this,void 0,void 0,(function*(){try{const{url:e}=yield Ls.getStorySharePath(this.id);if(!e)return;this.storiesItem.share_url=e,this.emitShareStoryWithPathEvent(e);const t={title:this.storiesItem.title,text:"",url:e};ar.emit(ro.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};ar.emit(ro.PerformShareAction,{shareId:"story-share",config:t})}emitShareStoryWithPathEvent(e){ar.emit("publicEvents.shareStoryWithPath",{id:this.id,index:this.activeSlideIndex,url:e})}},t=new WeakMap,r=new WeakMap,i=new WeakMap,n=new WeakMap,s=new WeakMap,o=new WeakMap,a=new WeakMap,(()=>{var t;const r="function"==typeof Symbol&&Symbol.metadata?Object.create(null!==(t=$[Symbol.metadata])&&void 0!==t?t:null):void 0;l=[to.observable],d=[to.observable],c=[to.observable],u=[to.observable],h=[to.observable],p=[to.observable],f=[to.observable],g=[to.computed],v=[to.computed],m=[to.computed],y=[to.computed],b=[to.computed],w=[to.computed],S=[to.computed],_=[to.computed],x=[to.computed],O=[to.computed],C=[to.computed],k=[to.computed],A=[to.computed],M=[to.computed],E=[to.computed],P=[to.computed],j=[to.computed],I=[to.computed],T=[to.computed],R=[to.computed],D=[to.action],B=[to.action],N=[to.action],F=[to.action],U=[to.action],V=[to.action],z=[to.action],G=[to.action],W=[to.action],po(e,null,l,{kind:"accessor",name:"storiesItem",static:!1,private:!1,access:{has:e=>"storiesItem"in e,get:e=>e.storiesItem,set:(e,t)=>{e.storiesItem=t}},metadata:r},q,Q),po(e,null,d,{kind:"accessor",name:"_activeSlideIndex",static:!1,private:!1,access:{has:e=>"_activeSlideIndex"in e,get:e=>e._activeSlideIndex,set:(e,t)=>{e._activeSlideIndex=t}},metadata:r},K,Y),po(e,null,c,{kind:"accessor",name:"_displayedSlides",static:!1,private:!1,access:{has:e=>"_displayedSlides"in e,get:e=>e._displayedSlides,set:(e,t)=>{e._displayedSlides=t}},metadata:r},Z,X),po(e,null,u,{kind:"accessor",name:"_hiddenTimeline",static:!1,private:!1,access:{has:e=>"_hiddenTimeline"in e,get:e=>e._hiddenTimeline,set:(e,t)=>{e._hiddenTimeline=t}},metadata:r},J,ee),po(e,null,h,{kind:"accessor",name:"slides",static:!1,private:!1,access:{has:e=>"slides"in e,get:e=>e.slides,set:(e,t)=>{e.slides=t}},metadata:r},te,re),po(e,null,p,{kind:"accessor",name:"_like",static:!1,private:!1,access:{has:e=>"_like"in e,get:e=>e._like,set:(e,t)=>{e._like=t}},metadata:r},ie,ne),po(e,null,f,{kind:"accessor",name:"_favorite",static:!1,private:!1,access:{has:e=>"_favorite"in e,get:e=>e._favorite,set:(e,t)=>{e._favorite=t}},metadata:r},se,oe),po(e,null,g,{kind:"getter",name:"id",static:!1,private:!1,access:{has:e=>"id"in e,get:e=>e.id},metadata:r},null,H),po(e,null,v,{kind:"getter",name:"title",static:!1,private:!1,access:{has:e=>"title"in e,get:e=>e.title},metadata:r},null,H),po(e,null,m,{kind:"getter",name:"slidesLoaded",static:!1,private:!1,access:{has:e=>"slidesLoaded"in e,get:e=>e.slidesLoaded},metadata:r},null,H),po(e,null,y,{kind:"getter",name:"like",static:!1,private:!1,access:{has:e=>"like"in e,get:e=>e.like},metadata:r},null,H),po(e,null,b,{kind:"getter",name:"favorite",static:!1,private:!1,access:{has:e=>"favorite"in e,get:e=>e.favorite},metadata:r},null,H),po(e,null,w,{kind:"getter",name:"hasLike",static:!1,private:!1,access:{has:e=>"hasLike"in e,get:e=>e.hasLike},metadata:r},null,H),po(e,null,S,{kind:"getter",name:"hasShare",static:!1,private:!1,access:{has:e=>"hasShare"in e,get:e=>e.hasShare},metadata:r},null,H),po(e,null,_,{kind:"getter",name:"hasFavorite",static:!1,private:!1,access:{has:e=>"hasFavorite"in e,get:e=>e.hasFavorite},metadata:r},null,H),po(e,null,x,{kind:"getter",name:"hasAudio",static:!1,private:!1,access:{has:e=>"hasAudio"in e,get:e=>e.hasAudio},metadata:r},null,H),po(e,null,O,{kind:"getter",name:"displayedSlides",static:!1,private:!1,access:{has:e=>"displayedSlides"in e,get:e=>e.displayedSlides},metadata:r},null,H),po(e,null,C,{kind:"getter",name:"activeSlideIndex",static:!1,private:!1,access:{has:e=>"activeSlideIndex"in e,get:e=>e.activeSlideIndex},metadata:r},null,H),po(e,null,k,{kind:"getter",name:"activeSlide",static:!1,private:!1,access:{has:e=>"activeSlide"in e,get:e=>e.activeSlide},metadata:r},null,H),po(e,null,A,{kind:"getter",name:"slidesCount",static:!1,private:!1,access:{has:e=>"slidesCount"in e,get:e=>e.slidesCount},metadata:r},null,H),po(e,null,M,{kind:"getter",name:"hiddenTimeline",static:!1,private:!1,access:{has:e=>"hiddenTimeline"in e,get:e=>e.hiddenTimeline},metadata:r},null,H),po(e,null,E,{kind:"getter",name:"displayedSlideImage",static:!1,private:!1,access:{has:e=>"displayedSlideImage"in e,get:e=>e.displayedSlideImage},metadata:r},null,H),po(e,null,P,{kind:"getter",name:"isBlank",static:!1,private:!1,access:{has:e=>"isBlank"in e,get:e=>e.isBlank},metadata:r},null,H),po(e,null,j,{kind:"getter",name:"reachEnd",static:!1,private:!1,access:{has:e=>"reachEnd"in e,get:e=>e.reachEnd},metadata:r},null,H),po(e,null,I,{kind:"getter",name:"reachStart",static:!1,private:!1,access:{has:e=>"reachStart"in e,get:e=>e.reachStart},metadata:r},null,H),po(e,null,T,{kind:"getter",name:"disableClose",static:!1,private:!1,access:{has:e=>"disableClose"in e,get:e=>e.disableClose},metadata:r},null,H),po(e,null,R,{kind:"getter",name:"error",static:!1,private:!1,access:{has:e=>"error"in e,get:e=>e.error},metadata:r},null,H),po(e,null,D,{kind:"method",name:"toSlide",static:!1,private:!1,access:{has:e=>"toSlide"in e,get:e=>e.toSlide},metadata:r},null,H),po(e,null,B,{kind:"method",name:"updateStoriesItem",static:!1,private:!1,access:{has:e=>"updateStoriesItem"in e,get:e=>e.updateStoriesItem},metadata:r},null,H),po(e,null,N,{kind:"method",name:"setLike",static:!1,private:!1,access:{has:e=>"setLike"in e,get:e=>e.setLike},metadata:r},null,H),po(e,null,F,{kind:"method",name:"setDislike",static:!1,private:!1,access:{has:e=>"setDislike"in e,get:e=>e.setDislike},metadata:r},null,H),po(e,null,U,{kind:"method",name:"setBookmark",static:!1,private:!1,access:{has:e=>"setBookmark"in e,get:e=>e.setBookmark},metadata:r},null,H),po(e,null,V,{kind:"method",name:"share",static:!1,private:!1,access:{has:e=>"share"in e,get:e=>e.share},metadata:r},null,H),po(e,null,z,{kind:"method",name:"markAsOpened",static:!1,private:!1,access:{has:e=>"markAsOpened"in e,get:e=>e.markAsOpened},metadata:r},null,H),po(e,null,G,{kind:"method",name:"hideTimeline",static:!1,private:!1,access:{has:e=>"hideTimeline"in e,get:e=>e.hideTimeline},metadata:r},null,H),po(e,null,W,{kind:"method",name:"showTimeline",static:!1,private:!1,access:{has:e=>"showTimeline"in e,get:e=>e.showTimeline},metadata:r},null,H),r&&Object.defineProperty(e,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:r})})(),e})();const yo=(e=>{var t={};return f.d(t,e),t})({getSlideApi:()=>s.getSlideApi});class bo{constructor(e){Object.defineProperty(this,"window",{enumerable:!0,configurable:!0,writable:!0,value: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,r){const i=this.width;this.window.document.querySelectorAll(e).forEach((e=>{if(e!==this.window.document.body&&this.window.innerWidth>e.clientWidth+i)return;const n=e.style[t],s=this.window.getComputedStyle(e)[t];e.dataset[t]=n,e.style[t]=`${r(Number.parseFloat(s))}px`}))}resetScrollbar(){this._resetElementAttributes("body","overflow"),this._resetElementAttributes("body","paddingRight")}_resetElementAttributes(e,t){this.window.document.querySelectorAll(e).forEach((e=>{const r=e.dataset[t];void 0===r?e.style.removeProperty(t):(delete e.dataset[t],e.style[t]=r)}))}}var wo,So=function(e,t,r,i){return new(r||(r=Promise))((function(n,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}l((i=i.apply(e,t||[])).next())}))};!function(e){e.ReloadStory="StoryReaderViewModel.reloadStory"}(wo||(wo={}));class _o{constructor(e,t,r){Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"storyReaderViewModel",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"statisticsService",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"publicEventsSubscriptions",{enumerable:!0,configurable:!0,writable:!0,value:[]}),this.handleShowMultipleStories=this.handleShowMultipleStories.bind(this),this.handleCloseStoryReader=this.handleCloseStoryReader.bind(this),this.handleRedirectToStory=this.handleRedirectToStory.bind(this),this.handleReloadStory=this.handleReloadStory.bind(this),this.handleWidgetEvent=this.handleWidgetEvent.bind(this),this.handleClickOnButton=this.handleClickOnButton.bind(this),this.subscribeToEventBusEvents()}subscribeToEventBusEvents(){ar.on(`${Ao.name}.showMultipleStories`,this.handleShowMultipleStories),ar.on(`${Ao.name}.redirectToStory`,this.handleRedirectToStory),ar.on(`${Ao.name}.closeStory`,this.handleCloseStoryReader),ar.on(wo.ReloadStory,this.handleReloadStory),ar.on("publicEvents.widgetEvent",this.handleWidgetEvent),ar.on("publicEvents.clickOnButton",this.handleClickOnButton),this.subscribeToPublicEvents()}unsubscribeEventBusEvents(){ar.off(`${Ao.name}.showMultipleStories`,this.handleShowMultipleStories),ar.off(`${Ao.name}.redirectToStory`,this.handleRedirectToStory),ar.off(`${Ao.name}.closeStory`,this.handleCloseStoryReader),ar.off(wo.ReloadStory,this.handleReloadStory),ar.off("publicEvents.widgetEvent",this.handleWidgetEvent),ar.off("publicEvents.clickOnButton",this.handleClickOnButton),this.unsubscribeFromPublicEvents()}handleShowMultipleStories({payload:e,sourceInfo:t}){this.storyReaderViewModel.showMultipleStories({storyId:e.id,feed:t.feedSlug,listType:t.listType,filter:t.filter})}handleRedirectToStory(e){return So(this,arguments,void 0,(function*({storyId:e,feedSlug:t=""}){try{yield this.storyReaderViewModel.showStory(e,t)}catch(e){console.error(e)}}))}handleCloseStoryReader(){this.storyReaderViewModel.close()}handleWidgetEvent(e){this.storyManager.emit("widgetEvent",{name:e.name,data:Object.assign(Object.assign({},e.devPayload),{feed:this.storyReaderViewModel.feedSlug})})}subscribeToPublicEvents(){const e=new Yt(this.storyManager),t=this.storyReaderViewModel.sourceInfo,r=["showSlide","showStory","closeStory","clickOnButton","likeStory","dislikeStory","favoriteStory","shareStory","shareStoryWithPath"];for(const i of r){const r=r=>e.handle(i,r,t);ar.on(`publicEvents.${i}`,r),this.publicEventsSubscriptions.push((()=>{ar.off(`publicEvents.${i}`,r)}))}}unsubscribeFromPublicEvents(){this.publicEventsSubscriptions.forEach((e=>e()))}handleClickOnButton(e){new Kt(this.storyManager,this.statisticsService).handle(e)}handleReloadStory(e){return So(this,void 0,void 0,(function*(){try{yield this.storyReaderViewModel.reloadStory(e)}catch(e){console.error(e)}}))}destroy(){this.unsubscribeEventBusEvents()}}var xo=function(e,t,r){for(var i=arguments.length>2,n=0;n<t.length;n++)r=i?t[n].call(e,r):t[n].call(e);return i?r:void 0},Oo=function(e,t,r,i,n,s){function o(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var a,l=i.kind,d="getter"===l?"get":"setter"===l?"set":"value",c=!t&&e?i.static?e:e.prototype:null,u=t||(c?Object.getOwnPropertyDescriptor(c,i.name):{}),h=!1,p=r.length-1;p>=0;p--){var f={};for(var g in i)f[g]="access"===g?{}:i[g];for(var g in i.access)f.access[g]=i.access[g];f.addInitializer=function(e){if(h)throw new TypeError("Cannot add initializers after decoration has completed");s.push(o(e||null))};var v=(0,r[p])("accessor"===l?{get:u.get,set:u.set}:u[d],f);if("accessor"===l){if(void 0===v)continue;if(null===v||"object"!=typeof v)throw new TypeError("Object expected");(a=o(v.get))&&(u.get=a),(a=o(v.set))&&(u.set=a),(a=o(v.init))&&n.unshift(a)}else(a=o(v))&&("field"===l?n.unshift(a):u[d]=a)}c&&Object.defineProperty(c,i.name,u),h=!0},Co=function(e,t,r,i){return new(r||(r=Promise))((function(n,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}l((i=i.apply(e,t||[])).next())}))},ko=function(e,t,r,i){if("a"===r&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?i:"a"===r?i.call(e):i?i.value:t.get(e)},Lo=function(e,t,r,i,n){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!n)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?n.call(e,r):n?n.value=r:t.set(e,r),r};let Ao=(()=>{var e,t,r,i,n;let s,o,a,l,d,c,u,h,p,f,g,v,m,y,b,w=Vt,S=[],_=[],x=[],O=[],C=[],k=[],L=[],A=[],M=[];return e=class extends w{get _activeStory(){return ko(this,t,"f")}set _activeStory(e){Lo(this,t,e,"f")}get _currentIndex(){return ko(this,r,"f")}set _currentIndex(e){Lo(this,r,e,"f")}get _placeholders(){return ko(this,i,"f")}set _placeholders(e){Lo(this,i,e,"f")}get storyViewModels(){return ko(this,n,"f")}set storyViewModels(e){Lo(this,n,e,"f")}constructor(s,o,a){super(),Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:(xo(this,S),s)}),Object.defineProperty(this,"storyReaderStoriesService",{enumerable:!0,configurable:!0,writable:!0,value:o}),Object.defineProperty(this,"statisticsService",{enumerable:!0,configurable:!0,writable:!0,value:a}),t.set(this,xo(this,_,null)),r.set(this,(xo(this,x),xo(this,O,1))),Object.defineProperty(this,"narrativeContext",{enumerable:!0,configurable:!0,writable:!0,value:xo(this,C)}),i.set(this,xo(this,k,[])),Object.defineProperty(this,"scrollbarHelper",{enumerable:!0,configurable:!0,writable:!0,value:(xo(this,L),new bo(window))}),Object.defineProperty(this,"_sourceInfo",{enumerable:!0,configurable:!0,writable:!0,value:{listType:Re.default,feedSlug:""}}),Object.defineProperty(this,"slideApi",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"slideApiHandlers",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"windowReferer",{enumerable:!0,configurable:!0,writable:!0,value:Te.default}),Object.defineProperty(this,"storyReaderViewModelEventBusListener",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),n.set(this,xo(this,A,new Map)),Object.defineProperty(this,"currentStoryDisplayStrategy",{enumerable:!0,configurable:!0,writable:!0,value:(xo(this,M),null)}),Object.defineProperty(this,"navigationHistory",{enumerable:!0,configurable:!0,writable:!0,value:new As}),this.initSlideApi(),this.storyReaderViewModelEventBusListener=new _o(s,this,a),this.handleWindowUnload=this.handleWindowUnload.bind(this),s.setViewModel(e.name,this),window.addEventListener("beforeunload",this.handleWindowUnload)}initSlideApi(){this.slideApiHandlers=new dn(this),this.slideApi=(0,yo.getSlideApi)(this.slideApiHandlers)}get feedSlug(){var e;return null!==(e=this.sourceInfo.feedSlug)&&void 0!==e?e:""}get widgetsData(){return W()(this.narrativeContext.widgetsData)?this.narrativeContext.widgetsData:{}}get sourceInfo(){return this._sourceInfo}get stories(){return Array.from(this.storyViewModels.values())}get activeStory(){return this._activeStory}get currentIndex(){return this._currentIndex}get placeholders(){return this._placeholders}get reachStart(){return 1===this.currentIndex}get reachEnd(){return this.currentIndex===this.storyViewModels.size-2}setStories({listType:e,stories:t}){let r=t.filter((e=>!e.hide_in_reader)).map((e=>_t.createInstance(nr,e)));r=[_t.createInstance(nr,{blank:!0,id:-1}),...r,_t.createInstance(nr,{blank:!0,id:-2})];for(const e of r)this.storyViewModels.has(e.id)?this.storyViewModels.get(e.id).updateStoriesItem(e):this.storyViewModels.set(e.id,new mo(e,this.slideApi,this.slideApiHandlers,this.navigationHistory))}setNarrativeContext(e){this.narrativeContext=e instanceof or?e:_t.createInstance(or,e.rawData),this.initStoryResources(this.narrativeContext)}setActiveStoryById(e){this._currentIndex=Array.from(this.storyViewModels.keys()).indexOf(e),this._activeStory=this.storyViewModels.get(e),this.setSlideApiActiveStory(this._activeStory)}setActiveStoryByIndex(e){this._currentIndex=e,this._activeStory=this.getDisplayedStoryByIndex(this._currentIndex),this.setSlideApiActiveStory(this._activeStory),this.handleActiveStoryError(this._activeStory)}getDisplayedStoryByIndex(e){return Array.from(this.storyViewModels.values())[e]}setSlideApiActiveStory(e){this.slideApiHandlers.setActiveStory(e)}open(e,t){this.storyViewModels.clear(),this.windowReferer=e.windowReferer,this.setScrollBar(e.windowReferer),this._sourceInfo=t,this.setStoriesAndContext({listType:e.listType,storyList:e.storyList,storyContext:e.storyContext}),this.setActiveStoryById(e.id),this._placeholders=e.placeholders,this.statisticsService.init(t),ct(!0)}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 r=this.activeStory.id,i=this.activeStory.activeSlideIndex;this.emit("closeStoryReader"),ar.emit("closeStoryReader",{id:r}),ar.emit(rn.CloseStoryReader,{storyId:r,slideIndex:i}),ar.emit("publicEvents.closeStory",{id:r,index:i,action:e}),Cr(),Br(),this.navigationHistory.reset(),this.activeStory.markAsOpened(),this._sourceInfo={listType:Re.default,feedSlug:""},this._activeStory=null,this.statisticsService.destroy(),this.storyViewModels.clear()}setScrollBar(e){e===Te.default&&this.scrollbarHelper.setScrollbar()}resetScrollBar(e){e===Te.default&&this.scrollbarHelper.resetScrollbar()}initStoryResources(e){(new qi).init(e)}handleActiveStoryError(e){e.error&&this.storyManager.emit("showStoryFailed",Object.assign({id:e.id,title:e.title},e.error))}handleWindowUnload(e){this.activeStory&&(ar.emit(rn.NextSlide,{fromStoryId:this.activeStory.id,fromSlideIndex:this.activeStory.activeSlideIndex}),this.statisticsService.sendData())}setStoriesAndContext(e){this.setStories({listType:e.listType,stories:e.storyList}),this.setNarrativeContext({rawData:e.storyContext})}canBeClosed(){return!(!this.activeStory||this.activeStory.isBlank)&&!this.activeStory.disableClose}showStory(e,t){return Co(this,void 0,void 0,(function*(){this.currentStoryDisplayStrategy=this.createStoryDisplayStrategyByType(Ns.ShowStory),yield this.currentStoryDisplayStrategy.show({storyId:e,feed:t})}))}showStoryOnce(e){return Co(this,void 0,void 0,(function*(){this.currentStoryDisplayStrategy=this.createStoryDisplayStrategyByType(Ns.ShowStoryOnce),yield this.currentStoryDisplayStrategy.show({storyId:e})}))}showStoryFromSharePage(e,t){return Co(this,void 0,void 0,(function*(){return this.currentStoryDisplayStrategy=this.createStoryDisplayStrategyByType(Ns.ShowStoryFromSharePage),this.currentStoryDisplayStrategy.show({storyId:e,fetchShareUrl:t})}))}showOnboardingStories(e){return Co(this,void 0,void 0,(function*(){var t;this.currentStoryDisplayStrategy=this.createStoryDisplayStrategyByType(Ns.ShowOnboardingStories),yield this.currentStoryDisplayStrategy.show({feed:null!==(t=null==e?void 0:e.feed)&&void 0!==t?t:"",customTags:null==e?void 0:e.customTags,limit:null==e?void 0:e.limit})}))}showMultipleStories(e){return Co(this,void 0,void 0,(function*(){var t,r;this.currentStoryDisplayStrategy=this.createStoryDisplayStrategyByType(Ns.ShowMultipleStories),yield this.currentStoryDisplayStrategy.show({storyId:e.storyId,listType:null!==(t=e.listType)&&void 0!==t?t:Re.default,windowReferer:null!==(r=e.windowReferer)&&void 0!==r?r:Te.default,feed:e.feed,filter:e.filter})}))}createStoryDisplayStrategyByType(e){return(new Vs).create(e,this,this.storyReaderStoriesService,this.storyManager)}fetchStoriesSlidesAndContextByNextStoryIndex(e){return Co(this,void 0,void 0,(function*(){const t=yield this.storyReaderStoriesService.fetchStoriesSlidesAndContextByNextStoryIndex({nextStoryIndex:e,listType:this.sourceInfo.listType,feed:this.sourceInfo.feedSlug});t.storyList.length&&this.setStoriesAndContext(t)}))}reloadStory(e){return Co(this,void 0,void 0,(function*(){var t,r;ls({id:e.id,story:{error:null}});const i=Object.assign(Object.assign({},this.sourceInfo),{feed:null!==(t=this.sourceInfo.feedSlug)&&void 0!==t?t:""});let n=this.storyReaderStoriesService.getStoriesWithSlidesAndContext(i);this.setStoriesAndContext(n),null===(r=this.currentStoryDisplayStrategy)||void 0===r||r.reload({storyId:e.id,listType:this.sourceInfo.listType,feed:this.sourceInfo.feedSlug})}))}nextStory(){var e;this.reachEnd||(null===(e=this.activeStory)||void 0===e||e.markAsOpened(),this.setActiveStoryByIndex(this._currentIndex+1),this.fetchStoriesSlidesAndContextByNextStoryIndex(this._currentIndex-1))}prevStory(){var e;this.reachStart||(null===(e=this.activeStory)||void 0===e||e.markAsOpened(),this.setActiveStoryByIndex(this._currentIndex-1),this.fetchStoriesSlidesAndContextByNextStoryIndex(this._currentIndex-1))}destroy(){this.removeAllListeners(),window.removeEventListener("beforeunload",this.handleWindowUnload),this.storyReaderViewModelEventBusListener.destroy(),this.storyManager.deleteViewModel(e.name)}closeGoodsWidget(){ar.emit("goodsWidget.close")}},t=new WeakMap,r=new WeakMap,i=new WeakMap,n=new WeakMap,(()=>{var t;const r="function"==typeof Symbol&&Symbol.metadata?Object.create(null!==(t=w[Symbol.metadata])&&void 0!==t?t:null):void 0;s=[to.observable],o=[to.observable],a=[to.observable],l=[to.observable],d=[to.computed],c=[to.computed],u=[to.computed],h=[to.computed],p=[to.computed],f=[to.computed],g=[to.action],v=[to.action],m=[to.action],y=[to.action],b=[to.action],Oo(e,null,s,{kind:"accessor",name:"_activeStory",static:!1,private:!1,access:{has:e=>"_activeStory"in e,get:e=>e._activeStory,set:(e,t)=>{e._activeStory=t}},metadata:r},_,x),Oo(e,null,o,{kind:"accessor",name:"_currentIndex",static:!1,private:!1,access:{has:e=>"_currentIndex"in e,get:e=>e._currentIndex,set:(e,t)=>{e._currentIndex=t}},metadata:r},O,C),Oo(e,null,a,{kind:"accessor",name:"_placeholders",static:!1,private:!1,access:{has:e=>"_placeholders"in e,get:e=>e._placeholders,set:(e,t)=>{e._placeholders=t}},metadata:r},k,L),Oo(e,null,l,{kind:"accessor",name:"storyViewModels",static:!1,private:!1,access:{has:e=>"storyViewModels"in e,get:e=>e.storyViewModels,set:(e,t)=>{e.storyViewModels=t}},metadata:r},A,M),Oo(e,null,d,{kind:"getter",name:"stories",static:!1,private:!1,access:{has:e=>"stories"in e,get:e=>e.stories},metadata:r},null,S),Oo(e,null,c,{kind:"getter",name:"activeStory",static:!1,private:!1,access:{has:e=>"activeStory"in e,get:e=>e.activeStory},metadata:r},null,S),Oo(e,null,u,{kind:"getter",name:"currentIndex",static:!1,private:!1,access:{has:e=>"currentIndex"in e,get:e=>e.currentIndex},metadata:r},null,S),Oo(e,null,h,{kind:"getter",name:"placeholders",static:!1,private:!1,access:{has:e=>"placeholders"in e,get:e=>e.placeholders},metadata:r},null,S),Oo(e,null,p,{kind:"getter",name:"reachStart",static:!1,private:!1,access:{has:e=>"reachStart"in e,get:e=>e.reachStart},metadata:r},null,S),Oo(e,null,f,{kind:"getter",name:"reachEnd",static:!1,private:!1,access:{has:e=>"reachEnd"in e,get:e=>e.reachEnd},metadata:r},null,S),Oo(e,null,g,{kind:"method",name:"open",static:!1,private:!1,access:{has:e=>"open"in e,get:e=>e.open},metadata:r},null,S),Oo(e,null,v,{kind:"method",name:"close",static:!1,private:!1,access:{has:e=>"close"in e,get:e=>e.close},metadata:r},null,S),Oo(e,null,m,{kind:"method",name:"reloadStory",static:!1,private:!1,access:{has:e=>"reloadStory"in e,get:e=>e.reloadStory},metadata:r},null,S),Oo(e,null,y,{kind:"method",name:"nextStory",static:!1,private:!1,access:{has:e=>"nextStory"in e,get:e=>e.nextStory},metadata:r},null,S),Oo(e,null,b,{kind:"method",name:"prevStory",static:!1,private:!1,access:{has:e=>"prevStory"in e,get:e=>e.prevStory},metadata:r},null,S),r&&Object.defineProperty(e,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:r})})(),e})();class Mo{constructor(e){Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:e})}create(){const e=new Wn,t=new an(this.storyManager),r=new sn(t);return new Ao(this.storyManager,e,r)}}class Eo{constructor(e,t){Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"storyListViewModel",{enumerable:!0,configurable:!0,writable:!0,value:t})}handle(e,t){Ls.markAsOpened(e.id),this.handleClickOnStoryCardDeepLink({id:e.id,index:t.index,isDeeplink:!0,url:e.deeplink},{listType:this.storyListViewModel.params.listType})}handleClickOnStoryCardDeepLink(e,{listType:t}){var r;const i={data:[[1,0,e.id,0,0]]},n=()=>{e.isDeeplink&&e.url&&this.storyManager.clickOnButtonAction({src:Gt.STORY_LIST,payload:e})};t===We.UGC||(null===(r=this.storyManager.getConfig())||void 0===r?void 0:r.disableStatistic)?n():K("session/update",i,I.createFunctionWithTimeout(n,1e3))}}class Po{constructor(e,t){Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"storyListViewModel",{enumerable:!0,configurable:!0,writable:!0,value:t})}handle(e,t){var r;Ls.markAsOpened(e.id),ar.emit(`${Da.name}.openGame`,{gameId:null===(r=e.gameInstance)||void 0===r?void 0:r.id})}}class jo{constructor(e,t){Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"storyListViewModel",{enumerable:!0,configurable:!0,writable:!0,value:t})}handle(e,t){const r={index:t.index,isDeeplink:!1,id:e.id,listType:Re.default,windowReferer:Te.default};this.openStoryReader(r),this.emitClickOnStory({id:e.id,index:t.index,isDeeplink:!1},{feedSlug:this.storyListViewModel.params.feedSlug,filter:this.storyListViewModel.params.filter})}openStoryReader(e){const t=this.storyListViewModel.params.feedSlug;e.listType=this.storyListViewModel.params.isFavorite?Re.favorite:Re.default,e.windowReferer=this.storyListViewModel.params.isFavorite?Te.favorite:Te.default,ar.emit(`${Ao.name}.showMultipleStories`,{payload:e,sourceInfo:{feedSlug:t,listType:e.listType,filter:this.storyListViewModel.params.filter}})}emitClickOnStory(e,t){const r=t.feedSlug,i=t.filter,n=yt(r),s=Qe.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===We.DEFAULT?o.feed=r:n===We.UGC&&(o.filter=i),o.source=Ie.list,this.storyManager.emit("clickOnStory",Object.assign(Object.assign({},e),o))}}class Io{static createHandler(e,t,r){const{deeplink:i,hideInReader:n,gameInstance:s}=e,o=Nt()(i)&&i.trim().length>0,a=null==s?void 0:s.id;return this.isInvalidStoryClick(Boolean(n),o,a,e.id)?null:o?new Eo(t,r):a?new Po(t,r):new jo(t,r)}static isInvalidStoryClick(e,t,r,i){return!(!e||t||r)&&(console.error(`Cannot open hidden story id ${i}`),!0)}}var To=function(e,t,r){for(var i=arguments.length>2,n=0;n<t.length;n++)r=i?t[n].call(e,r):t[n].call(e);return i?r:void 0},Ro=function(e,t,r,i,n,s){function o(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var a,l=i.kind,d="getter"===l?"get":"setter"===l?"set":"value",c=!t&&e?i.static?e:e.prototype:null,u=t||(c?Object.getOwnPropertyDescriptor(c,i.name):{}),h=!1,p=r.length-1;p>=0;p--){var f={};for(var g in i)f[g]="access"===g?{}:i[g];for(var g in i.access)f.access[g]=i.access[g];f.addInitializer=function(e){if(h)throw new TypeError("Cannot add initializers after decoration has completed");s.push(o(e||null))};var v=(0,r[p])("accessor"===l?{get:u.get,set:u.set}:u[d],f);if("accessor"===l){if(void 0===v)continue;if(null===v||"object"!=typeof v)throw new TypeError("Object expected");(a=o(v.get))&&(u.get=a),(a=o(v.set))&&(u.set=a),(a=o(v.init))&&n.unshift(a)}else(a=o(v))&&("field"===l?n.unshift(a):u[d]=a)}c&&Object.defineProperty(c,i.name,u),h=!0},Do=function(e,t,r,i){return new(r||(r=Promise))((function(n,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}l((i=i.apply(e,t||[])).next())}))},Bo=function(e,t,r,i){if("a"===r&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?i:"a"===r?i.call(e):i?i.value:t.get(e)},No=function(e,t,r,i,n){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!n)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?n.call(e,r):n?n.value=r:t.set(e,r),r};let Fo=(()=>{var e,t,r,i,n,s;let o,a,l,d,c,u,h,p,f,g,v,m,y,b,w,S,_,x,O=Vt,C=[],k=[],L=[],A=[],M=[],E=[],P=[],j=[],I=[],T=[],R=[];return e=class extends O{get _defaultStories(){return Bo(this,t,"f")}set _defaultStories(e){No(this,t,e,"f")}get _favoriteStories(){return Bo(this,r,"f")}set _favoriteStories(e){No(this,r,e,"f")}get _session(){return Bo(this,i,"f")}set _session(e){No(this,i,e,"f")}get _modeDesktop(){return Bo(this,n,"f")}set _modeDesktop(e){No(this,n,e,"f")}get _params(){return Bo(this,s,"f")}set _params(e){No(this,s,e,"f")}set modeDesktop(e){this._modeDesktop!==e&&(this._modeDesktop=e)}get id(){return this._id}get modeDesktop(){return this._modeDesktop}get session(){return this._session}get defaultStories(){return this._defaultStories}get favoriteStories(){return this._favoriteStories}get params(){return this._params}constructor(o,a){super(),Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:(To(this,C),o)}),Object.defineProperty(this,"storiesService",{enumerable:!0,configurable:!0,writable:!0,value:a}),Object.defineProperty(this,"_id",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),t.set(this,To(this,k,[])),r.set(this,(To(this,L),To(this,A,[]))),i.set(this,(To(this,M),To(this,E,null))),n.set(this,(To(this,P),To(this,j,!0))),Object.defineProperty(this,"subscriptions",{enumerable:!0,configurable:!0,writable:!0,value:(To(this,I),[])}),s.set(this,To(this,T,{listType:We.DEFAULT,feedSlug:"",useUgcCard:!1,isFavorite:!1,hasFavorite:!1})),Object.defineProperty(this,"isLoading",{enumerable:!0,configurable:!0,writable:!0,value:(To(this,R),!1)}),this._id=e.name+e.index++,this.setDefaultStories=this.setDefaultStories.bind(this),this.setFavoriteStories=this.setFavoriteStories.bind(this),this.storyManager.setViewModel(this._id,this)}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===We.DEFAULT}setParams(e){this.unsubscribeStoriesService(),this._params=e,this.subscribeToStoriesService()}onStoryClick(e,t=0){var r;null===(r=Io.createHandler(e,this.storyManager,this))||void 0===r||r.handle(e,{index:t})}destroy(){this.removeAllListeners(),this.unsubscribeStoriesService(),this.storyManager.deleteViewModel(this._id)}reload(){return Do(this,void 0,void 0,(function*(){yield this.loadStories({needFavorite:!1})}))}loadStories(e){return Do(this,void 0,void 0,(function*(){var t;if(this.isLoading)return;const r=Boolean(this._params.hasFavorite)&&e.needFavorite,i={feed:this._params.feedSlug,filter:{},defaultListLength:0,favoriteListLength:0,success:!0,error:{name:"",networkStatus:200,networkMessage:""}};try{this.emit("startLoading"),this.isLoading=!0;const{defaultStories:e,favoriteStories:t}=yield this.storiesService.loadStories(Object.assign(Object.assign({},this._params),{needFavorite:r}));i.success=!0,i.error=null,i.defaultListLength=e.length,this._params.hasFavorite&&this._params.listType===We.DEFAULT&&(i.favoriteListLength=t.length)}catch(e){console.error(e),i.success=!1,e instanceof $&&(i.error={name:e.name,networkMessage:e.networkMessage,networkStatus:e.networkStatus})}finally{this.isLoading=!1,i.filter=null!==(t=this._params.filter)&&void 0!==t?t:{},this.emit("endLoading",i)}}))}subscribeToStoriesService(){const e=this.storiesService.observeDefaultStories(this._params.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((0,to.action)((e=>{this._session=e})));this.subscriptions.push(e,t)}unsubscribeStoriesService(){this.subscriptions.forEach((e=>e.unsubscribe())),this.subscriptions=[]}setDefaultStories(e){this._defaultStories=e.map((e=>new qt(this,e)))}setFavoriteStories(e){this._favoriteStories=e.map((e=>new Qt(this,e)))}},t=new WeakMap,r=new WeakMap,i=new WeakMap,n=new WeakMap,s=new WeakMap,(()=>{var t;const r="function"==typeof Symbol&&Symbol.metadata?Object.create(null!==(t=O[Symbol.metadata])&&void 0!==t?t:null):void 0;o=[to.observable],a=[to.observable],l=[to.observable],d=[to.observable],c=[to.observable],u=[to.action],h=[to.computed],p=[to.computed],f=[to.computed],g=[to.computed],v=[to.computed],m=[to.computed],y=[to.computed],b=[to.computed],w=[to.action],S=[to.action],_=[to.action],x=[to.action],Ro(e,null,o,{kind:"accessor",name:"_defaultStories",static:!1,private:!1,access:{has:e=>"_defaultStories"in e,get:e=>e._defaultStories,set:(e,t)=>{e._defaultStories=t}},metadata:r},k,L),Ro(e,null,a,{kind:"accessor",name:"_favoriteStories",static:!1,private:!1,access:{has:e=>"_favoriteStories"in e,get:e=>e._favoriteStories,set:(e,t)=>{e._favoriteStories=t}},metadata:r},A,M),Ro(e,null,l,{kind:"accessor",name:"_session",static:!1,private:!1,access:{has:e=>"_session"in e,get:e=>e._session,set:(e,t)=>{e._session=t}},metadata:r},E,P),Ro(e,null,d,{kind:"accessor",name:"_modeDesktop",static:!1,private:!1,access:{has:e=>"_modeDesktop"in e,get:e=>e._modeDesktop,set:(e,t)=>{e._modeDesktop=t}},metadata:r},j,I),Ro(e,null,c,{kind:"accessor",name:"_params",static:!1,private:!1,access:{has:e=>"_params"in e,get:e=>e._params,set:(e,t)=>{e._params=t}},metadata:r},T,R),Ro(e,null,u,{kind:"setter",name:"modeDesktop",static:!1,private:!1,access:{has:e=>"modeDesktop"in e,set:(e,t)=>{e.modeDesktop=t}},metadata:r},null,C),Ro(e,null,h,{kind:"getter",name:"modeDesktop",static:!1,private:!1,access:{has:e=>"modeDesktop"in e,get:e=>e.modeDesktop},metadata:r},null,C),Ro(e,null,p,{kind:"getter",name:"session",static:!1,private:!1,access:{has:e=>"session"in e,get:e=>e.session},metadata:r},null,C),Ro(e,null,f,{kind:"getter",name:"defaultStories",static:!1,private:!1,access:{has:e=>"defaultStories"in e,get:e=>e.defaultStories},metadata:r},null,C),Ro(e,null,g,{kind:"getter",name:"favoriteStories",static:!1,private:!1,access:{has:e=>"favoriteStories"in e,get:e=>e.favoriteStories},metadata:r},null,C),Ro(e,null,v,{kind:"getter",name:"params",static:!1,private:!1,access:{has:e=>"params"in e,get:e=>e.params},metadata:r},null,C),Ro(e,null,m,{kind:"getter",name:"hasFavoriteCard",static:!1,private:!1,access:{has:e=>"hasFavoriteCard"in e,get:e=>e.hasFavoriteCard},metadata:r},null,C),Ro(e,null,y,{kind:"getter",name:"hasUgcCard",static:!1,private:!1,access:{has:e=>"hasUgcCard"in e,get:e=>e.hasUgcCard},metadata:r},null,C),Ro(e,null,b,{kind:"getter",name:"hasFavoriteStories",static:!1,private:!1,access:{has:e=>"hasFavoriteStories"in e,get:e=>e.hasFavoriteStories},metadata:r},null,C),Ro(e,null,w,{kind:"method",name:"setParams",static:!1,private:!1,access:{has:e=>"setParams"in e,get:e=>e.setParams},metadata:r},null,C),Ro(e,null,S,{kind:"method",name:"reload",static:!1,private:!1,access:{has:e=>"reload"in e,get:e=>e.reload},metadata:r},null,C),Ro(e,null,_,{kind:"method",name:"setDefaultStories",static:!1,private:!1,access:{has:e=>"setDefaultStories"in e,get:e=>e.setDefaultStories},metadata:r},null,C),Ro(e,null,x,{kind:"method",name:"setFavoriteStories",static:!1,private:!1,access:{has:e=>"setFavoriteStories"in e,get:e=>e.setFavoriteStories},metadata:r},null,C),r&&Object.defineProperty(e,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:r})})(),Object.defineProperty(e,"index",{enumerable:!0,configurable:!0,writable:!0,value:0}),e})();class Uo extends qt{constructor(e,t){super(e,t),Object.defineProperty(this,"favoriteStories",{enumerable:!0,configurable:!0,writable:!0,value:[]}),this.favoriteStories=this.storyListViewModel.favoriteStories.slice()}}class Vo{constructor(e){Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:e})}create(){const e=new ra(this.storyManager);return new Fo(this.storyManager,e)}}class zo{static create(e,t){const r=_t.createInstance(nr,{id:0,title:t.title.content,title_color:t.title.color,is_opened:!0,background_color:"white"});return r.favorite_cell=!0,new Uo(e,r)}}class Go{static create(e,t){let r=[];t.image&&t.image.svgSrc&&t.image.svgSrc.baseState&&r.push({width:100,height:100,type:"h",url:`data:image/svg+xml,${Cn(t.image.svgSrc.baseState)}`});const i=_t.createInstance(nr,{id:-100,title:t.title.content,title_color:t.title.color,is_opened:!1,background_color:t.backgroundColor,image:r});return i.ugc_card_cell=!0,new qt(e,i)}}class Wo{constructor(e=0,t=0,r=0,i=0){Object.defineProperty(this,"x",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"y",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"width",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"height",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.x=e,this.y=t,this.width=r,this.height=i}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),r=Math.max(this.x,e.x),i=Math.min(this.y+this.height,e.y+e.height),n=Math.max(this.y,e.y);return new Wo(Math.min(t,r),Math.min(i,n),Math.max(0,t-r),Math.max(0,i-n))}getArea(){return this.width*this.height}getAreaFraction(e){return+(this.getArea()/e.getArea()*100).toFixed(2)}static clone(e){return new Wo(e.x,e.y,e.width,e.height)}}class $o{constructor(e){Object.defineProperty(this,"feedCoverageAnalyticsCalculator",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"storiesIds",{enumerable:!0,configurable:!0,writable:!0,value:new Set}),Object.defineProperty(this,"getNewStoriesIds",{enumerable:!0,configurable:!0,writable:!0,value:e=>{const t=[];for(const r of e)this.storiesIds.has(r)||t.push(r);return t}})}markStoryAsFullVisible(e){this.storiesIds.has(e)||(this.storiesIds.add(e),this.feedCoverageAnalyticsCalculator.emit("feedImpression",[e]))}calculate(e){const t=this.getNewStoriesIds(e.map((({id:e})=>e)));t.forEach((e=>this.storiesIds.add(e))),0!==t.length&&this.feedCoverageAnalyticsCalculator.emit("feedImpression",t)}}class Ho{constructor(e){Object.defineProperty(this,"feedCoverageAnalyticsCalculator",{enumerable:!0,configurable:!0,writable:!0,value:e})}calculate(e){const t=e.map((({id:e,areaFraction:t})=>({storyId:e,visibleArea:Math.round(t)/100})));0!==t.length&&this.feedCoverageAnalyticsCalculator.emit("visibleAreaUpdated",t)}}class qo extends J.EventEmitter{constructor(){super(),Object.defineProperty(this,"storyRects",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"viewport",{enumerable:!0,configurable:!0,writable:!0,value:new Wo}),Object.defineProperty(this,"feedImpressionMetric",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"visibleAreaMetric",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"filterStoryRectIntersections",{enumerable:!0,configurable:!0,writable:!0,value:e=>e.filter((e=>-100!==e.id&&e.areaFraction>0))}),this.feedImpressionMetric=new $o(this),this.visibleAreaMetric=new Ho(this)}calculate(e){const t=this.getScrollViewportByCalculationParams(e),r=this.getStoryRectIntersectionsWithViewport(t),i=this.filterStoryRectIntersections(r);this.calculateMetrics(i)}setViewport(e){this.viewport=e}setStoryRects(e){this.storyRects=e}markStoryAsFullVisible(e){this.feedImpressionMetric.markStoryAsFullVisible(e)}destroy(){this.removeAllListeners()}getScrollViewportByCalculationParams(e){const t=Wo.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 r of this.storyRects)if(r.overlaps(e)){const i=r.getIntersection(e);t.push({id:r.id,areaFraction:i.getAreaFraction(r)})}else t.push({id:r.id,areaFraction:0});return t}}class Qo extends Wo{constructor(e,t=0,r=0,i=0,n=0){super(t,r,i,n),Object.defineProperty(this,"id",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.id=e}static clone(e){return new Qo(e.id,e.x,e.y,e.width,e.height)}}class Ko{constructor(e){Object.defineProperty(this,"feedCoverageAnalyticsCalculator",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"viewportPadding",{enumerable:!0,configurable:!0,writable:!0,value:{left:0,right:0,top:0,bottom:0}}),Object.defineProperty(this,"minOffsetLeft",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"maxOffsetLeft",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"minOffsetTop",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"maxOffsetTop",{enumerable:!0,configurable:!0,writable:!0,value:0})}startScroll({x:e,y:t}){this.minOffsetLeft=e,this.minOffsetTop=t,this.maxOffsetLeft=e,this.maxOffsetTop=t}endScroll({x:e,y:t}){this.minOffsetLeft=Math.min(e,this.minOffsetLeft),this.maxOffsetLeft=Math.max(e,this.maxOffsetLeft),this.minOffsetTop=Math.min(t,this.minOffsetTop),this.maxOffsetTop=Math.max(t,this.maxOffsetTop),this.feedCoverageAnalyticsCalculator.calculate({minOffsetLeft:this.minOffsetLeft,maxOffsetLeft:this.maxOffsetLeft,minOffsetTop:this.minOffsetTop,maxOffsetTop:this.maxOffsetTop})}calculate(e,t){this.feedCoverageAnalyticsCalculator.calculate({minOffsetLeft:e,maxOffsetLeft:e,minOffsetTop:t,maxOffsetTop:t})}updateGeometry({stories:e,storyListRect:t,windowRect:r,viewportPadding:i}){this.viewportPadding=i,this.setViewport(t,r),this.setStoryRects(e,t)}destroy(){this.feedCoverageAnalyticsCalculator.destroy()}markStoryAsFullVisible(e){this.feedCoverageAnalyticsCalculator.markStoryAsFullVisible(e)}setViewport(e,t){const r=this.getViewportByWindowAndStoryList(t,e);this.applyPaddingToViewport(r,e),this.feedCoverageAnalyticsCalculator.setViewport(r)}getViewportByWindowAndStoryList(e,t){let r=new Wo;return t.overlaps(e)?(r=t.getIntersection(e),r):r}applyPaddingToViewport(e,t){t.width<768||(e.x+=this.viewportPadding.left,e.y+=this.viewportPadding.top,e.height-=this.viewportPadding.top+this.viewportPadding.bottom,e.width-=this.viewportPadding.left+this.viewportPadding.right)}setStoryRects(e,t){const r=[];e.forEach(((i,n)=>{const s=Number(i.dataset.id),o=new Qo(s,i.offsetLeft,i.offsetTop,i.clientWidth,i.clientHeight);r.push(o),o.x+=t.x,o.y+=t.y,this.applyPaddingAndNegativeMarginToStoryRect(o,n,e.length-1)})),this.feedCoverageAnalyticsCalculator.setStoryRects(r)}applyPaddingAndNegativeMarginToStoryRect(e,t,r){const i=this.viewportPadding;0===t&&(e.x+=i.left,e.width-=i.left),t===r&&(e.width-=i.right)}}class Yo{constructor(e,t){Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"params",{enumerable:!0,configurable:!0,writable:!0,value:t}),this.handle=this.handle.bind(this)}handle(e){const t=y.getState();this.params.listType!==We.DEFAULT||t.disableStatistic||P(e);const r=this.params.feed,i=this.params.filter,n=yt(r),s={stories:e.map((e=>{const t={title:null,tags:[],slidesCount:null},r=Qe.getState().find((t=>t.id===e));return r&&(t.title=r.stat_title,t.tags=r.tags,t.slidesCount=r.slides_count,r.type===We.UGC&&(t.ugcPayload=W()(r.payload)?r.payload:{})),Object.assign({id:e},t)})),feed:null,filter:null};n===We.DEFAULT?s.feed=r:n===We.UGC&&(s.filter=i),this.storyManager.emit("feedImpression",s)}}class Zo{constructor(e,t){Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"params",{enumerable:!0,configurable:!0,writable:!0,value:t}),this.handle=this.handle.bind(this)}handle(e){const t=this.params.feed,r=this.params.filter,i=yt(t),n={stories:e.map((({storyId:e,visibleArea:t})=>{const r={title:null,tags:[],slidesCount:null,visibleArea:t},i=Qe.getState().find((t=>t.id===e));return i&&(r.title=i.stat_title,r.tags=i.tags,r.slidesCount=i.slides_count,i.type===We.UGC&&(r.ugcPayload=W()(i.payload)?i.payload:{})),Object.assign({id:e},r)})),feed:null,filter:null};i===We.DEFAULT?n.feed=t:i===We.UGC&&(n.filter=r),this.storyManager.emit("visibleAreaUpdated",n)}}class Xo{constructor(e,t){Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"params",{enumerable:!0,configurable:!0,writable:!0,value:t})}create(){const e=new qo,t=new Yo(this.storyManager,this.params),r=new Zo(this.storyManager,this.params);e.on("feedImpression",t.handle),e.on("visibleAreaUpdated",r.handle);return new Ko(e)}}const Jo=(e,t)=>{let r=[];switch(e){case Re.default:r=t?Xe.getState()[t]:[];break;case Re.favorite:r=et.getState();break;case Re.onboarding:r=t?Je.getState()[t]:[]}return null!=r?r:[]};class ea extends _t{constructor(){super(),Object.defineProperty(this,"id",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"expire_in",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"closed",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"share",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"user_key",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"server_timestamp",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"is_allow_profiling",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"preview_aspect_ratio",{enumerable:!0,configurable:!0,writable:!0,value:1}),Object.defineProperty(this,"session",{enumerable:!0,configurable:!0,writable:!0,value:{id:""}})}singleModelWrapper(){return""}attributes(){return at()(super.attributes(),["server_timestamp","session","cache","share","user_key","placeholders","is_allow_profiling","preview_aspect_ratio"])}}var ta=function(e,t,r,i){return new(r||(r=Promise))((function(n,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}l((i=i.apply(e,t||[])).next())}))};class ra{constructor(e){Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:e})}loadStories(e){return ta(this,arguments,void 0,(function*({feedSlug:e,filter:t,listType:r,testKey:i,needFavorite:n=!0}){const s=r===We.DEFAULT&&n;yield ds({defaultList:{feedSlug:e,filter:t},onboardingList:!1,favoriteList:s,testKey:i});const o=Jo(Re.default,e),a=(e=>e===Oa?We.UGC:We.DEFAULT)(e),l={stories:o.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===We.UGC&&(t.ugcPayload=W()(e.payload)?e.payload:{})),Object.assign({id:e.id},t)})),feed:null,filter:null};a===We.DEFAULT?l.feed=e:a===We.UGC&&(l.filter=t),this.storyManager.emit("feedLoad",l);return{defaultStories:Jo(Re.default,e),favoriteStories:Jo(Re.favorite,e)}}))}observeDefaultStories(e){return Xe.map((t=>{var r;return(null!==(r=t[e])&&void 0!==r?r:[]).map((e=>this.createStoryByData(Object.assign(Object.assign({},e),{slides_html:[]}))))}))}observeFavoriteStories(){return et.map((e=>e.map((e=>this.createStoryByData(Object.assign(Object.assign({},e),{slides_html:[]}))))))}observeSession(){return L.map((e=>_t.createInstance(ea,e)))}createStoryByData(e){return e instanceof nr?e:_t.createInstance(nr,e)}}var ia=f(2784),na=f.n(ia);class sa{constructor(e){Object.defineProperty(this,"sliderApi",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"debouncedTryEndScroll",{enumerable:!0,configurable:!0,writable:!0,value:na()((()=>{this.sliderApi.notifyScrollEnd()}),200)}),this.handleScroll=this.handleScroll.bind(this),this.init(),this.addEventListeners()}destroy(){this.sliderApi.getElementRef().removeEventListener("scroll",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(){this.sliderApi.getElementRef().addEventListener("scroll",this.handleScroll)}scrollTo(e){const t=this.sliderApi.getElementRef(),r="ltr"===this.sliderApi.dir?1:-1;t.scrollLeft=r*e.x,t.scrollTop=e.y}scrollWithAnimation(e,t){const r=this.sliderApi.getElementRef(),i="ltr"===this.sliderApi.dir?1:-1;r.scrollTo({left:i*e.x,top:e.y,behavior:"smooth"})}stopAnimation(){}handleScroll(){this.sliderApi.notifyScrollStart();const e=this.sliderApi.getElementRef();this.sliderApi.updatePosition(Math.abs(e.scrollLeft),Math.abs(e.scrollTop)),this.sliderApi.testAttraction(),this.sliderApi.emit("scroll",this.sliderApi.getCurrentPosition()),this.debouncedTryEndScroll()}}class oa{constructor(e){Object.defineProperty(this,"sliderApi",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"lastClientX",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"lastClientY",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"pushed",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"isDragging",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"isAnimating",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"debouncedTryAnimationEndScroll",{enumerable:!0,configurable:!0,writable:!0,value:na()((()=>{this.isAnimating=!1,this.sliderApi.notifyScrollEnd()}),200)}),this.handleScroll=this.handleScroll.bind(this),this.init(),this.handleMouseDown=this.handleMouseDown.bind(this),this.handleMouseMove=this.handleMouseMove.bind(this),this.handleMouseUp=this.handleMouseUp.bind(this),this.addEventListeners()}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();e.addEventListener("scroll",this.handleScroll),e.addEventListener("mousedown",this.handleMouseDown,Nn),e.addEventListener("touchstart",this.handleMouseDown,Nn)}scrollTo(e){const t=this.sliderApi.getElementRef(),r="ltr"===this.sliderApi.dir?1:-1;t.scrollLeft=r*e.x,t.scrollTop=e.y,this.sliderApi.updatePosition(Math.abs(t.scrollLeft),Math.abs(t.scrollTop)),this.sliderApi.testAttraction(),this.sliderApi.emit("scroll",this.sliderApi.getCurrentPosition())}scrollWithAnimation(e,t){this.isAnimating=!0;const r=this.sliderApi.getElementRef(),i="ltr"===this.sliderApi.dir?1:-1;r.scrollTo({left:i*e.x,top:e.y,behavior:"smooth"})}stopAnimation(){}destroy(){const e=this.sliderApi.getElementRef();e.removeEventListener("mousedown",this.handleMouseDown,Nn),e.removeEventListener("touchstart",this.handleMouseDown,Nn),e.removeEventListener("mouseup",this.handleMouseUp,Nn),e.removeEventListener("touchend",this.handleMouseUp,Nn),e.removeEventListener("mousemove",this.handleMouseMove,Nn),e.removeEventListener("touchmove",this.handleMouseMove,Nn),e.removeEventListener("scroll",this.handleScroll)}handleMouseDown(e){this.pushed=!0,this.isDragging=!1;const{clientX:t,clientY:r}=this.extractPointerPosition(e);this.lastClientX=t,this.lastClientY=r,window.addEventListener("mouseup",this.handleMouseUp,Nn),window.addEventListener("touchend",this.handleMouseUp,Nn),window.addEventListener("mousemove",this.handleMouseMove,Nn),window.addEventListener("touchmove",this.handleMouseMove,Nn)}handleMouseUp(){this.pushed&&(this.pushed=!1,this.isDragging=!1,this.sliderApi.notifyScrollEnd(),window.removeEventListener("mouseup",this.handleMouseUp,Nn),window.removeEventListener("touchend",this.handleMouseUp,Nn),window.removeEventListener("mousemove",this.handleMouseMove,Nn),window.removeEventListener("touchmove",this.handleMouseMove,Nn))}handleMouseMove(e){if(!this.pushed)return;const{clientX:t,clientY:r}=this.extractPointerPosition(e),i=t-this.lastClientX,n=r-this.lastClientY;this.lastClientX=t,this.lastClientY=r;const{x:s,y:o}=this.sliderApi.preparePosition(this.sliderApi.getCurrentPosition().x-i,this.sliderApi.getCurrentPosition().y-n);!this.isDragging&&(Math.abs(i)>=1||Math.abs(n)>=1)&&(this.isDragging=!0),this.isDragging&&this.scrollTo({x:s,y:o})}extractPointerPosition(e){return e instanceof MouseEvent?{clientX:e.clientX,clientY:e.clientY}:{clientX:e.touches[0].clientX,clientY:e.touches[0].clientY}}handleScroll(){this.isDragging?this.handleScrollByDraggable():this.handleScrollByAnimation()}handleScrollByDraggable(){this.sliderApi.notifyScrollStart()}handleScrollByAnimation(){if(!this.isAnimating)return;this.sliderApi.notifyScrollStart();const e=this.sliderApi.getElementRef();this.sliderApi.updatePosition(Math.abs(e.scrollLeft),Math.abs(e.scrollTop)),this.sliderApi.testAttraction(),this.sliderApi.emit("scroll",this.sliderApi.getCurrentPosition()),this.debouncedTryAnimationEndScroll()}}var aa;!function(e){e.Horizontal="horizontal",e.Vertical="vertical"}(aa||(aa={}));class la extends J.EventEmitter{constructor(){super(...arguments),Object.defineProperty(this,"scrollStrategy",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_isScrolling",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"slider",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"currentPosition",{enumerable:!0,configurable:!0,writable:!0,value:{x:0,y:0}}),Object.defineProperty(this,"direction",{enumerable:!0,configurable:!0,writable:!0,value:aa.Horizontal}),Object.defineProperty(this,"gap",{enumerable:!0,configurable:!0,writable:!0,value:20}),Object.defineProperty(this,"_reachStart",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"_reachEnd",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"desktopMode",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"_dir",{enumerable:!0,configurable:!0,writable:!0,value:"ltr"})}get isScrolling(){return this._isScrolling}get slides(){return this.slider.children[0]instanceof HTMLSlotElement?this.slider.children[0].assignedElements({flatten:!1}):Array.from(this.slider.children)}get elementRef(){return this.slider}get reachStart(){return this._reachStart}get reachEnd(){return this._reachEnd}get scrollWidth(){return this.slider.scrollWidth}get dir(){return this._dir}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){e=Math.trunc(e);const r=this.preparePosition(e,e);this.isTheSamePosition(r.x,r.y)||(t>0?this.scrollStrategy.scrollWithAnimation(r,t):this.scrollStrategy.scrollTo(r))}isHorizontal(){return this.direction===aa.Horizontal}updatePosition(e,t){this.currentPosition={x:Math.trunc(e),y:Math.trunc(t)}}getElementRef(){return this.slider}getCurrentPosition(){return this.currentPosition}preparePosition(e,t){let r={x:e,y:t};return this.isHorizontal()?r.y=0:r.x=0,this.attractToBounds(r.x,r.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(),r=e+this.slider.clientWidth>=Math.max(this.slider.scrollWidth-1,0),i=t+this.slider.clientHeight>=Math.max(this.slider.scrollHeight-1,0);this._reachStart=0===e&&0===t,this._reachEnd=this.isHorizontal()?r:i,this.emit("reachStart",this._reachStart),this.emit("reachEnd",this._reachEnd)}setTextDirection(e){this._dir=e}scrollBySlideIndex(e,t){this.isHorizontal()?this.scrollTo(this.slides[e].offsetLeft,t):this.scrollTo(this.slides[e].offsetTop,t)}scrollByDirection(e,t){const{x:r,y:i}=this.getCurrentPosition(),n=this.isHorizontal()?r:i,s=this.getSlidesPerView(),o=this.getStoryWidth(),a=this.getStoryHeight(),l=n+e*s*(this.isHorizontal()?o:a);this.scrollTo(l,t)}notifyScrollStart(){this.isScrolling||(this._isScrolling=!0,this.emit("scrollstart",this.currentPosition))}notifyScrollEnd(){this.isScrolling&&(this._isScrolling=!1,this.emit("scrollend",this.currentPosition))}isTheSamePosition(e,t){return e===this.currentPosition.x&&t===this.currentPosition.y}getSlidesPerView(){if(this.isHorizontal()&&this.slider.clientWidth){const e=this.slider.children[0].clientWidth+this.gap;return Math.round(this.slider.clientWidth/e)}if(!this.isHorizontal()&&this.slider.clientHeight){const e=this.slider.children[0].clientHeight+this.gap;return Math.round(this.slider.clientHeight/e)}return 1}getStoryWidth(){var e;return(null===(e=this.slides[0])||void 0===e?void 0:e.clientWidth)+this.gap}getStoryHeight(){var e;return(null===(e=this.slides[0])||void 0===e?void 0:e.clientHeight)+this.gap}changeScrollStrategy(){this.scrollStrategy&&this.scrollStrategy.destroy(),this.scrollStrategy=this.desktopMode?new oa(this):new sa(this)}}var da=function(e,t,r,i){return new(r||(r=Promise))((function(n,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}l((i=i.apply(e,t||[])).next())}))};class ca{static getUgcEditorConfig(){return da(this,void 0,void 0,(function*(){var e;let t=L.getState();yield A(),(null==t?void 0:t.editor)||(yield Kn({}));const r=y.getState(),i=L.getState(),n="3.0.0";return{sessionId:i.session.id,apiKey:r.apiKey,editor:null!==(e=i.editor)&&void 0!==e?e:{},sdkVersion:n,appPackageId:r.appPackageId,deviceId:C.getState(),userId:null!=r.userId?String(r.userId):void 0,lang:r.lang.toString()}}))}}var ua=function(e,t,r,i){return new(r||(r=Promise))((function(n,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}l((i=i.apply(e,t||[])).next())}))};class ha extends J.EventEmitter{constructor(e,t,r,i){super(),Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"storyReaderViewModel",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"storyId",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"options",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(this,"showSharePage",{enumerable:!0,configurable:!0,writable:!0,value:()=>ua(this,void 0,void 0,(function*(){var e;this.handleStartLoad();const t=null===(e=this.storyManager.getConfig())||void 0===e?void 0:e.disableStatistic,r=yield this.storyReaderViewModel.showStoryFromSharePage(this.storyId,t);this.handleEndLoad(r)}))}),this.handleCloseStoryReader=this.handleCloseStoryReader.bind(this),this.showSharePage(),this.storyReaderViewModel.once("closeStoryReader",this.handleCloseStoryReader)}closeStoryReader(){return ua(this,void 0,void 0,(function*(){this.storyManager.closeStoryReader()}))}handleStartLoad(){setTimeout((()=>{var e;this.emit(zt.START_LOADING),Dt()(null===(e=this.options)||void 0===e?void 0:e.handleStartLoad)&&this.options.handleStartLoad()}))}handleEndLoad(e){var t;this.emit(zt.END_LOADING,{result:e}),Dt()(null===(t=this.options)||void 0===t?void 0:t.handleStopLoad)&&this.options.handleStopLoad(e)}handleCloseStoryReader(){var e,t,r;if(Dt()(null===(e=this.options)||void 0===e?void 0:e.handleStoryReaderClose)||this.listenerCount(zt.CLOSE_STORY_READER)>0)try{Dt()(null===(t=this.options)||void 0===t?void 0:t.handleStoryReaderClose)&&(null===(r=this.options)||void 0===r||r.handleStoryReaderClose()),this.emit(zt.CLOSE_STORY_READER)}catch(e){console.error(e)}else{const e=window.location;window.open(`${e.protocol}//${e.host}`,"_parent")}}}var pa=function(e,t,r,i){return new(r||(r=Promise))((function(n,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}l((i=i.apply(e,t||[])).next())}))};class fa{constructor(e){Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"plugins",{enumerable:!0,configurable:!0,writable:!0,value:new Map})}install(e,t){this.plugins.set(e.name,e),lt(`[PluginManager]: plugin ${e.name} registered`),e.install(this.storyManager,t),lt(`[PluginManager]: plugin ${e.name} installed`)}uninstall(e){e.uninstall(this.storyManager),this.plugins.delete(e.name),lt(`[PluginManager]: plugin ${e.name} uninstalled`)}get(e){return this.plugins.get(e)}}class ga{constructor(e,t){var r,i,n,s,o,a;Object.defineProperty(this,"storyFeed",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"storyItem",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"id",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"title",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"titleColor",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"hasAudio",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"hasSwipeUp",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"isOpened",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"deeplink",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"gameInstanceId",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"hideInReader",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"hideTimeline",{enumerable:!0,configurable:!0,writable:!0,value:!1});const l=_t.createInstance(nr,Object.assign(Object.assign({},e),{slides:[]}));this.id=l.id,this.title=l.title,this.titleColor=l.title_color,this.hasAudio=null!==(r=l.has_audio)&&void 0!==r&&r,this.hasSwipeUp=null!==(i=l.has_swipe_up)&&void 0!==i&&i,this.isOpened=l.is_opened,this.deeplink=null!==(n=l.deeplink)&&void 0!==n?n:void 0,this.gameInstanceId=null!==(o=null===(s=l.game_instance)||void 0===s?void 0:s.id)&&void 0!==o?o:void 0,this.hideInReader=null!==(a=l.hide_in_reader)&&void 0!==a&&a,this.hideTimeline=l.hide_timeline,this.isOpened=l.isOpened,this.storyItem=l}getCover(e){var t,r,i,n;return{imageSrc:null===(r=null===(t=this.storyItem.image)||void 0===t?void 0:t.findOneByCoverQuality(e))||void 0===r?void 0:r.url,videoSrc:null!==(i=this.storyItem.videoCoverSrc)&&void 0!==i?i:void 0,backgroundColor:this.storyItem.background_color,feedCoverSrc:null===(n=this.storyFeed)||void 0===n?void 0:n.coverSrc}}}var va=function(e,t,r){for(var i=arguments.length>2,n=0;n<t.length;n++)r=i?t[n].call(e,r):t[n].call(e);return i?r:void 0},ma=function(e,t,r,i,n,s){function o(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var a,l=i.kind,d="getter"===l?"get":"setter"===l?"set":"value",c=!t&&e?i.static?e:e.prototype:null,u=t||(c?Object.getOwnPropertyDescriptor(c,i.name):{}),h=!1,p=r.length-1;p>=0;p--){var f={};for(var g in i)f[g]="access"===g?{}:i[g];for(var g in i.access)f.access[g]=i.access[g];f.addInitializer=function(e){if(h)throw new TypeError("Cannot add initializers after decoration has completed");s.push(o(e||null))};var v=(0,r[p])("accessor"===l?{get:u.get,set:u.set}:u[d],f);if("accessor"===l){if(void 0===v)continue;if(null===v||"object"!=typeof v)throw new TypeError("Object expected");(a=o(v.get))&&(u.get=a),(a=o(v.set))&&(u.set=a),(a=o(v.init))&&n.unshift(a)}else(a=o(v))&&("field"===l?n.unshift(a):u[d]=a)}c&&Object.defineProperty(c,i.name,u),h=!0},ya=function(e,t,r,i){if("a"===r&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?i:"a"===r?i.call(e):i?i.value:t.get(e)},ba=function(e,t,r,i,n){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!n)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?n.call(e,r):n?n.value=r:t.set(e,r),r};let wa=(()=>{var e,t;let r,i,n=Vt,s=[],o=[],a=[];return e=class extends n{get topStory(){return ya(this,t,"f")}set topStory(e){ba(this,t,e,"f")}constructor(e={feed:"default"}){super(),Object.defineProperty(this,"options",{enumerable:!0,configurable:!0,writable:!0,value:(va(this,s),e)}),Object.defineProperty(this,"storyModels",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"unreadedStoryModels",{enumerable:!0,configurable:!0,writable:!0,value:new Map}),Object.defineProperty(this,"storiesSubscription",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"feedsSubscription",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"feed",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),t.set(this,va(this,o,null)),Object.defineProperty(this,"_activeIndex",{enumerable:!0,configurable:!0,writable:!0,value:(va(this,a),-1)}),this.handleStoriesChange=this.handleStoriesChange.bind(this),this.handleFeedsChange=this.handleFeedsChange.bind(this),this.storiesSubscription=Xe.watch(this.handleStoriesChange),this.feedsSubscription=He.watch(this.handleFeedsChange)}get stories(){return this.storyModels.map((e=>this.createStackFeedStoryByModel(e)))}get length(){return this.storyModels.length}get activeIndex(){return this._activeIndex}get feedCoverSrc(){var e;return null===(e=this.feed)||void 0===e?void 0:e.coverSrc}get top(){return this.topStory}reload(){this.storyModels=[],this.unreadedStoryModels=new Map}destroy(){this.storiesSubscription.unsubscribe(),this.feedsSubscription.unsubscribe(),this.emit("destroy")}markStoryAsOpened(e){this.unreadedStoryModels.delete(e),this.resetUnreadedStories(),this.update()}resetUnreadedStories(){0===this.unreadedStoryModels.size&&(this.unreadedStoryModels=new Map(this.storyModels.map((e=>[e.id,e]))))}handleStoriesChange(e){var t;const r=null!==(t=e[this.options.feed])&&void 0!==t?t:[];0!==r.length&&(this.storyModels=r.slice(),this.resetUnreadedStories(),this.update())}handleFeedsChange(e){this.feed=e[this.options.feed]}createStackFeedStoryByModel(e){return new ga(e,this.feed)}update(){const e=this.unreadedStoryModels.values().next().value;if(!e)throw new Error("[StackedStoryList]: Empty stacked story list");this._activeIndex=this.storyModels.indexOf(e),this.topStory=this.createStackFeedStoryByModel(e),this.onUpdateTopStory(this.topStory),this.emit("update",this.topStory)}},t=new WeakMap,(()=>{var t;const l="function"==typeof Symbol&&Symbol.metadata?Object.create(null!==(t=n[Symbol.metadata])&&void 0!==t?t:null):void 0;r=[to.observable],i=[to.computed],ma(e,null,r,{kind:"accessor",name:"topStory",static:!1,private:!1,access:{has:e=>"topStory"in e,get:e=>e.topStory,set:(e,t)=>{e.topStory=t}},metadata:l},o,a),ma(e,null,i,{kind:"getter",name:"top",static:!1,private:!1,access:{has:e=>"top"in e,get:e=>e.top},metadata:l},null,s),l&&Object.defineProperty(e,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:l})})(),e})();var Sa=function(e,t,r,i){return new(r||(r=Promise))((function(n,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}l((i=i.apply(e,t||[])).next())}))};class _a extends wa{constructor(e,t){super(t),Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"feedCoverageAnalyticsCalculator",{enumerable:!0,configurable:!0,writable:!0,value:new qo}),Object.defineProperty(this,"firstStoryShown",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_id",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this._id=(0,j.v4)(),this.handleShowStory=this.handleShowStory.bind(this),this.handleCloseStoryReader=this.handleCloseStoryReader.bind(this),this.handleEventBusEvents=this.handleEventBusEvents.bind(this),this.subscribeToStoryReader(),this.subscribeToFeedCoverageAnalytics(),setTimeout((()=>{this.loadStories()}),0),this.storyManager.setViewModel(this._id,this)}reload(){const e=Object.create(null,{reload:{get:()=>super.reload}});return Sa(this,void 0,void 0,(function*(){return this.firstStoryShown=!1,e.reload.call(this),this.loadStories()}))}destroy(){const e=this.storyManager.storyReaderViewModel;null==e||e.off("showStory",this.handleShowStory),null==e||e.off("closeStoryReader",this.handleCloseStoryReader),ar.off("openGame",this.handleShowStory),ar.off("clickOnStoryDeepLink",this.handleShowStory),this.feedCoverageAnalyticsCalculator.destroy(),super.destroy(),this.storyManager.deleteViewModel(this._id)}showStory(e){var t;const r=Ca.instance,i=Nt()(e.deeplink)&&e.deeplink.trim().length>0,n=e.gameInstanceId;if(!e.hideInReader||i||n){if(i&&null!==e.deeplink){const t={index:0,id:e.id,story:e,isDeeplink:!0,url:e.deeplink};return r.clickOnButtonAction({src:Gt.STACK_STORY_LIST,payload:t}),void this.markStoryAsOpened(e.id)}if(n)return r.openGame(n),void this.markStoryAsOpened(e.id);null===(t=this.storyManager.storyReaderViewModel)||void 0===t||t.showMultipleStories({storyId:e.id,listType:Re.default,windowReferer:Te.stacked,feed:this.options.feed}),this.markStoryAsOpened(e.id)}else console.error("[StackedStoryList]: Cannot open hidden story id "+e.id)}handleCloseStoryReader(){this.top&&this.feedCoverageAnalyticsCalculator.markStoryAsFullVisible(this.top.id)}markStoryAsOpened(e){Ls.markAsOpened(e),this.feedCoverageAnalyticsCalculator.markStoryAsFullVisible(e),super.markStoryAsOpened(e)}onUpdateTopStory(e){this.firstStoryShown||(this.firstStoryShown=!0,this.feedCoverageAnalyticsCalculator.markStoryAsFullVisible(e.id))}subscribeToStoryReader(){return Sa(this,void 0,void 0,(function*(){try{const e=this.storyManager.storyReaderViewModel;ar.on("openGame",this.handleEventBusEvents),ar.on("clickOnStoryDeepLink",this.handleEventBusEvents),null==e||e.on("showStory",this.handleShowStory),null==e||e.on("closeStoryReader",this.handleCloseStoryReader)}catch(e){console.error("[StackedStoryList]: error while story reader init")}}))}handleShowStory({id:e}){this.markStoryAsOpened(e)}handleEventBusEvents({id:e}){this.markStoryAsOpened(e)}loadStories(){return Sa(this,void 0,void 0,(function*(){try{this.emit("startLoad"),yield ds({defaultList:{feedSlug:this.options.feed,filter:{}},onboardingList:!1,favoriteList:!1}),this.emit("endLoad")}catch(e){console.error("[StackedStoryList]: error while story list loaded")}}))}subscribeToFeedCoverageAnalytics(){const e=new Yo(this.storyManager,{listType:We.DEFAULT,feed:this.options.feed,filter:{}});this.feedCoverageAnalyticsCalculator.on("feedImpression",e.handle)}}var xa=function(e,t,r,i){return new(r||(r=Promise))((function(n,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}l((i=i.apply(e,t||[])).next())}))};const Oa="{{__ugc__}}";class Ca extends J.EventEmitter{constructor(){return super(),Object.defineProperty(this,"viewModelStore",{enumerable:!0,configurable:!0,writable:!0,value:new $t}),Object.defineProperty(this,"config",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"callbacks",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"pluginManager",{enumerable:!0,configurable:!0,writable:!0,value:new fa(this)}),Object.defineProperty(this,"clickOnButtonAction",{enumerable:!0,configurable:!0,writable:!0,value:({src:e,payload:t})=>{if(Dt()(this.callbacks.storyLinkClickHandler)||this.listenerCount(Be.CLICK_ON_STORY)>0){const r={src:e,data:t};try{Dt()(this.callbacks.storyLinkClickHandler)&&this.callbacks.storyLinkClickHandler(r),this.emit(Be.CLICK_ON_STORY,r)}catch(e){console.error(e)}}else window.open(t.url,"_self")}}),Ca.isSingletonInstanceExists()||(Ca.instance=this),Ca.instance}static get combinedPlaceholders(){return Ue()}get sdkVersionName(){return"3.0.0"}get sdkVersionCode(){return parseInt(3e4)}get lang(){return y.getState().lang}set storyLinkClickHandler(e){Dt()(e)&&(this.callbacks.storyLinkClickHandler=e)}get storyReaderViewModel(){return this.viewModelStore.get(Ao.name)}get gameReaderViewModel(){return this.viewModelStore.get(Da.name)}static getInstance(){return Ca.instance?Ca.instance:null}setViewModel(e,t){this.viewModelStore.set(e,t)}deleteViewModel(e){this.viewModelStore.delete(e)}getViewModelByKey(e){return this.viewModelStore.get(e)}getConfig(){return this.config}setConfig(e){this.validateConfig(e),this.initializeConfig(e)}destroy(){if(null!=Ca.instance){Ca.instance=null,this.closeAllReaders();for(const e of this.viewModelStore.getAll())e.destroy()}}setTags(e){this.config&&(z.getInstance().checkTagsLength(e),w({tags:e}),this.config.tags=e)}setUserId(e,t){return xa(this,void 0,void 0,(function*(){(Nt()(e)||Ut()(e))&&this.config&&this.config.userId!==e&&(this.config.userId=e,z.getInstance().checkUserIdLength(e),S({userId:e,userIdSign:t}),E(),yield this.closeAllReaders(),yield this.reloadAllStoryLists(),yield this.reloadAllStackedStoryLists())}))}setLang(e){return xa(this,void 0,void 0,(function*(){this.config&&Nt()(e)&&this.config.lang!==e&&(O({lang:e}),this.config.lang=e,E(),yield this.closeAllReaders(),yield this.reloadAllStoryLists(),yield this.reloadAllStackedStoryLists())}))}setApiKey(e){this.config&&(U(e),b({apiKey:e}),E(),this.config.apiKey=e)}setPlaceholders(e){W()(e)&&this.config&&(_({placeholders:e}),Pe(e),this.config.placeholders=e)}setImagePlaceholders(e){W()(e)&&this.config&&(x({imagePlaceholders:e}),Ae(e),this.config.imagePlaceholders=e)}showOnboardingStories(e){return xa(this,void 0,void 0,(function*(){return yield this.viewModelStore.wait(Ao.name),this.storyReaderViewModel.showOnboardingStories(e)}))}showStory(e){return xa(this,void 0,void 0,(function*(){"string"==typeof e&&(e=+e||e),yield this.viewModelStore.wait(Ao.name);return this.storyReaderViewModel.showStory(e,"")}))}showStoryOnce(e){return xa(this,void 0,void 0,(function*(){"string"==typeof e&&(e=+e||e),yield this.viewModelStore.wait(Ao.name);return this.storyReaderViewModel.showStoryOnce(e)}))}closeAllReaders(){var e,t;null===(e=this.storyReaderViewModel)||void 0===e||e.close(),null===(t=this.gameReaderViewModel)||void 0===t||t.closeGame()}closeGoodsWidget(){var e;null===(e=this.storyReaderViewModel)||void 0===e||e.closeGoodsWidget()}openGame(e){return xa(this,arguments,void 0,(function*(e,t={}){const r=this.gameReaderViewModel;try{yield r.openGame(e,t)}catch(e){console.error(e)}}))}closeGame(){return xa(this,void 0,void 0,(function*(){return this.gameReaderViewModel.closeGame()}))}closeStoryReader(){return xa(this,void 0,void 0,(function*(){this.storyReaderViewModel.close()}))}getUgcEditorConfig(){return xa(this,void 0,void 0,(function*(){return ca.getUgcEditorConfig()}))}showSharePage(e,t){return xa(this,void 0,void 0,(function*(){return"string"==typeof e&&(e=+e||e),yield this.viewModelStore.wait(Ao.name),new ha(this,this.storyReaderViewModel,e,t)}))}reloadAllStoryLists(){const e=this.viewModelStore.getAllOfType((e=>e instanceof Fo));return Promise.all(e.map((e=>e.reload())))}reloadAllStackedStoryLists(){const e=this.viewModelStore.getAllOfType((e=>e instanceof _a));return Promise.all(e.map((e=>e.reload())))}static isSingletonInstanceExists(){return!!Ca.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");z.getInstance().checkUserIdLength(e.userId),z.getInstance().checkTagsLength(e.tags)}initializeConfig(e){U(e.apiKey),b(e),e.placeholders&&Pe(e.placeholders),e.imagePlaceholders&&Ae(e.imagePlaceholders),E(),e.disableStatistic="com.inappstory.webpreview"===e.appPackageId,this.config=e}use(e,t){this.pluginManager.install(e,t)}getPlugin(e){return this.pluginManager.get(e)}createStoryReader(){return new Ht(this).createStoryReader()}createGameReader(){return new Ht(this).createGameReader()}createStoryList(){return new Ht(this).createStoryList()}}const ka=new Ca,La=new class{constructor(e){Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value: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()}getNonce(){return Xt()}showOnboardingStories(e){return pa(this,void 0,void 0,(function*(){return this.storyManager.showOnboardingStories(e)}))}showStory(e){return pa(this,void 0,void 0,(function*(){return this.storyManager.showStory(e)}))}showStoryOnce(e){return pa(this,void 0,void 0,(function*(){return this.storyManager.showStoryOnce(e)}))}closeAllReaders(){this.storyManager.closeAllReaders()}openGame(e){return pa(this,arguments,void 0,(function*(e,t={}){return this.storyManager.openGame(e,t)}))}closeGame(){return pa(this,void 0,void 0,(function*(){return this.storyManager.closeGame()}))}closeStoryReader(){return pa(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}static use(e,t){ka.use(e,t)}}(ka);var Aa=function(e,t,r,i){return new(r||(r=Promise))((function(n,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}l((i=i.apply(e,t||[])).next())}))};const Ma=(0,e.createEffect)((e=>Aa(void 0,[e],void 0,(function*({gameInstanceId:e,gameOptions:t}){yield A();const r={};t&&W()(t)&&null!=t.demoMode&&(r.demoMode=Boolean(t.demoMode));const i=yield Y.post(`game/${e}/launch?expand=config`,r);if(!i.ok)throw new Error(JSON.stringify(i.data));return i.data.clientConfig=Ea(),i.data})))),Ea=()=>{var e;let t=L.getState();const r=y.getState();return{sessionId:t.session.id,userKey:t.user_key,apiKey:r.apiKey,sdkVersion:"3.0.0",apiBaseUrl:N.apiUrl,userAgent:q,appPackageId:r.appPackageId,deviceId:C.getState(),userId:null!==(e=r.userId)&&void 0!==e?e:"",lang:r.lang.toString(),placeholders:Ca.combinedPlaceholders}};var Pa=function(e,t,r){for(var i=arguments.length>2,n=0;n<t.length;n++)r=i?t[n].call(e,r):t[n].call(e);return i?r:void 0},ja=function(e,t,r,i,n,s){function o(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var a,l=i.kind,d="getter"===l?"get":"setter"===l?"set":"value",c=!t&&e?i.static?e:e.prototype:null,u=t||(c?Object.getOwnPropertyDescriptor(c,i.name):{}),h=!1,p=r.length-1;p>=0;p--){var f={};for(var g in i)f[g]="access"===g?{}:i[g];for(var g in i.access)f.access[g]=i.access[g];f.addInitializer=function(e){if(h)throw new TypeError("Cannot add initializers after decoration has completed");s.push(o(e||null))};var v=(0,r[p])("accessor"===l?{get:u.get,set:u.set}:u[d],f);if("accessor"===l){if(void 0===v)continue;if(null===v||"object"!=typeof v)throw new TypeError("Object expected");(a=o(v.get))&&(u.get=a),(a=o(v.set))&&(u.set=a),(a=o(v.init))&&n.unshift(a)}else(a=o(v))&&("field"===l?n.unshift(a):u[d]=a)}c&&Object.defineProperty(c,i.name,u),h=!0},Ia=function(e,t,r,i){return new(r||(r=Promise))((function(n,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}l((i=i.apply(e,t||[])).next())}))},Ta=function(e,t,r,i){if("a"===r&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?i:"a"===r?i.call(e):i?i.value:t.get(e)},Ra=function(e,t,r,i,n){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!n)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?n.call(e,r):n?n.value=r:t.set(e,r),r};let Da=(()=>{var e,t,r,i,n,s,o,a,l;let d,c,u,h,p,f,g,v,m,y,b,w,S,_,x,O,C,k,L,A,M,E,P,j,I,T,R=Vt,D=[],B=[],N=[],F=[],U=[],V=[],z=[],G=[],$=[],H=[],q=[],Q=[],K=[],Y=[],Z=[],X=[],J=[];return e=class extends R{get _isOpened(){return Ta(this,t,"f")}set _isOpened(e){Ra(this,t,e,"f")}get _isGameInited(){return Ta(this,r,"f")}set _isGameInited(e){Ra(this,r,e,"f")}get _isGameLoading(){return Ta(this,i,"f")}set _isGameLoading(e){Ra(this,i,e,"f")}get _gameInstanceId(){return Ta(this,n,"f")}set _gameInstanceId(e){Ra(this,n,e,"f")}get _gameLaunch(){return Ta(this,s,"f")}set _gameLaunch(e){Ra(this,s,e,"f")}get _gameLaunchError(){return Ta(this,o,"f")}set _gameLaunchError(e){Ra(this,o,e,"f")}get _closeBtnVisible(){return Ta(this,a,"f")}set _closeBtnVisible(e){Ra(this,a,e,"f")}get _gameShouldBeShown(){return Ta(this,l,"f")}set _gameShouldBeShown(e){Ra(this,l,e,"f")}constructor(d){super(),Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:(Pa(this,D),d)}),t.set(this,Pa(this,B,!1)),r.set(this,(Pa(this,N),Pa(this,F,!1))),i.set(this,(Pa(this,U),Pa(this,V,!1))),n.set(this,(Pa(this,z),Pa(this,G,null))),s.set(this,(Pa(this,$),Pa(this,H,null))),o.set(this,(Pa(this,q),Pa(this,Q,null))),a.set(this,(Pa(this,K),Pa(this,Y,!1))),l.set(this,(Pa(this,Z),Pa(this,X,!1))),Object.defineProperty(this,"initGameRetryAttempts",{enumerable:!0,configurable:!0,writable:!0,value:(Pa(this,J),0)}),Object.defineProperty(this,"gameCenterMessageService",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"safeAreaInsets",{enumerable:!0,configurable:!0,writable:!0,value:{top:0,bottom:0,left:0,right:0}}),Object.defineProperty(this,"openGameOptions",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"desktopMode",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"dir",{enumerable:!0,configurable:!0,writable:!0,value:"ltr"}),this.handleVisibilityChange=this.handleVisibilityChange.bind(this),this.handleOpenGameCenterEvent=this.handleOpenGameCenterEvent.bind(this),document.addEventListener("visibilitychange",this.handleVisibilityChange),ar.on(`${e.name}.openGame`,this.handleOpenGameCenterEvent),this.storyManager.setViewModel(e.name,this)}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 gameShouldBeShown(){return this._gameShouldBeShown}get isWidescreen(){var e,t;return this.desktopMode&&(null===(t=null===(e=this.gameLaunch)||void 0===e?void 0:e.screenOptions.widescreen)||void 0===t||t)}openGame(e,t){return Ia(this,void 0,void 0,(function*(){if(this.isOpened)throw new Error(`Close the launched game with ID "${this.gameInstanceId}"`);this._gameInstanceId=e,this._isOpened=!0,this.openGameOptions=t,this._gameShouldBeShown=!1,yield this.launchGameById(e)}))}closeGame(){return Ia(this,void 0,void 0,(function*(){var e;return!!this._isOpened&&(this._isGameInited?null===(e=this.gameCenterMessageService)||void 0===e||e.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 r;null===(r=this.gameCenterMessageService)||void 0===r||r.sendGameCenterEventByApiRequest(e,t)}setSafeAreaInsets(e){this.safeAreaInsets=e}setDesktopMode(e){this.desktopMode=e}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 r=new URL(this._gameLaunch.url).origin;this.gameCenterMessageService=new _e(e,r),this.initGameCenter(this.gameCenterMessageService,this._gameLaunch)}pauseGameUI(){var e;null===(e=this.gameCenterMessageService)||void 0===e||e.pauseGameUI()}resumeGameUI(){var e;null===(e=this.gameCenterMessageService)||void 0===e||e.resumeGameUI()}confirmSharingComplete({shareId:e,isSuccess:t}){var r;null===(r=this.gameCenterMessageService)||void 0===r||r.shareComplete(e,t)}notifyGameCanBeStarted(){var e;null===(e=this.gameCenterMessageService)||void 0===e||e.notifyGameCanBeStarted()}destroy(){var t;null===(t=this.gameCenterMessageService)||void 0===t||t.destroy(),document.removeEventListener("visibilitychange",this.handleVisibilityChange),ar.off(`${e.name}.openGame`,this.handleOpenGameCenterEvent),this.storyManager.deleteViewModel(e.name)}launchGameById(e){return Ia(this,void 0,void 0,(function*(){try{this._gameLaunchError=null,this._isGameLoading=!0,this._gameLaunch=yield Ma({gameInstanceId:e,gameOptions:this.openGameOptions})}catch(e){this._gameLaunchError=e}}))}initGameCenter(e,t){var r;this.handleGameCenterEvents(e);const i=this.getGameConfig(t);null===(r=this.gameCenterMessageService)||void 0===r||r.initGame(i)}getGameConfig(e){const t=e.screenOptions;return ye()(e.config,{clientConfig:Object.assign({fullScreen:!1,screenOrientation:t.orientation,safeAreaInsets:this.safeAreaInsets,widescreen:this.isWidescreen,dir:this.dir,nonce:Xt(),sdkFeatures:{gameShouldForegroundCallback:!0}},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)).on("gameShouldForegroundCallback",this.handleGameShouldBeShown.bind(this));const t={share:new Et(e,this,this.desktopMode),storySetLocalData:new Tt,storyGetLocalData:new jt(e,this),gameInstanceGetLocalData:new Oe(e,this),gameInstanceSetLocalData:new Ct(e,this)};for(const[r,i]of Object.entries(t))e.on(r,((...e)=>i.handle(...e)))}handleGameShouldBeShown(e){this._gameShouldBeShown=!0;const t=JSON.parse(e);W()(t)&&(this._closeBtnVisible=Boolean(t.showClose))}handleGameLoaded(){try{this.initGame(),this.startGame()}catch(e){console.error(e)}}initGame(){this._isGameInited=!0,this._isGameLoading=!1}completeGame(){this._isGameInited=!1,this._isOpened=!1,this._gameLaunch=null}startGame(){this.storyManager.emit("startGame",{id:this.gameInstanceId})}handleVisibilityChange(){"hidden"===document.visibilityState?this.pauseGameUI():"visible"===document.visibilityState&&this.resumeGameUI()}handleGameComplete(e,t,r,i,n){var s;this.completeGame(),null===(s=this.gameCenterMessageService)||void 0===s||s.destroy(),this.emitGameCompleteEventByStoryManager(e),(null==n?void 0:n.id)&&this.openGame(n.id,{}),(null==i?void 0:i.id)&&this.storyManager.showStory(i.id),Cr()}emitGameCompleteEventByStoryManager(e){xs()(e)?this.storyManager.emit("closeGame",{id:this.gameInstanceId}):this.storyManager.emit("finishGame",{id:this.gameInstanceId,result:e})}handleSendApiRequest(e){It.sendApiRequestPromise(e,((e,t)=>this.sendGameCenterEventByApiRequest(e,t)),St)}handleOpenUrl(e){const{url:t}=JSON.parse(e);this.storyManager.clickOnButtonAction({src:Gt.GAME_READER,payload:{url:t,gameInstanceId:this.gameInstanceId}})}handleGameEvent(e,t){this.storyManager.emit("gameEvent",{name:e,payload:t})}handleReloadGameReader(){const e=this._gameLaunch;this._gameLaunch=null,setTimeout((0,to.action)((()=>{this._gameLaunch=e})))}handleGameLoadFailed(e,t){this.gameLaunch&&t&&this.initGameRetryAttempts<this.gameLaunch.canTryReloadCount?(this.initGameRetryAttempts++,this.handleReloadGameReader()):this._gameLaunchError=new Error(e)}handleOpenGameCenterEvent(e){return Ia(this,arguments,void 0,(function*({gameId:e}){yield this.openGame(e,{}),Or()}))}},t=new WeakMap,r=new WeakMap,i=new WeakMap,n=new WeakMap,s=new WeakMap,o=new WeakMap,a=new WeakMap,l=new WeakMap,(()=>{var t;const r="function"==typeof Symbol&&Symbol.metadata?Object.create(null!==(t=R[Symbol.metadata])&&void 0!==t?t:null):void 0;d=[to.observable],c=[to.observable],u=[to.observable],h=[to.observable],p=[to.observable],f=[to.observable],g=[to.observable],v=[to.observable],m=[to.computed],y=[to.computed],b=[to.computed],w=[to.computed],S=[to.computed],_=[to.computed],x=[to.computed],O=[to.computed],C=[to.computed],k=[to.action],L=[to.action],A=[to.action],M=[to.action],E=[to.action],P=[to.action],j=[to.action],I=[to.action],T=[to.action],ja(e,null,d,{kind:"accessor",name:"_isOpened",static:!1,private:!1,access:{has:e=>"_isOpened"in e,get:e=>e._isOpened,set:(e,t)=>{e._isOpened=t}},metadata:r},B,N),ja(e,null,c,{kind:"accessor",name:"_isGameInited",static:!1,private:!1,access:{has:e=>"_isGameInited"in e,get:e=>e._isGameInited,set:(e,t)=>{e._isGameInited=t}},metadata:r},F,U),ja(e,null,u,{kind:"accessor",name:"_isGameLoading",static:!1,private:!1,access:{has:e=>"_isGameLoading"in e,get:e=>e._isGameLoading,set:(e,t)=>{e._isGameLoading=t}},metadata:r},V,z),ja(e,null,h,{kind:"accessor",name:"_gameInstanceId",static:!1,private:!1,access:{has:e=>"_gameInstanceId"in e,get:e=>e._gameInstanceId,set:(e,t)=>{e._gameInstanceId=t}},metadata:r},G,$),ja(e,null,p,{kind:"accessor",name:"_gameLaunch",static:!1,private:!1,access:{has:e=>"_gameLaunch"in e,get:e=>e._gameLaunch,set:(e,t)=>{e._gameLaunch=t}},metadata:r},H,q),ja(e,null,f,{kind:"accessor",name:"_gameLaunchError",static:!1,private:!1,access:{has:e=>"_gameLaunchError"in e,get:e=>e._gameLaunchError,set:(e,t)=>{e._gameLaunchError=t}},metadata:r},Q,K),ja(e,null,g,{kind:"accessor",name:"_closeBtnVisible",static:!1,private:!1,access:{has:e=>"_closeBtnVisible"in e,get:e=>e._closeBtnVisible,set:(e,t)=>{e._closeBtnVisible=t}},metadata:r},Y,Z),ja(e,null,v,{kind:"accessor",name:"_gameShouldBeShown",static:!1,private:!1,access:{has:e=>"_gameShouldBeShown"in e,get:e=>e._gameShouldBeShown,set:(e,t)=>{e._gameShouldBeShown=t}},metadata:r},X,J),ja(e,null,m,{kind:"getter",name:"closeBtnVisible",static:!1,private:!1,access:{has:e=>"closeBtnVisible"in e,get:e=>e.closeBtnVisible},metadata:r},null,D),ja(e,null,y,{kind:"getter",name:"isGameLoading",static:!1,private:!1,access:{has:e=>"isGameLoading"in e,get:e=>e.isGameLoading},metadata:r},null,D),ja(e,null,b,{kind:"getter",name:"isGameInited",static:!1,private:!1,access:{has:e=>"isGameInited"in e,get:e=>e.isGameInited},metadata:r},null,D),ja(e,null,w,{kind:"getter",name:"gameLaunchError",static:!1,private:!1,access:{has:e=>"gameLaunchError"in e,get:e=>e.gameLaunchError},metadata:r},null,D),ja(e,null,S,{kind:"getter",name:"gameLaunch",static:!1,private:!1,access:{has:e=>"gameLaunch"in e,get:e=>e.gameLaunch},metadata:r},null,D),ja(e,null,_,{kind:"getter",name:"gameInstanceId",static:!1,private:!1,access:{has:e=>"gameInstanceId"in e,get:e=>e.gameInstanceId},metadata:r},null,D),ja(e,null,x,{kind:"getter",name:"isOpened",static:!1,private:!1,access:{has:e=>"isOpened"in e,get:e=>e.isOpened},metadata:r},null,D),ja(e,null,O,{kind:"getter",name:"gameShouldBeShown",static:!1,private:!1,access:{has:e=>"gameShouldBeShown"in e,get:e=>e.gameShouldBeShown},metadata:r},null,D),ja(e,null,C,{kind:"getter",name:"isWidescreen",static:!1,private:!1,access:{has:e=>"isWidescreen"in e,get:e=>e.isWidescreen},metadata:r},null,D),ja(e,null,k,{kind:"method",name:"openGame",static:!1,private:!1,access:{has:e=>"openGame"in e,get:e=>e.openGame},metadata:r},null,D),ja(e,null,L,{kind:"method",name:"closeGame",static:!1,private:!1,access:{has:e=>"closeGame"in e,get:e=>e.closeGame},metadata:r},null,D),ja(e,null,A,{kind:"method",name:"reload",static:!1,private:!1,access:{has:e=>"reload"in e,get:e=>e.reload},metadata:r},null,D),ja(e,null,M,{kind:"method",name:"setDesktopMode",static:!1,private:!1,access:{has:e=>"setDesktopMode"in e,get:e=>e.setDesktopMode},metadata:r},null,D),ja(e,null,E,{kind:"method",name:"handleGameShouldBeShown",static:!1,private:!1,access:{has:e=>"handleGameShouldBeShown"in e,get:e=>e.handleGameShouldBeShown},metadata:r},null,D),ja(e,null,P,{kind:"method",name:"handleGameLoaded",static:!1,private:!1,access:{has:e=>"handleGameLoaded"in e,get:e=>e.handleGameLoaded},metadata:r},null,D),ja(e,null,j,{kind:"method",name:"handleGameComplete",static:!1,private:!1,access:{has:e=>"handleGameComplete"in e,get:e=>e.handleGameComplete},metadata:r},null,D),ja(e,null,I,{kind:"method",name:"handleReloadGameReader",static:!1,private:!1,access:{has:e=>"handleReloadGameReader"in e,get:e=>e.handleReloadGameReader},metadata:r},null,D),ja(e,null,T,{kind:"method",name:"handleGameLoadFailed",static:!1,private:!1,access:{has:e=>"handleGameLoadFailed"in e,get:e=>e.handleGameLoadFailed},metadata:r},null,D),r&&Object.defineProperty(e,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:r})})(),e})();class Ba{constructor(e){Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:e})}create(){return new Da(this.storyManager)}}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}}();function Na(){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:Fa.LANDSCAPE_PRIMARY,"-90":Fa.LANDSCAPE_SECONDARY,0:Fa.PORTRAIT_PRIMARY,180:Fa.PORTRAIT_SECONDARY};function t(){}var r=new t,i=function(e){for(var t=["orientationchange","mozorientationchange","msorientationchange"],r=window.screen,i=0;i<t.length;i++)if(null===r["on"+t[i]])return{delegate:r,event:t[i]};if(void 0!==window.onorientationchange)return{delegate:window,event:"orientationchange"};return{delegate:$a(e),event:"change"}}(r);return t.prototype.addEventListener=Ua("addEventListener",i.delegate,i.event),t.prototype.dispatchEvent=Ua("dispatchEvent",i.delegate,i.event),t.prototype.removeEventListener=Ua("removeEventListener",i.delegate,i.event),t.prototype.lock=function(){var e,t="lockOrientation() is not available on this device.",r=window.screen;e=void 0===r?function(){return!1}:"function"==typeof r.msLockOrientation?r.msLockOrientation.bind(r):"function"==typeof r.mozLockOrientation?r.mozLockOrientation.bind(r):function(){return!1};return function(r){const i=window.Promise;return e(r)?i.resolve(r):i.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(r,{onchange:{get:function(){return i.delegate["on"+i.event]||null},set:function(e){i.delegate["on"+i.event]=Ga(e,r)}},type:{get:function(){var t=window.screen;return t.msOrientation||t.mozOrientation||e[window.orientation+""]||(Ha().matches?"landscape-primary":"portrait-primary")}},angle:{value:0}}),r}(),e}}var Fa;function Ua(e,t,r){var i=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]=Wa(r,n[0]):n[0]=r;var s,o,a=Ga(n[1],i);return"addEventListener"===e&&function(e,t){var r=za.indexOf(e);r>-1?Va[r]=t:(za.push(e),Va.push(t))}(n[1],a),"removeEventListener"===e&&(s=n[1],(o=za.indexOf(s))>-1&&(za.splice(o,1),Va.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"}(Fa||(Fa={}));var Va=[],za=[];function Ga(e,t){var r=za.indexOf(e);return r>-1?Va[r]:function(r){r.target!==t&&qa(r,"target",t),r.currentTarget!==t&&qa(r,"currentTarget",t),"change"!==r.type&&qa(r,"type","change"),e(r)}}function Wa(e,t){var r;try{r=new Event(e,t)}catch(e){r={type:"change"}}return r}function $a(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 r=this.listeners[e].indexOf(t);r>-1&&this.listeners[e].splice(r,1)}}});t.listeners={};var r=Ha();return r&&"boolean"==typeof r.matches&&r.addListener((function(){t.dispatchEvent(Wa("change"))})),t}function Ha(){return"function"!=typeof window.matchMedia?{}:window.matchMedia("(orientation: landscape)")}function qa(e,t,r){Object.defineProperty(e,t,{value:r})}class Qa{constructor(){Object.defineProperty(this,"_storyLists",{enumerable:!0,configurable:!0,writable:!0,value:[]})}get storyLists(){return this._storyLists}addStoryList(e){this._storyLists.push(e)}updateStoryListById(e,t){const r=this._storyLists.findIndex((t=>t.mountSelector===e));this._storyLists[r]=Object.assign(Object.assign({},this._storyLists[r]),t)}removeStoryListById(e){const t=this._storyLists.findIndex((t=>t.mountSelector===e));this._storyLists.splice(t,1)}}class Ka extends Error{constructor(e){super(`Appearance Manager must be an object, but passed ${e.toUpperCase()}. Please check your code.`)}}const Ya=e=>{if(null==e||"object"!=typeof e)throw new Ka(null==e?"null":typeof e)};var Za=function(e,t,r,i){return new(r||(r=Promise))((function(n,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}l((i=i.apply(e,t||[])).next())}))};class Xa extends J.EventEmitter{constructor(e,t,r,i){super(),Object.defineProperty(this,"_mountSelector",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"_appearanceManager",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"params",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"app",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(this,"storyListManager",{enumerable:!0,configurable:!0,writable:!0,value:new Qa}),Object.defineProperty(this,"_ugcCardClickHandler",{enumerable:!0,configurable:!0,writable:!0,value:()=>{}}),Object.defineProperty(this,"_api",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Ya(t),this.storyListManager.addStoryList(this),this.app.setStoryList(this.storyListManager.storyLists)}get mountSelector(){return this._mountSelector}get appearanceManager(){return this._appearanceManager}get type(){return We.DEFAULT}get identityFields(){return{feedSlug:this.feedSlug}}get feedSlug(){return this.params.feed}get testKey(){return this.params.testKey}get useUgcCard(){return this.params.useUgcCard}set ugcCardClickHandler(e){this._ugcCardClickHandler=e}get ugcCardClickHandler(){return this._ugcCardClickHandler}set api(e){this._api=e}reload(){return Za(this,void 0,void 0,(function*(){var e;return null===(e=this._api)||void 0===e?void 0:e.reload()}))}destroy(){this.storyListManager.removeStoryListById(this.mountSelector),this.app.setStoryList(this.storyListManager.storyLists)}}var Ja=function(e,t,r,i){return new(r||(r=Promise))((function(n,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}l((i=i.apply(e,t||[])).next())}))};class el extends J.EventEmitter{constructor(e,t,r,i){super(),Object.defineProperty(this,"_mountSelector",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"_appearanceManager",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"params",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"app",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(this,"storyListManager",{enumerable:!0,configurable:!0,writable:!0,value:new Qa}),Object.defineProperty(this,"_ugcCardClickHandler",{enumerable:!0,configurable:!0,writable:!0,value:()=>{}}),Object.defineProperty(this,"_api",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Ya(t),this.storyListManager.addStoryList(this),this.app.setUGCStoryList(this.storyListManager.storyLists)}get mountSelector(){return this._mountSelector}get appearanceManager(){return this._appearanceManager}get type(){return We.UGC}get identityFields(){return{feedSlug:this.feedSlug}}get feedSlug(){return Oa}get testKey(){return this.params.testKey}get useUgcCard(){return this.params.useUgcCard}set api(e){this._api=e}set ugcCardClickHandler(e){this._ugcCardClickHandler=e}get ugcCardClickHandler(){return this._ugcCardClickHandler}reload(){return Ja(this,void 0,void 0,(function*(){var e;return null===(e=this._api)||void 0===e?void 0:e.reload()}))}destroy(){this.storyListManager.removeStoryListById(this.mountSelector)}}var tl=f(1085);const rl=(e=>{var t={};return f.d(t,e),t})({createRoot:()=>o.createRoot});var il=f(1649);f(6704);window.__IAS__={storyManager:{sdkVersionName:La.sdkVersionName,on:La.on.bind(La),off:La.off.bind(La)}};const nl=(e=>{var t={};return f.d(t,e),t})({default:()=>a.default});var sl=f(2591),ol=f.n(sl),al=f(4289),ll={insert:"head",singleton:!1};ol()(al.A,ll);const dl=al.A.locals||{};var cl=f(7081),ul={insert:"head",singleton:!1};ol()(cl.A,ul);const hl=cl.A.locals||{},pl=({onClick:e,className:t})=>(0,tl.jsx)("div",{className:(0,nl.default)(hl.icon,t),onClick:e,children:(0,tl.jsx)("svg",{viewBox:"0 0 24 24",children:(0,tl.jsx)("path",{fill:"currentColor",d:"M17.65,6.35C16.2,4.9 14.21,4 12,4A8,8 0 0,0 4,12A8,8 0 0,0 12,20C15.73,20 18.84,17.45 19.73,14H17.65C16.83,16.33 14.61,18 12,18A6,6 0 0,1 6,12A6,6 0 0,1 12,6C13.66,6 15.14,6.69 16.22,7.78L13,11H20V4L17.65,6.35Z"})})});var fl=f(5669),gl={insert:"head",singleton:!1};ol()(fl.A,gl);const vl=fl.A.locals||{},ml=310/480,yl=({desktopMode:e,children:t,verticalPadding:r,style:i,isWidescreen:n,className:s})=>{const[o,a]=(0,il.useState)({width:"0px",height:"0px"});(0,il.useEffect)((()=>(l(),window.addEventListener("resize",l),()=>{window.removeEventListener("resize",l)})),[]);const l=()=>{const e=window.innerWidth,t=g(),r=e/window.innerHeight,i=c({aspectRatio:r,vh:t,vw:e}),n=d({aspectRatio:r,vh:t,vw:e});a({width:i,height:n})},d=({aspectRatio:e,vh:t,vw:r})=>{const i=p(e)||f();return e>ml&&!i?`${h({vh:t,vw:r})}px`:"100%"},c=({aspectRatio:e,vh:t,vw:r})=>e>ml&&!p(e)?`${u({aspectRatio:e,vh:t,vw:r})}px`:"auto",u=({aspectRatio:t,vh:r,vw:i})=>t>ml&&!e?i:Math.ceil(r*ml),h=({vh:t,vw:r})=>e?t:Math.ceil(r/ml),p=e=>e>ml&&e-ml<=.1,f=()=>{let e;return"matchMedia"in window&&void 0!==(e=window.matchMedia("(orientation: portrait)"))&&e.matches},g=()=>{let t=window.innerHeight;return e?(t-=r,t):t},v=n?{width:"100%",height:"100%"}:o;return(0,tl.jsx)("div",{className:(0,nl.default)(vl["aspect-ratio-box"],s,{[vl["aspect-ratio-box--centered"]]:!n}),style:Object.assign(Object.assign({},i),v),children:(0,tl.jsx)("div",{className:vl["aspect-ratio-box-inside"],children:t})})};var bl=f(5757),wl={insert:"head",singleton:!1};ol()(bl.A,wl);const Sl=bl.A.locals||{},_l=Na(),xl=e=>{const[t,r]=(0,il.useState)(!1),i=(0,il.useCallback)((()=>{if(e.desktopMode)return;const t=_l.type!==e.orientation;e.onOrientationChange({type:_l.type,isWrong:t}),r(t)}),[e.desktopMode,e.orientation]);return(0,il.useEffect)((()=>(i(),_l.addEventListener("change",i),()=>{_l.removeEventListener("change",i)})),[i]),t?(0,tl.jsx)("div",{className:Sl["screen-orientation-lock"]}):null};var Ol=f(8778),Cl={insert:"head",singleton:!1};ol()(Ol.A,Cl);const kl=Ol.A.locals||{};var Ll=f(1196),Al={insert:"head",singleton:!1};ol()(Ll.A,Al);const Ml=Ll.A.locals||{};let El;function Pl(){let e,t;/ipad|iphone/i.test(navigator.userAgent)?(e=document.createRange(),El&&e.selectNodeContents(El),t=window.getSelection(),t&&(t.removeAllRanges(),t.addRange(e)),El&&El.setSelectionRange(0,999999)):null==El||El.select()}const jl=e=>{!function(e){El=document.createElement("textarea"),El.value=e,document.body.appendChild(El)}(e),Pl(),document.execCommand("copy"),El&&document.body.removeChild(El)},Il=({shareText:e,shareLink:t,sharePanelOptions:r,onShareComplete:i})=>{var n,s,o,a,l,d,c,u,h,p,f;const[g,v]=(0,il.useState)(!1),[m,y]=(0,il.useState)(!1),b=()=>{y(!0),!g&&e||i()};return(0,tl.jsxs)("div",{className:`${kl["share-panel__body"]} ${Ml["share-panel__body_screenshot"]}`,children:[(0,tl.jsx)("div",{className:`${kl["share-panel-row"]} ${Ml["share-panel-row"]}`,children:(0,tl.jsx)("a",{className:Ml["share-panel-row__image-link"],onClick:b,href:t,download:"image.jpeg",children:(0,tl.jsx)("img",{src:t,className:Ml["share-panel-row__image"]})})}),(0,tl.jsx)("div",{className:kl["share-panel-separator"],style:{background:null===(n=r.divider)||void 0===n?void 0:n.background}}),(0,tl.jsx)("div",{className:`${kl["share-panel-row"]} ${Ml["share-panel-row"]}`,children:(0,tl.jsx)("a",{className:Ml["share-item__download-button"],onClick:b,href:t,download:"image.jpeg",children:(0,tl.jsx)("div",{dangerouslySetInnerHTML:{__html:null!==(a=null===(o=null===(s=r.downloadButton)||void 0===s?void 0:s.svgSrc)||void 0===o?void 0:o.baseState)&&void 0!==a?a:""}})})}),e?(0,tl.jsxs)(tl.Fragment,{children:[(0,tl.jsx)("div",{className:kl["share-panel-separator"],style:{background:null===(l=r.divider)||void 0===l?void 0:l.background}}),(0,tl.jsx)("div",{className:`${kl["share-panel-row"]} ${Ml["share-panel-row"]}`,children:(0,tl.jsxs)("button",{className:(0,nl.default)(Ml.btn,Ml["btn-copy"]),onClick:()=>{jl(null!=e?e:""),v(!0),m&&i()},children:[(0,tl.jsxs)("div",{className:Ml["btn-copy__icon"],children:[(0,tl.jsx)("span",{className:(0,nl.default)(Ml["btn-copy__icon-state"],{[Ml["btn-copy__icon-state_default"]]:!g}),dangerouslySetInnerHTML:{__html:null!==(u=null===(c=null===(d=r.copyButton)||void 0===d?void 0:d.svgSrc)||void 0===c?void 0:c.baseState)&&void 0!==u?u:""}}),(0,tl.jsx)("span",{className:(0,nl.default)(Ml["btn-copy__icon-state"],{[Ml["btn-copy__icon-state_done"]]:g}),dangerouslySetInnerHTML:{__html:null!==(f=null===(p=null===(h=r.copyButton)||void 0===h?void 0:h.svgSrc)||void 0===p?void 0:p.doneState)&&void 0!==f?f:""}})]}),(0,tl.jsx)("div",{className:Ml["btn-copy__text"],children:e})]})})]}):null]})};var Tl=f(610),Rl={insert:"head",singleton:!1};ol()(Tl.A,Rl);const Dl=Tl.A.locals||{};var Bl=function(e,t){var r={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(r[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(i=Object.getOwnPropertySymbols(e);n<i.length;n++)t.indexOf(i[n])<0&&Object.prototype.propertyIsEnumerable.call(e,i[n])&&(r[i[n]]=e[i[n]])}return r};const Nl=e=>{var t,r,i,n,s,o,a,l,d,c,u,{shareLink:h,sharePanelOptions:p,onShareComplete:f}=e,g=Bl(e,["shareLink","sharePanelOptions","onShareComplete"]);const v=()=>{try{return new URL(h).host}catch(e){return console.error(e),null}},m=()=>{window.removeEventListener("focus",m),f()},y=()=>v()?"":encodeURIComponent(h),b=e=>{var t,r;const i=(()=>{try{return new URL(h)}catch(e){return console.error(e),null}})();if(!i)return"#";const n=null===(t=p.targetParams)||void 0===t?void 0:t[e];return null===(r=null==n?void 0:n.getUrl)||void 0===r?void 0:r.call(n,{url:i.toString(),text:y()})},w=null===(t=p.title)||void 0===t?void 0:t.favicon,S=p.text;return(0,tl.jsxs)("div",{className:kl["share-panel__body"],children:[(0,tl.jsxs)("div",{className:`${kl["share-panel-row"]} ${kl["title-row"]}`,children:[v()&&Boolean(null==w?void 0:w.display)&&(0,tl.jsx)("div",{className:kl["share-url-favicon"],style:{background:null==w?void 0:w.background},children:(0,tl.jsx)("img",{src:`${null!==(r=g.faviconApiUrl)&&void 0!==r?r:"https://favicon.inappstory.ru"}?sz=64&domain_url=${v()}`})}),(0,tl.jsx)("span",{className:kl.title,style:S,children:null===(n=null===(i=p.title)||void 0===i?void 0:i.getValue)||void 0===n?void 0:n.call(i,{url:h,text:y()})})]}),(0,tl.jsx)("div",{className:kl["share-panel-separator"],style:{background:null===(s=p.divider)||void 0===s?void 0:s.background}}),(0,tl.jsx)("div",{className:`${kl["share-panel-row"]} ${Dl["social-list"]}`,children:null===(o=p.targets)||void 0===o?void 0:o.map(((e,t)=>{var r,i,n;const s=null===(r=p.targetParams)||void 0===r?void 0:r[e],o=null!==(n=null===(i=null==s?void 0:s.icon)||void 0===i?void 0:i.svgSrc.baseState)&&void 0!==n?n:"<svg></svg>";return(0,tl.jsx)("div",{className:Dl["social-list__item"],children:(0,tl.jsxs)("a",{href:b(e),onClick:()=>((e,t,r)=>{window.addEventListener("focus",m),window.open(e,t,r)})(b(e),"newwindow","width=650,height=570"),target:"_blank",rel:"noopener noreferrer",className:`${kl["share-item"]} ${Dl["share-item"]}`,children:[(0,tl.jsx)("div",{dangerouslySetInnerHTML:{__html:o}}),(0,tl.jsx)("span",{className:kl["share-item-title"],style:S,children:null==s?void 0:s.label})]})},t)}))}),(0,tl.jsx)("div",{className:kl["share-panel-separator"],style:{background:null===(a=p.divider)||void 0===a?void 0:a.background}}),(0,tl.jsx)("div",{className:kl["share-panel-row"],children:(0,tl.jsxs)("a",{className:`${kl["share-item"]} ${Dl["share-item"]}`,onClick:()=>{jl(h),f()},children:[(0,tl.jsx)("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:""}}),(0,tl.jsx)("span",{className:kl["share-item-title"],style:S,children:null===(u=p.copyButton)||void 0===u?void 0:u.label})]})})]})};var Fl;!function(e){e.Social="social",e.SlideScreenshot="slide-screenshot"}(Fl||(Fl={}));const Ul=({shareType:e,shareLink:t,shareText:r,onShareCompelete:i,sharePanelOptions:n,className:s})=>{const{dir:o}=kh(),[a,l]=(0,il.useState)(!1),[d,c]=(0,il.useState)(!0),u=()=>{l(!0),c(!1)};return(0,tl.jsxs)("div",{dir:o,className:(0,nl.default)(kl["share-panel-wrapper"],s),onClick:e=>{e.stopPropagation()},onTouchStart:e=>{e.stopPropagation(),e.preventDefault()},children:[(0,tl.jsx)("div",{className:(0,nl.default)(kl["share-panel-backdrop"],{[kl.fadeIn]:d,[kl.fadeOut]:!d}),onClick:()=>{l(!1),c(!1)}}),(0,tl.jsxs)("div",{className:(0,nl.default)(kl["share-panel"],{[kl.slideIn]:d,[kl.slideOut]:!d}),onAnimationEnd:()=>{d||i(a)},style:{"--height":"100%",background:n.background,borderTopLeftRadius:n.borderRadius+"px",borderTopRightRadius:n.borderRadius+"px"},children:[e===Fl.SlideScreenshot&&(0,tl.jsx)(Il,{shareText:r,shareLink:t,onShareComplete:u,sharePanelOptions:n}),e===Fl.Social&&(0,tl.jsx)(Nl,{shareLink:t,onShareComplete:u,sharePanelOptions:n}),(0,tl.jsx)("div",{className:kl["share-panel-separator"]})]})]})};var Vl=f(7495),zl={insert:"head",singleton:!1};ol()(Vl.A,zl);const Gl=Vl.A.locals||{},Wl=e=>{const t=(0,il.useRef)(null),[r,i]=(0,il.useState)(null);return(0,il.useEffect)((()=>{const r=e.plugin.createLottiePlayer(t.current,e.config);return i(r),()=>{r.destroy()}}),[e.config.sha1]),(0,il.useEffect)((()=>{r&&e.forceEnd&&r.stop()}),[r,e.forceEnd]),(0,il.useEffect)((()=>{if(r)return r.on("play",e.onPlay),r.on("complete",e.onComplete),r.on("beforeLoad",e.onBeforeLoad),r.on("load",e.onLoad),r.on("minPlayingTimeExpired",e.onMinPlayingTimeExpired),r.on("error",e.onError),()=>{r.off("play",e.onPlay),r.off("complete",e.onComplete),r.off("beforeLoad",e.onBeforeLoad),r.off("load",e.onLoad),r.off("minPlayingTimeExpired",e.onMinPlayingTimeExpired),r.off("error",e.onError)}}),[r,e.onError,e.onPlay,e.onComplete,e.onLoad,e.onBeforeLoad,e.onMinPlayingTimeExpired]),(0,tl.jsx)("canvas",{ref:t,style:{width:"100%",height:"100%"}})},$l=e=>{var t,r,i;const{storyManager:n}=kh(),[s,o]=(0,il.useState)(!1),[a,l]=(0,il.useState)(!1),[d,c]=(0,il.useState)(!1),[u,h]=(0,il.useState)(!1),[p,f]=(0,il.useState)(!1),[g,v]=(0,il.useState)(!1),m=a||u||e.isGameLoading||!e.gameShouldBeShown,y=(0,il.useMemo)((()=>n.getPlugin("dot-lottie")),[n]),b=d||!y||e.isGameLoadingError?null:(null===(r=null===(t=e.game)||void 0===t?void 0:t.splashLottieScreen)||void 0===r?void 0:r.url)&&(null===(i=e.game)||void 0===i?void 0:i.splashLottieScreen),w=e.game&&!e.isGameLoadingError&&m&&!a&&!b,S=()=>{var t,r,i,n;return e.desktopMode&&(null===(r=null===(t=e.game)||void 0===t?void 0:t.splashLandscapeScreen)||void 0===r?void 0:r.url)?e.game.splashLandscapeScreen.url:null===(n=null===(i=e.game)||void 0===i?void 0:i.splashScreen)||void 0===n?void 0:n.url},_=e.isGameInited&&(!b||p);(0,il.useEffect)((()=>{_&&e.onSplashCanBeHidden()}),[_]);return(0,tl.jsxs)("div",{className:(0,nl.default)(Gl["splash-container"],{[Gl["splash-container--fadeIn"]]:e.game,[Gl["splash-container--fadeOut"]]:e.gameShouldBeShown,[Gl["splash-container--isLoading"]]:w}),children:[(0,tl.jsx)("div",{className:Gl["splash-container__image"],style:{backgroundColor:e.splashImageBackgroundColor},children:S()&&(0,tl.jsx)("img",{src:S(),onLoad:()=>{v(!0)}})}),b&&y&&(0,tl.jsx)("div",{className:Gl["splash-container__lottie"],children:(0,tl.jsx)(Wl,{plugin:y,forceEnd:e.gameShouldBeShown,config:b,onError:()=>{c(!0)},onPlay:()=>{l(!0),o(!1)},onComplete:()=>{l(!1),o(!0)},onLoad:()=>{h(!1)},onBeforeLoad:()=>{h(!0)},onMinPlayingTimeExpired:()=>{f(!0)}})})]})};var Hl=f(9843),ql={insert:"head",singleton:!1};ol()(Hl.A,ql);const Ql=Hl.A.locals||{},Kl=e=>{var t,r;return(0,tl.jsx)("button",{dir:e.dir,onClick:e.onCloseGame,className:Ql["close-btn"],"data-position":e.closeButtonPosition,dangerouslySetInnerHTML:{__html:null!==(r=null===(t=e.closeButtonOptions)||void 0===t?void 0:t.svgSrc.baseState)&&void 0!==r?r:""}})};const Yl=(e=>{var t={};return f.d(t,e),t})({observer:()=>l.observer});const Zl=(e=>{var t={};return f.d(t,e),t})({createPortal:()=>d.createPortal}),Xl=(0,Yl.observer)((({gameReaderViewModel:e})=>{var t,r,i,n,s,o,a,l;const{desktopMode:d,dir:c,gameReaderOptions:u,storyReaderOptions:h}=kh(),p=(0,il.useRef)(null),{sharePanelOpeningParams:f,handleShareComplete:g,closeSharePanel:v}=(e=>{const[t,r]=(0,il.useState)(null);return(0,il.useEffect)((()=>(null==e||e.on("openSharePanel",r),()=>{null==e||e.off("openSharePanel",r)})),[e]),{sharePanelOpeningParams:t,handleShareComplete:i=>{t&&e&&(e.confirmSharingComplete({shareId:t.shareId,isSuccess:i}),r(null))},closeSharePanel:()=>{r(null)}}})(e);Eh((()=>{m()}));const m=()=>{e.closeGame(),v()},{gameLaunch:y,gameLaunchError:b,isGameLoading:w,closeBtnVisible:S}=e,_=(0,nl.default)(dl["game-reader"],{[dl["game-reader--desktop-mode"]]:d,[dl["game-reader--widescreen"]]:e.isWidescreen}),x={background:null!==(r=null===(t=u.backdrop)||void 0===t?void 0:t.background)&&void 0!==r?r:"",opacity:null!==(n=null===(i=u.backdrop)||void 0===i?void 0:i.opacity)&&void 0!==n?n:0,filter:(null===(s=u.backdrop)||void 0===s?void 0:s.blur)?`blur(${u.backdrop.blur}px)`:"none"},O=null!==(a=null===(o=u.game)||void 0===o?void 0:o.backdropColor)&&void 0!==a?a:"";return(0,Zl.createPortal)((0,tl.jsx)("div",{className:dl["game-reader-container"],style:{"--game-box-border-radius":`${parseFloat(String(u.borderRadius))}px`},children:(0,tl.jsxs)("div",{className:_,children:[(0,tl.jsx)("div",{className:dl["game-reader__backdrop"],style:x}),(0,tl.jsxs)(yl,{className:dl["game-reader__game-box"],isWidescreen:e.isWidescreen,desktopMode:d,verticalPadding:100,children:[(0,tl.jsx)($l,{onSplashCanBeHidden:()=>{e.notifyGameCanBeStarted()},desktopMode:d,isGameInited:e.isGameInited,isGameLoading:w,isGameLoadingError:Boolean(e.gameLaunchError),gameShouldBeShown:e.gameShouldBeShown,game:null!==(l=e.gameLaunch)&&void 0!==l?l:void 0,splashImageBackgroundColor:e.gameLaunch?O:x.background}),b&&(0,tl.jsx)(pl,{className:dl["game-reader__refresh-btn"],onClick:()=>{e.reload()}}),(!e.gameShouldBeShown||S)&&(0,tl.jsx)(Kl,{closeButtonPosition:u.closeButtonPosition,dir:c,onCloseGame:m,closeButtonOptions:u.closeButton}),y&&(0,tl.jsxs)(tl.Fragment,{children:[(0,tl.jsx)("iframe",{src:y.url,onLoad:t=>{p.current=t.target,e.dir=c,e.setGameCenterIframe(p.current)},style:{opacity:e.gameShouldBeShown?1:0},frameBorder:"0",className:dl["game-reader__iframe"],sandbox:"allow-same-origin allow-top-navigation allow-forms allow-scripts allow-downloads allow-top-navigation-to-custom-protocols",allow:"fullscreen"}),f&&(0,tl.jsx)(Ul,{shareType:f.shareType,shareLink:f.shareLink,onShareCompelete:g,sharePanelOptions:h.sharePanel})]})]}),y&&u.forceCheckOrientation&&(0,tl.jsx)(xl,{orientation:Fa.PORTRAIT_PRIMARY,desktopMode:d,onOrientationChange:({isWrong:t})=>{e.isGameInited&&(t?e.pauseGameUI():e.resumeGameUI())}})]})}),document.body)}));var Jl=f(2130),ed={insert:"head",singleton:!1};ol()(Jl.A,ed);const td=Jl.A.locals||{};class rd{constructor(e,t,r){Object.defineProperty(this,"storyReaderViewModel",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"storiesViewer",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"backdropRef",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"deltaValY",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"windowHeight",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"swipeUpGestureInAction",{enumerable:!0,configurable:!0,writable:!0,value:!1})}get closeGestureInAction(){return ur.getState()}startMove(){gr(),this.windowHeight=this.storiesViewer.clientHeight,this.storiesViewer.style.setProperty("transition","")}move(e){e>10||this.closeGestureInAction?(fr(),this.moveDownAndScaleReader(e)):(e<-10||this.swipeUpGestureInAction)&&this.moveUp(e)}endMove(){Sr(),this.deltaValY>=0?this.handleSwipeDown():this.handleSwipeUp(),gr()}moveDownAndScaleReader(e){this.deltaValY=e/this.windowHeight;let t=1-(1-.9)*this.deltaValY;t>=1&&(t=1);let r=100*this.deltaValY*.45;r<=0&&(r=0),this.storiesViewer.style.setProperty("transform",`scale(${t}) translateY(${r}%)`)}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(){ar.emit("swipeController.swipeUp")}}Na();const id=()=>{const e=window.innerWidth;return{vh:window.innerHeight,vw:e}};function nd(e,t){e.forEach(t)}function sd(e,t,r){if(!e)throw Error(`${r?r+": ":""}${t}`)}function od({node:e=[],from:t,source:r,parent:i=t||r,to:n,target:s,child:o=n||s,scope:a={},meta:l={},family:d={type:"regular"},regional:c}={}){const u=Id(i),h=Id(d.links),p=Id(d.owners),f=[];nd(e,(e=>e&&Ld(f,e)));const g={id:Ed(),seq:f,next:Id(o),meta:l,scope:a,family:{type:d.type||"crosslink",links:h,owners:p}};return nd(h,(e=>Ld(hd(e),g))),nd(p,(e=>Ld(pd(e),g))),nd(u,(e=>Ld(e.next,g))),c&&Pd&&jd(fd(Pd),[g]),g}function ad(e){const t=()=>e();return t.unsubscribe=()=>e(),t}function ld(e,{scope:t,safe:r}={}){sd(t||Wd||r,"scopeBind: scope not found");const i=t||Wd;return t=>{function r(){$d(o)}let n,s=0;const o=Wd;$d(i);try{n=e(t)}catch(e){n=e,s=1}if(r(),s)throw n;return n instanceof Promise&&n.then(r,r),n}}function dd({unit:e,fn:t,scope:r,batch:i}){const n=[Vd.run({fn:e=>t(e)})];i&&n.unshift(Vd.compute({priority:"sampler",batch:1})),bd(e)&&n.unshift(Vd.mov({store:e.stateRef,to:"stack"}));const s=Array.isArray(e)?e:[e];if(r){const e=[],t=r.additionalLinks;return s.forEach((r=>{const i=t[r.graphite.id]||[];t[r.graphite.id]=i;const s=od({node:cd(n,r),meta:{watchOp:r.kind}});i.push(s),e.push((()=>{const e=i.indexOf(s);-1!==e&&i.splice(e,1),Kd(s)}))})),ad((()=>{e.forEach((e=>e()))}))}{const e=od({node:n,parent:s,family:{owners:s}});return ad((()=>{Kd(e)}))}}function cd(e,t){return bd(t)?[Vd.mov({store:t.stateRef,to:"stack"}),...e]:e}"undefined"!=typeof Symbol&&Symbol.observable;const ud=e=>e.graphite||e,hd=e=>e.family.owners,pd=e=>e.family.links,fd=e=>e.value,gd=e=>e.subscribers,vd=(e,t)=>ud(e).meta[t],md=e=>(Rd(e)||Td(e))&&"kind"in e,yd=e=>t=>md(t)&&t.kind===e,bd=yd("store"),wd=yd("event"),Sd=yd("effect"),_d=e=>md(e)&&!!e.targetable,xd=yd("domain"),Od=yd("scope");var Cd={__proto__:null,unit:md,store:bd,event:wd,effect:Sd,targetable:_d,domain:xd,scope:Od,attached:e=>Sd(e)&&1==vd(e,"attached")};const kd=(e,t)=>{const r=e.indexOf(t);-1!==r&&e.splice(r,1)},Ld=(e,t)=>e.push(t),Ad=()=>{let e=0;return()=>""+ ++e},Md=(Ad(),Ad()),Ed=Ad();Ad();let Pd=null;const jd=(e,t)=>{const r=ud(e);nd(t,(e=>{const t=ud(e);"domain"!==r.family.type&&(t.family.type="crosslink"),Ld(hd(t),r),Ld(pd(r),t)}))},Id=(e=[])=>(Array.isArray(e)?e:[e]).flat().map(ud),Td=e=>"object"==typeof e&&null!==e,Rd=e=>"function"==typeof e,Dd=(e,t,r,i)=>{const n={id:Md(),type:e,data:t};return r&&(n.order={priority:r},i&&(n.order.barrierID=++Bd)),n};let Bd=0;const Nd=({from:e="store",store:t,target:r,to:i=(r?"store":"stack"),batch:n,priority:s})=>Dd("mov",{from:e,store:t,to:i,target:r},s,n),Fd=({fn:e,batch:t,priority:r,safe:i=0,filter:n=0,pure:s=0})=>Dd("compute",{fn:e,safe:i,filter:n,pure:s},r,t),Ud=({fn:e})=>Fd({fn:e,priority:"effect"}),Vd={mov:Nd,compute:Fd,filter:({fn:e,pure:t})=>Fd({fn:e,filter:1,pure:t}),run:Ud};const zd=[];let Gd=0;for(;Gd<6;)Ld(zd,{first:null,last:null,size:0}),Gd+=1;new Set;let Wd;const $d=e=>{Wd=e};const Hd=(e,t)=>{kd(e.next,t),kd(hd(e),t),kd(pd(e),t)},qd=(e,t,r)=>{let i;e.next.length=0,e.seq.length=0,e.scope=null;let n=pd(e);for(;i=n.pop();)Hd(i,e),(t||r&&"sample"!==e.meta.op||"crosslink"===i.family.type)&&qd(i,t,"on"!==i.meta.op&&r);for(n=hd(e);i=n.pop();)Hd(i,e),r&&"crosslink"===i.family.type&&qd(i,t,"on"!==i.meta.op&&r)},Qd=e=>e.clear(),Kd=(e,{deep:t}={})=>{let r=0;if(e.ownerSet&&e.ownerSet.delete(e),bd(e))Qd(gd(e));else if(xd(e)){r=1;const t=e.history;Qd(t.events),Qd(t.effects),Qd(t.stores),Qd(t.domains)}qd(ud(e),!!t,r)};od({node:[Ud({fn:({fn:e,value:t})=>e(t)})],meta:{op:"fx",fx:"sidechain"}});var Yd=f(7121),Zd=f(8139);function Xd(e,t){const r=Cd.unit(e);let i={};r?i={unit:e}:"@@unitShape"in e?"function"==typeof e["@@unitShape"]?i=e["@@unitShape"]():tc("expect @@unitShape to be a function"):i=e;const n=Array.isArray(i),s=il.default.useRef({stale:1,justSubscribed:0,scope:t}),[o,a,l,d,c]=il.default.useMemo((()=>{s.current.stale=1;const e=Array.isArray(i)?[]:{},n=[],o=[],a=[],l=[];for(const s in i){if(!{}.hasOwnProperty.call(i,s))continue;const d=i[s];Cd.unit(d)||tc(`expect useUnit ${r?"argument":`value in key "${s}"`} to be a unit`),Cd.event(d)||Cd.effect(d)?(e[s]=t?ld(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(i),...Object.values(i)]),u=il.default.useRef({value:o,storeKeys:a,eventKeys:d,eventValues:c}),h=il.default.useCallback((e=>{const r=s.current;return r.justSubscribed=1,dd({unit:l,fn:()=>{r.stale||(r.stale=1,e())},scope:t,batch:1})}),[l,t,u,s]),p=il.default.useCallback((()=>{const e=u.current,i=s.current;let h,p=0;const f=e.value,g=e.storeKeys,v=e.eventKeys,m=e.eventValues,y=t!==i.scope;if(i.stale||i.justSubscribed||y){p=!i.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 r=nc(l[e],t),i=a[e];p||(p=g.includes(i)?f[i]!==r:1),h[i]=r}for(let e=0;e<d.length;e++){const t=c[e],r=d[e];p||(p=v.includes(r)?m[v.indexOf(r)]!==t:1)}}return p&&(e.value=h),e.storeKeys=a,e.eventKeys=d,e.eventValues=c,i.stale=0,i.justSubscribed=!p,i.scope=t,r?e.value.unit:e.value}),[h,l,c,t,u,s]);return rc(h,p,p)}function Jd(e){const t=il.default.useContext(sc);return e&&!t&&tc("No scope found, consider adding <Provider> to app root"),t}function ec(e,t){return Xd(e,Jd(null==t?void 0:t.forceScope))}const tc=e=>{throw Error(e)},{useSyncExternalStore:rc}=("undefined"!=typeof window?il.default.useLayoutEffect:il.default.useEffect,Zd),{useSyncExternalStoreWithSelector:ic}=Yd,nc=(e,t)=>t?t.getState(e):e.getState(),sc=il.default.createContext(null),{Provider:oc}=sc,ac=Math.tan(.375*Math.PI),lc=!!Bn()&&{passive:!0};class dc extends J.EventEmitter{constructor(){super(),Object.defineProperty(this,"startValX",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"startValY",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"globalHorizontalSwipeGesture",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"globalVerticalSwipeGesture",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"enabled",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"touchGestureTimerId",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"touchGestureRegistered",{enumerable:!0,configurable:!0,writable:!0,value:!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,lc)}enable(){this.enabled=!0}disable(){this.enabled=!1}handleMouseDown(e){this.enabled&&hr.getState()&&(this.pauseMouseDownTimer(),this.initStartPoint(e),this.globalHorizontalSwipeGesture=!1,this.globalVerticalSwipeGesture=!1,ar.emit("swipeController.startMove"),this.registerMoveAndUpEvents())}pauseMouseDownTimer(){this.touchGestureTimerId=setTimeout((()=>{wr(),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){const t=e.pageX||e.touches&&e.touches[0].pageX,r=e.pageY||e.touches&&e.touches[0].pageY,i=t-this.startValX,n=r-this.startValY,s=Math.abs(i/n);let o=!1,a=!1,l=!1;Math.abs(i)>0||Math.abs(n)>0?(o=!0,s<=ac&&(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,lc),window.removeEventListener("mouseup",this.handleMouseUp),window.removeEventListener("touchend",this.handleMouseUp),ar.emit("swipeController.beforeEndMove"),this.touchGestureRegistered=!1,this.globalHorizontalSwipeGesture||this.globalVerticalSwipeGesture?this.globalVerticalSwipeGesture?this.completeVerticalSwipe():this.completeHorizontalSwipe():Sr()}moveVertical(e){this.globalVerticalSwipeGesture=!0,ar.emit("swipeController.move",{startY:this.startValY,startX:this.startValX,y:e,x:0,lockY:!1,lockX:!0})}moveHorizontal(e){this.globalHorizontalSwipeGesture=!0,ar.emit("swipeController.move",{startY:this.startValY,startX:this.startValX,y:0,x:e,lockY:!0,lockX:!1})}completeVerticalSwipe(){ar.emit("swipeController.endMove",{lockY:!1,lockX:!0}),this.globalVerticalSwipeGesture=!1}completeHorizontalSwipe(){ar.emit("swipeController.endMove",{lockY:!0,lockX:!1}),this.globalHorizontalSwipeGesture=!1}registerMoveAndUpEvents(){window.addEventListener("mousemove",this.handleMouseMove,!1),window.addEventListener("touchmove",this.handleMouseMove,lc),window.addEventListener("mouseup",this.handleMouseUp,!1),window.addEventListener("touchend",this.handleMouseUp,!1)}destroy(){window.removeEventListener("mousedown",this.handleMouseDown),window.removeEventListener("touchstart",this.handleMouseDown,lc)}}const cc=e=>50+parseFloat(String(e)),uc=(e,t)=>{const r=e.hasLike&&Boolean(t.hasLike),i=e.hasShare&&Boolean(t.hasShare),n=e.hasFavorite&&Boolean(t.hasFavorite),s=e.hasAudio;return!e.isBlank&&(r||n||i||s)},hc=e=>{const{desktopMode:t,storyReaderOptions:r}=kh();return(0,il.useMemo)((()=>{const i=cc(r.actionPanelBottomOffset),n=new qs(e.vw,e.vh,i),s=new Hs(n).create({vw:e.vw,vh:e.vh,desktopMode:t}),o=s instanceof $s,a=o?n.getViewportCorrectionPadding():{};return{actionPanelHeight:i,safeAreaFrameCalculator:n,storyGeometry:s,isMobileGeometry:o,correctionPaddingStyle:a}}),[r.actionPanelBottomOffset,e,t])},pc=(0,Yl.observer)((e=>{const t=(0,il.useRef)(null),r=(0,il.useRef)(null),{desktopMode:i,storyReaderOptions:n}=kh();(({storyReaderViewModel:e,storiesViewerRef:t,backdropRef:r})=>{const i=(0,il.useRef)(null);(0,il.useEffect)((()=>{i.current=new rd(e,t.current,r.current)}),[]);const n=()=>{var e;t.current.classList.add(td["no-select"]),null===(e=i.current)||void 0===e||e.startMove()},s=({y:e,lockX:t})=>{var r;t&&(null===(r=i.current)||void 0===r||r.move(e))},o=({lockX:e})=>{var t;e&&(null===(t=i.current)||void 0===t||t.endMove())},a=()=>{t.current.classList.remove(td["no-select"])};(0,il.useEffect)((()=>(ar.on("swipeController.startMove",n),ar.on("swipeController.move",s),ar.on("swipeController.endMove",o),ar.on("swipeController.beforeEndMove",a),()=>{ar.off("swipeController.startMove",n),ar.off("swipeController.move",s),ar.off("swipeController.endMove",o),ar.off("swipeController.beforeEndMove",a)})),[])})({storyReaderViewModel:e.storyReaderViewModel,backdropRef:t,storiesViewerRef:r});const{safeAreaFrameCalculator:s,isMobileGeometry:o}=hc(e.viewport),a=!o||s.shouldBeShownSafeAreaInsets?parseFloat(String(n.borderRadius)):0;return(0,tl.jsxs)(tl.Fragment,{children:[(0,tl.jsxs)("div",{ref:r,className:(0,nl.default)("stories-viewer",td["stories-viewer"],td.slider3d),style:Object.assign(Object.assign({},{"--loaderBackgroundColor":null===(l=n.loader)||void 0===l?void 0:l.default.color,"--loaderBackgroundAccentColor":null===(d=n.loader)||void 0===d?void 0:d.default.accentColor,"--timelineBlockTopOffset":`${parseFloat(String(n.timelineBlockTopOffset))}px`,"--slideBorderRadius":`${a}px`}),(()=>{var e,t,r,i;return{backgroundColor:null!==(t=null===(e=n.commonBackdrop)||void 0===e?void 0:e.color)&&void 0!==t?t:void 0,backdropFilter:null!==(i=null===(r=n.commonBackdrop)||void 0===r?void 0:r.backdropFilter)&&void 0!==i?i:void 0}})()),children:[i&&(0,tl.jsx)("div",{className:td["stories-viewer-background"],style:(()=>{var t,r,i;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===(r=n.slideBackdrop)||void 0===r?void 0:r.opacity)||0,filter:(null===(i=n.slideBackdrop)||void 0===i?void 0:i.blur)?`blur(${n.slideBackdrop.blur}px)`:"none"}})()}),e.children]}),(0,tl.jsx)("div",{ref:t,className:(0,nl.default)(td["stories-viewer-backdrop"],{[td._desktopMode]:i})})]});var l,d}));var fc=f(3390),gc={insert:"head",singleton:!1};ol()(fc.A,gc);const vc=fc.A.locals||{};var mc=f(2594),yc={insert:"head",singleton:!1};ol()(mc.A,yc);const bc=mc.A.locals||{};var wc=f(187),Sc={insert:"head",singleton:!1};ol()(wc.A,Sc);const _c=wc.A.locals||{},xc=(0,Yl.observer)((({story:e,commonOptions:t,storyReaderOptions:r})=>{const{dir:i}=kh(),n=ec(pr),s=e.hasLike&&Boolean(t.hasLike),o=e.hasShare&&Boolean(t.hasShare),a=e.hasFavorite&&Boolean(t.hasFavorite),l=e.hasAudio,d=uc(e,t)?cc(r.actionPanelBottomOffset):0;return(0,tl.jsx)("div",{dir:i,className:_c["stories-button-panel"],style:{height:`${d}px`,transform:`translateY(${d}px)`},children:uc(e,t)&&(0,tl.jsxs)("div",{className:_c["stories-button-panel-actions"],children:[(()=>{if(!s)return null;const t=0===e.like||-1===e.like,i=0===e.like||1===e.like;return(0,tl.jsxs)("span",{children:[(0,tl.jsx)("span",{className:(0,nl.default)(_c["button-panel-action"],{"like-up":t,"like-up-filled":1===e.like}),dangerouslySetInnerHTML:{__html:t?r.likeButton.svgSrc.baseState:r.likeButton.svgSrc.activeState},onClick:()=>{e.setLike(1===e.like?0:1)}}),(0,tl.jsx)("span",{className:(0,nl.default)(_c["button-panel-action"],{"like-down":i,"like-down-filled":-1===e.like}),dangerouslySetInnerHTML:{__html:i?r.dislikeButton.svgSrc.baseState:r.dislikeButton.svgSrc.activeState},onClick:()=>{e.setDislike(-1===e.like?0:-1)}})]})})(),a&&(0,tl.jsx)("span",{children:(0,tl.jsx)("span",{className:(0,nl.default)(_c["button-panel-action"],{bookmark:!e.favorite,"bookmark-filled":e.favorite}),dangerouslySetInnerHTML:{__html:e.favorite?r.favoriteButton.svgSrc.activeState:r.favoriteButton.svgSrc.baseState},onClick:()=>e.setBookmark(!e.favorite)})}),(0,tl.jsxs)("span",{className:_c["right-container"],children:[l&&(0,tl.jsx)("span",{children:(0,tl.jsx)("span",{className:(0,nl.default)(_c["button-panel-action"],{"muted-icon":n,"sound-icon":!n}),dangerouslySetInnerHTML:{__html:n?r.muteButton.svgSrc.baseState:r.muteButton.svgSrc.activeState},onClick:()=>{n?br():yr()}})}),o&&(0,tl.jsx)("span",{className:_c["button-panel-action"],dangerouslySetInnerHTML:{__html:r.shareButton.svgSrc.baseState},onClick:()=>{e.share()}})]})]})})}));var Oc=f(2349),Cc={insert:"head",singleton:!1};ol()(Oc.A,Cc);const kc=Oc.A.locals||{},Lc=e=>{var t,r;const{dir:i}=kh(),n=ec(dr);return(0,tl.jsx)("div",{className:kc["story-header"],children:!e.closeDisabled&&(0,tl.jsx)("button",{dir:i,"data-position":e.options.closeButtonPosition,className:(0,nl.default)(kc["stories-viewer__close"],{[kc["_paused-ui"]]:n}),onClick:t=>{t.stopPropagation(),t.preventDefault(),e.onClose()},dangerouslySetInnerHTML:{__html:null!==(r=null===(t=e.options.closeButton)||void 0===t?void 0:t.svgSrc.baseState)&&void 0!==r?r:""}})})};var Ac=f(3278),Mc={insert:"head",singleton:!1};ol()(Ac.A,Mc);const Ec=Ac.A.locals||{};var Pc=f(6323),jc={insert:"head",singleton:!1};ol()(Pc.A,jc);Pc.A.locals;const Ic=e=>{const t=e.slide;(0,il.useLayoutEffect)((()=>()=>{t.stop()}),[t]);const{slideContentRef:r}=(({slide:e,activeStory:t,currentStory:r,needSlideInitByFlipping:i,currentSlideIndex:n,slidesLoaded:s})=>{const o=(0,il.useRef)(null),[a,l]=ec([pr,cr]),d=t.id===r.id,c=d||i,u=0===n,h=1===n,p=c&&s&&e.state===Ks.None&&u,f=e.state===Ks.Started&&h||!c,g=d&&e.state===Ks.Loaded&&u;return(0,il.useLayoutEffect)((()=>{p&&e.init(o.current)}),[e,p]),(0,il.useLayoutEffect)((()=>{g&&e.start()}),[d,g]),(0,il.useLayoutEffect)((()=>{f&&e.stop()}),[f]),(0,il.useEffect)((()=>{l?e.pause():e.resume()}),[e,l,e.state]),(0,il.useEffect)((()=>{a?e.mute():e.unmute()}),[e,a,e.state]),{slideContentRef:o}})(e),i=t.state===Ks.Loading||!e.slidesLoaded,n=t.state===Ks.Loading||!e.slidesLoaded;return{slideContentRef:r,needLoadingMask:i,isVisible:t.state===Ks.Loaded||t.state===Ks.Started||t.state===Ks.Paused,needLoadingAnimation:n}},Tc=e=>{var t,r;kr(),Dr({text:e.text,link:null!==(t=e.url)&&void 0!==t?t:"",type:e.type,id:null!==(r=e.id)&&void 0!==r?r:""})};var Rc=function(e,t,r,i){return new(r||(r=Promise))((function(n,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}l((i=i.apply(e,t||[])).next())}))};const Dc=(e,t)=>Rc(void 0,void 0,void 0,(function*(){const r=Bc();if(!r)throw new Error;try{kr(),Gi({id:e}),yield r(t),Wi({result:!0})}catch(e){if(e instanceof DOMException&&"AbortError"===e.name)return;throw e}finally{Wi({result:!1})}})),Bc=()=>{var e,t;let r=null===(e=navigator.share)||void 0===e?void 0:e.bind(navigator);return!r&&(null===(t=window.parent)||void 0===t?void 0:t.navigator.share)&&(r=window.parent.navigator.share.bind(window.parent.navigator)),r};var Nc=function(e,t,r,i){return new(r||(r=Promise))((function(n,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}l((i=i.apply(e,t||[])).next())}))};const Fc=e=>Nc(void 0,[e],void 0,(function*({shareId:e,shareText:t,hideElementsSelector:r,slideContent:i,desktopMode:n}){let s=null;try{const o=yield Rn(In.IOS,i,function(e){let t="";return Array.prototype.slice.call(window.document.styleSheets).forEach((r=>{e(r)&&(t+=Array.prototype.slice.call(r.rules).map((e=>e.cssText)).join(""))})),t}((function(){return!0})),r),a={files:[o],text:t};if(s=URL.createObjectURL(o),n)return void Tc({type:At.SlideScreenshot,id:e,url:s,text:t});yield Dc(e,a)}catch(r){console.error(r),s&&Tc({type:At.SlideScreenshot,id:e,url:s,text:t})}}));var Uc=function(e,t,r,i){return new(r||(r=Promise))((function(n,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}l((i=i.apply(e,t||[])).next())}))};const Vc=e=>{const t={};for(const[r,i]of Object.entries(null!=e?e:{}))null!==i&&(t[r]=i);return t},zc=e=>{const t=({shareId:t,config:r})=>{var i;i={shareId:t,config:r,desktopMode:e.desktopMode},Uc(void 0,[i],void 0,(function*({shareId:e,config:t,desktopMode:r}){var i;null==e&&(e="story-share");const n=Vc(t),s=n.url=null!==(i=n.url)&&void 0!==i?i:n.text,o={type:At.Social,id:e,url:s};try{if(r)return void Tc(o);yield Dc(e,n)}catch(e){Tc(o)}}))},r=({shareId:t,hideElementsSelector:r,shareText:i})=>{const n=e.slideContentRef.current;Fc({shareId:t,hideElementsSelector:r,shareText:i,slideContent:n,desktopMode:e.desktopMode})};(0,il.useEffect)((()=>{if(e.activeStoryId===e.currentStoryId&&0===e.currentSlideIndex)return ar.on(ro.PerformShareAction,t),ar.on(ro.PerformScreenShotShareAction,r),()=>{ar.off(ro.PerformShareAction,t),ar.off(ro.PerformScreenShotShareAction,r)}}),[e.activeStoryId,e.currentStoryId,e.currentSlideIndex])};class Gc{constructor(e){let t;Object.defineProperty(this,"timeout_id",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"duration",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"content",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"position",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"getMountPoint",{enumerable:!0,configurable:!0,writable:!0,value:()=>document.body}),this.timeout_id=null,this.duration=3e3,this.content="",this.position="bottom",e&&"object"==typeof e&&(e.duration&&(this.duration="string"==typeof e.duration?parseFloat(e.duration):e.duration),e.content&&(this.content=e.content),e.getMountPoint&&(this.getMountPoint=e.getMountPoint),e.position&&(t=e.position.toLowerCase(),this.position="top"===t||"bottom"===t?t:"bottom"),this.show())}show(){var e;if(!this.content)return!1;this.timeout_id&&clearTimeout(this.timeout_id);const t=document.getElementById("toast_container");t&&(null===(e=t.parentNode)||void 0===e||e.removeChild(t));const r=document.createElement("div");r.setAttribute("id","toast_container"),r.setAttribute("class","toast_fadein");const i=document.createElement("div");i.setAttribute("id","toast"),r.appendChild(i);const n=document.createElement("span");return n.innerHTML=this.content,i.appendChild(n),this.getMountPoint().appendChild(r),this.timeout_id=window.setTimeout(this.hide,this.duration),!0}hide(){const e=document.getElementById("toast_container");if(!e)return!1;function t(){var e;const t=document.getElementById("toast_container");if(!t)return!1;null===(e=t.parentNode)||void 0===e||e.removeChild(t)}return this.timeout_id&&clearTimeout(this.timeout_id),e.className+=" toast_fadeout",e.addEventListener("webkitAnimationEnd",t),e.addEventListener("animationEnd",t),e.addEventListener("msAnimationEnd",t),e.addEventListener("oAnimationEnd",t),!0}}var Wc=function(e,t){var r={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(r[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(i=Object.getOwnPropertySymbols(e);n<i.length;n++)t.indexOf(i[n])<0&&Object.prototype.propertyIsEnumerable.call(e,i[n])&&(r[i[n]]=e[i[n]])}return r};const $c=(0,Yl.observer)((e=>{var{geometry:t}=e,r=Wc(e,["geometry"]);const{desktopMode:i}=kh(),{slideContentRef:n,needLoadingAnimation:s,needLoadingMask:o}=Ic(r),{slideStyle:a,slideContentStyle:l,needBottomPanel:d}=(({geometry:e,currentStory:t})=>{const{storyReaderOptions:r,commonOptions:i}=kh(),n=(0,il.useMemo)((()=>uc(t,i)),[t,i]),s=n?cc(r.actionPanelBottomOffset):0;return{needBottomPanel:n,slideStyle:(0,il.useMemo)((()=>({margin:e.getOffset(s),width:e.getWidth(),height:e.getHeight(),"--y-offset":e.getOffsetY(s),"--x-offset":e.getOffsetX(s)})),[s,e]),slideContentStyle:(0,il.useMemo)((()=>({fontSize:e.getFontSize()})),[e])}})({geometry:t,currentStory:r.currentStory});zc({slideContentRef:n,desktopMode:i,activeStoryId:r.activeStory.id,currentStoryId:r.currentStory.id,currentSlideIndex:r.currentSlideIndex}),(({slideContentRef:e,state:t})=>{const r=t=>{new Gc(Object.assign({getMountPoint:()=>e.current},t))};(0,il.useEffect)((()=>{if(t===Ks.Started)return ar.on(ro.ShowToast,r),()=>{ar.off(ro.ShowToast,r)}}),[t])})({slideContentRef:n,state:r.slide.state});const{handleSlideClick:c}=(({desktopMode:e,geometry:t,slide:r})=>{const{dir:i}=kh(),n=e=>["narrative-element-link","narrative-element-image","narrative-element-swipe-up"].some((t=>e.classList.contains(t))),s=(n,s)=>{const o=new Ui(r,s,t,i,e);for(const e of r.widgets)if(e.click({target:n,navigationController:o}),o.defaultPrevented)break;o.defaultPrevented||o.navigate()};return{handleSlideClick:e=>{const t=e.target;n(t)?Ys(r.story,t):s(t,e)}}})({activeStory:r.activeStory,desktopMode:i,geometry:t,slide:r.slide}),u=r.networkError||r.slide.state===Ks.Error;return(0,tl.jsxs)("div",{onClick:e=>{e.preventDefault(),e.stopPropagation(),r.clickDisabled||c(e)},className:`${Ec["stories-slide"]} ${Ec[`_position_${r.currentSlideIndex+1}`]} ${(0,nl.default)({[Ec["_with-bottom-panel"]]:d,[Ec["_desktop-mode"]]:t instanceof Ws})}`,children:[(0,tl.jsx)("div",{className:Ec["stories-slide-offset"],style:a,children:(0,tl.jsx)("div",{className:Ec["stories-slide-box"],"data-testid":"stories-slide-box",children:(0,tl.jsx)("div",{ref:n,dangerouslySetInnerHTML:{__html:r.slide.html},className:`${Ec["stories-slide-content"]} narrative-slide"`,style:l})})}),(o||u)&&(0,tl.jsx)("div",{className:Ec["load-mask"],onClick:e=>{e.stopPropagation(),e.preventDefault()},children:u?(0,tl.jsx)(pl,{className:Ec["stories-slide__refresh-btn"],onClick:()=>{r.networkError?r.onReloadStory():r.slide.reload()}}):s&&(0,tl.jsx)("div",{className:Ec["loading-spinner-default"]})})]})}));var Hc=f(9137),qc={insert:"head",singleton:!1};ol()(Hc.A,qc);const Qc=Hc.A.locals||{},Kc=(0,il.forwardRef)(((e,t)=>{const{desktopMode:r,dir:i}=kh(),n=ec(dr);return(0,tl.jsx)("div",{ref:t,dir:i,className:(0,nl.default)(Qc["stories-pager"],{[Qc["_desktop-mode"]]:r,[Qc["_paused-ui"]]:n}),style:{"--stories-pager-tick-foreground":e.timeline.foreground,"--stories-pager-background":e.timeline.background},children:(0,tl.jsx)("div",{className:`${Qc["stories-pager__ticks"]} ${(0,nl.default)({[Qc.hiddenTimeline]:e.hiddenTimeline})}`,children:new Array(e.slidesLength).fill(0).map(((t,r)=>(0,tl.jsxs)("div",{className:Qc["stories-pager__tick"],children:[(0,tl.jsx)("div",{className:(0,nl.default)(Qc["stories-pager__tick-progress"],{[Qc._active]:r+1<=e.activeSlideIndex})}),(0,tl.jsx)("div",{className:Qc["stories-pager__tick-progress-loader"],style:{display:r+1===e.activeSlideIndex+1?"block":"none"}})]},r+1)))})})}));var Yc=f(6212),Zc={insert:"head",singleton:!1};ol()(Yc.A,Zc);const Xc=Yc.A.locals||{};var Jc=function(e,t,r,i){return new(r||(r=Promise))((function(n,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}l((i=i.apply(e,t||[])).next())}))};const eu=e=>{const t=(0,il.useRef)(null),r=(0,il.useRef)(null),i=(0,il.useRef)(0),n=(0,il.useRef)(0);let s;const o=()=>{r.current&&(n.current=-1*function(e){const t=window.getComputedStyle(e),r=t.transform||t.webkitTransform||t.mozTransform;if("none"===r)return{x:0,y:0,z:0};const i=r.includes("3d")?"3d":"2d",n=r.match(/matrix.*\((.+)\)/)[1].split(", ");return"2d"===i?{x:isNaN(n[4])?0:n[4],y:isNaN(n[5])?0:n[5],z:0}:"3d"===i?{x:isNaN(n[12])?0:n[12],y:isNaN(n[13])?0:n[13],z:isNaN(n[14])?0:n[14]}:{x:0,y:0,z:0}}(r.current).x)},[a,l]=(0,il.useState)(!1),[d,c]=(0,il.useState)(!1),u=(0,il.useRef)(!1),h=()=>{const t=il.Children.count(e.children);return r.current&&t?r.current.scrollWidth/t:0};let p=!1;(0,il.useEffect)((()=>{var e;return("ontouchstart"in window||window.navigator.msPointerEnabled||"ontouchstart"in document.documentElement)&&(p=!0),p||(r.current&&(s=null===(e=r.current.children[0])||void 0===e?void 0:e.offsetWidth),r.current&&(i.current=r.current.scrollWidth-r.current.clientWidth,o()),i.current===n.current?c(!1):c(!0),0===n.current?l(!1):l(!0)),()=>{}}),[]);const f=(0,il.useRef)(!1),g=(0,il.useRef)(0);let v=0;const m=(0,il.useRef)(!1),[y,b]=(0,il.useState)(0),w=e=>{e<0&&(e=0),e>i.current&&(e=i.current),b(e)};(0,il.useEffect)((()=>{y===i.current?c(!1):c(!0),l(0!==y)}),[y]);const S=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,r=n.current+e;w(r)}}else m.current=!1},_=e=>{m.current&&e.preventDefault(),setTimeout((()=>{m.current=!1})),f.current=!1,document.removeEventListener("mousemove",S),document.removeEventListener("mouseup",_),document.removeEventListener("touchmove",S),document.removeEventListener("touchend",_)};return(0,tl.jsxs)("div",{className:Xc["scrolling-carousel"],style:e.style,children:[(0,tl.jsx)("div",{className:Xc["scrolling-carousel__wrapper"],ref:t,onMouseDown:e=>{u.current||(e.preventDefault(),f.current=!0,g.current=e.pageX,r.current&&(i.current=r.current.scrollWidth-r.current.clientWidth),r.current&&o(),document.addEventListener("mousemove",S),document.addEventListener("mouseup",_))},onTouchStart:e=>{u.current||(e.preventDefault(),f.current=!0,g.current=e.touches&&e.touches[0].pageX,r.current&&(i.current=r.current.scrollWidth-r.current.clientWidth),r.current&&o(),document.addEventListener("touchmove",S),document.addEventListener("touchend",_))},onClickCapture:e=>{m.current&&(e.preventDefault(),e.stopPropagation())},children:(0,tl.jsx)("div",{className:Xc["scrolling-carousel__item"],ref:r,style:{transform:`translateX(${-1*y}px)`},children:e.children})}),!p&&(0,tl.jsxs)(tl.Fragment,{children:[(0,tl.jsx)("div",{className:(0,nl.default)(Xc["scrolling-carousel__arrow-button"],Xc["scrolling-carousel__arrow-button--left"],{[Xc["scrolling-carousel__arrow-button--show"]]:a}),onClick:()=>Jc(void 0,void 0,void 0,(function*(){if(u.current)return;o();const e=n.current-h();w(e),u.current=!0,r.current&&(yield Un(r.current,"transform",300)),u.current=!1})),children:(0,tl.jsx)("svg",{focusable:"false",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,tl.jsx)("path",{d:"M15.41 7.41L14 6l-6 6 6 6 1.41-1.41L10.83 12z"})})}),(0,tl.jsx)("div",{className:(0,nl.default)(Xc["scrolling-carousel__arrow-button"],Xc["scrolling-carousel__arrow-button--right"],{[Xc["scrolling-carousel__arrow-button--show"]]:d}),onClick:()=>Jc(void 0,void 0,void 0,(function*(){if(u.current)return;o();const e=n.current+h();w(e),u.current=!0,r.current&&(yield Un(r.current,"transform",300)),u.current=!1})),children:(0,tl.jsx)("svg",{focusable:"false",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,tl.jsx)("path",{d:"M10 6L8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"})})})]})]})},tu=({children:e,style:t,color:r,font:i,className:n})=>(0,tl.jsx)("div",{className:n,style:Object.assign({color:r,font:i},t),children:e});var ru=f(9108),iu={insert:"head",singleton:!1};ol()(ru.A,iu);const nu=ru.A.locals||{},su=({goods:e,onClick:t,options:r})=>{var i;const{imgSrc:n,title:s,subTitle:o,price:a,oldPrice:l}=e;return(0,tl.jsxs)("div",{className:(0,nl.default)(nu["goods-card"]),style:{color:null!==(i=r.mainTextColor)&&void 0!==i?i:"black"},onClick:t,children:[(0,tl.jsx)("div",{className:(0,nl.default)(nu.figure),style:{borderRadius:r.imageCornerRadius+"px",backgroundColor:r.imageBackgroundColor},children:n&&(0,tl.jsx)("img",{src:n,alt:s,style:{borderRadius:r.imageCornerRadius+"px",backgroundColor:r.imageBackgroundColor}})}),(0,tl.jsx)(tu,{font:r.subtitleFont,children:o}),(0,tl.jsx)(tu,{font:r.titleFont,children:s}),(0,tl.jsxs)("div",{className:nu.prices,children:[(0,tl.jsx)(tu,{font:r.priceFont,children:a}),(0,tl.jsx)(tu,{className:nu["typography--old-price"],font:r.oldPriceFont,color:r.oldPriceTextColor,children:l})]})]})},ou=e=>{const t=e.goodsWidgetOptions,r=t.goodsWidgetRenderingType||t.goodsList.renderingType;let i=[];return r===ve.DEFAULT?i=e.goodsList.map(((r,i)=>(0,tl.jsx)(su,{options:t.goodsCard,goods:r,onClick:()=>e.onGoodsCardClick(r)},i))):r===ve.CUSTOM_CARD&&Dt()(t.getCardHtml)&&(i=e.goodsList.map(((r,i)=>{var n,s;return(0,tl.jsx)("div",{dangerouslySetInnerHTML:{__html:null!==(s=null===(n=t.getCardHtml)||void 0===n?void 0:n.call(t,r,i))&&void 0!==s?s:""},onClick:()=>e.onGoodsCardClick(r)},i)}))),(0,tl.jsx)(eu,{style:{marginTop:"-15px"},children:i})};var au=function(e,t){var r={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(r[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(i=Object.getOwnPropertySymbols(e);n<i.length;n++)t.indexOf(i[n])<0&&Object.prototype.propertyIsEnumerable.call(e,i[n])&&(r[i[n]]=e[i[n]])}return r};const lu=e=>{var{arrowColor:t}=e,r=au(e,["arrowColor"]);return(0,tl.jsx)("svg",Object.assign({},r,{width:"32",height:"12.5",viewBox:"0 0 64 25",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:(0,tl.jsx)("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})}))};var du=f(8161),cu={insert:"head",singleton:!1};ol()(du.A,cu);const uu=du.A.locals||{},hu=({closeImage:e,arrowColor:t,onClick:r})=>(0,tl.jsx)("div",{className:uu.btn,onClick:r,onTouchStart:r,children:e?(0,tl.jsx)("div",{dangerouslySetInnerHTML:{__html:e}}):(0,tl.jsx)(lu,{arrowColor:t})});var pu=f(1277),fu={insert:"head",singleton:!1};ol()(pu.A,fu);const gu=pu.A.locals||{},vu=({isLoading:e,backgroundColor:t="white",accentBackgroundColor:r="transparent"})=>e?(0,tl.jsx)("div",{className:gu.spinner,style:{border:`solid 2px ${t}`,borderColor:`${r} ${t} ${t} ${t}`}}):null;var mu=f(4940),yu={insert:"head",singleton:!1};ol()(mu.A,yu);const bu=mu.A.locals||{};var wu,Su=function(e,t,r,i){return new(r||(r=Promise))((function(n,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}l((i=i.apply(e,t||[])).next())}))};!function(e){e[e.IN=0]="IN",e[e.OUT=1]="OUT"}(wu||(wu={}));const _u=({open:e,url:t,goodsWidgetOptions:r,onClosed:i,onClose:n,onGoodsCardClick:s})=>{const o=(0,il.useRef)(null),[a,l]=(0,il.useState)([]),[d,c]=(0,il.useState)(wu.IN),u=r,{dimColor:h,substrateHeight:p,substrateColor:f,closeImage:g,closeBackgroundColor:v}=u.goodsList;(0,il.useEffect)((()=>{c(e?wu.IN:wu.OUT)}),[e]),(0,il.useEffect)((()=>{t&&m()}),[t]);const m=()=>Su(void 0,void 0,void 0,(function*(){const e=y(),t=yield r.openGoodsWidgetHandler(e);l(t)})),y=()=>{try{return JSON.parse(t).map((e=>({sku:e,title:"",subTitle:"",price:"",oldPrice:"",rawData:{}})))}catch(e){return console.error(e),[]}};(0,il.useEffect)((()=>{const e=o.current;if(d===wu.OUT)return e.addEventListener("animationend",i),()=>{e.removeEventListener("animationend",i)}}),[d]);const b=u.loader.custom?(0,tl.jsx)("div",{dangerouslySetInnerHTML:{__html:u.loader.custom}}):(0,tl.jsx)(vu,{isLoading:!a,backgroundColor:u.loader.default.color,accentBackgroundColor:u.loader.default.accentColor});return(0,tl.jsxs)("div",{className:(0,nl.default)(bu["goods-container"],{[bu["goods-container--visible"]]:d===wu.IN,[bu["goods-container--hidden"]]:d===wu.OUT}),ref:o,children:[(0,tl.jsx)("div",{className:(0,nl.default)(bu["goods-container__backdrop"]),style:{backgroundColor:h},onClick:n}),(0,tl.jsxs)("div",{className:(0,nl.default)(bu["goods-container"]),style:{height:p+"px",backgroundColor:null!=f?f:"white"},children:[b,a&&(0,tl.jsx)(ou,{goodsList:a,onGoodsCardClick:s,goodsWidgetOptions:r}),(0,tl.jsx)(hu,{onClick:n,closeImage:g,arrowColor:v})]})]})};var xu=f(2913),Ou={insert:"head",singleton:!1};ol()(xu.A,Ou);const Cu=xu.A.locals||{},ku=e=>{const[t,r]=(0,il.useState)(!1),[i,n]=(0,il.useState)(!1),s=()=>{n(!0),r(!0)},o=()=>{r(!1)};(0,il.useEffect)((()=>(e.widget.on(Ai.Open,s),()=>{e.widget.off(Ai.Open,s)})),[e.widget]),(0,il.useEffect)((()=>(ar.addListener("goodsWidget.close",o),()=>{ar.removeListener("goodsWidget.close",o)})),[]),(0,il.useEffect)((()=>{t&&ar.emit("publicEvents.widgetEvent",{name:"w-goods-open",devPayload:{story_id:e.story.id,slide_index:e.story.activeSlideIndex,widget_id:e.widget.elementId}})}),[t]);return i?(0,tl.jsx)("div",{className:Cu["goods-widget-viewer"],children:(0,tl.jsx)(_u,{open:t,url:e.widget.targetUrl,goodsWidgetOptions:e.goodsWidgetOptions,onClose:()=>{r(!1)},onClosed:()=>{e.widget.close(),n(!1)},onGoodsCardClick:t=>{var r,i;ar.emit("publicEvents.widgetEvent",{name:"w-goods-click",devPayload:{story_id:e.story.id,slide_index:e.story.activeSlideIndex,widget_id:e.widget.elementId,widget_value:t.sku}}),null===(i=(r=e.goodsWidgetOptions).itemClickHandler)||void 0===i||i.call(r,t)}})}):null},Lu={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 Au{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 Mu=e=>{switch(e){case"":default:return"text";case"tel":return"tel";case"email":return"email"}},Eu=e=>{const[t,r]=(0,il.useState)({countryCode:"",phone:""}),[i,n]=(0,il.useState)(""),[s,o]=(0,il.useState)(!0),a=r=>{var i;const n=Mu(null!==(i=null==e?void 0:e.configV2.main.input.type)&&void 0!==i?i:"");return"email"===n?Au.isEmailValid(r):"tel"!==n||Au.isTelephoneValid((()=>{var e;const r=t.countryCode.substring(1);return r&&null!==(e=Lu[r])&&void 0!==e?e:""})(),t.phone)};return{value:i,telephone:t,isValid:s,handleTelephoneChange:e=>{r(e),e.phone.length>0?n(e.countryCode+e.phone):n("")},handleChange:e=>{n(e.trim())},handleSubmit:e=>{const t=a(i);o(t),t&&e({value:i})},reset:()=>{o(!0),n(""),r({countryCode:"",phone:""})}}};var Pu=f(4169),ju={insert:"head",singleton:!1};ol()(Pu.A,ju);const Iu=Pu.A.locals||{},Tu=(0,il.forwardRef)(((e,t)=>{const r=(0,il.useRef)(null);return(0,il.useEffect)((()=>{var e;null===(e=r.current)||void 0===e||e.focus()}),[]),(0,tl.jsx)("input",{type:"email",className:(0,nl.default)(Iu.input,Iu.input_centered),placeholder:e.placeholder,value:e.value,ref:r,onChange:t=>e.onChange(t.target.value)})}));const Ru=(e=>{var t={};return f.d(t,e),t})({default:()=>c.default}),Du=(0,il.forwardRef)(((e,t)=>{const r=(0,il.useRef)(null),i=(0,il.useRef)(null),n=t=>{const r=t.target;r&&(r.value=r.value.replace(/\D/g,""),e.onChange({countryCode:e.value.countryCode,phone:r.value}))};(0,il.useEffect)((()=>{(()=>{let t=r.current;e.value.countryCode.length&&(t=i.current),null==t||t.focus()})()}),[]);const s=e.value.countryCode.substring(1),o=s?Lu[s]:"";return(0,tl.jsxs)("div",{className:Iu["input-group"],children:[(0,tl.jsxs)("div",{className:Iu["input-group__prepend"],children:[(0,tl.jsx)(Ru.default,{type:"tel",mask:"+999",maskChar:null,className:Iu.input,onChange:t=>{e.onChange({countryCode:t.currentTarget.value,phone:e.value.phone})},value:e.value.countryCode,placeholder:"+",inputRef:r}),(0,tl.jsx)("div",{className:Iu["input-group__separator"]})]}),o?(0,tl.jsx)(Ru.default,{type:"tel",className:Iu.input,mask:o,maskChar:"-",alwaysShowMask:!0,placeholder:e.placeholder,inputRef:i,value:e.value.phone,onChange:n}):(0,tl.jsx)("input",{type:"tel",className:Iu.input,placeholder:e.placeholder,ref:i,value:e.value.phone,onChange:n})]})})),Bu=(0,il.forwardRef)(((e,t)=>{const r=(0,il.useRef)(null),i=(0,il.useRef)(null);(0,il.useEffect)((()=>{var t;i.current.dataset.replicatedValue=e.value,null===(t=r.current)||void 0===t||t.focus()}),[]);return(0,tl.jsx)("div",{className:Iu["textarea-grow-wrap"],ref:i,style:e.style,children:(0,tl.jsx)("textarea",{className:Iu.input,placeholder:e.placeholder,rows:1,ref:r,maxLength:e.maxLength,value:e.value,onChange:t=>e.onChange(t.target.value),onInput:e=>{i.current.dataset.replicatedValue=e.currentTarget.value}})})}));var Nu=function(e,t){var r={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(r[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(i=Object.getOwnPropertySymbols(e);n<i.length;n++)t.indexOf(i[n])<0&&Object.prototype.propertyIsEnumerable.call(e,i[n])&&(r[i[n]]=e[i[n]])}return r};const Fu=e=>{var{form:t,config:r}=e,i=Nu(e,["form","config"]);const[n,s]=(0,il.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 r=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:`${r.background.color}`,border:`${r.border.visible&&`${t(r.border.width)}px solid ${r.border.color}`}`,borderRadius:`${t(r.border.radius)}px`}},getMainElementsStyle:()=>{const r=e.configV2.main;return{width:"100%",padding:`${t(r.padding.top)}px ${t(r.padding.right)}px ${t(r.padding.bottom)}px ${t(r.padding.left)}px`}},getQuestionStyle:()=>{const r=e.configV2.main.question;return{padding:`${t(r.padding.top)}px ${t(r.padding.right)}px ${t(r.padding.bottom)}px ${t(r.padding.left)}px`,color:`${r.text.color}`,fontSize:`${t(r.text.size)}px`,lineHeight:`${r.text.lineHeight}`,textAlign:`${r.text.align}`,fontFamily:`${r.text.type}`,fontWeight:`${r.text.weight}`,fontStyle:`${r.text.style}`}},getInputWrapperStyle:()=>{const r=e.configV2.main.input;let i=e.configV2.main.input.text.maxLines;return i=i>0?i:1,{padding:`${t(r.padding.top)}px ${t(r.padding.right)}px ${t(r.padding.bottom)}px ${t(r.padding.left)}px`,backgroundColor:`${r.background.color}`,border:`${t(r.border.width)}px solid ${r.border.color}`,borderRadius:`${t(r.border.radius)}px`,lineHeight:`${r.text.lineHeight}`,maxHeight:r.text.lineHeight*i+"em",fontSize:`${t(r.text.size)}px`,overflowY:"scroll",scrollbarWidth:"none"}},getButtonStyle:()=>{const r=e.configV2.main.button;return{padding:`${t(r.padding.top)}px ${t(r.padding.right)}px ${t(r.padding.bottom)}px ${t(r.padding.left)}px`,backgroundColor:`${r.background.color}`,border:`${t(r.border.width)}px solid ${r.border.color}`,color:`${r.text.color}`,fontSize:`${t(r.text.size)}px`,lineHeight:`${r.text.lineHeight}`,textAlign:`${r.text.align}`,fontFamily:`${r.text.type}`,fontWeight:`${r.text.weight}`,fontStyle:`${r.text.style}`}},getTextareaStyle:()=>{const r=e.configV2.main.input;return{color:`${r.text.color}`,fontSize:`${t(r.text.size)}px`,lineHeight:`${r.text.lineHeight}`,textAlign:`${r.text.align}`,fontFamily:`${r.text.type}`,fontWeight:`${r.text.weight}`,fontStyle:`${r.text.style}`}}}})({config:r}),h=Math.max(r.configV2.main.input.text.limit,0),p=String(r.configV2.main.input.text.placeholder).trim(),f=String(r.configV2.main.button.text.value).trim(),g=String(r.configV2.main.question.text.value).trim(),v=Mu(r.configV2.main.input.type),m=({value:e})=>{i.onComplete({result:!0,value:e}),s(!1)};return(0,tl.jsxs)("div",{className:Iu.wrapper,children:[(0,tl.jsx)("div",{className:(0,nl.default)(Iu.backdrop,{[Iu.fadeIn]:n,[Iu.fadeOut]:!n}),onAnimationEnd:()=>{n||i.onClose()},onClick:()=>{i.onComplete({result:!1,value:t.value}),s(!1)}}),(0,tl.jsxs)("div",{className:Iu.main,style:o(),children:[(0,tl.jsxs)("div",{className:Iu["main-elements"],style:a(),children:[(0,tl.jsx)("div",{className:Iu.question,style:l(),children:g}),(0,tl.jsxs)("div",{className:(0,nl.default)(Iu["input-wrapper"],{[Iu["is-invalid"]]:!t.isValid}),style:d(),children:["text"===v&&(0,tl.jsx)(Bu,{value:t.value,onChange:t.handleChange,style:u(),placeholder:p,maxLength:h}),"email"===v&&(0,tl.jsx)(Tu,{value:t.value,onChange:t.handleChange,placeholder:p}),"tel"===v&&(0,tl.jsx)(Du,{value:t.telephone,onChange:t.handleTelephoneChange,placeholder:p})]})]}),t.value.trim().length>0&&(0,tl.jsx)("div",{className:Iu["button-wrapper"],children:(0,tl.jsx)("button",{className:Iu.button,style:c(),onClick:()=>t.handleSubmit(m),children:f})})]})]})},Uu=({storyGeometry:e,activeSlide:t,storyRef:r})=>{const[i,n]=(0,il.useState)(null),[s,o]=(0,il.useState)(null),a=Eu(s);(0,il.useEffect)((()=>(ar.on(ro.ShowInputModal,l),()=>{ar.off(ro.ShowInputModal,l)})),[]);const l=({id:t,config:i})=>{Or(),mr(),n(t),(t=>{t.size.fontSize=parseFloat(e.getFontSize()),t.size.viewportWidth=e.calculateWidth();const i=r.current.getBoundingClientRect();t.size.slideOffsetX=i.x,t.size.slideOffsetY=i.y,t.size.slideHeight=i.height,o(t)})(i)};return(0,il.useLayoutEffect)((()=>()=>{a.reset()}),[i]),s?(0,tl.jsx)(Fu,{form:a,config:s,onComplete:e=>{if(!i)throw new Error;((e,r)=>{t.setUserData(e,r)})(i,e.result?e.value:""),Cr()},onClose:()=>{o(null),vr()}}):null};var Vu=function(e,t){var r={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(r[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(i=Object.getOwnPropertySymbols(e);n<i.length;n++)t.indexOf(i[n])<0&&Object.prototype.propertyIsEnumerable.call(e,i[n])&&(r[i[n]]=e[i[n]])}return r};const zu=(0,Yl.observer)((e=>{var t,{story:r,geometry:i,className:n}=e,s=Vu(e,["story","geometry","className"]);const o=(0,il.useRef)(null),a=(0,il.useRef)(null);(({story:e,progressBarRef:t,nextFlippingStoryIndex:r,activeStory:i})=>{const n=e.timer,s=ec(cr),o=e===i&&-1===r;(0,il.useEffect)((()=>{const r=e=>{var r;null===(r=t.current)||void 0===r||r.style.setProperty("--tick",e+"%")},i=({forceEnd:t})=>{t||(e.reachEnd?ar.emit(`${Ao.name}.showNextStory`,{action:"auto"}):e.nextSlide())},s=()=>{var e;null===(e=t.current)||void 0===e||e.style.setProperty("--tick","0%")},o=()=>{var e;null===(e=t.current)||void 0===e||e.style.setProperty("--tick","0%")};return n.on("start",s),n.on("stop",o),n.on("progress",r),n.on("complete",i),()=>{n.off("start",s),n.off("progress",r),n.off("complete",i),n.off("stop",o)}}),[e]),(0,il.useEffect)((()=>{s?n.pause():n.resume()}),[s]),(0,il.useEffect)((()=>{o||n.stop()}),[o])})({activeStory:s.activeStory,story:r,nextFlippingStoryIndex:s.nextFlippingStoryIndex,progressBarRef:a});const l=s.index===s.nextFlippingStoryIndex,d=(0,il.useMemo)((()=>{var e;return null===(e=r.activeSlide)||void 0===e?void 0:e.findWidgetByType(Ei.name)}),[null===(t=r.activeSlide)||void 0===t?void 0:t.state]),c=()=>{ar.emit(wo.ReloadStory,r)};return(0,tl.jsxs)("div",{ref:o,className:(0,nl.default)(bc["stories-item"],bc.slider3d__item,n),onMouseDown:()=>{Wi({result:!1})},onTouchStart:()=>{Wi({result:!1})},"data-testid":"story",style:s.style,children:[(0,tl.jsx)(Lc,{closeDisabled:r.disableClose,options:s.storyReaderOptions,onClose:s.onClose}),r.activeSlide&&(0,tl.jsx)(Kc,{ref:a,hiddenTimeline:r.hiddenTimeline,slidesLength:r.slidesCount,timeline:r.activeSlide.timeline,activeSlideIndex:r.activeSlideIndex}),r.displayedSlides.map(((e,t)=>(0,tl.jsx)($c,{clickDisabled:s.slideClickDisabled,onReloadStory:c,activeSlideIndex:r.activeSlideIndex,currentSlideIndex:t,needSlideInitByFlipping:l,networkError:Boolean(r.error),currentStory:r,activeStory:s.activeStory,geometry:i,slide:e,slidesLoaded:r.slidesLoaded},e.html))),(0,tl.jsx)(xc,{story:r,commonOptions:s.commonOptions,storyReaderOptions:s.storyReaderOptions}),d&&s.activeStory===r&&(0,tl.jsx)(ku,{widget:d,story:r,goodsWidgetOptions:s.goodsWidgetOptions}),s.activeStory===r&&r.activeSlide&&(0,tl.jsx)(Uu,{storyRef:o,storyGeometry:i,activeSlide:r.activeSlide})]})})),Gu=({className:e,style:t})=>(0,tl.jsx)("div",{className:(0,nl.default)(bc["stories-item"],e),style:t,children:(0,tl.jsx)("div",{className:`${Ec["stories-slide"]} ${Ec._dummy}`})});var Wu=f(9669),$u={insert:"head",singleton:!1};ol()(Wu.A,$u);const Hu=Wu.A.locals||{};var qu=function(e,t){var r={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(r[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(i=Object.getOwnPropertySymbols(e);n<i.length;n++)t.indexOf(i[n])<0&&Object.prototype.propertyIsEnumerable.call(e,i[n])&&(r[i[n]]=e[i[n]])}return r};const Qu=e=>{var{width:t,navigationOptions:r}=e,i=qu(e,["width","navigationOptions"]);const{desktopMode:n,dir:s}=kh(),[o,a]=ec([dr,Rr]),l=o||a,d="ltr"===s,c=(d?i.isNextStoryBlank:i.isPrevStoryBlank)||l,u=(d?i.isPrevStoryBlank:i.isNextStoryBlank)||l;return(0,tl.jsxs)("div",{className:(0,nl.default)([Hu["story-reader-controls"]],{[Hu._desktop_mode]:n}),children:[(0,tl.jsx)("div",{className:Hu.slider3d__btn_next,style:{transform:`translateY(-50%) translateX(calc(${t/2}px + 100%))`},children:(0,tl.jsx)("button",{className:Hu["btn-icon"],onClick:e=>{e.stopPropagation(),e.preventDefault(),i.disabled||(d?i.onNext():i.onPrev())},disabled:c,dangerouslySetInnerHTML:{__html:r.nextButton.svgSrc.baseState}})}),(0,tl.jsx)("div",{className:Hu.slider3d__btn_prev,style:{transform:`translateY(-50%) translateX(calc(-${t/2}px - 200%))`},children:(0,tl.jsx)("button",{className:Hu["btn-icon"],onClick:e=>{e.stopPropagation(),e.preventDefault(),i.disabled||(d?i.onPrev():i.onNext())},disabled:u,dangerouslySetInnerHTML:{__html:r.prevButton.svgSrc.baseState}})})]})},Ku=45,Yu=350,Zu="linear",Xu=1.6,Ju=2*Math.tan(Ku*Math.PI/360),eh=Yu/1e3;class th{constructor(e){Object.defineProperty(this,"slider",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"newAngle",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"angleDelta",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"normalizedShift",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"movementStartAt",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"_currentAngle",{enumerable:!0,configurable:!0,writable:!0,value:0})}get currentAngle(){return this._currentAngle}get perspective(){return 0}get depth(){return 0}startMove(){this.newAngle=0,this.angleDelta=0,this.normalizedShift=0,this.movementStartAt=Date.now()}move(e){this.normalizedShift=e/this.slider.clientWidth*Xu,this.newAngle=this._currentAngle+this.normalizedShift*Ku,this.angleDelta=this.newAngle-this._currentAngle}endMove(){if(!this.normalizedShift)return;let e=Math.round(this.angleDelta/Ku);e=this.limitByFastMovement(e),e=this.limitBySliderEdges(e),this.slider.emit("touchEnd",e)}limitByFastMovement(e){return this.isFastMovement(e)?this.normalizedShift<0?-1:1:e}isFastMovement(e){return Date.now()-this.movementStartAt<=500&&0===e}limitBySliderEdges(e){return e<0&&this.slider.isBeginning||e>0&&this.slider.isEnd?0:e}}const rh=.05;class ih extends th{init(){this._currentAngle=this.slider.currentIndex*Ku}transform(e){const t=this.slider.leftElement,r=this.slider.rightElement,i=this.slider.frontElement;null==t||t.style.setProperty("transform",`translateZ(0) translateX(${-100*(.1- -1*e/10)}%) scale(${Math.min(.9+-1*e/10,1)})`),null==r||r.style.setProperty("transform",`translateZ(0) translateX(${100*(1-e)}%)`),null==i||i.style.setProperty("transform",`translateZ(0) translateX(${e<=0?-100*e:-100*(0- -1*e/10)}%) scale(${e<=0?1:1+-1*e/10})`)}move(e){super.move(e),this.normalizedShift=this.applyBoundsConstraint(this.normalizedShift),this.transform(this.normalizedShift)}getCSSStyle(e,t){return{display:Math.abs(e-t)<=1?"block":"none",transition:"inherit",transform:`translateZ(0) translateX(${0===e?-10:-100*t+100*e}%) scale(${0===e?.9:1})`}}applyBoundsConstraint(e){return this.slider.isBeginning||this.slider.isEnd?e>=rh&&this.slider.isEnd?rh:e<=-.05&&this.slider.isBeginning?-.05:e:e}}const nh=.05;class sh extends th{init(){this._currentAngle=this.slider.currentIndex*Ku}transform(e){const t=this.slider.leftElement,r=this.slider.rightElement,i=this.slider.frontElement;null==t||t.style.setProperty("transform",`translateZ(0) translateX(${-100*(1+e)}%)`),null==r||r.style.setProperty("transform",`translateZ(0) translateX(${100*(1-e)}%)`),null==i||i.style.setProperty("transform",`translateZ(0) translateX(${-100*e}%)`)}move(e){super.move(e),this.normalizedShift=this.applyBoundsConstraint(this.normalizedShift),this.transform(this.normalizedShift)}getCSSStyle(e,t){return{display:Math.abs(e-t)<=1?"block":"none",transition:"inherit",transform:`translateZ(0) translateX(${-100*t+100*e}%)`}}applyBoundsConstraint(e){return this.slider.isBeginning||this.slider.isEnd?e>=nh&&this.slider.isEnd?nh:e<=-.05&&this.slider.isBeginning?-.05:e:e}}var oh=function(e,t,r,i){return new(r||(r=Promise))((function(n,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}l((i=i.apply(e,t||[])).next())}))};class ah extends th{get perspective(){return this.slider.clientWidth*Xu}get depth(){return this.slider.clientWidth/Ju}init(){this.transform(this.slider.currentIndex)}transform(e){return oh(this,void 0,void 0,(function*(){this._currentAngle=this._currentAngle+e*Ku,this.slider.setTransform(`rotateY(${-this._currentAngle}deg)`)}))}move(e){super.move(e),this.newAngle=this.applyBoundsConstraint(this.angleDelta),this.slider.setTransform(`rotateY(${-this.newAngle}deg)`)}getCSSStyle(e,t){return{display:Math.abs(e-t)<=1?"block":"none",transition:"",transform:"rotateY("+e*Ku+`deg) translateZ(${this.depth}px)`}}applyBoundsConstraint(e){return this.slider.isBeginning||this.slider.isEnd?e>=5&&this.slider.isEnd?this._currentAngle+5:e<=-5&&this.slider.isBeginning?this._currentAngle-5:this.newAngle:this.newAngle}}class lh{static create(e,t){switch(t){case he.FLAT:return new sh(e);case he.COVER:return new ih(e);case he.CUBE:return new ah(e);default:return new sh(e)}}}var dh=function(e,t,r){for(var i=arguments.length>2,n=0;n<t.length;n++)r=i?t[n].call(e,r):t[n].call(e);return i?r:void 0},ch=function(e,t,r,i,n,s){function o(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var a,l=i.kind,d="getter"===l?"get":"setter"===l?"set":"value",c=!t&&e?i.static?e:e.prototype:null,u=t||(c?Object.getOwnPropertyDescriptor(c,i.name):{}),h=!1,p=r.length-1;p>=0;p--){var f={};for(var g in i)f[g]="access"===g?{}:i[g];for(var g in i.access)f.access[g]=i.access[g];f.addInitializer=function(e){if(h)throw new TypeError("Cannot add initializers after decoration has completed");s.push(o(e||null))};var v=(0,r[p])("accessor"===l?{get:u.get,set:u.set}:u[d],f);if("accessor"===l){if(void 0===v)continue;if(null===v||"object"!=typeof v)throw new TypeError("Object expected");(a=o(v.get))&&(u.get=a),(a=o(v.set))&&(u.set=a),(a=o(v.init))&&n.unshift(a)}else(a=o(v))&&("field"===l?n.unshift(a):u[d]=a)}c&&Object.defineProperty(c,i.name,u),h=!0},uh=function(e,t,r,i){return new(r||(r=Promise))((function(n,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}l((i=i.apply(e,t||[])).next())}))},hh=function(e,t,r,i){if("a"===r&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?i:"a"===r?i.call(e):i?i.value:t.get(e)},ph=function(e,t,r,i,n){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!n)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?n.call(e,r):n?n.value=r:t.set(e,r),r};let fh=(()=>{var e,t,r,i;let n,s,o,a,l,d,c,u,h,p,f,g,v,m,y,b,w,S=J.EventEmitter,_=[],x=[],O=[],C=[],k=[],L=[],A=[];return e=class extends S{constructor(){super(...arguments),t.set(this,(dh(this,_),dh(this,x,!1))),r.set(this,(dh(this,O),dh(this,C,0))),i.set(this,(dh(this,k),dh(this,L,null))),Object.defineProperty(this,"$el",{enumerable:!0,configurable:!0,writable:!0,value:dh(this,A)})}get _animating(){return hh(this,t,"f")}set _animating(e){ph(this,t,e,"f")}get _currentIndex(){return hh(this,r,"f")}set _currentIndex(e){ph(this,r,e,"f")}get effect(){return hh(this,i,"f")}set effect(e){ph(this,i,e,"f")}get clientWidth(){return this.$el.clientWidth}get animating(){return this._animating}get leftElement(){return this.$el.children.item(this._currentIndex-1)}get rightElement(){return this.$el.children.item(this._currentIndex+1)}get frontElement(){return this.$el.children.item(this._currentIndex)}get isBeginning(){return this._currentIndex-1==0}get isEnd(){return this._currentIndex+1===this.$el.children.length-1}get perspective(){var e,t;return null!==(t=null===(e=this.effect)||void 0===e?void 0:e.perspective)&&void 0!==t?t:0}get depth(){var e,t;return null!==(t=null===(e=this.effect)||void 0===e?void 0:e.depth)&&void 0!==t?t:0}get currentIndex(){return this._currentIndex}set currentIndex(e){this._currentIndex=e}getCSSStyle(e,t){var r,i;return null!==(i=null===(r=this.effect)||void 0===r?void 0:r.getCSSStyle(e,t))&&void 0!==i?i:{}}init({$el:e,transformStyle:t}){this.$el=e,this.effect=lh.create(this,t),this.effect.init(),this.setTransition("transform 0s"),this.updateSlidesStyle(0)}transformWithAmimation(e){return uh(this,void 0,void 0,(function*(){this.emit("transitionStart"),this._animating=!0,this.setTransition(`transform ${eh}s ${Zu}`),this.effect.transform(e),yield this.waitTransitionEnd(),this.updateSlidesStyle(e),this._animating=!1,this.emit("transitionEnd")}))}startMove(){this.effect.startMove()}move(e){this._animating=!0,this.emit("touchMove"),this.effect.move(e)}endMove(){this._animating=!1,this.effect.endMove()}setTransform(e){this.$el.style.setProperty("transform",e)}updateSlidesStyle(e){const t=Array.from(this.$el.children);for(let r=0;r<t.length;r++){const i=t[r],n=this.effect.getCSSStyle(r,this.currentIndex+e);i.style.display=n.display,i.style.transform=n.transform,i.style.transition=n.transition}}setTransition(e){this.$el.style.setProperty("transition",e)}waitTransitionEnd(){return new Promise((e=>{const t=r=>{Math.round(100*r.elapsedTime)/100===eh&&"transform"===r.propertyName&&(this.setTransition("transform 0s"),this.$el.removeEventListener("transitionend",t),e())};this.$el.addEventListener("transitionend",t)}))}},t=new WeakMap,r=new WeakMap,i=new WeakMap,(()=>{var t;const r="function"==typeof Symbol&&Symbol.metadata?Object.create(null!==(t=S[Symbol.metadata])&&void 0!==t?t:null):void 0;n=[to.observable],s=[to.observable],o=[to.observable],a=[to.computed],l=[to.computed],d=[to.computed],c=[to.computed],u=[to.computed],h=[to.computed],p=[to.computed],f=[to.computed],g=[to.computed],v=[to.action],m=[to.action],y=[to.action],b=[to.action],w=[to.action],ch(e,null,n,{kind:"accessor",name:"_animating",static:!1,private:!1,access:{has:e=>"_animating"in e,get:e=>e._animating,set:(e,t)=>{e._animating=t}},metadata:r},x,O),ch(e,null,s,{kind:"accessor",name:"_currentIndex",static:!1,private:!1,access:{has:e=>"_currentIndex"in e,get:e=>e._currentIndex,set:(e,t)=>{e._currentIndex=t}},metadata:r},C,k),ch(e,null,o,{kind:"accessor",name:"effect",static:!1,private:!1,access:{has:e=>"effect"in e,get:e=>e.effect,set:(e,t)=>{e.effect=t}},metadata:r},L,A),ch(e,null,a,{kind:"getter",name:"animating",static:!1,private:!1,access:{has:e=>"animating"in e,get:e=>e.animating},metadata:r},null,_),ch(e,null,l,{kind:"getter",name:"leftElement",static:!1,private:!1,access:{has:e=>"leftElement"in e,get:e=>e.leftElement},metadata:r},null,_),ch(e,null,d,{kind:"getter",name:"rightElement",static:!1,private:!1,access:{has:e=>"rightElement"in e,get:e=>e.rightElement},metadata:r},null,_),ch(e,null,c,{kind:"getter",name:"frontElement",static:!1,private:!1,access:{has:e=>"frontElement"in e,get:e=>e.frontElement},metadata:r},null,_),ch(e,null,u,{kind:"getter",name:"isBeginning",static:!1,private:!1,access:{has:e=>"isBeginning"in e,get:e=>e.isBeginning},metadata:r},null,_),ch(e,null,h,{kind:"getter",name:"isEnd",static:!1,private:!1,access:{has:e=>"isEnd"in e,get:e=>e.isEnd},metadata:r},null,_),ch(e,null,p,{kind:"getter",name:"perspective",static:!1,private:!1,access:{has:e=>"perspective"in e,get:e=>e.perspective},metadata:r},null,_),ch(e,null,f,{kind:"getter",name:"depth",static:!1,private:!1,access:{has:e=>"depth"in e,get:e=>e.depth},metadata:r},null,_),ch(e,null,g,{kind:"getter",name:"currentIndex",static:!1,private:!1,access:{has:e=>"currentIndex"in e,get:e=>e.currentIndex},metadata:r},null,_),ch(e,null,v,{kind:"setter",name:"currentIndex",static:!1,private:!1,access:{has:e=>"currentIndex"in e,set:(e,t)=>{e.currentIndex=t}},metadata:r},null,_),ch(e,null,m,{kind:"method",name:"init",static:!1,private:!1,access:{has:e=>"init"in e,get:e=>e.init},metadata:r},null,_),ch(e,null,y,{kind:"method",name:"transformWithAmimation",static:!1,private:!1,access:{has:e=>"transformWithAmimation"in e,get:e=>e.transformWithAmimation},metadata:r},null,_),ch(e,null,b,{kind:"method",name:"move",static:!1,private:!1,access:{has:e=>"move"in e,get:e=>e.move},metadata:r},null,_),ch(e,null,w,{kind:"method",name:"endMove",static:!1,private:!1,access:{has:e=>"endMove"in e,get:e=>e.endMove},metadata:r},null,_),r&&Object.defineProperty(e,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:r})})(),e})();const gh=e=>{const{storyReaderOptions:t}=kh(),r=(0,il.useRef)(null),i=(0,il.useRef)(new fh).current;(({storiesSlider:e})=>{const t=()=>{null==e||e.startMove()},r=({startX:t,x:r,lockX:i})=>{if(i)return;const n=t-r;null==e||e.move(n)},i=({lockX:t})=>{t||null==e||e.endMove()};(0,il.useEffect)((()=>(ar.on("swipeController.startMove",t),ar.on("swipeController.move",r),ar.on("swipeController.endMove",i),()=>{ar.off("swipeController.startMove",t),ar.off("swipeController.move",r),ar.off("swipeController.endMove",i)})),[])})({storiesSlider:i});const n=t.scrollStyle,s=e.stories;i.currentIndex=e.currentIndex,(0,il.useLayoutEffect)((()=>{const e=()=>{i.init({$el:r.current,transformStyle:n})};return e(),window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}}),[s.length,n]),(0,il.useEffect)((()=>(i.on("transitionStart",a),i.on("transitionEnd",l),i.on("touchMove",o),()=>{i.off("transitionStart",a),i.off("transitionEnd",l),i.off("touchMove",o)})),[]);const o=()=>{mr()},a=()=>{mr()},l=()=>{vr()};return{ref:r,api:i,perspective:i.perspective,depth:i.depth}};var vh=function(e,t,r,i){return new(r||(r=Promise))((function(n,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}l((i=i.apply(e,t||[])).next())}))};const mh=(e,t)=>{const{storyReaderOptions:r}=kh(),[i,n]=(0,il.useState)(-1);(0,il.useEffect)((()=>(ar.on(`${Ao.name}.showNextStory`,l),ar.on(`${Ao.name}.showPrevStory`,d),()=>{ar.off(`${Ao.name}.showNextStory`,l),ar.off(`${Ao.name}.showPrevStory`,d)})),[]),(0,il.useEffect)((()=>(t.on("touchEnd",s),()=>{t.off("touchEnd",s)})),[t]);const s=r=>vh(void 0,void 0,void 0,(function*(){Sr(),0===r?yield t.transformWithAmimation(0):a(e.currentIndex+r,"swipe")})),o=t=>{ar.emit("publicEvents.closeStory",{id:e.activeStory.id,index:e.activeStory.activeSlideIndex,action:t})},a=(t,r="lastSlideClick")=>{n(t),e.setSlideApiActiveStory(e.getDisplayedStoryByIndex(t)),c(t,r)},l=t=>{const i=null==t?void 0:t.action;e.reachEnd?(t=>{"auto"!==t?(o("closeStoryByScrolling"),e.close("lastSlideClick")):r.closeOnLastSlideByTimer&&(o("closeStoryByScrolling"),e.close("auto"))})(i):a(e.currentIndex+1,i)},d=t=>{e.reachStart||a(e.currentIndex-1,null==t?void 0:t.action)},c=(r,i)=>vh(void 0,void 0,void 0,(function*(){if(-1===r)return;const s=e.currentIndex<r?1:-1;yield t.transformWithAmimation(s),((t,r)=>{o(r),1==(e.currentIndex<t?1:-1)?e.nextStory():e.prevStory(),n(-1)})(r,i)}));return{nextFlippingStoryIndex:i,nextStory:l,prevStory:d,navigateStory:a}},yh=(0,Yl.observer)((e=>{const{storyReaderOptions:t,commonOptions:r,goodsWidgetOptions:i}=kh(),[n,s]=ec([dr,ur]),{isOpened:o,sharePanelOpeningParams:a,handleShareComplete:l}=(()=>{const{isOpened:e,id:t,type:r,link:i,text:n}=ec(Tr);return{isOpened:e,sharePanelOpeningParams:{shareId:t,shareType:r,shareLink:i,shareText:n},handleShareComplete:e=>{Lr(),ar.emit(`${Li.name}.shareComplete`,{shareId:t,result:e}),Br()},closeSharePanel:()=>{Lr(),Br()}}})(),d=gh(e.storyReaderViewModel),c=mh(e.storyReaderViewModel,d.api),{actionPanelHeight:u,safeAreaFrameCalculator:h,isMobileGeometry:p,storyGeometry:f,correctionPaddingStyle:g}=hc(e.viewport),v=e.storyReaderViewModel.activeStory;return(0,tl.jsxs)(tl.Fragment,{children:[(0,tl.jsxs)("div",{className:(0,nl.default)(vc.slider3d__wrapper,{[vc["slider3d__wrapper_swipe-up"]]:s,[vc._desktop_mode]:!p}),style:Object.assign({WebkitPerspective:`${d.perspective}px`,perspective:`${d.perspective}px`,width:f.getWidth(),backgroundColor:p&&h.shouldBeShownSafeAreaInsets&&"#000"},g),children:[(0,tl.jsx)("div",{className:vc.slider3d__inner,style:{transform:`translateZ(-${d.depth}px)`},children:(0,tl.jsx)("div",{className:(0,nl.default)(vc["stories-face"],vc.slider3d__rotater),ref:d.ref,children:e.storyReaderViewModel.stories.map(((s,o)=>s.isBlank?(0,tl.jsx)(Gu,{style:{bottom:0}},s.id):(0,tl.jsx)(zu,{slideClickDisabled:n||d.api.animating,index:o,story:s,activeStory:v,nextFlippingStoryIndex:c.nextFlippingStoryIndex,geometry:f,style:{bottom:uc(s,r)?`${u}px`:0},commonOptions:r,storyReaderOptions:t,goodsWidgetOptions:i,onClose:e.onCloseStory},s.id)))})}),o&&(0,tl.jsx)(Ul,{className:vc["share-panel-wrapper"],shareText:a.shareText,shareType:a.shareType,shareLink:a.shareLink,onShareCompelete:l,sharePanelOptions:t.sharePanel})]}),(0,tl.jsx)(Qu,{disabled:d.api.animating,isNextStoryBlank:e.storyReaderViewModel.reachEnd,isPrevStoryBlank:e.storyReaderViewModel.reachStart,navigationOptions:t.navigation,width:f.calculateWidth(),onNext:c.nextStory,onPrev:c.prevStory})]})})),bh=(0,Yl.observer)((({storyReaderViewModel:e,desktopMode:t})=>{const r=(()=>{const[e,t]=(0,il.useState)((()=>id())),r=(0,il.useCallback)((()=>{t(id())}),[]);return(0,il.useEffect)((()=>(window.addEventListener("resize",r),()=>{window.removeEventListener("resize",r)})),[]),e})();(()=>{const e=()=>{"hidden"===document.visibilityState&&wr(),"visible"===document.visibilityState&&Sr()};(0,il.useEffect)((()=>(document.addEventListener("visibilitychange",e),()=>{document.removeEventListener("visibilitychange",e)})),[])})(),(()=>{const{desktopMode:e}=kh(),[t,r]=ec([Rr,hr]),i=(0,il.useRef)();(0,il.useEffect)((()=>(i.current=new dc,()=>{var e;null===(e=i.current)||void 0===e||e.destroy()})),[]),(0,il.useEffect)((()=>{const n=i.current;n&&(e||t||!r?n.disable():n.enable())}),[e,t,r])})(),Eh((()=>{e.close("closeReaderByEscBtn")}));return(0,Zl.createPortal)((0,tl.jsxs)(pc,{viewport:r,storyReaderViewModel:e,children:[(0,tl.jsx)(yh,{viewport:r,storyReaderViewModel:e,onCloseStory:()=>{e.close()}}),(0,tl.jsx)(xl,{orientation:Fa.PORTRAIT_PRIMARY,desktopMode:t,onOrientationChange:({isWrong:e})=>{e?Or():Cr()}})]}),document.body)}));var wh=f(7314),Sh={insert:"head",singleton:!1};ol()(wh.A,Sh);wh.A.locals;const _h=({storyManager:e,desktopMode:t})=>{const[r,i]=(0,il.useState)(null),n=(()=>{const e=(0,il.useRef)();return e.current||(e.current=(()=>{const e=getComputedStyle(document.documentElement),t=t=>parseFloat(e.getPropertyValue(t)),r=t("--ias-sat"),i=t("--ias-sab");return{left:t("--ias-sal"),right:t("--ias-sar"),top:r,bottom:i}})()),e.current})();return(0,il.useEffect)((()=>{const t=e.createGameReader();return t.setSafeAreaInsets(n),i(t),()=>{t.destroy()}}),[e]),(0,il.useEffect)((()=>{null==r||r.setDesktopMode(t)}),[r,t]),r},xh=il.default.createContext({dir:"ltr",storyManager:ka,desktopMode:!1,commonOptions:te,storyReaderOptions:pe,gameReaderOptions:we,goodsWidgetOptions:be});let Oh=!1;const Ch=(0,Yl.observer)((e=>{Ph(e.config),jh(e);const{commonOptions:t,gameReaderOptions:r,storyReaderOptions:i,goodsWidgetOptions:n}=Ih(e),s=Mh(),o=(({storyManager:e})=>{const[t,r]=(0,il.useState)(null);return(0,il.useEffect)((()=>{const t=e.createStoryReader();return r(t),()=>{t.destroy()}}),[e]),t})({storyManager:ka}),a=_h({storyManager:ka,desktopMode:s});(0,il.useEffect)((()=>{if(Oh)throw new Error("There can only be one instance of <IASContainer /> per application");return Oh=!0,()=>{Oh=!1}}),[]);const l=(0,il.useMemo)((()=>getComputedStyle(document.documentElement).direction),[]),d=(0,il.useMemo)((()=>({storyManager:ka,desktopMode:s,dir:l,commonOptions:t,gameReaderOptions:r,storyReaderOptions:i,goodsWidgetOptions:n})),[ka,s,l,t,r,i,n]);return(0,tl.jsxs)(xh.Provider,{value:d,children:[(null==a?void 0:a.isOpened)&&(0,tl.jsx)(Xl,{gameReaderViewModel:a}),(null==o?void 0:o.activeStory)&&(0,tl.jsx)(bh,{storyReaderViewModel:o,desktopMode:s}),e.children]})})),kh=()=>(0,il.useContext)(xh);var Lh=f(3643);const Ah=f.n(Lh)().getParser(window.navigator.userAgent).parse(),Mh=()=>{const[e,t]=(0,il.useState)(!1);(0,il.useLayoutEffect)((()=>(r(),window.addEventListener("resize",r),()=>{window.removeEventListener("resize",r)})),[]);const r=()=>{"mobile"===Ah.parsedResult.platform.type?t(!1):t(!0)};return e},Eh=e=>{const t=t=>{t.keyCode===kn.esc&&e()};(0,il.useEffect)((()=>(window.addEventListener("keydown",t),()=>{window.removeEventListener("keydown",t)})),[])},Ph=e=>{(0,il.useEffect)((()=>{e.lang&&ka.setLang(e.lang)}),[e.lang]),(0,il.useEffect)((()=>{ka.setApiKey(e.apiKey)}),[e.apiKey]),(0,il.useEffect)((()=>{e.userId&&ka.setUserId(e.userId,e.userIdSign)}),[e.userId,e.userIdSign]),(0,il.useEffect)((()=>{e.tags&&ka.setTags(e.tags)}),[JSON.stringify(e.tags)]),(0,il.useEffect)((()=>{e.placeholders&&ka.setPlaceholders(e.placeholders)}),[JSON.stringify(e.placeholders)]),(0,il.useEffect)((()=>{e.imagePlaceholders&&ka.setImagePlaceholders(e.imagePlaceholders)}),[JSON.stringify(e.imagePlaceholders)]),(0,il.useEffect)((()=>{ka.setConfig(e)}),[])},jh=({onClickOnStory:e,onShowStory:t,onCloseStory:r,onShowSlide:i,onClickOnButton:n,onLikeStory:s,onDislikeStory:o,onFavoriteStory:a,onShareStory:l,onShareStoryWithPath:d,onFeedImpression:c,onVisibleAreaUpdated:u,onWidgetEvent:h})=>{(0,il.useEffect)((()=>(e&&ka.on("clickOnStory",e),t&&ka.on("showStory",t),r&&ka.on("closeStory",r),i&&ka.on("showSlide",i),n&&ka.on("clickOnButton",n),s&&ka.on("likeStory",s),o&&ka.on("dislikeStory",o),a&&ka.on("favoriteStory",a),l&&ka.on("shareStory",l),d&&ka.on("shareStoryWithPath",d),c&&ka.on("feedImpression",c),u&&ka.on("visibleAreaUpdated",u),h&&ka.on("widgetEvent",h),()=>{e&&ka.off("clickOnStory",e),t&&ka.off("showStory",t),r&&ka.off("closeStory",r),i&&ka.off("showSlide",i),n&&ka.off("clickOnButton",n),s&&ka.off("likeStory",s),o&&ka.off("dislikeStory",o),a&&ka.off("favoriteStory",a),l&&ka.off("shareStory",l),d&&ka.off("shareStoryWithPath",d),c&&ka.off("feedImpression",c),u&&ka.off("visibleAreaUpdated",u),h&&ka.off("widgetEvent",h)})),[e,t,r,i,n,s,o,a,l,d,c,u,h])},Ih=({commonOptions:e,gameReaderOptions:t,storyReaderOptions:r,goodsWidgetOptions:i})=>{const n=(0,il.useRef)(new Se).current,s=(0,il.useMemo)((()=>(e&&n.setCommonOptions(e),n.commonOptions)),[JSON.stringify(e)]),o=(0,il.useMemo)((()=>(t&&n.setGameReaderOptions(t),n.gameReaderOptions)),[JSON.stringify(t)]),a=(0,il.useMemo)((()=>(i&&n.setGoodsWidgetOptions(i),n.goodsWidgetOptions)),[JSON.stringify(i),null==i?void 0:i.itemClickHandler,null==i?void 0:i.openGoodsWidgetHandler]);return{commonOptions:s,gameReaderOptions:o,storyReaderOptions:(0,il.useMemo)((()=>(r&&n.setStoryReaderOptions(r),n.storyReaderOptions)),[JSON.stringify(r)]),goodsWidgetOptions:a}};var Th=function(e,t){var r={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(r[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(i=Object.getOwnPropertySymbols(e);n<i.length;n++)t.indexOf(i[n])<0&&Object.prototype.propertyIsEnumerable.call(e,i[n])&&(r[i[n]]=e[i[n]])}return r};const Rh=e=>{var{listType:t,feedSlug:r,testKey:i,storyManager:n,options:s,filter:o,useUgcCard:a=!1,hasFavorite:l,isFavorite:d}=e,c=Th(e,["listType","feedSlug","testKey","storyManager","options","filter","useUgcCard","hasFavorite","isFavorite"]);const[u,h]=(0,il.useState)(),{desktopMode:p}=kh(),{storyListOptions:f}=(e=>{const t=(0,il.useRef)(new Se).current;return{storyListOptions:(0,il.useMemo)((()=>(e&&t.setStoriesListOptions(e),t.storiesListOptions)),[JSON.stringify(e)])}})(s),g=()=>{var e;null===(e=c.onLoadStart)||void 0===e||e.call(c)},v=e=>{var t;null===(t=c.onLoadEnd)||void 0===t||t.call(c,e)};return(0,il.useEffect)((()=>{const e=n.createStoryList();return e.on("startLoading",g),e.on("endLoading",v),h(e),()=>{e.destroy()}}),[n]),(0,il.useEffect)((()=>{null==u||u.setParams({listType:t,testKey:i,feedSlug:r,filter:o,useUgcCard:a,isFavorite:d,hasFavorite:l}),d||null==u||u.loadStories({needFavorite:!0})}),[u,i,r,o]),(0,il.useEffect)((()=>{u&&(u.modeDesktop=p)}),[p,u]),{storyListViewModel:u,storyListOptions:f}};function Dh(e){return!/^(-?\d|--)/.test(e)}function Bh(e){const t=[];let r="",i="",n=7;for(let s,o=0;s=e.charAt(o);o++)if(/[a-zA-Z\d\xa0-\uffff_-]/.test(s)&&7===n)r+=s;else if("\\"===s&&7===n)n=6;else if(" "===s&&7===n){if(""!==r){if(!Dh(r))return null;t.push(r),r=""}}else if(6===n)/[0-9a-f]/i.test(s)?(i+=s,n=8):(r+=s,n=7);else{if(8!==n)return null;/[0-9a-f]/i.test(s)&&i.length<6?i+=s:(r+=String.fromCodePoint(parseInt(i,16)),r+=s,i="",n=7)}if(""!==r){if(!Dh(r))return null;t.push(r)}return t.join(" ")}function Nh(e,t){let r=t,i="";const n={"font-family":[]};for(let t,s=0;t=e.charAt(s);s+=1)if(4!==r||'"'!==t&&"'"!==t)if(3===r&&","===t)r=4,i="";else if(4===r&&","===t){const e=Bh(i);e&&n["font-family"].push(e),i=""}else if(5===r&&" "===t)/^(?:\+|-)?(?:[0-9]*\.)?[0-9]+(?:deg|grad|rad|turn)$/.test(i)?(n["font-style"]+=" "+i,i=""):s-=1,r=1;else if(1!==r||" "!==t&&"/"!==t)2===r&&" "===t?(/^(?:\+|-)?([0-9]*\.)?[0-9]+(?:em|ex|ch|rem|vh|vw|vmin|vmax|px|mm|cm|in|pt|pc|%)?$/.test(i)&&(n["line-height"]=i),r=4,i=""):i+=t;else{if(/^(?:(?:xx|x)-large|(?:xx|s)-small|small|large|medium)$/.test(i)||/^(?:larg|small)er$/.test(i)||/^(?:\+|-)?(?:[0-9]*\.)?[0-9]+(?:em|ex|ch|rem|vh|vw|vmin|vmax|px|mm|cm|in|pt|pc|%)$/.test(i))r="/"===t?2:4,n["font-size"]=i;else if(/^italic$/.test(i))n["font-style"]=i;else if(/^oblique$/.test(i))n["font-style"]=i,r=5;else if(/^small-caps$/.test(i))n["font-variant"]=i;else if(/^(?:bold(?:er)?|lighter|normal)$/.test(i))n["font-weight"]=i;else if(/^[+-]?(?:[0-9]*\.)?[0-9]+(?:e[+-]?(?:0|[1-9][0-9]*))?$/.test(i)){const e=parseFloat(i);e>=1&&e<=1e3&&(n["font-weight"]=i)}else/^(?:(?:ultra|extra|semi)-)?(?:condensed|expanded)$/.test(i)&&(n["font-stretch"]=i);i=""}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,r=3,i=""}if(3===r&&!/^\s*$/.test(i))return null;if(4===r){const e=Bh(i);e&&n["font-family"].push(e)}return n}const Fh=(e=>{var t={};return f.d(t,e),t})({default:()=>u.default});class Uh{constructor(){Object.defineProperty(this,"fontStyle",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"fontVariant",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"fontWeight",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"fontSize",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"lineHeight",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"fontFamily",{enumerable:!0,configurable:!0,writable:!0,value:void 0})}toString(){return`${this.fontStyle} ${this.fontVariant} ${this.fontWeight} ${this.fontSize}px/${this.lineHeight} ${this.fontFamily.join(", ")}`}clone(){const e=new Uh;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 Vh{constructor(e,t){Object.defineProperty(this,"obj",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"cardTitleOptions",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"cardTitleFont",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),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,t={top:0,bottom:0};try{if("number"==typeof e)t.top=e,t.bottom=e;else{const r=(0,Fh.default)(e);t.top=parseFloat(r.top),t.bottom=parseFloat(r.bottom)}}catch(e){console.error(e)}const r=this.cardTitleOptions.lineClamp,i=Math.round(this.cardTitleFont.fontSize*this.cardTitleFont.lineHeight*100)/100;return t.top+t.bottom+r*i}measureScaledFontSizeInWebView(e){const t=document.createElement("span");t.style.fontSize=e+"px",t.style.display="none",this.obj.append(t);const r=getComputedStyle(t).fontSize;return this.obj.removeChild(t),parseFloat(r)||e}isOutsideTitle(){return this.cardTitleOptions.display&&(this.cardTitleOptions.position===se.CARD_OUTSIDE_TOP||this.cardTitleOptions.position===se.CARD_OUTSIDE_BOTTOM)}getCardTitleParsedFont(e){const t=new Uh;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 r=function(e){const t=Nh(e,1);return null!==t&&t["font-size"]&&t["font-family"].length?t:null}(e);if(null!=r["font-style"]&&(t.fontStyle=r["font-style"]),null!=r["font-variant"]&&(t.fontVariant=r["font-variant"]),null!=r["font-weight"]&&(t.fontWeight=r["font-weight"]),null!=r["font-size"]){const e=parseFloat(r["font-size"]);String(`${e}px`)===r["font-size"]&&(t.fontSize=e)}if(null!=r["line-height"]){const e=parseFloat(r["line-height"]);String(`${e}px`)===r["line-height"]?t.lineHeight=Math.round(e/t.fontSize*100)/100:String(e)===r["line-height"]&&(t.lineHeight=parseFloat(r["line-height"]))}null!=r["font-family"]&&Array.isArray(r["font-family"])&&(t.fontFamily=r["font-family"])}catch(e){console.error(e)}return t}}class zh{constructor(e){Object.defineProperty(this,"storiesListOptions",{enumerable:!0,configurable:!0,writable:!0,value:e})}getStoriesListStyleOptions(e){var t,r,i,n,s,o;const a={storiesHeight:null!==(r=null===(t=this.storiesListOptions.card)||void 0===t?void 0:t.height)&&void 0!==r?r:70,storiesLayoutHeight:null!==(n=null===(i=this.storiesListOptions.layout)||void 0===i?void 0:i.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};let 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}}}var Gh=f(1938),Wh={insert:"head",singleton:!1};ol()(Gh.A,Wh);const $h=Gh.A.locals||{},Hh=({slider:e,storyListViewModel:t,storyListOptions:r,isFavorite:i,listType:n,feed:s,filter:o,storyManager:a})=>{const l=(({storyManager:e,listType:t,feed:r,filter:i})=>{const[n,s]=(0,il.useState)();return(0,il.useEffect)((()=>{const n=new Xo(e,{listType:t,feed:r,filter:i}).create();return s(n),()=>{n.destroy()}}),[r,JSON.stringify(i)]),n})({listType:n,feed:s,filter:o,storyManager:a}),d=(0,il.useCallback)(na()((()=>{if(!e||!l)return;const{x:t,y:r}=e.getCurrentPosition();l.calculate(t,r)}),300),[e,l]),c=(0,il.useCallback)((()=>{if(!e||!l)return;const t=e.elementRef.getBoundingClientRect(),r=new Wo(t.left,t.top,t.width,t.height),i=Array.from(e.slides),n=new Wo(0,0,window.innerWidth,window.innerHeight),s=u();l.updateGeometry({stories:i,storyListRect:r,windowRect:n,viewportPadding:s}),d()}),[e,l,d]);(0,il.useEffect)((()=>{if(!e||i||!l)return;const t=l.startScroll.bind(l),r=l.endScroll.bind(l);return e.addListener("scrollstart",t),e.addListener("scrollend",r),window.addEventListener("scroll",c),window.addEventListener("resize",c),()=>{e.removeListener("scrollstart",t),e.removeListener("scrollend",r),window.removeEventListener("scroll",c),window.removeEventListener("resize",c)}}),[e,i,c]),(0,il.useEffect)((()=>{i||c()}),[r.direction,r.card.aspectRatio,r.card.height,t.defaultStories.length,i,c]),(0,il.useEffect)((()=>{if(!l)return;const e=({id:e})=>l.markStoryAsFullVisible(e);return ar.on("publicEvents.showStory",e),()=>{ar.off("publicEvents.showStory",e)}}),[l,t]);const u=()=>{const e=r.sidePadding,t={left:e,right:e,top:r.topPadding,bottom:r.bottomPadding};return"vertical"===r.direction&&(t.left=0,t.right=0),t}},qh=(e,t,r)=>{const{dir:i}=kh();(0,il.useEffect)((()=>{if(e&&t.autoScrollOnStoryClose)return ar.on("closeStoryReader",n),()=>{ar.off("closeStoryReader",n)}}),[e,t.direction,t.autoScrollOnStoryClose]);const n=({id:n})=>{if(!e)return;const s=((e,t)=>e.slides.find((e=>Number(e.dataset.id)===t)))(e,n);if(!s)return;const o=(e=>{const{x:t,y:i}=e.getCurrentPosition(),n=r.current.getBoundingClientRect();return new Wo(n.x+t,n.y+i,n.width,n.height)})(e),a=((e,t)=>new Wo("ltr"===i?e.offsetLeft:t.width-e.offsetLeft-e.clientWidth,e.offsetTop,e.clientWidth,e.clientHeight))(s,o);if(a.overlaps(o))return;const l="horizontal"===t.direction?a.x:s.offsetTop;e.scrollTo(l)}},Qh=(0,il.forwardRef)(((e,t)=>{const r=e.sliderOptions.card,i=e.sliderOptions.favoriteCard,n=r.border,s=r.opened.border,o=e.sliderOptions.navigation,a=()=>{var e,t,r;return(null!==(e=s.radius)&&void 0!==e?e:n.radius)-parseFloat(null!==(t=s.width)&&void 0!==t?t:n.width)-parseFloat(null!==(r=s.gap)&&void 0!==r?r:n.gap)};return(0,tl.jsx)("div",{dir:e.dir,ref:t,className:e.className,style:Object.assign(Object.assign({},(()=>{var t,l,d,c,u,h,p,f,g,v,m,y,b,w,S,_,x,O,C,k,L;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},M={"--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":r.gap+"px","--storiesHeight":r.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":r.mask.color,"--storiesListItemOpenedMaskColor":null!==(f=r.opened.mask.color)&&void 0!==f?f:r.mask.color,"--storiesListItemMaskLinearGradient":A(r.mask),"--storiesListItemOpenedMaskLinearGradient":A(null!=(null===(v=null===(g=r.opened)||void 0===g?void 0:g.mask)||void 0===v?void 0:v.linearGradient)?r.opened.mask:r.mask),"--storiesListCardFavoriteTitle":Dn(i.title.padding.toString())?i.title.padding+"px":i.title.padding,"--storiesListCardFavoriteGap":Dn(i.gap.toString())?i.gap+"px":i.gap,"--storiesListCardUgcMaskColor":e.sliderOptions.ugcCard.mask.color,"--storiesListCardUgcMaskLinearGradient":A(e.sliderOptions.ugcCard.mask),"--storiesListItemTitleFontFamily":"InternalPrimaryFont","--storiesListItemTitleFont":r.title.font,"--storiesListItemTitlePadding":Dn(r.title.padding.toString())?r.title.padding+"px":r.title.padding,"--storiesListControlsSize":Dn(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":r.dropShadow,"--storiesListCardOpenedDropShadow":null!==(m=r.opened.dropShadow)&&void 0!==m?m:r.dropShadow,"--storiesListCardFavoriteDropShadow":e.sliderOptions.favoriteCard.dropShadow,"--storiesListCardUgcDropShadow":e.sliderOptions.ugcCard.dropShadow,"--storiesListCardMask":(null===(y=r.svgMask)||void 0===y?void 0:y.cardMask)?`url("data:image/svg+xml,${Cn(null===(b=r.svgMask)||void 0===b?void 0:b.cardMask)}")`:null,"--storiesListCardOpenedMask":(null===(w=r.opened.svgMask)||void 0===w?void 0:w.cardMask)?`url("data:image/svg+xml,${Cn(null===(S=r.opened.svgMask)||void 0===S?void 0:S.cardMask)}")`:null,"--storiesListCardFavoriteMask":(null===(_=e.sliderOptions.ugcCard.svgMask)||void 0===_?void 0:_.cardMask)?`url("data:image/svg+xml,${Cn(null===(x=e.sliderOptions.ugcCard.svgMask)||void 0===x?void 0:x.cardMask)}")`:null};let E=null;return E=null===(O=r.svgMask)||void 0===O?void 0:O.overlayMask,null!=E&&Array.isArray(E)&&E.forEach(((e,t)=>M[`--storiesListCardOverlay${t}Mask`]=e.mask?`url("data:image/svg+xml,${Cn(e.mask)}")`:null)),E=null===(C=r.opened.svgMask)||void 0===C?void 0:C.overlayMask,null!=E&&Array.isArray(E)&&E.forEach(((e,t)=>M[`--storiesListCardOpenedOverlay${t}Mask`]=e.mask?`url("data:image/svg+xml,${Cn(e.mask)}")`:null)),E=null===(k=e.sliderOptions.favoriteCard.svgMask)||void 0===k?void 0:k.overlayMask,null!=E&&Array.isArray(E)&&E.forEach(((e,t)=>M[`--storiesListCardFavoriteOverlay${t}Mask`]=e.mask?`url("data:image/svg+xml,${Cn(e.mask)}")`:null)),E=null===(L=e.sliderOptions.ugcCard.svgMask)||void 0===L?void 0:L.overlayMask,null!=E&&Array.isArray(E)&&E.forEach(((e,t)=>M[`--storiesListCardUgcOverlay${t}Mask`]=e.mask?`url("data:image/svg+xml,${Cn(e.mask)}")`:null)),M})()),e.style),children:e.children})})),Kh=navigator.vendor&&navigator.vendor.indexOf("Apple")>-1&&navigator.userAgent&&-1==navigator.userAgent.indexOf("CriOS")&&-1==navigator.userAgent.indexOf("FxiOS"),Yh=({videoCoverSrc:e,onVideoCoverLoaded:t})=>{const r=(0,il.useRef)(null);return(0,il.useEffect)((()=>{(()=>{if(!e)return;const i=r.current,n=()=>{i.play().then((()=>{if(Kh){let e=1;const r=()=>{e>=2&&(i.removeEventListener("timeupdate",r),i.currentTime=0,t()),e++};i.addEventListener("timeupdate",r,!1)}else t()})).catch((e=>{console.error(e)})),i.removeEventListener("canplaythrough",n)};i.addEventListener("canplaythrough",n),i.load()})()}),[]),(0,tl.jsx)("video",{ref:r,src:e,loop:!0,muted:!0,playsInline:!0,"webkit-playsinline":"true",preload:"auto"})},Zh=({story:e,cardOptions:t,favoriteCardOptions:r,ugcCardOptions:i})=>{const n=(e,t)=>null!=t&&Array.isArray(t)?t.map(((t,r)=>s(t,e,r))):[],s=(e,t,r)=>({maskImage:`var(--${t}${r}Mask)`,WebKitMaskImage:`var(--${t}${r}Mask)`,background:e.background});return{getAllCardsOverlayMaskStyles:()=>{let s=[];var o;return e.isFavoriteCard&&(s=s.concat(n("storiesListCardFavoriteOverlay",null===(o=r.svgMask)||void 0===o?void 0:o.overlayMask))),s=e.isUgcCard?s.concat((()=>{var e;return n("storiesListCardUgcOverlay",null===(e=i.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 Xh=f(2811),Jh={insert:"head",singleton:!1};ol()(Xh.A,Jh);const ep=Xh.A.locals||{},tp=({story:e,cardOptions:t,favoriteCardOptions:r,ugcCardOptions:i,wrapperStyle:n,children:s,onClick:o})=>{const a={story:e,cardOptions:t,favoriteCardOptions:r,ugcCardOptions:i},[l,d]=(0,il.useState)(!1),{getAllCardsOverlayMaskStyles:c}=Zh(a),{getCardTitleAlignClass:u,getTitleStyle:h,getTitleWrapperStyle:p}=(({story:e,cardOptions:t,favoriteCardOptions:r,ugcCardOptions:i})=>{const{dir:n}=kh();return{getCardTitleAlignClass:()=>{const e=t.title.textAlign,r=e===ne.START||e===ne.LEFT,i=e===ne.END||e===ne.RIGHT,s="ltr"===n;return{[ep["align-left"]]:r&&s||i&&!s,[ep["align-center"]]:e===ne.CENTER,[ep["align-right"]]:i&&s||r&&!s}},getTitleStyle:()=>{const r={};return e.titleColor&&t.title.position===se.CARD_INSIDE_BOTTOM&&Object.assign(r,{color:e.titleColor}),r.WebkitLineClamp=String(parseInt(t.title.lineClamp)),r},getTitleWrapperStyle:()=>{let t={};return e.titleColor&&e.isFavoriteCard&&(t=Object.assign(Object.assign({},t),{color:r.title.color})),e.titleColor&&e.isUgcCard&&(t=Object.assign(Object.assign({},t),{color:i.title.color})),t}}})(a),{getSlideClassList:f,getSlideStyleList:g,getSlideWrapperStyle:v}=(({story:e,cardOptions:t,favoriteCardOptions:r,ugcCardOptions:i})=>{var n;const s=null!==(n=t.aspectRatio)&&void 0!==n?n:e.getAspectRatio(t.variant);return{getSlideClassList:()=>{var n,s;const o=e.background;let a="";void 0!==o&&(a=ep[`_background-color-${o.color}`+(!0===o.gradient?"-gradient":"")]);const l=(()=>{let n;return n=e.isFavoriteCard?r:e.isUgcCard?i: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,{[ep["_is-read"]]:e.isOpened},{[ep["_format-rectangle"]]:t.variant===fe.STYLE_RECTANGLE},{[ep["_format-circle"]]:t.variant===fe.STYLE_CIRCLE},{[ep["_format-quad"]]:t.variant===fe.STYLE_QUAD},{[ep["_favorite-cell"]]:e.isFavoriteCard},{[ep["_ugc-cell"]]:e.isUgcCard},{[ep["_has-drop-shadow"]]:d},{[ep["_has-card-svg-mask"]]:c},{[ep["_has-border-gradient-color"]]:u}]},getSlideStyleList:()=>{const r={width:s*t.height+"px",opacity:null!==t.opacity?t.opacity:1,boxShadow:t.boxShadow||"unset",height:`${t.height}px`};return e.isOpened&&(r.boxShadow=t.opened.boxShadow||r.boxShadow,r.opacity=null!==t.opened.opacity?t.opened.opacity:r.opacity),r},getSlideWrapperStyle:()=>{const e={};return e.width=s*t.height+"px",e}}})(a),m=e.getImageSrcByCoverQuality(t.coverQuality),y=t.title.position===se.CARD_INSIDE_BOTTOM,b=t.title.position===se.CARD_OUTSIDE_TOP,w=t.title.position===se.CARD_OUTSIDE_BOTTOM;return(0,tl.jsxs)("a",{"data-id":e.id,className:(0,nl.default)(ep["stories-slide-wrapper"],{[ep.isTitleCardOutsideTop]:b,[ep.isTitleCardOutsideBottom]:w}),style:Object.assign(Object.assign({},v()),n),rel:"noreferrer",onClick:t=>{t.stopPropagation(),t.preventDefault(),o(e)},children:[t.title.display&&b&&(0,tl.jsx)("div",{className:(0,nl.default)(ep["stories-slide__content"],ep.__position_outside_top),style:p(),children:(0,tl.jsx)("div",{className:(0,nl.default)(ep["stories-slide__title"],ep.clamp,u()),style:h(),children:e.title})}),(0,tl.jsxs)("div",{className:(0,nl.default)(ep["stories-slide"],f()),style:g(),children:[(0,tl.jsxs)("div",{className:ep["stories-slide__inner"],children:[(0,tl.jsx)("div",{className:ep["stories-slide-image"],style:{backgroundColor:e.backgroundColor?e.backgroundColor:"transparent"},children:(0,tl.jsx)("div",{className:ep["stories-slide-image__wrap"],children:(0,tl.jsxs)("div",{className:(0,nl.default)(ep["stories-slide-image__image"],ep._mode_list,{[ep["video-loaded"]]:l,[ep["ugc-card-cell"]]:e.isUgcCard}),children:[m&&(0,tl.jsx)("img",{src:m,alt:e.title,loading:t.coverLazyLoading?"lazy":"eager"}),e.videoCoverSrc&&(0,tl.jsx)(Yh,{onVideoCoverLoaded:()=>d(!0),videoCoverSrc:e.videoCoverSrc}),s]})})}),(0,tl.jsx)("div",{className:ep["stories-slide__mask"]}),t.title.display&&y&&(0,tl.jsx)("div",{className:ep["stories-slide__content"],style:p(),children:(0,tl.jsx)("div",{className:(0,nl.default)(ep["stories-slide__title"],ep.clamp,u()),style:h(),children:e.title})})]}),c().map(((e,t)=>(0,tl.jsx)("div",{style:e,className:ep["card-overlay-svg-mask"]},t)))]}),t.title.display&&w&&(0,tl.jsx)("div",{className:(0,nl.default)(ep["stories-slide__content"],ep.__position_outside_bottom),style:p(),children:(0,tl.jsx)("div",{className:(0,nl.default)(ep["stories-slide__title"],ep.clamp,u()),style:h(),children:e.title})})]})};var rp=f(2731),ip={insert:"head",singleton:!1};ol()(rp.A,ip);const np=rp.A.locals||{};var sp=function(e,t){var r={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(r[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(i=Object.getOwnPropertySymbols(e);n<i.length;n++)t.indexOf(i[n])<0&&Object.prototype.propertyIsEnumerable.call(e,i[n])&&(r[i[n]]=e[i[n]])}return r};const op=e=>{var{sliderDirection:t,slider:r}=e,i=sp(e,["sliderDirection","slider"]);const[n,s]=(0,il.useState)(!0),[o,a]=(0,il.useState)(!0),l=i.navigationOptions.speed;(0,il.useEffect)((()=>(r.on("reachStart",d),r.on("reachEnd",c),()=>{r.off("reachStart",d),r.off("reachEnd",c)})),[r]);const d=()=>{s(r.reachStart)},c=()=>{a(r.reachEnd)};return i.navigationView?i.navigationView({dir:i.dir,defaultStyles:np,reachStart:n,reachEnd:o,onPrev:()=>r.scrollByDirection(-1,l),onNext:()=>r.scrollByDirection(1,l),slider:{direction:t,viewport:r.elementRef.getBoundingClientRect()}}):i.navigationOptions.showControls?(0,tl.jsxs)("div",{className:(0,nl.default)(np["stories-list-controls"],np[t]),children:[(0,tl.jsx)("div",{onClick:()=>r.scrollByDirection(-1,l),className:(0,nl.default)(np["control-start"],{[np["control-start_dir_rtl"]]:"rtl"===i.dir,[np["control-start_reach-start"]]:n}),children:(0,tl.jsx)("div",{className:np["control-icon"]})}),(0,tl.jsx)("div",{onClick:()=>r.scrollByDirection(1,l),className:(0,nl.default)(np["control-end"],{[np["control-end_dir_rtl"]]:"rtl"===i.dir,[np["control-end_reach-end"]]:o}),children:(0,tl.jsx)("div",{className:np["control-icon"]})})]}):null};var ap=f(7533),lp={insert:"head",singleton:!1};ol()(ap.A,lp);const dp=ap.A.locals||{},cp=({favoriteStories:e,cardOptions:t,favoriteCardOptions:r})=>{const i=e=>{var r;return{paddingTop:1/(null!==(r=t.aspectRatio)&&void 0!==r?r:e.getAspectRatio(t.variant))*100+"%"}},n=e=>{const t=e.getImageSrcByCoverQuality(r.coverQuality),i={};return t?i.backgroundImage=`url('${t}')`:i.backgroundColor=e.backgroundColor,i};return(0,tl.jsx)("div",{className:dp["favorite-images-wrapper"],children:e.slice(0,4).map(((e,r)=>(0,tl.jsx)("div",{className:dp["favorite-image-wrapper"],children:(0,tl.jsx)("div",{style:i(e),className:(0,nl.default)(dp["favorite-image"],{[dp.circle_style]:t.variant===fe.STYLE_CIRCLE}),children:(0,tl.jsx)("div",{className:dp["favorite-image-item"],style:n(e)})})},r)))})};var up=function(e,t){var r={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(r[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(i=Object.getOwnPropertySymbols(e);n<i.length;n++)t.indexOf(i[n])<0&&Object.prototype.propertyIsEnumerable.call(e,i[n])&&(r[i[n]]=e[i[n]])}return r};const hp=(0,Yl.observer)((0,il.forwardRef)(((e,t)=>{var{isFavorite:r=!1,storyListViewModel:i}=e,n=up(e,["isFavorite","storyListViewModel"]);const s=(0,il.useRef)(null),o=(0,il.useRef)(null);((e,t)=>{(0,il.useImperativeHandle)(e,(()=>({reload:t.reload.bind(t)})),[t])})(t,i);const a=((e,t)=>{const[r,i]=(0,il.useState)(t);(0,il.useLayoutEffect)((()=>{const r=e.current;n(r,t),i(t)}),[JSON.stringify(t)]);const n=(e,t)=>{const r=new Vh(e,t.card.title);s(r,t),o(r,t)},s=(e,t)=>{const r=e.getCardTitleFont();r.fontSize=e.getScaledFontSizeInWebView(),t.card.title.font=r.toString()},o=(e,t)=>{const r=new zh(t),{storiesListHeight:i,storiesListInnerHeight:n}=r.getStoriesListStyleOptions(e.getStoryTitleBlockHeight()),s=t.layout.height;t.layout.height=Ut()(s)?`${i}px`:s};return r})(s,n.storyListOptions),l=(({isFavorite:e,storyListViewModel:t,storyListOptions:r})=>{let i=[];return e?i=t.favoriteStories.slice():(i=t.defaultStories.slice(),t.hasFavoriteCard&&i.push(zo.create(t,r.favoriteCard)),t.hasUgcCard&&i.unshift(Go.create(t,r.ugcCard))),i})({isFavorite:r,storyListViewModel:i,storyListOptions:a}),{sliderRef:d,slider:c,isScrolling:u}=((e,t)=>{const{dir:r,desktopMode:i}=kh(),n=(0,il.useRef)(),s=(0,il.useRef)(null),[o,a]=(0,il.useState)(!1),[l,d]=(0,il.useState)(null),c=()=>{clearTimeout(n.current),a(!0)},u=()=>{n.current=setTimeout((()=>a(!1)),100)};(0,il.useEffect)((()=>{if(!s.current)return;const e=new la;return e.mount(s.current),d(e),e.on("scrollstart",c),e.on("scrollend",u),()=>{e.destroy(),e.off("scrollstart",c),e.off("scrollend",u)}}),[]),(0,il.useEffect)((()=>{l&&(l.setGap(e.card.gap),l.setDesktopMode(i),l.changeDirection(e.direction))}),[l,e.card.gap,i,e.direction]),(0,il.useEffect)((()=>{l&&(l.setTextDirection(r),l.scrollTo(0,0))}),[l,r]);const h=(0,il.useCallback)((()=>{null==l||l.testAttraction()}),[l,t]);return(0,il.useEffect)((()=>(null==l||l.scrollTo(0,0),h(),window.addEventListener("resize",h),()=>{window.addEventListener("resize",h)})),[l,h]),{sliderRef:s,slider:l,isScrolling:o}})(a,l.length);Hh({slider:c,storyListViewModel:i,storyListOptions:a,isFavorite:r,listType:n.listType,feed:n.feedSlug,filter:n.filter,storyManager:n.storyManager}),qh(c,a,o);const{getRootStyle:h,getStoryWrapperStyle:p,viewportInnerClassList:f,viewportInnerStyle:g}=(e=>{const{dir:t,desktopMode:r}=kh();return{getRootStyle:()=>({"--background-color":e.layout.backgroundColor,paddingLeft:e.sidePadding+"px",paddingRight:e.sidePadding+"px","--storiesListTopPadding":e.topPadding+"px","--storiesListBottomPadding":e.bottomPadding+"px","--storiesListSidePadding":e.sidePadding+"px",backgroundColor:e.layout.backgroundColor}),getStoryWrapperStyle:(t,r)=>{const i={marginRight:"0",paddingLeft:"0",paddingRight:"0"};return"vertical"===e.direction||(t!==r-1?i.marginRight=e.card.gap+"px":i.paddingRight=e.sidePadding+"px",0===t&&(i.paddingLeft=e.sidePadding+"px")),i},viewportInnerClassList:r?(0,nl.default)($h["stories-list__viewport-inner"],$h["mode-desktop"],{[$h["with-list-controls"]]:e.navigation.showControls,[$h.isTitleCardOutsideTop]:e.card.title.position===se.CARD_OUTSIDE_TOP,[$h.isTitleCardOutsideBottom]:e.card.title.position===se.CARD_OUTSIDE_BOTTOM,[$h.isVerticalDirection]:"vertical"===e.direction}):(0,nl.default)($h["stories-list__viewport-inner"],Object.assign(Object.assign({},(()=>{const r=e.layout.sliderAlign,i=r===re.START||r===re.LEFT,n=r===re.END||r===re.RIGHT,s="ltr"===t;return{[$h["align-left"]]:i&&s||n&&!s,[$h["align-center"]]:r===re.CENTER,[$h["align-right"]]:n&&s||i&&!s}})()),{[$h.isTitleCardOutsideTop]:e.card.title.position===se.CARD_OUTSIDE_TOP,[$h.isTitleCardOutsideBottom]:e.card.title.position===se.CARD_OUTSIDE_BOTTOM,[$h.isVerticalDirection]:"vertical"===e.direction})),viewportInnerStyle:{height:e.layout.height,gap:"vertical"===e.direction?`${e.card.gap}px`:0}}})(a),v=a.card,m=a.favoriteCard,y=a.ugcCard;return(0,tl.jsxs)(Qh,{className:(0,nl.default)($h["stories-list-wrapper"],{[$h["mode-desktop"]]:i.modeDesktop,[$h["with-list-controls"]]:a.navigation.showControls}),dir:n.dir,style:h(),sliderOptions:a,ref:s,children:[(0,tl.jsx)("div",{className:$h["stories-list"],children:(0,tl.jsx)("div",{ref:o,className:(0,nl.default)($h["stories-list__viewport"],{[$h["mode-desktop"]]:i.modeDesktop}),style:"horizontal"===a.direction?{marginLeft:-a.sidePadding+"px",marginRight:-a.sidePadding+"px"}:{},children:(0,tl.jsx)("div",{ref:d,className:f,style:g,children:l.map(((e,t)=>{var r;const s=e instanceof Uo,o=n.storyCardView&&!s;return s&&n.favoriteCardView?(0,tl.jsx)(il.default.Fragment,{children:n.favoriteCardView(e)},t):(0,tl.jsx)(il.default.Fragment,{children:o?null===(r=n.storyCardView)||void 0===r?void 0:r.call(n,e):(0,tl.jsx)(tp,{story:e,cardOptions:v,favoriteCardOptions:m,ugcCardOptions:y,wrapperStyle:p(t,l.length),onClick:()=>((e,t)=>{var r,s,o;u||(null===(r=n.onStoryCardClick)||void 0===r||r.call(n,e),e.isUgcCard?null===(s=n.onUgcCardClick)||void 0===s||s.call(n):e.isFavoriteCard?null===(o=n.onFavoriteCardClick)||void 0===o||o.call(n):i.onStoryClick(e,t))})(e,t),children:s&&(0,tl.jsx)(cp,{favoriteStories:i.favoriteStories,favoriteCardOptions:a.favoriteCard,cardOptions:v})},t)},t)}))})})}),c&&(0,tl.jsx)(op,{dir:n.dir,navigationOptions:a.navigation,navigationView:n.navigationView,sliderDirection:a.direction,storiesLength:l.length,slider:c})]})}))),pp=(0,Yl.observer)((0,il.forwardRef)(((e,t)=>{var r,i,n;const{storyManager:s,dir:o}=kh(),a=null!==(r=e.feedSlug)&&void 0!==r?r:"default",l=We.DEFAULT,{storyListViewModel:d,storyListOptions:c}=Rh(Object.assign(Object.assign({},e),{storyManager:s,feedSlug:a,listType:l,hasFavorite:Boolean(e.hasFavorite),isFavorite:!1}));return d&&(null===(i=d.session)||void 0===i?void 0:i.session.id)?(0,tl.jsx)(hp,Object.assign({},e,{dir:o,storyManager:s,feedSlug:null!==(n=e.feedSlug)&&void 0!==n?n:"default",listType:We.DEFAULT,storyListViewModel:d,storyListOptions:c,onStoryCardClick:e.onStoryCardClick,onFavoriteCardClick:()=>{var t;s.emit("clickOnFavoriteCell",{feed:a}),null===(t=e.onFavoriteCardClick)||void 0===t||t.call(e)},ref:t})):null}))),fp=(0,Yl.observer)((0,il.forwardRef)(((e,t)=>{var r;const{storyManager:i,dir:n}=kh(),s=Oa,o=We.UGC,{storyListViewModel:a,storyListOptions:l}=Rh(Object.assign(Object.assign({},e),{storyManager:i,feedSlug:s,listType:o,isFavorite:!1,hasFavorite:!1}));return a&&(null===(r=a.session)||void 0===r?void 0:r.session.id)?(0,tl.jsx)(hp,Object.assign({},e,{ref:t,dir:n,storyListOptions:l,storyManager:i,listType:We.UGC,feedSlug:Oa,storyListViewModel:a,onStoryCardClick:e.onStoryCardClick})):null}))),gp=e=>{const{storyManager:t,dir:r}=kh(),i="default",n=We.DEFAULT,{storyListViewModel:s,storyListOptions:o}=Rh(Object.assign(Object.assign({},e),{storyManager:t,feedSlug:i,listType:n,isFavorite:!0,hasFavorite:!0}));return s?(0,tl.jsx)(hp,Object.assign({},e,{storyListOptions:o,storyManager:t,dir:r,feedSlug:i,listType:n,storyListViewModel:s,isFavorite:!0})):null};var vp=f(2432),mp={insert:"head",singleton:!1};ol()(vp.A,mp);const yp=vp.A.locals||{},bp=({open:e,options:t,storyListOptions:r,onClose:i})=>{var n,s;const{dir:o}=kh();(0,il.useLayoutEffect)((()=>{if(!e)return;const t=document.documentElement.style.overflow;return document.documentElement.style.overflow="hidden",()=>{document.documentElement.style.overflow=t}}),[e]);return e?(0,tl.jsx)("div",{className:yp["favorite-story-list-modal"],style:(()=>{var e,r,i,n;return{"--storiesFavoriteTitleColor":t.title.color,"--storiesFavoriteTitleFontFamily":"InternalPrimaryFont","--storiesFavoriteTitleFont":t.title.font,"--storiesFavoriteTitleBackgroundColor":t.title.backgroundColor,"--storiesFavoriteHeaderTopOffset":parseFloat(null!==(r=null===(e=t.headerTopOffset)||void 0===e?void 0:e.toString())&&void 0!==r?r:"0")+"px","--storiesFavoriteBottomOffset":parseFloat(null!==(n=null===(i=t.bottomOffset)||void 0===i?void 0:i.toString())&&void 0!==n?n:"0")+"px","--storiesFavoriteBackgroundColor":t.backgroundColor}})(),children:(0,tl.jsxs)("div",{className:yp.container,children:[(0,tl.jsxs)("div",{className:yp.header,children:[(0,tl.jsx)("p",{className:yp.title,children:t.title.content}),(0,tl.jsx)("button",{onClick:e=>{e.preventDefault(),e.stopPropagation(),i()},className:yp["header__close-btn"],style:(()=>{const e="start"===t.closeButtonPosition||"left"===t.closeButtonPosition,r="ltr"===o;return{[e&&r||!e&&!r?"left":"right"]:"10px"}})(),dangerouslySetInnerHTML:{__html:null!==(s=null===(n=t.closeButton)||void 0===n?void 0:n.svgSrc.baseState)&&void 0!==s?s:""}})]}),(0,tl.jsx)("div",{className:yp.content,children:(0,tl.jsx)("div",{className:yp["favorite-story-list"],children:(0,tl.jsx)(gp,{options:Object.assign(Object.assign(Object.assign({},r),{sidePadding:0}),{direction:ae.COLUMN,layout:{height:"auto"}})})})}),(0,tl.jsx)("div",{className:yp.footer}),(0,tl.jsx)("div",{className:yp["bottom-offset"]})]})}):null},wp=({storyList:e,onStoryCardClick:t,onFavoriteCardClick:r})=>{const[i,n]=(0,il.useState)(e.appearanceManager.storiesListOptions),s=(0,il.useRef)(null);return(0,il.useEffect)((()=>{e.api=s.current}),[]),(0,il.useEffect)((()=>(e.appearanceManager.on(Z.EVENT_UPDATED_STORIES_LIST_OPTIONS,n),()=>{e.appearanceManager.off(Z.EVENT_UPDATED_STORIES_LIST_OPTIONS,n)})),[e.appearanceManager]),(0,Zl.createPortal)((0,tl.jsx)(pp,{ref:s,options:i,hasFavorite:e.appearanceManager.commonOptions.hasFavorite,testKey:e.testKey,useUgcCard:e.useUgcCard,feedSlug:e.feedSlug,onLoadStart:()=>{e.emit(le.START_LOADER)},onLoadEnd:t=>{e.emit(le.END_LOADER,t)},onUgcCardClick:()=>{e.ugcCardClickHandler()},onFavoriteCardClick:r,onStoryCardClick:t},e.mountSelector),document.querySelector(e.mountSelector))},Sp=({ugcStoryList:e,onStoryCardClick:t})=>{const[r,i]=(0,il.useState)(e.appearanceManager.storiesListOptions),n=(0,il.useRef)(null);return(0,il.useEffect)((()=>{e.api=n.current}),[]),(0,il.useEffect)((()=>(e.appearanceManager.on(Z.EVENT_UPDATED_STORIES_LIST_OPTIONS,i),()=>{e.appearanceManager.off(Z.EVENT_UPDATED_STORIES_LIST_OPTIONS,i)})),[e.appearanceManager]),(0,Zl.createPortal)((0,tl.jsx)(fp,{ref:n,options:r,testKey:e.testKey,useUgcCard:e.useUgcCard,onStoryCardClick:t,onLoadStart:()=>{e.emit(le.START_LOADER)},onLoadEnd:t=>{e.emit(le.END_LOADER,t)},onUgcCardClick:()=>{e.ugcCardClickHandler()}}),document.querySelector(e.mountSelector))},_p=e=>{const[t,r]=(0,il.useState)(!1);return(0,tl.jsxs)(Ch,{config:e.storyManagerConfigDto,storyReaderOptions:e.appearanceManager.storyReaderOptions,commonOptions:e.appearanceManager.commonOptions,gameReaderOptions:e.appearanceManager.gameReaderOptions,goodsWidgetOptions:e.appearanceManager.goodsWidgetOptions,children:[e.storyLists.map((t=>(0,tl.jsx)(wp,{onFavoriteCardClick:()=>{r(!0)},onStoryCardClick:()=>{e.onAppearanceManagerChange(t.appearanceManager)},storyList:t},t.mountSelector))),e.ugcStoryLists.map((t=>(0,tl.jsx)(Sp,{ugcStoryList:t,onStoryCardClick:()=>{e.onAppearanceManagerChange(t.appearanceManager)}},t.mountSelector))),(0,tl.jsx)(bp,{open:t,onClose:()=>r(!1),options:e.appearanceManager.storyFavoriteReaderOptions,storyListOptions:e.appearanceManager.storiesListOptions})]})};class xp{constructor(){Object.defineProperty(this,"root",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"storyManagerConfigDto",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"storyLists",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"ugcStoryLists",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"appearanceManager",{enumerable:!0,configurable:!0,writable:!0,value:new Se}),this.createAppRoot(),this.handleAppearanceManagerUpdate=this.handleAppearanceManagerUpdate.bind(this),this.setAppearanceManager=this.setAppearanceManager.bind(this)}setStoryList(e){this.storyLists=e.slice(),this.render()}setUGCStoryList(e){this.ugcStoryLists=e.slice(),this.render()}setStoryManagerConfig(e){this.storyManagerConfigDto=Object.assign(Object.assign({},this.storyManagerConfigDto),e),this.render()}setAppearanceManager(e){this.unscubscribeToAppearanceManagerEvents(),this.appearanceManager=e,this.subscribeToAppearanceManagerEvents(),this.render()}render(){this.root.render((0,tl.jsx)(_p,{storyManagerConfigDto:this.storyManagerConfigDto,appearanceManager:this.appearanceManager,ugcStoryLists:this.ugcStoryLists,storyLists:this.storyLists,onAppearanceManagerChange:this.setAppearanceManager}))}createAppRoot(){const e=document.createElement("div");e.id="ias-app",document.body.append(e),this.root=(0,rl.createRoot)(e)}subscribeToAppearanceManagerEvents(){this.appearanceManager.on(Z.UPDATE,this.handleAppearanceManagerUpdate)}unscubscribeToAppearanceManagerEvents(){this.appearanceManager.off(Z.UPDATE,this.handleAppearanceManagerUpdate)}handleAppearanceManagerUpdate(){this.render()}}var Op=function(e,t,r,i){return new(r||(r=Promise))((function(n,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}l((i=i.apply(e,t||[])).next())}))};class Cp extends J.EventEmitter{constructor(e,t,r,i,n){super(),Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"app",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(this,"sharePage",{enumerable:!0,configurable:!0,writable:!0,value:null}),Ya(t),this.showSharePage(e,t,n)}showSharePage(e,t,r){return Op(this,void 0,void 0,(function*(){this.app.setAppearanceManager(t),this.sharePage=yield this.storyManager.showSharePage(e,r)}))}closeStoryReader(){return Op(this,void 0,void 0,(function*(){var e;null===(e=this.sharePage)||void 0===e||e.closeStoryReader()}))}}var kp=function(e,t,r,i){return new(r||(r=Promise))((function(n,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}l((i=i.apply(e,t||[])).next())}))};class Lp extends(ee()){constructor(e,t,r,i){super(),Object.defineProperty(this,"appearanceManager",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"options",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"app",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(this,"stackedStoryListViewModel",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Ya(e),this.handleUpdate=this.handleUpdate.bind(this),this.stackedStoryListViewModel=new _a(this.storyManager,{feed:t.feed}),this.stackedStoryListViewModel.on("update",this.handleUpdate)}get stories(){return this.stackedStoryListViewModel.stories}get length(){return this.stackedStoryListViewModel.length}get activeIndex(){return this.stackedStoryListViewModel.activeIndex}get feedCoverSrc(){return this.stackedStoryListViewModel.feedCoverSrc}get top(){return this.stackedStoryListViewModel.top}reload(){return kp(this,void 0,void 0,(function*(){return this.stackedStoryListViewModel.reload()}))}destroy(){this.stackedStoryListViewModel.destroy(),this.stackedStoryListViewModel.removeAllListeners()}showStory(e){this.app.setAppearanceManager(this.appearanceManager),this.stackedStoryListViewModel.showStory(e)}on(e,t){return"update"===e?super.on(e,t):(this.stackedStoryListViewModel.on(e,t),this)}once(e,t){return this.stackedStoryListViewModel.once(e,t),this}off(e,t){return this.stackedStoryListViewModel.off(e,t),this}handleUpdate(e){this.emit("update",{id:e.id,title:e.title,titleColor:e.titleColor,hasAudio:e.hasAudio,hasSwipeUp:e.hasSwipeUp,isOpened:e.isOpened,deeplink:e.deeplink,gameInstanceId:e.gameInstanceId,hideInReader:e.hideInReader,hide_timeline:e.hideTimeline,cover:e.getCover(this.appearanceManager.storiesListOptions.card.coverQuality)})}}var Ap=function(e,t,r,i){return new(r||(r=Promise))((function(n,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}l((i=i.apply(e,t||[])).next())}))};class Mp{constructor(e){return Object.defineProperty(this,"storyManagerConfigDto",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"app",{enumerable:!0,configurable:!0,writable:!0,value:new xp}),Object.defineProperty(this,"StoriesList",{enumerable:!0,configurable:!0,writable:!0,value:class extends Xa{constructor(e,t,r){super(e,t,r,Mp.instance.app)}}}),Object.defineProperty(this,"UGCStoriesList",{enumerable:!0,configurable:!0,writable:!0,value:class extends el{constructor(e,t,r){super(e,t,r,Mp.instance.app)}}}),Object.defineProperty(this,"SharePage",{enumerable:!0,configurable:!0,writable:!0,value:class extends Cp{constructor(e,t,r){super(e,t,ka,Mp.instance.app,r)}}}),Object.defineProperty(this,"StackedStoryList",{enumerable:!0,configurable:!0,writable:!0,value:class extends Lp{constructor(e,t){super(e,t,ka,Mp.instance.app)}}}),Mp.instance?(console.warn("StoryManager singleton is created multiple times\nuse IAS.StoryManager.getInstance() instead"),Mp.instance):(Mp.instance=this,this.app.setStoryManagerConfig(e),Mp.instance)}get sdkVersionName(){return ka.sdkVersionName}get sdkVersionCode(){return ka.sdkVersionCode}set storyLinkClickHandler(e){ka.storyLinkClickHandler=e}static getInstance(){return Mp.instance?Mp.instance:null}static use(e,t){ka.use(e,t)}getConfig(){return ka.getConfig()}showOnboardingStories(e,t){return Ap(this,void 0,void 0,(function*(){return Ya(e),this.app.setAppearanceManager(e),ka.showOnboardingStories(t)}))}showStory(e,t){return Ap(this,void 0,void 0,(function*(){Ya(t),this.app.setAppearanceManager(t),yield ka.showStory(e)}))}showStoryOnce(e,t){return Ap(this,void 0,void 0,(function*(){return Ya(t),this.app.setAppearanceManager(t),ka.showStoryOnce(e)}))}closeAllReaders(){ka.closeAllReaders()}openGame(e,t){return Ap(this,arguments,void 0,(function*(e,t,r={}){return Ya(t),this.app.setAppearanceManager(t),ka.openGame(e,r)}))}closeGame(){return Ap(this,void 0,void 0,(function*(){return ka.closeGame()}))}closeStoryReader(){return Ap(this,void 0,void 0,(function*(){return ka.closeStoryReader()}))}getUgcEditorConfig(){return ka.getUgcEditorConfig()}closeGoodsWidget(){ka.closeGoodsWidget()}setLang(e){this.storyManagerConfigDto.lang=e,this.app.setStoryManagerConfig(this.storyManagerConfigDto)}getNonce(){return Xt()}setUserId(e,t){return Ap(this,void 0,void 0,(function*(){this.storyManagerConfigDto.userId=e,this.storyManagerConfigDto.userIdSign=t,this.app.setStoryManagerConfig(this.storyManagerConfigDto)}))}setTags(e){this.storyManagerConfigDto.tags=e,this.app.setStoryManagerConfig(this.storyManagerConfigDto)}setPlaceholders(e){this.storyManagerConfigDto.placeholders=e,this.app.setStoryManagerConfig(this.storyManagerConfigDto)}setImagePlaceholders(e){this.storyManagerConfigDto.imagePlaceholders=e,this.app.setStoryManagerConfig(this.storyManagerConfigDto)}on(e,t){return ka.on(e,t),this}once(e,t){return ka.once(e,t),this}off(e,t){return ka.off(e,t),this}destroy(){ka.destroy()}}})();var v=g.hS,m=g.KL,y=g.Yb,b=g.Tg,w=g.WH,S=g.lV,_=g.ws,x=g.Jf,O=g.SK,C=g.tI,k=g.Uy,L=g.SP,A=g.Jj,M=g.pt,E=g.nN,P=g.mk,j=g.ex,I=g.Bq,T=g.I7,R=g.yx,D=g.qz,B=g.KO;export{v as AppearanceCommonOptionsDefault,m as AppearanceManager,y as CloseButtonPosition,b as GameReaderOptionsDefault,w as GoodsWidgetOptionsDefault,S as GoodsWidgetRenderingType,_ as SharePageEvents,x as SharePanelDefault,O as StoriesListCardCoverQuality,C as StoriesListCardTitlePosition,k as StoriesListCardTitleTextAlign,L as StoriesListCardViewVariant,A as StoriesListDirection,M as StoriesListEvents,E as StoriesListOptionsDefault,P as StoriesListSliderAlign,j as StoryFavoriteReaderOptionsDefault,I as StoryManager,T as StoryManagerConfigDefault,R as StoryReaderOptionsDefault,D as StoryReaderSwipeStyle,B as WidgetStoriesOptions};
|
|
31
|
+
var i=r(1649),n=r(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=i.useRef,l=i.useEffect,d=i.useMemo,c=i.useDebugValue;t.useSyncExternalStoreWithSelector=function(e,t,r,i,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=i(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 r=i(e);return void 0!==n&&n(t,r)?(o=e,t):(o=e,a=r)}var o,a,l=!1,d=void 0===r?null:r;return[function(){return e(t())},null===d?void 0:function(){return e(d())}]}),[t,r,i,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,r)=>{e.exports=r(3296)},7121:(e,t,r)=>{e.exports=r(1435)},1649:t=>{t.exports=e},37:e=>{e.exports=t}},p={};function f(e){var t=p[e];if(void 0!==t)return t.exports;var r=p[e]={id:e,loaded:!1,exports:{}};return h[e].call(r.exports,r,r.exports,f),r.loaded=!0,r.exports}f.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return f.d(t,{a:t}),t},f.d=(e,t)=>{for(var r in t)f.o(t,r)&&!f.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},f.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),f.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),f.nmd=e=>(e.paths=[],e.children||(e.children=[]),e),f.nc=void 0;var g={};(()=>{f.d(g,{hS:()=>te,KL:()=>Se,Yb:()=>X,Tg:()=>we,WH:()=>be,lV:()=>ve,ws:()=>zt,Jf:()=>ue,SK:()=>oe,tI:()=>se,Uy:()=>ne,SP:()=>ie,Jj:()=>ae,pt:()=>le,nN:()=>de,mk:()=>re,ex:()=>ge,Bq:()=>Mp,I7:()=>v,yx:()=>pe,qz:()=>he,KO:()=>fe});const e=(e=>{var t={};return f.d(t,e),t})({createApi:()=>r.createApi,createEffect:()=>r.createEffect,createEvent:()=>r.createEvent,createStore:()=>r.createStore,sample:()=>r.sample});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 h="en-US";class p{constructor(e=h){Object.defineProperty(this,"languageCode",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"countryCode",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"tag",{enumerable:!0,configurable:!0,writable:!0,value:void 0});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}`),h)}parseTag(e){const[t,r]=e.split("-");this.languageCode=t,this.countryCode=r.toUpperCase(),this.tag=`${this.languageCode}-${this.countryCode}`}}const v={apiKey:"",disableStatistic:!1,disableDeviceId:!1,lang:new p};var m=function(e,t){var r={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(r[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(i=Object.getOwnPropertySymbols(e);n<i.length;n++)t.indexOf(i[n])<0&&Object.prototype.propertyIsEnumerable.call(e,i[n])&&(r[i[n]]=e[i[n]])}return r};const y=(0,e.createStore)(v),b=(0,e.createEvent)();y.on(b,((e,t)=>{var{disableStatistic:r,disableDeviceId:i}=t,n=m(t,["disableStatistic","disableDeviceId"]);return Object.assign(Object.assign({disableStatistic:null!=r?r:e.disableStatistic,disableDeviceId:null!=i?i:e.disableDeviceId},n),{lang:new p(n.lang)})}));const w=(0,e.createEvent)();y.on(w,((e,{tags:t})=>Object.assign(Object.assign({},e),{tags:t})));const S=(0,e.createEvent)();y.on(S,((e,t)=>Object.assign(Object.assign({},e),t)));const _=(0,e.createEvent)();y.on(_,((e,{placeholders:t})=>Object.assign(Object.assign({},e),{placeholders:t})));const x=(0,e.createEvent)();y.on(x,((e,{imagePlaceholders:t})=>Object.assign(Object.assign({},e),{imagePlaceholders:t})));const O=(0,e.createEvent)();y.on(O,((e,{lang:t})=>Object.assign(Object.assign({},e),{lang:new p(t)})));const C=(0,e.createStore)(""),k=(0,e.createEvent)();(0,e.sample)({clock:k,target:C});const L=(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}),A=(0,e.createEffect)(),M=(0,e.createEvent)(),E=(0,e.createEvent)();L.on(E,(e=>{const t=Object.assign({},e);return t.session.id="",t}));const P=(0,e.createEffect)((e=>{K("session/update",e,(()=>{}))})).prepend((e=>({data:[[5,0,...e]]})));L.map((e=>e.storyWidgetsResources));var j=f(37);class I{static createFunctionWithTimeout(e,t){let r=!1;function i(){r||(r=!0,e())}return setTimeout(i,t||1e3),i}static convertModelToFormData(e,t,r){t instanceof Object&&Object.keys(t).forEach((i=>{const n=t[i];if(n instanceof Object&&!Array.isArray(n))return this.convertModelToFormData(e,n,i);r&&(i=`${r}[${i}]`),Array.isArray(n)?n.forEach((t=>{e.append(`${i}[]`,t)})):e.append(i,n)}))}}const T=e=>null==e;function R(e){const t=typeof e;return null!=e&&("object"===t||"function"===t)}function D(e,t){return Object.assign(Object.assign({},e),t)}function B(e){return e.replace(/^\//,"")}const N={baseUrl:"https://cdn.inappstory.ru",apiUrl:"https://api.inappstory.ru",faviconApiUrl:"https://favicon.inappstory.ru"};function F(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,r){return void 0===t?e:t.length>=e.length?t:r?(e+t).slice(-e.length):(t+e).substring(0,e.length)}(new Array(t%4).fill("=").join(""),e,!1),window.atob(e)}(e),r=t.charCodeAt(13);if(r>0){let e=t.substr(14,r);e=e.replace(/\0+$/,"");const i="{QQN{xuV?1Dv16j3";let n=i,s=0;for(;n.length<r;)n+=i[s],s++,s===i.length&&(s=0);let o="";for(let t=0;t<r;t++)o+=String.fromCharCode(e.charCodeAt(t)^n.charCodeAt(t));return new URL(`https://${o}`).host}}catch(e){console.error(e)}return null}function U(e){const t=F(e);if(null!=t){const e=t.split(".").slice(1);N.baseUrl=`https://${["cdn",...e].join(".")}`,N.faviconApiUrl=`https://${["favicon",...e].join(".")}`,N.apiUrl=`https://${t}`}}function V(e){let t=e.length;for(let r=e.length-1;r>=0;r--){const i=e.charCodeAt(r);i>127&&i<=2047?t++:i>2047&&i<=65535&&(t+=2),i>=56320&&i<=57343&&r--}return t}class z{constructor(){return Object.defineProperty(this,"_sdkConfigIsIncorrect",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_userIdByteLimit",{enumerable:!0,configurable:!0,writable:!0,value:255}),Object.defineProperty(this,"_tagsByteLimit",{enumerable:!0,configurable:!0,writable:!0,value:4e3}),Object.defineProperty(this,"userMessage",{enumerable:!0,configurable:!0,writable:!0,value:""}),Object.defineProperty(this,"tagsMessage",{enumerable:!0,configurable:!0,writable:!0,value:""}),z.instance||(z.instance=this),z.instance}static getInstance(){return z.instance?z.instance:new z}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&&V(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)&&V(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 G=f(1580),W=f.n(G);class $ extends Error{constructor(e,t,r){super(),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"networkStatus",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"networkMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.name=e,this.networkStatus=t,this.networkMessage=r,console.error({name:e,networkStatus:t,networkMessage:r})}static containErrorDataInResponse(e){const t=e.data;return t&&W()(t)&&null!=t.name&&null!=t.message&&null!=t.status}static createByRequestError(e){return $.containErrorDataInResponse(e)?new $(e.data.name,e.data.status,e.data.message):new $("networkError",null,"Invalid data in API response, data from response as json: "+JSON.stringify(e.data))}static createByFetchError(e){if(e.response&&e.response.status)return new $("networkError",e.response.status,e.response.statusText);{let t="";return window.navigator&&!window.navigator.onLine&&(t=" net::ERR_INTERNET_DISCONNECTED"),new $("error",null,e.toString()+t)}}}var H=function(e,t,r,i){return new(r||(r=Promise))((function(n,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}l((i=i.apply(e,t||[])).next())}))};const q=`InAppStoryWebSDK/${parseInt(30100)} ${(e=>{let t="";for(let r=0;r<e.length;r++){t+=e.charCodeAt(r)<=255?e[r]:"?"}return t})(navigator.userAgent)}`;const Q=new class{constructor(){Object.defineProperty(this,"_deviceInfoPromise",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"_baseHeaders",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"requestInterceptors",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"interceptors",{enumerable:!0,configurable:!0,writable:!0,value:{request:{use:e=>{this.requestInterceptors.push(e)}}}})}set deviceInfoPromise(e){this._deviceInfoPromise=e}set baseHeaders(e){this._baseHeaders=e}get baseURL(){return`${N.apiUrl}/v2/`}request(e){return H(this,void 0,void 0,(function*(){return new Promise(((t,r)=>{const i=()=>H(this,void 0,void 0,(function*(){try{if(R(e.headers)&&null!=e.headers||(e.headers={}),e.headers=D(this._baseHeaders,e.headers),this.requestInterceptors.length)for(const t of this.requestInterceptors)t(e);let i="";!T(e.params)&&R(e.params)&&(i=new URLSearchParams(Object.entries(e.params)).toString());let n=new URL(`${B(e.url)}${i?"?"+i:""}`,this.baseURL),s="get";T(e.method)||(s=e.method);let o={};!T(e.headers)&&R(e.headers)&&(o=e.headers);let a=null;!T(e.data)&&R(e.data)&&(a=JSON.stringify(e.data),o["Content-Type"]="application/json");try{if(z.getInstance().sdkConfigIsIncorrect)return void t({data:{name:"SDK config is incorrect",message:z.getInstance().sdkConfigErrorsAsArray.join(". "),status:400},headersRaw:{},headers:{},status:400,statusText:"SDK config is incorrect",ok:!1})}catch(e){console.error(e)}const l=yield fetch(n.toString(),{method:s,body:a,headers:o,credentials:"omit"}),d={data:yield l.json(),headersRaw:l.headers,headers:Object.fromEntries([...l.headers]),status:l.status,statusText:l.statusText,ok:l.ok};if(!l.ok)return void r($.createByRequestError(d));t(d)}catch(e){r($.createByFetchError(e))}}));this._deviceInfoPromise?this._deviceInfoPromise.finally(i):i()}))}))}post(e,t){return H(this,arguments,void 0,(function*(e,t,r={}){return this.request({method:"post",url:e,data:t,params:r})}))}get(e,t){return H(this,void 0,void 0,(function*(){return this.request({method:"get",url:e,params:t})}))}};function K(e,t,r){var i,n,s;if("sendBeacon"in navigator){const o=new URLSearchParams({access_token:y.getState().apiKey,session_id:null===(n=null===(i=L.getState())||void 0===i?void 0:i.session)||void 0===n?void 0:n.id,x_user_agent:q}),a=y.getState();null!=a.appPackageId&&o.append("x_app_package_id",a.appPackageId);const l=`${s=Q.baseURL,s.replace(/\/$/,"")}/${B(e)}?${o.toString()}`,d=new FormData;Object.keys(t).forEach((e=>{I.convertModelToFormData(d,t[e],e)}));let c=!1;null!=Array.from&&null!=d.keys&&(c=0===Array.from(d.keys()).length),c||navigator.sendBeacon(l,d),r()}else Q.post(e,t).then((()=>r()),(()=>r()))}Q.interceptors.request.use((e=>{var t,r,i;const n=y.getState();return e.headers=D(null!==(t=e.headers)&&void 0!==t?t:{},{Authorization:`Bearer ${n.apiKey}`,"Accept-Language":n.lang.toString(),"Auth-Session-Id":null===(i=null===(r=L.getState())||void 0===r?void 0:r.session)||void 0===i?void 0:i.id,"X-User-Id":n.userId?n.userId:"","X-Request-Id":(0,j.v4)(),"X-User-Agent":q}),null!=n.appPackageId&&(e.headers["X-App-Package-Id"]=n.appPackageId),n.disableDeviceId||(e.headers["X-Device-Id"]=C.getState()),e}));const Y=Q;var Z;!function(e){e.UPDATE="update",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",e.EVENT_UPDATED_INAPPMESSAGING_WIDGET_OPTIONS="updatedInAppMessagingWidgetOptions"}(Z||(Z={}));Error;var X,J=f(46),ee=f.n(J);!function(e){e.LEFT="left",e.RIGHT="right",e.START="start",e.END="end"}(X||(X={}));const te={hasFavorite:!1,hasLike:!1,hasShare:!1,closeButtonPosition:X.END,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 re,ie,ne,se,oe,ae,le;!function(e){e.CENTER="center",e.LEFT="left",e.RIGHT="right",e.START="start",e.END="end"}(re||(re={})),function(e){e.CIRCLE="circle",e.QUAD="quad",e.RECTANGLE="rectangle"}(ie||(ie={})),function(e){e.LEFT="left",e.RIGHT="right",e.START="start",e.END="end",e.CENTER="center"}(ne||(ne={})),function(e){e.CARD_INSIDE_BOTTOM="cardInsideBottom",e.CARD_OUTSIDE_TOP="cardOutsideTop",e.CARD_OUTSIDE_BOTTOM="cardOutsideBottom"}(se||(se={})),function(e){e.Medium="medium",e.High="high"}(oe||(oe={})),function(e){e.COLUMN="vertical",e.ROW="horizontal"}(ae||(ae={})),function(e){e.START_LOADER="startLoad",e.END_LOADER="endLoad"}(le||(le={}));const de={direction:ae.ROW,card:{title:{font:'16px system-ui, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"',padding:10.6,textAlign:ne.START,position:se.CARD_INSIDE_BOTTOM,display:!0,lineClamp:4},gap:10,height:178,aspectRatio:null,coverQuality:oe.High,variant:ie.RECTANGLE,border:{radius:21,color:"black",width:2,gap:5},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:"Favorite",font:"normal",color:"white",padding:15,textAlign:ne.START,position:se.CARD_INSIDE_BOTTOM,display:!0,lineClamp:3},gap:10,height:70,aspectRatio:null,coverQuality:oe.High,coverLazyLoading:!1,variant:ie.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:re.START},navigation:{speed:300,showControls:!1,controlsSize:48,controlsBackgroundColor:"white",controlsColor:"black"},autoScrollOnStoryClose:!0,ugcCard:{title:{content:null,font:'16px system-ui, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"',color:"#000",padding:15,textAlign:ne.START,position:se.CARD_INSIDE_BOTTOM,display:!0,lineClamp:3},gap:10,height:70,aspectRatio:null,coverQuality:oe.High,coverLazyLoading:!1,variant:ie.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"}},ce={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}`},ue={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:ce,twitter:ce,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="30px" height="30px" 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>',doneState:'<svg width="30px" height="30px" fill="none" viewBox="0 0 386 264" xmlns="http://www.w3.org/2000/svg">\n<path d="m379.05 7.3156c8.855 8.8533 8.855 23.207 0 32.06l-210.67 210.67c-17.707 17.707-46.414 17.707-64.121 0l-97.319-97.319c-8.8531-8.855-8.8531-23.208 0-32.061 8.853-8.853 23.207-8.853 32.06 0l97.319 97.319 210.67-210.67c8.852-8.8531 23.206-8.8531 32.058 0z" clip-rule="evenodd" fill="currentColor" fill-rule="evenodd"/>\n</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 he;!function(e){e.FLAT="flat",e.COVER="cover",e.CUBE="cube"}(he||(he={}));const pe={gameReaderOptions:{loader:{default:{color:"white",accentColor:"transparent"},custom:null}},scrollStyle:he.FLAT,timelineBlockTopOffset:8,actionPanelBottomOffset:0,borderRadius:12,loader:{default:{color:"white",accentColor:"transparent"},custom:null},recycleStoriesList:!1,closeOnLastSlideByTimer:!0,sharePanel:ue,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 fe;!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"}(fe||(fe={}));const ge={title:{content:"Favorite",font:"1.4rem/1.2 InternalPrimaryFont",color:"white",backgroundColor:"#333333"},headerTopOffset:0,bottomOffset:0,backgroundColor:"#333333"};var ve,me=f(2743),ye=f.n(me);!function(e){e.DEFAULT="default",e.CUSTOM_CARD="customCard"}(ve||(ve={}));const be={goodsWidgetRenderingType:ve.DEFAULT,goodsList:{renderingType:ve.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"}}},we={borderRadius:5,loader:{default:{color:"white",accentColor:"transparent"},custom:null},backdropColor:"#1a1a1a",backdrop:{opacity:1,background:"#1a1a1a"},game:{backdropColor:"rgb(51, 51, 51)"},forceDesktopMode:te.forceDesktopMode,forceCheckOrientation:!0};class Se extends J.EventEmitter{constructor(){super(),Object.defineProperty(this,"_commonOptions",{enumerable:!0,configurable:!0,writable:!0,value:te}),Object.defineProperty(this,"_storiesListOptions",{enumerable:!0,configurable:!0,writable:!0,value:de}),Object.defineProperty(this,"_storyReaderOptions",{enumerable:!0,configurable:!0,writable:!0,value:pe}),Object.defineProperty(this,"_storyFavoriteReaderOptions",{enumerable:!0,configurable:!0,writable:!0,value:ge}),Object.defineProperty(this,"_goodsWidgetOptions",{enumerable:!0,configurable:!0,writable:!0,value:be}),Object.defineProperty(this,"_gameReaderOptions",{enumerable:!0,configurable:!0,writable:!0,value:we})}setCommonOptions(e,t=!0){return this._commonOptions=ye()(this._commonOptions,e),this.emit(Z.UPDATE,this.commonOptions),this}get commonOptions(){return this._commonOptions}setStoriesListOptions(e,t=!0){return this._storiesListOptions=ye()(this._storiesListOptions,e),t&&(this.emit(Z.UPDATE,this.storiesListOptions),this.emit(Z.EVENT_UPDATED_STORIES_LIST_OPTIONS,this.storiesListOptions)),this}get storiesListOptions(){return this._storiesListOptions}setStoryReaderOptions(e,t=!0){return this._storyReaderOptions=ye()(this._storyReaderOptions,e,{arrayMerge:(e,t,r)=>t}),t&&this.emit(Z.UPDATE,{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=ye()(this._storyFavoriteReaderOptions,e),t&&this.emit(Z.UPDATE,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=ye()(this._goodsWidgetOptions,e),t&&this.emit(Z.UPDATE,this.goodsWidgetOptions),this}get goodsWidgetOptions(){return this._goodsWidgetOptions}setGameReaderOptions(e,t=!0){return this._gameReaderOptions=ye()(this._gameReaderOptions,e),t&&this.emit(Z.UPDATE,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)}}class _e extends J.EventEmitter{constructor(e,t){super(),Object.defineProperty(this,"iframe",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"origin",{enumerable:!0,configurable:!0,writable:!0,value:t}),this.messageListener=this.messageListener.bind(this),window.addEventListener("message",this.messageListener,!1)}messageListener(e){if(e.origin!==this.origin)return;const[t,...r]=e.data;try{if(!Array.isArray(e.data))throw new Error(`Invalid MessageEvent data format ${e.data}`);this.emit(t,...r)}catch(e){console.error(e)}}sendMessage(e,t){var r;null===(r=this.iframe.contentWindow)||void 0===r||r.postMessage([e,t],this.origin)}pauseGameUI(){null==this||this.sendMessage("cb",{cb:"pauseUI",arguments:JSON.stringify([])})}resumeGameUI(){null==this||this.sendMessage("cb",{cb:"resumeUI",arguments:JSON.stringify([])})}shareComplete(e,t){this.sendMessage("shareComplete",{id:e,isSuccess:t})}closeGameReader(){this.sendMessage("closeGameReader")}initGame(e){this.sendMessage("cb",{cb:"initGame",arguments:JSON.stringify([e])})}sendGameCenterEventByApiRequest(e,t){this.sendMessage("cb",{cb:e,plainData:t})}notifyGameCanBeStarted(){this.sendMessage("gameShouldForeground")}destroy(){window.removeEventListener("message",this.messageListener,!1),this.removeAllListeners()}}class xe{constructor(e,t,r){Object.defineProperty(this,"userKey",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"gameInstanceId",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"instanceUserData",{enumerable:!0,configurable:!0,writable:!0,value:r})}set(e){return window.localStorage.setItem(this.key,JSON.stringify(e)),e}get(){var e;let t={};const r=W()(this.instanceUserData)?this.instanceUserData:{};try{const r=JSON.parse(null!==(e=window.localStorage.getItem(this.key))&&void 0!==e?e:"{}");W()(r)&&(t=r)}catch(e){console.error(e)}return ye()(t,r)}get key(){return`game_instance_data_${this.userKey}_${this.gameInstanceId}`}}class Oe{constructor(e,t){Object.defineProperty(this,"gameCenterMessageService",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"gameReaderViewModel",{enumerable:!0,configurable:!0,writable:!0,value:t})}handle(e){const{id:t,callback:r}=JSON.parse(e),i=this.gameReaderViewModel.gameLaunch;if(!i)return;const n=new xe(i.clientConfig.userKey,i.config.gameInstanceId,i.instanceUserData).get();this.gameCenterMessageService.sendMessage("cb",{cb:r,arguments:JSON.stringify([t,JSON.stringify(n)])})}}var Ce=f(3142),ke=f.n(Ce);const Le=(0,e.createStore)({default:{},user:{}}),{sdkImagePlaceholdersChanged:Ae,addDefaultImagePlaceholders:Me}=(0,e.createApi)(Le,{sdkImagePlaceholdersChanged:(e,t)=>({default:e.default,user:t}),addDefaultImagePlaceholders:(e,t)=>{let r={default:{},user:e.user};return ke()(t)&&t.forEach((e=>{W()(e)&&void 0!==e.name&&void 0!==e.default_value&&(r.default[e.name]=e.default_value)})),r}}),Ee=(0,e.createStore)({default:{},user:{}}),{sdkPlaceholdersChanged:Pe,addDefaultPlaceholders:je}=(0,e.createApi)(Ee,{sdkPlaceholdersChanged:(e,t)=>({default:e.default,user:t}),addDefaultPlaceholders:(e,t)=>{let r={default:{},user:e.user};return ke()(t)&&t.forEach((e=>{W()(e)&&void 0!==e.name&&void 0!==e.default_value&&(r.default[e.name]=e.default_value)})),r}});var Ie,Te,Re,De,Be,Ne;!function(e){e.direct="direct",e.onboarding="onboarding",e.list="list",e.favorite="favorite"}(Ie||(Ie={})),function(e){e[e.default=0]="default",e[e.favorite=1]="favorite",e[e.stacked=2]="stacked"}(Te||(Te={})),function(e){e[e.default=0]="default",e[e.onboarding=1]="onboarding",e[e.favorite=2]="favorite",e[e.direct=3]="direct"}(Re||(Re={})),function(e){e.list="list",e.favorite="favorite"}(De||(De={})),function(e){e.CLICK_ON_STORY="clickOnStoryLink"}(Be||(Be={})),function(e){e.TEXT="text",e.IMAGE="image"}(Ne||(Ne={}));const Fe=Object.prototype.hasOwnProperty,Ue=()=>{const e=Ee.getState(),t=Le.getState(),r=[],i={};for(let t in e.default)Fe.call(e.default,t)&&(i[t]={type:Ne.TEXT,name:t,value:e.default[t]});for(let t in e.user)Fe.call(e.user,t)&&(i[t]={type:Ne.TEXT,name:t,value:e.user[t]});for(let e in i)Fe.call(i,e)&&r.push(i[e]);const n={};for(let e in t.default)Fe.call(t.default,e)&&(n[e]={type:Ne.IMAGE,name:e,value:t.default[e]});for(let e in t.user)Fe.call(t.user,e)&&(n[e]={type:Ne.IMAGE,name:e,value:t.user[e]});for(let e in n)Fe.call(n,e)&&r.push(n[e]);return r},Ve=(0,e.createStore)({style:"",widgetsData:{}}),ze=(0,e.createEffect)(),Ge=(0,e.createEffect)();var We;!function(e){e[e.DEFAULT=0]="DEFAULT",e[e.UGC=1]="UGC"}(We||(We={}));const $e=e=>({id:e,type:We.DEFAULT,title:null,title_color:null,background:{},background_color:null,image:null,display_to:null,display_from:null,favorite:null,like:null,deeplink:null,hide_in_reader:null,hide_timeline:!1,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,game_instance:{id:null},share_url:null,slidesLoaded:!1,error:null,slides_count:0,slides:[]}),He=(0,e.createStore)({}),qe=(0,e.createStore)({default:[]}),Qe=qe.map((e=>e[L.getState().user_key||"default"]||[]));var Ke;!function(e){e.FEEDS="feeds",e.FAVORITE="favorite"}(Ke||(Ke={}));const Ye=(0,e.createStore)({default:{[Ke.FEEDS]:{},[Ke.FAVORITE]:[]}}),Ze=Ye.map((e=>e[L.getState().user_key||"default"]||{})),Xe=(0,e.createStore)({}),Je=(0,e.createStore)({}),et=(0,e.createStore)([]),tt=(e,t)=>e.map((e=>t.find((t=>t.id===e)))).filter((e=>!!e));Xe.on([Ze,Qe],((e,t)=>{const r=Ze.getState(),i=Qe.getState();return((e,t)=>{const r={};for(const[i,n]of Object.entries(e))r[i]=tt(n,t);return r})(r[Ke.FEEDS],i)})),Je.on([Ze,Qe],((e,t)=>{const r=Ze.getState(),i={};for(const e in r[Ke.FEEDS])if("onboarding_"===e.substring(0,11)){const t=e.substring(11);if(i[t]=[],r[Ke.FEEDS][e]&&Array.isArray(r[Ke.FEEDS][e])){const n={};Qe.getState().filter((e=>!e.is_opened)).forEach((e=>{n[e.id]=e})),i[t]=r[Ke.FEEDS][e].filter((e=>n[e])).map((e=>n[e]))}}return i})),et.on([Ze,Qe],((e,t)=>{var r;const i=null!==(r=Ze.getState()[Ke.FAVORITE])&&void 0!==r?r:[],n={};return Qe.getState().forEach((e=>{n[e.id]=e})),i.map((e=>n[e]))}));const rt=(e,t="")=>e.is_opened,{storyItemFavoriteChanged:it,storyItemLikeChanged:nt,storyItemIsOpenedChanged:st}=(Qe.map((e=>{const t={};return t[We.DEFAULT]=e.filter((e=>!e.slidesLoaded&&e.type===We.DEFAULT)).map((e=>e.id)),t[We.UGC]=e.filter((e=>!e.slidesLoaded&&e.type===We.UGC)).map((e=>e.id)),t})),Object.prototype.hasOwnProperty,(0,e.createApi)(qe,{storyItemFavoriteChanged:(e,{id:t,favorite:r})=>{const i=L.getState().user_key||"default",n=(e[i]||[]).slice(0),s=n.find((e=>e.id===t));return void 0!==s&&(s.favorite=r),Object.assign(Object.assign({},e),{[i]:n})},storyItemLikeChanged:(e,{id:t,like:r})=>{const i=L.getState().user_key||"default",n=(e[i]||[]).slice(0),s=n.find((e=>e.id===t));return void 0!==s&&(s.like=r),Object.assign(Object.assign({},e),{[i]:n})},storyItemIsOpenedChanged:(e,{id:t})=>{const r=L.getState().user_key||"default",i=(e[r]||[]).slice(0),n=i.find((e=>e.id===t));return void 0!==n&&(n.is_opened=!0),Object.assign(Object.assign({},e),{[r]:i})}}));var ot=f(4871),at=f.n(ot);let lt,dt=!0;function ct(e){lt(e),dt=e}function ut(){return lt(dt),dt}lt=function(){};class ht{constructor(){Object.defineProperty(this,"__lastUpdated",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"_receiveTime",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"_serverTimestamp",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"rawData",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"myDictionary",{enumerable:!0,configurable:!0,writable:!0,value:{}})}get receiveTime(){return this._receiveTime}singleModelWrapper(){return""}attributes(){return["__lastUpdated"]}static prepareFromResponse(){}setAttributes(e){const t=this.attributes();let r=this;for(let i in e){let n=e[i];-1!==t.indexOf(i)&&(r[i]=n)}}static createInstance(e,t){const r=new e;let i=t;return""!==r.singleModelWrapper()&&void 0!==t[r.singleModelWrapper()]&&(i=t[r.singleModelWrapper()]),r.rawData=t,r.setAttributes(i),r._receiveTime=(new Date).getTime(),void 0!==t.server_timestamp&&(r._serverTimestamp=t.server_timestamp),r}static _fetch(e,t,r,i="get"){return new Promise(((n,s)=>{let o={url:t,method:i};-1!==["post","put","path"].indexOf(i)?o.data=r:o.params=r;Y.request(o).then((function(t){let r,i;r=t.data,r&&(r.__lastUpdated=Date.now()),i=ht.createInstance(e,r),n(i)})).catch(s)}))}static _fetchList(e,t,r){return new Promise(((i,n)=>{Y.get(t,{params:r}).then((function(t){const r=t.data;let n=[];r.forEach((t=>{n.push(ht.createInstance(e,t))}));let s={models:n,totalCount:Number(t.headers["x-pagination-total-count"]),currentPage:Number(t.headers["x-pagination-current-page"])};i(s)})).catch(n)}))}static emitEvent({type:e,event:t,eventData:r}){return new Promise(((i,n)=>{Y.post(`${e}/event/${t}`,r).then((function(e){const t=e.data;i(t)})).catch(n)}))}static update(e,t,r="post"){let i={url:e,method:r};return-1!==["post","put","path"].indexOf(r)?i.data=t:i.params=t,new Promise(((e,t)=>{Y.request(i).then((function(t){let r;r=t.data,e(r)})).catch(t)}))}}var pt;!function(e){e[e.BottomSheet=1]="BottomSheet",e[e.Modal=2]="Modal",e[e.Fullscreen=3]="Fullscreen"}(pt||(pt={}));const ft=(e,t)=>{let r=[];switch(e){case Re.default:r=t?Xe.getState()[t]:[];break;case Re.favorite:r=et.getState();break;case Re.onboarding:r=t?Je.getState()[t]:[];break;case Re.direct:r=Qe.getState()}return null!=r?r:[]},gt="{{__ugc__}}",vt=e=>e===gt?We.UGC:We.DEFAULT,mt=e=>({windowReferer:Te.default,listType:Re.direct,id:e.id,storyContext:Ve.getState(),storyList:[e],hasShare:L.getState().share,placeholders:Ue()}),yt=e=>"{{__ugc__}}"===e?We.UGC:We.DEFAULT;var bt=function(e,t,r,i){return new(r||(r=Promise))((function(n,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}l((i=i.apply(e,t||[])).next())}))};var wt=function(e,t,r,i){return new(r||(r=Promise))((function(n,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}l((i=i.apply(e,t||[])).next())}))};const St=(e,t)=>wt(void 0,void 0,void 0,(function*(){const e=yield(r={data:t},bt(void 0,void 0,void 0,(function*(){var e,t,i,n,s,o,a,l,d;let c=!1,u="",h={url:null!==(t=null===(e=r.data)||void 0===e?void 0:e.url)&&void 0!==t?t:"",method:null!==(n=null===(i=r.data)||void 0===i?void 0:i.method)&&void 0!==n?n:"get"};-1!==["post","put","path"].indexOf(null===(s=r.data)||void 0===s?void 0:s.method)?h.data=null!==(a=null===(o=r.data)||void 0===o?void 0:o.data)&&void 0!==a?a:void 0:h.params=null!==(d=null===(l=r.data)||void 0===l?void 0:l.params)&&void 0!==d?d:void 0;const p={requestId:r.id};try{const e=yield Y.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:r.cb,payload:{requestId:r.id,success:c,data:p,err:u}}})));var r;if(e.payload.success)return e.payload.data;throw e.payload.err}));class _t{constructor(){Object.defineProperty(this,"rawData",{enumerable:!0,configurable:!0,writable:!0,value:{}})}singleModelWrapper(){return""}attributes(){return[]}setAttributes(e){const t=this.attributes();let r=this;for(let i in e){let n=e[i];-1!==t.indexOf(i)&&(r[i]=n)}}static createInstance(e,t){const r=new e;let i=t;return""!==r.singleModelWrapper()&&void 0!==t[r.singleModelWrapper()]&&(i=t[r.singleModelWrapper()]),r.rawData=t,r.setAttributes(i),r}}var xt=function(e,t,r,i){return new(r||(r=Promise))((function(n,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}l((i=i.apply(e,t||[])).next())}))};class Ot extends _t{static save(e,t,r){return xt(this,void 0,void 0,(function*(){try{return{data:(yield r("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:[{}]}}}))}}class Ct{constructor(e,t){Object.defineProperty(this,"gameCenterMessageService",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"gameReaderViewModel",{enumerable:!0,configurable:!0,writable:!0,value:t})}handle(e){const{gameInstanceId:t,data:r}=JSON.parse(e),i=this.gameReaderViewModel.gameLaunch;if(!i)return;const n=new xe(i.clientConfig.userKey,i.config.gameInstanceId,i.instanceUserData).set(r);Ot.save(this.gameReaderViewModel.gameInstanceId,JSON.stringify(n),St)}}var kt=function(e,t,r,i){return new(r||(r=Promise))((function(n,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}l((i=i.apply(e,t||[])).next())}))};var Lt;!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"}(Lt||(Lt={}));var At,Mt=function(e,t,r,i){return new(r||(r=Promise))((function(n,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}l((i=i.apply(e,t||[])).next())}))};!function(e){e.Social="social",e.SlideScreenshot="slide-screenshot"}(At||(At={}));class Et{constructor(e,t,r){Object.defineProperty(this,"gameCenterMessageService",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"gameReaderViewModel",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"desktopMode",{enumerable:!0,configurable:!0,writable:!0,value:r})}handle(e,t){return Mt(this,void 0,void 0,(function*(){var r,i,n;let s=null!==(r=null==t?void 0:t.url)&&void 0!==r?r:t.text,o=[];t.files&&Array.isArray(t.files)&&t.files.length>0&&(o=yield Promise.all(t.files.map((e=>(e=>kt(void 0,[e],void 0,(function*({file:e,name:t,type:r}){const i=yield fetch(`data:${r};base64,${e}`),n=yield i.blob();return new File([n],t,{type:r,lastModified:(new Date).getTime()})})))(e)))));const a={url:null!=s?s:void 0,files:o.length>0?o:void 0,text:null!==(i=t.text)&&void 0!==i?i: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:r}){let i=At.Social,n=t;e.files&&e.files.length>0&&(i=At.SlideScreenshot,n=URL.createObjectURL(e.files[0])),this.gameReaderViewModel.emit(Lt.OpenSharePanel,{shareId:r,shareType:i,shareLink:n})}}class Pt{constructor(e){Object.defineProperty(this,"storyId",{enumerable:!0,configurable:!0,writable:!0,value: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 jt{constructor(e,t){Object.defineProperty(this,"gameCenterMessageService",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"gameReaderViewModel",{enumerable:!0,configurable:!0,writable:!0,value:t})}handle(e){const t=JSON.parse(e);if(!W()(t))return;const{id:r,storyId:i,callback:n}=t;let s=new Pt(i).get();this.gameCenterMessageService.sendMessage("cb",{cb:n,arguments:JSON.stringify([r,JSON.stringify(s)])})}}class It extends _t{static sentData(e,t,r){return new Promise((i=>{r("apiRequest",{url:"story-data/"+e,method:"put",params:null,data:t,headers:null}).then((e=>{i({data:e.data,status:200,headers:[{}]})})).catch((e=>{i({data:e,status:400,headers:[{}]})}))}))}static sendApiRequest({url:e,method:t,params:r,headers:i,data:n,profilingKey:s},o){return new Promise((s=>{o("apiRequest",{url:e,method:t,params:r,data:n,headers:i}).then((e=>{s({data:e.data,status:200,headers:[{}]})})).catch((e=>{s({data:e,status:400,headers:[{}]})}))}))}static sendApiRequestPromise(e,t,r){const{id:i,url:n,method:s,params:o,headers:a,data:l,cb:d}=JSON.parse(e);return r("apiRequest",{url:n,method:s,params:o,data:l,headers:a}).then((e=>{let r=JSON.stringify({requestId:i,data:JSON.stringify(e.data),status:e.status,headers:e.headers});t(d,r)}),(e=>{let r=JSON.stringify({requestId:i,data:JSON.stringify(e),status:400,headers:[{}]});t(d,r)}))}}class Tt{constructor(){}handle(e){const t=JSON.parse(e);if(!W()(t))return;const{storyId:r,data:i,sendToServer:n}=t;new Pt(r).set(i),n&&It.sentData(r,JSON.stringify(i),St)}}var Rt=f(3655),Dt=f.n(Rt),Bt=f(8138),Nt=f.n(Bt),Ft=f(986),Ut=f.n(Ft);class Vt extends J.EventEmitter{}var zt,Gt,Wt=function(e,t,r,i){return new(r||(r=Promise))((function(n,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}l((i=i.apply(e,t||[])).next())}))};class $t{constructor(){Object.defineProperty(this,"viewModels",{enumerable:!0,configurable:!0,writable:!0,value:new Map}),Object.defineProperty(this,"observersByKey",{enumerable:!0,configurable:!0,writable:!0,value:new Map})}set(e,t){this.viewModels.set(e,t),this.notifyViewModelSet(e)}get(e){return this.viewModels.get(e)}wait(e){return Wt(this,void 0,void 0,(function*(){const t=this.viewModels.get(e);return t||new Promise((t=>{let r=this.observersByKey.get(e);r||(r=[]);const i=()=>{const n=this.viewModels.get(e);if(!n)throw new Error;r.splice(r.indexOf(i),1),t(n)};r.push(i),this.observersByKey.set(e,r)}))}))}getAll(){return Array.from(this.viewModels.values())}getAllOfType(e){return Array.from(this.viewModels.values()).filter(e)}has(e){return this.viewModels.has(e)}delete(e){this.viewModels.delete(e)}clear(){this.viewModels.clear()}notifyViewModelSet(e){var t;null===(t=this.observersByKey.get(e))||void 0===t||t.forEach((e=>e()))}}class Ht{constructor(e){Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:e})}createStoryReader(){return new Mo(this.storyManager).create()}createGameReader(){return new Ba(this.storyManager).create()}createStoryList(){return new Vo(this.storyManager).create()}}!function(e){e.START_LOADING="startLoading",e.END_LOADING="endLoading",e.CLOSE_STORY_READER="closeStoryReader"}(zt||(zt={}));class qt extends Vt{constructor(e,t){super(),Object.defineProperty(this,"storyListViewModel",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"story",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"id",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"title",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"titleColor",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"magazineName",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"backgroundColor",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"background",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"favorite",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"like",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"deeplink",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"hideInReader",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"gameInstance",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"hasAudio",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"isFavoriteCard",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"isUgcCard",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"isOpened",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"image",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"videoCoverSrc",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"videoCover",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),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}getAspectRatio(e){var t,r;switch(e){case fe.STYLE_CIRCLE:case fe.STYLE_QUAD:return 1;case fe.STYLE_RECTANGLE:return null!==(r=null===(t=this.storyListViewModel.session)||void 0===t?void 0:t.preview_aspect_ratio)&&void 0!==r?r:.8;default:return 1}}getImageSrcByCoverQuality(e){var t,r;return null===(r=null===(t=this.story.image)||void 0===t?void 0:t.findOneByCoverQuality(e))||void 0===r?void 0:r.url}onClick(e){this.storyListViewModel.onStoryClick(this,e)}destroy(){}}class Qt extends qt{constructor(e,t){super(e,t)}getImageSrcByCoverQuality(e){var t,r;return null===(r=null===(t=this.story.image)||void 0===t?void 0:t.findOneByCoverQuality(e))||void 0===r?void 0:r.url}}!function(e){e.STORY_LIST="storyList",e.STORY_READER="storyReader",e.GAME_READER="gameReader",e.STACK_STORY_LIST="stackStoryList"}(Gt||(Gt={}));class Kt{constructor(e,t){Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"statisticsService",{enumerable:!0,configurable:!0,writable:!0,value:t})}handle(e){var t;e.dataForSending=ut()?{data:this.statisticsService.getData()}:null;const r=()=>this.storyManager.clickOnButtonAction({src:Gt.STORY_READER,payload:e});!(null===(t=this.storyManager.getConfig())||void 0===t?void 0:t.disableStatistic)&&e.dataForSending&&W()(e.dataForSending)&&Array.isArray(e.dataForSending.data)&&e.dataForSending.data.length>0?(this.statisticsService.cleanupData(),K("session/update",e.dataForSending,r)):r()}}class Yt{constructor(e){Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:e})}handle(e,t,r){var i,n;const s=r.listType,o=null!==(i=r.feedSlug)&&void 0!==i?i:"",a=r.filter,l=yt(o),d={title:null,tags:[],slidesCount:null,feed:null,filter:null,source:null},c=Qe.getState().find((e=>e.id===t.id));if(c&&(d.title=c.stat_title,d.tags=c.tags,d.slidesCount=c.slides_count,c.type===We.UGC&&(d.ugcPayload=W()(c.payload)?c.payload:{})),l===We.DEFAULT?d.feed=o:l===We.UGC&&(d.filter=a),s===Re.direct?d.source=Ie.direct:s===Re.default?d.source=Ie.list:s===Re.onboarding?d.source=Ie.onboarding:s===Re.favorite&&(d.source=Ie.favorite),null!=t.index&&-1===["clickOnStory","showStory"].indexOf(e)){t.payload=null;const e=null===(n=null==c?void 0:c.slides[t.index])||void 0===n?void 0:n.event_payload;(null==e?void 0:e.payload)&&(t.payload=e.payload)}this.storyManager.emit(e,Object.assign(Object.assign({},t),d))}}function Zt(e,t,r){return String(e).replace(new RegExp(function(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(t),"g"),(()=>r))}const Xt=()=>null!==f.nc&&void 0!==f.nc?f.nc:"";class Jt extends _t{attributes(){return["width","height","type","url"]}constructor(){super(),Object.defineProperty(this,"width",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"height",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"type",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_url",{enumerable:!0,configurable:!0,writable:!0,value:""})}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://")}}var er=f(3981),tr=f.n(er);class rr{constructor(){Object.defineProperty(this,"images",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"color",{enumerable:!0,configurable:!0,writable:!0,value:""}),Object.defineProperty(this,"gradient",{enumerable:!0,configurable:!0,writable:!0,value:!1})}static createFromArray(e){const t=new rr;for(let r in e)e.hasOwnProperty(r)&&t.images.push(Jt.createInstance(Jt,e[r]));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){var r;let i=null;return this.images.forEach((t=>{t.width===e&&(i=t)})),null!==i?i:(i=null!==(r=tr()(this.images))&&void 0!==r?r:null,t&&null!=i?i:null)}mapCoverQualityToImageType(e){switch(e){case oe.Medium:return"m";case oe.High:return"h"}}}class ir extends _t{constructor(){super(...arguments),Object.defineProperty(this,"_title",{enumerable:!0,configurable:!0,writable:!0,value:""}),Object.defineProperty(this,"title_color",{enumerable:!0,configurable:!0,writable:!0,value:""}),Object.defineProperty(this,"magazine_name",{enumerable:!0,configurable:!0,writable:!0,value:""}),Object.defineProperty(this,"is_opened",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"background",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"background_color",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"id",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"slides_count",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"_slides",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"source",{enumerable:!0,configurable:!0,writable:!0,value:""}),Object.defineProperty(this,"favorite",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"like",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"deeplink",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"hide_in_reader",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"blank",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"disable_close",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"share_url",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"like_functional",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"favorite_functional",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"share_functional",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"need_placeholders",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"game_instance",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"hide_timeline",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"tags",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"has_audio",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"has_placeholder",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"has_swipe_up",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_placeholders",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"favorite_cell",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"ugc_card_cell",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"slidesLoaded",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"error",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"_image",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_parsedSlideImage",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"_video_cover",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"_videoCoverSrc",{enumerable:!0,configurable:!0,writable:!0,value:null})}attributes(){return at()(super.attributes(),["title","title_color","source","magazine_name","background","background_color","id","image","display_to","display_from","favorite","like","deeplink","hide_in_reader","hide_timeline","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","slides","slides_count","slidesLoaded","error"])}set image(e){this._image=rr.createFromArray(e)}get image(){return this._image}imagePerSlide(e){var t,r;return this.parseHtmlSlidesForMainImage(),null!==(r=null===(t=this._parsedSlideImage)||void 0===t?void 0:t[e])&&void 0!==r?r:null}parseHtmlSlidesForMainImage(){!this._parsedSlideImage&&this.slides_count&&(this._parsedSlideImage=this.slides.map((e=>this.parseSlideNarrativeImageSrc(e.html)||this.parseSlideNarrativeVideoPosterSrc(e.html)||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=rr.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 ir.placeholders)ir.placeholders.hasOwnProperty(t)&&(e=Zt(e,`%${t}%`,ir.placeholders[t]));this.rawData.title=e,this._title=e}get slides(){return this._slides}set slides(e){var t;for(const r of e)r.html=Zt(r.html,"{{nonce}}",null!==(t=Xt())&&void 0!==t?t:"");this._slides=e}get isOpened(){return this.is_opened}set isOpened(e){this.is_opened=e,this.rawData.is_opened=e}}Object.defineProperty(ir,"placeholders",{enumerable:!0,configurable:!0,writable:!0,value:{}});const nr=ir,sr=f(4871);class or extends _t{constructor(){super(...arguments),Object.defineProperty(this,"style",{enumerable:!0,configurable:!0,writable:!0,value:""}),Object.defineProperty(this,"widgetsData",{enumerable:!0,configurable:!0,writable:!0,value:{}})}attributes(){return sr(super.attributes(),["style","widgetsData"])}}const ar=new J.EventEmitter;ar.setMaxListeners(50);const lr=(0,e.createStore)({uiPaused:!1,timerPaused:!1,locked:!1,closeGestureInAction:!1}),dr=lr.map((e=>e.uiPaused)),cr=lr.map((e=>e.timerPaused)),ur=(0,e.createStore)(!1),hr=(0,e.createStore)(!0),pr=(0,e.createStore)(!0),fr=(0,e.createEvent)(),gr=(0,e.createEvent)(),vr=(0,e.createEvent)(),mr=(0,e.createEvent)(),yr=(0,e.createEvent)(),br=(0,e.createEvent)(),wr=(0,e.createEvent)(),Sr=(0,e.createEvent)(),_r=(0,e.createEvent)(),xr=(0,e.createEvent)(),Or=(0,e.createEvent)(),Cr=(0,e.createEvent)(),kr=(0,e.createEvent)(),Lr=(0,e.createEvent)(),Ar=t=>(0,e.sample)({source:lr,clock:t,filter:e=>!e.locked}),Mr=Ar(wr),Er=Ar(Sr),Pr=Ar(_r),jr=Ar(xr);lr.on(Pr,(e=>Object.assign(Object.assign({},e),{uiPaused:!0,timerPaused:!0}))).on(jr,(e=>Object.assign(Object.assign({},e),{uiPaused:!1,timerPaused:!1}))).on(Mr,(e=>e.timerPaused?e:Object.assign(Object.assign({},e),{timerPaused:!0}))).on(Er,(e=>e.timerPaused?Object.assign(Object.assign({},e),{timerPaused:!1}):e)).on(Or,(e=>Object.assign(Object.assign({},e),{uiPaused:!0,timerPaused:!0,locked:!0}))).on(Cr,(e=>Object.assign(Object.assign({},e),{uiPaused:!1,timerPaused:!1,locked:!1}))).on(kr,(e=>Object.assign(Object.assign({},e),{timerPaused:!0,locked:!0}))).on(Lr,(e=>Object.assign(Object.assign({},e),{timerPaused:!1,locked:!1}))),ur.on(fr,(e=>!0)).on(gr,(e=>!1)),hr.on(vr,(()=>!0)).on(mr,(()=>!1)),pr.on(yr,(()=>!0)).on(br,(()=>!1));const Ir={id:"",isOpened:!1,type:At.Social,link:""},Tr=(0,e.createStore)(Ir),Rr=Tr.map((e=>e.isOpened)),Dr=(0,e.createEvent)(),Br=(0,e.createEvent)();Tr.on(Dr,((e,t)=>Object.assign(Object.assign({},e),{link:t.link,type:t.type,text:t.text,id:t.id,isOpened:!0}))).on(Br,(e=>Ir));class Nr extends(ee()){constructor(e){super(),Object.defineProperty(this,"story",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"layersContainer",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"animationApi",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_activeLayer",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"initialLayer",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"layers",{enumerable:!0,configurable:!0,writable:!0,value:[]})}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"))),this.initialLayer=this._activeLayer}reset(){var e;this.hideAllLayers(),null===(e=this.initialLayer)||void 0===e||e.classList.remove("hidden")}get activeLayer(){return this._activeLayer}getLayers(){return this.layers}hideLayer(e){e.classList.contains("hidden")||(this.animationApi.stop(e,!0),e.classList.add("hidden"),this.emit("hideLayer",{layer:e}))}showLayer(e){this.startTimer(),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 r=t[e];r&&this.showLayer(r)}hasValidMultiSlides(){let e=!0,t=this.layersContainer.querySelectorAll(".narrative-slide.narrative-multi-slide");const r=this.layersContainer.querySelectorAll(".narrative-slide.narrative-multi-slide:not(.hidden)");return t.length>0&&0===r.length&&(e=!1),e}startTimer(){var e;this.story.timer.start(null!==(e=this.story.activeSlide.duration)&&void 0!==e?e:0)}}const Fr=function(){const e={step:1,maxSteps:100};var t=Object.prototype.hasOwnProperty;return function(i,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(i);"[object Array]"!==a&&"[object NodeList]"!==a&&"[object HTMLCollection]"!==a&&(i=[i]);for(var l=0;l<i.length;l++)r(i[l],s)};function r(e,t){if(!i(e)||e.getAttribute("textFitted"))return!1;var r,n,s,o;if(!i(n=e.parentElement))return!1;if(r=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),r<=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>r))break;l-=a,e.style.fontSize=l+"px"}}}function i(e){return"object"==typeof HTMLElement?e instanceof HTMLElement:e&&"object"==typeof e&&null!==e&&1===e.nodeType&&"string"==typeof e.nodeName}}();var Ur=function(e,t,r,i){return new(r||(r=Promise))((function(n,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}l((i=i.apply(e,t||[])).next())}))};class Vr{constructor(e){Object.defineProperty(this,"videoEl",{enumerable:!0,configurable:!0,writable:!0,value:e}),this.parseDefaultMuted()}get $video(){return this.videoEl}get muted(){return this.videoEl.muted}get paused(){return this.videoEl.paused}start(){return Ur(this,void 0,void 0,(function*(){this.videoEl.pause(),this.videoEl.currentTime=0,yield this.play()}))}play(){return Ur(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 Ur(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 Ur(this,arguments,void 0,(function*(e=!0){return new Promise((t=>{const r=this.videoEl.oncanplaythrough?"canplaythrough":"canplay";this.videoEl.addEventListener(r,(()=>{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}destroy(){return Ur(this,void 0,void 0,(function*(){return Promise.resolve()}))}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"))}}const zr=(e=>{var t={};return f.d(t,e),t})({Player:()=>i.Player});var Gr=function(e,t,r,i){return new(r||(r=Promise))((function(n,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}l((i=i.apply(e,t||[])).next())}))};class Wr extends Vr{constructor(e){super(e),Object.defineProperty(this,"player",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_vodData",{enumerable:!0,configurable:!0,writable:!0,value:null}),this.handlePlayerError=this.handlePlayerError.bind(this),this._vodData=Wr.parseData(e)}get vodData(){return this._vodData}static get isBrowserSupported(){return zr.Player.isBrowserSupported()}load(){const e=Object.create(null,{load:{get:()=>super.load}});return Gr(this,void 0,void 0,(function*(){try{Wr.isBrowserSupported?(this.disableVideoPreload(),yield this.initPlayer()):(this.updateVideoSources(),yield e.load.call(this),console.error("[VOD]: Browser not supported!"))}catch(e){throw this.handlePlayerError({detail:e}),e}}))}destroy(){return Gr(this,void 0,void 0,(function*(){var e;this.stop(),null===(e=this.player)||void 0===e||e.removeEventListener("error",this.handlePlayerError),yield this.detachVideoElement(),yield this.player.destroy()}))}static parseData(e){const t=e.getAttribute("data-vod");try{return t&&JSON.parse(t)}catch(e){return null}}initPlayer(){return Gr(this,void 0,void 0,(function*(){this.player=new zr.Player,this.player.addEventListener("error",this.handlePlayerError),yield this.attachVideoElement(),yield this.loadVideo(),yield this.play(),this.stop()}))}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){this.detachVideoElement().catch(console.error);const t=e.detail,r=`[VOD]: error code ${t.code}; object ${t}`;console.error(r)}attachVideoElement(){return Gr(this,void 0,void 0,(function*(){yield this.player.attach(this.videoEl),lt("[VOD]: video element attached",this.videoEl)}))}loadVideo(){return Gr(this,void 0,void 0,(function*(){const e=zr.Player.convertJsonToUri(this.vodData);yield this.player.load(e,0,"application/json"),lt(`[VOD]: video ${e} successful loaded`)}))}detachVideoElement(){return Gr(this,void 0,void 0,(function*(){yield this.player.detach(this.videoEl),lt("[VOD]: video element detached",this.videoEl)}))}}var $r=function(e,t,r,i){return new(r||(r=Promise))((function(n,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}l((i=i.apply(e,t||[])).next())}))};class Hr{constructor(){Object.defineProperty(this,"videos",{enumerable:!0,configurable:!0,writable:!0,value:[]})}init(e){return $r(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 $r(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 $r(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()}destroy(){return $r(this,void 0,void 0,(function*(){for(const e of this.videos)yield e.destroy()}))}createVideoByElement(e){return Wr.parseData(e)?new Wr(e):new Vr(e)}}var qr=function(e,t,r,i){return new(r||(r=Promise))((function(n,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}l((i=i.apply(e,t||[])).next())}))};class Qr{constructor(e){Object.defineProperty(this,"layerManager",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"videoContexts",{enumerable:!0,configurable:!0,writable:!0,value:new Map}),Object.defineProperty(this,"muted",{enumerable:!0,configurable:!0,writable:!0,value:!1}),this.handleShowLayer=this.handleShowLayer.bind(this),this.handleHideLayer=this.handleHideLayer.bind(this),this.subscribeLayerManager()}init(){return qr(this,void 0,void 0,(function*(){for(const e of this.layerManager.getLayers()){const t=new Hr;yield t.init(e),this.videoContexts.set(e,t)}}))}start(){return qr(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 qr(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()}destroy(){return qr(this,void 0,void 0,(function*(){for(const e of this.videoContexts.values())yield e.destroy();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 Kr=function(e,t,r,i){return new(r||(r=Promise))((function(n,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}l((i=i.apply(e,t||[])).next())}))};class Yr{constructor(e){Object.defineProperty(this,"videoContainer",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"videoContext",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.videoContext=new Hr}init(){return Kr(this,void 0,void 0,(function*(){yield this.videoContext.init(this.videoContainer)}))}start(){return Kr(this,void 0,void 0,(function*(){yield this.videoContext.start()}))}pause(){this.videoContext.pause()}resume(){return Kr(this,void 0,void 0,(function*(){yield this.videoContext.resume()}))}stop(){this.videoContext.stop()}mute(){this.videoContext.mute()}unmute(){this.videoContext.unmute()}destroy(){return Kr(this,void 0,void 0,(function*(){return this.videoContext.destroy()}))}}class Zr{static create(e,t){return e.querySelectorAll(".narrative-slide.narrative-multi-slide").length>0?new Qr(t):new Yr(e)}}var Xr,Jr=function(e,t,r,i){return new(r||(r=Promise))((function(n,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}l((i=i.apply(e,t||[])).next())}))};!function(e){e.REFRESH_WIDGETS_STATE="REFRESH_WIDGETS_STATE"}(Xr||(Xr={}));class ei{constructor(e,t,r){Object.defineProperty(this,"slideApi",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"layersManager",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"story",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"_widgets",{enumerable:!0,configurable:!0,writable:!0,value:new Map}),this.showLayerByIndex=this.showLayerByIndex.bind(this),this.handleRefreshUserData=this.handleRefreshUserData.bind(this);for(const t of ei.widgetClasses.values()){const i=new t(e,r);this._widgets.set(i.getType(),i)}}static register(e){ei.widgetClasses.add(e)}get widgets(){return Array.from(this._widgets.values())}init(e){return Jr(this,void 0,void 0,(function*(){this.layersManager.init(e,this.slideApi.Animation),ar.on(ro.ShowLayer,this.showLayerByIndex),ar.on(Xr.REFRESH_WIDGETS_STATE,this.handleRefreshUserData);for(const t of this._widgets.values())yield t.init(e);this.layersManager.init(e,this.slideApi.Animation)}))}pause(){for(const e of this._widgets.values())e.pause()}resume(){for(const e of this._widgets.values())e.resume()}findWidgetByType(e){const t=this._widgets.get(e);if(null==t?void 0:t.firstElement)return t}stop(){for(const e of this._widgets.values())e.destroy();ar.off(ro.ShowLayer,this.showLayerByIndex),ar.off(Xr.REFRESH_WIDGETS_STATE,this.handleRefreshUserData)}destroy(){this.stop()}handleRefreshUserData(){this._widgets.forEach((e=>e.refreshUserData()))}showLayerByIndex({index:e}){this.layersManager.showLayerByIndex(e)}}Object.defineProperty(ei,"widgetClasses",{enumerable:!0,configurable:!0,writable:!0,value:new Set});class ti{constructor(){Object.defineProperty(this,"type",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"elements",{enumerable:!0,configurable:!0,writable:!0,value:void 0})}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(){if(!this.type)throw new Error("[StoryWidget]: widget must have a type");return this.type}setUserData(e,t){}}var ri=function(e,t,r,i){return new(r||(r=Promise))((function(n,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}l((i=i.apply(e,t||[])).next())}))};class ii extends ti{constructor(e){super(),Object.defineProperty(this,"slideApi",{enumerable:!0,configurable:!0,writable:!0,value:e}),this.type=ii.name}init(e){return ri(this,void 0,void 0,(function*(){this.elements=e.querySelectorAll(".narrative-element-barcode");try{this.slideApi.WidgetBarcode.initWidget(this.elements)}catch(e){console.error(e)}}))}refreshUserData(){this.elements&&this.slideApi.WidgetBarcode.refreshUserData(this.elements)}click(e){e.target===this.firstElement&&(this.slideApi.WidgetBarcode.click(e.target),e.navigationController.preventDefault())}}var ni=function(e,t,r,i){return new(r||(r=Promise))((function(n,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}l((i=i.apply(e,t||[])).next())}))};class si extends ti{constructor(e){super(),Object.defineProperty(this,"slideApi",{enumerable:!0,configurable:!0,writable:!0,value:e}),this.type=si.name}init(e){return ni(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){e.target===this.firstElement&&(this.slideApi.WidgetCopy.click(e.target),e.navigationController.preventDefault())}}var oi=function(e,t,r,i){return new(r||(r=Promise))((function(n,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}l((i=i.apply(e,t||[])).next())}))};class ai extends ti{constructor(e){super(),Object.defineProperty(this,"slideApi",{enumerable:!0,configurable:!0,writable:!0,value:e}),this.type=ai.name}init(e){return oi(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){e.target===this.firstElement&&(this.slideApi.WidgetDataInput.click(e.target),e.navigationController.preventDefault())}setUserData(e,t=""){this.slideApi.WidgetDataInput.setUserData(e,t)}}var li=function(e,t,r,i){return new(r||(r=Promise))((function(n,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}l((i=i.apply(e,t||[])).next())}))};class di extends ti{constructor(e){super(),Object.defineProperty(this,"slideApi",{enumerable:!0,configurable:!0,writable:!0,value:e}),this.type=di.name}init(e){return li(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)}click(){}}var ci=function(e,t,r,i){return new(r||(r=Promise))((function(n,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}l((i=i.apply(e,t||[])).next())}))};class ui extends ti{constructor(e){super(),Object.defineProperty(this,"slideApi",{enumerable:!0,configurable:!0,writable:!0,value:e}),this.type=ui.name}init(e){return ci(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)}}))}click(){}destroy(){}}var hi=function(e,t,r,i){return new(r||(r=Promise))((function(n,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}l((i=i.apply(e,t||[])).next())}))};class pi extends ti{constructor(e){super(),Object.defineProperty(this,"slideApi",{enumerable:!0,configurable:!0,writable:!0,value:e}),this.type=pi.name}init(e){return hi(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)}click(e){e.target.classList.contains("narrative-element-poll-button")&&(this.select(e.target),e.navigationController.preventDefault())}}var fi=function(e,t,r,i){return new(r||(r=Promise))((function(n,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}l((i=i.apply(e,t||[])).next())}))};class gi extends ti{constructor(e){super(),Object.defineProperty(this,"slideApi",{enumerable:!0,configurable:!0,writable:!0,value:e}),this.type=gi.name}init(e){return fi(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)}click(e){e.target.classList.contains("narrative-element-poll-button")&&(this.select(e.target),e.navigationController.preventDefault())}}var vi=function(e,t,r,i){return new(r||(r=Promise))((function(n,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}l((i=i.apply(e,t||[])).next())}))};class mi extends ti{constructor(e,t){super(),Object.defineProperty(this,"slideApi",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"story",{enumerable:!0,configurable:!0,writable:!0,value:t}),this.type=mi.name}init(e){return vi(this,void 0,void 0,(function*(){var t;this.elements=e.querySelectorAll(".narrative-element-quest");const r=e.querySelectorAll(".narrative-slide"),i=null===(t=null==r?void 0:r.item(0))||void 0===t?void 0:t.getAttribute("data-quest-count");this.elements.length||null==i||(this.elements=r);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)}click(e){e.target.classList.contains("narrative-element-test-answer")?this.handleTestAnswer(e):this.handleRouteClick(e)}handleTestAnswer(e){this.select(e.target),e.navigationController.preventDefault()}handleRouteClick(e){e.navigationController.navigationDisabled||(e.navigationController.preventDefault(),this.slideApi.WidgetQuest.handleRouteClick(this.firstElement,{direction:e.navigationController.direction>0?"forward":"backward",slideIndex:this.story.activeSlideIndex,slideCount:this.story.slidesCount,click:()=>{e.navigationController.navigate()}}))}}var yi=function(e,t,r,i){return new(r||(r=Promise))((function(n,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}l((i=i.apply(e,t||[])).next())}))};class bi extends ti{constructor(e,t){super(),Object.defineProperty(this,"slideApi",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"story",{enumerable:!0,configurable:!0,writable:!0,value:t}),this.type=bi.name}init(e){return yi(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)}click(e){e.target.classList.contains("narrative-element-quiz-next-button")?this.handleNextButton(e):e.target.classList.contains("narrative-element-quiz-answer")?this.handleAnswer(e):this.handleQuizIsDone(e)}handleQuizIsDone(e){this.slideQuizIsDone(this.firstElement)||e.navigationController.disableNextClick()}handleNextButton(e){this.story.nextSlide(),e.navigationController.preventDefault()}handleAnswer(e){this.select(e.target),e.navigationController.preventDefault()}}var wi=function(e,t,r,i){return new(r||(r=Promise))((function(n,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}l((i=i.apply(e,t||[])).next())}))};class Si extends ti{constructor(e,t){super(),Object.defineProperty(this,"slideApi",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"story",{enumerable:!0,configurable:!0,writable:!0,value:t}),this.type=Si.name}init(e){return wi(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)}click(e){e.target.classList.contains("narrative-element-quiz-next-button")?this.handleNextButton(e):e.target.classList.contains("narrative-element-quiz-answer")?this.handleAnswer(e):this.handleQuizIsDone(e)}handleNextButton(e){this.story.nextSlide(),e.navigationController.preventDefault()}handleQuizIsDone(e){this.slideQuizIsDone(this.firstElement)||e.navigationController.disableNextClick()}handleAnswer(e){this.select(e.target),e.navigationController.preventDefault()}}var _i=function(e,t,r,i){return new(r||(r=Promise))((function(n,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}l((i=i.apply(e,t||[])).next())}))};class xi extends ti{constructor(e){super(),Object.defineProperty(this,"slideApi",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"slideContent",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.type=xi.name,this.disableSwipeGesture=this.disableSwipeGesture.bind(this),this.enableSwipeGesture=this.enableSwipeGesture.bind(this)}init(e){return _i(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){e.target.classList.contains("rangeslider")?this.handleClickSlider(e):e.target.classList.contains("narrative-element-range-slider-next-button")?this.handleClickSliderNextButton(e):this.handleCaptureClick(e)}isClickCapturedBySlider(e){return this.slideApi.WidgetRangeSlider.isClickCapturedBySlider(e)}destroy(){this.unregisterMouseAndTouchEvents()}handleClickSlider(e){e.navigationController.preventDefault()}handleCaptureClick(e){this.isClickCapturedBySlider(this.firstElement)&&e.navigationController.preventDefault()}handleClickSliderNextButton(e){this.slideApi.WidgetRangeSlider.click(e.target),e.navigationController.preventDefault()}disableSwipeGesture(e){mr()}enableSwipeGesture(e){vr()}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,r,i;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===(r=this.slideContent)||void 0===r||r.removeEventListener("mousedown",this.disableSwipeGesture),null===(i=this.slideContent)||void 0===i||i.removeEventListener("touchstart",this.disableSwipeGesture)}}var Oi=function(e,t,r,i){return new(r||(r=Promise))((function(n,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}l((i=i.apply(e,t||[])).next())}))};class Ci extends ti{constructor(e){super(),Object.defineProperty(this,"slideApi",{enumerable:!0,configurable:!0,writable:!0,value:e}),this.type=Ci.name}init(e){return Oi(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)}}))}click(e){e.target.classList.contains("narrative-element-rate-input")&&(this.select(e.target),e.navigationController.preventDefault())}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 ki=function(e,t,r,i){return new(r||(r=Promise))((function(n,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}l((i=i.apply(e,t||[])).next())}))};class Li extends ti{constructor(e){super(),Object.defineProperty(this,"slideApi",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"slideContent",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.type=Li.name,this.handleShareComplete=this.handleShareComplete.bind(this)}init(e){return ki(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){e.target===this.firstElement&&(this.slideApi.WidgetShare.click(e.target),e.navigationController.preventDefault())}destroy(){this.unregisterEvents()}registerEvents(){ar.on(`${Li.name}.shareComplete`,this.handleShareComplete)}unregisterEvents(){ar.off(`${Li.name}.shareComplete`,this.handleShareComplete)}handleShareComplete({shareId:e,result:t}){lt(`[Share Widget]: share complete, { shareId, result }: ${e}, ${t}}`),this.complete(e,t)}}var Ai,Mi=function(e,t,r,i){return new(r||(r=Promise))((function(n,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}l((i=i.apply(e,t||[])).next())}))};!function(e){e.Open="open"}(Ai||(Ai={}));class Ei extends ti{constructor(e){super(),Object.defineProperty(this,"slideApi",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"_swipeUpLinkTarget",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_swipeUpElementId",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"slideContent",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"eventEmitter",{enumerable:!0,configurable:!0,writable:!0,value:new J.EventEmitter}),this.type=Ei.name,this.handleSwipeUpGesture=this.handleSwipeUpGesture.bind(this),this.handleClick=this.handleClick.bind(this)}get targetUrl(){var e;return decodeURIComponent(null!==(e=this._swipeUpLinkTarget)&&void 0!==e?e:"")}get elementId(){return this._swipeUpElementId}init(e){return Mi(this,void 0,void 0,(function*(){var t,r;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!==(r=this.firstElement.getAttribute("data-element-id"))&&void 0!==r?r:void 0,this.registerEvents())}))}click(e){}destroy(){this.unregisterEvents()}close(){vr(),Cr(),this.setGoodsElementOpacity(1)}on(e,t){this.eventEmitter.on(e,t)}off(e,t){this.eventEmitter.off(e,t)}registerEvents(){var e;ar.on("swipeController.swipeUp",this.handleSwipeUpGesture),ar.on("goods.close",this.handleSwipeUpGesture),null===(e=this.firstElement)||void 0===e||e.addEventListener("click",this.handleClick)}unregisterEvents(){var e;ar.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(){this._swipeUpLinkTarget&&this.slideContent&&this._swipeUpElementId&&(mr(),Or(),this.eventEmitter.emit(Ai.Open),this.setGoodsElementOpacity(0))}setGoodsElementOpacity(e){var t;const r=null===(t=this.slideContent)||void 0===t?void 0:t.querySelector(`[data-element-id="${this._swipeUpElementId}"]`);r&&r.style.setProperty("display",e>0?"block":"none")}}var Pi=function(e,t,r,i){return new(r||(r=Promise))((function(n,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}l((i=i.apply(e,t||[])).next())}))};class ji extends ti{constructor(e,t){super(),Object.defineProperty(this,"slideApi",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"story",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"_swipeUpLinkTarget",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_swipeUpElementId",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"slideContent",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.type=ji.name,this.handleSwipeUpGesture=this.handleSwipeUpGesture.bind(this)}get swipeUpLinkTarget(){return this._swipeUpLinkTarget}get swipeUpElementId(){return this._swipeUpElementId}init(e){return Pi(this,void 0,void 0,(function*(){var t,r;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!==(r=this.firstElement.getAttribute("data-element-id"))&&void 0!==r?r:void 0,ar.on("swipeController.swipeUp",this.handleSwipeUpGesture))}))}click(e){}destroy(){ar.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&&Ys(this.story,e)}}var Ii=function(e,t,r,i){return new(r||(r=Promise))((function(n,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}l((i=i.apply(e,t||[])).next())}))};class Ti extends ti{constructor(e){super(),Object.defineProperty(this,"slideApi",{enumerable:!0,configurable:!0,writable:!0,value:e}),this.type=Ti.name}init(e){return Ii(this,void 0,void 0,(function*(){this.elements=e.querySelectorAll(".narrative-element-vote");try{if(!this.firstElement)return;this.slideApi.WidgetVote.initWidget(this.firstElement);const e="narrative-element-quiz-next-button",t=this.firstElement.querySelector(`.${e}`);t&&t.classList.remove(e)}catch(e){console.error(e)}}))}refreshUserData(){this.elements&&this.slideApi.WidgetVote.refreshUserData(this.elements)}select(e){this.slideApi.WidgetVote.select(e)}click(e){if(e.target.classList.contains("narrative-element-vote-next-button")){if(!this.slideApi.WidgetVote.click(e.target))return void e.navigationController.preventDefault()}e.target.classList.contains("narrative-element-vote-answer")&&(this.slideApi.WidgetVote.select(e.target),e.navigationController.preventDefault())}}var Ri=function(e,t,r,i){return new(r||(r=Promise))((function(n,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}l((i=i.apply(e,t||[])).next())}))};class Di extends ti{constructor(e,t){super(),Object.defineProperty(this,"slideApi",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"story",{enumerable:!0,configurable:!0,writable:!0,value:t}),this.type=Di.name}init(e){return Ri(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)}click(e){e.target.classList.contains("narrative-element-test-next-button")?this.handleNextButton(e):e.target.classList.contains("narrative-element-test-answer")?this.handleAnswer(e):this.handleTestIsDone(e)}handleNextButton(e){this.story.nextSlide(),e.navigationController.preventDefault()}handleAnswer(e){this.select(e.target),e.navigationController.preventDefault()}handleTestIsDone(e){const t=this.slideTestIsDone(this.firstElement);!this.slideTestWithTimer(this.firstElement)||t?t||e.navigationController.disableNextClick():e.navigationController.preventDefault()}}var Bi,Ni=function(e,t,r,i){return new(r||(r=Promise))((function(n,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}l((i=i.apply(e,t||[])).next())}))};class Fi extends ti{constructor(e,t){super(),Object.defineProperty(this,"slideApi",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"story",{enumerable:!0,configurable:!0,writable:!0,value:t}),this.type=Fi.name}init(e){return Ni(this,void 0,void 0,(function*(){this.elements=e.querySelectorAll(".narrative-element-story-repeat")}))}click(e){e.target===this.firstElement&&(this.story.reset().catch(console.error),e.navigationController.preventDefault())}}ei.register(ii),ei.register(si),ei.register(ai),ei.register(di),ei.register(ui),ei.register(pi),ei.register(gi),ei.register(mi),ei.register(bi),ei.register(Si),ei.register(xi),ei.register(Ci),ei.register(Li),ei.register(Ei),ei.register(ji),ei.register(Ti),ei.register(Di),ei.register(Fi),function(e){e[e.None=0]="None",e[e.DisableNext=1]="DisableNext",e[e.DisablePrev=2]="DisablePrev"}(Bi||(Bi={}));class Ui{constructor(e,t,r,i,n){Object.defineProperty(this,"slide",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"event",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"geometry",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"dir",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(this,"desktopMode",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(this,"_mode",{enumerable:!0,configurable:!0,writable:!0,value:Bi.None}),Object.defineProperty(this,"_defaultPrevented",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_direction",{enumerable:!0,configurable:!0,writable:!0,value:0}),this._direction=this.calcDirection()}get mode(){return this._mode}get direction(){return this._direction}get defaultPrevented(){return this._defaultPrevented||this.slide.navigationDisabled}get navigationDisabled(){return this.slide.navigationDisabled}preventDefault(){this._defaultPrevented=!0}disableNextClick(){this._mode=Bi.DisableNext}navigate(){this.direction<0?this.toPrev():this.mode!==Bi.DisableNext&&this.toNext()}toPrev(){"ltr"===this.dir?this.prevSlideOrStory():this.nextSlideOrStory()}toNext(){"ltr"===this.dir?this.nextSlideOrStory():this.prevSlideOrStory()}prevSlideOrStory(){this.slide.story.reachStart?ar.emit(`${Ao.name}.showPrevStory`):this.slide.story.prevSlide()}nextSlideOrStory(){this.slide.story.reachEnd?ar.emit(`${Ao.name}.showNextStory`):this.slide.story.nextSlide()}calcClickPosition(){var e;let t=0,r=0;return this.desktopMode?(t=this.geometry.calculateWidth(),r=this.event.nativeEvent.offsetX):(t=this.geometry.vw,r=this.event.nativeEvent.pageX||(null===(e=this.event.nativeEvent.touches)||void 0===e?void 0:e[0].pageX)),r/t}calcDirection(){return this.calcClickPosition()<=.3?-1:1}}const Vi={id:"",running:!1},zi=(0,e.createStore)(Vi),Gi=(0,e.createEvent)(),Wi=(0,e.createEvent)(),$i=(0,e.createEvent)(),Hi=(0,e.createEffect)((({shareId:e,result:t})=>{$i(),Lr(),ar.emit(`${Li.name}.shareComplete`,{shareId:e,result:t})}));zi.on(Gi,((e,t)=>Object.assign(Object.assign({},e),{id:t.id,running:!0}))).on($i,(()=>Vi)),(0,e.sample)({clock:Wi,source:zi,filter:e=>e.running,fn:(e,t)=>({shareId:e.id,result:t.result}),target:Hi});class qi{init(e){var t;const r="stories-slider-style";let i=document.getElementById(r),n="";null!==e&&(n=null!==(t=e.style)&&void 0!==t?t:""),null===i?(i=document.createElement("style"),i.type="text/css",i.id=r,i.attributes.setNamedItem(document.createAttribute("scoped")),i.setAttribute("nonce",Xt()),i.styleSheet?i.styleSheet.cssText=n:i.appendChild(document.createTextNode(n)),document.head.appendChild(i)):i.styleSheet?i.styleSheet.cssText=n:(i.textContent="",i.appendChild(document.createTextNode(n)))}}class Qi{constructor(){Object.defineProperty(this,"cache",{enumerable:!0,configurable:!0,writable:!0,value:{}})}set(e,t){this.cache[e]=t}clear(){this.cache={}}get(e){return this.cache[e]}}class Ki{constructor(){Object.defineProperty(this,"actions",{enumerable:!0,configurable:!0,writable:!0,value:[]})}push(e){this.actions.push(e)}exec(){for(const e of this.actions)e()}flush(){this.actions=[]}}var Yi=function(e,t,r,i){return new(r||(r=Promise))((function(n,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}l((i=i.apply(e,t||[])).next())}))};class Zi{constructor(e){Object.defineProperty(this,"statisticsService",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"timerId",{enumerable:!0,configurable:!0,writable:!0,value:null})}start(){this.schedule(1e4)}stop(){null!=this.timerId&&(clearTimeout(this.timerId),this.timerId=null)}flush(){return Yi(this,void 0,void 0,(function*(){lt(`[${sn.name}]: flush statistics by timer`);this.statisticsService.getData().length>0?this.schedule(1e4):this.schedule(3e4),yield this.statisticsService.sendData()}))}schedule(e){lt(`[${sn.name}]: schedule flush statistics on ${e}ms`),this.timerId=setTimeout((()=>this.flush()),e)}}class Xi{constructor(){Object.defineProperty(this,"slideStartedAt",{enumerable:!0,configurable:!0,writable:!0,value:void 0})}calculate(){const e=Date.now(),t=e-this.slideStartedAt;return this.slideStartedAt=e,t}init(){this.slideStartedAt=Date.now()}}class Ji{constructor(e){Object.defineProperty(this,"statisticsService",{enumerable:!0,configurable:!0,writable:!0,value:e}),this.handle=this.handle.bind(this),ar.on(rn.CloseStoryReader,this.handle)}handle(e){this.statisticsService.addSlideEvent({action:1,storyId:e.storyId,slideIndex:e.slideIndex})}destroy(){ar.off(rn.CloseStoryReader,this.handle)}}class en{constructor(e){Object.defineProperty(this,"statisticsService",{enumerable:!0,configurable:!0,writable:!0,value:e}),this.handle=this.handle.bind(this),ar.on(rn.NextSlide,this.handle)}handle(e){this.statisticsService.addSlideEvent({action:1,storyId:e.fromStoryId,slideIndex:e.fromSlideIndex})}destroy(){ar.off(rn.NextSlide,this.handle)}}class tn{constructor(e){Object.defineProperty(this,"statisticsService",{enumerable:!0,configurable:!0,writable:!0,value:e}),this.handle=this.handle.bind(this),ar.on(rn.TransitionFromSlide,this.handle)}handle(e){this.statisticsService.addSlideEvent({action:2,storyId:e.storyId,slideIndex:e.slideIndex})}destroy(){ar.off(rn.TransitionFromSlide,this.handle)}}var rn,nn=function(e,t,r,i){return new(r||(r=Promise))((function(n,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}l((i=i.apply(e,t||[])).next())}))};!function(e){e.CloseStoryReader="statistics.closeStoryReader",e.NextSlide="statistics.nextSlide",e.TransitionFromSlide="statistics.transitionFromSlide"}(rn||(rn={}));class sn extends(ee()){constructor(e){super(),Object.defineProperty(this,"beaconService",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"lastIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"sourceInfo",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"flushSheduler",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"slideDurationCalculator",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"events",{enumerable:!0,configurable:!0,writable:!0,value:[]}),this.flushSheduler=new Zi(this),this.slideDurationCalculator=new Xi}init(e){this.data=[],this.sourceInfo=e,this.lastIndex=0,this.slideDurationCalculator.init(),this.flushSheduler.start(),this.events=[new Ji(this),new en(this),new tn(this)]}getData(){return this.data.slice()}getLastIndex(){return this.lastIndex}cleanupData(){this.data=[]}addSlideEvent(e){if(!ut())return;const t=this.slideDurationCalculator.calculate();this.data.push([e.action,this.lastIndex,e.storyId,e.slideIndex,t]),this.lastIndex++}sendData(){return nn(this,void 0,void 0,(function*(){const e=this.getData();if(e.length)try{if(!this.sourceInfo)throw new Error(`[${sn.name}]: You need pass source info!`);this.cleanupData(),yield this.beaconService.updateStatistics({updateDto:{data:e},listType:vt(this.sourceInfo.feedSlug)})}catch(t){this.data.push(...e),console.error(t)}}))}destroy(){return nn(this,void 0,void 0,(function*(){this.events.forEach((e=>e.destroy())),this.flushSheduler.stop(),yield this.sendData()}))}}var on=function(e,t,r,i){return new(r||(r=Promise))((function(n,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}l((i=i.apply(e,t||[])).next())}))};class an{constructor(e){Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:e})}updateStatistics(e){return on(this,arguments,void 0,(function*({listType:e,updateDto:t}){var r;if(0===t.data.length)return t;let i=!1,n="";if(e===We.UGC||(null===(r=this.storyManager.getConfig())||void 0===r?void 0:r.disableStatistic))i=!0;else try{K("session/update",t,(()=>{})),i=!0}catch(e){n=e.toString()}if(i)return t;throw n}))}}var ln=function(e,t,r,i){return new(r||(r=Promise))((function(n,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}l((i=i.apply(e,t||[])).next())}))};class dn{constructor(e){Object.defineProperty(this,"storyReaderViewModel",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"deferredActionsQueue",{enumerable:!0,configurable:!0,writable:!0,value:new Ki}),Object.defineProperty(this,"narrativeStoryCache",{enumerable:!0,configurable:!0,writable:!0,value:new Qi}),Object.defineProperty(this,"activeStorySlide",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"activeStory",{enumerable:!0,configurable:!0,writable:!0,value:null})}lock(e){if(this.activeStorySlide&&this.activeStorySlide!==e)throw new Error(`[SlideApi]: The resource is locked by story with ID ${this.activeStorySlide.story.id} and slide index ${this.activeStorySlide.index}`);this.activeStorySlide=e}unlock(e){this.activeStorySlide===e&&(this.activeStorySlide=null)}exec(){this.activeStorySlide&&(this.deferredActionsQueue.exec(),this.deferredActionsQueue.flush())}getStoryLocalData(){return ln(this,void 0,void 0,(function*(){if(!this.activeStory)return{};let e=sessionStorage.getItem("narrative_"+this.activeStory.id+"_data");return e?JSON.parse(e):{}}))}setStoryLocalData(e,t){if(!this.activeStory)return;let r=JSON.stringify(e);sessionStorage.setItem("narrative_"+this.activeStory.id+"_data",r),t&&ut()&&It.sentData(this.activeStory.id,{data:r},St)}getStoryServerData(e){var t,r;return null!==(r=null===(t=this.storyReaderViewModel.widgetsData._narrative_saved_data)||void 0===t?void 0:t[e])&&void 0!==r?r:null}updateStoryServerData(e,t){this.storyReaderViewModel.widgetsData._narrative_saved_data=t}getSlideDuration(e,t){var r,i,n;return null!==(n=null===(i=null===(r=this.storyReaderViewModel.widgetsData._narrative_slides_duration)||void 0===r?void 0:r[e])||void 0===i?void 0:i[t])&&void 0!==n?n:null}pauseUI(){_r()}resumeUI(){xr()}showStoryTextInput(e,t){ar.emit(ro.ShowInputModal,{id:e,config:t})}setStorySessionValue(e,t){this.narrativeStoryCache.set(e,t)}getStorySessionValue(e){return this.narrativeStoryCache.get(e)}getWidgetsSharedData(e,t){var r,i,n;const s=this.storyReaderViewModel.widgetsData;switch(t){case"rangeSlider":return null===(r=s._narrative_range_slider_data)||void 0===r?void 0:r[e];case"poll":return null===(i=s._narrative_poll_data)||void 0===i?void 0:i[e];case"vote":return null===(n=s._narrative_vote_data)||void 0===n?void 0:n[e]}return null}openUrl(e){this.activeStory&&(this.activeStory.markAsOpened(),ar.emit(rn.TransitionFromSlide,{storyId:this.activeStory.id,slideIndex:this.activeStory.activeSlideIndex}),window.open(e,"_parent"))}sendApiRequest(e,t,r,i,n,s){return It.sendApiRequest({url:e,method:t,params:r,headers:i,data:n,profilingKey:s},St)}share(e,t){null==e&&(e="story-share"),ar.emit(ro.PerformShareAction,{shareId:e,config:t})}shareSlideScreenshot(e,t,r){null==e&&(e="slide-screenshot-share"),ar.emit(ro.PerformScreenShotShareAction,{shareId:e,hideElementsSelector:null!=t?t:"",shareText:r})}showLayer(e){ar.emit(ro.ShowLayer,{index:e})}showStorySlide(e){this.pushToDefferedActionsQueueOrExec((()=>{var t;null===(t=this.activeStory)||void 0===t||t.redirectToSlide({slideIndex:e})}))}storyShowNext(){ar.emit(`${Ao.name}.showNextStory`)}showNextSlide(e){this.pushToDefferedActionsQueueOrExec((()=>{e?this.activeStory.timer.start(e):this.activeStory.nextSlide()}))}sendStatisticEvent(e,t,r){ar.emit("publicEvents.widgetEvent",{name:e,devPayload:r})}destroy(){}setActiveStory(e){this.narrativeStoryCache.clear(),this.activeStory=e,this.activeStorySlide&&this.unlock(this.activeStorySlide)}resetStory(e){return ln(this,void 0,void 0,(function*(){var t;let r={},i=yield this.getStoryLocalData();i=Object.assign({},null!==(t=this.getStoryServerData(e))&&void 0!==t?t:{},i);for(let e in i)i.hasOwnProperty(e)&&/^_gm_[A-z0-9-_]+_attempts$/.test(e)&&(r[e]=i[e]);ar.emit(Xr.REFRESH_WIDGETS_STATE),this.updateStoryServerData(e,r),this.setStoryLocalData(r,!0),this.showStorySlide(0),this.showLayer(0)}))}pushToDefferedActionsQueueOrExec(e){this.activeStorySlide?e():this.deferredActionsQueue.push(e)}getStoryFonts(){const e=L.getState().cache;return null!=e&&Array.isArray(e)?L.getState().cache.filter((e=>"font-face"===e.type)):[]}updateTimeline(e,t,r,i,n,s){}showToast(e){ar.emit(ro.ShowToast,{content:e})}}const cn=function(){var e="test";try{return localStorage.setItem(e,e),localStorage.removeItem(e),!0}catch(e){return!1}}();function un(e){let t=null;if(cn){let r=window.localStorage.getItem(e);null!==r&&Nt()(r)&&r.trim().length>0&&(t=JSON.parse(r))}return t}function hn(e,t){cn&&window.localStorage.setItem(e,JSON.stringify(t))}var pn=function(e,t,r,i){return new(r||(r=Promise))((function(n,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}l((i=i.apply(e,t||[])).next())}))};let fn=null;function gn(){return pn(this,void 0,void 0,(function*(){return null!=fn?fn:new Promise((e=>{!function(e,t){const r=new Image;r.onload=function(){var i=r.width>0&&r.height>0;t(e,i)},r.onerror=function(){t(e,!1)},r.src="data:image/webp;base64,"+{lossy:"UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA",lossless:"UklGRhoAAABXRUJQVlA4TA0AAAAvAAAAEAcQERGIiP4HAA==",alpha:"UklGRkoAAABXRUJQVlA4WAoAAAAQAAAAAAAAAAAAQUxQSAwAAAARBxAR/Q9ERP8DAABWUDggGAAAABQBAJ0BKgEAAQAAAP4AAA3AAP7mtQAAAA==",animation:"UklGRlIAAABXRUJQVlA4WAoAAAASAAAAAAAAAAAAQU5JTQYAAAD/////AABBTk1GJgAAAAAAAAAAAAAAAAAAAGQAAABWUDhMDQAAAC8AAAAQBxAREYiI/gcA"}[e]}("lossy",((t,r)=>{fn=r,e(r)}))}))}))}var vn=function(e,t,r,i){return new(r||(r=Promise))((function(n,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}l((i=i.apply(e,t||[])).next())}))};const mn=new class{openSession(e){return vn(this,void 0,void 0,(function*(){var t;return(yield Y.post(e.url,null!==(t=e.data)&&void 0!==t?t:{},e.params)).data}))}};function yn(e,t,r=!1,i,n){const s=["slides"];i&&s.push("share_url");const o={url:`${t===gt?"ugc/":""}story/${e}`,method:"GET",params:{expand:s.join(",")}};return o.params.once=Number(Boolean(n)),r||null!=o.params&&(o.params.fields=["id","slides"].join(",")),o}const bn=(e,t,r,i)=>{var n;let s=null===(n=y.getState())||void 0===n?void 0:n.tags;const o={};s&&ke()(s)&&s.length>0&&(o.tags=s.join(",")),void 0!==e&&ke()(e)&&e.length>0&&(o.tags=e.join(","));return null==r||"number"!=typeof r&&!(e=>!isNaN(parseFloat(e))&&isFinite(e))(r)||(o.limit=r),null!=t&&(o.test=t),null!=i&&W()(i)&&(o.f=JSON.stringify(i)),{params:o}};var wn=function(e,t,r,i){return new(r||(r=Promise))((function(n,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}l((i=i.apply(e,t||[])).next())}))};ze.use((e=>wn(void 0,void 0,void 0,(function*(){return Ve.getState().style||(yield Ge()),xn.fetchStoryContext(e)})))),Ge.use((()=>wn(void 0,void 0,void 0,(function*(){return xn.fetchStoryStyles()}))));Ve.on([ze.doneData,Ge.doneData],((e,t)=>{var r;const i=Object.assign(Object.assign({},e),{widgetsData:Object.assign({},e.widgetsData)});return i.style=null!==(r=null==t?void 0:t.style)&&void 0!==r?r:e.style,i.widgetsData=t.widgetsData?((e,t)=>{for(const[r,i]of Object.entries(t)){const t=Array.isArray(i)?{}:i;e[r]=Object.assign(Object.assign({},e[r]),t)}return e})(i.widgetsData,t.widgetsData):i.widgetsData,i}));class Sn extends Error{constructor(e){super(`Story with ID ${e} has already been shown to the user`),this.name=Sn.name}}var _n=function(e,t,r,i){return new(r||(r=Promise))((function(n,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}l((i=i.apply(e,t||[])).next())}))};const xn=new class{fetchUgcFeed(e){return _n(this,arguments,void 0,(function*({filter:e,testKey:t}){var r;const i=function(e,t,r,i){const{params:n}=bn(r,i,null,t);return{method:"GET",url:"ugc/feed",params:n}}(0,e,[],t);return(yield Y.get(i.url,null!==(r=i.params)&&void 0!==r?r:{})).data}))}fetchFeed(e){return _n(this,arguments,void 0,(function*({feedSlug:e,testKey:t}){var r;const i=function(e,t,r){const{params:i}=bn(t,r);return{method:"GET",url:`feed/${e}`,params:i}}(e,[],t),n=yield Y.get(i.url,null!==(r=i.params)&&void 0!==r?r:{});return n.data.feedSlug=e,n.data}))}fetchFavoriteList(){return _n(this,void 0,void 0,(function*(){var e;const t=function(){const{params:e}=bn();return{method:"GET",url:"story",params:Object.assign(Object.assign({},e),{favorite:1})}}();return(yield Y.get(t.url,null!==(e=t.params)&&void 0!==e?e:{})).data}))}fetchOnboardingList(e){return _n(this,arguments,void 0,(function*({onboardingList:e,onboardingTags:t,limit:r}){var i;const n=function(e="onboarding",t,r){const{params:i}=bn(t,null,r);return{method:"GET",url:`feed/${e}/onboarding`,params:i}}(e,t,r),s=yield Y.get(n.url,null!==(i=n.params)&&void 0!==i?i:{});return s.data.feedSlug=e,s.data}))}fetchStorySlides(e){return _n(this,arguments,void 0,(function*({id:e,feedSlug:t}){var r;const i=yn(e,t);return(yield Y.get(i.url,null!==(r=i.params)&&void 0!==r?r:{})).data}))}fetchStory(e){return _n(this,arguments,void 0,(function*({id:e,feedSlug:t,fetchShareUrl:r,once:i}){var n;const s=yn(e,t,!0,r,i),o=yield Y.get(s.url,null!==(n=s.params)&&void 0!==n?n:{});if(204===o.status&&i)throw new Sn(e.toString());return o.data}))}fetchStoryContext(e){return _n(this,arguments,void 0,(function*({ids:e}){var t;const r=function(e){return{url:"story-context",method:"GET",params:{id:e.join(","),fields:"widgetsData"}}}(e);return(yield Y.get(r.url,null!==(t=r.params)&&void 0!==t?t:{})).data}))}fetchStoryStyles(){return _n(this,void 0,void 0,(function*(){var e;const t={url:"story-context",method:"GET",params:{fields:"style"}};return(yield Y.get(t.url,null!==(e=t.params)&&void 0!==e?e:{})).data}))}},On=/[\r\n%#()<>?[\\\]^`{|}]/g;function Cn(e,t="double"){return(e=(e=(e="double"===t?e.replace(/"/g,"'"):e.replace(/'/g,'"')).replace(/>\s{1,}</g,"><")).replace(/\s{2,}/g," ")).replace(On,encodeURIComponent)}const kn=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});var Ln;!function(e){e.LANDSCAPE_PRIMARY="landscape-primary",e.LANDSCAPE_SECONDARY="landscape-secondary",e.PORTRAIT_PRIMARY="portrait-primary",e.PORTRAIT_SECONDARY="portrait-secondary"}(Ln||(Ln={}));var An=function(e,t,r,i){return new(r||(r=Promise))((function(n,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}l((i=i.apply(e,t||[])).next())}))};const Mn=e=>An(void 0,void 0,void 0,(function*(){return(yield fetch(e)).blob()})),En=e=>An(void 0,void 0,void 0,(function*(){const t=yield Mn(e);return function(e,t=!0){return new Promise((function(r){var i=new FileReader;i.onloadend=function(){if(t){var e=String(i.result).replace("data:","").replace(/^.+,/,"");r(e)}else r(String(i.result))},i.readAsDataURL(e)}))}(new File([t],"image",{type:t.type,lastModified:(new Date).getTime()}),!1)}));function Pn(e,t,r,i){var n=e.indexOf(r,t);if(-1===n)return null;for(var s="",o=n+r.length;o<e.length&&-1===i.indexOf(e[o]);o++)s+=e[o];return{foundAtIndex:n,value:s}}function jn(e,t){const r=document.createElementNS("http://www.w3.org/2000/svg",e);for(let e in t)r.setAttributeNS(null,e.replace(/[A-Z]/g,(function(e,t,r,i){return"-"+e.toLowerCase()})),t[e]);return r}var In;function Tn(e,t,r,i,n,s,o,a,l,d){var c=jn("svg",{width:String(n),height:String(s),style:"background-color: #fff;"}),u=jn("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!=i&&"string"==typeof i&&i.length>0){const e=Array.prototype.slice.call(h.querySelectorAll(i));for(let t=0;t<e.length;t++){const r=e[t];r&&r.style&&r.style.setProperty&&r.style.setProperty("display","none")}}u.appendChild(h);var p=[];(function(e){for(var t=[],r=0;;){var i=Pn(e,r,"src: url(",[" ",")","\t"]);if(null==i)break;r=i.foundAtIndex+i.value.length,t.push(i.value.replace(/["']/g,""))}return t})(r).forEach((function(e){p.push(new Promise((function(t,i){En(e).then((function(i){r=r.replace(e,i),t()})).catch((function(e){t()}))})))})),u.querySelectorAll("img").forEach((function(e){e.crossOrigin="Anonymous",p.push(new Promise((function(t,r){En(e.src).then((function(r){e.onload=r=>e.decode().then((()=>t())),e.onerror=e=>{console.error(e),t()},e.decoding="sync",e.src=r})).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=jn("style",{});t.textContent=r,c.appendChild(t);const i=(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 r=e.toDataURL(o,a);Mn(r).then((function(t){l(t),e.remove()}))}}),e===In.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.decoding="sync",u.src="data:image/svg+xml;base64,"+btoa(encodeURIComponent(i).replace(/%([0-9A-F]{2})/g,(function(e,t){return String.fromCharCode(parseInt(t,16))})))}))}()}function Rn(e,t,r,i){return new Promise((function(n,s){null==i&&(i=""),function(e,t,r,i,n,s){Tn(e,t,r,i,t.clientWidth,t.clientHeight,"image/jpeg",1,n,s)}(e,t,r,i,(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 Dn(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"}(In||(In={}));const Bn=()=>{let e=!1;try{const t=Object.defineProperty({},"passive",{get:function(){e=!0}}),r=()=>{};window.addEventListener("test",r,t),window.removeEventListener("test",r)}catch(e){}return e},Nn=!!Bn()&&{passive:!0};!function(){const e=window.requestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||window.msRequestAnimationFrame;window.requestAnimationFrame=e}();const Fn=function(){let e,t=document.createElement("div"),r={transition:"transitionend",OTransition:"otransitionend",MozTransition:"transitionend",WebkitTransition:"webkitTransitionEnd"};for(e in r)if(r.hasOwnProperty(e)&&void 0!==t.style[e])return r[e]}();function Un(e,t,r){return new Promise((i=>{let n=!1;const s=()=>{n=!0,clearTimeout(a),void 0!==Fn&&e.removeEventListener(Fn,o),e.style.setProperty("transition",`${t} 0ms`),i()},o=e=>{e.propertyName===t&&(n||s())};void 0!==Fn&&e.addEventListener(Fn,o,!1);const a=setTimeout((()=>{n||s()}),r+20);e.style.setProperty("transition",`${t} ${r}ms`)}))}var Vn=function(e,t,r,i){return new(r||(r=Promise))((function(n,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}l((i=i.apply(e,t||[])).next())}))};const zn=(e,...t)=>Vn(void 0,[e,...t],void 0,(function*(e,t=300){return new Promise((r=>{const i=Math.max(0,t-((new Date).getTime()-e));i?setTimeout(r,i):r()}))}));var Gn=function(e,t,r,i){return new(r||(r=Promise))((function(n,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}l((i=i.apply(e,t||[])).next())}))};class Wn{fetchStoryAndContextById(e){return Gn(this,arguments,void 0,(function*({storyId:e,feed:t,fetchShareUrl:r,once:i}){try{const n=(new Date).getTime();return yield A(),yield ze({ids:[e],feedSlug:t}),yield as({id:e,feedSlug:t,fetchShareUrl:r,once:i}),yield zn(n),this.getOrCreateDirectStoryById(e)}catch(t){if(i)throw t;const r=this.getOrCreateDirectStoryById(e);return r.error=t,r}}))}fetchStoriesSlidesAndContextByStoryId(e){return Gn(this,arguments,void 0,(function*({storyId:e,listType:t,feed:r=""}){const i=this.getVisibleStoriesByListTypeAndFeed(t,r),n=i.findIndex((t=>t.id===e));return yield this.fetchStoriesSlidesAndContextByRange({stories:i,storyIndex:n,listType:t,feed:r}),this.getStoriesWithSlidesAndContext({listType:t,feed:r})}))}fetchStoriesSlidesAndContextByNextStoryIndex(e){return Gn(this,arguments,void 0,(function*({nextStoryIndex:e,listType:t,feed:r}){const i=this.getVisibleStoriesByListTypeAndFeed(t,r);return yield this.fetchStoriesSlidesAndContextByRange({stories:i,storyIndex:e,listType:t,feed:r}),this.getStoriesWithSlidesAndContext({listType:t,feed:r})}))}getOrCreateDirectStoryById(e){var t;return null!==(t=ft(Re.direct).find((t=>t.id===e||t.string_id===e.toString())))&&void 0!==t?t:$e(e)}getStoriesWithSlidesAndContext({listType:e,feed:t}){return{storyList:ft(e,t).filter((e=>!e.hide_in_reader)),storyContext:Ve.getState(),listType:e}}fetchStoriesSlidesAndContextByRange(e){return Gn(this,void 0,void 0,(function*(){const t=this.getStoryIdsByStoriesRange(e.stories,e.storyIndex);if(!t.length)return null;yield this.fetchSlidesAndContext({feed:e.feed,storyIds:t})}))}getStoryIdsByStoriesRange(e,t){const r=t-2,i=t+2;return e.slice(Math.max(r,0),i+1).filter((e=>!e.slidesLoaded)).map((e=>e.id))}fetchSlidesAndContext(e){return Gn(this,arguments,void 0,(function*({feed:e,storyIds:t}){const r=(new Date).getTime();try{yield ze({ids:t,feedSlug:e}),yield Promise.allSettled(t.map((t=>os({id:t,feedSlug:e})))),yield zn(r)}catch(e){}}))}getVisibleStoriesByListTypeAndFeed(e,t){return ft(e,t).filter((e=>!e.hide_in_reader))}}var $n=function(e,t,r,i){return new(r||(r=Promise))((function(n,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}l((i=i.apply(e,t||[])).next())}))};const Hn=f(37);A.use((()=>$n(void 0,void 0,void 0,(function*(){const e=L.getState();if(e.session.id)return e;const t=yield function(){return $n(this,void 0,void 0,(function*(){const[e,t]=yield Promise.all([Qn(),gn()]);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:qn(e,t)}}))}();return mn.openSession(t)})))),(0,e.sample)({clock:M,target:L});const qn=(e,t)=>{"iOS"===e.os_name?window.isIos=!0:"Android"===e.os_name&&(window.Android=!0);const r=y.getState();return r&&r.userId&&(e.user_id=r.userId,e.user_sign=r.userIdSign),e.features="animation,data,deeplink,placeholder,resetTimers,gameReader,sendApi,swipeUpItems,imgPlaceholder,vod,closeStoryApi",t&&(e.features+=",webp"),e},Qn=()=>$n(void 0,void 0,void 0,(function*(){return new Promise(((e,t)=>{let r=un("device_data"),i=null;if(null!==r&&(i=r.device_id),null!==r&&i&&Nt()(i)&&36===i.trim().length)k(i),e(r);else{const t={platform:"web",device_id:Hn.v4()};hn("device_data",t),k(t.device_id),e(t)}}))})),Kn=(0,e.createEffect)();var Yn=function(e,t,r,i){return new(r||(r=Promise))((function(n,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}l((i=i.apply(e,t||[])).next())}))};Kn.use((()=>Yn(void 0,void 0,void 0,(function*(){return(yield Y.request(yield function(){return Yn(this,void 0,void 0,(function*(){return{method:"GET",url:"ugc/editor-config",params:{}}}))}())).data})))),L.on(Kn.doneData,((e,t)=>{const r=Object.assign({},e);return r.editor=t,r}));class Zn extends ht{attributes(){return["width","height","type","url"]}constructor(){super(),Object.defineProperty(this,"width",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"height",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"type",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_url",{enumerable:!0,configurable:!0,writable:!0,value:""})}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 Xn=f(3981);class Jn{constructor(){Object.defineProperty(this,"images",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"color",{enumerable:!0,configurable:!0,writable:!0,value:""}),Object.defineProperty(this,"gradient",{enumerable:!0,configurable:!0,writable:!0,value:!1})}static createFromArray(e){const t=new Jn;for(let r in e)e.hasOwnProperty(r)&&t.images.push(Zn.createInstance(Zn,e[r]));return t}findOneByType(e){let t=null;return this.images.forEach((r=>{r.type===e&&(t=r)})),t}findOneByWidth(e,t=!1){let r=null;return this.images.forEach((t=>{t.width===e&&(r=t)})),null!==r||t&&void 0!==(r=Xn(this.images))?r:null}}class es extends ht{constructor(){super(...arguments),Object.defineProperty(this,"id",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"feedSlug",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_cover",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"hasFavorite",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"stories",{enumerable:!0,configurable:!0,writable:!0,value:[]})}attributes(){return at()(super.attributes(),["id","cover","hasFavorite","stories"])}set cover(e){this._cover=Jn.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}}var ts=function(e,t,r,i){return new(r||(r=Promise))((function(n,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}l((i=i.apply(e,t||[])).next())}))};const rs=(0,e.createEffect)((e=>ts(void 0,void 0,void 0,(function*(){return xn.fetchUgcFeed(e)})))),is=(0,e.createEffect)((e=>ts(void 0,void 0,void 0,(function*(){return xn.fetchFeed(e)})))),ns=(0,e.createEffect)((()=>ts(void 0,void 0,void 0,(function*(){return xn.fetchFavoriteList()})))),ss=(0,e.createEffect)((e=>ts(void 0,void 0,void 0,(function*(){return xn.fetchOnboardingList(e)})))),os=(0,e.createEffect)((e=>ts(void 0,void 0,void 0,(function*(){return xn.fetchStorySlides(e)})))),as=(0,e.createEffect)((e=>ts(void 0,void 0,void 0,(function*(){return xn.fetchStory(e)})))),ls=(0,e.createEvent)(),ds=(0,e.createEffect)((e=>ts(void 0,[e],void 0,(function*({defaultList:e,onboardingList:t,favoriteList:r,onboardingTags:i,testKey:n,limit:s}){var o;if(yield A(),!1!==e&&W()(e)&&Nt()(e.feedSlug)){const t=e.feedSlug,r=null!==(o=e.filter)&&void 0!==o?o:{};t===gt?yield rs({filter:r,testKey:n}):yield is({feedSlug:t,testKey:n})}r&&(yield ns()),!1!==t&&Nt()(t)&&(yield ss({onboardingList:t,onboardingTags:i,limit:s}))})))),cs=e=>{const t=Ee.getState();for(let r in t.user)hs.call(t.user,r)&&(e=Zt(e,`%${r}%`,t.user[r]));for(let r in t.default)hs.call(t.default,r)&&(e=Zt(e,`%${r}%`,t.default[r]));const r=Le.getState();for(let t in r.user)hs.call(r.user,t)&&(e=Zt(e,`%${t}%`,r.user[t]));for(let t in r.default)hs.call(r.default,t)&&(e=Zt(e,`%${t}%`,r.default[t]));return e},us=(e,t)=>Array.isArray(e)?e.map((e=>Object.assign(Object.assign({},e),{title:e.need_placeholders?cs(e.title):e.title,slidesLoaded:!1,is_opened:rt(e),type:t}))):[];(0,e.sample)({clock:A.doneData,filter:L.map((e=>!e.session.id)),target:L}),(0,e.sample)({clock:L.map((e=>e.placeholders)),target:je}),(0,e.sample)({clock:L.map((e=>e.image_placeholders)),target:Me});const hs=Object.prototype.hasOwnProperty;(0,e.sample)({source:qe,clock:L,fn:(e,t)=>{const r={};for(const i in e)hs.call(e,i)&&(r[i]=e[i].map((e=>Object.assign(Object.assign({},e),{is_opened:rt(e,t.user_key),title:e.need_placeholders?cs(e.title):e.title}))));return r},target:qe});const{storiesListIdsChanged:ps}=(0,e.createApi)(Ye,{storiesListIdsChanged:(e,{storiesIdsUserEntity:t,feedSlug:r,storyList:i})=>{let n=L.getState().user_key||"default";const s=e[n]||{};return void 0===s[Ke.FAVORITE]&&(s[Ke.FAVORITE]=[]),void 0===s[Ke.FEEDS]&&(s[Ke.FEEDS]={}),t===Ke.FEEDS&&r&&(s[Ke.FEEDS][r]=i.map((e=>e.id))),t===Ke.FAVORITE&&(s[Ke.FAVORITE]=i.map((e=>e.id))),Object.assign(Object.assign({},e),{[n]:s})}}),{storiesListItemsAdded:fs}=(0,e.createApi)(qe,{storiesListItemsAdded:(e,{storiesIdsUserEntity:t,feedSlug:r,storyList:i})=>{let n=L.getState().user_key||"default";const s=e[n]||[],o=s.map((e=>e.id));return Object.assign(Object.assign({},e),{[n]:[...s,...i.filter((e=>-1===o.indexOf(e.id))).map((e=>Object.assign(Object.assign({},e),{slides:[]})))]})}}),{storyFeedsAdded:gs}=(0,e.createApi)(He,{storyFeedsAdded:(e,t)=>Object.assign(Object.assign({},e),t)});(0,e.sample)({clock:is.doneData.map((e=>{let t={};return t[e.feedSlug]=ht.createInstance(es,e),t})),target:[gs]}),(0,e.sample)({clock:rs.doneData.map((e=>{let t={};return t[gt]=ht.createInstance(es,e),t})),target:[gs]}),(0,e.sample)({clock:is.doneData.map((e=>{const t=us(e.stories,We.DEFAULT);return{storiesIdsUserEntity:Ke.FEEDS,feedSlug:e.feedSlug,storyList:t}})),target:[fs,ps]}),(0,e.sample)({clock:rs.doneData.map((e=>{const t=us(e,We.UGC);return{storiesIdsUserEntity:Ke.FEEDS,feedSlug:gt,storyList:t}})),target:[fs,ps]}),(0,e.sample)({clock:ss.doneData.map((e=>{const t=us(e.stories,We.DEFAULT);return{storiesIdsUserEntity:Ke.FEEDS,feedSlug:`onboarding_${e.feedSlug}`,storyList:t}})),target:[fs,ps]}),(0,e.sample)({clock:ns.doneData.map((e=>{const t=us(e,We.DEFAULT);return{storiesIdsUserEntity:Ke.FAVORITE,feedSlug:null,storyList:t}})),target:[fs,ps]});const vs=(e,t)=>Object.assign(Object.assign({},e),{slidesLoaded:!0,error:null,is_opened:rt(e),slides:t.slides.map((t=>Object.assign(Object.assign({},t),{html:e.need_placeholders?cs(t.html):t.html})))}),ms=()=>L.getState().user_key||"default",ys=(e,t)=>(e[t]||[]).slice(),bs=(e,t)=>e.findIndex((e=>e.id===t)),ws=(e,t)=>{const r=ms(),i=ys(e,r),n=bs(i,t.id);return-1===n?i.push(vs(t,t)):i[n]=vs(i[n],t),Object.assign(Object.assign({},e),{[r]:i})},Ss=(e,{params:{id:t},error:r})=>{const i=ms(),n=ys(e,i),s=bs(n,t);if(-1===s){const e=$e(t);e.error=r,n.push(e)}else n[s]=Object.assign(Object.assign({},n[s]),{slidesLoaded:!1,error:r});return Object.assign(Object.assign({},e),{[i]:n})};qe.on(ze.fail,((e,{params:{ids:t},error:r})=>{const i=ms(),n=ys(e,i);for(const e of t){const t=bs(n,e);if(-1===t){const t=$e(e);t.error=r,n.push(t)}else n[t]=Object.assign(Object.assign({},n[t]),{slidesLoaded:!1,error:r})}return Object.assign(Object.assign({},e),{[i]:n})})),qe.on(os.doneData,ws),qe.on(as.doneData,ws),qe.on(os.fail,Ss),qe.on(as.fail,Ss),qe.on(ls,((e,{id:t,story:r})=>{const i=ms(),n=ys(e,i),s=bs(n,t);return-1===s?e:(n[s]=Object.assign(Object.assign({},n[s]),r),Object.assign(Object.assign({},e),{[i]:n}))})),(0,e.sample)({source:qe,clock:Ee,fn:e=>{const t={};for(const r in e)hs.call(e,r)&&(t[r]=e[r].map((e=>Object.assign(Object.assign({},e),{slides:e.slides.map((t=>Object.assign(Object.assign({},t),{html:e.need_placeholders?cs(t.html):t.html})))}))));return t},target:qe});var _s=f(3514),xs=f.n(_s),Os=f(2438),Cs=f.n(Os),ks=function(e,t,r,i){return new(r||(r=Promise))((function(n,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}l((i=i.apply(e,t||[])).next())}))};class Ls{static updateStoryLike(e,t){return ks(this,void 0,void 0,(function*(){let r=!1;const i={like:void 0};let n="";try{const s=yield Y.post(`story-like/${e}`,{value:t});void 0!==s.data.like?(r=!0,i.like=s.data.like,nt({id:e,like:i.like})):n="response.data.like is undefined"}catch(e){n=e.toString()}if(r)return i;throw n}))}static getStorySharePath(e){return ks(this,void 0,void 0,(function*(){let t=!1;const r={url:void 0};let i="";try{const n=yield Y.get(`story-share/${e}`,{});void 0!==n.data.url?(t=!0,r.url=n.data.url):i="response.data.url is undefined"}catch(e){i=e.toString()}if(t)return r;throw i}))}static markAsOpened(e){if(!xs()(L.getState().user_key)){const t=`u/${L.getState().user_key}/s_opened`;let r=un(t);ke()(r)||(r=[]),r.push(e),r=Cs()(r),hn(t,r)}st({id:e})}static setBookmark(e,t){return ks(this,void 0,void 0,(function*(){let r=!1;const i={favorite:void 0};let n="";try{const s=yield Y.post(`story-favorite/${e}`,{value:t});void 0!==s.data.favorite?(r=!0,i.favorite=Boolean(s.data.favorite),!1===i.favorite?ps({storiesIdsUserEntity:Ke.FAVORITE,feedSlug:null,storyList:et.getState().filter((t=>t.id!==e))}):ps({storiesIdsUserEntity:Ke.FAVORITE,feedSlug:null,storyList:[...et.getState(),...Qe.getState().filter((t=>t.id===e))]}),it({id:e,favorite:i.favorite})):n="response.data.favorite is undefined"}catch(e){n=e.toString()}if(r)return i;throw n}))}}class As{constructor(){Object.defineProperty(this,"prevStoryId",{enumerable:!0,configurable:!0,writable:!0,value:-1}),Object.defineProperty(this,"prevSlideIndex",{enumerable:!0,configurable:!0,writable:!0,value:-1})}update({currentSlideIndex:e,currentStoryId:t}){this.prevStoryId!==t&&ar.emit("publicEvents.showStory",{id:t,index:e}),-1!==this.prevStoryId&&ar.emit(rn.NextSlide,{fromStoryId:this.prevStoryId,fromSlideIndex:this.prevSlideIndex}),ar.emit("publicEvents.showSlide",{id:t,index:e}),this.prevStoryId=t,this.prevSlideIndex=e}reset(){this.prevStoryId=-1,this.prevSlideIndex=-1}}var Ms=function(e,t,r,i){return new(r||(r=Promise))((function(n,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}l((i=i.apply(e,t||[])).next())}))};class Es extends Error{constructor(){super("The list of onboarding stories is empty")}}class Ps{constructor(e,t){Object.defineProperty(this,"showMultipleStoriesStrategy",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:t})}show(e){return Ms(this,void 0,void 0,(function*(){let t="onboarding";e.feed&&(t=e.feed),yield ds({defaultList:!1,favoriteList:!1,onboardingList:t,onboardingTags:e.customTags,limit:e.limit});const r=ft(Re.onboarding,t);if(!r.length)throw new Es;this.emitFeedLoad(t,r),yield this.showMultipleStoriesStrategy.show({windowReferer:Te.default,listType:Re.onboarding,storyId:r[0].id,feed:t})}))}emitFeedLoad(e,t){const r={stories:t.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),Object.assign({id:e.id},t)})),feed:null,filter:null};r.feed=e,this.storyManager.emit("feedLoad",r)}reload(e){return Ms(this,void 0,void 0,(function*(){this.showMultipleStoriesStrategy.reload(e)}))}}var js=function(e,t,r,i){return new(r||(r=Promise))((function(n,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}l((i=i.apply(e,t||[])).next())}))};class Is{constructor(e,t){Object.defineProperty(this,"storyReaderViewModel",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"storyReaderStoriesService",{enumerable:!0,configurable:!0,writable:!0,value:t})}show(e){return js(this,void 0,void 0,(function*(){const t=vt(e.feed),r=((e,t,r)=>{const i=ft(e.listType,r);let n=L.getState().share;return t===We.UGC&&(n=!1),Object.assign(Object.assign({},e),{id:e.storyId,storyContext:Ve.getState(),storyList:i,hasShare:n,placeholders:Ue()})})(e,t,e.feed);this.storyReaderViewModel.open(r,{listType:e.listType,feedSlug:e.feed,filter:e.filter});const i=yield this.storyReaderStoriesService.fetchStoriesSlidesAndContextByStoryId({storyId:e.storyId,listType:e.listType,feed:e.feed});this.storyReaderViewModel.setStoriesAndContext(i)}))}reload(e){return js(this,void 0,void 0,(function*(){const t=yield this.storyReaderStoriesService.fetchStoriesSlidesAndContextByStoryId(e);this.storyReaderViewModel.setStoriesAndContext(t)}))}}var Ts=function(e,t,r,i){return new(r||(r=Promise))((function(n,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}l((i=i.apply(e,t||[])).next())}))};class Rs{constructor(e){Object.defineProperty(this,"showStoryStrategy",{enumerable:!0,configurable:!0,writable:!0,value:e})}show(e){return Ts(this,void 0,void 0,(function*(){try{return yield this.showStoryStrategy.show({storyId:e.storyId,feed:"",fetchShareUrl:e.fetchShareUrl}),e.fetchShareUrl&&ct(!1),!0}catch(e){return!1}}))}reload(e){return Ts(this,void 0,void 0,(function*(){return this.showStoryStrategy.reload(e)}))}}var Ds=function(e,t,r,i){return new(r||(r=Promise))((function(n,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}l((i=i.apply(e,t||[])).next())}))};class Bs{constructor(e,t){Object.defineProperty(this,"storyReaderViewModel",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"storyReaderStoriesService",{enumerable:!0,configurable:!0,writable:!0,value:t})}show(e){return Ds(this,void 0,void 0,(function*(){var t;try{let r=this.storyReaderStoriesService.getOrCreateDirectStoryById(e.storyId);if(r.is_opened)throw new Sn(e.storyId.toString());if(!r.slidesLoaded){if(r=null!==(t=yield this.storyReaderStoriesService.fetchStoryAndContextById({storyId:e.storyId,feed:"",once:!0,listType:Re.direct}))&&void 0!==t?t:r,r.error)throw r.error;r.slidesLoaded=!1}const i=mt(r);this.storyReaderViewModel.open(i,{listType:Re.direct,feedSlug:"",once:!0}),r.slidesLoaded||(yield zn((new Date).getTime()),r.slidesLoaded=!0,this.storyReaderViewModel.setStoriesAndContext({listType:Re.direct,storyList:[r],storyContext:Ve.getState()}))}catch(e){throw this.storyReaderViewModel.close(),e}}))}reload(e){return Ds(this,void 0,void 0,(function*(){var t;const r=yield this.storyReaderStoriesService.fetchStoryAndContextById(Object.assign(Object.assign({},e),{feed:null!==(t=e.feed)&&void 0!==t?t:""}));this.storyReaderViewModel.setStoriesAndContext({listType:Re.direct,storyList:[r],storyContext:Ve.getState()})}))}}var Ns,Fs=function(e,t,r,i){return new(r||(r=Promise))((function(n,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}l((i=i.apply(e,t||[])).next())}))};class Us{constructor(e,t){Object.defineProperty(this,"storyReaderViewModel",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"storyReaderStoriesService",{enumerable:!0,configurable:!0,writable:!0,value:t})}show(e){return Fs(this,void 0,void 0,(function*(){var t,r;let i=this.storyReaderStoriesService.getOrCreateDirectStoryById(e.storyId);if(!i.slidesLoaded){if(i=yield this.storyReaderStoriesService.fetchStoryAndContextById({storyId:e.storyId,feed:null!==(t=e.feed)&&void 0!==t?t:"",listType:Re.direct,fetchShareUrl:e.fetchShareUrl}),i.error)throw i.error;i.slidesLoaded=!1}const n=mt(i);this.storyReaderViewModel.open(n,{listType:Re.direct,feedSlug:null!==(r=e.feed)&&void 0!==r?r:"",fetchShareUrl:e.fetchShareUrl}),i.slidesLoaded||(yield zn((new Date).getTime()),i.slidesLoaded=!0,this.storyReaderViewModel.setStoriesAndContext({listType:Re.direct,storyList:[i],storyContext:Ve.getState()}))}))}reload(e){return Fs(this,void 0,void 0,(function*(){var t;const r=yield this.storyReaderStoriesService.fetchStoryAndContextById(Object.assign(Object.assign({},e),{feed:null!==(t=e.feed)&&void 0!==t?t:""}));this.storyReaderViewModel.setStoriesAndContext({listType:Re.direct,storyList:[r],storyContext:Ve.getState()})}))}}!function(e){e[e.ShowStory=0]="ShowStory",e[e.ShowStoryOnce=1]="ShowStoryOnce",e[e.ShowStoryFromSharePage=2]="ShowStoryFromSharePage",e[e.ShowOnboardingStories=3]="ShowOnboardingStories",e[e.ShowMultipleStories=4]="ShowMultipleStories"}(Ns||(Ns={}));class Vs{create(e,t,r,i){switch(e){case Ns.ShowStory:return new Us(t,r);case Ns.ShowStoryOnce:return new Bs(t,r);case Ns.ShowStoryFromSharePage:return new Rs(new Us(t,r));case Ns.ShowOnboardingStories:return new Ps(new Is(t,r),i);case Ns.ShowMultipleStories:return new Is(t,r);default:throw new Error(`Strategy for type "${e}" not found.`)}}}const zs=.53167701863,Gs=.64516129032;class Ws{constructor(e,t,r){Object.defineProperty(this,"_vw",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"_vh",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"padding",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"viewportRatio",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.viewportRatio=e/t}get vw(){return this._vw}get vh(){return this._vh}get vhWitoutPadding(){return this._vh-this.padding.top-this.padding.bottom}getOffset(e){const t=this._vw,r=this.vhWitoutPadding-e,i=this.calculateWidthWithActionPanel(e),n=this.calculateHeightWithActionPanel(e);return this.viewportRatio>Gs?Math.ceil(n-r)/2*-1+"px auto":`0 ${Math.ceil(i-t)/2*-1}px`}getOffsetX(e){const t=this.calculateWidthWithActionPanel(e);return this.viewportRatio>Gs?"0px":Math.ceil(t-this._vw)/2+"px"}getOffsetY(e){const t=this.vhWitoutPadding-e;return this.viewportRatio>Gs?`${Math.ceil(this.calculateHeight()-t)}px`:"0px"}getWidth(){return this.viewportRatio>Gs?`${this.calculateWidth()}px`:"auto"}getHeight(){return this.viewportRatio>Gs?`${this.calculateHeight()}px`:"100%"}getFontSize(){return this.calculateWidth()/20+"px"}calculateWidth(){return Math.ceil(this.vhWitoutPadding*Gs)}calculateHeight(){return Math.ceil(this.calculateWidth()/Gs)}calculateWidthWithActionPanel(e){const t=this.vhWitoutPadding-e;return Math.ceil(t*Gs)}calculateHeightWithActionPanel(e){return Math.ceil(this.calculateWidthWithActionPanel(e)/Gs)}}class $s{constructor(e,t,r){Object.defineProperty(this,"_vw",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"_vh",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"padding",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"viewportRatio",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.viewportRatio=e/t}get vw(){return this._vw}get vh(){return this._vh}get vhWitoutPadding(){return this._vh-this.padding.top-this.padding.bottom}getOffset(e){const t=this._vw,r=this.vhWitoutPadding-e,i=this.calculateWidthWithActionPanel(e),n=this.calculateHeight();return n>r?Math.ceil(n-r)/2*-1+"px auto":`0 ${Math.ceil(i-t)/2*-1}px`}getOffsetX(e){const t=this.calculateWidthWithActionPanel(e),r=this.vhWitoutPadding-e,i=this.calculateHeight(),n=this._vw;return i>r?"0px":Math.ceil(t-n)/2+"px"}getOffsetY(e){const t=this.vhWitoutPadding-e,r=this.calculateHeight();return r>t?Math.ceil(r-t)/2+"px":"0px"}getWidth(){return this.viewportRatio>Gs?`${this.calculateWidth()}px`:"auto"}getHeight(){return this.viewportRatio>Gs?`${this.calculateHeight()}px`:"100%"}getFontSize(){return this.calculateWidth()/20+"px"}calculateWidth(){return this.viewportRatio>Gs?this._vw:Math.ceil(this.vhWitoutPadding*Gs)}calculateHeight(){return Math.ceil(this._vw/Gs)}calculateWidthWithActionPanel(e){const t=this.vhWitoutPadding-e;return this.viewportRatio>Gs?this._vw:Math.ceil(t*Gs)}}class Hs{constructor(e){Object.defineProperty(this,"safeAreaFrameCalculator",{enumerable:!0,configurable:!0,writable:!0,value:e})}create(e){const t=e.vw/e.vh;return e.desktopMode&&t>Gs?this.createDesktopStoryGeometry(e):this.createMobileStoryGeometry(e)}createDesktopStoryGeometry(e){return new Ws(e.vw,e.vh,{top:50,bottom:50})}createMobileStoryGeometry(e){var t,r;const{paddingTop:i,paddingBottom:n}=this.safeAreaFrameCalculator.getViewportCorrectionPadding();return new $s(e.vw,e.vh,{top:null!==(t=parseFloat(i))&&void 0!==t?t:0,bottom:null!==(r=parseFloat(n))&&void 0!==r?r:0})}}class qs{constructor(e,t,r){Object.defineProperty(this,"_vw",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"_vh",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"actionPanelHeight",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"viewportRatio",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.viewportRatio=e/t}get shouldBeShownSafeAreaInsets(){return this.viewportRatio<zs}getViewportCorrectionPadding(){const{paddingTop:e,paddingBottom:t}=this.calcFrameWidthByMobileAspectRatio();return{paddingTop:e+"px",paddingBottom:t+"px"}}calcFrameWidthByMobileAspectRatio(){const e=this._vh-this._vw/zs,t=Math.max(Math.min(e-this.actionPanelHeight,this.actionPanelHeight),0);return{paddingTop:Math.max(e-t,0),paddingBottom:t}}}class Qs extends J.EventEmitter{constructor(){super(...arguments),Object.defineProperty(this,"timer",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"currentProgress",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"progressBeforePause",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"timerPaused",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"cancelAnimationFcn",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"timeout",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"isCompleted",{enumerable:!0,configurable:!0,writable:!0,value:!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,r;if("performance"in window==0||"now"in window.performance==0){let e=Date.now();performance.timing&&performance.timing.navigationStart&&(e=performance.timing.navigationStart),r=Date.now()-e}else r=performance.now();return t=requestAnimationFrame((function i(n){let s;if(s=(n-r)/e.duration,s>1&&(s=1),e.forceEnd()&&(s=1),!e.paused()){let r=e.timing(s);e.draw(r),s<1&&(t=requestAnimationFrame(i))}})),()=>{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 r=100*this.currentProgress;this.emit("progress",r)}}var Ks;!function(e){e.None="none",e.Init="init",e.StartLoading="startLoading",e.Loading="loading",e.Loaded="loaded",e.Starting="starting",e.Started="started",e.Paused="paused",e.Error="error",e.Destroyed="destroyed"}(Ks||(Ks={}));const Ys=(e,t)=>{var r,i,n,s;const o=t.dataset;let a=null;const l=null!==(r=o.elementId)&&void 0!==r?r:"",d=null!==(i=o.linkType)&&void 0!==i?i:"",c=null!==(n=o.linkTarget)&&void 0!==n?n:"",u={url:()=>{a=decodeURIComponent(c),Zs({activeStory:e,url:a,elementId:l}),Xs(e,{linkType:d,url:a,elementId:l})},customAction:()=>{a=c,Zs({activeStory:e,url:a,elementId:l}),Xs(e,{linkType:d,url:a,elementId:l})},slide:()=>{e.redirectToSlide({slideIndex:parseInt(c),layerIndex:0})},story:()=>{const t=parseInt(c);Zs({activeStory:e,url:c,elementId:l}),ar.emit(`${Ao.name}.redirectToStory`,{storyId:t,feedSlug:"default"})},game:()=>{Zs({activeStory:e,url:c,elementId:l}),ar.emit(`${Da.name}.openGame`,{gameId:c})},layer:()=>{ar.emit(ro.ShowLayer,{index:parseInt(c)})},closeStory:()=>{ar.emit(`${Ao.name}.closeStory`)}};null===(s=u[d])||void 0===s||s.call(u)},Zs=({activeStory:e,url:t,elementId:r})=>{ar.emit("publicEvents.widgetEvent",{name:"w-link",devPayload:{story_id:e.id,slide_index:e.activeSlideIndex,widget_id:r,widget_label:"",widget_value:t}})},Xs=(e,{linkType:t,url:r,elementId:i})=>{e.markAsOpened(),ar.emit(rn.TransitionFromSlide,{storyId:e.id,slideIndex:e.activeSlideIndex}),"url"===t&&ar.emit("publicEvents.clickOnButton",{id:e.id,index:e.activeSlideIndex,url:r,elementId:i})};var Js=function(e,t,r,i){return new(r||(r=Promise))((function(n,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}l((i=i.apply(e,t||[])).next())}))};class eo{constructor(e){Object.defineProperty(this,"animationApi",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"slideElement",{enumerable:!0,configurable:!0,writable:!0,value: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)}}const to=(e=>{var t={};return f.d(t,e),t})({action:()=>n.action,computed:()=>n.computed,observable:()=>n.observable});var ro,io,no=function(e,t,r){for(var i=arguments.length>2,n=0;n<t.length;n++)r=i?t[n].call(e,r):t[n].call(e);return i?r:void 0},so=function(e,t,r,i,n,s){function o(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var a,l=i.kind,d="getter"===l?"get":"setter"===l?"set":"value",c=!t&&e?i.static?e:e.prototype:null,u=t||(c?Object.getOwnPropertyDescriptor(c,i.name):{}),h=!1,p=r.length-1;p>=0;p--){var f={};for(var g in i)f[g]="access"===g?{}:i[g];for(var g in i.access)f.access[g]=i.access[g];f.addInitializer=function(e){if(h)throw new TypeError("Cannot add initializers after decoration has completed");s.push(o(e||null))};var v=(0,r[p])("accessor"===l?{get:u.get,set:u.set}:u[d],f);if("accessor"===l){if(void 0===v)continue;if(null===v||"object"!=typeof v)throw new TypeError("Object expected");(a=o(v.get))&&(u.get=a),(a=o(v.set))&&(u.set=a),(a=o(v.init))&&n.unshift(a)}else(a=o(v))&&("field"===l?n.unshift(a):u[d]=a)}c&&Object.defineProperty(c,i.name,u),h=!0},oo=function(e,t,r,i){return new(r||(r=Promise))((function(n,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}l((i=i.apply(e,t||[])).next())}))},ao=function(e,t,r,i){if("a"===r&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?i:"a"===r?i.call(e):i?i.value:t.get(e)},lo=function(e,t,r,i,n){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!n)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?n.call(e,r):n?n.value=r:t.set(e,r),r};!function(e){e.PerformShareAction="performShareAction",e.PerformScreenShotShareAction="performScreenShotShareAction",e.ShowToast="showToast",e.ShowInputModal="showInputModal",e.ShowLayer="showLayer"}(ro||(ro={})),function(e){e.Start="start",e.ChangeState="changeState"}(io||(io={}));let co=(()=>{var e,t,r;let i,n,s,o,a,l,d,c,u,h,p=J.EventEmitter,f=[],g=[],v=[],m=[],y=[];return e=class extends p{get _state(){return ao(this,t,"f")}set _state(e){lo(this,t,e,"f")}get _muted(){return ao(this,r,"f")}set _muted(e){lo(this,r,e,"f")}constructor(e,i,n,s,o,a,l){super(),Object.defineProperty(this,"_story",{enumerable:!0,configurable:!0,writable:!0,value:(no(this,f),e)}),Object.defineProperty(this,"_index",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(this,"widgetManager",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(this,"animationApi",{enumerable:!0,configurable:!0,writable:!0,value:s}),Object.defineProperty(this,"layersManager",{enumerable:!0,configurable:!0,writable:!0,value:o}),Object.defineProperty(this,"slideApiHandlers",{enumerable:!0,configurable:!0,writable:!0,value:a}),Object.defineProperty(this,"slideDto",{enumerable:!0,configurable:!0,writable:!0,value:l}),Object.defineProperty(this,"id",{enumerable:!0,configurable:!0,writable:!0,value:Date.now()}),t.set(this,no(this,g,Ks.None)),Object.defineProperty(this,"videoManager",{enumerable:!0,configurable:!0,writable:!0,value:(no(this,v),null)}),Object.defineProperty(this,"narrativeAnimationContext",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),r.set(this,no(this,m,!1)),Object.defineProperty(this,"_navigationDisabled",{enumerable:!0,configurable:!0,writable:!0,value:(no(this,y),!1)}),Object.defineProperty(this,"slideContent",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"slideContentInnerHTML",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.narrativeAnimationContext=new eo(this.animationApi)}get state(){return this._state}get index(){return this._index}get story(){return this._story}get muted(){return this._muted}get navigationDisabled(){return this._navigationDisabled}get widgets(){return this.widgetManager.widgets.filter((e=>e.isInited))}get timeline(){return this.slideDto.timeline}get duration(){return this.slideDto.duration}get screenshotShare(){return this.slideDto.screenshot_share}get html(){return this.slideDto.html}get eventPayload(){return this.slideDto.event_payload}findWidgetByType(e){return this.widgetManager.findWidgetByType(e)}resume(){return oo(this,void 0,void 0,(function*(){var e;try{if(this.state!==Ks.Paused)return;yield null===(e=this.videoManager)||void 0===e?void 0:e.resume(),this.narrativeAnimationContext.resume(),this.widgetManager.resume(),lt(`[SLIDE][resume]:${this.story.id}:${this.index}`),this.setState(Ks.Started)}catch(e){console.error(e)}}))}pause(){var e;this.state===Ks.Started&&(null===(e=this.videoManager)||void 0===e||e.pause(),this.narrativeAnimationContext.pause(),this.widgetManager.pause(),lt(`[SLIDE][pause]:${this.story.id}:${this.index}`),this.setState(Ks.Paused))}mute(){var e;this._muted=!0,null===(e=this.videoManager)||void 0===e||e.mute()}unmute(){var e;this._muted=!1,null===(e=this.videoManager)||void 0===e||e.unmute()}showLayerByIndex(e){this.layersManager.showLayerByIndex(e)}reload(){return oo(this,void 0,void 0,(function*(){yield this.load(),this.state===Ks.Loaded&&this.start()}))}init(e){return oo(this,void 0,void 0,(function*(){this._state===Ks.None&&(this.setState(Ks.Init),this.slideContent=e,this.slideContentInnerHTML=this.slideContent.innerHTML,this.parseNavigationDisable(),this.videoManager=Zr.create(this.slideContent,this.layersManager),this.narrativeAnimationContext.init(this.slideContent),lt(`[SLIDE][init]:${this.story.id}:${this.index}`),yield this.widgetManager.init(this.slideContent),yield this.load())}))}start(){return oo(this,void 0,void 0,(function*(){var e;try{if(this.state===Ks.Starting)return;if(this.state!==Ks.Loaded)throw new Error(`You must initialize the slide first. State: ${this.state}`);this.setState(Ks.Starting),yield null===(e=this.videoManager)||void 0===e?void 0:e.start(),this.narrativeAnimationContext.start(),lt(`[SLIDE][start]:${this.story.id}:${this.index}`),this.setState(Ks.Started),this.slideApiHandlers.lock(this),this.slideApiHandlers.exec(),this.story.updateNavigationHistory(),this.startTimer(),this.emit(io.Start)}catch(e){console.error(e)}}))}stop(){var e;this.state===Ks.Started&&(this.narrativeAnimationContext.stop(),this.slideApiHandlers.unlock(this),lt(`[SLIDE][stop]:${this.story.id}:${this.index}`),this.widgetManager.stop(),this.resetSlideContentHTML(),this.setState(Ks.None),null===(e=this.videoManager)||void 0===e||e.destroy().catch(console.error))}setUserData(e,t){for(const r of this.widgets)r.setUserData(e,t)}resetSlideContentHTML(){this.slideContent.innerHTML=this.slideContentInnerHTML}setState(e){this._state=e,this.changeTimelineVisibilityByState(),this.emit(io.ChangeState,e)}load(){return oo(this,void 0,void 0,(function*(){var e;if(this.state!==Ks.Loaded)try{lt(`[SLIDE][start_load]:${this.story.id}:${this.index}`),this.setState(Ks.StartLoading),yield this.loadResources(),yield(e=this.slideContent,Js(void 0,void 0,void 0,(function*(){let t=0;return new Promise((r=>{const i=()=>{t++,e.getBoundingClientRect().height>0||t>10?r():requestAnimationFrame(i)};i()}))}))),this.fitNarrativeTextLines(),this.setState(Ks.Loaded),lt(`[SLIDE][end_load]:${this.story.id}:${this.index}`)}catch(e){console.error(e),this.setState(Ks.Error)}}))}loadResources(){return oo(this,void 0,void 0,(function*(){return new Promise(((e,t)=>oo(this,void 0,void 0,(function*(){var r;let i=setTimeout((()=>{lt("[SLIDE]: Resources were not loaded"),t()}),4e3);try{yield this.loadMediaResources(this.slideContent),yield this.loadFonts(),Hr.hasVideo(this.slideContent)&&(this.setState(Ks.Loading),yield null===(r=this.videoManager)||void 0===r?void 0:r.init(this.slideContent)),e()}catch(e){t(e)}finally{clearTimeout(i)}}))))}))}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 r=function(e){return new Promise((function(t,r){if("img"===e.tagName.toLowerCase()&&e instanceof HTMLImageElement){const r=()=>{requestAnimationFrame((()=>requestAnimationFrame((()=>{t(e),e.removeEventListener("load",r)}))))};e.addEventListener("load",r),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 i=e.target.closest(".narrative-element-image");i&&(i.style.display="none")}r(e)}))}))},i=e.querySelectorAll("img,video");let n,s=[];for(n=0;n<i.length;++n)s.push(r(i[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();Fr(e,{})}parseNavigationDisable(){const e=this.slideContent.querySelector(".narrative-slide");if(!e)return!1;this._navigationDisabled="1"===e.dataset.disableNavigation}changeTimelineVisibilityByState(){this.state===Ks.Error||this.state===Ks.Loading?this.story.hideTimeline():this.story.showTimeline()}startTimer(){var e;this.story.timer.started||this.story.timer.start(null!==(e=this.duration)&&void 0!==e?e:0)}},t=new WeakMap,r=new WeakMap,(()=>{var t;const r="function"==typeof Symbol&&Symbol.metadata?Object.create(null!==(t=p[Symbol.metadata])&&void 0!==t?t:null):void 0;i=[to.observable],n=[to.observable],s=[to.computed],o=[to.computed],a=[to.action],l=[to.action],d=[to.action],c=[to.action],u=[to.action],h=[to.action],so(e,null,i,{kind:"accessor",name:"_state",static:!1,private:!1,access:{has:e=>"_state"in e,get:e=>e._state,set:(e,t)=>{e._state=t}},metadata:r},g,v),so(e,null,n,{kind:"accessor",name:"_muted",static:!1,private:!1,access:{has:e=>"_muted"in e,get:e=>e._muted,set:(e,t)=>{e._muted=t}},metadata:r},m,y),so(e,null,s,{kind:"getter",name:"state",static:!1,private:!1,access:{has:e=>"state"in e,get:e=>e.state},metadata:r},null,f),so(e,null,o,{kind:"getter",name:"muted",static:!1,private:!1,access:{has:e=>"muted"in e,get:e=>e.muted},metadata:r},null,f),so(e,null,a,{kind:"method",name:"resume",static:!1,private:!1,access:{has:e=>"resume"in e,get:e=>e.resume},metadata:r},null,f),so(e,null,l,{kind:"method",name:"pause",static:!1,private:!1,access:{has:e=>"pause"in e,get:e=>e.pause},metadata:r},null,f),so(e,null,d,{kind:"method",name:"mute",static:!1,private:!1,access:{has:e=>"mute"in e,get:e=>e.mute},metadata:r},null,f),so(e,null,c,{kind:"method",name:"unmute",static:!1,private:!1,access:{has:e=>"unmute"in e,get:e=>e.unmute},metadata:r},null,f),so(e,null,u,{kind:"method",name:"start",static:!1,private:!1,access:{has:e=>"start"in e,get:e=>e.start},metadata:r},null,f),so(e,null,h,{kind:"method",name:"stop",static:!1,private:!1,access:{has:e=>"stop"in e,get:e=>e.stop},metadata:r},null,f),r&&Object.defineProperty(e,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:r})})(),e})();class uo{create({story:e,slideApi:t,slideApiHandlers:r,slideDto:i,index:n}){const s=new Nr(e),o=new ei(t,s,e);return new co(e,n,o,t.Animation,s,r,i)}}var ho=function(e,t,r){for(var i=arguments.length>2,n=0;n<t.length;n++)r=i?t[n].call(e,r):t[n].call(e);return i?r:void 0},po=function(e,t,r,i,n,s){function o(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var a,l=i.kind,d="getter"===l?"get":"setter"===l?"set":"value",c=!t&&e?i.static?e:e.prototype:null,u=t||(c?Object.getOwnPropertyDescriptor(c,i.name):{}),h=!1,p=r.length-1;p>=0;p--){var f={};for(var g in i)f[g]="access"===g?{}:i[g];for(var g in i.access)f.access[g]=i.access[g];f.addInitializer=function(e){if(h)throw new TypeError("Cannot add initializers after decoration has completed");s.push(o(e||null))};var v=(0,r[p])("accessor"===l?{get:u.get,set:u.set}:u[d],f);if("accessor"===l){if(void 0===v)continue;if(null===v||"object"!=typeof v)throw new TypeError("Object expected");(a=o(v.get))&&(u.get=a),(a=o(v.set))&&(u.set=a),(a=o(v.init))&&n.unshift(a)}else(a=o(v))&&("field"===l?n.unshift(a):u[d]=a)}c&&Object.defineProperty(c,i.name,u),h=!0},fo=function(e,t,r,i){return new(r||(r=Promise))((function(n,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}l((i=i.apply(e,t||[])).next())}))},go=function(e,t,r,i){if("a"===r&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?i:"a"===r?i.call(e):i?i.value:t.get(e)},vo=function(e,t,r,i,n){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!n)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?n.call(e,r):n?n.value=r:t.set(e,r),r};let mo=(()=>{var e,t,r,i,n,s,o,a;let l,d,c,u,h,p,f,g,v,m,y,b,w,S,_,x,O,C,k,A,M,E,P,j,I,T,R,D,B,N,F,U,V,z,G,W,$=Vt,H=[],q=[],Q=[],K=[],Y=[],Z=[],X=[],J=[],ee=[],te=[],re=[],ie=[],ne=[],se=[],oe=[];return e=class extends ${get storiesItem(){return go(this,t,"f")}set storiesItem(e){vo(this,t,e,"f")}get _activeSlideIndex(){return go(this,r,"f")}set _activeSlideIndex(e){vo(this,r,e,"f")}get _displayedSlides(){return go(this,i,"f")}set _displayedSlides(e){vo(this,i,e,"f")}get _hiddenTimeline(){return go(this,n,"f")}set _hiddenTimeline(e){vo(this,n,e,"f")}get slides(){return go(this,s,"f")}set slides(e){vo(this,s,e,"f")}get _like(){return go(this,o,"f")}set _like(e){vo(this,o,e,"f")}get _favorite(){return go(this,a,"f")}set _favorite(e){vo(this,a,e,"f")}constructor(e,l,d,c){super(),Object.defineProperty(this,"slideApi",{enumerable:!0,configurable:!0,writable:!0,value:(ho(this,H),l)}),Object.defineProperty(this,"slideApiHandlers",{enumerable:!0,configurable:!0,writable:!0,value:d}),Object.defineProperty(this,"navigationHistory",{enumerable:!0,configurable:!0,writable:!0,value:c}),t.set(this,ho(this,q,void 0)),r.set(this,(ho(this,Q),ho(this,K,0))),i.set(this,(ho(this,Y),ho(this,Z,[]))),n.set(this,(ho(this,X),ho(this,J,!1))),s.set(this,(ho(this,ee),ho(this,te,[]))),o.set(this,(ho(this,re),ho(this,ie,0))),a.set(this,(ho(this,ne),ho(this,se,!1))),Object.defineProperty(this,"_hasShare",{enumerable:!0,configurable:!0,writable:!0,value:(ho(this,oe),!1)}),Object.defineProperty(this,"_timer",{enumerable:!0,configurable:!0,writable:!0,value:new Qs}),this.updateStoriesItem(e),this.redirectToSlide=this.redirectToSlide.bind(this),this.nextSlide=this.nextSlide.bind(this),this._hasShare=L.getState().share}get id(){return this.storiesItem.id}get title(){return this.storiesItem.title}get slidesLoaded(){return this.storiesItem.slidesLoaded}get like(){return this._like}get favorite(){return this._favorite}get hasLike(){return Boolean(this.storiesItem.like_functional)}get hasShare(){return!!Boolean(this.storiesItem.share_functional)&&this._hasShare}get hasFavorite(){return Boolean(this.storiesItem.favorite_functional)}get hasAudio(){return Boolean(this.storiesItem.has_audio)}get displayedSlides(){return this._displayedSlides}get activeSlideIndex(){return this._activeSlideIndex}get activeSlide(){return this.slides[this._activeSlideIndex]}get slidesCount(){var e;return null!==(e=this.storiesItem.slides_count)&&void 0!==e?e:0}get hiddenTimeline(){return 1===this.storiesItem.slides.length&&0===this.storiesItem.slides[0].duration||this.storiesItem.hide_timeline||this._hiddenTimeline||!this.slidesLoaded}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}get error(){return this.storiesItem.error}get timer(){return this._timer}nextSlide(){this.reachEnd||this.toSlide(this.activeSlideIndex+1)}prevSlide(){this.reachStart||this.toSlide(this.activeSlideIndex-1)}toSlide(e){this._activeSlideIndex=e,this._displayedSlides=this.getDisplayedSlides(),this.timer.stop()}updateStoriesItem(e){this.storiesItem=e,this.slides=this.createSlidesViewModelsByDto(e.slides),this._like=this.storiesItem.like,this._favorite=this.storiesItem.favorite,this._displayedSlides=this.getDisplayedSlides()}updateNavigationHistory(){this.navigationHistory.update({currentSlideIndex:this.activeSlideIndex,currentStoryId:this.id})}setLike(e){this.updateStoryLike(e),ar.emit("publicEvents.likeStory",{id:this.id,index:this.activeSlideIndex,value:1===e})}setDislike(e){this.updateStoryLike(e),ar.emit("publicEvents.dislikeStory",{id:this.id,index:this.activeSlideIndex,value:-1===e})}setBookmark(e){return fo(this,void 0,void 0,(function*(){const t=this.storiesItem.favorite;this.storiesItem.favorite=e,this._favorite=e;try{const t=yield Ls.setBookmark(this.id,e);if(null==t.favorite)return;this.storiesItem.favorite=t.favorite,this._favorite=t.favorite,ar.emit("publicEvents.favoriteStory",{id:this.id,index:this.activeSlideIndex,value:t.favorite})}catch(e){this.storiesItem.favorite=t,this._favorite=t,console.error(e)}}))}share(){return fo(this,void 0,void 0,(function*(){var e;ar.emit("publicEvents.shareStory",{id:this.id,index:this.activeSlideIndex}),(null===(e=this.activeSlide)||void 0===e?void 0:e.screenshotShare)?ar.emit(ro.PerformScreenShotShareAction,{shareId:"slide-screenshot-share",hideElementsSelector:""}):ut()?yield this.performSessionShareAction():this.performWithoutSessionShareAction()}))}markAsOpened(){this.storiesItem.isOpened||(Ls.markAsOpened(this.id),this.storiesItem.isOpened=!0)}hideTimeline(){this._hiddenTimeline=!0}showTimeline(){this._hiddenTimeline=!1}reset(){return this.slideApiHandlers.resetStory(this.id)}redirectToSlide({slideIndex:e,layerIndex:t}){e!==this.activeSlideIndex&&this.toSlide(e)}destroy(){}getDisplayedSlides(){const e=new uo;return this.slidesLoaded?this.slides.slice(this._activeSlideIndex,this._activeSlideIndex+2):[e.create({story:this,index:0,slideApi:this.slideApi,slideApiHandlers:this.slideApiHandlers,slideDto:{index:0,timeline:{foreground:"",background:""},duration:0,screenshot_share:!1,html:""}})]}createSlidesViewModelsByDto(e){if(this.slides.length===e.length)return this.slides;const t=new uo;return e.map(((e,r)=>t.create({story:this,index:r,slideApi:this.slideApi,slideApiHandlers:this.slideApiHandlers,slideDto:e})))}updateStoryLike(e){return fo(this,void 0,void 0,(function*(){try{const t=yield Ls.updateStoryLike(this.id,e);null!=t.like&&(this.storiesItem.like=t.like,this._like=t.like)}catch(e){console.error(e)}}))}performSessionShareAction(){return fo(this,void 0,void 0,(function*(){try{const{url:e}=yield Ls.getStorySharePath(this.id);if(!e)return;this.storiesItem.share_url=e,this.emitShareStoryWithPathEvent(e);const t={title:this.storiesItem.title,text:"",url:e};ar.emit(ro.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};ar.emit(ro.PerformShareAction,{shareId:"story-share",config:t})}emitShareStoryWithPathEvent(e){ar.emit("publicEvents.shareStoryWithPath",{id:this.id,index:this.activeSlideIndex,url:e})}},t=new WeakMap,r=new WeakMap,i=new WeakMap,n=new WeakMap,s=new WeakMap,o=new WeakMap,a=new WeakMap,(()=>{var t;const r="function"==typeof Symbol&&Symbol.metadata?Object.create(null!==(t=$[Symbol.metadata])&&void 0!==t?t:null):void 0;l=[to.observable],d=[to.observable],c=[to.observable],u=[to.observable],h=[to.observable],p=[to.observable],f=[to.observable],g=[to.computed],v=[to.computed],m=[to.computed],y=[to.computed],b=[to.computed],w=[to.computed],S=[to.computed],_=[to.computed],x=[to.computed],O=[to.computed],C=[to.computed],k=[to.computed],A=[to.computed],M=[to.computed],E=[to.computed],P=[to.computed],j=[to.computed],I=[to.computed],T=[to.computed],R=[to.computed],D=[to.action],B=[to.action],N=[to.action],F=[to.action],U=[to.action],V=[to.action],z=[to.action],G=[to.action],W=[to.action],po(e,null,l,{kind:"accessor",name:"storiesItem",static:!1,private:!1,access:{has:e=>"storiesItem"in e,get:e=>e.storiesItem,set:(e,t)=>{e.storiesItem=t}},metadata:r},q,Q),po(e,null,d,{kind:"accessor",name:"_activeSlideIndex",static:!1,private:!1,access:{has:e=>"_activeSlideIndex"in e,get:e=>e._activeSlideIndex,set:(e,t)=>{e._activeSlideIndex=t}},metadata:r},K,Y),po(e,null,c,{kind:"accessor",name:"_displayedSlides",static:!1,private:!1,access:{has:e=>"_displayedSlides"in e,get:e=>e._displayedSlides,set:(e,t)=>{e._displayedSlides=t}},metadata:r},Z,X),po(e,null,u,{kind:"accessor",name:"_hiddenTimeline",static:!1,private:!1,access:{has:e=>"_hiddenTimeline"in e,get:e=>e._hiddenTimeline,set:(e,t)=>{e._hiddenTimeline=t}},metadata:r},J,ee),po(e,null,h,{kind:"accessor",name:"slides",static:!1,private:!1,access:{has:e=>"slides"in e,get:e=>e.slides,set:(e,t)=>{e.slides=t}},metadata:r},te,re),po(e,null,p,{kind:"accessor",name:"_like",static:!1,private:!1,access:{has:e=>"_like"in e,get:e=>e._like,set:(e,t)=>{e._like=t}},metadata:r},ie,ne),po(e,null,f,{kind:"accessor",name:"_favorite",static:!1,private:!1,access:{has:e=>"_favorite"in e,get:e=>e._favorite,set:(e,t)=>{e._favorite=t}},metadata:r},se,oe),po(e,null,g,{kind:"getter",name:"id",static:!1,private:!1,access:{has:e=>"id"in e,get:e=>e.id},metadata:r},null,H),po(e,null,v,{kind:"getter",name:"title",static:!1,private:!1,access:{has:e=>"title"in e,get:e=>e.title},metadata:r},null,H),po(e,null,m,{kind:"getter",name:"slidesLoaded",static:!1,private:!1,access:{has:e=>"slidesLoaded"in e,get:e=>e.slidesLoaded},metadata:r},null,H),po(e,null,y,{kind:"getter",name:"like",static:!1,private:!1,access:{has:e=>"like"in e,get:e=>e.like},metadata:r},null,H),po(e,null,b,{kind:"getter",name:"favorite",static:!1,private:!1,access:{has:e=>"favorite"in e,get:e=>e.favorite},metadata:r},null,H),po(e,null,w,{kind:"getter",name:"hasLike",static:!1,private:!1,access:{has:e=>"hasLike"in e,get:e=>e.hasLike},metadata:r},null,H),po(e,null,S,{kind:"getter",name:"hasShare",static:!1,private:!1,access:{has:e=>"hasShare"in e,get:e=>e.hasShare},metadata:r},null,H),po(e,null,_,{kind:"getter",name:"hasFavorite",static:!1,private:!1,access:{has:e=>"hasFavorite"in e,get:e=>e.hasFavorite},metadata:r},null,H),po(e,null,x,{kind:"getter",name:"hasAudio",static:!1,private:!1,access:{has:e=>"hasAudio"in e,get:e=>e.hasAudio},metadata:r},null,H),po(e,null,O,{kind:"getter",name:"displayedSlides",static:!1,private:!1,access:{has:e=>"displayedSlides"in e,get:e=>e.displayedSlides},metadata:r},null,H),po(e,null,C,{kind:"getter",name:"activeSlideIndex",static:!1,private:!1,access:{has:e=>"activeSlideIndex"in e,get:e=>e.activeSlideIndex},metadata:r},null,H),po(e,null,k,{kind:"getter",name:"activeSlide",static:!1,private:!1,access:{has:e=>"activeSlide"in e,get:e=>e.activeSlide},metadata:r},null,H),po(e,null,A,{kind:"getter",name:"slidesCount",static:!1,private:!1,access:{has:e=>"slidesCount"in e,get:e=>e.slidesCount},metadata:r},null,H),po(e,null,M,{kind:"getter",name:"hiddenTimeline",static:!1,private:!1,access:{has:e=>"hiddenTimeline"in e,get:e=>e.hiddenTimeline},metadata:r},null,H),po(e,null,E,{kind:"getter",name:"displayedSlideImage",static:!1,private:!1,access:{has:e=>"displayedSlideImage"in e,get:e=>e.displayedSlideImage},metadata:r},null,H),po(e,null,P,{kind:"getter",name:"isBlank",static:!1,private:!1,access:{has:e=>"isBlank"in e,get:e=>e.isBlank},metadata:r},null,H),po(e,null,j,{kind:"getter",name:"reachEnd",static:!1,private:!1,access:{has:e=>"reachEnd"in e,get:e=>e.reachEnd},metadata:r},null,H),po(e,null,I,{kind:"getter",name:"reachStart",static:!1,private:!1,access:{has:e=>"reachStart"in e,get:e=>e.reachStart},metadata:r},null,H),po(e,null,T,{kind:"getter",name:"disableClose",static:!1,private:!1,access:{has:e=>"disableClose"in e,get:e=>e.disableClose},metadata:r},null,H),po(e,null,R,{kind:"getter",name:"error",static:!1,private:!1,access:{has:e=>"error"in e,get:e=>e.error},metadata:r},null,H),po(e,null,D,{kind:"method",name:"toSlide",static:!1,private:!1,access:{has:e=>"toSlide"in e,get:e=>e.toSlide},metadata:r},null,H),po(e,null,B,{kind:"method",name:"updateStoriesItem",static:!1,private:!1,access:{has:e=>"updateStoriesItem"in e,get:e=>e.updateStoriesItem},metadata:r},null,H),po(e,null,N,{kind:"method",name:"setLike",static:!1,private:!1,access:{has:e=>"setLike"in e,get:e=>e.setLike},metadata:r},null,H),po(e,null,F,{kind:"method",name:"setDislike",static:!1,private:!1,access:{has:e=>"setDislike"in e,get:e=>e.setDislike},metadata:r},null,H),po(e,null,U,{kind:"method",name:"setBookmark",static:!1,private:!1,access:{has:e=>"setBookmark"in e,get:e=>e.setBookmark},metadata:r},null,H),po(e,null,V,{kind:"method",name:"share",static:!1,private:!1,access:{has:e=>"share"in e,get:e=>e.share},metadata:r},null,H),po(e,null,z,{kind:"method",name:"markAsOpened",static:!1,private:!1,access:{has:e=>"markAsOpened"in e,get:e=>e.markAsOpened},metadata:r},null,H),po(e,null,G,{kind:"method",name:"hideTimeline",static:!1,private:!1,access:{has:e=>"hideTimeline"in e,get:e=>e.hideTimeline},metadata:r},null,H),po(e,null,W,{kind:"method",name:"showTimeline",static:!1,private:!1,access:{has:e=>"showTimeline"in e,get:e=>e.showTimeline},metadata:r},null,H),r&&Object.defineProperty(e,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:r})})(),e})();const yo=(e=>{var t={};return f.d(t,e),t})({getSlideApi:()=>s.getSlideApi});class bo{constructor(e){Object.defineProperty(this,"window",{enumerable:!0,configurable:!0,writable:!0,value: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,r){const i=this.width;this.window.document.querySelectorAll(e).forEach((e=>{if(e!==this.window.document.body&&this.window.innerWidth>e.clientWidth+i)return;const n=e.style[t],s=this.window.getComputedStyle(e)[t];e.dataset[t]=n,e.style[t]=`${r(Number.parseFloat(s))}px`}))}resetScrollbar(){this._resetElementAttributes("body","overflow"),this._resetElementAttributes("body","paddingRight")}_resetElementAttributes(e,t){this.window.document.querySelectorAll(e).forEach((e=>{const r=e.dataset[t];void 0===r?e.style.removeProperty(t):(delete e.dataset[t],e.style[t]=r)}))}}var wo,So=function(e,t,r,i){return new(r||(r=Promise))((function(n,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}l((i=i.apply(e,t||[])).next())}))};!function(e){e.ReloadStory="StoryReaderViewModel.reloadStory"}(wo||(wo={}));class _o{constructor(e,t,r){Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"storyReaderViewModel",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"statisticsService",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"publicEventsSubscriptions",{enumerable:!0,configurable:!0,writable:!0,value:[]}),this.handleShowMultipleStories=this.handleShowMultipleStories.bind(this),this.handleCloseStoryReader=this.handleCloseStoryReader.bind(this),this.handleRedirectToStory=this.handleRedirectToStory.bind(this),this.handleReloadStory=this.handleReloadStory.bind(this),this.handleWidgetEvent=this.handleWidgetEvent.bind(this),this.handleClickOnButton=this.handleClickOnButton.bind(this),this.subscribeToEventBusEvents()}subscribeToEventBusEvents(){ar.on(`${Ao.name}.showMultipleStories`,this.handleShowMultipleStories),ar.on(`${Ao.name}.redirectToStory`,this.handleRedirectToStory),ar.on(`${Ao.name}.closeStory`,this.handleCloseStoryReader),ar.on(wo.ReloadStory,this.handleReloadStory),ar.on("publicEvents.widgetEvent",this.handleWidgetEvent),ar.on("publicEvents.clickOnButton",this.handleClickOnButton),this.subscribeToPublicEvents()}unsubscribeEventBusEvents(){ar.off(`${Ao.name}.showMultipleStories`,this.handleShowMultipleStories),ar.off(`${Ao.name}.redirectToStory`,this.handleRedirectToStory),ar.off(`${Ao.name}.closeStory`,this.handleCloseStoryReader),ar.off(wo.ReloadStory,this.handleReloadStory),ar.off("publicEvents.widgetEvent",this.handleWidgetEvent),ar.off("publicEvents.clickOnButton",this.handleClickOnButton),this.unsubscribeFromPublicEvents()}handleShowMultipleStories({payload:e,sourceInfo:t}){this.storyReaderViewModel.showMultipleStories({storyId:e.id,feed:t.feedSlug,listType:t.listType,filter:t.filter})}handleRedirectToStory(e){return So(this,arguments,void 0,(function*({storyId:e,feedSlug:t=""}){try{yield this.storyReaderViewModel.showStory(e,t)}catch(e){console.error(e)}}))}handleCloseStoryReader(){this.storyReaderViewModel.close()}handleWidgetEvent(e){this.storyManager.emit("widgetEvent",{name:e.name,data:Object.assign(Object.assign({},e.devPayload),{feed:this.storyReaderViewModel.feedSlug})})}subscribeToPublicEvents(){const e=new Yt(this.storyManager),t=this.storyReaderViewModel.sourceInfo,r=["showSlide","showStory","closeStory","clickOnButton","likeStory","dislikeStory","favoriteStory","shareStory","shareStoryWithPath"];for(const i of r){const r=r=>e.handle(i,r,t);ar.on(`publicEvents.${i}`,r),this.publicEventsSubscriptions.push((()=>{ar.off(`publicEvents.${i}`,r)}))}}unsubscribeFromPublicEvents(){this.publicEventsSubscriptions.forEach((e=>e()))}handleClickOnButton(e){new Kt(this.storyManager,this.statisticsService).handle(e)}handleReloadStory(e){return So(this,void 0,void 0,(function*(){try{yield this.storyReaderViewModel.reloadStory(e)}catch(e){console.error(e)}}))}destroy(){this.unsubscribeEventBusEvents()}}var xo=function(e,t,r){for(var i=arguments.length>2,n=0;n<t.length;n++)r=i?t[n].call(e,r):t[n].call(e);return i?r:void 0},Oo=function(e,t,r,i,n,s){function o(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var a,l=i.kind,d="getter"===l?"get":"setter"===l?"set":"value",c=!t&&e?i.static?e:e.prototype:null,u=t||(c?Object.getOwnPropertyDescriptor(c,i.name):{}),h=!1,p=r.length-1;p>=0;p--){var f={};for(var g in i)f[g]="access"===g?{}:i[g];for(var g in i.access)f.access[g]=i.access[g];f.addInitializer=function(e){if(h)throw new TypeError("Cannot add initializers after decoration has completed");s.push(o(e||null))};var v=(0,r[p])("accessor"===l?{get:u.get,set:u.set}:u[d],f);if("accessor"===l){if(void 0===v)continue;if(null===v||"object"!=typeof v)throw new TypeError("Object expected");(a=o(v.get))&&(u.get=a),(a=o(v.set))&&(u.set=a),(a=o(v.init))&&n.unshift(a)}else(a=o(v))&&("field"===l?n.unshift(a):u[d]=a)}c&&Object.defineProperty(c,i.name,u),h=!0},Co=function(e,t,r,i){return new(r||(r=Promise))((function(n,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}l((i=i.apply(e,t||[])).next())}))},ko=function(e,t,r,i){if("a"===r&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?i:"a"===r?i.call(e):i?i.value:t.get(e)},Lo=function(e,t,r,i,n){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!n)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?n.call(e,r):n?n.value=r:t.set(e,r),r};let Ao=(()=>{var e,t,r,i,n;let s,o,a,l,d,c,u,h,p,f,g,v,m,y,b,w=Vt,S=[],_=[],x=[],O=[],C=[],k=[],L=[],A=[],M=[];return e=class extends w{get _activeStory(){return ko(this,t,"f")}set _activeStory(e){Lo(this,t,e,"f")}get _currentIndex(){return ko(this,r,"f")}set _currentIndex(e){Lo(this,r,e,"f")}get _placeholders(){return ko(this,i,"f")}set _placeholders(e){Lo(this,i,e,"f")}get storyViewModels(){return ko(this,n,"f")}set storyViewModels(e){Lo(this,n,e,"f")}constructor(s,o,a){super(),Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:(xo(this,S),s)}),Object.defineProperty(this,"storyReaderStoriesService",{enumerable:!0,configurable:!0,writable:!0,value:o}),Object.defineProperty(this,"statisticsService",{enumerable:!0,configurable:!0,writable:!0,value:a}),t.set(this,xo(this,_,null)),r.set(this,(xo(this,x),xo(this,O,1))),Object.defineProperty(this,"narrativeContext",{enumerable:!0,configurable:!0,writable:!0,value:xo(this,C)}),i.set(this,xo(this,k,[])),Object.defineProperty(this,"scrollbarHelper",{enumerable:!0,configurable:!0,writable:!0,value:(xo(this,L),new bo(window))}),Object.defineProperty(this,"_sourceInfo",{enumerable:!0,configurable:!0,writable:!0,value:{listType:Re.default,feedSlug:""}}),Object.defineProperty(this,"slideApi",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"slideApiHandlers",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"windowReferer",{enumerable:!0,configurable:!0,writable:!0,value:Te.default}),Object.defineProperty(this,"storyReaderViewModelEventBusListener",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),n.set(this,xo(this,A,new Map)),Object.defineProperty(this,"currentStoryDisplayStrategy",{enumerable:!0,configurable:!0,writable:!0,value:(xo(this,M),null)}),Object.defineProperty(this,"navigationHistory",{enumerable:!0,configurable:!0,writable:!0,value:new As}),this.initSlideApi(),this.storyReaderViewModelEventBusListener=new _o(s,this,a),this.handleWindowUnload=this.handleWindowUnload.bind(this),s.setViewModel(e.name,this),window.addEventListener("beforeunload",this.handleWindowUnload)}initSlideApi(){this.slideApiHandlers=new dn(this),this.slideApi=(0,yo.getSlideApi)(this.slideApiHandlers)}get feedSlug(){var e;return null!==(e=this.sourceInfo.feedSlug)&&void 0!==e?e:""}get widgetsData(){return W()(this.narrativeContext.widgetsData)?this.narrativeContext.widgetsData:{}}get sourceInfo(){return this._sourceInfo}get stories(){return Array.from(this.storyViewModels.values())}get activeStory(){return this._activeStory}get currentIndex(){return this._currentIndex}get placeholders(){return this._placeholders}get reachStart(){return 1===this.currentIndex}get reachEnd(){return this.currentIndex===this.storyViewModels.size-2}setStories({listType:e,stories:t}){let r=t.filter((e=>!e.hide_in_reader)).map((e=>_t.createInstance(nr,e)));r=[_t.createInstance(nr,{blank:!0,id:-1}),...r,_t.createInstance(nr,{blank:!0,id:-2})];for(const e of r)this.storyViewModels.has(e.id)?this.storyViewModels.get(e.id).updateStoriesItem(e):this.storyViewModels.set(e.id,new mo(e,this.slideApi,this.slideApiHandlers,this.navigationHistory))}setNarrativeContext(e){this.narrativeContext=e instanceof or?e:_t.createInstance(or,e.rawData),this.initStoryResources(this.narrativeContext)}setActiveStoryById(e){this._currentIndex=Array.from(this.storyViewModels.keys()).indexOf(e),this._activeStory=this.storyViewModels.get(e),this.setSlideApiActiveStory(this._activeStory)}setActiveStoryByIndex(e){this._currentIndex=e,this._activeStory=this.getDisplayedStoryByIndex(this._currentIndex),this.setSlideApiActiveStory(this._activeStory),this.handleActiveStoryError(this._activeStory)}getDisplayedStoryByIndex(e){return Array.from(this.storyViewModels.values())[e]}setSlideApiActiveStory(e){this.slideApiHandlers.setActiveStory(e)}open(e,t){this.storyViewModels.clear(),this.windowReferer=e.windowReferer,this.setScrollBar(e.windowReferer),this._sourceInfo=t,this.setStoriesAndContext({listType:e.listType,storyList:e.storyList,storyContext:e.storyContext}),this.setActiveStoryById(e.id),this._placeholders=e.placeholders,this.statisticsService.init(t),ct(!0)}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 r=this.activeStory.id,i=this.activeStory.activeSlideIndex;this.emit("closeStoryReader"),ar.emit("closeStoryReader",{id:r}),ar.emit(rn.CloseStoryReader,{storyId:r,slideIndex:i}),ar.emit("publicEvents.closeStory",{id:r,index:i,action:e}),Cr(),Br(),this.navigationHistory.reset(),this.activeStory.markAsOpened(),this._sourceInfo={listType:Re.default,feedSlug:""},this._activeStory=null,this.statisticsService.destroy(),this.storyViewModels.clear()}setScrollBar(e){e===Te.default&&this.scrollbarHelper.setScrollbar()}resetScrollBar(e){e===Te.default&&this.scrollbarHelper.resetScrollbar()}initStoryResources(e){(new qi).init(e)}handleActiveStoryError(e){e.error&&this.storyManager.emit("showStoryFailed",Object.assign({id:e.id,title:e.title},e.error))}handleWindowUnload(e){this.activeStory&&(ar.emit(rn.NextSlide,{fromStoryId:this.activeStory.id,fromSlideIndex:this.activeStory.activeSlideIndex}),this.statisticsService.sendData())}setStoriesAndContext(e){this.setStories({listType:e.listType,stories:e.storyList}),this.setNarrativeContext({rawData:e.storyContext})}canBeClosed(){return!(!this.activeStory||this.activeStory.isBlank)&&!this.activeStory.disableClose}showStory(e,t){return Co(this,void 0,void 0,(function*(){this.currentStoryDisplayStrategy=this.createStoryDisplayStrategyByType(Ns.ShowStory),yield this.currentStoryDisplayStrategy.show({storyId:e,feed:t})}))}showStoryOnce(e){return Co(this,void 0,void 0,(function*(){this.currentStoryDisplayStrategy=this.createStoryDisplayStrategyByType(Ns.ShowStoryOnce),yield this.currentStoryDisplayStrategy.show({storyId:e})}))}showStoryFromSharePage(e,t){return Co(this,void 0,void 0,(function*(){return this.currentStoryDisplayStrategy=this.createStoryDisplayStrategyByType(Ns.ShowStoryFromSharePage),this.currentStoryDisplayStrategy.show({storyId:e,fetchShareUrl:t})}))}showOnboardingStories(e){return Co(this,void 0,void 0,(function*(){var t;this.currentStoryDisplayStrategy=this.createStoryDisplayStrategyByType(Ns.ShowOnboardingStories),yield this.currentStoryDisplayStrategy.show({feed:null!==(t=null==e?void 0:e.feed)&&void 0!==t?t:"",customTags:null==e?void 0:e.customTags,limit:null==e?void 0:e.limit})}))}showMultipleStories(e){return Co(this,void 0,void 0,(function*(){var t,r;this.currentStoryDisplayStrategy=this.createStoryDisplayStrategyByType(Ns.ShowMultipleStories),yield this.currentStoryDisplayStrategy.show({storyId:e.storyId,listType:null!==(t=e.listType)&&void 0!==t?t:Re.default,windowReferer:null!==(r=e.windowReferer)&&void 0!==r?r:Te.default,feed:e.feed,filter:e.filter})}))}createStoryDisplayStrategyByType(e){return(new Vs).create(e,this,this.storyReaderStoriesService,this.storyManager)}fetchStoriesSlidesAndContextByNextStoryIndex(e){return Co(this,void 0,void 0,(function*(){const t=yield this.storyReaderStoriesService.fetchStoriesSlidesAndContextByNextStoryIndex({nextStoryIndex:e,listType:this.sourceInfo.listType,feed:this.sourceInfo.feedSlug});t.storyList.length&&this.setStoriesAndContext(t)}))}reloadStory(e){return Co(this,void 0,void 0,(function*(){var t,r;ls({id:e.id,story:{error:null}});const i=Object.assign(Object.assign({},this.sourceInfo),{feed:null!==(t=this.sourceInfo.feedSlug)&&void 0!==t?t:""});let n=this.storyReaderStoriesService.getStoriesWithSlidesAndContext(i);this.setStoriesAndContext(n),null===(r=this.currentStoryDisplayStrategy)||void 0===r||r.reload({storyId:e.id,listType:this.sourceInfo.listType,feed:this.sourceInfo.feedSlug})}))}nextStory(){var e;this.reachEnd||(null===(e=this.activeStory)||void 0===e||e.markAsOpened(),this.setActiveStoryByIndex(this._currentIndex+1),this.fetchStoriesSlidesAndContextByNextStoryIndex(this._currentIndex-1))}prevStory(){var e;this.reachStart||(null===(e=this.activeStory)||void 0===e||e.markAsOpened(),this.setActiveStoryByIndex(this._currentIndex-1),this.fetchStoriesSlidesAndContextByNextStoryIndex(this._currentIndex-1))}destroy(){this.removeAllListeners(),window.removeEventListener("beforeunload",this.handleWindowUnload),this.storyReaderViewModelEventBusListener.destroy(),this.storyManager.deleteViewModel(e.name)}closeGoodsWidget(){ar.emit("goodsWidget.close")}},t=new WeakMap,r=new WeakMap,i=new WeakMap,n=new WeakMap,(()=>{var t;const r="function"==typeof Symbol&&Symbol.metadata?Object.create(null!==(t=w[Symbol.metadata])&&void 0!==t?t:null):void 0;s=[to.observable],o=[to.observable],a=[to.observable],l=[to.observable],d=[to.computed],c=[to.computed],u=[to.computed],h=[to.computed],p=[to.computed],f=[to.computed],g=[to.action],v=[to.action],m=[to.action],y=[to.action],b=[to.action],Oo(e,null,s,{kind:"accessor",name:"_activeStory",static:!1,private:!1,access:{has:e=>"_activeStory"in e,get:e=>e._activeStory,set:(e,t)=>{e._activeStory=t}},metadata:r},_,x),Oo(e,null,o,{kind:"accessor",name:"_currentIndex",static:!1,private:!1,access:{has:e=>"_currentIndex"in e,get:e=>e._currentIndex,set:(e,t)=>{e._currentIndex=t}},metadata:r},O,C),Oo(e,null,a,{kind:"accessor",name:"_placeholders",static:!1,private:!1,access:{has:e=>"_placeholders"in e,get:e=>e._placeholders,set:(e,t)=>{e._placeholders=t}},metadata:r},k,L),Oo(e,null,l,{kind:"accessor",name:"storyViewModels",static:!1,private:!1,access:{has:e=>"storyViewModels"in e,get:e=>e.storyViewModels,set:(e,t)=>{e.storyViewModels=t}},metadata:r},A,M),Oo(e,null,d,{kind:"getter",name:"stories",static:!1,private:!1,access:{has:e=>"stories"in e,get:e=>e.stories},metadata:r},null,S),Oo(e,null,c,{kind:"getter",name:"activeStory",static:!1,private:!1,access:{has:e=>"activeStory"in e,get:e=>e.activeStory},metadata:r},null,S),Oo(e,null,u,{kind:"getter",name:"currentIndex",static:!1,private:!1,access:{has:e=>"currentIndex"in e,get:e=>e.currentIndex},metadata:r},null,S),Oo(e,null,h,{kind:"getter",name:"placeholders",static:!1,private:!1,access:{has:e=>"placeholders"in e,get:e=>e.placeholders},metadata:r},null,S),Oo(e,null,p,{kind:"getter",name:"reachStart",static:!1,private:!1,access:{has:e=>"reachStart"in e,get:e=>e.reachStart},metadata:r},null,S),Oo(e,null,f,{kind:"getter",name:"reachEnd",static:!1,private:!1,access:{has:e=>"reachEnd"in e,get:e=>e.reachEnd},metadata:r},null,S),Oo(e,null,g,{kind:"method",name:"open",static:!1,private:!1,access:{has:e=>"open"in e,get:e=>e.open},metadata:r},null,S),Oo(e,null,v,{kind:"method",name:"close",static:!1,private:!1,access:{has:e=>"close"in e,get:e=>e.close},metadata:r},null,S),Oo(e,null,m,{kind:"method",name:"reloadStory",static:!1,private:!1,access:{has:e=>"reloadStory"in e,get:e=>e.reloadStory},metadata:r},null,S),Oo(e,null,y,{kind:"method",name:"nextStory",static:!1,private:!1,access:{has:e=>"nextStory"in e,get:e=>e.nextStory},metadata:r},null,S),Oo(e,null,b,{kind:"method",name:"prevStory",static:!1,private:!1,access:{has:e=>"prevStory"in e,get:e=>e.prevStory},metadata:r},null,S),r&&Object.defineProperty(e,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:r})})(),e})();class Mo{constructor(e){Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:e})}create(){const e=new Wn,t=new an(this.storyManager),r=new sn(t);return new Ao(this.storyManager,e,r)}}class Eo{constructor(e,t){Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"storyListViewModel",{enumerable:!0,configurable:!0,writable:!0,value:t})}handle(e,t){Ls.markAsOpened(e.id),this.handleClickOnStoryCardDeepLink({id:e.id,index:t.index,isDeeplink:!0,url:e.deeplink},{listType:this.storyListViewModel.params.listType})}handleClickOnStoryCardDeepLink(e,{listType:t}){var r;const i={data:[[1,0,e.id,0,0]]},n=()=>{e.isDeeplink&&e.url&&this.storyManager.clickOnButtonAction({src:Gt.STORY_LIST,payload:e})};t===We.UGC||(null===(r=this.storyManager.getConfig())||void 0===r?void 0:r.disableStatistic)?n():K("session/update",i,I.createFunctionWithTimeout(n,1e3))}}class Po{constructor(e,t){Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"storyListViewModel",{enumerable:!0,configurable:!0,writable:!0,value:t})}handle(e,t){var r;Ls.markAsOpened(e.id),ar.emit(`${Da.name}.openGame`,{gameId:null===(r=e.gameInstance)||void 0===r?void 0:r.id})}}class jo{constructor(e,t){Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"storyListViewModel",{enumerable:!0,configurable:!0,writable:!0,value:t})}handle(e,t){const r={index:t.index,isDeeplink:!1,id:e.id,listType:Re.default,windowReferer:Te.default};this.openStoryReader(r),this.emitClickOnStory({id:e.id,index:t.index,isDeeplink:!1},{feedSlug:this.storyListViewModel.params.feedSlug,filter:this.storyListViewModel.params.filter})}openStoryReader(e){const t=this.storyListViewModel.params.feedSlug;e.listType=this.storyListViewModel.params.isFavorite?Re.favorite:Re.default,e.windowReferer=this.storyListViewModel.params.isFavorite?Te.favorite:Te.default,ar.emit(`${Ao.name}.showMultipleStories`,{payload:e,sourceInfo:{feedSlug:t,listType:e.listType,filter:this.storyListViewModel.params.filter}})}emitClickOnStory(e,t){const r=t.feedSlug,i=t.filter,n=yt(r),s=Qe.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===We.DEFAULT?o.feed=r:n===We.UGC&&(o.filter=i),o.source=Ie.list,this.storyManager.emit("clickOnStory",Object.assign(Object.assign({},e),o))}}class Io{static createHandler(e,t,r){const{deeplink:i,hideInReader:n,gameInstance:s}=e,o=Nt()(i)&&i.trim().length>0,a=null==s?void 0:s.id;return this.isInvalidStoryClick(Boolean(n),o,a,e.id)?null:o?new Eo(t,r):a?new Po(t,r):new jo(t,r)}static isInvalidStoryClick(e,t,r,i){return!(!e||t||r)&&(console.error(`Cannot open hidden story id ${i}`),!0)}}var To=function(e,t,r){for(var i=arguments.length>2,n=0;n<t.length;n++)r=i?t[n].call(e,r):t[n].call(e);return i?r:void 0},Ro=function(e,t,r,i,n,s){function o(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var a,l=i.kind,d="getter"===l?"get":"setter"===l?"set":"value",c=!t&&e?i.static?e:e.prototype:null,u=t||(c?Object.getOwnPropertyDescriptor(c,i.name):{}),h=!1,p=r.length-1;p>=0;p--){var f={};for(var g in i)f[g]="access"===g?{}:i[g];for(var g in i.access)f.access[g]=i.access[g];f.addInitializer=function(e){if(h)throw new TypeError("Cannot add initializers after decoration has completed");s.push(o(e||null))};var v=(0,r[p])("accessor"===l?{get:u.get,set:u.set}:u[d],f);if("accessor"===l){if(void 0===v)continue;if(null===v||"object"!=typeof v)throw new TypeError("Object expected");(a=o(v.get))&&(u.get=a),(a=o(v.set))&&(u.set=a),(a=o(v.init))&&n.unshift(a)}else(a=o(v))&&("field"===l?n.unshift(a):u[d]=a)}c&&Object.defineProperty(c,i.name,u),h=!0},Do=function(e,t,r,i){return new(r||(r=Promise))((function(n,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}l((i=i.apply(e,t||[])).next())}))},Bo=function(e,t,r,i){if("a"===r&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?i:"a"===r?i.call(e):i?i.value:t.get(e)},No=function(e,t,r,i,n){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!n)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?n.call(e,r):n?n.value=r:t.set(e,r),r};let Fo=(()=>{var e,t,r,i,n,s;let o,a,l,d,c,u,h,p,f,g,v,m,y,b,w,S,_,x,O=Vt,C=[],k=[],L=[],A=[],M=[],E=[],P=[],j=[],I=[],T=[],R=[];return e=class extends O{get _defaultStories(){return Bo(this,t,"f")}set _defaultStories(e){No(this,t,e,"f")}get _favoriteStories(){return Bo(this,r,"f")}set _favoriteStories(e){No(this,r,e,"f")}get _session(){return Bo(this,i,"f")}set _session(e){No(this,i,e,"f")}get _modeDesktop(){return Bo(this,n,"f")}set _modeDesktop(e){No(this,n,e,"f")}get _params(){return Bo(this,s,"f")}set _params(e){No(this,s,e,"f")}set modeDesktop(e){this._modeDesktop!==e&&(this._modeDesktop=e)}get id(){return this._id}get modeDesktop(){return this._modeDesktop}get session(){return this._session}get defaultStories(){return this._defaultStories}get favoriteStories(){return this._favoriteStories}get params(){return this._params}constructor(o,a){super(),Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:(To(this,C),o)}),Object.defineProperty(this,"storiesService",{enumerable:!0,configurable:!0,writable:!0,value:a}),Object.defineProperty(this,"_id",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),t.set(this,To(this,k,[])),r.set(this,(To(this,L),To(this,A,[]))),i.set(this,(To(this,M),To(this,E,null))),n.set(this,(To(this,P),To(this,j,!0))),Object.defineProperty(this,"subscriptions",{enumerable:!0,configurable:!0,writable:!0,value:(To(this,I),[])}),s.set(this,To(this,T,{listType:We.DEFAULT,feedSlug:"",useUgcCard:!1,isFavorite:!1,hasFavorite:!1})),Object.defineProperty(this,"isLoading",{enumerable:!0,configurable:!0,writable:!0,value:(To(this,R),!1)}),this._id=e.name+e.index++,this.setDefaultStories=this.setDefaultStories.bind(this),this.setFavoriteStories=this.setFavoriteStories.bind(this),this.storyManager.setViewModel(this._id,this)}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===We.DEFAULT}setParams(e){this.unsubscribeStoriesService(),this._params=e,this.subscribeToStoriesService()}onStoryClick(e,t=0){var r;null===(r=Io.createHandler(e,this.storyManager,this))||void 0===r||r.handle(e,{index:t})}destroy(){this.removeAllListeners(),this.unsubscribeStoriesService(),this.storyManager.deleteViewModel(this._id)}reload(){return Do(this,void 0,void 0,(function*(){yield this.loadStories({needFavorite:!1})}))}loadStories(e){return Do(this,void 0,void 0,(function*(){var t;if(this.isLoading)return;const r=Boolean(this._params.hasFavorite)&&e.needFavorite,i={feed:this._params.feedSlug,filter:{},defaultListLength:0,favoriteListLength:0,success:!0,error:{name:"",networkStatus:200,networkMessage:""}};try{this.emit("startLoading"),this.isLoading=!0;const{defaultStories:e,favoriteStories:t}=yield this.storiesService.loadStories(Object.assign(Object.assign({},this._params),{needFavorite:r}));i.success=!0,i.error=null,i.defaultListLength=e.length,this._params.hasFavorite&&this._params.listType===We.DEFAULT&&(i.favoriteListLength=t.length)}catch(e){console.error(e),i.success=!1,e instanceof $&&(i.error={name:e.name,networkMessage:e.networkMessage,networkStatus:e.networkStatus})}finally{this.isLoading=!1,i.filter=null!==(t=this._params.filter)&&void 0!==t?t:{},this.emit("endLoading",i)}}))}subscribeToStoriesService(){const e=this.storiesService.observeDefaultStories(this._params.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((0,to.action)((e=>{this._session=e})));this.subscriptions.push(e,t)}unsubscribeStoriesService(){this.subscriptions.forEach((e=>e.unsubscribe())),this.subscriptions=[]}setDefaultStories(e){this._defaultStories=e.map((e=>new qt(this,e)))}setFavoriteStories(e){this._favoriteStories=e.map((e=>new Qt(this,e)))}},t=new WeakMap,r=new WeakMap,i=new WeakMap,n=new WeakMap,s=new WeakMap,(()=>{var t;const r="function"==typeof Symbol&&Symbol.metadata?Object.create(null!==(t=O[Symbol.metadata])&&void 0!==t?t:null):void 0;o=[to.observable],a=[to.observable],l=[to.observable],d=[to.observable],c=[to.observable],u=[to.action],h=[to.computed],p=[to.computed],f=[to.computed],g=[to.computed],v=[to.computed],m=[to.computed],y=[to.computed],b=[to.computed],w=[to.action],S=[to.action],_=[to.action],x=[to.action],Ro(e,null,o,{kind:"accessor",name:"_defaultStories",static:!1,private:!1,access:{has:e=>"_defaultStories"in e,get:e=>e._defaultStories,set:(e,t)=>{e._defaultStories=t}},metadata:r},k,L),Ro(e,null,a,{kind:"accessor",name:"_favoriteStories",static:!1,private:!1,access:{has:e=>"_favoriteStories"in e,get:e=>e._favoriteStories,set:(e,t)=>{e._favoriteStories=t}},metadata:r},A,M),Ro(e,null,l,{kind:"accessor",name:"_session",static:!1,private:!1,access:{has:e=>"_session"in e,get:e=>e._session,set:(e,t)=>{e._session=t}},metadata:r},E,P),Ro(e,null,d,{kind:"accessor",name:"_modeDesktop",static:!1,private:!1,access:{has:e=>"_modeDesktop"in e,get:e=>e._modeDesktop,set:(e,t)=>{e._modeDesktop=t}},metadata:r},j,I),Ro(e,null,c,{kind:"accessor",name:"_params",static:!1,private:!1,access:{has:e=>"_params"in e,get:e=>e._params,set:(e,t)=>{e._params=t}},metadata:r},T,R),Ro(e,null,u,{kind:"setter",name:"modeDesktop",static:!1,private:!1,access:{has:e=>"modeDesktop"in e,set:(e,t)=>{e.modeDesktop=t}},metadata:r},null,C),Ro(e,null,h,{kind:"getter",name:"modeDesktop",static:!1,private:!1,access:{has:e=>"modeDesktop"in e,get:e=>e.modeDesktop},metadata:r},null,C),Ro(e,null,p,{kind:"getter",name:"session",static:!1,private:!1,access:{has:e=>"session"in e,get:e=>e.session},metadata:r},null,C),Ro(e,null,f,{kind:"getter",name:"defaultStories",static:!1,private:!1,access:{has:e=>"defaultStories"in e,get:e=>e.defaultStories},metadata:r},null,C),Ro(e,null,g,{kind:"getter",name:"favoriteStories",static:!1,private:!1,access:{has:e=>"favoriteStories"in e,get:e=>e.favoriteStories},metadata:r},null,C),Ro(e,null,v,{kind:"getter",name:"params",static:!1,private:!1,access:{has:e=>"params"in e,get:e=>e.params},metadata:r},null,C),Ro(e,null,m,{kind:"getter",name:"hasFavoriteCard",static:!1,private:!1,access:{has:e=>"hasFavoriteCard"in e,get:e=>e.hasFavoriteCard},metadata:r},null,C),Ro(e,null,y,{kind:"getter",name:"hasUgcCard",static:!1,private:!1,access:{has:e=>"hasUgcCard"in e,get:e=>e.hasUgcCard},metadata:r},null,C),Ro(e,null,b,{kind:"getter",name:"hasFavoriteStories",static:!1,private:!1,access:{has:e=>"hasFavoriteStories"in e,get:e=>e.hasFavoriteStories},metadata:r},null,C),Ro(e,null,w,{kind:"method",name:"setParams",static:!1,private:!1,access:{has:e=>"setParams"in e,get:e=>e.setParams},metadata:r},null,C),Ro(e,null,S,{kind:"method",name:"reload",static:!1,private:!1,access:{has:e=>"reload"in e,get:e=>e.reload},metadata:r},null,C),Ro(e,null,_,{kind:"method",name:"setDefaultStories",static:!1,private:!1,access:{has:e=>"setDefaultStories"in e,get:e=>e.setDefaultStories},metadata:r},null,C),Ro(e,null,x,{kind:"method",name:"setFavoriteStories",static:!1,private:!1,access:{has:e=>"setFavoriteStories"in e,get:e=>e.setFavoriteStories},metadata:r},null,C),r&&Object.defineProperty(e,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:r})})(),Object.defineProperty(e,"index",{enumerable:!0,configurable:!0,writable:!0,value:0}),e})();class Uo extends qt{constructor(e,t){super(e,t),Object.defineProperty(this,"favoriteStories",{enumerable:!0,configurable:!0,writable:!0,value:[]}),this.favoriteStories=this.storyListViewModel.favoriteStories.slice()}}class Vo{constructor(e){Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:e})}create(){const e=new ra(this.storyManager);return new Fo(this.storyManager,e)}}class zo{static create(e,t){const r=_t.createInstance(nr,{id:0,title:t.title.content,title_color:t.title.color,is_opened:!0,background_color:"white"});return r.favorite_cell=!0,new Uo(e,r)}}class Go{static create(e,t){let r=[];t.image&&t.image.svgSrc&&t.image.svgSrc.baseState&&r.push({width:100,height:100,type:"h",url:`data:image/svg+xml,${Cn(t.image.svgSrc.baseState)}`});const i=_t.createInstance(nr,{id:-100,title:t.title.content,title_color:t.title.color,is_opened:!1,background_color:t.backgroundColor,image:r});return i.ugc_card_cell=!0,new qt(e,i)}}class Wo{constructor(e=0,t=0,r=0,i=0){Object.defineProperty(this,"x",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"y",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"width",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"height",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.x=e,this.y=t,this.width=r,this.height=i}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),r=Math.max(this.x,e.x),i=Math.min(this.y+this.height,e.y+e.height),n=Math.max(this.y,e.y);return new Wo(Math.min(t,r),Math.min(i,n),Math.max(0,t-r),Math.max(0,i-n))}getArea(){return this.width*this.height}getAreaFraction(e){return+(this.getArea()/e.getArea()*100).toFixed(2)}static clone(e){return new Wo(e.x,e.y,e.width,e.height)}}class $o{constructor(e){Object.defineProperty(this,"feedCoverageAnalyticsCalculator",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"storiesIds",{enumerable:!0,configurable:!0,writable:!0,value:new Set}),Object.defineProperty(this,"getNewStoriesIds",{enumerable:!0,configurable:!0,writable:!0,value:e=>{const t=[];for(const r of e)this.storiesIds.has(r)||t.push(r);return t}})}markStoryAsFullVisible(e){this.storiesIds.has(e)||(this.storiesIds.add(e),this.feedCoverageAnalyticsCalculator.emit("feedImpression",[e]))}calculate(e){const t=this.getNewStoriesIds(e.map((({id:e})=>e)));t.forEach((e=>this.storiesIds.add(e))),0!==t.length&&this.feedCoverageAnalyticsCalculator.emit("feedImpression",t)}}class Ho{constructor(e){Object.defineProperty(this,"feedCoverageAnalyticsCalculator",{enumerable:!0,configurable:!0,writable:!0,value:e})}calculate(e){const t=e.map((({id:e,areaFraction:t})=>({storyId:e,visibleArea:Math.round(t)/100})));0!==t.length&&this.feedCoverageAnalyticsCalculator.emit("visibleAreaUpdated",t)}}class qo extends J.EventEmitter{constructor(){super(),Object.defineProperty(this,"storyRects",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"viewport",{enumerable:!0,configurable:!0,writable:!0,value:new Wo}),Object.defineProperty(this,"feedImpressionMetric",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"visibleAreaMetric",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"filterStoryRectIntersections",{enumerable:!0,configurable:!0,writable:!0,value:e=>e.filter((e=>-100!==e.id&&e.areaFraction>0))}),this.feedImpressionMetric=new $o(this),this.visibleAreaMetric=new Ho(this)}calculate(e){const t=this.getScrollViewportByCalculationParams(e),r=this.getStoryRectIntersectionsWithViewport(t),i=this.filterStoryRectIntersections(r);this.calculateMetrics(i)}setViewport(e){this.viewport=e}setStoryRects(e){this.storyRects=e}markStoryAsFullVisible(e){this.feedImpressionMetric.markStoryAsFullVisible(e)}destroy(){this.removeAllListeners()}getScrollViewportByCalculationParams(e){const t=Wo.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 r of this.storyRects)if(r.overlaps(e)){const i=r.getIntersection(e);t.push({id:r.id,areaFraction:i.getAreaFraction(r)})}else t.push({id:r.id,areaFraction:0});return t}}class Qo extends Wo{constructor(e,t=0,r=0,i=0,n=0){super(t,r,i,n),Object.defineProperty(this,"id",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.id=e}static clone(e){return new Qo(e.id,e.x,e.y,e.width,e.height)}}class Ko{constructor(e){Object.defineProperty(this,"feedCoverageAnalyticsCalculator",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"viewportPadding",{enumerable:!0,configurable:!0,writable:!0,value:{left:0,right:0,top:0,bottom:0}}),Object.defineProperty(this,"minOffsetLeft",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"maxOffsetLeft",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"minOffsetTop",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"maxOffsetTop",{enumerable:!0,configurable:!0,writable:!0,value:0})}startScroll({x:e,y:t}){this.minOffsetLeft=e,this.minOffsetTop=t,this.maxOffsetLeft=e,this.maxOffsetTop=t}endScroll({x:e,y:t}){this.minOffsetLeft=Math.min(e,this.minOffsetLeft),this.maxOffsetLeft=Math.max(e,this.maxOffsetLeft),this.minOffsetTop=Math.min(t,this.minOffsetTop),this.maxOffsetTop=Math.max(t,this.maxOffsetTop),this.feedCoverageAnalyticsCalculator.calculate({minOffsetLeft:this.minOffsetLeft,maxOffsetLeft:this.maxOffsetLeft,minOffsetTop:this.minOffsetTop,maxOffsetTop:this.maxOffsetTop})}calculate(e,t){this.feedCoverageAnalyticsCalculator.calculate({minOffsetLeft:e,maxOffsetLeft:e,minOffsetTop:t,maxOffsetTop:t})}updateGeometry({stories:e,storyListRect:t,windowRect:r,viewportPadding:i}){this.viewportPadding=i,this.setViewport(t,r),this.setStoryRects(e,t)}destroy(){this.feedCoverageAnalyticsCalculator.destroy()}markStoryAsFullVisible(e){this.feedCoverageAnalyticsCalculator.markStoryAsFullVisible(e)}setViewport(e,t){const r=this.getViewportByWindowAndStoryList(t,e);this.applyPaddingToViewport(r,e),this.feedCoverageAnalyticsCalculator.setViewport(r)}getViewportByWindowAndStoryList(e,t){let r=new Wo;return t.overlaps(e)?(r=t.getIntersection(e),r):r}applyPaddingToViewport(e,t){t.width<768||(e.x+=this.viewportPadding.left,e.y+=this.viewportPadding.top,e.height-=this.viewportPadding.top+this.viewportPadding.bottom,e.width-=this.viewportPadding.left+this.viewportPadding.right)}setStoryRects(e,t){const r=[];e.forEach(((i,n)=>{const s=Number(i.dataset.id),o=new Qo(s,i.offsetLeft,i.offsetTop,i.clientWidth,i.clientHeight);r.push(o),o.x+=t.x,o.y+=t.y,this.applyPaddingAndNegativeMarginToStoryRect(o,n,e.length-1)})),this.feedCoverageAnalyticsCalculator.setStoryRects(r)}applyPaddingAndNegativeMarginToStoryRect(e,t,r){const i=this.viewportPadding;0===t&&(e.x+=i.left,e.width-=i.left),t===r&&(e.width-=i.right)}}class Yo{constructor(e,t){Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"params",{enumerable:!0,configurable:!0,writable:!0,value:t}),this.handle=this.handle.bind(this)}handle(e){const t=y.getState();this.params.listType!==We.DEFAULT||t.disableStatistic||P(e);const r=this.params.feed,i=this.params.filter,n=yt(r),s={stories:e.map((e=>{const t={title:null,tags:[],slidesCount:null},r=Qe.getState().find((t=>t.id===e));return r&&(t.title=r.stat_title,t.tags=r.tags,t.slidesCount=r.slides_count,r.type===We.UGC&&(t.ugcPayload=W()(r.payload)?r.payload:{})),Object.assign({id:e},t)})),feed:null,filter:null};n===We.DEFAULT?s.feed=r:n===We.UGC&&(s.filter=i),this.storyManager.emit("feedImpression",s)}}class Zo{constructor(e,t){Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"params",{enumerable:!0,configurable:!0,writable:!0,value:t}),this.handle=this.handle.bind(this)}handle(e){const t=this.params.feed,r=this.params.filter,i=yt(t),n={stories:e.map((({storyId:e,visibleArea:t})=>{const r={title:null,tags:[],slidesCount:null,visibleArea:t},i=Qe.getState().find((t=>t.id===e));return i&&(r.title=i.stat_title,r.tags=i.tags,r.slidesCount=i.slides_count,i.type===We.UGC&&(r.ugcPayload=W()(i.payload)?i.payload:{})),Object.assign({id:e},r)})),feed:null,filter:null};i===We.DEFAULT?n.feed=t:i===We.UGC&&(n.filter=r),this.storyManager.emit("visibleAreaUpdated",n)}}class Xo{constructor(e,t){Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"params",{enumerable:!0,configurable:!0,writable:!0,value:t})}create(){const e=new qo,t=new Yo(this.storyManager,this.params),r=new Zo(this.storyManager,this.params);e.on("feedImpression",t.handle),e.on("visibleAreaUpdated",r.handle);return new Ko(e)}}const Jo=(e,t)=>{let r=[];switch(e){case Re.default:r=t?Xe.getState()[t]:[];break;case Re.favorite:r=et.getState();break;case Re.onboarding:r=t?Je.getState()[t]:[]}return null!=r?r:[]};class ea extends _t{constructor(){super(),Object.defineProperty(this,"id",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"expire_in",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"closed",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"share",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"user_key",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"server_timestamp",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"is_allow_profiling",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"preview_aspect_ratio",{enumerable:!0,configurable:!0,writable:!0,value:1}),Object.defineProperty(this,"session",{enumerable:!0,configurable:!0,writable:!0,value:{id:""}})}singleModelWrapper(){return""}attributes(){return at()(super.attributes(),["server_timestamp","session","cache","share","user_key","placeholders","is_allow_profiling","preview_aspect_ratio"])}}var ta=function(e,t,r,i){return new(r||(r=Promise))((function(n,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}l((i=i.apply(e,t||[])).next())}))};class ra{constructor(e){Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:e})}loadStories(e){return ta(this,arguments,void 0,(function*({feedSlug:e,filter:t,listType:r,testKey:i,needFavorite:n=!0}){const s=r===We.DEFAULT&&n;yield ds({defaultList:{feedSlug:e,filter:t},onboardingList:!1,favoriteList:s,testKey:i});const o=Jo(Re.default,e),a=(e=>e===Oa?We.UGC:We.DEFAULT)(e),l={stories:o.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===We.UGC&&(t.ugcPayload=W()(e.payload)?e.payload:{})),Object.assign({id:e.id},t)})),feed:null,filter:null};a===We.DEFAULT?l.feed=e:a===We.UGC&&(l.filter=t),this.storyManager.emit("feedLoad",l);return{defaultStories:Jo(Re.default,e),favoriteStories:Jo(Re.favorite,e)}}))}observeDefaultStories(e){return Xe.map((t=>{var r;return(null!==(r=t[e])&&void 0!==r?r:[]).map((e=>this.createStoryByData(Object.assign(Object.assign({},e),{slides_html:[]}))))}))}observeFavoriteStories(){return et.map((e=>e.map((e=>this.createStoryByData(Object.assign(Object.assign({},e),{slides_html:[]}))))))}observeSession(){return L.map((e=>_t.createInstance(ea,e)))}createStoryByData(e){return e instanceof nr?e:_t.createInstance(nr,e)}}var ia=f(2784),na=f.n(ia);class sa{constructor(e){Object.defineProperty(this,"sliderApi",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"debouncedTryEndScroll",{enumerable:!0,configurable:!0,writable:!0,value:na()((()=>{this.sliderApi.notifyScrollEnd()}),200)}),this.handleScroll=this.handleScroll.bind(this),this.init(),this.addEventListeners()}destroy(){this.sliderApi.getElementRef().removeEventListener("scroll",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(){this.sliderApi.getElementRef().addEventListener("scroll",this.handleScroll)}scrollTo(e){const t=this.sliderApi.getElementRef(),r="ltr"===this.sliderApi.dir?1:-1;t.scrollLeft=r*e.x,t.scrollTop=e.y}scrollWithAnimation(e,t){const r=this.sliderApi.getElementRef(),i="ltr"===this.sliderApi.dir?1:-1;r.scrollTo({left:i*e.x,top:e.y,behavior:"smooth"})}stopAnimation(){}handleScroll(){this.sliderApi.notifyScrollStart();const e=this.sliderApi.getElementRef();this.sliderApi.updatePosition(Math.abs(e.scrollLeft),Math.abs(e.scrollTop)),this.sliderApi.testAttraction(),this.sliderApi.emit("scroll",this.sliderApi.getCurrentPosition()),this.debouncedTryEndScroll()}}class oa{constructor(e){Object.defineProperty(this,"sliderApi",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"lastClientX",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"lastClientY",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"pushed",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"isDragging",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"isAnimating",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"debouncedTryAnimationEndScroll",{enumerable:!0,configurable:!0,writable:!0,value:na()((()=>{this.isAnimating=!1,this.sliderApi.notifyScrollEnd()}),200)}),this.handleScroll=this.handleScroll.bind(this),this.init(),this.handleMouseDown=this.handleMouseDown.bind(this),this.handleMouseMove=this.handleMouseMove.bind(this),this.handleMouseUp=this.handleMouseUp.bind(this),this.addEventListeners()}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();e.addEventListener("scroll",this.handleScroll),e.addEventListener("mousedown",this.handleMouseDown,Nn),e.addEventListener("touchstart",this.handleMouseDown,Nn)}scrollTo(e){const t=this.sliderApi.getElementRef(),r="ltr"===this.sliderApi.dir?1:-1;t.scrollLeft=r*e.x,t.scrollTop=e.y,this.sliderApi.updatePosition(Math.abs(t.scrollLeft),Math.abs(t.scrollTop)),this.sliderApi.testAttraction(),this.sliderApi.emit("scroll",this.sliderApi.getCurrentPosition())}scrollWithAnimation(e,t){this.isAnimating=!0;const r=this.sliderApi.getElementRef(),i="ltr"===this.sliderApi.dir?1:-1;r.scrollTo({left:i*e.x,top:e.y,behavior:"smooth"})}stopAnimation(){}destroy(){const e=this.sliderApi.getElementRef();e.removeEventListener("mousedown",this.handleMouseDown,Nn),e.removeEventListener("touchstart",this.handleMouseDown,Nn),e.removeEventListener("mouseup",this.handleMouseUp,Nn),e.removeEventListener("touchend",this.handleMouseUp,Nn),e.removeEventListener("mousemove",this.handleMouseMove,Nn),e.removeEventListener("touchmove",this.handleMouseMove,Nn),e.removeEventListener("scroll",this.handleScroll)}handleMouseDown(e){this.pushed=!0,this.isDragging=!1;const{clientX:t,clientY:r}=this.extractPointerPosition(e);this.lastClientX=t,this.lastClientY=r,window.addEventListener("mouseup",this.handleMouseUp,Nn),window.addEventListener("touchend",this.handleMouseUp,Nn),window.addEventListener("mousemove",this.handleMouseMove,Nn),window.addEventListener("touchmove",this.handleMouseMove,Nn)}handleMouseUp(){this.pushed&&(this.pushed=!1,this.isDragging=!1,this.sliderApi.notifyScrollEnd(),window.removeEventListener("mouseup",this.handleMouseUp,Nn),window.removeEventListener("touchend",this.handleMouseUp,Nn),window.removeEventListener("mousemove",this.handleMouseMove,Nn),window.removeEventListener("touchmove",this.handleMouseMove,Nn))}handleMouseMove(e){if(!this.pushed)return;const{clientX:t,clientY:r}=this.extractPointerPosition(e),i=t-this.lastClientX,n=r-this.lastClientY;this.lastClientX=t,this.lastClientY=r;const{x:s,y:o}=this.sliderApi.preparePosition(this.sliderApi.getCurrentPosition().x-i,this.sliderApi.getCurrentPosition().y-n);!this.isDragging&&(Math.abs(i)>=1||Math.abs(n)>=1)&&(this.isDragging=!0),this.isDragging&&this.scrollTo({x:s,y:o})}extractPointerPosition(e){return e instanceof MouseEvent?{clientX:e.clientX,clientY:e.clientY}:{clientX:e.touches[0].clientX,clientY:e.touches[0].clientY}}handleScroll(){this.isDragging?this.handleScrollByDraggable():this.handleScrollByAnimation()}handleScrollByDraggable(){this.sliderApi.notifyScrollStart()}handleScrollByAnimation(){if(!this.isAnimating)return;this.sliderApi.notifyScrollStart();const e=this.sliderApi.getElementRef();this.sliderApi.updatePosition(Math.abs(e.scrollLeft),Math.abs(e.scrollTop)),this.sliderApi.testAttraction(),this.sliderApi.emit("scroll",this.sliderApi.getCurrentPosition()),this.debouncedTryAnimationEndScroll()}}var aa;!function(e){e.Horizontal="horizontal",e.Vertical="vertical"}(aa||(aa={}));class la extends J.EventEmitter{constructor(){super(...arguments),Object.defineProperty(this,"scrollStrategy",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_isScrolling",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"slider",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"currentPosition",{enumerable:!0,configurable:!0,writable:!0,value:{x:0,y:0}}),Object.defineProperty(this,"direction",{enumerable:!0,configurable:!0,writable:!0,value:aa.Horizontal}),Object.defineProperty(this,"gap",{enumerable:!0,configurable:!0,writable:!0,value:20}),Object.defineProperty(this,"_reachStart",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"_reachEnd",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"desktopMode",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"_dir",{enumerable:!0,configurable:!0,writable:!0,value:"ltr"})}get isScrolling(){return this._isScrolling}get slides(){return this.slider.children[0]instanceof HTMLSlotElement?this.slider.children[0].assignedElements({flatten:!1}):Array.from(this.slider.children)}get elementRef(){return this.slider}get reachStart(){return this._reachStart}get reachEnd(){return this._reachEnd}get scrollWidth(){return this.slider.scrollWidth}get dir(){return this._dir}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){e=Math.trunc(e);const r=this.preparePosition(e,e);this.isTheSamePosition(r.x,r.y)||(t>0?this.scrollStrategy.scrollWithAnimation(r,t):this.scrollStrategy.scrollTo(r))}isHorizontal(){return this.direction===aa.Horizontal}updatePosition(e,t){this.currentPosition={x:Math.trunc(e),y:Math.trunc(t)}}getElementRef(){return this.slider}getCurrentPosition(){return this.currentPosition}preparePosition(e,t){let r={x:e,y:t};return this.isHorizontal()?r.y=0:r.x=0,this.attractToBounds(r.x,r.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(),r=e+this.slider.clientWidth>=Math.max(this.slider.scrollWidth-1,0),i=t+this.slider.clientHeight>=Math.max(this.slider.scrollHeight-1,0);this._reachStart=0===e&&0===t,this._reachEnd=this.isHorizontal()?r:i,this.emit("reachStart",this._reachStart),this.emit("reachEnd",this._reachEnd)}setTextDirection(e){this._dir=e}scrollBySlideIndex(e,t){this.isHorizontal()?this.scrollTo(this.slides[e].offsetLeft,t):this.scrollTo(this.slides[e].offsetTop,t)}scrollByDirection(e,t){const{x:r,y:i}=this.getCurrentPosition(),n=this.isHorizontal()?r:i,s=this.getSlidesPerView(),o=this.getStoryWidth(),a=this.getStoryHeight(),l=n+e*s*(this.isHorizontal()?o:a);this.scrollTo(l,t)}notifyScrollStart(){this.isScrolling||(this._isScrolling=!0,this.emit("scrollstart",this.currentPosition))}notifyScrollEnd(){this.isScrolling&&(this._isScrolling=!1,this.emit("scrollend",this.currentPosition))}isTheSamePosition(e,t){return e===this.currentPosition.x&&t===this.currentPosition.y}getSlidesPerView(){if(this.isHorizontal()&&this.slider.clientWidth){const e=this.slider.children[0].clientWidth+this.gap;return Math.round(this.slider.clientWidth/e)}if(!this.isHorizontal()&&this.slider.clientHeight){const e=this.slider.children[0].clientHeight+this.gap;return Math.round(this.slider.clientHeight/e)}return 1}getStoryWidth(){var e;return(null===(e=this.slides[0])||void 0===e?void 0:e.clientWidth)+this.gap}getStoryHeight(){var e;return(null===(e=this.slides[0])||void 0===e?void 0:e.clientHeight)+this.gap}changeScrollStrategy(){this.scrollStrategy&&this.scrollStrategy.destroy(),this.scrollStrategy=this.desktopMode?new oa(this):new sa(this)}}var da=function(e,t,r,i){return new(r||(r=Promise))((function(n,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}l((i=i.apply(e,t||[])).next())}))};class ca{static getUgcEditorConfig(){return da(this,void 0,void 0,(function*(){var e;let t=L.getState();yield A(),(null==t?void 0:t.editor)||(yield Kn({}));const r=y.getState(),i=L.getState(),n="3.1.0";return{sessionId:i.session.id,apiKey:r.apiKey,editor:null!==(e=i.editor)&&void 0!==e?e:{},sdkVersion:n,appPackageId:r.appPackageId,deviceId:C.getState(),userId:null!=r.userId?String(r.userId):void 0,lang:r.lang.toString()}}))}}var ua=function(e,t,r,i){return new(r||(r=Promise))((function(n,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}l((i=i.apply(e,t||[])).next())}))};class ha extends J.EventEmitter{constructor(e,t,r,i){super(),Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"storyReaderViewModel",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"storyId",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"options",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(this,"showSharePage",{enumerable:!0,configurable:!0,writable:!0,value:()=>ua(this,void 0,void 0,(function*(){var e;this.handleStartLoad();const t=null===(e=this.storyManager.getConfig())||void 0===e?void 0:e.disableStatistic,r=yield this.storyReaderViewModel.showStoryFromSharePage(this.storyId,t);this.handleEndLoad(r)}))}),this.handleCloseStoryReader=this.handleCloseStoryReader.bind(this),this.showSharePage(),this.storyReaderViewModel.once("closeStoryReader",this.handleCloseStoryReader)}closeStoryReader(){return ua(this,void 0,void 0,(function*(){this.storyManager.closeStoryReader()}))}handleStartLoad(){setTimeout((()=>{var e;this.emit(zt.START_LOADING),Dt()(null===(e=this.options)||void 0===e?void 0:e.handleStartLoad)&&this.options.handleStartLoad()}))}handleEndLoad(e){var t;this.emit(zt.END_LOADING,{result:e}),Dt()(null===(t=this.options)||void 0===t?void 0:t.handleStopLoad)&&this.options.handleStopLoad(e)}handleCloseStoryReader(){var e,t,r;if(Dt()(null===(e=this.options)||void 0===e?void 0:e.handleStoryReaderClose)||this.listenerCount(zt.CLOSE_STORY_READER)>0)try{Dt()(null===(t=this.options)||void 0===t?void 0:t.handleStoryReaderClose)&&(null===(r=this.options)||void 0===r||r.handleStoryReaderClose()),this.emit(zt.CLOSE_STORY_READER)}catch(e){console.error(e)}else{const e=window.location;window.open(`${e.protocol}//${e.host}`,"_parent")}}}var pa=function(e,t,r,i){return new(r||(r=Promise))((function(n,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}l((i=i.apply(e,t||[])).next())}))};class fa{constructor(e){Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"plugins",{enumerable:!0,configurable:!0,writable:!0,value:new Map})}install(e,t){this.plugins.set(e.name,e),lt(`[PluginManager]: plugin ${e.name} registered`),e.install(this.storyManager,t),lt(`[PluginManager]: plugin ${e.name} installed`)}uninstall(e){e.uninstall(this.storyManager),this.plugins.delete(e.name),lt(`[PluginManager]: plugin ${e.name} uninstalled`)}get(e){return this.plugins.get(e)}}class ga{constructor(e,t){var r,i,n,s,o,a;Object.defineProperty(this,"storyFeed",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"storyItem",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"id",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"title",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"titleColor",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"hasAudio",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"hasSwipeUp",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"isOpened",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"deeplink",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"gameInstanceId",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"hideInReader",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"hideTimeline",{enumerable:!0,configurable:!0,writable:!0,value:!1});const l=_t.createInstance(nr,Object.assign(Object.assign({},e),{slides:[]}));this.id=l.id,this.title=l.title,this.titleColor=l.title_color,this.hasAudio=null!==(r=l.has_audio)&&void 0!==r&&r,this.hasSwipeUp=null!==(i=l.has_swipe_up)&&void 0!==i&&i,this.isOpened=l.is_opened,this.deeplink=null!==(n=l.deeplink)&&void 0!==n?n:void 0,this.gameInstanceId=null!==(o=null===(s=l.game_instance)||void 0===s?void 0:s.id)&&void 0!==o?o:void 0,this.hideInReader=null!==(a=l.hide_in_reader)&&void 0!==a&&a,this.hideTimeline=l.hide_timeline,this.isOpened=l.isOpened,this.storyItem=l}getCover(e){var t,r,i,n;return{imageSrc:null===(r=null===(t=this.storyItem.image)||void 0===t?void 0:t.findOneByCoverQuality(e))||void 0===r?void 0:r.url,videoSrc:null!==(i=this.storyItem.videoCoverSrc)&&void 0!==i?i:void 0,backgroundColor:this.storyItem.background_color,feedCoverSrc:null===(n=this.storyFeed)||void 0===n?void 0:n.coverSrc}}}var va=function(e,t,r){for(var i=arguments.length>2,n=0;n<t.length;n++)r=i?t[n].call(e,r):t[n].call(e);return i?r:void 0},ma=function(e,t,r,i,n,s){function o(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var a,l=i.kind,d="getter"===l?"get":"setter"===l?"set":"value",c=!t&&e?i.static?e:e.prototype:null,u=t||(c?Object.getOwnPropertyDescriptor(c,i.name):{}),h=!1,p=r.length-1;p>=0;p--){var f={};for(var g in i)f[g]="access"===g?{}:i[g];for(var g in i.access)f.access[g]=i.access[g];f.addInitializer=function(e){if(h)throw new TypeError("Cannot add initializers after decoration has completed");s.push(o(e||null))};var v=(0,r[p])("accessor"===l?{get:u.get,set:u.set}:u[d],f);if("accessor"===l){if(void 0===v)continue;if(null===v||"object"!=typeof v)throw new TypeError("Object expected");(a=o(v.get))&&(u.get=a),(a=o(v.set))&&(u.set=a),(a=o(v.init))&&n.unshift(a)}else(a=o(v))&&("field"===l?n.unshift(a):u[d]=a)}c&&Object.defineProperty(c,i.name,u),h=!0},ya=function(e,t,r,i){if("a"===r&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?i:"a"===r?i.call(e):i?i.value:t.get(e)},ba=function(e,t,r,i,n){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!n)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?n.call(e,r):n?n.value=r:t.set(e,r),r};let wa=(()=>{var e,t;let r,i,n=Vt,s=[],o=[],a=[];return e=class extends n{get topStory(){return ya(this,t,"f")}set topStory(e){ba(this,t,e,"f")}constructor(e={feed:"default"}){super(),Object.defineProperty(this,"options",{enumerable:!0,configurable:!0,writable:!0,value:(va(this,s),e)}),Object.defineProperty(this,"storyModels",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"unreadedStoryModels",{enumerable:!0,configurable:!0,writable:!0,value:new Map}),Object.defineProperty(this,"storiesSubscription",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"feedsSubscription",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"feed",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),t.set(this,va(this,o,null)),Object.defineProperty(this,"_activeIndex",{enumerable:!0,configurable:!0,writable:!0,value:(va(this,a),-1)}),this.handleStoriesChange=this.handleStoriesChange.bind(this),this.handleFeedsChange=this.handleFeedsChange.bind(this),this.storiesSubscription=Xe.watch(this.handleStoriesChange),this.feedsSubscription=He.watch(this.handleFeedsChange)}get stories(){return this.storyModels.map((e=>this.createStackFeedStoryByModel(e)))}get length(){return this.storyModels.length}get activeIndex(){return this._activeIndex}get feedCoverSrc(){var e;return null===(e=this.feed)||void 0===e?void 0:e.coverSrc}get top(){return this.topStory}reload(){this.storyModels=[],this.unreadedStoryModels=new Map}destroy(){this.storiesSubscription.unsubscribe(),this.feedsSubscription.unsubscribe(),this.emit("destroy")}markStoryAsOpened(e){this.unreadedStoryModels.delete(e),this.resetUnreadedStories(),this.update()}resetUnreadedStories(){0===this.unreadedStoryModels.size&&(this.unreadedStoryModels=new Map(this.storyModels.map((e=>[e.id,e]))))}handleStoriesChange(e){var t;const r=null!==(t=e[this.options.feed])&&void 0!==t?t:[];0!==r.length&&(this.storyModels=r.slice(),this.resetUnreadedStories(),this.update())}handleFeedsChange(e){this.feed=e[this.options.feed]}createStackFeedStoryByModel(e){return new ga(e,this.feed)}update(){const e=this.unreadedStoryModels.values().next().value;if(!e)throw new Error("[StackedStoryList]: Empty stacked story list");this._activeIndex=this.storyModels.indexOf(e),this.topStory=this.createStackFeedStoryByModel(e),this.onUpdateTopStory(this.topStory),this.emit("update",this.topStory)}},t=new WeakMap,(()=>{var t;const l="function"==typeof Symbol&&Symbol.metadata?Object.create(null!==(t=n[Symbol.metadata])&&void 0!==t?t:null):void 0;r=[to.observable],i=[to.computed],ma(e,null,r,{kind:"accessor",name:"topStory",static:!1,private:!1,access:{has:e=>"topStory"in e,get:e=>e.topStory,set:(e,t)=>{e.topStory=t}},metadata:l},o,a),ma(e,null,i,{kind:"getter",name:"top",static:!1,private:!1,access:{has:e=>"top"in e,get:e=>e.top},metadata:l},null,s),l&&Object.defineProperty(e,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:l})})(),e})();var Sa=function(e,t,r,i){return new(r||(r=Promise))((function(n,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}l((i=i.apply(e,t||[])).next())}))};class _a extends wa{constructor(e,t){super(t),Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"feedCoverageAnalyticsCalculator",{enumerable:!0,configurable:!0,writable:!0,value:new qo}),Object.defineProperty(this,"firstStoryShown",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_id",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this._id=(0,j.v4)(),this.handleShowStory=this.handleShowStory.bind(this),this.handleCloseStoryReader=this.handleCloseStoryReader.bind(this),this.handleEventBusEvents=this.handleEventBusEvents.bind(this),this.subscribeToStoryReader(),this.subscribeToFeedCoverageAnalytics(),setTimeout((()=>{this.loadStories()}),0),this.storyManager.setViewModel(this._id,this)}reload(){const e=Object.create(null,{reload:{get:()=>super.reload}});return Sa(this,void 0,void 0,(function*(){return this.firstStoryShown=!1,e.reload.call(this),this.loadStories()}))}destroy(){const e=this.storyManager.storyReaderViewModel;null==e||e.off("showStory",this.handleShowStory),null==e||e.off("closeStoryReader",this.handleCloseStoryReader),ar.off("openGame",this.handleShowStory),ar.off("clickOnStoryDeepLink",this.handleShowStory),this.feedCoverageAnalyticsCalculator.destroy(),super.destroy(),this.storyManager.deleteViewModel(this._id)}showStory(e){var t;const r=Ca.instance,i=Nt()(e.deeplink)&&e.deeplink.trim().length>0,n=e.gameInstanceId;if(!e.hideInReader||i||n){if(i&&null!==e.deeplink){const t={index:0,id:e.id,story:e,isDeeplink:!0,url:e.deeplink};return r.clickOnButtonAction({src:Gt.STACK_STORY_LIST,payload:t}),void this.markStoryAsOpened(e.id)}if(n)return r.openGame(n),void this.markStoryAsOpened(e.id);null===(t=this.storyManager.storyReaderViewModel)||void 0===t||t.showMultipleStories({storyId:e.id,listType:Re.default,windowReferer:Te.stacked,feed:this.options.feed}),this.markStoryAsOpened(e.id)}else console.error("[StackedStoryList]: Cannot open hidden story id "+e.id)}handleCloseStoryReader(){this.top&&this.feedCoverageAnalyticsCalculator.markStoryAsFullVisible(this.top.id)}markStoryAsOpened(e){Ls.markAsOpened(e),this.feedCoverageAnalyticsCalculator.markStoryAsFullVisible(e),super.markStoryAsOpened(e)}onUpdateTopStory(e){this.firstStoryShown||(this.firstStoryShown=!0,this.feedCoverageAnalyticsCalculator.markStoryAsFullVisible(e.id))}subscribeToStoryReader(){return Sa(this,void 0,void 0,(function*(){try{const e=this.storyManager.storyReaderViewModel;ar.on("openGame",this.handleEventBusEvents),ar.on("clickOnStoryDeepLink",this.handleEventBusEvents),null==e||e.on("showStory",this.handleShowStory),null==e||e.on("closeStoryReader",this.handleCloseStoryReader)}catch(e){console.error("[StackedStoryList]: error while story reader init")}}))}handleShowStory({id:e}){this.markStoryAsOpened(e)}handleEventBusEvents({id:e}){this.markStoryAsOpened(e)}loadStories(){return Sa(this,void 0,void 0,(function*(){try{this.emit("startLoad"),yield ds({defaultList:{feedSlug:this.options.feed,filter:{}},onboardingList:!1,favoriteList:!1}),this.emit("endLoad")}catch(e){console.error("[StackedStoryList]: error while story list loaded")}}))}subscribeToFeedCoverageAnalytics(){const e=new Yo(this.storyManager,{listType:We.DEFAULT,feed:this.options.feed,filter:{}});this.feedCoverageAnalyticsCalculator.on("feedImpression",e.handle)}}var xa=function(e,t,r,i){return new(r||(r=Promise))((function(n,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}l((i=i.apply(e,t||[])).next())}))};const Oa="{{__ugc__}}";class Ca extends J.EventEmitter{constructor(){return super(),Object.defineProperty(this,"viewModelStore",{enumerable:!0,configurable:!0,writable:!0,value:new $t}),Object.defineProperty(this,"config",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"callbacks",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"pluginManager",{enumerable:!0,configurable:!0,writable:!0,value:new fa(this)}),Object.defineProperty(this,"clickOnButtonAction",{enumerable:!0,configurable:!0,writable:!0,value:({src:e,payload:t})=>{if(Dt()(this.callbacks.storyLinkClickHandler)||this.listenerCount(Be.CLICK_ON_STORY)>0){const r={src:e,data:t};try{Dt()(this.callbacks.storyLinkClickHandler)&&this.callbacks.storyLinkClickHandler(r),this.emit(Be.CLICK_ON_STORY,r)}catch(e){console.error(e)}}else window.open(t.url,"_self")}}),Ca.isSingletonInstanceExists()||(Ca.instance=this),Ca.instance}static get combinedPlaceholders(){return Ue()}get sdkVersionName(){return"3.1.0"}get sdkVersionCode(){return parseInt(30100)}get lang(){return y.getState().lang}set storyLinkClickHandler(e){Dt()(e)&&(this.callbacks.storyLinkClickHandler=e)}get storyReaderViewModel(){return this.viewModelStore.get(Ao.name)}get gameReaderViewModel(){return this.viewModelStore.get(Da.name)}static getInstance(){return Ca.instance?Ca.instance:null}setViewModel(e,t){this.viewModelStore.set(e,t)}deleteViewModel(e){this.viewModelStore.delete(e)}getViewModelByKey(e){return this.viewModelStore.get(e)}getConfig(){return this.config}setConfig(e){this.validateConfig(e),this.initializeConfig(e)}destroy(){if(null!=Ca.instance){Ca.instance=null,this.closeAllReaders();for(const e of this.viewModelStore.getAll())e.destroy()}}setTags(e){this.config&&(z.getInstance().checkTagsLength(e),w({tags:e}),this.config.tags=e)}setUserId(e,t){return xa(this,void 0,void 0,(function*(){(Nt()(e)||Ut()(e))&&this.config&&this.config.userId!==e&&(this.config.userId=e,z.getInstance().checkUserIdLength(e),S({userId:e,userIdSign:t}),E(),yield this.closeAllReaders(),yield this.reloadAllStoryLists(),yield this.reloadAllStackedStoryLists())}))}setLang(e){return xa(this,void 0,void 0,(function*(){this.config&&Nt()(e)&&this.config.lang!==e&&(O({lang:e}),this.config.lang=e,E(),yield this.closeAllReaders(),yield this.reloadAllStoryLists(),yield this.reloadAllStackedStoryLists())}))}setApiKey(e){this.config&&(U(e),b({apiKey:e}),E(),this.config.apiKey=e)}setPlaceholders(e){W()(e)&&this.config&&(_({placeholders:e}),Pe(e),this.config.placeholders=e)}setImagePlaceholders(e){W()(e)&&this.config&&(x({imagePlaceholders:e}),Ae(e),this.config.imagePlaceholders=e)}showOnboardingStories(e){return xa(this,void 0,void 0,(function*(){return yield this.viewModelStore.wait(Ao.name),this.storyReaderViewModel.showOnboardingStories(e)}))}showStory(e){return xa(this,void 0,void 0,(function*(){"string"==typeof e&&(e=+e||e),yield this.viewModelStore.wait(Ao.name);return this.storyReaderViewModel.showStory(e,"")}))}showStoryOnce(e){return xa(this,void 0,void 0,(function*(){"string"==typeof e&&(e=+e||e),yield this.viewModelStore.wait(Ao.name);return this.storyReaderViewModel.showStoryOnce(e)}))}closeAllReaders(){var e,t;null===(e=this.storyReaderViewModel)||void 0===e||e.close(),null===(t=this.gameReaderViewModel)||void 0===t||t.closeGame()}closeGoodsWidget(){var e;null===(e=this.storyReaderViewModel)||void 0===e||e.closeGoodsWidget()}openGame(e){return xa(this,arguments,void 0,(function*(e,t={}){const r=this.gameReaderViewModel;try{yield r.openGame(e,t)}catch(e){console.error(e)}}))}closeGame(){return xa(this,void 0,void 0,(function*(){return this.gameReaderViewModel.closeGame()}))}closeStoryReader(){return xa(this,void 0,void 0,(function*(){this.storyReaderViewModel.close()}))}getUgcEditorConfig(){return xa(this,void 0,void 0,(function*(){return ca.getUgcEditorConfig()}))}showSharePage(e,t){return xa(this,void 0,void 0,(function*(){return"string"==typeof e&&(e=+e||e),yield this.viewModelStore.wait(Ao.name),new ha(this,this.storyReaderViewModel,e,t)}))}reloadAllStoryLists(){const e=this.viewModelStore.getAllOfType((e=>e instanceof Fo));return Promise.all(e.map((e=>e.reload())))}reloadAllStackedStoryLists(){const e=this.viewModelStore.getAllOfType((e=>e instanceof _a));return Promise.all(e.map((e=>e.reload())))}static isSingletonInstanceExists(){return!!Ca.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");z.getInstance().checkUserIdLength(e.userId),z.getInstance().checkTagsLength(e.tags)}initializeConfig(e){U(e.apiKey),b(e),e.placeholders&&Pe(e.placeholders),e.imagePlaceholders&&Ae(e.imagePlaceholders),E(),e.disableStatistic="com.inappstory.webpreview"===e.appPackageId,this.config=e}use(e,t){this.pluginManager.install(e,t)}getPlugin(e){return this.pluginManager.get(e)}createStoryReader(){return new Ht(this).createStoryReader()}createGameReader(){return new Ht(this).createGameReader()}createStoryList(){return new Ht(this).createStoryList()}}const ka=new Ca,La=new class{constructor(e){Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value: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()}getNonce(){return Xt()}showOnboardingStories(e){return pa(this,void 0,void 0,(function*(){return this.storyManager.showOnboardingStories(e)}))}showStory(e){return pa(this,void 0,void 0,(function*(){return this.storyManager.showStory(e)}))}showStoryOnce(e){return pa(this,void 0,void 0,(function*(){return this.storyManager.showStoryOnce(e)}))}closeAllReaders(){this.storyManager.closeAllReaders()}openGame(e){return pa(this,arguments,void 0,(function*(e,t={}){return this.storyManager.openGame(e,t)}))}closeGame(){return pa(this,void 0,void 0,(function*(){return this.storyManager.closeGame()}))}closeStoryReader(){return pa(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}static use(e,t){ka.use(e,t)}}(ka);var Aa=function(e,t,r,i){return new(r||(r=Promise))((function(n,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}l((i=i.apply(e,t||[])).next())}))};const Ma=(0,e.createEffect)((e=>Aa(void 0,[e],void 0,(function*({gameInstanceId:e,gameOptions:t}){yield A();const r={};t&&W()(t)&&null!=t.demoMode&&(r.demoMode=Boolean(t.demoMode));const i=yield Y.post(`game/${e}/launch?expand=config`,r);if(!i.ok)throw new Error(JSON.stringify(i.data));return i.data.clientConfig=Ea(),i.data})))),Ea=()=>{var e;let t=L.getState();const r=y.getState();return{sessionId:t.session.id,userKey:t.user_key,apiKey:r.apiKey,sdkVersion:"3.0.0",apiBaseUrl:N.apiUrl,userAgent:q,appPackageId:r.appPackageId,deviceId:C.getState(),userId:null!==(e=r.userId)&&void 0!==e?e:"",lang:r.lang.toString(),placeholders:Ca.combinedPlaceholders}};var Pa=function(e,t,r){for(var i=arguments.length>2,n=0;n<t.length;n++)r=i?t[n].call(e,r):t[n].call(e);return i?r:void 0},ja=function(e,t,r,i,n,s){function o(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var a,l=i.kind,d="getter"===l?"get":"setter"===l?"set":"value",c=!t&&e?i.static?e:e.prototype:null,u=t||(c?Object.getOwnPropertyDescriptor(c,i.name):{}),h=!1,p=r.length-1;p>=0;p--){var f={};for(var g in i)f[g]="access"===g?{}:i[g];for(var g in i.access)f.access[g]=i.access[g];f.addInitializer=function(e){if(h)throw new TypeError("Cannot add initializers after decoration has completed");s.push(o(e||null))};var v=(0,r[p])("accessor"===l?{get:u.get,set:u.set}:u[d],f);if("accessor"===l){if(void 0===v)continue;if(null===v||"object"!=typeof v)throw new TypeError("Object expected");(a=o(v.get))&&(u.get=a),(a=o(v.set))&&(u.set=a),(a=o(v.init))&&n.unshift(a)}else(a=o(v))&&("field"===l?n.unshift(a):u[d]=a)}c&&Object.defineProperty(c,i.name,u),h=!0},Ia=function(e,t,r,i){return new(r||(r=Promise))((function(n,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}l((i=i.apply(e,t||[])).next())}))},Ta=function(e,t,r,i){if("a"===r&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?i:"a"===r?i.call(e):i?i.value:t.get(e)},Ra=function(e,t,r,i,n){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!n)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?n.call(e,r):n?n.value=r:t.set(e,r),r};let Da=(()=>{var e,t,r,i,n,s,o,a,l;let d,c,u,h,p,f,g,v,m,y,b,w,S,_,x,O,C,k,L,A,M,E,P,j,I,T,R=Vt,D=[],B=[],N=[],F=[],U=[],V=[],z=[],G=[],$=[],H=[],q=[],Q=[],K=[],Y=[],Z=[],X=[],J=[];return e=class extends R{get _isOpened(){return Ta(this,t,"f")}set _isOpened(e){Ra(this,t,e,"f")}get _isGameInited(){return Ta(this,r,"f")}set _isGameInited(e){Ra(this,r,e,"f")}get _isGameLoading(){return Ta(this,i,"f")}set _isGameLoading(e){Ra(this,i,e,"f")}get _gameInstanceId(){return Ta(this,n,"f")}set _gameInstanceId(e){Ra(this,n,e,"f")}get _gameLaunch(){return Ta(this,s,"f")}set _gameLaunch(e){Ra(this,s,e,"f")}get _gameLaunchError(){return Ta(this,o,"f")}set _gameLaunchError(e){Ra(this,o,e,"f")}get _closeBtnVisible(){return Ta(this,a,"f")}set _closeBtnVisible(e){Ra(this,a,e,"f")}get _gameShouldBeShown(){return Ta(this,l,"f")}set _gameShouldBeShown(e){Ra(this,l,e,"f")}constructor(d){super(),Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:(Pa(this,D),d)}),t.set(this,Pa(this,B,!1)),r.set(this,(Pa(this,N),Pa(this,F,!1))),i.set(this,(Pa(this,U),Pa(this,V,!1))),n.set(this,(Pa(this,z),Pa(this,G,null))),s.set(this,(Pa(this,$),Pa(this,H,null))),o.set(this,(Pa(this,q),Pa(this,Q,null))),a.set(this,(Pa(this,K),Pa(this,Y,!1))),l.set(this,(Pa(this,Z),Pa(this,X,!1))),Object.defineProperty(this,"initGameRetryAttempts",{enumerable:!0,configurable:!0,writable:!0,value:(Pa(this,J),0)}),Object.defineProperty(this,"gameCenterMessageService",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"safeAreaInsets",{enumerable:!0,configurable:!0,writable:!0,value:{top:0,bottom:0,left:0,right:0}}),Object.defineProperty(this,"openGameOptions",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"desktopMode",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"dir",{enumerable:!0,configurable:!0,writable:!0,value:"ltr"}),this.handleVisibilityChange=this.handleVisibilityChange.bind(this),this.handleOpenGameCenterEvent=this.handleOpenGameCenterEvent.bind(this),document.addEventListener("visibilitychange",this.handleVisibilityChange),ar.on(`${e.name}.openGame`,this.handleOpenGameCenterEvent),this.storyManager.setViewModel(e.name,this)}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 gameShouldBeShown(){return this._gameShouldBeShown}get isWidescreen(){var e,t;return this.desktopMode&&(null===(t=null===(e=this.gameLaunch)||void 0===e?void 0:e.screenOptions.widescreen)||void 0===t||t)}openGame(e,t){return Ia(this,void 0,void 0,(function*(){if(this.isOpened)throw new Error(`Close the launched game with ID "${this.gameInstanceId}"`);this._gameInstanceId=e,this._isOpened=!0,this.openGameOptions=t,this._gameShouldBeShown=!1,yield this.launchGameById(e)}))}closeGame(){return Ia(this,void 0,void 0,(function*(){var e;return!!this._isOpened&&(this._isGameInited?null===(e=this.gameCenterMessageService)||void 0===e||e.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 r;null===(r=this.gameCenterMessageService)||void 0===r||r.sendGameCenterEventByApiRequest(e,t)}setSafeAreaInsets(e){this.safeAreaInsets=e}setDesktopMode(e){this.desktopMode=e}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 r=new URL(this._gameLaunch.url).origin;this.gameCenterMessageService=new _e(e,r),this.initGameCenter(this.gameCenterMessageService,this._gameLaunch)}pauseGameUI(){var e;null===(e=this.gameCenterMessageService)||void 0===e||e.pauseGameUI()}resumeGameUI(){var e;null===(e=this.gameCenterMessageService)||void 0===e||e.resumeGameUI()}confirmSharingComplete({shareId:e,isSuccess:t}){var r;null===(r=this.gameCenterMessageService)||void 0===r||r.shareComplete(e,t)}notifyGameCanBeStarted(){var e;null===(e=this.gameCenterMessageService)||void 0===e||e.notifyGameCanBeStarted()}destroy(){var t;null===(t=this.gameCenterMessageService)||void 0===t||t.destroy(),document.removeEventListener("visibilitychange",this.handleVisibilityChange),ar.off(`${e.name}.openGame`,this.handleOpenGameCenterEvent),this.storyManager.deleteViewModel(e.name)}launchGameById(e){return Ia(this,void 0,void 0,(function*(){try{this._gameLaunchError=null,this._isGameLoading=!0,this._gameLaunch=yield Ma({gameInstanceId:e,gameOptions:this.openGameOptions})}catch(e){this._gameLaunchError=e}}))}initGameCenter(e,t){var r;this.handleGameCenterEvents(e);const i=this.getGameConfig(t);null===(r=this.gameCenterMessageService)||void 0===r||r.initGame(i)}getGameConfig(e){const t=e.screenOptions;return ye()(e.config,{clientConfig:Object.assign({fullScreen:!1,screenOrientation:t.orientation,safeAreaInsets:this.safeAreaInsets,widescreen:this.isWidescreen,dir:this.dir,nonce:Xt(),sdkFeatures:{gameShouldForegroundCallback:!0}},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)).on("gameShouldForegroundCallback",this.handleGameShouldBeShown.bind(this));const t={share:new Et(e,this,this.desktopMode),storySetLocalData:new Tt,storyGetLocalData:new jt(e,this),gameInstanceGetLocalData:new Oe(e,this),gameInstanceSetLocalData:new Ct(e,this)};for(const[r,i]of Object.entries(t))e.on(r,((...e)=>i.handle(...e)))}handleGameShouldBeShown(e){this._gameShouldBeShown=!0;const t=JSON.parse(e);W()(t)&&(this._closeBtnVisible=Boolean(t.showClose))}handleGameLoaded(){try{this.initGame(),this.startGame()}catch(e){console.error(e)}}initGame(){this._isGameInited=!0,this._isGameLoading=!1}completeGame(){this._isGameInited=!1,this._isOpened=!1,this._gameLaunch=null}startGame(){this.storyManager.emit("startGame",{id:this.gameInstanceId})}handleVisibilityChange(){"hidden"===document.visibilityState?this.pauseGameUI():"visible"===document.visibilityState&&this.resumeGameUI()}handleGameComplete(e,t,r,i,n){var s;this.completeGame(),null===(s=this.gameCenterMessageService)||void 0===s||s.destroy(),this.emitGameCompleteEventByStoryManager(e),(null==n?void 0:n.id)&&this.openGame(n.id,{}),(null==i?void 0:i.id)&&this.storyManager.showStory(i.id),Cr()}emitGameCompleteEventByStoryManager(e){xs()(e)?this.storyManager.emit("closeGame",{id:this.gameInstanceId}):this.storyManager.emit("finishGame",{id:this.gameInstanceId,result:e})}handleSendApiRequest(e){It.sendApiRequestPromise(e,((e,t)=>this.sendGameCenterEventByApiRequest(e,t)),St)}handleOpenUrl(e){const{url:t}=JSON.parse(e);this.storyManager.clickOnButtonAction({src:Gt.GAME_READER,payload:{url:t,gameInstanceId:this.gameInstanceId}})}handleGameEvent(e,t){this.storyManager.emit("gameEvent",{name:e,payload:t})}handleReloadGameReader(){const e=this._gameLaunch;this._gameLaunch=null,setTimeout((0,to.action)((()=>{this._gameLaunch=e})))}handleGameLoadFailed(e,t){this.gameLaunch&&t&&this.initGameRetryAttempts<this.gameLaunch.canTryReloadCount?(this.initGameRetryAttempts++,this.handleReloadGameReader()):this._gameLaunchError=new Error(e)}handleOpenGameCenterEvent(e){return Ia(this,arguments,void 0,(function*({gameId:e}){yield this.openGame(e,{}),Or()}))}},t=new WeakMap,r=new WeakMap,i=new WeakMap,n=new WeakMap,s=new WeakMap,o=new WeakMap,a=new WeakMap,l=new WeakMap,(()=>{var t;const r="function"==typeof Symbol&&Symbol.metadata?Object.create(null!==(t=R[Symbol.metadata])&&void 0!==t?t:null):void 0;d=[to.observable],c=[to.observable],u=[to.observable],h=[to.observable],p=[to.observable],f=[to.observable],g=[to.observable],v=[to.observable],m=[to.computed],y=[to.computed],b=[to.computed],w=[to.computed],S=[to.computed],_=[to.computed],x=[to.computed],O=[to.computed],C=[to.computed],k=[to.action],L=[to.action],A=[to.action],M=[to.action],E=[to.action],P=[to.action],j=[to.action],I=[to.action],T=[to.action],ja(e,null,d,{kind:"accessor",name:"_isOpened",static:!1,private:!1,access:{has:e=>"_isOpened"in e,get:e=>e._isOpened,set:(e,t)=>{e._isOpened=t}},metadata:r},B,N),ja(e,null,c,{kind:"accessor",name:"_isGameInited",static:!1,private:!1,access:{has:e=>"_isGameInited"in e,get:e=>e._isGameInited,set:(e,t)=>{e._isGameInited=t}},metadata:r},F,U),ja(e,null,u,{kind:"accessor",name:"_isGameLoading",static:!1,private:!1,access:{has:e=>"_isGameLoading"in e,get:e=>e._isGameLoading,set:(e,t)=>{e._isGameLoading=t}},metadata:r},V,z),ja(e,null,h,{kind:"accessor",name:"_gameInstanceId",static:!1,private:!1,access:{has:e=>"_gameInstanceId"in e,get:e=>e._gameInstanceId,set:(e,t)=>{e._gameInstanceId=t}},metadata:r},G,$),ja(e,null,p,{kind:"accessor",name:"_gameLaunch",static:!1,private:!1,access:{has:e=>"_gameLaunch"in e,get:e=>e._gameLaunch,set:(e,t)=>{e._gameLaunch=t}},metadata:r},H,q),ja(e,null,f,{kind:"accessor",name:"_gameLaunchError",static:!1,private:!1,access:{has:e=>"_gameLaunchError"in e,get:e=>e._gameLaunchError,set:(e,t)=>{e._gameLaunchError=t}},metadata:r},Q,K),ja(e,null,g,{kind:"accessor",name:"_closeBtnVisible",static:!1,private:!1,access:{has:e=>"_closeBtnVisible"in e,get:e=>e._closeBtnVisible,set:(e,t)=>{e._closeBtnVisible=t}},metadata:r},Y,Z),ja(e,null,v,{kind:"accessor",name:"_gameShouldBeShown",static:!1,private:!1,access:{has:e=>"_gameShouldBeShown"in e,get:e=>e._gameShouldBeShown,set:(e,t)=>{e._gameShouldBeShown=t}},metadata:r},X,J),ja(e,null,m,{kind:"getter",name:"closeBtnVisible",static:!1,private:!1,access:{has:e=>"closeBtnVisible"in e,get:e=>e.closeBtnVisible},metadata:r},null,D),ja(e,null,y,{kind:"getter",name:"isGameLoading",static:!1,private:!1,access:{has:e=>"isGameLoading"in e,get:e=>e.isGameLoading},metadata:r},null,D),ja(e,null,b,{kind:"getter",name:"isGameInited",static:!1,private:!1,access:{has:e=>"isGameInited"in e,get:e=>e.isGameInited},metadata:r},null,D),ja(e,null,w,{kind:"getter",name:"gameLaunchError",static:!1,private:!1,access:{has:e=>"gameLaunchError"in e,get:e=>e.gameLaunchError},metadata:r},null,D),ja(e,null,S,{kind:"getter",name:"gameLaunch",static:!1,private:!1,access:{has:e=>"gameLaunch"in e,get:e=>e.gameLaunch},metadata:r},null,D),ja(e,null,_,{kind:"getter",name:"gameInstanceId",static:!1,private:!1,access:{has:e=>"gameInstanceId"in e,get:e=>e.gameInstanceId},metadata:r},null,D),ja(e,null,x,{kind:"getter",name:"isOpened",static:!1,private:!1,access:{has:e=>"isOpened"in e,get:e=>e.isOpened},metadata:r},null,D),ja(e,null,O,{kind:"getter",name:"gameShouldBeShown",static:!1,private:!1,access:{has:e=>"gameShouldBeShown"in e,get:e=>e.gameShouldBeShown},metadata:r},null,D),ja(e,null,C,{kind:"getter",name:"isWidescreen",static:!1,private:!1,access:{has:e=>"isWidescreen"in e,get:e=>e.isWidescreen},metadata:r},null,D),ja(e,null,k,{kind:"method",name:"openGame",static:!1,private:!1,access:{has:e=>"openGame"in e,get:e=>e.openGame},metadata:r},null,D),ja(e,null,L,{kind:"method",name:"closeGame",static:!1,private:!1,access:{has:e=>"closeGame"in e,get:e=>e.closeGame},metadata:r},null,D),ja(e,null,A,{kind:"method",name:"reload",static:!1,private:!1,access:{has:e=>"reload"in e,get:e=>e.reload},metadata:r},null,D),ja(e,null,M,{kind:"method",name:"setDesktopMode",static:!1,private:!1,access:{has:e=>"setDesktopMode"in e,get:e=>e.setDesktopMode},metadata:r},null,D),ja(e,null,E,{kind:"method",name:"handleGameShouldBeShown",static:!1,private:!1,access:{has:e=>"handleGameShouldBeShown"in e,get:e=>e.handleGameShouldBeShown},metadata:r},null,D),ja(e,null,P,{kind:"method",name:"handleGameLoaded",static:!1,private:!1,access:{has:e=>"handleGameLoaded"in e,get:e=>e.handleGameLoaded},metadata:r},null,D),ja(e,null,j,{kind:"method",name:"handleGameComplete",static:!1,private:!1,access:{has:e=>"handleGameComplete"in e,get:e=>e.handleGameComplete},metadata:r},null,D),ja(e,null,I,{kind:"method",name:"handleReloadGameReader",static:!1,private:!1,access:{has:e=>"handleReloadGameReader"in e,get:e=>e.handleReloadGameReader},metadata:r},null,D),ja(e,null,T,{kind:"method",name:"handleGameLoadFailed",static:!1,private:!1,access:{has:e=>"handleGameLoadFailed"in e,get:e=>e.handleGameLoadFailed},metadata:r},null,D),r&&Object.defineProperty(e,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:r})})(),e})();class Ba{constructor(e){Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:e})}create(){return new Da(this.storyManager)}}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}}();function Na(){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:Fa.LANDSCAPE_PRIMARY,"-90":Fa.LANDSCAPE_SECONDARY,0:Fa.PORTRAIT_PRIMARY,180:Fa.PORTRAIT_SECONDARY};function t(){}var r=new t,i=function(e){for(var t=["orientationchange","mozorientationchange","msorientationchange"],r=window.screen,i=0;i<t.length;i++)if(null===r["on"+t[i]])return{delegate:r,event:t[i]};if(void 0!==window.onorientationchange)return{delegate:window,event:"orientationchange"};return{delegate:$a(e),event:"change"}}(r);return t.prototype.addEventListener=Ua("addEventListener",i.delegate,i.event),t.prototype.dispatchEvent=Ua("dispatchEvent",i.delegate,i.event),t.prototype.removeEventListener=Ua("removeEventListener",i.delegate,i.event),t.prototype.lock=function(){var e,t="lockOrientation() is not available on this device.",r=window.screen;e=void 0===r?function(){return!1}:"function"==typeof r.msLockOrientation?r.msLockOrientation.bind(r):"function"==typeof r.mozLockOrientation?r.mozLockOrientation.bind(r):function(){return!1};return function(r){const i=window.Promise;return e(r)?i.resolve(r):i.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(r,{onchange:{get:function(){return i.delegate["on"+i.event]||null},set:function(e){i.delegate["on"+i.event]=Ga(e,r)}},type:{get:function(){var t=window.screen;return t.msOrientation||t.mozOrientation||e[window.orientation+""]||(Ha().matches?"landscape-primary":"portrait-primary")}},angle:{value:0}}),r}(),e}}var Fa;function Ua(e,t,r){var i=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]=Wa(r,n[0]):n[0]=r;var s,o,a=Ga(n[1],i);return"addEventListener"===e&&function(e,t){var r=za.indexOf(e);r>-1?Va[r]=t:(za.push(e),Va.push(t))}(n[1],a),"removeEventListener"===e&&(s=n[1],(o=za.indexOf(s))>-1&&(za.splice(o,1),Va.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"}(Fa||(Fa={}));var Va=[],za=[];function Ga(e,t){var r=za.indexOf(e);return r>-1?Va[r]:function(r){r.target!==t&&qa(r,"target",t),r.currentTarget!==t&&qa(r,"currentTarget",t),"change"!==r.type&&qa(r,"type","change"),e(r)}}function Wa(e,t){var r;try{r=new Event(e,t)}catch(e){r={type:"change"}}return r}function $a(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 r=this.listeners[e].indexOf(t);r>-1&&this.listeners[e].splice(r,1)}}});t.listeners={};var r=Ha();return r&&"boolean"==typeof r.matches&&r.addListener((function(){t.dispatchEvent(Wa("change"))})),t}function Ha(){return"function"!=typeof window.matchMedia?{}:window.matchMedia("(orientation: landscape)")}function qa(e,t,r){Object.defineProperty(e,t,{value:r})}class Qa{constructor(){Object.defineProperty(this,"_storyLists",{enumerable:!0,configurable:!0,writable:!0,value:[]})}get storyLists(){return this._storyLists}addStoryList(e){this._storyLists.push(e)}updateStoryListById(e,t){const r=this._storyLists.findIndex((t=>t.mountSelector===e));this._storyLists[r]=Object.assign(Object.assign({},this._storyLists[r]),t)}removeStoryListById(e){const t=this._storyLists.findIndex((t=>t.mountSelector===e));this._storyLists.splice(t,1)}}class Ka extends Error{constructor(e){super(`Appearance Manager must be an object, but passed ${e.toUpperCase()}. Please check your code.`)}}const Ya=e=>{if(null==e||"object"!=typeof e)throw new Ka(null==e?"null":typeof e)};var Za=function(e,t,r,i){return new(r||(r=Promise))((function(n,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}l((i=i.apply(e,t||[])).next())}))};class Xa extends J.EventEmitter{constructor(e,t,r,i){super(),Object.defineProperty(this,"_mountSelector",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"_appearanceManager",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"params",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"app",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(this,"storyListManager",{enumerable:!0,configurable:!0,writable:!0,value:new Qa}),Object.defineProperty(this,"_ugcCardClickHandler",{enumerable:!0,configurable:!0,writable:!0,value:()=>{}}),Object.defineProperty(this,"_api",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Ya(t),this.storyListManager.addStoryList(this),this.app.setStoryList(this.storyListManager.storyLists)}get mountSelector(){return this._mountSelector}get appearanceManager(){return this._appearanceManager}get type(){return We.DEFAULT}get identityFields(){return{feedSlug:this.feedSlug}}get feedSlug(){return this.params.feed}get testKey(){return this.params.testKey}get useUgcCard(){return this.params.useUgcCard}set ugcCardClickHandler(e){this._ugcCardClickHandler=e}get ugcCardClickHandler(){return this._ugcCardClickHandler}set api(e){this._api=e}reload(){return Za(this,void 0,void 0,(function*(){var e;return null===(e=this._api)||void 0===e?void 0:e.reload()}))}destroy(){this.storyListManager.removeStoryListById(this.mountSelector),this.app.setStoryList(this.storyListManager.storyLists)}}var Ja=function(e,t,r,i){return new(r||(r=Promise))((function(n,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}l((i=i.apply(e,t||[])).next())}))};class el extends J.EventEmitter{constructor(e,t,r,i){super(),Object.defineProperty(this,"_mountSelector",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"_appearanceManager",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"params",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"app",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(this,"storyListManager",{enumerable:!0,configurable:!0,writable:!0,value:new Qa}),Object.defineProperty(this,"_ugcCardClickHandler",{enumerable:!0,configurable:!0,writable:!0,value:()=>{}}),Object.defineProperty(this,"_api",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Ya(t),this.storyListManager.addStoryList(this),this.app.setUGCStoryList(this.storyListManager.storyLists)}get mountSelector(){return this._mountSelector}get appearanceManager(){return this._appearanceManager}get type(){return We.UGC}get identityFields(){return{feedSlug:this.feedSlug}}get feedSlug(){return Oa}get testKey(){return this.params.testKey}get useUgcCard(){return this.params.useUgcCard}set api(e){this._api=e}set ugcCardClickHandler(e){this._ugcCardClickHandler=e}get ugcCardClickHandler(){return this._ugcCardClickHandler}reload(){return Ja(this,void 0,void 0,(function*(){var e;return null===(e=this._api)||void 0===e?void 0:e.reload()}))}destroy(){this.storyListManager.removeStoryListById(this.mountSelector)}}var tl=f(1085);const rl=(e=>{var t={};return f.d(t,e),t})({createRoot:()=>o.createRoot});var il=f(1649);f(6704);window.__IAS__={storyManager:{sdkVersionName:La.sdkVersionName,on:La.on.bind(La),off:La.off.bind(La)}};const nl=(e=>{var t={};return f.d(t,e),t})({default:()=>a.default});var sl=f(2591),ol=f.n(sl),al=f(4289),ll={insert:"head",singleton:!1};ol()(al.A,ll);const dl=al.A.locals||{};var cl=f(7081),ul={insert:"head",singleton:!1};ol()(cl.A,ul);const hl=cl.A.locals||{},pl=({onClick:e,className:t})=>(0,tl.jsx)("div",{className:(0,nl.default)(hl.icon,t),onClick:e,children:(0,tl.jsx)("svg",{viewBox:"0 0 24 24",children:(0,tl.jsx)("path",{fill:"currentColor",d:"M17.65,6.35C16.2,4.9 14.21,4 12,4A8,8 0 0,0 4,12A8,8 0 0,0 12,20C15.73,20 18.84,17.45 19.73,14H17.65C16.83,16.33 14.61,18 12,18A6,6 0 0,1 6,12A6,6 0 0,1 12,6C13.66,6 15.14,6.69 16.22,7.78L13,11H20V4L17.65,6.35Z"})})});var fl=f(5669),gl={insert:"head",singleton:!1};ol()(fl.A,gl);const vl=fl.A.locals||{},ml=310/480,yl=({desktopMode:e,children:t,verticalPadding:r,style:i,isWidescreen:n,className:s})=>{const[o,a]=(0,il.useState)({width:"0px",height:"0px"});(0,il.useEffect)((()=>(l(),window.addEventListener("resize",l),()=>{window.removeEventListener("resize",l)})),[]);const l=()=>{const e=window.innerWidth,t=g(),r=e/window.innerHeight,i=c({aspectRatio:r,vh:t,vw:e}),n=d({aspectRatio:r,vh:t,vw:e});a({width:i,height:n})},d=({aspectRatio:e,vh:t,vw:r})=>{const i=p(e)||f();return e>ml&&!i?`${h({vh:t,vw:r})}px`:"100%"},c=({aspectRatio:e,vh:t,vw:r})=>e>ml&&!p(e)?`${u({aspectRatio:e,vh:t,vw:r})}px`:"auto",u=({aspectRatio:t,vh:r,vw:i})=>t>ml&&!e?i:Math.ceil(r*ml),h=({vh:t,vw:r})=>e?t:Math.ceil(r/ml),p=e=>e>ml&&e-ml<=.1,f=()=>{let e;return"matchMedia"in window&&void 0!==(e=window.matchMedia("(orientation: portrait)"))&&e.matches},g=()=>{let t=window.innerHeight;return e?(t-=r,t):t},v=n?{width:"100%",height:"100%"}:o;return(0,tl.jsx)("div",{className:(0,nl.default)(vl["aspect-ratio-box"],s,{[vl["aspect-ratio-box--centered"]]:!n}),style:Object.assign(Object.assign({},i),v),children:(0,tl.jsx)("div",{className:vl["aspect-ratio-box-inside"],children:t})})};var bl=f(5757),wl={insert:"head",singleton:!1};ol()(bl.A,wl);const Sl=bl.A.locals||{},_l=Na(),xl=e=>{const[t,r]=(0,il.useState)(!1),i=(0,il.useCallback)((()=>{if(e.desktopMode)return;const t=_l.type!==e.orientation;e.onOrientationChange({type:_l.type,isWrong:t}),r(t)}),[e.desktopMode,e.orientation]);return(0,il.useEffect)((()=>(i(),_l.addEventListener("change",i),()=>{_l.removeEventListener("change",i)})),[i]),t?(0,tl.jsx)("div",{className:Sl["screen-orientation-lock"]}):null};var Ol=f(8778),Cl={insert:"head",singleton:!1};ol()(Ol.A,Cl);const kl=Ol.A.locals||{};var Ll=f(1196),Al={insert:"head",singleton:!1};ol()(Ll.A,Al);const Ml=Ll.A.locals||{};let El;function Pl(){let e,t;/ipad|iphone/i.test(navigator.userAgent)?(e=document.createRange(),El&&e.selectNodeContents(El),t=window.getSelection(),t&&(t.removeAllRanges(),t.addRange(e)),El&&El.setSelectionRange(0,999999)):null==El||El.select()}const jl=e=>{!function(e){El=document.createElement("textarea"),El.value=e,document.body.appendChild(El)}(e),Pl(),document.execCommand("copy"),El&&document.body.removeChild(El)},Il=({shareText:e,shareLink:t,sharePanelOptions:r,onShareComplete:i})=>{var n,s,o,a,l,d,c,u,h,p,f;const[g,v]=(0,il.useState)(!1),[m,y]=(0,il.useState)(!1),b=()=>{y(!0),!g&&e||i()};return(0,tl.jsxs)("div",{className:`${kl["share-panel__body"]} ${Ml["share-panel__body_screenshot"]}`,children:[(0,tl.jsx)("div",{className:`${kl["share-panel-row"]} ${Ml["share-panel-row"]}`,children:(0,tl.jsx)("a",{className:Ml["share-panel-row__image-link"],onClick:b,href:t,download:"image.jpeg",children:(0,tl.jsx)("img",{src:t,className:Ml["share-panel-row__image"]})})}),(0,tl.jsx)("div",{className:kl["share-panel-separator"],style:{background:null===(n=r.divider)||void 0===n?void 0:n.background}}),(0,tl.jsx)("div",{className:`${kl["share-panel-row"]} ${Ml["share-panel-row"]}`,children:(0,tl.jsx)("a",{className:Ml["share-item__download-button"],onClick:b,href:t,download:"image.jpeg",children:(0,tl.jsx)("div",{dangerouslySetInnerHTML:{__html:null!==(a=null===(o=null===(s=r.downloadButton)||void 0===s?void 0:s.svgSrc)||void 0===o?void 0:o.baseState)&&void 0!==a?a:""}})})}),e?(0,tl.jsxs)(tl.Fragment,{children:[(0,tl.jsx)("div",{className:kl["share-panel-separator"],style:{background:null===(l=r.divider)||void 0===l?void 0:l.background}}),(0,tl.jsx)("div",{className:`${kl["share-panel-row"]} ${Ml["share-panel-row"]}`,children:(0,tl.jsxs)("button",{className:(0,nl.default)(Ml.btn,Ml["btn-copy"]),onClick:()=>{jl(null!=e?e:""),v(!0),m&&i()},children:[(0,tl.jsxs)("div",{className:Ml["btn-copy__icon"],children:[(0,tl.jsx)("span",{className:(0,nl.default)(Ml["btn-copy__icon-state"],{[Ml["btn-copy__icon-state_default"]]:!g}),dangerouslySetInnerHTML:{__html:null!==(u=null===(c=null===(d=r.copyButton)||void 0===d?void 0:d.svgSrc)||void 0===c?void 0:c.baseState)&&void 0!==u?u:""}}),(0,tl.jsx)("span",{className:(0,nl.default)(Ml["btn-copy__icon-state"],{[Ml["btn-copy__icon-state_done"]]:g}),dangerouslySetInnerHTML:{__html:null!==(f=null===(p=null===(h=r.copyButton)||void 0===h?void 0:h.svgSrc)||void 0===p?void 0:p.doneState)&&void 0!==f?f:""}})]}),(0,tl.jsx)("div",{className:Ml["btn-copy__text"],children:e})]})})]}):null]})};var Tl=f(610),Rl={insert:"head",singleton:!1};ol()(Tl.A,Rl);const Dl=Tl.A.locals||{};var Bl=function(e,t){var r={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(r[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(i=Object.getOwnPropertySymbols(e);n<i.length;n++)t.indexOf(i[n])<0&&Object.prototype.propertyIsEnumerable.call(e,i[n])&&(r[i[n]]=e[i[n]])}return r};const Nl=e=>{var t,r,i,n,s,o,a,l,d,c,u,{shareLink:h,sharePanelOptions:p,onShareComplete:f}=e,g=Bl(e,["shareLink","sharePanelOptions","onShareComplete"]);const v=()=>{try{return new URL(h).host}catch(e){return console.error(e),null}},m=()=>{window.removeEventListener("focus",m),f()},y=()=>v()?"":encodeURIComponent(h),b=e=>{var t,r;const i=(()=>{try{return new URL(h)}catch(e){return console.error(e),null}})();if(!i)return"#";const n=null===(t=p.targetParams)||void 0===t?void 0:t[e];return null===(r=null==n?void 0:n.getUrl)||void 0===r?void 0:r.call(n,{url:i.toString(),text:y()})},w=null===(t=p.title)||void 0===t?void 0:t.favicon,S=p.text;return(0,tl.jsxs)("div",{className:kl["share-panel__body"],children:[(0,tl.jsxs)("div",{className:`${kl["share-panel-row"]} ${kl["title-row"]}`,children:[v()&&Boolean(null==w?void 0:w.display)&&(0,tl.jsx)("div",{className:kl["share-url-favicon"],style:{background:null==w?void 0:w.background},children:(0,tl.jsx)("img",{src:`${null!==(r=g.faviconApiUrl)&&void 0!==r?r:"https://favicon.inappstory.ru"}?sz=64&domain_url=${v()}`})}),(0,tl.jsx)("span",{className:kl.title,style:S,children:null===(n=null===(i=p.title)||void 0===i?void 0:i.getValue)||void 0===n?void 0:n.call(i,{url:h,text:y()})})]}),(0,tl.jsx)("div",{className:kl["share-panel-separator"],style:{background:null===(s=p.divider)||void 0===s?void 0:s.background}}),(0,tl.jsx)("div",{className:`${kl["share-panel-row"]} ${Dl["social-list"]}`,children:null===(o=p.targets)||void 0===o?void 0:o.map(((e,t)=>{var r,i,n;const s=null===(r=p.targetParams)||void 0===r?void 0:r[e],o=null!==(n=null===(i=null==s?void 0:s.icon)||void 0===i?void 0:i.svgSrc.baseState)&&void 0!==n?n:"<svg></svg>";return(0,tl.jsx)("div",{className:Dl["social-list__item"],children:(0,tl.jsxs)("a",{href:b(e),onClick:()=>((e,t,r)=>{window.addEventListener("focus",m),window.open(e,t,r)})(b(e),"newwindow","width=650,height=570"),target:"_blank",rel:"noopener noreferrer",className:`${kl["share-item"]} ${Dl["share-item"]}`,children:[(0,tl.jsx)("div",{dangerouslySetInnerHTML:{__html:o}}),(0,tl.jsx)("span",{className:kl["share-item-title"],style:S,children:null==s?void 0:s.label})]})},t)}))}),(0,tl.jsx)("div",{className:kl["share-panel-separator"],style:{background:null===(a=p.divider)||void 0===a?void 0:a.background}}),(0,tl.jsx)("div",{className:kl["share-panel-row"],children:(0,tl.jsxs)("a",{className:`${kl["share-item"]} ${Dl["share-item"]}`,onClick:()=>{jl(h),f()},children:[(0,tl.jsx)("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:""}}),(0,tl.jsx)("span",{className:kl["share-item-title"],style:S,children:null===(u=p.copyButton)||void 0===u?void 0:u.label})]})})]})};var Fl;!function(e){e.Social="social",e.SlideScreenshot="slide-screenshot"}(Fl||(Fl={}));const Ul=({shareType:e,shareLink:t,shareText:r,onShareCompelete:i,sharePanelOptions:n,className:s})=>{const{dir:o}=kh(),[a,l]=(0,il.useState)(!1),[d,c]=(0,il.useState)(!0),u=()=>{l(!0),c(!1)};return(0,tl.jsxs)("div",{dir:o,className:(0,nl.default)(kl["share-panel-wrapper"],s),onClick:e=>{e.stopPropagation()},onTouchStart:e=>{e.stopPropagation(),e.preventDefault()},children:[(0,tl.jsx)("div",{className:(0,nl.default)(kl["share-panel-backdrop"],{[kl.fadeIn]:d,[kl.fadeOut]:!d}),onClick:()=>{l(!1),c(!1)}}),(0,tl.jsxs)("div",{className:(0,nl.default)(kl["share-panel"],{[kl.slideIn]:d,[kl.slideOut]:!d}),onAnimationEnd:()=>{d||i(a)},style:{"--height":"100%",background:n.background,borderTopLeftRadius:n.borderRadius+"px",borderTopRightRadius:n.borderRadius+"px"},children:[e===Fl.SlideScreenshot&&(0,tl.jsx)(Il,{shareText:r,shareLink:t,onShareComplete:u,sharePanelOptions:n}),e===Fl.Social&&(0,tl.jsx)(Nl,{shareLink:t,onShareComplete:u,sharePanelOptions:n}),(0,tl.jsx)("div",{className:kl["share-panel-separator"]})]})]})};var Vl=f(7495),zl={insert:"head",singleton:!1};ol()(Vl.A,zl);const Gl=Vl.A.locals||{},Wl=e=>{const t=(0,il.useRef)(null),[r,i]=(0,il.useState)(null);return(0,il.useEffect)((()=>{const r=e.plugin.createLottiePlayer(t.current,e.config);return i(r),()=>{r.destroy()}}),[e.config.sha1]),(0,il.useEffect)((()=>{r&&e.forceEnd&&r.stop()}),[r,e.forceEnd]),(0,il.useEffect)((()=>{if(r)return r.on("play",e.onPlay),r.on("complete",e.onComplete),r.on("beforeLoad",e.onBeforeLoad),r.on("load",e.onLoad),r.on("minPlayingTimeExpired",e.onMinPlayingTimeExpired),r.on("error",e.onError),()=>{r.off("play",e.onPlay),r.off("complete",e.onComplete),r.off("beforeLoad",e.onBeforeLoad),r.off("load",e.onLoad),r.off("minPlayingTimeExpired",e.onMinPlayingTimeExpired),r.off("error",e.onError)}}),[r,e.onError,e.onPlay,e.onComplete,e.onLoad,e.onBeforeLoad,e.onMinPlayingTimeExpired]),(0,tl.jsx)("canvas",{ref:t,style:{width:"100%",height:"100%"}})},$l=e=>{var t,r,i;const{storyManager:n}=kh(),[s,o]=(0,il.useState)(!1),[a,l]=(0,il.useState)(!1),[d,c]=(0,il.useState)(!1),[u,h]=(0,il.useState)(!1),[p,f]=(0,il.useState)(!1),[g,v]=(0,il.useState)(!1),m=a||u||e.isGameLoading||!e.gameShouldBeShown,y=(0,il.useMemo)((()=>n.getPlugin("dot-lottie")),[n]),b=d||!y||e.isGameLoadingError?null:(null===(r=null===(t=e.game)||void 0===t?void 0:t.splashLottieScreen)||void 0===r?void 0:r.url)&&(null===(i=e.game)||void 0===i?void 0:i.splashLottieScreen),w=e.game&&!e.isGameLoadingError&&m&&!a&&!b,S=()=>{var t,r,i,n;return e.desktopMode&&(null===(r=null===(t=e.game)||void 0===t?void 0:t.splashLandscapeScreen)||void 0===r?void 0:r.url)?e.game.splashLandscapeScreen.url:null===(n=null===(i=e.game)||void 0===i?void 0:i.splashScreen)||void 0===n?void 0:n.url},_=e.isGameInited&&(!b||p);(0,il.useEffect)((()=>{_&&e.onSplashCanBeHidden()}),[_]);return(0,tl.jsxs)("div",{className:(0,nl.default)(Gl["splash-container"],{[Gl["splash-container--fadeIn"]]:e.game,[Gl["splash-container--fadeOut"]]:e.gameShouldBeShown,[Gl["splash-container--isLoading"]]:w}),children:[(0,tl.jsx)("div",{className:Gl["splash-container__image"],style:{backgroundColor:e.splashImageBackgroundColor},children:S()&&(0,tl.jsx)("img",{src:S(),onLoad:()=>{v(!0)}})}),b&&y&&(0,tl.jsx)("div",{className:Gl["splash-container__lottie"],children:(0,tl.jsx)(Wl,{plugin:y,forceEnd:e.gameShouldBeShown,config:b,onError:()=>{c(!0)},onPlay:()=>{l(!0),o(!1)},onComplete:()=>{l(!1),o(!0)},onLoad:()=>{h(!1)},onBeforeLoad:()=>{h(!0)},onMinPlayingTimeExpired:()=>{f(!0)}})})]})};var Hl=f(9843),ql={insert:"head",singleton:!1};ol()(Hl.A,ql);const Ql=Hl.A.locals||{},Kl=e=>{var t,r;return(0,tl.jsx)("button",{dir:e.dir,onClick:e.onCloseGame,className:Ql["close-btn"],"data-position":e.closeButtonPosition,dangerouslySetInnerHTML:{__html:null!==(r=null===(t=e.closeButtonOptions)||void 0===t?void 0:t.svgSrc.baseState)&&void 0!==r?r:""}})};const Yl=(e=>{var t={};return f.d(t,e),t})({observer:()=>l.observer});const Zl=(e=>{var t={};return f.d(t,e),t})({createPortal:()=>d.createPortal}),Xl=(0,Yl.observer)((({gameReaderViewModel:e})=>{var t,r,i,n,s,o,a,l;const{desktopMode:d,dir:c,gameReaderOptions:u,storyReaderOptions:h}=kh(),p=(0,il.useRef)(null),{sharePanelOpeningParams:f,handleShareComplete:g,closeSharePanel:v}=(e=>{const[t,r]=(0,il.useState)(null);return(0,il.useEffect)((()=>(null==e||e.on("openSharePanel",r),()=>{null==e||e.off("openSharePanel",r)})),[e]),{sharePanelOpeningParams:t,handleShareComplete:i=>{t&&e&&(e.confirmSharingComplete({shareId:t.shareId,isSuccess:i}),r(null))},closeSharePanel:()=>{r(null)}}})(e);Eh((()=>{m()}));const m=()=>{e.closeGame(),v()},{gameLaunch:y,gameLaunchError:b,isGameLoading:w,closeBtnVisible:S}=e,_=(0,nl.default)(dl["game-reader"],{[dl["game-reader--desktop-mode"]]:d,[dl["game-reader--widescreen"]]:e.isWidescreen}),x={background:null!==(r=null===(t=u.backdrop)||void 0===t?void 0:t.background)&&void 0!==r?r:"",opacity:null!==(n=null===(i=u.backdrop)||void 0===i?void 0:i.opacity)&&void 0!==n?n:0,filter:(null===(s=u.backdrop)||void 0===s?void 0:s.blur)?`blur(${u.backdrop.blur}px)`:"none"},O=null!==(a=null===(o=u.game)||void 0===o?void 0:o.backdropColor)&&void 0!==a?a:"";return(0,Zl.createPortal)((0,tl.jsx)("div",{className:dl["game-reader-container"],style:{"--game-box-border-radius":`${parseFloat(String(u.borderRadius))}px`},children:(0,tl.jsxs)("div",{className:_,children:[(0,tl.jsx)("div",{className:dl["game-reader__backdrop"],style:x}),(0,tl.jsxs)(yl,{className:dl["game-reader__game-box"],isWidescreen:e.isWidescreen,desktopMode:d,verticalPadding:100,children:[(0,tl.jsx)($l,{onSplashCanBeHidden:()=>{e.notifyGameCanBeStarted()},desktopMode:d,isGameInited:e.isGameInited,isGameLoading:w,isGameLoadingError:Boolean(e.gameLaunchError),gameShouldBeShown:e.gameShouldBeShown,game:null!==(l=e.gameLaunch)&&void 0!==l?l:void 0,splashImageBackgroundColor:e.gameLaunch?O:x.background}),b&&(0,tl.jsx)(pl,{className:dl["game-reader__refresh-btn"],onClick:()=>{e.reload()}}),(!e.gameShouldBeShown||S)&&(0,tl.jsx)(Kl,{closeButtonPosition:u.closeButtonPosition,dir:c,onCloseGame:m,closeButtonOptions:u.closeButton}),y&&(0,tl.jsxs)(tl.Fragment,{children:[(0,tl.jsx)("iframe",{src:y.url,onLoad:t=>{p.current=t.target,e.dir=c,e.setGameCenterIframe(p.current)},style:{opacity:e.gameShouldBeShown?1:0},frameBorder:"0",className:dl["game-reader__iframe"],sandbox:"allow-same-origin allow-top-navigation allow-forms allow-scripts allow-downloads allow-top-navigation-to-custom-protocols",allow:"fullscreen"}),f&&(0,tl.jsx)(Ul,{shareType:f.shareType,shareLink:f.shareLink,onShareCompelete:g,sharePanelOptions:h.sharePanel})]})]}),y&&u.forceCheckOrientation&&(0,tl.jsx)(xl,{orientation:Fa.PORTRAIT_PRIMARY,desktopMode:d,onOrientationChange:({isWrong:t})=>{e.isGameInited&&(t?e.pauseGameUI():e.resumeGameUI())}})]})}),document.body)}));var Jl=f(2130),ed={insert:"head",singleton:!1};ol()(Jl.A,ed);const td=Jl.A.locals||{};class rd{constructor(e,t,r){Object.defineProperty(this,"storyReaderViewModel",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"storiesViewer",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"backdropRef",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"deltaValY",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"windowHeight",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"swipeUpGestureInAction",{enumerable:!0,configurable:!0,writable:!0,value:!1})}get closeGestureInAction(){return ur.getState()}startMove(){gr(),this.windowHeight=this.storiesViewer.clientHeight,this.storiesViewer.style.setProperty("transition","")}move(e){e>10||this.closeGestureInAction?(fr(),this.moveDownAndScaleReader(e)):(e<-10||this.swipeUpGestureInAction)&&this.moveUp(e)}endMove(){Sr(),this.deltaValY>=0?this.handleSwipeDown():this.handleSwipeUp(),gr()}moveDownAndScaleReader(e){this.deltaValY=e/this.windowHeight;let t=1-(1-.9)*this.deltaValY;t>=1&&(t=1);let r=100*this.deltaValY*.45;r<=0&&(r=0),this.storiesViewer.style.setProperty("transform",`scale(${t}) translateY(${r}%)`)}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(){ar.emit("swipeController.swipeUp")}}Na();const id=()=>{const e=window.innerWidth;return{vh:window.innerHeight,vw:e}};function nd(e,t){e.forEach(t)}function sd(e,t,r){if(!e)throw Error(`${r?r+": ":""}${t}`)}function od({node:e=[],from:t,source:r,parent:i=t||r,to:n,target:s,child:o=n||s,scope:a={},meta:l={},family:d={type:"regular"},regional:c}={}){const u=Id(i),h=Id(d.links),p=Id(d.owners),f=[];nd(e,(e=>e&&Ld(f,e)));const g={id:Ed(),seq:f,next:Id(o),meta:l,scope:a,family:{type:d.type||"crosslink",links:h,owners:p}};return nd(h,(e=>Ld(hd(e),g))),nd(p,(e=>Ld(pd(e),g))),nd(u,(e=>Ld(e.next,g))),c&&Pd&&jd(fd(Pd),[g]),g}function ad(e){const t=()=>e();return t.unsubscribe=()=>e(),t}function ld(e,{scope:t,safe:r}={}){sd(t||Wd||r,"scopeBind: scope not found");const i=t||Wd;return t=>{function r(){$d(o)}let n,s=0;const o=Wd;$d(i);try{n=e(t)}catch(e){n=e,s=1}if(r(),s)throw n;return n instanceof Promise&&n.then(r,r),n}}function dd({unit:e,fn:t,scope:r,batch:i}){const n=[Vd.run({fn:e=>t(e)})];i&&n.unshift(Vd.compute({priority:"sampler",batch:1})),bd(e)&&n.unshift(Vd.mov({store:e.stateRef,to:"stack"}));const s=Array.isArray(e)?e:[e];if(r){const e=[],t=r.additionalLinks;return s.forEach((r=>{const i=t[r.graphite.id]||[];t[r.graphite.id]=i;const s=od({node:cd(n,r),meta:{watchOp:r.kind}});i.push(s),e.push((()=>{const e=i.indexOf(s);-1!==e&&i.splice(e,1),Kd(s)}))})),ad((()=>{e.forEach((e=>e()))}))}{const e=od({node:n,parent:s,family:{owners:s}});return ad((()=>{Kd(e)}))}}function cd(e,t){return bd(t)?[Vd.mov({store:t.stateRef,to:"stack"}),...e]:e}"undefined"!=typeof Symbol&&Symbol.observable;const ud=e=>e.graphite||e,hd=e=>e.family.owners,pd=e=>e.family.links,fd=e=>e.value,gd=e=>e.subscribers,vd=(e,t)=>ud(e).meta[t],md=e=>(Rd(e)||Td(e))&&"kind"in e,yd=e=>t=>md(t)&&t.kind===e,bd=yd("store"),wd=yd("event"),Sd=yd("effect"),_d=e=>md(e)&&!!e.targetable,xd=yd("domain"),Od=yd("scope");var Cd={__proto__:null,unit:md,store:bd,event:wd,effect:Sd,targetable:_d,domain:xd,scope:Od,attached:e=>Sd(e)&&1==vd(e,"attached")};const kd=(e,t)=>{const r=e.indexOf(t);-1!==r&&e.splice(r,1)},Ld=(e,t)=>e.push(t),Ad=()=>{let e=0;return()=>""+ ++e},Md=(Ad(),Ad()),Ed=Ad();Ad();let Pd=null;const jd=(e,t)=>{const r=ud(e);nd(t,(e=>{const t=ud(e);"domain"!==r.family.type&&(t.family.type="crosslink"),Ld(hd(t),r),Ld(pd(r),t)}))},Id=(e=[])=>(Array.isArray(e)?e:[e]).flat().map(ud),Td=e=>"object"==typeof e&&null!==e,Rd=e=>"function"==typeof e,Dd=(e,t,r,i)=>{const n={id:Md(),type:e,data:t};return r&&(n.order={priority:r},i&&(n.order.barrierID=++Bd)),n};let Bd=0;const Nd=({from:e="store",store:t,target:r,to:i=(r?"store":"stack"),batch:n,priority:s})=>Dd("mov",{from:e,store:t,to:i,target:r},s,n),Fd=({fn:e,batch:t,priority:r,safe:i=0,filter:n=0,pure:s=0})=>Dd("compute",{fn:e,safe:i,filter:n,pure:s},r,t),Ud=({fn:e})=>Fd({fn:e,priority:"effect"}),Vd={mov:Nd,compute:Fd,filter:({fn:e,pure:t})=>Fd({fn:e,filter:1,pure:t}),run:Ud};const zd=[];let Gd=0;for(;Gd<6;)Ld(zd,{first:null,last:null,size:0}),Gd+=1;new Set;let Wd;const $d=e=>{Wd=e};const Hd=(e,t)=>{kd(e.next,t),kd(hd(e),t),kd(pd(e),t)},qd=(e,t,r)=>{let i;e.next.length=0,e.seq.length=0,e.scope=null;let n=pd(e);for(;i=n.pop();)Hd(i,e),(t||r&&"sample"!==e.meta.op||"crosslink"===i.family.type)&&qd(i,t,"on"!==i.meta.op&&r);for(n=hd(e);i=n.pop();)Hd(i,e),r&&"crosslink"===i.family.type&&qd(i,t,"on"!==i.meta.op&&r)},Qd=e=>e.clear(),Kd=(e,{deep:t}={})=>{let r=0;if(e.ownerSet&&e.ownerSet.delete(e),bd(e))Qd(gd(e));else if(xd(e)){r=1;const t=e.history;Qd(t.events),Qd(t.effects),Qd(t.stores),Qd(t.domains)}qd(ud(e),!!t,r)};od({node:[Ud({fn:({fn:e,value:t})=>e(t)})],meta:{op:"fx",fx:"sidechain"}});var Yd=f(7121),Zd=f(8139);function Xd(e,t){const r=Cd.unit(e);let i={};r?i={unit:e}:"@@unitShape"in e?"function"==typeof e["@@unitShape"]?i=e["@@unitShape"]():tc("expect @@unitShape to be a function"):i=e;const n=Array.isArray(i),s=il.default.useRef({stale:1,justSubscribed:0,scope:t}),[o,a,l,d,c]=il.default.useMemo((()=>{s.current.stale=1;const e=Array.isArray(i)?[]:{},n=[],o=[],a=[],l=[];for(const s in i){if(!{}.hasOwnProperty.call(i,s))continue;const d=i[s];Cd.unit(d)||tc(`expect useUnit ${r?"argument":`value in key "${s}"`} to be a unit`),Cd.event(d)||Cd.effect(d)?(e[s]=t?ld(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(i),...Object.values(i)]),u=il.default.useRef({value:o,storeKeys:a,eventKeys:d,eventValues:c}),h=il.default.useCallback((e=>{const r=s.current;return r.justSubscribed=1,dd({unit:l,fn:()=>{r.stale||(r.stale=1,e())},scope:t,batch:1})}),[l,t,u,s]),p=il.default.useCallback((()=>{const e=u.current,i=s.current;let h,p=0;const f=e.value,g=e.storeKeys,v=e.eventKeys,m=e.eventValues,y=t!==i.scope;if(i.stale||i.justSubscribed||y){p=!i.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 r=nc(l[e],t),i=a[e];p||(p=g.includes(i)?f[i]!==r:1),h[i]=r}for(let e=0;e<d.length;e++){const t=c[e],r=d[e];p||(p=v.includes(r)?m[v.indexOf(r)]!==t:1)}}return p&&(e.value=h),e.storeKeys=a,e.eventKeys=d,e.eventValues=c,i.stale=0,i.justSubscribed=!p,i.scope=t,r?e.value.unit:e.value}),[h,l,c,t,u,s]);return rc(h,p,p)}function Jd(e){const t=il.default.useContext(sc);return e&&!t&&tc("No scope found, consider adding <Provider> to app root"),t}function ec(e,t){return Xd(e,Jd(null==t?void 0:t.forceScope))}const tc=e=>{throw Error(e)},{useSyncExternalStore:rc}=("undefined"!=typeof window?il.default.useLayoutEffect:il.default.useEffect,Zd),{useSyncExternalStoreWithSelector:ic}=Yd,nc=(e,t)=>t?t.getState(e):e.getState(),sc=il.default.createContext(null),{Provider:oc}=sc,ac=Math.tan(.375*Math.PI),lc=!!Bn()&&{passive:!0};class dc extends J.EventEmitter{constructor(){super(),Object.defineProperty(this,"startValX",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"startValY",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"globalHorizontalSwipeGesture",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"globalVerticalSwipeGesture",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"enabled",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"touchGestureTimerId",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"touchGestureRegistered",{enumerable:!0,configurable:!0,writable:!0,value:!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,lc)}enable(){this.enabled=!0}disable(){this.enabled=!1}handleMouseDown(e){this.enabled&&hr.getState()&&(this.pauseMouseDownTimer(),this.initStartPoint(e),this.globalHorizontalSwipeGesture=!1,this.globalVerticalSwipeGesture=!1,ar.emit("swipeController.startMove"),this.registerMoveAndUpEvents())}pauseMouseDownTimer(){this.touchGestureTimerId=setTimeout((()=>{wr(),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){const t=e.pageX||e.touches&&e.touches[0].pageX,r=e.pageY||e.touches&&e.touches[0].pageY,i=t-this.startValX,n=r-this.startValY,s=Math.abs(i/n);let o=!1,a=!1,l=!1;Math.abs(i)>0||Math.abs(n)>0?(o=!0,s<=ac&&(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,lc),window.removeEventListener("mouseup",this.handleMouseUp),window.removeEventListener("touchend",this.handleMouseUp),ar.emit("swipeController.beforeEndMove"),this.touchGestureRegistered=!1,this.globalHorizontalSwipeGesture||this.globalVerticalSwipeGesture?this.globalVerticalSwipeGesture?this.completeVerticalSwipe():this.completeHorizontalSwipe():Sr()}moveVertical(e){this.globalVerticalSwipeGesture=!0,ar.emit("swipeController.move",{startY:this.startValY,startX:this.startValX,y:e,x:0,lockY:!1,lockX:!0})}moveHorizontal(e){this.globalHorizontalSwipeGesture=!0,ar.emit("swipeController.move",{startY:this.startValY,startX:this.startValX,y:0,x:e,lockY:!0,lockX:!1})}completeVerticalSwipe(){ar.emit("swipeController.endMove",{lockY:!1,lockX:!0}),this.globalVerticalSwipeGesture=!1}completeHorizontalSwipe(){ar.emit("swipeController.endMove",{lockY:!0,lockX:!1}),this.globalHorizontalSwipeGesture=!1}registerMoveAndUpEvents(){window.addEventListener("mousemove",this.handleMouseMove,!1),window.addEventListener("touchmove",this.handleMouseMove,lc),window.addEventListener("mouseup",this.handleMouseUp,!1),window.addEventListener("touchend",this.handleMouseUp,!1)}destroy(){window.removeEventListener("mousedown",this.handleMouseDown),window.removeEventListener("touchstart",this.handleMouseDown,lc)}}const cc=e=>50+parseFloat(String(e)),uc=(e,t)=>{const r=e.hasLike&&Boolean(t.hasLike),i=e.hasShare&&Boolean(t.hasShare),n=e.hasFavorite&&Boolean(t.hasFavorite),s=e.hasAudio;return!e.isBlank&&(r||n||i||s)},hc=e=>{const{desktopMode:t,storyReaderOptions:r}=kh();return(0,il.useMemo)((()=>{const i=cc(r.actionPanelBottomOffset),n=new qs(e.vw,e.vh,i),s=new Hs(n).create({vw:e.vw,vh:e.vh,desktopMode:t}),o=s instanceof $s,a=o?n.getViewportCorrectionPadding():{};return{actionPanelHeight:i,safeAreaFrameCalculator:n,storyGeometry:s,isMobileGeometry:o,correctionPaddingStyle:a}}),[r.actionPanelBottomOffset,e,t])},pc=(0,Yl.observer)((e=>{const t=(0,il.useRef)(null),r=(0,il.useRef)(null),{desktopMode:i,storyReaderOptions:n}=kh();(({storyReaderViewModel:e,storiesViewerRef:t,backdropRef:r})=>{const i=(0,il.useRef)(null);(0,il.useEffect)((()=>{i.current=new rd(e,t.current,r.current)}),[]);const n=()=>{var e;t.current.classList.add(td["no-select"]),null===(e=i.current)||void 0===e||e.startMove()},s=({y:e,lockX:t})=>{var r;t&&(null===(r=i.current)||void 0===r||r.move(e))},o=({lockX:e})=>{var t;e&&(null===(t=i.current)||void 0===t||t.endMove())},a=()=>{t.current.classList.remove(td["no-select"])};(0,il.useEffect)((()=>(ar.on("swipeController.startMove",n),ar.on("swipeController.move",s),ar.on("swipeController.endMove",o),ar.on("swipeController.beforeEndMove",a),()=>{ar.off("swipeController.startMove",n),ar.off("swipeController.move",s),ar.off("swipeController.endMove",o),ar.off("swipeController.beforeEndMove",a)})),[])})({storyReaderViewModel:e.storyReaderViewModel,backdropRef:t,storiesViewerRef:r});const{safeAreaFrameCalculator:s,isMobileGeometry:o}=hc(e.viewport),a=!o||s.shouldBeShownSafeAreaInsets?parseFloat(String(n.borderRadius)):0;return(0,tl.jsxs)(tl.Fragment,{children:[(0,tl.jsxs)("div",{ref:r,className:(0,nl.default)("stories-viewer",td["stories-viewer"],td.slider3d),style:Object.assign(Object.assign({},{"--loaderBackgroundColor":null===(l=n.loader)||void 0===l?void 0:l.default.color,"--loaderBackgroundAccentColor":null===(d=n.loader)||void 0===d?void 0:d.default.accentColor,"--timelineBlockTopOffset":`${parseFloat(String(n.timelineBlockTopOffset))}px`,"--slideBorderRadius":`${a}px`}),(()=>{var e,t,r,i;return{backgroundColor:null!==(t=null===(e=n.commonBackdrop)||void 0===e?void 0:e.color)&&void 0!==t?t:void 0,backdropFilter:null!==(i=null===(r=n.commonBackdrop)||void 0===r?void 0:r.backdropFilter)&&void 0!==i?i:void 0}})()),children:[i&&(0,tl.jsx)("div",{className:td["stories-viewer-background"],style:(()=>{var t,r,i;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===(r=n.slideBackdrop)||void 0===r?void 0:r.opacity)||0,filter:(null===(i=n.slideBackdrop)||void 0===i?void 0:i.blur)?`blur(${n.slideBackdrop.blur}px)`:"none"}})()}),e.children]}),(0,tl.jsx)("div",{ref:t,className:(0,nl.default)(td["stories-viewer-backdrop"],{[td._desktopMode]:i})})]});var l,d}));var fc=f(3390),gc={insert:"head",singleton:!1};ol()(fc.A,gc);const vc=fc.A.locals||{};var mc=f(2594),yc={insert:"head",singleton:!1};ol()(mc.A,yc);const bc=mc.A.locals||{};var wc=f(187),Sc={insert:"head",singleton:!1};ol()(wc.A,Sc);const _c=wc.A.locals||{},xc=(0,Yl.observer)((({story:e,commonOptions:t,storyReaderOptions:r})=>{const{dir:i}=kh(),n=ec(pr),s=e.hasLike&&Boolean(t.hasLike),o=e.hasShare&&Boolean(t.hasShare),a=e.hasFavorite&&Boolean(t.hasFavorite),l=e.hasAudio,d=uc(e,t)?cc(r.actionPanelBottomOffset):0;return(0,tl.jsx)("div",{dir:i,className:_c["stories-button-panel"],style:{height:`${d}px`,transform:`translateY(${d}px)`},children:uc(e,t)&&(0,tl.jsxs)("div",{className:_c["stories-button-panel-actions"],children:[(()=>{if(!s)return null;const t=0===e.like||-1===e.like,i=0===e.like||1===e.like;return(0,tl.jsxs)("span",{children:[(0,tl.jsx)("span",{className:(0,nl.default)(_c["button-panel-action"],{"like-up":t,"like-up-filled":1===e.like}),dangerouslySetInnerHTML:{__html:t?r.likeButton.svgSrc.baseState:r.likeButton.svgSrc.activeState},onClick:()=>{e.setLike(1===e.like?0:1)}}),(0,tl.jsx)("span",{className:(0,nl.default)(_c["button-panel-action"],{"like-down":i,"like-down-filled":-1===e.like}),dangerouslySetInnerHTML:{__html:i?r.dislikeButton.svgSrc.baseState:r.dislikeButton.svgSrc.activeState},onClick:()=>{e.setDislike(-1===e.like?0:-1)}})]})})(),a&&(0,tl.jsx)("span",{children:(0,tl.jsx)("span",{className:(0,nl.default)(_c["button-panel-action"],{bookmark:!e.favorite,"bookmark-filled":e.favorite}),dangerouslySetInnerHTML:{__html:e.favorite?r.favoriteButton.svgSrc.activeState:r.favoriteButton.svgSrc.baseState},onClick:()=>e.setBookmark(!e.favorite)})}),(0,tl.jsxs)("span",{className:_c["right-container"],children:[l&&(0,tl.jsx)("span",{children:(0,tl.jsx)("span",{className:(0,nl.default)(_c["button-panel-action"],{"muted-icon":n,"sound-icon":!n}),dangerouslySetInnerHTML:{__html:n?r.muteButton.svgSrc.baseState:r.muteButton.svgSrc.activeState},onClick:()=>{n?br():yr()}})}),o&&(0,tl.jsx)("span",{className:_c["button-panel-action"],dangerouslySetInnerHTML:{__html:r.shareButton.svgSrc.baseState},onClick:()=>{e.share()}})]})]})})}));var Oc=f(2349),Cc={insert:"head",singleton:!1};ol()(Oc.A,Cc);const kc=Oc.A.locals||{},Lc=e=>{var t,r;const{dir:i}=kh(),n=ec(dr);return(0,tl.jsx)("div",{className:kc["story-header"],children:!e.closeDisabled&&(0,tl.jsx)("button",{dir:i,"data-position":e.options.closeButtonPosition,className:(0,nl.default)(kc["stories-viewer__close"],{[kc["_paused-ui"]]:n}),onClick:t=>{t.stopPropagation(),t.preventDefault(),e.onClose()},dangerouslySetInnerHTML:{__html:null!==(r=null===(t=e.options.closeButton)||void 0===t?void 0:t.svgSrc.baseState)&&void 0!==r?r:""}})})};var Ac=f(3278),Mc={insert:"head",singleton:!1};ol()(Ac.A,Mc);const Ec=Ac.A.locals||{};var Pc=f(6323),jc={insert:"head",singleton:!1};ol()(Pc.A,jc);Pc.A.locals;const Ic=e=>{const t=e.slide;(0,il.useLayoutEffect)((()=>()=>{t.stop()}),[t]);const{slideContentRef:r}=(({slide:e,activeStory:t,currentStory:r,needSlideInitByFlipping:i,currentSlideIndex:n,slidesLoaded:s})=>{const o=(0,il.useRef)(null),[a,l]=ec([pr,cr]),d=t.id===r.id,c=d||i,u=0===n,h=1===n,p=c&&s&&e.state===Ks.None&&u,f=e.state===Ks.Started&&h||!c,g=d&&e.state===Ks.Loaded&&u;return(0,il.useLayoutEffect)((()=>{p&&e.init(o.current)}),[e,p]),(0,il.useLayoutEffect)((()=>{g&&e.start()}),[d,g]),(0,il.useLayoutEffect)((()=>{f&&e.stop()}),[f]),(0,il.useEffect)((()=>{l?e.pause():e.resume()}),[e,l,e.state]),(0,il.useEffect)((()=>{a?e.mute():e.unmute()}),[e,a,e.state]),{slideContentRef:o}})(e),i=t.state===Ks.Loading||!e.slidesLoaded,n=t.state===Ks.Loading||!e.slidesLoaded;return{slideContentRef:r,needLoadingMask:i,isVisible:t.state===Ks.Loaded||t.state===Ks.Started||t.state===Ks.Paused,needLoadingAnimation:n}},Tc=e=>{var t,r;kr(),Dr({text:e.text,link:null!==(t=e.url)&&void 0!==t?t:"",type:e.type,id:null!==(r=e.id)&&void 0!==r?r:""})};var Rc=function(e,t,r,i){return new(r||(r=Promise))((function(n,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}l((i=i.apply(e,t||[])).next())}))};const Dc=(e,t)=>Rc(void 0,void 0,void 0,(function*(){const r=Bc();if(!r)throw new Error;try{kr(),Gi({id:e}),yield r(t),Wi({result:!0})}catch(e){if(e instanceof DOMException&&"AbortError"===e.name)return;throw e}finally{Wi({result:!1})}})),Bc=()=>{var e,t;let r=null===(e=navigator.share)||void 0===e?void 0:e.bind(navigator);return!r&&(null===(t=window.parent)||void 0===t?void 0:t.navigator.share)&&(r=window.parent.navigator.share.bind(window.parent.navigator)),r};var Nc=function(e,t,r,i){return new(r||(r=Promise))((function(n,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}l((i=i.apply(e,t||[])).next())}))};const Fc=e=>Nc(void 0,[e],void 0,(function*({shareId:e,shareText:t,hideElementsSelector:r,slideContent:i,desktopMode:n}){let s=null;try{const o=yield Rn(In.IOS,i,function(e){let t="";return Array.prototype.slice.call(window.document.styleSheets).forEach((r=>{e(r)&&(t+=Array.prototype.slice.call(r.rules).map((e=>e.cssText)).join(""))})),t}((function(){return!0})),r),a={files:[o],text:t};if(s=URL.createObjectURL(o),n)return void Tc({type:At.SlideScreenshot,id:e,url:s,text:t});yield Dc(e,a)}catch(r){console.error(r),s&&Tc({type:At.SlideScreenshot,id:e,url:s,text:t})}}));var Uc=function(e,t,r,i){return new(r||(r=Promise))((function(n,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}l((i=i.apply(e,t||[])).next())}))};const Vc=e=>{const t={};for(const[r,i]of Object.entries(null!=e?e:{}))null!==i&&(t[r]=i);return t},zc=e=>{const t=({shareId:t,config:r})=>{var i;i={shareId:t,config:r,desktopMode:e.desktopMode},Uc(void 0,[i],void 0,(function*({shareId:e,config:t,desktopMode:r}){var i;null==e&&(e="story-share");const n=Vc(t),s=n.url=null!==(i=n.url)&&void 0!==i?i:n.text,o={type:At.Social,id:e,url:s};try{if(r)return void Tc(o);yield Dc(e,n)}catch(e){Tc(o)}}))},r=({shareId:t,hideElementsSelector:r,shareText:i})=>{const n=e.slideContentRef.current;Fc({shareId:t,hideElementsSelector:r,shareText:i,slideContent:n,desktopMode:e.desktopMode})};(0,il.useEffect)((()=>{if(e.activeStoryId===e.currentStoryId&&0===e.currentSlideIndex)return ar.on(ro.PerformShareAction,t),ar.on(ro.PerformScreenShotShareAction,r),()=>{ar.off(ro.PerformShareAction,t),ar.off(ro.PerformScreenShotShareAction,r)}}),[e.activeStoryId,e.currentStoryId,e.currentSlideIndex])};class Gc{constructor(e){let t;Object.defineProperty(this,"timeout_id",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"duration",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"content",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"position",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"getMountPoint",{enumerable:!0,configurable:!0,writable:!0,value:()=>document.body}),this.timeout_id=null,this.duration=3e3,this.content="",this.position="bottom",e&&"object"==typeof e&&(e.duration&&(this.duration="string"==typeof e.duration?parseFloat(e.duration):e.duration),e.content&&(this.content=e.content),e.getMountPoint&&(this.getMountPoint=e.getMountPoint),e.position&&(t=e.position.toLowerCase(),this.position="top"===t||"bottom"===t?t:"bottom"),this.show())}show(){var e;if(!this.content)return!1;this.timeout_id&&clearTimeout(this.timeout_id);const t=document.getElementById("toast_container");t&&(null===(e=t.parentNode)||void 0===e||e.removeChild(t));const r=document.createElement("div");r.setAttribute("id","toast_container"),r.setAttribute("class","toast_fadein");const i=document.createElement("div");i.setAttribute("id","toast"),r.appendChild(i);const n=document.createElement("span");return n.innerHTML=this.content,i.appendChild(n),this.getMountPoint().appendChild(r),this.timeout_id=window.setTimeout(this.hide,this.duration),!0}hide(){const e=document.getElementById("toast_container");if(!e)return!1;function t(){var e;const t=document.getElementById("toast_container");if(!t)return!1;null===(e=t.parentNode)||void 0===e||e.removeChild(t)}return this.timeout_id&&clearTimeout(this.timeout_id),e.className+=" toast_fadeout",e.addEventListener("webkitAnimationEnd",t),e.addEventListener("animationEnd",t),e.addEventListener("msAnimationEnd",t),e.addEventListener("oAnimationEnd",t),!0}}var Wc=function(e,t){var r={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(r[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(i=Object.getOwnPropertySymbols(e);n<i.length;n++)t.indexOf(i[n])<0&&Object.prototype.propertyIsEnumerable.call(e,i[n])&&(r[i[n]]=e[i[n]])}return r};const $c=(0,Yl.observer)((e=>{var{geometry:t}=e,r=Wc(e,["geometry"]);const{desktopMode:i}=kh(),{slideContentRef:n,needLoadingAnimation:s,needLoadingMask:o}=Ic(r),{slideStyle:a,slideContentStyle:l,needBottomPanel:d}=(({geometry:e,currentStory:t})=>{const{storyReaderOptions:r,commonOptions:i}=kh(),n=(0,il.useMemo)((()=>uc(t,i)),[t,i]),s=n?cc(r.actionPanelBottomOffset):0;return{needBottomPanel:n,slideStyle:(0,il.useMemo)((()=>({margin:e.getOffset(s),width:e.getWidth(),height:e.getHeight(),"--y-offset":e.getOffsetY(s),"--x-offset":e.getOffsetX(s)})),[s,e]),slideContentStyle:(0,il.useMemo)((()=>({fontSize:e.getFontSize()})),[e])}})({geometry:t,currentStory:r.currentStory});zc({slideContentRef:n,desktopMode:i,activeStoryId:r.activeStory.id,currentStoryId:r.currentStory.id,currentSlideIndex:r.currentSlideIndex}),(({slideContentRef:e,state:t})=>{const r=t=>{new Gc(Object.assign({getMountPoint:()=>e.current},t))};(0,il.useEffect)((()=>{if(t===Ks.Started)return ar.on(ro.ShowToast,r),()=>{ar.off(ro.ShowToast,r)}}),[t])})({slideContentRef:n,state:r.slide.state});const{handleSlideClick:c}=(({desktopMode:e,geometry:t,slide:r})=>{const{dir:i}=kh(),n=e=>["narrative-element-link","narrative-element-image","narrative-element-swipe-up"].some((t=>e.classList.contains(t))),s=(n,s)=>{const o=new Ui(r,s,t,i,e);for(const e of r.widgets)if(e.click({target:n,navigationController:o}),o.defaultPrevented)break;o.defaultPrevented||o.navigate()};return{handleSlideClick:e=>{const t=e.target;n(t)?Ys(r.story,t):s(t,e)}}})({activeStory:r.activeStory,desktopMode:i,geometry:t,slide:r.slide}),u=r.networkError||r.slide.state===Ks.Error;return(0,tl.jsxs)("div",{onClick:e=>{e.preventDefault(),e.stopPropagation(),r.clickDisabled||c(e)},className:`${Ec["stories-slide"]} ${Ec[`_position_${r.currentSlideIndex+1}`]} ${(0,nl.default)({[Ec["_with-bottom-panel"]]:d,[Ec["_desktop-mode"]]:t instanceof Ws})}`,children:[(0,tl.jsx)("div",{className:Ec["stories-slide-offset"],style:a,children:(0,tl.jsx)("div",{className:Ec["stories-slide-box"],"data-testid":"stories-slide-box",children:(0,tl.jsx)("div",{ref:n,dangerouslySetInnerHTML:{__html:r.slide.html},className:`${Ec["stories-slide-content"]} narrative-slide"`,style:l})})}),(o||u)&&(0,tl.jsx)("div",{className:Ec["load-mask"],onClick:e=>{e.stopPropagation(),e.preventDefault()},children:u?(0,tl.jsx)(pl,{className:Ec["stories-slide__refresh-btn"],onClick:()=>{r.networkError?r.onReloadStory():r.slide.reload()}}):s&&(0,tl.jsx)("div",{className:Ec["loading-spinner-default"]})})]})}));var Hc=f(9137),qc={insert:"head",singleton:!1};ol()(Hc.A,qc);const Qc=Hc.A.locals||{},Kc=(0,il.forwardRef)(((e,t)=>{const{desktopMode:r,dir:i}=kh(),n=ec(dr);return(0,tl.jsx)("div",{ref:t,dir:i,className:(0,nl.default)(Qc["stories-pager"],{[Qc["_desktop-mode"]]:r,[Qc["_paused-ui"]]:n}),style:{"--stories-pager-tick-foreground":e.timeline.foreground,"--stories-pager-background":e.timeline.background},children:(0,tl.jsx)("div",{className:`${Qc["stories-pager__ticks"]} ${(0,nl.default)({[Qc.hiddenTimeline]:e.hiddenTimeline})}`,children:new Array(e.slidesLength).fill(0).map(((t,r)=>(0,tl.jsxs)("div",{className:Qc["stories-pager__tick"],children:[(0,tl.jsx)("div",{className:(0,nl.default)(Qc["stories-pager__tick-progress"],{[Qc._active]:r+1<=e.activeSlideIndex})}),(0,tl.jsx)("div",{className:Qc["stories-pager__tick-progress-loader"],style:{display:r+1===e.activeSlideIndex+1?"block":"none"}})]},r+1)))})})}));var Yc=f(6212),Zc={insert:"head",singleton:!1};ol()(Yc.A,Zc);const Xc=Yc.A.locals||{};var Jc=function(e,t,r,i){return new(r||(r=Promise))((function(n,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}l((i=i.apply(e,t||[])).next())}))};const eu=e=>{const t=(0,il.useRef)(null),r=(0,il.useRef)(null),i=(0,il.useRef)(0),n=(0,il.useRef)(0);let s;const o=()=>{r.current&&(n.current=-1*function(e){const t=window.getComputedStyle(e),r=t.transform||t.webkitTransform||t.mozTransform;if("none"===r)return{x:0,y:0,z:0};const i=r.includes("3d")?"3d":"2d",n=r.match(/matrix.*\((.+)\)/)[1].split(", ");return"2d"===i?{x:isNaN(n[4])?0:n[4],y:isNaN(n[5])?0:n[5],z:0}:"3d"===i?{x:isNaN(n[12])?0:n[12],y:isNaN(n[13])?0:n[13],z:isNaN(n[14])?0:n[14]}:{x:0,y:0,z:0}}(r.current).x)},[a,l]=(0,il.useState)(!1),[d,c]=(0,il.useState)(!1),u=(0,il.useRef)(!1),h=()=>{const t=il.Children.count(e.children);return r.current&&t?r.current.scrollWidth/t:0};let p=!1;(0,il.useEffect)((()=>{var e;return("ontouchstart"in window||window.navigator.msPointerEnabled||"ontouchstart"in document.documentElement)&&(p=!0),p||(r.current&&(s=null===(e=r.current.children[0])||void 0===e?void 0:e.offsetWidth),r.current&&(i.current=r.current.scrollWidth-r.current.clientWidth,o()),i.current===n.current?c(!1):c(!0),0===n.current?l(!1):l(!0)),()=>{}}),[]);const f=(0,il.useRef)(!1),g=(0,il.useRef)(0);let v=0;const m=(0,il.useRef)(!1),[y,b]=(0,il.useState)(0),w=e=>{e<0&&(e=0),e>i.current&&(e=i.current),b(e)};(0,il.useEffect)((()=>{y===i.current?c(!1):c(!0),l(0!==y)}),[y]);const S=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,r=n.current+e;w(r)}}else m.current=!1},_=e=>{m.current&&e.preventDefault(),setTimeout((()=>{m.current=!1})),f.current=!1,document.removeEventListener("mousemove",S),document.removeEventListener("mouseup",_),document.removeEventListener("touchmove",S),document.removeEventListener("touchend",_)};return(0,tl.jsxs)("div",{className:Xc["scrolling-carousel"],style:e.style,children:[(0,tl.jsx)("div",{className:Xc["scrolling-carousel__wrapper"],ref:t,onMouseDown:e=>{u.current||(e.preventDefault(),f.current=!0,g.current=e.pageX,r.current&&(i.current=r.current.scrollWidth-r.current.clientWidth),r.current&&o(),document.addEventListener("mousemove",S),document.addEventListener("mouseup",_))},onTouchStart:e=>{u.current||(e.preventDefault(),f.current=!0,g.current=e.touches&&e.touches[0].pageX,r.current&&(i.current=r.current.scrollWidth-r.current.clientWidth),r.current&&o(),document.addEventListener("touchmove",S),document.addEventListener("touchend",_))},onClickCapture:e=>{m.current&&(e.preventDefault(),e.stopPropagation())},children:(0,tl.jsx)("div",{className:Xc["scrolling-carousel__item"],ref:r,style:{transform:`translateX(${-1*y}px)`},children:e.children})}),!p&&(0,tl.jsxs)(tl.Fragment,{children:[(0,tl.jsx)("div",{className:(0,nl.default)(Xc["scrolling-carousel__arrow-button"],Xc["scrolling-carousel__arrow-button--left"],{[Xc["scrolling-carousel__arrow-button--show"]]:a}),onClick:()=>Jc(void 0,void 0,void 0,(function*(){if(u.current)return;o();const e=n.current-h();w(e),u.current=!0,r.current&&(yield Un(r.current,"transform",300)),u.current=!1})),children:(0,tl.jsx)("svg",{focusable:"false",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,tl.jsx)("path",{d:"M15.41 7.41L14 6l-6 6 6 6 1.41-1.41L10.83 12z"})})}),(0,tl.jsx)("div",{className:(0,nl.default)(Xc["scrolling-carousel__arrow-button"],Xc["scrolling-carousel__arrow-button--right"],{[Xc["scrolling-carousel__arrow-button--show"]]:d}),onClick:()=>Jc(void 0,void 0,void 0,(function*(){if(u.current)return;o();const e=n.current+h();w(e),u.current=!0,r.current&&(yield Un(r.current,"transform",300)),u.current=!1})),children:(0,tl.jsx)("svg",{focusable:"false",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,tl.jsx)("path",{d:"M10 6L8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"})})})]})]})},tu=({children:e,style:t,color:r,font:i,className:n})=>(0,tl.jsx)("div",{className:n,style:Object.assign({color:r,font:i},t),children:e});var ru=f(9108),iu={insert:"head",singleton:!1};ol()(ru.A,iu);const nu=ru.A.locals||{},su=({goods:e,onClick:t,options:r})=>{var i;const{imgSrc:n,title:s,subTitle:o,price:a,oldPrice:l}=e;return(0,tl.jsxs)("div",{className:(0,nl.default)(nu["goods-card"]),style:{color:null!==(i=r.mainTextColor)&&void 0!==i?i:"black"},onClick:t,children:[(0,tl.jsx)("div",{className:(0,nl.default)(nu.figure),style:{borderRadius:r.imageCornerRadius+"px",backgroundColor:r.imageBackgroundColor},children:n&&(0,tl.jsx)("img",{src:n,alt:s,style:{borderRadius:r.imageCornerRadius+"px",backgroundColor:r.imageBackgroundColor}})}),(0,tl.jsx)(tu,{font:r.subtitleFont,children:o}),(0,tl.jsx)(tu,{font:r.titleFont,children:s}),(0,tl.jsxs)("div",{className:nu.prices,children:[(0,tl.jsx)(tu,{font:r.priceFont,children:a}),(0,tl.jsx)(tu,{className:nu["typography--old-price"],font:r.oldPriceFont,color:r.oldPriceTextColor,children:l})]})]})},ou=e=>{const t=e.goodsWidgetOptions,r=t.goodsWidgetRenderingType||t.goodsList.renderingType;let i=[];return r===ve.DEFAULT?i=e.goodsList.map(((r,i)=>(0,tl.jsx)(su,{options:t.goodsCard,goods:r,onClick:()=>e.onGoodsCardClick(r)},i))):r===ve.CUSTOM_CARD&&Dt()(t.getCardHtml)&&(i=e.goodsList.map(((r,i)=>{var n,s;return(0,tl.jsx)("div",{dangerouslySetInnerHTML:{__html:null!==(s=null===(n=t.getCardHtml)||void 0===n?void 0:n.call(t,r,i))&&void 0!==s?s:""},onClick:()=>e.onGoodsCardClick(r)},i)}))),(0,tl.jsx)(eu,{style:{marginTop:"-15px"},children:i})};var au=function(e,t){var r={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(r[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(i=Object.getOwnPropertySymbols(e);n<i.length;n++)t.indexOf(i[n])<0&&Object.prototype.propertyIsEnumerable.call(e,i[n])&&(r[i[n]]=e[i[n]])}return r};const lu=e=>{var{arrowColor:t}=e,r=au(e,["arrowColor"]);return(0,tl.jsx)("svg",Object.assign({},r,{width:"32",height:"12.5",viewBox:"0 0 64 25",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:(0,tl.jsx)("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})}))};var du=f(8161),cu={insert:"head",singleton:!1};ol()(du.A,cu);const uu=du.A.locals||{},hu=({closeImage:e,arrowColor:t,onClick:r})=>(0,tl.jsx)("div",{className:uu.btn,onClick:r,onTouchStart:r,children:e?(0,tl.jsx)("div",{dangerouslySetInnerHTML:{__html:e}}):(0,tl.jsx)(lu,{arrowColor:t})});var pu=f(1277),fu={insert:"head",singleton:!1};ol()(pu.A,fu);const gu=pu.A.locals||{},vu=({isLoading:e,backgroundColor:t="white",accentBackgroundColor:r="transparent"})=>e?(0,tl.jsx)("div",{className:gu.spinner,style:{border:`solid 2px ${t}`,borderColor:`${r} ${t} ${t} ${t}`}}):null;var mu=f(4940),yu={insert:"head",singleton:!1};ol()(mu.A,yu);const bu=mu.A.locals||{};var wu,Su=function(e,t,r,i){return new(r||(r=Promise))((function(n,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}l((i=i.apply(e,t||[])).next())}))};!function(e){e[e.IN=0]="IN",e[e.OUT=1]="OUT"}(wu||(wu={}));const _u=({open:e,url:t,goodsWidgetOptions:r,onClosed:i,onClose:n,onGoodsCardClick:s})=>{const o=(0,il.useRef)(null),[a,l]=(0,il.useState)([]),[d,c]=(0,il.useState)(wu.IN),u=r,{dimColor:h,substrateHeight:p,substrateColor:f,closeImage:g,closeBackgroundColor:v}=u.goodsList;(0,il.useEffect)((()=>{c(e?wu.IN:wu.OUT)}),[e]),(0,il.useEffect)((()=>{t&&m()}),[t]);const m=()=>Su(void 0,void 0,void 0,(function*(){const e=y(),t=yield r.openGoodsWidgetHandler(e);l(t)})),y=()=>{try{return JSON.parse(t).map((e=>({sku:e,title:"",subTitle:"",price:"",oldPrice:"",rawData:{}})))}catch(e){return console.error(e),[]}};(0,il.useEffect)((()=>{const e=o.current;if(d===wu.OUT)return e.addEventListener("animationend",i),()=>{e.removeEventListener("animationend",i)}}),[d]);const b=u.loader.custom?(0,tl.jsx)("div",{dangerouslySetInnerHTML:{__html:u.loader.custom}}):(0,tl.jsx)(vu,{isLoading:!a,backgroundColor:u.loader.default.color,accentBackgroundColor:u.loader.default.accentColor});return(0,tl.jsxs)("div",{className:(0,nl.default)(bu["goods-container"],{[bu["goods-container--visible"]]:d===wu.IN,[bu["goods-container--hidden"]]:d===wu.OUT}),ref:o,children:[(0,tl.jsx)("div",{className:(0,nl.default)(bu["goods-container__backdrop"]),style:{backgroundColor:h},onClick:n}),(0,tl.jsxs)("div",{className:(0,nl.default)(bu["goods-container"]),style:{height:p+"px",backgroundColor:null!=f?f:"white"},children:[b,a&&(0,tl.jsx)(ou,{goodsList:a,onGoodsCardClick:s,goodsWidgetOptions:r}),(0,tl.jsx)(hu,{onClick:n,closeImage:g,arrowColor:v})]})]})};var xu=f(2913),Ou={insert:"head",singleton:!1};ol()(xu.A,Ou);const Cu=xu.A.locals||{},ku=e=>{const[t,r]=(0,il.useState)(!1),[i,n]=(0,il.useState)(!1),s=()=>{n(!0),r(!0)},o=()=>{r(!1)};(0,il.useEffect)((()=>(e.widget.on(Ai.Open,s),()=>{e.widget.off(Ai.Open,s)})),[e.widget]),(0,il.useEffect)((()=>(ar.addListener("goodsWidget.close",o),()=>{ar.removeListener("goodsWidget.close",o)})),[]),(0,il.useEffect)((()=>{t&&ar.emit("publicEvents.widgetEvent",{name:"w-goods-open",devPayload:{story_id:e.story.id,slide_index:e.story.activeSlideIndex,widget_id:e.widget.elementId}})}),[t]);return i?(0,tl.jsx)("div",{className:Cu["goods-widget-viewer"],children:(0,tl.jsx)(_u,{open:t,url:e.widget.targetUrl,goodsWidgetOptions:e.goodsWidgetOptions,onClose:()=>{r(!1)},onClosed:()=>{e.widget.close(),n(!1)},onGoodsCardClick:t=>{var r,i;ar.emit("publicEvents.widgetEvent",{name:"w-goods-click",devPayload:{story_id:e.story.id,slide_index:e.story.activeSlideIndex,widget_id:e.widget.elementId,widget_value:t.sku}}),null===(i=(r=e.goodsWidgetOptions).itemClickHandler)||void 0===i||i.call(r,t)}})}):null},Lu={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 Au{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 Mu=e=>{switch(e){case"":default:return"text";case"tel":return"tel";case"email":return"email"}},Eu=e=>{const[t,r]=(0,il.useState)({countryCode:"",phone:""}),[i,n]=(0,il.useState)(""),[s,o]=(0,il.useState)(!0),a=r=>{var i;const n=Mu(null!==(i=null==e?void 0:e.configV2.main.input.type)&&void 0!==i?i:"");return"email"===n?Au.isEmailValid(r):"tel"!==n||Au.isTelephoneValid((()=>{var e;const r=t.countryCode.substring(1);return r&&null!==(e=Lu[r])&&void 0!==e?e:""})(),t.phone)};return{value:i,telephone:t,isValid:s,handleTelephoneChange:e=>{r(e),e.phone.length>0?n(e.countryCode+e.phone):n("")},handleChange:e=>{n(e.trim())},handleSubmit:e=>{const t=a(i);o(t),t&&e({value:i})},reset:()=>{o(!0),n(""),r({countryCode:"",phone:""})}}};var Pu=f(4169),ju={insert:"head",singleton:!1};ol()(Pu.A,ju);const Iu=Pu.A.locals||{},Tu=(0,il.forwardRef)(((e,t)=>{const r=(0,il.useRef)(null);return(0,il.useEffect)((()=>{var e;null===(e=r.current)||void 0===e||e.focus()}),[]),(0,tl.jsx)("input",{type:"email",className:(0,nl.default)(Iu.input,Iu.input_centered),placeholder:e.placeholder,value:e.value,ref:r,onChange:t=>e.onChange(t.target.value)})}));const Ru=(e=>{var t={};return f.d(t,e),t})({default:()=>c.default}),Du=(0,il.forwardRef)(((e,t)=>{const r=(0,il.useRef)(null),i=(0,il.useRef)(null),n=t=>{const r=t.target;r&&(r.value=r.value.replace(/\D/g,""),e.onChange({countryCode:e.value.countryCode,phone:r.value}))};(0,il.useEffect)((()=>{(()=>{let t=r.current;e.value.countryCode.length&&(t=i.current),null==t||t.focus()})()}),[]);const s=e.value.countryCode.substring(1),o=s?Lu[s]:"";return(0,tl.jsxs)("div",{className:Iu["input-group"],children:[(0,tl.jsxs)("div",{className:Iu["input-group__prepend"],children:[(0,tl.jsx)(Ru.default,{type:"tel",mask:"+999",maskChar:null,className:Iu.input,onChange:t=>{e.onChange({countryCode:t.currentTarget.value,phone:e.value.phone})},value:e.value.countryCode,placeholder:"+",inputRef:r}),(0,tl.jsx)("div",{className:Iu["input-group__separator"]})]}),o?(0,tl.jsx)(Ru.default,{type:"tel",className:Iu.input,mask:o,maskChar:"-",alwaysShowMask:!0,placeholder:e.placeholder,inputRef:i,value:e.value.phone,onChange:n}):(0,tl.jsx)("input",{type:"tel",className:Iu.input,placeholder:e.placeholder,ref:i,value:e.value.phone,onChange:n})]})})),Bu=(0,il.forwardRef)(((e,t)=>{const r=(0,il.useRef)(null),i=(0,il.useRef)(null);(0,il.useEffect)((()=>{var t;i.current.dataset.replicatedValue=e.value,null===(t=r.current)||void 0===t||t.focus()}),[]);return(0,tl.jsx)("div",{className:Iu["textarea-grow-wrap"],ref:i,style:e.style,children:(0,tl.jsx)("textarea",{className:Iu.input,placeholder:e.placeholder,rows:1,ref:r,maxLength:e.maxLength,value:e.value,onChange:t=>e.onChange(t.target.value),onInput:e=>{i.current.dataset.replicatedValue=e.currentTarget.value}})})}));var Nu=function(e,t){var r={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(r[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(i=Object.getOwnPropertySymbols(e);n<i.length;n++)t.indexOf(i[n])<0&&Object.prototype.propertyIsEnumerable.call(e,i[n])&&(r[i[n]]=e[i[n]])}return r};const Fu=e=>{var{form:t,config:r}=e,i=Nu(e,["form","config"]);const[n,s]=(0,il.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 r=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:`${r.background.color}`,border:`${r.border.visible&&`${t(r.border.width)}px solid ${r.border.color}`}`,borderRadius:`${t(r.border.radius)}px`}},getMainElementsStyle:()=>{const r=e.configV2.main;return{width:"100%",padding:`${t(r.padding.top)}px ${t(r.padding.right)}px ${t(r.padding.bottom)}px ${t(r.padding.left)}px`}},getQuestionStyle:()=>{const r=e.configV2.main.question;return{padding:`${t(r.padding.top)}px ${t(r.padding.right)}px ${t(r.padding.bottom)}px ${t(r.padding.left)}px`,color:`${r.text.color}`,fontSize:`${t(r.text.size)}px`,lineHeight:`${r.text.lineHeight}`,textAlign:`${r.text.align}`,fontFamily:`${r.text.type}`,fontWeight:`${r.text.weight}`,fontStyle:`${r.text.style}`}},getInputWrapperStyle:()=>{const r=e.configV2.main.input;let i=e.configV2.main.input.text.maxLines;return i=i>0?i:1,{padding:`${t(r.padding.top)}px ${t(r.padding.right)}px ${t(r.padding.bottom)}px ${t(r.padding.left)}px`,backgroundColor:`${r.background.color}`,border:`${t(r.border.width)}px solid ${r.border.color}`,borderRadius:`${t(r.border.radius)}px`,lineHeight:`${r.text.lineHeight}`,maxHeight:r.text.lineHeight*i+"em",fontSize:`${t(r.text.size)}px`,overflowY:"scroll",scrollbarWidth:"none"}},getButtonStyle:()=>{const r=e.configV2.main.button;return{padding:`${t(r.padding.top)}px ${t(r.padding.right)}px ${t(r.padding.bottom)}px ${t(r.padding.left)}px`,backgroundColor:`${r.background.color}`,border:`${t(r.border.width)}px solid ${r.border.color}`,color:`${r.text.color}`,fontSize:`${t(r.text.size)}px`,lineHeight:`${r.text.lineHeight}`,textAlign:`${r.text.align}`,fontFamily:`${r.text.type}`,fontWeight:`${r.text.weight}`,fontStyle:`${r.text.style}`}},getTextareaStyle:()=>{const r=e.configV2.main.input;return{color:`${r.text.color}`,fontSize:`${t(r.text.size)}px`,lineHeight:`${r.text.lineHeight}`,textAlign:`${r.text.align}`,fontFamily:`${r.text.type}`,fontWeight:`${r.text.weight}`,fontStyle:`${r.text.style}`}}}})({config:r}),h=Math.max(r.configV2.main.input.text.limit,0),p=String(r.configV2.main.input.text.placeholder).trim(),f=String(r.configV2.main.button.text.value).trim(),g=String(r.configV2.main.question.text.value).trim(),v=Mu(r.configV2.main.input.type),m=({value:e})=>{i.onComplete({result:!0,value:e}),s(!1)};return(0,tl.jsxs)("div",{className:Iu.wrapper,children:[(0,tl.jsx)("div",{className:(0,nl.default)(Iu.backdrop,{[Iu.fadeIn]:n,[Iu.fadeOut]:!n}),onAnimationEnd:()=>{n||i.onClose()},onClick:()=>{i.onComplete({result:!1,value:t.value}),s(!1)}}),(0,tl.jsxs)("div",{className:Iu.main,style:o(),children:[(0,tl.jsxs)("div",{className:Iu["main-elements"],style:a(),children:[(0,tl.jsx)("div",{className:Iu.question,style:l(),children:g}),(0,tl.jsxs)("div",{className:(0,nl.default)(Iu["input-wrapper"],{[Iu["is-invalid"]]:!t.isValid}),style:d(),children:["text"===v&&(0,tl.jsx)(Bu,{value:t.value,onChange:t.handleChange,style:u(),placeholder:p,maxLength:h}),"email"===v&&(0,tl.jsx)(Tu,{value:t.value,onChange:t.handleChange,placeholder:p}),"tel"===v&&(0,tl.jsx)(Du,{value:t.telephone,onChange:t.handleTelephoneChange,placeholder:p})]})]}),t.value.trim().length>0&&(0,tl.jsx)("div",{className:Iu["button-wrapper"],children:(0,tl.jsx)("button",{className:Iu.button,style:c(),onClick:()=>t.handleSubmit(m),children:f})})]})]})},Uu=({storyGeometry:e,activeSlide:t,storyRef:r})=>{const[i,n]=(0,il.useState)(null),[s,o]=(0,il.useState)(null),a=Eu(s);(0,il.useEffect)((()=>(ar.on(ro.ShowInputModal,l),()=>{ar.off(ro.ShowInputModal,l)})),[]);const l=({id:t,config:i})=>{Or(),mr(),n(t),(t=>{t.size.fontSize=parseFloat(e.getFontSize()),t.size.viewportWidth=e.calculateWidth();const i=r.current.getBoundingClientRect();t.size.slideOffsetX=i.x,t.size.slideOffsetY=i.y,t.size.slideHeight=i.height,o(t)})(i)};return(0,il.useLayoutEffect)((()=>()=>{a.reset()}),[i]),s?(0,tl.jsx)(Fu,{form:a,config:s,onComplete:e=>{if(!i)throw new Error;((e,r)=>{t.setUserData(e,r)})(i,e.result?e.value:""),Cr()},onClose:()=>{o(null),vr()}}):null};var Vu=function(e,t){var r={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(r[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(i=Object.getOwnPropertySymbols(e);n<i.length;n++)t.indexOf(i[n])<0&&Object.prototype.propertyIsEnumerable.call(e,i[n])&&(r[i[n]]=e[i[n]])}return r};const zu=(0,Yl.observer)((e=>{var t,{story:r,geometry:i,className:n}=e,s=Vu(e,["story","geometry","className"]);const o=(0,il.useRef)(null),a=(0,il.useRef)(null);(({story:e,progressBarRef:t,nextFlippingStoryIndex:r,activeStory:i})=>{const n=e.timer,s=ec(cr),o=e===i&&-1===r;(0,il.useEffect)((()=>{const r=e=>{var r;null===(r=t.current)||void 0===r||r.style.setProperty("--tick",e+"%")},i=({forceEnd:t})=>{t||(e.reachEnd?ar.emit(`${Ao.name}.showNextStory`,{action:"auto"}):e.nextSlide())},s=()=>{var e;null===(e=t.current)||void 0===e||e.style.setProperty("--tick","0%")},o=()=>{var e;null===(e=t.current)||void 0===e||e.style.setProperty("--tick","0%")};return n.on("start",s),n.on("stop",o),n.on("progress",r),n.on("complete",i),()=>{n.off("start",s),n.off("progress",r),n.off("complete",i),n.off("stop",o)}}),[e]),(0,il.useEffect)((()=>{s?n.pause():n.resume()}),[s]),(0,il.useEffect)((()=>{o||n.stop()}),[o])})({activeStory:s.activeStory,story:r,nextFlippingStoryIndex:s.nextFlippingStoryIndex,progressBarRef:a});const l=s.index===s.nextFlippingStoryIndex,d=(0,il.useMemo)((()=>{var e;return null===(e=r.activeSlide)||void 0===e?void 0:e.findWidgetByType(Ei.name)}),[null===(t=r.activeSlide)||void 0===t?void 0:t.state]),c=()=>{ar.emit(wo.ReloadStory,r)};return(0,tl.jsxs)("div",{ref:o,className:(0,nl.default)(bc["stories-item"],bc.slider3d__item,n),onMouseDown:()=>{Wi({result:!1})},onTouchStart:()=>{Wi({result:!1})},"data-testid":"story",style:s.style,children:[(0,tl.jsx)(Lc,{closeDisabled:r.disableClose,options:s.storyReaderOptions,onClose:s.onClose}),r.activeSlide&&(0,tl.jsx)(Kc,{ref:a,hiddenTimeline:r.hiddenTimeline,slidesLength:r.slidesCount,timeline:r.activeSlide.timeline,activeSlideIndex:r.activeSlideIndex}),r.displayedSlides.map(((e,t)=>(0,tl.jsx)($c,{clickDisabled:s.slideClickDisabled,onReloadStory:c,activeSlideIndex:r.activeSlideIndex,currentSlideIndex:t,needSlideInitByFlipping:l,networkError:Boolean(r.error),currentStory:r,activeStory:s.activeStory,geometry:i,slide:e,slidesLoaded:r.slidesLoaded},e.html))),(0,tl.jsx)(xc,{story:r,commonOptions:s.commonOptions,storyReaderOptions:s.storyReaderOptions}),d&&s.activeStory===r&&(0,tl.jsx)(ku,{widget:d,story:r,goodsWidgetOptions:s.goodsWidgetOptions}),s.activeStory===r&&r.activeSlide&&(0,tl.jsx)(Uu,{storyRef:o,storyGeometry:i,activeSlide:r.activeSlide})]})})),Gu=({className:e,style:t})=>(0,tl.jsx)("div",{className:(0,nl.default)(bc["stories-item"],e),style:t,children:(0,tl.jsx)("div",{className:`${Ec["stories-slide"]} ${Ec._dummy}`})});var Wu=f(9669),$u={insert:"head",singleton:!1};ol()(Wu.A,$u);const Hu=Wu.A.locals||{};var qu=function(e,t){var r={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(r[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(i=Object.getOwnPropertySymbols(e);n<i.length;n++)t.indexOf(i[n])<0&&Object.prototype.propertyIsEnumerable.call(e,i[n])&&(r[i[n]]=e[i[n]])}return r};const Qu=e=>{var{width:t,navigationOptions:r}=e,i=qu(e,["width","navigationOptions"]);const{desktopMode:n,dir:s}=kh(),[o,a]=ec([dr,Rr]),l=o||a,d="ltr"===s,c=(d?i.isNextStoryBlank:i.isPrevStoryBlank)||l,u=(d?i.isPrevStoryBlank:i.isNextStoryBlank)||l;return(0,tl.jsxs)("div",{className:(0,nl.default)([Hu["story-reader-controls"]],{[Hu._desktop_mode]:n}),children:[(0,tl.jsx)("div",{className:Hu.slider3d__btn_next,style:{transform:`translateY(-50%) translateX(calc(${t/2}px + 100%))`},children:(0,tl.jsx)("button",{className:Hu["btn-icon"],onClick:e=>{e.stopPropagation(),e.preventDefault(),i.disabled||(d?i.onNext():i.onPrev())},disabled:c,dangerouslySetInnerHTML:{__html:r.nextButton.svgSrc.baseState}})}),(0,tl.jsx)("div",{className:Hu.slider3d__btn_prev,style:{transform:`translateY(-50%) translateX(calc(-${t/2}px - 200%))`},children:(0,tl.jsx)("button",{className:Hu["btn-icon"],onClick:e=>{e.stopPropagation(),e.preventDefault(),i.disabled||(d?i.onPrev():i.onNext())},disabled:u,dangerouslySetInnerHTML:{__html:r.prevButton.svgSrc.baseState}})})]})},Ku=45,Yu=350,Zu="linear",Xu=1.6,Ju=2*Math.tan(Ku*Math.PI/360),eh=Yu/1e3;class th{constructor(e){Object.defineProperty(this,"slider",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"newAngle",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"angleDelta",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"normalizedShift",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"movementStartAt",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"_currentAngle",{enumerable:!0,configurable:!0,writable:!0,value:0})}get currentAngle(){return this._currentAngle}get perspective(){return 0}get depth(){return 0}startMove(){this.newAngle=0,this.angleDelta=0,this.normalizedShift=0,this.movementStartAt=Date.now()}move(e){this.normalizedShift=e/this.slider.clientWidth*Xu,this.newAngle=this._currentAngle+this.normalizedShift*Ku,this.angleDelta=this.newAngle-this._currentAngle}endMove(){if(!this.normalizedShift)return;let e=Math.round(this.angleDelta/Ku);e=this.limitByFastMovement(e),e=this.limitBySliderEdges(e),this.slider.emit("touchEnd",e)}limitByFastMovement(e){return this.isFastMovement(e)?this.normalizedShift<0?-1:1:e}isFastMovement(e){return Date.now()-this.movementStartAt<=500&&0===e}limitBySliderEdges(e){return e<0&&this.slider.isBeginning||e>0&&this.slider.isEnd?0:e}}const rh=.05;class ih extends th{init(){this._currentAngle=this.slider.currentIndex*Ku}transform(e){const t=this.slider.leftElement,r=this.slider.rightElement,i=this.slider.frontElement;null==t||t.style.setProperty("transform",`translateZ(0) translateX(${-100*(.1- -1*e/10)}%) scale(${Math.min(.9+-1*e/10,1)})`),null==r||r.style.setProperty("transform",`translateZ(0) translateX(${100*(1-e)}%)`),null==i||i.style.setProperty("transform",`translateZ(0) translateX(${e<=0?-100*e:-100*(0- -1*e/10)}%) scale(${e<=0?1:1+-1*e/10})`)}move(e){super.move(e),this.normalizedShift=this.applyBoundsConstraint(this.normalizedShift),this.transform(this.normalizedShift)}getCSSStyle(e,t){return{display:Math.abs(e-t)<=1?"block":"none",transition:"inherit",transform:`translateZ(0) translateX(${0===e?-10:-100*t+100*e}%) scale(${0===e?.9:1})`}}applyBoundsConstraint(e){return this.slider.isBeginning||this.slider.isEnd?e>=rh&&this.slider.isEnd?rh:e<=-.05&&this.slider.isBeginning?-.05:e:e}}const nh=.05;class sh extends th{init(){this._currentAngle=this.slider.currentIndex*Ku}transform(e){const t=this.slider.leftElement,r=this.slider.rightElement,i=this.slider.frontElement;null==t||t.style.setProperty("transform",`translateZ(0) translateX(${-100*(1+e)}%)`),null==r||r.style.setProperty("transform",`translateZ(0) translateX(${100*(1-e)}%)`),null==i||i.style.setProperty("transform",`translateZ(0) translateX(${-100*e}%)`)}move(e){super.move(e),this.normalizedShift=this.applyBoundsConstraint(this.normalizedShift),this.transform(this.normalizedShift)}getCSSStyle(e,t){return{display:Math.abs(e-t)<=1?"block":"none",transition:"inherit",transform:`translateZ(0) translateX(${-100*t+100*e}%)`}}applyBoundsConstraint(e){return this.slider.isBeginning||this.slider.isEnd?e>=nh&&this.slider.isEnd?nh:e<=-.05&&this.slider.isBeginning?-.05:e:e}}var oh=function(e,t,r,i){return new(r||(r=Promise))((function(n,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}l((i=i.apply(e,t||[])).next())}))};class ah extends th{get perspective(){return this.slider.clientWidth*Xu}get depth(){return this.slider.clientWidth/Ju}init(){this.transform(this.slider.currentIndex)}transform(e){return oh(this,void 0,void 0,(function*(){this._currentAngle=this._currentAngle+e*Ku,this.slider.setTransform(`rotateY(${-this._currentAngle}deg)`)}))}move(e){super.move(e),this.newAngle=this.applyBoundsConstraint(this.angleDelta),this.slider.setTransform(`rotateY(${-this.newAngle}deg)`)}getCSSStyle(e,t){return{display:Math.abs(e-t)<=1?"block":"none",transition:"",transform:"rotateY("+e*Ku+`deg) translateZ(${this.depth}px)`}}applyBoundsConstraint(e){return this.slider.isBeginning||this.slider.isEnd?e>=5&&this.slider.isEnd?this._currentAngle+5:e<=-5&&this.slider.isBeginning?this._currentAngle-5:this.newAngle:this.newAngle}}class lh{static create(e,t){switch(t){case he.FLAT:return new sh(e);case he.COVER:return new ih(e);case he.CUBE:return new ah(e);default:return new sh(e)}}}var dh=function(e,t,r){for(var i=arguments.length>2,n=0;n<t.length;n++)r=i?t[n].call(e,r):t[n].call(e);return i?r:void 0},ch=function(e,t,r,i,n,s){function o(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var a,l=i.kind,d="getter"===l?"get":"setter"===l?"set":"value",c=!t&&e?i.static?e:e.prototype:null,u=t||(c?Object.getOwnPropertyDescriptor(c,i.name):{}),h=!1,p=r.length-1;p>=0;p--){var f={};for(var g in i)f[g]="access"===g?{}:i[g];for(var g in i.access)f.access[g]=i.access[g];f.addInitializer=function(e){if(h)throw new TypeError("Cannot add initializers after decoration has completed");s.push(o(e||null))};var v=(0,r[p])("accessor"===l?{get:u.get,set:u.set}:u[d],f);if("accessor"===l){if(void 0===v)continue;if(null===v||"object"!=typeof v)throw new TypeError("Object expected");(a=o(v.get))&&(u.get=a),(a=o(v.set))&&(u.set=a),(a=o(v.init))&&n.unshift(a)}else(a=o(v))&&("field"===l?n.unshift(a):u[d]=a)}c&&Object.defineProperty(c,i.name,u),h=!0},uh=function(e,t,r,i){return new(r||(r=Promise))((function(n,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}l((i=i.apply(e,t||[])).next())}))},hh=function(e,t,r,i){if("a"===r&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?i:"a"===r?i.call(e):i?i.value:t.get(e)},ph=function(e,t,r,i,n){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!n)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?n.call(e,r):n?n.value=r:t.set(e,r),r};let fh=(()=>{var e,t,r,i;let n,s,o,a,l,d,c,u,h,p,f,g,v,m,y,b,w,S=J.EventEmitter,_=[],x=[],O=[],C=[],k=[],L=[],A=[];return e=class extends S{constructor(){super(...arguments),t.set(this,(dh(this,_),dh(this,x,!1))),r.set(this,(dh(this,O),dh(this,C,0))),i.set(this,(dh(this,k),dh(this,L,null))),Object.defineProperty(this,"$el",{enumerable:!0,configurable:!0,writable:!0,value:dh(this,A)})}get _animating(){return hh(this,t,"f")}set _animating(e){ph(this,t,e,"f")}get _currentIndex(){return hh(this,r,"f")}set _currentIndex(e){ph(this,r,e,"f")}get effect(){return hh(this,i,"f")}set effect(e){ph(this,i,e,"f")}get clientWidth(){return this.$el.clientWidth}get animating(){return this._animating}get leftElement(){return this.$el.children.item(this._currentIndex-1)}get rightElement(){return this.$el.children.item(this._currentIndex+1)}get frontElement(){return this.$el.children.item(this._currentIndex)}get isBeginning(){return this._currentIndex-1==0}get isEnd(){return this._currentIndex+1===this.$el.children.length-1}get perspective(){var e,t;return null!==(t=null===(e=this.effect)||void 0===e?void 0:e.perspective)&&void 0!==t?t:0}get depth(){var e,t;return null!==(t=null===(e=this.effect)||void 0===e?void 0:e.depth)&&void 0!==t?t:0}get currentIndex(){return this._currentIndex}set currentIndex(e){this._currentIndex=e}getCSSStyle(e,t){var r,i;return null!==(i=null===(r=this.effect)||void 0===r?void 0:r.getCSSStyle(e,t))&&void 0!==i?i:{}}init({$el:e,transformStyle:t}){this.$el=e,this.effect=lh.create(this,t),this.effect.init(),this.setTransition("transform 0s"),this.updateSlidesStyle(0)}transformWithAmimation(e){return uh(this,void 0,void 0,(function*(){this.emit("transitionStart"),this._animating=!0,this.setTransition(`transform ${eh}s ${Zu}`),this.effect.transform(e),yield this.waitTransitionEnd(),this.updateSlidesStyle(e),this._animating=!1,this.emit("transitionEnd")}))}startMove(){this.effect.startMove()}move(e){this._animating=!0,this.emit("touchMove"),this.effect.move(e)}endMove(){this._animating=!1,this.effect.endMove()}setTransform(e){this.$el.style.setProperty("transform",e)}updateSlidesStyle(e){const t=Array.from(this.$el.children);for(let r=0;r<t.length;r++){const i=t[r],n=this.effect.getCSSStyle(r,this.currentIndex+e);i.style.display=n.display,i.style.transform=n.transform,i.style.transition=n.transition}}setTransition(e){this.$el.style.setProperty("transition",e)}waitTransitionEnd(){return new Promise((e=>{const t=r=>{Math.round(100*r.elapsedTime)/100===eh&&"transform"===r.propertyName&&(this.setTransition("transform 0s"),this.$el.removeEventListener("transitionend",t),e())};this.$el.addEventListener("transitionend",t)}))}},t=new WeakMap,r=new WeakMap,i=new WeakMap,(()=>{var t;const r="function"==typeof Symbol&&Symbol.metadata?Object.create(null!==(t=S[Symbol.metadata])&&void 0!==t?t:null):void 0;n=[to.observable],s=[to.observable],o=[to.observable],a=[to.computed],l=[to.computed],d=[to.computed],c=[to.computed],u=[to.computed],h=[to.computed],p=[to.computed],f=[to.computed],g=[to.computed],v=[to.action],m=[to.action],y=[to.action],b=[to.action],w=[to.action],ch(e,null,n,{kind:"accessor",name:"_animating",static:!1,private:!1,access:{has:e=>"_animating"in e,get:e=>e._animating,set:(e,t)=>{e._animating=t}},metadata:r},x,O),ch(e,null,s,{kind:"accessor",name:"_currentIndex",static:!1,private:!1,access:{has:e=>"_currentIndex"in e,get:e=>e._currentIndex,set:(e,t)=>{e._currentIndex=t}},metadata:r},C,k),ch(e,null,o,{kind:"accessor",name:"effect",static:!1,private:!1,access:{has:e=>"effect"in e,get:e=>e.effect,set:(e,t)=>{e.effect=t}},metadata:r},L,A),ch(e,null,a,{kind:"getter",name:"animating",static:!1,private:!1,access:{has:e=>"animating"in e,get:e=>e.animating},metadata:r},null,_),ch(e,null,l,{kind:"getter",name:"leftElement",static:!1,private:!1,access:{has:e=>"leftElement"in e,get:e=>e.leftElement},metadata:r},null,_),ch(e,null,d,{kind:"getter",name:"rightElement",static:!1,private:!1,access:{has:e=>"rightElement"in e,get:e=>e.rightElement},metadata:r},null,_),ch(e,null,c,{kind:"getter",name:"frontElement",static:!1,private:!1,access:{has:e=>"frontElement"in e,get:e=>e.frontElement},metadata:r},null,_),ch(e,null,u,{kind:"getter",name:"isBeginning",static:!1,private:!1,access:{has:e=>"isBeginning"in e,get:e=>e.isBeginning},metadata:r},null,_),ch(e,null,h,{kind:"getter",name:"isEnd",static:!1,private:!1,access:{has:e=>"isEnd"in e,get:e=>e.isEnd},metadata:r},null,_),ch(e,null,p,{kind:"getter",name:"perspective",static:!1,private:!1,access:{has:e=>"perspective"in e,get:e=>e.perspective},metadata:r},null,_),ch(e,null,f,{kind:"getter",name:"depth",static:!1,private:!1,access:{has:e=>"depth"in e,get:e=>e.depth},metadata:r},null,_),ch(e,null,g,{kind:"getter",name:"currentIndex",static:!1,private:!1,access:{has:e=>"currentIndex"in e,get:e=>e.currentIndex},metadata:r},null,_),ch(e,null,v,{kind:"setter",name:"currentIndex",static:!1,private:!1,access:{has:e=>"currentIndex"in e,set:(e,t)=>{e.currentIndex=t}},metadata:r},null,_),ch(e,null,m,{kind:"method",name:"init",static:!1,private:!1,access:{has:e=>"init"in e,get:e=>e.init},metadata:r},null,_),ch(e,null,y,{kind:"method",name:"transformWithAmimation",static:!1,private:!1,access:{has:e=>"transformWithAmimation"in e,get:e=>e.transformWithAmimation},metadata:r},null,_),ch(e,null,b,{kind:"method",name:"move",static:!1,private:!1,access:{has:e=>"move"in e,get:e=>e.move},metadata:r},null,_),ch(e,null,w,{kind:"method",name:"endMove",static:!1,private:!1,access:{has:e=>"endMove"in e,get:e=>e.endMove},metadata:r},null,_),r&&Object.defineProperty(e,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:r})})(),e})();const gh=e=>{const{storyReaderOptions:t}=kh(),r=(0,il.useRef)(null),i=(0,il.useRef)(new fh).current;(({storiesSlider:e})=>{const t=()=>{null==e||e.startMove()},r=({startX:t,x:r,lockX:i})=>{if(i)return;const n=t-r;null==e||e.move(n)},i=({lockX:t})=>{t||null==e||e.endMove()};(0,il.useEffect)((()=>(ar.on("swipeController.startMove",t),ar.on("swipeController.move",r),ar.on("swipeController.endMove",i),()=>{ar.off("swipeController.startMove",t),ar.off("swipeController.move",r),ar.off("swipeController.endMove",i)})),[])})({storiesSlider:i});const n=t.scrollStyle,s=e.stories;i.currentIndex=e.currentIndex,(0,il.useLayoutEffect)((()=>{const e=()=>{i.init({$el:r.current,transformStyle:n})};return e(),window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}}),[s.length,n]),(0,il.useEffect)((()=>(i.on("transitionStart",a),i.on("transitionEnd",l),i.on("touchMove",o),()=>{i.off("transitionStart",a),i.off("transitionEnd",l),i.off("touchMove",o)})),[]);const o=()=>{mr()},a=()=>{mr()},l=()=>{vr()};return{ref:r,api:i,perspective:i.perspective,depth:i.depth}};var vh=function(e,t,r,i){return new(r||(r=Promise))((function(n,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}l((i=i.apply(e,t||[])).next())}))};const mh=(e,t)=>{const{storyReaderOptions:r}=kh(),[i,n]=(0,il.useState)(-1);(0,il.useEffect)((()=>(ar.on(`${Ao.name}.showNextStory`,l),ar.on(`${Ao.name}.showPrevStory`,d),()=>{ar.off(`${Ao.name}.showNextStory`,l),ar.off(`${Ao.name}.showPrevStory`,d)})),[]),(0,il.useEffect)((()=>(t.on("touchEnd",s),()=>{t.off("touchEnd",s)})),[t]);const s=r=>vh(void 0,void 0,void 0,(function*(){Sr(),0===r?yield t.transformWithAmimation(0):a(e.currentIndex+r,"swipe")})),o=t=>{ar.emit("publicEvents.closeStory",{id:e.activeStory.id,index:e.activeStory.activeSlideIndex,action:t})},a=(t,r="lastSlideClick")=>{n(t),e.setSlideApiActiveStory(e.getDisplayedStoryByIndex(t)),c(t,r)},l=t=>{const i=null==t?void 0:t.action;e.reachEnd?(t=>{"auto"!==t?(o("closeStoryByScrolling"),e.close("lastSlideClick")):r.closeOnLastSlideByTimer&&(o("closeStoryByScrolling"),e.close("auto"))})(i):a(e.currentIndex+1,i)},d=t=>{e.reachStart||a(e.currentIndex-1,null==t?void 0:t.action)},c=(r,i)=>vh(void 0,void 0,void 0,(function*(){if(-1===r)return;const s=e.currentIndex<r?1:-1;yield t.transformWithAmimation(s),((t,r)=>{o(r),1==(e.currentIndex<t?1:-1)?e.nextStory():e.prevStory(),n(-1)})(r,i)}));return{nextFlippingStoryIndex:i,nextStory:l,prevStory:d,navigateStory:a}},yh=(0,Yl.observer)((e=>{const{storyReaderOptions:t,commonOptions:r,goodsWidgetOptions:i}=kh(),[n,s]=ec([dr,ur]),{isOpened:o,sharePanelOpeningParams:a,handleShareComplete:l}=(()=>{const{isOpened:e,id:t,type:r,link:i,text:n}=ec(Tr);return{isOpened:e,sharePanelOpeningParams:{shareId:t,shareType:r,shareLink:i,shareText:n},handleShareComplete:e=>{Lr(),ar.emit(`${Li.name}.shareComplete`,{shareId:t,result:e}),Br()},closeSharePanel:()=>{Lr(),Br()}}})(),d=gh(e.storyReaderViewModel),c=mh(e.storyReaderViewModel,d.api),{actionPanelHeight:u,safeAreaFrameCalculator:h,isMobileGeometry:p,storyGeometry:f,correctionPaddingStyle:g}=hc(e.viewport),v=e.storyReaderViewModel.activeStory;return(0,tl.jsxs)(tl.Fragment,{children:[(0,tl.jsxs)("div",{className:(0,nl.default)(vc.slider3d__wrapper,{[vc["slider3d__wrapper_swipe-up"]]:s,[vc._desktop_mode]:!p}),style:Object.assign({WebkitPerspective:`${d.perspective}px`,perspective:`${d.perspective}px`,width:f.getWidth(),backgroundColor:p&&h.shouldBeShownSafeAreaInsets&&"#000"},g),children:[(0,tl.jsx)("div",{className:vc.slider3d__inner,style:{transform:`translateZ(-${d.depth}px)`},children:(0,tl.jsx)("div",{className:(0,nl.default)(vc["stories-face"],vc.slider3d__rotater),ref:d.ref,children:e.storyReaderViewModel.stories.map(((s,o)=>s.isBlank?(0,tl.jsx)(Gu,{style:{bottom:0}},s.id):(0,tl.jsx)(zu,{slideClickDisabled:n||d.api.animating,index:o,story:s,activeStory:v,nextFlippingStoryIndex:c.nextFlippingStoryIndex,geometry:f,style:{bottom:uc(s,r)?`${u}px`:0},commonOptions:r,storyReaderOptions:t,goodsWidgetOptions:i,onClose:e.onCloseStory},s.id)))})}),o&&(0,tl.jsx)(Ul,{className:vc["share-panel-wrapper"],shareText:a.shareText,shareType:a.shareType,shareLink:a.shareLink,onShareCompelete:l,sharePanelOptions:t.sharePanel})]}),(0,tl.jsx)(Qu,{disabled:d.api.animating,isNextStoryBlank:e.storyReaderViewModel.reachEnd,isPrevStoryBlank:e.storyReaderViewModel.reachStart,navigationOptions:t.navigation,width:f.calculateWidth(),onNext:c.nextStory,onPrev:c.prevStory})]})})),bh=(0,Yl.observer)((({storyReaderViewModel:e,desktopMode:t})=>{const r=(()=>{const[e,t]=(0,il.useState)((()=>id())),r=(0,il.useCallback)((()=>{t(id())}),[]);return(0,il.useEffect)((()=>(window.addEventListener("resize",r),()=>{window.removeEventListener("resize",r)})),[]),e})();(()=>{const e=()=>{"hidden"===document.visibilityState&&wr(),"visible"===document.visibilityState&&Sr()};(0,il.useEffect)((()=>(document.addEventListener("visibilitychange",e),()=>{document.removeEventListener("visibilitychange",e)})),[])})(),(()=>{const{desktopMode:e}=kh(),[t,r]=ec([Rr,hr]),i=(0,il.useRef)();(0,il.useEffect)((()=>(i.current=new dc,()=>{var e;null===(e=i.current)||void 0===e||e.destroy()})),[]),(0,il.useEffect)((()=>{const n=i.current;n&&(e||t||!r?n.disable():n.enable())}),[e,t,r])})(),Eh((()=>{e.close("closeReaderByEscBtn")}));return(0,Zl.createPortal)((0,tl.jsxs)(pc,{viewport:r,storyReaderViewModel:e,children:[(0,tl.jsx)(yh,{viewport:r,storyReaderViewModel:e,onCloseStory:()=>{e.close()}}),(0,tl.jsx)(xl,{orientation:Fa.PORTRAIT_PRIMARY,desktopMode:t,onOrientationChange:({isWrong:e})=>{e?Or():Cr()}})]}),document.body)}));var wh=f(7314),Sh={insert:"head",singleton:!1};ol()(wh.A,Sh);wh.A.locals;const _h=({storyManager:e,desktopMode:t})=>{const[r,i]=(0,il.useState)(null),n=(()=>{const e=(0,il.useRef)();return e.current||(e.current=(()=>{const e=getComputedStyle(document.documentElement),t=t=>parseFloat(e.getPropertyValue(t)),r=t("--ias-sat"),i=t("--ias-sab");return{left:t("--ias-sal"),right:t("--ias-sar"),top:r,bottom:i}})()),e.current})();return(0,il.useEffect)((()=>{const t=e.createGameReader();return t.setSafeAreaInsets(n),i(t),()=>{t.destroy()}}),[e]),(0,il.useEffect)((()=>{null==r||r.setDesktopMode(t)}),[r,t]),r},xh=il.default.createContext({dir:"ltr",storyManager:ka,desktopMode:!1,commonOptions:te,storyReaderOptions:pe,gameReaderOptions:we,goodsWidgetOptions:be});let Oh=!1;const Ch=(0,Yl.observer)((e=>{Ph(e.config),jh(e);const{commonOptions:t,gameReaderOptions:r,storyReaderOptions:i,goodsWidgetOptions:n}=Ih(e),s=Mh(),o=(({storyManager:e})=>{const[t,r]=(0,il.useState)(null);return(0,il.useEffect)((()=>{const t=e.createStoryReader();return r(t),()=>{t.destroy()}}),[e]),t})({storyManager:ka}),a=_h({storyManager:ka,desktopMode:s});(0,il.useEffect)((()=>{if(Oh)throw new Error("There can only be one instance of <IASContainer /> per application");return Oh=!0,()=>{Oh=!1}}),[]);const l=(0,il.useMemo)((()=>getComputedStyle(document.documentElement).direction),[]),d=(0,il.useMemo)((()=>({storyManager:ka,desktopMode:s,dir:l,commonOptions:t,gameReaderOptions:r,storyReaderOptions:i,goodsWidgetOptions:n})),[ka,s,l,t,r,i,n]);return(0,tl.jsxs)(xh.Provider,{value:d,children:[(null==a?void 0:a.isOpened)&&(0,tl.jsx)(Xl,{gameReaderViewModel:a}),(null==o?void 0:o.activeStory)&&(0,tl.jsx)(bh,{storyReaderViewModel:o,desktopMode:s}),e.children]})})),kh=()=>(0,il.useContext)(xh);var Lh=f(3643);const Ah=f.n(Lh)().getParser(window.navigator.userAgent).parse(),Mh=()=>{const[e,t]=(0,il.useState)(!1);(0,il.useLayoutEffect)((()=>(r(),window.addEventListener("resize",r),()=>{window.removeEventListener("resize",r)})),[]);const r=()=>{"mobile"===Ah.parsedResult.platform.type?t(!1):t(!0)};return e},Eh=e=>{const t=t=>{t.keyCode===kn.esc&&e()};(0,il.useEffect)((()=>(window.addEventListener("keydown",t),()=>{window.removeEventListener("keydown",t)})),[])},Ph=e=>{(0,il.useEffect)((()=>{e.lang&&ka.setLang(e.lang)}),[e.lang]),(0,il.useEffect)((()=>{ka.setApiKey(e.apiKey)}),[e.apiKey]),(0,il.useEffect)((()=>{e.userId&&ka.setUserId(e.userId,e.userIdSign)}),[e.userId,e.userIdSign]),(0,il.useEffect)((()=>{e.tags&&ka.setTags(e.tags)}),[JSON.stringify(e.tags)]),(0,il.useEffect)((()=>{e.placeholders&&ka.setPlaceholders(e.placeholders)}),[JSON.stringify(e.placeholders)]),(0,il.useEffect)((()=>{e.imagePlaceholders&&ka.setImagePlaceholders(e.imagePlaceholders)}),[JSON.stringify(e.imagePlaceholders)]),(0,il.useEffect)((()=>{ka.setConfig(e)}),[])},jh=({onClickOnStory:e,onShowStory:t,onCloseStory:r,onShowSlide:i,onClickOnButton:n,onLikeStory:s,onDislikeStory:o,onFavoriteStory:a,onShareStory:l,onShareStoryWithPath:d,onFeedImpression:c,onVisibleAreaUpdated:u,onWidgetEvent:h})=>{(0,il.useEffect)((()=>(e&&ka.on("clickOnStory",e),t&&ka.on("showStory",t),r&&ka.on("closeStory",r),i&&ka.on("showSlide",i),n&&ka.on("clickOnButton",n),s&&ka.on("likeStory",s),o&&ka.on("dislikeStory",o),a&&ka.on("favoriteStory",a),l&&ka.on("shareStory",l),d&&ka.on("shareStoryWithPath",d),c&&ka.on("feedImpression",c),u&&ka.on("visibleAreaUpdated",u),h&&ka.on("widgetEvent",h),()=>{e&&ka.off("clickOnStory",e),t&&ka.off("showStory",t),r&&ka.off("closeStory",r),i&&ka.off("showSlide",i),n&&ka.off("clickOnButton",n),s&&ka.off("likeStory",s),o&&ka.off("dislikeStory",o),a&&ka.off("favoriteStory",a),l&&ka.off("shareStory",l),d&&ka.off("shareStoryWithPath",d),c&&ka.off("feedImpression",c),u&&ka.off("visibleAreaUpdated",u),h&&ka.off("widgetEvent",h)})),[e,t,r,i,n,s,o,a,l,d,c,u,h])},Ih=({commonOptions:e,gameReaderOptions:t,storyReaderOptions:r,goodsWidgetOptions:i})=>{const n=(0,il.useRef)(new Se).current,s=(0,il.useMemo)((()=>(e&&n.setCommonOptions(e),n.commonOptions)),[JSON.stringify(e)]),o=(0,il.useMemo)((()=>(t&&n.setGameReaderOptions(t),n.gameReaderOptions)),[JSON.stringify(t)]),a=(0,il.useMemo)((()=>(i&&n.setGoodsWidgetOptions(i),n.goodsWidgetOptions)),[JSON.stringify(i),null==i?void 0:i.itemClickHandler,null==i?void 0:i.openGoodsWidgetHandler]);return{commonOptions:s,gameReaderOptions:o,storyReaderOptions:(0,il.useMemo)((()=>(r&&n.setStoryReaderOptions(r),n.storyReaderOptions)),[JSON.stringify(r)]),goodsWidgetOptions:a}};var Th=function(e,t){var r={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(r[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(i=Object.getOwnPropertySymbols(e);n<i.length;n++)t.indexOf(i[n])<0&&Object.prototype.propertyIsEnumerable.call(e,i[n])&&(r[i[n]]=e[i[n]])}return r};const Rh=e=>{var{listType:t,feedSlug:r,testKey:i,storyManager:n,options:s,filter:o,useUgcCard:a=!1,hasFavorite:l,isFavorite:d}=e,c=Th(e,["listType","feedSlug","testKey","storyManager","options","filter","useUgcCard","hasFavorite","isFavorite"]);const[u,h]=(0,il.useState)(),{desktopMode:p}=kh(),{storyListOptions:f}=(e=>{const t=(0,il.useRef)(new Se).current;return{storyListOptions:(0,il.useMemo)((()=>(e&&t.setStoriesListOptions(e),t.storiesListOptions)),[JSON.stringify(e)])}})(s),g=()=>{var e;null===(e=c.onLoadStart)||void 0===e||e.call(c)},v=e=>{var t;null===(t=c.onLoadEnd)||void 0===t||t.call(c,e)};return(0,il.useEffect)((()=>{const e=n.createStoryList();return e.on("startLoading",g),e.on("endLoading",v),h(e),()=>{e.destroy()}}),[n]),(0,il.useEffect)((()=>{null==u||u.setParams({listType:t,testKey:i,feedSlug:r,filter:o,useUgcCard:a,isFavorite:d,hasFavorite:l}),d||null==u||u.loadStories({needFavorite:!0})}),[u,i,r,o]),(0,il.useEffect)((()=>{u&&(u.modeDesktop=p)}),[p,u]),{storyListViewModel:u,storyListOptions:f}};function Dh(e){return!/^(-?\d|--)/.test(e)}function Bh(e){const t=[];let r="",i="",n=7;for(let s,o=0;s=e.charAt(o);o++)if(/[a-zA-Z\d\xa0-\uffff_-]/.test(s)&&7===n)r+=s;else if("\\"===s&&7===n)n=6;else if(" "===s&&7===n){if(""!==r){if(!Dh(r))return null;t.push(r),r=""}}else if(6===n)/[0-9a-f]/i.test(s)?(i+=s,n=8):(r+=s,n=7);else{if(8!==n)return null;/[0-9a-f]/i.test(s)&&i.length<6?i+=s:(r+=String.fromCodePoint(parseInt(i,16)),r+=s,i="",n=7)}if(""!==r){if(!Dh(r))return null;t.push(r)}return t.join(" ")}function Nh(e,t){let r=t,i="";const n={"font-family":[]};for(let t,s=0;t=e.charAt(s);s+=1)if(4!==r||'"'!==t&&"'"!==t)if(3===r&&","===t)r=4,i="";else if(4===r&&","===t){const e=Bh(i);e&&n["font-family"].push(e),i=""}else if(5===r&&" "===t)/^(?:\+|-)?(?:[0-9]*\.)?[0-9]+(?:deg|grad|rad|turn)$/.test(i)?(n["font-style"]+=" "+i,i=""):s-=1,r=1;else if(1!==r||" "!==t&&"/"!==t)2===r&&" "===t?(/^(?:\+|-)?([0-9]*\.)?[0-9]+(?:em|ex|ch|rem|vh|vw|vmin|vmax|px|mm|cm|in|pt|pc|%)?$/.test(i)&&(n["line-height"]=i),r=4,i=""):i+=t;else{if(/^(?:(?:xx|x)-large|(?:xx|s)-small|small|large|medium)$/.test(i)||/^(?:larg|small)er$/.test(i)||/^(?:\+|-)?(?:[0-9]*\.)?[0-9]+(?:em|ex|ch|rem|vh|vw|vmin|vmax|px|mm|cm|in|pt|pc|%)$/.test(i))r="/"===t?2:4,n["font-size"]=i;else if(/^italic$/.test(i))n["font-style"]=i;else if(/^oblique$/.test(i))n["font-style"]=i,r=5;else if(/^small-caps$/.test(i))n["font-variant"]=i;else if(/^(?:bold(?:er)?|lighter|normal)$/.test(i))n["font-weight"]=i;else if(/^[+-]?(?:[0-9]*\.)?[0-9]+(?:e[+-]?(?:0|[1-9][0-9]*))?$/.test(i)){const e=parseFloat(i);e>=1&&e<=1e3&&(n["font-weight"]=i)}else/^(?:(?:ultra|extra|semi)-)?(?:condensed|expanded)$/.test(i)&&(n["font-stretch"]=i);i=""}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,r=3,i=""}if(3===r&&!/^\s*$/.test(i))return null;if(4===r){const e=Bh(i);e&&n["font-family"].push(e)}return n}const Fh=(e=>{var t={};return f.d(t,e),t})({default:()=>u.default});class Uh{constructor(){Object.defineProperty(this,"fontStyle",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"fontVariant",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"fontWeight",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"fontSize",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"lineHeight",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"fontFamily",{enumerable:!0,configurable:!0,writable:!0,value:void 0})}toString(){return`${this.fontStyle} ${this.fontVariant} ${this.fontWeight} ${this.fontSize}px/${this.lineHeight} ${this.fontFamily.join(", ")}`}clone(){const e=new Uh;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 Vh{constructor(e,t){Object.defineProperty(this,"obj",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"cardTitleOptions",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"cardTitleFont",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),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,t={top:0,bottom:0};try{if("number"==typeof e)t.top=e,t.bottom=e;else{const r=(0,Fh.default)(e);t.top=parseFloat(r.top),t.bottom=parseFloat(r.bottom)}}catch(e){console.error(e)}const r=this.cardTitleOptions.lineClamp,i=Math.round(this.cardTitleFont.fontSize*this.cardTitleFont.lineHeight*100)/100;return t.top+t.bottom+r*i}measureScaledFontSizeInWebView(e){const t=document.createElement("span");t.style.fontSize=e+"px",t.style.display="none",this.obj.append(t);const r=getComputedStyle(t).fontSize;return this.obj.removeChild(t),parseFloat(r)||e}isOutsideTitle(){return this.cardTitleOptions.display&&(this.cardTitleOptions.position===se.CARD_OUTSIDE_TOP||this.cardTitleOptions.position===se.CARD_OUTSIDE_BOTTOM)}getCardTitleParsedFont(e){const t=new Uh;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 r=function(e){const t=Nh(e,1);return null!==t&&t["font-size"]&&t["font-family"].length?t:null}(e);if(null!=r["font-style"]&&(t.fontStyle=r["font-style"]),null!=r["font-variant"]&&(t.fontVariant=r["font-variant"]),null!=r["font-weight"]&&(t.fontWeight=r["font-weight"]),null!=r["font-size"]){const e=parseFloat(r["font-size"]);String(`${e}px`)===r["font-size"]&&(t.fontSize=e)}if(null!=r["line-height"]){const e=parseFloat(r["line-height"]);String(`${e}px`)===r["line-height"]?t.lineHeight=Math.round(e/t.fontSize*100)/100:String(e)===r["line-height"]&&(t.lineHeight=parseFloat(r["line-height"]))}null!=r["font-family"]&&Array.isArray(r["font-family"])&&(t.fontFamily=r["font-family"])}catch(e){console.error(e)}return t}}class zh{constructor(e){Object.defineProperty(this,"storiesListOptions",{enumerable:!0,configurable:!0,writable:!0,value:e})}getStoriesListStyleOptions(e){var t,r,i,n,s,o;const a={storiesHeight:null!==(r=null===(t=this.storiesListOptions.card)||void 0===t?void 0:t.height)&&void 0!==r?r:70,storiesLayoutHeight:null!==(n=null===(i=this.storiesListOptions.layout)||void 0===i?void 0:i.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};let 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}}}var Gh=f(1938),Wh={insert:"head",singleton:!1};ol()(Gh.A,Wh);const $h=Gh.A.locals||{},Hh=({slider:e,storyListViewModel:t,storyListOptions:r,isFavorite:i,listType:n,feed:s,filter:o,storyManager:a})=>{const l=(({storyManager:e,listType:t,feed:r,filter:i})=>{const[n,s]=(0,il.useState)();return(0,il.useEffect)((()=>{const n=new Xo(e,{listType:t,feed:r,filter:i}).create();return s(n),()=>{n.destroy()}}),[r,JSON.stringify(i)]),n})({listType:n,feed:s,filter:o,storyManager:a}),d=(0,il.useCallback)(na()((()=>{if(!e||!l)return;const{x:t,y:r}=e.getCurrentPosition();l.calculate(t,r)}),300),[e,l]),c=(0,il.useCallback)((()=>{if(!e||!l)return;const t=e.elementRef.getBoundingClientRect(),r=new Wo(t.left,t.top,t.width,t.height),i=Array.from(e.slides),n=new Wo(0,0,window.innerWidth,window.innerHeight),s=u();l.updateGeometry({stories:i,storyListRect:r,windowRect:n,viewportPadding:s}),d()}),[e,l,d]);(0,il.useEffect)((()=>{if(!e||i||!l)return;const t=l.startScroll.bind(l),r=l.endScroll.bind(l);return e.addListener("scrollstart",t),e.addListener("scrollend",r),window.addEventListener("scroll",c),window.addEventListener("resize",c),()=>{e.removeListener("scrollstart",t),e.removeListener("scrollend",r),window.removeEventListener("scroll",c),window.removeEventListener("resize",c)}}),[e,i,c]),(0,il.useEffect)((()=>{i||c()}),[r.direction,r.card.aspectRatio,r.card.height,t.defaultStories.length,i,c]),(0,il.useEffect)((()=>{if(!l)return;const e=({id:e})=>l.markStoryAsFullVisible(e);return ar.on("publicEvents.showStory",e),()=>{ar.off("publicEvents.showStory",e)}}),[l,t]);const u=()=>{const e=r.sidePadding,t={left:e,right:e,top:r.topPadding,bottom:r.bottomPadding};return"vertical"===r.direction&&(t.left=0,t.right=0),t}},qh=(e,t,r)=>{const{dir:i}=kh();(0,il.useEffect)((()=>{if(e&&t.autoScrollOnStoryClose)return ar.on("closeStoryReader",n),()=>{ar.off("closeStoryReader",n)}}),[e,t.direction,t.autoScrollOnStoryClose]);const n=({id:n})=>{if(!e)return;const s=((e,t)=>e.slides.find((e=>Number(e.dataset.id)===t)))(e,n);if(!s)return;const o=(e=>{const{x:t,y:i}=e.getCurrentPosition(),n=r.current.getBoundingClientRect();return new Wo(n.x+t,n.y+i,n.width,n.height)})(e),a=((e,t)=>new Wo("ltr"===i?e.offsetLeft:t.width-e.offsetLeft-e.clientWidth,e.offsetTop,e.clientWidth,e.clientHeight))(s,o);if(a.overlaps(o))return;const l="horizontal"===t.direction?a.x:s.offsetTop;e.scrollTo(l)}},Qh=(0,il.forwardRef)(((e,t)=>{const r=e.sliderOptions.card,i=e.sliderOptions.favoriteCard,n=r.border,s=r.opened.border,o=e.sliderOptions.navigation,a=()=>{var e,t,r;return(null!==(e=s.radius)&&void 0!==e?e:n.radius)-parseFloat(null!==(t=s.width)&&void 0!==t?t:n.width)-parseFloat(null!==(r=s.gap)&&void 0!==r?r:n.gap)};return(0,tl.jsx)("div",{dir:e.dir,ref:t,className:e.className,style:Object.assign(Object.assign({},(()=>{var t,l,d,c,u,h,p,f,g,v,m,y,b,w,S,_,x,O,C,k,L;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},M={"--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":r.gap+"px","--storiesHeight":r.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":r.mask.color,"--storiesListItemOpenedMaskColor":null!==(f=r.opened.mask.color)&&void 0!==f?f:r.mask.color,"--storiesListItemMaskLinearGradient":A(r.mask),"--storiesListItemOpenedMaskLinearGradient":A(null!=(null===(v=null===(g=r.opened)||void 0===g?void 0:g.mask)||void 0===v?void 0:v.linearGradient)?r.opened.mask:r.mask),"--storiesListCardFavoriteTitle":Dn(i.title.padding.toString())?i.title.padding+"px":i.title.padding,"--storiesListCardFavoriteGap":Dn(i.gap.toString())?i.gap+"px":i.gap,"--storiesListCardUgcMaskColor":e.sliderOptions.ugcCard.mask.color,"--storiesListCardUgcMaskLinearGradient":A(e.sliderOptions.ugcCard.mask),"--storiesListItemTitleFontFamily":"InternalPrimaryFont","--storiesListItemTitleFont":r.title.font,"--storiesListItemTitlePadding":Dn(r.title.padding.toString())?r.title.padding+"px":r.title.padding,"--storiesListControlsSize":Dn(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":r.dropShadow,"--storiesListCardOpenedDropShadow":null!==(m=r.opened.dropShadow)&&void 0!==m?m:r.dropShadow,"--storiesListCardFavoriteDropShadow":e.sliderOptions.favoriteCard.dropShadow,"--storiesListCardUgcDropShadow":e.sliderOptions.ugcCard.dropShadow,"--storiesListCardMask":(null===(y=r.svgMask)||void 0===y?void 0:y.cardMask)?`url("data:image/svg+xml,${Cn(null===(b=r.svgMask)||void 0===b?void 0:b.cardMask)}")`:null,"--storiesListCardOpenedMask":(null===(w=r.opened.svgMask)||void 0===w?void 0:w.cardMask)?`url("data:image/svg+xml,${Cn(null===(S=r.opened.svgMask)||void 0===S?void 0:S.cardMask)}")`:null,"--storiesListCardFavoriteMask":(null===(_=e.sliderOptions.ugcCard.svgMask)||void 0===_?void 0:_.cardMask)?`url("data:image/svg+xml,${Cn(null===(x=e.sliderOptions.ugcCard.svgMask)||void 0===x?void 0:x.cardMask)}")`:null};let E=null;return E=null===(O=r.svgMask)||void 0===O?void 0:O.overlayMask,null!=E&&Array.isArray(E)&&E.forEach(((e,t)=>M[`--storiesListCardOverlay${t}Mask`]=e.mask?`url("data:image/svg+xml,${Cn(e.mask)}")`:null)),E=null===(C=r.opened.svgMask)||void 0===C?void 0:C.overlayMask,null!=E&&Array.isArray(E)&&E.forEach(((e,t)=>M[`--storiesListCardOpenedOverlay${t}Mask`]=e.mask?`url("data:image/svg+xml,${Cn(e.mask)}")`:null)),E=null===(k=e.sliderOptions.favoriteCard.svgMask)||void 0===k?void 0:k.overlayMask,null!=E&&Array.isArray(E)&&E.forEach(((e,t)=>M[`--storiesListCardFavoriteOverlay${t}Mask`]=e.mask?`url("data:image/svg+xml,${Cn(e.mask)}")`:null)),E=null===(L=e.sliderOptions.ugcCard.svgMask)||void 0===L?void 0:L.overlayMask,null!=E&&Array.isArray(E)&&E.forEach(((e,t)=>M[`--storiesListCardUgcOverlay${t}Mask`]=e.mask?`url("data:image/svg+xml,${Cn(e.mask)}")`:null)),M})()),e.style),children:e.children})})),Kh=navigator.vendor&&navigator.vendor.indexOf("Apple")>-1&&navigator.userAgent&&-1==navigator.userAgent.indexOf("CriOS")&&-1==navigator.userAgent.indexOf("FxiOS"),Yh=({videoCoverSrc:e,onVideoCoverLoaded:t})=>{const r=(0,il.useRef)(null);return(0,il.useEffect)((()=>{(()=>{if(!e)return;const i=r.current,n=()=>{i.play().then((()=>{if(Kh){let e=1;const r=()=>{e>=2&&(i.removeEventListener("timeupdate",r),i.currentTime=0,t()),e++};i.addEventListener("timeupdate",r,!1)}else t()})).catch((e=>{console.error(e)})),i.removeEventListener("canplaythrough",n)};i.addEventListener("canplaythrough",n),i.load()})()}),[]),(0,tl.jsx)("video",{ref:r,src:e,loop:!0,muted:!0,playsInline:!0,"webkit-playsinline":"true",preload:"auto"})},Zh=({story:e,cardOptions:t,favoriteCardOptions:r,ugcCardOptions:i})=>{const n=(e,t)=>null!=t&&Array.isArray(t)?t.map(((t,r)=>s(t,e,r))):[],s=(e,t,r)=>({maskImage:`var(--${t}${r}Mask)`,WebKitMaskImage:`var(--${t}${r}Mask)`,background:e.background});return{getAllCardsOverlayMaskStyles:()=>{let s=[];var o;return e.isFavoriteCard&&(s=s.concat(n("storiesListCardFavoriteOverlay",null===(o=r.svgMask)||void 0===o?void 0:o.overlayMask))),s=e.isUgcCard?s.concat((()=>{var e;return n("storiesListCardUgcOverlay",null===(e=i.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 Xh=f(2811),Jh={insert:"head",singleton:!1};ol()(Xh.A,Jh);const ep=Xh.A.locals||{},tp=({story:e,cardOptions:t,favoriteCardOptions:r,ugcCardOptions:i,wrapperStyle:n,children:s,onClick:o})=>{const a={story:e,cardOptions:t,favoriteCardOptions:r,ugcCardOptions:i},[l,d]=(0,il.useState)(!1),{getAllCardsOverlayMaskStyles:c}=Zh(a),{getCardTitleAlignClass:u,getTitleStyle:h,getTitleWrapperStyle:p}=(({story:e,cardOptions:t,favoriteCardOptions:r,ugcCardOptions:i})=>{const{dir:n}=kh();return{getCardTitleAlignClass:()=>{const e=t.title.textAlign,r=e===ne.START||e===ne.LEFT,i=e===ne.END||e===ne.RIGHT,s="ltr"===n;return{[ep["align-left"]]:r&&s||i&&!s,[ep["align-center"]]:e===ne.CENTER,[ep["align-right"]]:i&&s||r&&!s}},getTitleStyle:()=>{const r={};return e.titleColor&&t.title.position===se.CARD_INSIDE_BOTTOM&&Object.assign(r,{color:e.titleColor}),r.WebkitLineClamp=String(parseInt(t.title.lineClamp)),r},getTitleWrapperStyle:()=>{let t={};return e.titleColor&&e.isFavoriteCard&&(t=Object.assign(Object.assign({},t),{color:r.title.color})),e.titleColor&&e.isUgcCard&&(t=Object.assign(Object.assign({},t),{color:i.title.color})),t}}})(a),{getSlideClassList:f,getSlideStyleList:g,getSlideWrapperStyle:v}=(({story:e,cardOptions:t,favoriteCardOptions:r,ugcCardOptions:i})=>{var n;const s=null!==(n=t.aspectRatio)&&void 0!==n?n:e.getAspectRatio(t.variant);return{getSlideClassList:()=>{var n,s;const o=e.background;let a="";void 0!==o&&(a=ep[`_background-color-${o.color}`+(!0===o.gradient?"-gradient":"")]);const l=(()=>{let n;return n=e.isFavoriteCard?r:e.isUgcCard?i: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,{[ep["_is-read"]]:e.isOpened},{[ep["_format-rectangle"]]:t.variant===fe.STYLE_RECTANGLE},{[ep["_format-circle"]]:t.variant===fe.STYLE_CIRCLE},{[ep["_format-quad"]]:t.variant===fe.STYLE_QUAD},{[ep["_favorite-cell"]]:e.isFavoriteCard},{[ep["_ugc-cell"]]:e.isUgcCard},{[ep["_has-drop-shadow"]]:d},{[ep["_has-card-svg-mask"]]:c},{[ep["_has-border-gradient-color"]]:u}]},getSlideStyleList:()=>{const r={width:s*t.height+"px",opacity:null!==t.opacity?t.opacity:1,boxShadow:t.boxShadow||"unset",height:`${t.height}px`};return e.isOpened&&(r.boxShadow=t.opened.boxShadow||r.boxShadow,r.opacity=null!==t.opened.opacity?t.opened.opacity:r.opacity),r},getSlideWrapperStyle:()=>{const e={};return e.width=s*t.height+"px",e}}})(a),m=e.getImageSrcByCoverQuality(t.coverQuality),y=t.title.position===se.CARD_INSIDE_BOTTOM,b=t.title.position===se.CARD_OUTSIDE_TOP,w=t.title.position===se.CARD_OUTSIDE_BOTTOM;return(0,tl.jsxs)("a",{"data-id":e.id,className:(0,nl.default)(ep["stories-slide-wrapper"],{[ep.isTitleCardOutsideTop]:b,[ep.isTitleCardOutsideBottom]:w}),style:Object.assign(Object.assign({},v()),n),rel:"noreferrer",onClick:t=>{t.stopPropagation(),t.preventDefault(),o(e)},children:[t.title.display&&b&&(0,tl.jsx)("div",{className:(0,nl.default)(ep["stories-slide__content"],ep.__position_outside_top),style:p(),children:(0,tl.jsx)("div",{className:(0,nl.default)(ep["stories-slide__title"],ep.clamp,u()),style:h(),children:e.title})}),(0,tl.jsxs)("div",{className:(0,nl.default)(ep["stories-slide"],f()),style:g(),children:[(0,tl.jsxs)("div",{className:ep["stories-slide__inner"],children:[(0,tl.jsx)("div",{className:ep["stories-slide-image"],style:{backgroundColor:e.backgroundColor?e.backgroundColor:"transparent"},children:(0,tl.jsx)("div",{className:ep["stories-slide-image__wrap"],children:(0,tl.jsxs)("div",{className:(0,nl.default)(ep["stories-slide-image__image"],ep._mode_list,{[ep["video-loaded"]]:l,[ep["ugc-card-cell"]]:e.isUgcCard}),children:[m&&(0,tl.jsx)("img",{src:m,alt:e.title,loading:t.coverLazyLoading?"lazy":"eager"}),e.videoCoverSrc&&(0,tl.jsx)(Yh,{onVideoCoverLoaded:()=>d(!0),videoCoverSrc:e.videoCoverSrc}),s]})})}),(0,tl.jsx)("div",{className:ep["stories-slide__mask"]}),t.title.display&&y&&(0,tl.jsx)("div",{className:ep["stories-slide__content"],style:p(),children:(0,tl.jsx)("div",{className:(0,nl.default)(ep["stories-slide__title"],ep.clamp,u()),style:h(),children:e.title})})]}),c().map(((e,t)=>(0,tl.jsx)("div",{style:e,className:ep["card-overlay-svg-mask"]},t)))]}),t.title.display&&w&&(0,tl.jsx)("div",{className:(0,nl.default)(ep["stories-slide__content"],ep.__position_outside_bottom),style:p(),children:(0,tl.jsx)("div",{className:(0,nl.default)(ep["stories-slide__title"],ep.clamp,u()),style:h(),children:e.title})})]})};var rp=f(2731),ip={insert:"head",singleton:!1};ol()(rp.A,ip);const np=rp.A.locals||{};var sp=function(e,t){var r={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(r[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(i=Object.getOwnPropertySymbols(e);n<i.length;n++)t.indexOf(i[n])<0&&Object.prototype.propertyIsEnumerable.call(e,i[n])&&(r[i[n]]=e[i[n]])}return r};const op=e=>{var{sliderDirection:t,slider:r}=e,i=sp(e,["sliderDirection","slider"]);const[n,s]=(0,il.useState)(!0),[o,a]=(0,il.useState)(!0),l=i.navigationOptions.speed;(0,il.useEffect)((()=>(r.on("reachStart",d),r.on("reachEnd",c),()=>{r.off("reachStart",d),r.off("reachEnd",c)})),[r]);const d=()=>{s(r.reachStart)},c=()=>{a(r.reachEnd)};return i.navigationView?i.navigationView({dir:i.dir,defaultStyles:np,reachStart:n,reachEnd:o,onPrev:()=>r.scrollByDirection(-1,l),onNext:()=>r.scrollByDirection(1,l),slider:{direction:t,viewport:r.elementRef.getBoundingClientRect()}}):i.navigationOptions.showControls?(0,tl.jsxs)("div",{className:(0,nl.default)(np["stories-list-controls"],np[t]),children:[(0,tl.jsx)("div",{onClick:()=>r.scrollByDirection(-1,l),className:(0,nl.default)(np["control-start"],{[np["control-start_dir_rtl"]]:"rtl"===i.dir,[np["control-start_reach-start"]]:n}),children:(0,tl.jsx)("div",{className:np["control-icon"]})}),(0,tl.jsx)("div",{onClick:()=>r.scrollByDirection(1,l),className:(0,nl.default)(np["control-end"],{[np["control-end_dir_rtl"]]:"rtl"===i.dir,[np["control-end_reach-end"]]:o}),children:(0,tl.jsx)("div",{className:np["control-icon"]})})]}):null};var ap=f(7533),lp={insert:"head",singleton:!1};ol()(ap.A,lp);const dp=ap.A.locals||{},cp=({favoriteStories:e,cardOptions:t,favoriteCardOptions:r})=>{const i=e=>{var r;return{paddingTop:1/(null!==(r=t.aspectRatio)&&void 0!==r?r:e.getAspectRatio(t.variant))*100+"%"}},n=e=>{const t=e.getImageSrcByCoverQuality(r.coverQuality),i={};return t?i.backgroundImage=`url('${t}')`:i.backgroundColor=e.backgroundColor,i};return(0,tl.jsx)("div",{className:dp["favorite-images-wrapper"],children:e.slice(0,4).map(((e,r)=>(0,tl.jsx)("div",{className:dp["favorite-image-wrapper"],children:(0,tl.jsx)("div",{style:i(e),className:(0,nl.default)(dp["favorite-image"],{[dp.circle_style]:t.variant===fe.STYLE_CIRCLE}),children:(0,tl.jsx)("div",{className:dp["favorite-image-item"],style:n(e)})})},r)))})};var up=function(e,t){var r={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(r[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(i=Object.getOwnPropertySymbols(e);n<i.length;n++)t.indexOf(i[n])<0&&Object.prototype.propertyIsEnumerable.call(e,i[n])&&(r[i[n]]=e[i[n]])}return r};const hp=(0,Yl.observer)((0,il.forwardRef)(((e,t)=>{var{isFavorite:r=!1,storyListViewModel:i}=e,n=up(e,["isFavorite","storyListViewModel"]);const s=(0,il.useRef)(null),o=(0,il.useRef)(null);((e,t)=>{(0,il.useImperativeHandle)(e,(()=>({reload:t.reload.bind(t)})),[t])})(t,i);const a=((e,t)=>{const[r,i]=(0,il.useState)(t);(0,il.useLayoutEffect)((()=>{const r=e.current;n(r,t),i(t)}),[JSON.stringify(t)]);const n=(e,t)=>{const r=new Vh(e,t.card.title);s(r,t),o(r,t)},s=(e,t)=>{const r=e.getCardTitleFont();r.fontSize=e.getScaledFontSizeInWebView(),t.card.title.font=r.toString()},o=(e,t)=>{const r=new zh(t),{storiesListHeight:i,storiesListInnerHeight:n}=r.getStoriesListStyleOptions(e.getStoryTitleBlockHeight()),s=t.layout.height;t.layout.height=Ut()(s)?`${i}px`:s};return r})(s,n.storyListOptions),l=(({isFavorite:e,storyListViewModel:t,storyListOptions:r})=>{let i=[];return e?i=t.favoriteStories.slice():(i=t.defaultStories.slice(),t.hasFavoriteCard&&i.push(zo.create(t,r.favoriteCard)),t.hasUgcCard&&i.unshift(Go.create(t,r.ugcCard))),i})({isFavorite:r,storyListViewModel:i,storyListOptions:a}),{sliderRef:d,slider:c,isScrolling:u}=((e,t)=>{const{dir:r,desktopMode:i}=kh(),n=(0,il.useRef)(),s=(0,il.useRef)(null),[o,a]=(0,il.useState)(!1),[l,d]=(0,il.useState)(null),c=()=>{clearTimeout(n.current),a(!0)},u=()=>{n.current=setTimeout((()=>a(!1)),100)};(0,il.useEffect)((()=>{if(!s.current)return;const e=new la;return e.mount(s.current),d(e),e.on("scrollstart",c),e.on("scrollend",u),()=>{e.destroy(),e.off("scrollstart",c),e.off("scrollend",u)}}),[]),(0,il.useEffect)((()=>{l&&(l.setGap(e.card.gap),l.setDesktopMode(i),l.changeDirection(e.direction))}),[l,e.card.gap,i,e.direction]),(0,il.useEffect)((()=>{l&&(l.setTextDirection(r),l.scrollTo(0,0))}),[l,r]);const h=(0,il.useCallback)((()=>{null==l||l.testAttraction()}),[l,t]);return(0,il.useEffect)((()=>(null==l||l.scrollTo(0,0),h(),window.addEventListener("resize",h),()=>{window.addEventListener("resize",h)})),[l,h]),{sliderRef:s,slider:l,isScrolling:o}})(a,l.length);Hh({slider:c,storyListViewModel:i,storyListOptions:a,isFavorite:r,listType:n.listType,feed:n.feedSlug,filter:n.filter,storyManager:n.storyManager}),qh(c,a,o);const{getRootStyle:h,getStoryWrapperStyle:p,viewportInnerClassList:f,viewportInnerStyle:g}=(e=>{const{dir:t,desktopMode:r}=kh();return{getRootStyle:()=>({"--background-color":e.layout.backgroundColor,paddingLeft:e.sidePadding+"px",paddingRight:e.sidePadding+"px","--storiesListTopPadding":e.topPadding+"px","--storiesListBottomPadding":e.bottomPadding+"px","--storiesListSidePadding":e.sidePadding+"px",backgroundColor:e.layout.backgroundColor}),getStoryWrapperStyle:(t,r)=>{const i={marginRight:"0",paddingLeft:"0",paddingRight:"0"};return"vertical"===e.direction||(t!==r-1?i.marginRight=e.card.gap+"px":i.paddingRight=e.sidePadding+"px",0===t&&(i.paddingLeft=e.sidePadding+"px")),i},viewportInnerClassList:r?(0,nl.default)($h["stories-list__viewport-inner"],$h["mode-desktop"],{[$h["with-list-controls"]]:e.navigation.showControls,[$h.isTitleCardOutsideTop]:e.card.title.position===se.CARD_OUTSIDE_TOP,[$h.isTitleCardOutsideBottom]:e.card.title.position===se.CARD_OUTSIDE_BOTTOM,[$h.isVerticalDirection]:"vertical"===e.direction}):(0,nl.default)($h["stories-list__viewport-inner"],Object.assign(Object.assign({},(()=>{const r=e.layout.sliderAlign,i=r===re.START||r===re.LEFT,n=r===re.END||r===re.RIGHT,s="ltr"===t;return{[$h["align-left"]]:i&&s||n&&!s,[$h["align-center"]]:r===re.CENTER,[$h["align-right"]]:n&&s||i&&!s}})()),{[$h.isTitleCardOutsideTop]:e.card.title.position===se.CARD_OUTSIDE_TOP,[$h.isTitleCardOutsideBottom]:e.card.title.position===se.CARD_OUTSIDE_BOTTOM,[$h.isVerticalDirection]:"vertical"===e.direction})),viewportInnerStyle:{height:e.layout.height,gap:"vertical"===e.direction?`${e.card.gap}px`:0}}})(a),v=a.card,m=a.favoriteCard,y=a.ugcCard;return(0,tl.jsxs)(Qh,{className:(0,nl.default)($h["stories-list-wrapper"],{[$h["mode-desktop"]]:i.modeDesktop,[$h["with-list-controls"]]:a.navigation.showControls}),dir:n.dir,style:h(),sliderOptions:a,ref:s,children:[(0,tl.jsx)("div",{className:$h["stories-list"],children:(0,tl.jsx)("div",{ref:o,className:(0,nl.default)($h["stories-list__viewport"],{[$h["mode-desktop"]]:i.modeDesktop}),style:"horizontal"===a.direction?{marginLeft:-a.sidePadding+"px",marginRight:-a.sidePadding+"px"}:{},children:(0,tl.jsx)("div",{ref:d,className:f,style:g,children:l.map(((e,t)=>{var r;const s=e instanceof Uo,o=n.storyCardView&&!s;return s&&n.favoriteCardView?(0,tl.jsx)(il.default.Fragment,{children:n.favoriteCardView(e)},t):(0,tl.jsx)(il.default.Fragment,{children:o?null===(r=n.storyCardView)||void 0===r?void 0:r.call(n,e):(0,tl.jsx)(tp,{story:e,cardOptions:v,favoriteCardOptions:m,ugcCardOptions:y,wrapperStyle:p(t,l.length),onClick:()=>((e,t)=>{var r,s,o;u||(null===(r=n.onStoryCardClick)||void 0===r||r.call(n,e),e.isUgcCard?null===(s=n.onUgcCardClick)||void 0===s||s.call(n):e.isFavoriteCard?null===(o=n.onFavoriteCardClick)||void 0===o||o.call(n):i.onStoryClick(e,t))})(e,t),children:s&&(0,tl.jsx)(cp,{favoriteStories:i.favoriteStories,favoriteCardOptions:a.favoriteCard,cardOptions:v})},t)},t)}))})})}),c&&(0,tl.jsx)(op,{dir:n.dir,navigationOptions:a.navigation,navigationView:n.navigationView,sliderDirection:a.direction,storiesLength:l.length,slider:c})]})}))),pp=(0,Yl.observer)((0,il.forwardRef)(((e,t)=>{var r,i,n;const{storyManager:s,dir:o}=kh(),a=null!==(r=e.feedSlug)&&void 0!==r?r:"default",l=We.DEFAULT,{storyListViewModel:d,storyListOptions:c}=Rh(Object.assign(Object.assign({},e),{storyManager:s,feedSlug:a,listType:l,hasFavorite:Boolean(e.hasFavorite),isFavorite:!1}));return d&&(null===(i=d.session)||void 0===i?void 0:i.session.id)?(0,tl.jsx)(hp,Object.assign({},e,{dir:o,storyManager:s,feedSlug:null!==(n=e.feedSlug)&&void 0!==n?n:"default",listType:We.DEFAULT,storyListViewModel:d,storyListOptions:c,onStoryCardClick:e.onStoryCardClick,onFavoriteCardClick:()=>{var t;s.emit("clickOnFavoriteCell",{feed:a}),null===(t=e.onFavoriteCardClick)||void 0===t||t.call(e)},ref:t})):null}))),fp=(0,Yl.observer)((0,il.forwardRef)(((e,t)=>{var r;const{storyManager:i,dir:n}=kh(),s=Oa,o=We.UGC,{storyListViewModel:a,storyListOptions:l}=Rh(Object.assign(Object.assign({},e),{storyManager:i,feedSlug:s,listType:o,isFavorite:!1,hasFavorite:!1}));return a&&(null===(r=a.session)||void 0===r?void 0:r.session.id)?(0,tl.jsx)(hp,Object.assign({},e,{ref:t,dir:n,storyListOptions:l,storyManager:i,listType:We.UGC,feedSlug:Oa,storyListViewModel:a,onStoryCardClick:e.onStoryCardClick})):null}))),gp=e=>{const{storyManager:t,dir:r}=kh(),i="default",n=We.DEFAULT,{storyListViewModel:s,storyListOptions:o}=Rh(Object.assign(Object.assign({},e),{storyManager:t,feedSlug:i,listType:n,isFavorite:!0,hasFavorite:!0}));return s?(0,tl.jsx)(hp,Object.assign({},e,{storyListOptions:o,storyManager:t,dir:r,feedSlug:i,listType:n,storyListViewModel:s,isFavorite:!0})):null};var vp=f(2432),mp={insert:"head",singleton:!1};ol()(vp.A,mp);const yp=vp.A.locals||{},bp=({open:e,options:t,storyListOptions:r,onClose:i})=>{var n,s;const{dir:o}=kh();(0,il.useLayoutEffect)((()=>{if(!e)return;const t=document.documentElement.style.overflow;return document.documentElement.style.overflow="hidden",()=>{document.documentElement.style.overflow=t}}),[e]);return e?(0,tl.jsx)("div",{className:yp["favorite-story-list-modal"],style:(()=>{var e,r,i,n;return{"--storiesFavoriteTitleColor":t.title.color,"--storiesFavoriteTitleFontFamily":"InternalPrimaryFont","--storiesFavoriteTitleFont":t.title.font,"--storiesFavoriteTitleBackgroundColor":t.title.backgroundColor,"--storiesFavoriteHeaderTopOffset":parseFloat(null!==(r=null===(e=t.headerTopOffset)||void 0===e?void 0:e.toString())&&void 0!==r?r:"0")+"px","--storiesFavoriteBottomOffset":parseFloat(null!==(n=null===(i=t.bottomOffset)||void 0===i?void 0:i.toString())&&void 0!==n?n:"0")+"px","--storiesFavoriteBackgroundColor":t.backgroundColor}})(),children:(0,tl.jsxs)("div",{className:yp.container,children:[(0,tl.jsxs)("div",{className:yp.header,children:[(0,tl.jsx)("p",{className:yp.title,children:t.title.content}),(0,tl.jsx)("button",{onClick:e=>{e.preventDefault(),e.stopPropagation(),i()},className:yp["header__close-btn"],style:(()=>{const e="start"===t.closeButtonPosition||"left"===t.closeButtonPosition,r="ltr"===o;return{[e&&r||!e&&!r?"left":"right"]:"10px"}})(),dangerouslySetInnerHTML:{__html:null!==(s=null===(n=t.closeButton)||void 0===n?void 0:n.svgSrc.baseState)&&void 0!==s?s:""}})]}),(0,tl.jsx)("div",{className:yp.content,children:(0,tl.jsx)("div",{className:yp["favorite-story-list"],children:(0,tl.jsx)(gp,{options:Object.assign(Object.assign(Object.assign({},r),{sidePadding:0}),{direction:ae.COLUMN,layout:{height:"auto"}})})})}),(0,tl.jsx)("div",{className:yp.footer}),(0,tl.jsx)("div",{className:yp["bottom-offset"]})]})}):null},wp=({storyList:e,onStoryCardClick:t,onFavoriteCardClick:r})=>{const[i,n]=(0,il.useState)(e.appearanceManager.storiesListOptions),s=(0,il.useRef)(null);return(0,il.useEffect)((()=>{e.api=s.current}),[]),(0,il.useEffect)((()=>(e.appearanceManager.on(Z.EVENT_UPDATED_STORIES_LIST_OPTIONS,n),()=>{e.appearanceManager.off(Z.EVENT_UPDATED_STORIES_LIST_OPTIONS,n)})),[e.appearanceManager]),(0,Zl.createPortal)((0,tl.jsx)(pp,{ref:s,options:i,hasFavorite:e.appearanceManager.commonOptions.hasFavorite,testKey:e.testKey,useUgcCard:e.useUgcCard,feedSlug:e.feedSlug,onLoadStart:()=>{e.emit(le.START_LOADER)},onLoadEnd:t=>{e.emit(le.END_LOADER,t)},onUgcCardClick:()=>{e.ugcCardClickHandler()},onFavoriteCardClick:r,onStoryCardClick:t},e.mountSelector),document.querySelector(e.mountSelector))},Sp=({ugcStoryList:e,onStoryCardClick:t})=>{const[r,i]=(0,il.useState)(e.appearanceManager.storiesListOptions),n=(0,il.useRef)(null);return(0,il.useEffect)((()=>{e.api=n.current}),[]),(0,il.useEffect)((()=>(e.appearanceManager.on(Z.EVENT_UPDATED_STORIES_LIST_OPTIONS,i),()=>{e.appearanceManager.off(Z.EVENT_UPDATED_STORIES_LIST_OPTIONS,i)})),[e.appearanceManager]),(0,Zl.createPortal)((0,tl.jsx)(fp,{ref:n,options:r,testKey:e.testKey,useUgcCard:e.useUgcCard,onStoryCardClick:t,onLoadStart:()=>{e.emit(le.START_LOADER)},onLoadEnd:t=>{e.emit(le.END_LOADER,t)},onUgcCardClick:()=>{e.ugcCardClickHandler()}}),document.querySelector(e.mountSelector))},_p=e=>{const[t,r]=(0,il.useState)(!1);return(0,tl.jsxs)(Ch,{config:e.storyManagerConfigDto,storyReaderOptions:e.appearanceManager.storyReaderOptions,commonOptions:e.appearanceManager.commonOptions,gameReaderOptions:e.appearanceManager.gameReaderOptions,goodsWidgetOptions:e.appearanceManager.goodsWidgetOptions,children:[e.storyLists.map((t=>(0,tl.jsx)(wp,{onFavoriteCardClick:()=>{r(!0)},onStoryCardClick:()=>{e.onAppearanceManagerChange(t.appearanceManager)},storyList:t},t.mountSelector))),e.ugcStoryLists.map((t=>(0,tl.jsx)(Sp,{ugcStoryList:t,onStoryCardClick:()=>{e.onAppearanceManagerChange(t.appearanceManager)}},t.mountSelector))),(0,tl.jsx)(bp,{open:t,onClose:()=>r(!1),options:e.appearanceManager.storyFavoriteReaderOptions,storyListOptions:e.appearanceManager.storiesListOptions})]})};class xp{constructor(){Object.defineProperty(this,"root",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"storyManagerConfigDto",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"storyLists",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"ugcStoryLists",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"appearanceManager",{enumerable:!0,configurable:!0,writable:!0,value:new Se}),this.createAppRoot(),this.handleAppearanceManagerUpdate=this.handleAppearanceManagerUpdate.bind(this),this.setAppearanceManager=this.setAppearanceManager.bind(this)}setStoryList(e){this.storyLists=e.slice(),this.render()}setUGCStoryList(e){this.ugcStoryLists=e.slice(),this.render()}setStoryManagerConfig(e){this.storyManagerConfigDto=Object.assign(Object.assign({},this.storyManagerConfigDto),e),this.render()}setAppearanceManager(e){this.unscubscribeToAppearanceManagerEvents(),this.appearanceManager=e,this.subscribeToAppearanceManagerEvents(),this.render()}render(){this.root.render((0,tl.jsx)(_p,{storyManagerConfigDto:this.storyManagerConfigDto,appearanceManager:this.appearanceManager,ugcStoryLists:this.ugcStoryLists,storyLists:this.storyLists,onAppearanceManagerChange:this.setAppearanceManager}))}createAppRoot(){const e=document.createElement("div");e.id="ias-app",document.body.append(e),this.root=(0,rl.createRoot)(e)}subscribeToAppearanceManagerEvents(){this.appearanceManager.on(Z.UPDATE,this.handleAppearanceManagerUpdate)}unscubscribeToAppearanceManagerEvents(){this.appearanceManager.off(Z.UPDATE,this.handleAppearanceManagerUpdate)}handleAppearanceManagerUpdate(){this.render()}}var Op=function(e,t,r,i){return new(r||(r=Promise))((function(n,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}l((i=i.apply(e,t||[])).next())}))};class Cp extends J.EventEmitter{constructor(e,t,r,i,n){super(),Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"app",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(this,"sharePage",{enumerable:!0,configurable:!0,writable:!0,value:null}),Ya(t),this.showSharePage(e,t,n)}showSharePage(e,t,r){return Op(this,void 0,void 0,(function*(){this.app.setAppearanceManager(t),this.sharePage=yield this.storyManager.showSharePage(e,r)}))}closeStoryReader(){return Op(this,void 0,void 0,(function*(){var e;null===(e=this.sharePage)||void 0===e||e.closeStoryReader()}))}}var kp=function(e,t,r,i){return new(r||(r=Promise))((function(n,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}l((i=i.apply(e,t||[])).next())}))};class Lp extends(ee()){constructor(e,t,r,i){super(),Object.defineProperty(this,"appearanceManager",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"options",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"app",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(this,"stackedStoryListViewModel",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Ya(e),this.handleUpdate=this.handleUpdate.bind(this),this.stackedStoryListViewModel=new _a(this.storyManager,{feed:t.feed}),this.stackedStoryListViewModel.on("update",this.handleUpdate)}get stories(){return this.stackedStoryListViewModel.stories}get length(){return this.stackedStoryListViewModel.length}get activeIndex(){return this.stackedStoryListViewModel.activeIndex}get feedCoverSrc(){return this.stackedStoryListViewModel.feedCoverSrc}get top(){return this.stackedStoryListViewModel.top}reload(){return kp(this,void 0,void 0,(function*(){return this.stackedStoryListViewModel.reload()}))}destroy(){this.stackedStoryListViewModel.destroy(),this.stackedStoryListViewModel.removeAllListeners()}showStory(e){this.app.setAppearanceManager(this.appearanceManager),this.stackedStoryListViewModel.showStory(e)}on(e,t){return"update"===e?super.on(e,t):(this.stackedStoryListViewModel.on(e,t),this)}once(e,t){return this.stackedStoryListViewModel.once(e,t),this}off(e,t){return this.stackedStoryListViewModel.off(e,t),this}handleUpdate(e){this.emit("update",{id:e.id,title:e.title,titleColor:e.titleColor,hasAudio:e.hasAudio,hasSwipeUp:e.hasSwipeUp,isOpened:e.isOpened,deeplink:e.deeplink,gameInstanceId:e.gameInstanceId,hideInReader:e.hideInReader,hide_timeline:e.hideTimeline,cover:e.getCover(this.appearanceManager.storiesListOptions.card.coverQuality)})}}var Ap=function(e,t,r,i){return new(r||(r=Promise))((function(n,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}l((i=i.apply(e,t||[])).next())}))};class Mp{constructor(e){return Object.defineProperty(this,"storyManagerConfigDto",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"app",{enumerable:!0,configurable:!0,writable:!0,value:new xp}),Object.defineProperty(this,"StoriesList",{enumerable:!0,configurable:!0,writable:!0,value:class extends Xa{constructor(e,t,r){super(e,t,r,Mp.instance.app)}}}),Object.defineProperty(this,"UGCStoriesList",{enumerable:!0,configurable:!0,writable:!0,value:class extends el{constructor(e,t,r){super(e,t,r,Mp.instance.app)}}}),Object.defineProperty(this,"SharePage",{enumerable:!0,configurable:!0,writable:!0,value:class extends Cp{constructor(e,t,r){super(e,t,ka,Mp.instance.app,r)}}}),Object.defineProperty(this,"StackedStoryList",{enumerable:!0,configurable:!0,writable:!0,value:class extends Lp{constructor(e,t){super(e,t,ka,Mp.instance.app)}}}),Mp.instance?(console.warn("StoryManager singleton is created multiple times\nuse IAS.StoryManager.getInstance() instead"),Mp.instance):(Mp.instance=this,this.app.setStoryManagerConfig(e),Mp.instance)}get sdkVersionName(){return ka.sdkVersionName}get sdkVersionCode(){return ka.sdkVersionCode}set storyLinkClickHandler(e){ka.storyLinkClickHandler=e}static getInstance(){return Mp.instance?Mp.instance:null}static use(e,t){ka.use(e,t)}getConfig(){return ka.getConfig()}showOnboardingStories(e,t){return Ap(this,void 0,void 0,(function*(){return Ya(e),this.app.setAppearanceManager(e),ka.showOnboardingStories(t)}))}showStory(e,t){return Ap(this,void 0,void 0,(function*(){Ya(t),this.app.setAppearanceManager(t),yield ka.showStory(e)}))}showStoryOnce(e,t){return Ap(this,void 0,void 0,(function*(){return Ya(t),this.app.setAppearanceManager(t),ka.showStoryOnce(e)}))}closeAllReaders(){ka.closeAllReaders()}openGame(e,t){return Ap(this,arguments,void 0,(function*(e,t,r={}){return Ya(t),this.app.setAppearanceManager(t),ka.openGame(e,r)}))}closeGame(){return Ap(this,void 0,void 0,(function*(){return ka.closeGame()}))}closeStoryReader(){return Ap(this,void 0,void 0,(function*(){return ka.closeStoryReader()}))}getUgcEditorConfig(){return ka.getUgcEditorConfig()}closeGoodsWidget(){ka.closeGoodsWidget()}setLang(e){this.storyManagerConfigDto.lang=e,this.app.setStoryManagerConfig(this.storyManagerConfigDto)}getNonce(){return Xt()}setUserId(e,t){return Ap(this,void 0,void 0,(function*(){this.storyManagerConfigDto.userId=e,this.storyManagerConfigDto.userIdSign=t,this.app.setStoryManagerConfig(this.storyManagerConfigDto)}))}setTags(e){this.storyManagerConfigDto.tags=e,this.app.setStoryManagerConfig(this.storyManagerConfigDto)}setPlaceholders(e){this.storyManagerConfigDto.placeholders=e,this.app.setStoryManagerConfig(this.storyManagerConfigDto)}setImagePlaceholders(e){this.storyManagerConfigDto.imagePlaceholders=e,this.app.setStoryManagerConfig(this.storyManagerConfigDto)}on(e,t){return ka.on(e,t),this}once(e,t){return ka.once(e,t),this}off(e,t){return ka.off(e,t),this}destroy(){ka.destroy()}}})();var v=g.hS,m=g.KL,y=g.Yb,b=g.Tg,w=g.WH,S=g.lV,_=g.ws,x=g.Jf,O=g.SK,C=g.tI,k=g.Uy,L=g.SP,A=g.Jj,M=g.pt,E=g.nN,P=g.mk,j=g.ex,I=g.Bq,T=g.I7,R=g.yx,D=g.qz,B=g.KO;export{v as AppearanceCommonOptionsDefault,m as AppearanceManager,y as CloseButtonPosition,b as GameReaderOptionsDefault,w as GoodsWidgetOptionsDefault,S as GoodsWidgetRenderingType,_ as SharePageEvents,x as SharePanelDefault,O as StoriesListCardCoverQuality,C as StoriesListCardTitlePosition,k as StoriesListCardTitleTextAlign,L as StoriesListCardViewVariant,A as StoriesListDirection,M as StoriesListEvents,E as StoriesListOptionsDefault,P as StoriesListSliderAlign,j as StoryFavoriteReaderOptionsDefault,I as StoryManager,T as StoryManagerConfigDefault,R as StoryReaderOptionsDefault,D as StoryReaderSwipeStyle,B as WidgetStoriesOptions};
|