1!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},t=(new e.Error).stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="660bc9a9-1267-47de-9485-2023a5e37668",e._sentryDebugIdIdentifier="sentry-dbid-660bc9a9-1267-47de-9485-2023a5e37668")}catch(e){}}();"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3363],{3648:(e,t,r)=>{r.d(t,{_:()=>n});function n(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}},7039:(e,t,r)=>{r.d(t,{A:()=>n});function n(e,...t){let r=e.length-1;return e.slice(0,r).reduce((e,r,n)=>e+r+t[n],"")+e[r]}},39408:(e,t,r)=>{r.d(t,{XL:()=>k,IT:()=>S});var n,i,s,o,a,l=r(53877),u=r(33670),f=r(93261);function c(e,t,r,o,a){var l,u,f,c;let h,d=a&&"input"in a?a.input:r.value,g=a?.expected??e.expects,y=a?.received??("object"==(h=typeof d)&&(h=(d&&Object.getPrototypeOf(d)?.constructor?.name)??"null"),"string"===h?`"${d}"`:"number"===h||"bigint"===h||"boolean"===h?`${d}`:h),p={kind:e.kind,type:e.type,input:d,expected:g,received:y,message:`Invalid ${t}: ${g?`Expected ${g} but r`:"R"}eceived ${y}`,requirement:e.requirement,path:a?.path,issues:a?.issues,lang:o.lang,abortEarly:o.abortEarly,abortPipeEarly:o.abortPipeEarly,skipPipe:o.skipPipe},m="schema"===e.kind,v=e.message??(l=e.reference,u=p.lang,s?.get(l)?.get(u))??(m?(f=p.lang,i?.get(f)):null)??o.message??(c=p.lang,n?.get(c));v&&(p.message="function"==typeof v?v(p):v),m&&(r.typed=!1),r.issues?r.issues.push(p):r.issues=[p]}function h(e,t){return{kind:"schema",type:"object",reference:h,expects:"Object",async:!1,entries:e,message:t,_run(e,t){let r=e.value;if(r&&"object"==typeof r)for(let n in e.typed=!0,e.value={},this.entries){let i=r[n],s=this.entries[n]._run({typed:!1,value:i},t);if(s.issues){let o={type:"object",origin:"value",input:r,key:n,value:i};for(let t of s.issues)t.path?t.path.unshift(o):t.path=[o],e.issues?.push(t);if(e.issues||(e.issues=s.issues),t.abortEarly){e.typed=!1;break}}s.typed||(e.typed=!1),(void 0!==s.value||n in r)&&(e.value[n]=s.value)}else c(this,"type",e,t);return e}}}function d(e,...t){let r={kind:"schema",type:"optional",reference:d,expects:`${e.expects} | undefined`,async:!1,wrapped:e,_run(e,t){return void 0===e.value&&("default"in this&&(e.value="function"==typeof this.default?this.default(e,t):this.default),void 0===e.value)?(e.typed=!0,e):this.wrapped._run(e,t)}};return 0 in t&&(r.default=t[0]),r}function g(e){return{kind:"schema",type:"string",reference:g,expects:"string",async:!1,message:e,_run(e,t){return"string"==typeof e.value?e.typed=!0:c(this,"type",e,t),e}}}let y=function(...e){return{...e[0],pipe:e,_run(t,r){for(let n=0;n<e.length;n++){t=e[n]._run(t,r);let i=e[n+1];if(r.skipPipe||t.issues&&(r.abortEarly||r.abortPipeEarly||i?.kind==="schema"||i?.kind==="transformation")){t.typed=!1;break}}return t}}}(g(),function e(t,r){return{kind:"validation",type:"min_length",reference:e,async:!1,expects:`>=${t}`,requirement:t,message:r,_run(e,t){return e.typed&&e.value.length<this.requirement&&c(this,"length",e,t,{received:`${e.value.length}`}),e}}}(1)),p=d(y),m=h({baseUrl:y,dataset:p,id:y,path:y,projectId:p,tool:p,type:p,workspace:p,isDraft:d(g())});h({origin:y,href:y,data:d(function e(t,r,n){return{kind:"schema",type:"record",reference:e,expects:"Object",async:!1,key:t,value:r,message:n,_run(e,t){let r=e.value;if(r&&"object"==typeof r){for(let n in e.typed=!0,e.value={},r)if("__proto__"!==n&&"prototype"!==n&&"constructor"!==n){let i=r[n],s=this.key._run({typed:!1,value:n},t);if(s.issues){let o={type:"record",origin:"key",input:r,key:n,value:i};for(let t of s.issues)t.path=[o],e.issues?.push(t);if(e.issues||(e.issues=s.issues),t.abortEarly){e.typed=!1;break}}let o=this.value._run({typed:!1,value:i},t);if(o.issues){let s={type:"record",origin:"value",input:r,key:n,value:i};for(let t of o.issues)t.path?t.path.unshift(s):t.path=[s],e.issues?.push(t);if(e.issues||(e.issues=o.issues),t.abortEarly){e.typed=!1;break}}s.typed&&o.typed||(e.typed=!1),s.typed&&(e.value[s.value]=o.value)}}else c(this,"type",e,t);return e}}}(g(),function e(){return{kind:"schema",type:"unknown",reference:e,expects:"unknown",async:!1,_run:e=>(e.typed=!0,e)}}()))});
1var v=function(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}((a||(a=1,o=function e(t,r){if(t===r)return!0;if(t&&r&&"object"==typeof t&&"object"==typeof r){if(t.constructor!==r.constructor)return!1;if(Array.isArray(t)){if((n=t.length)!=r.length)return!1;for(i=n;0!=i--;)if(!e(t[i],r[i]))return!1;return!0}if(t.constructor===RegExp)return t.source===r.source&&t.flags===r.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===r.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===r.toString();if((n=(s=Object.keys(t)).length)!==Object.keys(r).length)return!1;for(i=n;0!=i--;)if(!Object.prototype.hasOwnProperty.call(r,s[i]))return!1;for(i=n;0!=i--;){var n,i,s,o=s[i];if(!e(t[o],r[o]))return!1}return!0}return t!=t&&r!=r}),o));let{loadQuery:b,setServerClient:w,useLiveMode:k,useQuery:S}=(e=>{let{createFetcherStore:t,enableLiveMode:r}=(0,l.KS)({tag:"react-loader",...e}),n=function(e){let t="object"==typeof e?e?.config().stega.studioUrl:void 0,r=t,n=new Set;return{subscribe:e=>(n.add(e),()=>n.delete(e)),getSnapshot:()=>t,getServerSnapshot:()=>r,setStudioUrl(e){t=e,n.forEach(e=>e())}}}(e.client);return{loadQuery:()=>{throw Error("The `loadQuery` function is server only.")},useQuery:function({createFetcherStore:e,studioUrlStore:t}){let r={};return(n,i=r,s={})=>{var o,a;let l=(0,u.useMemo)(()=>s.initial?{perspective:"published",...s.initial}:void 0,[s.initial]),c=(0,u.useMemo)(()=>JSON.stringify(i),[i]),[h,d]=(0,u.useState)(()=>e(n,JSON.parse(c),l).value);(0,u.useEffect)(()=>{let t=e(n,JSON.parse(c),l).subscribe(e=>{d(t=>v(t.sourceMap,e.sourceMap)&&v(t.data,e.data)&&t.error===e.error&&t.loading===e.loading&&t.perspective===e.perspective?t:e)});return()=>t()},[c,l,n]);let g=(0,u.useSyncExternalStore)(t.subscribe,t.getSnapshot,t.getServerSnapshot),y=(o=h.data,a=h.sourceMap,(0,u.useMemo)(()=>(function e(t,r,n,i){let s=e=>e?"string"==typeof e?f.C.fromString(e):e:[],o=s(i);return Object.assign(e=>((e,t,r,n)=>{if(!t||!r)return;let i=(0,f.EH)(n),s=(0,f.Nx)({resultPath:i,resultSourceMap:t,studioUrl:r});if(s)return function(e){let{id:t,path:r,baseUrl:n,tool:i,workspace:s,type:o}=e;return m._run({typed:!1,value:e},{abortEarly:!0}).issues?void 0:[["id",(0,f.IM)(t)],["type",o],["path",function(e){let t="";for(let r of e){if("string"==typeof r){t&&(t+="."),t+=r;continue}if("number"==typeof r){t&&(t+=":"),t+=`${r}`;continue}if(null!==r&&Array.isArray(r)){t&&(t+=":"),t+=`${r.join(",")}}`;continue}if(r._key){t&&(t+=":"),t+=`${r._key}`;continue}}return t}(f.C.fromString(r))],["base",encodeURIComponent(n)],["workspace",s],["tool",i],["isDraft",t.startsWith("drafts.")]].filter(([,e])=>!!e).map(e=>{let[t,r]=e;return!0===r?t:e.join("=")}).join(";")}({baseUrl:s.baseUrl,workspace:s.workspace,tool:s.tool,type:s.type,id:s.id,path:"string"==typeof s.path?s.path:f.C.toString((0,f._y)(s.path))})})(0,r,n,[...o,...s(e)]),{scope:i=>e(t,r,n,[...o,...s(i)])})})(o,a,g),[o,a,g]));return(0,u.useMemo)(()=>({...h,encodeDataAttribute:y}),[h,y])}}({createFetcherStore:t,studioUrlStore:n}),setServerClient:()=>{throw Error("The `setServerClient` function is server only.")},useLiveMode:function({enableLiveMode:e,setStudioUrl:t}){return({allowStudioOrigin:r,client:n,onConnect:i,onDisconnect:s,studioUrl:o})=>{(0,u.useEffect)(()=>{r&&console.warn("`allowStudioOrigin` is deprecated and no longer needed");let t=e({client:n,onConnect:i,onDisconnect:s});return()=>t()},[r,n,i,s]),(0,u.useEffect)(()=>{t(o??"object"==typeof n?n?.config().stega.studioUrl:void 0)},[o,n])}}({enableLiveMode:r,setStudioUrl:n.setStudioUrl})}})({client:!1,ssr:!0})},53877:(e,t,r)=>{r.d(t,{KS:()=>H,eU:()=>F});var n,i,s,o,a,l,u,f,c,h,d,g,y={},p={exports:{}};function m(){return g||(g=1,function(e,t){let{hasOwnProperty:r}=Object.prototype,n=d();n.configure=d,n.stringify=n,n.default=n,t.stringify=n,t.configure=d,e.exports=n;let i=/[\u0000-\u001f\u0022\u005c\ud800-\udfff]|[\ud800-\udbff](?![\udc00-\udfff])|(?:[^\ud800-\udbff]|^)[\udc00-\udfff]/;function s(e){return e.length<5e3&&!i.test(e)?`"${e}"`:JSON.stringify(e)}function o(e){if(e.length>200)return e.sort();for(let t=1;t<e.length;t++){let r=e[t],n=t;for(;0!==n&&e[n-1]>r;)e[n]=e[n-1],n--;e[n]=r}return e}let a=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(Object.getPrototypeOf(new Int8Array)),Symbol.toStringTag).get;function l(e){return void 0!==a.call(e)&&0!==e.length}function u(e,t,r){e.length<r&&(r=e.length);let n=","===t?"":" ",i=`"0":${n}${e[0]}`;for(let s=1;s<r;s++)i+=`${t}"${s}":${n}${e[s]}`;return i}function f(e,t){let n;if(r.call(e,t)&&"boolean"!=typeof(n=e[t]))throw TypeError(`The "${t}" argument must be of type boolean`);return void 0===n||n}function c(e,t){let n;if(r.call(e,t)){if("number"!=typeof(n=e[t]))throw TypeError(`The "${t}" argument must be of type number`);if(!Number.isInteger(n))throw TypeError(`The "${t}" argument must be an integer`);if(n<1)throw RangeError(`The "${t}" argument must be >= 1`)}return void 0===n?1/0:n}function h(e){return 1===e?"1 item":`${e} items`}function d(e){let t=function(e){if(r.call(e,"strict")){let t=e.strict;if("boolean"!=typeof t)throw TypeError('The "strict" argument must be of type boolean');if(t)return e=>{let t=`Object can not safely be stringified. Received type ${typeof e}`;throw"function"!=typeof e&&(t+=` (${e.toString()})`),Error(t)}}}(e={...e});t&&(void 0===e.bigint&&(e.bigint=!1),"circularValue"in e||(e.cir
1cularValue=Error));let n=function(e){if(r.call(e,"circularValue")){let t=e.circularValue;if("string"==typeof t)return`"${t}"`;if(null==t)return t;if(t===Error||t===TypeError)return{toString(){throw TypeError("Converting circular structure to JSON")}};throw TypeError('The "circularValue" argument must be of type string or the value null or undefined')}return'"[Circular]"'}(e),i=f(e,"bigint"),a=f(e,"deterministic"),d=c(e,"maximumDepth"),g=c(e,"maximumBreadth");return function(e,r,f){if(arguments.length>1){let c="";if("number"==typeof f?c=" ".repeat(Math.min(f,10)):"string"==typeof f&&(c=f.slice(0,10)),null!=r){if("function"==typeof r)return function e(r,u,f,c,y,p){let m=u[r];switch("object"==typeof m&&null!==m&&"function"==typeof m.toJSON&&(m=m.toJSON(r)),typeof(m=c.call(u,r,m))){case"string":return s(m);case"object":{if(null===m)return"null";if(-1!==f.indexOf(m))return n;let t="",r=",",i=p;if(Array.isArray(m)){if(0===m.length)return"[]";if(d<f.length+1)return'"[Array]"';f.push(m),""!==y&&(p+=y,t+=` 2${p}`,r=`, 3${p}`);let n=Math.min(m.length,g),s=0;for(;s<n-1;s++){let n=e(String(s),m,f,c,y,p);t+=void 0!==n?n:"null",t+=r}let o=e(String(s),m,f,c,y,p);if(t+=void 0!==o?o:"null",m.length-1>g){let e=m.length-g-1;t+=`${r}"... ${h(e)} not stringified"`}return""!==y&&(t+=` 4${i}`),f.pop(),`[${t}]`}let u=Object.keys(m),v=u.length;if(0===v)return"{}";if(d<f.length+1)return'"[Object]"';let b="",w="";""!==y&&(p+=y,r=`, 5${p}`,b=" ");let k=Math.min(v,g);a&&!l(m)&&(u=o(u)),f.push(m);for(let n=0;n<k;n++){let i=u[n],o=e(i,m,f,c,y,p);void 0!==o&&(t+=`${w}${s(i)}:${b}${o}`,w=r)}return v>g&&(t+=`${w}"...":${b}"${h(v-g)} not stringified"`,w=r),""!==y&&w.length>1&&(t=` 6${p}${t} 7${i}`),f.pop(),`{${t}}`}case"number":return isFinite(m)?String(m):t?t(m):"null";case"boolean":return!0===m?"true":"false";case"undefined":return;case"bigint":if(i)return String(m);default:return t?t(m):void 0}}("",{"":e},[],r,c,"");if(Array.isArray(r))return function e(r,o,a,l,u,f){switch("object"==typeof o&&null!==o&&"function"==typeof o.toJSON&&(o=o.toJSON(r)),typeof o){case"string":return s(o);case"object":{if(null===o)return"null";if(-1!==a.indexOf(o))return n;let t=f,r="",i=",";if(Array.isArray(o)){if(0===o.length)return"[]";if(d<a.length+1)return'"[Array]"';a.push(o),""!==u&&(f+=u,r+=` 8${f}`,i=`, 9${f}`);let n=Math.min(o.length,g),s=0;for(;s<n-1;s++){let t=e(String(s),o[s],a,l,u,f);r+=void 0!==t?t:"null",r+=i}let c=e(String(s),o[s],a,l,u,f);if(r+=void 0!==c?c:"null",o.length-1>g){let e=o.length-g-1;r+=`${i}"... ${h(e)} not stringified"`}return""!==u&&(r+=` 10${t}`),a.pop(),`[${r}]`}a.push(o);let c="";""!==u&&(f+=u,i=`, 11${f}`,c=" ");let y="";for(let t of l){let n=e(t,o[t],a,l,u,f);void 0!==n&&(r+=`${y}${s(t)}:${c}${n}`,y=i)}return""!==u&&y.length>1&&(r=` 12${f}${r} 13${t}`),a.pop(),`{${r}}`}case"number":return isFinite(o)?String(o):t?t(o):"null";case"boolean":return!0===o?"true":"false";case"undefined":return;case"bigint":if(i)return String(o);default:return t?t(o):void 0}}("",e,[],function(e){let t=new Set;for(let r of e)("string"==typeof r||"number"==typeof r)&&t.add(String(r));return t}(r),c,"")}if(0!==c.length)return function e(r,f,c,y,p){switch(typeof f){case"string":return s(f);case"object":{if(null===f)return"null";if("function"==typeof f.toJSON){if("object"!=typeof(f=f.toJSON(r)))return e(r,f,c,y,p);if(null===f)return"null"}if(-1!==c.indexOf(f))return n;let t=p;if(Array.isArray(f)){if(0===f.length)return"[]";if(d<c.length+1)return'"[Array]"';c.push(f),p+=y;let r=` 14${p}`,n=`, 15${p}`,i=Math.min(f.length,g),s=0;for(;s<i-1;s++){let t=e(String(s),f[s],c,y,p);r+=void 0!==t?t:"null",r+=n}let o=e(String(s),f[s],c,y,p);if(r+=void 0!==o?o:"null",f.length-1>g){let e=f.length-g-1;r+=`${n}"... ${h(e)} not stringified"`}return r+=` 16${t}`,c.pop(),`[${r}]`}let i=Object.keys(f),m=i.length;if(0===m)return"{}";if(d<c.length+1)return'"[Object]"';p+=y;let v=`, 17${p}`,b="",w="",k=Math.min(m,g);l(f)&&(b+=u(f,v,g),i=i.slice(f.length),k-=f.length,w=v),a&&(i=o(i)),c.push(f);for(let t=0;t<k;t++){let r=i[t],n=e(r,f[r],c,y,p);void 0!==n&&(b+=`${w}${s(r)}: ${n}`,w=v)}return m>g&&(b+=`${w}"...": "${h(m-g)} not stringified"`,w=v),""!==w&&(b=` 18${p}${b} 19${t}`),c.pop(),`{${b}}`}case"number":return isFinite(f)?String(f):t?t(f):"null";case"boolean":return!0===f?"true":"false";case"undefined":return;case"bigint":if(i)return String(f);default:return t?t(f):void 0}}("",e,[],c,"")}return function e(r,f,c){switch(typeof f){case"string":return s(f);case"object":{if(null===f)return"null";if("function"==typeof f.toJSON){if("object"!=typeof(f=f.toJSON(r)))return e(r,f,c);if(null===f)return"null"}if(-1!==c.indexOf(f))return n;let t="";if(Array.isArray(f)){if(0===f.length)return"[]";if(d<c.length+1)return'"[Array]"';c.push(f);let r=Math.min(f.length,g),n=0;for(;n<r-1;n++){let r=e(String(n),f[n],c);t+=void 0!==r?r:"null",t+=","}let i=e(String(n),f[n],c);if(t+=void 0!==i?i:"null",f.length-1>g){let e=f.length-g-1;t+=`,"... ${h(e)} not stringified"`}return c.pop(),`[${t}]`}let i=Object.keys(f),y=i.length;if(0===y)return"{}";if(d<c.length+1)return'"[Object]"';let p="",m=Math.min(y,g);l(f)&&(t+=u(f,",",g),i=i.slice(f.length),m-=f.length,p=","),a&&(i=o(i)),c.push(f);for(let r=0;r<m;
19r++){let n=i[r],o=e(n,f[n],c);void 0!==o&&(t+=`${p}${s(n)}:${o}`,p=",")}return y>g&&(t+=`${p}"...":"${h(y-g)} not stringified"`),c.pop(),`{${t}}`}case"number":return isFinite(f)?String(f):t?t(f):"null";case"boolean":return!0===f?"true":"false";case"undefined":return;case"bigint":if(i)return String(f);default:return t?t(f):void 0}}("",e,[])}}}(p,p.exports)),p.exports}function v(){if(k)return w;function e(e){return e*Math.random()|0}return k=1,w={findNotMatching:function(e,t){let r=[],n=0;for(let i=0;i<e.length;i++)for(let s=n;s<t.length;s++)e[i]!==t[s]&&(r.push(t[s]),n=s+1);return r},findMatchingIndexes:function(e,t){let r=[],n=0;for(let i=0;i<e.length;i++)for(let s=n;s<t.length;s++)e[i]===t[s]&&(r.push(s),n=s+1);return r},bsearchIndex:function(e,t){let r=0,n=e.length-1;for(;r<=n;){let i=(r+n)/2|0;if(e[i]===t)return i;e[i]<t?r=i+1:n=i-1}return -1},wildcardMatch:function(e,t){if("*"===e||e.length===t.length&&e===t)return!0;let r=0,n=0;for(;r<e.length&&n<t.length;){if(e[r]===t[n]){r++,n++;continue}if("*"===e[r]){if(e[r+1]===t[n]){r++;continue}n++;continue}return!1}return r>=e.length-1},randomSubset:function(t,r){var n,i;if(t.length<1||r<1)return[];let s=(n=1,i=Math.min(t.length,r),(n=Math.floor(n))+e(1+(i=Math.floor(i))-n)),o=new Set;for(let r=0;r<s;r++)o.add(e(t.length));let a=[];for(let e of o)a.push(t[e]);return a},abstractLogging:function(){let e=()=>{};return{fatal:e,error:e,warn:e,info:e,debug:e,trace:e}},isServerSide:typeof window>"u"}}function b(){if($)return S;$=1;class e{constructor(e){this.options=e}async get(e){throw Error("storage get method not implemented")}async set(e,t,r,n){throw Error("storage set method not implemented")}async remove(e){throw Error("storage remove method not implemented")}async invalidate(e){throw Error("storage invalidate method not implemented")}async clear(e){throw Error("storage clear method not implemented")}async refresh(){throw Error("storage refresh method not implemented")}}return S=e}var w,k,S,$,_,E,A,O,R,x={};function T(){if(K)return j;K=1;var e=(R||(R=1,x.ARRAY_BUFFER_SUPPORT="u">typeof ArrayBuffer,x.SYMBOL_SUPPORT="u">typeof Symbol),x),t=e.ARRAY_BUFFER_SUPPORT,r=e.SYMBOL_SUPPORT;return j=function(e,n){var i,s,o,a,l;if(!e)throw Error("obliterator/forEach: invalid iterable.");if("function"!=typeof n)throw Error("obliterator/forEach: expecting a callback.");if(Array.isArray(e)||t&&ArrayBuffer.isView(e)||"string"==typeof e||"[object Arguments]"===e.toString()){for(o=0,a=e.length;o<a;o++)n(e[o],o);return}if("function"==typeof e.forEach)return void e.forEach(n);if(r&&Symbol.iterator in e&&"function"!=typeof e.next&&(e=e[Symbol.iterator]()),"function"==typeof e.next){for(i=e,o=0;!0!==(l=i.next()).done;)n(l.value,o),o++;return}for(s in e)e.hasOwnProperty(s)&&n(e[s],s)}}var j,K,M,z={};function P(){var e;return M||(M=1,z.getPointerArray=function(e){var t=e-1;if(t<=255)return Uint8Array;
19if(t<=65535)return Uint16Array;if(t<=0xffffffff)return Uint32Array;throw Error("mnemonist: Pointer Array of size > 4294967295 is not supported.")},z.getSignedPointerArray=function(e){var t=e-1;return t<=127?Int8Array:t<=32767?Int16Array:t<=0x7fffffff?Int32Array:Float64Array},z.getNumberType=function(e){return e===(0|e)?-1===Math.sign(e)?e<=127&&e>=-128?Int8Array:e<=32767&&e>=-32768?Int16Array:Int32Array:e<=255?Uint8Array:e<=65535?Uint16Array:Uint32Array:Float64Array},e={Uint8Array:1,Int8Array:2,Uint16Array:3,Int16Array:4,Uint32Array:5,Int32Array:6,Float32Array:7,Float64Array:8},z.getMinimalRepresentation=function(t,r){var n,i,s,o,a,l=null,u=0;for(o=0,a=t.length;o<a;o++)s=r?r(t[o]):t[o],(n=e[(i=z.getNumberType(s)).name])>u&&(u=n,l=i);return l},z.isTypedArray=function(e){return"u">typeof ArrayBuffer&&ArrayBuffer.isView(e)},z.concat=function(){var e,t,r,n=0;for(e=0,r=arguments.length;e<r;e++)n+=arguments[e].length;var i=new arguments[0].constructor(n);for(e=0,t=0;e<r;e++)i.set(arguments[e],t),t+=arguments[e].length;return i},z.indices=function(e){for(var t=z.getPointerArray(e),r=new t(e),n=0;n<e;n++)r[n]=n;return r}),z}var N,I={};function L(){let e;if(l)return a;l=1;let{isServerSide:t}=v();t&&(e=function(){if(E)return _;E=1;let e=m(),t=b(),{findNotMatching:r,randomSubset:n,abstractLogging:i}=v();class s extends t{constructor(e={}){if(!e.client||"object"!=typeof e.client)throw Error("Redis client is required");
19if(super(e),e.invalidation&&e.invalidation.referencesTTL&&("number"!=typeof e.invalidation.referencesTTL||e.invalidation.referencesTTL<1))throw Error("invalidation.referencesTTL must be a positive integer greater than 1");this.log=e.log||i(),this.store=e.client,this.invalidation=!!e.invalidation,this.referencesTTL=e.invalidation&&e.invalidation.referencesTTL||60}getReferenceKeyLabel(e){return`r:${e}`}getKeyReferenceLabel(e){return`k:${e}`}async get(e){this.log.debug({msg:"acd/storage/redis.get",key:e});try{let t=await this.store.get(e);if(!t){if(!this.invalidation)return;this.clearReferences(e);return}return JSON.parse(t)}catch(t){this.log.error({msg:"acd/storage/redis.get error",err:t,key:e})}}async getTTL(e){this.log.debug({msg:"acd/storage/memory.getTTL",key:e});let t=await this.store.pttl(e);return t<0?0:t=Math.ceil(t/1e3)}async set(t,n,i,s){if(this.log.debug({msg:"acd/storage/redis.set key",key:t,value:n,ttl:i,references:s}),!(!(i=Number(i))||i<0))try{if(await this.store.set(t,e(n),"EX",i),!s||s.length<1)return;if(!this.invalidation)return void this.log.warn({msg:"acd/storage/redis.set, invalidation is disabled, references are useless",key:t,references:s});let o=[],a=await this.store.smembers(this.getKeyReferenceLabel(t));if(this.log.debug({msg:"acd/storage/redis.set current references",key:t,currentReferences:a}),a.length>1){for(let e of(a.sort(),s.sort(),r(s,a)))o.push(["srem",this.getReferenceKeyLabel(e),t]);o.push(["del",this.getKeyReferenceLabel(t)])}let l=a.length>1?r(a,s):s;this.log.debug({msg:"acd/storage/redis.set references to add",key:t,referencesToAdd:l});for(let e=0;e<l.length;e++){let r=l[e],n=this.getReferenceKeyLabel(r);o.push(["sadd",n,t]),o.push(["expire",n,this.referencesTTL])}let u=this.getKeyReferenceLabel(t);o.push(["sadd",u,s]),o.push(["expire",u,i]),this.log.debug({msg:"acd/storage/redis.set references writes",writes:o}),await this.store.pipeline(o).exec()}catch(e){this.log.error({msg:"acd/storage/redis.set error",err:e,key:t,ttl:i,references:s})}}async remove(e){this.log.debug({msg:"acd/storage/redis.remove",key:e});try{let t=await this.store.del(e)>0;return t&&this.invalidation&&await this.clearReferences(e),t}catch(t){this.log.error({msg:"acd/storage/redis.remove error",err:t,key:e})}}async invalidate(e){if(!this.invalidation)return this.log.warn({msg:"acd/storage/redis.invalidate, exit due invalidation is disabled"}),[];this.log.debug({msg:"acd/storage/redis.invalidate",references:e});try{return Array.isArray(e)?await this._invalidateReferences(e):await this._invalidateReference(e)}catch(t){return this.log.error({msg:"acd/storage/redis.invalidate error",err:t,references:e}),[]}}async _invalidateReferences(e,t=!0){let r=e.map(e=>["smembers",t?this.getReferenceKeyLabel(e):e]),n=await this.store.pipeline(r).exec();this.log.debug({msg:"acd/storage/redis._invalidateReferences keys",keys:n});let i=[],s=[];for(let e=0;e<n.length;e++){let t=n[e][1];if(t){this.log.debug({msg:"acd/storage/redis._invalidateReferences got keys to be invalidated",keys:t});for(let e=0;e<t.length;e++){let r=t[e];this.log.debug({msg:"acd/storage/redis._invalidateReferences del key"+r}),s.push(r),i.push(["del",r])}}}return await this.store.pipeline(i).exec(),await this.clearReferences(s),s}async _invalidateReference(e){let t;if(e.includes("*")){let t=await this.store.keys(this.getReferenceKeyLabel(e));return this._invalidateReferences(t,!1)}t=await this.store.smembers(this.getReferenceKeyLabel(e)),this.log.debug({msg:"acd/storage/redis._invalidateReference keys",keys:t});let r=[],n=[];for(let e=0;e<t.length;e++){let i=t[e];this.log.debug({msg:"acd/storage/redis._invalidateReference del key"+i}),n.push(i),r.push(["del",i])}return await this.store.pipeline(r).exec(),await this.clearReferences(n),n}async clear(e){this.log.debug({msg:"acd/storage/redis.clear",name:e});try{if(!e)return void await this.store.flushall();let t=await this.store.keys(`${e}*`);this.log.debug({msg:"acd/storage/redis.clear keys",keys:t});let r=t.map(e=>["del",e]);if(await this.store.pipeline(r).exec(),!this.invalidation)return;await this.clearReferences(t)}catch(t){this.log.error({msg:"acd/storage/redis.clear error",err:t,name:e})}}async refresh(){try{await this.store.flushall()}catch(e){this.log.error({msg:"acd/storage/redis.refresh error",err:e})}}async clearReferences(e){try{if(!e)return void this.log.warn({msg:"acd/storage/redis.clearReferences invalid call due to empty key"});Array.isArray(e)||(e=[e]);let t=e.map(e=>["smembers",this.getKeyReferenceLabel(e)]),r=await this.store.pipeline(t).exec();this.log.debug({msg:"acd/storage/redis.clearReferences references",keys:e,referencesKeys:r});let n={};for(let t=0;t<e.length;t++){for(let i=0;i<r[t][1].length;i++){let s=this.getReferenceKeyLabel(r[t][1][i]);n[s]||(n[s]=["srem",s,e])}let i=this.getKeyReferenceLabel(e[t]);n[i]=["del",i]}this.log.debug({msg:"acd/storage/redis.clearReferences writes pipeline",writes:n}),await this.store.pipeline(Object.values(n)).exec()}catch(e){this.log.error({msg:"acd/storage/redis.clearReferences error",err:e})}}async gc(e="lazy",t={}){if(this.log.debug({msg:"acd/storage/redis.gc",mode:e,options:t}),!this.invalidation)return void this.log.warn({msg:"acd/storage/redis.gc does not run due to invali
19dation is disabled"});"strict"!==e&&"lazy"!==e&&(e="lazy");let r={references:{scanned:[],removed:[]},keys:{scanned:new Set,removed:new Set},loops:0,cursor:0,error:null};try{let i=0,s=64;if(t.chunk&&("number"!=typeof t.chunk||t.chunk<1))return r.error=Error("chunk must be a positive integer greater than 1"),r;if(t.lazy){if(t.lazy.chunk){if("number"!=typeof t.lazy.chunk||t.lazy.chunk<1)return r.error=Error("lazy.chunk must be a positive integer greater than 1"),r;s=t.lazy.chunk}if(t.lazy.cursor){if("number"!=typeof t.lazy.cursor||t.lazy.cursor<0)return r.error=Error("lazy.cursor must be a positive integer greater than 0"),r;i=t.lazy.cursor}}let o=t.chunk||64,a=Math.min(s,o),l=i,u=-1,f=-1;do{r.loops++;let t=await this.store.scan(i,"match","r:*","count",a);i=Number(t[0]),u=t[1].length;let o="lazy"===e?n(t[1],s):t[1];r.references.scanned=r.references.scanned.concat(o);let l=[];for(let e=0;e<o.length;e++){let t=o[e];l.push(["smembers",t])}let c=await this.store.pipeline(l).exec(),h={},d={};for(let e=0;e<c.length;e++){let t=c[e],n=o[e];d[n]=t[1];for(let e=0;e<t[1].length;e++){let i=t[1][e];h[i]?h[i].push(n):h[i]=[n],r.keys.scanned.add(i)}}let g=Object.keys(h);l=g.map(e=>["exists",e]);let y=await this.store.pipeline(l).exec(),p={};for(let e=0;e<g.length;e++){let t=g[e];if(1!==y[e][1])for(let e=0;e<h[t].length;e++){let n=h[t][e];p[n]?p[n].push(t):p[n]=[t],r.keys.removed.add(t)}}let m=Object.keys(p),v=[];for(let e=0;e<m.length;e++){let t=m[e];d[t].length===p[t].length?(v.push(["del",t]),r.references.removed.push(t)):v.push(["srem",t,p[t]])}if(await this.store.pipeline(v).exec(),f=v.length,"lazy"===e&&r.references.scanned.length>=s)break}while(l!==i&&u>0&&f>0);r.cursor=i,r.keys.scanned=Array.from(r.keys.scanned),r.keys.removed=Array.from(r.keys.removed)}catch(e){this.log.error({msg:"acd/storage/redis.gc error",err:e}),r.error=e}return r}}return _=s}());let r=function(){let e;if(o)return s;o=1;let t=function(){if(i)return n;i=1;var e=function(){if(O)return A;function e(e){if("function"!=typeof e)throw Error("obliterator/iterator: expecting a function!");this.next=e}return O=1,"u">typeof Symbol&&(e.prototype[Symbol.iterator]=function(){return this}),e.of=function(){var t=arguments,r=t.length,n=0;return new e(function(){return n>=r?{done:!0}:{done:!1,value:t[n++]}})},e.empty=function(){return new e(function(){return{done:!0}})},e.fromSequence=function(t){var r=0,n=t.length;return new e(function(){return r>=n?{done:!0}:{done:!1,value:t[r++]}})},e.is=function(t){return t instanceof e||"object"==typeof t&&null!==t&&"function"==typeof t.next},A=e}(),t=T(),r=P(),s=function(){if(N)return I;N=1;var e=T(),t=P();function r(e){return"number"==typeof e.length?e.length:"number"==typeof e.size?e.size:void 0}return I.isArrayLike=function(e){return Array.isArray(e)||t.isTypedArray(e)},I.guessLength=r,I.toArray=function(t){var n=r(t),i="number"==typeof n?Array(n):[],s=0;return e(t,function(e){i[s++]=e}),i},I.toArrayWithIndices=function(n){var i=r(n),s="number"==typeof i?t.getPointerArray(i):Array,o="number"==typeof i?Array(i):[],a="number"==typeof i?new s(i):[],l=0;return e(n,function(e){o[l]=e,a[l]=l++}),[o,a]},I}();function o(e,t,n){if(arguments.length<2&&(n=e,e=null,t=null),this.capacity=n,"number"!=typeof this.capacity||this.capacity<=0)throw Error("mnemonist/lru-cache: capacity should be positive number.");if(!isFinite(this.capacity)||Math.floor(this.capacity)!==this.capacity)throw Error("mnemonist/lru-cache: capacity should be a finite positive integer.");var i=r.getPointerArray(n);this.forward=new i(n),this.backward=new i(n),this.K="function"==typeof e?new e(n):Array(n),this.V="function"==typeof t?new t(n):Array(n),this.size=0,this.head=0,this.tail=0,this.items={}}return o.prototype.clear=function(){this.size=0,this.head=0,this.tail=0,this.items={}},o.prototype.splayOnTop=function(e){var t=this.head;if(this.head===e)return this;var r=this.backward[e],n=this.forward[e];return this.tail===e?this.tail=r:this.backward[n]=r,this.forward[r]=n,this.backward[t]=e,this.head=e,this.forward[e]=t,this},o.prototype.set=function(e,t){var r=this.items[e];if("u">typeof r){this.splayOnTop(r),this.V[r]=t;return}this.size<this.capacity?r=this.size++:(r=this.tail,this.tail=this.backward[r],delete this.items[this.K[r]]),this.items[e]=r,this.K[r]=e,this.V[r]=t,this.forward[r]=this.head,this.backward[this.head]=r,this.head=r},o.prototype.setpop=function(e,t){var r=null,n=null,i=this.items[e];return"u">typeof i?(this.splayOnTop(i),r=this.V[i],this.V[i]=t,{evicted:!1,key:e,value:r}):(this.size<this.capacity?i=this.size++:(i=this.tail,this.tail=this.backward[i],r=this.V[i],n=this.K[i],delete this.items[n]),this.items[e]=i,this.K[i]=e,this.V[i]=t,this.forward[i]=this.head,this.backward[this.head]=i,this.head=i,n?{evicted:!0,key:n,value:r}:null)},o.prototype.has=function(e){return e in this.items},o.prototype.get=function(e){var t=this.items[e];if(!(typeof t>"u"))return this.splayOnTop(t),this.V[t]},o.prototype.peek=function(e){var t=this.items[e];if(!(typeof t>"u"))return this.V[t]},o.prototype.forEach=function(e,t){t=arguments.length>1?t:this;for(var r=0,n=this.size,i=this.head,s=this.K,o=this.V,a=this.forward;r<n;)e.call(t,o[i],s[i],this),i=a[i],r++},o.prototype.keys=function(){var t=0,r=this.size,n=this.head,i=this.K,s=this.forward;return new e(function(){if(t>=r)return{done:!0};var e=i[n];return++t<r&&(n=s[n]),{done:!1,value:e}})},o.prototype.values=function(){var t=0,r=this.size,n=this.head,i=this.V,s=this.forward;return new e(function(){if(t>=r)return{done:!0};var e=i[n];return++t<r&&(n=s[n]),{done:!1,value:e}})},o.prototype.entries=function(){var t=0,r=this.size,n=this.head,i=this.K,s=this.V,o=this.forward;return new e(function(){if(t>=r)return{done:!0};var e=i[n],a=s[n];return++t<r&&(n=o[n]),{done:!1,value:[e,a]}})},"u">typeof Symbol&&(o.prototype[Symbol.iterator]=o.prototype.entries),o.prototype.inspect=function(){for(var e,t=new Map,r=this.entries();!(e=r.next()).done;)t.set(e.value[0],e.value[1]);return Object.defineProperty(t,"constructor",{value:o,enumerable:!1}),t},"u">typeof Symbol&&(o.prototype[Symbol.for("nodejs.util.inspect.custom")]=o.prototype.inspect),o.from=function(e,r,n,i){if(arguments.length<2){if("number"!=typeof(i=s.guessLength(e)))throw Error("mnemonist/lru-cache.from: could not guess iterable length. Please provide desired capacity as last argument.")}else 2==arguments.length&&(i=r,r=null,n=null);var a=new o(r,n,i);return t(e,function(e,t){a.set(t,e)}),a},n=o}(),{abstractLogging:r}=v(),a=b(),{findMatchingIndexes:l,findNotMatching:u,bsearchIndex:f,wildcardMatch:c}=v(),h="u">typeof globalThis.setImmediate?globalThis.setImmediate:(e,...t)=>setTimeout(e,0,...t);class d extends a{constructor(e={}){if(e.size&&("number"!=typeof e.size||e.size<1))throw Error("size must be a positive integer greater than 0");super(e),this.size=e.size||1024,this.log=e.log||r(),this.invalidation=e.invalidation||!1,this.init()}init(){this.store=new t(this.size),this.invalidation&&(this.keysReferences=new Map,this.referencesKeys=new Map)}get(e){this.log.debug({msg:"acd/storage/memory.get",key:e});let t=this.store.get(e);if(t){if(this.log.debug({msg:"acd/storage/memory.get, entry",entry:t,now:g()}),t.start+t.ttl>g())return this.log.debug({msg:"acd/storage/memory.get, key is NOT expired",key:e,entry:t}),t.value;this.log.debug({msg:"acd/storage/memory.get, key is EXPIRED",key:e,entry:t}),h(()=>this.remove(e))}}getTTL(e){this.log.debug({msg:"acd/storage/memory.getTTL",key:e});let t=this.store.peek(e),r=0;return t&&(r=t.start+t.ttl-g())<0&&(r=0),r}set(e,t,r,n){let i;if(this.log.debug({msg:"acd/storage/memory.set",key:e,value:t,ttl:r,references:n}),!(r=Number(r))||r<0)return;let s=this.store.has(e),o=this.store.setpop(e,{value:t,ttl:r,start:g()});if(this.log.debug({msg:"acd/storage/memory.set, evicted",removed:o}),o&&o.evicted&&(this.log.debug({msg:"acd/storage/memory.set, remove evicted key",key:o.key}),this._removeReferences([o.key])),!n||n.length<1)return;if(!this.invalidation)return void this.log.warn({msg:"acd/storage/memory.set, invalidation is disabled, references are useless"});if(n=[...new Set(n)],s&&(i=this.keysReferences.get(e),this.log.debug({msg:"acd/storage/memory.set, current keys-references",key:e,references:i}),i))for(let t of(i.sort(),n.sort(),u(n,i))){let r=this.referencesKeys.get(t);if(!r)continue;let n=f(r,e);
19if(!(n<0)){if(r.splice(n,1),r.length<1){this.referencesKeys.delete(t);continue}this.referencesKeys.set(t,r)}}let a=i?u(i,n):n;for(let t=0;t<a.length;t++){let r=a[t],n=this.referencesKeys.get(r);n?(this.log.debug({msg:"acd/storage/memory.set, add reference-key",key:e,reference:r}),n.push(e)):n=[e],this.log.debug({msg:"acd/storage/memory.set, set reference-keys",keys:n,reference:r}),this.referencesKeys.set(r,n)}this.keysReferences.set(e,n)}remove(e){this.log.debug({msg:"acd/storage/memory.remove",key:e});let t=this._removeKey(e);return this._removeReferences([e]),t}_removeKey(e){return this.log.debug({msg:"acd/storage/memory._removeKey",key:e}),!!this.store.has(e)&&(this.store.set(e,void 0),!0)}_removeReferences(e){if(!this.invalidation)return;this.log.debug({msg:"acd/storage/memory._removeReferences",keys:e});let t=new Set;for(let r=0;r<e.length;r++){let n=e[r],i=this.keysReferences.get(n);if(i){for(let e=0;e<i.length;e++)t.add(i[e]);this.log.debug({msg:"acd/storage/memory._removeReferences, delete key-references",key:n}),this.keysReferences.delete(n)}}this._removeReferencesKeys([...t],e)}_removeReferencesKeys(e,t){t.sort(),this.log.debug({msg:"acd/storage/memory._removeReferencesKeys",references:e,keys:t});for(let r=0;r<e.length;r++){let n=e[r],i=this.referencesKeys.get(n);if(this.log.debug({msg:"acd/storage/memory._removeReferencesKeys, get reference-key",reference:n,keys:t,referencesKeys:i}),!i)continue;let s=l(t,i);if(this.log.debug({msg:"acd/storage/memory._removeReferencesKeys, removing",reference:n,referencesToRemove:s,referencesKeys:i}),s.length===i.length){this.log.debug({msg:"acd/storage/memory._removeReferencesKeys, delete",reference:n}),this.referencesKeys.delete(n);continue}for(let e=s.length-1;e>=0;e--)this.log.debug({msg:"acd/storage/memory._removeReferencesKeys, remove",reference:n,referencesKeys:i,at:s[e]}),i.splice(s[e],1)}}invalidate(e){return this.invalidation?(this.log.debug({msg:"acd/storage/memory.invalidate",references:e}),Array.isArray(e)?this._invalidateReferences(e):this._invalidateReference(e)):(this.log.warn({msg:"acd/storage/memory.invalidate, exit due invalidation is disabled"}),[])}_invalidateReferences(e){let t=[];for(let r=0;r<e.length;r++){let n=e[r],i=this.referencesKeys.get(n);if(this.log.debug({msg:"acd/storage/memory._invalidateReferences, remove keys on reference",reference:n,keys:i}),i){for(let e=0;e<i.length;e++){let r=i[e];this.log.debug({msg:"acd/storage/memory._invalidateReferences, remove key on reference",reference:n,key:r}),this._removeKey(r)&&t.push(r)}this.log.debug({msg:"acd/storage/memory._invalidateReferences, remove references of",reference:n,keys:i}),this._removeReferences([...i])}}return t}_invalidateReference(e){if(e.includes("*")){let t=[];for(let r of this.referencesKeys.keys())c(e,r)&&t.push(r);return this._invalidateReferences(t)}let t=this.referencesKeys.get(e),r=[];if(this.log.debug({msg:"acd/storage/memory._invalidateReference, remove keys on reference",reference:e,keys:t}),!t)return r;for(let n=0;n<t.length;n++){let i=t[n];this.log.debug({msg:"acd/storage/memory._invalidateReference, remove key on reference",reference:e,key:i}),this._removeKey(i)&&r.push(i)}return this.log.debug({msg:"acd/storage/memory._invalidateReference, remove references of",reference:e,keys:t}),this._removeReferences([...t]),r}clear(e){if(this.log.debug({msg:"acd/storage/memory.clear",name:e}),!e){if(this.store.clear(),!this.invalidation)return;this.referencesKeys.clear(),this.keysReferences.clear();return}let t=[];this.store.forEach((r,n)=>{this.log.debug({msg:"acd/storage/memory.clear, iterate key",key:n}),0===n.indexOf(e)&&(this.log.debug({msg:"acd/storage/memory.clear, remove key",key:n}),t.push(n))});let r=[];for(let e=0;e<t.length;e++)this._removeKey(t[e])&&r.push(t[e]);return this._removeReferences(r),r}refresh(){this.log.debug({msg:"acd/storage/memory.refresh"}),this.init()}}function g(){if(void 0!==e)return e;e=Math.floor(Date.now()/1e3);let t=setTimeout(y,1e3);return"function"==typeof t.unref&&t.unref(),e}function y(){e=void 0}return s=d}(),u="redis";
19return a=function(n,i){if(!t&&n===u)throw Error("Redis storage is not supported in the browser");return n===u?new e(i):new r(i)}}var U=function(){if(c)return f;c=1;let{Cache:e}=function(){if(u)return y;u=1;let{kValues:e,kStorage:t,kStorages:r,kTransfromer:n,kTTL:i,kOnDedupe:s,kOnError:o,kOnHit:a,kOnMiss:l,kStale:f}=function(){if(d)return h;d=1;let e=Symbol("values"),t=Symbol("kStorage"),r=Symbol("kStorages"),n=Symbol("kTransformer"),i=Symbol("kTTL"),s=Symbol("kOnDedupe"),o=Symbol("kOnError"),a=Symbol("kOnHit");return h={kValues:e,kStorage:t,kStorages:r,kTransfromer:n,kTTL:i,kOnDedupe:s,kOnError:o,kOnHit:a,kOnMiss:Symbol("kOnMiss"),kStale:Symbol("kStale")}}(),c=m(),g=L();class p{constructor(u={}){if(!u.storage)throw Error("storage is required");if(u.ttl&&"number"==typeof u.ttl&&(u.ttl<0||!Number.isInteger(u.ttl)))throw Error("ttl must be a positive integer greater than 0");if(u.onDedupe&&"function"!=typeof u.onDedupe)throw Error("onDedupe must be a function");if(u.onError&&"function"!=typeof u.onError)throw Error("onError must be a function");if(u.onHit&&"function"!=typeof u.onHit)throw Error("onHit must be a function");if(u.onMiss&&"function"!=typeof u.onMiss)throw Error("onMiss must be a function");if("number"==typeof u.stale&&!(Math.floor(u.stale)===u.stale&&u.stale>=0))throw Error("stale must be an integer greater or equal to 0");this[e]={},this[t]=u.storage,this[r]=new Map,this[r].set("_default",u.storage),this[n]=u.transformer,this[i]=u.ttl||0,this[s]=u.onDedupe||w,this[o]=u.onError||w,this[a]=u.onHit||w,this[l]=u.onMiss||w,this[f]=u.stale||0}define(u,c,h){let d;if("function"==typeof c&&(h=c,c={}),u&&this[u])throw Error(`${u} is already defined in the cache or it is a forbidden name`);if(c=c||{},"function"!=typeof h)throw TypeError(`Missing the function parameter for '${u}'`);let y=c.serialize;if(y&&"function"!=typeof y)throw TypeError("serialize must be a function");let p=c.references;if(p&&"function"!=typeof p)throw TypeError("references must be a function");if("function"!=typeof c.ttl&&c.ttl&&("number"!=typeof c.ttl||c.ttl<0||!Number.isInteger(c.ttl)))throw Error("ttl must be a positive integer greater than 0");c.storage?(d=g(c.storage.type,c.storage.options),this[r].set(u,d)):d=this[t];let m=void 0!==c.ttl?c.ttl:this[i],b=void 0!==c.stale?c.stale:this[f],w=c.onDedupe||this[s],k=c.onError||this[o],S=c.onHit||this[a],$=c.onMiss||this[l],_=c.transformer||this[n],E=new v(h,u,y,p,d,_,m,w,k,S,$,b);return this[e][u]=E,this[u]=E.add.bind(E),this}async clear(t,r){if(t){if(!this[e][t])throw Error(`${t} is not defined in the cache`);await this[e][t].clear(r);return}let n=[];for(let t of Object.values(this[e]))n.push(t.clear());await Promise.all(n)}async get(t,r){if(!this[e][t])throw Error(`${t} is not defined in the cache`);return this[e][t].get(r)}async set(t,r,n,i,s){if(!this[e][t])throw Error(`${t} is not defined in the cache`);return this[e][t].set(r,n,i,s)}async invalidate(t,r){if(!this[e][t])throw Error(`${t} is not defined in the cache`);return this[e][t].invalidate(r)}async invalidateAll(e,t="_default"){if(!this[r].has(t))throw Error(`${t} storage is not defined in the cache`);await this[r].get(t).invalidate(e)}}class v{constructor(e,t,r,n,i,s,o,a,l,u,f,c){this.dedupes=new Map,this.func=e,this.name=t,this.serialize=r,this.references=n,this.storage=i,this.transformer=s,this.ttl=o,this.onDedupe=a,this.onError=l,this.onHit=u,this.onMiss=f,this.stale=c}getKey(e){let t=this.serialize?this.serialize(e):e;return"string"==typeof t?t:c(t)}getStorageKey(e){return`${this.name}~${e}`}getStorageName(){return`${this.name}~`}add(e){try{let t=this.getKey(e),r=this.dedupes.get(t);return r?this.onDedupe(t):(r=new b,this.buildPromise(r,e,t),this.dedupes.set(t,r)),r.promise}catch(e){this.onError(e)}}async wrapFunction(e,t){let r=this.getStorageKey(t);if(this.ttl>0||"function"==typeof this.ttl){let n=await this.get(r);if(void 0!==n){this.onHit(t);let i="function"==typeof this.stale?this.stale(n):this.stale;return i>0&&await this.storage.getTTL(r)<=i&&this._wrapFunction(r,e,t).catch(w),n}this.onMiss(t)}return this._wrapFunction(r,e,t)}async _wrapFunction(e,t,r){let n=await this.func(t,r),i="function"==typeof this.stale?this.stale(n):this.stale,s="function"==typeof this.ttl?this.ttl(n):this.ttl;if(null==s||"number"!=typeof s||!Number.isInteger(s))return this.onError(Error("ttl must be an integer")),n;if((s+=i)<1)return n;if(!this.references)return await this.set(e,n,s),n;try{let i=this.references(t,r,n),o=n;i&&"function"==typeof i.then&&(i=await i),this.transformer&&(o=this.transformer.serialize(n)),await this.storage.set(e,o,s,i)}catch(e){this.onError(e)}return n}buildPromise(e,t,r){e.promise=this.wrapFunction(t,r),e.promise.then(e=>(this.dedupes.delete(r),e)).catch(e=>{this.onError(e),this.dedupes.delete(r);let t=this.storage.remove(this.getStorageKey(r));t&&"function"==typeof t.catch&&t.catch(w)})}async clear(e){if(e){let t=this.getKey(e);this.dedupes.delete(t),await this.storage.remove(this.getStorageKey(t));return}await this.storage.clear(this.getStorageName()),this.dedupes.clear()}async get(e){let t=await this.storage.get(e);return this.transformer&&t?await this.transformer.deserialize(t):t}async set(e,t,r,n){return this.transformer&&(t=this.transformer.serialize(t)),this.storage.set(e,t,r,n)}
19async invalidate(e){return this.storage.invalidate(e)}}class b{constructor(){this.promise=null}}function w(){}return y.Cache=p,y}(),t=L();return f={Cache:e,createCache:function(r){r?r.storage||(r.storage={type:"memory"}):r={storage:{type:"memory"}};let n=t(r.storage.type,r.storage.options);return new e({...r,storage:n})},createStorage:t}}();let C=0,J=[];Symbol("clean");let D=[],F=(e,t)=>{let r=[],n={get:()=>(n.lc||n.listen(()=>{})(),n.value),l:t||0,lc:0,listen:(e,t)=>(n.lc=r.push(e,t||n.l)/2,()=>{let t=r.indexOf(e);~t&&(r.splice(t,2),--n.lc||n.off())}),notify(e,t){let i=!D.length;for(let i=0;i<r.length;i+=2)D.push(r[i],r[i+1],n.value,e,t);if(i){for(let e=0;e<D.length;e+=5){let t;for(let r=e+1;!t&&(r+=5)<D.length;)D[r]<D[e+1]&&(t=D.push(D[e],D[e+1],D[e+2],D[e+3],D[e+4]));t||D[e](D[e+2],D[e+3],D[e+4])}D.length=0}},off(){},set(e){let t=n.value;t!==e&&(n.value=e,n.notify(t))},subscribe(e,t){let r=n.listen(e,t);return e(n.value),r},value:e};return n},V=typeof document>"u"?"server":"browser";function q(e){return e.withConfig({allowReconfigure:!1})}let H=e=>{let{ssr:t=!1,tag:n="core-loader"}=e;if(t&&e.client)throw TypeError("`client` option is not allowed when `ssr: true`, use `setServerClient` from your server entry point instead");if(!t&&!1===e.client)throw TypeError("You must set `ssr: true` when `client: false` is used");if(!t&&!e.client)throw TypeError("`client` is required");let i=t?void 0:q(e.client);function s(e){return U.createCache().define("fetch",async t=>{if(!e)throw Error("You have to set the Sanity client with `setServerClient` before any data fetching is done");let{query:r,params:i={},perspective:s,useCdn:o,stega:a}=JSON.parse(t),{result:l,resultSourceMap:u}=await e.fetch(r,i,{tag:n,filterResponse:!1,perspective:s,useCdn:o,stega:a});return{result:l,resultSourceMap:u}})}function o(){let e=i?.config().perspective||"published";return a.instance=s(i),{hydrate:(t,r,n)=>({loading:n?.data===void 0||n?.sourceMap===void 0,error:void 0,data:n?.data,sourceMap:n?.sourceMap,perspective:e}),fetch:(t,r,n,i)=>{if(i.signal.aborted)return;let s=(C+=1,()=>{if(0==(C-=1)){let e=J;for(let t of(J=[],e))t()}});n.setKey("loading",!0),n.setKey("error",void 0),a.instance.fetch(JSON.stringify({query:t,params:r})).then(t=>{i.signal.aborted||(n.setKey("data",t.result),n.setKey("sourceMap",t.resultSourceMap),n.setKey("perspective",e))}).catch(e=>{n.setKey("error",e)}).finally(()=>{n.setKey("loading",!1),s()})}}}let a={instance:s(i)},l=F(i?o():void 0),u=(e=>{let{ssr:t,setFetcher:n}=e;return i=>{let s;if("server"===V)throw Error("Live mode is not supported in server environments");if(t&&!i.client)throw Error("The `client` option in `enableLiveMode` is required");let o=i.client||e.client||void 0,a=new AbortController;return Promise.all([r.e(5922),r.e(6245)]).then(r.bind(r,66245)).then(({enableLiveMode:e})=>{a.signal.aborted||(s=e({...i,client:o,setFetcher:n,ssr:t}))}),()=>{a.abort(),s?.()}}})({client:i||void 0,ssr:t,setFetcher:e=>{let t=l.get();return l.set(e),()=>l.set(t)}}),f={instance:void 0,canPreviewDrafts:!1};return{createFetcherStore:(e,t={},r)=>{let n=l.get(),i=((e={})=>{let t=F(e);return t.setKey=function(e,r){let n=t.value;typeof r>"u"&&e in t.value?(t.value={...t.value},delete t.value[e],t.notify(n,e)):t.value[e]!==r&&(t.value={...t.value,[e]:r},t.notify(n,e))},t})(n?n.hydrate(e,t,r):{loading:!1,error:typeof r?.data>"u"?Error("The `initial` option is required when `ssr: true`"):void 0,data:r?.data,sourceMap:r?.sourceMap,perspective:r?.perspective});return((e,t)=>((e,t,r,n)=>(e.events=e.events||{},e.events[r+10]||(e.events[r+10]=n(t=>{e.events[r].reduceRight((e,t)=>(t(e),e),{shared:{},...t})})),e.events[r]=e.events[r]||[],e.events[r].push(t),()=>{let n=e.events[r],i=n.indexOf(t);n.splice(i,1),n.length||(delete e.events[r],e.events[r+10](),delete e.events[r+10])}))(e,r=>{let n=t(r);n&&e.events[6].push(n)},5,t=>{let r=e.listen;e.listen=(...n)=>(e.lc||e.active||(e.active=!0,t()),r(...n));let n=e.off;return e.events[6]=[],e.off=()=>{n(),setTimeout(()=>{if(e.active&&!e.lc){for(let t of(e.active=!1,e.events[6]))t();e.events[6]=[]}},1e3)},()=>{e.listen=r,e.off=n}}))(i,()=>{let r=new AbortController,n=l.subscribe(n=>{!n||r.signal.aborted||(r.abort(),r=new AbortController,n.fetch(e,t,i,r))});return()=>{r.abort(),n()}}),i},enableLiveMode:u,setServerClient:e=>{if("server"!==V)throw Error("`setServerClient` can only be called in server environments, detected: "+JSON.stringify(V));if(!t)throw Error("`setServerClient` can only be called when `ssr: true`");f.instance=i=q(e),f.canPreviewDrafts=!!i.config().token,l.set(o())}
19,unstable__cache:a,unstable__serverClient:f}}},93261:(e,t,r)=>{r.d(t,{C:()=>d,EH:()=>w,Hf:()=>v,IM:()=>y,Jt:()=>u,KT:()=>function e(t,r,n=[]){if(null!==t&&Array.isArray(t))return t.map((t,i)=>{if(S(t)){let s=t._key;if("string"==typeof s)return e(t,r,n.concat({_key:s,_index:i}))}return e(t,r,n.concat(i))});if(S(t)){if("block"===t._type||"span"===t._type){let i={...t};return"block"===t._type?i.children=e(t.children,r,n.concat("children")):"span"===t._type&&(i.text=e(t.text,r,n.concat("text"))),i}return Object.fromEntries(Object.entries(t).map(([t,i])=>[t,e(i,r,n.concat(t))]))}return r(t,n)},Nx:()=>_,YQ:()=>g,_y:()=>b,dI:()=>f,fO:()=>k,iz:()=>$});let n=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,i=/_key\s*==\s*['"](.*)['"]/,s=/^\d*:\d*$/;function o(e){return"number"==typeof e||"string"==typeof e&&/^\[\d+\]$/.test(e)}function a(e){return"string"==typeof e?i.test(e.trim()):"object"==typeof e&&"_key"in e}function l(e){if("string"==typeof e&&s.test(e))return!0;if(!Array.isArray(e)||2!==e.length)return!1;let[t,r]=e;return("number"==typeof t||""===t)&&("number"==typeof r||""===r)}function u(e,t,r){let n="string"==typeof t?c(t):t;if(!Array.isArray(n))throw Error("Path must be an array or a string");let i=e;for(let e=0;e<n.length;e++){let t=n[e];if(o(t)){if(!Array.isArray(i))return r;i=i[t]}if(a(t)){if(!Array.isArray(i))return r;i=i.find(e=>e._key===t._key)}if("string"==typeof t&&(i="object"==typeof i&&null!==i?i[t]:void 0),typeof i>"u")return r}return i}function f(e){if(!Array.isArray(e))throw Error("Path is not an array");return e.reduce((e,t,r)=>{let n=typeof t;if("number"===n)return`${e}[${t}]`;if("string"===n)return`${e}${0===r?"":"."}${t}`;if(a(t)&&t._key)return`${e}[_key=="${t._key}"]`;if(Array.isArray(t)){let[r,n]=t;return`${e}[${r}:${n}]`}throw Error(`Unsupported path segment \`${JSON.stringify(t)}\``)},"")}function c(e){if("string"!=typeof e)throw Error("Path is not a string");let t=e.match(n);if(!t)throw Error("Invalid path string");return t.map(h)}function h(e){return o(e)?Number(e.replace(/[^\d]/g,"")):a(e)?{_key:e.match(i)[1]}:l(e)?function(e){let[t,r]=e.split(":").map(e=>""===e?e:Number(e));return[t,r]}(e):e}var d=Object.freeze({__proto__:null,fromString:c,get:u,isIndexSegment:o,isIndexTuple:l,isKeySegment:a,reKeySegment:i,toString:f});let g="drafts.";function y(e){return e.startsWith(g)?e.slice(g.length):e}let p={"\f":"\\f","\n":"\\n","\r":"\\r"," ":"\\t","'":"\\'","\\":"\\\\"},m={"\\f":"\f","\\n":` 20`,"\\r":"\r","\\t":" ","\\'":"'","\\\\":"\\"};function v(e){let t,r=[],n=/\['(.*?)'\]|\[(\d+)\]|\[\?\(@\._key=='(.*?)'\)\]/g;for(;null!==(t=n.exec(e));){if(void 0!==t[1]){let e=t[1].replace(/\\(\\|f|n|r|t|')/g,e=>m[e]);r.push(e);continue}if(void 0!==t[2]){r.push(parseInt(t[2],10));continue}if(void 0!==t[3]){let e=t[3].replace(/\\(\\')/g,e=>m[e]);r.push({_key:e,_index:-1});continue}}return r}function b(e){return e.map(e=>{if("string"==typeof e||"number"==typeof e)return e;if(""!==e._key)return{_key:e._key};if(-1!==e._index)return e._index;throw Error(`invalid segment:${JSON.stringify(e)}`)})}function w(e){return("string"==typeof e?c(e):e).map(e=>{var t;if("string"==typeof e||"number"==typeof e)return e;if(Array.isArray(e))throw Error(`IndexTuple segments aren't supported:${JSON.stringify(e)}`);if("object"==typeof(t=e)&&"_key"in t&&"_index"in t)return e;if(e._key)return{_key:e._key,_index:-1};throw Error(`invalid segment:${JSON.stringify(e)}`)})}function k(e,t){var r;if(!t?.mappings)return;let n=(r=e.map(e=>{if("string"==typeof e||"number"==typeof e)return e;if(-1!==e._index)return e._index;throw Error(`invalid segment:${JSON.stringify(e)}`)}),`$${r.map(e=>"string"==typeof e?`['${e.replace(/[\f\n\r\t'\\]/g,e=>p[e])}']`:"number"==typeof e?`[${e}]`:""!==e._key?`[?(@._key=='${e._key.replace(/['\\]/g,e=>p[e])}')]`:`[${e._index}]`).join("")}`);if(void 0!==t.mappings[n])return{mapping:t.mappings[n],matchedPath:n,pathSuffix:""};let i=Object.entries(t.mappings).filter(([e])=>n.startsWith(e)).sort(([e],[t])=>t.length-e.length);if(0==i.length)return;let[s,o]=i[0],a=n.substring(s.length);return{mapping:o,matchedPath:s,pathSuffix:a}}function S(e){return"object"==typeof e&&null!==e}function $(e){let{baseUrl:t,workspace:r="default",tool:n="default",id:i,type:s,path:o,projectId:a,dataset:l}=e;if(!t)throw Error("baseUrl is required");if(!o)throw Error("path is required");if(!i)throw Error("id is required");if("/"!==t&&t.endsWith("/"))throw Error("baseUrl must not end with a slash");let u="default"===r?void 0:r,c="default"===n?void 0:n,h=y(i),d=Array.isArray(o)?f(b(o)):o,p=new URLSearchParams({baseUrl:t,id:h,type:s,path:d});u&&p.set("workspace",u),c&&p.set("tool",c),a&&p.set("projectId",a),l&&p.set("dataset",l),i.startsWith(g)&&p.set("isDraft","");let m=["/"===t?"":t];u&&m.push(u);let v=["mode=presentation",`id=${h}`,`type=${s}`,`path=${encodeURIComponent(d)}`];return c&&v.push(`tool=${c}`),m.push("intent","edit",`${v.join(";")}?${p}`),m.join("/")}function _(e){let{resultSourceMap:t,resultPath:r}=e,{mapping:n,pathSuffix:i}=k(r,t)||{};
20if(!n||"literal"===n.source.type||"unknown"===n.source.type)return;let s=t.documents[n.source.document],o=t.paths[n.source.path];if(s&&o){var a;let t,{baseUrl:r,workspace:n,tool:l}=("/"!==(t="string"==typeof(a="function"==typeof e.studioUrl?e.studioUrl(s):e.studioUrl)?a:a.baseUrl)&&(t=t.replace(/\/$/,"")),"string"==typeof a?{baseUrl:t}:{...a,baseUrl:t});if(!r)return;let{_id:u,_type:f,_projectId:c,_dataset:h}=s;return{baseUrl:r,workspace:n,tool:l,id:u,type:f,path:v(o+i),projectId:c,dataset:h}}}}}]);
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.