(globalThis.webpackChunk_N_E=globalThis.webpackChunk_N_E||[]).push([[248],{28285:function(e,t,n){"use strict";n.d(t,{Z:function(){return a}});var r=n(62626),i=n(89131),s=n(49),o=n(11153);function a(e){return(0,r.Z)(e)||(0,i.Z)(e)||(0,s.Z)(e)||(0,o.Z)()}},9832:function(e,t,n){"use strict";n.d(t,{Dk:function(){return Dt},$Q:function(){return Ct},pc:function(){return Lt}});var r=n(95351),i=Object.defineProperty,s=(e,t,n)=>(((e,t,n)=>{t in e?i(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n})(e,"symbol"!=typeof t?t+"":t,n),n),o={0:8203,1:8204,2:8205,3:8290,4:8291,5:8288,6:65279,7:8289,8:119155,9:119156,a:119157,b:119158,c:119159,d:119160,e:119161,f:119162},a={0:8203,1:8204,2:8205,3:65279},c=new Array(4).fill(String.fromCodePoint(a[0])).join(""),l="\0";var u=Object.fromEntries(Object.entries(a).map((e=>e.reverse()))),p=Object.fromEntries(Object.entries(o).map((e=>e.reverse()))),h=`${Object.values(o).map((e=>`\\u{${e.toString(16)}}`)).join("")}`,d=new RegExp(`[${h}]{4,}`,"gu");function f(e){let t=e.match(d);if(t)return function(e,t=!1){let n=Array.from(e);if(n.length%2!==0)throw new Error("Encoded data has invalid length");if(n.length%4||!e.startsWith(c))return function(e,t){var n;let r=[];for(let c=.5*e.length;c--;){let t=`${p[e[2*c].codePointAt(0)]}${p[e[2*c+1].codePointAt(0)]}`;r.unshift(String.fromCharCode(parseInt(t,16)))}let i=[],s=[r.join("")],o=10;for(;s.length;){let e=s.shift();try{if(i.push(JSON.parse(e)),t)return i}catch(a){if(!o--)throw a;let t=+(null==(n=a.message.match(/\sposition\s(\d+)$/))?void 0:n[1]);if(!t)throw a;s.unshift(e.substring(0,t),e.substring(t))}}return i}(n,t);let r=[];for(let i=.25*n.length;i--;){let e=n.slice(4*i,4*i+4).map((e=>u[e.codePointAt(0)])).join("");r.unshift(String.fromCharCode(parseInt(e,4)))}if(t){r.shift();let e=r.indexOf(l);return-1===e&&(e=r.length),[JSON.parse(r.slice(0,e).join(""))]}return r.join("").split(l).filter(Boolean).map((e=>JSON.parse(e)))}(t[0],!0)[0]}function E(e){return f(e)}var v=Object.prototype.hasOwnProperty,m=Object.prototype.toString,y=function(e,t,n){if("[object Function]"!==m.call(t))throw new TypeError("iterator must be a function");var r=e.length;if(r===+r)for(var i=0;i(...t)=>{N&&console[e](...t)},O={error:I("error"),warn:I("warn"),log:I("log")};const b="Collection";function A(e,t,n){const r={...t,method:e,from:"live-preview",source:"live-preview-sdk",location:window.location.href,version:T};O.log("Send message",r),n.forEach((e=>{var t;null==(t=window.top)||t.postMessage(r,e)}))}class S{constructor(e,t){s(this,"storageKey"),s(this,"value"),this.storageKey=e,this.value=this.restoreSessionData()||t}getKey(e,t){return`${e}-${t}`}restoreSessionData(){try{const e=window.sessionStorage.getItem(this.storageKey),t=e?JSON.parse(e):null;return Array.isArray(t)?new Map(t):null}catch{return null}}get(e,t){return this.value.get(this.getKey(e,t))}set(e,t,n){this.value.set(this.getKey(e,t),n);try{window.sessionStorage.setItem(this.storageKey,JSON.stringify(Array.from(this.value.entries())))}catch{O.warn(`StorageMap: Failed to set data for key "${e}" in sessionStorage`)}}clear(){this.value.clear();try{window.sessionStorage.removeItem(this.storageKey)}catch{O.warn("StorageMap: Failed to clear data from sessionStorage")}}}function D(e,t){var n,r;const i=[];for(const s of e)"Field"===s.kind&&(i.push({name:s.name.value,alias:null==(n=s.alias)?void 0:n.value,__typename:t}),null!=(r=s.selectionSet)&&r.selections&&i.push(...D(s.selectionSet.selections,C(s,t))));return i}function L(e){var t;const n=[];for(const i of e.definitions)if("OperationDefinition"===i.kind||"FragmentDefinition"===i.kind){const e="typeCondition"in i?i.typeCondition.name.value:null==(t=i.name)?void 0:t.value;if(!e){console.warn("Could not generate __typename for query definition",i);continue}for(const t of i.selectionSet.selections)"Field"===t.kind&&n.push(...D(i.selectionSet.selections,e))}const r=new Map;for(const{__typename:i,alias:s,name:o}of n){const e=r.get(i)||{alias:new Map,fields:new Set};e.fields.add(o),s&&e.alias.set(o,s),r.set(i,e)}return r}function C(e,t){return"items"===e.name.value&&function(e){if(e.endsWith(b))return function(e){return e.charAt(0).toUpperCase()+e.slice(1)}(e.replace(b,""))}(t)||e.name.value}var R=(e=>(e.FIELD_ID="data-contentful-field-id",e.ENTRY_ID="data-contentful-entry-id",e.ASSET_ID="data-contentful-asset-id",e.LOCALE="data-contentful-locale",e.SPACE="data-contentful-space",e.ENVIRONMENT="data-contentful-environment",e))(R||{}),x=(e=>(e.MOUSE_MOVE="MOUSE_MOVE",e.SCROLL_START="SCROLL_START",e.SCROLL_END="SCROLL_END",e.RESIZE_START="RESIZE_START",e.RESIZE_END="RESIZE_END",e.TAGGED_ELEMENTS="TAGGED_ELEMENTS",e.INSPECTOR_MODE_CHANGED="INSPECTOR_MODE_CHANGED",e))(x||{}),w={0:8203,1:8204,2:8205,3:8290,4:8291,5:8288,6:65279,7:8289,8:119155,9:119156,a:119157,b:119158,c:119159,d:119160,e:119161,f:119162},k={0:8203,1:8204,2:8205,3:65279};new Array(4).fill(String.fromCodePoint(k[0])).join(""),Object.fromEntries(Object.entries(k).map((e=>e.reverse()))),Object.fromEntries(Object.entries(w).map((e=>e.reverse())));var M=`${Object.values(w).map((e=>`\\u{${e.toString(16)}}`)).join("")}`,F=new RegExp(`[${M}]{4,}`,"gu");function P(e,t){if(!(e=>{if(!e||e.nodeType!==Node.ELEMENT_NODE)return!1;const t=e;return!(!t.hasAttribute(R.FIELD_ID)||!t.hasAttribute(R.ENTRY_ID)&&!t.hasAttribute(R.ASSET_ID))})(e))return null;const n={fieldId:e.getAttribute(R.FIELD_ID),locale:e.getAttribute(R.LOCALE)??t.locale,environment:e.getAttribute(R.ENVIRONMENT)??t.environment,space:e.getAttribute(R.SPACE)??t.space},r=e.getAttribute(R.ENTRY_ID);if(r)return{...n,entryId:r};const i=e.getAttribute(R.ASSET_ID);return i?{...n,assetId:i}:null}function U(e,t){return e.href===t.href}function j(e,t,n=3){if(0===n)return null;const r=e.parentElement;if(r){const i={sameInformation:0,tagged:0,all:0};let s=e.nextElementSibling;for(;s;){const e=E(s.textContent||"");e&&(i.tagged+=1,e.href===t.href&&(i.sameInformation=1)),i.all+=1,s=s.nextElementSibling}const o=j(r,t,n-1);if(o&&o.counters.sameInformation>=1)return o;if(i.sameInformation>=1)return{element:r,counters:i}}return null}function B(e){return e.matches("input[type=submit], input[type=button], input[type=reset]")?e.value:e.matches("img, video")?e.alt:Array.from(e.childNodes).filter((e=>e.nodeType===Node.TEXT_NODE&&!!e.textContent)).map((e=>e.textContent)).join("")}function K(e,t){for(const n of t)if(n===e||n.contains(e))return!0;return!1}function V(e=window.document,t){const n=[...t?[]:e.querySelectorAll(`[${R.ASSET_ID}][${R.FIELD_ID}], [${R.ENTRY_ID}][${R.FIELD_ID}]`)],r=[],i=function(e){let t=[];return"function"==typeof e.matches&&e.matches("*")&&(t=[e]),[...t,...Array.from(e.querySelectorAll("*:not(script,style,meta,title)"))].map((e=>({node:e,text:B(e)}))).filter((({text:e})=>!(!e||!e.match(F))))}("body"in e?e.body:e);for(const{node:o,text:a}of i){const e=E(a);if(!e||!e.origin.includes("contentful.com")||K(o,n)||r.some((t=>t.element.contains(o)&&U(t.sourceMap,e))))continue;if(o.matches("img")){const t=o.closest("figure")||o.closest("picture")||o;r.push({element:t,sourceMap:e});continue}const t=j(o,e);t?r.push({element:t.element,sourceMap:e}):r.push({element:o,sourceMap:e})}const s=r.filter(((e,t)=>r.findIndex((t=>function(e,t){return!(!U(e.sourceMap,t.sourceMap)||e.element!==t.element)}(e,t)))===t));for(const{element:o,sourceMap:a}of s)"Asset"===a.contentful.entityType?o.setAttribute(R.ASSET_ID,a.contentful.entity):o.setAttribute(R.ENTRY_ID,a.contentful.entity),o.setAttribute(R.FIELD_ID,a.contentful.field),o.setAttribute(R.LOCALE,a.contentful.locale),o.setAttribute(R.SPACE,a.contentful.space),o.setAttribute(R.ENVIRONMENT,a.contentful.environment),n.push(o);return n}function G(){return[...new Set(V().map((e=>e.getAttribute(R.ENTRY_ID))).filter(Boolean))]}class Y{constructor(e){s(this,"isScrolling",!1),s(this,"scrollTimeout"),s(this,"isResizing",!1),s(this,"resizeTimeout"),s(this,"hoveredElement"),s(this,"taggedElements",[]),s(this,"taggedElementMutationObserver"),s(this,"receiveMessage",(e=>{if(e.method===x.INSPECTOR_MODE_CHANGED){const{isInspectorActive:t}=e;t&&this.sendAllElements()}})),s(this,"addHoverListener",(()=>{const e=e=>{const t=e.composedPath();for(const n of t){const e=n;if("BODY"===e.nodeName)break;if("function"==typeof(null==e?void 0:e.getAttribute)&&this.handleTaggedElement(e))return}this.hoveredElement&&(this.hoveredElement=void 0,A(x.MOUSE_MOVE,{element:null},this.options.targetOrigin))};return window.addEventListener("mouseover",e),()=>window.removeEventListener("mouseover",e)})),s(this,"addScrollListener",(()=>{const{targetOrigin:e}=this.options,t=()=>{this.isScrolling||(this.isScrolling=!0,A(x.SCROLL_START,{},e)),this.scrollTimeout&&clearTimeout(this.scrollTimeout),this.scrollTimeout=setTimeout((()=>{this.isScrolling=!1,A(x.SCROLL_END,{},e),this.sendAllElements(),this.hoveredElement&&this.handleTaggedElement(this.hoveredElement)}),150)};return window.addEventListener("scroll",t),()=>window.removeEventListener("scroll",t)})),s(this,"addMutationListener",(()=>{const e=new MutationObserver((()=>{var e;const t=V();(null==(e=this.taggedElements)?void 0:e.length)!==t.length&&this.sendAllElements()}));return e.observe(document.body,{attributes:!0,attributeFilter:[R.ENTRY_ID,R.FIELD_ID,R.LOCALE,R.SPACE,R.ENVIRONMENT],childList:!0,subtree:!0}),()=>e.disconnect()})),s(this,"addResizeListener",(()=>{const{targetOrigin:e}=this.options,t=new ResizeObserver((()=>{this.isResizing||(this.isResizing=!0,A(x.RESIZE_START,{},e)),this.resizeTimeout&&clearTimeout(this.resizeTimeout),this.resizeTimeout=setTimeout((()=>{this.isResizing=!1,A(x.RESIZE_END,{},e),this.sendAllElements(),this.hoveredElement&&this.handleTaggedElement(this.hoveredElement)}),150)}));return t.observe(document.body),()=>t.disconnect()})),s(this,"handleTaggedElement",(e=>{const{targetOrigin:t,locale:n,space:r,environment:i}=this.options,s=P(e,{locale:n,space:r,environment:i});return!!s&&(this.hoveredElement=e,A(x.MOUSE_MOVE,{element:{attributes:s,coordinates:e.getBoundingClientRect()}},t),!0)})),s(this,"sendAllElements",(()=>{const{targetOrigin:e}=this.options,t=V();this.taggedElements=t,this.taggedElementMutationObserver&&this.taggedElementMutationObserver.disconnect();const n=()=>{A(x.TAGGED_ELEMENTS,{elements:t.map((e=>({coordinates:e.getBoundingClientRect()})))},e)};this.taggedElementMutationObserver=new MutationObserver(n),this.taggedElements.forEach((e=>{var t;null==(t=this.taggedElementMutationObserver)||t.observe(e,{attributes:!0,attributeFilter:[R.ENTRY_ID,R.FIELD_ID,R.LOCALE,R.SPACE,R.ENVIRONMENT],childList:!0,subtree:!0,characterData:!0})})),n()})),this.options=e,this.addHoverListener(),this.addScrollListener(),this.addMutationListener(),this.addResizeListener()}}const{parse:$,stringify:z}=JSON,q=String,H="object",Q=(e,t)=>t,J=(e,t,n)=>{const r=q(t.push(n)-1);return e.set(n,r),r},X=(e,t,n)=>{const r=t&&typeof t===H?(e,n)=>""===e||-1=t)break;n=i.index+i[0].length,r+=1}return{line:r,column:t+1-n}}function re(e){return ie(e.source,ne(e.source,e.start))}function ie(e,t){const n=e.locationOffset.column-1,r="".padStart(n)+e.body,i=t.line-1,s=e.locationOffset.line-1,o=t.line+s,a=1===t.line?n:0,c=t.column+a,l=`${e.name}:${o}:${c}\n`,u=r.split(/\r\n|[\n\r]/g),p=u[i];if(p.length>120){const e=Math.floor(c/80),t=c%80,n=[];for(let r=0;r["|",e])),["|","^".padStart(t)],["|",n[e+1]]])}return l+se([[o-1+" |",u[i-1]],[`${o} |`,p],["|","^".padStart(c)],[`${o+1} |`,u[i+1]]])}function se(e){const t=e.filter((([e,t])=>void 0!==t)),n=Math.max(...t.map((([e])=>e.length)));return t.map((([e,t])=>e.padStart(n)+(t?" "+t:""))).join("\n")}class oe extends Error{constructor(e,...t){var n,r,i;const{nodes:s,source:o,positions:a,path:c,originalError:l,extensions:u}=function(e){const t=e[0];return null==t||"kind"in t||"length"in t?{nodes:t,source:e[1],positions:e[2],path:e[3],originalError:e[4],extensions:e[5]}:t}(t);super(e),this.name="GraphQLError",this.path=c??void 0,this.originalError=l??void 0,this.nodes=ae(Array.isArray(s)?s:s?[s]:void 0);const p=ae(null===(n=this.nodes)||void 0===n?void 0:n.map((e=>e.loc)).filter((e=>null!=e)));this.source=o??(null==p||null===(r=p[0])||void 0===r?void 0:r.source),this.positions=a??(null==p?void 0:p.map((e=>e.start))),this.locations=a&&o?a.map((e=>ne(o,e))):null==p?void 0:p.map((e=>ne(e.source,e.start)));const h=function(e){return"object"==typeof e&&null!==e}(null==l?void 0:l.extensions)?null==l?void 0:l.extensions:void 0;this.extensions=null!==(i=u??h)&&void 0!==i?i:Object.create(null),Object.defineProperties(this,{message:{writable:!0,enumerable:!0},name:{enumerable:!1},nodes:{enumerable:!1},source:{enumerable:!1},positions:{enumerable:!1},originalError:{enumerable:!1}}),null!=l&&l.stack?Object.defineProperty(this,"stack",{value:l.stack,writable:!0,configurable:!0}):Error.captureStackTrace?Error.captureStackTrace(this,oe):Object.defineProperty(this,"stack",{value:Error().stack,writable:!0,configurable:!0})}get[Symbol.toStringTag](){return"GraphQLError"}toString(){let e=this.message;if(this.nodes)for(const t of this.nodes)t.loc&&(e+="\n\n"+re(t.loc));else if(this.source&&this.locations)for(const t of this.locations)e+="\n\n"+ie(this.source,t);return e}toJSON(){const e={message:this.message};return null!=this.locations&&(e.locations=this.locations),null!=this.path&&(e.path=this.path),null!=this.extensions&&Object.keys(this.extensions).length>0&&(e.extensions=this.extensions),e}}function ae(e){return void 0===e||0===e.length?void 0:e}function ce(e,t,n){return new oe(`Syntax Error: ${n}`,{source:e,positions:[t]})}class le{constructor(e,t,n){this.start=e.start,this.end=t.end,this.startToken=e,this.endToken=t,this.source=n}get[Symbol.toStringTag](){return"Location"}toJSON(){return{start:this.start,end:this.end}}}class ue{constructor(e,t,n,r,i,s){this.kind=e,this.start=t,this.end=n,this.line=r,this.column=i,this.value=s,this.prev=null,this.next=null}get[Symbol.toStringTag](){return"Token"}toJSON(){return{kind:this.kind,value:this.value,line:this.line,column:this.column}}}var pe,he,de,fe;function Ee(e){return 9===e||32===e}function ve(e){return e>=48&&e<=57}function me(e){return e>=97&&e<=122||e>=65&&e<=90}function ye(e){return me(e)||95===e}function _e(e){return me(e)||ve(e)||95===e}function Te(e){var t;let n=Number.MAX_SAFE_INTEGER,r=null,i=-1;for(let o=0;o0===t?e:e.slice(n))).slice(null!==(t=r)&&void 0!==t?t:0,i+1)}function Ne(e){let t=0;for(;t",e.EOF="",e.BANG="!",e.DOLLAR="$",e.AMP="&",e.PAREN_L="(",e.PAREN_R=")",e.SPREAD="...",e.COLON=":",e.EQUALS="=",e.AT="@",e.BRACKET_L="[",e.BRACKET_R="]",e.BRACE_L="{",e.PIPE="|",e.BRACE_R="}",e.NAME="Name",e.INT="Int",e.FLOAT="Float",e.STRING="String",e.BLOCK_STRING="BlockString",e.COMMENT="Comment"}(fe||(fe={}));class ge{constructor(e){const t=new ue(fe.SOF,0,0,0,0);this.source=e,this.lastToken=t,this.token=t,this.line=1,this.lineStart=0}get[Symbol.toStringTag](){return"Lexer"}advance(){return this.lastToken=this.token,this.token=this.lookahead()}lookahead(){let e=this.token;if(e.kind!==fe.EOF)do{if(e.next)e=e.next;else{const t=Le(this,e.end);e.next=t,t.prev=e,e=t}}while(e.kind===fe.COMMENT);return e}}function Ie(e){return e>=0&&e<=55295||e>=57344&&e<=1114111}function Oe(e,t){return be(e.charCodeAt(t))&&Ae(e.charCodeAt(t+1))}function be(e){return e>=55296&&e<=56319}function Ae(e){return e>=56320&&e<=57343}function Se(e,t){const n=e.source.body.codePointAt(t);if(void 0===n)return fe.EOF;if(n>=32&&n<=126){const e=String.fromCodePoint(n);return'"'===e?"'\"'":`"${e}"`}return"U+"+n.toString(16).toUpperCase().padStart(4,"0")}function De(e,t,n,r,i){const s=e.line,o=1+n-e.lineStart;return new ue(t,n,r,s,o,i)}function Le(e,t){const n=e.source.body,r=n.length;let i=t;for(;i=48&&e<=57?e-48:e>=65&&e<=70?e-55:e>=97&&e<=102?e-87:-1}function Ue(e,t){const n=e.source.body;switch(n.charCodeAt(t+1)){case 34:return{value:'"',size:2};case 92:return{value:"\\",size:2};case 47:return{value:"/",size:2};case 98:return{value:"\b",size:2};case 102:return{value:"\f",size:2};case 110:return{value:"\n",size:2};case 114:return{value:"\r",size:2};case 116:return{value:"\t",size:2}}throw ce(e.source,t,`Invalid character escape sequence: "${n.slice(t,t+2)}".`)}function je(e,t){const n=e.source.body,r=n.length;let i=e.lineStart,s=t+3,o=s,a="";const c=[];for(;s2)return"[Array]";const n=Math.min(10,e.length),r=e.length-n,i=[];for(let s=0;s1&&i.push(`... ${r} more items`),"["+i.join(", ")+"]"}(e,n);return function(e,t){const n=Object.entries(e);return 0===n.length?"{}":t.length>2?"["+function(e){const t=Object.prototype.toString.call(e).replace(/^\[object /,"").replace(/]$/,"");if("Object"===t&&"function"==typeof e.constructor){const t=e.constructor.name;if("string"==typeof t&&""!==t)return t}return t}(e)+"]":"{ "+n.map((([e,n])=>e+": "+Ve(n,t))).join(", ")+" }"}(e,n)}(e,t);default:return String(e)}}const Ge=globalThis.process&&"production"===globalThis.process.env.NODE_ENV?function(e,t){return e instanceof t}:function(e,t){if(e instanceof t)return!0;if("object"==typeof e&&null!==e){var n;const r=t.prototype[Symbol.toStringTag];if(r===(Symbol.toStringTag in e?e[Symbol.toStringTag]:null===(n=e.constructor)||void 0===n?void 0:n.name)){const t=Ke(e);throw new Error(`Cannot use ${r} "${t}" from another module or realm.\n\nEnsure that there is only one instance of "graphql" in the node_modules\ndirectory. If different versions of "graphql" are the dependencies of other\nrelied on modules, use "resolutions" to ensure only one version is installed.\n\nhttps://yarnpkg.com/en/docs/selective-version-resolutions\n\nDuplicate "graphql" modules cannot be used at the same time since different\nversions may have different capabilities and behavior. The data from one\nversion used in the function from another could produce confusing and\nspurious results.`)}}return!1};class Ye{constructor(e,t="GraphQL request",n={line:1,column:1}){"string"==typeof e||Z(!1,`Body must be a string. Received: ${Ke(e)}.`),this.body=e,this.name=t,this.locationOffset=n,this.locationOffset.line>0||Z(!1,"line in locationOffset is 1-indexed and must be positive."),this.locationOffset.column>0||Z(!1,"column in locationOffset is 1-indexed and must be positive.")}get[Symbol.toStringTag](){return"Source"}}class $e{constructor(e,t={}){const n=function(e){return Ge(e,Ye)}(e)?e:new Ye(e);this._lexer=new ge(n),this._options=t,this._tokenCounter=0}parseName(){const e=this.expectToken(fe.NAME);return this.node(e,{kind:de.NAME,value:e.value})}parseDocument(){return this.node(this._lexer.token,{kind:de.DOCUMENT,definitions:this.many(fe.SOF,this.parseDefinition,fe.EOF)})}parseDefinition(){if(this.peek(fe.BRACE_L))return this.parseOperationDefinition();const e=this.peekDescription(),t=e?this._lexer.lookahead():this._lexer.token;if(t.kind===fe.NAME){switch(t.value){case"schema":return this.parseSchemaDefinition();case"scalar":return this.parseScalarTypeDefinition();case"type":return this.parseObjectTypeDefinition();case"interface":return this.parseInterfaceTypeDefinition();case"union":return this.parseUnionTypeDefinition();case"enum":return this.parseEnumTypeDefinition();case"input":return this.parseInputObjectTypeDefinition();case"directive":return this.parseDirectiveDefinition()}if(e)throw ce(this._lexer.source,this._lexer.token.start,"Unexpected description, descriptions are supported only on type definitions.");switch(t.value){case"query":case"mutation":case"subscription":return this.parseOperationDefinition();case"fragment":return this.parseFragmentDefinition();case"extend":return this.parseTypeSystemExtension()}}throw this.unexpected(t)}parseOperationDefinition(){const e=this._lexer.token;if(this.peek(fe.BRACE_L))return this.node(e,{kind:de.OPERATION_DEFINITION,operation:pe.QUERY,name:void 0,variableDefinitions:[],directives:[],selectionSet:this.parseSelectionSet()});const t=this.parseOperationType();let n;return this.peek(fe.NAME)&&(n=this.parseName()),this.node(e,{kind:de.OPERATION_DEFINITION,operation:t,name:n,variableDefinitions:this.parseVariableDefinitions(),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()})}parseOperationType(){const e=this.expectToken(fe.NAME);switch(e.value){case"query":return pe.QUERY;case"mutation":return pe.MUTATION;case"subscription":return pe.SUBSCRIPTION}throw this.unexpected(e)}parseVariableDefinitions(){return this.optionalMany(fe.PAREN_L,this.parseVariableDefinition,fe.PAREN_R)}parseVariableDefinition(){return this.node(this._lexer.token,{kind:de.VARIABLE_DEFINITION,variable:this.parseVariable(),type:(this.expectToken(fe.COLON),this.parseTypeReference()),defaultValue:this.expectOptionalToken(fe.EQUALS)?this.parseConstValueLiteral():void 0,directives:this.parseConstDirectives()})}parseVariable(){const e=this._lexer.token;return this.expectToken(fe.DOLLAR),this.node(e,{kind:de.VARIABLE,name:this.parseName()})}parseSelectionSet(){return this.node(this._lexer.token,{kind:de.SELECTION_SET,selections:this.many(fe.BRACE_L,this.parseSelection,fe.BRACE_R)})}parseSelection(){return this.peek(fe.SPREAD)?this.parseFragment():this.parseField()}parseField(){const e=this._lexer.token,t=this.parseName();let n,r;return this.expectOptionalToken(fe.COLON)?(n=t,r=this.parseName()):r=t,this.node(e,{kind:de.FIELD,alias:n,name:r,arguments:this.parseArguments(!1),directives:this.parseDirectives(!1),selectionSet:this.peek(fe.BRACE_L)?this.parseSelectionSet():void 0})}parseArguments(e){const t=e?this.parseConstArgument:this.parseArgument;return this.optionalMany(fe.PAREN_L,t,fe.PAREN_R)}parseArgument(e=!1){const t=this._lexer.token,n=this.parseName();return this.expectToken(fe.COLON),this.node(t,{kind:de.ARGUMENT,name:n,value:this.parseValueLiteral(e)})}parseConstArgument(){return this.parseArgument(!0)}parseFragment(){const e=this._lexer.token;this.expectToken(fe.SPREAD);const t=this.expectOptionalKeyword("on");return!t&&this.peek(fe.NAME)?this.node(e,{kind:de.FRAGMENT_SPREAD,name:this.parseFragmentName(),directives:this.parseDirectives(!1)}):this.node(e,{kind:de.INLINE_FRAGMENT,typeCondition:t?this.parseNamedType():void 0,directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()})}parseFragmentDefinition(){const e=this._lexer.token;return this.expectKeyword("fragment"),!0===this._options.allowLegacyFragmentVariables?this.node(e,{kind:de.FRAGMENT_DEFINITION,name:this.parseFragmentName(),variableDefinitions:this.parseVariableDefinitions(),typeCondition:(this.expectKeyword("on"),this.parseNamedType()),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()}):this.node(e,{kind:de.FRAGMENT_DEFINITION,name:this.parseFragmentName(),typeCondition:(this.expectKeyword("on"),this.parseNamedType()),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()})}parseFragmentName(){if("on"===this._lexer.token.value)throw this.unexpected();return this.parseName()}parseValueLiteral(e){const t=this._lexer.token;switch(t.kind){case fe.BRACKET_L:return this.parseList(e);case fe.BRACE_L:return this.parseObject(e);case fe.INT:return this.advanceLexer(),this.node(t,{kind:de.INT,value:t.value});case fe.FLOAT:return this.advanceLexer(),this.node(t,{kind:de.FLOAT,value:t.value});case fe.STRING:case fe.BLOCK_STRING:return this.parseStringLiteral();case fe.NAME:switch(this.advanceLexer(),t.value){case"true":return this.node(t,{kind:de.BOOLEAN,value:!0});case"false":return this.node(t,{kind:de.BOOLEAN,value:!1});case"null":return this.node(t,{kind:de.NULL});default:return this.node(t,{kind:de.ENUM,value:t.value})}case fe.DOLLAR:if(e){if(this.expectToken(fe.DOLLAR),this._lexer.token.kind===fe.NAME){const e=this._lexer.token.value;throw ce(this._lexer.source,t.start,`Unexpected variable "$${e}" in constant value.`)}throw this.unexpected(t)}return this.parseVariable();default:throw this.unexpected()}}parseConstValueLiteral(){return this.parseValueLiteral(!0)}parseStringLiteral(){const e=this._lexer.token;return this.advanceLexer(),this.node(e,{kind:de.STRING,value:e.value,block:e.kind===fe.BLOCK_STRING})}parseList(e){return this.node(this._lexer.token,{kind:de.LIST,values:this.any(fe.BRACKET_L,(()=>this.parseValueLiteral(e)),fe.BRACKET_R)})}parseObject(e){return this.node(this._lexer.token,{kind:de.OBJECT,fields:this.any(fe.BRACE_L,(()=>this.parseObjectField(e)),fe.BRACE_R)})}parseObjectField(e){const t=this._lexer.token,n=this.parseName();return this.expectToken(fe.COLON),this.node(t,{kind:de.OBJECT_FIELD,name:n,value:this.parseValueLiteral(e)})}parseDirectives(e){const t=[];for(;this.peek(fe.AT);)t.push(this.parseDirective(e));return t}parseConstDirectives(){return this.parseDirectives(!0)}parseDirective(e){const t=this._lexer.token;return this.expectToken(fe.AT),this.node(t,{kind:de.DIRECTIVE,name:this.parseName(),arguments:this.parseArguments(e)})}parseTypeReference(){const e=this._lexer.token;let t;if(this.expectOptionalToken(fe.BRACKET_L)){const n=this.parseTypeReference();this.expectToken(fe.BRACKET_R),t=this.node(e,{kind:de.LIST_TYPE,type:n})}else t=this.parseNamedType();return this.expectOptionalToken(fe.BANG)?this.node(e,{kind:de.NON_NULL_TYPE,type:t}):t}parseNamedType(){return this.node(this._lexer.token,{kind:de.NAMED_TYPE,name:this.parseName()})}peekDescription(){return this.peek(fe.STRING)||this.peek(fe.BLOCK_STRING)}parseDescription(){if(this.peekDescription())return this.parseStringLiteral()}parseSchemaDefinition(){const e=this._lexer.token,t=this.parseDescription();this.expectKeyword("schema");const n=this.parseConstDirectives(),r=this.many(fe.BRACE_L,this.parseOperationTypeDefinition,fe.BRACE_R);return this.node(e,{kind:de.SCHEMA_DEFINITION,description:t,directives:n,operationTypes:r})}parseOperationTypeDefinition(){const e=this._lexer.token,t=this.parseOperationType();this.expectToken(fe.COLON);const n=this.parseNamedType();return this.node(e,{kind:de.OPERATION_TYPE_DEFINITION,operation:t,type:n})}parseScalarTypeDefinition(){const e=this._lexer.token,t=this.parseDescription();this.expectKeyword("scalar");const n=this.parseName(),r=this.parseConstDirectives();return this.node(e,{kind:de.SCALAR_TYPE_DEFINITION,description:t,name:n,directives:r})}parseObjectTypeDefinition(){const e=this._lexer.token,t=this.parseDescription();this.expectKeyword("type");const n=this.parseName(),r=this.parseImplementsInterfaces(),i=this.parseConstDirectives(),s=this.parseFieldsDefinition();return this.node(e,{kind:de.OBJECT_TYPE_DEFINITION,description:t,name:n,interfaces:r,directives:i,fields:s})}parseImplementsInterfaces(){return this.expectOptionalKeyword("implements")?this.delimitedMany(fe.AMP,this.parseNamedType):[]}parseFieldsDefinition(){return this.optionalMany(fe.BRACE_L,this.parseFieldDefinition,fe.BRACE_R)}parseFieldDefinition(){const e=this._lexer.token,t=this.parseDescription(),n=this.parseName(),r=this.parseArgumentDefs();this.expectToken(fe.COLON);const i=this.parseTypeReference(),s=this.parseConstDirectives();return this.node(e,{kind:de.FIELD_DEFINITION,description:t,name:n,arguments:r,type:i,directives:s})}parseArgumentDefs(){return this.optionalMany(fe.PAREN_L,this.parseInputValueDef,fe.PAREN_R)}parseInputValueDef(){const e=this._lexer.token,t=this.parseDescription(),n=this.parseName();this.expectToken(fe.COLON);const r=this.parseTypeReference();let i;this.expectOptionalToken(fe.EQUALS)&&(i=this.parseConstValueLiteral());const s=this.parseConstDirectives();return this.node(e,{kind:de.INPUT_VALUE_DEFINITION,description:t,name:n,type:r,defaultValue:i,directives:s})}parseInterfaceTypeDefinition(){const e=this._lexer.token,t=this.parseDescription();this.expectKeyword("interface");const n=this.parseName(),r=this.parseImplementsInterfaces(),i=this.parseConstDirectives(),s=this.parseFieldsDefinition();return this.node(e,{kind:de.INTERFACE_TYPE_DEFINITION,description:t,name:n,interfaces:r,directives:i,fields:s})}parseUnionTypeDefinition(){const e=this._lexer.token,t=this.parseDescription();this.expectKeyword("union");const n=this.parseName(),r=this.parseConstDirectives(),i=this.parseUnionMemberTypes();return this.node(e,{kind:de.UNION_TYPE_DEFINITION,description:t,name:n,directives:r,types:i})}parseUnionMemberTypes(){return this.expectOptionalToken(fe.EQUALS)?this.delimitedMany(fe.PIPE,this.parseNamedType):[]}parseEnumTypeDefinition(){const e=this._lexer.token,t=this.parseDescription();this.expectKeyword("enum");const n=this.parseName(),r=this.parseConstDirectives(),i=this.parseEnumValuesDefinition();return this.node(e,{kind:de.ENUM_TYPE_DEFINITION,description:t,name:n,directives:r,values:i})}parseEnumValuesDefinition(){return this.optionalMany(fe.BRACE_L,this.parseEnumValueDefinition,fe.BRACE_R)}parseEnumValueDefinition(){const e=this._lexer.token,t=this.parseDescription(),n=this.parseEnumValueName(),r=this.parseConstDirectives();return this.node(e,{kind:de.ENUM_VALUE_DEFINITION,description:t,name:n,directives:r})}parseEnumValueName(){if("true"===this._lexer.token.value||"false"===this._lexer.token.value||"null"===this._lexer.token.value)throw ce(this._lexer.source,this._lexer.token.start,`${ze(this._lexer.token)} is reserved and cannot be used for an enum value.`);return this.parseName()}parseInputObjectTypeDefinition(){const e=this._lexer.token,t=this.parseDescription();this.expectKeyword("input");const n=this.parseName(),r=this.parseConstDirectives(),i=this.parseInputFieldsDefinition();return this.node(e,{kind:de.INPUT_OBJECT_TYPE_DEFINITION,description:t,name:n,directives:r,fields:i})}parseInputFieldsDefinition(){return this.optionalMany(fe.BRACE_L,this.parseInputValueDef,fe.BRACE_R)}parseTypeSystemExtension(){const e=this._lexer.lookahead();if(e.kind===fe.NAME)switch(e.value){case"schema":return this.parseSchemaExtension();case"scalar":return this.parseScalarTypeExtension();case"type":return this.parseObjectTypeExtension();case"interface":return this.parseInterfaceTypeExtension();case"union":return this.parseUnionTypeExtension();case"enum":return this.parseEnumTypeExtension();case"input":return this.parseInputObjectTypeExtension()}throw this.unexpected(e)}parseSchemaExtension(){const e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("schema");const t=this.parseConstDirectives(),n=this.optionalMany(fe.BRACE_L,this.parseOperationTypeDefinition,fe.BRACE_R);if(0===t.length&&0===n.length)throw this.unexpected();return this.node(e,{kind:de.SCHEMA_EXTENSION,directives:t,operationTypes:n})}parseScalarTypeExtension(){const e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("scalar");const t=this.parseName(),n=this.parseConstDirectives();if(0===n.length)throw this.unexpected();return this.node(e,{kind:de.SCALAR_TYPE_EXTENSION,name:t,directives:n})}parseObjectTypeExtension(){const e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("type");const t=this.parseName(),n=this.parseImplementsInterfaces(),r=this.parseConstDirectives(),i=this.parseFieldsDefinition();if(0===n.length&&0===r.length&&0===i.length)throw this.unexpected();return this.node(e,{kind:de.OBJECT_TYPE_EXTENSION,name:t,interfaces:n,directives:r,fields:i})}parseInterfaceTypeExtension(){const e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("interface");const t=this.parseName(),n=this.parseImplementsInterfaces(),r=this.parseConstDirectives(),i=this.parseFieldsDefinition();if(0===n.length&&0===r.length&&0===i.length)throw this.unexpected();return this.node(e,{kind:de.INTERFACE_TYPE_EXTENSION,name:t,interfaces:n,directives:r,fields:i})}parseUnionTypeExtension(){const e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("union");const t=this.parseName(),n=this.parseConstDirectives(),r=this.parseUnionMemberTypes();if(0===n.length&&0===r.length)throw this.unexpected();return this.node(e,{kind:de.UNION_TYPE_EXTENSION,name:t,directives:n,types:r})}parseEnumTypeExtension(){const e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("enum");const t=this.parseName(),n=this.parseConstDirectives(),r=this.parseEnumValuesDefinition();if(0===n.length&&0===r.length)throw this.unexpected();return this.node(e,{kind:de.ENUM_TYPE_EXTENSION,name:t,directives:n,values:r})}parseInputObjectTypeExtension(){const e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("input");const t=this.parseName(),n=this.parseConstDirectives(),r=this.parseInputFieldsDefinition();if(0===n.length&&0===r.length)throw this.unexpected();return this.node(e,{kind:de.INPUT_OBJECT_TYPE_EXTENSION,name:t,directives:n,fields:r})}parseDirectiveDefinition(){const e=this._lexer.token,t=this.parseDescription();this.expectKeyword("directive"),this.expectToken(fe.AT);const n=this.parseName(),r=this.parseArgumentDefs(),i=this.expectOptionalKeyword("repeatable");this.expectKeyword("on");const s=this.parseDirectiveLocations();return this.node(e,{kind:de.DIRECTIVE_DEFINITION,description:t,name:n,arguments:r,repeatable:i,locations:s})}parseDirectiveLocations(){return this.delimitedMany(fe.PIPE,this.parseDirectiveLocation)}parseDirectiveLocation(){const e=this._lexer.token,t=this.parseName();if(Object.prototype.hasOwnProperty.call(he,t.value))return t;throw this.unexpected(e)}node(e,t){return!0!==this._options.noLocation&&(t.loc=new le(e,this._lexer.lastToken,this._lexer.source)),t}peek(e){return this._lexer.token.kind===e}expectToken(e){const t=this._lexer.token;if(t.kind===e)return this.advanceLexer(),t;throw ce(this._lexer.source,t.start,`Expected ${qe(e)}, found ${ze(t)}.`)}expectOptionalToken(e){return this._lexer.token.kind===e&&(this.advanceLexer(),!0)}expectKeyword(e){const t=this._lexer.token;if(t.kind!==fe.NAME||t.value!==e)throw ce(this._lexer.source,t.start,`Expected "${e}", found ${ze(t)}.`);this.advanceLexer()}expectOptionalKeyword(e){const t=this._lexer.token;return t.kind===fe.NAME&&t.value===e&&(this.advanceLexer(),!0)}unexpected(e){const t=e??this._lexer.token;return ce(this._lexer.source,t.start,`Unexpected ${ze(t)}.`)}any(e,t,n){this.expectToken(e);const r=[];for(;!this.expectOptionalToken(n);)r.push(t.call(this));return r}optionalMany(e,t,n){if(this.expectOptionalToken(e)){const e=[];do{e.push(t.call(this))}while(!this.expectOptionalToken(n));return e}return[]}many(e,t,n){this.expectToken(e);const r=[];do{r.push(t.call(this))}while(!this.expectOptionalToken(n));return r}delimitedMany(e,t){this.expectOptionalToken(e);const n=[];do{n.push(t.call(this))}while(this.expectOptionalToken(e));return n}advanceLexer(){const{maxTokens:e}=this._options,t=this._lexer.advance();if(void 0!==e&&t.kind!==fe.EOF&&(++this._tokenCounter,this._tokenCounter>e))throw ce(this._lexer.source,t.start,`Document contains more that ${e} tokens. Parsing aborted.`)}}function ze(e){const t=e.value;return qe(e.kind)+(null!=t?` "${t}"`:"")}function qe(e){return function(e){return e===fe.BANG||e===fe.DOLLAR||e===fe.AMP||e===fe.PAREN_L||e===fe.PAREN_R||e===fe.SPREAD||e===fe.COLON||e===fe.EQUALS||e===fe.AT||e===fe.BRACKET_L||e===fe.BRACKET_R||e===fe.BRACE_L||e===fe.PIPE||e===fe.BRACE_R}(e)?`"${e}"`:e}var He=new Map,Qe=new Map,Je=!0,Xe=!1;function We(e){return e.replace(/[\s,]+/g," ").trim()}function Ze(e){var t=new Set,n=[];return e.definitions.forEach((function(e){if("FragmentDefinition"===e.kind){var r=e.name.value,i=function(e){return We(e.source.body.substring(e.start,e.end))}(e.loc),s=Qe.get(r);s&&!s.has(i)?Je&&console.warn("Warning: fragment with name "+r+" already exists.\ngraphql-tag enforces all fragment names across your application to be unique; read more about\nthis in the docs: http://dev.apollodata.com/core/fragments.html#unique-names"):s||Qe.set(r,s=new Set),s.add(i),t.has(i)||(t.add(i),n.push(e))}else n.push(e)})),W(W({},e),{definitions:n})}function et(e){var t=We(e);if(!He.has(t)){var n=function(e,t){return new $e(e,t).parseDocument()}(e,{experimentalFragmentVariables:Xe,allowLegacyFragmentVariables:Xe});if(!n||"Document"!==n.kind)throw new Error("Not a valid GraphQL document.");He.set(t,function(e){var t=new Set(e.definitions);t.forEach((function(e){e.loc&&delete e.loc,Object.keys(e).forEach((function(n){var r=e[n];r&&"object"==typeof r&&t.add(r)}))}));var n=e.loc;return n&&(delete n.startToken,delete n.endToken),e}(Ze(n)))}return He.get(t)}function tt(e){for(var t=[],n=1;n{if(n>r)return t;if(Array.isArray(e))for(const i of e)t=lt(i,t,n+1,r);else if("object"==typeof e&&null!==e){e.sys&&e.sys.id&&t.push(e.sys.id);const i="fields"in e?e.fields:e;for(const e in i)if(Object.prototype.hasOwnProperty.call(i,e)){const s=i[e];if(Array.isArray(s))for(const e of s)t=lt(e,t,n+1,r);else t=lt(s,t,n+1,r)}}return Array.from(new Set(t))};function ut(e,t){var n;if(0===t)return O.error("Max depth for validation of subscription data is reached, please provide your data in the correct format."),{isGQL:!1,sysIds:[],isREST:!1};if(Array.isArray(e)){const n={isGQL:!1,sysIds:[],isREST:!1};for(const r of e){const e=ut(r,t-1);n.isGQL=n.isGQL||e.isGQL,n.isREST=n.isREST||e.isREST,n.sysIds=[...n.sysIds,...e.sysIds]}return n}{const r=ct(e,"__typename"),i=(null==(n=e.sys)?void 0:n.id)??null,s=ct(e,"fields"),o=i?[i]:[];return!i||r||s?r||s?{isGQL:r,sysIds:lt(e,o,0,t),isREST:s}:ut(Object.values(e),t-1):{isGQL:r,sysIds:o,isREST:s}}}function pt(e){const{isGQL:t,isREST:n,sysIds:r}=ut(e.data,10),i=function(e,t){const n={...e};if(n.query){if("string"==typeof n.query)try{n.query=tt(n.query)}catch{O.error("The provided GraphQL query is invalid, please provide it in the correct format.",e),n.query=void 0}t&&(O.warn("The query param is ignored as it can only be used together with GraphQL.",e),n.query=void 0)}return n}(e,n);return 0===r.length?(O.error('Live Updates requires the "sys.id" to be present on the provided data',i.data),{isValid:!1,sysIds:r,isGQL:t,isREST:n,config:i}):t||n?{isGQL:t,isREST:n,sysIds:r,isValid:!0,config:i}:(O.error('For live updates as a basic requirement the provided data must include the "fields" property for REST or "__typename" for Graphql, otherwise the data will be treated as invalid and live updates are not applied.',i.data),{isValid:!1,sysIds:r,isGQL:t,isREST:n,config:i})}var ht=(e=>(e.CONNECTED="CONNECTED",e.DISCONNECTED="DISCONNECTED",e.ERROR="ERROR",e.IFRAME_CONNECTED="IFRAME_CONNECTED",e.TAGGED_FIELD_CLICKED="TAGGED_FIELD_CLICKED",e.URL_CHANGED="URL_CHANGED",e.SUBSCRIBED="SUBSCRIBED",e.UNSUBSCRIBED="UNSUBSCRIBED",e.ENTRY_UPDATED="ENTRY_UPDATED",e.ENTRY_SAVED="ENTRY_SAVED",e.DEBUG_MODE_ENABLED="DEBUG_MODE_ENABLED",e.ENTITY_NOT_KNOWN="ENTITY_NOT_KNOWN",e.UNKNOWN_REFERENCE_LOADED="UNKNOWN_REFERENCE_LOADED",e))(ht||{});class dt{constructor({locale:e,targetOrigin:t}){s(this,"subscriptions",new Map),s(this,"storage"),s(this,"defaultLocale"),s(this,"sendMessage"),this.defaultLocale=e,this.sendMessage=(e,n)=>A(e,n,t),this.storage=new S("live-updates",new Map),window.addEventListener("beforeunload",(()=>this.clearStorage()))}async receiveMessage(e){if("action"in e&&"ENTRY_UPDATED"===e.action||e.method===ht.ENTRY_UPDATED){const{data:t,subscriptionId:n}=e,r=this.subscriptions.get(n);r?(r.callback(t),r.data=t,this.subscriptions.set(n,r)):O.error("Received an update for an unknown subscription",{subscriptionId:n,data:t,subscriptions:this.subscriptions})}}clearStorage(){this.storage.clear()}sendErrorMessage(e){this.sendMessage(ht.ERROR,e)}subscribe(e){const{isGQL:t,isValid:n,sysIds:r,isREST:i,config:s}=pt(e);if(!n||!s)return this.sendErrorMessage({message:"Failed to subscribe",payload:{isGQL:t,isValid:n,sysIds:r,isREST:i},type:"SUBSCRIPTION_SETUP_FAILED"}),()=>{};const o=`${performance.now()}-${Math.random().toString(36).slice(2)}`,a=s.locale??this.defaultLocale;this.subscriptions.set(o,{...s,sysIds:r,gqlParams:s.query?L(s.query):void 0});const c={type:t?"GQL":"REST",locale:a,sysIds:r,event:"edit",id:o,config:X(s)};return this.sendMessage(ht.SUBSCRIBED,{action:ht.SUBSCRIBED,...c}),()=>{this.sendMessage(ht.UNSUBSCRIBED,c),this.subscriptions.delete(o)}}}class ft{constructor({locale:e}){s(this,"locale"),s(this,"subscription"),this.locale=e}subscribe(e){return this.subscription&&O.log("There is already a subscription for the save event, the existing one will be replaced."),this.subscription=e,()=>{this.subscription=void 0}}receiveMessage(e){if(e.method===ht.ENTRY_SAVED&&this.subscription){const{entity:t}=e;G().includes(t.sys.id)&&this.subscription(t)}}}const Et=["https://app.contentful.com","https://app.eu.contentful.com","http://localhost:3001"],vt=class e{static init(t){var n;if("object"!=typeof t||null==t||!t.locale)throw new Error("Init function have to be called with a locale configuration (for example: `ContentfulLivePreview.init({ locale: 'en-US'})`)");const{debugMode:r,enableInspectorMode:i,enableLiveUpdates:s,locale:o,environment:a,space:c,targetOrigin:l=Et}=t;if(typeof window<"u"){if(!function(){var e;try{return(null==(e=window.top)?void 0:e.location.href)!==window.location.href}catch{return!0}}())return this.liveUpdatesEnabled=!1,Promise.resolve(null);if(r&&g(r),"boolean"==typeof i&&(this.inspectorModeEnabled=i),"boolean"==typeof s&&(this.liveUpdatesEnabled=s),this.locale=o,this.space=c,this.environment=a,this.targetOrigin=Array.isArray(l)?l:[l],this.initialized)return O.log("You have already initialized the Live Preview SDK."),Promise.resolve(e.inspectorMode);this.inspectorModeEnabled&&(this.inspectorMode=new Y({locale:o,space:c,environment:a,targetOrigin:this.targetOrigin,ignoreManuallyTaggedElements:null==(n=t.experimental)?void 0:n.ignoreManuallyTaggedElements})),this.liveUpdatesEnabled&&(this.liveUpdates=new dt({locale:o,targetOrigin:this.targetOrigin}),this.saveEvent=new ft({locale:o})),window.addEventListener("message",(e=>{var t,n,r;if(function(e){return!("object"!=typeof e.data||!e.data)&&("from"in e.data&&"live-preview"===e.data.from||"source"in e.data&&"live-preview-editor"===e.data.source)}(e)){if(O.log("Received message",e.data),"action"in e.data&&"DEBUG_MODE_ENABLED"===e.data.action||e.data.method===ht.DEBUG_MODE_ENABLED)return void g(!0);this.inspectorModeEnabled&&(null==(t=this.inspectorMode)||t.receiveMessage(e.data)),this.liveUpdatesEnabled&&(null==(n=this.liveUpdates)||n.receiveMessage(e.data),null==(r=this.saveEvent)||r.receiveMessage(e.data))}})),function(e,t=500){let n=window.location.href;const r=setInterval((()=>{const t=window.location.href;t!==n&&(n=t,e(t))}),t)}((()=>{A(ht.URL_CHANGED,{action:ht.URL_CHANGED,taggedElementCount:document.querySelectorAll(`[${R.ENTRY_ID}]`).length},this.targetOrigin)}));const u=document.querySelectorAll(`[${R.ENTRY_ID}]`).length;return A(ht.CONNECTED,{action:ht.CONNECTED,connected:!0,tags:u,taggedElementCount:u,locale:this.locale,isInspectorEnabled:this.inspectorModeEnabled,isLiveUpdatesEnabled:this.liveUpdatesEnabled},this.targetOrigin),this.initialized=!0,Promise.resolve(e.inspectorMode)}}static subscribe(e,t){if(!this.liveUpdatesEnabled)return()=>{};const n="object"==typeof e?e:t;if("save"===("string"==typeof e?e:"edit")){if(!this.saveEvent)throw new Error("Save event is not initialized, please call `ContentfulLivePreview.init()` first.");return this.saveEvent.subscribe(n.callback)}if(!this.liveUpdates)throw new Error("Live updates are not initialized, please call `ContentfulLivePreview.init()` first.");return this.liveUpdates.subscribe(n)}static getProps(e){const{fieldId:t,locale:n,environment:r,space:i}=e;if(!this.inspectorModeEnabled)return null;if(t){const s={...n?{[R.LOCALE]:n}:{},...r?{[R.ENVIRONMENT]:r}:{},...i?{[R.SPACE]:i}:{},[R.FIELD_ID]:t};if(n&&(s[R.LOCALE]=n),void 0!==e.assetId)return{...s,[R.ASSET_ID]:e.assetId};if(void 0!==e.entryId)return{...s,[R.ENTRY_ID]:e.entryId}}return O.warn("Missing property for inspector mode",{...e}),null}static toggleInspectorMode(){return this.inspectorModeEnabled=!this.inspectorModeEnabled,this.inspectorModeEnabled}static toggleLiveUpdatesMode(){return this.liveUpdatesEnabled=!this.liveUpdatesEnabled,this.liveUpdatesEnabled}static openEntryInEditor(e){const t={locale:this.locale,environment:this.environment,space:this.space};void 0!==e.assetId&&e.fieldId||void 0!==e.entryId&&e.fieldId?function(e,t){A("TAGGED_FIELD_CLICKED",{action:"TAGGED_FIELD_CLICKED",...e},t)}({...t,...e},this.targetOrigin):O.error("Please provide field id and entry id to openEntryInEditor.")}static getEntryList(){return G()}};s(vt,"initialized",!1),s(vt,"inspectorMode",null),s(vt,"liveUpdates",null),s(vt,"saveEvent",null),s(vt,"inspectorModeEnabled",!0),s(vt,"liveUpdatesEnabled",!0),s(vt,"locale"),s(vt,"space"),s(vt,"environment"),s(vt,"sendMessage"),s(vt,"targetOrigin");let mt=vt;var yt=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof n.g<"u"?n.g:typeof self<"u"?self:{};function _t(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Tt,Nt={exports:{}},gt={};Nt.exports=function(){if(Tt)return gt;Tt=1;var e=r,t=Symbol.for("react.element"),n=Symbol.for("react.fragment"),i=Object.prototype.hasOwnProperty,s=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,o={key:!0,ref:!0,__self:!0,__source:!0};function a(e,n,r){var a,c={},l=null,u=null;for(a in void 0!==r&&(l=""+r),void 0!==n.key&&(l=""+n.key),void 0!==n.ref&&(u=n.ref),n)i.call(n,a)&&!o.hasOwnProperty(a)&&(c[a]=n[a]);if(e&&e.defaultProps)for(a in n=e.defaultProps)void 0===c[a]&&(c[a]=n[a]);return{$$typeof:t,type:e,key:l,ref:u,props:c,_owner:s.current}}return gt.Fragment=n,gt.jsx=a,gt.jsxs=a,gt}();var It=Nt.exports,Ot={exports:{}};!function(e,t){var n="__lodash_hash_undefined__",r=9007199254740991,i="[object Arguments]",s="[object Array]",o="[object Boolean]",a="[object Date]",c="[object Error]",l="[object Function]",u="[object Map]",p="[object Number]",h="[object Object]",d="[object Promise]",f="[object RegExp]",E="[object Set]",v="[object String]",m="[object Symbol]",y="[object WeakMap]",_="[object ArrayBuffer]",T="[object DataView]",N=/^\[object .+?Constructor\]$/,g=/^(?:0|[1-9]\d*)$/,I={};I["[object Float32Array]"]=I["[object Float64Array]"]=I["[object Int8Array]"]=I["[object Int16Array]"]=I["[object Int32Array]"]=I["[object Uint8Array]"]=I["[object Uint8ClampedArray]"]=I["[object Uint16Array]"]=I["[object Uint32Array]"]=!0,I[i]=I[s]=I[_]=I[o]=I[T]=I[a]=I[c]=I[l]=I[u]=I[p]=I[h]=I[f]=I[E]=I[v]=I[y]=!1;var O="object"==typeof yt&&yt&&yt.Object===Object&&yt,b="object"==typeof self&&self&&self.Object===Object&&self,A=O||b||Function("return this")(),S=t&&!t.nodeType&&t,D=S&&e&&!e.nodeType&&e,L=D&&D.exports===S,C=L&&O.process,R=function(){try{return C&&C.binding&&C.binding("util")}catch{}}(),x=R&&R.isTypedArray;function w(e,t){for(var n=-1,r=null==e?0:e.length;++na))return!1;var l=s.get(e);if(l&&s.get(t))return l==t;var u=-1,p=!0,h=2&n?new me:void 0;for(s.set(e,t),s.set(t,e);++u-1},Ee.prototype.set=function(e,t){var n=this.__data__,r=Te(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this},ve.prototype.clear=function(){this.size=0,this.__data__={hash:new fe,map:new(ne||Ee),string:new fe}},ve.prototype.delete=function(e){var t=De(this,e).delete(e);return this.size-=t?1:0,t},ve.prototype.get=function(e){return De(this,e).get(e)},ve.prototype.has=function(e){return De(this,e).has(e)},ve.prototype.set=function(e,t){var n=De(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this},me.prototype.add=me.prototype.push=function(e){return this.__data__.set(e,n),this},me.prototype.has=function(e){return this.__data__.has(e)},ye.prototype.clear=function(){this.__data__=new Ee,this.size=0},ye.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},ye.prototype.get=function(e){return this.__data__.get(e)},ye.prototype.has=function(e){return this.__data__.has(e)},ye.prototype.set=function(e,t){var n=this.__data__;if(n instanceof Ee){var r=n.__data__;if(!ne||r.length<199)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new ve(r)}return n.set(e,t),this.size=n.size,this};var Ce=W?function(e){return null==e?[]:(e=Object(e),function(e,t){for(var n=-1,r=null==e?0:e.length,i=0,s=[];++n-1&&e%1==0&&e-1&&e%1==0&&e<=r}function Be(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function Ke(e){return null!=e&&"object"==typeof e}var Ve=x?function(e){return function(t){return e(t)}}(x):function(e){return Ke(e)&&je(e.length)&&!!I[Ne(e)]};function Ge(e){return function(e){return null!=e&&je(e.length)&&!Ue(e)}(e)?_e(e):be(e)}e.exports=function(e,t){return Ie(e,t)}}(Ot,Ot.exports);const bt=_t(Ot.exports);function At(e,t){return(0,r.useEffect)(e,function(e){const t=(0,r.useRef)(e),n=(0,r.useRef)(0);return bt(e,t.current)||(t.current=e,n.current+=1),(0,r.useMemo)((()=>t.current),[n.current])}(t))}const St=(0,r.createContext)(null);function Dt({children:e,locale:t,space:n,environment:i,debugMode:s=!1,enableInspectorMode:o=!0,enableLiveUpdates:a=!0,targetOrigin:c,experimental:l}){if(!t)throw new Error('ContentfulLivePreviewProvider have to be called with a locale property (for example: `{children}`');mt.init({locale:t,space:n,environment:i,debugMode:s,enableInspectorMode:o,enableLiveUpdates:a,targetOrigin:c,experimental:l});const u=(0,r.useMemo)((()=>({locale:t,space:n,environment:i,debugMode:s,enableInspectorMode:o,enableLiveUpdates:a,targetOrigin:c})),[t,n,i,s,o,a,c]);return It.jsx(St.Provider,{value:u,children:e})}function Lt(e,t,n=!1){const[i,s]=(0,r.useState)({data:e,version:1}),o=(0,r.useRef)(e),a=(0,r.useRef)(function(e,t=100){let n;return(...r)=>{clearTimeout(n),n=setTimeout((()=>{e.apply(this,r)}),t)}}(s)),c=(0,r.useContext)(St),l="object"==typeof t?t:{locale:t,skip:n},u=(0,r.useMemo)((()=>!(c&&!c.enableLiveUpdates||l.skip)&&!!(Array.isArray(e)&&e.length||e&&"object"==typeof e&&Object.keys(e).length)),[c,l.skip,e]);return At((()=>{if(o.current!==e&&(s({data:e,version:1}),o.current=e),u)return mt.subscribe("edit",{data:e,locale:l.locale,query:l.query,callback:e=>{a.current((t=>({data:e,version:t.version+1})))}})}),[e,u,l.locale,l.query]),i.data}function Ct(e){const t=(0,r.useContext)(St);return(0,r.useCallback)((n=>null!=t&&t.enableInspectorMode?mt.getProps({...e,...n}):null),[null==t?void 0:t.enableInspectorMode,e])}},26072:function(e,t,n){"use strict";var r,i,s=n(95351),o=n(72002),a=function(){return(a=Object.assign||function(e){for(var t,n=1,r=arguments.length;n