@lincyaw/dsh 0.2.0-rc.83 → 0.2.0-rc.85
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/build/dist/client.js +2 -2
- package/build/dist/client.json +1 -0
- package/package.json +7 -7
package/build/dist/client.js
CHANGED
|
@@ -722,8 +722,8 @@ button {
|
|
|
722
722
|
`:K2(t)?G2(t.children):"\uFFFC").join("")}function f8(e,t){let n=o=>{if(o.type==="paragraph"||o.type==="heading")t.text(o.id,G2(o.children));else if(o.type==="code")t.text(o.id,o.value);else if(o.type==="list")for(let i of o.children){let[a,...s]=i.children;t.text(i.id,a?.type==="paragraph"?G2(a.children):""),(a?.type==="paragraph"?s:i.children).forEach(n)}else if(o.type==="blockquote"){let[i,...a]=o.children;i?.type==="paragraph"?(t.text(o.id,G2(i.children)),a.forEach(n)):o.children.forEach(n)}else if(o.type==="table")for(let i of o.children)for(let a of i.children)t.text(a.id,G2(a.children))},r=o=>{t.place(o);let i=e.blocks[o];i?.type==="text"?i.content.forEach(n):i?.type==="code"&&i.value!==void 0?t.text(o,i.value):(i?.type==="container"||i?.type==="component")&&i.children?.forEach(r)};for(let o of e.sectionOrder){let i=e.sections[o];i&&(t.place(`page:${o}`),t.text(`page:${o}`,i.title),i.children.forEach(r))}}function d1(e){let t=new Map;return f8(e,{place(){},text:(n,r)=>{t.set(n,{order:t.size,text:r})}}),t}function p8(e){let t=new Map,n=r=>{t.has(r)||t.set(r,t.size)};return f8(e,{place:n,text:n}),t}function Y0(e,t){for(let n of e.sectionOrder){let r=[...e.sections[n].children],o=new Set;for(;r.length;){let i=r.pop();if(i===t)return n;if(o.has(i))continue;o.add(i);let a=e.blocks[i];(a?.type==="container"||a?.type==="component")&&r.push(...a.children??[])}}}function Z0(e){if(e){if(Po(e))return JSON.stringify(["place",e.blockId,e.stepId??null]);if(K0(e))return JSON.stringify(["text",e.from.blockId,e.from.offset,e.to.blockId,e.to.offset])}}var J2=class extends Error{status;constructor(t,n){super(n),this.status=t,this.name="DocumentCommentError"}};function As(e,t){throw new J2(e,t)}function gh(e,t){if(!t)return;if(Po(t)){if(Object.hasOwn(e.blocks,t.blockId)||As(422,"comment-anchor-target-unavailable"),t.stepId!==void 0){let i=Object.hasOwn(e.steps,t.stepId)?e.steps[t.stepId]:void 0,a=i?e.sections[i.sectionId]:void 0;(!i||!a||!a.stepOrder.includes(t.stepId)||i.sectionId!==Y0(e,t.blockId))&&As(422,"comment-anchor-target-unavailable")}return}K0(t)||As(422,"comment-anchor-target-unavailable");let n=d1(e),r=n.get(t.from.blockId),o=n.get(t.to.blockId);(!r||!o)&&As(422,"comment-anchor-target-unavailable");for(let[i,a]of[[t.from,r],[t.to,o]]){let s=i.offset;(!Number.isSafeInteger(s)||s<0||s>a.text.length||s>0&&s<a.text.length&&/[\uD800-\uDBFF]/.test(a.text[s-1])&&/[\uDC00-\uDFFF]/.test(a.text[s]))&&As(422,"comment-anchor-offset-invalid")}(r.order>o.order||r.order===o.order&&t.from.offset>=t.to.offset)&&As(422,"comment-anchor-range-invalid")}function m8(e,t){if(t){try{return gh(e,t),t}catch(n){if(!(n instanceof J2)||n.status!==422)throw n}if(Po(t)&&t.stepId!==void 0&&Object.hasOwn(e.blocks,t.blockId)){let n={blockId:t.blockId};try{return gh(e,n),n}catch{}}}}function h8(e,t,n){let r=n.member;(!r?.id||!jc(r,"editor"))&&As(403,"comment-permission-denied"),Number.isFinite(Date.parse(n.now))||As(422,"comment-clock-invalid");let o=()=>{let f=n.allocate();return(!f||f.length>200||["__proto__","prototype","constructor"].includes(f))&&As(422,"comment-id-invalid"),f},i=f=>{let p=structuredClone(f),m=h=>{h.id=o(),h.type==="list"||h.type==="listItem"||h.type==="blockquote"||h.type==="table"||h.type==="tableRow"?h.children.forEach(m):h.type==="extension"&&h.fallback.forEach(m)};return n.allocateContentIds&&p.forEach(m),p},a=(f,p)=>({id:o(),type:"comment",userId:r.id,createdAt:n.now,updatedAt:n.now,content:i(f),reactions:[],...p?{metadata:structuredClone(p)}:{}}),s,l,c=!0;if(t.type==="comment.create"){let f=a(t.content,t.commentMetadata);s={id:o(),type:"thread",createdAt:n.now,updatedAt:n.now,resolved:!1,comments:[f],...t.anchor?{anchor:structuredClone(t.anchor)}:{},...t.metadata?{metadata:structuredClone(t.metadata)}:{}},Object.hasOwn(e,s.id)&&As(409,"comment-id-repeated"),l=f.id}else{Object.hasOwn(e,t.threadId)||As(404,"document-thread-missing"),e[t.threadId].deletedAt&&As(409,"document-thread-deleted"),s=structuredClone(e[t.threadId]);let f=p=>{let m=s.comments.find(h=>h.id===p);return m?m.deletedAt?As(409,"document-comment-deleted"):m:As(404,"document-comment-missing")};switch(t.type){case"comment.reply":{let p=a(t.content,t.metadata);s.comments.push(p),l=p.id;break}case"comment.update":{let p=f(t.commentId);p.userId!==r.id&&!jc(r,"owner")&&As(403,"comment-author-required"),l=p.id,p.content=i(t.content),p.updatedAt=n.now,t.metadata&&(p.metadata=structuredClone(t.metadata));break}case"comment.react":{let p=f(t.commentId),m=p.reactions.find(h=>h.emoji===t.emoji);(!t.emoji||t.emoji.length>32)&&As(422,"comment-reaction-invalid"),l=p.id,c=!!m?.userIds.includes(r.id)!==t.active,c&&t.active?m?m.userIds.push(r.id):p.reactions.push({emoji:t.emoji,createdAt:n.now,userIds:[r.id]}):c&&m&&(m.userIds=m.userIds.filter(h=>h!==r.id),p.reactions=p.reactions.filter(h=>h.userIds.length));break}case"comment.resolve":case"comment.reopen":c=s.resolved!==(t.type==="comment.resolve"),c&&(s.resolved=t.type==="comment.resolve",s.resolvedBy=r.id,s.resolvedUpdatedAt=n.now);break;case"comment.delete":t.commentId?(f(t.commentId),l=t.commentId,s.comments=s.comments.filter(p=>p.id!==l)):s.comments=[];break}c&&(s.updatedAt=n.now)}let d=c?{...e}:e,u=!s.comments.length;return c&&(u?delete d[s.id]:Object.defineProperty(d,s.id,{value:s,enumerable:!0,configurable:!0,writable:!0})),{threads:d,effect:{threadId:s.id,...l?{commentId:l}:{},changed:c,anchored:!u&&!!s.anchor,threadRemoved:u,removedComments:Math.max(0,(e[s.id]?.comments.length??0)-s.comments.length),comments:s.comments.length,reactions:s.comments.reduce((f,p)=>f+p.reactions.length,0)}}}function u1(e,t){let n=typeof e;if(n!==typeof t)return!1;if(Array.isArray(e)){if(!Array.isArray(t))return!1;let r=e.length;if(r!==t.length)return!1;for(let o=0;o<r;o++)if(!u1(e[o],t[o]))return!1;return!0}if(n==="object"){if(!e||!t)return e===t;let r=Object.keys(e),o=Object.keys(t);if(r.length!==o.length)return!1;for(let a of r)if(!u1(e[a],t[a]))return!1;return!0}return e===t}function Vc(e){return encodeURI(X5e(e))}function X5e(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}var Q5e={prefixItems:!0,items:!0,allOf:!0,anyOf:!0,oneOf:!0},eEe={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependentSchemas:!0},tEe={id:!0,$id:!0,$ref:!0,$schema:!0,$anchor:!0,$vocabulary:!0,$comment:!0,default:!0,enum:!0,const:!0,required:!0,type:!0,maximum:!0,minimum:!0,exclusiveMaximum:!0,exclusiveMinimum:!0,multipleOf:!0,maxLength:!0,minLength:!0,pattern:!0,format:!0,maxItems:!0,minItems:!0,uniqueItems:!0,maxProperties:!0,minProperties:!0},nEe=typeof self<"u"&&self.location&&self.location.origin!=="null"?new URL(self.location.origin+self.location.pathname+location.search):new URL("https://github.com/cfworker");function jp(e,t=Object.create(null),n=nEe,r=""){if(e&&typeof e=="object"&&!Array.isArray(e)){let i=e.$id||e.id;if(i){let a=new URL(i,n.href);a.hash.length>1?t[a.href]=e:(a.hash="",r===""?n=a:jp(e,t,n))}}else if(e!==!0&&e!==!1)return t;let o=n.href+(r?"#"+r:"");if(t[o]!==void 0)throw new Error(`Duplicate schema URI "${o}".`);if(t[o]=e,e===!0||e===!1)return t;if(e.__absolute_uri__===void 0&&Object.defineProperty(e,"__absolute_uri__",{enumerable:!1,value:o}),e.$ref&&e.__absolute_ref__===void 0){let i=new URL(e.$ref,n.href);i.hash=i.hash,Object.defineProperty(e,"__absolute_ref__",{enumerable:!1,value:i.href})}if(e.$recursiveRef&&e.__absolute_recursive_ref__===void 0){let i=new URL(e.$recursiveRef,n.href);i.hash=i.hash,Object.defineProperty(e,"__absolute_recursive_ref__",{enumerable:!1,value:i.href})}if(e.$anchor){let i=new URL("#"+e.$anchor,n.href);t[i.href]=e}for(let i in e){if(tEe[i])continue;let a=`${r}/${Vc(i)}`,s=e[i];if(Array.isArray(s)){if(Q5e[i]){let l=s.length;for(let c=0;c<l;c++)jp(s[c],t,n,`${a}/${c}`)}}else if(eEe[i])for(let l in s)jp(s[l],t,n,`${a}/${Vc(l)}`);else jp(s,t,n,a)}return t}var rEe=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,oEe=[0,31,28,31,30,31,30,31,31,30,31,30,31],iEe=/^(\d\d):(\d\d):(\d\d)(\.\d+)?(z|[+-]\d\d(?::?\d\d)?)?$/i,aEe=/^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i,sEe=/^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,lEe=/^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,cEe=/^(?:(?:https?|ftp):\/\/)(?:\S+(?::\S*)?@)?(?:(?!10(?:\.\d{1,3}){3})(?!127(?:\.\d{1,3}){3})(?!169\.254(?:\.\d{1,3}){2})(?!192\.168(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z\u{00a1}-\u{ffff}0-9]+-?)*[a-z\u{00a1}-\u{ffff}0-9]+)(?:\.(?:[a-z\u{00a1}-\u{ffff}0-9]+-?)*[a-z\u{00a1}-\u{ffff}0-9]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu,dEe=/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,uEe=/^(?:\/(?:[^~/]|~0|~1)*)*$/,fEe=/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,pEe=/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,mEe=e=>{if(e[0]==='"')return!1;let[t,n,...r]=e.split("@");return!t||!n||r.length!==0||t.length>64||n.length>253||t[0]==="."||t.endsWith(".")||t.includes("..")||!/^[a-z0-9.-]+$/i.test(n)||!/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+$/i.test(t)?!1:n.split(".").every(o=>/^[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?$/i.test(o))},hEe=/^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,gEe=/^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i,vEe=e=>e.length>1&&e.length<80&&(/^P\d+([.,]\d+)?W$/.test(e)||/^P[\dYMDTHS]*(\d[.,]\d+)?[YMDHS]$/.test(e)&&/^P([.,\d]+Y)?([.,\d]+M)?([.,\d]+D)?(T([.,\d]+H)?([.,\d]+M)?([.,\d]+S)?)?$/.test(e));function Tf(e){return e.test.bind(e)}var g8={date:AX,time:IX.bind(void 0,!1),"date-time":wEe,duration:vEe,uri:SEe,"uri-reference":Tf(sEe),"uri-template":Tf(lEe),url:Tf(cEe),email:mEe,hostname:Tf(aEe),ipv4:Tf(hEe),ipv6:Tf(gEe),regex:_Ee,uuid:Tf(dEe),"json-pointer":Tf(uEe),"json-pointer-uri-fragment":Tf(fEe),"relative-json-pointer":Tf(pEe)};function bEe(e){return e%4===0&&(e%100!==0||e%400===0)}function AX(e){let t=e.match(rEe);if(!t)return!1;let n=+t[1],r=+t[2],o=+t[3];return r>=1&&r<=12&&o>=1&&o<=(r==2&&bEe(n)?29:oEe[r])}function IX(e,t){let n=t.match(iEe);if(!n)return!1;let r=+n[1],o=+n[2],i=+n[3],a=!!n[5];return(r<=23&&o<=59&&i<=59||r==23&&o==59&&i==60)&&(!e||a)}var yEe=/t|\s/i;function wEe(e){let t=e.split(yEe);return t.length==2&&AX(t[0])&&IX(!0,t[1])}var kEe=/\/|:/,xEe=/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i;function SEe(e){return kEe.test(e)&&xEe.test(e)}var CEe=/[^\\]\\Z/;function _Ee(e){if(CEe.test(e))return!1;try{return new RegExp(e,"u"),!0}catch{return!1}}var TX;(function(e){e[e.Flag=1]="Flag",e[e.Basic=2]="Basic",e[e.Detailed=4]="Detailed"})(TX||(TX={}));function RX(e){let t=0,n=e.length,r=0,o;for(;r<n;)t++,o=e.charCodeAt(r++),o>=55296&&o<=56319&&r<n&&(o=e.charCodeAt(r),(o&64512)==56320&&r++);return t}function Bo(e,t,n="2019-09",r=jp(t),o=!0,i=null,a="#",s="#",l=Object.create(null)){if(t===!0)return{valid:!0,errors:[]};if(t===!1)return{valid:!1,errors:[{instanceLocation:a,keyword:"false",keywordLocation:a,error:"False boolean schema."}]};let c=typeof e,d;switch(c){case"boolean":case"number":case"string":d=c;break;case"object":e===null?d="null":Array.isArray(e)?d="array":d="object";break;default:throw new Error(`Instances of "${c}" type are not supported.`)}let{$ref:u,$recursiveRef:f,$recursiveAnchor:p,type:m,const:h,enum:g,required:v,not:b,anyOf:y,allOf:w,oneOf:S,if:x,then:k,else:C,format:E,properties:P,patternProperties:I,additionalProperties:T,unevaluatedProperties:_,minProperties:A,maxProperties:D,propertyNames:N,dependentRequired:O,dependentSchemas:M,dependencies:$,prefixItems:j,items:W,additionalItems:K,unevaluatedItems:z,contains:G,minContains:U,maxContains:H,minItems:F,maxItems:L,uniqueItems:V,minimum:Y,maximum:te,exclusiveMinimum:ee,exclusiveMaximum:X,multipleOf:ue,minLength:fe,maxLength:Z,pattern:ce,__absolute_ref__:ye,__absolute_recursive_ref__:ae}=t,ne=[];if(p===!0&&i===null&&(i=t),f==="#"){let se=i===null?r[ae]:i,de=`${s}/$recursiveRef`,we=Bo(e,i===null?t:i,n,r,o,se,a,de,l);we.valid||ne.push({instanceLocation:a,keyword:"$recursiveRef",keywordLocation:de,error:"A subschema had errors."},...we.errors)}if(u!==void 0){let de=r[ye||u];if(de===void 0){let me=`Unresolved $ref "${u}".`;throw ye&&ye!==u&&(me+=` Absolute URI "${ye}".`),me+=`
|
|
723
723
|
Known schemas:
|
|
724
724
|
- ${Object.keys(r).join(`
|
|
725
|
-
- `)}`,new Error(me)}let we=`${s}/$ref`,ke=Bo(e,de,n,r,o,i,a,we,l);if(ke.valid||ne.push({instanceLocation:a,keyword:"$ref",keywordLocation:we,error:"A subschema had errors."},...ke.errors),n==="4"||n==="7")return{valid:ne.length===0,errors:ne}}if(Array.isArray(m)){let se=m.length,de=!1;for(let we=0;we<se;we++)if(d===m[we]||m[we]==="integer"&&d==="number"&&e%1===0&&e===e){de=!0;break}de||ne.push({instanceLocation:a,keyword:"type",keywordLocation:`${s}/type`,error:`Instance type "${d}" is invalid. Expected "${m.join('", "')}".`})}else m==="integer"?(d!=="number"||e%1||e!==e)&&ne.push({instanceLocation:a,keyword:"type",keywordLocation:`${s}/type`,error:`Instance type "${d}" is invalid. Expected "${m}".`}):m!==void 0&&d!==m&&ne.push({instanceLocation:a,keyword:"type",keywordLocation:`${s}/type`,error:`Instance type "${d}" is invalid. Expected "${m}".`});if(h!==void 0&&(d==="object"||d==="array"?u1(e,h)||ne.push({instanceLocation:a,keyword:"const",keywordLocation:`${s}/const`,error:`Instance does not match ${JSON.stringify(h)}.`}):e!==h&&ne.push({instanceLocation:a,keyword:"const",keywordLocation:`${s}/const`,error:`Instance does not match ${JSON.stringify(h)}.`})),g!==void 0&&(d==="object"||d==="array"?g.some(se=>u1(e,se))||ne.push({instanceLocation:a,keyword:"enum",keywordLocation:`${s}/enum`,error:`Instance does not match any of ${JSON.stringify(g)}.`}):g.some(se=>e===se)||ne.push({instanceLocation:a,keyword:"enum",keywordLocation:`${s}/enum`,error:`Instance does not match any of ${JSON.stringify(g)}.`})),b!==void 0){let se=`${s}/not`;Bo(e,b,n,r,o,i,a,se).valid&&ne.push({instanceLocation:a,keyword:"not",keywordLocation:se,error:'Instance matched "not" schema.'})}let re=[];if(y!==void 0){let se=`${s}/anyOf`,de=ne.length,we=!1;for(let ke=0;ke<y.length;ke++){let me=y[ke],ie=Object.create(l),ge=Bo(e,me,n,r,o,p===!0?i:null,a,`${se}/${ke}`,ie);ne.push(...ge.errors),we=we||ge.valid,ge.valid&&re.push(ie)}we?ne.length=de:ne.splice(de,0,{instanceLocation:a,keyword:"anyOf",keywordLocation:se,error:"Instance does not match any subschemas."})}if(w!==void 0){let se=`${s}/allOf`,de=ne.length,we=!0;for(let ke=0;ke<w.length;ke++){let me=w[ke],ie=Object.create(l),ge=Bo(e,me,n,r,o,p===!0?i:null,a,`${se}/${ke}`,ie);ne.push(...ge.errors),we=we&&ge.valid,ge.valid&&re.push(ie)}we?ne.length=de:ne.splice(de,0,{instanceLocation:a,keyword:"allOf",keywordLocation:se,error:"Instance does not match every subschema."})}if(S!==void 0){let se=`${s}/oneOf`,de=ne.length,we=S.filter((ke,me)=>{let ie=Object.create(l),ge=Bo(e,ke,n,r,o,p===!0?i:null,a,`${se}/${me}`,ie);return ne.push(...ge.errors),ge.valid&&re.push(ie),ge.valid}).length;we===1?ne.length=de:ne.splice(de,0,{instanceLocation:a,keyword:"oneOf",keywordLocation:se,error:`Instance does not match exactly one subschema (${we} matches).`})}if((d==="object"||d==="array")&&Object.assign(l,...re),x!==void 0){let se=`${s}/if`;if(Bo(e,x,n,r,o,i,a,se,l).valid){if(k!==void 0){let we=Bo(e,k,n,r,o,i,a,`${s}/then`,l);we.valid||ne.push({instanceLocation:a,keyword:"if",keywordLocation:se,error:'Instance does not match "then" schema.'},...we.errors)}}else if(C!==void 0){let we=Bo(e,C,n,r,o,i,a,`${s}/else`,l);we.valid||ne.push({instanceLocation:a,keyword:"if",keywordLocation:se,error:'Instance does not match "else" schema.'},...we.errors)}}if(d==="object"){if(v!==void 0)for(let ke of v)ke in e||ne.push({instanceLocation:a,keyword:"required",keywordLocation:`${s}/required`,error:`Instance does not have required property "${ke}".`});let se=Object.keys(e);if(A!==void 0&&se.length<A&&ne.push({instanceLocation:a,keyword:"minProperties",keywordLocation:`${s}/minProperties`,error:`Instance does not have at least ${A} properties.`}),D!==void 0&&se.length>D&&ne.push({instanceLocation:a,keyword:"maxProperties",keywordLocation:`${s}/maxProperties`,error:`Instance does not have at least ${D} properties.`}),N!==void 0){let ke=`${s}/propertyNames`;for(let me in e){let ie=`${a}/${Vc(me)}`,ge=Bo(me,N,n,r,o,i,ie,ke);ge.valid||ne.push({instanceLocation:a,keyword:"propertyNames",keywordLocation:ke,error:`Property name "${me}" does not match schema.`},...ge.errors)}}if(O!==void 0){let ke=`${s}/dependantRequired`;for(let me in O)if(me in e){let ie=O[me];for(let ge of ie)ge in e||ne.push({instanceLocation:a,keyword:"dependentRequired",keywordLocation:ke,error:`Instance has "${me}" but does not have "${ge}".`})}}if(M!==void 0)for(let ke in M){let me=`${s}/dependentSchemas`;if(ke in e){let ie=Bo(e,M[ke],n,r,o,i,a,`${me}/${Vc(ke)}`,l);ie.valid||ne.push({instanceLocation:a,keyword:"dependentSchemas",keywordLocation:me,error:`Instance has "${ke}" but does not match dependant schema.`},...ie.errors)}}if($!==void 0){let ke=`${s}/dependencies`;for(let me in $)if(me in e){let ie=$[me];if(Array.isArray(ie))for(let ge of ie)ge in e||ne.push({instanceLocation:a,keyword:"dependencies",keywordLocation:ke,error:`Instance has "${me}" but does not have "${ge}".`});else{let ge=Bo(e,ie,n,r,o,i,a,`${ke}/${Vc(me)}`);ge.valid||ne.push({instanceLocation:a,keyword:"dependencies",keywordLocation:ke,error:`Instance has "${me}" but does not match dependant schema.`},...ge.errors)}}}let de=Object.create(null),we=!1;if(P!==void 0){let ke=`${s}/properties`;for(let me in P){if(!(me in e))continue;let ie=`${a}/${Vc(me)}`,ge=Bo(e[me],P[me],n,r,o,i,ie,`${ke}/${Vc(me)}`);if(ge.valid)l[me]=de[me]=!0;else if(we=o,ne.push({instanceLocation:a,keyword:"properties",keywordLocation:ke,error:`Property "${me}" does not match schema.`},...ge.errors),we)break}}if(!we&&I!==void 0){let ke=`${s}/patternProperties`;for(let me in I){let ie=new RegExp(me,"u"),ge=I[me];for(let Ce in e){if(!ie.test(Ce))continue;let vt=`${a}/${Vc(Ce)}`,Oe=Bo(e[Ce],ge,n,r,o,i,vt,`${ke}/${Vc(me)}`);Oe.valid?l[Ce]=de[Ce]=!0:(we=o,ne.push({instanceLocation:a,keyword:"patternProperties",keywordLocation:ke,error:`Property "${Ce}" matches pattern "${me}" but does not match associated schema.`},...Oe.errors))}}}if(!we&&T!==void 0){let ke=`${s}/additionalProperties`;for(let me in e){if(de[me])continue;let ie=`${a}/${Vc(me)}`,ge=Bo(e[me],T,n,r,o,i,ie,ke);ge.valid?l[me]=!0:(we=o,ne.push({instanceLocation:a,keyword:"additionalProperties",keywordLocation:ke,error:`Property "${me}" does not match additional properties schema.`},...ge.errors))}}else if(!we&&_!==void 0){let ke=`${s}/unevaluatedProperties`;for(let me in e)if(!l[me]){let ie=`${a}/${Vc(me)}`,ge=Bo(e[me],_,n,r,o,i,ie,ke);ge.valid?l[me]=!0:ne.push({instanceLocation:a,keyword:"unevaluatedProperties",keywordLocation:ke,error:`Property "${me}" does not match unevaluated properties schema.`},...ge.errors)}}}else if(d==="array"){L!==void 0&&e.length>L&&ne.push({instanceLocation:a,keyword:"maxItems",keywordLocation:`${s}/maxItems`,error:`Array has too many items (${e.length} > ${L}).`}),F!==void 0&&e.length<F&&ne.push({instanceLocation:a,keyword:"minItems",keywordLocation:`${s}/minItems`,error:`Array has too few items (${e.length} < ${F}).`});let se=e.length,de=0,we=!1;if(j!==void 0){let ke=`${s}/prefixItems`,me=Math.min(j.length,se);for(;de<me;de++){let ie=Bo(e[de],j[de],n,r,o,i,`${a}/${de}`,`${ke}/${de}`);if(l[de]=!0,!ie.valid&&(we=o,ne.push({instanceLocation:a,keyword:"prefixItems",keywordLocation:ke,error:"Items did not match schema."},...ie.errors),we))break}}if(W!==void 0){let ke=`${s}/items`;if(Array.isArray(W)){let me=Math.min(W.length,se);for(;de<me;de++){let ie=Bo(e[de],W[de],n,r,o,i,`${a}/${de}`,`${ke}/${de}`);if(l[de]=!0,!ie.valid&&(we=o,ne.push({instanceLocation:a,keyword:"items",keywordLocation:ke,error:"Items did not match schema."},...ie.errors),we))break}}else for(;de<se;de++){let me=Bo(e[de],W,n,r,o,i,`${a}/${de}`,ke);if(l[de]=!0,!me.valid&&(we=o,ne.push({instanceLocation:a,keyword:"items",keywordLocation:ke,error:"Items did not match schema."},...me.errors),we))break}if(!we&&K!==void 0){let me=`${s}/additionalItems`;for(;de<se;de++){let ie=Bo(e[de],K,n,r,o,i,`${a}/${de}`,me);l[de]=!0,ie.valid||(we=o,ne.push({instanceLocation:a,keyword:"additionalItems",keywordLocation:me,error:"Items did not match additional items schema."},...ie.errors))}}}if(G!==void 0)if(se===0&&U===void 0)ne.push({instanceLocation:a,keyword:"contains",keywordLocation:`${s}/contains`,error:"Array is empty. It must contain at least one item matching the schema."});else if(U!==void 0&&se<U)ne.push({instanceLocation:a,keyword:"minContains",keywordLocation:`${s}/minContains`,error:`Array has less items (${se}) than minContains (${U}).`});else{let ke=`${s}/contains`,me=ne.length,ie=0;for(let ge=0;ge<se;ge++){let Ce=Bo(e[ge],G,n,r,o,i,`${a}/${ge}`,ke);Ce.valid?(l[ge]=!0,ie++):ne.push(...Ce.errors)}ie>=(U||0)&&(ne.length=me),U===void 0&&H===void 0&&ie===0?ne.splice(me,0,{instanceLocation:a,keyword:"contains",keywordLocation:ke,error:"Array does not contain item matching schema."}):U!==void 0&&ie<U?ne.push({instanceLocation:a,keyword:"minContains",keywordLocation:`${s}/minContains`,error:`Array must contain at least ${U} items matching schema. Only ${ie} items were found.`}):H!==void 0&&ie>H&&ne.push({instanceLocation:a,keyword:"maxContains",keywordLocation:`${s}/maxContains`,error:`Array may contain at most ${H} items matching schema. ${ie} items were found.`})}if(!we&&z!==void 0){let ke=`${s}/unevaluatedItems`;for(de;de<se;de++){if(l[de])continue;let me=Bo(e[de],z,n,r,o,i,`${a}/${de}`,ke);l[de]=!0,me.valid||ne.push({instanceLocation:a,keyword:"unevaluatedItems",keywordLocation:ke,error:"Items did not match unevaluated items schema."},...me.errors)}}if(V)for(let ke=0;ke<se;ke++){let me=e[ke],ie=typeof me=="object"&&me!==null;for(let ge=0;ge<se;ge++){if(ke===ge)continue;let Ce=e[ge];(me===Ce||ie&&(typeof Ce=="object"&&Ce!==null)&&u1(me,Ce))&&(ne.push({instanceLocation:a,keyword:"uniqueItems",keywordLocation:`${s}/uniqueItems`,error:`Duplicate items at indexes ${ke} and ${ge}.`}),ke=Number.MAX_SAFE_INTEGER,ge=Number.MAX_SAFE_INTEGER)}}}else if(d==="number"){if(n==="4"?(Y!==void 0&&(ee===!0&&e<=Y||e<Y)&&ne.push({instanceLocation:a,keyword:"minimum",keywordLocation:`${s}/minimum`,error:`${e} is less than ${ee?"or equal to ":""} ${Y}.`}),te!==void 0&&(X===!0&&e>=te||e>te)&&ne.push({instanceLocation:a,keyword:"maximum",keywordLocation:`${s}/maximum`,error:`${e} is greater than ${X?"or equal to ":""} ${te}.`})):(Y!==void 0&&e<Y&&ne.push({instanceLocation:a,keyword:"minimum",keywordLocation:`${s}/minimum`,error:`${e} is less than ${Y}.`}),te!==void 0&&e>te&&ne.push({instanceLocation:a,keyword:"maximum",keywordLocation:`${s}/maximum`,error:`${e} is greater than ${te}.`}),ee!==void 0&&e<=ee&&ne.push({instanceLocation:a,keyword:"exclusiveMinimum",keywordLocation:`${s}/exclusiveMinimum`,error:`${e} is less than ${ee}.`}),X!==void 0&&e>=X&&ne.push({instanceLocation:a,keyword:"exclusiveMaximum",keywordLocation:`${s}/exclusiveMaximum`,error:`${e} is greater than or equal to ${X}.`})),ue!==void 0){let se=e%ue;Math.abs(0-se)>=11920929e-14&&Math.abs(ue-se)>=11920929e-14&&ne.push({instanceLocation:a,keyword:"multipleOf",keywordLocation:`${s}/multipleOf`,error:`${e} is not a multiple of ${ue}.`})}}else if(d==="string"){let se=fe===void 0&&Z===void 0?0:RX(e);fe!==void 0&&se<fe&&ne.push({instanceLocation:a,keyword:"minLength",keywordLocation:`${s}/minLength`,error:`String is too short (${se} < ${fe}).`}),Z!==void 0&&se>Z&&ne.push({instanceLocation:a,keyword:"maxLength",keywordLocation:`${s}/maxLength`,error:`String is too long (${se} > ${Z}).`}),ce!==void 0&&!new RegExp(ce,"u").test(e)&&ne.push({instanceLocation:a,keyword:"pattern",keywordLocation:`${s}/pattern`,error:"String does not match pattern."}),E!==void 0&&g8[E]&&!g8[E](e)&&ne.push({instanceLocation:a,keyword:"format",keywordLocation:`${s}/format`,error:`String does not match format "${E}".`})}return{valid:ne.length===0,errors:ne}}var vh=class{schema;draft;shortCircuit;lookup;constructor(t,n="2019-09",r=!0){this.schema=t,this.draft=n,this.shortCircuit=r,this.lookup=jp(t)}validate(t){return Bo(t,this.schema,this.draft,this.lookup,this.shortCircuit)}addSchema(t,n){n&&(t={...t,$id:n}),jp(t,this.lookup)}};var Ct=e=>({$ref:`#/$defs/${e}`}),At={type:"string"},Qn={type:"string",minLength:1,maxLength:200,pattern:"^[^\\u0000-\\u001f]+$",not:{enum:["__proto__","constructor","prototype"]}},Y2={type:"number",exclusiveMinimum:0},bh={type:"number",minimum:0},yh={type:"integer",minimum:0},Fr=e=>({type:"array",items:e}),Rf={type:"array",items:Qn,uniqueItems:!0},Li=e=>({type:"object",additionalProperties:e}),Dt=(e,t=Object.keys(e))=>({type:"object",properties:e,required:t,additionalProperties:!1}),Bi=e=>({const:e}),PEe={only:Fr(At),audience:Fr(At)},v8=Dt({alignment:{enum:["left","center","right","justify"]},color:At,background:At},[]),DX=[{required:["value"],not:{required:["origin"]}},{required:["origin"],not:{required:["value"]}}],Bu=(e,t,n=Object.keys(t))=>Dt({id:Qn,type:Bi(e),...t},["id","type",...n]),Z2=(e,t,n=Object.keys(t))=>Dt({id:Qn,type:Bi(e),...PEe,...t},["id","type",...n]),X2={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"urn:presmium:teaching-document:1",...Dt({schemaVersion:{const:1},id:Qn,metadata:Dt({title:At,description:At,tags:Fr(At),lang:{type:"string",minLength:1},plugins:Fr(At),presmium:Li(Ct("JsonObject")),renderers:Li(Ct("JsonObject")),execute:Ct("JsonObject"),checks:Ct("JsonObject"),translations:Li(At),translationOf:Dt({entry:At,digest:At})},["title","lang"]),sectionOrder:{...Rf,minItems:1},sections:Li(Ct("Section")),blocks:Li(Ct("Block")),steps:Li(Ct("Step")),narrations:Li(Ct("Narration")),assets:Li(Ct("Asset")),definitions:Li(Ct("Definition")),production:Ct("Production"),comments:Li(Ct("Thread"))},["schemaVersion","id","metadata","sectionOrder","sections","blocks","steps","narrations","assets","definitions","production"]),$defs:{JsonValue:{anyOf:[{type:["null","boolean","number","string"]},{type:"array",items:Ct("JsonValue")},Ct("JsonObject")]},JsonObject:{type:"object",additionalProperties:Ct("JsonValue")},JsonSchema:{anyOf:[{type:"boolean"},Ct("JsonObject")]},Layout:Dt({type:{enum:["stack","columns","canvas","scrolly"]},properties:Ct("JsonObject"),renderers:Li(Ct("JsonObject"))},["type"]),Section:Dt({id:Qn,title:At,level:{type:"integer",minimum:1,maximum:6},children:Rf,stepOrder:{...Rf,minItems:1},layout:Ct("Layout"),audience:Fr(At),config:Li(Ct("JsonObject"))},["id","title","children","stepOrder","layout"]),Mark:{oneOf:[Dt({type:{enum:["bold","italic","underline","strike","code"]}}),Dt({type:{enum:["color","background"]},value:At})]},Inline:{oneOf:[Dt({type:Bi("text"),text:At,marks:Fr(Ct("Mark"))},["type","text"]),Dt({type:Bi("link"),href:At,children:Fr(Ct("Inline"))}),Dt({type:Bi("math"),value:At}),Dt({type:Bi("break")}),Dt({type:Bi("extension"),kind:Qn,schemaVersion:{type:"integer",minimum:1},data:Ct("JsonObject"),fallback:At})]},RichTextNode:{oneOf:[Bu("paragraph",{children:Fr(Ct("Inline")),style:v8},["children"]),Bu("heading",{level:{type:"integer",minimum:1,maximum:6},children:Fr(Ct("Inline")),style:v8},["level","children"]),Bu("list",{ordered:{type:"boolean"},start:{type:"integer",minimum:1},children:Fr(Ct("ListItem"))},["ordered","children"]),Bu("blockquote",{children:Fr(Ct("RichTextNode"))}),Bu("code",{language:At,value:At}),Bu("math",{value:At}),Bu("table",{children:Fr(Ct("TableRow")),headerRows:yh,headerColumns:yh,columnWidths:Fr(Y2)},["children"]),Bu("extension",{kind:Qn,schemaVersion:{type:"integer",minimum:1},data:Ct("JsonObject"),fallback:Fr(Ct("RichTextNode"))})]},ListItem:Bu("listItem",{children:Fr(Ct("RichTextNode")),checked:{type:"boolean"}},["children"]),TableRow:Bu("tableRow",{children:Fr(Ct("TableCell"))}),TableCell:Bu("tableCell",{children:Fr(Ct("Inline")),style:v8,colspan:{type:"integer",minimum:1},rowspan:{type:"integer",minimum:1}},["children"]),CodeReference:Dt({anchor:{type:"string",minLength:1},pin:At,repo:At,highlightRegions:Li({type:"string",minLength:1})},["anchor"]),VariantReference:Dt({anchor:{type:"string",minLength:1},pin:At,repo:At},["anchor"]),CodeVariant:{...Dt({id:Qn,title:At,value:At,origin:Ct("VariantReference")},["id","title"]),oneOf:DX},CodeExecution:Dt({args:Li(At),stdin:At,timeoutMs:Y2,executor:At,when:{enum:["compile","live","both"]},session:At},["when"]),Block:{oneOf:[Z2("text",{content:Fr(Ct("RichTextNode")),reveal:Dt({type:Bi("items"),order:Rf})},["content"]),Z2("container",{layout:{enum:["stack","columns","tabs"]},children:Rf,properties:Dt({title:At,columnWidths:Fr(Y2),tabTitles:Fr(At)},[])}),Z2("image",{assetId:Qn,alt:At,caption:Fr(Ct("Inline")),width:Y2,alignment:{enum:["left","center","right","justify"]}},["alt"]),{...Z2("code",{language:At,value:At,origin:Ct("CodeReference"),title:At,execution:Ct("CodeExecution"),highlight:Li(Fr({type:"integer",minimum:1})),variants:Fr(Ct("CodeVariant")),echo:{type:"boolean"}},["language"]),oneOf:DX},Z2("component",{definitionId:Qn,parameters:Ct("JsonObject"),children:Rf},["definitionId","parameters"])]},Visual:Dt({blockId:Qn,visible:{type:"boolean"},state:Qn,parameters:Ct("JsonObject")},["blockId","visible"]),Step:Dt({id:Qn,sectionId:Qn,title:At,visuals:Fr(Ct("Visual")),narrationIds:Rf,inherits:Qn},["id","sectionId","visuals","narrationIds"]),NarrationNode:{oneOf:[Dt({type:Bi("text"),text:At}),Dt({type:Bi("pronunciation"),display:At,spoken:At}),Dt({id:Qn,type:Bi("cue"),action:{type:"string",minLength:1},target:Dt({blockId:Qn,element:At},["blockId"]),parameters:Ct("JsonObject")},["id","type","action"])]},Narration:Dt({id:Qn,content:Fr(Ct("NarrationNode")),provenance:Dt({type:Bi("transcription"),transcriptionId:{type:"string",pattern:"^[a-f0-9]{64}$"},revision:{type:"string",pattern:"^[a-f0-9]{64}$"},assetId:Qn,audioSha256:{type:"string",pattern:"^[a-f0-9]{64}$"},segmentIds:{...Rf,minItems:1}})},["id","content"]),Asset:Dt({id:Qn,kind:{enum:["image","audio","video","file"]},location:{type:"string",minLength:1},title:{type:"string",minLength:1,maxLength:200},fingerprint:At,mediaType:At},["id","kind","location"]),Implementation:{oneOf:[Dt({type:Bi("file"),path:{type:"string",minLength:1},exportName:At,fingerprint:At},["type","path"]),Dt({type:Bi("module"),specifier:{type:"string",minLength:1},exportName:At},["type","specifier"]),Dt({type:Bi("plugin"),plugin:Qn,name:Qn})]},State:Dt({id:Qn,title:At,parameterSchema:Ct("JsonSchema"),legacyIndex:yh},["id"]),Definition:Dt({id:Qn,kind:{type:"string",minLength:1},schemaVersion:{type:"integer",minimum:1},implementation:Ct("Implementation"),parameterSchema:Ct("JsonSchema"),states:Fr(Ct("State")),data:Ct("JsonObject")},["id","kind","schemaVersion","implementation","parameterSchema","states"]),VoiceSource:{oneOf:[Dt({type:Bi("none")}),Dt({type:Bi("tts"),voice:Dt({voice:{type:"string",minLength:1},engine:At,rate:Y2,style:At},["voice"])}),Dt({type:Bi("recording"),assetId:Qn,sourceRange:Dt({startMs:bh,endMs:bh})},["type","assetId"])]},StepProduction:Dt({narrationStart:{enum:["with-animation","after-animation"]},minimumHoldMs:bh,trailingPauseMs:bh,voiceSource:Ct("VoiceSource")},[]),MediaClip:Dt({id:Qn,assetId:Qn,sourceRange:Dt({startMs:bh,endMs:bh}),attachment:Dt({stepId:Qn,offsetMs:bh}),volume:{type:"number",minimum:0,maximum:1},muted:{type:"boolean"}},["id","assetId","sourceRange","attachment","volume"]),CaptionTiming:Dt({narrationIds:Rf,sourceFingerprint:{type:"string",pattern:"^[a-f0-9]{16}$"},playbackFingerprint:{type:"string",pattern:"^[a-f0-9]{16}$"},durationMs:{type:"integer",minimum:1},segments:{type:"array",minItems:1,maxItems:32,items:Dt({id:Qn,from:yh,to:yh,startMs:yh,endMs:yh})}}),Production:Dt({defaults:Ct("StepProduction"),sectionOverrides:Li(Ct("StepProduction")),stepOverrides:Li(Ct("StepProduction")),narrationOverrides:Li(Dt({narrationStart:{enum:["with-animation","after-animation"]}})),cueTimings:Li(Dt({pauseMs:bh})),captionTimings:Li(Ct("CaptionTiming")),captions:Dt({scale:{type:"number",minimum:.7,maximum:1.6}}),mediaClips:Fr(Ct("MediaClip"))},["defaults","stepOverrides","mediaClips"]),TextPoint:Dt({blockId:{type:"string",minLength:1,maxLength:205},offset:yh}),Comment:Dt({id:Qn,type:Bi("comment"),userId:Qn,createdAt:At,updatedAt:At,deletedAt:At,content:Fr(Ct("RichTextNode")),metadata:Ct("JsonObject"),reactions:Fr(Dt({emoji:At,createdAt:At,userIds:Rf}))},["id","type","userId","createdAt","updatedAt","reactions"]),Thread:Dt({id:Qn,type:Bi("thread"),createdAt:At,updatedAt:At,resolved:{type:"boolean"},resolvedUpdatedAt:At,resolvedBy:Qn,metadata:Ct("JsonObject"),deletedAt:At,anchor:{oneOf:[Dt({from:Ct("TextPoint"),to:Ct("TextPoint")}),Dt({blockId:Qn,stepId:Qn},["blockId"])]},comments:Fr(Ct("Comment"))},["id","type","createdAt","updatedAt","resolved","comments"])}};var EEe=new vh({$id:"urn:presmium:step-narrations:1",$defs:structuredClone(X2.$defs),type:"array",items:{$ref:"#/$defs/Narration"}},"2020-12",!1);function b8(e,t,n){let r=e.steps[t];if(!r||!e.sections[r.sectionId]?.stepOrder.includes(t))throw new Error("document-narration-target");if(!EEe.validate(n).valid)throw new Error("document-narration-content");let o=n.map(l=>l.id);if(new Set(o).size!==o.length)throw new Error("document-narration-target");let i={...e,steps:{...e.steps,[t]:{...r,narrationIds:o}},narrations:{...e.narrations},production:{...e.production,...e.production.narrationOverrides?{narrationOverrides:{...e.production.narrationOverrides}}:{},...e.production.cueTimings?{cueTimings:{...e.production.cueTimings}}:{}}};for(let l of n)i.narrations[l.id]=structuredClone(l);let a=new Set(Object.values(i.steps).flatMap(l=>l.narrationIds));for(let l of r.narrationIds)a.has(l)||(delete i.narrations[l],i.production.narrationOverrides&&delete i.production.narrationOverrides[l]);let s=new Set(Object.values(i.narrations).flatMap(l=>l.content.flatMap(c=>c.type==="cue"?[c.id]:[])));for(let l of Object.keys(i.production.cueTimings??{}))s.has(l)||delete i.production.cueTimings[l];return i}var Q2={minimumHoldMs:4e3,trailingPauseMs:500};function y8(e,t){let n=P8(e);for(let i of e.sectionOrder)n.add(`page:${i}`);let r=()=>{let i=t();if(!i||i.length>200||n.has(i)||n.has(`page:${i}`))throw new Error("page-id-collision");return n.add(i),i},o=r();return n.add(`page:${o}`),{sectionId:o,blockId:r(),nodeId:r(),stepId:r()}}function eP({sectionId:e,blockId:t,nodeId:n,stepId:r},o){return{section:{id:e,title:o,children:[t],stepOrder:[r],layout:{type:"stack"}},block:{id:t,type:"text",content:[{id:n,type:"paragraph",children:[]}]},step:{id:r,sectionId:e,visuals:[{blockId:t,visible:!0}],narrationIds:[]},timing:{...Q2}}}function w8(e,t,n){if(!e.sections[t]||!e.sectionOrder.includes(t))throw new Error("page-boundary");if(!n.trim())throw new Error("page-title-required");let r=structuredClone(e);return r.sections[t].title=n.trim(),r}function k8(e,t,n){if(!e.sections[t]||!e.sectionOrder.includes(t)||n!==null&&(!e.sections[n]||!e.sectionOrder.includes(n)))throw new Error("page-boundary");let r=structuredClone(e);return n!==t&&(r.sectionOrder=r.sectionOrder.filter(o=>o!==t),r.sectionOrder.splice(n===null?r.sectionOrder.length:r.sectionOrder.indexOf(n),0,t)),r}function x8(e,t){let n=new Set,r=o=>{if(n.has(o))return;n.add(o);let i=e.blocks[o];(i?.type==="container"||i?.type==="component")&&i.children?.forEach(r)};return e.sections[t]?.children.forEach(r),n}function S8(e,t){let n=e.sections[t];if(!n||!e.sectionOrder.includes(t))throw new Error("page-boundary");let r=x8(e,t),o=new Set(n.stepOrder),i=new Set(n.stepOrder.flatMap(m=>e.steps[m].narrationIds)),a=Object.values(e.steps).filter(m=>!o.has(m.id)),s=new Map;for(let m of a)for(let h of m.narrationIds){let g=s.get(h)??[];g.push(m.id),s.set(h,g)}let l=new Set(s.keys()),c=new Set([...i].filter(m=>!l.has(m))),d=[],u=[];for(let[m,h]of Object.entries(e.narrations))for(let g of h.content)g.type==="cue"&&(c.has(m)?d.push(g.id):g.target&&r.has(g.target.blockId)&&u.push({type:"cue",narrationId:m,cueId:g.id,blockId:g.target.blockId,stepIds:s.get(m)??[]}));for(let m of a)m.inherits&&o.has(m.inherits)&&u.push({type:"inheritance",stepId:m.id,inheritedStepId:m.inherits});let f=new Set(r);e.sectionOrder.length>1&&f.add(`page:${t}`);let p=m=>{switch(f.add(m.id),m.type){case"list":case"listItem":case"blockquote":case"table":case"tableRow":m.children.forEach(p);break;case"extension":m.fallback.forEach(p);break}};for(let m of r){let h=e.blocks[m];h?.type==="text"&&h.content.forEach(p)}return{sectionId:t,retainedEmpty:e.sectionOrder.length===1,blocks:[...r],steps:[...o],narrations:[...c],retainedNarrations:[...i].filter(m=>!c.has(m)),cues:d,clips:e.production.mediaClips.filter(m=>o.has(m.attachment.stepId)).map(m=>m.id),detachedComments:Object.values(e.comments??{}).filter(m=>{let h=m.anchor;return h?Po(h)?f.has(h.blockId)||!!(h.stepId&&o.has(h.stepId)):f.has(h.from.blockId)||f.has(h.to.blockId):!1}).map(m=>m.id),references:u}}function tP(e,t,n,r){let o=S8(e,r);return{document:t,section:r,revision:n,source:{path:`${t?`${t}/`:""}lecture.json`,version:n},counts:{steps:o.steps.length,blocks:o.blocks.length,narration:o.narrations.length+o.retainedNarrations.length},last:o.retainedEmpty,allowed:!o.references.length,...o.references.length?{reason:"page-referenced",references:o.references.map(i=>({document:t,section:i.type==="inheritance"?e.steps[i.stepId].sectionId:i.stepIds[0]?e.steps[i.stepIds[0]].sectionId:r,...i.type==="cue"?{block:i.blockId}:{}}))}:{}}}function C8(e,t,n){let r=S8(e,t);if(r.references.length)throw new Error("page-referenced");let o=structuredClone(e),i=o.sections[t];for(let s of r.blocks)delete o.blocks[s];for(let s of r.steps)delete o.steps[s],delete o.production.stepOverrides[s],o.production.captionTimings&&delete o.production.captionTimings[s];for(let s of r.narrations)delete o.narrations[s],o.production.narrationOverrides&&delete o.production.narrationOverrides[s];for(let s of r.cues)o.production.cueTimings&&delete o.production.cueTimings[s];o.production.sectionOverrides&&delete o.production.sectionOverrides[t];let a=new Set(r.clips);o.production.mediaClips=o.production.mediaClips.filter(s=>!a.has(s.id));for(let s of r.detachedComments)delete o.comments[s].anchor;if(!r.retainedEmpty)o.sectionOrder=o.sectionOrder.filter(s=>s!==t),delete o.sections[t];else{let s=n();if(!s||s.length>200||P8(e).has(s))throw new Error("page-id-collision");i.children=[],i.stepOrder=[s],o.steps[s]={id:s,sectionId:t,visuals:[],narrationIds:[]},o.production.stepOverrides[s]={...Q2}}return o}function _8(e,t,n,r){let o=e.sections[t];if(!o||!e.sectionOrder.includes(t))throw new Error("page-boundary");let i=structuredClone(e),a=new Map,s=P8(e),l=m=>{let h=a.get(m);if(!h){if(h=r(m),!h||h.length>200||s.has(h))throw new Error("page-copy-id-collision");s.add(h),a.set(m,h)}return h},c=m=>a.get(m)??m,d=x8(e,t),u=new Set(o.stepOrder.flatMap(m=>e.steps[m].narrationIds)),f=m=>{switch(m.id=l(m.id),m.type){case"list":case"listItem":case"blockquote":case"table":case"tableRow":m.children.forEach(f);break;case"extension":m.fallback.forEach(f);break}},p=l(t);for(let m of o.stepOrder)l(m);for(let m of d)l(m);for(let m of u)l(m);for(let m of d){let h=structuredClone(e.blocks[m]);h.id=c(m),h.type==="text"?(h.content.forEach(f),h.reveal&&(h.reveal.order=h.reveal.order.map(c))):h.type==="container"||h.type==="component"?h.children&&(h.children=h.children.map(c)):h.type==="code"&&(h.highlight&&(h.highlight=Object.fromEntries(Object.entries(h.highlight).map(([g,v])=>[c(g),v]))),h.origin?.highlightRegions&&(h.origin.highlightRegions=Object.fromEntries(Object.entries(h.origin.highlightRegions).map(([g,v])=>[c(g),v]))),h.variants?.forEach(g=>{g.id=l(g.id)})),i.blocks[h.id]=h}for(let m of u){let h=structuredClone(e.narrations[m]);h.id=c(m);for(let g of h.content)if(g.type==="cue"){let v=g.id;g.id=l(v),g.target&&(g.target.blockId=c(g.target.blockId)),i.production.cueTimings?.[v]&&(i.production.cueTimings[g.id]=structuredClone(i.production.cueTimings[v]))}i.narrations[h.id]=h,i.production.narrationOverrides?.[m]&&(i.production.narrationOverrides[h.id]=structuredClone(i.production.narrationOverrides[m]))}for(let m of o.stepOrder){let h=structuredClone(e.steps[m]);h.id=c(m),h.sectionId=p,h.visuals.forEach(v=>{v.blockId=c(v.blockId)}),h.narrationIds=h.narrationIds.map(c),h.inherits&&(h.inherits=c(h.inherits)),i.steps[h.id]=h,i.production.stepOverrides[m]&&(i.production.stepOverrides[h.id]=structuredClone(i.production.stepOverrides[m]));let g=e.production.captionTimings?.[m];g&&(i.production.captionTimings??={},i.production.captionTimings[h.id]={...structuredClone(g),narrationIds:g.narrationIds.map(c)})}i.production.sectionOverrides?.[t]&&(i.production.sectionOverrides[p]=structuredClone(i.production.sectionOverrides[t]));for(let m of e.production.mediaClips)if(o.stepOrder.includes(m.attachment.stepId)){let h=structuredClone(m);h.id=l(m.id),h.attachment.stepId=c(m.attachment.stepId),i.production.mediaClips.push(h)}return i.sections[p]={...structuredClone(o),id:p,title:n,children:o.children.map(c),stepOrder:o.stepOrder.map(c)},i.sectionOrder.splice(i.sectionOrder.indexOf(t)+1,0,p),{document:i,section:p,mapping:Object.fromEntries(a)}}function P8(e){let t=new Set([e.id,...Object.keys(e.sections),...Object.keys(e.blocks),...Object.keys(e.steps),...Object.keys(e.narrations),...Object.keys(e.assets),...Object.keys(e.definitions)]),n=r=>{switch(t.add(r.id),r.type){case"list":case"listItem":case"blockquote":case"table":case"tableRow":r.children.forEach(n);break;case"extension":r.fallback.forEach(n);break}};for(let r of Object.values(e.blocks))r.type==="text"?r.content.forEach(n):r.type==="code"&&r.variants?.forEach(o=>t.add(o.id));for(let r of Object.values(e.narrations))for(let o of r.content)o.type==="cue"&&t.add(o.id);for(let r of e.production.mediaClips)t.add(r.id);for(let r of Object.values(e.comments??{})){t.add(r.id);for(let o of r.comments)t.add(o.id),o.content?.forEach(n)}return t}var AEe=0xcbf29ce484222325n,IEe=0x100000001b3n;function X0(e){let t=AEe;for(let n of new TextEncoder().encode(e))t=BigInt.asUintN(64,(t^BigInt(n))*IEe);return t.toString(16).padStart(16,"0")}function A8(e,t){let n=Object.hasOwn(e.sections,t)&&e.sections[t];if(!n||!e.sectionOrder.includes(t))throw new Error(`document-voice-page-missing: ${t}`);return n}function I8(e,t){let n=Object.hasOwn(e.steps,t)&&e.steps[t];if(!n||!A8(e,n.sectionId).stepOrder.includes(t))throw new Error(`document-voice-step-missing: ${t}`);return n}function wh(e,t){let n=()=>[...new Set(e.sectionOrder.flatMap(r=>A8(e,r).stepOrder))];switch(t.kind){case"document":return n();case"page":return[...A8(e,t.sectionId).stepOrder];case"step":return I8(e,t.stepId),[t.stepId];case"steps":{if(!t.stepIds.length)throw new Error("document-voice-steps-empty");t.stepIds.forEach(o=>I8(e,o));let r=new Set(t.stepIds);return n().filter(o=>r.has(o))}default:throw new Error("document-voice-scope-invalid")}}function oc(e,t){let{sectionId:n}=I8(e,t),r=e.production,o=[[r.stepOverrides[t]?.voiceSource,"step"],[r.sectionOverrides?.[n]?.voiceSource,"page"],[r.defaults.voiceSource,"document"]];for(let[i,a]of o)if(i!==void 0)return{stepId:t,sectionId:n,value:i,inheritedFrom:a};return{stepId:t,sectionId:n,inheritedFrom:"unset"}}function T8(e,t){if(Object.is(e,t))return!0;if(!e||!t||typeof e!="object"||typeof t!="object"||Array.isArray(e)!==Array.isArray(t))return!1;let n=Object.keys(e),r=Object.keys(t);return n.length===r.length&&n.every(o=>Object.hasOwn(t,o)&&T8(e[o],t[o]))}function TEe(e,t){if(t==null)return;let n=(r,o)=>Object.keys(r).every(i=>o.includes(i));if(typeof t!="object"||Array.isArray(t))throw new Error("document-voice-source-invalid");if(!(t.type==="none"&&n(t,["type"]))){if(t.type==="tts"&&n(t,["type","voice"])){let r=t.voice;if(r&&typeof r=="object"&&!Array.isArray(r)&&n(r,["voice","engine","rate","style"])&&typeof r.voice=="string"&&r.voice.length>0&&(r.engine===void 0||typeof r.engine=="string")&&(r.style===void 0||typeof r.style=="string")&&(r.rate===void 0||typeof r.rate=="number"&&Number.isFinite(r.rate)&&r.rate>0))return}if(t.type==="recording"&&n(t,["type","assetId"])&&typeof t.assetId=="string"){let r=Object.hasOwn(e.assets,t.assetId)&&e.assets[t.assetId];if(!r)throw new Error(`document-voice-asset-missing: ${t.assetId}`);if(r.kind==="audio"||r.kind==="video")return;throw new Error(`document-voice-asset-kind: ${t.assetId}`)}throw new Error("document-voice-source-invalid")}}function MX(e,t,n){return t.kind==="step"?!1:e.production.stepOverrides[n]?.voiceSource!==void 0?!0:t.kind==="document"&&e.production.sectionOverrides?.[e.steps[n].sectionId]?.voiceSource!==void 0}function E8(e,t){if(T8(e?.voiceSource,t??void 0))return e;let n={...e};return t==null?delete n.voiceSource:n.voiceSource=structuredClone(t),Object.keys(n).length?n:void 0}function eS(e,t,n,r={}){let o=wh(e,t);TEe(e,n);let i=e.production,a=i.defaults,s=i.sectionOverrides,l=i.stepOverrides,c=(u,f)=>{let p=E8(l[u],f);p!==l[u]&&(l===i.stepOverrides&&(l={...l}),p?l[u]=p:delete l[u])},d=(u,f)=>{let p=E8(s?.[u],f);p!==s?.[u]&&(s===i.sectionOverrides&&(s={...s}),p?s[u]=p:delete s[u])};if(t.kind==="document")a=E8(a,n)??{},r.replaceOverrides&&(e.sectionOrder.forEach(u=>d(u,void 0)),o.forEach(u=>c(u,void 0)));else if(t.kind==="page")d(t.sectionId,n),r.replaceOverrides&&o.forEach(u=>c(u,void 0));else for(let u of o)(r.replaceOverrides||!MX(e,t,u))&&c(u,n);return a===i.defaults&&s===i.sectionOverrides&&l===i.stepOverrides?e:{...e,production:{...i,defaults:a,...s!==void 0?{sectionOverrides:s}:{},stepOverrides:l}}}function nP(e,t,n,r={}){let o=wh(e,t),i=eS(e,t,n,r),a={total:o.length,updated:0,preserved:0,unchanged:0,overrides:{pages:0,steps:0,none:0,tts:0,recording:0}},s=(l,c)=>{l&&(a.overrides[c]++,a.overrides[l.type]++)};t.kind==="document"&&e.sectionOrder.forEach(l=>s(e.production.sectionOverrides?.[l]?.voiceSource,"pages"));for(let l of o)s(e.production.stepOverrides[l]?.voiceSource,"steps"),!r.replaceOverrides&&MX(e,t,l)?a.preserved++:T8(oc(e,l),oc(i,l))?a.unchanged++:a.updated++;return a}var OX=e=>`var(--pm-color-${e})`,REe={muted:"muted-soft",accent:"accent-soft",ok:"ok-soft",warn:"warn-soft",danger:"danger-soft"},R8=["muted","accent","ok","warn","danger"];function tS(e,t){return OX(t==="text"?e:REe[e])}var DEe={gray:"muted",brown:"warn",red:"danger",orange:"warn",yellow:"warn",green:"ok",blue:"accent",purple:"accent",pink:"danger"},MEe=OX("sunk");function kh(e,t){if(t==="background"&&e===MEe)return tS("muted",t);let n=DEe[e];return n?tS(n,t):e}var rP=32,xh=class extends Error{status;constructor(t,n){super(n),this.status=t}};function NX(e){return e.map(t=>t.type==="text"?t.text:t.type==="pronunciation"?t.display:"").join("")}function $u(e,t){return(e.steps[t]?.narrationIds??[]).map(n=>NX(e.narrations[n]?.content??[])).join(`
|
|
726
|
-
`)}function Vp(e,t){let n=e.steps[t];if(!n)throw new xh(404,"caption-step-missing");let r={...e.production.defaults,...e.production.sectionOverrides?.[n.sectionId],...e.production.stepOverrides[t]};return X0(JSON.stringify({document:e.id,stepId:t,sectionId:n.sectionId,lang:e.metadata.lang,timing:r,narrations:n.narrationIds.map(o=>({id:o,content:e.narrations[o]?.content,start:e.production.stepOverrides[t]?.narrationStart??e.production.narrationOverrides?.[o]?.narrationStart??r.narrationStart})),pauses:n.narrationIds.flatMap(o=>e.narrations[o]?.content.flatMap(i=>i.type==="cue"?[[i.id,e.production.cueTimings?.[i.id]]]:[])??[])}))}function f1(e,t){if(!t.trim()||!Number.isSafeInteger(e.durationMs)||e.durationMs<=0)return"caption-timing-unavailable";if(!e.segments.length||e.segments.length>rP)return"caption-segment-limit";let n=new Set([0,t.length,...Array.from(new Intl.Segmenter(void 0,{granularity:"grapheme"}).segment(t),a=>a.index)]),r=new Set,o=0,i=0;for(let a of e.segments){if(!a.id||r.has(a.id))return"caption-segment-id-invalid";if(r.add(a.id),!Number.isSafeInteger(a.from)||!Number.isSafeInteger(a.to)||a.from!==o||a.to<=a.from||!n.has(a.from)||!n.has(a.to)||!t.slice(a.from,a.to).trim())return"caption-text-range-invalid";if(!Number.isSafeInteger(a.startMs)||!Number.isSafeInteger(a.endMs)||a.startMs<i||a.endMs<=a.startMs||a.endMs>e.durationMs)return"caption-time-range-invalid";o=a.to,i=a.endMs}return o===t.length?void 0:"caption-text-incomplete"}function p1(e,t){let n=e.steps[t.stepId];if(!n)throw new xh(404,"caption-step-missing");let r=structuredClone(e);if(t.type==="caption.timing.reset")r.production.captionTimings&&delete r.production.captionTimings[t.stepId];else{let o=t.value;if(JSON.stringify(o.narrationIds)!==JSON.stringify(n.narrationIds)||o.sourceFingerprint!==Vp(e,n.id))throw new xh(409,"caption-source-changed");let i=f1(o,$u(e,n.id));if(i)throw new xh(422,i);if(n.narrationIds.some(a=>e.narrations[a]?.content.some(s=>s.type==="cue"&&s.action==="next")))throw new xh(422,"caption-cross-step-unsupported");r.production.captionTimings??={},Object.defineProperty(r.production.captionTimings,n.id,{value:structuredClone(o),configurable:!0,enumerable:!0,writable:!0})}return{content:r,effect:{stepId:n.id,segments:t.type==="caption.timing.set"?t.value.segments.length:0,changed:JSON.stringify(r.production.captionTimings)!==JSON.stringify(e.production.captionTimings),mode:t.type==="caption.timing.set"?"manual":"automatic"}}}function oP(e){let t=e?.captions?.scale;return typeof t=="number"&&t>=.7&&t<=1.6?t:1}function D8(e,t){if(!Number.isFinite(t))throw new Error("document-caption-scale");let n=Math.round(Math.min(1.6,Math.max(.7,t))*10)/10;if(n===oP(e.production))return e;let{captions:r,...o}=e.production;return{...e,production:n===1?o:{...o,captions:{scale:n}}}}var M8={};q6(M8,{JsonPatchError:()=>gi,_areEquals:()=>oS,applyOperation:()=>Q0,applyPatch:()=>uP,applyReducer:()=>BEe,deepClone:()=>FEe,getValueByPointer:()=>cP,validate:()=>LX,validator:()=>dP});var OEe=(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var i in o)o.hasOwnProperty(i)&&(r[i]=o[i])},e(t,n)};return function(t,n){e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}})(),NEe=Object.prototype.hasOwnProperty;function aP(e,t){return NEe.call(e,t)}function sP(e){if(Array.isArray(e)){for(var t=new Array(e.length),n=0;n<t.length;n++)t[n]=""+n;return t}if(Object.keys)return Object.keys(e);var r=[];for(var o in e)aP(e,o)&&r.push(o);return r}function ns(e){switch(typeof e){case"object":return JSON.parse(JSON.stringify(e));case"undefined":return null;default:return e}}function lP(e){for(var t=0,n=e.length,r;t<n;){if(r=e.charCodeAt(t),r>=48&&r<=57){t++;continue}return!1}return!0}function Df(e){return e.indexOf("/")===-1&&e.indexOf("~")===-1?e:e.replace(/~/g,"~0").replace(/\//g,"~1")}function nS(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}function iP(e){if(e===void 0)return!0;if(e){if(Array.isArray(e)){for(var t=0,n=e.length;t<n;t++)if(iP(e[t]))return!0}else if(typeof e=="object"){for(var r=sP(e),o=r.length,i=0;i<o;i++)if(iP(e[r[i]]))return!0}}return!1}function FX(e,t){var n=[e];for(var r in t){var o=typeof t[r]=="object"?JSON.stringify(t[r],null,2):t[r];typeof o<"u"&&n.push(r+": "+o)}return n.join(`
|
|
725
|
+
- `)}`,new Error(me)}let we=`${s}/$ref`,ke=Bo(e,de,n,r,o,i,a,we,l);if(ke.valid||ne.push({instanceLocation:a,keyword:"$ref",keywordLocation:we,error:"A subschema had errors."},...ke.errors),n==="4"||n==="7")return{valid:ne.length===0,errors:ne}}if(Array.isArray(m)){let se=m.length,de=!1;for(let we=0;we<se;we++)if(d===m[we]||m[we]==="integer"&&d==="number"&&e%1===0&&e===e){de=!0;break}de||ne.push({instanceLocation:a,keyword:"type",keywordLocation:`${s}/type`,error:`Instance type "${d}" is invalid. Expected "${m.join('", "')}".`})}else m==="integer"?(d!=="number"||e%1||e!==e)&&ne.push({instanceLocation:a,keyword:"type",keywordLocation:`${s}/type`,error:`Instance type "${d}" is invalid. Expected "${m}".`}):m!==void 0&&d!==m&&ne.push({instanceLocation:a,keyword:"type",keywordLocation:`${s}/type`,error:`Instance type "${d}" is invalid. Expected "${m}".`});if(h!==void 0&&(d==="object"||d==="array"?u1(e,h)||ne.push({instanceLocation:a,keyword:"const",keywordLocation:`${s}/const`,error:`Instance does not match ${JSON.stringify(h)}.`}):e!==h&&ne.push({instanceLocation:a,keyword:"const",keywordLocation:`${s}/const`,error:`Instance does not match ${JSON.stringify(h)}.`})),g!==void 0&&(d==="object"||d==="array"?g.some(se=>u1(e,se))||ne.push({instanceLocation:a,keyword:"enum",keywordLocation:`${s}/enum`,error:`Instance does not match any of ${JSON.stringify(g)}.`}):g.some(se=>e===se)||ne.push({instanceLocation:a,keyword:"enum",keywordLocation:`${s}/enum`,error:`Instance does not match any of ${JSON.stringify(g)}.`})),b!==void 0){let se=`${s}/not`;Bo(e,b,n,r,o,i,a,se).valid&&ne.push({instanceLocation:a,keyword:"not",keywordLocation:se,error:'Instance matched "not" schema.'})}let re=[];if(y!==void 0){let se=`${s}/anyOf`,de=ne.length,we=!1;for(let ke=0;ke<y.length;ke++){let me=y[ke],ie=Object.create(l),ge=Bo(e,me,n,r,o,p===!0?i:null,a,`${se}/${ke}`,ie);ne.push(...ge.errors),we=we||ge.valid,ge.valid&&re.push(ie)}we?ne.length=de:ne.splice(de,0,{instanceLocation:a,keyword:"anyOf",keywordLocation:se,error:"Instance does not match any subschemas."})}if(w!==void 0){let se=`${s}/allOf`,de=ne.length,we=!0;for(let ke=0;ke<w.length;ke++){let me=w[ke],ie=Object.create(l),ge=Bo(e,me,n,r,o,p===!0?i:null,a,`${se}/${ke}`,ie);ne.push(...ge.errors),we=we&&ge.valid,ge.valid&&re.push(ie)}we?ne.length=de:ne.splice(de,0,{instanceLocation:a,keyword:"allOf",keywordLocation:se,error:"Instance does not match every subschema."})}if(S!==void 0){let se=`${s}/oneOf`,de=ne.length,we=S.filter((ke,me)=>{let ie=Object.create(l),ge=Bo(e,ke,n,r,o,p===!0?i:null,a,`${se}/${me}`,ie);return ne.push(...ge.errors),ge.valid&&re.push(ie),ge.valid}).length;we===1?ne.length=de:ne.splice(de,0,{instanceLocation:a,keyword:"oneOf",keywordLocation:se,error:`Instance does not match exactly one subschema (${we} matches).`})}if((d==="object"||d==="array")&&Object.assign(l,...re),x!==void 0){let se=`${s}/if`;if(Bo(e,x,n,r,o,i,a,se,l).valid){if(k!==void 0){let we=Bo(e,k,n,r,o,i,a,`${s}/then`,l);we.valid||ne.push({instanceLocation:a,keyword:"if",keywordLocation:se,error:'Instance does not match "then" schema.'},...we.errors)}}else if(C!==void 0){let we=Bo(e,C,n,r,o,i,a,`${s}/else`,l);we.valid||ne.push({instanceLocation:a,keyword:"if",keywordLocation:se,error:'Instance does not match "else" schema.'},...we.errors)}}if(d==="object"){if(v!==void 0)for(let ke of v)ke in e||ne.push({instanceLocation:a,keyword:"required",keywordLocation:`${s}/required`,error:`Instance does not have required property "${ke}".`});let se=Object.keys(e);if(A!==void 0&&se.length<A&&ne.push({instanceLocation:a,keyword:"minProperties",keywordLocation:`${s}/minProperties`,error:`Instance does not have at least ${A} properties.`}),D!==void 0&&se.length>D&&ne.push({instanceLocation:a,keyword:"maxProperties",keywordLocation:`${s}/maxProperties`,error:`Instance does not have at least ${D} properties.`}),N!==void 0){let ke=`${s}/propertyNames`;for(let me in e){let ie=`${a}/${Vc(me)}`,ge=Bo(me,N,n,r,o,i,ie,ke);ge.valid||ne.push({instanceLocation:a,keyword:"propertyNames",keywordLocation:ke,error:`Property name "${me}" does not match schema.`},...ge.errors)}}if(O!==void 0){let ke=`${s}/dependantRequired`;for(let me in O)if(me in e){let ie=O[me];for(let ge of ie)ge in e||ne.push({instanceLocation:a,keyword:"dependentRequired",keywordLocation:ke,error:`Instance has "${me}" but does not have "${ge}".`})}}if(M!==void 0)for(let ke in M){let me=`${s}/dependentSchemas`;if(ke in e){let ie=Bo(e,M[ke],n,r,o,i,a,`${me}/${Vc(ke)}`,l);ie.valid||ne.push({instanceLocation:a,keyword:"dependentSchemas",keywordLocation:me,error:`Instance has "${ke}" but does not match dependant schema.`},...ie.errors)}}if($!==void 0){let ke=`${s}/dependencies`;for(let me in $)if(me in e){let ie=$[me];if(Array.isArray(ie))for(let ge of ie)ge in e||ne.push({instanceLocation:a,keyword:"dependencies",keywordLocation:ke,error:`Instance has "${me}" but does not have "${ge}".`});else{let ge=Bo(e,ie,n,r,o,i,a,`${ke}/${Vc(me)}`);ge.valid||ne.push({instanceLocation:a,keyword:"dependencies",keywordLocation:ke,error:`Instance has "${me}" but does not match dependant schema.`},...ge.errors)}}}let de=Object.create(null),we=!1;if(P!==void 0){let ke=`${s}/properties`;for(let me in P){if(!(me in e))continue;let ie=`${a}/${Vc(me)}`,ge=Bo(e[me],P[me],n,r,o,i,ie,`${ke}/${Vc(me)}`);if(ge.valid)l[me]=de[me]=!0;else if(we=o,ne.push({instanceLocation:a,keyword:"properties",keywordLocation:ke,error:`Property "${me}" does not match schema.`},...ge.errors),we)break}}if(!we&&I!==void 0){let ke=`${s}/patternProperties`;for(let me in I){let ie=new RegExp(me,"u"),ge=I[me];for(let Ce in e){if(!ie.test(Ce))continue;let vt=`${a}/${Vc(Ce)}`,Oe=Bo(e[Ce],ge,n,r,o,i,vt,`${ke}/${Vc(me)}`);Oe.valid?l[Ce]=de[Ce]=!0:(we=o,ne.push({instanceLocation:a,keyword:"patternProperties",keywordLocation:ke,error:`Property "${Ce}" matches pattern "${me}" but does not match associated schema.`},...Oe.errors))}}}if(!we&&T!==void 0){let ke=`${s}/additionalProperties`;for(let me in e){if(de[me])continue;let ie=`${a}/${Vc(me)}`,ge=Bo(e[me],T,n,r,o,i,ie,ke);ge.valid?l[me]=!0:(we=o,ne.push({instanceLocation:a,keyword:"additionalProperties",keywordLocation:ke,error:`Property "${me}" does not match additional properties schema.`},...ge.errors))}}else if(!we&&_!==void 0){let ke=`${s}/unevaluatedProperties`;for(let me in e)if(!l[me]){let ie=`${a}/${Vc(me)}`,ge=Bo(e[me],_,n,r,o,i,ie,ke);ge.valid?l[me]=!0:ne.push({instanceLocation:a,keyword:"unevaluatedProperties",keywordLocation:ke,error:`Property "${me}" does not match unevaluated properties schema.`},...ge.errors)}}}else if(d==="array"){L!==void 0&&e.length>L&&ne.push({instanceLocation:a,keyword:"maxItems",keywordLocation:`${s}/maxItems`,error:`Array has too many items (${e.length} > ${L}).`}),F!==void 0&&e.length<F&&ne.push({instanceLocation:a,keyword:"minItems",keywordLocation:`${s}/minItems`,error:`Array has too few items (${e.length} < ${F}).`});let se=e.length,de=0,we=!1;if(j!==void 0){let ke=`${s}/prefixItems`,me=Math.min(j.length,se);for(;de<me;de++){let ie=Bo(e[de],j[de],n,r,o,i,`${a}/${de}`,`${ke}/${de}`);if(l[de]=!0,!ie.valid&&(we=o,ne.push({instanceLocation:a,keyword:"prefixItems",keywordLocation:ke,error:"Items did not match schema."},...ie.errors),we))break}}if(W!==void 0){let ke=`${s}/items`;if(Array.isArray(W)){let me=Math.min(W.length,se);for(;de<me;de++){let ie=Bo(e[de],W[de],n,r,o,i,`${a}/${de}`,`${ke}/${de}`);if(l[de]=!0,!ie.valid&&(we=o,ne.push({instanceLocation:a,keyword:"items",keywordLocation:ke,error:"Items did not match schema."},...ie.errors),we))break}}else for(;de<se;de++){let me=Bo(e[de],W,n,r,o,i,`${a}/${de}`,ke);if(l[de]=!0,!me.valid&&(we=o,ne.push({instanceLocation:a,keyword:"items",keywordLocation:ke,error:"Items did not match schema."},...me.errors),we))break}if(!we&&K!==void 0){let me=`${s}/additionalItems`;for(;de<se;de++){let ie=Bo(e[de],K,n,r,o,i,`${a}/${de}`,me);l[de]=!0,ie.valid||(we=o,ne.push({instanceLocation:a,keyword:"additionalItems",keywordLocation:me,error:"Items did not match additional items schema."},...ie.errors))}}}if(G!==void 0)if(se===0&&U===void 0)ne.push({instanceLocation:a,keyword:"contains",keywordLocation:`${s}/contains`,error:"Array is empty. It must contain at least one item matching the schema."});else if(U!==void 0&&se<U)ne.push({instanceLocation:a,keyword:"minContains",keywordLocation:`${s}/minContains`,error:`Array has less items (${se}) than minContains (${U}).`});else{let ke=`${s}/contains`,me=ne.length,ie=0;for(let ge=0;ge<se;ge++){let Ce=Bo(e[ge],G,n,r,o,i,`${a}/${ge}`,ke);Ce.valid?(l[ge]=!0,ie++):ne.push(...Ce.errors)}ie>=(U||0)&&(ne.length=me),U===void 0&&H===void 0&&ie===0?ne.splice(me,0,{instanceLocation:a,keyword:"contains",keywordLocation:ke,error:"Array does not contain item matching schema."}):U!==void 0&&ie<U?ne.push({instanceLocation:a,keyword:"minContains",keywordLocation:`${s}/minContains`,error:`Array must contain at least ${U} items matching schema. Only ${ie} items were found.`}):H!==void 0&&ie>H&&ne.push({instanceLocation:a,keyword:"maxContains",keywordLocation:`${s}/maxContains`,error:`Array may contain at most ${H} items matching schema. ${ie} items were found.`})}if(!we&&z!==void 0){let ke=`${s}/unevaluatedItems`;for(de;de<se;de++){if(l[de])continue;let me=Bo(e[de],z,n,r,o,i,`${a}/${de}`,ke);l[de]=!0,me.valid||ne.push({instanceLocation:a,keyword:"unevaluatedItems",keywordLocation:ke,error:"Items did not match unevaluated items schema."},...me.errors)}}if(V)for(let ke=0;ke<se;ke++){let me=e[ke],ie=typeof me=="object"&&me!==null;for(let ge=0;ge<se;ge++){if(ke===ge)continue;let Ce=e[ge];(me===Ce||ie&&(typeof Ce=="object"&&Ce!==null)&&u1(me,Ce))&&(ne.push({instanceLocation:a,keyword:"uniqueItems",keywordLocation:`${s}/uniqueItems`,error:`Duplicate items at indexes ${ke} and ${ge}.`}),ke=Number.MAX_SAFE_INTEGER,ge=Number.MAX_SAFE_INTEGER)}}}else if(d==="number"){if(n==="4"?(Y!==void 0&&(ee===!0&&e<=Y||e<Y)&&ne.push({instanceLocation:a,keyword:"minimum",keywordLocation:`${s}/minimum`,error:`${e} is less than ${ee?"or equal to ":""} ${Y}.`}),te!==void 0&&(X===!0&&e>=te||e>te)&&ne.push({instanceLocation:a,keyword:"maximum",keywordLocation:`${s}/maximum`,error:`${e} is greater than ${X?"or equal to ":""} ${te}.`})):(Y!==void 0&&e<Y&&ne.push({instanceLocation:a,keyword:"minimum",keywordLocation:`${s}/minimum`,error:`${e} is less than ${Y}.`}),te!==void 0&&e>te&&ne.push({instanceLocation:a,keyword:"maximum",keywordLocation:`${s}/maximum`,error:`${e} is greater than ${te}.`}),ee!==void 0&&e<=ee&&ne.push({instanceLocation:a,keyword:"exclusiveMinimum",keywordLocation:`${s}/exclusiveMinimum`,error:`${e} is less than ${ee}.`}),X!==void 0&&e>=X&&ne.push({instanceLocation:a,keyword:"exclusiveMaximum",keywordLocation:`${s}/exclusiveMaximum`,error:`${e} is greater than or equal to ${X}.`})),ue!==void 0){let se=e%ue;Math.abs(0-se)>=11920929e-14&&Math.abs(ue-se)>=11920929e-14&&ne.push({instanceLocation:a,keyword:"multipleOf",keywordLocation:`${s}/multipleOf`,error:`${e} is not a multiple of ${ue}.`})}}else if(d==="string"){let se=fe===void 0&&Z===void 0?0:RX(e);fe!==void 0&&se<fe&&ne.push({instanceLocation:a,keyword:"minLength",keywordLocation:`${s}/minLength`,error:`String is too short (${se} < ${fe}).`}),Z!==void 0&&se>Z&&ne.push({instanceLocation:a,keyword:"maxLength",keywordLocation:`${s}/maxLength`,error:`String is too long (${se} > ${Z}).`}),ce!==void 0&&!new RegExp(ce,"u").test(e)&&ne.push({instanceLocation:a,keyword:"pattern",keywordLocation:`${s}/pattern`,error:"String does not match pattern."}),E!==void 0&&g8[E]&&!g8[E](e)&&ne.push({instanceLocation:a,keyword:"format",keywordLocation:`${s}/format`,error:`String does not match format "${E}".`})}return{valid:ne.length===0,errors:ne}}var vh=class{schema;draft;shortCircuit;lookup;constructor(t,n="2019-09",r=!0){this.schema=t,this.draft=n,this.shortCircuit=r,this.lookup=jp(t)}validate(t){return Bo(t,this.schema,this.draft,this.lookup,this.shortCircuit)}addSchema(t,n){n&&(t={...t,$id:n}),jp(t,this.lookup)}};var Ct=e=>({$ref:`#/$defs/${e}`}),At={type:"string"},Qn={type:"string",minLength:1,maxLength:200,pattern:"^[^\\u0000-\\u001f]+$",not:{enum:["__proto__","constructor","prototype"]}},Y2={type:"number",exclusiveMinimum:0},bh={type:"number",minimum:0},yh={type:"integer",minimum:0},Fr=e=>({type:"array",items:e}),Rf={type:"array",items:Qn,uniqueItems:!0},Li=e=>({type:"object",additionalProperties:e}),Dt=(e,t=Object.keys(e))=>({type:"object",properties:e,required:t,additionalProperties:!1}),Bi=e=>({const:e}),PEe={only:Fr(At),audience:Fr(At)},v8=Dt({alignment:{enum:["left","center","right","justify"]},color:At,background:At},[]),DX=[{required:["value"],not:{required:["origin"]}},{required:["origin"],not:{required:["value"]}}],Bu=(e,t,n=Object.keys(t))=>Dt({id:Qn,type:Bi(e),...t},["id","type",...n]),Z2=(e,t,n=Object.keys(t))=>Dt({id:Qn,type:Bi(e),...PEe,...t},["id","type",...n]),X2={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"urn:presmium:teaching-document:1",...Dt({schemaVersion:{const:1},id:Qn,metadata:Dt({title:At,description:At,tags:Fr(At),lang:{type:"string",minLength:1},plugins:Fr(At),presmium:Li(Ct("JsonObject")),renderers:Li(Ct("JsonObject")),execute:Ct("JsonObject"),checks:Ct("JsonObject"),translations:Li(At),translationOf:Dt({entry:At,digest:At})},["title","lang"]),sectionOrder:{...Rf,minItems:1},sections:Li(Ct("Section")),blocks:Li(Ct("Block")),steps:Li(Ct("Step")),narrations:Li(Ct("Narration")),assets:Li(Ct("Asset")),definitions:Li(Ct("Definition")),production:Ct("Production"),comments:Li(Ct("Thread"))},["schemaVersion","id","metadata","sectionOrder","sections","blocks","steps","narrations","assets","definitions","production"]),$defs:{JsonValue:{anyOf:[{type:["null","boolean","number","string"]},{type:"array",items:Ct("JsonValue")},Ct("JsonObject")]},JsonObject:{type:"object",additionalProperties:Ct("JsonValue")},JsonSchema:{anyOf:[{type:"boolean"},Ct("JsonObject")]},Layout:Dt({type:{enum:["stack","columns","canvas","scrolly"]},properties:Ct("JsonObject"),renderers:Li(Ct("JsonObject"))},["type"]),Section:Dt({id:Qn,title:At,level:{type:"integer",minimum:1,maximum:6},children:Rf,stepOrder:{...Rf,minItems:1},layout:Ct("Layout"),audience:Fr(At),config:Li(Ct("JsonObject"))},["id","title","children","stepOrder","layout"]),Mark:{oneOf:[Dt({type:{enum:["bold","italic","underline","strike","code"]}}),Dt({type:{enum:["color","background"]},value:At})]},Inline:{oneOf:[Dt({type:Bi("text"),text:At,marks:Fr(Ct("Mark"))},["type","text"]),Dt({type:Bi("link"),href:At,children:Fr(Ct("Inline"))}),Dt({type:Bi("math"),value:At}),Dt({type:Bi("break")}),Dt({type:Bi("extension"),kind:Qn,schemaVersion:{type:"integer",minimum:1},data:Ct("JsonObject"),fallback:At})]},RichTextNode:{oneOf:[Bu("paragraph",{children:Fr(Ct("Inline")),style:v8},["children"]),Bu("heading",{level:{type:"integer",minimum:1,maximum:6},children:Fr(Ct("Inline")),style:v8},["level","children"]),Bu("list",{ordered:{type:"boolean"},start:{type:"integer",minimum:1},children:Fr(Ct("ListItem"))},["ordered","children"]),Bu("blockquote",{children:Fr(Ct("RichTextNode"))}),Bu("code",{language:At,value:At}),Bu("math",{value:At}),Bu("table",{children:Fr(Ct("TableRow")),headerRows:yh,headerColumns:yh,columnWidths:Fr(Y2)},["children"]),Bu("extension",{kind:Qn,schemaVersion:{type:"integer",minimum:1},data:Ct("JsonObject"),fallback:Fr(Ct("RichTextNode"))})]},ListItem:Bu("listItem",{children:Fr(Ct("RichTextNode")),checked:{type:"boolean"}},["children"]),TableRow:Bu("tableRow",{children:Fr(Ct("TableCell"))}),TableCell:Bu("tableCell",{children:Fr(Ct("Inline")),style:v8,colspan:{type:"integer",minimum:1},rowspan:{type:"integer",minimum:1}},["children"]),CodeReference:Dt({anchor:{type:"string",minLength:1},pin:At,repo:At,highlightRegions:Li({type:"string",minLength:1})},["anchor"]),VariantReference:Dt({anchor:{type:"string",minLength:1},pin:At,repo:At},["anchor"]),CodeVariant:{...Dt({id:Qn,title:At,value:At,origin:Ct("VariantReference")},["id","title"]),oneOf:DX},CodeExecution:Dt({args:Li(At),stdin:At,timeoutMs:Y2,executor:At,when:{enum:["compile","live","both"]},session:At},["when"]),Block:{oneOf:[Z2("text",{content:Fr(Ct("RichTextNode")),reveal:Dt({type:Bi("items"),order:Rf})},["content"]),Z2("container",{layout:{enum:["stack","columns","tabs"]},children:Rf,properties:Dt({title:At,columnWidths:Fr(Y2),tabTitles:Fr(At)},[])}),Z2("image",{assetId:Qn,alt:At,caption:Fr(Ct("Inline")),width:Y2,alignment:{enum:["left","center","right","justify"]}},["alt"]),{...Z2("code",{language:At,value:At,origin:Ct("CodeReference"),title:At,execution:Ct("CodeExecution"),highlight:Li(Fr({type:"integer",minimum:1})),variants:Fr(Ct("CodeVariant")),echo:{type:"boolean"}},["language"]),oneOf:DX},Z2("component",{definitionId:Qn,parameters:Ct("JsonObject"),children:Rf},["definitionId","parameters"])]},Visual:Dt({blockId:Qn,visible:{type:"boolean"},state:Qn,parameters:Ct("JsonObject")},["blockId","visible"]),Step:Dt({id:Qn,sectionId:Qn,title:At,visuals:Fr(Ct("Visual")),narrationIds:Rf,inherits:Qn},["id","sectionId","visuals","narrationIds"]),NarrationNode:{oneOf:[Dt({type:Bi("text"),text:At}),Dt({type:Bi("pronunciation"),display:At,spoken:At}),Dt({id:Qn,type:Bi("cue"),action:{type:"string",minLength:1},target:Dt({blockId:Qn,element:At},["blockId"]),parameters:Ct("JsonObject")},["id","type","action"])]},Narration:Dt({id:Qn,content:Fr(Ct("NarrationNode")),provenance:Dt({type:Bi("transcription"),transcriptionId:{type:"string",pattern:"^[a-f0-9]{64}$"},revision:{type:"string",pattern:"^[a-f0-9]{64}$"},assetId:Qn,audioSha256:{type:"string",pattern:"^[a-f0-9]{64}$"},segmentIds:{...Rf,minItems:1}})},["id","content"]),Asset:Dt({id:Qn,kind:{enum:["image","audio","video","file"]},location:{type:"string",minLength:1},title:{type:"string",minLength:1,maxLength:200},fingerprint:At,mediaType:At},["id","kind","location"]),Implementation:{oneOf:[Dt({type:Bi("file"),path:{type:"string",minLength:1},exportName:At,fingerprint:At},["type","path"]),Dt({type:Bi("module"),specifier:{type:"string",minLength:1},exportName:At},["type","specifier"]),Dt({type:Bi("plugin"),plugin:Qn,name:Qn})]},State:Dt({id:Qn,title:At,parameterSchema:Ct("JsonSchema"),legacyIndex:yh},["id"]),Definition:Dt({id:Qn,kind:{type:"string",minLength:1},schemaVersion:{type:"integer",minimum:1},implementation:Ct("Implementation"),parameterSchema:Ct("JsonSchema"),states:Fr(Ct("State")),data:Ct("JsonObject")},["id","kind","schemaVersion","implementation","parameterSchema","states"]),VoiceSource:{oneOf:[Dt({type:Bi("none")}),Dt({type:Bi("tts"),voice:Dt({voice:{type:"string",minLength:1},engine:At,rate:Y2,style:At},["voice"])}),Dt({type:Bi("recording"),assetId:Qn,sourceRange:Dt({startMs:bh,endMs:bh})},["type","assetId"])]},StepProduction:Dt({narrationStart:{enum:["with-animation","after-animation"]},minimumHoldMs:bh,trailingPauseMs:bh,captionVisible:{type:"boolean"},voiceSource:Ct("VoiceSource")},[]),MediaClip:Dt({id:Qn,assetId:Qn,sourceRange:Dt({startMs:bh,endMs:bh}),attachment:Dt({stepId:Qn,offsetMs:bh}),volume:{type:"number",minimum:0,maximum:1},muted:{type:"boolean"}},["id","assetId","sourceRange","attachment","volume"]),CaptionTiming:Dt({narrationIds:Rf,sourceFingerprint:{type:"string",pattern:"^[a-f0-9]{16}$"},playbackFingerprint:{type:"string",pattern:"^[a-f0-9]{16}$"},durationMs:{type:"integer",minimum:1},segments:{type:"array",minItems:1,maxItems:32,items:Dt({id:Qn,from:yh,to:yh,startMs:yh,endMs:yh})}}),Production:Dt({defaults:Ct("StepProduction"),sectionOverrides:Li(Ct("StepProduction")),stepOverrides:Li(Ct("StepProduction")),narrationOverrides:Li(Dt({narrationStart:{enum:["with-animation","after-animation"]}})),cueTimings:Li(Dt({pauseMs:bh})),captionTimings:Li(Ct("CaptionTiming")),captions:Dt({scale:{type:"number",minimum:.7,maximum:1.6}}),mediaClips:Fr(Ct("MediaClip"))},["defaults","stepOverrides","mediaClips"]),TextPoint:Dt({blockId:{type:"string",minLength:1,maxLength:205},offset:yh}),Comment:Dt({id:Qn,type:Bi("comment"),userId:Qn,createdAt:At,updatedAt:At,deletedAt:At,content:Fr(Ct("RichTextNode")),metadata:Ct("JsonObject"),reactions:Fr(Dt({emoji:At,createdAt:At,userIds:Rf}))},["id","type","userId","createdAt","updatedAt","reactions"]),Thread:Dt({id:Qn,type:Bi("thread"),createdAt:At,updatedAt:At,resolved:{type:"boolean"},resolvedUpdatedAt:At,resolvedBy:Qn,metadata:Ct("JsonObject"),deletedAt:At,anchor:{oneOf:[Dt({from:Ct("TextPoint"),to:Ct("TextPoint")}),Dt({blockId:Qn,stepId:Qn},["blockId"])]},comments:Fr(Ct("Comment"))},["id","type","createdAt","updatedAt","resolved","comments"])}};var EEe=new vh({$id:"urn:presmium:step-narrations:1",$defs:structuredClone(X2.$defs),type:"array",items:{$ref:"#/$defs/Narration"}},"2020-12",!1);function b8(e,t,n){let r=e.steps[t];if(!r||!e.sections[r.sectionId]?.stepOrder.includes(t))throw new Error("document-narration-target");if(!EEe.validate(n).valid)throw new Error("document-narration-content");let o=n.map(l=>l.id);if(new Set(o).size!==o.length)throw new Error("document-narration-target");let i={...e,steps:{...e.steps,[t]:{...r,narrationIds:o}},narrations:{...e.narrations},production:{...e.production,...e.production.narrationOverrides?{narrationOverrides:{...e.production.narrationOverrides}}:{},...e.production.cueTimings?{cueTimings:{...e.production.cueTimings}}:{}}};for(let l of n)i.narrations[l.id]=structuredClone(l);let a=new Set(Object.values(i.steps).flatMap(l=>l.narrationIds));for(let l of r.narrationIds)a.has(l)||(delete i.narrations[l],i.production.narrationOverrides&&delete i.production.narrationOverrides[l]);let s=new Set(Object.values(i.narrations).flatMap(l=>l.content.flatMap(c=>c.type==="cue"?[c.id]:[])));for(let l of Object.keys(i.production.cueTimings??{}))s.has(l)||delete i.production.cueTimings[l];return i}var Q2={minimumHoldMs:4e3,trailingPauseMs:500};function y8(e,t){let n=P8(e);for(let i of e.sectionOrder)n.add(`page:${i}`);let r=()=>{let i=t();if(!i||i.length>200||n.has(i)||n.has(`page:${i}`))throw new Error("page-id-collision");return n.add(i),i},o=r();return n.add(`page:${o}`),{sectionId:o,blockId:r(),nodeId:r(),stepId:r()}}function eP({sectionId:e,blockId:t,nodeId:n,stepId:r},o){return{section:{id:e,title:o,children:[t],stepOrder:[r],layout:{type:"stack"}},block:{id:t,type:"text",content:[{id:n,type:"paragraph",children:[]}]},step:{id:r,sectionId:e,visuals:[{blockId:t,visible:!0}],narrationIds:[]},timing:{...Q2}}}function w8(e,t,n){if(!e.sections[t]||!e.sectionOrder.includes(t))throw new Error("page-boundary");if(!n.trim())throw new Error("page-title-required");let r=structuredClone(e);return r.sections[t].title=n.trim(),r}function k8(e,t,n){if(!e.sections[t]||!e.sectionOrder.includes(t)||n!==null&&(!e.sections[n]||!e.sectionOrder.includes(n)))throw new Error("page-boundary");let r=structuredClone(e);return n!==t&&(r.sectionOrder=r.sectionOrder.filter(o=>o!==t),r.sectionOrder.splice(n===null?r.sectionOrder.length:r.sectionOrder.indexOf(n),0,t)),r}function x8(e,t){let n=new Set,r=o=>{if(n.has(o))return;n.add(o);let i=e.blocks[o];(i?.type==="container"||i?.type==="component")&&i.children?.forEach(r)};return e.sections[t]?.children.forEach(r),n}function S8(e,t){let n=e.sections[t];if(!n||!e.sectionOrder.includes(t))throw new Error("page-boundary");let r=x8(e,t),o=new Set(n.stepOrder),i=new Set(n.stepOrder.flatMap(m=>e.steps[m].narrationIds)),a=Object.values(e.steps).filter(m=>!o.has(m.id)),s=new Map;for(let m of a)for(let h of m.narrationIds){let g=s.get(h)??[];g.push(m.id),s.set(h,g)}let l=new Set(s.keys()),c=new Set([...i].filter(m=>!l.has(m))),d=[],u=[];for(let[m,h]of Object.entries(e.narrations))for(let g of h.content)g.type==="cue"&&(c.has(m)?d.push(g.id):g.target&&r.has(g.target.blockId)&&u.push({type:"cue",narrationId:m,cueId:g.id,blockId:g.target.blockId,stepIds:s.get(m)??[]}));for(let m of a)m.inherits&&o.has(m.inherits)&&u.push({type:"inheritance",stepId:m.id,inheritedStepId:m.inherits});let f=new Set(r);e.sectionOrder.length>1&&f.add(`page:${t}`);let p=m=>{switch(f.add(m.id),m.type){case"list":case"listItem":case"blockquote":case"table":case"tableRow":m.children.forEach(p);break;case"extension":m.fallback.forEach(p);break}};for(let m of r){let h=e.blocks[m];h?.type==="text"&&h.content.forEach(p)}return{sectionId:t,retainedEmpty:e.sectionOrder.length===1,blocks:[...r],steps:[...o],narrations:[...c],retainedNarrations:[...i].filter(m=>!c.has(m)),cues:d,clips:e.production.mediaClips.filter(m=>o.has(m.attachment.stepId)).map(m=>m.id),detachedComments:Object.values(e.comments??{}).filter(m=>{let h=m.anchor;return h?Po(h)?f.has(h.blockId)||!!(h.stepId&&o.has(h.stepId)):f.has(h.from.blockId)||f.has(h.to.blockId):!1}).map(m=>m.id),references:u}}function tP(e,t,n,r){let o=S8(e,r);return{document:t,section:r,revision:n,source:{path:`${t?`${t}/`:""}lecture.json`,version:n},counts:{steps:o.steps.length,blocks:o.blocks.length,narration:o.narrations.length+o.retainedNarrations.length},last:o.retainedEmpty,allowed:!o.references.length,...o.references.length?{reason:"page-referenced",references:o.references.map(i=>({document:t,section:i.type==="inheritance"?e.steps[i.stepId].sectionId:i.stepIds[0]?e.steps[i.stepIds[0]].sectionId:r,...i.type==="cue"?{block:i.blockId}:{}}))}:{}}}function C8(e,t,n){let r=S8(e,t);if(r.references.length)throw new Error("page-referenced");let o=structuredClone(e),i=o.sections[t];for(let s of r.blocks)delete o.blocks[s];for(let s of r.steps)delete o.steps[s],delete o.production.stepOverrides[s],o.production.captionTimings&&delete o.production.captionTimings[s];for(let s of r.narrations)delete o.narrations[s],o.production.narrationOverrides&&delete o.production.narrationOverrides[s];for(let s of r.cues)o.production.cueTimings&&delete o.production.cueTimings[s];o.production.sectionOverrides&&delete o.production.sectionOverrides[t];let a=new Set(r.clips);o.production.mediaClips=o.production.mediaClips.filter(s=>!a.has(s.id));for(let s of r.detachedComments)delete o.comments[s].anchor;if(!r.retainedEmpty)o.sectionOrder=o.sectionOrder.filter(s=>s!==t),delete o.sections[t];else{let s=n();if(!s||s.length>200||P8(e).has(s))throw new Error("page-id-collision");i.children=[],i.stepOrder=[s],o.steps[s]={id:s,sectionId:t,visuals:[],narrationIds:[]},o.production.stepOverrides[s]={...Q2}}return o}function _8(e,t,n,r){let o=e.sections[t];if(!o||!e.sectionOrder.includes(t))throw new Error("page-boundary");let i=structuredClone(e),a=new Map,s=P8(e),l=m=>{let h=a.get(m);if(!h){if(h=r(m),!h||h.length>200||s.has(h))throw new Error("page-copy-id-collision");s.add(h),a.set(m,h)}return h},c=m=>a.get(m)??m,d=x8(e,t),u=new Set(o.stepOrder.flatMap(m=>e.steps[m].narrationIds)),f=m=>{switch(m.id=l(m.id),m.type){case"list":case"listItem":case"blockquote":case"table":case"tableRow":m.children.forEach(f);break;case"extension":m.fallback.forEach(f);break}},p=l(t);for(let m of o.stepOrder)l(m);for(let m of d)l(m);for(let m of u)l(m);for(let m of d){let h=structuredClone(e.blocks[m]);h.id=c(m),h.type==="text"?(h.content.forEach(f),h.reveal&&(h.reveal.order=h.reveal.order.map(c))):h.type==="container"||h.type==="component"?h.children&&(h.children=h.children.map(c)):h.type==="code"&&(h.highlight&&(h.highlight=Object.fromEntries(Object.entries(h.highlight).map(([g,v])=>[c(g),v]))),h.origin?.highlightRegions&&(h.origin.highlightRegions=Object.fromEntries(Object.entries(h.origin.highlightRegions).map(([g,v])=>[c(g),v]))),h.variants?.forEach(g=>{g.id=l(g.id)})),i.blocks[h.id]=h}for(let m of u){let h=structuredClone(e.narrations[m]);h.id=c(m);for(let g of h.content)if(g.type==="cue"){let v=g.id;g.id=l(v),g.target&&(g.target.blockId=c(g.target.blockId)),i.production.cueTimings?.[v]&&(i.production.cueTimings[g.id]=structuredClone(i.production.cueTimings[v]))}i.narrations[h.id]=h,i.production.narrationOverrides?.[m]&&(i.production.narrationOverrides[h.id]=structuredClone(i.production.narrationOverrides[m]))}for(let m of o.stepOrder){let h=structuredClone(e.steps[m]);h.id=c(m),h.sectionId=p,h.visuals.forEach(v=>{v.blockId=c(v.blockId)}),h.narrationIds=h.narrationIds.map(c),h.inherits&&(h.inherits=c(h.inherits)),i.steps[h.id]=h,i.production.stepOverrides[m]&&(i.production.stepOverrides[h.id]=structuredClone(i.production.stepOverrides[m]));let g=e.production.captionTimings?.[m];g&&(i.production.captionTimings??={},i.production.captionTimings[h.id]={...structuredClone(g),narrationIds:g.narrationIds.map(c)})}i.production.sectionOverrides?.[t]&&(i.production.sectionOverrides[p]=structuredClone(i.production.sectionOverrides[t]));for(let m of e.production.mediaClips)if(o.stepOrder.includes(m.attachment.stepId)){let h=structuredClone(m);h.id=l(m.id),h.attachment.stepId=c(m.attachment.stepId),i.production.mediaClips.push(h)}return i.sections[p]={...structuredClone(o),id:p,title:n,children:o.children.map(c),stepOrder:o.stepOrder.map(c)},i.sectionOrder.splice(i.sectionOrder.indexOf(t)+1,0,p),{document:i,section:p,mapping:Object.fromEntries(a)}}function P8(e){let t=new Set([e.id,...Object.keys(e.sections),...Object.keys(e.blocks),...Object.keys(e.steps),...Object.keys(e.narrations),...Object.keys(e.assets),...Object.keys(e.definitions)]),n=r=>{switch(t.add(r.id),r.type){case"list":case"listItem":case"blockquote":case"table":case"tableRow":r.children.forEach(n);break;case"extension":r.fallback.forEach(n);break}};for(let r of Object.values(e.blocks))r.type==="text"?r.content.forEach(n):r.type==="code"&&r.variants?.forEach(o=>t.add(o.id));for(let r of Object.values(e.narrations))for(let o of r.content)o.type==="cue"&&t.add(o.id);for(let r of e.production.mediaClips)t.add(r.id);for(let r of Object.values(e.comments??{})){t.add(r.id);for(let o of r.comments)t.add(o.id),o.content?.forEach(n)}return t}var AEe=0xcbf29ce484222325n,IEe=0x100000001b3n;function X0(e){let t=AEe;for(let n of new TextEncoder().encode(e))t=BigInt.asUintN(64,(t^BigInt(n))*IEe);return t.toString(16).padStart(16,"0")}function A8(e,t){let n=Object.hasOwn(e.sections,t)&&e.sections[t];if(!n||!e.sectionOrder.includes(t))throw new Error(`document-voice-page-missing: ${t}`);return n}function I8(e,t){let n=Object.hasOwn(e.steps,t)&&e.steps[t];if(!n||!A8(e,n.sectionId).stepOrder.includes(t))throw new Error(`document-voice-step-missing: ${t}`);return n}function wh(e,t){let n=()=>[...new Set(e.sectionOrder.flatMap(r=>A8(e,r).stepOrder))];switch(t.kind){case"document":return n();case"page":return[...A8(e,t.sectionId).stepOrder];case"step":return I8(e,t.stepId),[t.stepId];case"steps":{if(!t.stepIds.length)throw new Error("document-voice-steps-empty");t.stepIds.forEach(o=>I8(e,o));let r=new Set(t.stepIds);return n().filter(o=>r.has(o))}default:throw new Error("document-voice-scope-invalid")}}function oc(e,t){let{sectionId:n}=I8(e,t),r=e.production,o=[[r.stepOverrides[t]?.voiceSource,"step"],[r.sectionOverrides?.[n]?.voiceSource,"page"],[r.defaults.voiceSource,"document"]];for(let[i,a]of o)if(i!==void 0)return{stepId:t,sectionId:n,value:i,inheritedFrom:a};return{stepId:t,sectionId:n,inheritedFrom:"unset"}}function T8(e,t){if(Object.is(e,t))return!0;if(!e||!t||typeof e!="object"||typeof t!="object"||Array.isArray(e)!==Array.isArray(t))return!1;let n=Object.keys(e),r=Object.keys(t);return n.length===r.length&&n.every(o=>Object.hasOwn(t,o)&&T8(e[o],t[o]))}function TEe(e,t){if(t==null)return;let n=(r,o)=>Object.keys(r).every(i=>o.includes(i));if(typeof t!="object"||Array.isArray(t))throw new Error("document-voice-source-invalid");if(!(t.type==="none"&&n(t,["type"]))){if(t.type==="tts"&&n(t,["type","voice"])){let r=t.voice;if(r&&typeof r=="object"&&!Array.isArray(r)&&n(r,["voice","engine","rate","style"])&&typeof r.voice=="string"&&r.voice.length>0&&(r.engine===void 0||typeof r.engine=="string")&&(r.style===void 0||typeof r.style=="string")&&(r.rate===void 0||typeof r.rate=="number"&&Number.isFinite(r.rate)&&r.rate>0))return}if(t.type==="recording"&&n(t,["type","assetId"])&&typeof t.assetId=="string"){let r=Object.hasOwn(e.assets,t.assetId)&&e.assets[t.assetId];if(!r)throw new Error(`document-voice-asset-missing: ${t.assetId}`);if(r.kind==="audio"||r.kind==="video")return;throw new Error(`document-voice-asset-kind: ${t.assetId}`)}throw new Error("document-voice-source-invalid")}}function MX(e,t,n){return t.kind==="step"?!1:e.production.stepOverrides[n]?.voiceSource!==void 0?!0:t.kind==="document"&&e.production.sectionOverrides?.[e.steps[n].sectionId]?.voiceSource!==void 0}function E8(e,t){if(T8(e?.voiceSource,t??void 0))return e;let n={...e};return t==null?delete n.voiceSource:n.voiceSource=structuredClone(t),Object.keys(n).length?n:void 0}function eS(e,t,n,r={}){let o=wh(e,t);TEe(e,n);let i=e.production,a=i.defaults,s=i.sectionOverrides,l=i.stepOverrides,c=(u,f)=>{let p=E8(l[u],f);p!==l[u]&&(l===i.stepOverrides&&(l={...l}),p?l[u]=p:delete l[u])},d=(u,f)=>{let p=E8(s?.[u],f);p!==s?.[u]&&(s===i.sectionOverrides&&(s={...s}),p?s[u]=p:delete s[u])};if(t.kind==="document")a=E8(a,n)??{},r.replaceOverrides&&(e.sectionOrder.forEach(u=>d(u,void 0)),o.forEach(u=>c(u,void 0)));else if(t.kind==="page")d(t.sectionId,n),r.replaceOverrides&&o.forEach(u=>c(u,void 0));else for(let u of o)(r.replaceOverrides||!MX(e,t,u))&&c(u,n);return a===i.defaults&&s===i.sectionOverrides&&l===i.stepOverrides?e:{...e,production:{...i,defaults:a,...s!==void 0?{sectionOverrides:s}:{},stepOverrides:l}}}function nP(e,t,n,r={}){let o=wh(e,t),i=eS(e,t,n,r),a={total:o.length,updated:0,preserved:0,unchanged:0,overrides:{pages:0,steps:0,none:0,tts:0,recording:0}},s=(l,c)=>{l&&(a.overrides[c]++,a.overrides[l.type]++)};t.kind==="document"&&e.sectionOrder.forEach(l=>s(e.production.sectionOverrides?.[l]?.voiceSource,"pages"));for(let l of o)s(e.production.stepOverrides[l]?.voiceSource,"steps"),!r.replaceOverrides&&MX(e,t,l)?a.preserved++:T8(oc(e,l),oc(i,l))?a.unchanged++:a.updated++;return a}var OX=e=>`var(--pm-color-${e})`,REe={muted:"muted-soft",accent:"accent-soft",ok:"ok-soft",warn:"warn-soft",danger:"danger-soft"},R8=["muted","accent","ok","warn","danger"];function tS(e,t){return OX(t==="text"?e:REe[e])}var DEe={gray:"muted",brown:"warn",red:"danger",orange:"warn",yellow:"warn",green:"ok",blue:"accent",purple:"accent",pink:"danger"},MEe=OX("sunk");function kh(e,t){if(t==="background"&&e===MEe)return tS("muted",t);let n=DEe[e];return n?tS(n,t):e}var rP=32,xh=class extends Error{status;constructor(t,n){super(n),this.status=t}};function NX(e){return e.map(t=>t.type==="text"?t.text:t.type==="pronunciation"?t.display:"").join("")}function $u(e,t){return(e.steps[t]?.narrationIds??[]).map(n=>NX(e.narrations[n]?.content??[])).join(`
|
|
726
|
+
`)}function Vp(e,t){let n=e.steps[t];if(!n)throw new xh(404,"caption-step-missing");let r={...e.production.defaults,...e.production.sectionOverrides?.[n.sectionId],...e.production.stepOverrides[t]};return delete r.captionVisible,X0(JSON.stringify({document:e.id,stepId:t,sectionId:n.sectionId,lang:e.metadata.lang,timing:r,narrations:n.narrationIds.map(o=>({id:o,content:e.narrations[o]?.content,start:e.production.stepOverrides[t]?.narrationStart??e.production.narrationOverrides?.[o]?.narrationStart??r.narrationStart})),pauses:n.narrationIds.flatMap(o=>e.narrations[o]?.content.flatMap(i=>i.type==="cue"?[[i.id,e.production.cueTimings?.[i.id]]]:[])??[])}))}function f1(e,t){if(!t.trim()||!Number.isSafeInteger(e.durationMs)||e.durationMs<=0)return"caption-timing-unavailable";if(!e.segments.length||e.segments.length>rP)return"caption-segment-limit";let n=new Set([0,t.length,...Array.from(new Intl.Segmenter(void 0,{granularity:"grapheme"}).segment(t),a=>a.index)]),r=new Set,o=0,i=0;for(let a of e.segments){if(!a.id||r.has(a.id))return"caption-segment-id-invalid";if(r.add(a.id),!Number.isSafeInteger(a.from)||!Number.isSafeInteger(a.to)||a.from!==o||a.to<=a.from||!n.has(a.from)||!n.has(a.to)||!t.slice(a.from,a.to).trim())return"caption-text-range-invalid";if(!Number.isSafeInteger(a.startMs)||!Number.isSafeInteger(a.endMs)||a.startMs<i||a.endMs<=a.startMs||a.endMs>e.durationMs)return"caption-time-range-invalid";o=a.to,i=a.endMs}return o===t.length?void 0:"caption-text-incomplete"}function p1(e,t){let n=e.steps[t.stepId];if(!n)throw new xh(404,"caption-step-missing");let r=structuredClone(e);if(t.type==="caption.timing.reset")r.production.captionTimings&&delete r.production.captionTimings[t.stepId];else{let o=t.value;if(JSON.stringify(o.narrationIds)!==JSON.stringify(n.narrationIds)||o.sourceFingerprint!==Vp(e,n.id))throw new xh(409,"caption-source-changed");let i=f1(o,$u(e,n.id));if(i)throw new xh(422,i);if(n.narrationIds.some(a=>e.narrations[a]?.content.some(s=>s.type==="cue"&&s.action==="next")))throw new xh(422,"caption-cross-step-unsupported");r.production.captionTimings??={},Object.defineProperty(r.production.captionTimings,n.id,{value:structuredClone(o),configurable:!0,enumerable:!0,writable:!0})}return{content:r,effect:{stepId:n.id,segments:t.type==="caption.timing.set"?t.value.segments.length:0,changed:JSON.stringify(r.production.captionTimings)!==JSON.stringify(e.production.captionTimings),mode:t.type==="caption.timing.set"?"manual":"automatic"}}}function oP(e){let t=e?.captions?.scale;return typeof t=="number"&&t>=.7&&t<=1.6?t:1}function D8(e,t){if(!Number.isFinite(t))throw new Error("document-caption-scale");let n=Math.round(Math.min(1.6,Math.max(.7,t))*10)/10;if(n===oP(e.production))return e;let{captions:r,...o}=e.production;return{...e,production:n===1?o:{...o,captions:{scale:n}}}}var M8={};q6(M8,{JsonPatchError:()=>gi,_areEquals:()=>oS,applyOperation:()=>Q0,applyPatch:()=>uP,applyReducer:()=>BEe,deepClone:()=>FEe,getValueByPointer:()=>cP,validate:()=>LX,validator:()=>dP});var OEe=(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var i in o)o.hasOwnProperty(i)&&(r[i]=o[i])},e(t,n)};return function(t,n){e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}})(),NEe=Object.prototype.hasOwnProperty;function aP(e,t){return NEe.call(e,t)}function sP(e){if(Array.isArray(e)){for(var t=new Array(e.length),n=0;n<t.length;n++)t[n]=""+n;return t}if(Object.keys)return Object.keys(e);var r=[];for(var o in e)aP(e,o)&&r.push(o);return r}function ns(e){switch(typeof e){case"object":return JSON.parse(JSON.stringify(e));case"undefined":return null;default:return e}}function lP(e){for(var t=0,n=e.length,r;t<n;){if(r=e.charCodeAt(t),r>=48&&r<=57){t++;continue}return!1}return!0}function Df(e){return e.indexOf("/")===-1&&e.indexOf("~")===-1?e:e.replace(/~/g,"~0").replace(/\//g,"~1")}function nS(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}function iP(e){if(e===void 0)return!0;if(e){if(Array.isArray(e)){for(var t=0,n=e.length;t<n;t++)if(iP(e[t]))return!0}else if(typeof e=="object"){for(var r=sP(e),o=r.length,i=0;i<o;i++)if(iP(e[r[i]]))return!0}}return!1}function FX(e,t){var n=[e];for(var r in t){var o=typeof t[r]=="object"?JSON.stringify(t[r],null,2):t[r];typeof o<"u"&&n.push(r+": "+o)}return n.join(`
|
|
727
727
|
`)}var rS=(function(e){OEe(t,e);function t(n,r,o,i,a){var s=this.constructor,l=e.call(this,FX(n,{name:r,index:o,operation:i,tree:a}))||this;return l.name=r,l.index=o,l.operation=i,l.tree=a,Object.setPrototypeOf(l,s.prototype),l.message=FX(n,{name:r,index:o,operation:i,tree:a}),l}return t})(Error);var gi=rS,FEe=ns,m1={add:function(e,t,n){return e[t]=this.value,{newDocument:n}},remove:function(e,t,n){var r=e[t];return delete e[t],{newDocument:n,removed:r}},replace:function(e,t,n){var r=e[t];return e[t]=this.value,{newDocument:n,removed:r}},move:function(e,t,n){var r=cP(n,this.path);r&&(r=ns(r));var o=Q0(n,{op:"remove",path:this.from}).removed;return Q0(n,{op:"add",path:this.path,value:o}),{newDocument:n,removed:r}},copy:function(e,t,n){var r=cP(n,this.from);return Q0(n,{op:"add",path:this.path,value:ns(r)}),{newDocument:n}},test:function(e,t,n){return{newDocument:n,test:oS(e[t],this.value)}},_get:function(e,t,n){return this.value=e[t],{newDocument:n}}},LEe={add:function(e,t,n){return lP(t)?e.splice(t,0,this.value):e[t]=this.value,{newDocument:n,index:t}},remove:function(e,t,n){var r=e.splice(t,1);return{newDocument:n,removed:r[0]}},replace:function(e,t,n){var r=e[t];return e[t]=this.value,{newDocument:n,removed:r}},move:m1.move,copy:m1.copy,test:m1.test,_get:m1._get};function cP(e,t){if(t=="")return e;var n={op:"_get",path:t};return Q0(e,n),n.value}function Q0(e,t,n,r,o,i){if(n===void 0&&(n=!1),r===void 0&&(r=!0),o===void 0&&(o=!0),i===void 0&&(i=0),n&&(typeof n=="function"?n(t,0,e,t.path):dP(t,0)),t.path===""){var a={newDocument:e};if(t.op==="add")return a.newDocument=t.value,a;if(t.op==="replace")return a.newDocument=t.value,a.removed=e,a;if(t.op==="move"||t.op==="copy")return a.newDocument=cP(e,t.from),t.op==="move"&&(a.removed=e),a;if(t.op==="test"){if(a.test=oS(e,t.value),a.test===!1)throw new gi("Test operation failed","TEST_OPERATION_FAILED",i,t,e);return a.newDocument=e,a}else{if(t.op==="remove")return a.removed=e,a.newDocument=null,a;if(t.op==="_get")return t.value=e,a;if(n)throw new gi("Operation `op` property is not one of operations defined in RFC-6902","OPERATION_OP_INVALID",i,t,e);return a}}else{r||(e=ns(e));var s=t.path||"",l=s.split("/"),c=e,d=1,u=l.length,f=void 0,p=void 0,m=void 0;for(typeof n=="function"?m=n:m=dP;;){if(p=l[d],p&&p.indexOf("~")!=-1&&(p=nS(p)),o&&(p=="__proto__"||p=="prototype"&&d>0&&l[d-1]=="constructor"))throw new TypeError("JSON-Patch: modifying `__proto__` or `constructor/prototype` prop is banned for security reasons, if this was on purpose, please set `banPrototypeModifications` flag false and pass it to this function. More info in fast-json-patch README");if(n&&f===void 0&&(c[p]===void 0?f=l.slice(0,d).join("/"):d==u-1&&(f=t.path),f!==void 0&&m(t,0,e,f)),d++,Array.isArray(c)){if(p==="-")p=c.length;else{if(n&&!lP(p))throw new gi("Expected an unsigned base-10 integer value, making the new referenced value the array element with the zero-based index","OPERATION_PATH_ILLEGAL_ARRAY_INDEX",i,t,e);lP(p)&&(p=~~p)}if(d>=u){if(n&&t.op==="add"&&p>c.length)throw new gi("The specified index MUST NOT be greater than the number of elements in the array","OPERATION_VALUE_OUT_OF_BOUNDS",i,t,e);var a=LEe[t.op].call(t,c,p,e);if(a.test===!1)throw new gi("Test operation failed","TEST_OPERATION_FAILED",i,t,e);return a}}else if(d>=u){var a=m1[t.op].call(t,c,p,e);if(a.test===!1)throw new gi("Test operation failed","TEST_OPERATION_FAILED",i,t,e);return a}if(c=c[p],n&&d<u&&(!c||typeof c!="object"))throw new gi("Cannot perform operation at the desired path","OPERATION_PATH_UNRESOLVABLE",i,t,e)}}}function uP(e,t,n,r,o){if(r===void 0&&(r=!0),o===void 0&&(o=!0),n&&!Array.isArray(t))throw new gi("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");r||(e=ns(e));for(var i=new Array(t.length),a=0,s=t.length;a<s;a++)i[a]=Q0(e,t[a],n,!0,o,a),e=i[a].newDocument;return i.newDocument=e,i}function BEe(e,t,n){var r=Q0(e,t);if(r.test===!1)throw new gi("Test operation failed","TEST_OPERATION_FAILED",n,t,e);return r.newDocument}function dP(e,t,n,r){if(typeof e!="object"||e===null||Array.isArray(e))throw new gi("Operation is not an object","OPERATION_NOT_AN_OBJECT",t,e,n);if(m1[e.op]){if(typeof e.path!="string")throw new gi("Operation `path` property is not a string","OPERATION_PATH_INVALID",t,e,n);if(e.path.indexOf("/")!==0&&e.path.length>0)throw new gi('Operation `path` property must start with "/"',"OPERATION_PATH_INVALID",t,e,n);if((e.op==="move"||e.op==="copy")&&typeof e.from!="string")throw new gi("Operation `from` property is not present (applicable in `move` and `copy` operations)","OPERATION_FROM_REQUIRED",t,e,n);if((e.op==="add"||e.op==="replace"||e.op==="test")&&e.value===void 0)throw new gi("Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)","OPERATION_VALUE_REQUIRED",t,e,n);if((e.op==="add"||e.op==="replace"||e.op==="test")&&iP(e.value))throw new gi("Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)","OPERATION_VALUE_CANNOT_CONTAIN_UNDEFINED",t,e,n);if(n){if(e.op=="add"){var o=e.path.split("/").length,i=r.split("/").length;if(o!==i+1&&o!==i)throw new gi("Cannot perform an `add` operation at the desired path","OPERATION_PATH_CANNOT_ADD",t,e,n)}else if(e.op==="replace"||e.op==="remove"||e.op==="_get"){if(e.path!==r)throw new gi("Cannot perform the operation at a path that does not exist","OPERATION_PATH_UNRESOLVABLE",t,e,n)}else if(e.op==="move"||e.op==="copy"){var a={op:"_get",path:e.from,value:void 0},s=LX([a],n);if(s&&s.name==="OPERATION_PATH_UNRESOLVABLE")throw new gi("Cannot perform the operation from a path that does not exist","OPERATION_FROM_UNRESOLVABLE",t,e,n)}}}else throw new gi("Operation `op` property is not one of operations defined in RFC-6902","OPERATION_OP_INVALID",t,e,n)}function LX(e,t,n){try{if(!Array.isArray(e))throw new gi("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");if(t)uP(ns(t),ns(e),n||!0);else{n=n||dP;for(var r=0;r<e.length;r++)n(e[r],r,t,void 0)}}catch(o){if(o instanceof gi)return o;throw o}}function oS(e,t){if(e===t)return!0;if(e&&t&&typeof e=="object"&&typeof t=="object"){var n=Array.isArray(e),r=Array.isArray(t),o,i,a;if(n&&r){if(i=e.length,i!=t.length)return!1;for(o=i;o--!==0;)if(!oS(e[o],t[o]))return!1;return!0}if(n!=r)return!1;var s=Object.keys(e);if(i=s.length,i!==Object.keys(t).length)return!1;for(o=i;o--!==0;)if(!t.hasOwnProperty(s[o]))return!1;for(o=i;o--!==0;)if(a=s[o],!oS(e[a],t[a]))return!1;return!0}return e!==e&&t!==t}var L8={};q6(L8,{compare:()=>WEe,generate:()=>O8,observe:()=>UEe,unobserve:()=>qEe});var N8=new WeakMap,$Ee=(function(){function e(t){this.observers=new Map,this.obj=t}return e})(),zEe=(function(){function e(t,n){this.callback=t,this.observer=n}return e})();function jEe(e){return N8.get(e)}function VEe(e,t){return e.observers.get(t)}function HEe(e,t){e.observers.delete(t.callback)}function qEe(e,t){t.unobserve()}function UEe(e,t){var n=[],r,o=jEe(e);if(!o)o=new $Ee(e),N8.set(e,o);else{var i=VEe(o,t);r=i&&i.observer}if(r)return r;if(r={},o.value=ns(e),t){r.callback=t,r.next=null;var a=function(){O8(r)},s=function(){clearTimeout(r.next),r.next=setTimeout(a)};typeof window<"u"&&(window.addEventListener("mouseup",s),window.addEventListener("keyup",s),window.addEventListener("mousedown",s),window.addEventListener("keydown",s),window.addEventListener("change",s))}return r.patches=n,r.object=e,r.unobserve=function(){O8(r),clearTimeout(r.next),HEe(o,r),typeof window<"u"&&(window.removeEventListener("mouseup",s),window.removeEventListener("keyup",s),window.removeEventListener("mousedown",s),window.removeEventListener("keydown",s),window.removeEventListener("change",s))},o.observers.set(t,new zEe(t,r)),r}function O8(e,t){t===void 0&&(t=!1);var n=N8.get(e.object);F8(n.value,e.object,e.patches,"",t),e.patches.length&&uP(n.value,e.patches);var r=e.patches;return r.length>0&&(e.patches=[],e.callback&&e.callback(r)),r}function F8(e,t,n,r,o){if(t!==e){typeof t.toJSON=="function"&&(t=t.toJSON());for(var i=sP(t),a=sP(e),s=!1,l=!1,c=a.length-1;c>=0;c--){var d=a[c],u=e[d];if(aP(t,d)&&!(t[d]===void 0&&u!==void 0&&Array.isArray(t)===!1)){var f=t[d];typeof u=="object"&&u!=null&&typeof f=="object"&&f!=null&&Array.isArray(u)===Array.isArray(f)?F8(u,f,n,r+"/"+Df(d),o):u!==f&&(s=!0,o&&n.push({op:"test",path:r+"/"+Df(d),value:ns(u)}),n.push({op:"replace",path:r+"/"+Df(d),value:ns(f)}))}else Array.isArray(e)===Array.isArray(t)?(o&&n.push({op:"test",path:r+"/"+Df(d),value:ns(u)}),n.push({op:"remove",path:r+"/"+Df(d)}),l=!0):(o&&n.push({op:"test",path:r,value:e}),n.push({op:"replace",path:r,value:t}),s=!0)}if(!(!l&&i.length==a.length))for(var c=0;c<i.length;c++){var d=i[c];!aP(e,d)&&t[d]!==void 0&&n.push({op:"add",path:r+"/"+Df(d),value:ns(t[d])})}}}function WEe(e,t,n){n===void 0&&(n=!1);var r=[];return F8(e,t,r,"",n),r}var BX=Object.assign({},M8,L8,{JsonPatchError:rS,deepClone:ns,escapePathComponent:Df,unescapePathComponent:nS});var fP=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t,t.exports),e=null),t.exports);var B8=class extends RangeError{constructor(t){super(`Maximum copy depth of ${String(t)} exceeded; the value copied is nested too deeply.`),this.maxDepth=t,this.name="MaxDepthExceededError"}},GEe=Function.prototype.toString,KEe=Object.prototype.toString;function zX(e){if(!e)return Object.create(null);let t=e.constructor;if(t===Object)return e===Object.prototype?{}:Object.create(e);if(typeof t=="function"&&~GEe.call(t).indexOf("[native code]"))try{return new t}catch{}return Object.create(e)}function jX(e){let t=e[Symbol.toStringTag];if(t)return t;let n=KEe.call(e);return n.substring(8,n.length-1)}var JEe=Object.getPrototypeOf(Int8Array.prototype).slice;function $X(e,t,n,r){let o=Object.getOwnPropertyDescriptor(e,n)||{configurable:!0,enumerable:!0,value:e[n],writable:!0},i=o.get||o.set?o:{configurable:o.configurable,enumerable:o.enumerable,value:r.copier(o.value,r),writable:o.writable};try{Object.defineProperty(t,n,i)}catch{t[n]=i.get?i.get():i.value}}function Sh(e,t,n,r,o){for(let i=o;i<r.length;++i)$X(e,t,r[i],n);for(let i of Object.getOwnPropertySymbols(e))$X(e,t,i,n);return t}function YEe(e,t){let n=new t.Constructor;t.cache.set(e,n);for(let r=0;r<e.length;++r)n[r]=t.copier(e[r],t);return n}function ZEe(e,t){let n=new t.Constructor;return t.cache.set(e,n),Sh(e,n,t,Object.getOwnPropertyNames(e),0)}function VX(e,t){if(ArrayBuffer.isView(e))return JEe.call(e,0);if(e.resizable||e.growable){let n=e.maxByteLength,r=new t.Constructor(e.byteLength,{maxByteLength:n});return new Uint8Array(r).set(new Uint8Array(e)),r}return!e.byteLength&&jX(e)==="SharedArrayBuffer"?new t.Constructor(0):e.slice(0)}function XEe(e,t){let n=VX(e,t);t.cache.set(e,n);let r=ArrayBuffer.isView(n)&&n.length||0;return Sh(e,n,t,Object.getOwnPropertyNames(e),r)}function HX(e,t){return e.slice(0,e.size,e.type)}var QEe=mP(HX);function eAe(e,t){return new t.Constructor(t.copier(e.buffer,t),e.byteOffset,e.byteLength)}function tAe(e,t){let{buffer:n}=e,{cache:r,Constructor:o}=t,i=r.has(n),a=i?r.get(n):t.copier(n,t);if(!i&&r.has(e))return r.get(e);let s=new o(a,e.byteOffset,e.byteLength);return t.cache.set(e,s),Sh(e,s,t,Object.getOwnPropertyNames(e),0)}function qX(e,t){return new t.Constructor(e.getTime())}var nAe=mP(qX);function UX(e,t){let n=new t.Constructor;t.cache.set(e,n);for(let[r,o]of e)n.set(r,t.copier(o,t));return n}function rAe(e,t){return Sh(e,UX(e,t),t,Object.getOwnPropertyNames(e),0)}function oAe(e,t){let n=zX(t.prototype);t.cache.set(e,n);for(let r of Object.keys(e))r==="__proto__"?Object.defineProperty(n,r,{configurable:!0,enumerable:!0,value:t.copier(e[r],t),writable:!0}):n[r]=t.copier(e[r],t);for(let r of Object.getOwnPropertySymbols(e))Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=t.copier(e[r],t));return n}function iAe(e,t){let n=zX(t.prototype);return t.cache.set(e,n),Sh(e,n,t,Object.getOwnPropertyNames(e),0)}function pP(e,t){return new t.Constructor(e.valueOf())}var aAe=mP(pP);function WX(e,t){let n=new t.Constructor(e.source,e.flags);return n.lastIndex=e.lastIndex,n}var sAe=mP(WX);function h1(e,t){return e}function GX(e,t){let n=new t.Constructor;t.cache.set(e,n);for(let r of e)n.add(t.copier(r,t));return n}function lAe(e,t){return Sh(e,GX(e,t),t,Object.getOwnPropertyNames(e),0)}function mP(e){return(t,n)=>{let r=e(t,n);return n.cache.set(t,r),Sh(t,r,n,Object.getOwnPropertyNames(t),0)}}function cAe(e,t){let n=pP(e,t);t.cache.set(e,n);let{length:r}=e,o=Object.getOwnPropertyNames(e),i=o[r]==="length"?r+1:r;return Sh(e,n,t,o,i)}var dAe=1e3;function uAe(){return new WeakMap}function fAe({createCache:e,maxDepth:t,methods:n,strict:r}){let o={array:r?ZEe:YEe,arrayBuffer:r?XEe:VX,asyncGenerator:h1,blob:r?QEe:HX,dataView:r?tAe:eAe,date:r?nAe:qX,error:h1,generator:h1,map:r?rAe:UX,object:r?iAe:oAe,regExp:r?sAe:WX,set:r?lAe:GX},i=n?Object.assign(o,n):o,a=pAe(i,r),s=e||uAe;if(!a.Object||!a.Array)throw new Error("An object and array copier must be provided.");return{createCache:s,copiers:a,maxDepth:t??dAe,methods:i,strict:!!r}}function pAe(e,t){let n=t?aAe:pP;return Object.assign(Object.create(null),{Arguments:e.object,Array:e.array,ArrayBuffer:e.arrayBuffer,AsyncGenerator:e.asyncGenerator,BigInt64Array:e.arrayBuffer,BigUint64Array:e.arrayBuffer,Blob:e.blob,Boolean:n,DataView:e.dataView,Date:e.date,Error:e.error,Float32Array:e.arrayBuffer,Float64Array:e.arrayBuffer,Generator:e.generator,Int8Array:e.arrayBuffer,Int16Array:e.arrayBuffer,Int32Array:e.arrayBuffer,Map:e.map,Number:n,Object:e.object,Promise:h1,RegExp:e.regExp,Set:e.set,SharedArrayBuffer:e.arrayBuffer,String:t?cAe:pP,WeakMap:h1,WeakSet:h1,Uint8Array:e.arrayBuffer,Uint8ClampedArray:e.arrayBuffer,Uint16Array:e.arrayBuffer,Uint32Array:e.arrayBuffer})}function KX(e={}){let{createCache:t,copiers:n,maxDepth:r}=fAe(e),{Array:o,Object:i}=n;function a(s,l){if(l.prototype=l.Constructor=void 0,!s||typeof s!="object")return s;if(l.cache.has(s))return l.cache.get(s);if(++l.depth>r)throw new B8(r);l.prototype=Object.getPrototypeOf(s),l.Constructor=l.prototype&&l.prototype.constructor;let c;if(!l.Constructor||l.Constructor===Object)c=i(s,l);else if(Array.isArray(s))c=o(s,l);else{let d=n[jX(s)];d?c=d(s,l):c=typeof s.then=="function"?s:i(s,l)}return--l.depth,c}return function(l){return a(l,{Constructor:void 0,cache:t(),copier:a,depth:0,prototype:void 0})}}var Jpt=KX({strict:!0}),g1=KX();function YX(e){return e==="#"||e===""||Array.isArray(e)&&e.length===0||!1}var mAe=/~1/g,hAe=/~0/g,gAe=/(^#?\/?)/g;function ZX(e){return e.replace(mAe,"/").replace(hAe,"~")}function vAe(e){return ZX(decodeURIComponent(e))}function v1(e){if(e==null||typeof e!="string"||YX(e))return Array.isArray(e)?e.slice():[];let t=e.indexOf("#")>=0?vAe:ZX;e=e.replace(gAe,"");let n=e.split("/");for(let r=0,o=n.length;r<o;r+=1)n[r]=t(n[r]);return n}function hP(e,t,n=void 0){if(t==null||e==null)return n;if(YX(t))return e;let r=XX(e,v1(t));return r===void 0?n:r}function XX(e,t){let n=t.shift();if(e!==void 0)return n===void 0?e:e==null?void 0:XX(e[n],t)}var bAe=/~/g,yAe=/\//g;function JX(e,t){if(e.length===0)return t?"#":"";for(let n=0,r=e.length;n<r;n+=1)e[n]=e[n].replace(bAe,"~0").replace(yAe,"~1"),t&&(e[n]=encodeURIComponent(e[n]));return(t?"#/":"/")+e.join("/")}function $8(e,...t){let n=[];if(Array.isArray(e))return JX(e,arguments[1]===!0);let r=arguments[arguments.length-1],o=typeof r=="boolean"?r:e&&e[0]==="#";for(let a=0,s=arguments.length;a<s;a+=1)n.push.apply(n,v1(arguments[a]));let i=[];for(let a=0,s=n.length;a<s;a+=1)if(n[a]===".."){if(i.length===0)return o?"#":"";i.pop()}else i.push(n[a]);return JX(i,o)}var J8=ut(z8(),1),uQ=ut(tQ(),1);function Dd(e,t=[]){if(!Array.isArray(e))return e===void 0?[]:[e];for(let n of e)Array.isArray(n)?Dd(n,t):(LAe(n)||n instanceof Promise)&&t.push(n);return t}var Nh={DECLARATOR_ONEOF:"oneOfProperty",propertyBlacklist:["_id"],DYNAMIC_PROPERTIES:["$ref","$defs","if","then","else","allOf","anyOf","oneOf","dependentSchemas","dependentRequired","definitions","dependencies","patternProperties","propertyDependencies"],REGEX_FLAGS:"u",VALID_ANNOTATION_KEYWORDS:["$id","$schema","title","description","default","oneOfProperty"],PROPERTIES_TO_MERGE:["title","description","default","options","x-options","readOnly","writeOnly"]};function j8(e,t){t!=null&&Object.values(t).forEach(n=>ic(n,e))}function gP(e,t){t?.forEach(n=>ic(n,e))}function ic(e,t=[]){return zo(e)&&(t.push(e),j8(t,e.$defs),e.additionalProperties&&ic(e.additionalProperties,t),gP(t,e.allOf),gP(t,e.anyOf),e.contains&&ic(e.contains,t),j8(t,e.dependentSchemas),e.if&&ic(e.if,t),e.else&&ic(e.else,t),e.then&&ic(e.then,t),e.items&&ic(e.items,t),gP(t,e.prefixItems),e.not&&ic(e.not,t),gP(t,e.oneOf),e.patternProperties&&Object.values(e.patternProperties).forEach(({node:n})=>ic(n,t)),j8(t,e.properties),e.propertyNames&&ic(e.propertyNames,t),e.unevaluatedProperties&&ic(e.unevaluatedProperties,t),e.unevaluatedItems&&ic(e.unevaluatedItems,t)),t}var wAe=Object.prototype.toString;function $i(e){let t=wAe.call(e).slice(8,-1).toLowerCase();return t==="file"?"object":t}function Lt(e){return $i(e)==="object"}var fQ=fP(((e,t)=>{let n=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),r=RegExp.prototype.test.bind(/^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u),o=RegExp.prototype.test.bind(/^\d*$/u),i=RegExp.prototype.test.bind(/^[\da-f]{2}$/iu),a=RegExp.prototype.test.bind(/^[\da-z\-._~]$/iu),s=RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:@/]$/u),l=RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:@/?]$/u),c=RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:]$/u),d=RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=]$/u),u=RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=]*$/u);function f(F){let L="",V=0,Y=0;for(Y=0;Y<F.length;Y++)if(V=F[Y].charCodeAt(0),V!==48){if(!(V>=48&&V<=57||V>=65&&V<=70||V>=97&&V<=102))return"";L+=F[Y];break}for(Y+=1;Y<F.length;Y++){if(V=F[Y].charCodeAt(0),!(V>=48&&V<=57||V>=65&&V<=70||V>=97&&V<=102))return"";L+=F[Y]}return L}let p=RegExp.prototype.test.bind(/^[\dA-Fa-f]{1,4}$/),m=RegExp.prototype.test.bind(/^[vV][\dA-Fa-f]+\.[A-Za-z\d\-._~!$&'()*+,;=:]+$/),h=RegExp.prototype.test.bind(/^[A-Za-z\d\-._~]$/),g=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u),v=RegExp.prototype.test.bind(/[^\d!"$&'()*+,\-.;=_`a-z{}~]/u),b=RegExp.prototype.test.bind(/(?:^|\.)\d+$/u);function y(F){return v(F)||b(F)}function w(F){if(F.length===0)return!1;for(let L=0;L<F.length;L++)if(!h(F[L]))if(F[L]==="%"&&L+2<F.length&&i(F.slice(L+1,L+3)))L+=2;else return!1;return!0}function S(F){let L=-1,V=0,Y=-1,te=0;for(let ue=0;ue<F.length;ue++)F[ue]==="0"?(Y===-1&&(Y=ue),te++,te>V&&(V=te,L=Y)):(Y=-1,te=0);if(V<2)return F.join(":");let ee=F.slice(0,L).join(":"),X=F.slice(L+V).join(":");return ee+"::"+X}function x(F){let L=F.indexOf("::");if(L!==-1&&F.indexOf("::",L+1)!==-1)return;let V=L===-1?F.split(":"):F.slice(0,L).split(":"),Y=L===-1?[]:F.slice(L+2).split(":");L!==-1&&(V.length===1&&V[0]===""&&(V.length=0),Y.length===1&&Y[0]===""&&(Y.length=0));let te=V.concat(Y),ee=0;for(let ue=0;ue<te.length;ue++){let fe=te[ue];if(fe==="")return;if(fe.indexOf(".")!==-1){if(ue!==te.length-1||L!==-1&&Y.length===0||!r(fe))return;ee+=2}else{if(!p(fe))return;te[ue]=parseInt(fe,16).toString(16),ee++}}if(L===-1)return ee===8?S(te):void 0;if(ee>=8)return;let X=te.slice(0,V.length);for(let ue=ee;ue<8;ue++)X.push("0");for(let ue=V.length;ue<te.length;ue++)X.push(te[ue]);return S(X)}function k(F){let L=F[0]==="["&&F[F.length-1]==="]";if((F[0]==="["||F[F.length-1]==="]")&&!L)return{host:F,isIPV6:!1,error:!0};let V=L?F.slice(1,-1):F;if(L&&m(V))return V=V.toLowerCase(),{host:`[${V}]`,escapedHost:V,isIPV6:!1,isIPVFuture:!0};if(C(V,":")<2)return{host:F,isIPV6:!1,error:L};let Y="",te=V.indexOf("%");if(te!==-1){let X=V.slice(te,te+3).toLowerCase()==="%25"?3:1;if(Y=V.slice(te+X),!w(Y))return{host:F,isIPV6:!1,error:!0};V=V.slice(0,te)}let ee=x(V);return ee===void 0?{host:F,isIPV6:!1,error:!0}:{host:ee+(Y?"%"+Y:""),escapedHost:ee+(Y?"%25"+Y:""),isIPV6:!0}}function C(F,L){let V=0;for(let Y=0;Y<F.length;Y++)F[Y]===L&&V++;return V}function E(F){let L=F,V=[],Y=-1,te=0;for(;te=L.length;){if(te===1){if(L===".")break;if(L==="/"){V.push("/");break}V.push(L);break}if(te===2){if(L[0]==="."){if(L[1]===".")break;if(L[1]==="/"){L=L.slice(2);continue}}else if(L[0]==="/"&&L[1]==="."){V.push("/");break}}else if(te===3&&L==="/.."){V.length!==0&&V.pop(),V.push("/");break}if(L[0]==="."){if(L[1]==="."){if(L[2]==="/"){L=L.slice(3);continue}}else if(L[1]==="/"){L=L.slice(2);continue}}else if(L[0]==="/"&&L[1]==="."){if(L[2]==="/"){L=L.slice(2);continue}if(L[2]==="."&&L[3]==="/"){L=L.slice(3),V.length!==0&&V.pop();continue}}if((Y=L.indexOf("/",1))===-1){V.push(L);break}V.push(L.slice(0,Y)),L=L.slice(Y)}return V.join("")}let P={"@":"%40","/":"%2F","?":"%3F","#":"%23"},I=/[@/?#]/g;function T(F,L,V=!1){return L?(I.lastIndex=0,F.replace(I,Y=>P[Y])):u(F)?F:j(F,d,V)}function _(F,L=!1){if(F.indexOf("%")===-1)return F;let V="";for(let Y=0;Y<F.length;Y++){if(F[Y]==="%"&&Y+2<F.length){let te=F.slice(Y+1,Y+3);if(i(te)){let ee=te.toUpperCase(),X=String.fromCharCode(parseInt(ee,16));L&&a(X)?V+=X:V+="%"+ee,Y+=2;continue}}V+=F[Y]}return V}let A=Array(256);{let F="0123456789ABCDEF";for(let L=0;L<256;L++)A[L]="%"+F[L>>4]+F[L&15]}function D(F){return F>=48&&F<=57||F>=65&&F<=90||F>=97&&F<=122||F===42||F===43||F===45||F===46||F===47||F===64||F===95}function N(F){return F<2048?A[192|F>>6]+A[128|F&63]:F<65536?A[224|F>>12]+A[128|F>>6&63]+A[128|F&63]:A[240|F>>18]+A[128|F>>12&63]+A[128|F>>6&63]+A[128|F&63]}function O(F){let L="";for(let V=0;V<F.length;V++){let Y=F[V];if(Y==="%"&&V+2<F.length){let te=F.slice(V+1,V+3);if(i(te)){let ee=te.toUpperCase(),X=String.fromCharCode(parseInt(ee,16));X!=="."&&a(X)?L+=X:L+="%"+ee,V+=2;continue}}if(s(Y))L+=Y;else{let te=F.charCodeAt(V);if(te<128)L+=D(te)?Y:A[te];else if(te<55296||te>57343)L+=N(te);else if(te<=56319&&V+1<F.length){let ee=F.charCodeAt(V+1);ee>=56320&&ee<=57343?(L+=N(65536+(te-55296<<10)+(ee-56320)),V++):L+=N(65533)}else L+=N(65533)}}return L}function M(F,L=!1){let V="",Y=L&&F[0]!=="/";for(let te=0;te<F.length;te++){let ee=F[te];if(ee==="%"&&te+2<F.length){let X=F.slice(te+1,te+3);if(i(X)){V+="%"+X.toUpperCase(),te+=2;continue}}if(ee==="/"&&(Y=!1),s(ee)&&(ee!==":"||!Y))V+=ee;else{let X=F.charCodeAt(te);if(X<128)V+=A[X];else if(X<55296||X>57343)V+=N(X);else if(X<=56319&&te+1<F.length){let ue=F.charCodeAt(te+1);ue>=56320&&ue<=57343?(V+=N(65536+(X-55296<<10)+(ue-56320)),te++):V+=N(65533)}else V+=N(65533)}}return V}function $(F){let L="";for(let V=0;V<F.length;V++){let Y=F[V];if(Y==="%"&&V+2<F.length){let te=F.slice(V+1,V+3);if(i(te)){let ee=te.toUpperCase(),X=String.fromCharCode(parseInt(ee,16));a(X)?L+=X:L+="%"+ee,V+=2;continue}}if(l(Y))L+=Y;else{let te=F.charCodeAt(V);if(te<128)L+=D(te)?Y:A[te];else if(te<55296||te>57343)L+=N(te);else if(te<=56319&&V+1<F.length){let ee=F.charCodeAt(V+1);ee>=56320&&ee<=57343?(L+=N(65536+(te-55296<<10)+(ee-56320)),V++):L+=N(65533)}else L+=N(65533)}}return L}function j(F,L,V=!1){let Y="";for(let te=0;te<F.length;te++){let ee=F[te];if(ee==="%"&&te+2<F.length){let X=F.slice(te+1,te+3);if(i(X)){Y+="%"+X.toUpperCase(),te+=2;continue}}if(L(ee))Y+=ee;else{let X=F.charCodeAt(te);if(X<128)Y+=A[X];else if(X<55296||X>57343)Y+=V?ee:N(X);else if(X<=56319&&te+1<F.length){let ue=F.charCodeAt(te+1);ue>=56320&&ue<=57343?(Y+=V?ee+F[te+1]:N(65536+(X-55296<<10)+(ue-56320)),te++):Y+=V?"\uFFFD":N(65533)}else Y+=V?"\uFFFD":N(65533)}}return Y}function W(F){return j(F,c)}function K(F){return j(F,l)}function z(F){return j(F,l)}function G(F){let L="";for(let V=0;V<F.length;V++){let Y=F[V];if(Y==="%"&&V+2<F.length){let ee=F.slice(V+1,V+3);if(i(ee)){L+="%"+ee.toUpperCase(),V+=2;continue}}let te=F.charCodeAt(V);if(te<128)L+=D(te)?Y:A[te];else if(te<55296||te>57343)L+=N(te);else if(te<=56319&&V+1<F.length){let ee=F.charCodeAt(V+1);ee>=56320&&ee<=57343?(L+=N(65536+(te-55296<<10)+(ee-56320)),V++):L+=N(65533)}else L+=N(65533)}return L}function U(F){let L=F.ipv6Zone;if(L===void 0)return;let V=F.host,Y=V.indexOf("%");if(Y===-1)return;let te=V.slice(0,Y)+"%25"+L,ee=k("["+te+"]");if(ee.isIPV6===!0&&ee.host===V)return"["+te+"]"}function H(F,L=!1){let V=[];if(F.userinfo!==void 0&&(V.push(W(F.userinfo)),V.push("@")),F.host!==void 0){let Y=F.host;if(!r(Y)){let te=U(F);if(te!==void 0)Y=te;else{let ee=k(Y);ee.isIPV6!==!0&&ee.isIPVFuture!==!0&&(Y=_(Y,!0),ee=k(Y)),Y=ee.isIPV6===!0||ee.isIPVFuture===!0?`[${ee.escapedHost}]`:T(Y,!1,L)}}V.push(Y)}if(typeof F.port=="number"||typeof F.port=="string"){let Y=String(F.port);if(!o(Y))throw TypeError("URI port is malformed.");V.push(":"),V.push(Y)}return V.length?V.join(""):void 0}t.exports={BYTE_HEX:A,percentEncodeNonAscii:N,nonSimpleDomain:g,nonSimpleMailtoDomain:y,recomposeAuthority:H,encodeHost:T,normalizePercentEncoding:_,normalizePathEncoding:O,serializePathEncoding:M,normalizeQueryFragmentEncoding:$,encodeUserinfo:W,encodeQuery:K,encodeFragment:z,escapePreservingEscapes:G,removeDotSegments:E,isIPv4:r,isUUID:n,normalizeIPv6:k,stringArrayToHexStripped:f}})),kAe=fP(((e,t)=>{let{isUUID:n,BYTE_HEX:r,percentEncodeNonAscii:o,nonSimpleMailtoDomain:i}=fQ(),a=/^([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-./:;=@]|%[\da-f]{2})+)$/iu,s=["http","https","ws","wss","urn","urn:uuid","mailto"];function l(L){return s.indexOf(L)!==-1}function c(L){return L.secure===!0?!0:L.secure===!1?!1:L.scheme?L.scheme.length===3&&(L.scheme[0]==="w"||L.scheme[0]==="W")&&(L.scheme[1]==="s"||L.scheme[1]==="S")&&(L.scheme[2]==="s"||L.scheme[2]==="S"):!1}function d(L){return L.host||(L.error=L.error||"HTTP URIs must have a host."),L}function u(L){let V=String(L.scheme).toLowerCase()==="https";return(L.port===(V?443:80)||L.port==="")&&(L.port=void 0),L.path||="/",L}function f(L){return L.secure=c(L),L.resourceName=(L.path||"/")+(L.query?"?"+L.query:""),L.path=void 0,L.query=void 0,L}function p(L){if((L.port===(c(L)?443:80)||L.port==="")&&(L.port=void 0),typeof L.secure=="boolean"&&(L.scheme=L.secure?"wss":"ws",L.secure=void 0),L.resourceName){let V=L.resourceName.indexOf("?"),Y=V===-1?L.resourceName:L.resourceName.slice(0,V);L.path=Y&&Y!=="/"?Y:void 0,L.query=V===-1?void 0:L.resourceName.slice(V+1),L.resourceName=void 0}return L.fragment=void 0,L}function m(L,V){if(!L.path)return L.error="URN can not be parsed",L;let Y=L.path.match(a);if(Y&&Y[0]===L.path){let te=V.scheme||L.scheme||"urn";L.nid=Y[1].toLowerCase(),L.nss=Y[2];let ee=F(`${te}:${V.nid||L.nid}`);L.path=void 0,ee&&(L=ee.parse(L,V))}else L.error=L.error||"URN can not be parsed.";return L}function h(L,V){if(L.nid===void 0)throw Error("URN without nid cannot be serialized");let Y=V.scheme||L.scheme||"urn",te=L.nid.toLowerCase(),ee=F(`${Y}:${V.nid||te}`);ee&&(L=ee.serialize(L,V));let X=L,ue=L.nss;return X.path=`${te||V.nid}:${ue}`,V.skipEscape=!0,X}function g(L,V){let Y=L;return Y.uuid=Y.nss,Y.nss=void 0,!V.tolerant&&(!Y.uuid||!n(Y.uuid))&&(Y.error=Y.error||"UUID is not valid."),Y}function v(L){let V=L;return V.nss=(L.uuid||"").toLowerCase(),V}let b={scheme:"http",domainHost:!0,parse:d,serialize:u},y={scheme:"https",domainHost:b.domainHost,parse:d,serialize:u},w={scheme:"ws",domainHost:!0,parse:f,serialize:p},S={scheme:"wss",domainHost:w.domainHost,parse:w.parse,serialize:w.serialize},x={scheme:"urn",parse:m,serialize:h,skipNormalize:!0,absolutePath:!0},k={scheme:"urn:uuid",parse:g,serialize:v,skipNormalize:!0},C="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~!$'()*+;:";function E(L,V=!1){let Y=new Uint8Array(128);for(let X=0;X<L.length;X++)Y[L.charCodeAt(X)]=1;let te=L.replace(/[\\\]^-]/gu,"\\$&"),ee=V?`[${te}]|[^\\0-\\x7F\\uD800-\\uDFFF]`:`[${te}]`;return{all:RegExp(`^(?:${ee})*$`,"u"),table:Y,allowNonAscii:V}}let P=E("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~!$'()*+="),I=E("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~!$'()*+,;:@"),T=E(C),_=E(C,!0),A=/^[\da-f]{2}$/iu,D=/^\[[\x21-\x5A\x5E-\x7E]*\]$/u,N="URI mailto has an invalid recipient domain.",O=/[\uD800-\uDFFF]/u;function M(L){if(typeof L!="string"||L.indexOf("%")===-1)return L;try{return decodeURIComponent(L)}catch{return L}}function $(L){let V="";for(let Y=0;Y<L.length;Y++){let te=L.charCodeAt(Y);if(te>=55296&&te<=56319&&Y+1<L.length){let ee=L.charCodeAt(Y+1);if(ee>=56320&&ee<=57343){V+=L[Y]+L[Y+1],Y++;continue}}V+=te>=55296&&te<=57343?"\uFFFD":L[Y]}return V}function j(L,V){if(V.all.test(L))return L;let Y=V.table,te="";for(let ee=0;ee<L.length;ee++){let X=L.charCodeAt(ee);if(X<128)Y[X]===1?te+=L[ee]:X===37&&ee+2<L.length&&A.test(L.slice(ee+1,ee+3))?(te+="%"+L.slice(ee+1,ee+3).toUpperCase(),ee+=2):te+=r[X];else if(X<55296||X>57343)te+=V.allowNonAscii?L[ee]:o(X);else{if(X<=56319&&ee+1<L.length){let ue=L.charCodeAt(ee+1);if(ue>=56320&&ue<=57343){te+=V.allowNonAscii?L[ee]+L[ee+1]:o(65536+(X-55296<<10)+(ue-56320)),ee++;continue}}te+=V.allowNonAscii?"\uFFFD":o(65533)}}return te}function W(L,V,Y){let te=String(L).toLowerCase();if(D.test(te)||te!==""&&!i(te))return te;try{let ee=new URL("http://"+te);if(ee.username||ee.password||ee.port||ee.pathname!=="/"||ee.search||ee.hash||!ee.hostname)throw Error(N);return V&&V.unicodeSupport?te:ee.hostname}catch{return Y&&(Y.error=Y.error||N),te}}function K(L,V){let Y=V&&V.unicodeSupport?_:T;return L.length>1&&L[0]==="["&&L[L.length-1]==="]"?"["+j(L.slice(1,-1),Y)+"]":j(L,Y)}function z(L,V){let Y=L,te=Y.path,ee=Y.query;te&&O.test(te)&&(te=$(te)),ee&&O.test(ee)&&(ee=$(ee));let X=te?te.indexOf(",")===-1?[te]:te.split(","):[];if(Y.path=void 0,ee){let ue=null,fe=0;for(;fe<=ee.length;){let Z=ee.indexOf("&",fe);Z===-1&&(Z=ee.length);let ce=ee.slice(fe,Z);fe=Z+1;let ye=ce.indexOf("=");if(ye!==ce.lastIndexOf("=")){Y.error=Y.error||"URI mailto has malformed header fields.";continue}let ae=M(ye===-1?ce:ce.slice(0,ye)),ne=ae.toLowerCase(),re=ye===-1?"":ce.slice(ye+1);if(ne==="to"){let se=re.split(",");for(let de=0;de<se.length;de++)X.push(se[de])}else ne==="subject"?Y.subject=M(re):ne==="body"?Y.body=M(re):(ue===null&&(ue=Object.create(null)),ue[ae]=M(re))}ue!==null&&(Y.headers=ue)}Y.query=void 0,X.length>0&&(Y.userinfo!==void 0||Y.host!==void 0||Y.port!==void 0)&&(Y.userinfo=void 0,Y.host=void 0,Y.port=void 0,Y.error=Y.error||"URI mailto must not have an authority component.");for(let ue=0;ue<X.length;ue++){let fe=X[ue],Z=fe.lastIndexOf("@");if(Z<0){Y.error=Y.error||N,X[ue]=M(fe);continue}let ce=M(fe.slice(0,Z)),ye=W(M(fe.slice(Z+1)),V,Y);X[ue]=ce+"@"+ye}return X.length&&(Y.to=X),Y}function G(L){return j(L.replace(/%/gu,"%25"),I)}function U(L,V){let Y=L,te=Array.isArray(Y.to)?Y.to.slice():[],ee=Y.headers&&typeof Y.headers=="object"?Object.assign(Object.create(null),Y.headers):Object.create(null),X=Object.create(null);for(let Z in ee){let ce=Z.toLowerCase();if(ce==="to"){let ye=String(ee[Z]).split(",");for(let ae=0;ae<ye.length;ae++)te.push(ye[ae])}else ce==="subject"||ce==="body"?X[ce]=ee[Z]:X[Z]=ee[Z]}if(Y.subject!==void 0&&(X.subject=Y.subject),Y.body!==void 0&&(X.body=Y.body),Y.headers=X,te.length){Y.userinfo=void 0,Y.host=void 0,Y.port=void 0;for(let Z=0;Z<te.length;Z++){let ce=String(te[Z]),ye=ce.lastIndexOf("@"),ae=ye>=0?ce.slice(0,ye):ce,ne=ye>=0?ce.slice(ye+1):"",re=j(ae,P),se=W(M(ne),V);te[Z]=re+"@"+K(se,V)}Y.path=te.join(","),V.skipEscape=!0}else Y.path=void 0;let ue="",fe=0;for(let Z in X)fe++!==0&&(ue+="&"),ue+=G(Z)+"="+j(String(X[Z]),I);return fe===0?Y.headers=void 0:Y.query=ue,Y}let H={http:b,https:y,ws:w,wss:S,urn:x,"urn:uuid":k,mailto:{scheme:"mailto",parse:z,serialize:U,domainHost:!1,unicodeSupport:!0,skipNormalize:!0,absolutePath:!0}};Object.setPrototypeOf(H,null);function F(L){return L&&(H[L]||H[L.toLowerCase()])||void 0}t.exports={wsIsSecure:c,SCHEMES:H,isValidSchemeName:l,getSchemeHandler:F}})),xAe=fP(((e,t)=>{let{normalizeIPv6:n,removeDotSegments:r,recomposeAuthority:o,normalizePercentEncoding:i,normalizePathEncoding:a,serializePathEncoding:s,normalizeQueryFragmentEncoding:l,encodeQuery:c,encodeFragment:d,encodeHost:u,isIPv4:f,nonSimpleDomain:p}=fQ(),{SCHEMES:m,getSchemeHandler:h}=kAe(),g=/^[A-Za-z][A-Za-z0-9+.-]*$/u,v="URI scheme is malformed.";function b(z){let G=unescape(String(z));if(!g.test(G))throw TypeError(v);return G}function y(z,G){return typeof z=="string"?z=$(z,G):typeof z=="object"&&(z=M(C(z,G),G)),z}function w(z,G,U){let H=U?Object.assign({scheme:"null"},U):{scheme:"null"},{parsed:F,malformedAuthorityOrPort:L,malformedReferenceEdge:V,malformedPercentEncoding:Y,malformedSchemeSpecific:te,malformedHost:ee,malformedScheme:X}=O(z,H),{parsed:ue,malformedAuthorityOrPort:fe,malformedReferenceEdge:Z,malformedPercentEncoding:ce,malformedSchemeSpecific:ye,malformedHost:ae,malformedScheme:ne}=O(G,H);if(L||fe||V||Z||Y||ce||te||ye||ee||ae||X||ne)throw Error(F.error||ue.error||"URI is malformed.");let re=x(F,ue,H,!0),se=h(U&&U.scheme||re.scheme),de=re.host;if((re.scheme==="http"||re.scheme==="https")&&!de)throw Error("HTTP URIs must have a host.");let we=de!==void 0&&de!==""&&(f(de)||n(de).isIPV6);N(re,U||{},se,we);let ke=de&&de.indexOf("%")!==-1&&!/\P{ASCII}/u.test(de);if(re.error&&!ke)throw Error(re.error);return H.skipEscape=!0,se&&se.absolutePath&&(H.absolutePath=!0),C(re,H)}function S(z,G){z.host=G.host,G.ipv6Zone!==void 0&&(z.ipv6Zone=G.ipv6Zone)}function x(z,G,U,H){let F={};if(H||(z=M(C(z,U),U),G=M(C(G,U),U)),U||={},!U.tolerant&&G.scheme){F.scheme=G.scheme,F.userinfo=G.userinfo,S(F,G),F.port=G.port;let L=h(G.scheme);F.path=L&&L.absolutePath?G.path||"":r(G.path||""),F.query=G.query}else G.userinfo!==void 0||G.host!==void 0||G.port!==void 0?(F.userinfo=G.userinfo,S(F,G),F.port=G.port,F.path=r(G.path||""),F.query=G.query):(G.path?(G.path[0]==="/"?F.path=r(G.path):(F.path=(z.userinfo!==void 0||z.host!==void 0||z.port!==void 0)&&!z.path?"/"+G.path:z.path?z.path.slice(0,z.path.lastIndexOf("/")+1)+G.path:G.path,F.path=r(F.path)),F.query=G.query):(F.path=z.path,F.query=G.query===void 0?z.query:G.query),F.userinfo=z.userinfo,S(F,z),F.port=z.port),F.scheme=z.scheme;return F.fragment=G.fragment,F}function k(z,G,U){let H=W(z,U),F=W(G,U);return H!==void 0&&F!==void 0&&H===F}function C(z,G){let U={host:z.host,ipv6Zone:z.ipv6Zone,scheme:z.scheme,userinfo:z.userinfo,port:z.port,path:z.path,query:z.query,nid:z.nid,nss:z.nss,uuid:z.uuid,fragment:z.fragment,reference:z.reference,resourceName:z.resourceName,secure:z.secure,to:z.to,subject:z.subject,body:z.body,headers:z.headers,error:""},H=Object.assign({},G),F=[];U.scheme&&=b(U.scheme);let L=h(H.scheme||U.scheme);L&&L.serialize&&L.serialize(U,H);let V=U.userinfo!==void 0||U.host!==void 0||U.port!==void 0,Y=!H.skipEscape&&U.scheme===void 0&&!V;U.path!==void 0&&(U.path=H.skipEscape?i(U.path):s(U.path,Y)),H.reference!=="suffix"&&U.scheme&&(U.scheme=b(U.scheme),F.push(U.scheme,":"));let te=H.unicodeSupport===!0||!!(L&&L.unicodeSupport),ee=o(U,te);if(ee!==void 0&&(H.reference!=="suffix"&&F.push("//"),F.push(ee),U.path&&U.path[0]!=="/"&&F.push("/")),U.path!==void 0){let X=U.path;!H.absolutePath&&(!L||!L.absolutePath)&&(X=r(X)),Y&&(X=s(X,!0)),ee===void 0&&X[0]==="/"&&X[1]==="/"&&(X="/%2F"+X.slice(2)),F.push(X)}return U.query!==void 0&&F.push("?",c(U.query)),U.fragment!==void 0&&F.push("#",d(U.fragment)),F.join("")}let E=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u,P=/^(?:[^#/:?]+:)?\/\/([^/?#]*)/,I=/^(?:[^#/:?]+:)?([/\\\t\n\r]*)/;function T(z,G){if(G[2]!==void 0&&z.path&&z.path[0]!=="/")return'URI path must start with "/" when authority is present.';if(typeof z.port=="number"&&(z.port<0||z.port>65535))return"URI port is malformed."}function _(z){if(z===void 0)return!1;let G=z.indexOf("%");for(;G!==-1;){if(G+2>=z.length||!/^[\da-f]{2}$/iu.test(z.slice(G+1,G+3)))return!0;G=z.indexOf("%",G+3)}return!1}function A(z){return z[0]==="["&&z[z.length-1]==="]"}function D(z){let G=z[4];return _(z[3])||G!==void 0&&!A(G)&&_(G)||_(z[6])||_(z[7])||_(z[8])}function N(z,G,U,H){let F=z.host&&z.host[0]==="["&&z.host[z.host.length-1]==="]";if(!G.unicodeSupport&&(!U||!U.unicodeSupport)&&z.host&&!A(z.host)&&(G.domainHost||U&&U.domainHost)&&H===!1&&!F&&p(z.host))try{z.host=new URL("http://"+z.host).hostname}catch(L){return z.error=z.error||"Host's domain name can not be converted to ASCII: "+L,!0}return!1}function O(z,G){let U=Object.assign({},G),H={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0},F=!1,L=z.length!==0&&(z.charCodeAt(0)<=32||z.charCodeAt(z.length-1)<=32),V=!1,Y=!1,te=!1,ee=!1,X=!1,ue=!1;U.reference==="suffix"&&(z=U.scheme?U.scheme+":"+z:"//"+z);let fe=z.match(P);fe!==null&&fe[1].indexOf("\\")!==-1&&(H.error="URI authority must not contain a literal backslash.",F=!0);let Z=z.match(I);if(Z!==null){let ye=Z[1],ae=ye.replace(/[\t\n\r]/g,"");ae.length>=2&&(ae.slice(0,2)==="//"?ye.length!==ae.length&&(H.error=H.error||"URI authority introducer must not contain whitespace.",F=!0):(H.error=H.error||"URI authority must not contain a literal backslash.",F=!0))}L&&(H.error=H.error||"URI must not contain leading or trailing C0 controls or spaces.");let ce=z.match(E);if(ce){if(H.scheme=ce[1],H.userinfo=ce[3],H.host=ce[4],H.port=parseInt(ce[5],10),H.path=ce[6]||"",H.query=ce[7],H.fragment=ce[8],H.scheme!==void 0){let ne=unescape(H.scheme);g.test(ne)?H.scheme=ne.toLowerCase():(H.error=H.error||v,X=!0)}V=D(ce),V&&(H.error=H.error||"URI contains malformed percent-encoding."),isNaN(H.port)&&(H.port=ce[5]);let ye=T(H,ce);if(ye!==void 0&&(H.error=H.error||ye,F=!0),H.host)if(f(H.host)===!1){let ne=A(H.host),re=H.host.indexOf("[")!==-1||H.host.indexOf("]")!==-1,se=n(H.host);ue=se.isIPV6||se.isIPVFuture===!0,ee=re&&(!ne||se.error===!0),H.host=ue?se.host:se.host.toLowerCase(),ue&&se.isIPV6===!0&&H.host.indexOf("%")!==-1&&(H.ipv6Zone=H.host.slice(H.host.indexOf("%")+1)),ee&&(H.error=H.error||"URI host is malformed.",F=!0)}else ue=!0;H.reference=H.scheme===void 0&&H.userinfo===void 0&&H.host===void 0&&H.port===void 0&&H.query===void 0&&!H.path?"same-document":H.scheme===void 0?"relative":H.fragment===void 0?"absolute":"uri",U.reference&&U.reference!=="suffix"&&U.reference!==H.reference&&(H.error=H.error||"URI is not a "+U.reference+" reference.");let ae=h(U.scheme||H.scheme);if(ee||(te=N(H,U,ae,ue)),H.host!==void 0&&!ee){let ne=H.host;if(z.indexOf("%")!==-1&&!ue&&(ne=i(ne,!0),ne=i(ne.toLowerCase())),U.scheme!=="null"){let re=U.unicodeSupport===!0||!!(ae&&ae.unicodeSupport);H.host=u(ne,ue,re)}else H.host=ne}(!ae||ae&&!ae.skipNormalize)&&(H.path&&=a(H.path),H.query&&=l(H.query),H.fragment&&=l(H.fragment)),ae&&ae.parse&&(ae.parse(H,U),ae===m.urn&&H.nid===void 0&&(Y=!0))}else H.error=H.error||"URI can not be parsed.";return{parsed:H,malformedAuthorityOrPort:F,malformedReferenceEdge:L,malformedPercentEncoding:V,malformedSchemeSpecific:Y,malformedHost:te,malformedScheme:X}}function M(z,G){return O(z,G).parsed}function $(z,G){return j(z,G).normalized}function j(z,G){let{parsed:U,malformedAuthorityOrPort:H,malformedReferenceEdge:F,malformedPercentEncoding:L,malformedSchemeSpecific:V,malformedHost:Y,malformedScheme:te}=O(z,G);return{normalized:H||F||L||V||Y||te?z:C(U,G),malformedAuthorityOrPort:H,malformedReferenceEdge:F,malformedPercentEncoding:L,malformedSchemeSpecific:V,malformedHost:Y,malformedScheme:te}}function W(z,G){if(typeof z!="string"&&typeof z!="object")return;let U;try{U=typeof z=="string"?z:C(z,G)}catch{return}let{normalized:H,malformedAuthorityOrPort:F,malformedReferenceEdge:L,malformedPercentEncoding:V,malformedSchemeSpecific:Y,malformedHost:te,malformedScheme:ee}=j(U,G);return F||L||V||Y||te||ee?void 0:H}let K={SCHEMES:m,normalize:y,resolve:w,resolveComponent:x,equal:k,serialize:C,parse:M};t.exports=K,t.exports.default=K,t.exports.fastUri=K}))(),SAe=/(#)+$/,V8=/#$/,CAe=/^[^:]+:\/\/[^/]+\//,_Ae=/#.*$/;function Ao(e,t){return t==null?e?.replace(V8,"")??"#":e==null||e==="#"?t?.replace(V8,""):t[0]==="#"?e[0]==="/"?t:`${e.replace(_Ae,"")}${t.replace(SAe,"")}`:CAe.test(t)?t.replace(V8,""):(0,xAe.resolve)(e,t??"")??"#"}var PAe=Object.prototype.hasOwnProperty,cv=(e,t)=>!(e[t]===void 0||!PAe.call(e,t));function nr(e,t){if(Lt(e)&&cv(e,`${t}`)||Array.isArray(e))return e[t]}function Hu(e,t,...n){if(t?.type==="error")return t;if(e?.type==="error"||$i(e)!==$i(t))return e;let r=bP(e,t);for(let o of n)delete r[o];return r}function bP(e,t,n){if(Lt(e)&&Lt(t)){let i={...e,...t};return[...Object.keys(e),...Object.keys(t)].filter((a,s,l)=>l.indexOf(a)===s).forEach(a=>i[a]=bP(nr(e,a),nr(t,a),a)),i}let r=Array.isArray(e),o=Array.isArray(t);if(r&&o){if(n==="required"||n==="anyOf")return e.concat(t).filter((s,l,c)=>c.indexOf(s)===l);if(n==="items"||n==="prefixItems"){let s=[];for(let l=0;l<t.length;l+=1)Lt(e[l])&&Lt(t[l])&&e[l].type===t[l].type?s[l]=bP(e[l],t[l]):s.push(t[l]??e[l]);return s}let i=[],a=[];for(let s=0;s<Math.max(e.length,t.length);s+=1)Lt(e[s])&&Lt(t[s])?i[s]=bP(e[s],t[s]):e[s]!==void 0&&t[s]!==void 0?(i[s]=e[s],a.push(t[s])):e[s]===void 0?t[s]!==void 0&&a.push(t[s]):i[s]=e[s];return[...i,...a].filter((s,l,c)=>c.indexOf(s)===l)}if(n==="type"&&(r||o)){if(r&&e.includes(t))return t;if(o&&t.includes(e))return e;if(r)return[...e,t];if(o)return[...t,e]}return o?t:r||t===void 0?e:t}function H8(e,t){return(t.order??0)-(e.order??0)}function q8(e,t,n){if(e==null||n.indexOf(e)!==t)return!1;let r=e.toJSON?.()??e.name;return n.find((o,i)=>(o.toJSON?.()??o.name)===r&&i===t)}function nQ(e,t){if(e==null||t==null)return t||e;let n=Object.create(null);return[...Object.keys(e),...Object.keys(t)].filter((r,o,i)=>i.indexOf(r)===o).forEach(r=>{let o=ta(nr(e,r),nr(t,r));zo(o)&&(n[r]=o)}),n}function rQ(e,t){return e==null||t==null?t||e:e.concat(t).filter((n,r,o)=>o.indexOf(n)===r)}function EAe(e,t){if(e==null||t==null)return e||t;let n=[...e],r=e.map(o=>o.node.evaluationPath);return t.forEach(o=>{r.includes(o.node.evaluationPath)||n.push(o)}),n}function ta(e,t,...n){if(e==null||t==null)return e||t;let r={};e.items&&t.prefixItems||e.prefixItems&&t.items?t.prefixItems?r.prefixItems=t.prefixItems:r.items=t.items:(r.prefixItems=t.prefixItems??e.prefixItems,r.items=ta(e.items,t.items));let o={...e,...t,...r,dynamicId:tO(e.dynamicId,t.dynamicId),oneOfIndex:e.oneOfIndex??t.oneOfIndex,schema:Hu(e.schema,t.schema,...n),parent:e.parent,resolvers:e.resolvers.concat(t.resolvers).filter(q8).sort(H8),reducers:e.reducers.concat(t.reducers).filter(q8).sort(H8),validators:e.validators.concat(t.validators).filter(q8).sort(H8),additionalProperties:ta(e.additionalProperties,t.additionalProperties),contains:ta(e.contains,t.contains),enum:rQ(e.enum,t.enum),if:ta(e.if,t.if),then:ta(e.then,t.then),else:ta(e.else,t.else),not:ta(e.not,t.not),propertyNames:ta(e.propertyNames,t.propertyNames),unevaluatedProperties:ta(e.unevaluatedProperties,t.unevaluatedProperties),unevaluatedItems:ta(e.unevaluatedItems,t.unevaluatedItems),$defs:nQ(e.$defs,t.$defs),patternProperties:EAe(e.patternProperties,t.patternProperties),properties:nQ(e.properties,t.properties),required:rQ(e.required,t.required)};function i(a){let s=a.toJSON?.()??a.name;return o.schema?.[s]!==void 0||(o[s]=void 0,!1)}return n?.forEach(a=>o[a]=void 0),o.resolvers=o.resolvers.filter(i),o.reducers=o.reducers.filter(i),o.validators=o.validators.filter(i),o}function Q8(e,...t){let n={};return Object.keys(e).forEach(r=>{t.includes(r)||(n[r]=e[r])}),n}function eO(e,...t){if(!Lt(e)||t.length===0)return e;let n={};return t.forEach(r=>{e[r]!==void 0&&(n[r]=e[r])}),n}function Y8(e,t={}){return e.replace(/\{\{(\w+)\}\}/g,(n,r)=>{let o=t[r];return o==null?"":typeof o=="object"?JSON.stringify(o):String(o)})}function Ia(e,t,n,r){return oo(e,t,n,r).every(Up)}function oo(e,t,n,r){if(qc(e))return[e];r.push({pointer:n,node:e});let o=e.schema;if(o===!0)return[];if(o===!1)return[e.createError("invalid-data-error",{value:t,pointer:n,schema:e.schema})];let i=[];for(let a of e.validators){let s=a({node:e,data:t,pointer:n,path:r});Array.isArray(s)?i.push(...s):s&&i.push(s)}return Dd(i)}function pQ(e,t=!0){let n=$8([`${e}`]).slice(1);if(!t)return n;try{return encodeURIComponent(n)}catch{return n.replace(/%/g,"%25")}}function dv(e){return Object.keys(e).map(t=>[t,pQ(t)])}function na(e,t){let n=pQ(t,!1);return`${e}/${e.startsWith("#")?n.replace(/%/g,"%25"):n}`}function AAe(e,t,n={}){n.path=n.path??[],n.withSchemaWarning=n.withSchemaWarning??!1,n.pointer=n.pointer??"#";let r=this,o=v1(e);if(o.length===0){let c=r.resolveRef(n);return qc(c)?{node:void 0,error:c}:{node:c,error:void 0}}let i="#",a=r;for(let c=0,d=o.length;c<d;c+=1){i=na(i,o[c]);let u=a.getNodeChild(o[c],t,{...n,pointer:i});if(u.error||u.node==null)return u;a=u.node,t=nr(t,o[c])}let{node:s,error:l}=a.resolveRef(n).reduceNode(t,{pointer:i});return qc(l)?{node:void 0,error:l}:zo(s)?{node:s,error:void 0}:{error:void 0}}function IAe(e,t,n={}){let r=n.pointer??na("#",e),o=n.path??[],i=n.pointer??"#",a=this;if(a.reducers.length){let s=a.reduceNode(t,{key:e,path:o,pointer:i});if(s.error)return s;zo(s.node)&&(a=s.node)}for(let s of a.resolvers){let l=s({data:t,key:e,node:a,pointer:r});if(qc(l))return{node:void 0,error:l};if(zo(l))return{node:l.resolveRef({pointer:i,path:o}),error:void 0}}return n.createSchema===!0?{node:pv(a).compileSchema(a.createSchema(nr(t,e)),`${a.evaluationPath}/additional`,`${a.schemaLocation}/additional`),error:void 0}:n.withSchemaWarning===!0?{node:void 0,error:a.createError("schema-warning",{pointer:i,value:t,schema:a.schema,key:e})}:{node:void 0}}var _h="format",pS={id:_h,keyword:_h,parse:TAe,addValidate:({schema:e})=>e?.format!=null,validate:RAe};function mQ(e){e.formatAssertion===!1&&(e.keywords=e.keywords.map(t=>t.keyword===_h?{...t,addValidate:()=>!1}:t))}function TAe(e){let t=e.schema[_h];if(t!=null){if(typeof t!="string")return e.createError("schema-error",{pointer:`${e.schemaLocation}/${_h}`,schema:e.schema,value:t,message:`Keyword '${_h}' must be a string - received '${typeof t}'`});if(e.context.formats[t]==null)return e.createAnnotation("unknown-format-warning",{pointer:`${e.schemaLocation}/${_h}`,schema:e.schema,value:t,message:`Keyword '${_h}' must be a string - received '${typeof t}'`})}}function RAe(e){let{node:t}=e,n=t.context.formats[t.schema.format];return n?.(e)}var{DYNAMIC_PROPERTIES:oQ,REGEX_FLAGS:DAe,DECLARATOR_ONEOF:MAe,VALID_ANNOTATION_KEYWORDS:OAe}=Nh;function zo(e){return Lt(e)&&Array.isArray(e?.reducers)&&Array.isArray(e?.resolvers)}function pv(e,t=e.context.remotes){if(e.context.isolated===!0&&t===e.context.remotes)return e;let n={...e,context:{...e.context,isolated:!0,refs:{...e.context.refs},anchors:{...e.context.anchors},dynamicAnchors:{...e.context.dynamicAnchors},remotes:{...t}}};return Object.entries(n.context.remotes).forEach(([r,o])=>{o===e&&(n.context.remotes[r]=n)}),n}function NAe(e,t){if(!Array.isArray(e)||e.length===0)throw Error(`Missing drafts in 'compileSchema({ $schema: "${t}" })'`);return e.length===1?e[0]:e.find(n=>new RegExp(n.$schemaRegEx,DAe).test(t))??e[e.length-1]}function tO(e,t){return e==t?e??"":e==null||t==null?(e||t)??"":e.startsWith(t)?e:t.startsWith(e)?t:`${e}+${t}`}var Z8={compileSchema(e,t,n,r){let o=this;t??=o.evaluationPath;let i=t.split("/$ref")[0],a={lastIdPointer:o.lastIdPointer,context:o.context,parent:o,evaluationPath:t,dynamicId:tO(o.dynamicId,r),schemaLocation:n??$8(o.schemaLocation,i),reducers:[],resolvers:[],validators:[],schema:e,...Z8};return!Is(e)&&!rs(e)?(a.schemaValidation=[a.createError("schema-error",{pointer:n??t,schema:e,value:void 0,message:`JSON schema must be object or boolean - reveived: '${e}'`})],a):(a.schemaValidation=Dd(X8(a).filter(s=>s!=null)),a)},createError(e,t,n){let r=this,o=n;if(o===void 0){let i=r.schema?.errorMessages?.[e]??r.context.errors[e];if(typeof i=="function")return i(t);o=Y8(i??name,t)}return{type:"error",code:e,message:o,data:t}},createAnnotation(e,t,n){let r=this,o=n;if(o===void 0){let i=r.schema?.errorMessages?.[e]??r.context.errors[e];if(typeof i=="function")return i(t);o=Y8(i??name,t)}return{type:"annotation",code:e,message:o,data:t}},createSchema(e){return this.context.methods.createSchema(e)},getChildSelection(e){let t=this;return t.context.methods.getChildSelection(t,e)},getNode:AAe,getNodeChild:IAe,getNodeRef(e){return this.compileSchema({$ref:e},"$dynamic").resolveRef()},getNodeRoot(){return this.context.rootNode},getDraftVersion(){return this.context.version},getData(e,t){let n=this,r={recursionLimit:1,...n.context.getDataDefaultOptions,cache:{},...t??{}};return n.context.methods.getData(n,e,r)},reduceNode(e,t={}){let n=this,{key:r="missing-key",pointer:o=n.evaluationPath,path:i}=t,a=pv(n);if(a.schema===!1)return{node:a,error:void 0};if(a.schema===!0){let d=a.compileSchema(a.createSchema(e),a.evaluationPath,a.schemaLocation);return i?.push({pointer:o,node:a}),{node:d,error:void 0}}let s,l=a.compileSchema(a.schema,a.evaluationPath,a.schemaLocation),c=a.reducers;for(let d of c){let u=d({data:e,key:r,node:a,pointer:o,path:i??[]});if(qc(u))return{node:void 0,error:u};if(u){if(u.schema===!1){s=!1;break}l=ta(l,u)}}return s===!1?{node:{...a,schema:!1,reducers:[]},error:void 0}:(l!==a&&i?.push({pointer:o,node:a}),l.schema=Q8(l.schema,MAe,...oQ),oQ.forEach(d=>l[d]=void 0),{node:l,error:void 0})},validate(e,t="#",n=[]){let r=this,o=oo(r,e,t,n)??[],i=[],a=[],s=Dd(Array.isArray(o)?o:[o]).filter(qc),l=[];return Dd(Array.isArray(o)?o:[o]).forEach(c=>{if(qc(c)){if(r.context.throwOnInvalidRef&&c.code==="ref-error"){let d=Error("Invalid $ref: "+c.message);throw d.data=i,d}i.push(c)}else c instanceof Promise?l.push(c.then(Dd)):Up(c)&&a.push(c)}),{valid:s.length===0,errors:i,annotations:a,errorsAsync:l}},addRemoteSchema(e,t){Is(t)&&(t.$id=Ao(t.$id||e));let n=this,{context:r}=n,o=Is(t)?t.$schema??n.context.draft:void 0,i=NAe(r.drafts,o??r.rootNode.schema?.$schema),a={evaluationPath:"#",lastIdPointer:"#",schemaLocation:"#",dynamicId:"",reducers:[],resolvers:[],validators:[],schema:t,context:{...r,isolated:!1,refs:{},anchors:{},...g1(eO(i,"methods","keywords","version","formats","errors"))},...Z8};a.context.rootNode=a,a.context.remotes[Ao(e)]=a,mQ(a.context);let s=X8(a).filter(u=>u!=null);s=Dd(s);let l=[],c=[],d=a.context.rootNode.$id??Ao(e);return s.forEach(u=>{qc(u)?(u.data.schemaId=d,l.push(u)):Up(u)&&(u.data.schemaId=d,c.push(u))}),n.schemaErrors=(n.schemaErrors??[]).concat(l),n.schemaAnnotations=(n.schemaAnnotations??[]).concat(c),n},resolveRef(e){throw Error("method 'resolveRef' is not implemented")},toSchemaNodes(){return ic(this)},toDataNodes(e,t){let n=this;return n.context.methods.toDataNodes(n,e,t)},toJSON(){let e=this;return{...e,context:void 0,errors:void 0,parent:e.parent?.evaluationPath}}},iQ=["$ref","if","$defs"],FAe=["draft-04","draft-06","draft-07"];function X8(e){if(e.schema.$ref&&FAe.includes(e.context.version))return e.context.keywords.filter(({keyword:r})=>iQ.includes(r)).map(r=>aQ(r,e));let t=Object.keys(e.schema),n=e.context.keywords.filter(({keyword:r})=>iQ.includes(r)||t.includes(r)).map(r=>aQ(r,e));return t.filter(r=>!r.startsWith("x-")&&!OAe.includes(r)&&e.context.keywords.find(o=>o.keywords?o.keywords.includes(r):o.keyword===r)==null).forEach(r=>{n.push(e.createAnnotation("unknown-keyword-warning",{$id:e.$id,pointer:`${e.schemaLocation}/${r}`,schema:e.schema,value:r,draft:e.getDraftVersion()}))}),n}function aQ(e,t){let n=e.parse?.(t);return e.reduce&&e.addReduce?.(t)&&t.reducers.push(e.reduce),e.resolve&&e.addResolve?.(t)&&t.resolvers.push(e.resolve),e.validate&&e.addValidate?.(t)&&t.validators.push(e.validate),n}function Is(e){return Lt(e)}function rs(e){return typeof e=="boolean"}function LAe(e){return Lt(e)&&(e?.type&&e?.code&&e?.data)!=null}function Up(e){return Lt(e)&&e.type==="annotation"}function qc(e){return Lt(e)&&e.type==="error"}function qu(e){return typeof e=="number"}var U8=/(#)+$/g,BAe=["",null,"#"];function nO(e){if(BAe.includes(e))return[];if(e=e.replace(U8,""),e.indexOf("#")===-1)return[e.replace(/(#|\/)+$/g,"")];if(e.indexOf("#")===0)return[e.replace(U8,"")];let t=e.split("#");return t[0]=t[0].replace(/(#|\/)+$/g,""),t[1]=`#${t[1].replace(U8,"")}`,t}var $Ae={id:"$ref",keyword:"$ref",order:10,parse:zAe,addReduce:e=>e.$ref!=null||e.schema.$dynamicRef!=null,reduce:hQ,addValidate:({schema:e})=>e.$ref!=null||e.$dynamicRef!=null,validate:jAe};function sQ(e,t){e.context.isolated!==!0&&(e.context.refs[t]??(e.context.refs[t]=e))}function zAe(e){e.resolveRef=gQ;let t=Ao(e.parent?.$id,e.schema?.$id);e.$id=t,e.lastIdPointer=e.parent?.lastIdPointer??"#",t!==e.parent?.$id&&e.evaluationPath!=="#"&&(e.lastIdPointer=e.evaluationPath),e.lastIdPointer!=="#"&&e.evaluationPath.startsWith(e.lastIdPointer)&&sQ(e,Ao(t,`#${e.evaluationPath.replace(e.lastIdPointer,"")}`)),sQ(e,Ao(e.context.rootNode.$id,e.evaluationPath));let n=e.schema.$anchor;if(n){let o=`${t.replace(/#$/,"")}#${n}`;e.context.anchors[o]??(e.context.anchors[o]=e)}let r=e.schema.$dynamicAnchor;if(r){let o=`${t.replace(/#$/,"")}#${r}`;e.context.dynamicAnchors[o]??(e.context.dynamicAnchors[o]=e)}if(e.schema.$ref&&(e.$ref=Ao(t,e.schema.$ref),e.$ref.startsWith("/")&&(e.$ref=`#${e.$ref}`)),e.$ref?.startsWith("#/$defs/")&&hP(e.getNodeRoot().schema,e.$ref)==null)return e.createError("schema-error",{pointer:`${e.schemaLocation}/$ref`,schema:e.schema,value:e.schema.$ref,message:`Invalid $ref to missing target '${e.schema.ref}'`})}function hQ({node:e,data:t,key:n,pointer:r,path:o}){if(e==null)return;let i=e.resolveRef({pointer:r,path:o});if(i==null)return e.createError("ref-error",{ref:e.schema.$ref??e.schema.$dynamicRef,pointer:r,schema:e.schema,value:t});if(i.schemaLocation===e.schemaLocation)return i;let{node:a,error:s}=ta(e,i).reduceNode(t,{key:n,pointer:r,path:o});return a??s}function gQ({pointer:e,path:t=[]}={}){if(this.schema.$dynamicRef){let r=VAe(this,t);return qc(r)||t.push({pointer:e,node:r}),r}if(this.$ref==null)return this;let n=dS(this);return zo(n)&&t.push({pointer:e,node:n}),n}function jAe({node:e,data:t,pointer:n="#",path:r}){let o=e.resolveRef({pointer:n,path:r});return o==null?e.createError("ref-error",{ref:e.schema.$ref??e.schema.$dynamicRef,pointer:n,schema:e.schema,value:t}):oo(o,t,n,r)}function VAe(e,t){let n=t,r=Ao(e.$id,e.schema.$dynamicRef);if(e.context.dynamicAnchors[r]==null&&e.context.anchors[r])return Md(e.context.anchors[r],e);for(let o of n){if(o.node.schema.$dynamicAnchor)return Md(o.node,e);let i=e.schema.$dynamicRef.split("#").pop(),a=Ao(o.node.$id,`#${i}`);if(e.context.dynamicAnchors[a])return Md(e.context.dynamicAnchors[a],e)}return dS(e,r)}function Md(e,t){let n=e.schema;Lt(e.schema)&&(n={...Q8(e.schema,"$id"),...eO(t.schema,...Nh.PROPERTIES_TO_MERGE)});let{isolated:r,remotes:o}=t.context;return(r===!0?pv(e,o):e).compileSchema(n,`${t.evaluationPath}/$ref`,e.schemaLocation)}function dS(e,t=e?.$ref){if(t==null)return e;if(e.context.refs[t])return Md(e.context.refs[t],e);if(e.context.anchors[t])return Md(e.context.anchors[t],e);if(e.context.dynamicAnchors[t])return Md(e.context.dynamicAnchors[t],e);let n=nO(t);if(n.length===0)return e.createError("ref-error",{ref:t,pointer:e.evaluationPath,schema:e.schema,value:void 0});if(n.length===1){let r=n[0];if(e.context.remotes[r])return Md(e.context.remotes[r],e);if(r[0]==="#"){let o=e.context.rootNode.schema,i=hP(o,r);if(i)return e.compileSchema(i,`${e.evaluationPath}/$ref`,r)}return e.createError("ref-error",{ref:r,pointer:e.evaluationPath,schema:e.schema,value:void 0})}if(n.length===2){let r=n[0];if(e.context.remotes[r]&&e!==e.context.remotes[r]){let{isolated:o,remotes:i}=e.context,a=i[r],s=o===!0?pv(a,i):a,l=dS(s,t);if(l||(l=dS(s,n[1]),l))return l}if(e.context.refs[r]){let o=e.context.refs[r],i=v1(n[1]),a=o;for(let s of i)if(a=a[s==="definitions"?"$defs":s],a==null)return e.createError("ref-error",{ref:t,pointer:e.evaluationPath,schema:e.schema,value:void 0,host:n[0],local:n[1]});return e.context.isolated===!0?Md(a,e):a}}return e.createError("ref-error",{ref:t,pointer:e.evaluationPath,schema:e.schema,value:void 0})}function Uc(e,...t){return t.reduce((n,r)=>(r.schemaValidation&&n.push(...r.schemaValidation),n),e)}var mS={id:"$defs",keyword:"$defs",parse:HAe};function HAe(e){let t=[];return e.schema.$defs&&(Lt(e.schema.$defs)?(e.$defs=e.$defs??Object.create(null),dv(e.schema.$defs).forEach(([n,r])=>{e.$defs[n]=e.compileSchema(e.schema.$defs[n],`${e.evaluationPath}/$defs/${r}`,`${e.schemaLocation}/$defs/${r}`),Uc(t,e.$defs[n])})):t.push(e.createError("schema-error",{pointer:e.schemaLocation,schema:e.schema,value:e.schema.$defs,message:`$defs must be an object - received: ${typeof e.schema.$defs}`}))),e.schema.definitions&&(Lt(e.schema.definitions)||t.push(e.createError("schema-error",{pointer:e.schemaLocation,schema:e.schema,value:e.schema.$defs,message:`definitions must be an object - received: ${typeof e.schema.definitions}`})),e.$defs=e.$defs??Object.create(null),dv(e.schema.definitions).forEach(([n,r])=>{e.$defs[n]=e.compileSchema(e.schema.definitions[n],`${e.evaluationPath}/definitions/${r}`,`${e.schemaLocation}/definitions/${r}`),Uc(t,e.$defs[n])})),t}var rO={id:"$ref",keyword:"$ref",parse:qAe,addValidate:({schema:e})=>e.$ref!=null,validate:UAe};function qAe(e){let t=e.parent?.$id;if(e.schema?.$ref??(t=Ao(e.parent?.$id,e.schema?.$id)),e.$id=t,e.lastIdPointer=e.parent?.lastIdPointer??"#",e.resolveRef=gQ,e.context.refs[t]??(e.context.refs[t]=e),t!==e.parent?.$id&&(e.lastIdPointer=e.evaluationPath),e.lastIdPointer!=="#"&&e.evaluationPath.startsWith(e.lastIdPointer)){let n=`#${e.evaluationPath.replace(e.lastIdPointer,"")}`;e.context.refs[Ao(t,n)]=e}else e.context.refs[Ao(t,e.evaluationPath)]=e;e.context.refs[Ao(e.context.rootNode.$id,e.evaluationPath)]=e,e.schema.$ref&&(e.$ref=Ao(t,e.schema.$ref))}function UAe({node:e,data:t,pointer:n="#",path:r}){let o=vQ(e,n,r);return zo(o)?oo(o,t,n,r):e.createError("ref-error",{ref:e.schema.$ref,pointer:n,schema:e.schema,value:t})}function vQ(e,t,n){let r=e.resolveRef({pointer:t,path:n});return zo(r)?r!==e&&r?vQ(r,t,n):e:e.createError("ref-error",{ref:e.schema.$ref,pointer:t,schema:e.schema,value:void 0})}var WAe={id:"$ref",keyword:"$ref",parse:GAe,addValidate:({schema:e})=>e.$ref!=null,validate:rO.validate};function W8(e,t){e.context.refs[t]??(e.context.refs[t]=e)}function GAe(e){let t=e.parent?.$id;if(e.schema?.$ref==null&&e.schema?.id&&(t=Ao(e.parent?.$id,e.schema.id)),e.$id=t,e.lastIdPointer=e.parent?.lastIdPointer??"#",e.resolveRef=KAe,e.context.refs[t]??(e.context.refs[t]=e),t!==e.parent?.$id&&(e.lastIdPointer=e.evaluationPath),e.lastIdPointer!=="#"&&e.evaluationPath.startsWith(e.lastIdPointer)){let n=`#${e.evaluationPath.replace(e.lastIdPointer,"")}`;W8(e,Ao(t,n))}else W8(e,Ao(t,e.evaluationPath));W8(e,Ao(e.context.rootNode.$id,e.evaluationPath)),e.schema.$ref&&(e.$ref=Ao(t,e.schema.$ref))}function KAe({pointer:e,path:t}={}){if(this.$ref==null)return this;let n=yP(this);return zo(n)&&t?.push({pointer:e,node:n}),n}function vP(e,t){let n=Lt(e.schema)?Q8(e.schema,"id"):e.schema,{isolated:r,remotes:o}=t.context;return(r===!0?pv(e,o):e).compileSchema(n,`${t.evaluationPath}/$ref`,n.schemaLocation)}function yP(e,t=e?.$ref){if(t==null)return e;if(e.context.refs[t])return vP(e.context.refs[t],e);if(e.context.anchors[t])return vP(e.context.anchors[t],e);let n=nO(t);if(n.length===0)return e.createError("ref-error",{ref:t,pointer:e.evaluationPath,schema:e.schema,value:void 0});if(n.length===1){let r=n[0];return e.context.remotes[r]?vP(e.context.remotes[r],e):e.createError("ref-error",{ref:r,pointer:e.evaluationPath,schema:e.schema,value:void 0})}if(n.length===2){let r=n[0];if(e.context.remotes[r]&&e!==e.context.remotes[r]){let{isolated:i,remotes:a}=e.context,s=a[r],l=i===!0?pv(s,a):s,c=yP(l,t);if(c||(c=yP(l,n[1]),c))return c}let o=n[0];if(e.context.refs[o]){let i=e.context.refs[o],a=n[1].split("$defs/").pop();if(a&&i?.$defs){let s=i.$defs[a];return yP(s&&e.context.isolated===!0?vP(s,e):s)}}}else return e.createError("ref-error",{ref:t,pointer:e.evaluationPath,schema:e.schema,value:void 0})}var rv="additionalItems",wP={id:rv,keyword:rv,order:-10,parse:JAe,addResolve:e=>e.items!=null,resolve:YAe,addValidate:({schema:e})=>e[rv]!=null&&e[rv]!==!0&&Array.isArray(e.items),validate:ZAe};function JAe(e){let{schema:t,evaluationPath:n,schemaLocation:r}=e;if(t.additionalItems==null||t.additionalItems===!1)return;let o=t[rv];if(!(Lt(o)||o===!0))return e.createError("schema-error",{pointer:n,schema:t,value:void 0,message:`Keyword '${rv}' must be an object or a boolean - received '${typeof o}'`});if(!Array.isArray(t.items))return e.createAnnotation("schema-error",{pointer:n,schema:t,value:void 0,message:`Keyword '${rv}' is only evaluated with a given items-array`});e.items=e.compileSchema(t.additionalItems,`${n}/additionalItems`,`${r}/additionalItems`)}function YAe({node:e,key:t,data:n}){if(Array.isArray(n)){let r=nr(n,t),{node:o,error:i}=e.items.reduceNode(r);return o??i}}function ZAe({node:e,data:t,pointer:n,path:r}){let{schema:o}=e;if(!Array.isArray(t)||t.length===0||Array.isArray(o.items)&&o.items.length>=t.length)return;let i=Array.isArray(o.items)?o.items.length:0,a=[];for(let s=i;s<t.length;s+=1){let l=t[s];if(e.items){let c=oo(e.items,l,`${n}/${s}`,r);c&&a.push(...c)}else o.additionalItems===!1&&a.push(e.createError("additional-items-error",{key:s,pointer:`${n}/${s}`,value:t,schema:o}))}return a}var hS={id:"additionalProperties",keyword:"additionalProperties",order:-10,parse:XAe,addResolve:({schema:e})=>e.additionalProperties!=null,resolve:QAe,addValidate:({schema:e})=>e.additionalProperties!==!0&&e.additionalProperties!=null&&!(e.additionalProperties===!1&&Lt(e.patternProperties)),validate:eIe};function XAe(e){let{schema:t,evaluationPath:n,schemaLocation:r}=e;if(!(t.additionalProperties==null||rs(t.additionalProperties)))return Lt(t.additionalProperties)?(e.additionalProperties=e.compileSchema(t.additionalProperties,`${n}/additionalProperties`,`${r}/additionalProperties`),e.additionalProperties.schemaValidation):e.createError("schema-error",{pointer:e.schemaLocation,schema:t,value:t.additionalProperties,message:`keyword 'additionalProperties' must be a valid JSON Schema - receoved: ${typeof t.additionalProperties}`})}function QAe({node:e,data:t,key:n,pointer:r=na("#",n)}){let o=nr(t,n);if(e.additionalProperties){let{node:i,error:a}=e.additionalProperties.reduceNode(o,{pointer:r});return i??a}if(e.schema.additionalProperties===!1)return e.createError("no-additional-properties-error",{pointer:r,schema:e.schema,value:nr(t,n),property:`${n}`})}function eIe({node:e,data:t,pointer:n="#",path:r}){if(!Lt(t))return;let{schema:o}=e,i=[],a=Object.keys(t).filter(c=>Nh.propertyBlacklist.includes(c)===!1),s=e.patternProperties;Array.isArray(s)&&(a=a.filter(c=>{for(let d of s)if(d.pattern.test(c))return!1;return!0}));let l=e.properties?Object.keys(e.properties):[];return a.filter(c=>l.indexOf(c)===-1).forEach(c=>{let d=nr(t,c);if(d!==void 0)if(Lt(e.additionalProperties)){let u=oo(e.additionalProperties,d,na(n,c),r);u&&i.push(...u)}else i.push(e.createError("no-additional-properties-error",{pointer:na(n,c),schema:o,value:t,property:c,properties:l}))}),i}var $o="allOf",gS={id:$o,keyword:$o,parse:tIe,addReduce:e=>e[$o]!=null,reduce:nIe,addValidate:e=>e[$o]!=null,validate:rIe};function tIe(e){let{schema:t,evaluationPath:n,schemaLocation:r}=e;if(t[$o]!=null){if(!Array.isArray(t[$o]))return e.createError("schema-error",{pointer:r,schema:t,value:t[$o],message:`Keyword '${$o}' must be an array - received '${typeof t[$o]}'`});if(t[$o].length!==0)return e[$o]=t[$o].map((o,i)=>e.compileSchema(o,`${n}/${$o}/${i}`,`${r}/${$o}/${i}`)),Uc([],...e[$o])}}function nIe({node:e,data:t,key:n,pointer:r,path:o}){if(e[$o]==null)return;let i={},a="";for(let s=0;s<e[$o].length;s+=1){let{node:l}=e[$o][s].reduceNode(t,{key:n,pointer:r,path:o});if(l){let c=l.dynamicId?.replace(e.dynamicId,"")??"",d=c===""?`${$o}/${s}`:c;a+=`${a===""?"":","}${d}`;let u=Hu(e[$o][s].schema,l.schema);i=Hu(i,u,$o,"contains")}}return e.compileSchema(i,`${e.evaluationPath}/${a}`,e.schemaLocation,`${e.schemaLocation}(${a})`)}function rIe({node:e,data:t,pointer:n,path:r}){if(!Array.isArray(e[$o])||e[$o].length===0)return;let o=[];return e[$o].forEach(i=>{o.push(...oo(i,t,n,r))}),o}var Eo="anyOf",vS={id:Eo,keyword:Eo,parse:oIe,addReduce:e=>e[Eo]!=null,reduce:iIe,addValidate:e=>e[Eo]!=null,validate:aIe};function oIe(e){let{schema:t,evaluationPath:n,schemaLocation:r}=e;if(t[Eo]!=null){if(!Array.isArray(t[Eo]))return e.createError("schema-error",{pointer:r,schema:t,value:t[Eo],message:`Keyword '${Eo}' must be an array - received '${typeof t[Eo]}'`});if(t[Eo].length!==0)return e[Eo]=t[Eo].map((o,i)=>e.compileSchema(o,`${n}/${Eo}/${i}`,`${r}/${Eo}/${i}`)),Uc([],...e[Eo])}}function iIe({node:e,data:t,pointer:n,path:r}){if(e[Eo]==null)return;let o={},i="";for(let a=0;a<e[Eo].length;a+=1)if(Ia(e[Eo][a],t,n,r)){let{node:s}=e[Eo][a].reduceNode(t);if(s){let l=s.dynamicId?.replace(e.dynamicId,"")??"",c=l===""?`${Eo}/${a}`:l;i+=`${i===""?"":","}${c}`;let d=Hu(e[Eo][a].schema,s.schema);o=Hu(o,d,Eo)}}return e.compileSchema(o,`${e.evaluationPath}${i}`,e.schemaLocation,`${e.schemaLocation}(${i})`)}function aIe({node:e,data:t,pointer:n,path:r}){if(e[Eo]!=null){for(let o of e[Eo])if(Ia(o,t,n,r))return;return e.createError("any-of-error",{pointer:n,schema:e.schema,value:t,anyOf:e.schema[Eo]})}}var Vu="contains",oO={id:Vu,keyword:Vu,parse:sIe,addValidate:e=>e[Vu]!=null,validate:bQ,addReduce:e=>e[Vu]!=null,reduce:({node:e})=>e.compileSchema({items:{anyOf:[e[Vu].schema]}},e.evaluationPath,e.schemaLocation)};function sIe(e){let t=e.schema[Vu];if(t!=null)return Is(t)||rs(t)?(e[Vu]=e.compileSchema(t,`${e.evaluationPath}/${Vu}`),e[Vu].schemaValidation):e.createError("schema-error",{pointer:`${e.schemaLocation}/${Vu}`,schema:e.schema,value:t,message:`Keyword '${Vu}' must be a valid JSON Schema - received '${typeof t}'`})}function bQ({node:e,data:t,pointer:n,path:r},o=e.schema.minContains??1,i=e.schema.maxContains??1/0){let{schema:a}=e;if(!Array.isArray(t))return;let s=0;for(let l of t)Ia(e.contains,l,n,r)&&s++;if(!(i>=s&&o<=s))return i<s?e.createError("contains-max-error",{pointer:n,schema:a,delta:s-i,value:t}):o>s?e.createError("contains-min-error",{pointer:n,schema:a,delta:o-s,value:t}):e.createError("contains-error",{pointer:n,schema:a,value:t})}var iO={...oO,validate:e=>bQ(e,1,1/0)};function Mh(e){let t=e===void 0?{}:{type:$i(e)};return t.type==="object"&&Lt(e)&&(t.properties=Object.create(null),Object.keys(e).forEach(n=>t.properties[n]=Mh(e[n]))),t.type==="array"&&Array.isArray(e)&&(e.length===1?t.items=Mh(e[0]):(t.items=e.map(Mh),t.items.find(n=>n.type!==t.items[0].type)??(t.items=t.items[0]))),t}function aO(e){return Array.isArray(e)&&e.find(t=>typeof t!="string")==null}var Hc="dependentRequired",yQ={id:Hc,keyword:Hc,parse:lIe,addValidate:e=>e[Hc]!=null,validate:wQ};function lIe(e){let{schema:t}=e;if(t[Hc]==null)return;if(!Lt(t[Hc]))return e.createError("schema-error",{pointer:`${e.schemaLocation}/${Hc}`,schema:t,value:t[Hc],message:`Keyword '${Hc}' must be an object - received '${typeof t[Hc]}'`});let n=[];e.dependentRequired=Object.create(null);for(let[r,o]of dv(t[Hc])){let i=t[Hc][r];aO(i)?e.dependentRequired[r]=i:n.push(e.createError("schema-error",{pointer:`${e.schemaLocation}/${Hc}/${o}`,schema:t,value:i,message:`Keyword '${Hc}[string]' must be a string[] - received '${typeof i}'`}))}return n}function wQ({node:e,data:t,pointer:n="#"}){let{dependentRequired:r}=e;if(r==null||!Lt(t))return;let o=[];return Object.keys(t).forEach(i=>{let a=r[i];if(Array.isArray(a))for(let s=0,l=a.length;s<l;s+=1)cv(t,a[s])||o.push(e.createError("missing-dependency-error",{missingProperty:a[s],pointer:n,schema:e.schema,value:t}))}),o}var Mf="dependentSchemas",kQ={id:Mf,keyword:Mf,parse:cIe,addReduce:e=>e.dependentSchemas!=null,reduce:dIe,addValidate:e=>e.dependentSchemas!=null,validate:xQ};function cIe(e){let{dependentSchemas:t}=e.schema;if(t==null)return;if(!Lt(t))return e.createError("schema-error",{pointer:`${e.schemaLocation}/${Mf}`,schema:e.schema,value:t,message:`Keyword '${Mf}' must be an object - received '${typeof t}'`});if(Object.keys(t).length===0)return;let n=[],r=Object.create(null);for(let[o,i]of dv(t)){let a=t[o];Lt(a)?(r[o]=e.compileSchema(a,`${e.evaluationPath}/${Mf}/${i}`,`${e.schemaLocation}/${Mf}/${i}`),Uc(n,r[o])):rs(a)?r[o]=a:n.push(e.createError("schema-error",{pointer:`${e.schemaLocation}/${Mf}/${i}`,schema:e.schema,value:a,message:`Keyword '${Mf}[string]' must be a valid JSON Schema'`}))}return e.dependentSchemas=r,n}function dIe({node:e,data:t}){let{dependentSchemas:n}=e;if(!Lt(t)||n==null)return e;let r,o=0,i=`${e.schemaLocation}(`;return Object.keys(t).forEach(a=>{n[a]!=null&&(r??={properties:Object.create(null)},zo(n[a])?r=Hu(r,n[a].schema):r.properties[a]=n[a],i+=`${o?",":""}${Mf}/${a}`,o++)}),r==null?e:(r=Hu(e.schema,r,Mf),e.compileSchema(r,e.evaluationPath,e.schemaLocation,`${i})`))}function xQ({node:e,data:t,pointer:n,path:r}){let{schema:o,dependentSchemas:i}=e;if(!Lt(t)||i==null)return;let a=[];return Object.keys(t).forEach(s=>{let l=i[s];l!==!0&&(l===!1?a.push(e.createError("missing-dependency-error",{pointer:n,schema:o,value:t})):zo(l)&&Dd(oo(l,t,n,r),a))}),a}var ac="dependencies",bS={id:ac,keyword:ac,parse:uIe,order:-9,addReduce:e=>e.schema[ac]!=null,reduce:fIe,addValidate:e=>e.schema[ac]!=null,validate:pIe};function uIe(e){let{dependencies:t}=e.schema;if(!Lt(t))return e.createError("schema-error",{pointer:`${e.schemaLocation}/${ac}`,schema:e.schema,value:t,message:`Keyword '${ac}' must be an object - received ${typeof t}`});let n=[];for(let[r,o]of dv(t)){let i=t[r];Is(i)||rs(i)?(e.dependentSchemas=e.dependentSchemas??Object.create(null),e.dependentSchemas[r]=e.compileSchema(i,`${e.evaluationPath}/${ac}/${o}`,`${e.schemaLocation}/${ac}/${o}`),Uc(n,e.dependentSchemas[r])):aO(i)?(e.dependentRequired=e.dependentRequired??Object.create(null),e.dependentRequired[r]=i):n.push(e.createError("schema-error",{pointer:`${e.schemaLocation}/${ac}`,schema:e.schema,value:t,message:`Keyword '${ac}[string]' must be JSON Schema or string[]`}))}return n}function fIe({node:e,data:t,key:n,pointer:r,path:o}){if(!Lt(t)||e.dependentRequired==null&&e.dependentSchemas==null)return e;let i=e.compileSchema(e.schema,e.evaluationPath,e.schemaLocation),a=i.schema.required??[],s="",l=e.dependentRequired;l&&Object.keys(l).forEach(d=>{if(!cv(t,d)&&!a.includes(d)||l[d]==null)return;a.push(...l[d]);let u=`${ac}/${d}`;s+=`${s===""?"":","}${u}`});let c=e.dependentSchemas;if(c)for(let d of Object.keys(c)){if(!cv(t,d)&&!a.includes(d))continue;let u=c[d];if(!zo(u))continue;Array.isArray(u.schema.required)&&a.push(...u.schema.required);let{node:f,error:p}={...u,schema:{...u.schema,required:a}}.reduceNode(t,{key:n,pointer:na(`${r}/${ac}`,d),path:o});if(!f)return p;i=ta(i,f);let m=f.dynamicId?.replace(e.dynamicId,"")??"",h=m===""?`${ac}/${d}`:m;s+=`${s===""?"":","}${h}`}return i===e?e:a.length===0?i:(a=i.schema.required?i.schema.required.concat(...a):a,a=a.filter((d,u,f)=>f.indexOf(d)===u),i=ta(i,i,ac),i.compileSchema({...i.schema,required:a},i.evaluationPath,i.schemaLocation,`${e.schemaLocation}(${s})`))}function pIe({node:e,data:t,pointer:n,path:r}){if(!Lt(t))return;let o=[];return e.dependentRequired&&Dd(wQ({node:e,data:t,pointer:n,path:r}),o),e.dependentSchemas&&Dd(xQ({node:e,data:t,pointer:n,path:r}),o),o}var ov="deprecated",yS={id:ov,keyword:ov,parse:mIe,addValidate:e=>e[ov]===!0,validate:hIe};function mIe(e){let t=e.schema[ov];if(t!=null){if(typeof t!="boolean")return e.createError("schema-error",{pointer:`${e.schemaLocation}/${ov}`,schema:e.schema,value:t,message:`Keyword '${ov}' must be a boolean - received '${typeof t}'`});e[ov]=t}}function hIe({node:e,data:t,pointer:n}){return[e.createAnnotation("deprecated-warning",{pointer:n,schema:e.schema,value:t},e.schema.deprecatedMessage)]}function uS(e,t){if(e===t)return!0;if(Array.isArray(e)||Array.isArray(t)){if(!Array.isArray(e)||!Array.isArray(t)||e.length!==t.length)return!1;for(let n=0;n<e.length;n+=1)if(!uS(e[n],t[n]))return!1;return!0}if(Lt(e)&&Lt(t)){let n=Object.getPrototypeOf(e),r=Object.getPrototypeOf(t);if(n!==Object.prototype&&n!==null||r!==Object.prototype&&r!==null)return(0,J8.default)(e,t);let o=Object.keys(e);return o.length===Object.keys(t).length&&o.every(i=>Object.prototype.hasOwnProperty.call(t,i)&&uS(e[i],t[i]))}return(0,J8.default)(e,t)}var Hp="enum",wS={id:Hp,keyword:Hp,parse:gIe,addValidate:e=>e.enum!=null,validate:vIe};function gIe(e){let{schema:t}=e;if(t[Hp]!=null){if(!Array.isArray(t[Hp]))return e.createError("schema-error",{pointer:`${e.schemaLocation}/${Hp}`,schema:t,value:t[Hp],message:`Keyword '${Hp}' must be an array - received '${typeof t[Hp]}'`});e.enum=t[Hp]}}function vIe({node:e,data:t,pointer:n="#"}){if(e.enum!=null&&!e.enum.some(r=>uS(t,r)))return e.createError("enum-error",{pointer:n,schema:e.schema,value:t,values:e.enum})}var kS={"additional-items-error":"Array at `{{pointer}}` may not have an additional item `{{key}}`","additional-properties-error":"Additional property `{{property}}` on `{{pointer}}` does not match schema `{{schema}}`","all-of-error":"Value `{{value}}` at `{{pointer}}` does not match schema of `{{allOf}}`","any-of-error":"Value `{{value}}` at `{{pointer}}` does not match any schema of `{{anyOf}}`","const-error":"Expected value at `{{pointer}}` to be `{{expected}}`, but value given is `{{value}}`","contains-any-error":"The array at `{{pointer}}` must contain at least one item","contains-array-error":"The property at `{{pointer}}` must not be an array","contains-error":"The array at `{{pointer}}` must contain an element that matches `{{schema}}`","contains-min-error":"The array at `{{pointer}}` contains {{delta}} too few items matching `{{schema}}`","contains-max-error":"The array at `{{pointer}}` contains {{delta}} too many items matching `{{schema}}`","enum-error":"Expected given value `{{value}}` in `{{pointer}}` to be one of `{{values}}`","exclusive-maximum-error":"Value in `{{pointer}}` is `{{length}}`, but should be at most `{{maximum}}`","exclusive-minimum-error":"Value in `{{pointer}}` is `{{length}}`, but should be at minimum `{{minimum}}`","forbidden-property-error":"Property name `{{property}}` at `{{pointer}}` is not allowed","format-date-error":"Value `{{value}}` at `{{pointer}}` is not a valid date","format-date-time-error":"Value `{{value}}` at `{{pointer}}` is not a valid date-time","format-duration-error":"Value `{{value}}` at `{{pointer}}` is not a valid duration","format-email-error":"Value `{{value}}` at `{{pointer}}` is not a valid email","format-hostname-error":"Value `{{value}}` at `{{pointer}}` is not a valid hostname","format-idn-hostname-error":"Value `{{value}}` at `{{pointer}}` is not a valid idn hostname","format-ipv4-error":"Value `{{value}}` at `{{pointer}}` is not a valid IPv4 address","format-ipv4-leading-zero-error":"IPv4 addresses starting with zero are invalid, since they are interpreted as octals","format-ipv6-error":"Value `{{value}}` at `{{pointer}}` is not a valid IPv6 address","format-ipv6-leading-zero-error":"IPv6 addresses starting with zero are invalid, since they are interpreted as octals","format-iri-error":"Value `{{value}}` at `{{pointer}}` is not a valid iri","format-iri-reference-error":"Value `{{value}}` at `{{pointer}}` is not a valid iri-reference","format-json-pointer-error":"Value `{{value}}` at `{{pointer}}` is not a valid json-pointer","format-regex-error":"Value `{{value}}` at `{{pointer}}` is not a valid regular expression","format-time-error":"Value `{{value}}` at `{{pointer}}` is not a valid time","format-uri-error":"Value `{{value}}` at `{{pointer}}` is not a valid uri","format-uri-reference-error":"Value `{{value}}` at `{{pointer}}` is not a valid uri-reference","format-uri-template-error":"Value `{{value}}` at `{{pointer}}` is not a valid uri-template","format-url-error":"Value `{{value}}` at `{{pointer}}` is not a valid url","format-uuid-error":"Value `{{value}}` at `{{pointer}}` is not a valid uuid","invalid-data-error":"No value may be specified in `{{pointer}}`","invalid-property-name-error":"Invalid property name `{{property}}` at `{{pointer}}`","maximum-error":"Value in `{{pointer}}` is `{{length}}`, but should be `{{maximum}}` at maximum","max-items-error":"Too many items in `{{pointer}}`, should be `{{maximum}}` at most, but got `{{length}}`","max-length-error":"Value `{{pointer}}` should have a maximum length of `{{maxLength}}`, but got `{{length}}`.","max-properties-error":"Too many properties in `{{pointer}}`, should be `{{maxProperties}}` at most, but got `{{length}}`","minimum-error":"Value in `{{pointer}}` is `{{length}}`, but should be `{{minimum}}` at minimum","min-items-error":"Too few items in `{{pointer}}`, should be at least `{{minItems}}`, but got `{{length}}`","min-items-one-error":"At least one item is required in `{{pointer}}`","min-length-error":"Value `{{pointer}}` should have a minimum length of `{{minLength}}`, but got `{{length}}`.","min-length-one-error":"A value is required in `{{pointer}}`","missing-one-of-declarator-error":"Missing oneOf declarator `{{declarator}}` in schema `{{schemaLocation}}`","min-properties-error":"Too few properties in `{{pointer}}`, should be at least `{{minProperties}}`, but got `{{length}}`","missing-array-item-error":"Array at '{{pointer}}' has a missing item at '{{key}}'","missing-dependency-error":"The required propery '{{missingProperty}}' in `{{pointer}}` is missing","missing-one-of-property-error":"Value at `{{pointer}}` must be object or array and have a property ${oneOfProperty}: ${value}","multiple-of-error":"Expected `{{value}}` in `{{pointer}}` to be multiple of `{{multipleOf}}`","multiple-one-of-error":"Value `{{value}}` should not match multiple schemas in oneOf `{{matches}}`","no-additional-properties-error":"Additional property `{{property}}` in `{{pointer}}` is not allowed","not-error":"Value `{{value}}` at pointer should not match schema `{{not}}`","one-of-error":"Value `{{value}}` in `{{pointer}}` does not match any given oneof schema","one-of-property-error":"Failed finding a matching oneOfProperty schema in `{{pointer}}` where `{{property}}` matches `{{value}}`","pattern-error":"Value in `{{pointer}}` should match `{{description}}`, but received `{{received}}`","pattern-properties-error":"Property `{{key}}` does not match any patterns in `{{pointer}}`. Valid patterns are: {{patterns}}","ref-error":"Could not resolve $ref '{{ref}}' from '{{pointer}}'","required-property-error":"The required property `{{key}}` is missing at `{{pointer}}`","schema-warning":"Failed retrieving a schema from '{{pointer}}' to key '{{key}}'","type-error":"Expected `{{value}}` ({{received}}) in `{{pointer}}` to be of type `{{expected}}`","undefined-value-error":"Value must not be undefined in `{{pointer}}`","unevaluated-property-error":"Invalid unevaluated property `{{pointer}}`","unevaluated-items-error":"Invalid unevaluated item `{{pointer}}`","unique-items-error":"Items in array must be unique. Value `{{value}}` in `{{pointer}}` is a duplicate of {{duplicatePointer}}.","unknown-property-error":"Could not find a valid schema for property `{{pointer}}` within object","value-not-empty-error":"A value for `{{property}}` is required at `{{pointer}}`","deprecated-warning":"Value at `{{pointer}}` is deprecated","schema-error":"Invalid schema found at {{pointer}}: {{message}}","unknown-keyword-warning":"Keyword '{{value}}' is not a valid keyword to draft '{{draft}}'","unknown-format-warning":"Format {{value}} is not a valid format"},bIe={id:"exclusiveMaximum",keyword:"exclusiveMaximum",parse:yIe,addValidate:({schema:e})=>e.exclusiveMaximum===!0||!isNaN(e.maximum),validate:wIe};function yIe(e){let{exclusiveMaximum:t}=e.schema;if(t!=null&&typeof t!="number"&&typeof t!="boolean")return e.createError("schema-error",{pointer:e.evaluationPath,schema:e.schema,value:void 0,message:`Keyword 'exclusiveMaximum' must be a number - received '${typeof t}'`})}function wIe({node:e,data:t,pointer:n}){if(typeof t=="number"&&e.schema.exclusiveMaximum&&e.schema.maximum===t)return e.createError("maximum-error",{maximum:e.schema.exclusiveMaximum,length:t,pointer:n,schema:e.schema,value:t})}var kIe={id:"exclusiveMinimum",keyword:"exclusiveMinimum",parse:xIe,addValidate:({schema:e})=>e.exclusiveMinimum===!0||!isNaN(e.minimum),validate:SIe};function xIe(e){let{exclusiveMinimum:t}=e.schema;if(t!=null&&typeof t!="number"&&typeof t!="boolean")return e.createError("schema-error",{pointer:e.evaluationPath,schema:e.schema,value:void 0,message:`Keyword 'exclusiveMinimum' must be a number - received '${typeof t}'`})}function SIe({node:e,data:t,pointer:n}){if(typeof t=="number"&&e.schema.exclusiveMinimum&&e.schema.minimum===t)return e.createError("minimum-error",{minimum:e.schema.exclusiveMinimum,length:t,pointer:n,schema:e.schema,value:t})}var{REGEX_FLAGS:CIe}=Nh,_Ie=/^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,PIe=/^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i,EIe=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,AIe=/^(?<time>(?:([0-1]\d|2[0-3]):[0-5]\d:(?<second>[0-5]\d|60)))(?:\.\d+)?(?<offset>(?:z|[+-]([0-1]\d|2[0-3])(?::?[0-5]\d)?))$/i,IIe=[0,31,28,31,30,31,30,31,31,30,31,30,31],TIe=/^(?:\/(?:[^~/]|~0|~1)*)*$/,RIe=/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,DIe=/^P(?!$)(\d+Y)?(\d+M)?(\d+W)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?$/,uv={date:({node:e,pointer:t,data:n})=>{let{schema:r}=e;if(typeof n!="string"||n==="")return;let o=n.match(EIe);if(!o)return e.createError("format-date-error",{value:n,pointer:t,schema:r});let i=+o[1],a=+o[2],s=+o[3],l=i%4==0&&(i%100!=0||i%400==0);if(!(a>=1&&a<=12&&s>=1&&s<=(a==2&&l?29:IIe[a])))return e.createError("format-date-error",{value:n,pointer:t,schema:r})},"date-time":({node:e,pointer:t,data:n,path:r})=>{let{schema:o}=e;if(typeof n!="string"||n==="")return;let i=n.split(/t/i);if(i.length===2){let a=uv.date({node:e,pointer:t,data:i[0],path:r})===void 0,s=uv.time({node:e,pointer:t,data:i[1],path:r})===void 0;if(a&&s)return}return e.createError("format-date-time-error",{value:n,pointer:t,schema:o})},duration:({node:e,pointer:t,data:n})=>{if($i(n)==="string"&&(!DIe.test(n)||/(\d+M)(\d+W)|(\d+Y)(\d+W)/.test(n)))return e.createError("format-duration-error",{value:n,pointer:t,schema:e.schema})},email:({node:e,pointer:t,data:n})=>{let{schema:r}=e;if(typeof n!="string"||n==="")return;let o=n.lastIndexOf("@"),i=n.substr(0,o),a=n.substr(o+1);if(!i||!a||i.length>64||a.length>253)return e.createError("format-email-error",{value:n,pointer:t,schema:r});let s=i;if(/^".*"$/.test(i)&&(s=i.replace(/(^")|([. @]+)|("$)/g,"")),s[0]==="."||s.endsWith(".")||s.includes("..")||!/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+$/i.test(s))return e.createError("format-email-error",{value:n,pointer:t,schema:r});if(/^\[.*\]$/.test(a)){let l=a.substr(1,a.length-2);if(_Ie.test(l)||PIe.test(l)||/IPv6:::[0-9a-f]{1,4}/.test(l))return}if(!/^[a-z0-9.-]+$/i.test(a)||!a.split(".").every(l=>/^[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?$/i.test(l)))return e.createError("format-email-error",{value:n,pointer:t,schema:r})},"json-pointer":({node:e,pointer:t,data:n})=>{let{schema:r}=e;if(typeof n=="string"&&n!==""&&!TIe.test(n))return e.createError("format-json-pointer-error",{value:n,pointer:t,schema:r})},"relative-json-pointer":({node:e,pointer:t,data:n})=>{let{schema:r}=e;if(typeof n=="string"&&!RIe.test(n))return e.createError("format-json-pointer-error",{value:n,pointer:t,schema:r})},regex:({node:e,pointer:t,data:n})=>{let{schema:r}=e;if(!(typeof n=="object"||typeof n=="number"||Array.isArray(n)||$i(n)==="boolean")){if(typeof n=="string"&&/\\Z$/.test(n)===!1){try{new RegExp(n,r.regexFlags??CIe);return}catch{}return e.createError("format-regex-error",{value:n,pointer:t,schema:r})}return e.createError("format-regex-error",{value:n,pointer:t,schema:r})}},time:({node:e,pointer:t,data:n})=>{let{schema:r}=e;if(typeof n!="string"||n==="")return;let o=n.match(AIe);if(!o)return e.createError("format-date-time-error",{value:n,pointer:t,schema:r});if(o.groups?.second==="60"){if(/23:59:60(z|\+00:00)/i.test(n))return;let i=o.groups.time.match(/(\d+):(\d+):/),a=o.groups.offset.match(/(\d+):(\d+)/);if(i&&a){let s=parseInt(i[1]),l=parseInt(a[1]),c=parseInt(i[2]),d=parseInt(a[2]),u;u=/^-/.test(o.groups.offset)?(s+l)*60+(c+d):(24+s-l)*60+(c-d);let f=Math.floor(u/60),p=f%24,m=u-f*60;if(p===23&&m===59)return}return e.createError("format-date-time-error",{value:n,pointer:t,schema:r})}},url:({node:e,data:t,pointer:n})=>{let{schema:r}=e;if(typeof t=="string"&&t!==""&&!(0,uQ.isWebUri)(t))return e.createError("format-url-error",{value:t,pointer:n,schema:r})},uuid:({node:e,data:t,pointer:n})=>{let{schema:r}=e;if(typeof t=="string"&&t!==""&&!/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(t))return e.createError("format-uuid-error",{value:t,pointer:n,schema:r})}};function kP(e,t){if(e.oneOf)return e.oneOf.map(o=>o.resolveRef());if(e.items?.oneOf)return e.items.oneOf.map(o=>o.resolveRef());if(e.prefixItems&&e.prefixItems.length>+t){let{node:o,error:i}=e.getNodeChild(t);return o?[o]:i}if(e.schema.additionalItems){if(e.schema.additionalItems===!0)return[e.compileSchema({type:"string"})];if(e.items)return[e.items.resolveRef()]}if(e.prefixItems&&e.prefixItems.length<=+t)return[];let{node:n,error:r}=e.getNodeChild(t);return n?[n]:r}var MIe=["string","number","integer","boolean","null","array","object"],OIe=["additionalProperties","dependencies","dependentSchemas","dependentRequired","maxProperties","minProperties","patternProperties","properties","propertyNames","required","unevaluatedProperties"],NIe=["contains","items","maxItems","minItems","unevaluatedItems","uniqueItems"];function tv(e,t){let n=$i(t),r=e.schema;if(r===!0)return n==="bigint"?"number":MIe.some(l=>l===n)?n:void 0;if(!Lt(r))return;let o=r.type;if(Array.isArray(o)){if(o.includes(n))return n;let l=$i(r.default);return o.includes(l)?l:o[0]}if(o)return o;if(Array.isArray(r.enum)){let l=r.enum.map(d=>$i(d)).filter((d,u,f)=>f.indexOf(d)===u);if(l.includes(n))return n;let c=$i(r.default);return l.includes(c)?c:l[0]}let i=Object.keys(e.schema),a=i.filter(l=>OIe.includes(l)),s=i.filter(l=>NIe.includes(l));if(a.length>0&&a.length>s.length)return"object";if(s.length>0&&s.length>a.length)return"array";if(e.if)return tv(e.if.resolveRef()??e.if,t);if(e.allOf)for(let l of e.allOf){let c=tv(l.resolveRef()??l,t);if(c)return c}if(e.oneOf)for(let l of e.oneOf){let c=tv(l.resolveRef()??l,t);if(c)return c}if(e.anyOf)for(let l of e.anyOf){let c=tv(l.resolveRef()??l,t);if(c)return c}if(r.$ref){let l=e.resolveRef();if(l)return tv(l,t)}}function SQ(e){switch($i(e)){case"string":case"array":return e?.length===0;case"null":case"undefined":return!0;case"object":return Object.keys(e).length===0;default:return!1}}var cl="oneOf",{DECLARATOR_ONEOF:k1}=Nh,xS={id:cl,keyword:cl,parse:CQ,addReduce:e=>e[cl]!=null,reduce:_Q,addValidate:e=>e[cl]!=null,validate:PQ},FIe={id:"oneOf-fuzzy",keyword:"oneOf",parse:CQ,addReduce:e=>e.oneOf!=null,reduce:sO,addValidate:e=>e.oneOf!=null,validate:PQ};function CQ(e){let{schema:t,evaluationPath:n,schemaLocation:r}=e;if(t[cl]!=null){if(!Array.isArray(t[cl]))return e.createError("schema-error",{pointer:r,schema:t,value:t[cl],message:`Keyword '${cl}' must be an array - received '${typeof t[cl]}'`});if(t[cl].length!==0)return e[cl]=t[cl].map((o,i)=>e.compileSchema(o,`${n}/${cl}/${i}`,`${r}/${cl}/${i}`)),Uc([],...e[cl])}}function _Q({node:e,data:t,pointer:n,path:r}){if(e.oneOf==null)return;if(t!=null&&e.schema[k1])return LIe({node:e,data:t,pointer:n,path:r});let o=[],i=[];for(let a=0;a<e.oneOf.length;a+=1){let s=oo(e.oneOf[a],t,n,r);s.every(Up)?o.push({index:a,node:e.oneOf[a]}):i.push(...s)}if(o.length===1){let{node:a,index:s}=o[0],{node:l,error:c}=a.reduceNode(t,{pointer:n,path:r});if(l){let d=l.dynamicId?.replace(a.dynamicId,"")??"",u=d===""?`oneOf/${s}`:d;return l.oneOfIndex=s,l.dynamicId=tO(l.dynamicId,`+${a.schemaLocation}(${u})`),l}return c}return o.length,e.createError("one-of-error",{value:JSON.stringify(t),pointer:n,schema:e.schema,oneOf:e.schema.oneOf,errors:i})}function LIe({node:e,data:t,pointer:n,path:r}){if(e.oneOf==null)return;let o=e.schema[k1],i=nr(t,o);if(t===void 0||i===void 0)return e.createError("missing-one-of-property-error",{oneOfProperty:o,pointer:n,schema:e.schema,value:t});let a=[];for(let s=0;s<e.oneOf.length;s+=1){let{node:l}=e.oneOf[s].getNodeChild(o,t);if(!zo(l))return e.createError("missing-one-of-declarator-error",{declarator:k1,oneOfProperty:o,schemaLocation:e.oneOf[s].schemaLocation,pointer:`${n}/oneOf/${s}`,schema:e.schema,value:t});let c=Dd(oo(l,i,na(n,o),r));if(!c.every(Up))a.push(...c);else{let{node:d}=e.oneOf[s].reduceNode(t,{pointer:n,path:r});if(d)return d.oneOfIndex=s,d}}return e.createError("one-of-property-error",{property:o,value:t,pointer:n,schema:e.schema,errors:a})}function BIe(e,t,n,r){if(t==null||e.properties==null)return-1;let o=0,i=Object.keys(e.properties??{});for(let a of i)t[a]!==void 0&&Ia(e.properties[a],t[a],n,r)&&(o+=1);return o}function sO({node:e,data:t,pointer:n,path:r}){if(e.oneOf==null)return e;let o=_Q({node:e,data:t,pointer:n,path:r});if(zo(o))return o;if(Lt(t)){let i,a=-1,s=0;for(let d=0;d<e.oneOf.length;d+=1){let u=e.oneOf[d],f=BIe(u,t,n,r);s<f&&(s=f,i=u,a=d)}if(i===void 0)return e.createError("one-of-error",{value:JSON.stringify(t),pointer:n,schema:e.schema,oneOf:e.schema.oneOf});let{node:l,error:c}=i.reduceNode(t,{pointer:n,path:r});return l?(l.oneOfIndex=a,l):c}if(Array.isArray(t)){let i,a=-1,s=1/0;for(let d=0;d<e.oneOf.length;d+=1){let u=e.oneOf[d],{errors:f}=u.validate(t),p=f.length;p<s&&(s=p,i=u,a=d)}if(i===void 0)return e.createError("one-of-error",{value:JSON.stringify(t),pointer:n,schema:e.schema,oneOf:e.schema.oneOf});let{node:l,error:c}=i.reduceNode(t,{pointer:n,path:r});return l?(l.oneOfIndex=a,l):c}return o}function $Ie({node:e,data:t,pointer:n="#",path:r}){let{oneOf:o,schema:i}=e;if(!o)return;let a=i[k1],s=nr(t,a),l=[],c=[];for(let d of o){let{node:u,error:f}=d.getNodeChild(a,s);if(u){let p=oo(u,s,na(n,a),r);p.every(Up)?l.push({index:o.indexOf(d),node:d}):c.push(...p)}else console.log(`jlib oneOf error: failed getting schema for '${a}' to resolve ${k1} in ${n}/oneOf/${o.indexOf(d)}`,f)}if(l.length===1){let d=l[0];return d.node.oneOfIndex=d.index,oo(d.node,t,n,r)}return l.length>1?e.createError("multiple-one-of-error",{value:t,pointer:n,schema:i,matches:l}):e.createError("one-of-error",{value:JSON.stringify(t),pointer:n,schema:i,oneOf:i.oneOf,errors:c})}function PQ({node:e,data:t,pointer:n="#",path:r}){let{oneOf:o,schema:i}=e;if(!o)return;if(i[k1])return $Ie({node:e,data:t,pointer:n,path:r});let a=[],s=[];for(let l=0;l<o.length;l+=1){let c=oo(o[l],t,n,r);c.every(Up)?a.push({index:l,node:o[l]}):s.push(...c)}if(a.length===1){let{node:l,index:c}=a[0];l.oneOfIndex=c}else return a.length>1?e.createError("multiple-one-of-error",{value:t,pointer:n,schema:i,matches:a}):e.createError("one-of-error",{value:JSON.stringify(t),pointer:n,schema:i,oneOf:i.oneOf,errors:s})}var lO=()=>!1;try{typeof File=="function"&&(lO=e=>e instanceof File)}catch{}function zIe(e,t){if(e.$ref==null)return;t.cache=t.cache??{};let{cache:n,recursionLimit:r=1}=t,o=e.schemaLocation;if(n[o]=n[o]??{},n[o][e.$ref]=n[o][e.$ref]??0,n[o][e.$ref]>=r&&t.disableRecursionLimit!==!0)return!1;t.disableRecursionLimit=!1,n[o][e.$ref]+=1;let i=e.resolveRef();if(i&&i!==e)return i}function lQ(e,t){return(t.cache?.[e.schemaLocation]?.[e.$ref]??-1)<(t.recursionLimit??1)}function jIe(e,t){let n=$i(t);if(e===void 0||t==null||n===e||n==="number"&&e==="integer")return t;if(e==="string")return JSON.stringify(t);if(n!=="string")return t;try{let r=JSON.parse(t);if($i(r)===e)return r}catch{}return t}function xP(e,t,n){if(n?.cache==null)throw Error("Missing options");if(e.schema===!1||e.schema===!0||lO(t))return t;if(e.schema?.const!==void 0)return e.schema?.const;let r=e,o=t;if(Array.isArray(e.schema.enum)&&e.schema.enum.length>0&&t===void 0)return e.schema.default??e.schema.enum[0];if(e.schema.default!==void 0&&o===void 0&&(o=e.schema.default),r.allOf?.length&&r.allOf.forEach(l=>{o=l.getData(o,n)??o}),r.anyOf&&r.anyOf?.length>0&&(o=r.anyOf[0].getData(o,n)??o),r.oneOf&&r.oneOf?.length>0)if(SQ(o))r=ta(r,r.oneOf[0]);else{let l=sO({node:r,data:o,path:[],pointer:"#"});if(qc(l)){if(o!=null&&n.removeInvalidData!==!0)return o;r=r.oneOf[0],o=void 0}else r=ta(r,l)}let i=zIe(r,n);if(i===!1)return o;zo(i)&&(o=i.getData(o,n)??o,r=i);let a=tv(r,o),s=VIe[a]?.(r,o,n);return s===void 0?o:s}var VIe={null:(e,t,n)=>iS(e,t,null,n.useTypeDefaults),string:(e,t,n)=>iS(e,t,"",n.useTypeDefaults),number:(e,t,n)=>iS(e,t,0,n.useTypeDefaults),integer:(e,t,n)=>iS(e,t,0,n.useTypeDefaults),boolean:(e,t,n)=>iS(e,t,!1,n.useTypeDefaults),object:(e,t,n)=>{let r=e.schema,o=r.default===void 0?{}:r.default,i=Object.create(null),a=n.extendDefaults===!1&&r.default!==void 0?[]:r.required??[],s=e.properties;s&&Object.keys(s).forEach(d=>{let u=s[d],f=a.includes(d),p=nr(t,d),m=t===void 0||p===void 0?nr(o,d):p;if(m!==void 0||f||n.addOptionalProps){let h=u.getData(m,n),g=$i(h);if(n.removeInvalidData&&g!=="object"&&g!=="array"&&!u.validate(h).valid)return;(h!==void 0||n.useTypeDefaults!==!1)&&(i[d]=h)}});let l=e.dependentRequired;Lt(l)&&Object.keys(l).forEach(d=>{let u=l[d];nr(i,d)!==void 0&&u.forEach(f=>{let{node:p}=e.getNodeChild(f,i);p&&(i[f]=p.getData(nr(i,f),n))})});let c=e.dependentSchemas;if(c&&Object.keys(c).forEach(d=>{let u=c[d];if(i[d]!==void 0&&zo(u)){let f=u.getData(t??i,n);Object.assign(i,f)}}),t)if(n.removeInvalidData===!0&&(r.additionalProperties===!1||Lt(r.additionalProperties))){let d=e.additionalProperties;zo(d)&&Object.keys(t).forEach(u=>{if(i[u]==null){let f=nr(t,u);d.validate(f).valid&&(i[u]=f)}})}else Object.keys(t).forEach(d=>{let u=$i(d);if(n.removeInvalidData&&e.properties&&e.properties[d]&&u!=="object"&&u!=="array"){let f=e.properties[d],p=f.getData(nr(t,d),n);if(!f.validate(p).valid)return}i[d]??(i[d]=nr(t,d))});if(e.if){let{valid:d}=e.if.validate(i);if(d&&e.then){let u=e.then.getData(i,n);Object.assign(i,u)}else if(!d&&e.else){let u=e.else.getData(i,n);Object.assign(i,u)}}return{...o,...i}},array:(e,t,n)=>{let r=e.schema,o=r.default===void 0?[]:r.default,i=Array.isArray(t)?[...t]:o,a=n.extendDefaults===!1&&r.default!==void 0?0:r.minItems??0;if(r.items==null){if(e.items){let s=Math.max(a,i.length);for(let l=0;l<s;l+=1)i[l]=e.items.getData(i[l],n)}return i||[]}if(e.prefixItems){let s=Array.isArray(t)?t:[],l=Math.max(a??0,e.prefixItems.length);for(let c=0;c<l;c+=1){let d=e.prefixItems[c]??e.items;if(d&&lQ(d,n)||s[c]!==void 0){let u=d.getData(i[c]==null?o[c]:i[c],n);u!==void 0&&(i[c]=u)}}return i||[]}if(e.items==null)return i;if(e.items&&lQ(e.items,n)||Array.isArray(t)&&t?.length>0){let s={...n.cache};for(let l=0,c=Math.max(a,i.length);l<c;l+=1){n.cache=g1(s);let d={...n,disableRecursionLimit:!0},u=e.items.getData(i[l]==null?o[l]:i[l],d);if(u===void 0)return i;i[l]=u}}return i}};function iS({schema:e},t,n,r){return t===void 0?e.const?e.const:e.default===void 0&&Array.isArray(e.enum)?e.enum[0]:e.default===void 0&&r!==!1?n:e.default:jIe(e.type,t)}var qp="items",SP={id:qp,keyword:qp,parse:qIe,addResolve:e=>(e.prefixItems||e[qp])!=null,resolve:HIe,addValidate:({schema:e})=>e.items!=null,validate:UIe};function HIe({node:e,key:t}){if(e.prefixItems?.[t])return e.prefixItems[t];if(e.items)return e.items}function qIe(e){let{schema:t,evaluationPath:n}=e,r=t[qp];if(r!=null&&typeof r!="boolean")if(Lt(r))e.items=e.compileSchema(r,`${n}/${qp}`,`${e.schemaLocation}/${qp}`);else if(Array.isArray(r))e.prefixItems=r.map((o,i)=>e.compileSchema(o,`${n}/${qp}/${i}`,`${e.schemaLocation}/${qp}/${i}`));else return e.createError("schema-error",{pointer:n,schema:t,value:void 0,message:`Keyword '${qp}' must be an object or array - received '${typeof r}'`})}function UIe({node:e,data:t,pointer:n="#",path:r}){let{schema:o}=e;if(!Array.isArray(t)||t.length===0)return;if(o.items===!1)return Array.isArray(t)&&t.length===0?void 0:e.createError("invalid-data-error",{pointer:n,value:t,schema:o});let i=[];if(e.prefixItems){for(let a=0;a<Math.min(e.prefixItems.length,t.length);a+=1){let s=t[a],l=e.prefixItems[a],c=oo(l,s,`${n}/${a}`,r);i.push(...c)}return i}if(e.items){for(let a=0;a<t.length;a+=1){let s=t[a],l=oo(e.items,s,`${n}/${a}`,r);l&&i.push(...l)}return i}}var iv="maximum",SS={id:iv,keyword:iv,parse:WIe,addValidate:e=>e.maximum!=null,validate:GIe};function WIe(e){let t=e.schema[iv];if(t!=null){if(!qu(t))return e.createError("schema-error",{pointer:`${e.schemaLocation}/${iv}`,schema:e.schema,value:t,message:`Keyword '${iv}' must be a number - received '${typeof t}'`});e[iv]=t}}function GIe({node:e,data:t,pointer:n}){if(!qu(t))return;let r=e[iv],{schema:o}=e;if(r&&r<t)return e.createError("maximum-error",{maximum:r,length:t,value:t,pointer:n,schema:o});if(r&&o.exclusiveMaximum===!0&&r===t)return e.createError("maximum-error",{maximum:r,length:t,pointer:n,schema:o,value:t})}var b1="maxItems",CS={id:b1,keyword:b1,parse:KIe,addValidate:({schema:e})=>!isNaN(e.maxItems),validate:JIe};function KIe(e){let t=e.schema[b1];if(t!=null){if(!qu(t))return e.createError("schema-error",{pointer:`${e.schemaLocation}/${b1}`,schema:e.schema,value:t,message:`Keyword '${b1}' must be a number - received '${typeof t}'`});e[b1]=t}}function JIe({node:e,data:t,pointer:n}){let{schema:r}=e;if(Array.isArray(t)&&r.maxItems<t.length)return e.createError("max-items-error",{maximum:r.maxItems,length:t.length,schema:r,value:t,pointer:n})}function EQ(e){let t=[],n=0,r=e.length;for(;n<r;){let o=e.charCodeAt(n++);if(o>=55296&&o<=56319&&n<r){let i=e.charCodeAt(n++);(i&64512)==56320?t.push(((o&1023)<<10)+(i&1023)+65536):(t.push(o),n--)}else t.push(o)}return t}var Eh="maxLength",_S={id:Eh,keyword:Eh,parse:YIe,addValidate:e=>e[Eh]!=null,validate:ZIe};function YIe(e){let t=e.schema[Eh];if(t!=null){if(!qu(t))return e.createError("schema-error",{pointer:`${e.schemaLocation}/${Eh}`,schema:e.schema,value:t,message:`Keyword '${Eh}' must be a number - received '${typeof t}'`});e[Eh]=t}}function ZIe({node:e,data:t,pointer:n="#"}){if(typeof t!="string")return;let r=e[Eh],o=EQ(t).length;if(r<o)return e.createError("max-length-error",{maxLength:r,length:o,pointer:n,schema:e.schema,value:t})}var Ah="maxProperties",PS={id:Ah,keyword:Ah,parse:XIe,addValidate:e=>e[Ah]!=null,validate:QIe};function XIe(e){let t=e.schema[Ah];if(t!=null){if(!qu(t))return e.createError("schema-error",{pointer:`${e.schemaLocation}/${Ah}`,schema:e.schema,value:t,message:`Keyword '${Ah}' must be a number - received '${typeof t}'`});e[Ah]=t}}function QIe({node:e,data:t,pointer:n="#"}){if(!Lt(t))return;let r=e[Ah],o=Object.keys(t).length;if(r<o)return e.createError("max-properties-error",{maxProperties:r,length:o,pointer:n,schema:e.schema,value:t})}var Ih="minimum",ES={id:Ih,keyword:Ih,parse:eTe,addValidate:e=>e[Ih]!=null,validate:tTe};function eTe(e){let t=e.schema[Ih];if(t!=null){if(!qu(t))return e.createError("schema-error",{pointer:`${e.schemaLocation}/${Ih}`,schema:e.schema,value:t,message:`Keyword '${Ih}' must be a number - received '${typeof t}'`});e[Ih]=t}}function tTe({node:e,data:t,pointer:n}){if(!qu(t))return;let r=e[Ih];if(r>t||e.schema.exclusiveMinimum===!0&&e.schema.minimum===t)return e.createError("minimum-error",{minimum:r,length:t,pointer:n,schema:e.schema,value:t})}var Th="minItems",AS={id:Th,keyword:Th,parse:nTe,addValidate:e=>e[Th]!=null,validate:rTe};function nTe(e){let t=e.schema[Th];if(t!=null){if(!qu(t))return e.createError("schema-error",{pointer:`${e.schemaLocation}/${Th}`,schema:e.schema,value:t,message:`Keyword '${Th}' must be a number - received '${typeof t}'`});e[Th]=t}}function rTe({node:e,data:t,pointer:n}){if(!Array.isArray(t))return;let r=e[Th];if(r>t.length)return e.createError("min-items-error",{minItems:r,length:t.length,pointer:n,schema:e.schema,value:t})}var Rh="minLength",IS={id:Rh,keyword:Rh,parse:oTe,addValidate:e=>e[Rh]!=null,validate:iTe};function oTe(e){let t=e.schema[Rh];if(t!=null){if(!qu(t))return e.createError("schema-error",{pointer:`${e.schemaLocation}/${Rh}`,schema:e.schema,value:t,message:`Keyword '${Rh}' must be a number - received '${typeof t}'`});e[Rh]=t}}function iTe({node:e,data:t,pointer:n="#"}){if(typeof t!="string")return;let r=EQ(t).length,o=e[Rh];if(!(o<=r))return e.createError("min-length-error",{minLength:o,length:r,pointer:n,schema:e.schema,value:t})}var av="minProperties",TS={id:av,keyword:av,parse:aTe,addValidate:e=>e[av]!=null,validate:sTe};function aTe(e){let t=e.schema[av];if(t!=null){if(!qu(t))return e.createError("schema-error",{pointer:`${e.schemaLocation}/${av}`,schema:e.schema,value:t,message:`Keyword '${av}' must be a number - received '${typeof t}'`});e[av]=t}}function sTe({node:e,data:t,pointer:n="#"}){if(!Lt(t))return;let r=Object.keys(t).length;if(e.schema.minProperties>r)return e.createError("min-properties-error",{minProperties:e.schema.minProperties,length:r,pointer:n,schema:e.schema,value:t})}function cQ(e){let t=`${e}`;if(t.includes("e-"))return parseInt(t.replace(/.*e-/,""));let n=t.indexOf(".");return n===-1?0:t.length-(n+1)}var Dh="multipleOf",RS={id:Dh,keyword:Dh,parse:lTe,addValidate:e=>e[Dh]!=null,validate:cTe};function lTe(e){let t=e.schema[Dh];if(t!=null){if(!qu(t))return e.createError("schema-error",{pointer:`${e.schemaLocation}/${Dh}`,schema:e.schema,value:t,message:`Keyword '${Dh}' must be a number - received '${typeof t}'`});e[Dh]=t}}function cTe({node:e,data:t,pointer:n}){if(typeof t!="number")return;let r=e[Dh],o=cQ(t),i=cQ(r);if(o>i)return e.createError("multiple-of-error",{multipleOf:r,value:t,pointer:n,schema:e.schema});let a=10**i;if(Math.round(t*a)%Math.round(r*a)/a!==0)return e.createError("multiple-of-error",{multipleOf:r,value:t,pointer:n,schema:e.schema})}var DS={id:"not",keyword:"not",parse:dTe,addValidate:e=>e.not!=null,validate:uTe};function dTe(e){let{schema:t,evaluationPath:n,schemaLocation:r}=e,o=t.not;if(o!=null)return!Is(o)&&!rs(o)?e.createError("schema-error",{pointer:`${r}/not`,schema:t,value:o,message:`Keyword 'not' must be a valid JSON Schema - received '${typeof o}'`}):(e.not=e.compileSchema(t.not,`${n}/not`,`${r}/not`),e.not.schemaValidation)}function uTe({node:e,data:t,pointer:n,path:r}){let{schema:o}=e;if(Ia(e.not,t,n,r))return e.createError("not-error",{value:t,not:o.not,pointer:n,schema:o})}var sS="pattern",{REGEX_FLAGS:fTe}=Nh,MS={id:sS,keyword:sS,parse:pTe,addValidate:e=>e[sS]!=null,validate:mTe};function pTe(e){let t=e.schema[sS];if(t!=null){if(typeof t!="string")return e.createError("schema-error",{pointer:e.schemaLocation,schema:e.schema,value:t,message:`Keyword 'pattern' must be a string - received '${typeof t}'`});try{e[sS]=new RegExp(t,e.schema.regexFlags??fTe)}catch(n){return e.createError("schema-error",{pointer:e.schemaLocation,schema:e.schema,value:t,message:n.message})}}}function mTe({node:e,data:t,pointer:n="#"}){if(typeof t=="string"&&e.pattern.test(t)===!1){let{schema:r}=e;return e.createError("pattern-error",{pattern:r.pattern,description:r.patternExample||r.pattern,received:t,schema:r,value:t,pointer:n})}}var{REGEX_FLAGS:hTe}=Nh,OS={id:"patternProperties",keyword:"patternProperties",parse:gTe,addReduce:e=>e.patternProperties!=null,reduce:bTe,addResolve:e=>e.patternProperties!=null,resolve:vTe,addValidate:e=>e.patternProperties!=null,validate:yTe};function gTe(e){let{schema:t}=e;if(!Lt(t.patternProperties))return;let n=dv(t.patternProperties);if(n.length!==0)return e.patternProperties=n.map(([r,o])=>({name:r,pattern:new RegExp(r,t.regexFlags??hTe),node:e.compileSchema(t.patternProperties[r],`${e.evaluationPath}/patternProperties/${o}`,`${e.schemaLocation}/patternProperties/${o}`)})),Uc([],...e.patternProperties.map(({node:r})=>r))}function vTe({node:e,key:t}){return e.patternProperties?.find(({pattern:n})=>n.test(`${t}`))?.node}function bTe({node:e,data:t,key:n}){let{patternProperties:r}=e;if(r==null)return;let o,i=Object.keys(t??{});n&&i.push(`${n}`);let a=`${e.schemaLocation}(`;return i.push(...Object.keys(e.schema.properties??{})),i.forEach((s,l,c)=>{if(c.indexOf(s)!==l)return;let d=nr(e.schema.properties,s)??{},u=r.filter(f=>f.pattern.test(s));u.forEach(f=>d=Hu(d,f.node.schema)),u.length>0&&(o??={properties:Object.create(null)},o.properties[s]=d,a+=`${u.map(({name:f})=>`patternProperties/${f}`).join(",")}`)}),o==null?e:(o=Hu(e.schema,o,"patternProperties"),e.compileSchema(o,e.evaluationPath,e.schemaLocation,`${a})`))}function yTe({node:e,data:t,pointer:n,path:r}){if(!Lt(t))return;let{schema:o,patternProperties:i}=e,a=o.properties||{},s=Object.keys(o.patternProperties).join(","),l=[];return Object.keys(t).forEach(c=>{let d=nr(t,c),u=i.filter(f=>f.pattern.test(c));u.forEach(({node:f})=>l.push(...oo(f,d,na(n,c),r))),!cv(a,c)&&u.length===0&&o.additionalProperties===!1&&l.push(e.createError("no-additional-properties-error",{key:c,pointer:na(n,c),schema:o,value:d,patterns:s}))}),l}var NS={id:"property",keyword:"properties",parse:kTe,addResolve:e=>e.properties!=null,resolve:wTe,addValidate:e=>e.properties!=null,validate:xTe};function wTe({node:e,key:t}){return nr(e.properties,t)}function kTe(e){let{schema:t,evaluationPath:n,schemaLocation:r}=e;if(t.properties==null)return;if(t.properties&&!Lt(t.properties))return e.createError("schema-error",{pointer:r,schema:t,value:void 0,message:"keyword `properties` must be of type `object`"});let o=[],i=Object.create(null);return dv(t.properties).forEach(([a,s])=>{let l=e.compileSchema(t.properties[a],`${n}/properties/${s}`,`${r}/properties/${s}`);i[a]=l,Uc(o,i[a])}),e.properties=i,o}function xTe({node:e,data:t,pointer:n,path:r}){if(!Lt(t))return;let o=[],i=e.properties??{};return Object.keys(t).forEach(a=>{let s=nr(t,a),l=nr(i,a);if(l==null||s===void 0)return;let c=oo(l,s,na(n,a),r);o.push(...c)}),o}var Oh="propertyNames",FS={id:Oh,keyword:Oh,parse:STe,addValidate:e=>e.schema[Oh]!=null,validate:CTe};function STe(e){let t=e.schema[Oh];if(t!=null){if(!(Is(t)||rs(t)))return e.createError("schema-error",{pointer:`${e.schemaLocation}/${Oh}`,schema:e.schema,value:t,message:`Keyword '${Oh}' must be a valid JSON Schema - received '${typeof t}'`});if(!rs(t))return e.propertyNames=e.compileSchema(t,`${e.evaluationPath}/propertyNames`,`${e.schemaLocation}/propertyNames`),e.propertyNames.schemaValidation}}function CTe({node:e,data:t,pointer:n,path:r}){let{schema:o}=e;if(!Lt(t))return;if(o.propertyNames===!1)return Object.keys(t).length===0?void 0:e.createError("invalid-property-name-error",{property:Object.keys(t),pointer:n,value:t,schema:o});if(o[Oh]===!0)return;let i=e[Oh];if(!Lt(i))return;let a=[];return Object.keys(t).forEach(s=>{let l=oo(i,s,na(n,s),r);l.every(Up)||a.push(e.createError("invalid-property-name-error",{property:s,pointer:n,validationError:l.find(qc),value:t[s],schema:o}))}),a}var lS="required",LS={id:lS,keyword:lS,parse:_Te,addValidate:e=>e.required!=null,validate:PTe};function _Te(e){let t=e.schema[lS];if(t!=null){if(!aO(t))return e.createError("schema-error",{pointer:`${e.schemaLocation}/${lS}`,schema:e.schema,value:t,message:`Keyword '${lS}' must be a string[]`});e.required=t}}function PTe({node:e,data:t,pointer:n="#"}){let{required:r}=e;if(Lt(t))return r.map(o=>{if(!cv(t,o))return e.createError("required-property-error",{key:o,pointer:n,schema:e.schema,value:t})})}function ETe(e){return{...e,keywords:[...e.keywords.map(t=>({...t}))]}}function ATe(e,t){let{keywords:n}=ITe(e,...t.keywords??[]),r={...e.errors,...t.errors??{}},o={...e.formats,...t.formats??{}};return x1({...e,...t,formats:o,keywords:n,errors:r})}function ITe(e,...t){let n=ETe(e);return t.forEach(r=>TTe(n,r)),n}function TTe(e,t){let n=e.keywords.findIndex(r=>r.keyword===t.keyword);n===-1?e.keywords.push(t):e.keywords[n]=t}function x1(e){return e.keywords?.forEach(t=>{let n=()=>t.keyword;t.validate&&(t.validate.toJSON=n,t.validate.order=t.order??0),t.reduce&&(t.reduce.toJSON=n,t.reduce.order=t.order??0),t.resolve&&(t.resolve.toJSON=n,t.resolve.order=t.order??0)}),e.keywords?.sort((t,n)=>(n.order??0)-(t.order??0)),e}function fv(e,t,n="#",r=[]){let o=e.resolveRef()??e;return r.push({node:o,value:t,pointer:n}),Lt(t)?Object.keys(t).forEach(i=>{let{node:a}=o.getNodeChild(i,t);a&&fv(a,nr(t,i),na(n,i),r)}):Array.isArray(t)&&t.forEach((i,a)=>{let{node:s}=o.getNodeChild(a,t);s&&fv(s,nr(t,a),na(n,a),r)}),r}var zu="type",G8=["null","boolean","number","integer","string","object","array"],BS={id:zu,keyword:zu,parse:RTe,addReduce:e=>Array.isArray(e.type),reduce:DTe,addValidate:e=>e.type!=null,validate:MTe};function RTe(e){let t=e.schema[zu];if(t!=null){if(typeof t!="string"&&!Array.isArray(t))return e.createError("schema-error",{pointer:`${e.schemaLocation}/${zu}`,schema:e.schema,value:t,message:`Keyword '${zu}' must be a string or a string[] - received ${typeof t}`});if(typeof t=="string"&&!G8.includes(t))return e.createError("schema-error",{pointer:`${e.schemaLocation}/${zu}`,schema:e.schema,value:t,message:`Keyword '${zu}' is not a valid JSON Schema type - received '${t}'. Expected one of ${G8.join(", ")}`});if(Array.isArray(t)){let n=t.findIndex(r=>!G8.includes(r));if(n!==-1)return e.createError("schema-error",{pointer:`${e.schemaLocation}/${zu}/${n}`,schema:e.schema,value:t[n],message:`Keyword '${zu}' contains an invalid JSON Schema type: '${t[n]}'`})}e[zu]=t}}function DTe({node:e,pointer:t,data:n}){let r=AQ(n,e.type);if(r!=="undefined"&&Array.isArray(e.schema.type)&&e.schema.type.includes(r))return e.compileSchema({...e.schema,pointer:t,type:r},e.evaluationPath)}function AQ(e,t){let n=$i(e);return n==="number"&&(t==="integer"||Array.isArray(t)&&t.includes("integer"))?Number.isInteger(e)||isNaN(e)?"integer":"number":n}function MTe({node:e,data:t,pointer:n}){let r=e[zu],o=AQ(t,r);if(!(t===void 0||r===o||Array.isArray(r)&&r.includes(o)))return e.createError("type-error",{value:t,received:o,expected:r,schema:e.schema,pointer:n})}var y1="uniqueItems",$S={id:y1,keyword:y1,parse:OTe,addValidate:({schema:e})=>e[y1]===!0,validate:NTe};function OTe(e){let t=e.schema[y1];if(t!=null&&t!==!1){if(typeof t!="boolean")return e.createError("schema-error",{pointer:`${e.schemaLocation}/${y1}`,schema:e.schema,value:t,message:`Keyword '${y1}' must be a boolean - received ${typeof t}`});e.uniqueItems=!0}}function NTe({node:e,data:t,pointer:n}){if(!Array.isArray(t))return;let{schema:r}=e,o=[],i=[];return t.forEach((a,s)=>{for(let l=s+1;l<t.length;l+=1)uS(a,t[l])&&!o.includes(l)&&(i.push(e.createError("unique-items-error",{pointer:`${n}/${l}`,duplicatePointer:`${n}/${s}`,arrayPointer:n,value:JSON.stringify(a),schema:r})),o.push(l))}),i}var FTe=x1({version:"draft-04",$schemaRegEx:"draft-?0?4",$schema:"http://json-schema.org/draft-04/schema#",errors:kS,formats:uv,methods:{createSchema:Mh,getData:xP,getChildSelection:kP,toDataNodes:fv},keywords:[WAe,gS,vS,iO,mS,bS,yS,wS,bIe,kIe,pS,SP,SS,CS,_S,PS,ES,AS,IS,TS,RS,DS,OS,MS,NS,FS,LS,BS,$S,xS,wP,hS]}),CP={id:"const",keyword:"const",addValidate:({schema:e})=>e.const!==void 0,validate:LTe};function LTe({node:e,data:t,pointer:n}){if(!uS(t,e.schema.const))return[e.createError("const-error",{pointer:n,schema:e.schema,value:t,expected:e.schema.const})]}var cS="exclusiveMaximum",_P={id:cS,keyword:cS,parse:BTe,addValidate:({schema:e})=>e.exclusiveMaximum!=null&&!isNaN(parseInt(e.exclusiveMaximum)),validate:$Te};function BTe(e){let t=e.schema[cS];if(t!=null&&typeof t!="number")return e.createError("schema-error",{pointer:`${e.schemaLocation}/${cS}`,schema:e.schema,value:t,message:`Keyword '${cS}' must be a number - received '${typeof t}'`})}function $Te({node:e,data:t,pointer:n}){if(typeof t=="number"&&e.schema.exclusiveMaximum<=t)return e.createError("exclusive-maximum-error",{maximum:e.schema.exclusiveMaximum,length:t,pointer:n,schema:e.schema,value:t})}var sv="exclusiveMinimum",PP={id:sv,keyword:sv,parse:zTe,addValidate:({schema:e})=>e[sv]!=null&&!isNaN(parseInt(e[sv])),validate:jTe};function zTe(e){let t=e.schema[sv];if(t!=null&&typeof t!="number")return e.createError("schema-error",{pointer:`${e.schemaLocation}/${sv}`,schema:e.schema,value:t,message:`Keyword '${sv}' must be a number - received '${typeof t}'`})}function jTe({node:e,data:t,pointer:n}){if(typeof t=="number"&&e.schema.exclusiveMinimum>=t)return e.createError("exclusive-minimum-error",{minimum:e.schema.exclusiveMinimum,length:t,pointer:n,schema:e.schema,value:t})}var VTe=x1({version:"draft-06",$schemaRegEx:"draft-?0?6",$schema:"http://json-schema.org/draft-06/schema#",errors:kS,formats:uv,methods:{createSchema:Mh,getData:xP,getChildSelection:kP,toDataNodes:fv},keywords:[rO,gS,vS,CP,iO,mS,bS,yS,wS,_P,PP,pS,SP,SS,CS,_S,PS,ES,AS,IS,TS,RS,DS,OS,MS,NS,FS,LS,BS,$S,xS,wP,hS]}),cO={id:"if-then-else",keyword:"if",keywords:["if","then","else"],parse:HTe,addReduce:e=>e.if!=null&&(e.then!=null||e.else!=null),reduce:qTe,addValidate:e=>e.if!=null,validate:UTe};function HTe(e){let{schema:t,evaluationPath:n}=e,r=[];return t.if!=null&&(Is(t.if)||rs(t.if)?(e.if=e.compileSchema(t.if,`${n}/if`),Uc(r,e.if)):r.push(e.createError("schema-error",{pointer:`${e.schemaLocation}/if`,schema:e.schema,value:t.if,message:`Keyword 'if' must be valid JSON Schema - received '${typeof t.if}'`}))),t.then!=null&&(Is(t.then)||rs(t.then)?(e.then=e.compileSchema(t.then,`${n}/then`),Uc(r,e.then)):r.push(e.createError("schema-error",{pointer:`${e.schemaLocation}/then`,schema:e.schema,value:t.then,message:`Keyword 'then' must be valid JSON Schema - received '${typeof t.then}'`}))),t.else!=null&&(Is(t.else)||rs(t.else)?(e.else=e.compileSchema(t.else,`${n}/else`),Uc(r,e.else)):r.push(e.createError("schema-error",{pointer:`${e.schemaLocation}/else`,schema:e.schema,value:t.else,message:`Keyword 'else' must be valid JSON Schema - received '${typeof t.else}'`}))),r}function qTe({node:e,data:t,pointer:n,path:r}){if(t!==void 0&&e.if!=null){if(Ia(e.if,t,n,[...r??[]])){if(e.then){let{node:o}=e.then.reduceNode(t);if(o){let i=o.dynamicId?.replace(e.dynamicId,"").replace(/^#/,"")??"",a=i===""?"(then)":i,s=Hu(e.then.schema,o.schema,"if","then","else");return e.compileSchema(s,e.then.evaluationPath,e.schemaLocation,`${e.schemaLocation}${a}`)}}}else if(e.else){let{node:o}=e.else.reduceNode(t);if(o){let i=o.dynamicId?.replace(e.dynamicId,"")??"",a=i===""?"(else)":i,s=Hu(e.else.schema,o.schema,"if","then","else");return e.compileSchema(s,e.else.evaluationPath,e.schemaLocation,`${e.schemaLocation}${a}`)}}}}function UTe({node:e,data:t,pointer:n,path:r}){if(e.if!=null){if(Ia(e.if,t,n,[...r??[]])){if(e.then)return oo(e.then,t,n,r)}else if(e.else)return oo(e.else,t,n,r)}}var WTe=x1({version:"draft-07",$schemaRegEx:"draft-?0?7",$schema:"http://json-schema.org/draft-07/schema#",errors:kS,formats:uv,methods:{createSchema:Mh,getData:xP,getChildSelection:kP,toDataNodes:fv},keywords:[rO,gS,vS,CP,iO,mS,bS,yS,wS,_P,PP,pS,cO,SP,SS,CS,_S,PS,ES,AS,IS,TS,RS,DS,OS,MS,NS,FS,LS,BS,$S,xS,wP,hS]}),GTe={id:"$ref",keyword:"$ref",parse:KTe,addValidate:({schema:e})=>e.$ref!=null||e.$recursiveRef!=null,validate:YTe,addReduce:({schema:e})=>e.$ref!=null||e.$recursiveRef!=null,reduce:hQ};function dQ(e,t){e.context.refs[t]??(e.context.refs[t]=e)}function KTe(e){e.resolveRef=JTe;let t=Ao(e.parent?.$id,e.schema?.$id);e.$id=t,e.lastIdPointer=e.parent?.lastIdPointer??"#",t!==e.parent?.$id&&e.evaluationPath!=="#"&&(e.lastIdPointer=e.evaluationPath),e.lastIdPointer!=="#"&&e.evaluationPath.startsWith(e.lastIdPointer)&&dQ(e,Ao(t,`#${e.evaluationPath.replace(e.lastIdPointer,"")}`)),dQ(e,Ao(e.context.rootNode.$id,e.evaluationPath)),e.schema.$anchor&&(e.context.anchors[`${t.replace(/#$/,"")}#${e.schema.$anchor}`]=e),e.schema.$ref&&(e.$ref=Ao(t,e.schema.$ref),e.$ref.startsWith("/")&&(e.$ref=`#${e.$ref}`))}function JTe({pointer:e,path:t}={}){if(this.schema.$recursiveRef){let r=ZTe(this,t??[]);return zo(r)&&t?.push({pointer:e,node:r}),r}if(this.$ref==null)return this;let n=fS(this);return zo(n)&&t?.push({pointer:e,node:n}),n}function YTe({node:e,data:t,pointer:n="#",path:r}){let o=e.resolveRef({pointer:n,path:r});return o==null?e.createError("ref-error",{ref:e.schema.$ref??e.schema.$recursiveRef,pointer:n,schema:e.schema,value:t}):oo(o,t,n,r)}function ZTe(e,t){let n=t,r=0;for(let i=n.length-1;i>=0;i--){if(n[i].node.schema.$recursiveAnchor===!1)return fS(e,Ao(e.$id,e.schema.$recursiveRef));if(/^https?:\/\//.test(n[i].node.schema.$id??"")&&n[i].node.schema.$recursiveAnchor!==!0){r=i;break}}let o=n.find((i,a)=>a>=r&&i.node.schema.$recursiveAnchor===!0);return o?o.node:fS(e,Ao(e.$id,e.schema.$recursiveRef))}function fS(e,t=e?.$ref){if(t==null)return e;if(e.context.refs[t])return Md(e.context.refs[t],e);if(e.context.anchors[t])return Md(e.context.anchors[t],e);let n=nO(t);if(n.length===0)return e.createError("ref-error",{ref:t,pointer:e.evaluationPath,schema:e.schema,value:void 0});if(n.length===1){let r=n[0];if(e.context.remotes[r])return Md(e.context.remotes[r],e);if(r[0]==="#"){let o=r.match(/#[^#]*$/)?.pop(),i=e.context.rootNode.schema,a=hP(i,o);if(a)return e.compileSchema(a,`${e.evaluationPath}/$ref`,o)}return e.createError("ref-error",{ref:r,pointer:e.evaluationPath,schema:e.schema,value:void 0})}if(n.length===2){let r=n[0];if(e.context.remotes[r]&&e!==e.context.remotes[r]){let{isolated:o,remotes:i}=e.context,a=i[r],s=o===!0?pv(a,i):a,l=fS(s,t);if(l||(l=fS(s,n[1]),l))return l}if(e.context.refs[r]){let o=e.context.refs[r],i=v1(n[1]),a=o;for(let s of i)if(a=a[s==="definitions"?"$defs":s],a==null)return e.createError("ref-error",{ref:t,pointer:e.evaluationPath,schema:e.schema,value:void 0,host:n[0],local:n[1]});return e.context.isolated===!0?Md(a,e):a}}return e.createError("ref-error",{ref:t,pointer:e.evaluationPath,schema:e.schema,value:void 0})}var w1="unevaluatedItems",XTe={id:w1,keyword:w1,parse:QTe,addValidate:({schema:e})=>e[w1]!=null,validate:e7e};function QTe(e){let{unevaluatedItems:t}=e.schema;if(t!=null&&typeof t!="boolean"){if(!Lt(t))return e.createError("schema-error",{pointer:e.evaluationPath,schema:e.schema,value:void 0,message:`Keyword '${w1}' must be an object - received '${typeof t}'`});e.unevaluatedItems=e.compileSchema(e.schema.unevaluatedItems,`${e.evaluationPath}/${w1}`,`${e.schemaLocation}/${w1}`)}}function e7e({node:e,data:t,pointer:n,path:r}){let{schema:o}=e;if(!Array.isArray(t)||t.length===0||o.unevaluatedItems==null||o.unevaluatedItems===!0)return;let{node:i}=e.reduceNode(t,{pointer:n,path:r});if(i??=e,i.schema.unevaluatedItems===!0||i.schema.additionalItems===!0)return;let a=e.if!=null&&Ia(e.if,t,n,r),s=[];for(let l=0;l<t.length;l+=1){let c=t[l],{node:d}=e.getNodeChild(l,t,{path:r});if(d&&!Ia(d,c,`${n}/${l}`,r)){let u=e.unevaluatedItems;if(u&&t.forEach(f=>{let p=oo(u,f,`${n}/${l}`,r);if(p!=null){if(Array.isArray(p))return s.push(...p);s.push(p)}}),e.schema.unevaluatedItems===!1)return e.createError("unevaluated-items-error",{pointer:`${n}/${l}`,value:JSON.stringify(c),schema:o})}if(d===void 0&&!(a&&e.if.prefixItems&&e.if.prefixItems.length>l))if(e.unevaluatedItems){let u=oo(e.unevaluatedItems,c,`${n}/${l}`,r);u.length>0&&s.push(...u)}else s.push(e.createError("unevaluated-items-error",{pointer:`${n}/${l}`,value:JSON.stringify(c),schema:o}))}return s}function Ch({node:e,data:t,key:n,pointer:r,path:o}){if(Array.isArray(e.schema.required)&&!e.schema.required.find(a=>cv(t,a)))return!1;if(e.schema.unevaluatedProperties===!0||e.schema.additionalProperties===!0||e.properties?.[n]&&e.properties[n].validate(t[n],r,o).valid||e.patternProperties&&e.patternProperties.find(a=>a.pattern.test(n)))return!0;if(e.allOf){for(let a of e.allOf)if(Ch({node:a,data:t,key:n,pointer:r,path:o}))return!0}if(e.anyOf){for(let a of e.anyOf)if(Ia(a,t,r,o)&&Ch({node:a,data:t,key:n,pointer:r,path:o}))return!0}if(e.oneOf){for(let a of e.oneOf)if(Ia(a,t,r,o)&&Ch({node:a,data:t,key:n,pointer:r,path:o}))return!0}if(e.if){let a=Ia(e.if,t,r,o);if(a&&Ch({node:e.if,data:t,key:n,pointer:r,path:o}))return!0;if(a&&e.then){if(Ch({node:e.then,data:t,key:n,pointer:r,path:o}))return!0}else if(!a&&e.else&&Ch({node:e.else,data:t,key:n,pointer:r,path:o}))return!0}let i=e.resolveRef({pointer:r,path:o});return!!(i!==e&&Ch({node:i,data:t,key:n,pointer:r,path:o}))}var Ph="unevaluatedProperties",IQ={id:Ph,keyword:Ph,parse:t7e,addValidate:({schema:e})=>e[Ph]!=null,validate:n7e};function t7e(e){let t=e.schema[Ph];if(t!=null){if(!(Is(t)||rs(t)))return e.createError("schema-error",{pointer:`${e.schemaLocation}/${Ph}`,schema:e.schema,value:t,message:`Keyword '${Ph}' must be a valid JSON Schema - received '${typeof t}'`});if(!rs(t))return e.unevaluatedProperties=e.compileSchema(e.schema.unevaluatedProperties,`${e.evaluationPath}/${Ph}`,`${e.schemaLocation}/${Ph}`),e.unevaluatedProperties.schemaValidation}}function n7e({node:e,data:t,pointer:n,path:r}){if(!Lt(t))return;let o=Object.keys(t).filter(a=>t[a]!==void 0);if(o.length===0)return;let i=[];for(let a of o){if(e.properties?.[a]||Ch({node:e,data:t,key:a,pointer:n,path:r}))continue;let{node:s}=e.getNodeChild(a,t,{pointer:n,path:r});if(s===void 0)if(e.unevaluatedProperties){let l=oo(e.unevaluatedProperties,t[a],na(n,a),r);i.push(...l)}else e.schema.unevaluatedProperties===!1&&i.push(e.createError("unevaluated-property-error",{pointer:na(n,a),value:JSON.stringify(t[a]),schema:e.schema}));if(s&&!Ia(s,t[a],na(n,a),r))if(e.unevaluatedProperties){let l=oo(e.unevaluatedProperties,t[a],na(n,a),r);i.push(...l)}else e.schema.unevaluatedProperties===!1&&i.push(e.createError("unevaluated-property-error",{pointer:na(n,a),value:JSON.stringify(t[a]),schema:e.schema}))}return i}var r7e=x1({version:"draft-2019-09",$schemaRegEx:"draft[/-]2019-?(09)?",$schema:"https://json-schema.org/draft/2019-09/schema",errors:kS,formats:uv,methods:{createSchema:Mh,getData:xP,getChildSelection:kP,toDataNodes:fv},keywords:[GTe,gS,vS,CP,oO,mS,bS,yQ,kQ,yS,wS,_P,PP,pS,cO,SP,SS,CS,_S,PS,ES,AS,IS,TS,RS,DS,OS,MS,NS,FS,LS,BS,XTe,IQ,$S,xS,wP,hS]});function o7e(e,t){if(e.items){let o=e.items.resolveRef();if(o?.oneOf)return o.oneOf.map(i=>i.resolveRef())}if(e.oneOf)return e.oneOf.map(o=>o.resolveRef());if(e.prefixItems&&e.prefixItems.length>+t){let{node:o,error:i}=e.getNodeChild(t);return zo(o)?[o]:i}if(e.schema.items===!0)return[e.compileSchema({type:"string"})];if(e.schema.items===!1)return[];if(e.items)return[e.items.resolveRef()];if(e.prefixItems&&e.prefixItems.length<=+t)return[];let{node:n,error:r}=e.getNodeChild(t);return r??[n]}function i7e(e,t){if(e.$ref==null)return;t.cache=t.cache??{};let{cache:n,recursionLimit:r=1}=t,o=e.schemaLocation;if(n[o]=n[o]??{},n[o][e.$ref]=n[o][e.$ref]??0,n[o][e.$ref]>=r&&t.disableRecursionLimit!==!0)return!1;t.disableRecursionLimit=!1,n[o][e.$ref]+=1;let i=e.resolveRef();if(i&&i!==e)return i}function K8(e,t){return(t.cache?.[e.schemaLocation]?.[e.$ref]??-1)<(t.recursionLimit??1)}function a7e(e,t){let n=$i(t);if(e===void 0||t==null||n===e||n==="number"&&e==="integer")return t;if(e==="string")return JSON.stringify(t);if(n!=="string")return t;try{let r=JSON.parse(t);if($i(r)===e)return r}catch{}return t}function s7e(e,t,n){if(n?.cache==null)throw Error("Missing options");if(e.schema===!1||e.schema===!0||lO(t))return t;if(e.schema?.const!==void 0)return e.schema?.const;let r=e,o=t;if(Array.isArray(e.schema.enum)&&e.schema.enum.length>0&&t===void 0)return e.schema.default??e.schema.enum[0];if(e.schema.default!==void 0&&o===void 0&&(o=e.schema.default),r.allOf?.length&&r.allOf.forEach(l=>{o=l.getData(o,n)??o}),r.anyOf&&r.anyOf?.length>0&&(o=r.anyOf[0].getData(o,n)??o),r.oneOf&&r.oneOf?.length>0)if(SQ(o))r=ta(r,r.oneOf[0]);else{let l=sO({node:r,data:o,path:[],pointer:"#"});if(qc(l)){if(o!=null&&n.removeInvalidData!==!0)return o;r=r.oneOf[0],o=void 0}else r=ta(r,l)}let i=i7e(r,n);if(i===!1)return o;zo(i)&&(o=i.getData(o,n)??o,r=i);let a=tv(r,o),s=l7e[a]?.(r,o,n);return s===void 0?o:s}var l7e={null:(e,t,n)=>aS(e,t,null,n.useTypeDefaults),string:(e,t,n)=>aS(e,t,"",n.useTypeDefaults),number:(e,t,n)=>aS(e,t,0,n.useTypeDefaults),integer:(e,t,n)=>aS(e,t,0,n.useTypeDefaults),boolean:(e,t,n)=>aS(e,t,!1,n.useTypeDefaults),object:(e,t,n)=>{let r=e.schema,o=r.default===void 0?{}:r.default,i=Object.create(null),a=n.extendDefaults===!1&&r.default!==void 0?[]:r.required??[],s=e.properties;s&&Object.keys(s).forEach(d=>{let u=s[d],f=a.includes(d),p=nr(t,d),m=t===void 0||p===void 0?nr(o,d):p;if(m!==void 0||f||n.addOptionalProps){let h=u.getData(m,n),g=$i(h);if(n.removeInvalidData&&g!=="object"&&g!=="array"&&!u.validate(h).valid)return;(h!==void 0||n.useTypeDefaults!==!1)&&(i[d]=h)}});let l=e.dependentRequired;Lt(l)&&Object.keys(l).forEach(d=>{let u=l[d];nr(i,d)!==void 0&&u.forEach(f=>{let{node:p}=e.getNodeChild(f,i);p&&(i[f]=p.getData(nr(i,f),n))})});let c=e.dependentSchemas;if(c&&Object.keys(c).forEach(d=>{let u=c[d];if(i[d]!==void 0&&zo(u)){let f=u.getData(t??i,n);Object.assign(i,f)}}),t&&(n.removeInvalidData===!0&&(r.additionalProperties===!1||Lt(r.additionalProperties))?zo(e.additionalProperties)&&Object.keys(t).forEach(d=>{if(i[d]==null){let u=nr(t,d);e.additionalProperties?.validate(u).valid&&(i[d]=u)}}):Object.keys(t).forEach(d=>{let u=$i(d);if(n.removeInvalidData&&e.properties&&e.properties[d]&&u!=="object"&&u!=="array"){let f=e.properties[d],p=f.getData(nr(t,d),n);if(!f.validate(p).valid)return}i[d]??(i[d]=nr(t,d))})),e.if){let{errors:d}=e.if.validate(i);if(d.length===0&&e.then){let u=e.then.getData(i,n);Object.assign(i,u)}else if(d.length>0&&e.else){let u=e.else.getData(i,n);Object.assign(i,u)}}return{...o,...i}},array:(e,t,n)=>{let r=e.schema,o=r.default===void 0?[]:r.default,i=Array.isArray(t)?[...t]:o,a=n.extendDefaults===!1&&r.default!==void 0?0:r.minItems??0;if(r.prefixItems==null){if(e.items&&(K8(e.items,n)||i?.length>0)){let s={...n.cache},l=Math.max(a,i.length);for(let c=0;c<l;c+=1){n.cache=g1(s);let d={...n,disableRecursionLimit:!0};i[c]=e.items.getData(i[c]==null?o[c]:i[c],d)}}return i||[]}if(e.prefixItems){let s=Array.isArray(t)?t:[],l=Math.max(a??0,e.prefixItems.length);for(let c=0;c<l;c+=1){let d=e.prefixItems[c]??e.items;if(d&&K8(d,n)||s[c]!==void 0){let u=d.getData(i[c]==null?o[c]:i[c],n);u!==void 0&&(i[c]=u)}}return i||[]}if(e.items==null)return i;if(e.items&&K8(e.items,n)||t?.length>0){let s={...n.cache};for(let l=0,c=Math.max(a,i.length);l<c;l+=1){n.cache=g1(s);let d={...n,disableRecursionLimit:!0},u=e.items.getData(i[l]==null?o[l]:i[l],d);if(u===void 0)return i;i[l]=u}}return i}};function aS({schema:e},t,n,r){return t===void 0?e.const?e.const:e.default===void 0&&Array.isArray(e.enum)?e.enum[0]:e.default===void 0&&r!==!1?n:e.default:a7e(e.type,t)}var ju="items",c7e={id:ju,keyword:ju,parse:u7e,addResolve:e=>e[ju]!=null,resolve:d7e,addValidate:e=>e[ju]!=null,validate:f7e};function d7e({node:e,key:t}){if(!(e.prefixItems&&e.prefixItems?.length>+t))return e.items}function u7e(e){let t=e.schema[ju];if(t!=null){if(!(Is(t)||rs(t)))return e.createError("schema-error",{pointer:`${e.schemaLocation}/${ju}`,schema:e.schema,value:t,message:`Keyword '${ju}' must be a valid JSON Schema - received '${typeof t}'`});if(t!==!0)return e[ju]=e.compileSchema(t,`${e.evaluationPath}/${ju}`,`${e.schemaLocation}/${ju}`),e[ju].schemaValidation}}function f7e({node:e,data:t,pointer:n="#",path:r}){let{schema:o}=e;if(!Array.isArray(t)||t.length===0||Array.isArray(o.prefixItems)&&o.prefixItems.length>=t.length)return;if(o.items===!1)return Array.isArray(t)&&t.length===0?void 0:e.createError("invalid-data-error",{pointer:n,value:t,schema:o});let i=[];if(e.items){for(let a=o.prefixItems?.length??0;a<t.length;a+=1){let s=t[a],l=oo(e.items,s,`${n}/${a}`,r);l&&i.push(...l)}return i}}var lv="prefixItems",p7e={id:lv,keyword:lv,parse:h7e,addResolve:e=>e[lv]!=null,resolve:m7e,addValidate:e=>e[lv]!=null,validate:g7e};function m7e({node:e,key:t}){if(e.prefixItems&&e.prefixItems[t])return e.prefixItems[t]}function h7e(e){let{schema:t,evaluationPath:n}=e;if(Array.isArray(t.prefixItems))return e.prefixItems=t.prefixItems.map((r,o)=>e.compileSchema(r,`${n}/${lv}/${o}`,`${e.schemaLocation}/${lv}/${o}`)),Uc([],...e.prefixItems)}function g7e({node:e,data:t,pointer:n="#",path:r}){if(!Array.isArray(t)||t.length===0)return;let o=[],i=e[lv];if(i){for(let a=0;a<Math.min(i.length,t.length);a+=1){let s=t[a],l=i[a],c=oo(l,s,`${n}/${a}`,r);o.push(...c)}return o}}function ev({node:e,data:t,key:n,pointer:r,path:o}){let i=nr(t,n);if(e.schema.unevaluatedItems===!0||e.schema.items===!0||e.contains&&Ia(e.contains,i,`${r}/${n}`,o))return!0;if(e.allOf){for(let a of e.allOf)if(ev({node:a,data:t,key:n,pointer:r,path:o}))return!0}if(e.anyOf){for(let a of e.anyOf)if(Ia(a,t,r,o)&&ev({node:a,data:t,key:n,pointer:r,path:o}))return!0}if(e.oneOf){for(let a of e.oneOf)if(Ia(a,t,r,o)&&ev({node:a,data:t,key:n,pointer:r,path:o}))return!0}if(e.if){let a=Ia(e.if,t,r,o);if(a&&ev({node:e.if,data:t,key:n,pointer:r,path:o})||a&&e.if.prefixItems&&e.if.prefixItems.length>n)return!0;if(a&&e.then){if(ev({node:e.then,data:t,key:n,pointer:r,path:o}))return!0}else if(!a&&e.else&&ev({node:e.else,data:t,key:n,pointer:r,path:o}))return!0}}var nv="unevaluatedItems",v7e={id:nv,keyword:nv,parse:b7e,addValidate:({schema:e})=>e.unevaluatedItems!=null,validate:y7e};function b7e(e){let t=e.schema[nv];if(t!=null){if(!(Is(t)||rs(t)))return e.createError("schema-error",{pointer:`${e.schemaLocation}/${nv}`,schema:e.schema,value:t,message:`Keyword '${nv}' must be a valid JSON Schema - received '${typeof t}'`});if(!rs(t))return e.unevaluatedItems=e.compileSchema(e.schema.unevaluatedItems,`${e.evaluationPath}/${nv}`,`${e.schemaLocation}/${nv}`),e.unevaluatedItems.schemaValidation}}function y7e({node:e,data:t,pointer:n,path:r}){let{schema:o}=e;if(!Array.isArray(t)||t.length===0||o.unevaluatedItems==null||o.unevaluatedItems===!0)return;let i=[];for(let a=0;a<t.length;a+=1){if(ev({node:e,data:t,pointer:n,key:a,path:r}))continue;let s=t[a],{node:l}=e.getNodeChild(a,t,{path:r});if(l===void 0)if(e.unevaluatedItems){let c=oo(e.unevaluatedItems,s,`${n}/${a}`,r);c.length>0&&i.push(...c)}else i.push(e.createError("unevaluated-items-error",{pointer:`${n}/${a}`,value:JSON.stringify(s),schema:o}));if(l&&!Ia(l,s,`${n}/${a}`,r)&&(e.unevaluatedItems&&e.unevaluatedItems.validate(s,`${n}/${a}`,r).valid===!1||e.schema.unevaluatedItems===!1))return e.createError("unevaluated-items-error",{pointer:`${n}/${a}`,value:JSON.stringify(s),schema:o})}return i}var EP=x1({version:"draft-2020-12",$schemaRegEx:"draft[/-]2020-?(12)?",$schema:"https://json-schema.org/draft/2020-12/schema",errors:kS,formats:uv,methods:{createSchema:Mh,getData:s7e,getChildSelection:o7e,toDataNodes:fv},keywords:[$Ae,hS,gS,vS,CP,oO,mS,bS,yQ,kQ,yS,wS,_P,PP,pS,cO,c7e,SS,CS,_S,PS,ES,AS,IS,TS,RS,DS,xS,MS,OS,p7e,NS,FS,LS,BS,v7e,IQ,$S]}),{REGEX_FLAGS:w7e}=Nh,k7e=[FTe,VTe,WTe,r7e,EP];function x7e(e,t){return e.find(n=>new RegExp(n.$schemaRegEx,w7e).test(t))??e[e.length-1]}function dO(e,t={}){let n=t.remote;if(Array.isArray(t.remotes)&&t.remotes.length>0&&!t.remote){let d=[...t.remotes];d.forEach((u,f)=>{if(u.$id==null)throw Error(`required $id on remotes[${f}] is missing`)}),n=dO(d.shift(),{formatAssertion:t.formatAssertion}),d.forEach(u=>n?.addRemoteSchema(u.$id,u))}let r=t.formatAssertion??!0,o=t.drafts??k7e,i=x7e(o,Is(e)?e.$schema??t.draft:void 0),a={evaluationPath:"#",lastIdPointer:"#",schemaLocation:"#",dynamicId:"",reducers:[],resolvers:[],validators:[],schema:e,context:{remotes:{},dynamicAnchors:{},...n?.context??{},anchors:{},refs:{},...g1(eO(i,"methods","keywords","version","formats","errors")),draft:t.draft,getDataDefaultOptions:t.getDataDefaultOptions,throwOnInvalidRef:t.throwOnInvalidRef??!1,drafts:o},...Z8};if(a.context.rootNode=a,a.context.remotes[(Is(e)?e.$id:void 0)??"#"]=a,n){let d=dS(a,a.schema.$schema);if(zo(d)&&d.schema.$vocabulary){let u=Object.keys(d.schema.$vocabulary).find(p=>p.includes("vocab/format-assertion"));u&&r==="meta-schema"&&(r=d.schema.$vocabulary[u]===!0);let f=Object.keys(d.getData({},{addOptionalProps:!0}));f.length>0&&(a.context.keywords=a.context.keywords.filter(p=>f.includes(p.keyword)))}}if(a.context.formatAssertion=r,mQ(a.context),!Is(e)&&!rs(e))return a.schemaErrors=[a.createError("schema-error",{pointer:"#",schema:e,value:void 0,message:`JSON schema must be object or boolean - reveived: '${e}'`})],a;let s=X8(a).filter(d=>d!=null);s=Dd(s);let l=[],c=[];if(s.forEach(d=>{qc(d)?(d.data.schemaId=a.context.rootNode.$id??"#",l.push(d)):Up(d)&&(d.data.schemaId=a.context.rootNode.$id??"#",c.push(d))}),Array.isArray(n?.schemaErrors)&&l.push(...n.schemaErrors),Array.isArray(n?.schemaAnnotations)&&c.push(...n.schemaAnnotations),t.throwOnInvalidSchema&&l.length>0){let d=Error("Invalid schema passed to compileSchema");throw d.data=l,d}return a.schemaErrors=l,a.schemaAnnotations=c,a}var rmt=ATe(EP,{$schemaRegEx:".",keywords:[FIe],errors:{"min-length-error":e=>e.minLength===1?{type:"error",code:"min-length-one-error",message:"An input is required",data:e}:{type:"error",code:"min-length-error",message:Y8("Value in `{{pointer}}` is `{{length}}`, but should be `{{minLength}}` at minimum",e),data:e}}});function zS(e){let t=structuredClone(e),n=i=>!!(i&&typeof i=="object"&&!Array.isArray(i)),r=0,o=(i,a)=>{if(n(i)){if(a>64||++r>5e4)throw new Error("parameter-schema-limit");i.readOnly===!1&&delete i.readOnly;for(let s of["$defs","definitions","properties","patternProperties","dependentSchemas"]){let l=i[s];if(n(l))for(let c of Object.values(l))o(c,a+1)}if(n(i.dependencies))for(let s of Object.values(i.dependencies))Array.isArray(s)||o(s,a+1);for(let s of["items","additionalItems","additionalProperties","unevaluatedItems","unevaluatedProperties","contains","not","if","then","else","propertyNames","contentSchema"]){let l=i[s];if(Array.isArray(l))for(let c of l)o(c,a+1);else o(l,a+1)}for(let s of["allOf","anyOf","oneOf","prefixItems"])if(Array.isArray(i[s]))for(let l of i[s])o(l,a+1)}};return o(t,0),t}function S1(e,t,n){if(n.length>64||n.some(o=>typeof o!="string"&&(typeof o!="number"||!Number.isSafeInteger(o)||o<0)))return{available:!1,public:!1,readOnly:!1,reason:"invalid-path"};let r=!1;try{let o=dO(zS(e),{drafts:[EP],draft:"draft-2020-12",throwOnInvalidSchema:!0,throwOnInvalidRef:!0}),i=l=>typeof l.code=="string"&&["one-of-error","any-of-error"].includes(l.code)?"value-unresolved":"path-unavailable",a="",s=t;for(let l=0;l<=n.length;l++){let c=o.getNode(a,t,{createSchema:!1});if(c.error)return{available:!1,public:!1,readOnly:r,reason:i(c.error)};if(!c.node)return{available:!0,public:!1,readOnly:r};typeof c.node.schema=="object"&&c.node.schema.readOnly===!0&&(r=!0);let d=c.node.reduceNode(s);if(d.error)return{available:!1,public:!1,readOnly:r,reason:i(d.error)};if(!d.node)return{available:!1,public:!1,readOnly:r,reason:"path-unavailable"};if(typeof d.node.schema=="object"&&d.node.schema.readOnly===!0&&(r=!0),l===n.length)return{available:!0,public:!0,readOnly:r};let u=n[l];a+=`/${String(u).replace(/~/g,"~0").replace(/\//g,"~1")}`,s=s!==null&&typeof s=="object"&&Object.hasOwn(s,u)?s[u]:void 0}}catch{return{available:!1,public:!1,readOnly:r,reason:"schema-unavailable"}}return{available:!1,public:!1,readOnly:r,reason:"path-unavailable"}}function Uu(e,t,n=[]){try{let r=new vh(structuredClone(e),"2020-12",!1);for(let i of n)r.addSchema(structuredClone(typeof i.schema=="boolean"?{allOf:[i.schema]}:i.schema),i.id);let o=r.validate(t);return{available:!0,valid:o.valid,issues:o.errors.slice(0,10).map(i=>({path:i.instanceLocation.replace(/^#/,""),keyword:i.keyword,message:i.error,schemaPath:i.keywordLocation}))}}catch(r){return{available:!1,valid:!1,issues:[{path:"",keyword:"schema-unavailable",message:r instanceof Error?r.message:"This parameter schema cannot be validated."}]}}}var S7e=new vh(X2,"2020-12",!1),uO=e=>e.replaceAll("~","~0").replaceAll("/","~1"),Si=(e,t)=>`${e}/${uO(String(t))}`,jS=(e,t)=>Object.hasOwn(e,t);function sc(e){let t=[],n=(P,I,T,_="error")=>{t.push({path:P,code:I,message:T,severity:_})},r=new WeakSet,o=0,i=(P,I,T=0)=>{if(++o>1e6||T>128)return n(I,"json.limit","The document exceeds the supported JSON size or nesting limit."),!1;if(P===null||typeof P=="string"||typeof P=="boolean")return!0;if(typeof P=="number")return Number.isFinite(P)?!0:(n(I,"json.number","JSON numbers must be finite."),!1);if(typeof P!="object")return n(I,"json.value","A document contains only JSON values."),!1;if(r.has(P))return n(I,"json.cycle","A JSON value cannot contain an object cycle."),!1;if(!Array.isArray(P)&&![Object.prototype,null].includes(Object.getPrototypeOf(P)))return n(I,"json.object","A JSON object cannot have a custom object prototype."),!1;r.add(P);let _=Object.entries(P).every(([A,D])=>i(D,Si(I,A),T+1));return r.delete(P),_};if(!i(e,""))return{issues:t};let a;try{a=S7e.validate(e)}catch(P){return n("","schema.invalid",P instanceof Error?P.message:"Document schema validation failed."),{issues:t}}if(!a.valid){for(let P of a.errors.slice(0,100))n(P.instanceLocation.replace(/^#/,""),`schema.${P.keyword}`,P.error);return{issues:t}}let s=e,l=s.metadata.renderers?.lecture;bt(l)&&jS(l,"script")&&n("/metadata/renderers/lecture/script","narration.external-source","External lecture scripts are not supported. Author narration in lecture.json narrations and bind it through each step narrationIds.");let c=new Map(Object.keys(s.sections).map(P=>[`page:${P}`,P])),d=new Map,u=(P,I)=>{let T=c.get(P);T!==void 0&&n(I,"id.reserved",`ID ${P} is reserved for the title of section ${T}.`);let _=d.get(P);_!==void 0?n(I,"id.duplicate",`ID ${P} is already used at ${_}.`):d.set(P,I)};u(s.id,"/id");for(let P of["sections","blocks","steps","narrations","assets","definitions"])for(let[I,T]of Object.entries(s[P])){let _=Si(`/${P}`,I);T.id!==I&&n(`${_}/id`,"id.key","An entity ID must match its map key."),u(T.id,`${_}/id`)}let f=(P,I,T,_)=>jS(P,I)?!0:(n(T,"reference.missing",`Unknown ${_} ${I}.`),!1);for(let[P,I]of s.sectionOrder.entries())f(s.sections,I,`/sectionOrder/${P}`,"section");for(let P of Object.keys(s.sections))s.sectionOrder.includes(P)||n(Si("/sections",P),"section.order","Every section must appear once in sectionOrder.");let p=new Map,m=new Map,h=new Set,g=(P,I,T)=>{if(!f(s.blocks,P,I,"block"))return;if(h.has(P)){n(I,"block.cycle","Block ownership cannot contain a cycle.");return}if(p.has(P)){n(I,"block.parent",`Block ${P} already belongs to ${p.get(P)}.`);return}p.set(P,I),m.set(P,T),h.add(P);let _=s.blocks[P];if(_.type==="container"||_.type==="component")for(let[A,D]of(_.children??[]).entries())g(D,Si(Si("/blocks",P),"children")+`/${A}`,T);h.delete(P)};for(let[P,I]of Object.entries(s.sections))for(let[T,_]of I.children.entries())g(_,Si("/sections",P)+`/children/${T}`,P);for(let P of Object.keys(s.blocks))p.has(P)||n(Si("/blocks",P),"block.orphan","Every content block must have one section or container parent.");let v=new Map,b=(P,I,T)=>{if(u(P.id,`${I}/id`),T.add(P.id),P.type==="table"){let _=P;(_.headerRows??0)>_.children.length&&n(`${I}/headerRows`,"table.header","Header rows cannot exceed table rows.");let A=[],D=_.children.map((N,O)=>{A=A.filter(K=>K.until>O).sort((K,z)=>K.from-z.from);let M=0,$=0,j=[];for(let[K,z]of N.children.entries()){let G=`${I}/children/${O}/children/${K}`,U=z.colspan??1,H=z.rowspan??1;if(!Number.isSafeInteger(U)||!Number.isSafeInteger(H)){n(G,"table.span","Cell spans must be safe positive integers.");continue}for(;A[$]&&A[$].from<=M;)M=Math.max(M,A[$].to),$++;let F=M+U,L=A[$]&&A[$].from<F;L&&n(G,"table.overlap","A cell cannot overlap a cell spanning from an earlier row."),O+H>_.children.length&&n(`${G}/rowspan`,"table.span","A row span cannot extend beyond the table rows."),(!Number.isSafeInteger(F)||_.columnWidths&&F>_.columnWidths.length)&&n(`${G}/colspan`,"table.span","A cell span cannot extend beyond the declared table columns."),H>1&&!L&&j.push({from:M,to:F,until:O+H}),M=F}let W=A.reduce((K,z)=>Math.max(K,z.to),M);return A.push(...j),W});_.headerColumns!==void 0&&D.some(N=>_.headerColumns>N)&&n(`${I}/headerColumns`,"table.header","Header columns cannot exceed table columns."),_.columnWidths&&D.some(N=>N!==_.columnWidths.length)&&n(`${I}/columnWidths`,"table.widths","Column widths must match the logical table columns.")}if("children"in P&&Array.isArray(P.children))for(let[_,A]of P.children.entries())bt(A)&&typeof A.id=="string"&&b(A,`${I}/children/${_}`,T);P.type==="extension"&&"fallback"in P&&Array.isArray(P.fallback)&&P.fallback.forEach((_,A)=>b(_,`${I}/fallback/${A}`,T))},y=(P,I,T)=>{let _=Uu(P,I);for(let A of _.issues)n(T+A.path,_.available?"parameters.schema":"parameters.schema-unavailable",A.message)};for(let[P,I]of Object.entries(s.blocks)){let T=Si("/blocks",P);if(I.type==="text"){let _=new Set;v.set(P,_),I.content.forEach((A,D)=>b(A,`${T}/content/${D}`,_));for(let[A,D]of(I.reveal?.order??[]).entries())_.has(D)||n(`${T}/reveal/order/${A}`,"reveal.target","Reveal items must name rich-text nodes of this block.")}else if(I.type==="image")I.assetId!==void 0&&f(s.assets,I.assetId,`${T}/assetId`,"asset")&&s.assets[I.assetId].kind!=="image"&&n(`${T}/assetId`,"asset.kind","An image block requires an image asset.");else if(I.type==="component")f(s.definitions,I.definitionId,`${T}/definitionId`,"definition")&&y(s.definitions[I.definitionId].parameterSchema,I.parameters,`${T}/parameters`);else if(I.type==="code"){I.highlight&&I.origin?.highlightRegions&&n(`${T}/highlight`,"code.highlight-owner","Choose authored line numbers or tracked source regions, not both.");for(let[_,A]of[["highlight",I.highlight],["origin/highlightRegions",I.origin?.highlightRegions]])for(let D of Object.keys(A??{}))f(s.steps,D,`${T}/${_}/${uO(D)}`,"step")&&s.steps[D].sectionId!==m.get(P)&&n(`${T}/${_}/${uO(D)}`,"code.highlight-section","A code highlight must belong to a step of its own section.");for(let[_,A]of(I.variants??[]).entries())u(A.id,`${T}/variants/${_}/id`)}else I.type==="container"&&(I.properties.columnWidths&&I.properties.columnWidths.length!==I.children.length&&n(`${T}/properties/columnWidths`,"container.columns","Column widths must match the child count."),I.layout==="tabs"&&I.properties.tabTitles&&I.properties.tabTitles.length!==I.children.length&&n(`${T}/properties/tabTitles`,"container.tabs","Tab titles must match the child count."))}for(let[P,I]of Object.entries(s.definitions)){let T=new Set;for(let[_,A]of I.states.entries())T.has(A.id)&&n(Si("/definitions",P)+`/states/${_}/id`,"state.duplicate","Definition state IDs must be unique within the definition."),T.add(A.id)}let w=(P,I=new Set)=>{if(I.has(P)||!jS(s.steps,P))return new Map;I.add(P);let T=s.steps[P],_=T.inherits?w(T.inherits,I):new Map;for(let A of T.visuals)_.set(A.blockId,{..._.get(A.blockId),...A,parameters:{..._.get(A.blockId)?.parameters,...A.parameters}});return _},S=new Set;for(let[P,I]of Object.entries(s.sections))for(let[T,_]of I.stepOrder.entries()){let A=Si("/sections",P)+`/stepOrder/${T}`;S.has(_)&&n(A,"step.owner","A step belongs to one section order."),S.add(_),f(s.steps,_,A,"step")&&s.steps[_].sectionId!==P&&n(A,"step.section","A step must belong to the section that orders it.")}for(let[P,I]of Object.entries(s.steps)){let T=Si("/steps",P);S.has(P)||n(T,"step.orphan","Every step must appear in its section stepOrder."),f(s.sections,I.sectionId,`${T}/sectionId`,"section");let _=new Set;for(let[N,O]of I.visuals.entries()){let M=`${T}/visuals/${N}`;if(_.has(O.blockId)&&n(`${M}/blockId`,"visual.duplicate","A step has one override per block."),_.add(O.blockId),!f(s.blocks,O.blockId,`${M}/blockId`,"block"))continue;m.get(O.blockId)!==I.sectionId&&n(`${M}/blockId`,"visual.section","Visual state must target a block owned by the same section.");let $=w(P).get(O.blockId),j=s.blocks[O.blockId];if(j.type==="component"){let W=s.definitions[j.definitionId];if(W){$.parameters&&y(W.parameterSchema,{...j.parameters,...$.parameters},`${M}/parameters`);let K=$.state===void 0?void 0:W.states.find(z=>z.id===$.state);$.state!==void 0&&!K&&n(`${M}/state`,"state.missing","The component definition does not declare this state."),K?.parameterSchema&&y(K.parameterSchema,{...j.parameters,...$.parameters},`${M}/parameters`)}}else O.state!==void 0&&n(`${M}/state`,"state.unsupported","Named animation states require a component definition.")}for(let[N,O]of I.narrationIds.entries())f(s.narrations,O,`${T}/narrationIds/${N}`,"narration");let A=new Set([P]),D=I.inherits;for(;D!==void 0;){if(A.has(D)){n(`${T}/inherits`,"step.cycle","Step inheritance cannot contain a cycle.");break}if(A.add(D),!f(s.steps,D,`${T}/inherits`,"step"))break;if(s.steps[D].sectionId!==I.sectionId){n(`${T}/inherits`,"step.section","Inherited steps must belong to the same section.");break}D=s.steps[D].inherits}}let x=new Set;for(let[P,I]of Object.entries(s.narrations))if(I.provenance){let T=Si("/narrations",P)+"/provenance/assetId";f(s.assets,I.provenance.assetId,T,"asset")&&s.assets[I.provenance.assetId].kind!=="audio"&&n(T,"asset.kind","Transcription provenance requires the original audio asset.")}for(let[P,I]of Object.entries(s.narrations))for(let[T,_]of I.content.entries())if(_.type==="cue"){let A=Si("/narrations",P)+`/content/${T}`;u(_.id,`${A}/id`),x.add(_.id),_.target&&f(s.blocks,_.target.blockId,`${A}/target/blockId`,"block"),_.parameters&&["pauseMs","durationMs","delayMs"].some(D=>jS(_.parameters,D))&&n(`${A}/parameters`,"production.owner","Cue timing belongs to production.cueTimings.")}let k=(P,I)=>{let T=P.voiceSource;T?.type==="recording"&&f(s.assets,T.assetId,`${I}/voiceSource/assetId`,"asset")&&!["audio","video"].includes(s.assets[T.assetId].kind)&&n(`${I}/voiceSource/assetId`,"asset.kind","Recorded speech requires audio or video."),T?.type==="recording"&&T.sourceRange&&T.sourceRange.endMs<=T.sourceRange.startMs&&n(`${I}/voiceSource/sourceRange`,"media.range","A recording range must end after it starts.")};k(s.production.defaults,"/production/defaults");for(let[P,I]of Object.entries(s.production.sectionOverrides??{}))f(s.sections,P,Si("/production/sectionOverrides",P),"section"),k(I,Si("/production/sectionOverrides",P));for(let[P,I]of Object.entries(s.production.stepOverrides))f(s.steps,P,Si("/production/stepOverrides",P),"step"),k(I,Si("/production/stepOverrides",P));for(let P of Object.keys(s.production.narrationOverrides??{}))f(s.narrations,P,Si("/production/narrationOverrides",P),"narration");for(let P of Object.keys(s.production.cueTimings??{}))x.has(P)||n(Si("/production/cueTimings",P),"cue.missing","Cue timing must reference an authored narration cue.");for(let[P,I]of Object.entries(s.production.captionTimings??{})){let T=s.steps[P],A=!T||JSON.stringify(T.narrationIds)!==JSON.stringify(I.narrationIds)||Vp(s,P)!==I.sourceFingerprint?"caption-source-changed":f1(I,$u(s,P));A&&n(Si("/production/captionTimings",P),"caption.timing-stale","Manual caption timing requires review: "+A,"warning")}for(let[P,I]of s.production.mediaClips.entries()){let T=`/production/mediaClips/${P}`;u(I.id,`${T}/id`),f(s.assets,I.assetId,`${T}/assetId`,"asset")&&!["audio","video"].includes(s.assets[I.assetId].kind)&&n(`${T}/assetId`,"asset.kind","A media clip requires audio or video."),f(s.steps,I.attachment.stepId,`${T}/attachment/stepId`,"step"),I.sourceRange.endMs<=I.sourceRange.startMs&&n(`${T}/sourceRange`,"media.range","A media range must end after it starts.")}let C=s.metadata.renderers?.lecture;C&&["voice","gap","script"].some(P=>jS(C,P))&&n("/metadata/renderers/lecture","production.owner","Voice, narration sources and playback timing belong only to production and narration entities.");let E=new Set([...v.values()].flatMap(P=>[...P]));for(let P of s.sectionOrder)E.add(`page:${P}`);for(let[P,I]of Object.entries(s.blocks))I.type==="code"&&I.value!==void 0&&E.add(P);for(let[P,I]of Object.entries(s.comments??{})){let T=Si("/comments",P);P!==I.id&&n(`${T}/id`,"id.key","A thread ID must match its map key."),u(I.id,`${T}/id`);let _=I.anchor;if(_&&Po(_)){if(!Object.hasOwn(s.blocks,_.blockId))n(`${T}/anchor/blockId`,"comment.target","A place comment must name an existing block.");else if(_.stepId!==void 0){let A=Object.hasOwn(s.steps,_.stepId)?s.steps[_.stepId]:void 0,D=A?s.sections[A.sectionId]:void 0;(!A||!D||!D.stepOrder.includes(_.stepId)||A.sectionId!==Y0(s,_.blockId))&&n(`${T}/anchor/stepId`,"comment.target","A place comment must name a step of the block's own section.")}}else if(_)for(let A of["from","to"])E.has(_[A].blockId)||n(`${T}/anchor/${A}/blockId`,"comment.target","A comment anchor must name a stable rich-text node or section title.");for(let[A,D]of I.comments.entries())u(D.id,`${T}/comments/${A}/id`),D.content?.forEach((N,O)=>b(N,`${T}/comments/${A}/content/${O}`,new Set))}return t.some(P=>P.severity==="error")?{issues:t}:{document:s,issues:t}}var{applyPatch:_7e,compare:DQ}=BX,RP=class extends Error{status;detail;constructor(t,n,r){super(n),this.status=t,this.detail=r}},mv=(e,t)=>JSON.stringify(e)===JSON.stringify(t),Wc=(e,t)=>Object.hasOwn(e,t),ti=(e,t,n)=>{throw new RP(e,t,n)},TQ=e=>"/"+e.map(t=>t.replaceAll("~","~0").replaceAll("/","~1")).join("/"),fO=e=>e.slice(1).split("/").map(t=>t.replaceAll("~1","/").replaceAll("~0","~"));function DP(e,t){let n=Wc(e.blocks,t)?e.blocks[t]:void 0;return n?n.type!=="component"?ti(422,"component-block-type",{blockId:t}):n:ti(404,"component-block-missing",{blockId:t})}function VS(e,t){DP(e,t);let n=Y0(e,t);return n||ti(422,"component-block-owner-missing",{blockId:t})}function pO(e,t,n){let r=Wc(e.steps,t)?e.steps[t]:void 0;return r?r.sectionId!==n?ti(422,"component-step-owner",{stepId:t,sectionId:n}):r:ti(404,"component-step-missing",{stepId:t})}function is(e,t,n){let r=DP(e,t);if(n===void 0)return{parameters:structuredClone(r.parameters)};let o=VS(e,t),i=pO(e,n,o),a=[],s=new Set,l=n;for(;l!==void 0;){if(s.has(l))return ti(422,"component-step-cycle",{stepId:n});s.add(l),a.unshift(l),l=pO(e,l,o).inherits}let c;for(let u of a){let f=e.steps[u].visuals.find(p=>p.blockId===t);f&&(c={...c,...structuredClone(f),parameters:{...c?.parameters,...f.parameters}})}let d=i.visuals.find(u=>u.blockId===t)?.parameters;return{parameters:{...structuredClone(r.parameters),...structuredClone(c?.parameters??{})},...c?{visual:c}:{},...d!==void 0?{ownParameters:structuredClone(d)}:{}}}function TP(e,t){if(!t.length||t.length>32)return ti(422,"component-parameter-change-limit",{limits:{maxChanges:32}});let n=structuredClone(e);for(let[r,o]of t.entries()){let i=o.path;if(!i.length||i.length>16||i.some(c=>typeof c!="string"||c.length>200||c==="__proto__"))return ti(422,"component-parameter-path-invalid",{index:r,limits:{maxPathDepth:16,maxSegmentChars:200}});let a=n;for(let c of i.slice(0,-1)){if(!a||typeof a!="object"||!Wc(a,c)||Array.isArray(a)&&!/^(0|[1-9][0-9]*)$/.test(c))return ti(404,"component-parameter-path-missing",{index:r,path:i});a=a[c]}let s=i.at(-1);if(!a||typeof a!="object")return ti(422,"component-parameter-parent-type",{index:r,path:i});if(Array.isArray(a)&&(!/^(0|[1-9][0-9]*)$/.test(s)||!Number.isSafeInteger(Number(s))||Number(s)>a.length))return ti(422,"component-parameter-array-index",{index:r,path:i});if(o.op==="remove"&&!Wc(a,s))return ti(404,"component-parameter-path-missing",{index:r,path:i});let l=o.op==="remove"?{op:"remove",path:TQ(i)}:{op:Array.isArray(a)&&Wc(a,s)?"replace":"add",path:TQ(i),value:structuredClone(o.value)};try{_7e(n,[l],!0,!0,!0)}catch(c){return ti(422,"component-parameter-path-invalid",{index:r,path:i,reason:c instanceof Error?c.name.slice(0,80):"invalid-patch"})}}return n}var Od=Symbol("absent-parameter");function RQ(e,t,n,r,o=!1,i=[],a=!1){let s=0,l=v=>({path:v.slice(0,8).map(b=>b.slice(0,80)),...v.length>8||v.some(b=>b.length>80)?{pathTruncated:!0}:{}}),c=(v,b,y,w)=>{let S=!1;for(let x of v){let k=S1(x,b,y);if(!k.available)return ti(422,"component-parameter-access-unavailable",{...l(y),reason:k.reason?.slice(0,120),next:"Keep the draft and use an explicitly supported public schema path."});if(k.readOnly)return ti(422,"component-parameter-read-only",l(y));S||=k.public}if(w&&!S)return ti(422,"component-parameter-not-public",l(y))},d=(v,b,y,w=y)=>{v!==Od&&c(n,e,w,!o),(b!==Od||o)&&c(r,t,y,!0)},u=v=>v.map(b=>JSON.stringify(b)),f=(v,b)=>{let y=[],w=0;for(let S=0;S<b.length&&w<v.length;S++)b[S]===v[w]&&(y.push(S),w++);return w===v.length?y:void 0},p=(v,b,y)=>{if(!i.length||i.some(x=>x.path.length<=y.length&&x.path.every((k,C)=>y[C]===k)))return;let w=i.filter(x=>y.every((k,C)=>x.path[C]===k));if(!w.length)return;let S=v.map((x,k)=>k);for(let x of w)if(x.path.length===y.length+1){let k=Number(x.path.at(-1));if(!Number.isSafeInteger(k)||k<0||k>S.length)return;x.op==="remove"?S.splice(k,1):k===S.length&&S.push(-1)}return S.length===b.length?S:void 0},m=v=>v!==Od&&v!==null&&typeof v=="object",h=(v,b,y,w=y)=>{if(!(v!==Od&&b!==Od&&mv(v,b))){if(++s>8192||y.length>128)return ti(422,"component-parameter-access-unavailable",{reason:"change-complexity-limit",limits:{maxChangedNodes:8192,maxInspectionDepth:128},next:"Apply smaller public field changes separately."});if(d(v,b,y,w),Array.isArray(v)&&Array.isArray(b)){let S=u(v),x=u(b);if(S.length===x.length&&mv([...S].sort(),[...x].sort()))return;let k=f(x,S);if(k){let T=new Set(k);for(let _=0;_<v.length;_++)T.has(_)||c(n,e,[...w,String(_)],!0);return}let C=f(S,x);if(C){let T=new Set(C);for(let _=0;_<b.length;_++)T.has(_)||h(Od,b[_],[...y,String(_)],[...w,String(_)]);return}let E=p(v,b,y);if(E){let T=new Set(E);for(let _=0;_<v.length;_++)T.has(_)||c(n,e,[...w,String(_)],!0);for(let[_,A]of E.entries())h(A<0?Od:v[A],b[_],[...y,String(_)],[...w,String(A)]);return}let P=S.flatMap((T,_)=>T===x[_]?[]:[{value:T,index:_}]),I=x.flatMap((T,_)=>T===S[_]?[]:[{value:T,index:_}]);if(!a&&I.some(T=>P.some(_=>T.value===_.value&&T.index!==_.index)))return ti(422,"component-parameter-array-change-unavailable",{...l(y),next:"Apply the exact item reorder and field changes in separate source-bound plans."});for(let T=0;T<Math.max(v.length,b.length);T++)T>=b.length?c(n,e,[...w,String(T)],!0):h(T<v.length?v[T]:Od,b[T],[...y,String(T)],[...w,String(T)]);return}if(m(v)||m(b))for(let S of new Set([...m(v)?Object.keys(v):[],...m(b)?Object.keys(b):[]]))h(m(v)&&Wc(v,S)?v[S]:Od,m(b)&&Wc(b,S)?b[S]:Od,[...y,S],[...w,S])}},g=new Set(DQ(e,t).map(v=>fO(v.path)[0]));if(g.size){d(e,t,[]);for(let v of g)h(Wc(e,v)?e[v]:Od,Wc(t,v)?t[v]:Od,[v])}}function AP(e,t){let n=t?.state?e.states.find(r=>r.id===t.state)?.parameterSchema:void 0;return[e.parameterSchema,...n===void 0?[]:[n]]}function mO(e,t){let n=DQ(e,t).map(o=>o.op==="remove"?{op:"remove",path:fO(o.path)}:o.op==="add"||o.op==="replace"?{op:"set",path:fO(o.path),value:structuredClone(o.value)}:ti(422,"component-parameter-diff-unavailable"));if(!n.length)return[];if(n.length<=32&&mv(TP(e,n),t))return n;let r=[...new Set([...Object.keys(e),...Object.keys(t)])].filter(o=>!mv(e[o],t[o])).map(o=>Wc(t,o)?{op:"set",path:[o],value:structuredClone(t[o])}:{op:"remove",path:[o]});return r.length>32?ti(422,"component-parameter-change-limit",{limits:{maxChanges:32}}):r}function Gc(e,t){let n=DP(e,t.blockId),r=VS(e,n.id),o=structuredClone(e),i=DP(o,n.id),a=t.type==="component.step-parameters.patch"||t.type==="component.step-parameters.reset"?t.stepId:void 0;if(t.type==="component.parameters.patch")i.parameters=TP(i.parameters,t.changes);else if(t.type==="component.definition.use"){if(!Wc(o.definitions,t.definitionId))return ti(404,"component-definition-missing",{definitionId:t.definitionId});i.definitionId=t.definitionId,t.changes?.length&&(i.parameters=TP(i.parameters,t.changes))}else{let v=pO(o,t.stepId,r),b=v.visuals.find(y=>y.blockId===i.id);if(t.type==="component.step-parameters.reset")b&&delete b.parameters;else{let y=is(e,i.id,t.stepId),w=TP(y.parameters,t.changes),S=structuredClone(b?.parameters??{}),x=new Set(t.changes.map(P=>P.path[0])),k=structuredClone(e),C=k.steps[t.stepId].visuals.find(P=>P.blockId===i.id);C&&delete C.parameters;let E=is(k,i.id,t.stepId).parameters;for(let P of x)if(Wc(w,P))Object.defineProperty(S,P,{value:structuredClone(w[P]),configurable:!0,enumerable:!0,writable:!0});else{if(Wc(E,P))return ti(422,"component-parameter-inherited-removal-unavailable",{path:[P],next:"Reset the current parameter override to restore inheritance, or set a schema-valid value."});delete S[P]}b?b.parameters=S:v.visuals.push({blockId:i.id,visible:y.visual?.visible??!1,parameters:S})}}let s=sc(o);if(!s.document)return ti(422,"component-parameters-invalid",{issueCount:s.issues.length,issues:s.issues.slice(0,3).map(v=>({code:v.code.slice(0,64),path:v.path.slice(0,160),message:v.message.slice(0,160),severity:v.severity}))});let l=e.definitions[n.definitionId],c=o.definitions[i.definitionId],d=n.definitionId!==i.definitionId;RQ(n.parameters,i.parameters,AP(l),AP(c),d,"changes"in t?t.changes:void 0,t.type==="component.step-parameters.reset");let u=[],f=[],p=[],m=[];for(let v of e.sections[r].stepOrder){let b=is(e,i.id,v),y=is(o,i.id,v);RQ(b.parameters,y.parameters,AP(l,b.visual),AP(c,y.visual),d,"changes"in t?t.changes:void 0,t.type==="component.step-parameters.reset"),(d||!mv(b.parameters,y.parameters))&&u.push(v),b.ownParameters!==void 0&&mv(b.ownParameters,y.ownParameters)?f.push(v):y.ownParameters!==void 0?p.push(v):b.ownParameters!==void 0&&m.push(v)}let h=!mv(e,o),g=v=>Object.values(e.blocks).filter(b=>b.type==="component"&&b.definitionId===v).map(b=>b.id);return{content:o,effect:{blockId:i.id,sectionId:r,layer:t.type==="component.definition.use"?"definition":a?"step":"base",...a?{stepId:a}:{},definitionId:i.definitionId,...i.definitionId!==n.definitionId?{previousDefinitionId:n.definitionId}:{},changed:h,paths:"changes"in t?(t.changes??[]).map(v=>[...v.path]):[],affected:{blocks:h?[i.id]:[],steps:u,pages:h?[r]:[]},overrides:{preserved:f,materialized:p,reset:m},references:{before:g(n.definitionId),after:Object.values(o.blocks).filter(v=>v.type==="component"&&v.definitionId===i.definitionId).map(v=>v.id)}}}}function hO(e){let t=[...new Set([...e.metadata.plugins??[],"@lincyaw/addon-lecture","@lincyaw/addon-speech"])];return JSON.stringify(t)===JSON.stringify(e.metadata.plugins)&&e.metadata.renderers?.lecture?e:{...e,metadata:{...e.metadata,plugins:t,renderers:{...e.metadata.renderers,lecture:e.metadata.renderers?.lecture??{}}}}}var hv=(e,t)=>Object.hasOwn(e,t),P7e=e=>e.map(t=>t.type==="text"?t.text:t.type==="pronunciation"?t.display:"").join(""),E7e=(e,t)=>{let n=[...t].sort();return e.length===t.length&&[...e].sort().every((r,o)=>r===n[o])},A7e=(e,t)=>`atom:${e}:${X0(JSON.stringify(t))}`;function gO(e,t,n){let r={targets:[],conflicts:[],impact:{narrationIds:[],stepIds:[],sharedStepIds:[],forks:[],removedAtoms:[],removedCueTimings:[]}},o=(f,p,m,h)=>{r.conflicts.push({code:f,...p!==void 0?{target:p}:{},...m?{key:m}:{},...h?{stepIds:h}:{}})};if(t.transcriptionId!==n.candidate.id||t.revision!==n.candidate.revision||t.source.documentId!==e.id||n.source.documentId!==e.id)return o("candidate-document-changed"),r;let i=structuredClone(e),a=new Map,s=new Set,l=new Set,c=new Set([e.id,...["sections","blocks","steps","narrations","assets","definitions"].flatMap(f=>Object.keys(e[f])),...Object.values(e.narrations).flatMap(f=>f.content.flatMap(p=>p.type==="cue"?[p.id]:[]))]),d=(f,p,m="")=>`${f}-${X0(JSON.stringify([e.id,n.id,p,m]))}`;for(let[f,p]of n.targets.entries()){let m=hv(e.steps,p.stepId)?e.steps[p.stepId]:void 0,h=hv(e.sections,p.sectionId)?e.sections[p.sectionId]:void 0;if(!m||!h||m.sectionId!==h.id||!h.stepOrder.includes(m.id)){o("target-changed",f);continue}let g=JSON.stringify([m.id,p.narrationId??null]);if(s.has(g)){o("target-repeated",f);continue}s.add(g);let v=p.narrationId!==void 0&&hv(e.narrations,p.narrationId)?e.narrations[p.narrationId]:void 0;if(p.narrationId!==void 0?!v||!m.narrationIds.includes(p.narrationId):m.narrationIds.length!==0){o("narration-target-changed",f);continue}let b=v?Object.values(e.steps).filter(D=>D.narrationIds.includes(v.id)).map(D=>D.id):[m.id];b.length>1&&!p.shared&&o("shared-decision-required",f,void 0,b),p.shared==="edit-shared"&&!E7e(p.affectedStepIds??[],b)&&o("shared-scope-changed",f,void 0,b),p.shared==="fork"&&p.affectedStepIds?.length&&o("shared-scope-unexpected",f);let y=t.result.segments.filter(D=>p.segmentIds.includes(D.id));if(y.length!==p.segmentIds.length){o("segment-missing",f);continue}let w=y.map(D=>D.text).join(`
|
|
728
728
|
`),S=(v?.content??[]).flatMap((D,N)=>D.type==="text"?[]:[{key:A7e(N,D),node:D}]),x=new Map(S.map(D=>[D.key,D.node])),k=new Set,C=new Set(p.discardAtoms??[]),E=[];if(p.content===void 0&&w===P7e(v?.content??[])&&!C.size)E=structuredClone(v?.content??[]),S.forEach(D=>k.add(D.key));else if(p.content===void 0)E=[{type:"text",text:w}];else for(let D of p.content)if(D.type==="text")E.push({type:"text",text:D.text});else{let N=x.get(D.key);N?k.has(D.key)||C.has(D.key)?o("atom-repeated",f,D.key):(k.add(D.key),E.push(structuredClone(N))):o("atom-unknown",f,D.key)}for(let D of C){let N=x.get(D);N?(r.impact.removedAtoms.push(D),N.type==="cue"&&l.add(N.id)):o("atom-unknown",f,D)}for(let D of S)!k.has(D.key)&&!C.has(D.key)&&o("protected-atom-unresolved",f,D.key);let P=!!(v&&p.shared==="fork"),I=!v||P?d("narration",g):v.id,T=[];(!v||P)&&c.has(I)&&o("generated-id-collision",f,I),P&&(E=E.map(D=>{if(D.type!=="cue")return D;let N=d("cue",g,D.id);return c.has(N)&&o("generated-id-collision",f,N),c.add(N),T.push({from:D.id,to:N}),hv(e.production.cueTimings??{},D.id)&&(i.production.cueTimings??={},i.production.cueTimings[N]=structuredClone(e.production.cueTimings[D.id])),{...D,id:N}}));let _={...v,id:I,content:E,provenance:{type:"transcription",transcriptionId:t.transcriptionId,revision:t.revision,assetId:t.audio.assetId,audioSha256:t.audio.sha256,segmentIds:y.map(D=>D.id)}},A=a.get(I);A&&JSON.stringify(A)!==JSON.stringify(_)?o("shared-content-conflict",f):(a.set(I,_),Object.defineProperty(i.narrations,I,{value:_,enumerable:!0,configurable:!0,writable:!0})),v?P&&(i.steps[m.id].narrationIds=i.steps[m.id].narrationIds.map(D=>D===v.id?I:D),hv(e.production.narrationOverrides??{},v.id)&&(i.production.narrationOverrides??={},i.production.narrationOverrides[I]=structuredClone(e.production.narrationOverrides[v.id])),r.impact.forks.push({from:v.id,to:I,stepId:m.id,cues:T})):i.steps[m.id].narrationIds.push(I),c.add(I),r.impact.narrationIds.push(I),r.impact.stepIds.push(...P?[m.id]:b),b.length>1&&!P&&r.impact.sharedStepIds.push(...b),r.targets.push({sectionId:h.id,stepId:m.id,narrationId:v?.id,outputNarrationId:I,segmentIds:y.map(D=>D.id),sourceText:w,before:structuredClone(v?.content??[]),proposed:structuredClone(E),atoms:structuredClone(S)})}let u=new Set(Object.values(i.narrations).flatMap(f=>f.content.flatMap(p=>p.type==="cue"?[p.id]:[])));for(let f of l)!u.has(f)&&hv(e.production.cueTimings??{},f)&&!n.removeCueTimings?.includes(f)&&o("cue-timing-confirmation-required",void 0,f);for(let f of n.removeCueTimings??[])!l.has(f)||u.has(f)||!hv(e.production.cueTimings??{},f)?o("cue-timing-unexpected",void 0,f):(delete i.production.cueTimings[f],r.impact.removedCueTimings.push(f));for(let f of["narrationIds","stepIds","sharedStepIds","removedAtoms"])r.impact[f]=[...new Set(r.impact[f])];if(!r.conflicts.length){let f=sc(i);if(!f.document||f.issues.some(p=>p.severity==="error"))for(let p of f.issues.filter(m=>m.severity==="error"))o("document-invalid",void 0,p.path)}return{...r,...r.conflicts.length?{}:{content:i}}}function MP(e,t){let n=e.sourceRange??{startMs:0,endMs:t};return Number.isFinite(t)&&t>0&&Number.isFinite(n.startMs)&&Number.isFinite(n.endMs)&&n.startMs>=0&&n.endMs>n.startMs&&n.endMs<=t?{...n}:void 0}function*OP(e){for(let t of e)yield t,t.node.type==="component"&&t.node.children&&(yield*OP(t.node.children))}function gv(e,t){if(e.stepIds)return e.stepIds.map(a=>[`step:${a}`]);let n=Array.from({length:e.steps+1},()=>[]),r=(a,s)=>a>0&&n[a]?.push(s),o=!1,i=(a,s)=>{for(let l of a){if(t!==void 0&&l.only&&!l.only.includes(t)){o=!0;continue}let c=s+l.id;if(l.role==="visual"){for(let d=0;d<=(l.span??0);d++)r(l.at+d,d===0?c:`${c}+${d}`);l.until!==void 0&&r(l.until,`${c}-`)}l.node.type==="component"&&l.node.children&&i(l.node.children,`${c}/`)}};return i(e.blocks,""),o?n.filter((a,s)=>s===0||a.length>0):n}function vO(e,t){return e.slice(1,t+1).flat()}function NP(e,t){let n=new Set(t);for(let r=e.length-1;r>0;r--)if(e[r].some(o=>n.has(o)))return r;return 0}function Wp(e){let t=e?.trim().toLowerCase()??"";if(t==="zh"||t.startsWith("zh-"))return"zh-CN";if(t==="en"||t.startsWith("en-"))return"en"}var I7e='textarea, [contenteditable]:not([contenteditable="false"]), input:not([type="button"], [type="checkbox"], [type="radio"], [type="range"], [type="reset"], [type="submit"], [type="color"], [type="file"], [type="image"])',T7e='[role="dialog"], [role="alertdialog"], [role="menu"], [role="listbox"]',MQ='button, a[href], summary, select, input, [role="button"], [role="link"], [role="checkbox"], [role="radio"], [role="switch"], [role="tab"], [role="option"], [role="treeitem"]',OQ='select, input[type="range"], [role="slider"], [role="spinbutton"], [role="tablist"], [role="toolbar"], [role="radiogroup"], [role="grid"], [role="tree"], [role="menubar"]',R7e=new Set(["ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Home","End","PageUp","PageDown"]),bO=new WeakMap;function yO(e=globalThis.document){if(!e||bO.has(e))return;let t={pointer:!1,byPointer:new WeakSet};bO.set(e,t),e.addEventListener("pointerdown",()=>{t.pointer=!0},!0),e.addEventListener("keydown",()=>{t.pointer=!1},!0),e.addEventListener("focusin",n=>{let r=n.composedPath()[0];r instanceof Element&&(t.pointer?t.byPointer.add(r):t.byPointer.delete(r))},!0)}function wO(e){if(e.isComposing||e.keyCode===229)return!0;let t=e.composedPath?.()[0]??e.target;return t instanceof Element?t.isContentEditable||t.closest(I7e)||t.closest(T7e)?!0:e.key!==" "&&!R7e.has(e.key)?!1:t.closest('[role="separator"]')?!0:bO.get(t.ownerDocument)?.byPointer.has(t)?!1:t.tabIndex>=0&&!t.matches(`${MQ}, ${OQ}`)||!!t.closest(e.key===" "?MQ:OQ):!1}function D7e(e){let[t,n]=typeof e=="number"?[e,1]:typeof e=="string"?e.split(/[/:]/).map(Number):[],r=n===void 0?t:(t??Number.NaN)/n;return r!==void 0&&Number.isFinite(r)&&r>0?r:16/9}function kO(e){let t=e.config.renderers.slides??{},n=typeof t.canvasWidth=="number"&&t.canvasWidth>0?t.canvasWidth:980;return{width:n,height:Math.round(n/D7e(t.aspectRatio))}}function xO(e){return e.trim().toLowerCase().replace(/[^a-z0-9]/g,"_")}function SO(e,t){if(!Number.isSafeInteger(t)||t<0||t>e.steps)throw new Error("voice-target");return{section:e.id,step:t,binding:X0(JSON.stringify([e.id,gv(e)]))}}var FP=200,as=function(){};as.prototype.append=function(t){return t.length?(t=as.from(t),!this.length&&t||t.length<FP&&this.leafAppend(t)||this.length<FP&&t.leafPrepend(this)||this.appendInner(t)):this};as.prototype.prepend=function(t){return t.length?as.from(t).append(this):this};as.prototype.appendInner=function(t){return new M7e(this,t)};as.prototype.slice=function(t,n){return t===void 0&&(t=0),n===void 0&&(n=this.length),t>=n?as.empty:this.sliceInner(Math.max(0,t),Math.min(this.length,n))};as.prototype.get=function(t){if(!(t<0||t>=this.length))return this.getInner(t)};as.prototype.forEach=function(t,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length),n<=r?this.forEachInner(t,n,r,0):this.forEachInvertedInner(t,n,r,0)};as.prototype.map=function(t,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length);var o=[];return this.forEach(function(i,a){return o.push(t(i,a))},n,r),o};as.from=function(t){return t instanceof as?t:t&&t.length?new NQ(t):as.empty};var NQ=(function(e){function t(r){e.call(this),this.values=r}e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t;var n={length:{configurable:!0},depth:{configurable:!0}};return t.prototype.flatten=function(){return this.values},t.prototype.sliceInner=function(o,i){return o==0&&i==this.length?this:new t(this.values.slice(o,i))},t.prototype.getInner=function(o){return this.values[o]},t.prototype.forEachInner=function(o,i,a,s){for(var l=i;l<a;l++)if(o(this.values[l],s+l)===!1)return!1},t.prototype.forEachInvertedInner=function(o,i,a,s){for(var l=i-1;l>=a;l--)if(o(this.values[l],s+l)===!1)return!1},t.prototype.leafAppend=function(o){if(this.length+o.length<=FP)return new t(this.values.concat(o.flatten()))},t.prototype.leafPrepend=function(o){if(this.length+o.length<=FP)return new t(o.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(t.prototype,n),t})(as);as.empty=new NQ([]);var M7e=(function(e){function t(n,r){e.call(this),this.left=n,this.right=r,this.length=n.length+r.length,this.depth=Math.max(n.depth,r.depth)+1}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},t.prototype.getInner=function(r){return r<this.left.length?this.left.get(r):this.right.get(r-this.left.length)},t.prototype.forEachInner=function(r,o,i,a){var s=this.left.length;if(o<s&&this.left.forEachInner(r,o,Math.min(i,s),a)===!1||i>s&&this.right.forEachInner(r,Math.max(o-s,0),Math.min(this.length,i)-s,a+s)===!1)return!1},t.prototype.forEachInvertedInner=function(r,o,i,a){var s=this.left.length;if(o>s&&this.right.forEachInvertedInner(r,o-s,Math.max(i,s)-s,a+s)===!1||i<s&&this.left.forEachInvertedInner(r,Math.min(o,s),i,a)===!1)return!1},t.prototype.sliceInner=function(r,o){if(r==0&&o==this.length)return this;var i=this.left.length;return o<=i?this.left.slice(r,o):r>=i?this.right.slice(r-i,o-i):this.left.slice(r,i).append(this.right.slice(0,o-i))},t.prototype.leafAppend=function(r){var o=this.right.leafAppend(r);if(o)return new t(this.left,o)},t.prototype.leafPrepend=function(r){var o=this.left.leafPrepend(r);if(o)return new t(o,this.right)},t.prototype.appendInner=function(r){return this.left.depth>=Math.max(this.right.depth,r.depth)+1?new t(this.left,new t(this.right,r)):new t(this,r)},t})(as),CO=as;function Ts(e){this.content=e}Ts.prototype={constructor:Ts,find:function(e){for(var t=0;t<this.content.length;t+=2)if(this.content[t]===e)return t;return-1},get:function(e){var t=this.find(e);return t==-1?void 0:this.content[t+1]},update:function(e,t,n){var r=n&&n!=e?this.remove(n):this,o=r.find(e),i=r.content.slice();return o==-1?i.push(n||e,t):(i[o+1]=t,n&&(i[o]=n)),new Ts(i)},remove:function(e){var t=this.find(e);if(t==-1)return this;var n=this.content.slice();return n.splice(t,2),new Ts(n)},addToStart:function(e,t){return new Ts([e,t].concat(this.remove(e).content))},addToEnd:function(e,t){var n=this.remove(e).content.slice();return n.push(e,t),new Ts(n)},addBefore:function(e,t,n){var r=this.remove(t),o=r.content.slice(),i=r.find(e);return o.splice(i==-1?o.length:i,0,t,n),new Ts(o)},forEach:function(e){for(var t=0;t<this.content.length;t+=2)e(this.content[t],this.content[t+1])},prepend:function(e){return e=Ts.from(e),e.size?new Ts(e.content.concat(this.subtract(e).content)):this},append:function(e){return e=Ts.from(e),e.size?new Ts(this.subtract(e).content.concat(e.content)):this},subtract:function(e){var t=this;e=Ts.from(e);for(var n=0;n<e.content.length;n+=2)t=t.remove(e.content[n]);return t},toObject:function(){var e={};return this.forEach(function(t,n){e[t]=n}),e},get size(){return this.content.length>>1}};Ts.from=function(e){if(e instanceof Ts)return e;var t=[];if(e)for(var n in e)t.push(n,e[n]);return new Ts(t)};var _O=Ts;function WQ(e,t,n){for(let r=0;;r++){if(r==e.childCount||r==t.childCount)return e.childCount==t.childCount?null:n;let o=e.child(r),i=t.child(r);if(o==i){n+=o.nodeSize;continue}if(!o.sameMarkup(i))return n;if(o.isText&&o.text!=i.text){let a=o.text,s=i.text,l=0;for(;a[l]==s[l];l++)n++;return l&&l<a.length&&l<s.length&&JQ(a.charCodeAt(l-1))&&KQ(a.charCodeAt(l))&&n--,n}if(o.content.size||i.content.size){let a=WQ(o.content,i.content,n+1);if(a!=null)return a}n+=o.nodeSize}}function GQ(e,t,n,r){for(let o=e.childCount,i=t.childCount;;){if(o==0||i==0)return o==i?null:{a:n,b:r};let a=e.child(--o),s=t.child(--i),l=a.nodeSize;if(a==s){n-=l,r-=l;continue}if(!a.sameMarkup(s))return{a:n,b:r};if(a.isText&&a.text!=s.text){let c=a.text,d=s.text,u=c.length,f=d.length;for(;u>0&&f>0&&c[u-1]==d[f-1];)u--,f--,n--,r--;return u&&f&&u<c.length&&JQ(c.charCodeAt(u-1))&&KQ(c.charCodeAt(u))&&(n++,r++),{a:n,b:r}}if(a.content.size||s.content.size){let c=GQ(a.content,s.content,n-1,r-1);if(c)return c}n-=l,r-=l}}function KQ(e){return e>=56320&&e<57344}function JQ(e){return e>=55296&&e<56320}var Ee=class e{constructor(t,n){if(this.content=t,this.size=n||0,n==null)for(let r=0;r<t.length;r++)this.size+=t[r].nodeSize}nodesBetween(t,n,r,o=0,i){for(let a=0,s=0;s<n;a++){let l=this.content[a],c=s+l.nodeSize;if(c>t&&r(l,o+s,i||null,a)!==!1&&l.content.size){let d=s+1;l.nodesBetween(Math.max(0,t-d),Math.min(l.content.size,n-d),r,o+d)}s=c}}descendants(t){this.nodesBetween(0,this.size,t)}textBetween(t,n,r,o){let i="",a=!0;return this.nodesBetween(t,n,(s,l)=>{let c=s.isText?s.text.slice(Math.max(t,l)-l,n-l):s.isLeaf?o?typeof o=="function"?o(s):o:s.type.spec.leafText?s.type.spec.leafText(s):"":"";s.isBlock&&(s.isLeaf&&c||s.isTextblock)&&r&&(a?a=!1:i+=r),i+=c},0),i}append(t){if(!t.size)return this;if(!this.size)return t;let n=this.lastChild,r=t.firstChild,o=this.content.slice(),i=0;for(n.isText&&n.sameMarkup(r)&&(o[o.length-1]=n.withText(n.text+r.text),i=1);i<t.content.length;i++)o.push(t.content[i]);return new e(o,this.size+t.size)}cut(t,n=this.size){if(t==0&&n==this.size)return this;let r=[],o=0;if(n>t)for(let i=0,a=0;a<n;i++){let s=this.content[i],l=a+s.nodeSize;l>t&&((a<t||l>n)&&(s.isText?s=s.cut(Math.max(0,t-a),Math.min(s.text.length,n-a)):s=s.cut(Math.max(0,t-a-1),Math.min(s.content.size,n-a-1))),r.push(s),o+=s.nodeSize),a=l}return new e(r,o)}cutByIndex(t,n){return t==n?e.empty:t==0&&n==this.content.length?this:new e(this.content.slice(t,n))}replaceChild(t,n){let r=this.content[t];if(r==n)return this;let o=this.content.slice(),i=this.size+n.nodeSize-r.nodeSize;return o[t]=n,new e(o,i)}addToStart(t){return new e([t].concat(this.content),this.size+t.nodeSize)}addToEnd(t){return new e(this.content.concat(t),this.size+t.nodeSize)}eq(t){if(this.content.length!=t.content.length)return!1;for(let n=0;n<this.content.length;n++)if(!this.content[n].eq(t.content[n]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(t){let n=this.content[t];if(!n)throw new RangeError("Index "+t+" out of range for "+this);return n}maybeChild(t){return this.content[t]||null}forEach(t){for(let n=0,r=0;n<this.content.length;n++){let o=this.content[n];t(o,r,n),r+=o.nodeSize}}findDiffStart(t,n=0){return WQ(this,t,n)}findDiffEnd(t,n=this.size,r=t.size){return GQ(this,t,n,r)}findIndex(t){if(t==0)return LP(0,t);if(t==this.size)return LP(this.content.length,t);if(t>this.size||t<0)throw new RangeError(`Position ${t} outside of fragment (${this})`);for(let n=0,r=0;;n++){let o=this.child(n),i=r+o.nodeSize;if(i>=t)return i==t?LP(n+1,i):LP(n,r);r=i}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(t=>t.toJSON()):null}static fromJSON(t,n){if(!n)return e.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return e.fromArray(n.map(t.nodeFromJSON))}static fromArray(t){if(!t.length)return e.empty;let n,r=0;for(let o=0;o<t.length;o++){let i=t[o];r+=i.nodeSize,o&&i.isText&&t[o-1].sameMarkup(i)?(n||(n=t.slice(0,o)),n[n.length-1]=i.withText(n[n.length-1].text+i.text)):n&&n.push(i)}return new e(n||t,r)}static from(t){if(!t)return e.empty;if(t instanceof e)return t;if(Array.isArray(t))return this.fromArray(t);if(t.attrs)return new e([t],t.nodeSize);throw new RangeError("Can not convert "+t+" to a Fragment"+(t.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}};Ee.empty=new Ee([],0);var PO={index:0,offset:0};function LP(e,t){return PO.index=e,PO.offset=t,PO}function zP(e,t){if(e===t)return!0;if(!(e&&typeof e=="object")||!(t&&typeof t=="object"))return!1;let n=Array.isArray(e);if(Array.isArray(t)!=n)return!1;if(n){if(e.length!=t.length)return!1;for(let r=0;r<e.length;r++)if(!zP(e[r],t[r]))return!1}else{for(let r in e)if(!(r in t)||!zP(e[r],t[r]))return!1;for(let r in t)if(!(r in e))return!1}return!0}var sr=class e{constructor(t,n){this.type=t,this.attrs=n}addToSet(t){let n,r=!1;for(let o=0;o<t.length;o++){let i=t[o];if(this.eq(i))return t;if(this.type.excludes(i.type))n||(n=t.slice(0,o));else{if(i.type.excludes(this.type))return t;!r&&i.type.rank>this.type.rank&&(n||(n=t.slice(0,o)),n.push(this),r=!0),n&&n.push(i)}}return n||(n=t.slice()),r||n.push(this),n}removeFromSet(t){for(let n=0;n<t.length;n++)if(this.eq(t[n]))return t.slice(0,n).concat(t.slice(n+1));return t}isInSet(t){for(let n=0;n<t.length;n++)if(this.eq(t[n]))return!0;return!1}eq(t){return this==t||this.type==t.type&&zP(this.attrs,t.attrs)}toJSON(){let t={type:this.type.name};for(let n in this.attrs){t.attrs=this.attrs;break}return t}static fromJSON(t,n){if(!n)throw new RangeError("Invalid input for Mark.fromJSON");let r=t.marks[n.type];if(!r)throw new RangeError(`There is no mark type ${n.type} in this schema`);return r.create(n.attrs)}static sameSet(t,n){if(t==n)return!0;if(t.length!=n.length)return!1;for(let r=0;r<t.length;r++)if(!t[r].eq(n[r]))return!1;return!0}static setFrom(t){if(!t||Array.isArray(t)&&t.length==0)return e.none;if(t instanceof e)return[t];let n=t.slice();return n.sort((r,o)=>r.type.rank-o.type.rank),n}};sr.none=[];var Fh=class extends Error{},Be=class e{constructor(t,n,r){this.content=t,this.openStart=n,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(t,n){let r=ZQ(this.content,t+this.openStart,n,this.openStart+1,this.openEnd+1);return r&&new e(r,this.openStart,this.openEnd)}removeBetween(t,n){return new e(YQ(this.content,t+this.openStart,n+this.openStart),this.openStart,this.openEnd)}eq(t){return this.content.eq(t.content)&&this.openStart==t.openStart&&this.openEnd==t.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let t={content:this.content.toJSON()};return this.openStart>0&&(t.openStart=this.openStart),this.openEnd>0&&(t.openEnd=this.openEnd),t}static fromJSON(t,n){if(!n)return e.empty;let r=n.openStart||0,o=n.openEnd||0;if(typeof r!="number"||typeof o!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new e(Ee.fromJSON(t,n.content),r,o)}static maxOpen(t,n=!0){let r=0,o=0;for(let i=t.firstChild;i&&!i.isLeaf&&(n||!i.type.spec.isolating);i=i.firstChild)r++;for(let i=t.lastChild;i&&!i.isLeaf&&(n||!i.type.spec.isolating);i=i.lastChild)o++;return new e(t,r,o)}};Be.empty=new Be(Ee.empty,0,0);function YQ(e,t,n){let{index:r,offset:o}=e.findIndex(t),i=e.maybeChild(r),{index:a,offset:s}=e.findIndex(n);if(o==t||i.isText){if(s!=n&&!e.child(a).isText)throw new RangeError("Removing non-flat range");return e.cut(0,t).append(e.cut(n))}if(r!=a)throw new RangeError("Removing non-flat range");return e.replaceChild(r,i.copy(YQ(i.content,t-o-1,n-o-1)))}function ZQ(e,t,n,r,o,i){let{index:a,offset:s}=e.findIndex(t),l=e.maybeChild(a);if(s==t||l.isText)return i&&r<=0&&o<=0&&!i.canReplace(a,a,n)?null:e.cut(0,t).append(n).append(e.cut(t));let c=ZQ(l.content,t-s-1,n,a==0?r-1:0,a==e.childCount-1?o-1:0,l);return c&&e.replaceChild(a,l.copy(c))}function O7e(e,t,n){if(n.openStart>e.depth)throw new Fh("Inserted content deeper than insertion position");if(e.depth-n.openStart!=t.depth-n.openEnd)throw new Fh("Inconsistent open depths");return XQ(e,t,n,0)}function XQ(e,t,n,r){let o=e.index(r),i=e.node(r);if(o==t.index(r)&&r<e.depth-n.openStart){let a=XQ(e,t,n,r+1);return i.copy(i.content.replaceChild(o,a))}else if(n.content.size)if(!n.openStart&&!n.openEnd&&e.depth==r&&t.depth==r){let a=e.parent,s=a.content;return bv(a,s.cut(0,e.parentOffset).append(n.content).append(s.cut(t.parentOffset)))}else{let{start:a,end:s}=N7e(n,e);return bv(i,eee(e,a,s,t,r))}else return bv(i,jP(e,t,r))}function QQ(e,t){if(!t.type.compatibleContent(e.type))throw new Fh("Cannot join "+t.type.name+" onto "+e.type.name)}function EO(e,t,n){let r=e.node(n);return QQ(r,t.node(n)),r}function vv(e,t){let n=t.length-1;n>=0&&e.isText&&e.sameMarkup(t[n])?t[n]=e.withText(t[n].text+e.text):t.push(e)}function HS(e,t,n,r){let o=(t||e).node(n),i=0,a=t?t.index(n):o.childCount;e&&(i=e.index(n),e.depth>n?i++:e.textOffset&&(vv(e.nodeAfter,r),i++));for(let s=i;s<a;s++)vv(o.child(s),r);t&&t.depth==n&&t.textOffset&&vv(t.nodeBefore,r)}function bv(e,t){if(!e.type.validContent(t))throw new Fh("Invalid content for node "+e.type.name);return e.copy(t)}function eee(e,t,n,r,o){let i=e.depth>o&&EO(e,t,o+1),a=r.depth>o&&EO(n,r,o+1),s=[];return HS(null,e,o,s),i&&a&&t.index(o)==n.index(o)?(QQ(i,a),vv(bv(i,eee(e,t,n,r,o+1)),s)):(i&&vv(bv(i,jP(e,t,o+1)),s),HS(t,n,o,s),a&&vv(bv(a,jP(n,r,o+1)),s)),HS(r,null,o,s),new Ee(s)}function jP(e,t,n){let r=[];if(HS(null,e,n,r),e.depth>n){let o=EO(e,t,n+1);vv(bv(o,jP(e,t,n+1)),r)}return HS(t,null,n,r),new Ee(r)}function N7e(e,t){let n=t.depth-e.openStart,o=t.node(n).copy(e.content);for(let i=n-1;i>=0;i--)o=t.node(i).copy(Ee.from(o));return{start:o.resolveNoCache(e.openStart+n),end:o.resolveNoCache(o.content.size-e.openEnd-n)}}var VP=class e{constructor(t,n,r){this.pos=t,this.path=n,this.parentOffset=r,this.depth=n.length/3-1}resolveDepth(t){return t==null?this.depth:t<0?this.depth+t:t}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(t){return this.path[this.resolveDepth(t)*3]}index(t){return this.path[this.resolveDepth(t)*3+1]}indexAfter(t){return t=this.resolveDepth(t),this.index(t)+(t==this.depth&&!this.textOffset?0:1)}start(t){return t=this.resolveDepth(t),t==0?0:this.path[t*3-1]+1}end(t){return t=this.resolveDepth(t),this.start(t)+this.node(t).content.size}before(t){if(t=this.resolveDepth(t),!t)throw new RangeError("There is no position before the top-level node");return t==this.depth+1?this.pos:this.path[t*3-1]}after(t){if(t=this.resolveDepth(t),!t)throw new RangeError("There is no position after the top-level node");return t==this.depth+1?this.pos:this.path[t*3-1]+this.path[t*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let t=this.parent,n=this.index(this.depth);if(n==t.childCount)return null;let r=this.pos-this.path[this.path.length-1],o=t.child(n);return r?t.child(n).cut(r):o}get nodeBefore(){let t=this.index(this.depth),n=this.pos-this.path[this.path.length-1];return n?this.parent.child(t).cut(0,n):t==0?null:this.parent.child(t-1)}posAtIndex(t,n){n=this.resolveDepth(n);let r=this.path[n*3],o=n==0?0:this.path[n*3-1]+1;for(let i=0;i<t;i++)o+=r.child(i).nodeSize;return o}marks(){let t=this.parent,n=this.index();if(t.content.size==0)return sr.none;if(this.textOffset)return t.child(n).marks;let r=t.maybeChild(n-1),o=t.maybeChild(n);if(!r){let s=r;r=o,o=s}let i=r.marks;for(var a=0;a<i.length;a++)i[a].type.spec.inclusive===!1&&(!o||!i[a].isInSet(o.marks))&&(i=i[a--].removeFromSet(i));return i}marksAcross(t){let n=this.parent.maybeChild(this.index());if(!n||!n.isInline)return null;let r=n.marks,o=t.parent.maybeChild(t.index());for(var i=0;i<r.length;i++)r[i].type.spec.inclusive===!1&&(!o||!r[i].isInSet(o.marks))&&(r=r[i--].removeFromSet(r));return r}sharedDepth(t){for(let n=this.depth;n>0;n--)if(this.start(n)<=t&&this.end(n)>=t)return n;return 0}blockRange(t=this,n){if(t.pos<this.pos)return t.blockRange(this);for(let r=this.depth-(this.parent.inlineContent||this.pos==t.pos?1:0);r>=0;r--)if(t.pos<=this.end(r)&&(!n||n(this.node(r))))return new Gp(this,t,r);return null}sameParent(t){return this.pos-this.parentOffset==t.pos-t.parentOffset}max(t){return t.pos>this.pos?t:this}min(t){return t.pos<this.pos?t:this}toString(){let t="";for(let n=1;n<=this.depth;n++)t+=(t?"/":"")+this.node(n).type.name+"_"+this.index(n-1);return t+":"+this.parentOffset}static resolve(t,n){if(!(n>=0&&n<=t.content.size))throw new RangeError("Position "+n+" out of range");let r=[],o=0,i=n;for(let a=t;;){let{index:s,offset:l}=a.content.findIndex(i),c=i-l;if(r.push(a,s,o+l),!c||(a=a.child(s),a.isText))break;i=c-1,o+=l+1}return new e(n,r,i)}static resolveCached(t,n){let r=FQ.get(t);if(r)for(let i=0;i<r.elts.length;i++){let a=r.elts[i];if(a.pos==n)return a}else FQ.set(t,r=new AO);let o=r.elts[r.i]=e.resolve(t,n);return r.i=(r.i+1)%F7e,o}},AO=class{constructor(){this.elts=[],this.i=0}},F7e=12,FQ=new WeakMap,Gp=class{constructor(t,n,r){this.$from=t,this.$to=n,this.depth=r}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}},L7e=Object.create(null),Wu=class e{constructor(t,n,r,o=sr.none){this.type=t,this.attrs=n,this.marks=o,this.content=r||Ee.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(t){return this.content.child(t)}maybeChild(t){return this.content.maybeChild(t)}forEach(t){this.content.forEach(t)}nodesBetween(t,n,r,o=0){this.content.nodesBetween(t,n,r,o,this)}descendants(t){this.nodesBetween(0,this.content.size,t)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(t,n,r,o){return this.content.textBetween(t,n,r,o)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(t){return this==t||this.sameMarkup(t)&&this.content.eq(t.content)}sameMarkup(t){return this.hasMarkup(t.type,t.attrs,t.marks)}hasMarkup(t,n,r){return this.type==t&&zP(this.attrs,n||t.defaultAttrs||L7e)&&sr.sameSet(this.marks,r||sr.none)}copy(t=null){return t==this.content?this:new e(this.type,this.attrs,t,this.marks)}mark(t){return t==this.marks?this:new e(this.type,this.attrs,this.content,t)}cut(t,n=this.content.size){return t==0&&n==this.content.size?this:this.copy(this.content.cut(t,n))}slice(t,n=this.content.size,r=!1){if(t==n)return Be.empty;let o=this.resolve(t),i=this.resolve(n),a=r?0:o.sharedDepth(n),s=o.start(a),c=o.node(a).content.cut(o.pos-s,i.pos-s);return new Be(c,o.depth-a,i.depth-a)}replace(t,n,r){return O7e(this.resolve(t),this.resolve(n),r)}nodeAt(t){for(let n=this;;){let{index:r,offset:o}=n.content.findIndex(t);if(n=n.maybeChild(r),!n)return null;if(o==t||n.isText)return n;t-=o+1}}childAfter(t){let{index:n,offset:r}=this.content.findIndex(t);return{node:this.content.maybeChild(n),index:n,offset:r}}childBefore(t){if(t==0)return{node:null,index:0,offset:0};let{index:n,offset:r}=this.content.findIndex(t);if(r<t)return{node:this.content.child(n),index:n,offset:r};let o=this.content.child(n-1);return{node:o,index:n-1,offset:r-o.nodeSize}}resolve(t){return VP.resolveCached(this,t)}resolveNoCache(t){return VP.resolve(this,t)}rangeHasMark(t,n,r){let o=!1;return n>t&&this.nodesBetween(t,n,i=>(r.isInSet(i.marks)&&(o=!0),!o)),o}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let t=this.type.name;return this.content.size&&(t+="("+this.content.toStringInner()+")"),tee(this.marks,t)}contentMatchAt(t){let n=this.type.contentMatch.matchFragment(this.content,0,t);if(!n)throw new Error("Called contentMatchAt on a node with invalid content");return n}canReplace(t,n,r=Ee.empty,o=0,i=r.childCount){let a=this.contentMatchAt(t).matchFragment(r,o,i),s=a&&a.matchFragment(this.content,n);if(!s||!s.validEnd)return!1;for(let l=o;l<i;l++)if(!this.type.allowsMarks(r.child(l).marks))return!1;return!0}canReplaceWith(t,n,r,o){if(o&&!this.type.allowsMarks(o))return!1;let i=this.contentMatchAt(t).matchType(r),a=i&&i.matchFragment(this.content,n);return a?a.validEnd:!1}canAppend(t){return t.content.size?this.canReplace(this.childCount,this.childCount,t.content):this.type.compatibleContent(t.type)}check(){this.type.checkContent(this.content),LQ(this.type.attrs,this.attrs,"node",this.type.name);let t=sr.none;for(let n=0;n<this.marks.length;n++){let r=this.marks[n];LQ(r.type.attrs,r.attrs,"mark",r.type.name),t=r.addToSet(t)}if(!sr.sameSet(t,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(n=>n.type.name)}`);this.content.forEach(n=>n.check())}toJSON(){let t={type:this.type.name};for(let n in this.attrs){t.attrs=this.attrs;break}return this.content.size&&(t.content=this.content.toJSON()),this.marks.length&&(t.marks=this.marks.map(n=>n.toJSON())),t}static fromJSON(t,n){if(!n)throw new RangeError("Invalid input for Node.fromJSON");let r;if(n.marks){if(!Array.isArray(n.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=n.marks.map(t.markFromJSON)}if(n.type=="text"){if(typeof n.text!="string")throw new RangeError("Invalid text node in JSON");return t.text(n.text,r)}let o=Ee.fromJSON(t,n.content);return t.nodeType(n.type).create(n.attrs,o,r)}};Wu.prototype.text=void 0;var IO=class e extends Wu{constructor(t,n,r,o){if(super(t,n,null,o),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):tee(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(t,n){return this.text.slice(t,n)}get nodeSize(){return this.text.length}mark(t){return t==this.marks?this:new e(this.type,this.attrs,this.text,t)}withText(t){return t==this.text?this:new e(this.type,this.attrs,t,this.marks)}cut(t=0,n=this.text.length){return t==0&&n==this.text.length?this:this.withText(this.text.slice(t,n))}eq(t){return this.sameMarkup(t)&&this.text==t.text}toJSON(){let t=super.toJSON();return t.text=this.text,t}};function tee(e,t){for(let n=e.length-1;n>=0;n--)t=e[n].type.name+"("+t+")";return t}function LQ(e,t,n,r){for(let o in t)if(!(o in e))throw new RangeError(`Unsupported attribute ${o} for ${n} of type ${r}`);for(let o in e)e[o].validate&&e[o].validate(t[o])}var yv=class e{constructor(t){this.validEnd=t,this.next=[],this.wrapCache=[]}static parse(t,n){let r=new TO(t,n);if(r.next==null)return e.empty;let o=nee(r);r.next&&r.err("Unexpected trailing text");let i=q7e(H7e(o));return U7e(i,r),i}matchType(t){for(let n=0;n<this.next.length;n++)if(this.next[n].type==t)return this.next[n].next;return null}matchFragment(t,n=0,r=t.childCount){let o=this;for(let i=n;o&&i<r;i++)o=o.matchType(t.child(i).type);return o}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let t=0;t<this.next.length;t++){let{type:n}=this.next[t];if(!(n.isText||n.hasRequiredAttrs()))return n}return null}compatible(t){for(let n=0;n<this.next.length;n++)for(let r=0;r<t.next.length;r++)if(this.next[n].type==t.next[r].type)return!0;return!1}fillBefore(t,n=!1,r=0){let o=[this];function i(a,s){let l=a.matchFragment(t,r);if(l&&(!n||l.validEnd))return Ee.from(s.map(c=>c.createAndFill()));for(let c=0;c<a.next.length;c++){let{type:d,next:u}=a.next[c];if(!(d.isText||d.hasRequiredAttrs())&&o.indexOf(u)==-1){o.push(u);let f=i(u,s.concat(d));if(f)return f}}return null}return i(this,[])}findWrapping(t){for(let r=0;r<this.wrapCache.length;r+=2)if(this.wrapCache[r]==t)return this.wrapCache[r+1];let n=this.computeWrapping(t);return this.wrapCache.push(t,n),n}computeWrapping(t){let n=Object.create(null),r=[{match:this,type:null,via:null}];for(;r.length;){let o=r.shift(),i=o.match;if(i.matchType(t)){let a=[];for(let s=o;s.type;s=s.via)a.push(s.type);return a.reverse()}for(let a=0;a<i.next.length;a++){let{type:s,next:l}=i.next[a];!s.isLeaf&&!s.hasRequiredAttrs()&&!(s.name in n)&&(!o.type||l.validEnd)&&(r.push({match:s.contentMatch,type:s,via:o}),n[s.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(t){if(t>=this.next.length)throw new RangeError(`There's no ${t}th edge in this content match`);return this.next[t]}toString(){let t=[];function n(r){t.push(r);for(let o=0;o<r.next.length;o++)t.indexOf(r.next[o].next)==-1&&n(r.next[o].next)}return n(this),t.map((r,o)=>{let i=o+(r.validEnd?"*":" ")+" ";for(let a=0;a<r.next.length;a++)i+=(a?", ":"")+r.next[a].type.name+"->"+t.indexOf(r.next[a].next);return i}).join(`
|
|
729
729
|
`)}};yv.empty=new yv(!0);var TO=class{constructor(t,n){this.string=t,this.nodeTypes=n,this.inline=null,this.pos=0,this.tokens=t.split(/\s*(?=\b|\W|$)/),this.tokens[this.tokens.length-1]==""&&this.tokens.pop(),this.tokens[0]==""&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(t){return this.next==t&&(this.pos++||!0)}err(t){throw new SyntaxError(t+" (in content expression '"+this.string+"')")}};function nee(e){let t=[];do t.push(B7e(e));while(e.eat("|"));return t.length==1?t[0]:{type:"choice",exprs:t}}function B7e(e){let t=[];do t.push($7e(e));while(e.next&&e.next!=")"&&e.next!="|");return t.length==1?t[0]:{type:"seq",exprs:t}}function $7e(e){let t=V7e(e);for(;;)if(e.eat("+"))t={type:"plus",expr:t};else if(e.eat("*"))t={type:"star",expr:t};else if(e.eat("?"))t={type:"opt",expr:t};else if(e.eat("{"))t=z7e(e,t);else break;return t}function BQ(e){/\D/.test(e.next)&&e.err("Expected number, got '"+e.next+"'");let t=Number(e.next);return e.pos++,t}function z7e(e,t){let n=BQ(e),r=n;return e.eat(",")&&(e.next!="}"?r=BQ(e):r=-1),e.eat("}")||e.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:t}}function j7e(e,t){let n=e.nodeTypes,r=n[t];if(r)return[r];let o=[];for(let i in n){let a=n[i];a.isInGroup(t)&&o.push(a)}return o.length==0&&e.err("No node type or group '"+t+"' found"),o}function V7e(e){if(e.eat("(")){let t=nee(e);return e.eat(")")||e.err("Missing closing paren"),t}else if(/\W/.test(e.next))e.err("Unexpected token '"+e.next+"'");else{let t=j7e(e,e.next).map(n=>(e.inline==null?e.inline=n.isInline:e.inline!=n.isInline&&e.err("Mixing inline and block content"),{type:"name",value:n}));return e.pos++,t.length==1?t[0]:{type:"choice",exprs:t}}}function H7e(e){let t=[[]];return o(i(e,0),n()),t;function n(){return t.push([])-1}function r(a,s,l){let c={term:l,to:s};return t[a].push(c),c}function o(a,s){a.forEach(l=>l.to=s)}function i(a,s){if(a.type=="choice")return a.exprs.reduce((l,c)=>l.concat(i(c,s)),[]);if(a.type=="seq")for(let l=0;;l++){let c=i(a.exprs[l],s);if(l==a.exprs.length-1)return c;o(c,s=n())}else if(a.type=="star"){let l=n();return r(s,l),o(i(a.expr,l),l),[r(l)]}else if(a.type=="plus"){let l=n();return o(i(a.expr,s),l),o(i(a.expr,l),l),[r(l)]}else{if(a.type=="opt")return[r(s)].concat(i(a.expr,s));if(a.type=="range"){let l=s;for(let c=0;c<a.min;c++){let d=n();o(i(a.expr,l),d),l=d}if(a.max==-1)o(i(a.expr,l),l);else for(let c=a.min;c<a.max;c++){let d=n();r(l,d),o(i(a.expr,l),d),l=d}return[r(l)]}else{if(a.type=="name")return[r(s,void 0,a.value)];throw new Error("Unknown expr type")}}}}function ree(e,t){return t-e}function $Q(e,t){let n=[];return r(t),n.sort(ree);function r(o){let i=e[o];if(i.length==1&&!i[0].term)return r(i[0].to);n.push(o);for(let a=0;a<i.length;a++){let{term:s,to:l}=i[a];!s&&n.indexOf(l)==-1&&r(l)}}}function q7e(e){let t=Object.create(null);return n($Q(e,0));function n(r){let o=[];r.forEach(a=>{e[a].forEach(({term:s,to:l})=>{if(!s)return;let c;for(let d=0;d<o.length;d++)o[d][0]==s&&(c=o[d][1]);$Q(e,l).forEach(d=>{c||o.push([s,c=[]]),c.indexOf(d)==-1&&c.push(d)})})});let i=t[r.join(",")]=new yv(r.indexOf(e.length-1)>-1);for(let a=0;a<o.length;a++){let s=o[a][1].sort(ree);i.next.push({type:o[a][0],next:t[s.join(",")]||n(s)})}return i}}function U7e(e,t){for(let n=0,r=[e];n<r.length;n++){let o=r[n],i=!o.validEnd,a=[];for(let s=0;s<o.next.length;s++){let{type:l,next:c}=o.next[s];a.push(l.name),i&&!(l.isText||l.hasRequiredAttrs())&&(i=!1),r.indexOf(c)==-1&&r.push(c)}i&&t.err("Only non-generatable nodes ("+a.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function oee(e){let t=Object.create(null);for(let n in e){let r=e[n];if(!r.hasDefault)return null;t[n]=r.default}return t}function iee(e,t){let n=Object.create(null);for(let r in e){let o=e[r],i=t&&t[r];if(i===void 0)if(o.hasDefault)i=o.default;else throw new RangeError("No value supplied for attribute "+r);else o.validate&&o.validate(i);n[r]=i}return n}function aee(e,t){let n=Object.create(null);if(t)for(let r in t)n[r]=new RO(e,r,t[r]);return n}var HP=class e{constructor(t,n,r){this.name=t,this.schema=n,this.spec=r,this.markSet=null,this.groups=r.group?r.group.split(" "):[],this.attrs=aee(t,r.attrs),this.defaultAttrs=oee(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(r.inline||t=="text"),this.isText=t=="text"}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==yv.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}isInGroup(t){return this.groups.indexOf(t)>-1}get whitespace(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}hasRequiredAttrs(){for(let t in this.attrs)if(this.attrs[t].isRequired)return!0;return!1}compatibleContent(t){return this==t||this.contentMatch.compatible(t.contentMatch)}computeAttrs(t){return!t&&this.defaultAttrs?this.defaultAttrs:iee(this.attrs,t)}create(t=null,n,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new Wu(this,this.computeAttrs(t),Ee.from(n),sr.setFrom(r))}createChecked(t=null,n,r){return n=Ee.from(n),this.checkContent(n),new Wu(this,this.computeAttrs(t),n,sr.setFrom(r))}createAndFill(t=null,n,r){if(t=this.computeAttrs(t),n=Ee.from(n),n.size){let a=this.contentMatch.fillBefore(n);if(!a)return null;n=a.append(n)}let o=this.contentMatch.matchFragment(n),i=o&&o.fillBefore(Ee.empty,!0);return i?new Wu(this,t,n.append(i),sr.setFrom(r)):null}validContent(t){let n=this.contentMatch.matchFragment(t);if(!n||!n.validEnd)return!1;for(let r=0;r<t.childCount;r++)if(!this.allowsMarks(t.child(r).marks))return!1;return!0}checkContent(t){if(!this.validContent(t))throw new RangeError(`Invalid content for node ${this.name}: ${t.toString().slice(0,50)}`)}checkAttrs(t){}allowsMarkType(t){return this.markSet==null||this.markSet.indexOf(t)>-1}allowsMarks(t){if(this.markSet==null)return!0;for(let n=0;n<t.length;n++)if(!this.allowsMarkType(t[n].type))return!1;return!0}allowedMarks(t){if(this.markSet==null)return t;let n;for(let r=0;r<t.length;r++)this.allowsMarkType(t[r].type)?n&&n.push(t[r]):n||(n=t.slice(0,r));return n?n.length?n:sr.none:t}static compile(t,n){let r=Object.create(null);t.forEach((i,a)=>r[i]=new e(i,n,a));let o=n.spec.topNode||"doc";if(!r[o])throw new RangeError("Schema is missing its top node type ('"+o+"')");if(!r.text)throw new RangeError("Every schema needs a 'text' type");for(let i in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}};function W7e(e,t,n){let r=n.split("|");return o=>{let i=o===null?"null":typeof o;if(r.indexOf(i)<0)throw new RangeError(`Expected value of type ${r} for attribute ${t} on type ${e}, got ${i}`)}}var RO=class{constructor(t,n,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?W7e(t,n,r.validate):r.validate}get isRequired(){return!this.hasDefault}},US=class e{constructor(t,n,r,o){this.name=t,this.rank=n,this.schema=r,this.spec=o,this.attrs=aee(t,o.attrs),this.excluded=null;let i=oee(this.attrs);this.instance=i?new sr(this,i):null}create(t=null){return!t&&this.instance?this.instance:new sr(this,iee(this.attrs,t))}static compile(t,n){let r=Object.create(null),o=0;return t.forEach((i,a)=>r[i]=new e(i,o++,n,a)),r}removeFromSet(t){for(var n=0;n<t.length;n++)t[n].type==this&&(t=t.slice(0,n).concat(t.slice(n+1)),n--);return t}isInSet(t){for(let n=0;n<t.length;n++)if(t[n].type==this)return t[n]}excludes(t){return this.excluded.indexOf(t)>-1}},wv=class{constructor(t){this.linebreakReplacement=null,this.cached=Object.create(null);let n=this.spec={};for(let o in t)n[o]=t[o];n.nodes=_O.from(t.nodes),n.marks=_O.from(t.marks||{}),this.nodes=HP.compile(this.spec.nodes,this),this.marks=US.compile(this.spec.marks,this);let r=Object.create(null);for(let o in this.nodes){if(o in this.marks)throw new RangeError(o+" can not be both a node and a mark");let i=this.nodes[o],a=i.spec.content||"",s=i.spec.marks;if(i.contentMatch=r[a]||(r[a]=yv.parse(a,this.nodes)),i.inlineContent=i.contentMatch.inlineContent,i.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!i.isInline||!i.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=i}i.markSet=s=="_"?null:s?zQ(this,s.split(" ")):s==""||!i.inlineContent?[]:null}for(let o in this.marks){let i=this.marks[o],a=i.spec.excludes;i.excluded=a==null?[i]:a==""?[]:zQ(this,a.split(" "))}this.nodeFromJSON=o=>Wu.fromJSON(this,o),this.markFromJSON=o=>sr.fromJSON(this,o),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(t,n=null,r,o){if(typeof t=="string")t=this.nodeType(t);else if(t instanceof HP){if(t.schema!=this)throw new RangeError("Node type from different schema used ("+t.name+")")}else throw new RangeError("Invalid node type: "+t);return t.createChecked(n,r,o)}text(t,n){let r=this.nodes.text;return new IO(r,r.defaultAttrs,t,sr.setFrom(n))}mark(t,n){return typeof t=="string"&&(t=this.marks[t]),t.create(n)}nodeType(t){let n=this.nodes[t];if(!n)throw new RangeError("Unknown node type: "+t);return n}};function zQ(e,t){let n=[];for(let r=0;r<t.length;r++){let o=t[r],i=e.marks[o],a=i;if(i)n.push(i);else for(let s in e.marks){let l=e.marks[s];(o=="_"||l.spec.group&&l.spec.group.split(" ").indexOf(o)>-1)&&n.push(a=l)}if(!a)throw new SyntaxError("Unknown mark type: '"+t[r]+"'")}return n}function G7e(e){return e.tag!=null}function K7e(e){return e.style!=null}var ni=class e{constructor(t,n){this.schema=t,this.rules=n,this.tags=[],this.styles=[];let r=this.matchedStyles=[];n.forEach(o=>{if(G7e(o))this.tags.push(o);else if(K7e(o)){let i=/[^=]*/.exec(o.style)[0];r.indexOf(i)<0&&r.push(i),this.styles.push(o)}}),this.normalizeLists=!this.tags.some(o=>{if(!/^(ul|ol)\b/.test(o.tag)||!o.node)return!1;let i=t.nodes[o.node];return i.contentMatch.matchType(i)})}parse(t,n={}){let r=new qP(this,n,!1);return r.addAll(t,sr.none,n.from,n.to),r.finish()}parseSlice(t,n={}){let r=new qP(this,n,!0);return r.addAll(t,sr.none,n.from,n.to),Be.maxOpen(r.finish())}matchTag(t,n,r){for(let o=r?this.tags.indexOf(r)+1:0;o<this.tags.length;o++){let i=this.tags[o];if(Z7e(t,i.tag)&&(i.namespace===void 0||t.namespaceURI==i.namespace)&&(!i.context||n.matchesContext(i.context))){if(i.getAttrs){let a=i.getAttrs(t);if(a===!1)continue;i.attrs=a||void 0}return i}}}matchStyle(t,n,r,o){for(let i=o?this.styles.indexOf(o)+1:0;i<this.styles.length;i++){let a=this.styles[i],s=a.style;if(!(s.indexOf(t)!=0||a.context&&!r.matchesContext(a.context)||s.length>t.length&&(s.charCodeAt(t.length)!=61||s.slice(t.length+1)!=n))){if(a.getAttrs){let l=a.getAttrs(n);if(l===!1)continue;a.attrs=l||void 0}return a}}}static schemaRules(t){let n=[];function r(o){let i=o.priority==null?50:o.priority,a=0;for(;a<n.length;a++){let s=n[a];if((s.priority==null?50:s.priority)<i)break}n.splice(a,0,o)}for(let o in t.marks){let i=t.marks[o].spec.parseDOM;i&&i.forEach(a=>{r(a=VQ(a)),a.mark||a.ignore||a.clearMark||(a.mark=o)})}for(let o in t.nodes){let i=t.nodes[o].spec.parseDOM;i&&i.forEach(a=>{r(a=VQ(a)),a.node||a.ignore||a.mark||(a.node=o)})}return n}static fromSchema(t){return t.cached.domParser||(t.cached.domParser=new e(t,e.schemaRules(t)))}},see={address:!0,article:!0,aside:!0,blockquote:!0,body:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},J7e={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},lee={ol:!0,ul:!0},WS=1,DO=2,qS=4;function jQ(e,t,n){return t!=null?(t?WS:0)|(t==="full"?DO:0):e&&e.whitespace=="pre"?WS|DO:n&~qS}var C1=class{constructor(t,n,r,o,i,a){this.type=t,this.attrs=n,this.marks=r,this.solid=o,this.options=a,this.content=[],this.activeMarks=sr.none,this.match=i||(a&qS?null:t.contentMatch)}findWrapping(t){if(!this.match){if(!this.type)return[];let n=this.type.contentMatch.fillBefore(Ee.from(t));if(n)this.match=this.type.contentMatch.matchFragment(n);else{let r=this.type.contentMatch,o;return(o=r.findWrapping(t.type))?(this.match=r,o):null}}return this.match.findWrapping(t.type)}finish(t){if(!(this.options&WS)){let r=this.content[this.content.length-1],o;if(r&&r.isText&&(o=/[ \t\r\n\u000c]+$/.exec(r.text))){let i=r;r.text.length==o[0].length?this.content.pop():this.content[this.content.length-1]=i.withText(i.text.slice(0,i.text.length-o[0].length))}}let n=Ee.from(this.content);return!t&&this.match&&(n=n.append(this.match.fillBefore(Ee.empty,!0))),this.type?this.type.create(this.attrs,n,this.marks):n}inlineContext(t){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:t.parentNode&&!see.hasOwnProperty(t.parentNode.nodeName.toLowerCase())}},qP=class{constructor(t,n,r){this.parser=t,this.options=n,this.isOpen=r,this.open=0,this.localPreserveWS=!1;let o=n.topNode,i,a=jQ(null,n.preserveWhitespace,0)|(r?qS:0);o?i=new C1(o.type,o.attrs,sr.none,!0,n.topMatch||o.type.contentMatch,a):r?i=new C1(null,null,sr.none,!0,null,a):i=new C1(t.schema.topNodeType,null,sr.none,!0,null,a),this.nodes=[i],this.find=n.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(t,n){t.nodeType==3?this.addTextNode(t,n):t.nodeType==1&&this.addElement(t,n)}addTextNode(t,n){let r=t.nodeValue,o=this.top,i=o.options&DO?"full":this.localPreserveWS||(o.options&WS)>0,{schema:a}=this.parser;if(i==="full"||o.inlineContext(t)||/[^ \t\r\n\u000c]/.test(r)){if(i)if(i==="full")r=r.replace(/\r\n?/g,`
|
package/build/dist/client.json
CHANGED
|
@@ -64,6 +64,7 @@
|
|
|
64
64
|
"../kernel/src/document-authoring-actions.ts",
|
|
65
65
|
"../kernel/src/transcription-adoption.ts",
|
|
66
66
|
"../kernel/src/recording.ts",
|
|
67
|
+
"../kernel/src/production-captions.ts",
|
|
67
68
|
"../kernel/src/ir.ts",
|
|
68
69
|
"../kernel/src/anchors.ts",
|
|
69
70
|
"../kernel/src/diagnostics.ts",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lincyaw/dsh",
|
|
3
|
-
"version": "0.2.0-rc.
|
|
3
|
+
"version": "0.2.0-rc.85",
|
|
4
4
|
"description": "Presmium's bundle for DeepSeek Harness: the workbench of presmium studio, its host side (Presmium's tools, approvals, document context, skills and routes) and its client side (the root layout and the workbench's panels, precompiled) (experimental)",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -85,10 +85,10 @@
|
|
|
85
85
|
"node-addon-require-builtin": "0.1.9",
|
|
86
86
|
"ws": "8.22.0",
|
|
87
87
|
"zod": "4.4.3",
|
|
88
|
-
"@lincyaw/
|
|
89
|
-
"@lincyaw/
|
|
90
|
-
"@lincyaw/skills": "1.0.0-rc.
|
|
91
|
-
"@lincyaw/
|
|
88
|
+
"@lincyaw/cli": "1.0.0-rc.86",
|
|
89
|
+
"@lincyaw/kernel": "1.0.0-rc.86",
|
|
90
|
+
"@lincyaw/skills": "1.0.0-rc.86",
|
|
91
|
+
"@lincyaw/mcp": "1.0.0-rc.86"
|
|
92
92
|
},
|
|
93
93
|
"peerDependencies": {
|
|
94
94
|
"@deepseek-ai/dsh": "0.2.1-alpha.4"
|
|
@@ -104,8 +104,8 @@
|
|
|
104
104
|
"react": "18.3.1",
|
|
105
105
|
"react-dom": "18.3.1",
|
|
106
106
|
"react-resizable-panels": "^4.14.5",
|
|
107
|
-
"@lincyaw/
|
|
108
|
-
"@lincyaw/
|
|
107
|
+
"@lincyaw/design": "1.0.0-rc.86",
|
|
108
|
+
"@lincyaw/workbench": "0.2.0-rc.86"
|
|
109
109
|
},
|
|
110
110
|
"scripts": {}
|
|
111
111
|
}
|