PageSourceSearch

https://ghc.anitab.org/_next/static/chunks/4598.92a6b8e005291276.js

js anitab.org collected 2026-10-01 08:46:32 UTC 67,024 bytes, 53 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4598],{11726:function(e,t,n){n.d(t,{BB:function(){return c},F5:function(){return k},Mx:function(){return P},U2:function(){return u},XL:function(){return x},eT:function(){return f},lV:function(){return function e(t,n,r=[]){if(null!==t&&Array.isArray(t))return t.map((t,i)=>{if(E(t)){let a=t._key;if("string"==typeof a)return e(t,n,r.concat({_key:a,_index:i}))}return e(t,n,r.concat(i))});if(E(t)){if("block"===t._type||"span"===t._type){let i={...t};return"block"===t._type?i.children=e(t.children,n,r.concat("children")):"span"===t._type&&(i.text=e(t.text,n,r.concat("text"))),i}return Object.fromEntries(Object.entries(t).map(([t,i])=>[t,e(i,n,r.concat(t))]))}return n(t,r)}},qy:function(){return y},tZ:function(){return S},vs:function(){return b}});let r=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,i=/_key\s*==\s*['"](.*)['"]/,a=/^\d*:\d*$/;function o(e){return"number"==typeof e||"string"==typeof e&&/^\[\d+\]$/.test(e)}function s(e){return"string"==typeof e?i.test(e.trim()):"object"==typeof e&&"_key"in e}function l(e){if("string"==typeof e&&a.test(e))return!0;if(!Array.isArray(e)||2!==e.length)return!1;let[t,n]=e;return("number"==typeof t||""===t)&&("number"==typeof n||""===n)}function u(e,t,n){let r="string"==typeof t?d(t):t;if(!Array.isArray(r))throw Error("Path must be an array or a string");let i=e;for(let e=0;e<r.length;e++){let t=r[e];if(o(t)){if(!Array.isArray(i))return n;i=i[t]}if(s(t)){if(!Array.isArray(i))return n;i=i.find(e=>e._key===t._key)}if("string"==typeof t&&(i="object"==typeof i&&null!==i?i[t]:void 0),typeof i>"u")return n}return i}function c(e){if(!Array.isArray(e))throw Error("Path is not an array");return e.reduce((e,t,n)=>{let r=typeof t;if("number"===r)return`${e}[${t}]`;if("string"===r)return`${e}${0===n?"":"."}${t}`;if(s(t)&&t._key)return`${e}[_key=="${t._key}"]`;if(Array.isArray(t)){let[n,r]=t;return`${e}[${n}:${r}]`}throw Error(`Unsupported path segment \`${JSON.stringify(t)}\``)},"")}function d(e){if("string"!=typeof e)throw Error("Path is not a string");let t=e.match(r);if(!t)throw Error("Invalid path string");return t.map(p)}function p(e){return o(e)?Number(e.replace(/[^\d]/g,"")):s(e)?{_key:e.match(i)[1]}:l(e)?function(e){let[t,n]=e.split(":").map(e=>""===e?e:Number(e));return[t,n]}(e):e}var f=Object.freeze({__proto__:null,fromString:d,get:u,isIndexSegment:o,isIndexTuple:l,isKeySegment:s,reKeySegment:i,toString:c});let h="drafts.",m="versions.";function v(e){return e.startsWith(h)}function g(e){return e.startsWith(m)}function y(e){return g(e)?h+b(e):v(e)?e:h+e}function x(e,t){if("drafts"===t||"published"===t)throw Error('Version can not be "published" or "drafts"');return`${m}${t}.${b(e)}`}function b(e){return g(e)?e.split(".").slice(2).join("."):v(e)?e.slice(h.length):e}let w={"\f":"\\f","\n":"\\n","\r":"\\r","	":"\\t","'":"\\'","\\":"\\\\"},j={"\\f":"\f","\\n":`
2`,"\\r":"\r","\\t":"	","\\'":"'","\\\\":"\\"};function k(e){let t;let n=[],r=/\['(.*?)'\]|\[(\d+)\]|\[\?\(@\._key=='(.*?)'\)\]/g;for(;null!==(t=r.exec(e));){if(void 0!==t[1]){let e=t[1].replace(/\\(\\|f|n|r|t|')/g,e=>j[e]);n.push(e);continue}if(void 0!==t[2]){n.push(parseInt(t[2],10));continue}if(void 0!==t[3]){let e=t[3].replace(/\\(\\')/g,e=>j[e]);n.push({_key:e,_index:-1});continue}}return n}function P(e,t){var n;if(!t?.mappings)return;let r=(n=e.map(e=>{if("string"==typeof e||"number"==typeof e)return e;if(-1!==e._index)return e._index;throw Error(`invalid segment:${JSON.stringify(e)}`)}),`$${n.map(e=>"string"==typeof e?`['${e.replace(/[\f\n\r\t'\\]/g,e=>w[e])}']`:"number"==typeof e?`[${e}]`:""!==e._key?`[?(@._key=='${e._key.replace(/['\\]/g,e=>w[e])}')]`:`[${e._index}]`).join("")}`);if(void 0!==t.mappings[r])return{mapping:t.mappings[r],matchedPath:r,pathSuffix:""};let i=Object.entries(t.mappings).filter(([e])=>r.startsWith(e)).sort(([e],[t])=>t.length-e.length);if(0==i.length)return;let[a,o]=i[0],s=r.substring(a.length);return{mapping:o,matchedPath:a,pathSuffix:s}}function E(e){return"object"==typeof e&&null!==e}function S(e){let{baseUrl:t,workspace:n="default",tool:r="default",id:i,type:a,path:o,projectId:s,dataset:l}=e;if(!t)throw Error("baseUrl is required");if(!o)throw Error("path is required");if(!i)throw Error("id is required");if("/"!==t&&t.endsWith("/"))throw Error("baseUrl must not end with a slash");let u="default"===n?void 0:n,d="default"===r?void 0:r,p=b(i),f=Array.isArray(o)?c(o.map(e=>{if("string"==typeof e||"number"==typeof e)return e;if(""!==e._key)return{_key:e._key};if(-1!==e._index)return e._index;throw Error(`invalid segment:${JSON.stringify(e)}`)})):o,h=new URLSearchParams({baseUrl:t,id:p,type:a,path:f});if(u&&h.set("workspace",u),d&&h.set("tool",d),s&&h.set("projectId",s),l&&h.set("dataset",l),v(i)||g(i)){if(g(i)){let e=function(e){if(!g(e))return;let[t,n,...r]=e.split(".");return n}(i);h.set("perspective",e)}}else h.set("perspective","published");let m=["/"===t?"":t];u&&m.push(u);let y=["mode=presentation",`id=${p}`,`type=${a}`,`path=${encodeURIComponent(f)}`];return d&&y.push(`tool=${d}`),m.push("intent","edit",`${y.join(";")}?${h}`),m.join("/")}},43328:function(e,t,n){n.d(t,{D:function(){return s},u:function(){return l}});var r=n(26705),i=n(59731),a=n(20955);let o=(0,a.createContext)(null);function s(e){let{children:t,setDisplayedDocument:n,documentId:s}=e,l=(0,a.useCallback)(e=>n(t=>i(t,e)?t:e),[n]);return(0,a.useEffect)(()=>
2{if(s)return;let e=setTimeout(()=>n(null));return()=>clearTimeout(e)},[s,n]),(0,r.jsx)(o.Provider,{value:l,children:t})}function l(){return(0,a.useContext)(o)}},24598:function(e,t,n){let r;n.r(t),n.d(t,{default:function(){return ts}});var i,a,o,s,l,u=n(26705),c=n(11726),d=n(31031),p=n(20955),f=n(88477),h=n(83826),m=n(8702),v=n(94168),g=n(50259),y=n(77844),x=n(71613),b=n(43328);let w="sanity.previewUrlSecret",j="sanity-preview-secret",k="sanity-preview-pathname",P=`*[_type == "${w}" && dateTime(_updatedAt) <= dateTime(now()) - 3600]`;var E=n(87876),S=n(29791),C=n(42367),_=n(30458);function $({children:e,isValidProp:t,...n}){t&&(0,C.K)(t),(n={...(0,p.useContext)(S._),...n}).isStatic=(0,_.h)(()=>n.isStatic);let r=(0,p.useMemo)(()=>n,[JSON.stringify(n.transition),n.transformPagePoint,n.reducedMotion]);return p.createElement(S._.Provider,{value:r},e)}var R=n(95127),z=n(21770);async function I(e,t,n,r,i=(0,z.Z)()){let a=e.withConfig({apiVersion:"2023-11-09"});try{let e=new Date(Date.now()+36e5),o=`sanity-preview-url-secret.${i}`,s=function(){if("u">typeof crypto){let e=new Uint8Array(16);crypto.getRandomValues(e);let t="";for(let n=0;n<e.length;n++)t+=e[n].toString(16).padStart(2,"0");return t=btoa(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/[=]+$/,"")}return Math.random().toString(36).slice(2)}(),l=a.patch(o).set({secret:s,source:t,studioUrl:n,userId:r});return await a.transaction().createOrReplace({_id:o,_type:w}).patch(l).commit({tag:"sanity.preview-url-secret"}),{secret:s,expiresAt:e}}finally{await a.delete({query:P})}}var A=n(59731);function L(e){return e.replace(/([.+*?=^!:${}()[\]|/\\])/g,"\\$1")}function D(e){return e&&e.sensitive?"":"i"}var M=n(29429),O=Object.defineProperty,T=(e,t,n)=>{let r;return(r="symbol"!=typeof t?t+"":t)in e?O(e,r,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[r]=n};let U=new Uint8Array(16),N=[];for(let e=0;e<256;++e)N.push((e+256).toString(16).slice(1));var W={randomUUID:"u">typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function F(e,t,n){if(W.randomUUID&&!t&&!e)return W.randomUUID();let i=(e=e||{}).random||(e.rng||function(){if(!r&&!(r="u">typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)))throw Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return r(U)})();return i[6]=15&i[6]|64,i[8]=63&i[8]|128,function(e,t=0){return N[e[t+0]]+N[e[t+1]]+N[e[t+2]]+N[e[t+3]]+"-"+N[e[t+4]]+N[e[t+5]]+"-"+N[e[t+6]]+N[e[t+7]]+"-"+N[e[t+8]]+N[e[t+9]]+"-"+N[e[t+10]]+N[e[t+11]]+N[e[t+12]]+N[e[t+13]]+N[e[t+14]]+N[e[t+15]]}(i)}let K=["handshake/syn","handshake/syn-ack","handshake/ack"],q=e=>K.some(t=>t===e),V=({data:e={}})=>"object"==typeof e&&null!==e&&!Array.isArray(e)&&!("domain"in e)&&["id","type","from","to"].every(t=>t in e)&&e.type.startsWith("handshake/");function B(e){let t=e.target,n=e.connectTo.map(e=>({buffer:[],config:e,id:"",handler:i,status:"connecting",interval:void 0,heartbeat:void 0}));function r(e){window.clearInterval(e.interval)}function i(e){let{data:t}=e;if(q(t.type)){let e=n.find(e=>e.config.id===t.from);e&&"handshake/syn-ack"===t.type&&(l(e,"connected"),u(e,"handshake/ack",{id:e.id}))}}let a=t=>{var r,i,a;let o=t.data;if(!q(o.type)&&n.find(e=>e.id===o.connectionId)){let t=n.find(e=>e.config.id===o.from);if(t){let n=[o.type,o.data];null==(i=(r=t.config).onEvent)||i.call(r,...n),null==(a=e.onEvent)||a.call(e,...n),c(t,"channel/response",{responseTo:o.id},!1)}}};function o(t){var r;if(V(t))console.error("Visual editing package mismatch detected! Please ensure you are using the latest version of Sanity Studio and any packages listed here:\nhttps://github.com/sanity-io/visual-editing");else if(function(t){let{data:r,origin:i}=t;return"sanity/channels"===r.domain&&r.to==e.id&&n.map(e=>e.config.id).includes(r.from)&&"channel/response"!==r.type&&i===e.targetOrigin}(t)){let{data:e}=t;null==(r=n.find(t=>t.config.id===e.from))||r.handler(t)}}function s(e){e.heartbeat&&window.clearInterval(e.heartbeat)}function l(t,n){var o,l,d;t.status=n,null==(l=(o=t.config).onStatusUpdate)||l.call(o,n,t.config.id),null==(d=e.onStatusUpdate)||d.call(e,n,t.config.id),"connecting"===n||"reconnecting"===n?(t.handler=i,s(t),t.id=
2F(),t.interval=window.setInterval(()=>{u(t,"handshake/syn",{id:t.id})},500)):"connected"===n?(t.handler=a,r(t),function(e){if(s(e),e.config.heartbeat){let t="number"==typeof e.config.heartbeat?e.config.heartbeat:1e3;e.heartbeat=window.setInterval(()=>{c(e,"channel/heartbeat")},t)}}(t),function(e){let t=[...e.buffer];e.buffer.splice(0,e.buffer.length),t.forEach(({type:t,data:n})=>{c(e,t,n)})}(t)):"disconnected"===n&&(t.id=null,t.handler=i,r(t),s(t))}function u(n,r,i){if(!n.id)throw Error("No channel ID set");let a={connectionId:n.id,data:i,domain:"sanity/channels",from:e.id,id:F(),to:n.config.id,type:r};try{null==t||t.postMessage(a,{targetOrigin:"*"})}catch{throw Error(`Failed to postMessage '${a.id}' on '${e.id}'`)}}function c(n,r,i,a=!0){let o=F();if("connecting"===n.status||"reconnecting"===n.status||"disconnected"===n.status)return void n.buffer.push({type:r,data:i});if(!n.id)throw Error("No channel ID set");let s={connectionId:n.id,data:i,domain:"sanity/channels",from:e.id,id:o,to:n.config.id,type:r};if(a){let t=setTimeout(()=>{s.connectionId===n.id&&(window.removeEventListener("message",a,!1),"channel/heartbeat"!==r&&n.buffer.push({type:r,data:i}),l(n,"reconnecting"),console.warn(`Received no response to message '${s.type}' on client '${e.id}' (ID: '${s.id}').`))},1e3),a=e=>{var n;let{data:r}=e;"channel/response"===r.type&&null!=(n=r.data)&&n.responseTo&&r.data.responseTo===s.id&&(window.removeEventListener("message",a,!1),clearTimeout(t))};window.addEventListener("message",a,!1)}try{null==t||t.postMessage(s,{targetOrigin:e.targetOrigin})}catch{throw Error(`Failed to postMessage '${s.id}' on client '${e.id}'`)}}
2return window.addEventListener("message",o,!1),n.forEach(e=>{l(e,"connecting")}),{destroy:function(){n.forEach(e=>{["disconnected"].includes(e.status)||(c(e,"channel/disconnect",{id:e.id},!1),l(e,"disconnected"))}),window.removeEventListener("message",o,!1),n.forEach(e=>{s(e),r(e)})},send:function(e,t,r){(e?Array.isArray(e)?[...e]:[e]:n).forEach(e=>{let i=n.find(t=>t.config.id===e);if(!i)throw Error("Invalid channel ID");c(i,t,r)})}}}function Z(e){var t,n,r;let i=typeof e;return"object"===i&&(i=null!=(r=e&&(null==(n=null==(t=Object.getPrototypeOf(e))?void 0:t.constructor)?void 0:n.name))?r:"null"),"string"===i?`"${e}"`:"number"===i||"bigint"===i||"boolean"===i?`${e}`:i}function G(e,t,n,r,i){var l,u,c,d,p,f,h,m,v,g,y;let x=i&&"input"in i?i.input:n.value,b=null!=(l=null==i?void 0:i.expected)?l:e.expects,w=null!=(u=null==i?void 0:i.received)?u:Z(x),j={kind:e.kind,type:e.type,input:x,expected:b,received:w,message:`Invalid ${t}: ${b?`Expected ${b} but r`:"R"}eceived ${w}`,requirement:e.requirement,path:null==i?void 0:i.path,issues:null==i?void 0:i.issues,lang:r.lang,abortEarly:r.abortEarly,abortPipeEarly:r.abortPipeEarly,skipPipe:r.skipPipe},k="schema"===e.kind,P=null!=(f=null!=(p=null!=(d=null!=(c=e.message)?c:(m=e.reference,v=j.lang,null==(g=null==s?void 0:s.get(m))?void 0:g.get(v)))?d:k?(h=j.lang,null==o?void 0:o.get(h)):null)?p:r.message)?f:(y=j.lang,null==a?void 0:a.get(y));P&&(j.message="function"==typeof P?P(j):P),k&&(n.typed=!1),n.issues?n.issues.push(j):n.issues=[j]}var J=class extends Error{constructor(e){super(e[0].message),T(this,"issues"),this.name="ValiError",this.issues=e}};function H(e){return{kind:"schema",type:"boolean",reference:H,expects:"boolean",async:!1,message:e,_run(e,t){return"boolean"==typeof e.value?e.typed=!0:G(this,"type",e,t),e}}}function X(e,t){return{kind:"schema",type:"object",reference:X,expects:"Object",async:!1,entries:e,message:t,_run(e,t){var n;let r=e.value;if(r&&"object"==typeof r)for(let i in e.typed=!0,e.value={},this.entries){let a=r[i],o=this.entries[i]._run({typed:!1,value:a},t);if(o.issues){let s={type:"object",origin:"value",input:r,key:i,value:a};for(let t of o.issues)t.path?t.path.unshift(s):t.path=[s],null==(n=e.issues)||n.push(t);if(e.issues||(e.issues=o.issues),t.abortEarly){e.typed=!1;break}}o.typed||(e.typed=!1),(void 0!==o.value||i in r)&&(e.value[i]=o.value)}else G(this,"type",e,t);return e}}}function Y(e,...t){let n={kind:"schema",type:"optional",reference:Y,expects:`${e.expects} | undefined`,async:!1,wrapped:e,_run(e,t){return void 0===e.value&&("default"in this&&(e.value="function"==typeof this.default?this.default(e,t):this.default),void 0===e.value)?(e.typed=!0,e):this.wrapped._run(e,t)}};return 0 in t&&(n.default=t[0]),n}function Q(e){return{kind:"schema",type:"string",reference:Q,expects:"string",async:!1,message:e,_run(e,t){return"string"==typeof e.value?e.typed=!0:G(this,"type",e,t),e}}}let ee=/^([A-Za-z]+):([0-9]+)$/,et=/^([A-Za-z]+):([0-9]+),([0-9]+)$/,en=/^([A-Za-z]+):([a-z0-9]+)$/,er=function(...e){return{...e[0],pipe:e,_run(t,n){for(let r=0;r<e.length;r++){t=e[r]._run(t,n);let i=e[r+1];if(n.skipPipe||t.issues&&(n.abortEarly||n.abortPipeEarly||"schema"===(null==i?void 0:i.kind)||"transformation"===(null==i?void 0:i.kind))){t.typed=!1;break}}return t}}}(Q(),function e(t,n){return{kind:"validation",type:"min_length",reference:e,async:!1,expects:`>=${t}`,requirement:t,message:n,_run(e,t){return e.typed&&e.value.length<this.requirement&&G(this,"length",e,t,{received:`${e.value.length}`}),e}}}(1)),ei=Y(er);X({baseUrl:er,dataset:ei,id:er,path:er,projectId:ei,tool:ei,type:ei,workspace:ei,isDraft:Y(Q())}),X({origin:er,href:er,data:Y(function e(t,n,r){return{kind:"schema",type:"record",reference:e,expects:"Object",async:!1,key:t,value:n,message:r,_run(e,t){var n,r;let i=e.value;if(i&&"object"==typeof i){for(let a in e.typed=!0,e.value={},i)if("__proto__"!==a&&"prototype"!==a&&"constructor"!==a){let o=i[a],s=this.key._run({typed:!1,value:a},t);if(s.issues){let r={type:"record",origin:"key",input:i,key:a,value:o};for(let t of s.issues)t.path=[r],null==(n=e.issues)||n.push(t);
2if(e.issues||(e.issues=s.issues),t.abortEarly){e.typed=!1;break}}let l=this.value._run({typed:!1,value:o},t);if(l.issues){let n={type:"record",origin:"value",input:i,key:a,value:o};for(let t of l.issues)t.path?t.path.unshift(n):t.path=[n],null==(r=e.issues)||r.push(t);if(e.issues||(e.issues=l.issues),t.abortEarly){e.typed=!1;break}}s.typed&&l.typed||(e.typed=!1),s.typed&&(e.value[s.value]=l.value)}}else G(this,"type",e,t);return e}}}(Q(),function e(){return{kind:"schema",type:"unknown",reference:e,expects:"unknown",async:!1,_run:e=>(e.typed=!0,e)}}()))});let ea={alt:"altKey",ctrl:"ctrlKey",mod:"u">typeof window&&/Mac|iPod|iPhone|iPad/.test(window.navigator.platform)?"metaKey":"ctrlKey",shift:"shiftKey"};function eo(e){return"Alt"===e.key}function es(e,t){let n;return(...r)=>{clearTimeout(n),n=setTimeout(()=>{e.apply(e,r)},t)}}let el=(0,p.createContext)(null);el.displayName="PanelsContext";let eu=m.zo.div`
3  overflow: hidden;
4  flex-basis: 0;
5  flex-shrink: 1;
6`,ec=function({children:e,defaultSize:t=null,id:n,minWidth:r,maxWidth:i,order:a=0}){let o=(0,p.useContext)(el);if(null===o)throw Error("Panel components must be rendered within a PanelGroup container");let{getPanelStyle:s,registerElement:l,unregisterElement:c}=o,d=s(n);return(0,p.useLayoutEffect)(()=>(l(n,{id:n,type:"panel",defaultSize:t,maxWidth:null!=i?i:null,minWidth:null!=r?r:0,order:a}),()=>{c(n)}),[n,t,a,i,r,l,c]),(0,u.jsx)(eu,{style:d,children:e})},ed="presentation/panels",ep=()=>JSON.parse(localStorage.getItem(ed)||"{}"),ef=e=>e.map(e=>[e.id,e.order].join(":")).join(",");function eh(e,t,n){let{maxWidth:r,minWidth:i}=e;return Math.min(null==r?100:r/n*100,Math.max(i/n*100,t))}function em(e,t,n=0,r=null){return e.clientX-(r||t.getBoundingClientRect()).left-n}function ev(e){return"panel"===e.type}function eg(e){return"resizer"===e.type}function ey(e){return Array.from(e.values()).sort(({order:e},{order:t})=>null==e&&null==t?0:null==e?-1:null==t?1:e-t)}function ex(e,t,n){let r=t.reduce((e,t)=>e+t,0),i=[...t].map(e=>e/r*100),a=0;for(let t=0;t<e.length;t++){let r=e[t],o=i[t],s=eh(r,o,n);o!=s&&(a+=o-s,i[t]=s)}if("0.000"!==a.toFixed(3))for(let t=0;t<e.length;t++){let{maxWidth:r,minWidth:o}=e[t];o=o/n*100,null!=r&&(r=r/n*100);let s=Math.min(null!=r?r:100,Math.max(o,i[t]+a));if(s!==i[t]&&(a-=s-i[t],i[t]=s,"0.000"===Math.abs(a).toFixed(3)))break}return i}let eb=m.zo.div`
7  display: flex;
8  flex-direction: row;
9  height: 100%;
10  overflow: hidden;
11  width: 100%;
12`,ew=function({children:e}){let t=(0,p.useRef)(null),[n,r]=(0,p.useState)(new Map),i=(0,p.useMemo)(()=>ey(n).filter(ev),[n]),[a,o]=(0,p.useState)([]),[s,l]=(0,p.useState)(null),c=(0,p.useRef)({elements:n,panels:i,widths:a}),d=(0,p.useCallback)(e=>({flexGrow:function(e,t,n){if(1===e.length)return"100";let r=n[e.findIndex(e=>e.id===t)];return null==r?"0":r.toPrecision(10)}(i,e,a),pointerEvents:null===s?void 0:"none"}),[s,i,a]),f=(0,p.useCallback)((e,t)=>{r(n=>{if(n.has(e))return n;let r=new Map(n);return r.set(e,t),r})},[]),h=(0,p.useCallback)(e=>{r(t=>{if(!t.has(e))return t;let n=new Map(t);return n.delete(e),n})},[]),m=(0,p.useRef)({containerWidth:window.innerWidth,dragOffset:0,panelAfter:null,panelBefore:null,resizerIndex:-1,resizerRect:null,startX:0,widths:[]}),v=(0,p.useCallback)((e,t)=>{let r=ey(n),i=r.findIndex(t=>t.id===e),a=n.get(e);if(!a||!eg(a))return;let o=a.el.current;o&&(m.current={resizerIndex:i,panelBefore:r.reduce((e,t,n)=>ev(t)&&n<i?t:e,null),panelAfter:r.reduce((e,t,n)=>null===e&&ev(t)&&n>i?t:e,null),containerWidth:window.innerWidth,startX:t.pageX,dragOffset:em(t,o),resizerRect:o.getBoundingClientRect(),widths:c.current.widths},l(e))},[n]),g=(0,p.useCallback)(()=>{l(null)},[]),y=(0,p.useCallback)((e,r)=>{r.preventDefault(),r.stopPropagation();let{containerWidth:i,dragOffset:a,panelBefore:s,panelAfter:l,resizerRect:u}=m.current;if(null==s||null==l)return;let d=n.get(e);if(!d||!eg(d))return;let p=d.el.current;if(!p)return;let f=em(r,p,a,u);if(0===f)return;let{widths:h}=c.current,v=function(e,t,n,r,i,a){let{panels:o,widths:s}=i,{widths:l}=a,u=l||s,c=[...u];{let i=e<0?r:n,a=u[o.findIndex(e=>e.id===i.id)],s=eh(i,a+Math.abs(e),t);if(a===s)return u;e=e<0?a-s:s-a}let d=0,p=e<0?n:r,f=o.findIndex(e=>e.id===p.id);for(;;){let n=o[f],r=u[f],i=eh(n,r-(Math.abs(e)-Math.abs(d)),t);if(r!==i&&(d+=r-i,c[f]=i,d.toPrecision(10).localeCompare(Math.abs(e).toPrecision(10),void 0,{numeric:!0})>=0))break;if(e<0){if(--f<0)break}else if(++f>=o.length)break}return 0===d?u:(p=e<0?r:n,c[f=o.findIndex(e=>e.id===p.id)]=u[f]+d,c)}(f/t.current.getBoundingClientRect().width*100,i,s,l,c.current,m.current);h.some((e,t)=>e!==v[t])&&o(v)},[n]);(0,p.useLayoutEffect)(()=>{c.current.elements=n,c.current.panels=i,c.current.widths=a},[n,i,a]);let x=(0,p.useMemo)(()=>{let e=(e,t)=>
12{var n;let r=ep(),i=ef(e);n={...r,[i]:t},localStorage.setItem(ed,JSON.stringify(n))};return{get:e=>{let t=ep(),n=ef(e);return Array.isArray(t[n])&&t[n].some(e=>null===e)?void 0:t[n]},set:e,setDebounced:es(e,100)}},[]);(0,p.useLayoutEffect)(()=>{let{widths:e}=c.current;if(e.length===i.length)return;let t=x.get(i);if(t)return void o(ex(i,t,window.innerWidth));o(function(e){let t=e.length,n=100,r=e.map(e=>e.defaultSize?(n-=e.defaultSize,t-=1,e.defaultSize):null),i=n/t;return r.map(e=>null===e?i:e)}(i))},[x,i]),(0,p.useEffect)(()=>{a.length&&x.setDebounced(i,a)},[x,i,a]),(0,p.useLayoutEffect)(()=>{let e=new ResizeObserver(()=>{let{panels:e,widths:t}=c.current,n=ex(e,t,window.innerWidth);t.some((e,t)=>e!==n[t])&&o(n)});return e.observe(t.current),()=>{e.disconnect()}},[]);let b=(0,p.useMemo)(()=>({activeResizer:s,drag:y,getPanelStyle:d,registerElement:f,startDragging:v,stopDragging:g,unregisterElement:h}),[s,y,d,f,v,g,h]);return(0,u.jsx)(el.Provider,{value:b,children:(0,u.jsx)(eb,{ref:t,children:e})})};function ej(e){let{children:t,message:n,onRetry:r,onContinueAnyway:i,...a}=e,{t:o}=(0,f.$G7)(v.p),s=(0,u.jsx)(d.zx,{fontSize:1,mode:"ghost",onClick:r,text:o("error-card.retry-button.text")}),l=(0,u.jsx)(d.zx,{fontSize:1,mode:"ghost",tone:"critical",onClick:i,text:o("error-card.continue-button.text")});return(0,u.jsx)(d.Zb,{height:"fill",...a,children:(0,u.jsx)(d.kC,{align:"center",height:"fill",justify:"center",children:(0,u.jsx)(d.W2,{padding:4,sizing:"border",width:0,children:(0,u.jsxs)(d.Kq,{space:4,children:[(0,u.jsxs)(d.Kq,{space:3,children:[(0,u.jsx)(d.xv,{size:1,weight:"semibold",children:o("error-card.title")}),(0,u.jsx)(d.xv,{muted:!0,size:1,children:n})]}),t,r&&i?(0,u.jsxs)(d.gF,{space:2,children:[s,l]}):r?(0,u.jsx)(d.xu,{children:s}):i?(0,u.jsx)(d.xu,{children:l}):null]})})})})}let ek=(0,p.forwardRef)(function(e,t){let{searchParams:n,...r}=e;return(0,u.jsx)(h.Px,{...r,ref:t,state:{type:void 0,_searchParams:Object.entries(n)},title:void 0})}),eP=(0,p.forwardRef)(function(e,t){let{documentId:n,documentType:r,parentRefPath:i,template:a,searchParams:o,...s}=e;return(0,u.jsx)(h.Px,{...s,ref:t,state:{id:n,type:r,_searchParams:Object.entries({...o,prefersLatestPublished:"published"===o.perspective?"true":void 0})},title:void 0})});function eE(e){let{children:t,onStructureParams:n,structureParams:r,searchParams:i,refs:a}=e,{state:o,resolvePathFromState:s}=(0,h.tv)(),l=(0,f.BoV)(Object.fromEntries(o._searchParams||[])),c=(0,p.useCallback)(e=>`${s(o)}${function(e){let t=["comment","inspect","instruction","pathKey","rev","since","template","prefersLatestPublished","view"];return function(e={}){let t=Object.entries(e).map(([e,t])=>`${e}=${t}`).join("&");return t.length?`?${t}`:""}(Object.entries(e).filter(([e])=>t.includes(e)).reduce((e,[t,n])=>null==n?e:{...e,[t]:n},{}))}({...l,...e})}`,[s,l,o]),d=(0,p.useMemo)(()=>({index:0,groupIndex:0,siblingIndex:0,payload:{},params:r,hasGroupSiblings:!1,groupLength:1,routerPanesState:[],ChildLink:e=>{let{childId:t,...n}=e,r=null==a?void 0:a.find(e=>e._id===t||(0,f.vsM)(e._id)===t);return r?(0,u.jsx)(h.Px,{...n,state:{id:t,type:r._type,_searchParams:Object.entries({...i,prefersLatestPublished:"published"===(null==i?void 0:i.perspective)?"true":void 0})}}):(0,u.jsx)("div",{...n})},BackLink:e=>(0,u.jsx)(ek,{...e,searchParams:i}),ReferenceChildLink:e=>(0,u.jsx)(eP,{...e,searchParams:i}),ParameterizedLink:()=>(0,u.jsx)(u.Fragment,{children:"ParameterizedLink"}),closeCurrentAndAfter:()=>{console.warn("closeCurrentAndAfter")},handleEditReference:e=>{console.warn("handleEditReference",e)},replaceCurrent:e=>{console.warn("replaceCurrent",e)},closeCurrent:()=>{console.warn("closeCurrent")},duplicateCurrent:e=>{console.warn("duplicateCurrent",e)},setView:e=>{console.warn("setView",e)},setParams:e=>{var t;n({...e,inspect:null!=(t=e.inspect)?t:void 0})},setPayload:e=>{console.warn("setPayload",e)},navigateIntent:(e,t,n)=>{console.warn("navigateIntent",e,t,n)},createPathWithParams:c}),[c,n,a,i,r]);return(0,u.jsx)(y.ud.Provider,{value:d,children:t})}let eS=(0,m.zo)(x.PaneLayout)`
13  height: 100%;
14`,eC=(0,m.zo)(d.kC)`
15  & > div {
16    min-width: none !important;
17    max-width: none !important;
18  }
19`,e_=(0,m.zo)(d.EK)`
20  white-space: pre-wrap;
21`;
21function e$(e){let{mainDocumentState:t,onStructureParams:n,searchParams:r,refs:i}=e,{t:a}=(0,f.$G7)(v.p),{devMode:o}=(0,v.u)(),s=(0,p.useMemo)(()=>i.filter(e=>{var n;return(0,f.vsM)(e._id)!==(null==(n=null==t?void 0:t.document)?void 0:n._id)}).map(e=>e._id),[t,i]),l=(0,p.useMemo)(()=>({id:"$root",options:{filter:"_id in $ids",params:{ids:s}},schemaTypeName:"",title:a("document-list-pane.document-list.title"),type:"documentList"}),[s,a]),[c,h]=(0,p.useState)(null),m=(0,p.useCallback)(()=>h(null),[]),[g]=(0,p.useState)(()=>({}));return(0,p.useEffect)(()=>h(null),[i]),c?(0,u.jsx)(ej,{flex:1,message:a("document-list-pane.error.text"),onRetry:m,children:o&&(0,u.jsx)(d.Zb,{overflow:"auto",padding:3,radius:2,tone:"critical",children:(0,u.jsxs)(d.Kq,{space:3,children:[(0,u.jsx)(d.__,{muted:!0,size:0,children:a("presentation-error.label")}),(0,u.jsx)(e_,{size:1,children:c.error.message})]})})}):(0,u.jsx)(d.SV,{onCatch:h,children:(0,u.jsx)(eS,{children:(0,u.jsx)(x.StructureToolProvider,{children:(0,u.jsx)(eE,{onStructureParams:n,structureParams:g,searchParams:r,refs:i,children:(0,u.jsx)(eC,{direction:"column",flex:1,children:(0,u.jsx)(x.PaneContainer,{index:0,itemId:"$root",pane:l,paneKey:"$root"})})})})})})}let eR=(0,m.zo)(d.EK)`
22  white-space: pre-wrap;
23`;function ez(e){let{documentId:t,documentType:n,onFocusPath:r,onStructureParams:i,searchParams:a,structureParams:o}=e,{template:s,templateParams:l}=o,{t:c}=(0,f.$G7)(v.p),{devMode:m}=(0,v.u)(),g=(0,p.useMemo)(()=>({id:t,options:{id:t,type:n,template:s,templateParameters:(0,h.ZB)(l)},title:"",type:"document"}),[t,n,s,l]),[y,b]=(0,p.useState)(null),w=(0,p.useCallback)(()=>b(null),[]);return(0,p.useEffect)(()=>{b(null)},[t,n,o]),y?(0,u.jsx)(ej,{flex:1,message:c("document-pane.error.text"),onRetry:w,children:m&&(0,u.jsx)(d.Zb,{overflow:"auto",padding:3,radius:2,tone:"critical",children:(0,u.jsxs)(d.Kq,{space:3,children:[(0,u.jsx)(d.__,{muted:!0,size:0,children:c("presentation-error.label")}),(0,u.jsx)(eR,{size:1,children:y.error.message})]})})}):(0,u.jsx)(d.SV,{onCatch:b,children:(0,u.jsx)(x.PaneLayout,{style:{height:"100%"},children:(0,u.jsx)(eE,{searchParams:a,onStructureParams:i,structureParams:o,children:(0,u.jsx)(x.DocumentPane,{paneKey:"document",index:1,itemId:"document",pane:g,onFocusPath:r})})})})}function eI(e){let{documentId:t,documentType:n,onFocusPath:r,onStructureParams:i,searchParams:a,structureParams:o}=e;return(0,u.jsx)(x.StructureToolProvider,{children:(0,u.jsx)(ez,{documentId:t,documentType:n,onFocusPath:r,onStructureParams:i,searchParams:a,structureParams:o})})}function eA(e){var t;let{documentId:n,documentType:r,mainDocumentState:i,onFocusPath:a,onStructureParams:o,refs:s,searchParams:l,structureParams:c}=e,{t:m}=(0,f.$G7)(v.p),y=(0,f.I_y)(),x=(0,p.useCallback)(e=>(0,u.jsx)(h.Px,{...e,state:{id:i.document._id,type:i.document._type,_searchParams:Object.entries({...l,prefersLatestPublished:"published"===(null==l?void 0:l.perspective)?"true":void 0})}}),[i,l]),b=(0,p.useMemo)(()=>{var e;return y.get((null==(e=null==i?void 0:i.document)?void 0:e._type)||"shoe")},[i,y]),w=function(e,t){let n=(0,f.rq_)(),[r,i]=(0,p.useState)({});return(0,p.useEffect)(()=>{if(!t)return;let r=(0,f.eLL)(n,t,e,"").subscribe(e=>{i(e)});return()=>{null==r||r.unsubscribe()}},[n,t,e]),r}((null==(t=null==i?void 0:i.document)?void 0:t._id)||"",b),j=(0,p.useMemo)(()=>i?(0,u.jsx)(f.ogX,{...(0,f.L_b)({value:i.document,published:w.published,draft:w.draft}),schemaType:b,status:(0,u.jsx)(d.Zb,{padding:1,radius:2,shadow:1,children:(0,u.jsx)(d.xv,{muted:!0,size:0,weight:"medium",children:m("main-document.label")})})}):null,[i,b,m,w]);return n&&r?(0,u.jsx)(eI,{documentId:n,documentType:r,onFocusPath:a,onStructureParams:o,searchParams:l,structureParams:c}):(0,u.jsxs)(d.kC,{direction:"column",flex:1,height:"fill",children:[i&&(0,u.jsx)(d.Zb,{padding:3,tone:i.document?"inherit":"caution",children:i.document?(0,u.jsx)(f.oUE,{__unstable_focusRing:!0,as:x,"data-as":"a",radius:2,sizing:"border",tone:"inherit",children:j}):(0,u.jsx)(d.Zb,{padding:2,radius:2,tone:"inherit",children:(0,u.jsxs)(d.kC,{gap:3,children:[(0,u.jsx)(d.xu,{flex:"none",children:(0,u.jsx)(d.xv,{size:1,children:(0,u.jsx)(g.foC,{})})}),(0,u.jsx)(d.xu,{flex:1,children:(0,u.jsx)(d.xv,{size:1,children:(0,u.jsx)(f.vNl,{t:m,i18nKey:"main-document.missing.text",components:{Code:"code"},values:{path:i.path}})})})]})})}
23),(0,u.jsx)(e$,{mainDocumentState:i,onStructureParams:o,searchParams:l,refs:s})]})}let eL=m.zo.div`
24  position: relative;
25`,eD=m.zo.div`
26  position: absolute;
27  top: 0;
28  bottom: 0;
29  left: -5px;
30  width: 9px;
31  z-index: 10;
32  cursor: ${({$disabled:e})=>e?"auto":"ew-resize"};
33
34  /* Border */
35  & > span:nth-child(1) {
36    display: block;
37    border-left: 1px solid var(--card-border-color);
38    position: absolute;
39    top: 0;
40    left: 4px;
41    bottom: 0;
42    transition: opacity 200ms;
43  }
44
45  ${({$disabled:e})=>!e&&"\n    /* Hover effect */\n    & > span:nth-child(2) {\n      display: block;\n      position: absolute;\n      top: 0;\n      left: 0;\n      width: 9px;\n      bottom: 0;\n      background-color: var(--card-border-color);\n      opacity: 0;\n      transition: opacity 150ms;\n    }\n\n    @media (hover: hover) {\n      &:hover > span:nth-child(2) {\n        opacity: 0.2;\n      }\n    }\n  "}
46`,eM=function({id:e,order:t,disabled:n=!1}){let r=(0,p.useRef)(null),i=(0,p.useContext)(el);if(null===i)throw Error("Panel components must be rendered within a PanelGroup container");let a=(0,p.useRef)(e||F()).current,{activeResizer:o,drag:s,startDragging:l,stopDragging:c,registerElement:d,unregisterElement:f}=i,h=o===a;if(null===i)throw Error("Panel components must be rendered within a PanelGroup container");let m=(0,p.useCallback)(e=>{l(a,e.nativeEvent)},[a,l]),v=(0,p.useCallback)(e=>{s(a,e)},[a,s]),g=(0,p.useCallback)(()=>{r.current.blur(),c()},[c]);return(0,p.useEffect)(()=>{if(h&&!n)return window.addEventListener("mousemove",v),window.addEventListener("mouseup",g),()=>{window.removeEventListener("mousemove",v),window.removeEventListener("mouseup",g)}},[n,h,v,g]),(0,p.useLayoutEffect)(()=>(d(a,{id:a,order:t,type:"resizer",el:r}),()=>{f(a)}),[a,t,d,f]),(0,u.jsx)(eL,{onMouseDown:m,ref:r,children:(0,u.jsxs)(eD,{$disabled:n,children:[(0,u.jsx)("span",{}),(0,u.jsx)("span",{})]})})},eO=e=>{let{documentId:t,setDisplayedDocument:n,getCommentIntent:r}=e;return(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(eM,{order:4}),(0,u.jsx)(ec,{id:"content",minWidth:325,order:5,children:(0,u.jsx)(b.D,{documentId:t,setDisplayedDocument:n,children:(0,u.jsx)(f.dFz,{getIntent:r,children:e.children})})})]})},eT=e=>{let{documentId:t,documentsOnPage:n,documentType:r,getCommentIntent:i,mainDocumentState:a,onFocusPath:o,onStructureParams:s,searchParams:l,setDisplayedDocument:c,structureParams:d}=e;return(0,u.jsx)(eO,{documentId:t,getCommentIntent:i,setDisplayedDocument:c,children:(0,u.jsx)(eA,{documentId:t,documentType:r,mainDocumentState:a,onFocusPath:o,onStructureParams:s,refs:n,searchParams:l,structureParams:d})})},eU=function(e){let{children:t,navigate:n}=e,r=(0,p.useCallback)((e,t)=>{n(t||{},e?{preview:e}:{})},[n]);return(0,u.jsx)(v.P.Provider,{value:r,children:t})},eN=(0,p.memo)(function(e){let{minWidth:t,maxWidth:n,component:r}=e;return(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(ec,{id:"navigator",minWidth:t,maxWidth:n,order:1,children:(0,u.jsx)(r,{})}),(0,u.jsx)(eM,{order:2,disabled:null!=t&&null!=n&&t===n})]})}),eW=function(e){let{children:t,params:n}=e,r=(0,p.useMemo)(()=>n,[n]);return(0,u.jsx)(v.a.Provider,{value:r,children:t})},eF=function(e){let{children:t,devMode:n,name:r,navigate:i,params:a,searchParams:o,structureParams:s}=e,l=(0,p.useMemo)(()=>({devMode:n,name:r,navigate:i,params:a,searchParams:o,structureParams:s}),[n,r,i,a,o,s]);return(0,u.jsx)(v.b.Provider,{value:l,children:t})},eK="ACTION_IFRAME_LOADED",eq="ACTION_IFRAME_REFRESH",eV="ACTION_IFRAME_RELOAD",eB="ACTION_VISUAL_EDITING_OVERLAYS_TOGGLE",eZ=(e,t)=>{switch(t.type){case eK:return"loaded"===e.iframe.status?e:{...e,iframe:{...e.iframe,status:"loaded"}};case eq:return"refreshing"===e.iframe.status?e:{...e,iframe:{...e.iframe,status:"refreshing"}};case eV:return"reloading"===e.iframe.status?e:{...e,iframe:{...e.iframe,status:"reloading"}};case eB:return eG(e,t);default:return e}},eG=(e,t)=>e.visualEditing.overlaysEnabled===t.enabled?e:{...e,visualEditing:{...e.visualEditing,overlaysEnabled:t.enabled}},eJ=X({mainDocument:{...l=H(),fallback:!1,_run(e,t){return l._run(e,t),e.issues?{typed:!0,value:"function"==typeof this.fallback?this.fallback(e,t):this.fallback}:e}},iframe:X({status:function e(t,n){return{kind:"schema",type:"picklist",reference:e,expects:t.map(Z).join(" | ")||"never",async:!1,options:t,message:n,_run(e,t){return this.options.includes(e.value)?e.typed=!0:G(this,"type",e,t),e}}}(["loading","loaded","refreshing","reloading"])}),visualEditing:X({overlaysEnabled:H()})}),eH={mainDocument:!1,iframe:{status:"loading"},visualEditing:{overlaysEnabled:!1}};function eX(e){return function(e,t,n){var r,a,o;let s=e._run({typed:!1,value:t},{lang:(r=void 0,null==i?void 0:i.lang),message:null==r?void 0:r.message,abortEarly:null!=(a=null==r?void 0:r.abortEarly)?a:null==i?void 0:i.abortEarly,abortPipeEarly:null!=(o=null==r?void 0:r.abortPipeEarly)?o:null==i?void 0:i.abortPipeEarly,skipPipe:null==r?void 0:r.skipPipe});if(s.issues)throw new J(s.issues);return s.value}(eJ,{...eH,...e})}let eY=(0,E.E)(m.zo.iframe`
47  border: 0;
48  max-height: 100%;
49  width: 100%;
50  display: block;
51`),eQ=function(e){var t;let{fontSize:n=1,onChange:r,origin:i,padding:a=3,prefix:o,suffix:s,value:l}=e,{t:c}=(0,f.$G7)(v.p),{basePath:h="/"}=(null==(t=(0,f.AJ_)())?void 0:t.activeWorkspace)||{},m=(0,p.useRef)(null),[y,x]=(0,p.useState)(void 0),[b,w]=(0,p.useState)(void 0),j=(0,p.useCallback)(e=>{x(e.currentTarget.value)},[]),k=(0,p.useCallback)(e=>{var t;if("Enter"===e.key){if(void 0===y)return;let e=y.startsWith("/")||""===y?`${i}${y}`:y;if(!e.startsWith(i+"/")&&e!==i)return void w(c("preview-location-input.error",{origin:i,context:"missing-origin"}));if(!i&&(e.startsWith(`${h}/`)||e===h))return void w(c("preview-location-input.error",{basePath:h,context:"same-base-path"}));let n=e===i?i+"/":e;w(void 0),x(void 0),r(n.slice(i.length)),null==(t=m.current)||t.blur()}"Escape"===e.key&&(w(void 0),x(void 0))},[h,r,i,y,c]),P=(0,p.useCallback)(()=>{w(void 0),x(void 0)},[]);(0,p.useEffect)(()=>{w(void 0),x(void 0)},[i,l]);let E=(0,p.useMemo)(()=>({icon:g.X5P}),[]);return(0,u.jsx)(u.Fragment,{children:(0,u.jsx)(d.oi,{clearButton:b?E:void 0,customValidity:b,fontSize:n,onBlur:P,onClear:()=>{w(void 0),x(i+l)},onChange:j,onKeyDownCapture:k,padding:a,prefix:o,style:{zIndex:1},radius:2,ref:m,space:a,suffix:s,value:void 0===y?`${i}${l}`:y})})};function e0(e){let{initialUrl:t,openPopup:n,previewLocationOrigin:r,previewLocationRoute:i}=e,{t:a}=(0,f.$G7)(v.p),o=(0,p.useCallback)(e=>{e.preventDefault(),n(e.currentTarget.href)},[n]);return(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(e1,{initialUrl:t,previewLocationOrigin:r,previewLocationRoute:i}),(0,u.jsx)(d.sN,{icon:g.buG,text:a("share-url.menu-item.open.text"),as:"a",href:`${r}${i}`,onClick:o,rel:"opener",target:"_blank"})]})}function e1(e){let{initialUrl:t,previewLocationOrigin:n,previewLocationRoute:r}=e,{t:i}=(0,f.$G7)(v.p),{push:a}=(0,d.pm)(),o=(0,f.m85)({apiVersion:v.A}),s=(0,f.xJ)(),[l,c]=(0,p.useState)(!1);return(0,u.jsx)(d.sN,{disabled:l,onClick:()=>{let e;if(null==navigator||!navigator.clipboard)return a({closable:!0,status:"error",title:i("share-url.clipboard.status",{context:"unsupported"})}),!1;c(!0);let l=`${n}${r}`,u=()=>{a({id:e,closable:!0,status:"success",title:i("share-url.clipboard.status",{context:"success"})}),c(!1)},d=e=>{a({closable:!0,status:"error",title:i("share-url.clipboard.status",{context:"failed"}),description:e.message||e.toString()}),c(!1)};if(t.searchParams.has(j)){let n=async()=>(e=a({closable:!0,title:i("share-url.clipboard.status",{context:"copying"})}),(function(e,t,n){let r=new URL(e);return r.searchParams.set(j,t),r.searchParams.set(k,n),r})(t,(await I(o,"@sanity/presentation",typeof window>"u"?"":location.href,null==s?void 0:s.id)).secret,r).toString());if("u">typeof ClipboardItem){let e="text/plain",t=new ClipboardItem({[e]:n().then(t=>new Blob([t],{type:e}))});navigator.clipboard.write([t]).then(u).catch(d)}else n().then(e=>navigator.clipboard.writeText(e)).then(u).catch(d)}else navigator.clipboard.writeText(l).then(u).catch(d)},text:i("share-url.menu-item.copy.text"),icon:g.TIy})}let e2=(0,E.E)(d.kC),e3={previewDrafts:"preview-frame.perspective.previewDrafts.title",published:"preview-frame.perspective.published.title"},e5={previewDrafts:g.dY8,published:g.EI4},e4=(0,p.forwardRef)(function(e,t){let{dispatch:n,iframe:r,initialUrl:i,loadersConnection:a,navigatorEnabled:o,onPathChange:s,onRefresh:l,openPopup:c,overlaysConnection:h,perspective:m,previewUrl:y,setPerspective:x,setVie
51wport:b,targetOrigin:w,toggleNavigator:P,toggleOverlay:E,viewport:S,visualEditing:{overlaysEnabled:C}}=e,{t:_}=(0,f.$G7)(v.p),{devMode:z}=(0,v.u)(),I=(0,d.Tb)(),A=(0,p.useCallback)(()=>b("desktop"===S?"mobile":"desktop"),[b,S]),L="loading"===r.status||"reloading"===r.status,[D,M]=(0,p.useState)(!1),O="refreshing"===r.status,[T,U]=(0,p.useState)(!1),N=L||O||"connecting"===h,W=(0,p.useMemo)(()=>w===location.origin?"":w,[w]),F=(0,p.useCallback)(()=>{l(()=>{"function"!=typeof t&&null!=t&&t.current&&(n({type:eV}),t.current.src=`${w}${y||"/"}`)})},[n,l,y,w,t]),K=(0,p.useCallback)(()=>{"function"!=typeof t&&null!=t&&t.current&&(t.current.src=i.toString(),n({type:eV}))},[n,t,i]),q=(0,p.useCallback)(()=>{B(!0)},[]),[V,B]=(0,p.useState)(!1),[Z,G]=(0,p.useState)(!1);(0,p.useEffect)(()=>{if(!(L||O||"connecting"!==h&&"reconnecting"!==h)){let e=setTimeout(()=>{G(!0)},1e3);return()=>clearTimeout(e)}},[h,L,O]),(0,p.useEffect)(()=>{if(!L&&!O&&Z){if("connected"===h&&(U(!1),G(!1),M(!1),B(!1)),"connecting"===h){let e=setTimeout(()=>{M(!0),console.error("Unable to connect to visual editing. Make sure you've setup '@sanity/visual-editing' correctly")},v.M);return()=>clearTimeout(e)}if("reconnecting"===h){let e=setTimeout(()=>{M(!0),U(!0)},v.M);return()=>clearTimeout(e)}"disconnected"===h&&U(!0)}},[L,h,O,Z]);let J=(0,p.useMemo)(()=>{let{pathname:e,search:t}=function(e){let t=new URL(e);return t.searchParams.delete(k),t.searchParams.delete(j),t}(new URL(y||"/",w));return`${e}${t}`},[y,w]),H=(0,p.useCallback)(()=>{n({type:eK})},[n]);return(0,p.useEffect)(()=>{if("function"==typeof t||null==t||!t.current)return;let e=t.current;function n(){e===document.activeElement&&e.dispatchEvent(new MouseEvent("mousedown",{bubbles:!0,cancelable:!0}))}return window.addEventListener("blur",n),()=>{window.removeEventListener("blur",n)}},[t]),(0,u.jsx)($,{transition:I?{duration:0}:void 0,children:(0,u.jsxs)(d.uE,{delay:1e3,children:[(0,u.jsx)(d.Zb,{flex:"none",padding:2,shadow:1,style:{position:"relative"},children:(0,u.jsxs)(d.kC,{align:"center",style:{minHeight:0},children:[P&&(0,u.jsx)(d.xu,{flex:"none",marginRight:1,padding:1,children:(0,u.jsx)(d.u,{animate:!0,content:(0,u.jsx)(d.xv,{size:1,children:_("preview-frame.navigator.toggle-button.tooltip")}),fallbackPlacements:["bottom-start"],padding:2,placement:"bottom",portal:!0,children:(0,u.jsx)(d.zx,{"aria-label":_("preview-frame.navigator.toggle-button.aria-label"),fontSize:1,icon:g.bl6,mode:"bleed",onClick:P,padding:2,selected:o})})}),(0,u.jsx)(d.u,{animate:!0,content:(0,u.jsxs)(d.kC,{align:"center",style:{whiteSpace:"nowrap"},children:[(0,u.jsx)(d.xu,{padding:1,children:(0,u.jsx)(d.xv,{size:1,children:_("preview-frame.overlay.toggle-button.tooltip",{context:C?"disable":"enable"})})}),(0,u.jsx)(d.xu,{paddingY:1,children:(0,u.jsx)(f.SV0,{keys:["Alt"],style:{marginTop:-4,marginBottom:-4}})})]}),fallbackPlacements:["bottom-start"],padding:1,placement:"bottom",portal:!0,children:(0,u.jsx)(d.Zb,{as:"label",flex:"none",marginRight:1,padding:3,style:{lineHeight:0,borderRadius:999,userSelect:"none"},tone:C?"transparent":void 0,children:(0,u.jsxs)(d.kC,{align:"center",gap:3,children:[(0,u.jsx)("div",{style:{margin:-4},children:(0,u.jsx)(d.rs,{checked:C,onChange:E,disabled:"loading"===r.status||"connected"!==h})}),(0,u.jsx)(d.xu,{children:(0,u.jsx)(d.xv,{muted:!C,size:1,weight:"medium",children:_("preview-frame.overlay.toggle-button.text")})})]})})}),(0,u.jsx)(d.xu,{flex:1,marginX:1,children:(0,u.jsx)(eQ,{prefix:(0,u.jsx)(d.xu,{padding:1,children:(0,u.jsx)(d.u,{animate:!0,content:(0,u.jsx)(d.xv,{size:1,children:"loaded"===r.status?_("preview-frame.refresh-button.tooltip"):_("preview-frame.status",{context:r.status})}),fallbackPlacements:["bottom-start"],padding:2,placement:"bottom",portal:!0,children:(0,u.jsx)(d.zx,{"aria-label":_("preview-frame.refresh-button.aria-label"),fontSize:1,icon:g.DuK,mode:"bleed",loading:"reloading"===r.status||"refreshing"===r.status,onClick:F,padding:2})})}),onChange:s,origin:W,suffix:(0,u.jsx)(d.xu,{padding:1,children:(0,u.jsx)(d.j2,{button:(0,u.jsx)(d.zx,{fontSize:1,iconRight:g.aAc,mode:"bleed",padding:2,space:2}),id:"location-menu",menu:(0,u.jsx)(d.v2,{children:(0,u.jsx)(e0,{initialUrl:i,openPopup:c,previewLocationOrigin:W,previewLocationRoute:J})}),popover:{animate:!0,constrainSize:!0,placement:"bottom",portal:!0}})}),value:J})}),(0,u.jsx)(d.kC,{align:"center",flex:"none",gap:1,padding:1,children:(0,u.jsx)(d.j2,{button:(0,u.jsx)(d.zx,{fontSize:1,iconRight:g.v4q,mode:"bleed",padding:2,space:2,text:_(e3["connected"===a?m:"previewDrafts"]),loading:"reconnecting"===a&&"loaded"!==r.status,disabled:"connected"!==a}),id:"perspective-menu",menu:(0,u.jsxs)(d.v2,{style:{maxWidth:240},children:[(0,u.jsx)(d.sN,{fontSize:1,onClick:()=>x("previewDrafts"),padding:3,pressed:"previewDrafts"===m,tone:"caution",children:(0,u.jsxs)(d.kC,{align:"flex-start",ga
51p:3,children:[(0,u.jsx)(d.xu,{flex:"none",children:(0,u.jsx)(d.xv,{size:1,children:(0,p.createElement)(e5.previewDrafts)})}),(0,u.jsxs)(d.Kq,{flex:1,space:2,children:[(0,u.jsx)(d.xv,{size:1,weight:"medium",children:_(e3.previewDrafts)}),(0,u.jsx)(d.xv,{muted:!0,size:1,children:_("preview-frame.perspective.previewDrafts.text")})]}),(0,u.jsx)(d.xu,{flex:"none",children:(0,u.jsx)(d.xv,{muted:!0,size:1,style:{opacity:"previewDrafts"===m?1:0},children:(0,u.jsx)(g.KML,{})})})]})}),(0,u.jsx)(d.sN,{fontSize:1,onClick:()=>x("published"),padding:3,pressed:"published"===m,tone:"positive",children:(0,u.jsxs)(d.kC,{align:"flex-start",gap:3,children:[(0,u.jsx)(d.xu,{flex:"none",children:(0,u.jsx)(d.xv,{size:1,children:(0,p.createElement)(e5.published)})}),(0,u.jsxs)(d.Kq,{flex:1,space:2,children:[(0,u.jsx)(d.xv,{size:1,weight:"medium",children:_(e3.published)}),(0,u.jsx)(d.xv,{muted:!0,size:1,children:_("preview-frame.perspective.published.text")})]}),(0,u.jsx)(d.xu,{flex:"none",children:(0,u.jsx)(d.xv,{muted:!0,size:1,style:{opacity:"published"===m?1:0},children:(0,u.jsx)(g.KML,{})})})]})})]}),popover:{animate:!0,constrainSize:!0,placement:"bottom",portal:!0}})}),(0,u.jsx)(d.kC,{align:"center",flex:"none",gap:1,children:(0,u.jsx)(d.u,{animate:!0,content:(0,u.jsx)(d.xv,{size:1,children:_("preview-frame.viewport-button.tooltip",{context:"desktop"===S?"narrow":"full"})}),fallbackPlacements:["bottom-start"],padding:2,placement:"bottom",portal:!0,children:(0,u.jsx)(d.zx,{"aria-label":_("preview-frame.viewport-button.aria-label"),fontSize:1,icon:"desktop"===S?g.RbG:g.ugZ,mode:"bleed",onClick:A,padding:2})})})]})}),(0,u.jsx)(d.Zb,{flex:1,tone:"transparent",children:(0,u.jsxs)(d.kC,{align:"center",height:"fill",justify:"center",padding:"desktop"===S?0:2,sizing:"border",style:{position:"relative",cursor:N?"wait":void 0},children:[(0,u.jsx)(R.M,{children:T||L||O||!Z||V?(L||"connecting"===h&&"refreshing"!==r.status)&&!V?(0,u.jsx)(e2,{initial:"initial",animate:"animate",exit:"exit",variants:e9,justify:"center",align:"center",style:{inset:"0",position:"absolute"},children:(0,u.jsxs)(d.kC,{style:{...e7[S]},justify:"center",align:"center",direction:"column",gap:4,children:[(0,u.jsx)(d.$j,{muted:!0}),(0,u.jsx)(d.xv,{muted:!0,size:1,children:_("preview-frame.status",{context:"loading"})})]})}):T&&!V?(0,u.jsx)(e2,{initial:"initial",animate:"animate",exit:"exit",variants:e6,justify:"center",align:"center",style:{background:"var(--card-bg-color)",inset:"0",position:"absolute",borderTop:"1px solid transparent",boxShadow:"0 0 0 1px var(--card-border-color)"},children:(0,u.jsx)(ej,{flex:1,message:_("preview-frame.connection.error.text"),onRetry:K,onContinueAnyway:q,children:z&&(0,u.jsxs)(u.Fragment,{children:["connected"!==h&&(0,u.jsx)(d.Zb,{padding:3,radius:2,tone:"critical",children:(0,u.jsxs)(d.Kq,{space:3,children:[(0,u.jsx)(d.__,{muted:!0,size:0,children:_("preview-frame.overlay.connection-status.label")}),(0,u.jsx)(d.EK,{size:1,children:_("channel.status",{context:h})})]})}),"connected"!==a&&(0,u.jsx)(d.Zb,{padding:3,radius:2,tone:"critical",children:(0,u.jsxs)(d.Kq,{space:3,children:[(0,u.jsx)(d.__,{muted:!0,size:0,children:_("preview-frame.loader.connection-status.label")}),(0,u.jsx)(d.EK,{size:1,children:_("channel.status",{context:a})})]})})]})})}):null:(0,u.jsx)(e2,{initial:"initial",animate:"animate",exit:"exit",variants:e9,justify:"center",align:"center",style:{inset:"0",position:"absolute",backdropFilter:D?"blur(16px) saturate(0.5) grayscale(0.5)":"blur(2px)",transition:"backdrop-filter 0.2s ease-in-out",WebkitBackdropFilter:D?"blur(16px) saturate(0.5) grayscale(0.5)":"blur(2px)",WebkitTransition:"-webkit-backdrop-filter 0.2s ease-in-out",zIndex:1},children:(0,u.jsxs)(d.kC,{style:{...e7[S]},justify:"center",align:"center",direction:"column",gap:4,children:[D&&(0,u.jsx)(d.zx,{disabled:!0,fontSize:1,mode:"ghost",text:_("preview-frame.continue-button.text"),style:{opacity:0}}),(0,u.jsx)(d.Zb,{radius:2,tone:D?"caution":"inherit",padding:4,shadow:1,children:(0,u.jsxs)(d.kC,{justify:"center",align:"center",direction:"column",gap:4,children:[(0,u.jsx)(d.$j,{muted:!0}
51),(0,u.jsx)(d.xv,{muted:!0,size:1,children:_("preview-frame.status",D?{context:"timeout"}:{context:"connecting"})})]})}),D&&(0,u.jsx)(d.zx,{fontSize:1,tone:"critical",onClick:q,text:_("preview-frame.continue-button.text")})]})})}),(0,u.jsx)(eY,{ref:t,style:{pointerEvents:(L||"connecting"===h&&"refreshing"!==r.status)&&!V?"none":"auto",boxShadow:"0 0 0 1px var(--card-border-color)",borderTop:"1px solid transparent"},src:i.toString(),initial:["background"],variants:e8,animate:[(L||"connecting"===h&&"refreshing"!==r.status)&&!V?"background":"active",L?"reloading":"idle",S,Z&&!V?"timedOut":""],onLoad:H})]})})]})})}),e7={desktop:{width:"100%",height:"100%"},mobile:{width:375,height:650}},e9={initial:{opacity:1},animate:{opacity:[0,0,1]},exit:{opacity:[1,0,0]}},e6={initial:{opacity:1},animate:{opacity:[0,0,1]},exit:{opacity:[1,0,0]}},e8={desktop:{...e7.desktop,boxShadow:"0 0 0 0px var(--card-border-color)"},mobile:{...e7.mobile,boxShadow:"0 0 0 1px var(--card-border-color)"},background:{opacity:0,scale:1},idle:{scale:1},reloading:{scale:[1,1,1,.98]},active:{opacity:[0,0,1],scale:1},timedOut:{opacity:[0,0,1]}},te=!1;function tt(e,t){return e instanceof Function?e(t):e}function tn(e){return Object.fromEntries(Object.entries(e).filter(([,e])=>void 0!==e&&""!==e&&null!==e))}let tr=Symbol(),ti=(0,p.lazy)(()=>n.e(1140).then(n.bind(n,11140))),ta=(0,p.lazy)(()=>n.e(5054).then(n.bind(n,35054))),to=(0,m.zo)(d.kC)`
52  overflow-x: auto;
53`;function ts(e){var t,n,r,i;let{previewUrl:a,components:o}=null!=(t=e.tool.options)?t:{},s=e.tool.name||v.D,{unstable_navigator:l}=o||{},{navigate:m,state:g}=(0,h.tv)(),y=(0,f.BoV)(Object.fromEntries(g._searchParams||[])),x=function(e,t,n){var r,i;let a=(0,f.m85)({apiVersion:v.A}),o=(0,f.AJ_)(),s=(null==(r=null==o?void 0:o.activeWorkspace)?void 0:r.basePath)||"/",l=function(e,t,n,r){let[i,a]=(0,p.useState)(()=>r||""),o=(0,p.useRef)(0);(0,p.useEffect)(()=>{if(i&&r)return window.clearTimeout(o.current),()=>{o.current=window.setTimeout(()=>{a("")},100)}},[i,r]);let s=(0,f.xJ)();return(0,p.useMemo)(()=>["@sanity/presentation",t,n,e,null==s?void 0:s.id,tr,i],[t,null==s?void 0:s.id,e,n,i])}(t,s,(null==(i=null==o?void 0:o.activeWorkspace)?void 0:i.name)||"default",n),u=function(e,t){let n=(0,f.m85)({apiVersion:v.A}),r=(0,f.xJ)(),[i,a]=(0,p.useState)(""),o=e?(0,M.Rq)(async()=>await I(n,"@sanity/presentation",typeof window>"u"?"":location.href,null==r?void 0:r.id),[...t,i]):null;return(0,p.useEffect)(()=>{if(!o)return;let e=setTimeout(()=>{(0,p.startTransition)(()=>a(o.expiresAt.toString()))},o.expiresAt.getTime()-Date.now());return()=>clearTimeout(e)},[o]),(null==o?void 0:o.secret)||null}("object"==typeof e||"function"==typeof e,l);return(0,M.Rq)(async()=>{if("string"==typeof e){let t=new URL(e,location.origin),r=t;try{if(n){let e=new URL(n,t);e.origin===t.origin&&(r=e)}else if(document.referrer){let e=new URL(document.referrer);e.origin===t.origin&&(r=e)}}catch{}return location.origin===r.origin&&(r.pathname.startsWith(`${s}/`)||r.pathname===s)?t:r}let t=await ("object"==typeof e?function(e){let{draftMode:t,previewMode:n,origin:r=typeof location>"u"?"https://localhost":location.origin}=e,i=(null==n?void 0:n.enable)||(null==t?void 0:t.enable),{preview:a="/"}=e,o=new URL(a,r),s=i?new URL(i,r):void 0;return async t=>{try{if(t.previewSearchParam){let e=new URL(t.previewSearchParam,o);e.origin===o.origin&&(a=`${e.pathname}${e.search}`)}else if(t.referrer){let e=new URL(t.referrer);e.origin===o.origin&&(a=`${e.pathname}${e.search}`)}}catch{}"u">typeof location&&location.origin===o.origin&&t.studioBasePath&&(a.startsWith(`${t.studioBasePath}/`)||a===t.studioBasePath)&&(a=e.preview||"/");let n=new URL(a,o);if(s){let e=new URL(s),{searchParams:r}=e;return r.set(j,t.previewUrlSecret),n.pathname!==e.pathname&&r.set(k,`${n.pathname}${n.search}`),e.toString()}return n.toString()}}(e):e)({client:a,previewUrlSecret:u,previewSearchParam:n,referrer:typeof document>"u"?null:document.referrer,studioBasePath:s});return new URL(t,location.origin)},[...l,u])}(a||"/",s,y.preview||null),[b]=(0,p.useState)(()=>{var t;let n=null==(t=e.tool.options)?void 0:t.devMode;return"function"==typeof n?n():"boolean"==typeof n?n:"u">typeof window&&"localhost"===window.location.hostname}),w=(0,p.useMemo)(()=>x.origin,[x.origin]),P=(0,p.useRef)(null),[E,S]=(0,p.useState)(),[C,_]=(0,p.useState)({}),$=(0,p.useRef)({title:void 0,url:void 0}
53),{navigate:R,params:z,searchParams:O,structureParams:T}=function({initialPreviewUrl:e,routerNavigate:t,routerState:n,routerSearchParams:r,frameStateRef:i}){let a=(0,p.useMemo)(()=>{let{id:t,path:i,type:a}={id:function(e){var t;if(void 0===e)return;let n=null==(t=decodeURIComponent(e))?void 0:t.split(".");return"drafts"===n[0]&&n.shift(),n.join(".")}(n.id),path:function(e){if(void 0!==e)return c.eT.toString(function(e){let t=[];for(let n of e.split(".")){let e=ee.exec(n);if(e){t.push(e[1],Number(e[2]));continue}let r=et.exec(n);if(r){t.push(r[1],[Number(r[2]),Number(r[3])]);continue}let i=en.exec(n);i?t.push(i[1],{_key:i[2]}):t.push(n)}return t}(decodeURIComponent(e)))}(n.path),type:n.type};return{id:t,type:a,path:i,preview:r.preview||`${e.pathname}${e.search}`,perspective:r.perspective,viewport:r.viewport,inspect:r.inspect,rev:r.rev,prefersLatestPublished:r.prefersLatestPublished,since:r.since,template:r.template,templateParams:r.templateParams,view:r.view,pathKey:r.pathKey,instruction:r.instruction,comment:r.comment}},[n,r,e]),o=(0,p.useMemo)(()=>tn({inspect:a.inspect,path:a.path,rev:a.rev,prefersLatestPublished:a.prefersLatestPublished,since:a.since,template:a.template,templateParams:a.templateParams,view:a.view,pathKey:a.pathKey,instruction:a.instruction,comment:a.comment}),[a.comment,a.inspect,a.instruction,a.path,a.pathKey,a.prefersLatestPublished,a.rev,a.since,a.template,a.templateParams,a.view]),s=(0,p.useMemo)(()=>tn({perspective:a.perspective,preview:a.preview,viewport:a.viewport}),[a.perspective,a.preview,a.viewport]),l=(0,p.useRef)(n);return(0,p.useEffect)(()=>{l.current=n},[n]),{navigate:(0,p.useCallback)((e,n={},r)=>{e.id&&(e.id=(0,f.vsM)(e.id));let{_searchParams:a,...o}=l.current,s=(a||[]).reduce((e,[t,n])=>(e[t]=n,e),{}),u=tn({...o,...e}),c=tn({...s,...n});o.id!==u.id&&(delete c.template,delete c.templateParams),u._searchParams=Object.entries(c).reduce((e,[t,n])=>[...e,[t,n]],[]),t(u,{replace:null!=r?r:c.preview===i.current.url})},[t,i]),params:a,searchParams:s,structureParams:o}}({initialPreviewUrl:x,routerNavigate:m,routerState:g,routerSearchParams:y,frameStateRef:$}),U=(0,p.useMemo)(()=>es(R,50),[R]),[N,W]=(0,p.useReducer)(eZ,{},eX),F=(0,p.useMemo)(()=>z.perspective?"published":"previewDrafts",[z.perspective]),K=(0,p.useMemo)(()=>z.viewport?"mobile":"desktop",[z.viewport]),[q,V]=function(e,t){if("published"!==e&&"previewDrafts"!==e)throw Error(`Invalid perspective: ${e}`);let[n,r]=(0,p.useState)({}),[i,a]=(0,p.useState)({}),o=(0,p.useRef)(""),s=(0,p.useCallback)((e,n,i=[])=>{let s=i.filter(e=>"_projectId"in e&&e._projectId?(te||(console.warn("Cross dataset references are not supported yet, ignoring source document",e),te=!0),!1):e);("published"===n?r:a)(n=>{let r={};for(let e of s)r[e._id]=e;return o.current!==t.current.url?(o.current=t.current.url,{[e]:r}):A(n[e],r)?n:{...n,[e]:r}})},[t]);return[(0,p.useMemo)(()=>Object.values(Object.values("published"===e?n:i).reduce((e,t)=>(Object.values(t).forEach(t=>{e[t._id]=t}),e),{})),[e,i,n]),s]}(F,$),Z=(0,f.vpR)(),G=(0,f.p9V)(),J=function(e){let{navigate:t,resolvers:n=[],path:r,previewUrl:i}=e,{state:a}=(0,h.tv)(),o=(0,f.m85)({apiVersion:v.A}),[s,l]=(0,p.useState)(void 0),u=(0,p.useRef)(void 0),c=(0,p.useMemo)(()=>{var e,t;return new URL(r||(null==(t=null==(e=a._searchParams)?void 0:e.find(([e])=>"preview"===e))?void 0:t[1])||"","string"==typeof i?i:"object"==typeof i&&(null==i?void 0:i.origin)||location.origin)},[r,i,a._searchParams]),d=(0,p.useCallback)(()=>{l(void 0),u.current=void 0},[]);return(0,p.useEffect)(()=>{var e,r,i,a,s;if(n.length&&c){let d;for(let e of n){let t=function(e,t){for(e of Array.isArray(e)?e:[e]){let n,r=e;if("string"==typeof e)try{let t=new URL(e);n=t.origin,r=t.pathname}catch{}if(!n||t.origin===n)try{let e=(function(e,t){var n=[];return function(e,t,n){void 0===n&&(n={});var r=n.decode,i=void 0===r?function(e){return e}:r;return function(n){var r=e.exec(n);if(!r)return!1;for(var a=r[0],o=r.index,s=Object.create(null),l=1;l<r.length;l++)!function(e){if(void 0!==r[e]){var n=t[e-1];"*"===n.modifier||"+"===n.modifier?s[n.name]=r[e].split(n.prefix+n.suffix
53).map(function(e){return i(e,n)}):s[n.name]=i(r[e],n)}}(l);return{path:a,index:o,params:s}}}(function e(t,n,r){var i;return t instanceof RegExp?function(e,t){if(!t)return e;for(var n=/\((?:\?<(.*?)>)?(?!\?)/g,r=0,i=n.exec(e.source);i;)t.push({name:i[1]||r++,prefix:"",suffix:"",modifier:"",pattern:""}),i=n.exec(e.source);return e}(t,n):Array.isArray(t)?(i=t.map(function(t){return e(t,n,r).source}),new RegExp("(?:".concat(i.join("|"),")"),D(r))):function(e,t,n){void 0===n&&(n={});for(var r=n.strict,i=void 0!==r&&r,a=n.start,o=n.end,s=n.encode,l=void 0===s?function(e){return e}:s,u=n.delimiter,c=n.endsWith,d="[".concat(L(void 0===c?"":c),"]|$"),p="[".concat(L(void 0===u?"/#?":u),"]"),f=void 0===a||a?"^":"",h=0;h<e.length;h++){var m=e[h];if("string"==typeof m)f+=L(l(m));else{var v=L(l(m.prefix)),g=L(l(m.suffix));if(m.pattern){if(t&&t.push(m),v||g){if("+"===m.modifier||"*"===m.modifier){var y="*"===m.modifier?"?":"";f+="(?:".concat(v,"((?:").concat(m.pattern,")(?:").concat(g).concat(v,"(?:").concat(m.pattern,"))*)").concat(g,")").concat(y)}else f+="(?:".concat(v,"(").concat(m.pattern,")").concat(g,")").concat(m.modifier)}else"+"===m.modifier||"*"===m.modifier?f+="((?:".concat(m.pattern,")").concat(m.modifier,")"):f+="(".concat(m.pattern,")").concat(m.modifier)}else f+="(?:".concat(v).concat(g,")").concat(m.modifier)}}if(void 0===o||o)i||(f+="".concat(p,"?")),f+=n.endsWith?"(?=".concat(d,")"):"$";else{var x=e[e.length-1],b="string"==typeof x?p.indexOf(x[x.length-1])>-1:void 0===x;i||(f+="(?:".concat(p,"(?=").concat(d,"))?")),b||(f+="(?=".concat(p,"|").concat(d,")"))}return new RegExp(f,D(n))}(function(e,t){void 0===t&&(t={});for(var n=function(e){for(var t=[],n=0;n<e.length;){var r=e[n];if("*"===r||"+"===r||"?"===r){t.push({type:"MODIFIER",index:n,value:e[n++]});continue}if("\\"===r){t.push({type:"ESCAPED_CHAR",index:n++,value:e[n++]});continue}if("{"===r){t.push({type:"OPEN",index:n,value:e[n++]});continue}if("}"===r){t.push({type:"CLOSE",index:n,value:e[n++]});continue}if(":"===r){for(var i="",a=n+1;a<e.length;){var o=e.charCodeAt(a);if(o>=48&&o<=57||o>=65&&o<=90||o>=97&&o<=122||95===o){i+=e[a++];continue}break}if(!i)throw TypeError("Missing parameter name at ".concat(n));t.push({type:"NAME",index:n,value:i}),n=a;continue}if("("===r){var s=1,l="",a=n+1;if("?"===e[a])throw TypeError('Pattern cannot start with "?" at '.concat(a));for(;a<e.length;){if("\\"===e[a]){l+=e[a++]+e[a++];continue}if(")"===e[a]){if(0==--s){a++;break}}else if("("===e[a]&&(s++,"?"!==e[a+1]))throw TypeError("Capturing groups are not allowed at ".concat(a));l+=e[a++]}if(s)throw TypeError("Unbalanced pattern at ".concat(n));if(!l)throw TypeError("Missing pattern at ".concat(n));t.push({type:"PATTERN",index:n,value:l}),n=a;continue}t.push({type:"CHAR",index:n,value:e[n++]})}return t.push({type:"END",index:n,value:""}),t}(e),r=t.prefixes,i=void 0===r?"./":r,a="[^".concat(L(t.delimiter||"/#?"),"]+?"),o=[],s=0,l=0,u="",c=function(e){if(l<n.length&&n[l].type===e)return n[l++].value},d=function(e){var t=c(e);if(void 0!==t)return t;var r=n[l],i=r.type,a=r.index;throw TypeError("Unexpected ".concat(i," at ").concat(a,", expected ").concat(e))},p=function(){for(var e,t="";e=c("CHAR")||c("ESCAPED_CHAR");)t+=e;return t};l<n.length;){var f=c("CHAR"),h=c("NAME"),m=c("PATTERN");if(h||m){var v=f||"";-1===i.indexOf(v)&&(u+=v,v=""),u&&(o.push(u),u=""),o.push({name:h||s++,prefix:v,suffix:"",pattern:m||a,modifier:c("MODIFIER")||""});continue}var g=f||c("ESCAPED_CHAR");if(g){u+=g;continue}if(u&&(o.push(u),u=""),c("OPEN")){var v=p(),y=c("NAME")||"",x=c("PATTERN")||"",b=p();d("CLOSE"),o.push({name:y||(x?s++:""),pattern:y&&!x?a:x,prefix:v,suffix:b,modifier:c("MODIFIER")||""});continue}d("END")}return o}(t,r),n,r)}(e,n,t),n,t)})(r,{decode:decodeURIComponent})(t.pathname);if(e){let{params:t,path:r}=e;return{origin:n,params:t,path:r}}}catch{throw Error(`"${e}" is not a valid route pattern`)}}}(e.route,c);if(t){d={context:t,resolver:e};break}}if(d){let n=function(e,t){var n;if(e.resolve){let r=null==(n=e.resolve(t))?void 0:n.filter;return r?`*[${r}][0]{_id, _type}`:void 0}return"type"in e?`*[_type == "${e.type}"][0]{_id, _type}`:`*[${tt(e.filter,t)}][0]{_id, _type}`}(d.resolver,d.context),p=(e=d.resolver,r=d.context,e.resolve?null!=(a=null==(i=e.resolve(r))?void 0:i.params)?a:r.params:"type"in e?{}:null!=(s=tt(e.params,r))?s:r.params);if(n){let e=new AbortController,r={perspective:"previewDrafts",signal:e.signal};return o.fetch(n,p,r).then(e=>{e&&u.current===e._id||(l({document:e,path:c.pathname}),null==t||t({id:null==e?void 0:e._id,type:null==e?void 0:e._type}),u.current=null==e?void 0:e._id)}).catch(e=>{e instanceof Error&&"AbortError"===e.name||(l({document:void 0,path:c.pathname}),u.current=void 0)}),()=>{e.abort()}}}}d()},[o,d,t,n,c]),s}({resolvers:null==(r=null==(n=e.tool.options)?void 0:n.resolve)?void 0:r.mainDocuments,previewUrl:null==(i=e.tool.options)?void 0:i.previewUrl,path:z.preview,navigate:R}),[H,X]=(0,p.useState)("connecting"),[Y,Q]=(0,p.useState)("connecting"),[er,ei]=(0,p.useState)("connecting"),[el]=(0,p.useState)(()=>new Set),eu=(0,p.useCallback)(e=>{let t=window.open(e,"_blank");t&&el.add(t)},[el]);(0,p.useEffect)(()=>
53{if(el.size&&E)for(let e of el)e&&"closed"in e&&!e.closed&&E.addSource(e)},[E,el,el.size]);let ed=(0,p.useRef)(F);(0,p.useEffect)(()=>{ed.current=F},[F]),(0,p.useEffect)(()=>{var e;let t=null==(e=P.current)?void 0:e.contentWindow;if(!t)return;let n=function(e){let{destroy:t,send:n}=B(e),r=new Set,i=new WeakMap,a=new Set;return{destroy:()=>{for(let e of(t(),a))e()},send:(e,...t)=>{for(let a of(n(e,...t),r))a&&"closed"in a&&!a.closed&&i.has(a)&&i.get(a)(e,...t)},addSource(t){if(r.has(t))return;if(!("closed"in t))throw console.warn("Source is unsupported",{source:t}),Error("Source is unsupported");if(t.closed)throw Error("Source is closed");let{send:n,destroy:o}=B({...e,target:t,connectTo:e.connectTo.map(e=>{let{onStatusUpdate:t,onEvent:n,...r}=e;return{...r,onEvent:n?(...e)=>{let[t]=e;if("preview-kit/documents"!==t&&"overlay/navigate"!==t&&"loader/documents"!==t)return n(...e)}:void 0}})});a.add(o),i.set(t,n),r.add(t)}}}({id:"presentation",target:t,targetOrigin:w,connectTo:[{id:"overlays",heartbeat:!0,onStatusUpdate:X,onEvent(e,t){if(("visual-editing/focus"===e||"overlay/focus"===e)&&"id"in t)U({type:t.type,id:t.id,path:t.path},{prefersLatestPublished:"isDraft"in t||"previewDrafts"===ed.current?void 0:"true"});else if("visual-editing/navigate"===e||"overlay/navigate"===e){let{title:e,url:n}=t;$.current.url!==n&&U({},{preview:n}),$.current={title:e,url:n}}else"visual-editing/meta"===e?$.current.title=t.title:"visual-editing/toggle"===e||"overlay/toggle"===e?W({type:eB,enabled:t.enabled}):"visual-editing/documents"===e?V("visual-editing",t.perspective,t.documents):"visual-editing/refreshing"===e&&"manual"===t.source?clearTimeout(eS.current):"visual-editing/refreshing"===e&&"mutation"===t.source?W({type:eq}):"visual-editing/refreshed"===e&&W({type:eK})}},{id:"loaders",heartbeat:!0,onStatusUpdate:Q,onEvent(e,t){if("loader/documents"===e&&t.projectId===Z&&t.dataset===G)V("loaders",t.perspective,t.documents);else if("loader/query-listen"===e&&t.projectId===Z&&t.dataset===G){if("number"==typeof t.heartbeat&&t.heartbeat<v.c)throw Error(`Loader query listen heartbeat interval must be at least ${v.c}ms`);_(e=>{var n,r,i;return{...e,[(r=t.query,i=t.params,`${r}-${"string"==typeof i?i:JSON.stringify(i)}`)]:{perspective:t.perspective,query:t.query,params:t.params,receivedAt:Date.now(),heartbeat:null!=(n=t.heartbeat)&&n}}})}}},{id:"preview-kit",heartbeat:!0,onStatusUpdate:ei,onEvent(e,t){"preview-kit/documents"===e&&t.projectId===Z&&t.dataset===G&&V("preview-kit",t.perspective,t.documents)}}]});return S(n),()=>{n.destroy(),S(void 0)}},[G,Z,V,U,w]),(0,p.useEffect)(()=>{let e=setInterval(()=>_(e=>{if(Object.keys(e).length<1)return e;let t=Date.now();if(!Object.values(e).some(e=>!1!==e.heartbeat&&t>e.receivedAt+e.heartbeat))return e;let n={};for(let[r,i]of Object.entries(e))!1!==i.heartbeat&&t>i.receivedAt+i.heartbeat||(n[r]=i);return n}),v.c);return()=>clearInterval(e)},[]);let ep=(0,p.useCallback)(e=>{U({path:c.eT.toString(e)},{},!0)},[U]),ef=(0,p.useCallback)(e=>{let t=new URL(e,x.origin),n=t.pathname+t.search;t.origin===x.origin&&n!==z.preview&&U({},{preview:n})},[x,z,U]),eh=(0,p.useCallback)(e=>{U({},{...e,prefersLatestPublished:void 0})},[U]);(0,p.useEffect)(()=>{null==E||E.send("overlays","presentation/perspective",{perspective:F})},[E,F]),(0,p.useEffect)(()=>{z.id&&z.path?null==E||E.send("overlays","presentation/focus",{id:z.id,path:z.path}):null==E||E.send("overlays","presentation/blur",void 0)},[E,z.id,z.path]);let em=(0,p.useRef)(void 0);(0,p.useEffect)(()=>{"published"!==F||!z.id||z.id===em.current||z.rev||z.prefersLatestPublished||U({},{prefersLatestPublished:"true"},!0),em.current=z.id},[U,z.id,z.prefersLatestPublished,z.rev,F]),(0,p.useEffect)(()=>{$.current.url&&z.preview&&$.current.url!==z.preview&&($.current.url=z.preview,"connected"!==H&&P.current?P.current.src=`${w}${z.preview}`:null==E||E.send("overlays","presentation/navigate",{url:z.preview,type:"replace"}))},[E,H,w,z.preview]);let ev=(0,p.useCallback)(()=>null==E?void 0:E.send("overlays","presentation/toggleOverlay",void 0),[E]),[eg,ey]=(0,p.useState)(null);(0,p.useEffect)(()=>{let e=e=>{eo(e)&&ev()},t=e=>{eo(e)&&ev(),["mod","\\"].every(t=>ea[t]?e[ea[t]]:e.key===t.toUpperCase())&&ev()};return window.addEventListener("keydown",t),window.addEventListener("keyup",e),()=>{window.removeEventListener("keydown",t),window.removeEventListener("keyup",e)}},[ev]);let[ex,eb]=(0,p.useState)(null),[{navigatorEnabled:ej,toggleNavigator:ek},eP]=function(e){let{unstable_navigator:t}=e,n=!(null==t||!t.component),[r,i]=function(e,t){let[n,r]=(0,p.useState)(()=>{var n;return JSON.parse(null!=(n=localStorage.getItem(e))?n:JSON.stringify(t))});return(0,p.useEffect)(()=>{localStorage.setItem(e,JSON.stringify(n))},[e,n]),[n,r]}("presentation/navigator",n),a=!!n&&r,o=(0,p.useMemo)(()=>
53{if(n)return()=>i(e=>!e)},[n,i]),s=(0,p.useCallback)(function(){return(0,u.jsx)(u.Fragment,{children:a&&(0,u.jsx)(eN,{...t})})},[a,t]);return[{navigatorEnabled:a,toggleNavigator:o},s]}({unstable_navigator:l}),eE=(0,p.useRef)(z.id);(0,p.useEffect)(()=>{z.rev&&eE.current&&z.id!==eE.current&&U({},{rev:void 0}),eE.current=z.id});let eS=(0,p.useRef)(),eC=(0,p.useCallback)(e=>{if(W({type:eq}),E)return eS.current=window.setTimeout(e,300),void E.send("overlays","presentation/refresh",{source:"manual",livePreviewEnabled:"connected"===er||"connected"===Y});e()},[E,Y,er]),e_=(0,f.cFj)(),e$=(0,p.useCallback)(({id:e,type:t,path:n})=>{if($.current.url)return{title:$.current.title||$.current.url,name:"edit",params:{id:e,path:n,type:t,inspect:v.C,workspace:e_.name,mode:v.E,preview:z.preview}}},[z.preview,e_.name]),eR=(0,p.useCallback)(e=>{U({},{viewport:"desktop"===e?void 0:"mobile"},!0)},[U]),ez=(0,p.useCallback)(e=>{U({},{perspective:"previewDrafts"===e?void 0:e})},[U]);return(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(eF,{devMode:b,name:s,navigate:U,params:z,searchParams:O,structureParams:T,children:(0,u.jsx)(eU,{navigate:U,children:(0,u.jsx)(eW,{params:z,children:(0,u.jsx)(to,{height:"fill",children:(0,u.jsxs)(ew,{children:[(0,u.jsx)(eP,{}),(0,u.jsx)(ec,{id:"preview",minWidth:325,defaultSize:ej?50:75,order:3,children:(0,u.jsx)(d.kC,{direction:"column",flex:1,height:"fill",ref:eb,children:(0,u.jsx)(d.NM,{element:ex,children:(0,u.jsx)(e4,{dispatch:W,iframe:N.iframe,initialUrl:x,loadersConnection:Y,navigatorEnabled:ej,onPathChange:ef,onRefresh:eC,openPopup:eu,overlaysConnection:H,previewUrl:z.preview,perspective:F,ref:P,setPerspective:ez,setViewport:eR,targetOrigin:w,toggleNavigator:ek,toggleOverlay:ev,viewport:K,visualEditing:N.visualEditing})})})}),(0,u.jsx)(eT,{documentId:z.id,documentsOnPage:q,documentType:z.type,getCommentIntent:e$,mainDocumentState:J,onFocusPath:ep,onStructureParams:eh,searchParams:O,setDisplayedDocument:ey,structureParams:T})]})})})})}),E&&(0,u.jsx)(p.Suspense,{children:(0,u.jsx)(ti,{channel:E,liveQueries:C,perspective:F,liveDocument:eg,documentsOnPage:q})}),E&&z.id&&z.type&&(0,u.jsx)(p.Suspense,{children:(0,u.jsx)(ta,{channel:E,id:z.id,type:z.type,loadersConnection:Y,previewKitConnection:er})})]})}}}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.