1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6046],{56046:function(t,e,n){n.r(e),n.d(e,{encodeIntoResult:function(){return p},stegaEncodeSourceMap:function(){return y},stegaEncodeSourceMap$1:function(){return m}});var r=n(20557);let o=/_key\s*==\s*['"](.*)['"]/;function i(t){if(!Array.isArray(t))throw Error("Path is not an array");return t.reduce((t,e,n)=>{let r=typeof e;if("number"===r)return"".concat(t,"[").concat(e,"]");if("string"===r)return"".concat(t).concat(0===n?"":".").concat(e);if(("string"==typeof e?o.test(e.trim()):"object"==typeof e&&"_key"in e)&&e._key)return"".concat(t,'[_key=="').concat(e._key,'"]');if(Array.isArray(e)){let[n,r]=e;return"".concat(t,"[").concat(n,":").concat(r,"]")}throw Error("Unsupported path segment `".concat(JSON.stringify(e),"`"))},"")}let l={"\f":"\\f","\n":"\\n","\r":"\\r"," ":"\\t","'":"\\'","\\":"\\\\"},a={"\\f":"\f","\\n":"\n","\\r":"\r","\\t":" ","\\'":"'","\\\\":"\\"};function c(t){let e;let n=[],r=/\['(.*?)'\]|\[(\d+)\]|\[\?\(@\._key=='(.*?)'\)\]/g;for(;null!==(e=r.exec(t));){if(void 0!==e[1]){let t=e[1].replace(/\\(\\|f|n|r|t|')/g,t=>a[t]);n.push(t);continue}if(void 0!==e[2]){n.push(parseInt(e[2],10));continue}if(void 0!==e[3]){let t=e[3].replace(/\\(\\')/g,t=>a[t]);n.push({_key:t,_index:-1});continue}}return n}function u(t){return t.map(t=>{if("string"==typeof t||"number"==typeof t)return t;if(""!==t._key)return{_key:t._key};if(-1!==t._index)return t._index;throw Error("invalid segment:".concat(JSON.stringify(t)))})}function s(t){return"object"==typeof t&&null!==t}function p(t,e,n){return function t(e,n){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];if(null!==e&&Array.isArray(e))return e.map((e,o)=>{if(s(e)){let i=e._key;if("string"==typeof i)return t(e,n,r.concat({_key:i,_index:o}))}return t(e,n,r.concat(o))});if(s(e)){if("block"===e._type||"span"===e._type){let o={...e};return"block"===e._type?o.children=t(e.children,n,r.concat("children")):"span"===e._type&&(o.text=t(e.text,n,r.concat("text"))),o}return Object.fromEntries(Object.entries(e).map(e=>{let[o,i]=e;return[o,t(i,n,r.concat(o))]}))}return n(e,r)}(t,(t,r)=>{if("string"!=typeof t)return t;let o=function(t,e){var n;if(!(null==e?void 0:e.mappings))return;let r=(n=t.map(t=>{if("string"==typeof t||"number"==typeof t)return t;if(-1!==t._index)return t._index;throw Error("invalid segment:".concat(JSON.stringify(t)))}),"$".concat(n.map(t=>"string"==typeof t?"['".concat(t.replace(/[\f\n\r\t'\\]/g,t=>l[t]),"']"):"number"==typeof t?"[".concat(t,"]"):""!==t._key?"[?(@._key=='".concat(t._key.replace(/['\\]/g,t=>l[t]),"')]"):"[".concat(t._index,"]")).join("")));if(void 0!==e.mappings[r])return{mapping:e.mappings[r],matchedPath:r,pathSuffix:""};let o=Object.entries(e.mappings).filter(t=>{let[e]=t;return r.startsWith(e)}).sort((t,e)=>{let[n]=t,[r]=e;return r.length-n.length});if(0==o.length)return;let[i,a]=o[0],c=r.substring(i.length);return{mapping:a,matchedPath:i,pathSuffix:c}}(r,e);if(!o)return t;let{mapping:i,matchedPath:a}=o;if("value"!==i.type||"documentValue"!==i.source.type)return t;let u=e.documents[i.source.document],s=e.paths[i.source.path],p=c(a);return n({sourcePath:c(s).concat(r.slice(p.length)),sourceDocument:u,resultPath:r,value:t})})}let d="drafts.",f=t=>{let{sourcePath:e,resultPath:n,value:r}=t;if(/^\d{4}-\d{2}-\d{2}/.test(r)&&Date.parse(r)||function(t){try{new URL(t,t.startsWith("/")?"https://acme.com":void 0)}catch(t){return!1}return!0}(r))return!1;let o=e.at(-1);return!("slug"===e.at(-2)&&"current"===o||"string"==typeof o&&(o.startsWith("_")||o.endsWith("Id"))||e.some(t=>"meta"===t||"metadata"===t||"openGraph"===t||"seo"===t)||g(e)||g(n)||"string"==typeof o&&h.has(o))},h=new Set(["color","colour","currency","email","format","gid","hex","href","hsl","hsla","icon","id","index","key","language","layout","link","linkAction","locale","lqip","page","path","ref","rgb","rgba","route","secret","slug","status","tag","template","theme","type","textTheme","unit","url","username","variant","website"]);function g(t){return t.some(t=>"string"==typeof t&&null!==t.match(/type/i))}function y(t,e,n){var l,a,c,s,h,g,y,m,_;let{filter:k,logger:v,enabled:b}=n;if(!b){let r="config.enabled must be true, don't call this function otherwise";throw null==v||null===(a=v.error)||void 0===a||a.call(v,"[@sanity/client]: ".concat(r),{result:t,resultSourceMap:e,config:n}),TypeError(r)}if(!e)return null==v||null===(l=v.error)||void 0===l||l.call(v,"[@sanity/client]: Missing Content Source Map from response body",{result:t,resultSourceMap:e,config:n}),t;if(!n.studioUrl){let r="config.studioUrl must be defined";throw null==v||null===(c=v.error)||void 0===c||c.call(v,"[@sanity/client]: ".concat(r),{result:t,resultSourceMap:e,config:n}),TypeError(r)}let w={encoded:[],skipped:[]},E=p(t,e,t=>{var e;let o,{sourcePath:l,sourceDocument:a,resultPath:c,value:s}=t;if(("function"==typeof k?k({sourcePath:l,resultPath:c,filterDefault:f,sourceDocument:a,value:s}):f({sourcePath:l,resultPath:c,filterDefault:f,sourceDocument:a,value:s}))===!1)return v&&w.skipped.push({path:i(u(l)),value:"".concat(s.slice(0,20)).concat(s.length>20?"...":""),length:s.length}),s;v&&w.encoded.push({path:i(u(l)),value:"".concat(s.slice(0,20)).concat(s.length>20?"...":""),length:s.length});let{baseUrl:p,workspace:h,tool:g}=("/"!==(o="string"==typeof(e="function"==typeof n.studioUrl?n.studioUrl(
1a):n.studioUrl)?e:e.baseUrl)&&(o=o.replace(/\/$/,"")),"string"==typeof e?{baseUrl:o}:{...e,baseUrl:o});if(!p)return s;let{_id:y,_type:m,_projectId:_,_dataset:b}=a;return(0,r.C)(s,{origin:"sanity.io",href:function(t){let{baseUrl:e,workspace:n="default",tool:r="default",id:o,type:l,path:a,projectId:c,dataset:s}=t;if(!e)throw Error("baseUrl is required");if(!a)throw Error("path is required");if(!o)throw Error("id is required");if("/"!==e&&e.endsWith("/"))throw Error("baseUrl must not end with a slash");let p="default"===n?void 0:n,f="default"===r?void 0:r,h=o.startsWith(d)?o.slice(d.length):o,g=Array.isArray(a)?i(u(a)):a,y=new URLSearchParams({baseUrl:e,id:h,type:l,path:g});p&&y.set("workspace",p),f&&y.set("tool",f),c&&y.set("projectId",c),s&&y.set("dataset",s),o.startsWith(d)&&y.set("isDraft","");let m=["/"===e?"":e];p&&m.push(p);let _=["mode=presentation","id=".concat(h),"type=".concat(l),"path=".concat(encodeURIComponent(g))];return f&&_.push("tool=".concat(f)),m.push("intent","edit","".concat(_.join(";"),"?").concat(y)),m.join("/")}({baseUrl:p,workspace:h,tool:g,id:y,type:m,path:l,...!n.omitCrossDatasetReferenceData&&{dataset:b,projectId:_}})},!1)});if(v){let t=w.skipped.length,e=w.encoded.length;if((t||e)&&(null===(s=(null==v?void 0:v.groupCollapsed)||v.log)||void 0===s||s("[@sanity/client]: Encoding source map into result"),null===(h=v.log)||void 0===h||h.call(v,"[@sanity/client]: Paths encoded: ".concat(w.encoded.length,", skipped: ").concat(w.skipped.length))),w.encoded.length>0&&(null==v||null===(g=v.log)||void 0===g||g.call(v,"[@sanity/client]: Table of encoded paths"),null===(y=(null==v?void 0:v.table)||v.log)||void 0===y||y(w.encoded)),w.skipped.length>0){let t=new Set;for(let{path:e}of w.skipped)t.add(e.replace(o,"0").replace(/\[\d+\]/g,"[]"));null==v||null===(_=v.log)||void 0===_||_.call(v,"[@sanity/client]: List of skipped paths",[...t.values()])}(t||e)&&(null==v||null===(m=v.groupEnd)||void 0===m||m.call(v))}return E}var m=Object.freeze({__proto__:null,stegaEncodeSourceMap:y})}}]);
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.