1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[730],{89730:(n,e,t)=>{t.r(e),t.d(e,{OptimizelyCms12Client:()=>c,default:()=>g});var l=t(73699),o=t(98731);function i(){let n=(0,l._)(['query GetAllRoutes($cursor: String, $pageSize: Int = 100, $typeFilter: [String] = "Page", $siteId: String = null)\n{\nContent(\n where: {\n _and: {\n _and: {\n RelativePath: { exist: true }\n ContentType: { in: $typeFilter }\n SiteId: { eq: $siteId }\n }\n RelativePath: { notIn: [""] }\n }\n },\n limit: $pageSize,\n cursor: $cursor\n) {\n items {\n path: RelativePath\n locale:Language { name: Name }\n contentLink: ContentLink { id: Id, workId: WorkId, guidValue: GuidValue }\n name: Name\n contentType: ContentType\n slug: RouteSegment\n changed: Changed\n published: StartPublish\n siteId: SiteId\n url: Url\n },\n cursor,\n total\n}\n}']);return i=function(){return n},n}let r=(0,o.J1)(i());function a(){let n=(0,l._)(["query GetRouteById($id: Int!, $workId: Int, $locale: [Locales]!) {\nContent(\n where: {\n ContentLink: {\n Id: {\n eq: $id\n }\n WorkId: {\n eq: $workId\n }\n }\n },\n locale: $locale\n limit: 1,\n orderBy: {\n ContentLink: {\n WorkId: DESC\n }\n Status: ASC\n }\n)\n{\n total,\n items {\n route: RelativePath\n url: Url\n locale:Language { name: Name }\n contentLink: ContentLink { id: Id, workId: WorkId, guidValue: GuidValue }\n name: Name,\n contentType: ContentType,\n slug: RouteSegment,\n changed: Changed,\n published: StartPublish\n siteId: SiteId\n }\n}\n}"]);return a=function(){return n},n}let u=(0,o.J1)(a());function s(){let n=(0,l._)(["query GetRouteByPath($path: [String!]!, $siteId: String) {\nContent(\n where: {\n _and: {\n RelativePath: {\n in: $path\n },\n SiteId: {\n eq:$siteId\n }\n }\n }\n)\n{\n total,\n items {\n route: RelativePath\n url: Url\n locale:Language { name: Name }\n contentLink: ContentLink { id: Id, workId: WorkId, guidValue: GuidValue }\n name: Name,\n contentType: ContentType,\n slug: RouteSegment,\n changed: Changed,\n published: StartPublish\n siteId: SiteId\n }\n}\n}"]);return s=function(){return n},n}let d=(0,o.J1)(s());class c{enablePreview(){throw Error("The CMS 12 implementation does not support preview mode")}disablePreview(){throw Error("The CMS 12 implementation does not support preview mode")}async getRoutes(n,e){var t,l,o,i,a,u,s,d,c,g,h;n.updateFlags({queryCache:!1},!0);let m=await n.request(r,{siteId:e,typeFilter:"Page"}),p=null!=(u=null==m||null==(t=m.Content)?void 0:t.items)?u:[],v=null!=(s=null==m||null==(l=m.Content)?void 0:l.total)?s:0,I=null!=(d=null==m||null==(o=m.Content)?void 0:o.cursor)?d:"";if(v>0&&""!==I&&v>p.length)for(;(null!=(c=null==m||null==(a=m.Content)||null==(i=a.items)?void 0:i.length)?c:0)>0&&p.length<v;)m=await n.request({document:r,variables:{cursor:I,siteId:e,typeFilter:"Page"}}),p=p.concat(null!=(h=null==(g=m.Content)?void 0:g.items)?h:[]);return n.restoreFlags(),p.map(this.tryConvertResponse.bind(this)).filter(this.isNotNullOrUndefined)}async getRouteByPath(n,e,t){var l,o,i,r,a,u;n.debug&&console.log("Resolving content info for ".concat(e," on ").concat(t?"site "+t:"all sites"));let s=await n.request({document:d,variables:{path:e,siteId:t}});if((null!=(a=null==(o=s.Content)||null==(l=o.items)?void 0:l.length)?a:0)===0){n.debug&&console.warn("No items in the resultset");return}if((null!=(u=null==(r=s.Content)||null==(i=r.items)?void 0:i.length)?u:0)>1)throw Error("Ambiguous URL provided, did you omit the siteId in a multi-channel setup?");return n.debug&&console.log("Resolved content info for ".concat(e," to:"),s.Content.items[0]),this.convertResponse(s.Content.items[0])}async getRouteById(n,e,t,l){var o,i,r;let[a,s]=this.parseIdString(e),d={id:a,workId:s,locale:t.replaceAll("-","_")};n.debug&&console.log("Resolving content by id:",JSON.stringify(d));let c=await n.request({document:u,variables:d});if((null==(o=c.Content)?void 0:o.total)>=1)return n.debug&&(null==(i=c.Content)?void 0:i.total)>1&&console.warn("Received multiple entries with this ID, returning the first one from: ".concat(((null==(r=c.Content)?void 0:r.items)||[]).map(n=>"".concat(n.contentLink.id,"_").concat(n.contentLink.workId,"_").concat(n.locale.name)).join("; "))),this.convertResponse(c.Content.items[0])}parseIdString(n){let e=-1,t=null;if(n.indexOf("_")>0)[e,t]=n.split("_").map(n=>{try{return Number.parseInt(n,10)}catch(n){return -1}}),t<0&&(t=null);else try{e=Number.parseInt(n,10)}catch(n){e=-1}return[e,t]}convertResponse(n){var e,t,l;return{...n,url:new URL(n.url),key:(null==(e=n.contentLink)?void 0:e.guidValue)||"",version:null==(l=n.contentLink)||null==(t=l.workId)?void 0:t.toString(),locale:n.locale.name,changed:n.changed?new Date(n.changed):null}}tryConvertResponse(n){try{return this.convertResponse(n)}catch(e){console.error("Unable to convert ".concat(JSON.stringify(n)," to Route"),e);return}}isNotNullOrUndefined(n){return null!=n&&void 0!=n}}let g=c}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.