@sanity/client 6.13.3 → 6.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_chunks/{browserMiddleware-3B0LRN1j.cjs → browserMiddleware-B2MFFa3m.cjs} +2 -2
- package/dist/_chunks/{browserMiddleware-3B0LRN1j.cjs.map → browserMiddleware-B2MFFa3m.cjs.map} +1 -1
- package/dist/_chunks/{browserMiddleware--4iEqxOv.js → browserMiddleware-nhWQI70y.js} +2 -2
- package/dist/_chunks/{browserMiddleware--4iEqxOv.js.map → browserMiddleware-nhWQI70y.js.map} +1 -1
- package/dist/_chunks/{nodeMiddleware-ClJKodBZ.cjs → nodeMiddleware-CfcASl-f.cjs} +3 -3
- package/dist/_chunks/{nodeMiddleware-ClJKodBZ.cjs.map → nodeMiddleware-CfcASl-f.cjs.map} +1 -1
- package/dist/_chunks/{nodeMiddleware-CpwnMbUW.js → nodeMiddleware-Me3HWLoB.js} +3 -3
- package/dist/_chunks/{nodeMiddleware-CpwnMbUW.js.map → nodeMiddleware-Me3HWLoB.js.map} +1 -1
- package/dist/_chunks/{resolveEditInfo-CkO-V0Hb.cjs → resolveEditInfo-CTU2TYdi.cjs} +14 -4
- package/dist/_chunks/resolveEditInfo-CTU2TYdi.cjs.map +1 -0
- package/dist/_chunks/{resolveEditInfo-BC6qdqZw.js → resolveEditInfo-DX-6auJZ.js} +14 -4
- package/dist/_chunks/resolveEditInfo-DX-6auJZ.js.map +1 -0
- package/dist/_chunks/{stegaEncodeSourceMap-D3O62d5b.js → stegaEncodeSourceMap-B6IscnhR.js} +14 -5
- package/dist/_chunks/stegaEncodeSourceMap-B6IscnhR.js.map +1 -0
- package/dist/_chunks/{stegaEncodeSourceMap-Do2NcGKy.js → stegaEncodeSourceMap-DS4_14pP.js} +6 -5
- package/dist/_chunks/stegaEncodeSourceMap-DS4_14pP.js.map +1 -0
- package/dist/_chunks/{stegaEncodeSourceMap-DYge0fQ_.cjs → stegaEncodeSourceMap-DTaF28aJ.cjs} +6 -5
- package/dist/_chunks/stegaEncodeSourceMap-DTaF28aJ.cjs.map +1 -0
- package/dist/_chunks/{stegaEncodeSourceMap-VuriKnxL.cjs → stegaEncodeSourceMap-Do4zj2pO.cjs} +14 -5
- package/dist/_chunks/stegaEncodeSourceMap-Do4zj2pO.cjs.map +1 -0
- package/dist/csm.cjs +1 -1
- package/dist/csm.d.ts +2 -0
- package/dist/csm.js +2 -2
- package/dist/index.browser.cjs +1 -1
- package/dist/index.browser.js +2 -2
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +4 -0
- package/dist/index.js +2 -2
- package/dist/stega.browser.cjs +2 -2
- package/dist/stega.browser.js +3 -3
- package/dist/stega.cjs +2 -2
- package/dist/stega.d.ts +4 -0
- package/dist/stega.js +3 -3
- package/package.json +8 -8
- package/src/csm/createEditUrl.ts +8 -0
- package/src/csm/resolveEditInfo.ts +3 -1
- package/src/csm/types.ts +2 -0
- package/src/stega/stegaEncodeSourceMap.ts +2 -1
- package/src/stega/types.ts +4 -0
- package/umd/sanityClient.js +14 -5
- package/umd/sanityClient.min.js +3 -3
- package/dist/_chunks/resolveEditInfo-BC6qdqZw.js.map +0 -1
- package/dist/_chunks/resolveEditInfo-CkO-V0Hb.cjs.map +0 -1
- package/dist/_chunks/stegaEncodeSourceMap-D3O62d5b.js.map +0 -1
- package/dist/_chunks/stegaEncodeSourceMap-DYge0fQ_.cjs.map +0 -1
- package/dist/_chunks/stegaEncodeSourceMap-Do2NcGKy.js.map +0 -1
- package/dist/_chunks/stegaEncodeSourceMap-VuriKnxL.cjs.map +0 -1
package/umd/sanityClient.min.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).SanityClient={})}(this,(function(e){"use strict";const t={timeout:"undefined"!=typeof navigator&&"ReactNative"===navigator.product?6e4:12e4},n=function(e){const n={...t,..."string"==typeof e?{url:e}:e},{searchParams:o}=new URL(n.url,"http://localhost");if(n.timeout=r(n.timeout),n.query)for(const[e,t]of Object.entries(n.query))if(void 0!==t)if(Array.isArray(t))for(const n of t)o.append(e,n);else o.append(e,t);const[i]=n.url.split("?"),s=o.toString();return s&&(n.url="".concat(i,"?").concat(s)),n.method=n.body&&!n.method?"POST":(n.method||"GET").toUpperCase(),n};function r(e){if(!1===e||0===e)return!1;if(e.connect||e.socket)return e;const n=Number(e);return isNaN(n)?r(t.timeout):{connect:n,socket:n}}const o=/^https?:\/\//i,i=function(e){if(!o.test(e.url))throw new Error('"'.concat(e.url,'" is not a valid URL'))};var s="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function a(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var c=function(e){return e.replace(/^\s+|\s+$/g,"")},u=a((function(e){if(!e)return{};for(var t,n={},r=c(e).split("\n"),o=0;o<r.length;o++){var i=r[o],s=i.indexOf(":"),a=c(i.slice(0,s)).toLowerCase(),u=c(i.slice(s+1));void 0===n[a]?n[a]=u:(t=n[a],"[object Array]"===Object.prototype.toString.call(t)?n[a].push(u):n[a]=[n[a],u])}return n}));const l=["request","response","progress","error","abort"],d=["processOptions","validateOptions","interceptRequest","finalizeOptions","onRequest","onResponse","onError","onReturn","onHeaders"];function f(e,t){const r=[],o=d.reduce(((e,t)=>(e[t]=e[t]||[],e)),{processOptions:[n],validateOptions:[i]});function s(e){const n=l.reduce(((e,t)=>(e[t]=function(){const e=Object.create(null);let t=0;return{publish:function(t){for(const n in e)e[n](t)},subscribe:function(n){const r=t++;return e[r]=n,function(){delete e[r]}}}}(),e)),{}),r=(e=>function(t,n,...r){const o="onError"===t;let i=n;for(let n=0;n<e[t].length&&(i=(0,e[t][n])(i,...r),!o||i);n++);return i})(o),i=r("processOptions",e);r("validateOptions",i);const s={options:i,channels:n,applyMiddleware:r};let a;const c=n.request.subscribe((e=>{a=t(e,((t,o)=>((e,t,o)=>{let i=e,s=t;if(!i)try{s=r("onResponse",t,o)}catch(e){s=null,i=e}i=i&&r("onError",i,o),i?n.error.publish(i):s&&n.response.publish(s)})(t,o,e)))}));n.abort.subscribe((()=>{c(),a&&a.abort()}));const u=r("onReturn",n,s);return u===n&&n.request.publish(s),u}return s.use=function(e){if(!e)throw new Error("Tried to add middleware that resolved to falsey value");if("function"==typeof e)throw new Error("Tried to add middleware that was a function. It probably expects you to pass options to it.");if(e.onReturn&&o.onReturn.length>0)throw new Error("Tried to add new middleware with `onReturn` handler, but another handler has already been registered for this event");return d.forEach((t=>{e[t]&&o[t].push(e[t])})),r.push(e),s},s.clone=()=>f(r,t),e.forEach(s.use),s}var h,p,y,g,m,v,b,w=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)},C=(e,t,n)=>(w(e,t,"read from private field"),n?n.call(e):t.get(e)),E=(e,t,n)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,n)},x=(e,t,n,r)=>(w(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n);class S{constructor(){this.readyState=0,this.responseType="",E(this,h,void 0),E(this,p,void 0),E(this,y,void 0),E(this,g,{}),E(this,m,void 0),E(this,v,{}),E(this,b,void 0)}open(e,t,n){x(this,h,e),x(this,p,t),x(this,y,""),this.readyState=1,this.onreadystatechange(),x(this,m,void 0)}abort(){C(this,m)&&C(this,m).abort()}getAllResponseHeaders(){return C(this,y)}setRequestHeader(e,t){C(this,g)[e]=t}setInit(e,t=!0){x(this,v,e),x(this,b,t)}send(e){const t="arraybuffer"!==this.responseType,n={...C(this,v),method:C(this,h),headers:C(this,g),body:e};"function"==typeof AbortController&&C(this,b)&&(x(this,m,new AbortController),"undefined"!=typeof EventTarget&&C(this,m).signal instanceof EventTarget&&(n.signal=C(this,m).signal)),"undefined"!=typeof document&&(n.credentials=this.withCredentials?"include":"omit"),fetch(C(this,p),n).then((e=>(e.headers.forEach(((e,t)=>{x(this,y,C(this,y)+"".concat(t,": ").concat(e,"\r\n"))})),this.status=e.status,this.statusText=e.statusText,this.readyState=3,t?e.text():e.arrayBuffer()))).then((e=>{"string"==typeof e?this.responseText=e:this.response=e,this.readyState=4,this.onreadystatechange()})).catch((e=>{var t;"AbortError"!==e.name?null==(t=this.onerror)||t.call(this,e):this.onabort()}))}}h=new WeakMap,p=new WeakMap,y=new WeakMap,g=new WeakMap,m=new WeakMap,v=new WeakMap,b=new WeakMap;const T="function"==typeof XMLHttpRequest?"xhr":"fetch",_="xhr"===T?XMLHttpRequest:S,O=(e,t)=>{var n;const r=e.options,o=e.applyMiddleware("finalizeOptions",r),i={},s=e.applyMiddleware("interceptRequest",void 0,{adapter:T,context:e});if(s){const e=setTimeout(t,0,null,s);return{abort:()=>clearTimeout(e)}}let a=new _;a instanceof S&&"object"==typeof o.fetch&&a.setInit(o.fetch,null==(n=o.useAbortSignal)||n);const c=o.headers,l=o.timeout;let d=!1,f=!1,h=!1;if(a.onerror=e=>{g(new Error("Request error while attempting to reach ".concat(o.url).concat(e.lengthComputable?"(".concat(e.loaded," of ").concat(e.total," bytes transferred)"):"")))},a.ontimeout=e=>{g(new Error("Request timeout while attempting to reach ".concat(o.url).concat(e.lengthComputable?"(".concat(e.loaded," of ").concat(e.total," bytes transferred)"):"")))},a.onabort=()=>{y(!0),d=!0},a.onreadystatechange=()=>{!function(){if(!l)return;y(),i.socket=setTimeout((()=>p("ESOCKETTIMEDOUT")),l.socket)}(),d||4!==a.readyState||0!==a.status&&function(){if(d||f||h)return;if(0===a.status)return void g(new Error("Unknown XHR error"));y(),f=!0,t(null,{body:a.response||(""===a.responseType||"text"===a.responseType?a.responseText:""),url:o.url,method:o.method,headers:u(a.getAllResponseHeaders()),statusCode:a.status,statusMessage:a.statusText})}()},a.open(o.method,o.url,!0),a.withCredentials=!!o.withCredentials,c&&a.setRequestHeader)for(const e in c)c.hasOwnProperty(e)&&a.setRequestHeader(e,c[e]);return o.rawBody&&(a.responseType="arraybuffer"),e.applyMiddleware("onRequest",{options:o,adapter:T,request:a,context:e}),a.send(o.body||null),l&&(i.connect=setTimeout((()=>p("ETIMEDOUT")),l.connect)),{abort:function(){d=!0,a&&a.abort()}};function p(t){h=!0,a.abort();const n=new Error("ESOCKETTIMEDOUT"===t?"Socket timed out on request to ".concat(o.url):"Connection timed out on request to ".concat(o.url));n.code=t,e.channels.error.publish(n)}function y(e){(e||d||a.readyState>=2&&i.connect)&&clearTimeout(i.connect),i.socket&&clearTimeout(i.socket)}function g(e){if(f)return;y(!0),f=!0,a=null;const n=e||new Error("Network error while attempting to reach ".concat(o.url));n.isNetworkError=!0,n.request=o,t(n)}},j=(e=[],t=O)=>f(e,t);var k,A,I={exports:{}};function P(){if(A)return k;A=1;var e=1e3,t=60*e,n=60*t,r=24*n,o=7*r,i=365.25*r;function s(e,t,n,r){var o=t>=1.5*n;return Math.round(e/n)+" "+r+(o?"s":"")}return k=function(a,c){c=c||{};var u=typeof a;if("string"===u&&a.length>0)return function(s){if((s=String(s)).length>100)return;var a=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(s);if(!a)return;var c=parseFloat(a[1]);switch((a[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return c*i;case"weeks":case"week":case"w":return c*o;case"days":case"day":case"d":return c*r;case"hours":case"hour":case"hrs":case"hr":case"h":return c*n;case"minutes":case"minute":case"mins":case"min":case"m":return c*t;case"seconds":case"second":case"secs":case"sec":case"s":return c*e;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return c;default:return}}(a);if("number"===u&&isFinite(a))return c.long?function(o){var i=Math.abs(o);if(i>=r)return s(o,i,r,"day");if(i>=n)return s(o,i,n,"hour");if(i>=t)return s(o,i,t,"minute");if(i>=e)return s(o,i,e,"second");return o+" ms"}(a):function(o){var i=Math.abs(o);if(i>=r)return Math.round(o/r)+"d";if(i>=n)return Math.round(o/n)+"h";if(i>=t)return Math.round(o/t)+"m";if(i>=e)return Math.round(o/e)+"s";return o+"ms"}(a);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(a))}}var R=function(e){function t(e){let r,o,i,s=null;function a(...e){if(!a.enabled)return;const n=a,o=Number(new Date),i=o-(r||o);n.diff=i,n.prev=r,n.curr=o,r=o,e[0]=t.coerce(e[0]),"string"!=typeof e[0]&&e.unshift("%O");let s=0;e[0]=e[0].replace(/%([a-zA-Z%])/g,((r,o)=>{if("%%"===r)return"%";s++;const i=t.formatters[o];if("function"==typeof i){const t=e[s];r=i.call(n,t),e.splice(s,1),s--}return r})),t.formatArgs.call(n,e);(n.log||t.log).apply(n,e)}return a.namespace=e,a.useColors=t.useColors(),a.color=t.selectColor(e),a.extend=n,a.destroy=t.destroy,Object.defineProperty(a,"enabled",{enumerable:!0,configurable:!1,get:()=>null!==s?s:(o!==t.namespaces&&(o=t.namespaces,i=t.enabled(e)),i),set:e=>{s=e}}),"function"==typeof t.init&&t.init(a),a}function n(e,n){const r=t(this.namespace+(void 0===n?":":n)+e);return r.log=this.log,r}function r(e){return e.toString().substring(2,e.toString().length-2).replace(/\.\*\?$/,"*")}return t.debug=t,t.default=t,t.coerce=function(e){if(e instanceof Error)return e.stack||e.message;return e},t.disable=function(){const e=[...t.names.map(r),...t.skips.map(r).map((e=>"-"+e))].join(",");return t.enable(""),e},t.enable=function(e){let n;t.save(e),t.namespaces=e,t.names=[],t.skips=[];const r=("string"==typeof e?e:"").split(/[\s,]+/),o=r.length;for(n=0;n<o;n++)r[n]&&("-"===(e=r[n].replace(/\*/g,".*?"))[0]?t.skips.push(new RegExp("^"+e.slice(1)+"$")):t.names.push(new RegExp("^"+e+"$")))},t.enabled=function(e){if("*"===e[e.length-1])return!0;let n,r;for(n=0,r=t.skips.length;n<r;n++)if(t.skips[n].test(e))return!1;for(n=0,r=t.names.length;n<r;n++)if(t.names[n].test(e))return!0;return!1},t.humanize=P(),t.destroy=function(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")},Object.keys(e).forEach((n=>{t[n]=e[n]})),t.names=[],t.skips=[],t.formatters={},t.selectColor=function(e){let n=0;for(let t=0;t<e.length;t++)n=(n<<5)-n+e.charCodeAt(t),n|=0;return t.colors[Math.abs(n)%t.colors.length]},t.enable(t.load()),t};
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).SanityClient={})}(this,(function(e){"use strict";const t={timeout:"undefined"!=typeof navigator&&"ReactNative"===navigator.product?6e4:12e4},r=function(e){const r={...t,..."string"==typeof e?{url:e}:e},{searchParams:o}=new URL(r.url,"http://localhost");if(r.timeout=n(r.timeout),r.query)for(const[e,t]of Object.entries(r.query))if(void 0!==t)if(Array.isArray(t))for(const r of t)o.append(e,r);else o.append(e,t);const[i]=r.url.split("?"),s=o.toString();return s&&(r.url="".concat(i,"?").concat(s)),r.method=r.body&&!r.method?"POST":(r.method||"GET").toUpperCase(),r};function n(e){if(!1===e||0===e)return!1;if(e.connect||e.socket)return e;const r=Number(e);return isNaN(r)?n(t.timeout):{connect:r,socket:r}}const o=/^https?:\/\//i,i=function(e){if(!o.test(e.url))throw new Error('"'.concat(e.url,'" is not a valid URL'))};var s="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function a(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var c=function(e){return e.replace(/^\s+|\s+$/g,"")},u=a((function(e){if(!e)return{};for(var t,r={},n=c(e).split("\n"),o=0;o<n.length;o++){var i=n[o],s=i.indexOf(":"),a=c(i.slice(0,s)).toLowerCase(),u=c(i.slice(s+1));void 0===r[a]?r[a]=u:(t=r[a],"[object Array]"===Object.prototype.toString.call(t)?r[a].push(u):r[a]=[r[a],u])}return r}));const l=["request","response","progress","error","abort"],d=["processOptions","validateOptions","interceptRequest","finalizeOptions","onRequest","onResponse","onError","onReturn","onHeaders"];function f(e,t){const n=[],o=d.reduce(((e,t)=>(e[t]=e[t]||[],e)),{processOptions:[r],validateOptions:[i]});function s(e){const r=l.reduce(((e,t)=>(e[t]=function(){const e=Object.create(null);let t=0;return{publish:function(t){for(const r in e)e[r](t)},subscribe:function(r){const n=t++;return e[n]=r,function(){delete e[n]}}}}(),e)),{}),n=(e=>function(t,r,...n){const o="onError"===t;let i=r;for(let r=0;r<e[t].length&&(i=(0,e[t][r])(i,...n),!o||i);r++);return i})(o),i=n("processOptions",e);n("validateOptions",i);const s={options:i,channels:r,applyMiddleware:n};let a;const c=r.request.subscribe((e=>{a=t(e,((t,o)=>((e,t,o)=>{let i=e,s=t;if(!i)try{s=n("onResponse",t,o)}catch(e){s=null,i=e}i=i&&n("onError",i,o),i?r.error.publish(i):s&&r.response.publish(s)})(t,o,e)))}));r.abort.subscribe((()=>{c(),a&&a.abort()}));const u=n("onReturn",r,s);return u===r&&r.request.publish(s),u}return s.use=function(e){if(!e)throw new Error("Tried to add middleware that resolved to falsey value");if("function"==typeof e)throw new Error("Tried to add middleware that was a function. It probably expects you to pass options to it.");if(e.onReturn&&o.onReturn.length>0)throw new Error("Tried to add new middleware with `onReturn` handler, but another handler has already been registered for this event");return d.forEach((t=>{e[t]&&o[t].push(e[t])})),n.push(e),s},s.clone=()=>f(n,t),e.forEach(s.use),s}var h,p,y,g,m,v,b,w=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)},C=(e,t,r)=>(w(e,t,"read from private field"),r?r.call(e):t.get(e)),E=(e,t,r)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,r)},x=(e,t,r,n)=>(w(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r);class S{constructor(){this.readyState=0,this.responseType="",E(this,h,void 0),E(this,p,void 0),E(this,y,void 0),E(this,g,{}),E(this,m,void 0),E(this,v,{}),E(this,b,void 0)}open(e,t,r){x(this,h,e),x(this,p,t),x(this,y,""),this.readyState=1,this.onreadystatechange(),x(this,m,void 0)}abort(){C(this,m)&&C(this,m).abort()}getAllResponseHeaders(){return C(this,y)}setRequestHeader(e,t){C(this,g)[e]=t}setInit(e,t=!0){x(this,v,e),x(this,b,t)}send(e){const t="arraybuffer"!==this.responseType,r={...C(this,v),method:C(this,h),headers:C(this,g),body:e};"function"==typeof AbortController&&C(this,b)&&(x(this,m,new AbortController),"undefined"!=typeof EventTarget&&C(this,m).signal instanceof EventTarget&&(r.signal=C(this,m).signal)),"undefined"!=typeof document&&(r.credentials=this.withCredentials?"include":"omit"),fetch(C(this,p),r).then((e=>(e.headers.forEach(((e,t)=>{x(this,y,C(this,y)+"".concat(t,": ").concat(e,"\r\n"))})),this.status=e.status,this.statusText=e.statusText,this.readyState=3,t?e.text():e.arrayBuffer()))).then((e=>{"string"==typeof e?this.responseText=e:this.response=e,this.readyState=4,this.onreadystatechange()})).catch((e=>{var t;"AbortError"!==e.name?null==(t=this.onerror)||t.call(this,e):this.onabort()}))}}h=new WeakMap,p=new WeakMap,y=new WeakMap,g=new WeakMap,m=new WeakMap,v=new WeakMap,b=new WeakMap;const T="function"==typeof XMLHttpRequest?"xhr":"fetch",_="xhr"===T?XMLHttpRequest:S,O=(e,t)=>{var r;const n=e.options,o=e.applyMiddleware("finalizeOptions",n),i={},s=e.applyMiddleware("interceptRequest",void 0,{adapter:T,context:e});if(s){const e=setTimeout(t,0,null,s);return{abort:()=>clearTimeout(e)}}let a=new _;a instanceof S&&"object"==typeof o.fetch&&a.setInit(o.fetch,null==(r=o.useAbortSignal)||r);const c=o.headers,l=o.timeout;let d=!1,f=!1,h=!1;if(a.onerror=e=>{g(new Error("Request error while attempting to reach ".concat(o.url).concat(e.lengthComputable?"(".concat(e.loaded," of ").concat(e.total," bytes transferred)"):"")))},a.ontimeout=e=>{g(new Error("Request timeout while attempting to reach ".concat(o.url).concat(e.lengthComputable?"(".concat(e.loaded," of ").concat(e.total," bytes transferred)"):"")))},a.onabort=()=>{y(!0),d=!0},a.onreadystatechange=()=>{!function(){if(!l)return;y(),i.socket=setTimeout((()=>p("ESOCKETTIMEDOUT")),l.socket)}(),d||4!==a.readyState||0!==a.status&&function(){if(d||f||h)return;if(0===a.status)return void g(new Error("Unknown XHR error"));y(),f=!0,t(null,{body:a.response||(""===a.responseType||"text"===a.responseType?a.responseText:""),url:o.url,method:o.method,headers:u(a.getAllResponseHeaders()),statusCode:a.status,statusMessage:a.statusText})}()},a.open(o.method,o.url,!0),a.withCredentials=!!o.withCredentials,c&&a.setRequestHeader)for(const e in c)c.hasOwnProperty(e)&&a.setRequestHeader(e,c[e]);return o.rawBody&&(a.responseType="arraybuffer"),e.applyMiddleware("onRequest",{options:o,adapter:T,request:a,context:e}),a.send(o.body||null),l&&(i.connect=setTimeout((()=>p("ETIMEDOUT")),l.connect)),{abort:function(){d=!0,a&&a.abort()}};function p(t){h=!0,a.abort();const r=new Error("ESOCKETTIMEDOUT"===t?"Socket timed out on request to ".concat(o.url):"Connection timed out on request to ".concat(o.url));r.code=t,e.channels.error.publish(r)}function y(e){(e||d||a.readyState>=2&&i.connect)&&clearTimeout(i.connect),i.socket&&clearTimeout(i.socket)}function g(e){if(f)return;y(!0),f=!0,a=null;const r=e||new Error("Network error while attempting to reach ".concat(o.url));r.isNetworkError=!0,r.request=o,t(r)}},j=(e=[],t=O)=>f(e,t);var k,A,I={exports:{}};function P(){if(A)return k;A=1;var e=1e3,t=60*e,r=60*t,n=24*r,o=7*n,i=365.25*n;function s(e,t,r,n){var o=t>=1.5*r;return Math.round(e/r)+" "+n+(o?"s":"")}return k=function(a,c){c=c||{};var u=typeof a;if("string"===u&&a.length>0)return function(s){if((s=String(s)).length>100)return;var a=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(s);if(!a)return;var c=parseFloat(a[1]);switch((a[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return c*i;case"weeks":case"week":case"w":return c*o;case"days":case"day":case"d":return c*n;case"hours":case"hour":case"hrs":case"hr":case"h":return c*r;case"minutes":case"minute":case"mins":case"min":case"m":return c*t;case"seconds":case"second":case"secs":case"sec":case"s":return c*e;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return c;default:return}}(a);if("number"===u&&isFinite(a))return c.long?function(o){var i=Math.abs(o);if(i>=n)return s(o,i,n,"day");if(i>=r)return s(o,i,r,"hour");if(i>=t)return s(o,i,t,"minute");if(i>=e)return s(o,i,e,"second");return o+" ms"}(a):function(o){var i=Math.abs(o);if(i>=n)return Math.round(o/n)+"d";if(i>=r)return Math.round(o/r)+"h";if(i>=t)return Math.round(o/t)+"m";if(i>=e)return Math.round(o/e)+"s";return o+"ms"}(a);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(a))}}var R=function(e){function t(e){let n,o,i,s=null;function a(...e){if(!a.enabled)return;const r=a,o=Number(new Date),i=o-(n||o);r.diff=i,r.prev=n,r.curr=o,n=o,e[0]=t.coerce(e[0]),"string"!=typeof e[0]&&e.unshift("%O");let s=0;e[0]=e[0].replace(/%([a-zA-Z%])/g,((n,o)=>{if("%%"===n)return"%";s++;const i=t.formatters[o];if("function"==typeof i){const t=e[s];n=i.call(r,t),e.splice(s,1),s--}return n})),t.formatArgs.call(r,e);(r.log||t.log).apply(r,e)}return a.namespace=e,a.useColors=t.useColors(),a.color=t.selectColor(e),a.extend=r,a.destroy=t.destroy,Object.defineProperty(a,"enabled",{enumerable:!0,configurable:!1,get:()=>null!==s?s:(o!==t.namespaces&&(o=t.namespaces,i=t.enabled(e)),i),set:e=>{s=e}}),"function"==typeof t.init&&t.init(a),a}function r(e,r){const n=t(this.namespace+(void 0===r?":":r)+e);return n.log=this.log,n}function n(e){return e.toString().substring(2,e.toString().length-2).replace(/\.\*\?$/,"*")}return t.debug=t,t.default=t,t.coerce=function(e){if(e instanceof Error)return e.stack||e.message;return e},t.disable=function(){const e=[...t.names.map(n),...t.skips.map(n).map((e=>"-"+e))].join(",");return t.enable(""),e},t.enable=function(e){let r;t.save(e),t.namespaces=e,t.names=[],t.skips=[];const n=("string"==typeof e?e:"").split(/[\s,]+/),o=n.length;for(r=0;r<o;r++)n[r]&&("-"===(e=n[r].replace(/\*/g,".*?"))[0]?t.skips.push(new RegExp("^"+e.slice(1)+"$")):t.names.push(new RegExp("^"+e+"$")))},t.enabled=function(e){if("*"===e[e.length-1])return!0;let r,n;for(r=0,n=t.skips.length;r<n;r++)if(t.skips[r].test(e))return!1;for(r=0,n=t.names.length;r<n;r++)if(t.names[r].test(e))return!0;return!1},t.humanize=P(),t.destroy=function(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")},Object.keys(e).forEach((r=>{t[r]=e[r]})),t.names=[],t.skips=[],t.formatters={},t.selectColor=function(e){let r=0;for(let t=0;t<e.length;t++)r=(r<<5)-r+e.charCodeAt(t),r|=0;return t.colors[Math.abs(r)%t.colors.length]},t.enable(t.load()),t};
|
|
2
2
|
/*!
|
|
3
3
|
* is-plain-object <https://github.com/jonschlinkert/is-plain-object>
|
|
4
4
|
*
|
|
5
5
|
* Copyright (c) 2014-2017, Jon Schlinkert.
|
|
6
6
|
* Released under the MIT License.
|
|
7
7
|
*/
|
|
8
|
-
function M(e){return"[object Object]"===Object.prototype.toString.call(e)}!function(e,t){t.formatArgs=function(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+e.exports.humanize(this.diff),!this.useColors)return;const n="color: "+this.color;t.splice(1,0,n,"color: inherit");let r=0,o=0;t[0].replace(/%[a-zA-Z%]/g,(e=>{"%%"!==e&&(r++,"%c"===e&&(o=r))})),t.splice(o,0,n)},t.save=function(e){try{e?t.storage.setItem("debug",e):t.storage.removeItem("debug")}catch(e){}},t.load=function(){let e;try{e=t.storage.getItem("debug")}catch(e){}!e&&"undefined"!=typeof process&&"env"in process&&(e=process.env.DEBUG);return e},t.useColors=function(){if("undefined"!=typeof window&&window.process&&("renderer"===window.process.type||window.process.__nwjs))return!0;if("undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;return"undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)},t.storage=function(){try{return localStorage}catch(e){}}(),t.destroy=(()=>{let e=!1;return()=>{e||(e=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],t.log=console.debug||console.log||(()=>{}),e.exports=R(t);const{formatters:n}=e.exports;n.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}}(I,I.exports);const D="undefined"==typeof Buffer?()=>!1:e=>Buffer.isBuffer(e),F=["boolean","string","number"];function q(){return{processOptions:e=>{const t=e.body;if(!t)return e;var n,r,o;return!("function"==typeof t.pipe)&&!D(t)&&(-1!==F.indexOf(typeof t)||Array.isArray(t)||!1!==M(n=t)&&(void 0===(r=n.constructor)||!1!==M(o=r.prototype)&&!1!==o.hasOwnProperty("isPrototypeOf")))?Object.assign({},e,{body:JSON.stringify(e.body),headers:Object.assign({},e.headers,{"Content-Type":"application/json"})}):e}}}function N(e){return{onResponse:n=>{const r=n.headers["content-type"]||"",o=e&&e.force||-1!==r.indexOf("application/json");return n.body&&r&&o?Object.assign({},n,{body:t(n.body)}):n},processOptions:e=>Object.assign({},e,{headers:Object.assign({Accept:"application/json"},e.headers)})};function t(e){try{return JSON.parse(e)}catch(e){throw e.message="Failed to parsed response body as JSON: ".concat(e.message),e}}}let U={};"undefined"!=typeof globalThis?U=globalThis:"undefined"!=typeof window?U=window:"undefined"!=typeof global?U=global:"undefined"!=typeof self&&(U=self);var W=U;function H(e={}){const t=e.implementation||W.Observable;if(!t)throw new Error("`Observable` is not available in global scope, and no implementation was passed");return{onReturn:(e,n)=>new t((t=>(e.error.subscribe((e=>t.error(e))),e.progress.subscribe((e=>t.next(Object.assign({type:"progress"},e)))),e.response.subscribe((e=>{t.next(Object.assign({type:"response"},e)),t.complete()})),e.request.publish(n),()=>e.abort.publish())))}}class z{constructor(e){this.__CANCEL__=!0,this.message=e}toString(){return"Cancel".concat(this.message?": ".concat(this.message):"")}}const L=class{constructor(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");let t=null;this.promise=new Promise((e=>{t=e})),e((e=>{this.reason||(this.reason=new z(e),t(this.reason))}))}};L.source=()=>{let e;return{token:new L((t=>{e=t})),cancel:e}};var $=(e,t,n)=>("GET"===n.method||"HEAD"===n.method)&&(e.isNetworkError||!1);function B(e){return 100*Math.pow(2,e)+100*Math.random()}const J=(e={})=>(e=>{const t=e.maxRetries||5,n=e.retryDelay||B,r=e.shouldRetry;return{onError:(e,o)=>{const i=o.options,s=i.maxRetries||t,a=i.shouldRetry||r,c=i.attemptNumber||0;if(null!==(u=i.body)&&"object"==typeof u&&"function"==typeof u.pipe)return e;var u;if(!a(e,c,i)||c>=s)return e;const l=Object.assign({},o,{options:Object.assign({},i,{attemptNumber:c+1})});return setTimeout((()=>o.channels.request.publish(l)),n(c)),null}}})({shouldRetry:$,...e});J.shouldRetry=$;var G=function(e,t){return G=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},G(e,t)};function V(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}G(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}function Q(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))}function Y(e,t){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(a){return function(c){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,a[0]&&(s=0)),s;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,r=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){s.label=a[1];break}if(6===a[0]&&s.label<o[1]){s.label=o[1],o=a;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(a);break}o[2]&&s.ops.pop(),s.trys.pop();continue}a=t.call(e,s)}catch(e){a=[6,e],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,c])}}}function X(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function K(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)s.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return s}function Z(e,t,n){if(n||2===arguments.length)for(var r,o=0,i=t.length;o<i;o++)!r&&o in t||(r||(r=Array.prototype.slice.call(t,0,o)),r[o]=t[o]);return e.concat(r||Array.prototype.slice.call(t))}function ee(e){return this instanceof ee?(this.v=e,this):new ee(e)}function te(e,t,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r,o=n.apply(e,t||[]),i=[];return r={},s("next"),s("throw"),s("return"),r[Symbol.asyncIterator]=function(){return this},r;function s(e){o[e]&&(r[e]=function(t){return new Promise((function(n,r){i.push([e,t,n,r])>1||a(e,t)}))})}function a(e,t){try{(n=o[e](t)).value instanceof ee?Promise.resolve(n.value.v).then(c,u):l(i[0][2],n)}catch(e){l(i[0][3],e)}var n}function c(e){a("next",e)}function u(e){a("throw",e)}function l(e,t){e(t),i.shift(),i.length&&a(i[0][0],i[0][1])}}function ne(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,n=e[Symbol.asyncIterator];return n?n.call(e):(e=X(e),t={},r("next"),r("throw"),r("return"),t[Symbol.asyncIterator]=function(){return this},t);function r(n){t[n]=e[n]&&function(t){return new Promise((function(r,o){(function(e,t,n,r){Promise.resolve(r).then((function(t){e({value:t,done:n})}),t)})(r,o,(t=e[n](t)).done,t.value)}))}}}function re(e){return"function"==typeof e}function oe(e){var t=e((function(e){Error.call(e),e.stack=(new Error).stack}));return t.prototype=Object.create(Error.prototype),t.prototype.constructor=t,t}"function"==typeof SuppressedError&&SuppressedError;var ie=oe((function(e){return function(t){e(this),this.message=t?t.length+" errors occurred during unsubscription:\n"+t.map((function(e,t){return t+1+") "+e.toString()})).join("\n "):"",this.name="UnsubscriptionError",this.errors=t}}));function se(e,t){if(e){var n=e.indexOf(t);0<=n&&e.splice(n,1)}}var ae=function(){function e(e){this.initialTeardown=e,this.closed=!1,this._parentage=null,this._finalizers=null}var t;return e.prototype.unsubscribe=function(){var e,t,n,r,o;if(!this.closed){this.closed=!0;var i=this._parentage;if(i)if(this._parentage=null,Array.isArray(i))try{for(var s=X(i),a=s.next();!a.done;a=s.next()){a.value.remove(this)}}catch(t){e={error:t}}finally{try{a&&!a.done&&(t=s.return)&&t.call(s)}finally{if(e)throw e.error}}else i.remove(this);var c=this.initialTeardown;if(re(c))try{c()}catch(e){o=e instanceof ie?e.errors:[e]}var u=this._finalizers;if(u){this._finalizers=null;try{for(var l=X(u),d=l.next();!d.done;d=l.next()){var f=d.value;try{ue(f)}catch(e){o=null!=o?o:[],e instanceof ie?o=Z(Z([],K(o)),K(e.errors)):o.push(e)}}}catch(e){n={error:e}}finally{try{d&&!d.done&&(r=l.return)&&r.call(l)}finally{if(n)throw n.error}}}if(o)throw new ie(o)}},e.prototype.add=function(t){var n;if(t&&t!==this)if(this.closed)ue(t);else{if(t instanceof e){if(t.closed||t._hasParent(this))return;t._addParent(this)}(this._finalizers=null!==(n=this._finalizers)&&void 0!==n?n:[]).push(t)}},e.prototype._hasParent=function(e){var t=this._parentage;return t===e||Array.isArray(t)&&t.includes(e)},e.prototype._addParent=function(e){var t=this._parentage;this._parentage=Array.isArray(t)?(t.push(e),t):t?[t,e]:e},e.prototype._removeParent=function(e){var t=this._parentage;t===e?this._parentage=null:Array.isArray(t)&&se(t,e)},e.prototype.remove=function(t){var n=this._finalizers;n&&se(n,t),t instanceof e&&t._removeParent(this)},e.EMPTY=((t=new e).closed=!0,t),e}();function ce(e){return e instanceof ae||e&&"closed"in e&&re(e.remove)&&re(e.add)&&re(e.unsubscribe)}function ue(e){re(e)?e():e.unsubscribe()}ae.EMPTY;var le={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1},de={setTimeout:function(e,t){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];return setTimeout.apply(void 0,Z([e,t],K(n)))},clearTimeout:function(e){var t=de.delegate;return((null==t?void 0:t.clearTimeout)||clearTimeout)(e)},delegate:void 0};function fe(e){de.setTimeout((function(){throw e}))}function he(){}var pe=function(e){function t(t){var n=e.call(this)||this;return n.isStopped=!1,t?(n.destination=t,ce(t)&&t.add(n)):n.destination=we,n}return V(t,e),t.create=function(e,t,n){return new ve(e,t,n)},t.prototype.next=function(e){this.isStopped||this._next(e)},t.prototype.error=function(e){this.isStopped||(this.isStopped=!0,this._error(e))},t.prototype.complete=function(){this.isStopped||(this.isStopped=!0,this._complete())},t.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,e.prototype.unsubscribe.call(this),this.destination=null)},t.prototype._next=function(e){this.destination.next(e)},t.prototype._error=function(e){try{this.destination.error(e)}finally{this.unsubscribe()}},t.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},t}(ae),ye=Function.prototype.bind;function ge(e,t){return ye.call(e,t)}var me=function(){function e(e){this.partialObserver=e}return e.prototype.next=function(e){var t=this.partialObserver;if(t.next)try{t.next(e)}catch(e){be(e)}},e.prototype.error=function(e){var t=this.partialObserver;if(t.error)try{t.error(e)}catch(e){be(e)}else be(e)},e.prototype.complete=function(){var e=this.partialObserver;if(e.complete)try{e.complete()}catch(e){be(e)}},e}(),ve=function(e){function t(t,n,r){var o,i,s=e.call(this)||this;re(t)||!t?o={next:null!=t?t:void 0,error:null!=n?n:void 0,complete:null!=r?r:void 0}:s&&le.useDeprecatedNextContext?((i=Object.create(t)).unsubscribe=function(){return s.unsubscribe()},o={next:t.next&&ge(t.next,i),error:t.error&&ge(t.error,i),complete:t.complete&&ge(t.complete,i)}):o=t;return s.destination=new me(o),s}return V(t,e),t}(pe);function be(e){fe(e)}var we={closed:!0,next:he,error:function(e){throw e},complete:he},Ce="function"==typeof Symbol&&Symbol.observable||"@@observable";function Ee(e){return e}function xe(e){return 0===e.length?Ee:1===e.length?e[0]:function(t){return e.reduce((function(e,t){return t(e)}),t)}}var Se=function(){function e(e){e&&(this._subscribe=e)}return e.prototype.lift=function(t){var n=new e;return n.source=this,n.operator=t,n},e.prototype.subscribe=function(e,t,n){var r,o=this,i=(r=e)&&r instanceof pe||function(e){return e&&re(e.next)&&re(e.error)&&re(e.complete)}(r)&&ce(r)?e:new ve(e,t,n);return function(){var e=o,t=e.operator,n=e.source;i.add(t?t.call(i,n):n?o._subscribe(i):o._trySubscribe(i))}(),i},e.prototype._trySubscribe=function(e){try{return this._subscribe(e)}catch(t){e.error(t)}},e.prototype.forEach=function(e,t){var n=this;return new(t=Te(t))((function(t,r){var o=new ve({next:function(t){try{e(t)}catch(e){r(e),o.unsubscribe()}},error:r,complete:t});n.subscribe(o)}))},e.prototype._subscribe=function(e){var t;return null===(t=this.source)||void 0===t?void 0:t.subscribe(e)},e.prototype[Ce]=function(){return this},e.prototype.pipe=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return xe(e)(this)},e.prototype.toPromise=function(e){var t=this;return new(e=Te(e))((function(e,n){var r;t.subscribe((function(e){return r=e}),(function(e){return n(e)}),(function(){return e(r)}))}))},e.create=function(t){return new e(t)},e}();function Te(e){var t;return null!==(t=null!=e?e:le.Promise)&&void 0!==t?t:Promise}function _e(e){return function(t){if(function(e){return re(null==e?void 0:e.lift)}(t))return t.lift((function(t){try{return e(t,this)}catch(e){this.error(e)}}));throw new TypeError("Unable to lift unknown Observable type")}}function Oe(e,t,n,r,o){return new je(e,t,n,r,o)}var je=function(e){function t(t,n,r,o,i,s){var a=e.call(this,t)||this;return a.onFinalize=i,a.shouldUnsubscribe=s,a._next=n?function(e){try{n(e)}catch(e){t.error(e)}}:e.prototype._next,a._error=o?function(e){try{o(e)}catch(e){t.error(e)}finally{this.unsubscribe()}}:e.prototype._error,a._complete=r?function(){try{r()}catch(e){t.error(e)}finally{this.unsubscribe()}}:e.prototype._complete,a}return V(t,e),t.prototype.unsubscribe=function(){var t;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var n=this.closed;e.prototype.unsubscribe.call(this),!n&&(null===(t=this.onFinalize)||void 0===t||t.call(this))}},t}(pe);var ke=function(e){return e&&"number"==typeof e.length&&"function"!=typeof e};function Ae(e){return re(null==e?void 0:e.then)}function Ie(e){return re(e[Ce])}function Pe(e){return Symbol.asyncIterator&&re(null==e?void 0:e[Symbol.asyncIterator])}function Re(e){return new TypeError("You provided "+(null!==e&&"object"==typeof e?"an invalid object":"'"+e+"'")+" where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.")}var Me="function"==typeof Symbol&&Symbol.iterator?Symbol.iterator:"@@iterator";function De(e){return re(null==e?void 0:e[Me])}function Fe(e){return te(this,arguments,(function(){var t,n,r;return Y(this,(function(o){switch(o.label){case 0:t=e.getReader(),o.label=1;case 1:o.trys.push([1,,9,10]),o.label=2;case 2:return[4,ee(t.read())];case 3:return n=o.sent(),r=n.value,n.done?[4,ee(void 0)]:[3,5];case 4:return[2,o.sent()];case 5:return[4,ee(r)];case 6:return[4,o.sent()];case 7:return o.sent(),[3,2];case 8:return[3,10];case 9:return t.releaseLock(),[7];case 10:return[2]}}))}))}function qe(e){return re(null==e?void 0:e.getReader)}function Ne(e){if(e instanceof Se)return e;if(null!=e){if(Ie(e))return o=e,new Se((function(e){var t=o[Ce]();if(re(t.subscribe))return t.subscribe(e);throw new TypeError("Provided object does not correctly implement Symbol.observable")}));if(ke(e))return r=e,new Se((function(e){for(var t=0;t<r.length&&!e.closed;t++)e.next(r[t]);e.complete()}));if(Ae(e))return n=e,new Se((function(e){n.then((function(t){e.closed||(e.next(t),e.complete())}),(function(t){return e.error(t)})).then(null,fe)}));if(Pe(e))return Ue(e);if(De(e))return t=e,new Se((function(e){var n,r;try{for(var o=X(t),i=o.next();!i.done;i=o.next()){var s=i.value;if(e.next(s),e.closed)return}}catch(e){n={error:e}}finally{try{i&&!i.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}e.complete()}));if(qe(e))return Ue(Fe(e))}var t,n,r,o;throw Re(e)}function Ue(e){return new Se((function(t){(function(e,t){var n,r,o,i;return Q(this,void 0,void 0,(function(){var s,a;return Y(this,(function(c){switch(c.label){case 0:c.trys.push([0,5,6,11]),n=ne(e),c.label=1;case 1:return[4,n.next()];case 2:if((r=c.sent()).done)return[3,4];if(s=r.value,t.next(s),t.closed)return[2];c.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return a=c.sent(),o={error:a},[3,11];case 6:return c.trys.push([6,,9,10]),r&&!r.done&&(i=n.return)?[4,i.call(n)]:[3,8];case 7:c.sent(),c.label=8;case 8:return[3,10];case 9:if(o)throw o.error;return[7];case 10:return[7];case 11:return t.complete(),[2]}}))}))})(e,t).catch((function(e){return t.error(e)}))}))}function We(e,t,n,r,o){void 0===r&&(r=0),void 0===o&&(o=!1);var i=t.schedule((function(){n(),o?e.add(this.schedule(null,r)):this.unsubscribe()}),r);if(e.add(i),!o)return i}function He(e,t){return void 0===t&&(t=0),_e((function(n,r){n.subscribe(Oe(r,(function(n){return We(r,e,(function(){return r.next(n)}),t)}),(function(){return We(r,e,(function(){return r.complete()}),t)}),(function(n){return We(r,e,(function(){return r.error(n)}),t)})))}))}function ze(e,t){return void 0===t&&(t=0),_e((function(n,r){r.add(e.schedule((function(){return n.subscribe(r)}),t))}))}function Le(e,t){if(!e)throw new Error("Iterable cannot be null");return new Se((function(n){We(n,t,(function(){var r=e[Symbol.asyncIterator]();We(n,t,(function(){r.next().then((function(e){e.done?n.complete():n.next(e.value)}))}),0,!0)}))}))}function $e(e,t){if(null!=e){if(Ie(e))return function(e,t){return Ne(e).pipe(ze(t),He(t))}(e,t);if(ke(e))return function(e,t){return new Se((function(n){var r=0;return t.schedule((function(){r===e.length?n.complete():(n.next(e[r++]),n.closed||this.schedule())}))}))}(e,t);if(Ae(e))return function(e,t){return Ne(e).pipe(ze(t),He(t))}(e,t);if(Pe(e))return Le(e,t);if(De(e))return function(e,t){return new Se((function(n){var r;return We(n,t,(function(){r=e[Me](),We(n,t,(function(){var e,t,o;try{t=(e=r.next()).value,o=e.done}catch(e){return void n.error(e)}o?n.complete():n.next(t)}),0,!0)})),function(){return re(null==r?void 0:r.return)&&r.return()}}))}(e,t);if(qe(e))return function(e,t){return Le(Fe(e),t)}(e,t)}throw Re(e)}function Be(e,t){return t?$e(e,t):Ne(e)}var Je=oe((function(e){return function(){e(this),this.name="EmptyError",this.message="no elements in sequence"}}));function Ge(e,t){var n="object"==typeof t;return new Promise((function(r,o){var i,s=!1;e.subscribe({next:function(e){i=e,s=!0},error:o,complete:function(){s?r(i):n?r(t.defaultValue):o(new Je)}})}))}function Ve(e,t){return _e((function(n,r){var o=0;n.subscribe(Oe(r,(function(n){r.next(e.call(t,n,o++))})))}))}var Qe=Array.isArray;function Ye(e){return Ve((function(t){return function(e,t){return Qe(t)?e.apply(void 0,Z([],K(t))):e(t)}(e,t)}))}function Xe(e,t,n){e?We(n,e,t):t()}var Ke=Array.isArray;function Ze(e,t){return _e((function(n,r){var o=0;n.subscribe(Oe(r,(function(n){return e.call(t,n,o++)&&r.next(n)})))}))}function et(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=function(e){return re((t=e)[t.length-1])?e.pop():void 0;var t}(e);return n?function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return xe(e)}(et.apply(void 0,Z([],K(e))),Ye(n)):_e((function(t,n){var r,o,i;(r=Z([t],K(function(e){return 1===e.length&&Ke(e[0])?e[0]:e}(e))),void 0===i&&(i=Ee),function(e){Xe(o,(function(){for(var t=r.length,n=new Array(t),s=t,a=t,c=function(t){Xe(o,(function(){var c=Be(r[t],o),u=!1;c.subscribe(Oe(e,(function(r){n[t]=r,u||(u=!0,a--),a||e.next(i(n.slice()))}),(function(){--s||e.complete()})))}),e)},u=0;u<t;u++)c(u)}),e)})(n)}))}class tt extends Error{constructor(e){const t=rt(e);super(t.message),this.statusCode=400,Object.assign(this,t)}}class nt extends Error{constructor(e){const t=rt(e);super(t.message),this.statusCode=500,Object.assign(this,t)}}function rt(e){const t=e.body,n={response:e,statusCode:e.statusCode,responseBody:it(t,e),message:"",details:void 0};if(t.error&&t.message)return n.message="".concat(t.error," - ").concat(t.message),n;if(function(e){return ot(e)&&ot(e.error)&&"mutationError"===e.error.type&&"string"==typeof e.error.description}(t)){const e=t.error.items||[],r=e.slice(0,5).map((e=>{var t;return null==(t=e.error)?void 0:t.description})).filter(Boolean);let o=r.length?":\n- ".concat(r.join("\n- ")):"";return e.length>5&&(o+="\n...and ".concat(e.length-5," more")),n.message="".concat(t.error.description).concat(o),n.details=t.error,n}return t.error&&t.error.description?(n.message=t.error.description,n.details=t.error,n):(n.message=t.error||t.message||function(e){const t=e.statusMessage?" ".concat(e.statusMessage):"";return"".concat(e.method,"-request to ").concat(e.url," resulted in HTTP ").concat(e.statusCode).concat(t)}(e),n)}function ot(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}function it(e,t){return-1!==(t.headers["content-type"]||"").toLowerCase().indexOf("application/json")?JSON.stringify(e,null,2):e}const st={onResponse:e=>{if(e.statusCode>=500)throw new nt(e);if(e.statusCode>=400)throw new tt(e);return e}},at={onResponse:e=>{const t=e.headers["x-sanity-warning"];return(Array.isArray(t)?t:[t]).filter(Boolean).forEach((e=>console.warn(e))),e}};function ct(e,{maxRetries:t=5,retryDelay:n}){const r=j([t>0?J({retryDelay:n,maxRetries:t,shouldRetry:ut}):{},...e,at,q(),N(),{onRequest:e=>{if("xhr"!==e.adapter)return;const t=e.request,n=e.context;function r(e){return t=>{const r=t.lengthComputable?t.loaded/t.total*100:-1;n.channels.progress.publish({stage:e,percent:r,total:t.total,loaded:t.loaded,lengthComputable:t.lengthComputable})}}"upload"in t&&"onprogress"in t.upload&&(t.upload.onprogress=r("upload")),"onprogress"in t&&(t.onprogress=r("download"))}},st,H({implementation:Se})]);function o(e,t=r){return t({maxRedirects:0,...e})}return o.defaultRequester=r,o}function ut(e,t,n){const r="GET"===n.method||"HEAD"===n.method,o=(n.uri||n.url).startsWith("/data/query"),i=e.response&&(429===e.response.statusCode||502===e.response.statusCode||503===e.response.statusCode);return!(!r&&!o||!i)||J.shouldRetry(e,t,n)}function lt(e){if("string"==typeof e)return{id:e};if(Array.isArray(e))return{query:"*[_id in $ids]",params:{ids:e}};if("object"==typeof e&&null!==e&&"query"in e&&"string"==typeof e.query)return"params"in e&&"object"==typeof e.params&&null!==e.params?{query:e.query,params:e.params}:{query:e.query};const t=["* Document ID (<docId>)","* Array of document IDs","* Object containing `query`"].join("\n");throw new Error("Unknown selection - must be one of:\n\n".concat(t))}const dt=["image","file"],ft=["before","after","replace"],ht=e=>{if(!/^(~[a-z0-9]{1}[-\w]{0,63}|[a-z0-9]{1}[-\w]{0,63})$/.test(e))throw new Error("Datasets can only contain lowercase characters, numbers, underscores and dashes, and start with tilde, and be maximum 64 characters")},pt=(e,t)=>{if(null===t||"object"!=typeof t||Array.isArray(t))throw new Error("".concat(e,"() takes an object of properties"))},yt=(e,t)=>{if("string"!=typeof t||!/^[a-z0-9_][a-z0-9_.-]{0,127}$/i.test(t)||t.includes(".."))throw new Error("".concat(e,'(): "').concat(t,'" is not a valid document ID'))},gt=(e,t)=>{if(!t._id)throw new Error("".concat(e,'() requires that the document contains an ID ("_id" property)'));yt(e,t._id)},mt=e=>{if(!e.dataset)throw new Error("`dataset` must be provided to perform queries");return e.dataset||""},vt=e=>{if("string"!=typeof e||!/^[a-z0-9._-]{1,75}$/i.test(e))throw new Error("Tag can only contain alphanumeric characters, underscores, dashes and dots, and be between one and 75 characters long.");return e};var bt,wt,Ct=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)},Et=(e,t,n)=>(Ct(e,t,"read from private field"),n?n.call(e):t.get(e)),xt=(e,t,n)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,n)},St=(e,t,n,r)=>(Ct(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n);class Tt{constructor(e,t={}){this.selection=e,this.operations=t}set(e){return this._assign("set",e)}setIfMissing(e){return this._assign("setIfMissing",e)}diffMatchPatch(e){return pt("diffMatchPatch",e),this._assign("diffMatchPatch",e)}unset(e){if(!Array.isArray(e))throw new Error("unset(attrs) takes an array of attributes to unset, non-array given");return this.operations=Object.assign({},this.operations,{unset:e}),this}inc(e){return this._assign("inc",e)}dec(e){return this._assign("dec",e)}insert(e,t,n){return((e,t,n)=>{const r="insert(at, selector, items)";if(-1===ft.indexOf(e)){const e=ft.map((e=>'"'.concat(e,'"'))).join(", ");throw new Error("".concat(r,' takes an "at"-argument which is one of: ').concat(e))}if("string"!=typeof t)throw new Error("".concat(r,' takes a "selector"-argument which must be a string'));if(!Array.isArray(n))throw new Error("".concat(r,' takes an "items"-argument which must be an array'))})(e,t,n),this._assign("insert",{[e]:t,items:n})}append(e,t){return this.insert("after","".concat(e,"[-1]"),t)}prepend(e,t){return this.insert("before","".concat(e,"[0]"),t)}splice(e,t,n,r){const o=t<0?t-1:t,i=void 0===n||-1===n?-1:Math.max(0,t+n),s=o<0&&i>=0?"":i,a="".concat(e,"[").concat(o,":").concat(s,"]");return this.insert("replace",a,r||[])}ifRevisionId(e){return this.operations.ifRevisionID=e,this}serialize(){return{...lt(this.selection),...this.operations}}toJSON(){return this.serialize()}reset(){return this.operations={},this}_assign(e,t,n=!0){return pt(e,t),this.operations=Object.assign({},this.operations,{[e]:Object.assign({},n&&this.operations[e]||{},t)}),this}_set(e,t){return this._assign(e,t,!1)}}bt=new WeakMap;let _t=class e extends Tt{constructor(e,t,n){super(e,t),xt(this,bt,void 0),St(this,bt,n)}clone(){return new e(this.selection,{...this.operations},Et(this,bt))}commit(e){if(!Et(this,bt))throw new Error("No `client` passed to patch, either provide one or pass the patch to a clients `mutate()` method");const t="string"==typeof this.selection,n=Object.assign({returnFirst:t,returnDocuments:!0},e);return Et(this,bt).mutate({patch:this.serialize()},n)}};wt=new WeakMap;let Ot=class e extends Tt{constructor(e,t,n){super(e,t),xt(this,wt,void 0),St(this,wt,n)}clone(){return new e(this.selection,{...this.operations},Et(this,wt))}commit(e){if(!Et(this,wt))throw new Error("No `client` passed to patch, either provide one or pass the patch to a clients `mutate()` method");const t="string"==typeof this.selection,n=Object.assign({returnFirst:t,returnDocuments:!0},e);return Et(this,wt).mutate({patch:this.serialize()},n)}};var jt,kt,At=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)},It=(e,t,n)=>(At(e,t,"read from private field"),n?n.call(e):t.get(e)),Pt=(e,t,n)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,n)},Rt=(e,t,n,r)=>(At(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n);const Mt={returnDocuments:!1};class Dt{constructor(e=[],t){this.operations=e,this.trxId=t}create(e){return pt("create",e),this._add({create:e})}createIfNotExists(e){const t="createIfNotExists";return pt(t,e),gt(t,e),this._add({[t]:e})}createOrReplace(e){const t="createOrReplace";return pt(t,e),gt(t,e),this._add({[t]:e})}delete(e){return yt("delete",e),this._add({delete:{id:e}})}transactionId(e){return e?(this.trxId=e,this):this.trxId}serialize(){return[...this.operations]}toJSON(){return this.serialize()}reset(){return this.operations=[],this}_add(e){return this.operations.push(e),this}}jt=new WeakMap;let Ft=class e extends Dt{constructor(e,t,n){super(e,n),Pt(this,jt,void 0),Rt(this,jt,t)}clone(){return new e([...this.operations],It(this,jt),this.trxId)}commit(e){if(!It(this,jt))throw new Error("No `client` passed to transaction, either provide one or pass the transaction to a clients `mutate()` method");return It(this,jt).mutate(this.serialize(),Object.assign({transactionId:this.trxId},Mt,e||{}))}patch(e,t){const n="function"==typeof t;if("string"!=typeof e&&e instanceof Ot)return this._add({patch:e.serialize()});if(n){const n=t(new Ot(e,{},It(this,jt)));if(!(n instanceof Ot))throw new Error("function passed to `patch()` must return the patch");return this._add({patch:n.serialize()})}return this._add({patch:{id:e,...t}})}};kt=new WeakMap;let qt=class e extends Dt{constructor(e,t,n){super(e,n),Pt(this,kt,void 0),Rt(this,kt,t)}clone(){return new e([...this.operations],It(this,kt),this.trxId)}commit(e){if(!It(this,kt))throw new Error("No `client` passed to transaction, either provide one or pass the transaction to a clients `mutate()` method");return It(this,kt).mutate(this.serialize(),Object.assign({transactionId:this.trxId},Mt,e||{}))}patch(e,t){const n="function"==typeof t;if("string"!=typeof e&&e instanceof _t)return this._add({patch:e.serialize()});if(n){const n=t(new _t(e,{},It(this,kt)));if(!(n instanceof _t))throw new Error("function passed to `patch()` must return the patch");return this._add({patch:n.serialize()})}return this._add({patch:{id:e,...t}})}};function Nt(e){return"https://www.sanity.io/help/"+e}const Ut=e=>function(e){let t,n=!1;return(...r)=>(n||(t=e(...r),n=!0),t)}(((...t)=>console.warn(e.join(" "),...t))),Wt=Ut(["Since you haven't set a value for `useCdn`, we will deliver content using our","global, edge-cached API-CDN. If you wish to have content delivered faster, set","`useCdn: false` to use the Live API. Note: You may incur higher costs using the live API."]),Ht=Ut(["The Sanity client is configured with the `perspective` set to `previewDrafts`, which doesn't support the API-CDN.","The Live API will be used instead. Set `useCdn: false` in your configuration to hide this warning."]),zt=Ut(["You have configured Sanity client to use a token in the browser. This may cause unintentional security issues.","See ".concat(Nt("js-client-browser-token")," for more information and how to hide this warning.")]),Lt=Ut(["Using the Sanity client without specifying an API version is deprecated.","See ".concat(Nt("js-client-api-version"))]),$t=Ut(["The default export of @sanity/client has been deprecated. Use the named export `createClient` instead."]),Bt={apiHost:"https://api.sanity.io",apiVersion:"1",useProjectHostname:!0,stega:{enabled:!1}},Jt=["localhost","127.0.0.1","0.0.0.0"],Gt=function(e){switch(e){case"previewDrafts":case"published":case"raw":return;default:throw new TypeError("Invalid API perspective string, expected `published`, `previewDrafts` or `raw`")}},Vt=(e,t)=>{const n={...t,...e,stega:{..."boolean"==typeof t.stega?{enabled:t.stega}:t.stega||Bt.stega,..."boolean"==typeof e.stega?{enabled:e.stega}:e.stega||{}}};n.apiVersion||Lt();const r={...Bt,...n},o=r.useProjectHostname;if("undefined"==typeof Promise){const e=Nt("js-client-promise-polyfill");throw new Error("No native Promise-implementation found, polyfill needed - see ".concat(e))}if(o&&!r.projectId)throw new Error("Configuration must contain `projectId`");if("string"==typeof r.perspective&&Gt(r.perspective),"encodeSourceMap"in r)throw new Error("It looks like you're using options meant for '@sanity/preview-kit/client'. 'encodeSourceMap' is not supported in '@sanity/client'. Did you mean 'stega.enabled'?");if("encodeSourceMapAtPath"in r)throw new Error("It looks like you're using options meant for '@sanity/preview-kit/client'. 'encodeSourceMapAtPath' is not supported in '@sanity/client'. Did you mean 'stega.filter'?");if("boolean"!=typeof r.stega.enabled)throw new Error("stega.enabled must be a boolean, received ".concat(r.stega.enabled));if(r.stega.enabled&&void 0===r.stega.studioUrl)throw new Error("stega.studioUrl must be defined when stega.enabled is true");if(r.stega.enabled&&"string"!=typeof r.stega.studioUrl&&"function"!=typeof r.stega.studioUrl)throw new Error("stega.studioUrl must be a string or a function, received ".concat(r.stega.studioUrl));const i="undefined"!=typeof window&&window.location&&window.location.hostname,s=i&&(e=>-1!==Jt.indexOf(e))(window.location.hostname);i&&s&&r.token&&!0!==r.ignoreBrowserTokenWarning?zt():void 0===r.useCdn&&Wt(),o&&(e=>{if(!/^[-a-z0-9]+$/i.test(e))throw new Error("`projectId` can only contain only a-z, 0-9 and dashes")})(r.projectId),r.dataset&&ht(r.dataset),"requestTagPrefix"in r&&(r.requestTagPrefix=r.requestTagPrefix?vt(r.requestTagPrefix).replace(/\.+$/,""):void 0),r.apiVersion="".concat(r.apiVersion).replace(/^v/,""),r.isDefaultApi=r.apiHost===Bt.apiHost,r.useCdn=!1!==r.useCdn&&!r.withCredentials,function(e){if("1"===e||"X"===e)return;const t=new Date(e);if(!(/^\d{4}-\d{2}-\d{2}$/.test(e)&&t instanceof Date&&t.getTime()>0))throw new Error("Invalid API version string, expected `1` or date in format `YYYY-MM-DD`")}(r.apiVersion);const a=r.apiHost.split("://",2),c=a[0],u=a[1],l=r.isDefaultApi?"apicdn.sanity.io":u;return r.useProjectHostname?(r.url="".concat(c,"://").concat(r.projectId,".").concat(u,"/v").concat(r.apiVersion),r.cdnUrl="".concat(c,"://").concat(r.projectId,".").concat(l,"/v").concat(r.apiVersion)):(r.url="".concat(r.apiHost,"/v").concat(r.apiVersion),r.cdnUrl=r.url),r},Qt="X-Sanity-Project-ID";var Yt={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},Xt={0:8203,1:8204,2:8205,3:65279},Kt=new Array(4).fill(String.fromCodePoint(Xt[0])).join("");function Zt(e,t,n="auto"){return!0===n||"auto"===n&&(function(e){return!!Number.isNaN(Number(e))&&Boolean(Date.parse(e))}(e)||function(e){try{new URL(e,e.startsWith("/")?"https://acme.com":void 0)}catch{return!1}return!0}(e))?e:`${e}${function(e){let t=JSON.stringify(e);return`${Kt}${Array.from(t).map((e=>{let n=e.charCodeAt(0);if(n>255)throw new Error(`Only ASCII edit info can be encoded. Error attempting to encode ${t} on character ${e} (${n})`);return Array.from(n.toString(4).padStart(4,"0")).map((e=>String.fromCodePoint(Xt[e]))).join("")})).join("")}`}(t)}`}Object.fromEntries(Object.entries(Xt).map((e=>e.reverse()))),Object.fromEntries(Object.entries(Yt).map((e=>e.reverse())));var en=`${Object.values(Yt).map((e=>`\\u{${e.toString(16)}}`)).join("")}`,tn=new RegExp(`[${en}]{4,}`,"gu");function nn(e){try{return JSON.parse(JSON.stringify(e,((e,t)=>{return"string"!=typeof t?t:(n=t,{cleaned:n.replace(tn,""),encoded:(null==(r=n.match(tn))?void 0:r[0])||""}).cleaned;var n,r})))}catch{return e}}const rn=({query:e,params:t={},options:n={}})=>{const r=new URLSearchParams,{tag:o,returnQuery:i,...s}=n;o&&r.append("tag",o),r.append("query",e);for(const[e,n]of Object.entries(t))r.append("$".concat(e),JSON.stringify(n));for(const[e,t]of Object.entries(s))t&&r.append(e,"".concat(t));return!1===i&&r.append("returnQuery","false"),"?".concat(r)},on=(e={})=>{return{dryRun:e.dryRun,returnIds:!0,returnDocuments:(t=e.returnDocuments,n=!0,!1===t?void 0:void 0===t?n:t),visibility:e.visibility||"sync",autoGenerateArrayKeys:e.autoGenerateArrayKeys,skipCrossDatasetReferenceValidation:e.skipCrossDatasetReferenceValidation};var t,n},sn=e=>"response"===e.type,an=e=>e.body,cn=11264;function un(e,t,n,r,o={},i={}){const s="stega"in i?{...n||{},..."boolean"==typeof i.stega?{enabled:i.stega}:i.stega||{}}:n,a=s.enabled?nn(o):o,c=!1===i.filterResponse?e=>e:e=>e.result,{cache:u,next:l,...d}={useAbortSignal:void 0!==i.signal,resultSourceMap:s.enabled?"withKeyArraySelector":i.resultSourceMap,...i,returnQuery:!1===i.filterResponse&&!1!==i.returnQuery},f=gn(e,t,"query",{query:r,params:a},void 0!==u||void 0!==l?{...d,fetch:{cache:u,next:l}}:d);return s.enabled?f.pipe(function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return et.apply(void 0,Z([],K(e)))}(Be(Promise.resolve().then((function(){return Gr})).then((function(e){return e.stegaEncodeSourceMap$1})).then((({stegaEncodeSourceMap:e})=>e)))),Ve((([e,t])=>{const n=t(e.result,e.resultSourceMap,s);return c({...e,result:n})}))):f.pipe(Ve(c))}function ln(e,t,n,r={}){return vn(e,t,{uri:wn(e,"doc",n),json:!0,tag:r.tag}).pipe(Ze(sn),Ve((e=>e.body.documents&&e.body.documents[0])))}function dn(e,t,n,r={}){return vn(e,t,{uri:wn(e,"doc",n.join(",")),json:!0,tag:r.tag}).pipe(Ze(sn),Ve((e=>{const t=(r=e.body.documents||[],o=e=>e._id,r.reduce(((e,t)=>(e[o(t)]=t,e)),Object.create(null)));var r,o;return n.map((e=>t[e]||null))})))}function fn(e,t,n,r){return gt("createIfNotExists",n),mn(e,t,n,"createIfNotExists",r)}function hn(e,t,n,r){return gt("createOrReplace",n),mn(e,t,n,"createOrReplace",r)}function pn(e,t,n,r){return gn(e,t,"mutate",{mutations:[{delete:lt(n)}]},r)}function yn(e,t,n,r){let o;o=n instanceof Ot||n instanceof _t?{patch:n.serialize()}:n instanceof Ft||n instanceof qt?n.serialize():n;return gn(e,t,"mutate",{mutations:Array.isArray(o)?o:[o],transactionId:r&&r.transactionId||void 0},r)}function gn(e,t,n,r,o={}){const i="mutate"===n,s="query"===n,a=i?"":rn(r),c=!i&&a.length<cn,u=c?a:"",l=o.returnFirst,{timeout:d,token:f,tag:h,headers:p,returnQuery:y}=o;return vn(e,t,{method:c?"GET":"POST",uri:wn(e,n,u),json:!0,body:c?void 0:r,query:i&&on(o),timeout:d,headers:p,token:f,tag:h,returnQuery:y,perspective:o.perspective,resultSourceMap:o.resultSourceMap,canUseCdn:s,signal:o.signal,fetch:o.fetch,useAbortSignal:o.useAbortSignal,useCdn:o.useCdn}).pipe(Ze(sn),Ve(an),Ve((e=>{if(!i)return e;const t=e.results||[];if(o.returnDocuments)return l?t[0]&&t[0].document:t.map((e=>e.document));const n=l?"documentId":"documentIds",r=l?t[0]&&t[0].id:t.map((e=>e.id));return{transactionId:e.transactionId,results:t,[n]:r}})))}function mn(e,t,n,r,o={}){return gn(e,t,"mutate",{mutations:[{[r]:n}]},Object.assign({returnFirst:!0,returnDocuments:!0},o))}function vn(e,t,n){var r,o;const i=n.url||n.uri,s=e.config(),a=void 0===n.canUseCdn?["GET","HEAD"].indexOf(n.method||"GET")>=0&&0===i.indexOf("/data/"):n.canUseCdn;let c=(null!=(r=n.useCdn)?r:s.useCdn)&&a;const u=n.tag&&s.requestTagPrefix?[s.requestTagPrefix,n.tag].join("."):n.tag||s.requestTagPrefix;if(u&&null!==n.tag&&(n.query={tag:vt(u),...n.query}),["GET","HEAD","POST"].indexOf(n.method||"GET")>=0&&0===i.indexOf("/data/query/")){const e=null!=(o=n.resultSourceMap)?o:s.resultSourceMap;void 0!==e&&!1!==e&&(n.query={resultSourceMap:e,...n.query});const t=n.perspective||s.perspective;"string"==typeof t&&"raw"!==t&&(Gt(t),n.query={perspective:t,...n.query},"previewDrafts"===t&&c&&(c=!1,Ht())),!1===n.returnQuery&&(n.query={returnQuery:"false",...n.query})}const l=function(e,t={}){const n={},r=t.token||e.token;r&&(n.Authorization="Bearer ".concat(r)),t.useGlobalApi||e.useProjectHostname||!e.projectId||(n[Qt]=e.projectId);const o=Boolean(void 0===t.withCredentials?e.token||e.withCredentials:t.withCredentials),i=void 0===t.timeout?e.timeout:t.timeout;return Object.assign({},t,{headers:Object.assign({},n,t.headers||{}),timeout:void 0===i?3e5:i,proxy:t.proxy||e.proxy,json:!0,withCredentials:o,fetch:"object"==typeof t.fetch&&"object"==typeof e.fetch?{...e.fetch,...t.fetch}:t.fetch||e.fetch})}(s,Object.assign({},n,{url:Cn(e,i,c)})),d=new Se((e=>t(l,s.requester).subscribe(e)));return n.signal?d.pipe((f=n.signal,e=>new Se((t=>{const n=()=>t.error(function(e){var t,n;if(En)return new DOMException(null!=(t=null==e?void 0:e.reason)?t:"The operation was aborted.","AbortError");const r=new Error(null!=(n=null==e?void 0:e.reason)?n:"The operation was aborted.");return r.name="AbortError",r}(f));if(f&&f.aborted)return void n();const r=e.subscribe(t);return f.addEventListener("abort",n),()=>{f.removeEventListener("abort",n),r.unsubscribe()}})))):d;var f}function bn(e,t,n){return vn(e,t,n).pipe(Ze((e=>"response"===e.type)),Ve((e=>e.body)))}function wn(e,t,n){const r=e.config(),o=mt(r),i="/".concat(t,"/").concat(o),s=n?"".concat(i,"/").concat(n):i;return"/data".concat(s).replace(/\/($|\?)/,"$1")}function Cn(e,t,n=!1){const{url:r,cdnUrl:o}=e.config();return"".concat(n?o:r,"/").concat(t.replace(/^\//,""))}const En=Boolean(globalThis.DOMException);var xn,Sn,Tn,_n,On=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)},jn=(e,t,n)=>(On(e,t,"read from private field"),n?n.call(e):t.get(e)),kn=(e,t,n)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,n)},An=(e,t,n,r)=>(On(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n);class In{constructor(e,t){kn(this,xn,void 0),kn(this,Sn,void 0),An(this,xn,e),An(this,Sn,t)}upload(e,t,n){return Rn(jn(this,xn),jn(this,Sn),e,t,n)}}xn=new WeakMap,Sn=new WeakMap;class Pn{constructor(e,t){kn(this,Tn,void 0),kn(this,_n,void 0),An(this,Tn,e),An(this,_n,t)}upload(e,t,n){return Ge(Rn(jn(this,Tn),jn(this,_n),e,t,n).pipe(Ze((e=>"response"===e.type)),Ve((e=>e.body.document))))}}function Rn(e,t,n,r,o={}){(e=>{if(-1===dt.indexOf(e))throw new Error("Invalid asset type: ".concat(e,". Must be one of ").concat(dt.join(", ")))})(n);let i=o.extract||void 0;i&&!i.length&&(i=["none"]);const s=mt(e.config()),a="image"===n?"images":"files",c=function(e,t){if("undefined"==typeof File||!(t instanceof File))return e;return Object.assign({filename:!1===e.preserveFilename?void 0:t.name,contentType:t.type},e)}(o,r),{tag:u,label:l,title:d,description:f,creditLine:h,filename:p,source:y}=c,g={label:l,title:d,description:f,filename:p,meta:i,creditLine:h};return y&&(g.sourceId=y.id,g.sourceName=y.name,g.sourceUrl=y.url),vn(e,t,{tag:u,method:"POST",timeout:c.timeout||0,uri:"/assets/".concat(a,"/").concat(s),headers:c.contentType?{"Content-Type":c.contentType}:{},query:g,body:r})}Tn=new WeakMap,_n=new WeakMap;var Mn=(e,t)=>Object.keys(t).concat(Object.keys(e)).reduce(((n,r)=>(n[r]=void 0===e[r]?t[r]:e[r],n)),{});const Dn=["includePreviousRevision","includeResult","visibility","effectFormat","tag"],Fn={includeResult:!0};function qn(e,t,n={}){const{url:r,token:o,withCredentials:i,requestTagPrefix:s}=this.config(),a=n.tag&&s?[s,n.tag].join("."):n.tag,c={...Mn(n,Fn),tag:a},u=(l=c,Dn.reduce(((e,t)=>(void 0===l[t]||(e[t]=l[t]),e)),{}));var l;const d=rn({query:e,params:t,options:{tag:a,...u}}),f="".concat(r).concat(wn(this,"listen",d));if(f.length>14800)return new Se((e=>e.error(new Error("Query too large for listener"))));const h=c.events?c.events:["mutation"],p=-1!==h.indexOf("reconnect"),y={};return(o||i)&&(y.withCredentials=!0),o&&(y.headers={Authorization:"Bearer ".concat(o)}),new Se((e=>{let t,n;u().then((e=>{t=e})).catch((t=>{e.error(t),d()}));let r=!1;function o(){r||(p&&e.next({type:"reconnect"}),r||t.readyState===t.CLOSED&&(c(),clearTimeout(n),n=setTimeout(l,100)))}function i(t){e.error(function(e){if(e instanceof Error)return e;const t=Nn(e);return t instanceof Error?t:new Error(function(e){if(!e.error)return e.message||"Unknown listener error";if(e.error.description)return e.error.description;return"string"==typeof e.error?e.error:JSON.stringify(e.error,null,2)}(t))}(t))}function s(t){const n=Nn(t);return n instanceof Error?e.error(n):e.next(n)}function a(){r=!0,c(),e.complete()}function c(){t&&(t.removeEventListener("error",o),t.removeEventListener("channelError",i),t.removeEventListener("disconnect",a),h.forEach((e=>t.removeEventListener(e,s))),t.close())}async function u(){const{default:e}=await Promise.resolve().then((function(){return Yr})),t=new e(f,y);return t.addEventListener("error",o),t.addEventListener("channelError",i),t.addEventListener("disconnect",a),h.forEach((e=>t.addEventListener(e,s))),t}function l(){u().then((e=>{t=e})).catch((t=>{e.error(t),d()}))}function d(){r=!0,c()}return d}))}function Nn(e){try{const t=e.data&&JSON.parse(e.data)||{};return Object.assign({type:e.type},t)}catch(e){return e}}var Un,Wn,Hn,zn,Ln=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)},$n=(e,t,n)=>(Ln(e,t,"read from private field"),n?n.call(e):t.get(e)),Bn=(e,t,n)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,n)},Jn=(e,t,n,r)=>(Ln(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n);class Gn{constructor(e,t){Bn(this,Un,void 0),Bn(this,Wn,void 0),Jn(this,Un,e),Jn(this,Wn,t)}create(e,t){return Qn($n(this,Un),$n(this,Wn),"PUT",e,t)}edit(e,t){return Qn($n(this,Un),$n(this,Wn),"PATCH",e,t)}delete(e){return Qn($n(this,Un),$n(this,Wn),"DELETE",e)}list(){return bn($n(this,Un),$n(this,Wn),{uri:"/datasets",tag:null})}}Un=new WeakMap,Wn=new WeakMap;class Vn{constructor(e,t){Bn(this,Hn,void 0),Bn(this,zn,void 0),Jn(this,Hn,e),Jn(this,zn,t)}create(e,t){return Ge(Qn($n(this,Hn),$n(this,zn),"PUT",e,t))}edit(e,t){return Ge(Qn($n(this,Hn),$n(this,zn),"PATCH",e,t))}delete(e){return Ge(Qn($n(this,Hn),$n(this,zn),"DELETE",e))}list(){return Ge(bn($n(this,Hn),$n(this,zn),{uri:"/datasets",tag:null}))}}function Qn(e,t,n,r,o){return ht(r),bn(e,t,{method:n,uri:"/datasets/".concat(r),body:o,tag:null})}Hn=new WeakMap,zn=new WeakMap;var Yn,Xn,Kn,Zn,er=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)},tr=(e,t,n)=>(er(e,t,"read from private field"),n?n.call(e):t.get(e)),nr=(e,t,n)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,n)},rr=(e,t,n,r)=>(er(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n);class or{constructor(e,t){nr(this,Yn,void 0),nr(this,Xn,void 0),rr(this,Yn,e),rr(this,Xn,t)}list(e){const t=!1===(null==e?void 0:e.includeMembers)?"/projects?includeMembers=false":"/projects";return bn(tr(this,Yn),tr(this,Xn),{uri:t})}getById(e){return bn(tr(this,Yn),tr(this,Xn),{uri:"/projects/".concat(e)})}}Yn=new WeakMap,Xn=new WeakMap;class ir{constructor(e,t){nr(this,Kn,void 0),nr(this,Zn,void 0),rr(this,Kn,e),rr(this,Zn,t)}list(e){const t=!1===(null==e?void 0:e.includeMembers)?"/projects?includeMembers=false":"/projects";return Ge(bn(tr(this,Kn),tr(this,Zn),{uri:t}))}getById(e){return Ge(bn(tr(this,Kn),tr(this,Zn),{uri:"/projects/".concat(e)}))}}Kn=new WeakMap,Zn=new WeakMap;var sr,ar,cr,ur,lr=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)},dr=(e,t,n)=>(lr(e,t,"read from private field"),n?n.call(e):t.get(e)),fr=(e,t,n)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,n)},hr=(e,t,n,r)=>(lr(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n);class pr{constructor(e,t){fr(this,sr,void 0),fr(this,ar,void 0),hr(this,sr,e),hr(this,ar,t)}getById(e){return bn(dr(this,sr),dr(this,ar),{uri:"/users/".concat(e)})}}sr=new WeakMap,ar=new WeakMap;class yr{constructor(e,t){fr(this,cr,void 0),fr(this,ur,void 0),hr(this,cr,e),hr(this,ur,t)}getById(e){return Ge(bn(dr(this,cr),dr(this,ur),{uri:"/users/".concat(e)}))}}cr=new WeakMap,ur=new WeakMap;var gr,mr,vr,br,wr=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)},Cr=(e,t,n)=>(wr(e,t,"read from private field"),n?n.call(e):t.get(e)),Er=(e,t,n)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,n)},xr=(e,t,n,r)=>(wr(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n);gr=new WeakMap,mr=new WeakMap;let Sr=class e{constructor(e,t=Bt){Er(this,gr,void 0),Er(this,mr,void 0),this.listen=qn,this.config(t),xr(this,mr,e),this.assets=new In(this,Cr(this,mr)),this.datasets=new Gn(this,Cr(this,mr)),this.projects=new or(this,Cr(this,mr)),this.users=new pr(this,Cr(this,mr))}clone(){return new e(Cr(this,mr),this.config())}config(e){if(void 0===e)return{...Cr(this,gr)};if(Cr(this,gr)&&!1===Cr(this,gr).allowReconfigure)throw new Error("Existing client instance cannot be reconfigured - use `withConfig(newConfig)` to return a new client");return xr(this,gr,Vt(e,Cr(this,gr)||{})),this}withConfig(t){const n=this.config();return new e(Cr(this,mr),{...n,...t,stega:{...n.stega||{},..."boolean"==typeof(null==t?void 0:t.stega)?{enabled:t.stega}:(null==t?void 0:t.stega)||{}}})}fetch(e,t,n){return un(this,Cr(this,mr),Cr(this,gr).stega,e,t,n)}getDocument(e,t){return ln(this,Cr(this,mr),e,t)}getDocuments(e,t){return dn(this,Cr(this,mr),e,t)}create(e,t){return mn(this,Cr(this,mr),e,"create",t)}createIfNotExists(e,t){return fn(this,Cr(this,mr),e,t)}createOrReplace(e,t){return hn(this,Cr(this,mr),e,t)}delete(e,t){return pn(this,Cr(this,mr),e,t)}mutate(e,t){return yn(this,Cr(this,mr),e,t)}patch(e,t){return new _t(e,t,this)}transaction(e){return new qt(e,this)}request(e){return bn(this,Cr(this,mr),e)}getUrl(e,t){return Cn(this,e,t)}getDataUrl(e,t){return wn(this,e,t)}};vr=new WeakMap,br=new WeakMap;let Tr=class e{constructor(e,t=Bt){Er(this,vr,void 0),Er(this,br,void 0),this.listen=qn,this.config(t),xr(this,br,e),this.assets=new Pn(this,Cr(this,br)),this.datasets=new Vn(this,Cr(this,br)),this.projects=new ir(this,Cr(this,br)),this.users=new yr(this,Cr(this,br)),this.observable=new Sr(e,t)}clone(){return new e(Cr(this,br),this.config())}config(e){if(void 0===e)return{...Cr(this,vr)};if(Cr(this,vr)&&!1===Cr(this,vr).allowReconfigure)throw new Error("Existing client instance cannot be reconfigured - use `withConfig(newConfig)` to return a new client");return this.observable&&this.observable.config(e),xr(this,vr,Vt(e,Cr(this,vr)||{})),this}withConfig(t){const n=this.config();return new e(Cr(this,br),{...n,...t,stega:{...n.stega||{},..."boolean"==typeof(null==t?void 0:t.stega)?{enabled:t.stega}:(null==t?void 0:t.stega)||{}}})}fetch(e,t,n){return Ge(un(this,Cr(this,br),Cr(this,vr).stega,e,t,n))}getDocument(e,t){return Ge(ln(this,Cr(this,br),e,t))}getDocuments(e,t){return Ge(dn(this,Cr(this,br),e,t))}create(e,t){return Ge(mn(this,Cr(this,br),e,"create",t))}createIfNotExists(e,t){return Ge(fn(this,Cr(this,br),e,t))}createOrReplace(e,t){return Ge(hn(this,Cr(this,br),e,t))}delete(e,t){return Ge(pn(this,Cr(this,br),e,t))}mutate(e,t){return Ge(yn(this,Cr(this,br),e,t))}patch(e,t){return new Ot(e,t,this)}transaction(e){return new Ft(e,this)}request(e){return Ge(bn(this,Cr(this,br),e))}dataRequest(e,t,n){return Ge(gn(this,Cr(this,br),e,t,n))}getUrl(e,t){return Cn(this,e,t)}getDataUrl(e,t){return wn(this,e,t)}};const _r=function(e,t){return{requester:ct(e,{}).defaultRequester,createClient:n=>new t(ct(e,{maxRetries:n.maxRetries,retryDelay:n.retryDelay}),n)}}([],Tr),Or=_r.requester,jr=_r.createClient,kr=function(e){return function(t){return $t(),e(t)}}(jr),Ar=/_key\s*==\s*['"](.*)['"]/;function Ir(e){if(!Array.isArray(e))throw new Error("Path is not an array");return e.reduce(((e,t,n)=>{const r=typeof t;if("number"===r)return"".concat(e,"[").concat(t,"]");if("string"===r){const r=0===n?"":".";return"".concat(e).concat(r).concat(t)}if(function(e){return"string"==typeof e?Ar.test(e.trim()):"object"==typeof e&&"_key"in e}(t)&&t._key)return"".concat(e,'[_key=="').concat(t._key,'"]');if(Array.isArray(t)){const[n,r]=t;return"".concat(e,"[").concat(n,":").concat(r,"]")}throw new Error("Unsupported path segment `".concat(JSON.stringify(t),"`"))}),"")}const Pr={"\f":"\\f","\n":"\\n","\r":"\\r","\t":"\\t","'":"\\'","\\":"\\\\"},Rr={"\\f":"\f","\\n":"\n","\\r":"\r","\\t":"\t","\\'":"'","\\\\":"\\"};function Mr(e){const t=[],n=/\['(.*?)'\]|\[(\d+)\]|\[\?\(@\._key=='(.*?)'\)\]/g;let r;for(;null!==(r=n.exec(e));)if(void 0===r[1])if(void 0===r[2])if(void 0===r[3]);else{const e=r[3].replace(/\\(\\')/g,(e=>Rr[e]));t.push({_key:e,_index:-1})}else t.push(parseInt(r[2],10));else{const e=r[1].replace(/\\(\\|f|n|r|t|')/g,(e=>Rr[e]));t.push(e)}return t}function Dr(e){return e.map((e=>{if("string"==typeof e)return e;if("number"==typeof e)return e;if(""!==e._key)return{_key:e._key};if(-1!==e._index)return e._index;throw new Error("invalid segment:".concat(JSON.stringify(e)))}))}function Fr(e,t){if(!(null==t?void 0:t.mappings))return;const n=function(e){return"$".concat(e.map((e=>{if("string"==typeof e){const t=e.replace(/[\f\n\r\t'\\]/g,(e=>Pr[e]));return"['".concat(t,"']")}if("number"==typeof e)return"[".concat(e,"]");if(""!==e._key){const t=e._key.replace(/['\\]/g,(e=>Pr[e]));return"[?(@._key=='".concat(t,"')]")}return"[".concat(e._index,"]")})).join(""))}(e.map((e=>{if("string"==typeof e)return e;if("number"==typeof e)return e;if(-1!==e._index)return e._index;throw new Error("invalid segment:".concat(JSON.stringify(e)))})));if(void 0!==t.mappings[n])return{mapping:t.mappings[n],matchedPath:n,pathSuffix:""};const r=Object.entries(t.mappings).filter((([e])=>n.startsWith(e))).sort((([e],[t])=>t.length-e.length));if(0==r.length)return;const[o,i]=r[0];return{mapping:i,matchedPath:o,pathSuffix:n.substring(o.length)}}function qr(e){return"object"==typeof e&&null!==e}function Nr(e,t,n=[]){return function(e){return null!==e&&Array.isArray(e)}(e)?e.map(((e,r)=>{if(qr(e)){const o=e._key;if("string"==typeof o)return Nr(e,t,n.concat({_key:o,_index:r}))}return Nr(e,t,n.concat(r))})):qr(e)?Object.fromEntries(Object.entries(e).map((([e,r])=>[e,Nr(r,t,n.concat(e))]))):t(e,n)}function Ur(e,t,n){return Nr(e,((e,r)=>{if("string"!=typeof e)return e;const o=Fr(r,t);if(!o)return e;const{mapping:i,matchedPath:s}=o;if("value"!==i.type)return e;if("documentValue"!==i.source.type)return e;const a=t.documents[i.source.document],c=t.paths[i.source.path],u=Mr(s),l=Mr(c).concat(r.slice(u.length));return n({sourcePath:l,sourceDocument:a,resultPath:r,value:e})}))}const Wr="drafts.";function Hr(e){const{baseUrl:t,workspace:n="default",tool:r="default",id:o,type:i,path:s}=e;if(!t)throw new Error("baseUrl is required");if(!s)throw new Error("path is required");if(!o)throw new Error("id is required");if("/"!==t&&t.endsWith("/"))throw new Error("baseUrl must not end with a slash");const a="default"===n?void 0:n,c="default"===r?void 0:r,u=function(e){return e.startsWith(Wr)?e.slice(Wr.length):e}(o),l=Array.isArray(s)?Ir(Dr(s)):s,d=new URLSearchParams({baseUrl:t,id:u,type:i,path:l});a&&d.set("workspace",a),c&&d.set("tool",c);const f=["/"===t?"":t];a&&f.push(a);const h=["mode=presentation","id=".concat(u),"type=".concat(i),"path=".concat(encodeURIComponent(l))];return c&&h.push("tool=".concat(c)),f.push("intent","edit","".concat(h.join(";"),"?").concat(d)),f.join("/")}const zr=({sourcePath:e,value:t})=>{if(/^\d{4}-\d{2}-\d{2}/.test(n=t)&&Boolean(Date.parse(n))||function(e){try{new URL(e,e.startsWith("/")?"https://acme.com":void 0)}catch{return!1}return!0}(t))return!1;var n;const r=e.at(-1);return("slug"!==e.at(-2)||"current"!==r)&&(("string"!=typeof r||!r.startsWith("_"))&&(("number"!=typeof r||"marks"!==e.at(-2))&&(("href"!==r||"number"!=typeof e.at(-2)||"markDefs"!==e.at(-3))&&("style"!==r&&"listItem"!==r&&(!e.some((e=>"meta"===e||"metadata"===e||"openGraph"===e||"seo"===e))&&("string"!=typeof r||!Lr.has(r)))))))},Lr=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","unit","url","username","variant","website"]);function $r(e,t,n){var r,o,i,s,a,c,u,l,d;const{filter:f,logger:h,enabled:p}=n;if(!p){const o="config.enabled must be true, don't call this function otherwise";throw null==(r=null==h?void 0:h.error)||r.call(h,"[@sanity/client]: ".concat(o),{result:e,resultSourceMap:t,config:n}),new TypeError(o)}if(!t)return null==(o=null==h?void 0:h.error)||o.call(h,"[@sanity/client]: Missing Content Source Map from response body",{result:e,resultSourceMap:t,config:n}),e;if(!n.studioUrl){const r="config.studioUrl must be defined";throw null==(i=null==h?void 0:h.error)||i.call(h,"[@sanity/client]: ".concat(r),{result:e,resultSourceMap:t,config:n}),new TypeError(r)}const y={encoded:[],skipped:[]},g=Ur(e,t,(({sourcePath:e,sourceDocument:t,resultPath:r,value:o})=>{if(!1===("function"==typeof f?f({sourcePath:e,resultPath:r,filterDefault:zr,sourceDocument:t,value:o}):zr({sourcePath:e,resultPath:r,filterDefault:zr,sourceDocument:t,value:o})))return h&&y.skipped.push({path:Br(e),value:"".concat(o.slice(0,20)).concat(o.length>20?"...":""),length:o.length}),o;h&&y.encoded.push({path:Br(e),value:"".concat(o.slice(0,20)).concat(o.length>20?"...":""),length:o.length});const{baseUrl:i,workspace:s,tool:a}=function(e){let t="string"==typeof e?e:e.baseUrl;return"/"!==t&&(t=t.replace(/\/$/,"")),"string"==typeof e?{baseUrl:t}:{...e,baseUrl:t}}("function"==typeof n.studioUrl?n.studioUrl(t):n.studioUrl);if(!i)return o;const{_id:c,_type:u}=t;return Zt(o,{origin:"sanity.io",href:Hr({baseUrl:i,workspace:s,tool:a,id:c,type:u,path:e})},!1)}));if(h){const e=y.skipped.length,t=y.encoded.length;if((e||t)&&(null==(s=(null==h?void 0:h.groupCollapsed)||h.log)||s("[@sanity/client]: Encoding source map into result"),null==(a=h.log)||a.call(h,"[@sanity/client]: Paths encoded: ".concat(y.encoded.length,", skipped: ").concat(y.skipped.length))),y.encoded.length>0&&(null==(c=null==h?void 0:h.log)||c.call(h,"[@sanity/client]: Table of encoded paths"),null==(u=(null==h?void 0:h.table)||h.log)||u(y.encoded)),y.skipped.length>0){const e=new Set;for(const{path:t}of y.skipped)e.add(t.replace(Ar,"0").replace(/\[\d+\]/g,"[]"));null==(l=null==h?void 0:h.log)||l.call(h,"[@sanity/client]: List of skipped paths",[...e.values()])}(e||t)&&(null==(d=null==h?void 0:h.groupEnd)||d.call(h))}return g}function Br(e){return Ir(Dr(e))}var Jr=Object.freeze({__proto__:null,stegaEncodeSourceMap:$r}),Gr=Object.freeze({__proto__:null,encodeIntoResult:Ur,stegaEncodeSourceMap:$r,stegaEncodeSourceMap$1:Jr}),Vr={exports:{}};
|
|
8
|
+
function M(e){return"[object Object]"===Object.prototype.toString.call(e)}!function(e,t){t.formatArgs=function(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+e.exports.humanize(this.diff),!this.useColors)return;const r="color: "+this.color;t.splice(1,0,r,"color: inherit");let n=0,o=0;t[0].replace(/%[a-zA-Z%]/g,(e=>{"%%"!==e&&(n++,"%c"===e&&(o=n))})),t.splice(o,0,r)},t.save=function(e){try{e?t.storage.setItem("debug",e):t.storage.removeItem("debug")}catch(e){}},t.load=function(){let e;try{e=t.storage.getItem("debug")}catch(e){}!e&&"undefined"!=typeof process&&"env"in process&&(e=process.env.DEBUG);return e},t.useColors=function(){if("undefined"!=typeof window&&window.process&&("renderer"===window.process.type||window.process.__nwjs))return!0;if("undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;return"undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)},t.storage=function(){try{return localStorage}catch(e){}}(),t.destroy=(()=>{let e=!1;return()=>{e||(e=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],t.log=console.debug||console.log||(()=>{}),e.exports=R(t);const{formatters:r}=e.exports;r.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}}(I,I.exports);const D="undefined"==typeof Buffer?()=>!1:e=>Buffer.isBuffer(e),F=["boolean","string","number"];function q(){return{processOptions:e=>{const t=e.body;if(!t)return e;var r,n,o;return!("function"==typeof t.pipe)&&!D(t)&&(-1!==F.indexOf(typeof t)||Array.isArray(t)||!1!==M(r=t)&&(void 0===(n=r.constructor)||!1!==M(o=n.prototype)&&!1!==o.hasOwnProperty("isPrototypeOf")))?Object.assign({},e,{body:JSON.stringify(e.body),headers:Object.assign({},e.headers,{"Content-Type":"application/json"})}):e}}}function N(e){return{onResponse:r=>{const n=r.headers["content-type"]||"",o=e&&e.force||-1!==n.indexOf("application/json");return r.body&&n&&o?Object.assign({},r,{body:t(r.body)}):r},processOptions:e=>Object.assign({},e,{headers:Object.assign({Accept:"application/json"},e.headers)})};function t(e){try{return JSON.parse(e)}catch(e){throw e.message="Failed to parsed response body as JSON: ".concat(e.message),e}}}let U={};"undefined"!=typeof globalThis?U=globalThis:"undefined"!=typeof window?U=window:"undefined"!=typeof global?U=global:"undefined"!=typeof self&&(U=self);var W=U;function H(e={}){const t=e.implementation||W.Observable;if(!t)throw new Error("`Observable` is not available in global scope, and no implementation was passed");return{onReturn:(e,r)=>new t((t=>(e.error.subscribe((e=>t.error(e))),e.progress.subscribe((e=>t.next(Object.assign({type:"progress"},e)))),e.response.subscribe((e=>{t.next(Object.assign({type:"response"},e)),t.complete()})),e.request.publish(r),()=>e.abort.publish())))}}class z{constructor(e){this.__CANCEL__=!0,this.message=e}toString(){return"Cancel".concat(this.message?": ".concat(this.message):"")}}const L=class{constructor(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");let t=null;this.promise=new Promise((e=>{t=e})),e((e=>{this.reason||(this.reason=new z(e),t(this.reason))}))}};L.source=()=>{let e;return{token:new L((t=>{e=t})),cancel:e}};var $=(e,t,r)=>("GET"===r.method||"HEAD"===r.method)&&(e.isNetworkError||!1);function B(e){return 100*Math.pow(2,e)+100*Math.random()}const J=(e={})=>(e=>{const t=e.maxRetries||5,r=e.retryDelay||B,n=e.shouldRetry;return{onError:(e,o)=>{const i=o.options,s=i.maxRetries||t,a=i.shouldRetry||n,c=i.attemptNumber||0;if(null!==(u=i.body)&&"object"==typeof u&&"function"==typeof u.pipe)return e;var u;if(!a(e,c,i)||c>=s)return e;const l=Object.assign({},o,{options:Object.assign({},i,{attemptNumber:c+1})});return setTimeout((()=>o.channels.request.publish(l)),r(c)),null}}})({shouldRetry:$,...e});J.shouldRetry=$;var G=function(e,t){return G=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},G(e,t)};function V(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}G(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}function Q(e,t,r,n){return new(r||(r=Promise))((function(o,i){function s(e){try{c(n.next(e))}catch(e){i(e)}}function a(e){try{c(n.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}c((n=n.apply(e,t||[])).next())}))}function Y(e,t){var r,n,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(a){return function(c){return function(a){if(r)throw new TypeError("Generator is already executing.");for(;i&&(i=0,a[0]&&(s=0)),s;)try{if(r=1,n&&(o=2&a[0]?n.return:a[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,a[1])).done)return o;switch(n=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,n=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){s.label=a[1];break}if(6===a[0]&&s.label<o[1]){s.label=o[1],o=a;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(a);break}o[2]&&s.ops.pop(),s.trys.pop();continue}a=t.call(e,s)}catch(e){a=[6,e],n=0}finally{r=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,c])}}}function X(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function K(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,o,i=r.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(n=i.next()).done;)s.push(n.value)}catch(e){o={error:e}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return s}function Z(e,t,r){if(r||2===arguments.length)for(var n,o=0,i=t.length;o<i;o++)!n&&o in t||(n||(n=Array.prototype.slice.call(t,0,o)),n[o]=t[o]);return e.concat(n||Array.prototype.slice.call(t))}function ee(e){return this instanceof ee?(this.v=e,this):new ee(e)}function te(e,t,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n,o=r.apply(e,t||[]),i=[];return n={},s("next"),s("throw"),s("return"),n[Symbol.asyncIterator]=function(){return this},n;function s(e){o[e]&&(n[e]=function(t){return new Promise((function(r,n){i.push([e,t,r,n])>1||a(e,t)}))})}function a(e,t){try{(r=o[e](t)).value instanceof ee?Promise.resolve(r.value.v).then(c,u):l(i[0][2],r)}catch(e){l(i[0][3],e)}var r}function c(e){a("next",e)}function u(e){a("throw",e)}function l(e,t){e(t),i.shift(),i.length&&a(i[0][0],i[0][1])}}function re(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,r=e[Symbol.asyncIterator];return r?r.call(e):(e=X(e),t={},n("next"),n("throw"),n("return"),t[Symbol.asyncIterator]=function(){return this},t);function n(r){t[r]=e[r]&&function(t){return new Promise((function(n,o){(function(e,t,r,n){Promise.resolve(n).then((function(t){e({value:t,done:r})}),t)})(n,o,(t=e[r](t)).done,t.value)}))}}}function ne(e){return"function"==typeof e}function oe(e){var t=e((function(e){Error.call(e),e.stack=(new Error).stack}));return t.prototype=Object.create(Error.prototype),t.prototype.constructor=t,t}"function"==typeof SuppressedError&&SuppressedError;var ie=oe((function(e){return function(t){e(this),this.message=t?t.length+" errors occurred during unsubscription:\n"+t.map((function(e,t){return t+1+") "+e.toString()})).join("\n "):"",this.name="UnsubscriptionError",this.errors=t}}));function se(e,t){if(e){var r=e.indexOf(t);0<=r&&e.splice(r,1)}}var ae=function(){function e(e){this.initialTeardown=e,this.closed=!1,this._parentage=null,this._finalizers=null}var t;return e.prototype.unsubscribe=function(){var e,t,r,n,o;if(!this.closed){this.closed=!0;var i=this._parentage;if(i)if(this._parentage=null,Array.isArray(i))try{for(var s=X(i),a=s.next();!a.done;a=s.next()){a.value.remove(this)}}catch(t){e={error:t}}finally{try{a&&!a.done&&(t=s.return)&&t.call(s)}finally{if(e)throw e.error}}else i.remove(this);var c=this.initialTeardown;if(ne(c))try{c()}catch(e){o=e instanceof ie?e.errors:[e]}var u=this._finalizers;if(u){this._finalizers=null;try{for(var l=X(u),d=l.next();!d.done;d=l.next()){var f=d.value;try{ue(f)}catch(e){o=null!=o?o:[],e instanceof ie?o=Z(Z([],K(o)),K(e.errors)):o.push(e)}}}catch(e){r={error:e}}finally{try{d&&!d.done&&(n=l.return)&&n.call(l)}finally{if(r)throw r.error}}}if(o)throw new ie(o)}},e.prototype.add=function(t){var r;if(t&&t!==this)if(this.closed)ue(t);else{if(t instanceof e){if(t.closed||t._hasParent(this))return;t._addParent(this)}(this._finalizers=null!==(r=this._finalizers)&&void 0!==r?r:[]).push(t)}},e.prototype._hasParent=function(e){var t=this._parentage;return t===e||Array.isArray(t)&&t.includes(e)},e.prototype._addParent=function(e){var t=this._parentage;this._parentage=Array.isArray(t)?(t.push(e),t):t?[t,e]:e},e.prototype._removeParent=function(e){var t=this._parentage;t===e?this._parentage=null:Array.isArray(t)&&se(t,e)},e.prototype.remove=function(t){var r=this._finalizers;r&&se(r,t),t instanceof e&&t._removeParent(this)},e.EMPTY=((t=new e).closed=!0,t),e}();function ce(e){return e instanceof ae||e&&"closed"in e&&ne(e.remove)&&ne(e.add)&&ne(e.unsubscribe)}function ue(e){ne(e)?e():e.unsubscribe()}ae.EMPTY;var le={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1},de={setTimeout:function(e,t){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];return setTimeout.apply(void 0,Z([e,t],K(r)))},clearTimeout:function(e){var t=de.delegate;return((null==t?void 0:t.clearTimeout)||clearTimeout)(e)},delegate:void 0};function fe(e){de.setTimeout((function(){throw e}))}function he(){}var pe=function(e){function t(t){var r=e.call(this)||this;return r.isStopped=!1,t?(r.destination=t,ce(t)&&t.add(r)):r.destination=we,r}return V(t,e),t.create=function(e,t,r){return new ve(e,t,r)},t.prototype.next=function(e){this.isStopped||this._next(e)},t.prototype.error=function(e){this.isStopped||(this.isStopped=!0,this._error(e))},t.prototype.complete=function(){this.isStopped||(this.isStopped=!0,this._complete())},t.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,e.prototype.unsubscribe.call(this),this.destination=null)},t.prototype._next=function(e){this.destination.next(e)},t.prototype._error=function(e){try{this.destination.error(e)}finally{this.unsubscribe()}},t.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},t}(ae),ye=Function.prototype.bind;function ge(e,t){return ye.call(e,t)}var me=function(){function e(e){this.partialObserver=e}return e.prototype.next=function(e){var t=this.partialObserver;if(t.next)try{t.next(e)}catch(e){be(e)}},e.prototype.error=function(e){var t=this.partialObserver;if(t.error)try{t.error(e)}catch(e){be(e)}else be(e)},e.prototype.complete=function(){var e=this.partialObserver;if(e.complete)try{e.complete()}catch(e){be(e)}},e}(),ve=function(e){function t(t,r,n){var o,i,s=e.call(this)||this;ne(t)||!t?o={next:null!=t?t:void 0,error:null!=r?r:void 0,complete:null!=n?n:void 0}:s&&le.useDeprecatedNextContext?((i=Object.create(t)).unsubscribe=function(){return s.unsubscribe()},o={next:t.next&&ge(t.next,i),error:t.error&&ge(t.error,i),complete:t.complete&&ge(t.complete,i)}):o=t;return s.destination=new me(o),s}return V(t,e),t}(pe);function be(e){fe(e)}var we={closed:!0,next:he,error:function(e){throw e},complete:he},Ce="function"==typeof Symbol&&Symbol.observable||"@@observable";function Ee(e){return e}function xe(e){return 0===e.length?Ee:1===e.length?e[0]:function(t){return e.reduce((function(e,t){return t(e)}),t)}}var Se=function(){function e(e){e&&(this._subscribe=e)}return e.prototype.lift=function(t){var r=new e;return r.source=this,r.operator=t,r},e.prototype.subscribe=function(e,t,r){var n,o=this,i=(n=e)&&n instanceof pe||function(e){return e&&ne(e.next)&&ne(e.error)&&ne(e.complete)}(n)&&ce(n)?e:new ve(e,t,r);return function(){var e=o,t=e.operator,r=e.source;i.add(t?t.call(i,r):r?o._subscribe(i):o._trySubscribe(i))}(),i},e.prototype._trySubscribe=function(e){try{return this._subscribe(e)}catch(t){e.error(t)}},e.prototype.forEach=function(e,t){var r=this;return new(t=Te(t))((function(t,n){var o=new ve({next:function(t){try{e(t)}catch(e){n(e),o.unsubscribe()}},error:n,complete:t});r.subscribe(o)}))},e.prototype._subscribe=function(e){var t;return null===(t=this.source)||void 0===t?void 0:t.subscribe(e)},e.prototype[Ce]=function(){return this},e.prototype.pipe=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return xe(e)(this)},e.prototype.toPromise=function(e){var t=this;return new(e=Te(e))((function(e,r){var n;t.subscribe((function(e){return n=e}),(function(e){return r(e)}),(function(){return e(n)}))}))},e.create=function(t){return new e(t)},e}();function Te(e){var t;return null!==(t=null!=e?e:le.Promise)&&void 0!==t?t:Promise}function _e(e){return function(t){if(function(e){return ne(null==e?void 0:e.lift)}(t))return t.lift((function(t){try{return e(t,this)}catch(e){this.error(e)}}));throw new TypeError("Unable to lift unknown Observable type")}}function Oe(e,t,r,n,o){return new je(e,t,r,n,o)}var je=function(e){function t(t,r,n,o,i,s){var a=e.call(this,t)||this;return a.onFinalize=i,a.shouldUnsubscribe=s,a._next=r?function(e){try{r(e)}catch(e){t.error(e)}}:e.prototype._next,a._error=o?function(e){try{o(e)}catch(e){t.error(e)}finally{this.unsubscribe()}}:e.prototype._error,a._complete=n?function(){try{n()}catch(e){t.error(e)}finally{this.unsubscribe()}}:e.prototype._complete,a}return V(t,e),t.prototype.unsubscribe=function(){var t;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var r=this.closed;e.prototype.unsubscribe.call(this),!r&&(null===(t=this.onFinalize)||void 0===t||t.call(this))}},t}(pe);var ke=function(e){return e&&"number"==typeof e.length&&"function"!=typeof e};function Ae(e){return ne(null==e?void 0:e.then)}function Ie(e){return ne(e[Ce])}function Pe(e){return Symbol.asyncIterator&&ne(null==e?void 0:e[Symbol.asyncIterator])}function Re(e){return new TypeError("You provided "+(null!==e&&"object"==typeof e?"an invalid object":"'"+e+"'")+" where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.")}var Me="function"==typeof Symbol&&Symbol.iterator?Symbol.iterator:"@@iterator";function De(e){return ne(null==e?void 0:e[Me])}function Fe(e){return te(this,arguments,(function(){var t,r,n;return Y(this,(function(o){switch(o.label){case 0:t=e.getReader(),o.label=1;case 1:o.trys.push([1,,9,10]),o.label=2;case 2:return[4,ee(t.read())];case 3:return r=o.sent(),n=r.value,r.done?[4,ee(void 0)]:[3,5];case 4:return[2,o.sent()];case 5:return[4,ee(n)];case 6:return[4,o.sent()];case 7:return o.sent(),[3,2];case 8:return[3,10];case 9:return t.releaseLock(),[7];case 10:return[2]}}))}))}function qe(e){return ne(null==e?void 0:e.getReader)}function Ne(e){if(e instanceof Se)return e;if(null!=e){if(Ie(e))return o=e,new Se((function(e){var t=o[Ce]();if(ne(t.subscribe))return t.subscribe(e);throw new TypeError("Provided object does not correctly implement Symbol.observable")}));if(ke(e))return n=e,new Se((function(e){for(var t=0;t<n.length&&!e.closed;t++)e.next(n[t]);e.complete()}));if(Ae(e))return r=e,new Se((function(e){r.then((function(t){e.closed||(e.next(t),e.complete())}),(function(t){return e.error(t)})).then(null,fe)}));if(Pe(e))return Ue(e);if(De(e))return t=e,new Se((function(e){var r,n;try{for(var o=X(t),i=o.next();!i.done;i=o.next()){var s=i.value;if(e.next(s),e.closed)return}}catch(e){r={error:e}}finally{try{i&&!i.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}e.complete()}));if(qe(e))return Ue(Fe(e))}var t,r,n,o;throw Re(e)}function Ue(e){return new Se((function(t){(function(e,t){var r,n,o,i;return Q(this,void 0,void 0,(function(){var s,a;return Y(this,(function(c){switch(c.label){case 0:c.trys.push([0,5,6,11]),r=re(e),c.label=1;case 1:return[4,r.next()];case 2:if((n=c.sent()).done)return[3,4];if(s=n.value,t.next(s),t.closed)return[2];c.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return a=c.sent(),o={error:a},[3,11];case 6:return c.trys.push([6,,9,10]),n&&!n.done&&(i=r.return)?[4,i.call(r)]:[3,8];case 7:c.sent(),c.label=8;case 8:return[3,10];case 9:if(o)throw o.error;return[7];case 10:return[7];case 11:return t.complete(),[2]}}))}))})(e,t).catch((function(e){return t.error(e)}))}))}function We(e,t,r,n,o){void 0===n&&(n=0),void 0===o&&(o=!1);var i=t.schedule((function(){r(),o?e.add(this.schedule(null,n)):this.unsubscribe()}),n);if(e.add(i),!o)return i}function He(e,t){return void 0===t&&(t=0),_e((function(r,n){r.subscribe(Oe(n,(function(r){return We(n,e,(function(){return n.next(r)}),t)}),(function(){return We(n,e,(function(){return n.complete()}),t)}),(function(r){return We(n,e,(function(){return n.error(r)}),t)})))}))}function ze(e,t){return void 0===t&&(t=0),_e((function(r,n){n.add(e.schedule((function(){return r.subscribe(n)}),t))}))}function Le(e,t){if(!e)throw new Error("Iterable cannot be null");return new Se((function(r){We(r,t,(function(){var n=e[Symbol.asyncIterator]();We(r,t,(function(){n.next().then((function(e){e.done?r.complete():r.next(e.value)}))}),0,!0)}))}))}function $e(e,t){if(null!=e){if(Ie(e))return function(e,t){return Ne(e).pipe(ze(t),He(t))}(e,t);if(ke(e))return function(e,t){return new Se((function(r){var n=0;return t.schedule((function(){n===e.length?r.complete():(r.next(e[n++]),r.closed||this.schedule())}))}))}(e,t);if(Ae(e))return function(e,t){return Ne(e).pipe(ze(t),He(t))}(e,t);if(Pe(e))return Le(e,t);if(De(e))return function(e,t){return new Se((function(r){var n;return We(r,t,(function(){n=e[Me](),We(r,t,(function(){var e,t,o;try{t=(e=n.next()).value,o=e.done}catch(e){return void r.error(e)}o?r.complete():r.next(t)}),0,!0)})),function(){return ne(null==n?void 0:n.return)&&n.return()}}))}(e,t);if(qe(e))return function(e,t){return Le(Fe(e),t)}(e,t)}throw Re(e)}function Be(e,t){return t?$e(e,t):Ne(e)}var Je=oe((function(e){return function(){e(this),this.name="EmptyError",this.message="no elements in sequence"}}));function Ge(e,t){var r="object"==typeof t;return new Promise((function(n,o){var i,s=!1;e.subscribe({next:function(e){i=e,s=!0},error:o,complete:function(){s?n(i):r?n(t.defaultValue):o(new Je)}})}))}function Ve(e,t){return _e((function(r,n){var o=0;r.subscribe(Oe(n,(function(r){n.next(e.call(t,r,o++))})))}))}var Qe=Array.isArray;function Ye(e){return Ve((function(t){return function(e,t){return Qe(t)?e.apply(void 0,Z([],K(t))):e(t)}(e,t)}))}function Xe(e,t,r){e?We(r,e,t):t()}var Ke=Array.isArray;function Ze(e,t){return _e((function(r,n){var o=0;r.subscribe(Oe(n,(function(r){return e.call(t,r,o++)&&n.next(r)})))}))}function et(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=function(e){return ne((t=e)[t.length-1])?e.pop():void 0;var t}(e);return r?function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return xe(e)}(et.apply(void 0,Z([],K(e))),Ye(r)):_e((function(t,r){var n,o,i;(n=Z([t],K(function(e){return 1===e.length&&Ke(e[0])?e[0]:e}(e))),void 0===i&&(i=Ee),function(e){Xe(o,(function(){for(var t=n.length,r=new Array(t),s=t,a=t,c=function(t){Xe(o,(function(){var c=Be(n[t],o),u=!1;c.subscribe(Oe(e,(function(n){r[t]=n,u||(u=!0,a--),a||e.next(i(r.slice()))}),(function(){--s||e.complete()})))}),e)},u=0;u<t;u++)c(u)}),e)})(r)}))}class tt extends Error{constructor(e){const t=nt(e);super(t.message),this.statusCode=400,Object.assign(this,t)}}class rt extends Error{constructor(e){const t=nt(e);super(t.message),this.statusCode=500,Object.assign(this,t)}}function nt(e){const t=e.body,r={response:e,statusCode:e.statusCode,responseBody:it(t,e),message:"",details:void 0};if(t.error&&t.message)return r.message="".concat(t.error," - ").concat(t.message),r;if(function(e){return ot(e)&&ot(e.error)&&"mutationError"===e.error.type&&"string"==typeof e.error.description}(t)){const e=t.error.items||[],n=e.slice(0,5).map((e=>{var t;return null==(t=e.error)?void 0:t.description})).filter(Boolean);let o=n.length?":\n- ".concat(n.join("\n- ")):"";return e.length>5&&(o+="\n...and ".concat(e.length-5," more")),r.message="".concat(t.error.description).concat(o),r.details=t.error,r}return t.error&&t.error.description?(r.message=t.error.description,r.details=t.error,r):(r.message=t.error||t.message||function(e){const t=e.statusMessage?" ".concat(e.statusMessage):"";return"".concat(e.method,"-request to ").concat(e.url," resulted in HTTP ").concat(e.statusCode).concat(t)}(e),r)}function ot(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}function it(e,t){return-1!==(t.headers["content-type"]||"").toLowerCase().indexOf("application/json")?JSON.stringify(e,null,2):e}const st={onResponse:e=>{if(e.statusCode>=500)throw new rt(e);if(e.statusCode>=400)throw new tt(e);return e}},at={onResponse:e=>{const t=e.headers["x-sanity-warning"];return(Array.isArray(t)?t:[t]).filter(Boolean).forEach((e=>console.warn(e))),e}};function ct(e,{maxRetries:t=5,retryDelay:r}){const n=j([t>0?J({retryDelay:r,maxRetries:t,shouldRetry:ut}):{},...e,at,q(),N(),{onRequest:e=>{if("xhr"!==e.adapter)return;const t=e.request,r=e.context;function n(e){return t=>{const n=t.lengthComputable?t.loaded/t.total*100:-1;r.channels.progress.publish({stage:e,percent:n,total:t.total,loaded:t.loaded,lengthComputable:t.lengthComputable})}}"upload"in t&&"onprogress"in t.upload&&(t.upload.onprogress=n("upload")),"onprogress"in t&&(t.onprogress=n("download"))}},st,H({implementation:Se})]);function o(e,t=n){return t({maxRedirects:0,...e})}return o.defaultRequester=n,o}function ut(e,t,r){const n="GET"===r.method||"HEAD"===r.method,o=(r.uri||r.url).startsWith("/data/query"),i=e.response&&(429===e.response.statusCode||502===e.response.statusCode||503===e.response.statusCode);return!(!n&&!o||!i)||J.shouldRetry(e,t,r)}function lt(e){if("string"==typeof e)return{id:e};if(Array.isArray(e))return{query:"*[_id in $ids]",params:{ids:e}};if("object"==typeof e&&null!==e&&"query"in e&&"string"==typeof e.query)return"params"in e&&"object"==typeof e.params&&null!==e.params?{query:e.query,params:e.params}:{query:e.query};const t=["* Document ID (<docId>)","* Array of document IDs","* Object containing `query`"].join("\n");throw new Error("Unknown selection - must be one of:\n\n".concat(t))}const dt=["image","file"],ft=["before","after","replace"],ht=e=>{if(!/^(~[a-z0-9]{1}[-\w]{0,63}|[a-z0-9]{1}[-\w]{0,63})$/.test(e))throw new Error("Datasets can only contain lowercase characters, numbers, underscores and dashes, and start with tilde, and be maximum 64 characters")},pt=(e,t)=>{if(null===t||"object"!=typeof t||Array.isArray(t))throw new Error("".concat(e,"() takes an object of properties"))},yt=(e,t)=>{if("string"!=typeof t||!/^[a-z0-9_][a-z0-9_.-]{0,127}$/i.test(t)||t.includes(".."))throw new Error("".concat(e,'(): "').concat(t,'" is not a valid document ID'))},gt=(e,t)=>{if(!t._id)throw new Error("".concat(e,'() requires that the document contains an ID ("_id" property)'));yt(e,t._id)},mt=e=>{if(!e.dataset)throw new Error("`dataset` must be provided to perform queries");return e.dataset||""},vt=e=>{if("string"!=typeof e||!/^[a-z0-9._-]{1,75}$/i.test(e))throw new Error("Tag can only contain alphanumeric characters, underscores, dashes and dots, and be between one and 75 characters long.");return e};var bt,wt,Ct=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)},Et=(e,t,r)=>(Ct(e,t,"read from private field"),r?r.call(e):t.get(e)),xt=(e,t,r)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,r)},St=(e,t,r,n)=>(Ct(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r);class Tt{constructor(e,t={}){this.selection=e,this.operations=t}set(e){return this._assign("set",e)}setIfMissing(e){return this._assign("setIfMissing",e)}diffMatchPatch(e){return pt("diffMatchPatch",e),this._assign("diffMatchPatch",e)}unset(e){if(!Array.isArray(e))throw new Error("unset(attrs) takes an array of attributes to unset, non-array given");return this.operations=Object.assign({},this.operations,{unset:e}),this}inc(e){return this._assign("inc",e)}dec(e){return this._assign("dec",e)}insert(e,t,r){return((e,t,r)=>{const n="insert(at, selector, items)";if(-1===ft.indexOf(e)){const e=ft.map((e=>'"'.concat(e,'"'))).join(", ");throw new Error("".concat(n,' takes an "at"-argument which is one of: ').concat(e))}if("string"!=typeof t)throw new Error("".concat(n,' takes a "selector"-argument which must be a string'));if(!Array.isArray(r))throw new Error("".concat(n,' takes an "items"-argument which must be an array'))})(e,t,r),this._assign("insert",{[e]:t,items:r})}append(e,t){return this.insert("after","".concat(e,"[-1]"),t)}prepend(e,t){return this.insert("before","".concat(e,"[0]"),t)}splice(e,t,r,n){const o=t<0?t-1:t,i=void 0===r||-1===r?-1:Math.max(0,t+r),s=o<0&&i>=0?"":i,a="".concat(e,"[").concat(o,":").concat(s,"]");return this.insert("replace",a,n||[])}ifRevisionId(e){return this.operations.ifRevisionID=e,this}serialize(){return{...lt(this.selection),...this.operations}}toJSON(){return this.serialize()}reset(){return this.operations={},this}_assign(e,t,r=!0){return pt(e,t),this.operations=Object.assign({},this.operations,{[e]:Object.assign({},r&&this.operations[e]||{},t)}),this}_set(e,t){return this._assign(e,t,!1)}}bt=new WeakMap;let _t=class e extends Tt{constructor(e,t,r){super(e,t),xt(this,bt,void 0),St(this,bt,r)}clone(){return new e(this.selection,{...this.operations},Et(this,bt))}commit(e){if(!Et(this,bt))throw new Error("No `client` passed to patch, either provide one or pass the patch to a clients `mutate()` method");const t="string"==typeof this.selection,r=Object.assign({returnFirst:t,returnDocuments:!0},e);return Et(this,bt).mutate({patch:this.serialize()},r)}};wt=new WeakMap;let Ot=class e extends Tt{constructor(e,t,r){super(e,t),xt(this,wt,void 0),St(this,wt,r)}clone(){return new e(this.selection,{...this.operations},Et(this,wt))}commit(e){if(!Et(this,wt))throw new Error("No `client` passed to patch, either provide one or pass the patch to a clients `mutate()` method");const t="string"==typeof this.selection,r=Object.assign({returnFirst:t,returnDocuments:!0},e);return Et(this,wt).mutate({patch:this.serialize()},r)}};var jt,kt,At=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)},It=(e,t,r)=>(At(e,t,"read from private field"),r?r.call(e):t.get(e)),Pt=(e,t,r)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,r)},Rt=(e,t,r,n)=>(At(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r);const Mt={returnDocuments:!1};class Dt{constructor(e=[],t){this.operations=e,this.trxId=t}create(e){return pt("create",e),this._add({create:e})}createIfNotExists(e){const t="createIfNotExists";return pt(t,e),gt(t,e),this._add({[t]:e})}createOrReplace(e){const t="createOrReplace";return pt(t,e),gt(t,e),this._add({[t]:e})}delete(e){return yt("delete",e),this._add({delete:{id:e}})}transactionId(e){return e?(this.trxId=e,this):this.trxId}serialize(){return[...this.operations]}toJSON(){return this.serialize()}reset(){return this.operations=[],this}_add(e){return this.operations.push(e),this}}jt=new WeakMap;let Ft=class e extends Dt{constructor(e,t,r){super(e,r),Pt(this,jt,void 0),Rt(this,jt,t)}clone(){return new e([...this.operations],It(this,jt),this.trxId)}commit(e){if(!It(this,jt))throw new Error("No `client` passed to transaction, either provide one or pass the transaction to a clients `mutate()` method");return It(this,jt).mutate(this.serialize(),Object.assign({transactionId:this.trxId},Mt,e||{}))}patch(e,t){const r="function"==typeof t;if("string"!=typeof e&&e instanceof Ot)return this._add({patch:e.serialize()});if(r){const r=t(new Ot(e,{},It(this,jt)));if(!(r instanceof Ot))throw new Error("function passed to `patch()` must return the patch");return this._add({patch:r.serialize()})}return this._add({patch:{id:e,...t}})}};kt=new WeakMap;let qt=class e extends Dt{constructor(e,t,r){super(e,r),Pt(this,kt,void 0),Rt(this,kt,t)}clone(){return new e([...this.operations],It(this,kt),this.trxId)}commit(e){if(!It(this,kt))throw new Error("No `client` passed to transaction, either provide one or pass the transaction to a clients `mutate()` method");return It(this,kt).mutate(this.serialize(),Object.assign({transactionId:this.trxId},Mt,e||{}))}patch(e,t){const r="function"==typeof t;if("string"!=typeof e&&e instanceof _t)return this._add({patch:e.serialize()});if(r){const r=t(new _t(e,{},It(this,kt)));if(!(r instanceof _t))throw new Error("function passed to `patch()` must return the patch");return this._add({patch:r.serialize()})}return this._add({patch:{id:e,...t}})}};function Nt(e){return"https://www.sanity.io/help/"+e}const Ut=e=>function(e){let t,r=!1;return(...n)=>(r||(t=e(...n),r=!0),t)}(((...t)=>console.warn(e.join(" "),...t))),Wt=Ut(["Since you haven't set a value for `useCdn`, we will deliver content using our","global, edge-cached API-CDN. If you wish to have content delivered faster, set","`useCdn: false` to use the Live API. Note: You may incur higher costs using the live API."]),Ht=Ut(["The Sanity client is configured with the `perspective` set to `previewDrafts`, which doesn't support the API-CDN.","The Live API will be used instead. Set `useCdn: false` in your configuration to hide this warning."]),zt=Ut(["You have configured Sanity client to use a token in the browser. This may cause unintentional security issues.","See ".concat(Nt("js-client-browser-token")," for more information and how to hide this warning.")]),Lt=Ut(["Using the Sanity client without specifying an API version is deprecated.","See ".concat(Nt("js-client-api-version"))]),$t=Ut(["The default export of @sanity/client has been deprecated. Use the named export `createClient` instead."]),Bt={apiHost:"https://api.sanity.io",apiVersion:"1",useProjectHostname:!0,stega:{enabled:!1}},Jt=["localhost","127.0.0.1","0.0.0.0"],Gt=function(e){switch(e){case"previewDrafts":case"published":case"raw":return;default:throw new TypeError("Invalid API perspective string, expected `published`, `previewDrafts` or `raw`")}},Vt=(e,t)=>{const r={...t,...e,stega:{..."boolean"==typeof t.stega?{enabled:t.stega}:t.stega||Bt.stega,..."boolean"==typeof e.stega?{enabled:e.stega}:e.stega||{}}};r.apiVersion||Lt();const n={...Bt,...r},o=n.useProjectHostname;if("undefined"==typeof Promise){const e=Nt("js-client-promise-polyfill");throw new Error("No native Promise-implementation found, polyfill needed - see ".concat(e))}if(o&&!n.projectId)throw new Error("Configuration must contain `projectId`");if("string"==typeof n.perspective&&Gt(n.perspective),"encodeSourceMap"in n)throw new Error("It looks like you're using options meant for '@sanity/preview-kit/client'. 'encodeSourceMap' is not supported in '@sanity/client'. Did you mean 'stega.enabled'?");if("encodeSourceMapAtPath"in n)throw new Error("It looks like you're using options meant for '@sanity/preview-kit/client'. 'encodeSourceMapAtPath' is not supported in '@sanity/client'. Did you mean 'stega.filter'?");if("boolean"!=typeof n.stega.enabled)throw new Error("stega.enabled must be a boolean, received ".concat(n.stega.enabled));if(n.stega.enabled&&void 0===n.stega.studioUrl)throw new Error("stega.studioUrl must be defined when stega.enabled is true");if(n.stega.enabled&&"string"!=typeof n.stega.studioUrl&&"function"!=typeof n.stega.studioUrl)throw new Error("stega.studioUrl must be a string or a function, received ".concat(n.stega.studioUrl));const i="undefined"!=typeof window&&window.location&&window.location.hostname,s=i&&(e=>-1!==Jt.indexOf(e))(window.location.hostname);i&&s&&n.token&&!0!==n.ignoreBrowserTokenWarning?zt():void 0===n.useCdn&&Wt(),o&&(e=>{if(!/^[-a-z0-9]+$/i.test(e))throw new Error("`projectId` can only contain only a-z, 0-9 and dashes")})(n.projectId),n.dataset&&ht(n.dataset),"requestTagPrefix"in n&&(n.requestTagPrefix=n.requestTagPrefix?vt(n.requestTagPrefix).replace(/\.+$/,""):void 0),n.apiVersion="".concat(n.apiVersion).replace(/^v/,""),n.isDefaultApi=n.apiHost===Bt.apiHost,n.useCdn=!1!==n.useCdn&&!n.withCredentials,function(e){if("1"===e||"X"===e)return;const t=new Date(e);if(!(/^\d{4}-\d{2}-\d{2}$/.test(e)&&t instanceof Date&&t.getTime()>0))throw new Error("Invalid API version string, expected `1` or date in format `YYYY-MM-DD`")}(n.apiVersion);const a=n.apiHost.split("://",2),c=a[0],u=a[1],l=n.isDefaultApi?"apicdn.sanity.io":u;return n.useProjectHostname?(n.url="".concat(c,"://").concat(n.projectId,".").concat(u,"/v").concat(n.apiVersion),n.cdnUrl="".concat(c,"://").concat(n.projectId,".").concat(l,"/v").concat(n.apiVersion)):(n.url="".concat(n.apiHost,"/v").concat(n.apiVersion),n.cdnUrl=n.url),n},Qt="X-Sanity-Project-ID";var Yt={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},Xt={0:8203,1:8204,2:8205,3:65279},Kt=new Array(4).fill(String.fromCodePoint(Xt[0])).join("");function Zt(e,t,r="auto"){return!0===r||"auto"===r&&(function(e){return!!Number.isNaN(Number(e))&&Boolean(Date.parse(e))}(e)||function(e){try{new URL(e,e.startsWith("/")?"https://acme.com":void 0)}catch{return!1}return!0}(e))?e:`${e}${function(e){let t=JSON.stringify(e);return`${Kt}${Array.from(t).map((e=>{let r=e.charCodeAt(0);if(r>255)throw new Error(`Only ASCII edit info can be encoded. Error attempting to encode ${t} on character ${e} (${r})`);return Array.from(r.toString(4).padStart(4,"0")).map((e=>String.fromCodePoint(Xt[e]))).join("")})).join("")}`}(t)}`}Object.fromEntries(Object.entries(Xt).map((e=>e.reverse()))),Object.fromEntries(Object.entries(Yt).map((e=>e.reverse())));var er=`${Object.values(Yt).map((e=>`\\u{${e.toString(16)}}`)).join("")}`,tr=new RegExp(`[${er}]{4,}`,"gu");function rr(e){try{return JSON.parse(JSON.stringify(e,((e,t)=>{return"string"!=typeof t?t:(r=t,{cleaned:r.replace(tr,""),encoded:(null==(n=r.match(tr))?void 0:n[0])||""}).cleaned;var r,n})))}catch{return e}}const nr=({query:e,params:t={},options:r={}})=>{const n=new URLSearchParams,{tag:o,returnQuery:i,...s}=r;o&&n.append("tag",o),n.append("query",e);for(const[e,r]of Object.entries(t))n.append("$".concat(e),JSON.stringify(r));for(const[e,t]of Object.entries(s))t&&n.append(e,"".concat(t));return!1===i&&n.append("returnQuery","false"),"?".concat(n)},or=(e={})=>{return{dryRun:e.dryRun,returnIds:!0,returnDocuments:(t=e.returnDocuments,r=!0,!1===t?void 0:void 0===t?r:t),visibility:e.visibility||"sync",autoGenerateArrayKeys:e.autoGenerateArrayKeys,skipCrossDatasetReferenceValidation:e.skipCrossDatasetReferenceValidation};var t,r},ir=e=>"response"===e.type,sr=e=>e.body,ar=11264;function cr(e,t,r,n,o={},i={}){const s="stega"in i?{...r||{},..."boolean"==typeof i.stega?{enabled:i.stega}:i.stega||{}}:r,a=s.enabled?rr(o):o,c=!1===i.filterResponse?e=>e:e=>e.result,{cache:u,next:l,...d}={useAbortSignal:void 0!==i.signal,resultSourceMap:s.enabled?"withKeyArraySelector":i.resultSourceMap,...i,returnQuery:!1===i.filterResponse&&!1!==i.returnQuery},f=yr(e,t,"query",{query:n,params:a},void 0!==u||void 0!==l?{...d,fetch:{cache:u,next:l}}:d);return s.enabled?f.pipe(function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return et.apply(void 0,Z([],K(e)))}(Be(Promise.resolve().then((function(){return Gn})).then((function(e){return e.stegaEncodeSourceMap$1})).then((({stegaEncodeSourceMap:e})=>e)))),Ve((([e,t])=>{const r=t(e.result,e.resultSourceMap,s);return c({...e,result:r})}))):f.pipe(Ve(c))}function ur(e,t,r,n={}){return mr(e,t,{uri:br(e,"doc",r),json:!0,tag:n.tag}).pipe(Ze(ir),Ve((e=>e.body.documents&&e.body.documents[0])))}function lr(e,t,r,n={}){return mr(e,t,{uri:br(e,"doc",r.join(",")),json:!0,tag:n.tag}).pipe(Ze(ir),Ve((e=>{const t=(n=e.body.documents||[],o=e=>e._id,n.reduce(((e,t)=>(e[o(t)]=t,e)),Object.create(null)));var n,o;return r.map((e=>t[e]||null))})))}function dr(e,t,r,n){return gt("createIfNotExists",r),gr(e,t,r,"createIfNotExists",n)}function fr(e,t,r,n){return gt("createOrReplace",r),gr(e,t,r,"createOrReplace",n)}function hr(e,t,r,n){return yr(e,t,"mutate",{mutations:[{delete:lt(r)}]},n)}function pr(e,t,r,n){let o;o=r instanceof Ot||r instanceof _t?{patch:r.serialize()}:r instanceof Ft||r instanceof qt?r.serialize():r;return yr(e,t,"mutate",{mutations:Array.isArray(o)?o:[o],transactionId:n&&n.transactionId||void 0},n)}function yr(e,t,r,n,o={}){const i="mutate"===r,s="query"===r,a=i?"":nr(n),c=!i&&a.length<ar,u=c?a:"",l=o.returnFirst,{timeout:d,token:f,tag:h,headers:p,returnQuery:y}=o;return mr(e,t,{method:c?"GET":"POST",uri:br(e,r,u),json:!0,body:c?void 0:n,query:i&&or(o),timeout:d,headers:p,token:f,tag:h,returnQuery:y,perspective:o.perspective,resultSourceMap:o.resultSourceMap,canUseCdn:s,signal:o.signal,fetch:o.fetch,useAbortSignal:o.useAbortSignal,useCdn:o.useCdn}).pipe(Ze(ir),Ve(sr),Ve((e=>{if(!i)return e;const t=e.results||[];if(o.returnDocuments)return l?t[0]&&t[0].document:t.map((e=>e.document));const r=l?"documentId":"documentIds",n=l?t[0]&&t[0].id:t.map((e=>e.id));return{transactionId:e.transactionId,results:t,[r]:n}})))}function gr(e,t,r,n,o={}){return yr(e,t,"mutate",{mutations:[{[n]:r}]},Object.assign({returnFirst:!0,returnDocuments:!0},o))}function mr(e,t,r){var n,o;const i=r.url||r.uri,s=e.config(),a=void 0===r.canUseCdn?["GET","HEAD"].indexOf(r.method||"GET")>=0&&0===i.indexOf("/data/"):r.canUseCdn;let c=(null!=(n=r.useCdn)?n:s.useCdn)&&a;const u=r.tag&&s.requestTagPrefix?[s.requestTagPrefix,r.tag].join("."):r.tag||s.requestTagPrefix;if(u&&null!==r.tag&&(r.query={tag:vt(u),...r.query}),["GET","HEAD","POST"].indexOf(r.method||"GET")>=0&&0===i.indexOf("/data/query/")){const e=null!=(o=r.resultSourceMap)?o:s.resultSourceMap;void 0!==e&&!1!==e&&(r.query={resultSourceMap:e,...r.query});const t=r.perspective||s.perspective;"string"==typeof t&&"raw"!==t&&(Gt(t),r.query={perspective:t,...r.query},"previewDrafts"===t&&c&&(c=!1,Ht())),!1===r.returnQuery&&(r.query={returnQuery:"false",...r.query})}const l=function(e,t={}){const r={},n=t.token||e.token;n&&(r.Authorization="Bearer ".concat(n)),t.useGlobalApi||e.useProjectHostname||!e.projectId||(r[Qt]=e.projectId);const o=Boolean(void 0===t.withCredentials?e.token||e.withCredentials:t.withCredentials),i=void 0===t.timeout?e.timeout:t.timeout;return Object.assign({},t,{headers:Object.assign({},r,t.headers||{}),timeout:void 0===i?3e5:i,proxy:t.proxy||e.proxy,json:!0,withCredentials:o,fetch:"object"==typeof t.fetch&&"object"==typeof e.fetch?{...e.fetch,...t.fetch}:t.fetch||e.fetch})}(s,Object.assign({},r,{url:wr(e,i,c)})),d=new Se((e=>t(l,s.requester).subscribe(e)));return r.signal?d.pipe((f=r.signal,e=>new Se((t=>{const r=()=>t.error(function(e){var t,r;if(Cr)return new DOMException(null!=(t=null==e?void 0:e.reason)?t:"The operation was aborted.","AbortError");const n=new Error(null!=(r=null==e?void 0:e.reason)?r:"The operation was aborted.");return n.name="AbortError",n}(f));if(f&&f.aborted)return void r();const n=e.subscribe(t);return f.addEventListener("abort",r),()=>{f.removeEventListener("abort",r),n.unsubscribe()}})))):d;var f}function vr(e,t,r){return mr(e,t,r).pipe(Ze((e=>"response"===e.type)),Ve((e=>e.body)))}function br(e,t,r){const n=e.config(),o=mt(n),i="/".concat(t,"/").concat(o),s=r?"".concat(i,"/").concat(r):i;return"/data".concat(s).replace(/\/($|\?)/,"$1")}function wr(e,t,r=!1){const{url:n,cdnUrl:o}=e.config();return"".concat(r?o:n,"/").concat(t.replace(/^\//,""))}const Cr=Boolean(globalThis.DOMException);var Er,xr,Sr,Tr,_r=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)},Or=(e,t,r)=>(_r(e,t,"read from private field"),r?r.call(e):t.get(e)),jr=(e,t,r)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,r)},kr=(e,t,r,n)=>(_r(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r);class Ar{constructor(e,t){jr(this,Er,void 0),jr(this,xr,void 0),kr(this,Er,e),kr(this,xr,t)}upload(e,t,r){return Pr(Or(this,Er),Or(this,xr),e,t,r)}}Er=new WeakMap,xr=new WeakMap;class Ir{constructor(e,t){jr(this,Sr,void 0),jr(this,Tr,void 0),kr(this,Sr,e),kr(this,Tr,t)}upload(e,t,r){return Ge(Pr(Or(this,Sr),Or(this,Tr),e,t,r).pipe(Ze((e=>"response"===e.type)),Ve((e=>e.body.document))))}}function Pr(e,t,r,n,o={}){(e=>{if(-1===dt.indexOf(e))throw new Error("Invalid asset type: ".concat(e,". Must be one of ").concat(dt.join(", ")))})(r);let i=o.extract||void 0;i&&!i.length&&(i=["none"]);const s=mt(e.config()),a="image"===r?"images":"files",c=function(e,t){if("undefined"==typeof File||!(t instanceof File))return e;return Object.assign({filename:!1===e.preserveFilename?void 0:t.name,contentType:t.type},e)}(o,n),{tag:u,label:l,title:d,description:f,creditLine:h,filename:p,source:y}=c,g={label:l,title:d,description:f,filename:p,meta:i,creditLine:h};return y&&(g.sourceId=y.id,g.sourceName=y.name,g.sourceUrl=y.url),mr(e,t,{tag:u,method:"POST",timeout:c.timeout||0,uri:"/assets/".concat(a,"/").concat(s),headers:c.contentType?{"Content-Type":c.contentType}:{},query:g,body:n})}Sr=new WeakMap,Tr=new WeakMap;var Rr=(e,t)=>Object.keys(t).concat(Object.keys(e)).reduce(((r,n)=>(r[n]=void 0===e[n]?t[n]:e[n],r)),{});const Mr=["includePreviousRevision","includeResult","visibility","effectFormat","tag"],Dr={includeResult:!0};function Fr(e,t,r={}){const{url:n,token:o,withCredentials:i,requestTagPrefix:s}=this.config(),a=r.tag&&s?[s,r.tag].join("."):r.tag,c={...Rr(r,Dr),tag:a},u=(l=c,Mr.reduce(((e,t)=>(void 0===l[t]||(e[t]=l[t]),e)),{}));var l;const d=nr({query:e,params:t,options:{tag:a,...u}}),f="".concat(n).concat(br(this,"listen",d));if(f.length>14800)return new Se((e=>e.error(new Error("Query too large for listener"))));const h=c.events?c.events:["mutation"],p=-1!==h.indexOf("reconnect"),y={};return(o||i)&&(y.withCredentials=!0),o&&(y.headers={Authorization:"Bearer ".concat(o)}),new Se((e=>{let t,r;u().then((e=>{t=e})).catch((t=>{e.error(t),d()}));let n=!1;function o(){n||(p&&e.next({type:"reconnect"}),n||t.readyState===t.CLOSED&&(c(),clearTimeout(r),r=setTimeout(l,100)))}function i(t){e.error(function(e){if(e instanceof Error)return e;const t=qr(e);return t instanceof Error?t:new Error(function(e){if(!e.error)return e.message||"Unknown listener error";if(e.error.description)return e.error.description;return"string"==typeof e.error?e.error:JSON.stringify(e.error,null,2)}(t))}(t))}function s(t){const r=qr(t);return r instanceof Error?e.error(r):e.next(r)}function a(){n=!0,c(),e.complete()}function c(){t&&(t.removeEventListener("error",o),t.removeEventListener("channelError",i),t.removeEventListener("disconnect",a),h.forEach((e=>t.removeEventListener(e,s))),t.close())}async function u(){const{default:e}=await Promise.resolve().then((function(){return Yn})),t=new e(f,y);return t.addEventListener("error",o),t.addEventListener("channelError",i),t.addEventListener("disconnect",a),h.forEach((e=>t.addEventListener(e,s))),t}function l(){u().then((e=>{t=e})).catch((t=>{e.error(t),d()}))}function d(){n=!0,c()}return d}))}function qr(e){try{const t=e.data&&JSON.parse(e.data)||{};return Object.assign({type:e.type},t)}catch(e){return e}}var Nr,Ur,Wr,Hr,zr=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)},Lr=(e,t,r)=>(zr(e,t,"read from private field"),r?r.call(e):t.get(e)),$r=(e,t,r)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,r)},Br=(e,t,r,n)=>(zr(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r);class Jr{constructor(e,t){$r(this,Nr,void 0),$r(this,Ur,void 0),Br(this,Nr,e),Br(this,Ur,t)}create(e,t){return Vr(Lr(this,Nr),Lr(this,Ur),"PUT",e,t)}edit(e,t){return Vr(Lr(this,Nr),Lr(this,Ur),"PATCH",e,t)}delete(e){return Vr(Lr(this,Nr),Lr(this,Ur),"DELETE",e)}list(){return vr(Lr(this,Nr),Lr(this,Ur),{uri:"/datasets",tag:null})}}Nr=new WeakMap,Ur=new WeakMap;class Gr{constructor(e,t){$r(this,Wr,void 0),$r(this,Hr,void 0),Br(this,Wr,e),Br(this,Hr,t)}create(e,t){return Ge(Vr(Lr(this,Wr),Lr(this,Hr),"PUT",e,t))}edit(e,t){return Ge(Vr(Lr(this,Wr),Lr(this,Hr),"PATCH",e,t))}delete(e){return Ge(Vr(Lr(this,Wr),Lr(this,Hr),"DELETE",e))}list(){return Ge(vr(Lr(this,Wr),Lr(this,Hr),{uri:"/datasets",tag:null}))}}function Vr(e,t,r,n,o){return ht(n),vr(e,t,{method:r,uri:"/datasets/".concat(n),body:o,tag:null})}Wr=new WeakMap,Hr=new WeakMap;var Qr,Yr,Xr,Kr,Zr=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)},en=(e,t,r)=>(Zr(e,t,"read from private field"),r?r.call(e):t.get(e)),tn=(e,t,r)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,r)},rn=(e,t,r,n)=>(Zr(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r);class nn{constructor(e,t){tn(this,Qr,void 0),tn(this,Yr,void 0),rn(this,Qr,e),rn(this,Yr,t)}list(e){const t=!1===(null==e?void 0:e.includeMembers)?"/projects?includeMembers=false":"/projects";return vr(en(this,Qr),en(this,Yr),{uri:t})}getById(e){return vr(en(this,Qr),en(this,Yr),{uri:"/projects/".concat(e)})}}Qr=new WeakMap,Yr=new WeakMap;class on{constructor(e,t){tn(this,Xr,void 0),tn(this,Kr,void 0),rn(this,Xr,e),rn(this,Kr,t)}list(e){const t=!1===(null==e?void 0:e.includeMembers)?"/projects?includeMembers=false":"/projects";return Ge(vr(en(this,Xr),en(this,Kr),{uri:t}))}getById(e){return Ge(vr(en(this,Xr),en(this,Kr),{uri:"/projects/".concat(e)}))}}Xr=new WeakMap,Kr=new WeakMap;var sn,an,cn,un,ln=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)},dn=(e,t,r)=>(ln(e,t,"read from private field"),r?r.call(e):t.get(e)),fn=(e,t,r)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,r)},hn=(e,t,r,n)=>(ln(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r);class pn{constructor(e,t){fn(this,sn,void 0),fn(this,an,void 0),hn(this,sn,e),hn(this,an,t)}getById(e){return vr(dn(this,sn),dn(this,an),{uri:"/users/".concat(e)})}}sn=new WeakMap,an=new WeakMap;class yn{constructor(e,t){fn(this,cn,void 0),fn(this,un,void 0),hn(this,cn,e),hn(this,un,t)}getById(e){return Ge(vr(dn(this,cn),dn(this,un),{uri:"/users/".concat(e)}))}}cn=new WeakMap,un=new WeakMap;var gn,mn,vn,bn,wn=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)},Cn=(e,t,r)=>(wn(e,t,"read from private field"),r?r.call(e):t.get(e)),En=(e,t,r)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,r)},xn=(e,t,r,n)=>(wn(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r);gn=new WeakMap,mn=new WeakMap;let Sn=class e{constructor(e,t=Bt){En(this,gn,void 0),En(this,mn,void 0),this.listen=Fr,this.config(t),xn(this,mn,e),this.assets=new Ar(this,Cn(this,mn)),this.datasets=new Jr(this,Cn(this,mn)),this.projects=new nn(this,Cn(this,mn)),this.users=new pn(this,Cn(this,mn))}clone(){return new e(Cn(this,mn),this.config())}config(e){if(void 0===e)return{...Cn(this,gn)};if(Cn(this,gn)&&!1===Cn(this,gn).allowReconfigure)throw new Error("Existing client instance cannot be reconfigured - use `withConfig(newConfig)` to return a new client");return xn(this,gn,Vt(e,Cn(this,gn)||{})),this}withConfig(t){const r=this.config();return new e(Cn(this,mn),{...r,...t,stega:{...r.stega||{},..."boolean"==typeof(null==t?void 0:t.stega)?{enabled:t.stega}:(null==t?void 0:t.stega)||{}}})}fetch(e,t,r){return cr(this,Cn(this,mn),Cn(this,gn).stega,e,t,r)}getDocument(e,t){return ur(this,Cn(this,mn),e,t)}getDocuments(e,t){return lr(this,Cn(this,mn),e,t)}create(e,t){return gr(this,Cn(this,mn),e,"create",t)}createIfNotExists(e,t){return dr(this,Cn(this,mn),e,t)}createOrReplace(e,t){return fr(this,Cn(this,mn),e,t)}delete(e,t){return hr(this,Cn(this,mn),e,t)}mutate(e,t){return pr(this,Cn(this,mn),e,t)}patch(e,t){return new _t(e,t,this)}transaction(e){return new qt(e,this)}request(e){return vr(this,Cn(this,mn),e)}getUrl(e,t){return wr(this,e,t)}getDataUrl(e,t){return br(this,e,t)}};vn=new WeakMap,bn=new WeakMap;let Tn=class e{constructor(e,t=Bt){En(this,vn,void 0),En(this,bn,void 0),this.listen=Fr,this.config(t),xn(this,bn,e),this.assets=new Ir(this,Cn(this,bn)),this.datasets=new Gr(this,Cn(this,bn)),this.projects=new on(this,Cn(this,bn)),this.users=new yn(this,Cn(this,bn)),this.observable=new Sn(e,t)}clone(){return new e(Cn(this,bn),this.config())}config(e){if(void 0===e)return{...Cn(this,vn)};if(Cn(this,vn)&&!1===Cn(this,vn).allowReconfigure)throw new Error("Existing client instance cannot be reconfigured - use `withConfig(newConfig)` to return a new client");return this.observable&&this.observable.config(e),xn(this,vn,Vt(e,Cn(this,vn)||{})),this}withConfig(t){const r=this.config();return new e(Cn(this,bn),{...r,...t,stega:{...r.stega||{},..."boolean"==typeof(null==t?void 0:t.stega)?{enabled:t.stega}:(null==t?void 0:t.stega)||{}}})}fetch(e,t,r){return Ge(cr(this,Cn(this,bn),Cn(this,vn).stega,e,t,r))}getDocument(e,t){return Ge(ur(this,Cn(this,bn),e,t))}getDocuments(e,t){return Ge(lr(this,Cn(this,bn),e,t))}create(e,t){return Ge(gr(this,Cn(this,bn),e,"create",t))}createIfNotExists(e,t){return Ge(dr(this,Cn(this,bn),e,t))}createOrReplace(e,t){return Ge(fr(this,Cn(this,bn),e,t))}delete(e,t){return Ge(hr(this,Cn(this,bn),e,t))}mutate(e,t){return Ge(pr(this,Cn(this,bn),e,t))}patch(e,t){return new Ot(e,t,this)}transaction(e){return new Ft(e,this)}request(e){return Ge(vr(this,Cn(this,bn),e))}dataRequest(e,t,r){return Ge(yr(this,Cn(this,bn),e,t,r))}getUrl(e,t){return wr(this,e,t)}getDataUrl(e,t){return br(this,e,t)}};const _n=function(e,t){return{requester:ct(e,{}).defaultRequester,createClient:r=>new t(ct(e,{maxRetries:r.maxRetries,retryDelay:r.retryDelay}),r)}}([],Tn),On=_n.requester,jn=_n.createClient,kn=function(e){return function(t){return $t(),e(t)}}(jn),An=/_key\s*==\s*['"](.*)['"]/;function In(e){if(!Array.isArray(e))throw new Error("Path is not an array");return e.reduce(((e,t,r)=>{const n=typeof t;if("number"===n)return"".concat(e,"[").concat(t,"]");if("string"===n){const n=0===r?"":".";return"".concat(e).concat(n).concat(t)}if(function(e){return"string"==typeof e?An.test(e.trim()):"object"==typeof e&&"_key"in e}(t)&&t._key)return"".concat(e,'[_key=="').concat(t._key,'"]');if(Array.isArray(t)){const[r,n]=t;return"".concat(e,"[").concat(r,":").concat(n,"]")}throw new Error("Unsupported path segment `".concat(JSON.stringify(t),"`"))}),"")}const Pn={"\f":"\\f","\n":"\\n","\r":"\\r","\t":"\\t","'":"\\'","\\":"\\\\"},Rn={"\\f":"\f","\\n":"\n","\\r":"\r","\\t":"\t","\\'":"'","\\\\":"\\"};function Mn(e){const t=[],r=/\['(.*?)'\]|\[(\d+)\]|\[\?\(@\._key=='(.*?)'\)\]/g;let n;for(;null!==(n=r.exec(e));)if(void 0===n[1])if(void 0===n[2])if(void 0===n[3]);else{const e=n[3].replace(/\\(\\')/g,(e=>Rn[e]));t.push({_key:e,_index:-1})}else t.push(parseInt(n[2],10));else{const e=n[1].replace(/\\(\\|f|n|r|t|')/g,(e=>Rn[e]));t.push(e)}return t}function Dn(e){return e.map((e=>{if("string"==typeof e)return e;if("number"==typeof e)return e;if(""!==e._key)return{_key:e._key};if(-1!==e._index)return e._index;throw new Error("invalid segment:".concat(JSON.stringify(e)))}))}function Fn(e,t){if(!(null==t?void 0:t.mappings))return;const r=function(e){return"$".concat(e.map((e=>{if("string"==typeof e){const t=e.replace(/[\f\n\r\t'\\]/g,(e=>Pn[e]));return"['".concat(t,"']")}if("number"==typeof e)return"[".concat(e,"]");if(""!==e._key){const t=e._key.replace(/['\\]/g,(e=>Pn[e]));return"[?(@._key=='".concat(t,"')]")}return"[".concat(e._index,"]")})).join(""))}(e.map((e=>{if("string"==typeof e)return e;if("number"==typeof e)return e;if(-1!==e._index)return e._index;throw new Error("invalid segment:".concat(JSON.stringify(e)))})));if(void 0!==t.mappings[r])return{mapping:t.mappings[r],matchedPath:r,pathSuffix:""};const n=Object.entries(t.mappings).filter((([e])=>r.startsWith(e))).sort((([e],[t])=>t.length-e.length));if(0==n.length)return;const[o,i]=n[0];return{mapping:i,matchedPath:o,pathSuffix:r.substring(o.length)}}function qn(e){return"object"==typeof e&&null!==e}function Nn(e,t,r=[]){return function(e){return null!==e&&Array.isArray(e)}(e)?e.map(((e,n)=>{if(qn(e)){const o=e._key;if("string"==typeof o)return Nn(e,t,r.concat({_key:o,_index:n}))}return Nn(e,t,r.concat(n))})):qn(e)?Object.fromEntries(Object.entries(e).map((([e,n])=>[e,Nn(n,t,r.concat(e))]))):t(e,r)}function Un(e,t,r){return Nn(e,((e,n)=>{if("string"!=typeof e)return e;const o=Fn(n,t);if(!o)return e;const{mapping:i,matchedPath:s}=o;if("value"!==i.type)return e;if("documentValue"!==i.source.type)return e;const a=t.documents[i.source.document],c=t.paths[i.source.path],u=Mn(s),l=Mn(c).concat(n.slice(u.length));return r({sourcePath:l,sourceDocument:a,resultPath:n,value:e})}))}const Wn="drafts.";function Hn(e){const{baseUrl:t,workspace:r="default",tool:n="default",id:o,type:i,path:s,projectId:a,dataset:c}=e;if(!t)throw new Error("baseUrl is required");if(!s)throw new Error("path is required");if(!o)throw new Error("id is required");if("/"!==t&&t.endsWith("/"))throw new Error("baseUrl must not end with a slash");const u="default"===r?void 0:r,l="default"===n?void 0:n,d=function(e){return e.startsWith(Wn)?e.slice(Wn.length):e}(o),f=Array.isArray(s)?In(Dn(s)):s,h=new URLSearchParams({baseUrl:t,id:d,type:i,path:f});u&&h.set("workspace",u),l&&h.set("tool",l),a&&h.set("projectId",a),c&&h.set("dataset",c);const p=["/"===t?"":t];u&&p.push(u);const y=["mode=presentation","id=".concat(d),"type=".concat(i),"path=".concat(encodeURIComponent(f))];return l&&y.push("tool=".concat(l)),p.push("intent","edit","".concat(y.join(";"),"?").concat(h)),p.join("/")}const zn=({sourcePath:e,value:t})=>{if(/^\d{4}-\d{2}-\d{2}/.test(r=t)&&Boolean(Date.parse(r))||function(e){try{new URL(e,e.startsWith("/")?"https://acme.com":void 0)}catch{return!1}return!0}(t))return!1;var r;const n=e.at(-1);return("slug"!==e.at(-2)||"current"!==n)&&(("string"!=typeof n||!n.startsWith("_"))&&(("number"!=typeof n||"marks"!==e.at(-2))&&(("href"!==n||"number"!=typeof e.at(-2)||"markDefs"!==e.at(-3))&&("style"!==n&&"listItem"!==n&&(!e.some((e=>"meta"===e||"metadata"===e||"openGraph"===e||"seo"===e))&&("string"!=typeof n||!Ln.has(n)))))))},Ln=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","unit","url","username","variant","website"]);function $n(e,t,r){var n,o,i,s,a,c,u,l,d;const{filter:f,logger:h,enabled:p}=r;if(!p){const o="config.enabled must be true, don't call this function otherwise";throw null==(n=null==h?void 0:h.error)||n.call(h,"[@sanity/client]: ".concat(o),{result:e,resultSourceMap:t,config:r}),new TypeError(o)}if(!t)return null==(o=null==h?void 0:h.error)||o.call(h,"[@sanity/client]: Missing Content Source Map from response body",{result:e,resultSourceMap:t,config:r}),e;if(!r.studioUrl){const n="config.studioUrl must be defined";throw null==(i=null==h?void 0:h.error)||i.call(h,"[@sanity/client]: ".concat(n),{result:e,resultSourceMap:t,config:r}),new TypeError(n)}const y={encoded:[],skipped:[]},g=Un(e,t,(({sourcePath:e,sourceDocument:t,resultPath:n,value:o})=>{if(!1===("function"==typeof f?f({sourcePath:e,resultPath:n,filterDefault:zn,sourceDocument:t,value:o}):zn({sourcePath:e,resultPath:n,filterDefault:zn,sourceDocument:t,value:o})))return h&&y.skipped.push({path:Bn(e),value:"".concat(o.slice(0,20)).concat(o.length>20?"...":""),length:o.length}),o;h&&y.encoded.push({path:Bn(e),value:"".concat(o.slice(0,20)).concat(o.length>20?"...":""),length:o.length});const{baseUrl:i,workspace:s,tool:a}=function(e){let t="string"==typeof e?e:e.baseUrl;return"/"!==t&&(t=t.replace(/\/$/,"")),"string"==typeof e?{baseUrl:t}:{...e,baseUrl:t}}("function"==typeof r.studioUrl?r.studioUrl(t):r.studioUrl);if(!i)return o;const{_id:c,_type:u,_projectId:l,_dataset:d}=t;return Zt(o,{origin:"sanity.io",href:Hn({baseUrl:i,workspace:s,tool:a,id:c,type:u,path:e,...!r.omitCrossDatasetReferenceData&&{dataset:d,projectId:l}})},!1)}));if(h){const e=y.skipped.length,t=y.encoded.length;if((e||t)&&(null==(s=(null==h?void 0:h.groupCollapsed)||h.log)||s("[@sanity/client]: Encoding source map into result"),null==(a=h.log)||a.call(h,"[@sanity/client]: Paths encoded: ".concat(y.encoded.length,", skipped: ").concat(y.skipped.length))),y.encoded.length>0&&(null==(c=null==h?void 0:h.log)||c.call(h,"[@sanity/client]: Table of encoded paths"),null==(u=(null==h?void 0:h.table)||h.log)||u(y.encoded)),y.skipped.length>0){const e=new Set;for(const{path:t}of y.skipped)e.add(t.replace(An,"0").replace(/\[\d+\]/g,"[]"));null==(l=null==h?void 0:h.log)||l.call(h,"[@sanity/client]: List of skipped paths",[...e.values()])}(e||t)&&(null==(d=null==h?void 0:h.groupEnd)||d.call(h))}return g}function Bn(e){return In(Dn(e))}var Jn=Object.freeze({__proto__:null,stegaEncodeSourceMap:$n}),Gn=Object.freeze({__proto__:null,encodeIntoResult:Un,stegaEncodeSourceMap:$n,stegaEncodeSourceMap$1:Jn}),Vn={exports:{}};
|
|
9
9
|
/** @license
|
|
10
10
|
* eventsource.js
|
|
11
11
|
* Available under MIT License (MIT)
|
|
12
12
|
* https://github.com/Yaffle/EventSource/
|
|
13
13
|
*/
|
|
14
|
-
!function(e,t){!function(n){var r=n.setTimeout,o=n.clearTimeout,i=n.XMLHttpRequest,s=n.XDomainRequest,a=n.ActiveXObject,c=n.EventSource,u=n.document,l=n.Promise,d=n.fetch,f=n.Response,h=n.TextDecoder,p=n.TextEncoder,y=n.AbortController;if("undefined"==typeof window||void 0===u||"readyState"in u||null!=u.body||(u.readyState="loading",window.addEventListener("load",(function(e){u.readyState="complete"}),!1)),null==i&&null!=a&&(i=function(){return new a("Microsoft.XMLHTTP")}),null==Object.create&&(Object.create=function(e){function t(){}return t.prototype=e,new t}),Date.now||(Date.now=function(){return(new Date).getTime()}),null==y){var g=d;d=function(e,t){var n=t.signal;return g(e,{headers:t.headers,credentials:t.credentials,cache:t.cache}).then((function(e){var t=e.body.getReader();return n._reader=t,n._aborted&&n._reader.cancel(),{status:e.status,statusText:e.statusText,headers:e.headers,body:{getReader:function(){return t}}}}))},y=function(){this.signal={_reader:null,_aborted:!1},this.abort=function(){null!=this.signal._reader&&this.signal._reader.cancel(),this.signal._aborted=!0}}}function m(){this.bitsNeeded=0,this.codePoint=0}m.prototype.decode=function(e){function t(e,t,n){if(1===n)return e>=128>>t&&e<<t<=2047;if(2===n)return e>=2048>>t&&e<<t<=55295||e>=57344>>t&&e<<t<=65535;if(3===n)return e>=65536>>t&&e<<t<=1114111;throw new Error}function n(e,t){if(6===e)return t>>6>15?3:t>31?2:1;if(12===e)return t>15?3:2;if(18===e)return 3;throw new Error}for(var r=65533,o="",i=this.bitsNeeded,s=this.codePoint,a=0;a<e.length;a+=1){var c=e[a];0!==i&&(c<128||c>191||!t(s<<6|63&c,i-6,n(i,s)))&&(i=0,s=r,o+=String.fromCharCode(s)),0===i?(c>=0&&c<=127?(i=0,s=c):c>=192&&c<=223?(i=6,s=31&c):c>=224&&c<=239?(i=12,s=15&c):c>=240&&c<=247?(i=18,s=7&c):(i=0,s=r),0===i||t(s,i,n(i,s))||(i=0,s=r)):(i-=6,s=s<<6|63&c),0===i&&(s<=65535?o+=String.fromCharCode(s):(o+=String.fromCharCode(55296+(s-65535-1>>10)),o+=String.fromCharCode(56320+(s-65535-1&1023))))}return this.bitsNeeded=i,this.codePoint=s,o};null!=h&&null!=p&&function(){try{return"test"===(new h).decode((new p).encode("test"),{stream:!0})}catch(e){console.debug("TextDecoder does not support streaming option. Using polyfill instead: "+e)}return!1}()||(h=m);var v=function(){};function b(e){this.withCredentials=!1,this.readyState=0,this.status=0,this.statusText="",this.responseText="",this.onprogress=v,this.onload=v,this.onerror=v,this.onreadystatechange=v,this._contentType="",this._xhr=e,this._sendTimeout=0,this._abort=v}function w(e){return e.replace(/[A-Z]/g,(function(e){return String.fromCharCode(e.charCodeAt(0)+32)}))}function C(e){for(var t=Object.create(null),n=e.split("\r\n"),r=0;r<n.length;r+=1){var o=n[r].split(": "),i=o.shift(),s=o.join(": ");t[w(i)]=s}this._map=t}function E(){}function x(e){this._headers=e}function S(){}function T(){this._listeners=Object.create(null)}function _(e){r((function(){throw e}),0)}function O(e){this.type=e,this.target=void 0}function j(e,t){O.call(this,e),this.data=t.data,this.lastEventId=t.lastEventId}function k(e,t){O.call(this,e),this.status=t.status,this.statusText=t.statusText,this.headers=t.headers}function A(e,t){O.call(this,e),this.error=t.error}b.prototype.open=function(e,t){this._abort(!0);var n=this,s=this._xhr,a=1,c=0;this._abort=function(e){0!==n._sendTimeout&&(o(n._sendTimeout),n._sendTimeout=0),1!==a&&2!==a&&3!==a||(a=4,s.onload=v,s.onerror=v,s.onabort=v,s.onprogress=v,s.onreadystatechange=v,s.abort(),0!==c&&(o(c),c=0),e||(n.readyState=4,n.onabort(null),n.onreadystatechange())),a=0};var u=function(){if(1===a){var e=0,t="",r=void 0;if("contentType"in s)e=200,t="OK",r=s.contentType;else try{e=s.status,t=s.statusText,r=s.getResponseHeader("Content-Type")}catch(n){e=0,t="",r=void 0}0!==e&&(a=2,n.readyState=2,n.status=e,n.statusText=t,n._contentType=r,n.onreadystatechange())}},l=function(){if(u(),2===a||3===a){a=3;var e="";try{e=s.responseText}catch(e){}n.readyState=3,n.responseText=e,n.onprogress()}},d=function(e,t){if(null!=t&&null!=t.preventDefault||(t={preventDefault:v}),l(),1===a||2===a||3===a){if(a=4,0!==c&&(o(c),c=0),n.readyState=4,"load"===e)n.onload(t);else if("error"===e)n.onerror(t);else{if("abort"!==e)throw new TypeError;n.onabort(t)}n.onreadystatechange()}},f=function(){c=r((function(){f()}),500),3===s.readyState&&l()};"onload"in s&&(s.onload=function(e){d("load",e)}),"onerror"in s&&(s.onerror=function(e){d("error",e)}),"onabort"in s&&(s.onabort=function(e){d("abort",e)}),"onprogress"in s&&(s.onprogress=l),"onreadystatechange"in s&&(s.onreadystatechange=function(e){!function(e){null!=s&&(4===s.readyState?"onload"in s&&"onerror"in s&&"onabort"in s||d(""===s.responseText?"error":"load",e):3===s.readyState?"onprogress"in s||l():2===s.readyState&&u())}(e)}),!("contentType"in s)&&"ontimeout"in i.prototype||(t+=(-1===t.indexOf("?")?"?":"&")+"padding=true"),s.open(e,t,!0),"readyState"in s&&(c=r((function(){f()}),0))},b.prototype.abort=function(){this._abort(!1)},b.prototype.getResponseHeader=function(e){return this._contentType},b.prototype.setRequestHeader=function(e,t){var n=this._xhr;"setRequestHeader"in n&&n.setRequestHeader(e,t)},b.prototype.getAllResponseHeaders=function(){return null!=this._xhr.getAllResponseHeaders&&this._xhr.getAllResponseHeaders()||""},b.prototype.send=function(){if("ontimeout"in i.prototype&&("sendAsBinary"in i.prototype||"mozAnon"in i.prototype)||null==u||null==u.readyState||"complete"===u.readyState){var e=this._xhr;"withCredentials"in e&&(e.withCredentials=this.withCredentials);try{e.send(void 0)}catch(e){throw e}}else{var t=this;t._sendTimeout=r((function(){t._sendTimeout=0,t.send()}),4)}},C.prototype.get=function(e){return this._map[w(e)]},null!=i&&null==i.HEADERS_RECEIVED&&(i.HEADERS_RECEIVED=2),E.prototype.open=function(e,t,n,r,o,s,a){e.open("GET",o);var c=0;for(var u in e.onprogress=function(){var t=e.responseText.slice(c);c+=t.length,n(t)},e.onerror=function(e){e.preventDefault(),r(new Error("NetworkError"))},e.onload=function(){r(null)},e.onabort=function(){r(null)},e.onreadystatechange=function(){if(e.readyState===i.HEADERS_RECEIVED){var n=e.status,r=e.statusText,o=e.getResponseHeader("Content-Type"),s=e.getAllResponseHeaders();t(n,r,o,new C(s))}},e.withCredentials=s,a)Object.prototype.hasOwnProperty.call(a,u)&&e.setRequestHeader(u,a[u]);return e.send(),e},x.prototype.get=function(e){return this._headers.get(e)},S.prototype.open=function(e,t,n,r,o,i,s){var a=null,c=new y,u=c.signal,f=new h;return d(o,{headers:s,credentials:i?"include":"same-origin",signal:u,cache:"no-store"}).then((function(e){return a=e.body.getReader(),t(e.status,e.statusText,e.headers.get("Content-Type"),new x(e.headers)),new l((function(e,t){var r=function(){a.read().then((function(t){if(t.done)e(void 0);else{var o=f.decode(t.value,{stream:!0});n(o),r()}})).catch((function(e){t(e)}))};r()}))})).catch((function(e){return"AbortError"===e.name?void 0:e})).then((function(e){r(e)})),{abort:function(){null!=a&&a.cancel(),c.abort()}}},T.prototype.dispatchEvent=function(e){e.target=this;var t=this._listeners[e.type];if(null!=t)for(var n=t.length,r=0;r<n;r+=1){var o=t[r];try{"function"==typeof o.handleEvent?o.handleEvent(e):o.call(this,e)}catch(e){_(e)}}},T.prototype.addEventListener=function(e,t){e=String(e);var n=this._listeners,r=n[e];null==r&&(r=[],n[e]=r);for(var o=!1,i=0;i<r.length;i+=1)r[i]===t&&(o=!0);o||r.push(t)},T.prototype.removeEventListener=function(e,t){e=String(e);var n=this._listeners,r=n[e];if(null!=r){for(var o=[],i=0;i<r.length;i+=1)r[i]!==t&&o.push(r[i]);0===o.length?delete n[e]:n[e]=o}},j.prototype=Object.create(O.prototype),k.prototype=Object.create(O.prototype),A.prototype=Object.create(O.prototype);var I=-1,P=0,R=1,M=2,D=-1,F=0,q=1,N=2,U=3,W=/^text\/event\-stream(;.*)?$/i,H=function(e,t){var n=null==e?t:parseInt(e,10);return n!=n&&(n=t),z(n)},z=function(e){return Math.min(Math.max(e,1e3),18e6)},L=function(e,t,n){try{"function"==typeof t&&t.call(e,n)}catch(e){_(e)}};function $(e,t){T.call(this),t=t||{},this.onopen=void 0,this.onmessage=void 0,this.onerror=void 0,this.url=void 0,this.readyState=void 0,this.withCredentials=void 0,this.headers=void 0,this._close=void 0,function(e,t,n){t=String(t);var a=Boolean(n.withCredentials),c=n.lastEventIdQueryParameterName||"lastEventId",u=z(1e3),l=H(n.heartbeatTimeout,45e3),d="",f=u,h=!1,p=0,y=n.headers||{},g=n.Transport,m=B&&null==g?void 0:new b(null!=g?new g:null!=i&&"withCredentials"in i.prototype||null==s?new i:new s),v=null!=g&&"string"!=typeof g?new g:null==m?new S:new E,w=void 0,C=0,x=I,T="",_="",O="",$="",J=F,G=0,V=0,Q=function(t,n,r,o){if(x===P)if(200===t&&null!=r&&W.test(r)){x=R,h=Date.now(),f=u,e.readyState=R;var i=new k("open",{status:t,statusText:n,headers:o});e.dispatchEvent(i),L(e,e.onopen,i)}else{var s="";200!==t?(n&&(n=n.replace(/\s+/g," ")),s="EventSource's response has a status "+t+" "+n+" that is not 200. Aborting the connection."):s="EventSource's response has a Content-Type specifying an unsupported type: "+(null==r?"-":r.replace(/\s+/g," "))+". Aborting the connection.",K();i=new k("error",{status:t,statusText:n,headers:o});e.dispatchEvent(i),L(e,e.onerror,i),console.error(s)}},Y=function(t){if(x===R){for(var n=-1,i=0;i<t.length;i+=1){(c=t.charCodeAt(i))!=="\n".charCodeAt(0)&&c!=="\r".charCodeAt(0)||(n=i)}var s=(-1!==n?$:"")+t.slice(0,n+1);$=(-1===n?$:"")+t.slice(n+1),""!==t&&(h=Date.now(),p+=t.length);for(var a=0;a<s.length;a+=1){var c=s.charCodeAt(a);if(J===D&&c==="\n".charCodeAt(0))J=F;else if(J===D&&(J=F),c==="\r".charCodeAt(0)||c==="\n".charCodeAt(0)){if(J!==F){J===q&&(V=a+1);var y=s.slice(G,V-1),g=s.slice(V+(V<a&&s.charCodeAt(V)===" ".charCodeAt(0)?1:0),a);"data"===y?(T+="\n",T+=g):"id"===y?_=g:"event"===y?O=g:"retry"===y?(u=H(g,u),f=u):"heartbeatTimeout"===y&&(l=H(g,l),0!==C&&(o(C),C=r((function(){Z()}),l)))}if(J===F){if(""!==T){d=_,""===O&&(O="message");var m=new j(O,{data:T.slice(1),lastEventId:_});if(e.dispatchEvent(m),"open"===O?L(e,e.onopen,m):"message"===O?L(e,e.onmessage,m):"error"===O&&L(e,e.onerror,m),x===M)return}T="",O=""}J=c==="\r".charCodeAt(0)?D:F}else J===F&&(G=a,J=q),J===q?c===":".charCodeAt(0)&&(V=a+1,J=N):J===N&&(J=U)}}},X=function(t){if(x===R||x===P){x=I,0!==C&&(o(C),C=0),C=r((function(){Z()}),f),f=z(Math.min(16*u,2*f)),e.readyState=P;var n=new A("error",{error:t});e.dispatchEvent(n),L(e,e.onerror,n),null!=t&&console.error(t)}},K=function(){x=M,null!=w&&(w.abort(),w=void 0),0!==C&&(o(C),C=0),e.readyState=M},Z=function(){if(C=0,x===I){h=!1,p=0,C=r((function(){Z()}),l),x=P,T="",O="",_=d,$="",G=0,V=0,J=F;var n=t;if("data:"!==t.slice(0,5)&&"blob:"!==t.slice(0,5)&&""!==d){var o=t.indexOf("?");n=-1===o?t:t.slice(0,o+1)+t.slice(o+1).replace(/(?:^|&)([^=&]*)(?:=[^&]*)?/g,(function(e,t){return t===c?"":e})),n+=(-1===t.indexOf("?")?"?":"&")+c+"="+encodeURIComponent(d)}var i=e.withCredentials,s={Accept:"text/event-stream"},a=e.headers;if(null!=a)for(var u in a)Object.prototype.hasOwnProperty.call(a,u)&&(s[u]=a[u]);try{w=v.open(m,Q,Y,X,n,i,s)}catch(e){throw K(),e}}else if(h||null==w){var f=Math.max((h||Date.now())+l-Date.now(),1);h=!1,C=r((function(){Z()}),f)}else X(new Error("No activity within "+l+" milliseconds. "+(x===P?"No response received.":p+" chars received.")+" Reconnecting.")),null!=w&&(w.abort(),w=void 0)};e.url=t,e.readyState=P,e.withCredentials=a,e.headers=y,e._close=K,Z()}(this,e,t)}var B=null!=d&&null!=f&&"body"in f.prototype;$.prototype=Object.create(T.prototype),$.prototype.CONNECTING=P,$.prototype.OPEN=R,$.prototype.CLOSED=M,$.prototype.close=function(){this._close()},$.CONNECTING=P,$.OPEN=R,$.CLOSED=M,$.prototype.withCredentials=void 0;var J,G=c;null==i||null!=c&&"withCredentials"in c.prototype||(G=$),J=function(e){e.EventSourcePolyfill=$,e.NativeEventSource=c,e.EventSource=G}(t),void 0!==J&&(e.exports=J)}("undefined"==typeof globalThis?"undefined"!=typeof window?window:"undefined"!=typeof self?self:s:globalThis)}(Vr,Vr.exports);var Qr=a(Vr.exports.EventSourcePolyfill),Yr=Object.freeze({__proto__:null,default:Qr});e.BasePatch=Tt,e.BaseTransaction=Dt,e.ClientError=tt,e.ObservablePatch=_t,e.ObservableSanityClient=Sr,e.ObservableTransaction=qt,e.Patch=Ot,e.SanityClient=Tr,e.ServerError=nt,e.Transaction=Ft,e.createClient=jr,e.default=kr,e.requester=Or,e.unstable__adapter=T,e.unstable__environment="browser",Object.defineProperty(e,"__esModule",{value:!0})}));
|
|
14
|
+
!function(e,t){!function(r){var n=r.setTimeout,o=r.clearTimeout,i=r.XMLHttpRequest,s=r.XDomainRequest,a=r.ActiveXObject,c=r.EventSource,u=r.document,l=r.Promise,d=r.fetch,f=r.Response,h=r.TextDecoder,p=r.TextEncoder,y=r.AbortController;if("undefined"==typeof window||void 0===u||"readyState"in u||null!=u.body||(u.readyState="loading",window.addEventListener("load",(function(e){u.readyState="complete"}),!1)),null==i&&null!=a&&(i=function(){return new a("Microsoft.XMLHTTP")}),null==Object.create&&(Object.create=function(e){function t(){}return t.prototype=e,new t}),Date.now||(Date.now=function(){return(new Date).getTime()}),null==y){var g=d;d=function(e,t){var r=t.signal;return g(e,{headers:t.headers,credentials:t.credentials,cache:t.cache}).then((function(e){var t=e.body.getReader();return r._reader=t,r._aborted&&r._reader.cancel(),{status:e.status,statusText:e.statusText,headers:e.headers,body:{getReader:function(){return t}}}}))},y=function(){this.signal={_reader:null,_aborted:!1},this.abort=function(){null!=this.signal._reader&&this.signal._reader.cancel(),this.signal._aborted=!0}}}function m(){this.bitsNeeded=0,this.codePoint=0}m.prototype.decode=function(e){function t(e,t,r){if(1===r)return e>=128>>t&&e<<t<=2047;if(2===r)return e>=2048>>t&&e<<t<=55295||e>=57344>>t&&e<<t<=65535;if(3===r)return e>=65536>>t&&e<<t<=1114111;throw new Error}function r(e,t){if(6===e)return t>>6>15?3:t>31?2:1;if(12===e)return t>15?3:2;if(18===e)return 3;throw new Error}for(var n=65533,o="",i=this.bitsNeeded,s=this.codePoint,a=0;a<e.length;a+=1){var c=e[a];0!==i&&(c<128||c>191||!t(s<<6|63&c,i-6,r(i,s)))&&(i=0,s=n,o+=String.fromCharCode(s)),0===i?(c>=0&&c<=127?(i=0,s=c):c>=192&&c<=223?(i=6,s=31&c):c>=224&&c<=239?(i=12,s=15&c):c>=240&&c<=247?(i=18,s=7&c):(i=0,s=n),0===i||t(s,i,r(i,s))||(i=0,s=n)):(i-=6,s=s<<6|63&c),0===i&&(s<=65535?o+=String.fromCharCode(s):(o+=String.fromCharCode(55296+(s-65535-1>>10)),o+=String.fromCharCode(56320+(s-65535-1&1023))))}return this.bitsNeeded=i,this.codePoint=s,o};null!=h&&null!=p&&function(){try{return"test"===(new h).decode((new p).encode("test"),{stream:!0})}catch(e){console.debug("TextDecoder does not support streaming option. Using polyfill instead: "+e)}return!1}()||(h=m);var v=function(){};function b(e){this.withCredentials=!1,this.readyState=0,this.status=0,this.statusText="",this.responseText="",this.onprogress=v,this.onload=v,this.onerror=v,this.onreadystatechange=v,this._contentType="",this._xhr=e,this._sendTimeout=0,this._abort=v}function w(e){return e.replace(/[A-Z]/g,(function(e){return String.fromCharCode(e.charCodeAt(0)+32)}))}function C(e){for(var t=Object.create(null),r=e.split("\r\n"),n=0;n<r.length;n+=1){var o=r[n].split(": "),i=o.shift(),s=o.join(": ");t[w(i)]=s}this._map=t}function E(){}function x(e){this._headers=e}function S(){}function T(){this._listeners=Object.create(null)}function _(e){n((function(){throw e}),0)}function O(e){this.type=e,this.target=void 0}function j(e,t){O.call(this,e),this.data=t.data,this.lastEventId=t.lastEventId}function k(e,t){O.call(this,e),this.status=t.status,this.statusText=t.statusText,this.headers=t.headers}function A(e,t){O.call(this,e),this.error=t.error}b.prototype.open=function(e,t){this._abort(!0);var r=this,s=this._xhr,a=1,c=0;this._abort=function(e){0!==r._sendTimeout&&(o(r._sendTimeout),r._sendTimeout=0),1!==a&&2!==a&&3!==a||(a=4,s.onload=v,s.onerror=v,s.onabort=v,s.onprogress=v,s.onreadystatechange=v,s.abort(),0!==c&&(o(c),c=0),e||(r.readyState=4,r.onabort(null),r.onreadystatechange())),a=0};var u=function(){if(1===a){var e=0,t="",n=void 0;if("contentType"in s)e=200,t="OK",n=s.contentType;else try{e=s.status,t=s.statusText,n=s.getResponseHeader("Content-Type")}catch(r){e=0,t="",n=void 0}0!==e&&(a=2,r.readyState=2,r.status=e,r.statusText=t,r._contentType=n,r.onreadystatechange())}},l=function(){if(u(),2===a||3===a){a=3;var e="";try{e=s.responseText}catch(e){}r.readyState=3,r.responseText=e,r.onprogress()}},d=function(e,t){if(null!=t&&null!=t.preventDefault||(t={preventDefault:v}),l(),1===a||2===a||3===a){if(a=4,0!==c&&(o(c),c=0),r.readyState=4,"load"===e)r.onload(t);else if("error"===e)r.onerror(t);else{if("abort"!==e)throw new TypeError;r.onabort(t)}r.onreadystatechange()}},f=function(){c=n((function(){f()}),500),3===s.readyState&&l()};"onload"in s&&(s.onload=function(e){d("load",e)}),"onerror"in s&&(s.onerror=function(e){d("error",e)}),"onabort"in s&&(s.onabort=function(e){d("abort",e)}),"onprogress"in s&&(s.onprogress=l),"onreadystatechange"in s&&(s.onreadystatechange=function(e){!function(e){null!=s&&(4===s.readyState?"onload"in s&&"onerror"in s&&"onabort"in s||d(""===s.responseText?"error":"load",e):3===s.readyState?"onprogress"in s||l():2===s.readyState&&u())}(e)}),!("contentType"in s)&&"ontimeout"in i.prototype||(t+=(-1===t.indexOf("?")?"?":"&")+"padding=true"),s.open(e,t,!0),"readyState"in s&&(c=n((function(){f()}),0))},b.prototype.abort=function(){this._abort(!1)},b.prototype.getResponseHeader=function(e){return this._contentType},b.prototype.setRequestHeader=function(e,t){var r=this._xhr;"setRequestHeader"in r&&r.setRequestHeader(e,t)},b.prototype.getAllResponseHeaders=function(){return null!=this._xhr.getAllResponseHeaders&&this._xhr.getAllResponseHeaders()||""},b.prototype.send=function(){if("ontimeout"in i.prototype&&("sendAsBinary"in i.prototype||"mozAnon"in i.prototype)||null==u||null==u.readyState||"complete"===u.readyState){var e=this._xhr;"withCredentials"in e&&(e.withCredentials=this.withCredentials);try{e.send(void 0)}catch(e){throw e}}else{var t=this;t._sendTimeout=n((function(){t._sendTimeout=0,t.send()}),4)}},C.prototype.get=function(e){return this._map[w(e)]},null!=i&&null==i.HEADERS_RECEIVED&&(i.HEADERS_RECEIVED=2),E.prototype.open=function(e,t,r,n,o,s,a){e.open("GET",o);var c=0;for(var u in e.onprogress=function(){var t=e.responseText.slice(c);c+=t.length,r(t)},e.onerror=function(e){e.preventDefault(),n(new Error("NetworkError"))},e.onload=function(){n(null)},e.onabort=function(){n(null)},e.onreadystatechange=function(){if(e.readyState===i.HEADERS_RECEIVED){var r=e.status,n=e.statusText,o=e.getResponseHeader("Content-Type"),s=e.getAllResponseHeaders();t(r,n,o,new C(s))}},e.withCredentials=s,a)Object.prototype.hasOwnProperty.call(a,u)&&e.setRequestHeader(u,a[u]);return e.send(),e},x.prototype.get=function(e){return this._headers.get(e)},S.prototype.open=function(e,t,r,n,o,i,s){var a=null,c=new y,u=c.signal,f=new h;return d(o,{headers:s,credentials:i?"include":"same-origin",signal:u,cache:"no-store"}).then((function(e){return a=e.body.getReader(),t(e.status,e.statusText,e.headers.get("Content-Type"),new x(e.headers)),new l((function(e,t){var n=function(){a.read().then((function(t){if(t.done)e(void 0);else{var o=f.decode(t.value,{stream:!0});r(o),n()}})).catch((function(e){t(e)}))};n()}))})).catch((function(e){return"AbortError"===e.name?void 0:e})).then((function(e){n(e)})),{abort:function(){null!=a&&a.cancel(),c.abort()}}},T.prototype.dispatchEvent=function(e){e.target=this;var t=this._listeners[e.type];if(null!=t)for(var r=t.length,n=0;n<r;n+=1){var o=t[n];try{"function"==typeof o.handleEvent?o.handleEvent(e):o.call(this,e)}catch(e){_(e)}}},T.prototype.addEventListener=function(e,t){e=String(e);var r=this._listeners,n=r[e];null==n&&(n=[],r[e]=n);for(var o=!1,i=0;i<n.length;i+=1)n[i]===t&&(o=!0);o||n.push(t)},T.prototype.removeEventListener=function(e,t){e=String(e);var r=this._listeners,n=r[e];if(null!=n){for(var o=[],i=0;i<n.length;i+=1)n[i]!==t&&o.push(n[i]);0===o.length?delete r[e]:r[e]=o}},j.prototype=Object.create(O.prototype),k.prototype=Object.create(O.prototype),A.prototype=Object.create(O.prototype);var I=-1,P=0,R=1,M=2,D=-1,F=0,q=1,N=2,U=3,W=/^text\/event\-stream(;.*)?$/i,H=function(e,t){var r=null==e?t:parseInt(e,10);return r!=r&&(r=t),z(r)},z=function(e){return Math.min(Math.max(e,1e3),18e6)},L=function(e,t,r){try{"function"==typeof t&&t.call(e,r)}catch(e){_(e)}};function $(e,t){T.call(this),t=t||{},this.onopen=void 0,this.onmessage=void 0,this.onerror=void 0,this.url=void 0,this.readyState=void 0,this.withCredentials=void 0,this.headers=void 0,this._close=void 0,function(e,t,r){t=String(t);var a=Boolean(r.withCredentials),c=r.lastEventIdQueryParameterName||"lastEventId",u=z(1e3),l=H(r.heartbeatTimeout,45e3),d="",f=u,h=!1,p=0,y=r.headers||{},g=r.Transport,m=B&&null==g?void 0:new b(null!=g?new g:null!=i&&"withCredentials"in i.prototype||null==s?new i:new s),v=null!=g&&"string"!=typeof g?new g:null==m?new S:new E,w=void 0,C=0,x=I,T="",_="",O="",$="",J=F,G=0,V=0,Q=function(t,r,n,o){if(x===P)if(200===t&&null!=n&&W.test(n)){x=R,h=Date.now(),f=u,e.readyState=R;var i=new k("open",{status:t,statusText:r,headers:o});e.dispatchEvent(i),L(e,e.onopen,i)}else{var s="";200!==t?(r&&(r=r.replace(/\s+/g," ")),s="EventSource's response has a status "+t+" "+r+" that is not 200. Aborting the connection."):s="EventSource's response has a Content-Type specifying an unsupported type: "+(null==n?"-":n.replace(/\s+/g," "))+". Aborting the connection.",K();i=new k("error",{status:t,statusText:r,headers:o});e.dispatchEvent(i),L(e,e.onerror,i),console.error(s)}},Y=function(t){if(x===R){for(var r=-1,i=0;i<t.length;i+=1){(c=t.charCodeAt(i))!=="\n".charCodeAt(0)&&c!=="\r".charCodeAt(0)||(r=i)}var s=(-1!==r?$:"")+t.slice(0,r+1);$=(-1===r?$:"")+t.slice(r+1),""!==t&&(h=Date.now(),p+=t.length);for(var a=0;a<s.length;a+=1){var c=s.charCodeAt(a);if(J===D&&c==="\n".charCodeAt(0))J=F;else if(J===D&&(J=F),c==="\r".charCodeAt(0)||c==="\n".charCodeAt(0)){if(J!==F){J===q&&(V=a+1);var y=s.slice(G,V-1),g=s.slice(V+(V<a&&s.charCodeAt(V)===" ".charCodeAt(0)?1:0),a);"data"===y?(T+="\n",T+=g):"id"===y?_=g:"event"===y?O=g:"retry"===y?(u=H(g,u),f=u):"heartbeatTimeout"===y&&(l=H(g,l),0!==C&&(o(C),C=n((function(){Z()}),l)))}if(J===F){if(""!==T){d=_,""===O&&(O="message");var m=new j(O,{data:T.slice(1),lastEventId:_});if(e.dispatchEvent(m),"open"===O?L(e,e.onopen,m):"message"===O?L(e,e.onmessage,m):"error"===O&&L(e,e.onerror,m),x===M)return}T="",O=""}J=c==="\r".charCodeAt(0)?D:F}else J===F&&(G=a,J=q),J===q?c===":".charCodeAt(0)&&(V=a+1,J=N):J===N&&(J=U)}}},X=function(t){if(x===R||x===P){x=I,0!==C&&(o(C),C=0),C=n((function(){Z()}),f),f=z(Math.min(16*u,2*f)),e.readyState=P;var r=new A("error",{error:t});e.dispatchEvent(r),L(e,e.onerror,r),null!=t&&console.error(t)}},K=function(){x=M,null!=w&&(w.abort(),w=void 0),0!==C&&(o(C),C=0),e.readyState=M},Z=function(){if(C=0,x===I){h=!1,p=0,C=n((function(){Z()}),l),x=P,T="",O="",_=d,$="",G=0,V=0,J=F;var r=t;if("data:"!==t.slice(0,5)&&"blob:"!==t.slice(0,5)&&""!==d){var o=t.indexOf("?");r=-1===o?t:t.slice(0,o+1)+t.slice(o+1).replace(/(?:^|&)([^=&]*)(?:=[^&]*)?/g,(function(e,t){return t===c?"":e})),r+=(-1===t.indexOf("?")?"?":"&")+c+"="+encodeURIComponent(d)}var i=e.withCredentials,s={Accept:"text/event-stream"},a=e.headers;if(null!=a)for(var u in a)Object.prototype.hasOwnProperty.call(a,u)&&(s[u]=a[u]);try{w=v.open(m,Q,Y,X,r,i,s)}catch(e){throw K(),e}}else if(h||null==w){var f=Math.max((h||Date.now())+l-Date.now(),1);h=!1,C=n((function(){Z()}),f)}else X(new Error("No activity within "+l+" milliseconds. "+(x===P?"No response received.":p+" chars received.")+" Reconnecting.")),null!=w&&(w.abort(),w=void 0)};e.url=t,e.readyState=P,e.withCredentials=a,e.headers=y,e._close=K,Z()}(this,e,t)}var B=null!=d&&null!=f&&"body"in f.prototype;$.prototype=Object.create(T.prototype),$.prototype.CONNECTING=P,$.prototype.OPEN=R,$.prototype.CLOSED=M,$.prototype.close=function(){this._close()},$.CONNECTING=P,$.OPEN=R,$.CLOSED=M,$.prototype.withCredentials=void 0;var J,G=c;null==i||null!=c&&"withCredentials"in c.prototype||(G=$),J=function(e){e.EventSourcePolyfill=$,e.NativeEventSource=c,e.EventSource=G}(t),void 0!==J&&(e.exports=J)}("undefined"==typeof globalThis?"undefined"!=typeof window?window:"undefined"!=typeof self?self:s:globalThis)}(Vn,Vn.exports);var Qn=a(Vn.exports.EventSourcePolyfill),Yn=Object.freeze({__proto__:null,default:Qn});e.BasePatch=Tt,e.BaseTransaction=Dt,e.ClientError=tt,e.ObservablePatch=_t,e.ObservableSanityClient=Sn,e.ObservableTransaction=qt,e.Patch=Ot,e.SanityClient=Tn,e.ServerError=rt,e.Transaction=Ft,e.createClient=jn,e.default=kn,e.requester=On,e.unstable__adapter=T,e.unstable__environment="browser",Object.defineProperty(e,"__esModule",{value:!0})}));
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"resolveEditInfo-BC6qdqZw.js","sources":["../../src/csm/studioPath.ts","../../src/csm/getPublishedId.ts","../../src/csm/jsonPath.ts","../../src/csm/resolveMapping.ts","../../src/csm/isArray.ts","../../src/csm/isRecord.ts","../../src/csm/walkMap.ts","../../src/csm/createEditUrl.ts","../../src/csm/resolveEditInfo.ts"],"sourcesContent":["/** @alpha */\nexport type KeyedSegment = {_key: string}\n\n/** @alpha */\nexport type IndexTuple = [number | '', number | '']\n\n/** @alpha */\nexport type PathSegment = string | number | KeyedSegment | IndexTuple\n\n/** @alpha */\nexport type Path = PathSegment[]\n\nconst rePropName =\n /[^.[\\]]+|\\[(?:(-?\\d+(?:\\.\\d+)?)|([\"'])((?:(?!\\2)[^\\\\]|\\\\.)*?)\\2)\\]|(?=(?:\\.|\\[\\])(?:\\.|\\[\\]|$))/g\n/** @internal */\nexport const reKeySegment = /_key\\s*==\\s*['\"](.*)['\"]/\nconst reIndexTuple = /^\\d*:\\d*$/\n\n/** @internal */\nexport function isIndexSegment(segment: PathSegment): segment is number {\n return typeof segment === 'number' || (typeof segment === 'string' && /^\\[\\d+\\]$/.test(segment))\n}\n\n/** @internal */\nexport function isKeySegment(segment: PathSegment): segment is KeyedSegment {\n if (typeof segment === 'string') {\n return reKeySegment.test(segment.trim())\n }\n\n return typeof segment === 'object' && '_key' in segment\n}\n\n/** @internal */\nexport function isIndexTuple(segment: PathSegment): segment is IndexTuple {\n if (typeof segment === 'string' && reIndexTuple.test(segment)) {\n return true\n }\n\n if (!Array.isArray(segment) || segment.length !== 2) {\n return false\n }\n\n const [from, to] = segment\n return (typeof from === 'number' || from === '') && (typeof to === 'number' || to === '')\n}\n\n/** @internal */\nexport function get<Result = unknown, Fallback = unknown>(\n obj: unknown,\n path: Path | string,\n defaultVal?: Fallback,\n): Result | typeof defaultVal {\n const select = typeof path === 'string' ? fromString(path) : path\n if (!Array.isArray(select)) {\n throw new Error('Path must be an array or a string')\n }\n\n let acc: unknown | undefined = obj\n for (let i = 0; i < select.length; i++) {\n const segment = select[i]\n if (isIndexSegment(segment)) {\n if (!Array.isArray(acc)) {\n return defaultVal\n }\n\n acc = acc[segment]\n }\n\n if (isKeySegment(segment)) {\n if (!Array.isArray(acc)) {\n return defaultVal\n }\n\n acc = acc.find((item) => item._key === segment._key)\n }\n\n if (typeof segment === 'string') {\n acc =\n typeof acc === 'object' && acc !== null\n ? ((acc as Record<string, unknown>)[segment] as Result)\n : undefined\n }\n\n if (typeof acc === 'undefined') {\n return defaultVal\n }\n }\n\n return acc as Result\n}\n\n/** @alpha */\nexport function toString(path: Path): string {\n if (!Array.isArray(path)) {\n throw new Error('Path is not an array')\n }\n\n return path.reduce<string>((target, segment, i) => {\n const segmentType = typeof segment\n if (segmentType === 'number') {\n return `${target}[${segment}]`\n }\n\n if (segmentType === 'string') {\n const separator = i === 0 ? '' : '.'\n return `${target}${separator}${segment}`\n }\n\n if (isKeySegment(segment) && segment._key) {\n return `${target}[_key==\"${segment._key}\"]`\n }\n\n if (Array.isArray(segment)) {\n const [from, to] = segment\n return `${target}[${from}:${to}]`\n }\n\n throw new Error(`Unsupported path segment \\`${JSON.stringify(segment)}\\``)\n }, '')\n}\n\n/** @alpha */\nexport function fromString(path: string): Path {\n if (typeof path !== 'string') {\n throw new Error('Path is not a string')\n }\n\n const segments = path.match(rePropName)\n if (!segments) {\n throw new Error('Invalid path string')\n }\n\n return segments.map(parsePathSegment)\n}\n\nfunction parsePathSegment(segment: string): PathSegment {\n if (isIndexSegment(segment)) {\n return parseIndexSegment(segment)\n }\n\n if (isKeySegment(segment)) {\n return parseKeySegment(segment)\n }\n\n if (isIndexTuple(segment)) {\n return parseIndexTupleSegment(segment)\n }\n\n return segment\n}\n\nfunction parseIndexSegment(segment: string): PathSegment {\n return Number(segment.replace(/[^\\d]/g, ''))\n}\n\nfunction parseKeySegment(segment: string): KeyedSegment {\n const segments = segment.match(reKeySegment)\n return {_key: segments![1]}\n}\n\nfunction parseIndexTupleSegment(segment: string): IndexTuple {\n const [from, to] = segment.split(':').map((seg) => (seg === '' ? seg : Number(seg)))\n return [from, to]\n}\n","export const DRAFTS_PREFIX = 'drafts.'\n\n/** @internal */\nexport function getPublishedId(id: string): string {\n if (id.startsWith(DRAFTS_PREFIX)) {\n return id.slice(DRAFTS_PREFIX.length)\n }\n\n return id\n}\n","import * as studioPath from './studioPath'\nimport type {\n ContentSourceMapParsedPath,\n ContentSourceMapParsedPathKeyedSegment,\n ContentSourceMapPaths,\n Path,\n} from './types'\n\nconst ESCAPE: Record<string, string> = {\n '\\f': '\\\\f',\n '\\n': '\\\\n',\n '\\r': '\\\\r',\n '\\t': '\\\\t',\n \"'\": \"\\\\'\",\n '\\\\': '\\\\\\\\',\n}\n\nconst UNESCAPE: Record<string, string> = {\n '\\\\f': '\\f',\n '\\\\n': '\\n',\n '\\\\r': '\\r',\n '\\\\t': '\\t',\n \"\\\\'\": \"'\",\n '\\\\\\\\': '\\\\',\n}\n\n/**\n * @internal\n */\nexport function jsonPath(path: ContentSourceMapParsedPath): ContentSourceMapPaths[number] {\n return `$${path\n .map((segment) => {\n if (typeof segment === 'string') {\n const escapedKey = segment.replace(/[\\f\\n\\r\\t'\\\\]/g, (match) => {\n return ESCAPE[match]\n })\n return `['${escapedKey}']`\n }\n\n if (typeof segment === 'number') {\n return `[${segment}]`\n }\n\n if (segment._key !== '') {\n const escapedKey = segment._key.replace(/['\\\\]/g, (match) => {\n return ESCAPE[match]\n })\n return `[?(@._key=='${escapedKey}')]`\n }\n\n return `[${segment._index}]`\n })\n .join('')}`\n}\n\n/**\n * @internal\n */\nexport function parseJsonPath(path: ContentSourceMapPaths[number]): ContentSourceMapParsedPath {\n const parsed: ContentSourceMapParsedPath = []\n\n const parseRe = /\\['(.*?)'\\]|\\[(\\d+)\\]|\\[\\?\\(@\\._key=='(.*?)'\\)\\]/g\n let match: RegExpExecArray | null\n\n while ((match = parseRe.exec(path)) !== null) {\n if (match[1] !== undefined) {\n const key = match[1].replace(/\\\\(\\\\|f|n|r|t|')/g, (m) => {\n return UNESCAPE[m]\n })\n\n parsed.push(key)\n continue\n }\n\n if (match[2] !== undefined) {\n parsed.push(parseInt(match[2], 10))\n continue\n }\n\n if (match[3] !== undefined) {\n const _key = match[3].replace(/\\\\(\\\\')/g, (m) => {\n return UNESCAPE[m]\n })\n\n parsed.push({\n _key,\n _index: -1,\n })\n continue\n }\n }\n\n return parsed\n}\n\n/**\n * @internal\n */\nexport function jsonPathToStudioPath(path: ContentSourceMapParsedPath): Path {\n return path.map((segment) => {\n if (typeof segment === 'string') {\n return segment\n }\n\n if (typeof segment === 'number') {\n return segment\n }\n\n if (segment._key !== '') {\n return {_key: segment._key}\n }\n\n if (segment._index !== -1) {\n return segment._index\n }\n\n throw new Error(`invalid segment:${JSON.stringify(segment)}`)\n })\n}\n\n/**\n * @internal\n */\nexport function studioPathToJsonPath(path: Path | string): ContentSourceMapParsedPath {\n const parsedPath = typeof path === 'string' ? studioPath.fromString(path) : path\n\n return parsedPath.map((segment) => {\n if (typeof segment === 'string') {\n return segment\n }\n\n if (typeof segment === 'number') {\n return segment\n }\n\n if (Array.isArray(segment)) {\n throw new Error(`IndexTuple segments aren't supported:${JSON.stringify(segment)}`)\n }\n\n if (isContentSourceMapParsedPathKeyedSegment(segment)) {\n return segment\n }\n\n if (segment._key) {\n return {_key: segment._key, _index: -1}\n }\n\n throw new Error(`invalid segment:${JSON.stringify(segment)}`)\n })\n}\n\nfunction isContentSourceMapParsedPathKeyedSegment(\n segment: studioPath.PathSegment | ContentSourceMapParsedPath[number],\n): segment is ContentSourceMapParsedPathKeyedSegment {\n return typeof segment === 'object' && '_key' in segment && '_index' in segment\n}\n\n/**\n * @internal\n */\nexport function jsonPathToMappingPath(path: ContentSourceMapParsedPath): (string | number)[] {\n return path.map((segment) => {\n if (typeof segment === 'string') {\n return segment\n }\n\n if (typeof segment === 'number') {\n return segment\n }\n\n if (segment._index !== -1) {\n return segment._index\n }\n\n throw new Error(`invalid segment:${JSON.stringify(segment)}`)\n })\n}\n","import {jsonPath, jsonPathToMappingPath} from './jsonPath'\nimport type {ContentSourceMap, ContentSourceMapMapping, ContentSourceMapParsedPath} from './types'\n\n/**\n * @internal\n */\nexport function resolveMapping(\n resultPath: ContentSourceMapParsedPath,\n csm?: ContentSourceMap,\n):\n | {\n mapping: ContentSourceMapMapping\n matchedPath: string\n pathSuffix: string\n }\n | undefined {\n if (!csm?.mappings) {\n return undefined\n }\n const resultMappingPath = jsonPath(jsonPathToMappingPath(resultPath))\n\n if (csm.mappings[resultMappingPath] !== undefined) {\n return {\n mapping: csm.mappings[resultMappingPath],\n matchedPath: resultMappingPath,\n pathSuffix: '',\n }\n }\n\n const mappings = Object.entries(csm.mappings)\n .filter(([key]) => resultMappingPath.startsWith(key))\n .sort(([key1], [key2]) => key2.length - key1.length)\n\n if (mappings.length == 0) {\n return undefined\n }\n\n const [matchedPath, mapping] = mappings[0]\n const pathSuffix = resultMappingPath.substring(matchedPath.length)\n return {mapping, matchedPath, pathSuffix}\n}\n","/** @internal */\nexport function isArray(value: unknown): value is Array<unknown> {\n return value !== null && Array.isArray(value)\n}\n","/** @internal */\nexport function isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' && value !== null\n}\n","import {isArray} from './isArray'\nimport {isRecord} from './isRecord'\nimport type {ContentSourceMapParsedPath, WalkMapFn} from './types'\n\n/**\n * generic way to walk a nested object or array and apply a mapping function to each value\n * @internal\n */\nexport function walkMap(\n value: unknown,\n mappingFn: WalkMapFn,\n path: ContentSourceMapParsedPath = [],\n): unknown {\n if (isArray(value)) {\n return value.map((v, idx) => {\n if (isRecord(v)) {\n const _key = v['_key']\n if (typeof _key === 'string') {\n return walkMap(v, mappingFn, path.concat({_key, _index: idx}))\n }\n }\n\n return walkMap(v, mappingFn, path.concat(idx))\n })\n }\n\n if (isRecord(value)) {\n return Object.fromEntries(\n Object.entries(value).map(([k, v]) => [k, walkMap(v, mappingFn, path.concat(k))]),\n )\n }\n\n return mappingFn(value, path)\n}\n","import {getPublishedId} from './getPublishedId'\nimport {jsonPathToStudioPath} from './jsonPath'\nimport * as studioPath from './studioPath'\nimport type {CreateEditUrlOptions, EditIntentUrl, StudioBaseUrl} from './types'\n\n/** @internal */\nexport function createEditUrl(options: CreateEditUrlOptions): `${StudioBaseUrl}${EditIntentUrl}` {\n const {\n baseUrl,\n workspace: _workspace = 'default',\n tool: _tool = 'default',\n id: _id,\n type,\n path,\n } = options\n\n if (!baseUrl) {\n throw new Error('baseUrl is required')\n }\n if (!path) {\n throw new Error('path is required')\n }\n if (!_id) {\n throw new Error('id is required')\n }\n if (baseUrl !== '/' && baseUrl.endsWith('/')) {\n throw new Error('baseUrl must not end with a slash')\n }\n\n const workspace = _workspace === 'default' ? undefined : _workspace\n const tool = _tool === 'default' ? undefined : _tool\n // eslint-disable-next-line no-warning-comments\n // @TODO allow passing draft prefixed IDs, to better open the right perspective mode\n const id = getPublishedId(_id)\n const stringifiedPath = Array.isArray(path)\n ? studioPath.toString(jsonPathToStudioPath(path))\n : path\n\n // eslint-disable-next-line no-warning-comments\n // @TODO Using searchParams as a temporary workaround until `@sanity/overlays` can decode state from the path reliably\n const searchParams = new URLSearchParams({\n baseUrl,\n id,\n type,\n path: stringifiedPath,\n })\n if (workspace) {\n searchParams.set('workspace', workspace)\n }\n if (tool) {\n searchParams.set('tool', tool)\n }\n\n const segments = [baseUrl === '/' ? '' : baseUrl]\n if (workspace) {\n segments.push(workspace)\n }\n const routerParams = [\n 'mode=presentation',\n `id=${id}`,\n `type=${type}`,\n `path=${encodeURIComponent(stringifiedPath)}`,\n ]\n if (tool) {\n routerParams.push(`tool=${tool}`)\n }\n segments.push('intent', 'edit', `${routerParams.join(';')}?${searchParams}`)\n return segments.join('/') as unknown as `${StudioBaseUrl}${EditIntentUrl}`\n}\n","import {parseJsonPath} from './jsonPath'\nimport {resolveMapping} from './resolveMapping'\nimport type {\n CreateEditUrlOptions,\n ResolveEditInfoOptions,\n StudioBaseRoute,\n StudioBaseUrl,\n StudioUrl,\n} from './types'\n\n/** @internal */\nexport function resolveEditInfo(options: ResolveEditInfoOptions): CreateEditUrlOptions | undefined {\n const {resultSourceMap: csm, resultPath} = options\n const {mapping, pathSuffix} = resolveMapping(resultPath, csm) || {}\n\n if (!mapping) {\n // console.warn('no mapping for path', { path: resultPath, sourceMap: csm })\n return undefined\n }\n\n if (mapping.source.type === 'literal') {\n return undefined\n }\n\n if (mapping.source.type === 'unknown') {\n return undefined\n }\n\n const sourceDoc = csm.documents[mapping.source.document]\n const sourcePath = csm.paths[mapping.source.path]\n\n if (sourceDoc && sourcePath) {\n const {baseUrl, workspace, tool} = resolveStudioBaseRoute(\n typeof options.studioUrl === 'function' ? options.studioUrl(sourceDoc) : options.studioUrl,\n )\n if (!baseUrl) return undefined\n const {_id, _type} = sourceDoc\n return {\n baseUrl,\n workspace,\n tool,\n id: _id,\n type: _type,\n path: parseJsonPath(sourcePath + pathSuffix),\n } satisfies CreateEditUrlOptions\n }\n\n return undefined\n}\n\n/** @internal */\nexport function resolveStudioBaseRoute(studioUrl: StudioUrl): StudioBaseRoute {\n let baseUrl: StudioBaseUrl = typeof studioUrl === 'string' ? studioUrl : studioUrl.baseUrl\n if (baseUrl !== '/') {\n baseUrl = baseUrl.replace(/\\/$/, '')\n }\n if (typeof studioUrl === 'string') {\n return {baseUrl}\n }\n return {...studioUrl, baseUrl}\n}\n"],"names":["studioPath.fromString","studioPath.toString"],"mappings":"AAYA,MAAM,UACJ,GAAA,kGAAA,CAAA;AAEK,MAAM,YAAe,GAAA,2BAAA;AAC5B,MAAM,YAAe,GAAA,WAAA,CAAA;AAGd,SAAS,eAAe,OAAyC,EAAA;AACtE,EAAO,OAAA,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