@playpilot/tpi 3.1.0-beta.2 → 3.1.0-beta.4
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/link-injections.js +1 -1
- package/package.json +1 -1
- package/src/lib/crawler.ts +7 -0
- package/src/routes/+page.svelte +3 -0
- package/src/routes/components/Editorial/ResizeHandle.svelte +1 -1
- package/src/tests/lib/crawler.test.js +47 -0
- package/src/tests/routes/+page.test.js +17 -0
- package/src/tests/routes/components/Editorial/ResizeHandle.test.js +9 -1
package/dist/link-injections.js
CHANGED
|
@@ -5,6 +5,6 @@
|
|
|
5
5
|
opacity: ${c-d*p}`}}function Ht(e,{delay:t=0,duration:n=400,easing:r=bn,axis:i="y"}={}){const a=getComputedStyle(e),l=+a.opacity,s=i==="y"?"height":"width",c=parseFloat(a[s]),f=i==="y"?["top","bottom"]:["left","right"],d=f.map(y=>`${y[0].toUpperCase()}${y.slice(1)}`),o=parseFloat(a[`padding${d[0]}`]),v=parseFloat(a[`padding${d[1]}`]),m=parseFloat(a[`margin${d[0]}`]),g=parseFloat(a[`margin${d[1]}`]),h=parseFloat(a[`border${d[0]}Width`]),p=parseFloat(a[`border${d[1]}Width`]);return{delay:t,duration:n,easing:r,css:y=>`overflow: hidden;opacity: ${Math.min(y*20,1)*l};${s}: ${y*c}px;padding-${f[0]}: ${y*o}px;padding-${f[1]}: ${y*v}px;margin-${f[0]}: ${y*m}px;margin-${f[1]}: ${y*g}px;border-${f[0]}-width: ${y*h}px;border-${f[1]}-width: ${y*p}px;min-${s}: 0`}}function Fa(e,{delay:t=0,duration:n=400,easing:r=bn,start:i=0,opacity:a=0}={}){const l=getComputedStyle(e),s=+l.opacity,c=l.transform==="none"?"":l.transform,f=1-i,d=s*(1-a);return{delay:t,duration:n,easing:r,css:(o,v)=>`
|
|
6
6
|
transform: ${c} scale(${1-f*v});
|
|
7
7
|
opacity: ${s-d*v}
|
|
8
|
-
`}}var qa=A('<div class="popover svelte-8w8waf" tabindex="-1" aria-hidden="true"><div class="dialog svelte-8w8waf"><!></div></div>');function Ba(e,t){re(t,!0);let n=R(t,"maxHeight",15);Ir("scope","popover");let r=F(null),i=F(!1);nt(async()=>{await On(),a(),await On(),l()});function a(){if(!u(r))return;const{top:o,right:v,bottom:m,height:g}=u(r).getBoundingClientRect(),h=s();L(i,Y(o-h<0&&window.innerHeight-m>o+g));const p=window.innerWidth-v-h;v+h>window.innerWidth&&(u(r).style.left=`${p}px`)}function l(){if(!u(r))return;const{top:o,height:v}=u(r).getBoundingClientRect(),m=s(),g=u(i)?window.innerHeight-o-m:o+v-m;n(Math.min(g,window.innerHeight*.8))}function s(){return parseFloat(getComputedStyle(document.documentElement).fontSize)}var c=qa(),f=S(c),d=S(f);ht(d,()=>t.children),ct(c,o=>L(r,o),()=>u(r)),O(()=>{oe(c,"flip",u(i)),$t(c,"--max-height",n()?n()+"px":null)}),De(3,f,()=>Zt,()=>({duration:100,y:10})),b(e,c),ie()}const Va=[{slug:"100",name:"All",categories:{movie:100,series:100,documentary:100,kids:100,cinema:100,podcasts:100}},{slug:"999",name:"Unscripted",categories:{},media_format:"video"},{slug:"900",name:"Independent",categories:{},media_format:"video"},{slug:"113",name:"Game Show",categories:{series:36,kids:28},media_format:"video"},{slug:"112",name:"Film Noir",categories:{movie:37},media_format:"video"},{slug:"212",name:"Entertainment",categories:{kids:80,series:42,movie:42},media_format:"video"},{slug:"120",name:"News",categories:{series:26,documentary:36,kids:38},media_format:"video"},{slug:"208",name:"Short",categories:{movie:21,documentary:30,kids:36},media_format:"video"},{slug:"902",name:"Bollywood",categories:{},media_format:"video"},{slug:"240",name:"Concert",categories:{movie:45},media_format:"video"},{slug:"901",name:"Arthouse",categories:{},media_format:"video"},{slug:"903",name:"Alternate Version",categories:{},media_format:"video"},{slug:"121",name:"Reality TV",categories:{series:24},media_format:"video"},{slug:"202",name:"Culture",categories:{kids:40,documentary:84,series:44},media_format:"video"},{slug:"107",name:"Drama",categories:{series:82,movie:82,cinema:88,documentary:44},media_format:"video"},{slug:"105",name:"Crime",categories:{series:84,documentary:86,cinema:64,movie:84},media_format:"video"},{slug:"128",name:"Western",categories:{movie:12,series:12,documentary:24},media_format:"video"},{slug:"127",name:"Thriller",categories:{series:70,documentary:28,cinema:80,movie:70},media_format:"video"},{slug:"102",name:"Animation",categories:{series:50,cinema:50,kids:90,documentary:48,movie:50},media_format:"video"},{slug:"119",name:"Mystery",categories:{movie:76,cinema:70,kids:26,documentary:38,series:76},media_format:"video"},{slug:"227",name:"Science",categories:{series:22,kids:46,documentary:74},media_format:"video"},{slug:"108",name:"Nature",categories:{kids:48,documentary:76,series:28},media_format:"video"},{slug:"116",name:"War",categories:{movie:14,documentary:68,series:14,cinema:66},media_format:"video"},{slug:"123",name:"Sci-Fi",categories:{series:72,movie:72,cinema:68,kids:70,documentary:32},media_format:"video"},{slug:"106",name:"Documentary",categories:{kids:50},media_format:"video"},{slug:"232",name:"Stand-up",categories:{movie:18,series:18},media_format:"video"},{slug:"126",name:"Talk Show",categories:{kids:34,series:16},media_format:"video"},{slug:"111",name:"Fantasy",categories:{kids:78,cinema:74,documentary:42,movie:38,series:38},media_format:"video"},{slug:"114",name:"History",categories:{movie:35,kids:44,cinema:10,series:80,documentary:90},media_format:"video"},{slug:"109",name:"Adventure",categories:{kids:88,cinema:86,documentary:82,series:88,movie:88},media_format:"video"},{slug:"101",name:"Action",categories:{documentary:50,kids:86,series:90,cinema:90,movie:90},media_format:"video"},{slug:"124",name:"Horror",categories:{cinema:76,documentary:40,series:78,movie:80},media_format:"video"},{slug:"115",name:"Comedy",categories:{cinema:84,documentary:46,series:86,kids:82,movie:86},media_format:"video"},{slug:"104",name:"Biography",categories:{series:46,documentary:88,cinema:10,movie:46},media_format:"video"},{slug:"118",name:"Music",categories:{kids:72,cinema:9,documentary:78,movie:32,series:32},media_format:"video"},{slug:"125",name:"Sport",categories:{cinema:7,kids:68,series:20,documentary:70,movie:20},media_format:"video"},{slug:"122",name:"Romance",categories:{documentary:34,cinema:78,movie:74,series:74},media_format:"video"},{slug:"103",name:"Kids",categories:{kids:76},media_format:"video"},{slug:"222",name:"Lifestyle",categories:{documentary:80,kids:74,series:34},media_format:"video"},{slug:"117",name:"Musical",categories:{kids:30,movie:78,cinema:8,series:30},media_format:"video"},{slug:"129",name:"Anime",categories:{cinema:5,movie:48,kids:84,series:48},media_format:"video"},{slug:"110",name:"Family",categories:{series:40,cinema:40,movie:40},media_format:"video"}];var Ua=A('<div class="genre svelte-13nhocm"> </div>'),Ka=(e,t)=>L(t,!0),za=A('<button class="genre expand svelte-13nhocm"> </button>'),Wa=A("<!> <!>",1);function Ya(e,t){re(t,!0);let n=F(!1);const r=K(()=>u(n)?t.genres:[t.genres[0]]);var i=Wa(),a=ee(i);Qe(a,17,()=>u(r),xt,(c,f)=>{var d=ze();const o=K(()=>{var g;return(g=Va.find(h=>h.slug===u(f)))==null?void 0:g.name});var v=ee(d);{var m=g=>{var h=Ua(),p=S(h);O(()=>z(p,he(u(o)))),b(g,h)};H(v,g=>{u(o)&&g(m)})}b(c,d)});var l=I(a,2);{var s=c=>{var f=za();f.__click=[Ka,n];var d=S(f);O(()=>z(d,`+${t.genres.length-1}`)),b(c,f)};H(l,c=>{!u(n)&&t.genres.length>1&&c(s)})}b(e,i),ie()}ue(["click"]);function $a(e){let t=[];for(const n of e){let r=n;const i=t.find(s=>s.name===r.name),a=i==null?void 0:i.extra_info.category,l=r.extra_info.category;(a==="RENT"&&l==="BUY"||a==="BUY"&&l==="RENT")&&(t=t.filter(s=>s.name!==r.name),r={...r,extra_info:{...r.extra_info,category:"TVOD"}}),t.push(r)}return t}ki();var Ga=Pe('<svg width="6" height="12" viewBox="0 0 6 12" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M0 11L5 6L0 1" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"></path></svg>');function Za(e){var t=Ga();b(e,t)}var Ja=(e,t,n)=>t(n()),Xa=A('<div class="arrow svelte-1f6ryh6"><!></div>'),Qa=A('<a target="_blank" class="playlink svelte-1f6ryh6" rel="sponsored"><img alt="" height="32" width="32" class="svelte-1f6ryh6"> <div><span class="name svelte-1f6ryh6"> </span> <div class="category svelte-1f6ryh6"> </div></div> <!></a>'),el=A('<div class="playlink empty svelte-1f6ryh6"> </div>'),tl=A('<h2 class="svelte-1f6ryh6"> </h2> <div class="playlinks svelte-1f6ryh6"><!> <!></div>',1);function nl(e,t){re(t,!0);const n=R(t,"list",3,!1),r=ta("scope")==="modal",i=K(()=>t.playlinks.filter(h=>!!h.logo_url)),a=K(()=>$a(u(i))),l={SVOD:he("Stream"),BUY:he("Buy"),RENT:he("Rent"),TVOD:he("Rent Or Buy")};function s(h){Ne(r?Ae.TitleModalPlaylinkClick:Ae.TitlePopoverPlaylinkClick,t.title,{playlink:h})}var c=tl(),f=ee(c),d=S(f);O(()=>z(d,he("Where To Stream Online")));var o=I(f,2),v=S(o);Qe(v,17,()=>u(a),xt,(h,p)=>{let y=()=>u(p).name,w=()=>u(p).url,x=()=>u(p).logo_url,C=()=>u(p).extra_info.category;var k=Qa();k.__click=[Ja,s,y];var E=S(k),j=I(E,2),T=S(j),P=S(T),N=I(T,2),B=S(N);O(()=>z(B,l[C()]||he("Stream")));var W=I(j,2);{var X=te=>{var V=Xa(),U=S(V);Za(U),b(te,V)};H(W,te=>{n()&&te(X)})}O(()=>{ne(k,"href",w()),ne(k,"data-playlink",y()),ne(E,"src",x()),z(P,y())}),b(h,k)});var m=I(v,2);{var g=h=>{var p=el(),y=S(p);O(()=>z(y,he("Title Unavailable"))),b(h,p)};H(m,h=>{t.playlinks.length||h(g)})}O(()=>oe(o,"list",n())),b(e,c),ie()}ue(["click"]);var rl=(e,t)=>L(t,!0),il=A('<button class="show-more svelte-fluzit">Show more</button>'),al=A('<p class="svelte-fluzit"> </p>'),ll=A('<div><span class="paragraph svelte-fluzit"> <!> <!></span> <!></div>');function ol(e,t){re(t,!0);const n=R(t,"blurb",3,""),r=R(t,"limit",3,200);let i=F(!1);const a=K(()=>t.text.slice(0,r()));var l=ll(),s=S(l),c=S(s),f=I(c);{var d=h=>{var p=Ke("...");b(h,p)};H(f,h=>{!u(i)&&t.text.length>r()&&h(d)})}var o=I(f,2);{var v=h=>{var p=il();p.__click=[rl,i],b(h,p)};H(o,h=>{!u(i)&&(t.text.length>r()||n())&&h(v)})}var m=I(s,2);{var g=h=>{var p=al(),y=S(p);O(()=>z(y,n())),b(h,p)};H(m,h=>{u(i)&&h(g)})}O(()=>z(c,u(i)?t.text:u(a))),b(e,l),ie()}ue(["click"]);var sl=A('<div class="participant"> <div class="character svelte-15oguej"> <!></div></div>'),cl=A('<h2 class="svelte-15oguej">Cast</h2> <div class="participants svelte-15oguej"></div>',1);function ul(e,t){var n=cl(),r=I(ee(n),2);Qe(r,21,()=>t.participants,xt,(i,a)=>{var l=sl(),s=S(l),c=I(s),f=S(c);O(()=>{var v;return z(f,((v=u(a).character)==null?void 0:v.slice(0,20))||"")});var d=I(f);{var o=v=>{var m=Ke("...");b(v,m)};H(d,v=>{var m;(m=u(a).character)!=null&&m.length&&v(o)})}O(()=>z(s,`${u(a).name??""} `)),b(i,l)}),b(e,n)}var dl=Pe('<svg width="14" height="14" viewBox="0 0 14 14" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M7 0.351929L9.163 4.72803L14 5.43408L10.5 8.8385L11.326 13.648L7 11.3761L2.674 13.648L3.5 8.8385L0 5.43408L4.837 4.72803L7 0.351929Z" fill="#F6C045"></path></svg>');function zr(e){var t=dl();b(e,t)}var fl=A('<div class="top svelte-urs395"><img class="poster svelte-urs395"></div>'),vl=A("<div> </div>"),_l=A("<!> <!>",1),hl=A('<img alt="" class="svelte-urs395">'),ml=A('<div class="content svelte-urs395" data-playpilot-link-injections-title=""><header class="header svelte-urs395"><!> <h1 class="svelte-urs395"> </h1> <div class="info svelte-urs395"><div class="imdb svelte-urs395"><!> </div> <!> <div> </div> <div class="capitalize svelte-urs395"> </div> <!></div></header> <main class="main"><!> <!></main></div> <div class="background svelte-urs395"><!></div>',1);function Wr(e,t){re(t,!0);const n=R(t,"small",3,!1),r=R(t,"compact",3,!1);let i=F(!1),a=F(!1),l=F(!1);var s=ml(),c=ee(s),f=S(c),d=S(f);{var o=V=>{var U=fl(),ae=S(U);O(()=>{ne(ae,"src",t.title.standing_poster),ne(ae,"alt",`Movie poster for '${t.title.title??""}'`),oe(ae,"loaded",u(i))}),se("load",ae,()=>L(i,!0)),b(V,U)};H(d,V=>{r()||V(o)})}var v=I(d,2),m=S(v),g=I(v,2),h=S(g),p=S(h);zr(p);var y=I(p),w=I(h,2);Ya(w,{get genres(){return t.title.genres}});var x=I(w,2),C=S(x),k=I(x,2),E=S(k);O(()=>z(E,he(`Type: ${t.title.type}`)));var j=I(k,2);{var T=V=>{var U=vl(),ae=S(U);O(()=>z(ae,`${t.title.length??""} ${he("Minutes")??""}`)),b(V,U)};H(j,V=>{!n()&&t.title.length&&V(T)})}var P=I(f,2),N=S(P);nl(N,{get playlinks(){return t.title.providers},get title(){return t.title},list:!0});var B=I(N,2);{var W=V=>{var U=_l(),ae=ee(U);ol(ae,{get text(){return t.title.description},get blurb(){return t.title.blurb}});var ke=I(ae,2);{var ge=Re=>{ul(Re,{get participants(){return t.title.participants}})};H(ke,Re=>{var Se;(Se=t.title.participants)!=null&&Se.length&&Re(ge)})}b(V,U)};H(B,V=>{n()||V(W)})}var X=I(c,2),te=S(X);Dr(te,()=>u(l),V=>{var U=hl();O(()=>{ne(U,"src",u(l)?t.title.standing_poster:t.title.medium_poster),oe(U,"loaded",u(a)),oe(U,"blur",u(l))}),se("load",U,()=>L(a,!0)),se("error",U,()=>L(l,!0)),b(V,U)}),O(()=>{ne(c,"data-playpilot-original-title",t.title.original_title),oe(c,"small",n()),oe(c,"compact",r()),oe(v,"truncate",n()),z(m,t.title.title),z(y,` ${t.title.imdb_score??""}`),z(C,t.title.year),oe(X,"faded",r())}),b(e,s),ie()}function gl(e,t){re(t,!0);let n=F(0);Ne(Ae.TitlePopoverView,t.title),Ba(e,{get maxHeight(){return u(n)},set maxHeight(r){L(n,Y(r))},children:(r,i)=>{var a=K(()=>u(n)<250);Wr(r,{get title(){return t.title},small:!0,get compact(){return u(a)}})},$$slots:{default:!0}}),ie()}var pl=(e,t,n,r)=>t(u(n).title_details,u(r)),yl=A(' <span class="svelte-6p0hvs"><button class="svelte-6p0hvs"> </button></span>',1),wl=(e,t,n,r)=>t(u(n).title_details,r()),kl=A('<!> <a target="_blank"> </a>',1),bl=A(" <!>.",1),xl=A("<!> <br>",1),Sl=A(" <br>",1),El=A('<span class="svelte-6p0hvs"><!></span>'),Tl=A("<p></p>");function Il(e,t){re(t,!0);const n=R(t,"onclickmodal",3,c=>null);function r(c,f){Ne(Ae.AfterArticlePlaylinkClick,c,{playlink:f})}function i(c,f){Ne(Ae.AfterArticleModalButtonClick,c),n()(f)}var a=ze(),l=ee(a);{var s=c=>{var f=Tl();Qe(f,21,()=>t.linkInjections,xt,(d,o)=>{var v=El();const m=K(()=>{const{key:w,title:x,title_details:C,after_article_style:k}=u(o);return{key:w,title:x,title_details:C,after_article_style:k}}),g=K(()=>{var w;return((w=u(m).title_details)==null?void 0:w.providers)||[]});var h=S(v);{var p=w=>{var x=xl(),C=ee(x);{var k=j=>{var T=yl(),P=ee(T);O(()=>z(P,`"${u(m).title??""}" ${he("Is Available To Stream")??""} `));var N=I(P),B=S(N);B.__click=[pl,i,m,o];var W=S(B);O(()=>z(W,he("View Streaming Options"))),b(j,T)},E=j=>{var T=bl(),P=ee(T);O(()=>z(P,`"${u(m).title??""}" ${he("Is Available To Stream On")??""} `));var N=I(P);Qe(N,17,()=>u(g),xt,(B,W,X)=>{let te=()=>u(W).name,V=()=>u(W).url;var U=kl(),ae=ee(U);{var ke=Se=>{var Z=Ke();O(()=>z(Z,X===u(g).length-1?`, ${he("And")}`:",")),b(Se,Z)};H(ae,Se=>{X&&Se(ke)})}var ge=I(ae,2);ge.__click=[wl,r,m,te];var Re=S(ge);O(()=>{ne(ge,"href",V()),z(Re,te())}),b(B,U)}),b(j,T)};H(C,j=>{u(m).after_article_style==="modal_button"?j(k):j(E,!1)})}b(w,x)},y=w=>{var x=Sl(),C=ee(x);O(()=>z(C,`"${u(m).title??""}" ${he("Title Unavailable Suffix")??""} `)),b(w,x)};H(h,w=>{u(g).length?w(p):w(y,!1)})}O(()=>ne(v,"data-playpilot-injection-key",u(m).key)),b(d,v)}),b(c,f)};H(l,c=>{t.linkInjections.length&&c(s)})}b(e,a),ie()}ue(["click"]);function Al(e){const t=document.createElement("div");return t.textContent=e,t.innerHTML}function xn(e){const t=document.createElement("div");return t.innerHTML=e,t.textContent||""}function Cl(e,t,n=[]){var a,l;const r=document.createTreeWalker(t);let i;for(;(i=r.nextNode())&&!((a=i.nodeValue)!=null&&a.includes(e)&&!n.includes(((l=i.parentNode)==null?void 0:l.nodeName)||"")););return i}function Pl(e){const t=e.parentNode;return t?t.nodeName==="A"||!!t.closest("a"):!1}function Ll(e,t,n,r){const i=Al(t),a=xn(t),l=e.slice(0,r),s=e.slice(r),c=/[-/\\^$*+?.()|[\]{}]/g,f=new RegExp(`${a.replace(c,"\\$&")}|${i.replace(c,"\\$&")}`),d=s.replace(f,n);return l+d}function it(e){return xn(e).toLowerCase().replace(/\s+/g,"")}function Ml(e,t,n){const i=e.indexOf(t),a=Math.floor((n-t.length)/2);let l=Math.max(0,i-a),s=l+n;s>e.length&&(s=e.length,l=Math.max(0,s-n));let c=e.slice(l,s).trim();return l>0&&(c="…"+c),s<e.length&&(c+="…"),c}function Dl(e){let t=0;for(let n=0;n<e.length;n++)e[n]>t&&(t=e[n]);return t}const Sn="data-playpilot-injection-key",En=`[${Sn}]`,ut={};let jt=null;function jl(e){let t=[],n=[e];for(;n.length>0;){const r=n.pop();if(/^(A|BUTTON|SCRIPT|NOSCRIPT|STYLE|IFRAME|H[1-6])$/.test(r.tagName))continue;if(Array.from(r.childNodes).some(l=>{var s;return l.nodeType===Node.TEXT_NODE&&((s=l.nodeValue)==null?void 0:s.trim())!==""})){t.push(r);continue}const a=Array.from(r.children);for(let l=a.length-1;l>=0;l--)n.push(a[l])}return t}function Tn(){var t;const e=(t=window.PlayPilotLinkInjections)==null?void 0:t.selector;if(e){const n=e.replace(/(:)/g,"\\$1"),r=document.querySelector(n);if(r)return r}return document.querySelector("article")||document.querySelector("main")||document.body}function Nl(e,t,n={aiInjections:[],manualInjections:[]}){var d;const r=Ul(n),i=e.map(o=>o.innerText).join(" "),a=zl(r),l=a.filter(o=>it(i).includes(it(o.sentence))),s={};for(const o of l){const v=e.findIndex(x=>it(x.innerText).includes(it(o.sentence))),m=e[v];if(!m)continue;const g=Cl(o.title,m,["A"]);if(!g||Pl(g))continue;const h=document.createElement("span");h.dataset.playpilotInjectionKey=o.key;const p=document.createElement("a");p.innerText=o.title,p.href=o.playpilot_url,p.dataset.playpilotOriginalTitle=(d=o.title_details)==null?void 0:d.original_title,p.target="_blank",p.rel="noopener nofollow noreferrer",h.insertAdjacentElement("beforeend",p);const y=Dl(Object.values(s).filter(x=>x.elementIndex===v).map(x=>x.to));m.innerHTML=Ll(m.innerHTML,o.title,h.outerHTML,y);const w=m.innerHTML.indexOf(h.outerHTML);s[o.key]={elementIndex:v,from:w,to:w+h.outerHTML.length}}Rl(a,t),Ol();const c=Wl(r);return c.length&&ql(e,c,t),Vl(r,s).filter(o=>o.title_details).map((o,v)=>{const m=!o.inactive&&!o.after_article&&!document.querySelector(`[${Sn}="${o.key}"]`),g=o.duplicate??(!o.manual&&Yl(o,v,r));return{...o,inactive:o.inactive??!1,duplicate:g,failed:m}})}function Ol(){const e=Array.from(document.querySelectorAll(`${En} a`)),t=["--playpilot-injection-text-color","--playpilot-injection-text-color-hover","--playpilot-injection-font-weight","--playpilot-injection-text-decoration","--playpilot-injection-text-decoration-hover","--playpilot-injection-background-color","--playpilot-injection-background-color-hover"];e.forEach(n=>{t.forEach(r=>{getComputedStyle(n).getPropertyValue(r)&&(n.dataset.usedCssVariables=`${n.dataset.usedCssVariables||""} ${r}`)})})}function Rl(e,t){window.addEventListener("click",r=>{const i=r.target;if(!(i!=null&&i.parentElement))return;const a=i.parentElement.getAttribute(Sn);if(!a)return;const l=e.find(s=>a===s.key);l&&Hl(r,l,t)}),Array.from(document.querySelectorAll(En)).forEach(r=>{const i=r.dataset.playpilotInjectionKey,a=e.find(l=>i===l.key);a&&(r.addEventListener("mouseenter",l=>Fl(l,a)),r.addEventListener("mouseleave",()=>Ft(a)))})}function Hl(e,t,n){e.ctrlKey||e.metaKey||e.button!==0||(e.preventDefault(),n(t),Ft(t))}function Fl(e,t){if(ut[t.key]||window.matchMedia("(pointer: coarse)").matches)return;const n=e.currentTarget,r=kn(gl,{target:n,props:{title:t.title_details}});ut[t.key]={injection:t,component:r}}function Ft(e,t=!0){const n=ut[e.key];n&&(Mr(n.component,{outro:t}),delete ut[e.key])}function ql(e,t,n){if(!t.length)return;const r=document.createElement("div");r.dataset.playpilotAfterArticlePlaylinks="true",e[e.length-1].insertAdjacentElement("afterend",r),jt=kn(Il,{target:r,props:{linkInjections:t,onclickmodal:n}})}function Bl(){var e;jt&&(Mr(jt),(e=document.querySelector("[data-playpilot-after-article-playlinks]"))==null||e.remove(),jt=null)}function un(){Object.values(ut).forEach(t=>Ft(t.injection)),document.querySelectorAll(En).forEach(t=>t.outerHTML=t.textContent||""),Object.values(ut).forEach(({injection:t})=>Ft(t,!1)),Bl()}function Vl(e,t){return e.sort((n,r)=>{const i=t[n.key],a=t[r.key];return!i&&a?1:i&&!a?-1:!i&&!a?0:(i==null?void 0:i.elementIndex)!==(a==null?void 0:a.elementIndex)?((i==null?void 0:i.elementIndex)||0)-((a==null?void 0:a.elementIndex)||0):((i==null?void 0:i.from)||0)-((a==null?void 0:a.from)||0)})}function Ul({aiInjections:e,manualInjections:t}){return[...e,...t.map(n=>({...n,manual:!0}))]}function Kl(e){return{aiInjections:e.filter(t=>!t.manual),manualInjections:e.filter(t=>t.manual)}}function In(e){return!e.inactive&&!e.removed&&!e.duplicate&&!!e.title_details}function zl(e){return Yr(e).filter(t=>t.in_text!==!1&&In(t))}function Wl(e){return Yr(e).filter(t=>t.after_article===!0&&In(t))}function Yr(e){return e.filter(t=>t.removed||t.inactive?!1:t.manual&&!t.removed&&!t.inactive?!0:!e.some(n=>n.manual&&(n.removed||n.inactive)&&An(n,t)))}function Yl(e,t,n){return n.some((r,i)=>t!==i&&r.manual&&An(r,e))}function An(e,t){return e.title===t.title&&it(e.sentence)===it(t.sentence)}function $l(){const e=Tn();return{heading:Gl(e),modified_time:Zl(e),published_time:Jl(e)}}function Gl(e){const t=e.querySelector("h1")||document.querySelector("h1");return(t==null?void 0:t.innerText.trim())||null}function Zl(e){const t=document.querySelector('meta[property*="modified_time"]')||e.querySelector('[itemprop="dateModified"]')||document.querySelector('[itemprop="dateModified"]')||null,n=(t==null?void 0:t.getAttribute("content"))||(t==null?void 0:t.getAttribute("datetime"))||(t==null?void 0:t.innerText);return n?$r(n):null}function Jl(e){const t=document.querySelector('meta[property*="published_time"]')||e.querySelector('[itemprop="datePublished"]')||document.querySelector('[itemprop="datePublished"]')||e.querySelector("time")||document.querySelector("time")||e.querySelector("[datetime]")||document.querySelector("[datetime]")||null,n=(t==null?void 0:t.getAttribute("content"))||(t==null?void 0:t.getAttribute("datetime"))||(t==null?void 0:t.innerText);return n?$r(n):null}function $r(e){try{return new Date(e).toISOString()}catch{return null}}function Gr(){return location.protocol+"//"+location.host+location.pathname}let en=null;async function Zr(e,t,{hash:n=Vr(t),params:r={}}={}){const i=new Headers({"Content-Type":"application/json"}),a=Jt(),l=Br()?await Fr():!1,s=Ur(),c=$l();if(!a)throw new Error("No token was provided");const f=await fetch(Gt+`/external-pages/?api-token=${a}&include_title_details=true${l?"&editorial_mode_enabled=true":""}&language=${s}`,{headers:i,method:"POST",body:JSON.stringify({hash:n,url:e,metadata:c,page_text:t,...r})});if(!f.ok)throw f;return await f.json()}async function zn(e,t,{requireCompletedResult:n=!1,pollInterval:r=3e3,maxTries:i=600}={}){let a=Vr(t),l=0;en&&clearTimeout(en);const s=async(c,f)=>{try{const d=await Zr(e,t,{hash:a});if(n&&d.automation_enabled&&d.ai_running)throw new Error;d.link_injections=Wn(d.link_injections||[]),d.ai_injections=Wn(d.ai_injections||[]),c(d);return}catch{if(l++,l>=i){i>1&&console.error("Max poll limit exceeded. Please return later."),c();return}en=setTimeout(()=>s(c),r)}};return new Promise(s)}async function Xl(e,t){var l;const n=(l=window.PlayPilotLinkInjections)==null?void 0:l.selector,i=e.filter(s=>s.manual).map(s=>({sid:s.sid,title:s.title,sentence:s.sentence,playpilot_url:s.playpilot_url,after_article:!!s.after_article,after_article_style:s.after_article_style||null,in_text:s.in_text??!0,inactive:!!s.inactive,removed:!!s.removed}));if(!await Zr(Gr(),t,{params:{private_token:qr(),automation_enabled:!1,link_injections:i,text_selector:n}}))throw new Error("saveLinkInjections response was faulty");return e}async function Ql(){const e=new Headers({"Content-Type":"application/json"}),t=Jt();if(!t)throw new Error("No token was provided");const n=await fetch(Gt+`/domains/config?api-token=${t}`,{headers:e});if(!n.ok)throw n;try{return await n.json()||null}catch{return null}}function Wn(e){return e.map(t=>({...t,key:Jr(t.sid)}))}function Jr(e){return e+"-"+(Math.random()+1).toString(36).substring(7)}function Jt(){var e;return(e=window.PlayPilotLinkInjections)==null?void 0:e.token}var eo=Pe('<svg width="16" height="16" viewBox="0 0 16 16" fill="none"><path d="M14 2L2 14M2 2L14 14" stroke="currentColor" stroke-width="1.33" stroke-linecap="round" stroke-linejoin="round"></path></svg>');function to(e){var t=eo();b(e,t)}function Cn(e,t){re(t,!0);const n=R(t,"size",3,"margin(2)"),r=R(t,"onclick",3,()=>null),i=La(t,["$$slots","$$events","$$legacy","children","size","onclick"]);var a=ze(),l=ee(a);ya(l,()=>t.href?"a":"button",!1,(s,c)=>{let f;O(()=>{f=xa(s,f,{role:t.href?"link":"button",onclick:r(),class:"button",...i},"svelte-1qqv88o",s.namespaceURI===nr,s.nodeName.includes("-")),$t(s,"--size",n())});var d=ze(),o=ee(d);ht(o,()=>t.children??Ye),b(c,d)}),b(e,a),ie()}var no=(e,t)=>t()(),ro=A('<div class="modal svelte-1riopfw"><div class="dialog svelte-1riopfw" role="dialog"><div class="close svelte-1riopfw"><!></div> <!></div> <div class="backdrop svelte-1riopfw"></div></div>');function io(e,t){re(t,!0);const n=R(t,"onclose",3,()=>null),r=R(t,"onscroll",3,()=>null);Ir("scope","modal"),nt(()=>{const o=document.body.style.overflowY;return document.body.style.overflowY="hidden",()=>document.body.style.overflowY=o||""});function i(o){return window.innerWidth<600?Zt(o,{duration:250,y:window.innerHeight}):Fa(o,{duration:150,start:.85})}var a=ro();se("keydown",ve,({key:o})=>{o==="Escape"&&n()()});var l=S(a),s=S(l),c=S(s);Cn(c,{onclick:()=>n()(),children:(o,v)=>{to(o)},$$slots:{default:!0}});var f=I(s,2);ht(f,()=>t.children);var d=I(l,2);d.__click=[no,n],se("scroll",l,function(...o){var v;(v=r())==null||v.apply(this,o)}),De(3,l,()=>i),De(3,a,()=>Kr,()=>({duration:150})),b(e,a),ie()}ue(["click"]);function ao(e,t){re(t,!0),Ne(Ae.TitleModalView,t.title);let n=!1;function r(){n||(Ne(Ae.TitleModalScroll,t.title),n=!0)}io(e,{get onclose(){return t.onclose},onscroll:r,children:(i,a)=>{Wr(i,{get title(){return t.title}})},$$slots:{default:!0}}),ie()}var lo=Pe('<svg width="8" height="4" viewBox="0 0 8 4" fill="none" class="svelte-by11ix"><path d="M1 0.5L4 3.5L7 0.5" stroke="currentColor" stroke-width="0.9975" stroke-linecap="round" stroke-linejoin="round"></path></svg>');function oo(e,t){const n=R(t,"expanded",3,!1);var r=lo();O(()=>oe(r,"expanded",n())),b(e,r)}function so(e,t,n){t(!t()),n()(t())}var co=A('<button class="switch svelte-91s87b"><div class="label svelte-91s87b"><!></div> <div class="track svelte-91s87b"><div class="knob svelte-91s87b"></div></div></button>');function dn(e,t){re(t,!0);let n=R(t,"active",15),r=R(t,"fullwidth",3,!1),i=R(t,"label",3,""),a=R(t,"onclick",3,()=>null);var l=co();l.__click=[so,n,a];var s=S(l),c=S(s);ht(c,()=>t.children),O(()=>{ne(l,"aria-label",`Toggle ${i()??""} ${(n()?"off":"on")??""}`),oe(l,"active",n()),oe(l,"fullwidth",r())}),b(e,l),ie()}ue(["click"]);var uo=A('<input type="text" class="svelte-1vrer3i">');function Pn(e,t){let n=R(t,"value",15),r=R(t,"label",3,""),i=R(t,"name",3,""),a=R(t,"readonly",3,!1),l=R(t,"oninput",3,()=>null);var s=uo();s.__input=function(...c){var f;(f=l())==null||f.apply(this,c)},O(()=>{ne(s,"name",i()),ne(s,"aria-label",r()),ne(s,"placeholder",r()),s.readOnly=a()}),Aa(s,n),b(e,s)}ue(["input"]);var fo=Pe('<path d="M13.5833 13.6667L4.41667 13.6667M5.5 1.5H12.5C13.9001 1.5 14.6002 1.5 15.135 1.77248C15.6054 2.01217 15.9878 2.39462 16.2275 2.86502C16.5 3.3998 16.5 4.09987 16.5 5.5V12.5C16.5 13.9001 16.5 14.6002 16.2275 15.135C15.9878 15.6054 15.6054 15.9878 15.135 16.2275C14.6002 16.5 13.9001 16.5 12.5 16.5H5.5C4.09987 16.5 3.3998 16.5 2.86502 16.2275C2.39462 15.9878 2.01217 15.6054 1.77248 15.135C1.5 14.6002 1.5 13.9001 1.5 12.5V5.5C1.5 4.09987 1.5 3.3998 1.77248 2.86502C2.01217 2.39462 2.39462 2.01217 2.86502 1.77248C3.3998 1.5 4.09987 1.5 5.5 1.5Z" stroke="currentColor" stroke-width="1.25" stroke-linecap="round" stroke-linejoin="round"></path>'),vo=Pe('<path d="M13.5833 8.58342H4.41667M5.5 1.50009H12.5C13.9001 1.50009 14.6002 1.50009 15.135 1.77258C15.6054 2.01226 15.9878 2.39471 16.2275 2.86512C16.5 3.39989 16.5 4.09996 16.5 5.50009V12.5001C16.5 13.9002 16.5 14.6003 16.2275 15.1351C15.9878 15.6055 15.6054 15.9879 15.135 16.2276C14.6002 16.5001 13.9001 16.5001 12.5 16.5001H5.5C4.09987 16.5001 3.3998 16.5001 2.86502 16.2276C2.39462 15.9879 2.01217 15.6055 1.77248 15.1351C1.5 14.6003 1.5 13.9002 1.5 12.5001V5.50009C1.5 4.09996 1.5 3.39989 1.77248 2.86512C2.01217 2.39471 2.39462 2.01226 2.86502 1.77258C3.3998 1.50009 4.09987 1.50009 5.5 1.50009Z" stroke="currentColor" stroke-width="1.25" stroke-linecap="round" stroke-linejoin="round"></path>'),_o=Pe('<svg width="18" height="18" viewBox="0 0 18 18" fill="none"><!></svg>');function Yn(e,t){const n=R(t,"align",3,"bottom");var r=_o(),i=S(r);{var a=s=>{var c=fo();b(s,c)},l=s=>{var c=ze(),f=ee(c);{var d=o=>{var v=vo();b(o,v)};H(f,o=>{n()==="center"&&o(d)},!0)}b(s,c)};H(i,s=>{n()==="bottom"?s(a):s(l,!1)})}b(e,r)}var ho=A("<!> In-text Playlink",1),mo=A("<!> Bottom Playlink",1),go=(e,t)=>t().after_article_style="playlinks",po=(e,t)=>t().after_article_style="modal_button",yo=A('<div><div class="label svelte-14krcvc">Bottom playlinks style</div> <div class="group svelte-14krcvc" role="listbox" tabindex="0" aria-label="Playlink type"><button role="option" id="playlinks-in-text" class="svelte-14krcvc">Playlinks sentence</button> <button role="option" id="playlinks-after-article" class="svelte-14krcvc">Modal button</button> <div class="active-marker svelte-14krcvc"></div></div></div>'),wo=A('<div class="switches svelte-14krcvc"><!> <!></div> <!>',1);function ko(e,t){re(t,!0);const n=R(t,"linkInjection",7),r=K(()=>n().after_article_style==="modal_button");var i=wo(),a=ee(i),l=S(a),s=K(()=>n().in_text??!0);dn(l,{fullwidth:!0,get active(){return u(s)},onclick:v=>{n().in_text=v,n().manual=!0},label:"In-text Playlink",children:(v,m)=>{var g=ho(),h=ee(g);Yn(h,{align:"center"}),b(v,g)},$$slots:{default:!0}});var c=I(l,2),f=K(()=>n().after_article??!1);dn(c,{fullwidth:!0,get active(){return u(f)},onclick:v=>{n().after_article=v,n().manual=!0},label:"Bottom Playlink",children:(v,m)=>{var g=mo(),h=ee(g);Yn(h,{align:"bottom"}),b(v,g)},$$slots:{default:!0}});var d=I(a,2);{var o=v=>{var m=yo(),g=I(S(m),2),h=S(g);h.__click=[go,n];var p=I(h,2);p.__click=[po,n];var y=I(p,2);O(()=>{ne(g,"aria-activedescendant",`playlinks-${(u(r)?"after-article":"in-text")??""}`),ne(h,"aria-selected",!u(r)||null),oe(h,"active",!u(r)),ne(p,"aria-selected",u(r)||null),oe(p,"active",u(r)),oe(y,"right",u(r))}),De(3,m,()=>Ht,()=>({duration:100})),b(v,m)};H(d,v=>{n().after_article&&v(o)})}b(e,i),ie()}ue(["click"]);var bo=A('<div class="alert svelte-1tq7qhv"><!></div>');function Ln(e,t){re(t,!0);var n=bo(),r=S(n);ht(r,()=>t.children),b(e,n),ie()}var xo=Pe('<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M9.99984 10.8333C10.4601 10.8333 10.8332 10.4602 10.8332 10C10.8332 9.53977 10.4601 9.16668 9.99984 9.16668C9.5396 9.16668 9.1665 9.53977 9.1665 10C9.1665 10.4602 9.5396 10.8333 9.99984 10.8333Z" stroke="currentColor" stroke-width="1.66667" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.99984 5.00001C10.4601 5.00001 10.8332 4.62691 10.8332 4.16668C10.8332 3.70644 10.4601 3.33334 9.99984 3.33334C9.5396 3.33334 9.1665 3.70644 9.1665 4.16668C9.1665 4.62691 9.5396 5.00001 9.99984 5.00001Z" stroke="currentColor" stroke-width="1.66667" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.99984 16.6667C10.4601 16.6667 10.8332 16.2936 10.8332 15.8333C10.8332 15.3731 10.4601 15 9.99984 15C9.5396 15 9.1665 15.3731 9.1665 15.8333C9.1665 16.2936 9.5396 16.6667 9.99984 16.6667Z" stroke="currentColor" stroke-width="1.66667" stroke-linecap="round" stroke-linejoin="round"></path></svg>');function So(e){var t=xo();b(e,t)}var Eo=(e,t)=>L(t,!u(t)),To=A('<div class="content svelte-1fmy0wh"><!></div>'),Io=A('<div class="context-menu svelte-1fmy0wh"><button class="svelte-1fmy0wh"><!></button> <!></div>');function Ao(e,t){re(t,!0);let n=F(!1),r=F(null);function i(d){var v;const o=d.target;o===u(r)||(v=u(r))!=null&&v.contains(o)||L(n,!1)}var a=Io();se("click",ve,i);var l=S(a);l.__click=[Eo,n];var s=S(l);So(s),ct(l,d=>L(r,d),()=>u(r));var c=I(l,2);{var f=d=>{var o=To(),v=S(o);ht(v,()=>t.children),De(1,o,()=>Zt,()=>({duration:150,y:5})),b(d,o)};H(c,d=>{u(n)&&d(f)})}O(()=>{ne(l,"aria-label",t.ariaLabel),ne(l,"aria-expanded",u(n))}),b(e,a),ie()}ue(["click"]);function Co(e,t,n){requestAnimationFrame(()=>t());const r=e.target;if(["BUTTON","INPUT"].includes(r.nodeName)||r.closest("button")||r.closest("input"))return;const i=n()[0];i&&i.scrollIntoView({behavior:"smooth"})}var Po=(e,t)=>L(t,!u(t)),Lo=A('<button class="expand-sentence svelte-1lxtpkd"> </button>'),Mo=A('<button class="context-menu-action svelte-1lxtpkd">Remove</button>'),Do=(e,t)=>L(t,!u(t)),jo=A('<div class="actions svelte-1lxtpkd"><button class="expand svelte-1lxtpkd" aria-label="Expand"><!></button> <!></div>'),No=A('<div class="expanded svelte-1lxtpkd"><div class="label svelte-1lxtpkd">Link URL</div> <!> <div class="label offset svelte-1lxtpkd">Layout options</div> <div class="type-select svelte-1lxtpkd"><!></div></div>'),Oo=A('<div class="item svelte-1lxtpkd"><div class="header svelte-1lxtpkd"><img class="poster svelte-1lxtpkd" alt="" width="32" height="48"> <div class="info svelte-1lxtpkd"><div class="title svelte-1lxtpkd"> </div> <div class="sentence svelte-1lxtpkd"><!> <!></div></div> <div class="context-menu svelte-1lxtpkd"><!></div></div> <div class="content svelte-1lxtpkd"><!> <!></div></div>');function Ro(e,t){re(t,!0);const n=R(t,"linkInjection",15),r=R(t,"onremove",3,()=>null),i=R(t,"onhighlight",3,()=>null),a=K(()=>n()||{}),l=K(()=>u(a).key),s=K(()=>u(a).sentence),c=K(()=>u(a).title_details),f=K(()=>u(a).failed),d=K(()=>u(a).inactive),o=K(()=>u(c)),v=K(()=>Ml(n().sentence,n().title,60));let m=F(!1),g=F(!1),h=F(!1),p=F(null);nt(()=>{u(f)&&Ne(Ae.InjectionFailed,u(o),{phrase:n().title,sentence:u(s)})});function y(Z=!0){x().forEach(le=>{le.classList.toggle("injection-highlight",Z)})}function w(Z){let Q=Z.target,le=Q==null?void 0:Q.dataset.playpilotInjectionKey;Q&&!le&&(Q=Q.closest(`[data-playpilot-injection-key="${u(l)}"]`),le=Q==null?void 0:Q.dataset.playpilotInjectionKey),L(h,le===u(l)),u(p)&&u(h)&&i()(u(p))}function x(){return Array.from(document.querySelectorAll(`[data-playpilot-injection-key="${u(l)}"]`))}var C=Oo();se("mouseover",ve,w),C.__click=[Co,y,x];var k=S(C),E=S(k),j=I(E,2),T=S(j),P=S(T),N=I(T,2),B=S(N);pa(B,()=>(u(g)?u(s):u(v)).replace(n().title,`<em>${n().title}</em>`));var W=I(B,2);{var X=Z=>{var Q=Lo();Q.__click=[Po,g];var le=S(Q);O(()=>z(le,u(g)?"Less":"More")),b(Z,Q)};H(W,Z=>{u(v).length<u(s).length&&Z(X)})}var te=I(j,2),V=S(te);Ao(V,{ariaLabel:"More options",children:(Z,Q)=>{var le=Mo();le.__click=function(...M){var D;(D=r())==null||D.apply(this,M)},b(Z,le)},$$slots:{default:!0}});var U=I(k,2),ae=S(U);{var ke=Z=>{Ln(Z,{children:(Q,le)=>{var M=Ke("A match was found, but the link could not be injected.");b(Q,M)},$$slots:{default:!0}})},ge=Z=>{var Q=jo(),le=S(Q);le.__click=[Do,m];var M=S(le);oo(M,{get expanded(){return u(m)}});var D=I(le,2),J=K(()=>u(d)?"Inactive":"Visible"),me=K(()=>!n().inactive);dn(D,{get label(){return u(J)},get active(){return u(me)},onclick:be=>{n(n().inactive=!be,!0),n(n().manual=!0,!0)},children:(be,We)=>{var Ee=Ke();O(()=>z(Ee,u(d)?"Inactive":"Visible")),b(be,Ee)},$$slots:{default:!0}}),O(()=>ne(le,"aria-expanded",u(m))),b(Z,Q)};H(ae,Z=>{u(f)?Z(ke):Z(ge,!1)})}var Re=I(ae,2);{var Se=Z=>{var Q=No(),le=I(S(Q),2);Pn(le,{oninput:()=>n(n().manual=!0,!0),label:"Playlink URL",get value(){return n().playpilot_url},set value(J){n(n().playpilot_url=J,!0)}});var M=I(le,4),D=S(M);ko(D,{get linkInjection(){return n()}}),De(3,Q,()=>Ht,()=>({duration:100})),b(Z,Q)};H(Re,Z=>{u(m)&&Z(Se)})}ct(C,Z=>L(p,Z),()=>u(p)),O(()=>{oe(C,"highlighted",u(h)),oe(C,"inactive",u(d)),ne(E,"src",u(o).standing_poster),z(P,u(o).title)}),se("mouseenter",C,()=>y(!0)),se("mouseleave",C,()=>y(!1)),De(6,C,()=>Ht,()=>({duration:200})),b(e,C),ie()}ue(["click"]);var Ho=A('<button class="drag-handle svelte-19mcc5g" aria-label="Move editor"></button>');function Fo(e,t){re(t,!0);let n=R(t,"element",7),r=R(t,"position",23,()=>({x:0,y:0})),i=R(t,"limit",19,()=>({x:0,y:0})),a=R(t,"onchange",3,()=>null),l=!1,s={x:0,y:0},c=r();nt(()=>{f(r().x,r().y)});function f(h,p){const y=window.innerWidth,w=window.innerHeight,x=n().clientWidth,C=n().clientHeight;h=Math.min(Math.max(h,i().x),y-x-i().x),p=Math.min(Math.max(p,i().y),w-C-i().y),n().style.right=h+"px",n().style.bottom=Math.max(p,i().y)+"px",r({x:h,y:p}),a()(r())}function d(h){var p,y;return{x:h.pageX||((p=h.touches)==null?void 0:p[0].pageX)||0,y:h.pageY||((y=h.touches)==null?void 0:y[0].pageY)||0}}function o(h){l=!0,s=d(h),c=r()}function v(h){if(!l)return;const p=d(h),y=p.x-s.x,w=p.y-s.y,x=c.x-y,C=c.y-w;f(x,C)}function m(){l&&(l=!1)}var g=Ho();se("mousemove",ve,v),se("touchmove",ve,v,void 0,!0),se("mouseup",ve,m),se("touchend",ve,m),se("resize",ve,()=>f(r().x,r().y)),g.__mousedown=o,g.__touchstart=o,b(e,g),ie()}ue(["mousedown","touchstart"]);var qo=A('<button class="resize-handle svelte-1367ri6" aria-label="Move editor"></button>');function Bo(e,t){re(t,!0);let n=R(t,"element",7),r=R(t,"height",7,200),i=R(t,"onchange",3,()=>null);const a=16;let l=!1,s=0,c=r();nt(()=>{f(r())});function f(h){const p=window.getComputedStyle(n()).minHeight||"0",y=Math.max(parseInt(p),Math.min(h,m()));n().style.height=`${y}px`,r(y),i()(y)}function d(h){var p,y;l=!0,s=h.pageY||((y=(p=h.touches)==null?void 0:p[0])==null?void 0:y.pageY)||0,c=n().clientHeight}function o(h){var x,C;if(!l)return;const p=h.pageY||((C=(x=h.touches)==null?void 0:x[0])==null?void 0:C.pageY)||0,y=s-p,w=c+y;f(w)}function v(){l=!1}function m(){const h=window.innerHeight-n().getBoundingClientRect().bottom;return Math.max(window.innerHeight-a*2-h,0)}var g=qo();se("mousemove",ve,o),se("touchmove",ve,o,void 0,!0),se("mouseup",ve,v),se("touchend",ve,v),se("resize",ve,()=>f(r())),g.__mousedown=d,g.__touchstart=d,b(e,g),ie()}ue(["mousedown","touchstart"]);var Vo=Pe('<svg width="4" height="8" viewBox="0 0 4 8" fill="none"><path d="M3.5 7L0.5 4L3.5 1" stroke="currentcolor" stroke-width="0.9975" stroke-linecap="round" stroke-linejoin="round"></path></svg>');function Uo(e){var t=Vo();b(e,t)}async function Ko(e){const t=new Headers({"Content-Type":"application/json"}),n=Jt();if(!n)throw new Error("No token was provided");const r=await fetch(Gt+`/search/titles/?api-token=${n}&query=${e}`,{headers:t});if(!r.ok)throw r;return await r.json()}var zo=Pe('<svg viewBox="0 -960 960 960" width="18" height="18"><path fill="currentColor" d="M200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h280v80H200v560h560v-280h80v280q0 33-23.5 56.5T760-120H200Zm188-212-56-56 372-372H560v-80h280v280h-80v-144L388-332Z"></path></svg>');function Wo(e){var t=zo();b(e,t)}var Yo=A("<div> </div>"),$o=e=>e.stopImmediatePropagation(),Go=A('<button class="item svelte-tbzvlp"><img class="poster svelte-tbzvlp" alt="" width="28" height="42"> <div class="content"><div class="name svelte-tbzvlp"> </div> <div class="meta svelte-tbzvlp"><div class="imdb svelte-tbzvlp"><!> </div> <div> </div> <div> </div> <!></div></div> <a target="_blank" class="open-in-new-tab svelte-tbzvlp"><!></a></button>');function $n(e,t){re(t,!0);const n=R(t,"hoverable",3,!0),r=R(t,"onclick",3,()=>null);var i=Go();i.__click=function(...k){var E;(E=r())==null||E.apply(this,k)};var a=S(i),l=I(a,2),s=S(l),c=S(s),f=I(s,2),d=S(f),o=S(d);zr(o);var v=I(o),m=I(d,2),g=S(m),h=I(m,2),p=S(h),y=I(h,2);{var w=k=>{var E=Yo(),j=S(E);O(()=>z(j,`${t.title.length??""} min`)),b(k,E)};H(y,k=>{t.title.length&&k(w)})}var x=I(l,2);x.__click=[$o];var C=S(x);Wo(C),O(()=>{oe(i,"hoverable",n()),ne(a,"src",t.title.standing_poster),z(c,t.title.title),z(v,` ${t.title.imdb_score??""}`),z(g,t.title.year),z(p,t.title.type),ne(x,"href",`${Rr}/${t.title.type??""}/${t.title.slug??""}`)}),b(e,i),ie()}ue(["click"]);var Zo=A('<em class="empty svelte-1olb8n0">No results found</em>'),Jo=A('<div class="results svelte-1olb8n0" data-testid="search-results"></div>'),Xo=A('<div class="selected svelte-1olb8n0"><!></div>'),Qo=A('<div class="search svelte-1olb8n0"><!> <!> <!></div>');function es(e,t){re(t,!0);let n=R(t,"onselect",3,()=>null),r=R(t,"query",15),i=F(Y([])),a=F(null),l=F(!1);Ut(()=>{r()&&s(r())});async function s(h){L(l,!0);try{L(i,Y(await Ko(h)))}finally{L(l,!1)}}function c(h){r(h.title),L(a,Y(h)),n()(h)}var f=Qo(),d=S(f);Pn(d,{oninput:()=>L(a,null),name:"search",label:"Search...",get value(){return r()},set value(h){r(h)}});var o=I(d,2);{var v=h=>{var p=Jo();Qe(p,21,()=>u(i),y=>y.sid,(y,w)=>{$n(y,{get title(){return u(w)},onclick:()=>c(u(w))})},y=>{var w=ze(),x=ee(w);{var C=k=>{var E=Zo();b(k,E)};H(x,k=>{u(l)||k(C)})}b(y,w)}),b(h,p)};H(o,h=>{r()&&!u(a)&&h(v)})}var m=I(o,2);{var g=h=>{var p=Xo(),y=S(p);$n(y,{get title(){return u(a)},hoverable:!1}),b(h,p)};H(m,h=>{u(a)&&h(g)})}b(e,f),ie()}function ts(e,t,n,r,i,a){if(!u(t)||!u(n))return;const l=u(n).type==="movie"?"movie":"show",s=Rr+`/${l}/${u(n).slug}`,c={sid:u(n).sid,title:u(t),sentence:u(r),playpilot_url:s,key:Jr(u(n).sid),title_details:u(n),manual:!0};i.onsave(c),a()()}var ns=A('<div class="error svelte-l7tw17"><!></div>'),rs=A('<section class="layout svelte-l7tw17"><div class="header svelte-l7tw17"><!> <h2 class="svelte-l7tw17">Add Playlink manually</h2></div> <p class="svelte-l7tw17">Highlight the text section in your post that you want to turn into a Playlink.</p> <label for="text" class="svelte-l7tw17">Selected text</label> <!> <!> <label for="text" class="svelte-l7tw17">Paired title</label> <!> <button class="save svelte-l7tw17">Add playlink</button></section>');function is(e,t){re(t,!0);let n=R(t,"htmlString",3,""),r=R(t,"onclose",3,()=>null),i=F(""),a=F(""),l=F(null),s=F(""),c=F("");nt(f);function f(){const k=window.getSelection();if(!(k!=null&&k.anchorNode)||!Tn().contains(k.anchorNode.parentElement))return;const E=k.toString().trim();if(!E)return;if(L(s,""),L(i,Y(E)),k.anchorNode!==k.focusNode){L(s,"Selection is broken up by multiple elements. Please select the text more directly.");return}L(c,Y(u(i))),L(a,Y(d(k,E)));const j=k.getRangeAt(0).commonAncestorContainer.textContent,T=xn(n());(!j||!T.includes(j))&&L(s,"Selection was not inside of given content")}function d(k,E){const j=k.getRangeAt(0);let T=j.startContainer;for(;(T.textContent||"").length<=E.length*3&&T.parentNode;)T=T.parentNode;if(!T||!T.textContent)return"";const P=T.textContent,N=o(T,j.startContainer,j.startOffset),B=o(T,j.endContainer,j.endOffset),W=P.slice(0,N).lastIndexOf("."),X=P.slice(B).match(/[.!?]/),te=X?B+X.index:P.length,V=W===-1?0:W+1,U=te;return P.slice(V,U+1).trim()}function o(k,E,j){let T=0;const P=k,N=B=>{var W;if(B===E)return T+=j,!0;B.nodeType===Node.TEXT_NODE&&(T+=((W=B.textContent)==null?void 0:W.length)||0);for(let X=B.firstChild;X;X=X.nextSibling)if(N(X))return!0;return!1};return N(P),T}function v(k){var E,j;L(l,Y(k)),(j=(E=window.getSelection())==null?void 0:E.removeAllRanges)==null||j.call(E)}var m=rs();se("mouseup",ve,f);var g=S(m),h=S(g);Cn(h,{get onclick(){return r()},size:"24px",children:(k,E)=>{Uo(k)},$$slots:{default:!0}});var p=I(g,6);Pn(p,{get value(){return u(i)},label:"Select text on the page",name:"selected-text",readonly:!0});var y=I(p,2);{var w=k=>{var E=ns(),j=S(E);Ln(j,{children:(T,P)=>{var N=Ke();O(()=>z(N,u(s))),b(T,N)},$$slots:{default:!0}}),b(k,E)};H(y,k=>{u(s)&&k(w)})}var x=I(y,4);Dr(x,()=>u(a)+u(i),k=>{es(k,{onselect:v,get query(){return u(c)},set query(E){L(c,Y(E))}})});var C=I(x,2);C.__click=[ts,i,l,a,t,r],O(()=>C.disabled=!u(i)||!u(l)),b(e,m),ie()}ue(["click"]);var as=Pe('<svg width="24px" height="24px" viewBox="0 0 64 64" stroke-width="3" stroke="currentColor" fill="none"><circle cx="34.52" cy="11.43" r="5.82"></circle><circle cx="53.63" cy="31.6" r="5.82"></circle><circle cx="34.52" cy="50.57" r="5.82"></circle><circle cx="15.16" cy="42.03" r="5.82"></circle><circle cx="15.16" cy="19.27" r="5.82"></circle><circle cx="34.51" cy="29.27" r="4.7"></circle><line x1="20.17" y1="16.3" x2="28.9" y2="12.93"></line><line x1="38.6" y1="15.59" x2="49.48" y2="27.52"></line><line x1="50.07" y1="36.2" x2="38.67" y2="46.49"></line><line x1="18.36" y1="24.13" x2="30.91" y2="46.01"></line><line x1="20.31" y1="44.74" x2="28.7" y2="48.63"></line><line x1="17.34" y1="36.63" x2="31.37" y2="16.32"></line><line x1="20.52" y1="21.55" x2="30.34" y2="27.1"></line><line x1="39.22" y1="29.8" x2="47.81" y2="30.45"></line><line x1="34.51" y1="33.98" x2="34.52" y2="44.74"></line></svg>');function ls(e){var t=as();b(e,t)}var os=A('AI links are currently processing. This can take several minutes.<br class="svelte-7ilatt"> You can add manual links while this is ongoing.',1),ss=(e,t,n,r)=>{t.onadd(u(n)),L(r,!0)},cs=A('AI links are ready. <strong class="svelte-7ilatt"> </strong> New links will be used next time you refresh the page, or you can insert them now. <button class="button svelte-7ilatt">Add AI links</button>',1),us=(e,t)=>L(t,!0),ds=A('AI links finished running, but no new links were found. <button class="button svelte-7ilatt">Dismiss</button>',1),fs=A('<div class="loading-bar svelte-7ilatt" data-testid="loading-bar"></div>'),vs=A('<div class="animator svelte-7ilatt"></div>'),_s=A('<div class="ai-indicator svelte-7ilatt"><div class="content svelte-7ilatt"><div class="icon svelte-7ilatt"><!></div> <div class="svelte-7ilatt"><!></div> <!></div> <div class="border svelte-7ilatt"><!></div></div>');function hs(e,t){re(t,!0);const n=R(t,"htmlString",3,""),r=K(()=>Math.min(Math.max(n().length*30,6e4),6e5));let i=F(!0),a=F(Y([])),l=F(!1);function s(o){L(i,!1),L(a,Y(o))}var c=ze(),f=ee(c);{var d=o=>{var v=_s(),m=S(v),g=S(m),h=S(g);ls(h);var p=I(g,2),y=S(p);{var w=P=>{var N=os();b(P,N)},x=P=>{var N=ze(),B=ee(N);{var W=te=>{var V=cs(),U=I(ee(V)),ae=S(U),ke=I(U,2);ke.__click=[ss,t,a,l],O(()=>z(ae,`${u(a).length??""} New ${(u(a).length>1?"links were":"link was")??""} found.`)),b(te,V)},X=te=>{var V=ds(),U=I(ee(V));U.__click=[us,l],b(te,V)};H(B,te=>{var V;(V=u(a))!=null&&V.length?te(W):te(X,!1)},!0)}b(P,N)};H(y,P=>{u(i)?P(w):P(x,!1)})}var C=I(p,2);{var k=P=>{var N=fs();O(()=>$t(N,"animation-duration",`${u(r)??""}ms`)),b(P,N)};H(C,P=>{u(i)&&P(k)})}var E=I(m,2),j=S(E);{var T=P=>{var N=vs();b(P,N)};H(j,P=>{u(i)&&P(T)})}O(()=>oe(v,"running",u(i))),b(o,v)};H(f,o=>{u(l)||o(d)})}return b(e,c),ie({notifyUserOfNewState:s})}ue(["click"]);async function ms(e,t,n,r,i,a,l){try{L(t,!0),L(n,!1),r(await Xl(r(),i())),L(a,Y(u(l)))}catch{L(n,!0)}finally{L(t,!1)}}var gs=A('<div class="handle svelte-1w9c21y"><!></div>'),ps=A('<!> <div class="handle svelte-1w9c21y"><!></div>',1),ys=A('<div class="loading svelte-1w9c21y">Loading...</div>'),ws=A('<div class="bubble svelte-1w9c21y"> </div> <!>',1),ks=A('<div class="error svelte-1w9c21y"><!></div>'),bs=A('<div class="empty svelte-1w9c21y">No links available. Add links manually by clicking the + button and select text to add a link to.</div>'),xs=A('<button class="save svelte-1w9c21y"> </button>'),Ss=A('<!> <div class="items svelte-1w9c21y"></div> <!>',1),Es=A('<div class="panel playpilot-styled-scrollbar svelte-1w9c21y"><!></div>'),Ts=A('<section class="editor playpilot-styled-scrollbar svelte-1w9c21y"><header class="header svelte-1w9c21y"><!> <h1 class="svelte-1w9c21y">Playlinks</h1> <!></header> <!> <!> <!></section>');function Is(e,t){re(t,!0);let n=R(t,"linkInjections",15),r=R(t,"htmlString",3,""),i=R(t,"loading",3,!1),a=R(t,"aiRunning",3,!1);const l="editor-position",s="editor-height";let c=F(null),f=Y(JSON.parse(localStorage.getItem(l)||'{ "x": 0, "y": 0 }')),d=Y(parseInt(localStorage.getItem(s)||"0")),o=F(!1),v=F(!1),m=F(!1),g=F(0),h=F(""),p=F(void 0);const y=K(()=>JSON.stringify(n())),w=K(()=>u(h)!==u(y)),x=K(()=>n().filter(M=>M.title_details&&!M.removed&&!M.duplicate&&(M.manual||!M.manual&&!M.failed))),C=K(()=>k(u(x)));Ut(()=>{i()||Je(()=>{L(h,Y(u(y))),N()})});function k(M){return M.sort((D,J)=>D.failed!==J.failed?D.failed?1:-1:D.title_details.title.localeCompare(J.title_details.title))}function E(M,D){localStorage.setItem(M,D)}function j(M){const D=n().findIndex(J=>J.key===M);n(n()[D].manual=!0,!0),n(n()[D].removed=!0,!0),n([...n()])}function T(M){if(!u(c))return;const D=M.offsetTop,J=D+M.offsetHeight,me=u(c).scrollTop,be=me+u(c).clientHeight;D>=me&&J<=be||u(c).scrollTo({top:D-u(c).clientHeight/2,behavior:"smooth"})}function P(M){const D=M.target;L(g,Y(D.scrollTop))}function N(){const M={total:n().length.toString(),failed_automatic:n().filter(D=>D.failed&&!D.manual).length.toString(),failed_manual:n().filter(D=>D.failed&&D.manual).length.toString(),final_injected:u(x).length.toString()};Ne(Ae.TotalInjectionsCount,null,M)}function B(M){const D=M.filter(J=>{if(In(J))return!n().some(me=>An(J,me))});u(p).notifyUserOfNewState(D)}var W=Ts(),X=S(W),te=S(X);{var V=M=>{var D=ps(),J=ee(D);{var me=Ee=>{var ce=gs(),de=S(ce);Bo(de,{get element(){return u(c)},get height(){return d},onchange:qe=>E(s,JSON.stringify(qe))}),b(Ee,ce)};H(J,Ee=>{i()||Ee(me)})}var be=I(J,2),We=S(be);Fo(We,{get element(){return u(c)},get position(){return f},limit:{x:16,y:16},onchange:Ee=>E(l,JSON.stringify(Ee))}),b(M,D)};H(te,M=>{u(c)&&M(V)})}var U=I(te,4);{var ae=M=>{var D=ys();b(M,D)},ke=M=>{var D=ws(),J=ee(D),me=S(J),be=I(J,2);Cn(be,{onclick:()=>L(o,!0),size:"24px","aria-label":"Add manual injection",children:(We,Ee)=>{var ce=Ke("+");b(We,ce)},$$slots:{default:!0}}),O(()=>{ne(J,"aria-label",`${u(x).length??""} found playlinks`),z(me,u(x).length)}),b(M,D)};H(U,M=>{i()?M(ae):M(ke,!1)})}var ge=I(X,2);{var Re=M=>{ct(hs(M,{get htmlString(){return r()},onadd:D=>D.forEach(J=>n().push(J))}),D=>L(p,Y(D)),()=>u(p))};H(ge,M=>{!i()&&a()&&M(Re)})}var Se=I(ge,2);{var Z=M=>{var D=Ss(),J=ee(D);{var me=ce=>{var de=ks(),qe=S(de);Ln(qe,{children:(mt,Ps)=>{var Xr=Ke("Something went wrong, check your links below.");b(mt,Xr)},$$slots:{default:!0}}),De(7,de,()=>Ht,()=>({duration:150})),b(ce,de)};H(J,ce=>{u(m)&&ce(me)})}var be=I(J,2);Qe(be,21,()=>u(C),ce=>ce.key,(ce,de)=>{const qe=K(()=>n().findIndex(mt=>mt.key===u(de).key));Ro(ce,{onremove:()=>j(u(de).key),onhighlight:T,get linkInjection(){return n()[u(qe)]},set linkInjection(mt){n(n()[u(qe)]=mt,!0)}})},ce=>{var de=bs();b(ce,de)});var We=I(be,2);{var Ee=ce=>{var de=xs();de.__click=[ms,v,m,n,r,h,y];var qe=S(de);O(()=>{de.disabled=u(v),z(qe,u(v)?"Saving...":"Save links")}),De(1,de,()=>Kr,()=>({duration:100})),b(ce,de)};H(We,ce=>{u(w)&&n().length&&ce(Ee)})}b(M,D)};H(Se,M=>{i()||M(Z)})}var Q=I(Se,2);{var le=M=>{var D=Es(),J=S(D);is(J,{get htmlString(){return r()},onclose:()=>L(o,!1),onsave:me=>n().push(me)}),O(()=>$t(D,"top",`${u(g)??""}px`)),De(3,D,()=>Zt,()=>({x:Math.min(window.innerWidth,320),duration:200,opacity:1})),b(M,D)};H(Q,M=>{u(o)&&M(le)})}return ct(W,M=>L(c,M),()=>u(c)),O(()=>{oe(W,"panel-open",u(o)),oe(W,"loading",i())}),se("scroll",W,P),b(e,W),ie({requestNewAIInjections:B})}ue(["click"]);var As=A('<div class="playpilot-link-injections svelte-4l9ehd"><!> <!></div>');function Cs(e,t){re(t,!0);const n=Tn(),r=jl(n),i=r.map(T=>T.outerHTML).join(""),a=Br();let l=F(null),s=F(null),c=F(!1),f=F(!0),d=F(Y([])),o=F(void 0);const v=K(()=>u(l)||{}),m=K(()=>Mn(u(v).ai_injections,()=>[],!0)),g=K(()=>Mn(u(v).link_injections,()=>[],!0));Ut(()=>{a&&p()}),nt(()=>(Ne(Ae.ArticlePageView),h(),()=>un()));async function h(){var N;a&&L(c,Y(await Fr()));const T=Gr();try{const B=await Ql();if(!a&&(B!=null&&B.exclude_urls_pattern)&&T.match(B.exclude_urls_pattern))return}catch(B){Ne(Ae.FetchingConfigFailed),console.error("TPI Config failed to fetch",B);return}if(L(l,Y(await zn(T,i,{maxTries:1}))),y({aiInjections:u(m),manualInjections:u(g)}),L(f,!1),!((N=u(l))!=null&&N.ai_running)||!a)return;const P=await zn(T,i,{requireCompletedResult:!0});u(o).requestNewAIInjections((P==null?void 0:P.ai_injections)||[])}function p(){un(),y(Kl(u(d)))}function y(T={aiInjections:u(m),manualInjections:u(g)}){if(!u(m).length&&!u(g).length)return;const P=Nl(r,w,T);JSON.stringify(P)!==JSON.stringify(u(d))&&L(d,Y(P))}function w(T){L(s,Y(T))}var x=As(),C=S(x);{var k=T=>{var P=K(()=>{var N,B;return((N=u(l))==null?void 0:N.ai_running)&&((B=u(l))==null?void 0:B.automation_enabled)});ct(Is(T,{htmlString:i,get loading(){return u(f)},get aiRunning(){return u(P)},get linkInjections(){return u(d)},set linkInjections(N){L(d,Y(N))}}),N=>L(o,Y(N)),()=>u(o))};H(C,T=>{a&&u(c)&&T(k)})}var E=I(C,2);{var j=T=>{ao(T,{get title(){return u(s).title_details},onclose:()=>L(s,null)})};H(E,T=>{u(s)&&u(s).title_details&&T(j)})}b(e,x),ie()}window.PlayPilotLinkInjections={token:"",editorial_token:"",selector:"",language:null,app:null,initialize(e={token:"",selector:"",language:null,editorial_token:""}){if(!e.token){console.error("An API token is required.");return}this.token=e.token,this.editorial_token=e.editorial_token,this.selector=e.selector,this.language=e.language,this.app&&this.destroy();const t=document.createElement("div");t.id="playpilot-link-injection",document.body.insertAdjacentElement("beforeend",t),this.app=kn(Cs,{target:t})},destroy(){if(!this.app)return;this.app=null;const e=document.getElementById("playpilot-link-injection");e&&e.remove(),un()}};
|
|
8
|
+
`}}var qa=A('<div class="popover svelte-8w8waf" tabindex="-1" aria-hidden="true"><div class="dialog svelte-8w8waf"><!></div></div>');function Ba(e,t){re(t,!0);let n=R(t,"maxHeight",15);Ir("scope","popover");let r=F(null),i=F(!1);nt(async()=>{await On(),a(),await On(),l()});function a(){if(!u(r))return;const{top:o,right:v,bottom:m,height:g}=u(r).getBoundingClientRect(),h=s();L(i,Y(o-h<0&&window.innerHeight-m>o+g));const p=window.innerWidth-v-h;v+h>window.innerWidth&&(u(r).style.left=`${p}px`)}function l(){if(!u(r))return;const{top:o,height:v}=u(r).getBoundingClientRect(),m=s(),g=u(i)?window.innerHeight-o-m:o+v-m;n(Math.min(g,window.innerHeight*.8))}function s(){return parseFloat(getComputedStyle(document.documentElement).fontSize)}var c=qa(),f=S(c),d=S(f);ht(d,()=>t.children),ct(c,o=>L(r,o),()=>u(r)),O(()=>{oe(c,"flip",u(i)),$t(c,"--max-height",n()?n()+"px":null)}),De(3,f,()=>Zt,()=>({duration:100,y:10})),b(e,c),ie()}const Va=[{slug:"100",name:"All",categories:{movie:100,series:100,documentary:100,kids:100,cinema:100,podcasts:100}},{slug:"999",name:"Unscripted",categories:{},media_format:"video"},{slug:"900",name:"Independent",categories:{},media_format:"video"},{slug:"113",name:"Game Show",categories:{series:36,kids:28},media_format:"video"},{slug:"112",name:"Film Noir",categories:{movie:37},media_format:"video"},{slug:"212",name:"Entertainment",categories:{kids:80,series:42,movie:42},media_format:"video"},{slug:"120",name:"News",categories:{series:26,documentary:36,kids:38},media_format:"video"},{slug:"208",name:"Short",categories:{movie:21,documentary:30,kids:36},media_format:"video"},{slug:"902",name:"Bollywood",categories:{},media_format:"video"},{slug:"240",name:"Concert",categories:{movie:45},media_format:"video"},{slug:"901",name:"Arthouse",categories:{},media_format:"video"},{slug:"903",name:"Alternate Version",categories:{},media_format:"video"},{slug:"121",name:"Reality TV",categories:{series:24},media_format:"video"},{slug:"202",name:"Culture",categories:{kids:40,documentary:84,series:44},media_format:"video"},{slug:"107",name:"Drama",categories:{series:82,movie:82,cinema:88,documentary:44},media_format:"video"},{slug:"105",name:"Crime",categories:{series:84,documentary:86,cinema:64,movie:84},media_format:"video"},{slug:"128",name:"Western",categories:{movie:12,series:12,documentary:24},media_format:"video"},{slug:"127",name:"Thriller",categories:{series:70,documentary:28,cinema:80,movie:70},media_format:"video"},{slug:"102",name:"Animation",categories:{series:50,cinema:50,kids:90,documentary:48,movie:50},media_format:"video"},{slug:"119",name:"Mystery",categories:{movie:76,cinema:70,kids:26,documentary:38,series:76},media_format:"video"},{slug:"227",name:"Science",categories:{series:22,kids:46,documentary:74},media_format:"video"},{slug:"108",name:"Nature",categories:{kids:48,documentary:76,series:28},media_format:"video"},{slug:"116",name:"War",categories:{movie:14,documentary:68,series:14,cinema:66},media_format:"video"},{slug:"123",name:"Sci-Fi",categories:{series:72,movie:72,cinema:68,kids:70,documentary:32},media_format:"video"},{slug:"106",name:"Documentary",categories:{kids:50},media_format:"video"},{slug:"232",name:"Stand-up",categories:{movie:18,series:18},media_format:"video"},{slug:"126",name:"Talk Show",categories:{kids:34,series:16},media_format:"video"},{slug:"111",name:"Fantasy",categories:{kids:78,cinema:74,documentary:42,movie:38,series:38},media_format:"video"},{slug:"114",name:"History",categories:{movie:35,kids:44,cinema:10,series:80,documentary:90},media_format:"video"},{slug:"109",name:"Adventure",categories:{kids:88,cinema:86,documentary:82,series:88,movie:88},media_format:"video"},{slug:"101",name:"Action",categories:{documentary:50,kids:86,series:90,cinema:90,movie:90},media_format:"video"},{slug:"124",name:"Horror",categories:{cinema:76,documentary:40,series:78,movie:80},media_format:"video"},{slug:"115",name:"Comedy",categories:{cinema:84,documentary:46,series:86,kids:82,movie:86},media_format:"video"},{slug:"104",name:"Biography",categories:{series:46,documentary:88,cinema:10,movie:46},media_format:"video"},{slug:"118",name:"Music",categories:{kids:72,cinema:9,documentary:78,movie:32,series:32},media_format:"video"},{slug:"125",name:"Sport",categories:{cinema:7,kids:68,series:20,documentary:70,movie:20},media_format:"video"},{slug:"122",name:"Romance",categories:{documentary:34,cinema:78,movie:74,series:74},media_format:"video"},{slug:"103",name:"Kids",categories:{kids:76},media_format:"video"},{slug:"222",name:"Lifestyle",categories:{documentary:80,kids:74,series:34},media_format:"video"},{slug:"117",name:"Musical",categories:{kids:30,movie:78,cinema:8,series:30},media_format:"video"},{slug:"129",name:"Anime",categories:{cinema:5,movie:48,kids:84,series:48},media_format:"video"},{slug:"110",name:"Family",categories:{series:40,cinema:40,movie:40},media_format:"video"}];var Ua=A('<div class="genre svelte-13nhocm"> </div>'),Ka=(e,t)=>L(t,!0),za=A('<button class="genre expand svelte-13nhocm"> </button>'),Wa=A("<!> <!>",1);function Ya(e,t){re(t,!0);let n=F(!1);const r=K(()=>u(n)?t.genres:[t.genres[0]]);var i=Wa(),a=ee(i);Qe(a,17,()=>u(r),xt,(c,f)=>{var d=ze();const o=K(()=>{var g;return(g=Va.find(h=>h.slug===u(f)))==null?void 0:g.name});var v=ee(d);{var m=g=>{var h=Ua(),p=S(h);O(()=>z(p,he(u(o)))),b(g,h)};H(v,g=>{u(o)&&g(m)})}b(c,d)});var l=I(a,2);{var s=c=>{var f=za();f.__click=[Ka,n];var d=S(f);O(()=>z(d,`+${t.genres.length-1}`)),b(c,f)};H(l,c=>{!u(n)&&t.genres.length>1&&c(s)})}b(e,i),ie()}ue(["click"]);function $a(e){let t=[];for(const n of e){let r=n;const i=t.find(s=>s.name===r.name),a=i==null?void 0:i.extra_info.category,l=r.extra_info.category;(a==="RENT"&&l==="BUY"||a==="BUY"&&l==="RENT")&&(t=t.filter(s=>s.name!==r.name),r={...r,extra_info:{...r.extra_info,category:"TVOD"}}),t.push(r)}return t}ki();var Ga=Pe('<svg width="6" height="12" viewBox="0 0 6 12" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M0 11L5 6L0 1" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"></path></svg>');function Za(e){var t=Ga();b(e,t)}var Ja=(e,t,n)=>t(n()),Xa=A('<div class="arrow svelte-1f6ryh6"><!></div>'),Qa=A('<a target="_blank" class="playlink svelte-1f6ryh6" rel="sponsored"><img alt="" height="32" width="32" class="svelte-1f6ryh6"> <div><span class="name svelte-1f6ryh6"> </span> <div class="category svelte-1f6ryh6"> </div></div> <!></a>'),el=A('<div class="playlink empty svelte-1f6ryh6"> </div>'),tl=A('<h2 class="svelte-1f6ryh6"> </h2> <div class="playlinks svelte-1f6ryh6"><!> <!></div>',1);function nl(e,t){re(t,!0);const n=R(t,"list",3,!1),r=ta("scope")==="modal",i=K(()=>t.playlinks.filter(h=>!!h.logo_url)),a=K(()=>$a(u(i))),l={SVOD:he("Stream"),BUY:he("Buy"),RENT:he("Rent"),TVOD:he("Rent Or Buy")};function s(h){Ne(r?Ae.TitleModalPlaylinkClick:Ae.TitlePopoverPlaylinkClick,t.title,{playlink:h})}var c=tl(),f=ee(c),d=S(f);O(()=>z(d,he("Where To Stream Online")));var o=I(f,2),v=S(o);Qe(v,17,()=>u(a),xt,(h,p)=>{let y=()=>u(p).name,w=()=>u(p).url,x=()=>u(p).logo_url,C=()=>u(p).extra_info.category;var k=Qa();k.__click=[Ja,s,y];var E=S(k),j=I(E,2),T=S(j),P=S(T),N=I(T,2),B=S(N);O(()=>z(B,l[C()]||he("Stream")));var W=I(j,2);{var X=te=>{var V=Xa(),U=S(V);Za(U),b(te,V)};H(W,te=>{n()&&te(X)})}O(()=>{ne(k,"href",w()),ne(k,"data-playlink",y()),ne(E,"src",x()),z(P,y())}),b(h,k)});var m=I(v,2);{var g=h=>{var p=el(),y=S(p);O(()=>z(y,he("Title Unavailable"))),b(h,p)};H(m,h=>{t.playlinks.length||h(g)})}O(()=>oe(o,"list",n())),b(e,c),ie()}ue(["click"]);var rl=(e,t)=>L(t,!0),il=A('<button class="show-more svelte-fluzit">Show more</button>'),al=A('<p class="svelte-fluzit"> </p>'),ll=A('<div><span class="paragraph svelte-fluzit"> <!> <!></span> <!></div>');function ol(e,t){re(t,!0);const n=R(t,"blurb",3,""),r=R(t,"limit",3,200);let i=F(!1);const a=K(()=>t.text.slice(0,r()));var l=ll(),s=S(l),c=S(s),f=I(c);{var d=h=>{var p=Ke("...");b(h,p)};H(f,h=>{!u(i)&&t.text.length>r()&&h(d)})}var o=I(f,2);{var v=h=>{var p=il();p.__click=[rl,i],b(h,p)};H(o,h=>{!u(i)&&(t.text.length>r()||n())&&h(v)})}var m=I(s,2);{var g=h=>{var p=al(),y=S(p);O(()=>z(y,n())),b(h,p)};H(m,h=>{u(i)&&h(g)})}O(()=>z(c,u(i)?t.text:u(a))),b(e,l),ie()}ue(["click"]);var sl=A('<div class="participant"> <div class="character svelte-15oguej"> <!></div></div>'),cl=A('<h2 class="svelte-15oguej">Cast</h2> <div class="participants svelte-15oguej"></div>',1);function ul(e,t){var n=cl(),r=I(ee(n),2);Qe(r,21,()=>t.participants,xt,(i,a)=>{var l=sl(),s=S(l),c=I(s),f=S(c);O(()=>{var v;return z(f,((v=u(a).character)==null?void 0:v.slice(0,20))||"")});var d=I(f);{var o=v=>{var m=Ke("...");b(v,m)};H(d,v=>{var m;(m=u(a).character)!=null&&m.length&&v(o)})}O(()=>z(s,`${u(a).name??""} `)),b(i,l)}),b(e,n)}var dl=Pe('<svg width="14" height="14" viewBox="0 0 14 14" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M7 0.351929L9.163 4.72803L14 5.43408L10.5 8.8385L11.326 13.648L7 11.3761L2.674 13.648L3.5 8.8385L0 5.43408L4.837 4.72803L7 0.351929Z" fill="#F6C045"></path></svg>');function zr(e){var t=dl();b(e,t)}var fl=A('<div class="top svelte-urs395"><img class="poster svelte-urs395"></div>'),vl=A("<div> </div>"),_l=A("<!> <!>",1),hl=A('<img alt="" class="svelte-urs395">'),ml=A('<div class="content svelte-urs395" data-playpilot-link-injections-title=""><header class="header svelte-urs395"><!> <h1 class="svelte-urs395"> </h1> <div class="info svelte-urs395"><div class="imdb svelte-urs395"><!> </div> <!> <div> </div> <div class="capitalize svelte-urs395"> </div> <!></div></header> <main class="main"><!> <!></main></div> <div class="background svelte-urs395"><!></div>',1);function Wr(e,t){re(t,!0);const n=R(t,"small",3,!1),r=R(t,"compact",3,!1);let i=F(!1),a=F(!1),l=F(!1);var s=ml(),c=ee(s),f=S(c),d=S(f);{var o=V=>{var U=fl(),ae=S(U);O(()=>{ne(ae,"src",t.title.standing_poster),ne(ae,"alt",`Movie poster for '${t.title.title??""}'`),oe(ae,"loaded",u(i))}),se("load",ae,()=>L(i,!0)),b(V,U)};H(d,V=>{r()||V(o)})}var v=I(d,2),m=S(v),g=I(v,2),h=S(g),p=S(h);zr(p);var y=I(p),w=I(h,2);Ya(w,{get genres(){return t.title.genres}});var x=I(w,2),C=S(x),k=I(x,2),E=S(k);O(()=>z(E,he(`Type: ${t.title.type}`)));var j=I(k,2);{var T=V=>{var U=vl(),ae=S(U);O(()=>z(ae,`${t.title.length??""} ${he("Minutes")??""}`)),b(V,U)};H(j,V=>{!n()&&t.title.length&&V(T)})}var P=I(f,2),N=S(P);nl(N,{get playlinks(){return t.title.providers},get title(){return t.title},list:!0});var B=I(N,2);{var W=V=>{var U=_l(),ae=ee(U);ol(ae,{get text(){return t.title.description},get blurb(){return t.title.blurb}});var ke=I(ae,2);{var ge=Re=>{ul(Re,{get participants(){return t.title.participants}})};H(ke,Re=>{var Se;(Se=t.title.participants)!=null&&Se.length&&Re(ge)})}b(V,U)};H(B,V=>{n()||V(W)})}var X=I(c,2),te=S(X);Dr(te,()=>u(l),V=>{var U=hl();O(()=>{ne(U,"src",u(l)?t.title.standing_poster:t.title.medium_poster),oe(U,"loaded",u(a)),oe(U,"blur",u(l))}),se("load",U,()=>L(a,!0)),se("error",U,()=>L(l,!0)),b(V,U)}),O(()=>{ne(c,"data-playpilot-original-title",t.title.original_title),oe(c,"small",n()),oe(c,"compact",r()),oe(v,"truncate",n()),z(m,t.title.title),z(y,` ${t.title.imdb_score??""}`),z(C,t.title.year),oe(X,"faded",r())}),b(e,s),ie()}function gl(e,t){re(t,!0);let n=F(0);Ne(Ae.TitlePopoverView,t.title),Ba(e,{get maxHeight(){return u(n)},set maxHeight(r){L(n,Y(r))},children:(r,i)=>{var a=K(()=>u(n)<250);Wr(r,{get title(){return t.title},small:!0,get compact(){return u(a)}})},$$slots:{default:!0}}),ie()}var pl=(e,t,n,r)=>t(u(n).title_details,u(r)),yl=A(' <span class="svelte-6p0hvs"><button class="svelte-6p0hvs"> </button></span>',1),wl=(e,t,n,r)=>t(u(n).title_details,r()),kl=A('<!> <a target="_blank"> </a>',1),bl=A(" <!>.",1),xl=A("<!> <br>",1),Sl=A(" <br>",1),El=A('<span class="svelte-6p0hvs"><!></span>'),Tl=A("<p></p>");function Il(e,t){re(t,!0);const n=R(t,"onclickmodal",3,c=>null);function r(c,f){Ne(Ae.AfterArticlePlaylinkClick,c,{playlink:f})}function i(c,f){Ne(Ae.AfterArticleModalButtonClick,c),n()(f)}var a=ze(),l=ee(a);{var s=c=>{var f=Tl();Qe(f,21,()=>t.linkInjections,xt,(d,o)=>{var v=El();const m=K(()=>{const{key:w,title:x,title_details:C,after_article_style:k}=u(o);return{key:w,title:x,title_details:C,after_article_style:k}}),g=K(()=>{var w;return((w=u(m).title_details)==null?void 0:w.providers)||[]});var h=S(v);{var p=w=>{var x=xl(),C=ee(x);{var k=j=>{var T=yl(),P=ee(T);O(()=>z(P,`"${u(m).title??""}" ${he("Is Available To Stream")??""} `));var N=I(P),B=S(N);B.__click=[pl,i,m,o];var W=S(B);O(()=>z(W,he("View Streaming Options"))),b(j,T)},E=j=>{var T=bl(),P=ee(T);O(()=>z(P,`"${u(m).title??""}" ${he("Is Available To Stream On")??""} `));var N=I(P);Qe(N,17,()=>u(g),xt,(B,W,X)=>{let te=()=>u(W).name,V=()=>u(W).url;var U=kl(),ae=ee(U);{var ke=Se=>{var Z=Ke();O(()=>z(Z,X===u(g).length-1?`, ${he("And")}`:",")),b(Se,Z)};H(ae,Se=>{X&&Se(ke)})}var ge=I(ae,2);ge.__click=[wl,r,m,te];var Re=S(ge);O(()=>{ne(ge,"href",V()),z(Re,te())}),b(B,U)}),b(j,T)};H(C,j=>{u(m).after_article_style==="modal_button"?j(k):j(E,!1)})}b(w,x)},y=w=>{var x=Sl(),C=ee(x);O(()=>z(C,`"${u(m).title??""}" ${he("Title Unavailable Suffix")??""} `)),b(w,x)};H(h,w=>{u(g).length?w(p):w(y,!1)})}O(()=>ne(v,"data-playpilot-injection-key",u(m).key)),b(d,v)}),b(c,f)};H(l,c=>{t.linkInjections.length&&c(s)})}b(e,a),ie()}ue(["click"]);function Al(e){const t=document.createElement("div");return t.textContent=e,t.innerHTML}function xn(e){const t=document.createElement("div");return t.innerHTML=e,t.textContent||""}function Cl(e,t,n=[]){var a,l;const r=document.createTreeWalker(t);let i;for(;(i=r.nextNode())&&!((a=i.nodeValue)!=null&&a.includes(e)&&!n.includes(((l=i.parentNode)==null?void 0:l.nodeName)||"")););return i}function Pl(e){const t=e.parentNode;return t?t.nodeName==="A"||!!t.closest("a"):!1}function Ll(e,t,n,r){const i=Al(t),a=xn(t),l=e.slice(0,r),s=e.slice(r),c=/[-/\\^$*+?.()|[\]{}]/g,f=new RegExp(`${a.replace(c,"\\$&")}|${i.replace(c,"\\$&")}`),d=s.replace(f,n);return l+d}function it(e){return xn(e).toLowerCase().replace(/\s+/g,"")}function Ml(e,t,n){const i=e.indexOf(t),a=Math.floor((n-t.length)/2);let l=Math.max(0,i-a),s=l+n;s>e.length&&(s=e.length,l=Math.max(0,s-n));let c=e.slice(l,s).trim();return l>0&&(c="…"+c),s<e.length&&(c+="…"),c}function Dl(e){let t=0;for(let n=0;n<e.length;n++)e[n]>t&&(t=e[n]);return t}const Sn="data-playpilot-injection-key",En=`[${Sn}]`,ut={};let jt=null;function jl(e){let t=[],n=[e];for(;n.length>0;){const r=n.pop();if(/^(A|BUTTON|SCRIPT|NOSCRIPT|STYLE|IFRAME|H[1-6])$/.test(r.tagName))continue;if(Array.from(r.childNodes).some(l=>{var s;return l.nodeType===Node.TEXT_NODE&&((s=l.nodeValue)==null?void 0:s.trim())!==""})){t.push(r);continue}const a=Array.from(r.children);for(let l=a.length-1;l>=0;l--)n.push(a[l])}return t}function Tn(){var t;const e=(t=window.PlayPilotLinkInjections)==null?void 0:t.selector;if(e){const n=e.replace(/(:)/g,"\\$1"),r=document.querySelector(n);if(r)return r}return document.querySelector("article")||document.querySelector("main")||document.body}function Nl(e,t,n={aiInjections:[],manualInjections:[]}){var d;const r=Ul(n),i=e.map(o=>o.innerText).join(" "),a=zl(r),l=a.filter(o=>it(i).includes(it(o.sentence))),s={};for(const o of l){const v=e.findIndex(x=>it(x.innerText).includes(it(o.sentence))),m=e[v];if(!m)continue;const g=Cl(o.title,m,["A"]);if(!g||Pl(g))continue;const h=document.createElement("span");h.dataset.playpilotInjectionKey=o.key;const p=document.createElement("a");p.innerText=o.title,p.href=o.playpilot_url,p.dataset.playpilotOriginalTitle=(d=o.title_details)==null?void 0:d.original_title,p.target="_blank",p.rel="noopener nofollow noreferrer",h.insertAdjacentElement("beforeend",p);const y=Dl(Object.values(s).filter(x=>x.elementIndex===v).map(x=>x.to));m.innerHTML=Ll(m.innerHTML,o.title,h.outerHTML,y);const w=m.innerHTML.indexOf(h.outerHTML);s[o.key]={elementIndex:v,from:w,to:w+h.outerHTML.length}}Rl(a,t),Ol();const c=Wl(r);return c.length&&ql(e,c,t),Vl(r,s).filter(o=>o.title_details).map((o,v)=>{const m=!o.inactive&&!o.after_article&&!document.querySelector(`[${Sn}="${o.key}"]`),g=o.duplicate??(!o.manual&&Yl(o,v,r));return{...o,inactive:o.inactive??!1,duplicate:g,failed:m}})}function Ol(){const e=Array.from(document.querySelectorAll(`${En} a`)),t=["--playpilot-injection-text-color","--playpilot-injection-text-color-hover","--playpilot-injection-font-weight","--playpilot-injection-text-decoration","--playpilot-injection-text-decoration-hover","--playpilot-injection-background-color","--playpilot-injection-background-color-hover"];e.forEach(n=>{t.forEach(r=>{getComputedStyle(n).getPropertyValue(r)&&(n.dataset.usedCssVariables=`${n.dataset.usedCssVariables||""} ${r}`)})})}function Rl(e,t){window.addEventListener("click",r=>{const i=r.target;if(!(i!=null&&i.parentElement))return;const a=i.parentElement.getAttribute(Sn);if(!a)return;const l=e.find(s=>a===s.key);l&&Hl(r,l,t)}),Array.from(document.querySelectorAll(En)).forEach(r=>{const i=r.dataset.playpilotInjectionKey,a=e.find(l=>i===l.key);a&&(r.addEventListener("mouseenter",l=>Fl(l,a)),r.addEventListener("mouseleave",()=>Ft(a)))})}function Hl(e,t,n){e.ctrlKey||e.metaKey||e.button!==0||(e.preventDefault(),n(t),Ft(t))}function Fl(e,t){if(ut[t.key]||window.matchMedia("(pointer: coarse)").matches)return;const n=e.currentTarget,r=kn(gl,{target:n,props:{title:t.title_details}});ut[t.key]={injection:t,component:r}}function Ft(e,t=!0){const n=ut[e.key];n&&(Mr(n.component,{outro:t}),delete ut[e.key])}function ql(e,t,n){if(!t.length)return;const r=document.createElement("div");r.dataset.playpilotAfterArticlePlaylinks="true",e[e.length-1].insertAdjacentElement("afterend",r),jt=kn(Il,{target:r,props:{linkInjections:t,onclickmodal:n}})}function Bl(){var e;jt&&(Mr(jt),(e=document.querySelector("[data-playpilot-after-article-playlinks]"))==null||e.remove(),jt=null)}function un(){Object.values(ut).forEach(t=>Ft(t.injection)),document.querySelectorAll(En).forEach(t=>t.outerHTML=t.textContent||""),Object.values(ut).forEach(({injection:t})=>Ft(t,!1)),Bl()}function Vl(e,t){return e.sort((n,r)=>{const i=t[n.key],a=t[r.key];return!i&&a?1:i&&!a?-1:!i&&!a?0:(i==null?void 0:i.elementIndex)!==(a==null?void 0:a.elementIndex)?((i==null?void 0:i.elementIndex)||0)-((a==null?void 0:a.elementIndex)||0):((i==null?void 0:i.from)||0)-((a==null?void 0:a.from)||0)})}function Ul({aiInjections:e,manualInjections:t}){return[...e,...t.map(n=>({...n,manual:!0}))]}function Kl(e){return{aiInjections:e.filter(t=>!t.manual),manualInjections:e.filter(t=>t.manual)}}function In(e){return!e.inactive&&!e.removed&&!e.duplicate&&!!e.title_details}function zl(e){return Yr(e).filter(t=>t.in_text!==!1&&In(t))}function Wl(e){return Yr(e).filter(t=>t.after_article===!0&&In(t))}function Yr(e){return e.filter(t=>t.removed||t.inactive?!1:t.manual&&!t.removed&&!t.inactive?!0:!e.some(n=>n.manual&&(n.removed||n.inactive)&&An(n,t)))}function Yl(e,t,n){return n.some((r,i)=>t!==i&&r.manual&&An(r,e))}function An(e,t){return e.title===t.title&&it(e.sentence)===it(t.sentence)}function $l(){const e=Tn();return{heading:Gl(e),modified_time:Zl(e),published_time:Jl(e)}}function Gl(e){const t=e.querySelector("h1")||document.querySelector("h1");return(t==null?void 0:t.innerText.trim())||null}function Zl(e){const t=document.querySelector('meta[property*="modified_time"]')||e.querySelector('[itemprop="dateModified"]')||document.querySelector('[itemprop="dateModified"]')||null,n=(t==null?void 0:t.getAttribute("content"))||(t==null?void 0:t.getAttribute("datetime"))||(t==null?void 0:t.innerText);return n?$r(n):null}function Jl(e){const t=document.querySelector('meta[property*="published_time"]')||e.querySelector('[itemprop="datePublished"]')||document.querySelector('[itemprop="datePublished"]')||e.querySelector("time")||document.querySelector("time")||e.querySelector("[datetime]")||document.querySelector("[datetime]")||null,n=(t==null?void 0:t.getAttribute("content"))||(t==null?void 0:t.getAttribute("datetime"))||(t==null?void 0:t.innerText);return n?$r(n):null}function $r(e){try{return new Date(e).toISOString()}catch{return null}}function Gr(){return location.protocol+"//"+location.host+location.pathname}let en=null;async function Zr(e,t,{hash:n=Vr(t),params:r={}}={}){const i=new Headers({"Content-Type":"application/json"}),a=Jt(),l=Br()?await Fr():!1,s=Ur(),c=$l();if(!a)throw new Error("No token was provided");const f=await fetch(Gt+`/external-pages/?api-token=${a}&include_title_details=true${l?"&editorial_mode_enabled=true":""}&language=${s}`,{headers:i,method:"POST",body:JSON.stringify({hash:n,url:e,metadata:c,page_text:t,...r})});if(!f.ok)throw f;return await f.json()}async function zn(e,t,{requireCompletedResult:n=!1,pollInterval:r=3e3,maxTries:i=600}={}){let a=Vr(t),l=0;en&&clearTimeout(en);const s=async(c,f)=>{try{const d=await Zr(e,t,{hash:a});if(n&&d.automation_enabled&&d.ai_running)throw new Error;d.link_injections=Wn(d.link_injections||[]),d.ai_injections=Wn(d.ai_injections||[]),c(d);return}catch{if(l++,l>=i){i>1&&console.error("Max poll limit exceeded. Please return later."),c();return}en=setTimeout(()=>s(c),r)}};return new Promise(s)}async function Xl(e,t){var l;const n=(l=window.PlayPilotLinkInjections)==null?void 0:l.selector,i=e.filter(s=>s.manual).map(s=>({sid:s.sid,title:s.title,sentence:s.sentence,playpilot_url:s.playpilot_url,after_article:!!s.after_article,after_article_style:s.after_article_style||null,in_text:s.in_text??!0,inactive:!!s.inactive,removed:!!s.removed}));if(!await Zr(Gr(),t,{params:{private_token:qr(),automation_enabled:!1,link_injections:i,text_selector:n}}))throw new Error("saveLinkInjections response was faulty");return e}async function Ql(){const e=new Headers({"Content-Type":"application/json"}),t=Jt();if(!t)throw new Error("No token was provided");const n=await fetch(Gt+`/domains/config?api-token=${t}`,{headers:e});if(!n.ok)throw n;try{return await n.json()||null}catch{return null}}function Wn(e){return e.map(t=>({...t,key:Jr(t.sid)}))}function Jr(e){return e+"-"+(Math.random()+1).toString(36).substring(7)}function Jt(){var e;return(e=window.PlayPilotLinkInjections)==null?void 0:e.token}function eo(){const e=navigator.userAgent.toLowerCase();return/bot|crawl|spider|google|baidu|bing|msn|teoma|slurp|yandex|facebookexternalhit|facebot/i.test(e)}var to=Pe('<svg width="16" height="16" viewBox="0 0 16 16" fill="none"><path d="M14 2L2 14M2 2L14 14" stroke="currentColor" stroke-width="1.33" stroke-linecap="round" stroke-linejoin="round"></path></svg>');function no(e){var t=to();b(e,t)}function Cn(e,t){re(t,!0);const n=R(t,"size",3,"margin(2)"),r=R(t,"onclick",3,()=>null),i=La(t,["$$slots","$$events","$$legacy","children","size","onclick"]);var a=ze(),l=ee(a);ya(l,()=>t.href?"a":"button",!1,(s,c)=>{let f;O(()=>{f=xa(s,f,{role:t.href?"link":"button",onclick:r(),class:"button",...i},"svelte-1qqv88o",s.namespaceURI===nr,s.nodeName.includes("-")),$t(s,"--size",n())});var d=ze(),o=ee(d);ht(o,()=>t.children??Ye),b(c,d)}),b(e,a),ie()}var ro=(e,t)=>t()(),io=A('<div class="modal svelte-1riopfw"><div class="dialog svelte-1riopfw" role="dialog"><div class="close svelte-1riopfw"><!></div> <!></div> <div class="backdrop svelte-1riopfw"></div></div>');function ao(e,t){re(t,!0);const n=R(t,"onclose",3,()=>null),r=R(t,"onscroll",3,()=>null);Ir("scope","modal"),nt(()=>{const o=document.body.style.overflowY;return document.body.style.overflowY="hidden",()=>document.body.style.overflowY=o||""});function i(o){return window.innerWidth<600?Zt(o,{duration:250,y:window.innerHeight}):Fa(o,{duration:150,start:.85})}var a=io();se("keydown",ve,({key:o})=>{o==="Escape"&&n()()});var l=S(a),s=S(l),c=S(s);Cn(c,{onclick:()=>n()(),children:(o,v)=>{no(o)},$$slots:{default:!0}});var f=I(s,2);ht(f,()=>t.children);var d=I(l,2);d.__click=[ro,n],se("scroll",l,function(...o){var v;(v=r())==null||v.apply(this,o)}),De(3,l,()=>i),De(3,a,()=>Kr,()=>({duration:150})),b(e,a),ie()}ue(["click"]);function lo(e,t){re(t,!0),Ne(Ae.TitleModalView,t.title);let n=!1;function r(){n||(Ne(Ae.TitleModalScroll,t.title),n=!0)}ao(e,{get onclose(){return t.onclose},onscroll:r,children:(i,a)=>{Wr(i,{get title(){return t.title}})},$$slots:{default:!0}}),ie()}var oo=Pe('<svg width="8" height="4" viewBox="0 0 8 4" fill="none" class="svelte-by11ix"><path d="M1 0.5L4 3.5L7 0.5" stroke="currentColor" stroke-width="0.9975" stroke-linecap="round" stroke-linejoin="round"></path></svg>');function so(e,t){const n=R(t,"expanded",3,!1);var r=oo();O(()=>oe(r,"expanded",n())),b(e,r)}function co(e,t,n){t(!t()),n()(t())}var uo=A('<button class="switch svelte-91s87b"><div class="label svelte-91s87b"><!></div> <div class="track svelte-91s87b"><div class="knob svelte-91s87b"></div></div></button>');function dn(e,t){re(t,!0);let n=R(t,"active",15),r=R(t,"fullwidth",3,!1),i=R(t,"label",3,""),a=R(t,"onclick",3,()=>null);var l=uo();l.__click=[co,n,a];var s=S(l),c=S(s);ht(c,()=>t.children),O(()=>{ne(l,"aria-label",`Toggle ${i()??""} ${(n()?"off":"on")??""}`),oe(l,"active",n()),oe(l,"fullwidth",r())}),b(e,l),ie()}ue(["click"]);var fo=A('<input type="text" class="svelte-1vrer3i">');function Pn(e,t){let n=R(t,"value",15),r=R(t,"label",3,""),i=R(t,"name",3,""),a=R(t,"readonly",3,!1),l=R(t,"oninput",3,()=>null);var s=fo();s.__input=function(...c){var f;(f=l())==null||f.apply(this,c)},O(()=>{ne(s,"name",i()),ne(s,"aria-label",r()),ne(s,"placeholder",r()),s.readOnly=a()}),Aa(s,n),b(e,s)}ue(["input"]);var vo=Pe('<path d="M13.5833 13.6667L4.41667 13.6667M5.5 1.5H12.5C13.9001 1.5 14.6002 1.5 15.135 1.77248C15.6054 2.01217 15.9878 2.39462 16.2275 2.86502C16.5 3.3998 16.5 4.09987 16.5 5.5V12.5C16.5 13.9001 16.5 14.6002 16.2275 15.135C15.9878 15.6054 15.6054 15.9878 15.135 16.2275C14.6002 16.5 13.9001 16.5 12.5 16.5H5.5C4.09987 16.5 3.3998 16.5 2.86502 16.2275C2.39462 15.9878 2.01217 15.6054 1.77248 15.135C1.5 14.6002 1.5 13.9001 1.5 12.5V5.5C1.5 4.09987 1.5 3.3998 1.77248 2.86502C2.01217 2.39462 2.39462 2.01217 2.86502 1.77248C3.3998 1.5 4.09987 1.5 5.5 1.5Z" stroke="currentColor" stroke-width="1.25" stroke-linecap="round" stroke-linejoin="round"></path>'),_o=Pe('<path d="M13.5833 8.58342H4.41667M5.5 1.50009H12.5C13.9001 1.50009 14.6002 1.50009 15.135 1.77258C15.6054 2.01226 15.9878 2.39471 16.2275 2.86512C16.5 3.39989 16.5 4.09996 16.5 5.50009V12.5001C16.5 13.9002 16.5 14.6003 16.2275 15.1351C15.9878 15.6055 15.6054 15.9879 15.135 16.2276C14.6002 16.5001 13.9001 16.5001 12.5 16.5001H5.5C4.09987 16.5001 3.3998 16.5001 2.86502 16.2276C2.39462 15.9879 2.01217 15.6055 1.77248 15.1351C1.5 14.6003 1.5 13.9002 1.5 12.5001V5.50009C1.5 4.09996 1.5 3.39989 1.77248 2.86512C2.01217 2.39471 2.39462 2.01226 2.86502 1.77258C3.3998 1.50009 4.09987 1.50009 5.5 1.50009Z" stroke="currentColor" stroke-width="1.25" stroke-linecap="round" stroke-linejoin="round"></path>'),ho=Pe('<svg width="18" height="18" viewBox="0 0 18 18" fill="none"><!></svg>');function Yn(e,t){const n=R(t,"align",3,"bottom");var r=ho(),i=S(r);{var a=s=>{var c=vo();b(s,c)},l=s=>{var c=ze(),f=ee(c);{var d=o=>{var v=_o();b(o,v)};H(f,o=>{n()==="center"&&o(d)},!0)}b(s,c)};H(i,s=>{n()==="bottom"?s(a):s(l,!1)})}b(e,r)}var mo=A("<!> In-text Playlink",1),go=A("<!> Bottom Playlink",1),po=(e,t)=>t().after_article_style="playlinks",yo=(e,t)=>t().after_article_style="modal_button",wo=A('<div><div class="label svelte-14krcvc">Bottom playlinks style</div> <div class="group svelte-14krcvc" role="listbox" tabindex="0" aria-label="Playlink type"><button role="option" id="playlinks-in-text" class="svelte-14krcvc">Playlinks sentence</button> <button role="option" id="playlinks-after-article" class="svelte-14krcvc">Modal button</button> <div class="active-marker svelte-14krcvc"></div></div></div>'),ko=A('<div class="switches svelte-14krcvc"><!> <!></div> <!>',1);function bo(e,t){re(t,!0);const n=R(t,"linkInjection",7),r=K(()=>n().after_article_style==="modal_button");var i=ko(),a=ee(i),l=S(a),s=K(()=>n().in_text??!0);dn(l,{fullwidth:!0,get active(){return u(s)},onclick:v=>{n().in_text=v,n().manual=!0},label:"In-text Playlink",children:(v,m)=>{var g=mo(),h=ee(g);Yn(h,{align:"center"}),b(v,g)},$$slots:{default:!0}});var c=I(l,2),f=K(()=>n().after_article??!1);dn(c,{fullwidth:!0,get active(){return u(f)},onclick:v=>{n().after_article=v,n().manual=!0},label:"Bottom Playlink",children:(v,m)=>{var g=go(),h=ee(g);Yn(h,{align:"bottom"}),b(v,g)},$$slots:{default:!0}});var d=I(a,2);{var o=v=>{var m=wo(),g=I(S(m),2),h=S(g);h.__click=[po,n];var p=I(h,2);p.__click=[yo,n];var y=I(p,2);O(()=>{ne(g,"aria-activedescendant",`playlinks-${(u(r)?"after-article":"in-text")??""}`),ne(h,"aria-selected",!u(r)||null),oe(h,"active",!u(r)),ne(p,"aria-selected",u(r)||null),oe(p,"active",u(r)),oe(y,"right",u(r))}),De(3,m,()=>Ht,()=>({duration:100})),b(v,m)};H(d,v=>{n().after_article&&v(o)})}b(e,i),ie()}ue(["click"]);var xo=A('<div class="alert svelte-1tq7qhv"><!></div>');function Ln(e,t){re(t,!0);var n=xo(),r=S(n);ht(r,()=>t.children),b(e,n),ie()}var So=Pe('<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M9.99984 10.8333C10.4601 10.8333 10.8332 10.4602 10.8332 10C10.8332 9.53977 10.4601 9.16668 9.99984 9.16668C9.5396 9.16668 9.1665 9.53977 9.1665 10C9.1665 10.4602 9.5396 10.8333 9.99984 10.8333Z" stroke="currentColor" stroke-width="1.66667" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.99984 5.00001C10.4601 5.00001 10.8332 4.62691 10.8332 4.16668C10.8332 3.70644 10.4601 3.33334 9.99984 3.33334C9.5396 3.33334 9.1665 3.70644 9.1665 4.16668C9.1665 4.62691 9.5396 5.00001 9.99984 5.00001Z" stroke="currentColor" stroke-width="1.66667" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.99984 16.6667C10.4601 16.6667 10.8332 16.2936 10.8332 15.8333C10.8332 15.3731 10.4601 15 9.99984 15C9.5396 15 9.1665 15.3731 9.1665 15.8333C9.1665 16.2936 9.5396 16.6667 9.99984 16.6667Z" stroke="currentColor" stroke-width="1.66667" stroke-linecap="round" stroke-linejoin="round"></path></svg>');function Eo(e){var t=So();b(e,t)}var To=(e,t)=>L(t,!u(t)),Io=A('<div class="content svelte-1fmy0wh"><!></div>'),Ao=A('<div class="context-menu svelte-1fmy0wh"><button class="svelte-1fmy0wh"><!></button> <!></div>');function Co(e,t){re(t,!0);let n=F(!1),r=F(null);function i(d){var v;const o=d.target;o===u(r)||(v=u(r))!=null&&v.contains(o)||L(n,!1)}var a=Ao();se("click",ve,i);var l=S(a);l.__click=[To,n];var s=S(l);Eo(s),ct(l,d=>L(r,d),()=>u(r));var c=I(l,2);{var f=d=>{var o=Io(),v=S(o);ht(v,()=>t.children),De(1,o,()=>Zt,()=>({duration:150,y:5})),b(d,o)};H(c,d=>{u(n)&&d(f)})}O(()=>{ne(l,"aria-label",t.ariaLabel),ne(l,"aria-expanded",u(n))}),b(e,a),ie()}ue(["click"]);function Po(e,t,n){requestAnimationFrame(()=>t());const r=e.target;if(["BUTTON","INPUT"].includes(r.nodeName)||r.closest("button")||r.closest("input"))return;const i=n()[0];i&&i.scrollIntoView({behavior:"smooth"})}var Lo=(e,t)=>L(t,!u(t)),Mo=A('<button class="expand-sentence svelte-1lxtpkd"> </button>'),Do=A('<button class="context-menu-action svelte-1lxtpkd">Remove</button>'),jo=(e,t)=>L(t,!u(t)),No=A('<div class="actions svelte-1lxtpkd"><button class="expand svelte-1lxtpkd" aria-label="Expand"><!></button> <!></div>'),Oo=A('<div class="expanded svelte-1lxtpkd"><div class="label svelte-1lxtpkd">Link URL</div> <!> <div class="label offset svelte-1lxtpkd">Layout options</div> <div class="type-select svelte-1lxtpkd"><!></div></div>'),Ro=A('<div class="item svelte-1lxtpkd"><div class="header svelte-1lxtpkd"><img class="poster svelte-1lxtpkd" alt="" width="32" height="48"> <div class="info svelte-1lxtpkd"><div class="title svelte-1lxtpkd"> </div> <div class="sentence svelte-1lxtpkd"><!> <!></div></div> <div class="context-menu svelte-1lxtpkd"><!></div></div> <div class="content svelte-1lxtpkd"><!> <!></div></div>');function Ho(e,t){re(t,!0);const n=R(t,"linkInjection",15),r=R(t,"onremove",3,()=>null),i=R(t,"onhighlight",3,()=>null),a=K(()=>n()||{}),l=K(()=>u(a).key),s=K(()=>u(a).sentence),c=K(()=>u(a).title_details),f=K(()=>u(a).failed),d=K(()=>u(a).inactive),o=K(()=>u(c)),v=K(()=>Ml(n().sentence,n().title,60));let m=F(!1),g=F(!1),h=F(!1),p=F(null);nt(()=>{u(f)&&Ne(Ae.InjectionFailed,u(o),{phrase:n().title,sentence:u(s)})});function y(Z=!0){x().forEach(le=>{le.classList.toggle("injection-highlight",Z)})}function w(Z){let Q=Z.target,le=Q==null?void 0:Q.dataset.playpilotInjectionKey;Q&&!le&&(Q=Q.closest(`[data-playpilot-injection-key="${u(l)}"]`),le=Q==null?void 0:Q.dataset.playpilotInjectionKey),L(h,le===u(l)),u(p)&&u(h)&&i()(u(p))}function x(){return Array.from(document.querySelectorAll(`[data-playpilot-injection-key="${u(l)}"]`))}var C=Ro();se("mouseover",ve,w),C.__click=[Po,y,x];var k=S(C),E=S(k),j=I(E,2),T=S(j),P=S(T),N=I(T,2),B=S(N);pa(B,()=>(u(g)?u(s):u(v)).replace(n().title,`<em>${n().title}</em>`));var W=I(B,2);{var X=Z=>{var Q=Mo();Q.__click=[Lo,g];var le=S(Q);O(()=>z(le,u(g)?"Less":"More")),b(Z,Q)};H(W,Z=>{u(v).length<u(s).length&&Z(X)})}var te=I(j,2),V=S(te);Co(V,{ariaLabel:"More options",children:(Z,Q)=>{var le=Do();le.__click=function(...M){var D;(D=r())==null||D.apply(this,M)},b(Z,le)},$$slots:{default:!0}});var U=I(k,2),ae=S(U);{var ke=Z=>{Ln(Z,{children:(Q,le)=>{var M=Ke("A match was found, but the link could not be injected.");b(Q,M)},$$slots:{default:!0}})},ge=Z=>{var Q=No(),le=S(Q);le.__click=[jo,m];var M=S(le);so(M,{get expanded(){return u(m)}});var D=I(le,2),J=K(()=>u(d)?"Inactive":"Visible"),me=K(()=>!n().inactive);dn(D,{get label(){return u(J)},get active(){return u(me)},onclick:be=>{n(n().inactive=!be,!0),n(n().manual=!0,!0)},children:(be,We)=>{var Ee=Ke();O(()=>z(Ee,u(d)?"Inactive":"Visible")),b(be,Ee)},$$slots:{default:!0}}),O(()=>ne(le,"aria-expanded",u(m))),b(Z,Q)};H(ae,Z=>{u(f)?Z(ke):Z(ge,!1)})}var Re=I(ae,2);{var Se=Z=>{var Q=Oo(),le=I(S(Q),2);Pn(le,{oninput:()=>n(n().manual=!0,!0),label:"Playlink URL",get value(){return n().playpilot_url},set value(J){n(n().playpilot_url=J,!0)}});var M=I(le,4),D=S(M);bo(D,{get linkInjection(){return n()}}),De(3,Q,()=>Ht,()=>({duration:100})),b(Z,Q)};H(Re,Z=>{u(m)&&Z(Se)})}ct(C,Z=>L(p,Z),()=>u(p)),O(()=>{oe(C,"highlighted",u(h)),oe(C,"inactive",u(d)),ne(E,"src",u(o).standing_poster),z(P,u(o).title)}),se("mouseenter",C,()=>y(!0)),se("mouseleave",C,()=>y(!1)),De(6,C,()=>Ht,()=>({duration:200})),b(e,C),ie()}ue(["click"]);var Fo=A('<button class="drag-handle svelte-19mcc5g" aria-label="Move editor"></button>');function qo(e,t){re(t,!0);let n=R(t,"element",7),r=R(t,"position",23,()=>({x:0,y:0})),i=R(t,"limit",19,()=>({x:0,y:0})),a=R(t,"onchange",3,()=>null),l=!1,s={x:0,y:0},c=r();nt(()=>{f(r().x,r().y)});function f(h,p){const y=window.innerWidth,w=window.innerHeight,x=n().clientWidth,C=n().clientHeight;h=Math.min(Math.max(h,i().x),y-x-i().x),p=Math.min(Math.max(p,i().y),w-C-i().y),n().style.right=h+"px",n().style.bottom=Math.max(p,i().y)+"px",r({x:h,y:p}),a()(r())}function d(h){var p,y;return{x:h.pageX||((p=h.touches)==null?void 0:p[0].pageX)||0,y:h.pageY||((y=h.touches)==null?void 0:y[0].pageY)||0}}function o(h){l=!0,s=d(h),c=r()}function v(h){if(!l)return;const p=d(h),y=p.x-s.x,w=p.y-s.y,x=c.x-y,C=c.y-w;f(x,C)}function m(){l&&(l=!1)}var g=Fo();se("mousemove",ve,v),se("touchmove",ve,v,void 0,!0),se("mouseup",ve,m),se("touchend",ve,m),se("resize",ve,()=>f(r().x,r().y)),g.__mousedown=o,g.__touchstart=o,b(e,g),ie()}ue(["mousedown","touchstart"]);var Bo=A('<button class="resize-handle svelte-1367ri6" aria-label="Move editor"></button>');function Vo(e,t){re(t,!0);let n=R(t,"element",7),r=R(t,"height",7,200),i=R(t,"onchange",3,()=>null);const a=16;let l=!1,s=0,c=r();nt(()=>{r()&&f(r())});function f(h){const p=window.getComputedStyle(n()).minHeight||"0",y=Math.max(parseInt(p),Math.min(h,m()));n().style.height=`${y}px`,r(y),i()(y)}function d(h){var p,y;l=!0,s=h.pageY||((y=(p=h.touches)==null?void 0:p[0])==null?void 0:y.pageY)||0,c=n().clientHeight}function o(h){var x,C;if(!l)return;const p=h.pageY||((C=(x=h.touches)==null?void 0:x[0])==null?void 0:C.pageY)||0,y=s-p,w=c+y;f(w)}function v(){l=!1}function m(){const h=window.innerHeight-n().getBoundingClientRect().bottom;return Math.max(window.innerHeight-a*2-h,0)}var g=Bo();se("mousemove",ve,o),se("touchmove",ve,o,void 0,!0),se("mouseup",ve,v),se("touchend",ve,v),se("resize",ve,()=>f(r())),g.__mousedown=d,g.__touchstart=d,b(e,g),ie()}ue(["mousedown","touchstart"]);var Uo=Pe('<svg width="4" height="8" viewBox="0 0 4 8" fill="none"><path d="M3.5 7L0.5 4L3.5 1" stroke="currentcolor" stroke-width="0.9975" stroke-linecap="round" stroke-linejoin="round"></path></svg>');function Ko(e){var t=Uo();b(e,t)}async function zo(e){const t=new Headers({"Content-Type":"application/json"}),n=Jt();if(!n)throw new Error("No token was provided");const r=await fetch(Gt+`/search/titles/?api-token=${n}&query=${e}`,{headers:t});if(!r.ok)throw r;return await r.json()}var Wo=Pe('<svg viewBox="0 -960 960 960" width="18" height="18"><path fill="currentColor" d="M200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h280v80H200v560h560v-280h80v280q0 33-23.5 56.5T760-120H200Zm188-212-56-56 372-372H560v-80h280v280h-80v-144L388-332Z"></path></svg>');function Yo(e){var t=Wo();b(e,t)}var $o=A("<div> </div>"),Go=e=>e.stopImmediatePropagation(),Zo=A('<button class="item svelte-tbzvlp"><img class="poster svelte-tbzvlp" alt="" width="28" height="42"> <div class="content"><div class="name svelte-tbzvlp"> </div> <div class="meta svelte-tbzvlp"><div class="imdb svelte-tbzvlp"><!> </div> <div> </div> <div> </div> <!></div></div> <a target="_blank" class="open-in-new-tab svelte-tbzvlp"><!></a></button>');function $n(e,t){re(t,!0);const n=R(t,"hoverable",3,!0),r=R(t,"onclick",3,()=>null);var i=Zo();i.__click=function(...k){var E;(E=r())==null||E.apply(this,k)};var a=S(i),l=I(a,2),s=S(l),c=S(s),f=I(s,2),d=S(f),o=S(d);zr(o);var v=I(o),m=I(d,2),g=S(m),h=I(m,2),p=S(h),y=I(h,2);{var w=k=>{var E=$o(),j=S(E);O(()=>z(j,`${t.title.length??""} min`)),b(k,E)};H(y,k=>{t.title.length&&k(w)})}var x=I(l,2);x.__click=[Go];var C=S(x);Yo(C),O(()=>{oe(i,"hoverable",n()),ne(a,"src",t.title.standing_poster),z(c,t.title.title),z(v,` ${t.title.imdb_score??""}`),z(g,t.title.year),z(p,t.title.type),ne(x,"href",`${Rr}/${t.title.type??""}/${t.title.slug??""}`)}),b(e,i),ie()}ue(["click"]);var Jo=A('<em class="empty svelte-1olb8n0">No results found</em>'),Xo=A('<div class="results svelte-1olb8n0" data-testid="search-results"></div>'),Qo=A('<div class="selected svelte-1olb8n0"><!></div>'),es=A('<div class="search svelte-1olb8n0"><!> <!> <!></div>');function ts(e,t){re(t,!0);let n=R(t,"onselect",3,()=>null),r=R(t,"query",15),i=F(Y([])),a=F(null),l=F(!1);Ut(()=>{r()&&s(r())});async function s(h){L(l,!0);try{L(i,Y(await zo(h)))}finally{L(l,!1)}}function c(h){r(h.title),L(a,Y(h)),n()(h)}var f=es(),d=S(f);Pn(d,{oninput:()=>L(a,null),name:"search",label:"Search...",get value(){return r()},set value(h){r(h)}});var o=I(d,2);{var v=h=>{var p=Xo();Qe(p,21,()=>u(i),y=>y.sid,(y,w)=>{$n(y,{get title(){return u(w)},onclick:()=>c(u(w))})},y=>{var w=ze(),x=ee(w);{var C=k=>{var E=Jo();b(k,E)};H(x,k=>{u(l)||k(C)})}b(y,w)}),b(h,p)};H(o,h=>{r()&&!u(a)&&h(v)})}var m=I(o,2);{var g=h=>{var p=Qo(),y=S(p);$n(y,{get title(){return u(a)},hoverable:!1}),b(h,p)};H(m,h=>{u(a)&&h(g)})}b(e,f),ie()}function ns(e,t,n,r,i,a){if(!u(t)||!u(n))return;const l=u(n).type==="movie"?"movie":"show",s=Rr+`/${l}/${u(n).slug}`,c={sid:u(n).sid,title:u(t),sentence:u(r),playpilot_url:s,key:Jr(u(n).sid),title_details:u(n),manual:!0};i.onsave(c),a()()}var rs=A('<div class="error svelte-l7tw17"><!></div>'),is=A('<section class="layout svelte-l7tw17"><div class="header svelte-l7tw17"><!> <h2 class="svelte-l7tw17">Add Playlink manually</h2></div> <p class="svelte-l7tw17">Highlight the text section in your post that you want to turn into a Playlink.</p> <label for="text" class="svelte-l7tw17">Selected text</label> <!> <!> <label for="text" class="svelte-l7tw17">Paired title</label> <!> <button class="save svelte-l7tw17">Add playlink</button></section>');function as(e,t){re(t,!0);let n=R(t,"htmlString",3,""),r=R(t,"onclose",3,()=>null),i=F(""),a=F(""),l=F(null),s=F(""),c=F("");nt(f);function f(){const k=window.getSelection();if(!(k!=null&&k.anchorNode)||!Tn().contains(k.anchorNode.parentElement))return;const E=k.toString().trim();if(!E)return;if(L(s,""),L(i,Y(E)),k.anchorNode!==k.focusNode){L(s,"Selection is broken up by multiple elements. Please select the text more directly.");return}L(c,Y(u(i))),L(a,Y(d(k,E)));const j=k.getRangeAt(0).commonAncestorContainer.textContent,T=xn(n());(!j||!T.includes(j))&&L(s,"Selection was not inside of given content")}function d(k,E){const j=k.getRangeAt(0);let T=j.startContainer;for(;(T.textContent||"").length<=E.length*3&&T.parentNode;)T=T.parentNode;if(!T||!T.textContent)return"";const P=T.textContent,N=o(T,j.startContainer,j.startOffset),B=o(T,j.endContainer,j.endOffset),W=P.slice(0,N).lastIndexOf("."),X=P.slice(B).match(/[.!?]/),te=X?B+X.index:P.length,V=W===-1?0:W+1,U=te;return P.slice(V,U+1).trim()}function o(k,E,j){let T=0;const P=k,N=B=>{var W;if(B===E)return T+=j,!0;B.nodeType===Node.TEXT_NODE&&(T+=((W=B.textContent)==null?void 0:W.length)||0);for(let X=B.firstChild;X;X=X.nextSibling)if(N(X))return!0;return!1};return N(P),T}function v(k){var E,j;L(l,Y(k)),(j=(E=window.getSelection())==null?void 0:E.removeAllRanges)==null||j.call(E)}var m=is();se("mouseup",ve,f);var g=S(m),h=S(g);Cn(h,{get onclick(){return r()},size:"24px",children:(k,E)=>{Ko(k)},$$slots:{default:!0}});var p=I(g,6);Pn(p,{get value(){return u(i)},label:"Select text on the page",name:"selected-text",readonly:!0});var y=I(p,2);{var w=k=>{var E=rs(),j=S(E);Ln(j,{children:(T,P)=>{var N=Ke();O(()=>z(N,u(s))),b(T,N)},$$slots:{default:!0}}),b(k,E)};H(y,k=>{u(s)&&k(w)})}var x=I(y,4);Dr(x,()=>u(a)+u(i),k=>{ts(k,{onselect:v,get query(){return u(c)},set query(E){L(c,Y(E))}})});var C=I(x,2);C.__click=[ns,i,l,a,t,r],O(()=>C.disabled=!u(i)||!u(l)),b(e,m),ie()}ue(["click"]);var ls=Pe('<svg width="24px" height="24px" viewBox="0 0 64 64" stroke-width="3" stroke="currentColor" fill="none"><circle cx="34.52" cy="11.43" r="5.82"></circle><circle cx="53.63" cy="31.6" r="5.82"></circle><circle cx="34.52" cy="50.57" r="5.82"></circle><circle cx="15.16" cy="42.03" r="5.82"></circle><circle cx="15.16" cy="19.27" r="5.82"></circle><circle cx="34.51" cy="29.27" r="4.7"></circle><line x1="20.17" y1="16.3" x2="28.9" y2="12.93"></line><line x1="38.6" y1="15.59" x2="49.48" y2="27.52"></line><line x1="50.07" y1="36.2" x2="38.67" y2="46.49"></line><line x1="18.36" y1="24.13" x2="30.91" y2="46.01"></line><line x1="20.31" y1="44.74" x2="28.7" y2="48.63"></line><line x1="17.34" y1="36.63" x2="31.37" y2="16.32"></line><line x1="20.52" y1="21.55" x2="30.34" y2="27.1"></line><line x1="39.22" y1="29.8" x2="47.81" y2="30.45"></line><line x1="34.51" y1="33.98" x2="34.52" y2="44.74"></line></svg>');function os(e){var t=ls();b(e,t)}var ss=A('AI links are currently processing. This can take several minutes.<br class="svelte-7ilatt"> You can add manual links while this is ongoing.',1),cs=(e,t,n,r)=>{t.onadd(u(n)),L(r,!0)},us=A('AI links are ready. <strong class="svelte-7ilatt"> </strong> New links will be used next time you refresh the page, or you can insert them now. <button class="button svelte-7ilatt">Add AI links</button>',1),ds=(e,t)=>L(t,!0),fs=A('AI links finished running, but no new links were found. <button class="button svelte-7ilatt">Dismiss</button>',1),vs=A('<div class="loading-bar svelte-7ilatt" data-testid="loading-bar"></div>'),_s=A('<div class="animator svelte-7ilatt"></div>'),hs=A('<div class="ai-indicator svelte-7ilatt"><div class="content svelte-7ilatt"><div class="icon svelte-7ilatt"><!></div> <div class="svelte-7ilatt"><!></div> <!></div> <div class="border svelte-7ilatt"><!></div></div>');function ms(e,t){re(t,!0);const n=R(t,"htmlString",3,""),r=K(()=>Math.min(Math.max(n().length*30,6e4),6e5));let i=F(!0),a=F(Y([])),l=F(!1);function s(o){L(i,!1),L(a,Y(o))}var c=ze(),f=ee(c);{var d=o=>{var v=hs(),m=S(v),g=S(m),h=S(g);os(h);var p=I(g,2),y=S(p);{var w=P=>{var N=ss();b(P,N)},x=P=>{var N=ze(),B=ee(N);{var W=te=>{var V=us(),U=I(ee(V)),ae=S(U),ke=I(U,2);ke.__click=[cs,t,a,l],O(()=>z(ae,`${u(a).length??""} New ${(u(a).length>1?"links were":"link was")??""} found.`)),b(te,V)},X=te=>{var V=fs(),U=I(ee(V));U.__click=[ds,l],b(te,V)};H(B,te=>{var V;(V=u(a))!=null&&V.length?te(W):te(X,!1)},!0)}b(P,N)};H(y,P=>{u(i)?P(w):P(x,!1)})}var C=I(p,2);{var k=P=>{var N=vs();O(()=>$t(N,"animation-duration",`${u(r)??""}ms`)),b(P,N)};H(C,P=>{u(i)&&P(k)})}var E=I(m,2),j=S(E);{var T=P=>{var N=_s();b(P,N)};H(j,P=>{u(i)&&P(T)})}O(()=>oe(v,"running",u(i))),b(o,v)};H(f,o=>{u(l)||o(d)})}return b(e,c),ie({notifyUserOfNewState:s})}ue(["click"]);async function gs(e,t,n,r,i,a,l){try{L(t,!0),L(n,!1),r(await Xl(r(),i())),L(a,Y(u(l)))}catch{L(n,!0)}finally{L(t,!1)}}var ps=A('<div class="handle svelte-1w9c21y"><!></div>'),ys=A('<!> <div class="handle svelte-1w9c21y"><!></div>',1),ws=A('<div class="loading svelte-1w9c21y">Loading...</div>'),ks=A('<div class="bubble svelte-1w9c21y"> </div> <!>',1),bs=A('<div class="error svelte-1w9c21y"><!></div>'),xs=A('<div class="empty svelte-1w9c21y">No links available. Add links manually by clicking the + button and select text to add a link to.</div>'),Ss=A('<button class="save svelte-1w9c21y"> </button>'),Es=A('<!> <div class="items svelte-1w9c21y"></div> <!>',1),Ts=A('<div class="panel playpilot-styled-scrollbar svelte-1w9c21y"><!></div>'),Is=A('<section class="editor playpilot-styled-scrollbar svelte-1w9c21y"><header class="header svelte-1w9c21y"><!> <h1 class="svelte-1w9c21y">Playlinks</h1> <!></header> <!> <!> <!></section>');function As(e,t){re(t,!0);let n=R(t,"linkInjections",15),r=R(t,"htmlString",3,""),i=R(t,"loading",3,!1),a=R(t,"aiRunning",3,!1);const l="editor-position",s="editor-height";let c=F(null),f=Y(JSON.parse(localStorage.getItem(l)||'{ "x": 0, "y": 0 }')),d=Y(parseInt(localStorage.getItem(s)||"0")),o=F(!1),v=F(!1),m=F(!1),g=F(0),h=F(""),p=F(void 0);const y=K(()=>JSON.stringify(n())),w=K(()=>u(h)!==u(y)),x=K(()=>n().filter(M=>M.title_details&&!M.removed&&!M.duplicate&&(M.manual||!M.manual&&!M.failed))),C=K(()=>k(u(x)));Ut(()=>{i()||Je(()=>{L(h,Y(u(y))),N()})});function k(M){return M.sort((D,J)=>D.failed!==J.failed?D.failed?1:-1:D.title_details.title.localeCompare(J.title_details.title))}function E(M,D){localStorage.setItem(M,D)}function j(M){const D=n().findIndex(J=>J.key===M);n(n()[D].manual=!0,!0),n(n()[D].removed=!0,!0),n([...n()])}function T(M){if(!u(c))return;const D=M.offsetTop,J=D+M.offsetHeight,me=u(c).scrollTop,be=me+u(c).clientHeight;D>=me&&J<=be||u(c).scrollTo({top:D-u(c).clientHeight/2,behavior:"smooth"})}function P(M){const D=M.target;L(g,Y(D.scrollTop))}function N(){const M={total:n().length.toString(),failed_automatic:n().filter(D=>D.failed&&!D.manual).length.toString(),failed_manual:n().filter(D=>D.failed&&D.manual).length.toString(),final_injected:u(x).length.toString()};Ne(Ae.TotalInjectionsCount,null,M)}function B(M){const D=M.filter(J=>{if(In(J))return!n().some(me=>An(J,me))});u(p).notifyUserOfNewState(D)}var W=Is(),X=S(W),te=S(X);{var V=M=>{var D=ys(),J=ee(D);{var me=Ee=>{var ce=ps(),de=S(ce);Vo(de,{get element(){return u(c)},get height(){return d},onchange:qe=>E(s,JSON.stringify(qe))}),b(Ee,ce)};H(J,Ee=>{i()||Ee(me)})}var be=I(J,2),We=S(be);qo(We,{get element(){return u(c)},get position(){return f},limit:{x:16,y:16},onchange:Ee=>E(l,JSON.stringify(Ee))}),b(M,D)};H(te,M=>{u(c)&&M(V)})}var U=I(te,4);{var ae=M=>{var D=ws();b(M,D)},ke=M=>{var D=ks(),J=ee(D),me=S(J),be=I(J,2);Cn(be,{onclick:()=>L(o,!0),size:"24px","aria-label":"Add manual injection",children:(We,Ee)=>{var ce=Ke("+");b(We,ce)},$$slots:{default:!0}}),O(()=>{ne(J,"aria-label",`${u(x).length??""} found playlinks`),z(me,u(x).length)}),b(M,D)};H(U,M=>{i()?M(ae):M(ke,!1)})}var ge=I(X,2);{var Re=M=>{ct(ms(M,{get htmlString(){return r()},onadd:D=>D.forEach(J=>n().push(J))}),D=>L(p,Y(D)),()=>u(p))};H(ge,M=>{!i()&&a()&&M(Re)})}var Se=I(ge,2);{var Z=M=>{var D=Es(),J=ee(D);{var me=ce=>{var de=bs(),qe=S(de);Ln(qe,{children:(mt,Ls)=>{var Xr=Ke("Something went wrong, check your links below.");b(mt,Xr)},$$slots:{default:!0}}),De(7,de,()=>Ht,()=>({duration:150})),b(ce,de)};H(J,ce=>{u(m)&&ce(me)})}var be=I(J,2);Qe(be,21,()=>u(C),ce=>ce.key,(ce,de)=>{const qe=K(()=>n().findIndex(mt=>mt.key===u(de).key));Ho(ce,{onremove:()=>j(u(de).key),onhighlight:T,get linkInjection(){return n()[u(qe)]},set linkInjection(mt){n(n()[u(qe)]=mt,!0)}})},ce=>{var de=xs();b(ce,de)});var We=I(be,2);{var Ee=ce=>{var de=Ss();de.__click=[gs,v,m,n,r,h,y];var qe=S(de);O(()=>{de.disabled=u(v),z(qe,u(v)?"Saving...":"Save links")}),De(1,de,()=>Kr,()=>({duration:100})),b(ce,de)};H(We,ce=>{u(w)&&n().length&&ce(Ee)})}b(M,D)};H(Se,M=>{i()||M(Z)})}var Q=I(Se,2);{var le=M=>{var D=Ts(),J=S(D);as(J,{get htmlString(){return r()},onclose:()=>L(o,!1),onsave:me=>n().push(me)}),O(()=>$t(D,"top",`${u(g)??""}px`)),De(3,D,()=>Zt,()=>({x:Math.min(window.innerWidth,320),duration:200,opacity:1})),b(M,D)};H(Q,M=>{u(o)&&M(le)})}return ct(W,M=>L(c,M),()=>u(c)),O(()=>{oe(W,"panel-open",u(o)),oe(W,"loading",i())}),se("scroll",W,P),b(e,W),ie({requestNewAIInjections:B})}ue(["click"]);var Cs=A('<div class="playpilot-link-injections svelte-4l9ehd"><!> <!></div>');function Ps(e,t){re(t,!0);const n=Tn(),r=jl(n),i=r.map(T=>T.outerHTML).join(""),a=Br();let l=F(null),s=F(null),c=F(!1),f=F(!0),d=F(Y([])),o=F(void 0);const v=K(()=>u(l)||{}),m=K(()=>Mn(u(v).ai_injections,()=>[],!0)),g=K(()=>Mn(u(v).link_injections,()=>[],!0));Ut(()=>{a&&p()}),nt(()=>{if(!eo())return Ne(Ae.ArticlePageView),h(),()=>un()});async function h(){var N;a&&L(c,Y(await Fr()));const T=Gr();try{const B=await Ql();if(!a&&(B!=null&&B.exclude_urls_pattern)&&T.match(B.exclude_urls_pattern))return}catch(B){Ne(Ae.FetchingConfigFailed),console.error("TPI Config failed to fetch",B);return}if(L(l,Y(await zn(T,i,{maxTries:1}))),y({aiInjections:u(m),manualInjections:u(g)}),L(f,!1),!((N=u(l))!=null&&N.ai_running)||!a)return;const P=await zn(T,i,{requireCompletedResult:!0});u(o).requestNewAIInjections((P==null?void 0:P.ai_injections)||[])}function p(){un(),y(Kl(u(d)))}function y(T={aiInjections:u(m),manualInjections:u(g)}){if(!u(m).length&&!u(g).length)return;const P=Nl(r,w,T);JSON.stringify(P)!==JSON.stringify(u(d))&&L(d,Y(P))}function w(T){L(s,Y(T))}var x=Cs(),C=S(x);{var k=T=>{var P=K(()=>{var N,B;return((N=u(l))==null?void 0:N.ai_running)&&((B=u(l))==null?void 0:B.automation_enabled)});ct(As(T,{htmlString:i,get loading(){return u(f)},get aiRunning(){return u(P)},get linkInjections(){return u(d)},set linkInjections(N){L(d,Y(N))}}),N=>L(o,Y(N)),()=>u(o))};H(C,T=>{a&&u(c)&&T(k)})}var E=I(C,2);{var j=T=>{lo(T,{get title(){return u(s).title_details},onclose:()=>L(s,null)})};H(E,T=>{u(s)&&u(s).title_details&&T(j)})}b(e,x),ie()}window.PlayPilotLinkInjections={token:"",editorial_token:"",selector:"",language:null,app:null,initialize(e={token:"",selector:"",language:null,editorial_token:""}){if(!e.token){console.error("An API token is required.");return}this.token=e.token,this.editorial_token=e.editorial_token,this.selector=e.selector,this.language=e.language,this.app&&this.destroy();const t=document.createElement("div");t.id="playpilot-link-injection",document.body.insertAdjacentElement("beforeend",t),this.app=kn(Ps,{target:t})},destroy(){if(!this.app)return;this.app=null;const e=document.getElementById("playpilot-link-injection");e&&e.remove(),un()}};
|
|
9
9
|
|
|
10
10
|
})();
|
package/package.json
CHANGED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Detect whether the user is a bot or crawler simply by their user agent.
|
|
3
|
+
*/
|
|
4
|
+
export function isCrawler(): boolean {
|
|
5
|
+
const userAgent = navigator.userAgent.toLowerCase()
|
|
6
|
+
return /bot|crawl|spider|google|baidu|bing|msn|teoma|slurp|yandex|facebookexternalhit|facebot/i.test(userAgent)
|
|
7
|
+
}
|
package/src/routes/+page.svelte
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
import { clearLinkInjections, getLinkInjectionElements, getLinkInjectionsParentElement, injectLinksInDocument, separateLinkInjectionTypes } from '$lib/linkInjection'
|
|
5
5
|
import { track } from '$lib/tracking'
|
|
6
6
|
import { getFullUrlPath } from '$lib/url'
|
|
7
|
+
import { isCrawler } from '$lib/crawler'
|
|
7
8
|
import { TrackingEvent } from '$lib/enums/TrackingEvent'
|
|
8
9
|
import { authorize, isEditorialModeEnabled } from '$lib/auth'
|
|
9
10
|
import TitleModal from './components/TitleModal.svelte'
|
|
@@ -31,6 +32,8 @@
|
|
|
31
32
|
})
|
|
32
33
|
|
|
33
34
|
onMount(() => {
|
|
35
|
+
if (isCrawler()) return
|
|
36
|
+
|
|
34
37
|
track(TrackingEvent.ArticlePageView)
|
|
35
38
|
|
|
36
39
|
initialize()
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { describe, it, expect, afterEach } from 'vitest'
|
|
2
|
+
import { isCrawler } from '$lib/crawler'
|
|
3
|
+
|
|
4
|
+
describe('$lib/crawler', () => {
|
|
5
|
+
describe('isCrawler', () => {
|
|
6
|
+
const originalUserAgent = navigator.userAgent
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* @param {string} value
|
|
10
|
+
*/
|
|
11
|
+
function mockUserAgent(value) {
|
|
12
|
+
Object.defineProperty(navigator, 'userAgent', {
|
|
13
|
+
value,
|
|
14
|
+
configurable: true,
|
|
15
|
+
})
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
afterEach(() => mockUserAgent(originalUserAgent))
|
|
19
|
+
|
|
20
|
+
it('Should return true various specific crawlers', () => {
|
|
21
|
+
mockUserAgent('Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)')
|
|
22
|
+
expect(isCrawler()).toBe(true)
|
|
23
|
+
|
|
24
|
+
mockUserAgent('Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2228.0 Safari/537.36 BingPreview/1.0b')
|
|
25
|
+
expect(isCrawler()).toBe(true)
|
|
26
|
+
})
|
|
27
|
+
|
|
28
|
+
it('Should return true for general bot user agents', () => {
|
|
29
|
+
mockUserAgent('bot')
|
|
30
|
+
expect(isCrawler()).toBe(true)
|
|
31
|
+
|
|
32
|
+
mockUserAgent('crawl')
|
|
33
|
+
expect(isCrawler()).toBe(true)
|
|
34
|
+
|
|
35
|
+
mockUserAgent('spider')
|
|
36
|
+
expect(isCrawler()).toBe(true)
|
|
37
|
+
})
|
|
38
|
+
|
|
39
|
+
it('Should return false for regular user agents', () => {
|
|
40
|
+
mockUserAgent('Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36')
|
|
41
|
+
expect(isCrawler()).toBe(false)
|
|
42
|
+
|
|
43
|
+
mockUserAgent('Mozilla/5.0 (iPhone; CPU iPhone OS 14_6 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0.3 Mobile/15E148 Safari/604.1')
|
|
44
|
+
expect(isCrawler()).toBe(false)
|
|
45
|
+
})
|
|
46
|
+
})
|
|
47
|
+
})
|
|
@@ -6,6 +6,7 @@ import { fetchConfig, pollLinkInjections } from '$lib/api'
|
|
|
6
6
|
import { track } from '$lib/tracking'
|
|
7
7
|
import { TrackingEvent } from '$lib/enums/TrackingEvent'
|
|
8
8
|
import { authorize } from '$lib/auth'
|
|
9
|
+
import { isCrawler } from '$lib/crawler'
|
|
9
10
|
|
|
10
11
|
vi.mock('$lib/api', () => ({
|
|
11
12
|
pollLinkInjections: vi.fn(),
|
|
@@ -24,6 +25,10 @@ vi.mock(import('$lib/auth'), async (importOriginal) => {
|
|
|
24
25
|
}
|
|
25
26
|
})
|
|
26
27
|
|
|
28
|
+
vi.mock('$lib/crawler', () => ({
|
|
29
|
+
isCrawler: vi.fn(() => false),
|
|
30
|
+
}))
|
|
31
|
+
|
|
27
32
|
vi.mock('$lib/url', () => ({
|
|
28
33
|
getFullUrlPath: () => '/test',
|
|
29
34
|
}))
|
|
@@ -132,6 +137,18 @@ describe('$routes/+page.svelte', () => {
|
|
|
132
137
|
expect(track).toHaveBeenCalledWith(TrackingEvent.ArticlePageView)
|
|
133
138
|
})
|
|
134
139
|
|
|
140
|
+
it('Should not initialize if isCrawler is true', async () => {
|
|
141
|
+
vi.mocked(isCrawler).mockReturnValueOnce(true)
|
|
142
|
+
|
|
143
|
+
render(page)
|
|
144
|
+
|
|
145
|
+
await new Promise(res => setTimeout(res)) // Await potential fetches
|
|
146
|
+
|
|
147
|
+
expect(track).not.toHaveBeenCalled()
|
|
148
|
+
expect(authorize).not.toHaveBeenCalled()
|
|
149
|
+
expect(pollLinkInjections).not.toHaveBeenCalled()
|
|
150
|
+
})
|
|
151
|
+
|
|
135
152
|
it('Should not inject if config exclude_urls_pattern matches current url', async () => {
|
|
136
153
|
vi.mocked(fetchConfig).mockResolvedValueOnce({ exclude_urls_pattern: '/t' })
|
|
137
154
|
|
|
@@ -28,11 +28,19 @@ describe('ResizeHandle.svelte', () => {
|
|
|
28
28
|
it('Should limit the height to elements minimum height', () => {
|
|
29
29
|
document.body.innerHTML = '<div style="min-height: 5px"></div>'
|
|
30
30
|
const element = /** @type {HTMLElement} */ (document.querySelector('div'))
|
|
31
|
-
render(ResizeHandle, { element, height:
|
|
31
|
+
render(ResizeHandle, { element, height: 1 })
|
|
32
32
|
|
|
33
33
|
expect(element?.style.height).toBe('5px')
|
|
34
34
|
})
|
|
35
35
|
|
|
36
|
+
it('Should not set height if height is 0', () => {
|
|
37
|
+
document.body.innerHTML = '<div></div>'
|
|
38
|
+
const element = /** @type {HTMLElement} */ (document.querySelector('div'))
|
|
39
|
+
render(ResizeHandle, { element, height: 0 })
|
|
40
|
+
|
|
41
|
+
expect(element?.style.height).not.toBeTruthy()
|
|
42
|
+
})
|
|
43
|
+
|
|
36
44
|
it('Should fire given onchange function when height changes', () => {
|
|
37
45
|
document.body.innerHTML = '<div></div>'
|
|
38
46
|
|