@lvl99dotcom/edaha-editor 0.3.0 → 0.4.1

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.
Files changed (37) hide show
  1. package/README.md +8 -1
  2. package/dist/client/assets/index--k7n6Qb8.css +1 -0
  3. package/dist/client/assets/{index-BwcJ6yrI.js → index-owkKXGfS.js} +140 -126
  4. package/dist/client/index.html +2 -2
  5. package/dist/client-lib/index.js +4037 -0
  6. package/dist/client-lib/style.css +1569 -0
  7. package/dist/editor/index.d.ts +24 -1
  8. package/dist/editor/index.js +15 -1
  9. package/dist/server/store/index.d.ts +2 -1
  10. package/dist/server/store/index.js +4 -3
  11. package/dist/types/client/components/define/index.d.ts +7 -0
  12. package/dist/types/client/components/edaha-article/index.d.ts +380 -0
  13. package/dist/types/client/components/edaha-article-browser/index.d.ts +162 -0
  14. package/dist/types/client/components/edaha-article-data-field/index.d.ts +121 -0
  15. package/dist/types/client/components/edaha-article-data-group/index.d.ts +40 -0
  16. package/dist/types/client/components/edaha-editor/index.d.ts +289 -0
  17. package/dist/types/client/components/edaha-embed-dialog/index.d.ts +84 -0
  18. package/dist/types/client/components/edaha-file-browser/index.d.ts +203 -0
  19. package/dist/types/client/components/edaha-markdown/index.d.ts +70 -0
  20. package/dist/types/client/components/edaha-metadata-field/index.d.ts +100 -0
  21. package/dist/types/client/components/edaha-richtext/index.d.ts +88 -0
  22. package/dist/types/client/components/edaha-toasts/index.d.ts +47 -0
  23. package/dist/types/client/dates/index.d.ts +14 -0
  24. package/dist/types/client/editorApi/index.d.ts +129 -0
  25. package/dist/types/client/embeds/index.d.ts +74 -0
  26. package/dist/types/client/icons/index.d.ts +60 -0
  27. package/dist/types/client/index.d.ts +3 -0
  28. package/dist/types/client/markdown/index.d.ts +163 -0
  29. package/dist/types/client/metadataForm/index.d.ts +77 -0
  30. package/dist/types/client/narrow/index.d.ts +21 -0
  31. package/dist/types/client/richtext/editor/index.d.ts +34 -0
  32. package/dist/types/client/richtext/extensions/index.d.ts +90 -0
  33. package/dist/types/client/sortTable/index.d.ts +24 -0
  34. package/dist/types/client/theme/index.d.ts +48 -0
  35. package/dist/types/server/types/index.d.ts +251 -0
  36. package/package.json +15 -10
  37. package/dist/client/assets/index-D2Y17Fm-.css +0 -1
@@ -1,9 +1,9 @@
1
1
  var e=Object.defineProperty,t=Object.getOwnPropertyDescriptor,n=Object.getOwnPropertyNames,r=Object.prototype.hasOwnProperty,i=(e,t,n)=>()=>{if(n)throw n[0];try{return e&&(t=e(e=0)),t}catch(e){throw n=[e],e}},a=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t,t.exports),e=null),t.exports),o=(t,n)=>{let r={};for(var i in t)e(r,i,{get:t[i],enumerable:!0});return n||e(r,Symbol.toStringTag,{value:`Module`}),r},s=(i,a,o,s)=>{if(a&&typeof a==`object`||typeof a==`function`)for(var c=n(a),l=0,u=c.length,d;l<u;l++)d=c[l],!r.call(i,d)&&d!==o&&e(i,d,{get:(e=>a[e]).bind(null,d),enumerable:!(s=t(a,d))||s.enumerable});return i},c=t=>r.call(t,`module.exports`)?t[`module.exports`]:s(e({},`__esModule`,{value:!0}),t);(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),t.credentials=e.crossOrigin===`use-credentials`?`include`:e.crossOrigin===`anonymous`?`omit`:`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var l=globalThis,u=l.ShadowRoot&&(l.ShadyCSS===void 0||l.ShadyCSS.nativeShadow)&&`adoptedStyleSheets`in Document.prototype&&`replace`in CSSStyleSheet.prototype,d=Symbol(),f=new WeakMap,p=class{constructor(e,t,n){if(this._$cssResult$=!0,n!==d)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o,t=this.t;if(u&&e===void 0){let n=t!==void 0&&t.length===1;n&&(e=f.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),n&&f.set(t,e))}return e}toString(){return this.cssText}},m=e=>new p(typeof e==`string`?e:e+``,void 0,d),h=(e,t)=>{if(u)e.adoptedStyleSheets=t.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet);else for(let n of t){let t=document.createElement(`style`),r=l.litNonce;r!==void 0&&t.setAttribute(`nonce`,r),t.textContent=n.cssText,e.appendChild(t)}},g=u?e=>e:e=>e instanceof CSSStyleSheet?(e=>{let t=``;for(let n of e.cssRules)t+=n.cssText;return m(t)})(e):e,{is:_,defineProperty:v,getOwnPropertyDescriptor:y,getOwnPropertyNames:b,getOwnPropertySymbols:x,getPrototypeOf:S}=Object,C=globalThis,w=C.trustedTypes,ee=w?w.emptyScript:``,T=C.reactiveElementPolyfillSupport,te=(e,t)=>e,ne={toAttribute(e,t){switch(t){case Boolean:e=e?ee:null;break;case Object:case Array:e=e==null?e:JSON.stringify(e)}return e},fromAttribute(e,t){let n=e;switch(t){case Boolean:n=e!==null;break;case Number:n=e===null?null:Number(e);break;case Object:case Array:try{n=JSON.parse(e)}catch{n=null}}return n}},re=(e,t)=>!_(e,t),ie={attribute:!0,type:String,converter:ne,reflect:!1,useDefault:!1,hasChanged:re};Symbol.metadata??=Symbol(`metadata`),C.litPropertyMetadata??=new WeakMap;var ae=class extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??=[]).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=ie){if(t.state&&(t.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(e)&&((t=Object.create(t)).wrapped=!0),this.elementProperties.set(e,t),!t.noAccessor){let n=Symbol(),r=this.getPropertyDescriptor(e,n,t);r!==void 0&&v(this.prototype,e,r)}}static getPropertyDescriptor(e,t,n){let{get:r,set:i}=y(this.prototype,e)??{get(){return this[t]},set(e){this[t]=e}};return{get:r,set(t){let a=r?.call(this);i?.call(this,t),this.requestUpdate(e,a,n)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??ie}static _$Ei(){if(this.hasOwnProperty(te(`elementProperties`)))return;let e=S(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(te(`finalized`)))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(te(`properties`))){let e=this.properties,t=[...b(e),...x(e)];for(let n of t)this.createProperty(n,e[n])}let e=this[Symbol.metadata];if(e!==null){let t=litPropertyMetadata.get(e);if(t!==void 0)for(let[e,n]of t)this.elementProperties.set(e,n)}this._$Eh=new Map;for(let[e,t]of this.elementProperties){let n=this._$Eu(e,t);n!==void 0&&this._$Eh.set(n,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){let t=[];if(Array.isArray(e)){let n=new Set(e.flat(1/0).reverse());for(let e of n)t.unshift(g(e))}else e!==void 0&&t.push(g(e));return t}static _$Eu(e,t){let n=t.attribute;return!1===n?void 0:typeof n==`string`?n:typeof e==`string`?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(e=>e(this))}addController(e){(this._$EO??=new Set).add(e),this.renderRoot!==void 0&&this.isConnected&&e.hostConnected?.()}removeController(e){this._$EO?.delete(e)}_$E_(){let e=new Map,t=this.constructor.elementProperties;for(let n of t.keys())this.hasOwnProperty(n)&&(e.set(n,this[n]),delete this[n]);e.size>0&&(this._$Ep=e)}createRenderRoot(){let e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return h(e,this.constructor.elementStyles),e}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(e=>e.hostConnected?.())}enableUpdating(e){}disconnectedCallback(){this._$EO?.forEach(e=>e.hostDisconnected?.())}attributeChangedCallback(e,t,n){this._$AK(e,n)}_$ET(e,t){let n=this.constructor.elementProperties.get(e),r=this.constructor._$Eu(e,n);if(r!==void 0&&!0===n.reflect){let i=(n.converter?.toAttribute===void 0?ne:n.converter).toAttribute(t,n.type);this._$Em=e,i==null?this.removeAttribute(r):this.setAttribute(r,i),this._$Em=null}}_$AK(e,t){let n=this.constructor,r=n._$Eh.get(e);if(r!==void 0&&this._$Em!==r){let e=n.getPropertyOptions(r),i=typeof e.converter==`function`?{fromAttribute:e.converter}:e.converter?.fromAttribute===void 0?ne:e.converter;this._$Em=r;let a=i.fromAttribute(t,e.type);this[r]=a??this._$Ej?.get(r)??a,this._$Em=null}}requestUpdate(e,t,n,r=!1,i){if(e!==void 0){let a=this.constructor;if(!1===r&&(i=this[e]),n??=a.getPropertyOptions(e),!((n.hasChanged??re)(i,t)||n.useDefault&&n.reflect&&i===this._$Ej?.get(e)&&!this.hasAttribute(a._$Eu(e,n))))return;this.C(e,t,n)}!1===this.isUpdatePending&&(this._$ES=this._$EP())}C(e,t,{useDefault:n,reflect:r,wrapped:i},a){n&&!(this._$Ej??=new Map).has(e)&&(this._$Ej.set(e,a??t??this[e]),!0!==i||a!==void 0)||(this._$AL.has(e)||(this.hasUpdated||n||(t=void 0),this._$AL.set(e,t)),!0===r&&this._$Em!==e&&(this._$Eq??=new Set).add(e))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(e){Promise.reject(e)}let e=this.scheduleUpdate();return e!=null&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(let[e,t]of this._$Ep)this[e]=t;this._$Ep=void 0}let e=this.constructor.elementProperties;if(e.size>0)for(let[t,n]of e){let{wrapped:e}=n,r=this[t];!0!==e||this._$AL.has(t)||r===void 0||this.C(t,void 0,n,r)}}let e=!1,t=this._$AL;try{e=this.shouldUpdate(t),e?(this.willUpdate(t),this._$EO?.forEach(e=>e.hostUpdate?.()),this.update(t)):this._$EM()}catch(t){throw e=!1,this._$EM(),t}e&&this._$AE(t)}willUpdate(e){}_$AE(e){this._$EO?.forEach(e=>e.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(e){return!0}update(e){this._$Eq&&=this._$Eq.forEach(e=>this._$ET(e,this[e])),this._$EM()}updated(e){}firstUpdated(e){}};ae.elementStyles=[],ae.shadowRootOptions={mode:`open`},ae[te(`elementProperties`)]=new Map,ae[te(`finalized`)]=new Map,T?.({ReactiveElement:ae}),(C.reactiveElementVersions??=[]).push(`2.1.2`);var oe=globalThis,se=e=>e,ce=oe.trustedTypes,le=ce?ce.createPolicy(`lit-html`,{createHTML:e=>e}):void 0,ue=`$lit$`,de=`lit$${Math.random().toFixed(9).slice(2)}$`,fe=`?`+de,pe=`<${fe}>`,me=document,he=()=>me.createComment(``),ge=e=>e===null||typeof e!=`object`&&typeof e!=`function`,_e=Array.isArray,ve=e=>_e(e)||typeof e?.[Symbol.iterator]==`function`,ye=`[
2
- \f\r]`,be=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,xe=/-->/g,Se=/>/g,Ce=RegExp(`>|${ye}(?:([^\\s"'>=/]+)(${ye}*=${ye}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,`g`),we=/'/g,Te=/"/g,Ee=/^(?:script|style|textarea|title)$/i,E=(e=>(t,...n)=>({_$litType$:e,strings:t,values:n}))(1),De=Symbol.for(`lit-noChange`),D=Symbol.for(`lit-nothing`),Oe=new WeakMap,ke=me.createTreeWalker(me,129);function Ae(e,t){if(!_e(e)||!e.hasOwnProperty(`raw`))throw Error(`invalid template strings array`);return le===void 0?t:le.createHTML(t)}var je=(e,t)=>{let n=e.length-1,r=[],i,a=t===2?`<svg>`:t===3?`<math>`:``,o=be;for(let t=0;t<n;t++){let n=e[t],s,c,l=-1,u=0;for(;u<n.length&&(o.lastIndex=u,c=o.exec(n),c!==null);)u=o.lastIndex,o===be?c[1]===`!--`?o=xe:c[1]===void 0?c[2]===void 0?c[3]!==void 0&&(o=Ce):(Ee.test(c[2])&&(i=RegExp(`</`+c[2],`g`)),o=Ce):o=Se:o===Ce?c[0]===`>`?(o=i??be,l=-1):c[1]===void 0?l=-2:(l=o.lastIndex-c[2].length,s=c[1],o=c[3]===void 0?Ce:c[3]===`"`?Te:we):o===Te||o===we?o=Ce:o===xe||o===Se?o=be:(o=Ce,i=void 0);let d=o===Ce&&e[t+1].startsWith(`/>`)?` `:``;a+=o===be?n+pe:l>=0?(r.push(s),n.slice(0,l)+ue+n.slice(l)+de+d):n+de+(l===-2?t:d)}return[Ae(e,a+(e[n]||`<?>`)+(t===2?`</svg>`:t===3?`</math>`:``)),r]},Me=class e{constructor({strings:t,_$litType$:n},r){let i;this.parts=[];let a=0,o=0,s=t.length-1,c=this.parts,[l,u]=je(t,n);if(this.el=e.createElement(l,r),ke.currentNode=this.el.content,n===2||n===3){let e=this.el.content.firstChild;e.replaceWith(...e.childNodes)}for(;(i=ke.nextNode())!==null&&c.length<s;){if(i.nodeType===1){if(i.hasAttributes())for(let e of i.getAttributeNames())if(e.endsWith(ue)){let t=u[o++],n=i.getAttribute(e).split(de),r=/([.?@])?(.*)/.exec(t);c.push({type:1,index:a,name:r[2],strings:n,ctor:r[1]===`.`?Le:r[1]===`?`?Re:r[1]===`@`?ze:Ie}),i.removeAttribute(e)}else e.startsWith(de)&&(c.push({type:6,index:a}),i.removeAttribute(e));if(Ee.test(i.tagName)){let e=i.textContent.split(de),t=e.length-1;if(t>0){i.textContent=ce?ce.emptyScript:``;for(let n=0;n<t;n++)i.append(e[n],he()),ke.nextNode(),c.push({type:2,index:++a});i.append(e[t],he())}}}else if(i.nodeType===8){if(i.data===fe)c.push({type:2,index:a});else{let e=-1;for(;(e=i.data.indexOf(de,e+1))!==-1;)c.push({type:7,index:a}),e+=de.length-1}}a++}}static createElement(e,t){let n=me.createElement(`template`);return n.innerHTML=e,n}};function Ne(e,t,n=e,r){if(t===De)return t;let i=r===void 0?n._$Cl:n._$Co?.[r],a=ge(t)?void 0:t._$litDirective$;return i?.constructor!==a&&(i?._$AO?.(!1),a===void 0?i=void 0:(i=new a(e),i._$AT(e,n,r)),r===void 0?n._$Cl=i:(n._$Co??=[])[r]=i),i!==void 0&&(t=Ne(e,i._$AS(e,t.values),i,r)),t}var Pe=class{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){let{el:{content:t},parts:n}=this._$AD,r=(e?.creationScope??me).importNode(t,!0);ke.currentNode=r;let i=ke.nextNode(),a=0,o=0,s=n[0];for(;s!==void 0;){if(a===s.index){let t;s.type===2?t=new Fe(i,i.nextSibling,this,e):s.type===1?t=new s.ctor(i,s.name,s.strings,this,e):s.type===6&&(t=new Be(i,this,e)),this._$AV.push(t),s=n[++o]}a!==s?.index&&(i=ke.nextNode(),a++)}return ke.currentNode=me,r}p(e){let t=0;for(let n of this._$AV)n!==void 0&&(n.strings===void 0?n._$AI(e[t]):(n._$AI(e,n,t),t+=n.strings.length-2)),t++}},Fe=class e{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,t,n,r){this.type=2,this._$AH=D,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=n,this.options=r,this._$Cv=r?.isConnected??!0}get parentNode(){let e=this._$AA.parentNode,t=this._$AM;return t!==void 0&&e?.nodeType===11&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=Ne(this,e,t),ge(e)?e===D||e==null||e===``?(this._$AH!==D&&this._$AR(),this._$AH=D):e!==this._$AH&&e!==De&&this._(e):e._$litType$===void 0?e.nodeType===void 0?ve(e)?this.k(e):this._(e):this.T(e):this.$(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==D&&ge(this._$AH)?this._$AA.nextSibling.data=e:this.T(me.createTextNode(e)),this._$AH=e}$(e){let{values:t,_$litType$:n}=e,r=typeof n==`number`?this._$AC(e):(n.el===void 0&&(n.el=Me.createElement(Ae(n.h,n.h[0]),this.options)),n);if(this._$AH?._$AD===r)this._$AH.p(t);else{let e=new Pe(r,this),n=e.u(this.options);e.p(t),this.T(n),this._$AH=e}}_$AC(e){let t=Oe.get(e.strings);return t===void 0&&Oe.set(e.strings,t=new Me(e)),t}k(t){_e(this._$AH)||(this._$AH=[],this._$AR());let n=this._$AH,r,i=0;for(let a of t)i===n.length?n.push(r=new e(this.O(he()),this.O(he()),this,this.options)):r=n[i],r._$AI(a),i++;i<n.length&&(this._$AR(r&&r._$AB.nextSibling,i),n.length=i)}_$AR(e=this._$AA.nextSibling,t){for(this._$AP?.(!1,!0,t);e!==this._$AB;){let t=se(e).nextSibling;se(e).remove(),e=t}}setConnected(e){this._$AM===void 0&&(this._$Cv=e,this._$AP?.(e))}},Ie=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,n,r,i){this.type=1,this._$AH=D,this._$AN=void 0,this.element=e,this.name=t,this._$AM=r,this.options=i,n.length>2||n[0]!==``||n[1]!==``?(this._$AH=Array(n.length-1).fill(new String),this.strings=n):this._$AH=D}_$AI(e,t=this,n,r){let i=this.strings,a=!1;if(i===void 0)e=Ne(this,e,t,0),a=!ge(e)||e!==this._$AH&&e!==De,a&&(this._$AH=e);else{let r=e,o,s;for(e=i[0],o=0;o<i.length-1;o++)s=Ne(this,r[n+o],t,o),s===De&&(s=this._$AH[o]),a||=!ge(s)||s!==this._$AH[o],s===D?e=D:e!==D&&(e+=(s??``)+i[o+1]),this._$AH[o]=s}a&&!r&&this.j(e)}j(e){e===D?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??``)}},Le=class extends Ie{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===D?void 0:e}},Re=class extends Ie{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==D)}},ze=class extends Ie{constructor(e,t,n,r,i){super(e,t,n,r,i),this.type=5}_$AI(e,t=this){if((e=Ne(this,e,t,0)??D)===De)return;let n=this._$AH,r=e===D&&n!==D||e.capture!==n.capture||e.once!==n.once||e.passive!==n.passive,i=e!==D&&(n===D||r);r&&this.element.removeEventListener(this.name,this,n),i&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){typeof this._$AH==`function`?this._$AH.call(this.options?.host??this.element,e):this._$AH.handleEvent(e)}},Be=class{constructor(e,t,n){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=n}get _$AU(){return this._$AM._$AU}_$AI(e){Ne(this,e)}},Ve={M:ue,P:de,A:fe,C:1,L:je,R:Pe,D:ve,V:Ne,I:Fe,H:Ie,N:Re,U:ze,B:Le,F:Be},He=oe.litHtmlPolyfillSupport;He?.(Me,Fe),(oe.litHtmlVersions??=[]).push(`3.3.3`);var Ue=(e,t,n)=>{let r=n?.renderBefore??t,i=r._$litPart$;if(i===void 0){let e=n?.renderBefore??null;r._$litPart$=i=new Fe(t.insertBefore(he(),e),e,void 0,n??{})}return i._$AI(e),i},We=globalThis,Ge=class extends ae{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){let e=super.createRenderRoot();return this.renderOptions.renderBefore??=e.firstChild,e}update(e){let t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=Ue(t,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return De}};Ge._$litElement$=!0,Ge.finalized=!0,We.litElementHydrateSupport?.({LitElement:Ge});var Ke=We.litElementPolyfillSupport;Ke?.({LitElement:Ge}),(We.litElementVersions??=[]).push(`4.2.2`);var qe={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},Je=e=>(...t)=>({_$litDirective$:e,values:t}),Ye=class{constructor(e){}get _$AU(){return this._$AM._$AU}_$AT(e,t,n){this._$Ct=e,this._$AM=t,this._$Ci=n}_$AS(e,t){return this.update(e,t)}update(e,t){return this.render(...t)}},Xe=Je(class extends Ye{constructor(e){if(super(e),e.type!==qe.ATTRIBUTE||e.name!==`class`||e.strings?.length>2)throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.")}render(e){return` `+Object.keys(e).filter(t=>e[t]).join(` `)+` `}update(e,[t]){if(this.st===void 0){this.st=new Set,e.strings!==void 0&&(this.nt=new Set(e.strings.join(` `).split(/\s/).filter(e=>e!==``)));for(let e in t)t[e]&&!this.nt?.has(e)&&this.st.add(e);return this.render(t)}let n=e.element.classList;for(let e of this.st)e in t||(n.remove(e),this.st.delete(e));for(let e in t){let r=!!t[e];r===this.st.has(e)||this.nt?.has(e)||(r?(n.add(e),this.st.add(e)):(n.remove(e),this.st.delete(e)))}return De}}),{I:Ze}=Ve,Qe=e=>e,$e=e=>e.strings===void 0,et=()=>document.createComment(``),tt=(e,t,n)=>{let r=e._$AA.parentNode,i=t===void 0?e._$AB:t._$AA;if(n===void 0)n=new Ze(r.insertBefore(et(),i),r.insertBefore(et(),i),e,e.options);else{let t=n._$AB.nextSibling,a=n._$AM,o=a!==e;if(o){let t;n._$AQ?.(e),n._$AM=e,n._$AP!==void 0&&(t=e._$AU)!==a._$AU&&n._$AP(t)}if(t!==i||o){let e=n._$AA;for(;e!==t;){let t=Qe(e).nextSibling;Qe(r).insertBefore(e,i),e=t}}}return n},nt=(e,t,n=e)=>(e._$AI(t,n),e),rt={},it=(e,t=rt)=>e._$AH=t,at=e=>e._$AH,ot=e=>{e._$AR(),e._$AA.remove()},st=Je(class extends Ye{constructor(){super(...arguments),this.key=D}render(e,t){return this.key=e,t}update(e,[t,n]){return t!==this.key&&(it(e),this.key=t),n}}),ct=class extends Error{problems;constructor(e,t){super(e),this.problems=t}},lt=e=>{let t=new URLSearchParams(Object.entries(e).filter(([,e])=>e!==void 0&&e!==``).map(([e,t])=>[e,String(t)]));return t.size?`?${t}`:``},ut=({type:e,slug:t,name:n})=>`/api/files/${e}/${t}/${encodeURIComponent(n)}`,dt=class{fetch;constructor(e=(...e)=>fetch(...e)){this.fetch=e}async request(e,t){let n=await this.fetch(e,t);if(n.status===204)return;let r=await n.json().catch(()=>({}));if(!n.ok)throw new ct(r.error??`Request failed with ${n.status}`,r.problems);return r}send(e,t,n){return this.request(t,{method:e,headers:{"Content-Type":`application/json`},body:JSON.stringify(n)})}query(e={}){return this.request(`/api/articles${lt(e)}`)}queryFiles(e={}){return this.request(`/api/files${lt(e)}`)}fileFilters(){return this.request(`/api/files/filters`)}fileReferences(e){return this.request(`${ut(e)}/references`)}replaceFile(e,t){let n=new FormData;return n.append(`file`,t),this.request(ut(e),{method:`PUT`,body:n})}deleteFile(e){return this.request(ut(e),{method:`DELETE`})}recent(){return this.request(`/api/articles/recent`)}filters(){return this.request(`/api/articles/filters`)}metadata(){return this.request(`/api/metadata`)}site(){return this.request(`/api/site`)}types(){return this.request(`/api/types`)}templates(e){return this.request(`/api/templates/${e}`)}read({type:e,slug:t}){return this.request(`/api/articles/${e}/${t}`)}create(e){return this.send(`POST`,`/api/articles`,e)}save(e,t){return this.send(`PUT`,`/api/articles/${e.type}/${e.slug}`,t)}remove({type:e,slug:t}){return this.request(`/api/articles/${e}/${t}`,{method:`DELETE`})}embeds(){return this.request(`/api/embeds`)}async validateEmbed(e,t,n={}){return(await this.send(`POST`,`/api/embed-validations`,{key:e,content:t,options:n})).errors}embedFrame(e,t,n={}){return this.send(`POST`,`/api/embed-frames`,{key:e,content:t,options:n})}async toMarkdown(e,t){return(await this.send(`POST`,`/api/convert/markdown`,{html:e,location:t})).markdown}async toHtml(e,t){return(await this.send(`POST`,`/api/convert/html`,{markdown:e,location:t})).html}async preview(e,t){return(await this.send(`POST`,`/api/preview`,{data:e,location:t})).url}upload({type:e,slug:t},n){let r=new FormData;return r.append(`file`,n),this.request(`/api/articles/${e}/${t}/files`,{method:`POST`,body:r})}},ft=(e,t)=>{customElements.get(e)||customElements.define(e,t)},pt=`important`,mt=` !`+pt,ht=Je(class extends Ye{constructor(e){if(super(e),e.type!==qe.ATTRIBUTE||e.name!==`style`||e.strings?.length>2)throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.")}render(e){return Object.keys(e).reduce((t,n)=>{let r=e[n];return r==null?t:t+`${n=n.includes(`-`)?n:n.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,`-$&`).toLowerCase()}:${r};`},``)}update(e,[t]){let{style:n}=e.element;if(this.ft===void 0)return this.ft=new Set(Object.keys(t)),this.render(t);for(let e of this.ft)t[e]??(this.ft.delete(e),e.includes(`-`)?n.removeProperty(e):n[e]=null);for(let e in t){let r=t[e];if(r!=null){this.ft.add(e);let t=typeof r==`string`&&r.endsWith(mt);e.includes(`-`)||t?n.setProperty(e,t?r.slice(0,-11):r,t?pt:``):n[e]=r}}return De}}),gt={ß:`ss`,æ:`ae`,œ:`oe`,ø:`o`,đ:`d`,ð:`d`,ł:`l`,þ:`th`,ı:`i`},_t=e=>e.normalize(`NFKD`).replace(/\p{Diacritic}/gu,``).toLowerCase().replace(/[ßæœøđðłþı]/g,e=>gt[e]).replace(/['"‘’“”`´]/g,``).replace(/[^a-z0-9]+/g,`-`).replace(/^-+|-+$/g,``),vt=e=>{let t=new Set;return e.map(e=>{let n=_t(e);if(!n)return``;let r=n;for(let e=2;t.has(r);e++)r=`${n}-${e}`;return t.add(r),r})},yt=e=>String(e).padStart(2,`0`),bt=e=>{let t=new Date(e);return`${t.getFullYear()}-${yt(t.getMonth()+1)}-${yt(t.getDate())}T${yt(t.getHours())}:${yt(t.getMinutes())}`},xt=e=>{let t=new Date(e);return e&&!Number.isNaN(t.getTime())?t.toISOString():``},St=Je(class extends Ye{constructor(e){if(super(e),e.type!==qe.PROPERTY&&e.type!==qe.ATTRIBUTE&&e.type!==qe.BOOLEAN_ATTRIBUTE)throw Error("The `live` directive is not allowed on child or event bindings");if(!$e(e))throw Error("`live` bindings can only contain a single expression")}render(e){return e}update(e,[t]){if(t===De||t===D)return t;let n=e.element,r=e.name;if(e.type===qe.PROPERTY){if(t===n[r])return De}else if(e.type===qe.BOOLEAN_ATTRIBUTE){if(!!t===n.hasAttribute(r))return De}else if(e.type===qe.ATTRIBUTE&&n.getAttribute(r)===t+``)return De;return it(e),t}}),Ct=class extends Ye{constructor(e){if(super(e),this.it=D,e.type!==qe.CHILD)throw Error(this.constructor.directiveName+`() can only be used in child bindings`)}render(e){if(e===D||e==null)return this._t=void 0,this.it=e;if(e===De)return e;if(typeof e!=`string`)throw Error(this.constructor.directiveName+`() called with a non-string value`);if(e===this.it)return this._t;this.it=e;let t=[e];return t.raw=t,this._t={_$litType$:this.constructor.resultType,strings:t,values:[]}}};Ct.directiveName=`unsafeHTML`,Ct.resultType=1;var wt=Je(Ct),Tt={add_column_right:`<svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M140-780v600h269v-600H140ZM80-120v-720h720v150h-60v-90H469v600h271v-90h60v150H80Zm389-360Zm-60 0h60-60Zm0 0Zm331 110v-80h-80v-60h80v-80h60v80h80v60h-80v80h-60Z"/></svg>`,add_photo_alternate:`<svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M480-480ZM180-120q-24 0-42-18t-18-42v-600q0-24 18-42t42-18h365v60H180v600h600v-365h60v365q0 24-18 42t-42 18H180Zm60-162h480L576-474 449-307l-94-124-115 149Zm453-323v-87h-88v-60h88v-88h60v88h87v60h-87v87h-60Z"/></svg>`,add_row_below:`<svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M180-551h600v-269H180v269Zm-60 391v-720h720v720H690v-60h90v-271H180v271h90v60H120Zm360-331Zm0-60v60-60Zm0 0ZM450-80v-80h-80v-60h80v-80h60v80h80v60h-80v80h-60Z"/></svg>`,close:`<svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m249-207-42-42 231-231-231-231 42-42 231 231 231-231 42 42-231 231 231 231-42 42-231-231-231 231Z"/></svg>`,content_copy:`<svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M300-200q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H300Zm0-60h440v-560H300v560ZM180-80q-24 0-42-18t-18-42v-620h60v620h500v60H180Zm120-180v-560 560Z"/></svg>`,delete:`<svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M261-120q-24.75 0-42.37-17.63Q201-155.25 201-180v-570h-41v-60h188v-30h264v30h188v60h-41v570q0 24-18 42t-42 18H261Zm438-630H261v570h438v-570ZM367-266h60v-399h-60v399Zm166 0h60v-399h-60v399ZM261-750v570-570Z"/></svg>`,find_replace:`<svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M164-572q17-100 95.5-164T440-800q65 0 121.5 30t98.5 81v-111h60v228H492v-60h134q-32-48-80.5-78T440-740q-77 0-137.5 46.5T225-572h-61Zm633 452L613-304q-37 31-81 47t-92 16q-65 0-122.5-27T220-346v106h-60v-228h228v60H249q33 48 83 77.5T440-301q75 0 133.5-47T651-468h61q-5 34-19.5 64.5T656-347l184 184-43 43Z"/></svg>`,folder_open:`<svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M140-160q-23 0-41.5-18.5T80-220v-520q0-23 18.5-41.5T140-800h281l60 60h339q23 0 41.5 18.5T880-680H455l-60-60H140v520l102-400h698L833-206q-6 24-22 35t-41 11H140Zm63-60h572l84-340H287l-84 340Zm0 0 84-340-84 340Zm-63-460v-60 60Z"/></svg>`,code_blocks:`<svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m379-343 44-44-93-93 92-92-44-44-136 136 137 137Zm202 0 137-137-137-137-44 44 93 93-93 93 44 44ZM180-120q-24 0-42-18t-18-42v-600q0-24 18-42t42-18h600q24 0 42 18t18 42v600q0 24-18 42t-42 18H180Zm0-60h600v-600H180v600Zm0-600v600-600Z"/></svg>`,delete_sweep:`<svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M600-230v-60h145v60H600Zm0-368v-60h280v60H600Zm0 184v-60h235v60H600ZM125-675H80v-60h170v-45h135v45h170v60h-45v415q0 24-18 42t-42 18H185q-24 0-42-18t-18-42v-415Zm60 0v415h265v-415H185Zm0 0v415-415Z"/></svg>`,expand_circle_down:`<svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m480-351 173-173-43-42-130 130-130-130-43 42 173 173Zm0 271q-82 0-155-31.5t-127.5-86Q143-252 111.5-325T80-480q0-83 31.5-156t86-127Q252-817 325-848.5T480-880q83 0 156 31.5T763-763q54 54 85.5 127T880-480q0 82-31.5 155T763-197.5q-54 54.5-127 86T480-80Zm0-60q142 0 241-99.5T820-480q0-142-99-241t-241-99q-141 0-240.5 99T140-480q0 141 99.5 240.5T480-140Zm0-340Z"/></svg>`,format_bold:`<svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M275-200v-560h228q66 0 114.5 42T666-612q0 38-21 70t-56 49v6q43 14 69.5 50t26.5 81q0 68-52.5 112T510-200H275Zm86-76h144q38 0 66-25t28-63q0-37-28-62t-66-25H361v175Zm0-247h136q35 0 60.5-23t25.5-58q0-35-25.5-58.5T497-686H361v163Z"/></svg>`,format_h1:`<svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M200-280v-400h60v170h180v-170h60v400h-60v-170H260v170h-60Zm500 0v-340h-80v-60h140v400h-60Z"/></svg>`,format_h2:`<svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M120-280v-400h60v170h180v-170h60v400h-60v-170H180v170h-60Zm420 0v-170q0-24.75 17.63-42.38Q575.25-510 600-510h180v-110H540v-60h240q25 0 42.5 17.62Q840-644.75 840-620v110q0 24.75-17.62 42.37Q804.75-450 780-450H600v110h240v60H540Z"/></svg>`,format_h3:`<svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M120-280v-400h60v170h180v-170h60v400h-60v-170H180v170h-60Zm420 0v-60h240v-110H620v-60h160v-110H540v-60h240q25 0 42.5 17.62Q840-644.75 840-620v280q0 24.75-17.62 42.37Q804.75-280 780-280H540Z"/></svg>`,format_italic:`<svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M224-199v-80h134l139-409H338v-80h380v80H584L445-279h159v80H224Z"/></svg>`,format_list_bulleted:`<svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M377-198v-60h463v60H377Zm0-252v-60h463v60H377Zm0-253v-60h463v60H377ZM189-161q-28.05 0-48.02-19Q121-199 121-227.5t19.5-48q19.5-19.5 48-19.5t47.5 19.98q19 19.97 19 48.02 0 27.23-19.39 46.61Q216.23-161 189-161Zm0-252q-28.05 0-48.02-19.5Q121-452 121-480t19.98-47.5Q160.95-547 189-547q27.23 0 46.61 19.5Q255-508 255-480t-19.39 47.5Q216.23-413 189-413Zm-48.5-272.5Q121-705 121-733t19.5-47.5Q160-800 188-800t47.5 19.5Q255-761 255-733t-19.5 47.5Q216-666 188-666t-47.5-19.5Z"/></svg>`,format_list_numbered:`<svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M120-80v-60h100v-30h-60v-60h60v-30H120v-60h120q17 0 28.5 11.5T280-280v40q0 17-11.5 28.5T240-200q17 0 28.5 11.5T280-160v40q0 17-11.5 28.5T240-80H120Zm0-280v-110q0-17 11.5-28.5T160-510h60v-30H120v-60h120q17 0 28.5 11.5T280-560v70q0 17-11.5 28.5T240-450h-60v30h100v60H120Zm60-280v-180h-60v-60h120v240h-60Zm189 431v-60h471v60H369Zm0-243v-60h471v60H369Zm0-243v-60h471v60H369Z"/></svg>`,format_quote:`<svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m248-240 94-162q-5 1-11 1.5t-11 .5q-66 0-113-47t-47-113q0-66 47-113t113-47q66 0 113 47t47 113q0 21-5.5 41T458-480L320-240h-72Zm360 0 94-162q-5 1-11 1.5t-11 .5q-66 0-113-47t-47-113q0-66 47-113t113-47q66 0 113 47t47 113q0 21-5.5 41T818-480L680-240h-72ZM376.5-503.5Q400-527 400-560t-23.5-56.5Q353-640 320-640t-56.5 23.5Q240-593 240-560t23.5 56.5Q287-480 320-480t56.5-23.5Zm360 0Q760-527 760-560t-23.5-56.5Q713-640 680-640t-56.5 23.5Q600-593 600-560t23.5 56.5Q647-480 680-480t56.5-23.5ZM680-560Zm-360 0Z"/></svg>`,format_underlined:`<svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M200-140v-60h560v60H200Zm123.5-198.5Q267-397 267-497v-343h83v343q0 63 34 101t96 38q62 0 96-38t34-101v-343h83v343q0 100-56.5 158.5T480-280q-100 0-156.5-58.5Z"/></svg>`,fullscreen:`<svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M120-120v-193h60v133h133v60H120Zm527 0v-60h133v-133h60v193H647ZM120-647v-193h193v60H180v133h-60Zm660 0v-133H647v-60h193v193h-60Z"/></svg>`,fullscreen_exit:`<svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M253-120v-133H120v-60h193v193h-60Zm394 0v-193h193v60H707v133h-60ZM120-647v-60h133v-133h60v193H120Zm527 0v-193h60v133h133v60H647Z"/></svg>`,image:`<svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M180-120q-24 0-42-18t-18-42v-600q0-24 18-42t42-18h600q24 0 42 18t18 42v600q0 24-18 42t-42 18H180Zm0-60h600v-600H180v600Zm56-97h489L578-473 446-302l-93-127-117 152Zm-56 97v-600 600Z"/></svg>`,link:`<svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M450-280H280q-83 0-141.5-58.5T80-480q0-83 58.5-141.5T280-680h170v60H280q-58.33 0-99.17 40.76-40.83 40.77-40.83 99Q140-422 180.83-381q40.84 41 99.17 41h170v60ZM325-450v-60h310v60H325Zm185 170v-60h170q58.33 0 99.17-40.76 40.83-40.77 40.83-99Q820-538 779.17-579q-40.84-41-99.17-41H510v-60h170q83 0 141.5 58.5T880-480q0 83-58.5 141.5T680-280H510Z"/></svg>`,manage_search:`<svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M80-200v-60h400v60H80Zm0-210v-60h200v60H80Zm0-210v-60h200v60H80Zm758 420L678-360q-26 20-56 30t-62 10q-83 0-141.5-58.5T360-520q0-83 58.5-141.5T560-720q83 0 141.5 58.5T760-520q0 32-10 62t-30 56l160 160-42 42ZM559.76-380Q618-380 659-420.76q41-40.77 41-99Q700-578 659.24-619q-40.77-41-99-41Q502-660 461-619.24q-41 40.77-41 99Q420-462 460.76-421q40.77 41 99 41Z"/></svg>`,menu:`<svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M120-240v-60h720v60H120Zm0-210v-60h720v60H120Zm0-210v-60h720v60H120Z"/></svg>`,playlist_remove:`<svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m571-80-43-43 114-113-114-113 43-43 113 114 113-114 43 43-114 113 114 113-43 43-113-114L571-80ZM120-330v-60h300v60H120Zm0-165v-60h470v60H120Zm0-165v-60h470v60H120Z"/></svg>`,raw_on:`<svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M120-360v-240h144q23 0 35.5 12.5T312-552v63q0 20-12 30.5T271-446l37 86h-50l-32-81h-58v81h-48Zm226 0 66-240h84l70 240h-54l-18-61h-82l-15 61h-51Zm290 0-61-240h49l37 142 34-142h45l37 142 33-142h50l-58 240h-50l-33-131-37 131h-46ZM426-469h53l-18-67h-17l-18 67Zm-258-20h96v-63h-96v63Z"/></svg>`,read_more:`<svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m288-276-42-42 131-132H80v-60h297L246-642l42-42 204 204-204 204Zm252-34v-60h340v60H540Zm0-280v-60h340v60H540Zm120 140v-60h220v60H660Z"/></svg>`,smart_display:`<svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m392-313 260-169-260-169v338ZM140-160q-24 0-42-18t-18-42v-520q0-24 18-42t42-18h680q24 0 42 18t18 42v520q0 24-18 42t-42 18H140Zm0-60h680v-520H140v520Zm0 0v-520 520Z"/></svg>`,strikethrough_s:`<svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M504-160q-78 0-142-41.5T269-313l69-29q20 48 65 77t101 29q52 0 83-27t31-73q0-23-9.5-48.5T582-430h84q14 23 21 46t7 48q0 78-53 127t-137 49ZM80-490v-60h800v60H80Zm394-316q66 0 117 31t75 86l-69 31q-14-34-46.5-53T474-730q-49 0-79 24t-30 66q0 8 1 15t3 15h-74q-2-8-3-16t-1-16q0-73 51-118.5T474-806Z"/></svg>`,table:`<svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M180-120q-24 0-42-18t-18-42v-600q0-24 18-42t42-18h600q24 0 42 18t18 42v600q0 24-18 42t-42 18H180Zm270-250H180v190h270v-190Zm60 0v190h270v-190H510Zm-60-60v-190H180v190h270Zm60 0h270v-190H510v190ZM180-680h600v-100H180v100Z"/></svg>`,text_decrease:`<svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m40-200 220-560h80l220 560h-75l-57-150H172l-57 150H40Zm156-214h208L302-685h-4L196-414Zm414-36v-60h310v60H610Z"/></svg>`,text_increase:`<svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m40-200 220-560h80l220 560h-75l-57-150H172l-57 150H40Zm156-214h208L302-685h-4L196-414Zm534 94v-130H600v-60h130v-130h60v130h130v60H790v130h-60Z"/></svg>`},Et={Bold:`format_bold`,Italic:`format_italic`,Underline:`format_underlined`,Strikethrough:`strikethrough_s`,Small:`text_decrease`,Big:`text_increase`,Link:`link`,Heading:`format_h2`,Subheading:`format_h3`,"Heading 1":`format_h1`,"Heading 2":`format_h2`,"Heading 3":`format_h3`,"Bullet list":`format_list_bulleted`,"Numbered list":`format_list_numbered`,Quote:`format_quote`,Code:`code_blocks`,Details:`expand_circle_down`,"Image URL":`image`,Table:`table`,"Add row":`add_row_below`,"Add column":`add_column_right`,"Remove row":`playlist_remove`,"Remove column":`playlist_remove`,"Remove table":`delete_sweep`,Embed:`smart_display`,Raw:`raw_on`,"Read more":`read_more`,"Upload image":`add_photo_alternate`,"Choose file":`folder_open`},Dt=e=>E`<span class="icon icon-${e}" aria-hidden="true"
3
- >${wt(Tt[e])}</span
4
- >`,Ot=e=>{let t=Et[e];return t?E`${Dt(t)}<span class="visually-hidden">${e}</span>`:e},kt=(e,t)=>e.find(e=>e.key===t)?.name??(t?`Unknown embed "${t}"`:`Embed without a kind`),At=e=>e?.icon?E`<span class="icon embed-icon" aria-hidden="true"
5
- >${wt(e.icon)}</span
6
- >`:``,jt=(e,{pressed:t,disabled:n,onClick:r})=>E`<button
2
+ \f\r]`,be=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,xe=/-->/g,Se=/>/g,Ce=RegExp(`>|${ye}(?:([^\\s"'>=/]+)(${ye}*=${ye}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,`g`),we=/'/g,Te=/"/g,Ee=/^(?:script|style|textarea|title)$/i,E=(e=>(t,...n)=>({_$litType$:e,strings:t,values:n}))(1),De=Symbol.for(`lit-noChange`),D=Symbol.for(`lit-nothing`),Oe=new WeakMap,ke=me.createTreeWalker(me,129);function Ae(e,t){if(!_e(e)||!e.hasOwnProperty(`raw`))throw Error(`invalid template strings array`);return le===void 0?t:le.createHTML(t)}var je=(e,t)=>{let n=e.length-1,r=[],i,a=t===2?`<svg>`:t===3?`<math>`:``,o=be;for(let t=0;t<n;t++){let n=e[t],s,c,l=-1,u=0;for(;u<n.length&&(o.lastIndex=u,c=o.exec(n),c!==null);)u=o.lastIndex,o===be?c[1]===`!--`?o=xe:c[1]===void 0?c[2]===void 0?c[3]!==void 0&&(o=Ce):(Ee.test(c[2])&&(i=RegExp(`</`+c[2],`g`)),o=Ce):o=Se:o===Ce?c[0]===`>`?(o=i??be,l=-1):c[1]===void 0?l=-2:(l=o.lastIndex-c[2].length,s=c[1],o=c[3]===void 0?Ce:c[3]===`"`?Te:we):o===Te||o===we?o=Ce:o===xe||o===Se?o=be:(o=Ce,i=void 0);let d=o===Ce&&e[t+1].startsWith(`/>`)?` `:``;a+=o===be?n+pe:l>=0?(r.push(s),n.slice(0,l)+ue+n.slice(l)+de+d):n+de+(l===-2?t:d)}return[Ae(e,a+(e[n]||`<?>`)+(t===2?`</svg>`:t===3?`</math>`:``)),r]},Me=class e{constructor({strings:t,_$litType$:n},r){let i;this.parts=[];let a=0,o=0,s=t.length-1,c=this.parts,[l,u]=je(t,n);if(this.el=e.createElement(l,r),ke.currentNode=this.el.content,n===2||n===3){let e=this.el.content.firstChild;e.replaceWith(...e.childNodes)}for(;(i=ke.nextNode())!==null&&c.length<s;){if(i.nodeType===1){if(i.hasAttributes())for(let e of i.getAttributeNames())if(e.endsWith(ue)){let t=u[o++],n=i.getAttribute(e).split(de),r=/([.?@])?(.*)/.exec(t);c.push({type:1,index:a,name:r[2],strings:n,ctor:r[1]===`.`?Le:r[1]===`?`?Re:r[1]===`@`?ze:Ie}),i.removeAttribute(e)}else e.startsWith(de)&&(c.push({type:6,index:a}),i.removeAttribute(e));if(Ee.test(i.tagName)){let e=i.textContent.split(de),t=e.length-1;if(t>0){i.textContent=ce?ce.emptyScript:``;for(let n=0;n<t;n++)i.append(e[n],he()),ke.nextNode(),c.push({type:2,index:++a});i.append(e[t],he())}}}else if(i.nodeType===8){if(i.data===fe)c.push({type:2,index:a});else{let e=-1;for(;(e=i.data.indexOf(de,e+1))!==-1;)c.push({type:7,index:a}),e+=de.length-1}}a++}}static createElement(e,t){let n=me.createElement(`template`);return n.innerHTML=e,n}};function Ne(e,t,n=e,r){if(t===De)return t;let i=r===void 0?n._$Cl:n._$Co?.[r],a=ge(t)?void 0:t._$litDirective$;return i?.constructor!==a&&(i?._$AO?.(!1),a===void 0?i=void 0:(i=new a(e),i._$AT(e,n,r)),r===void 0?n._$Cl=i:(n._$Co??=[])[r]=i),i!==void 0&&(t=Ne(e,i._$AS(e,t.values),i,r)),t}var Pe=class{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){let{el:{content:t},parts:n}=this._$AD,r=(e?.creationScope??me).importNode(t,!0);ke.currentNode=r;let i=ke.nextNode(),a=0,o=0,s=n[0];for(;s!==void 0;){if(a===s.index){let t;s.type===2?t=new Fe(i,i.nextSibling,this,e):s.type===1?t=new s.ctor(i,s.name,s.strings,this,e):s.type===6&&(t=new Be(i,this,e)),this._$AV.push(t),s=n[++o]}a!==s?.index&&(i=ke.nextNode(),a++)}return ke.currentNode=me,r}p(e){let t=0;for(let n of this._$AV)n!==void 0&&(n.strings===void 0?n._$AI(e[t]):(n._$AI(e,n,t),t+=n.strings.length-2)),t++}},Fe=class e{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,t,n,r){this.type=2,this._$AH=D,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=n,this.options=r,this._$Cv=r?.isConnected??!0}get parentNode(){let e=this._$AA.parentNode,t=this._$AM;return t!==void 0&&e?.nodeType===11&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=Ne(this,e,t),ge(e)?e===D||e==null||e===``?(this._$AH!==D&&this._$AR(),this._$AH=D):e!==this._$AH&&e!==De&&this._(e):e._$litType$===void 0?e.nodeType===void 0?ve(e)?this.k(e):this._(e):this.T(e):this.$(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==D&&ge(this._$AH)?this._$AA.nextSibling.data=e:this.T(me.createTextNode(e)),this._$AH=e}$(e){let{values:t,_$litType$:n}=e,r=typeof n==`number`?this._$AC(e):(n.el===void 0&&(n.el=Me.createElement(Ae(n.h,n.h[0]),this.options)),n);if(this._$AH?._$AD===r)this._$AH.p(t);else{let e=new Pe(r,this),n=e.u(this.options);e.p(t),this.T(n),this._$AH=e}}_$AC(e){let t=Oe.get(e.strings);return t===void 0&&Oe.set(e.strings,t=new Me(e)),t}k(t){_e(this._$AH)||(this._$AH=[],this._$AR());let n=this._$AH,r,i=0;for(let a of t)i===n.length?n.push(r=new e(this.O(he()),this.O(he()),this,this.options)):r=n[i],r._$AI(a),i++;i<n.length&&(this._$AR(r&&r._$AB.nextSibling,i),n.length=i)}_$AR(e=this._$AA.nextSibling,t){for(this._$AP?.(!1,!0,t);e!==this._$AB;){let t=se(e).nextSibling;se(e).remove(),e=t}}setConnected(e){this._$AM===void 0&&(this._$Cv=e,this._$AP?.(e))}},Ie=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,n,r,i){this.type=1,this._$AH=D,this._$AN=void 0,this.element=e,this.name=t,this._$AM=r,this.options=i,n.length>2||n[0]!==``||n[1]!==``?(this._$AH=Array(n.length-1).fill(new String),this.strings=n):this._$AH=D}_$AI(e,t=this,n,r){let i=this.strings,a=!1;if(i===void 0)e=Ne(this,e,t,0),a=!ge(e)||e!==this._$AH&&e!==De,a&&(this._$AH=e);else{let r=e,o,s;for(e=i[0],o=0;o<i.length-1;o++)s=Ne(this,r[n+o],t,o),s===De&&(s=this._$AH[o]),a||=!ge(s)||s!==this._$AH[o],s===D?e=D:e!==D&&(e+=(s??``)+i[o+1]),this._$AH[o]=s}a&&!r&&this.j(e)}j(e){e===D?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??``)}},Le=class extends Ie{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===D?void 0:e}},Re=class extends Ie{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==D)}},ze=class extends Ie{constructor(e,t,n,r,i){super(e,t,n,r,i),this.type=5}_$AI(e,t=this){if((e=Ne(this,e,t,0)??D)===De)return;let n=this._$AH,r=e===D&&n!==D||e.capture!==n.capture||e.once!==n.once||e.passive!==n.passive,i=e!==D&&(n===D||r);r&&this.element.removeEventListener(this.name,this,n),i&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){typeof this._$AH==`function`?this._$AH.call(this.options?.host??this.element,e):this._$AH.handleEvent(e)}},Be=class{constructor(e,t,n){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=n}get _$AU(){return this._$AM._$AU}_$AI(e){Ne(this,e)}},Ve={M:ue,P:de,A:fe,C:1,L:je,R:Pe,D:ve,V:Ne,I:Fe,H:Ie,N:Re,U:ze,B:Le,F:Be},He=oe.litHtmlPolyfillSupport;He?.(Me,Fe),(oe.litHtmlVersions??=[]).push(`3.3.3`);var Ue=(e,t,n)=>{let r=n?.renderBefore??t,i=r._$litPart$;if(i===void 0){let e=n?.renderBefore??null;r._$litPart$=i=new Fe(t.insertBefore(he(),e),e,void 0,n??{})}return i._$AI(e),i},We=globalThis,Ge=class extends ae{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){let e=super.createRenderRoot();return this.renderOptions.renderBefore??=e.firstChild,e}update(e){let t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=Ue(t,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return De}};Ge._$litElement$=!0,Ge.finalized=!0,We.litElementHydrateSupport?.({LitElement:Ge});var Ke=We.litElementPolyfillSupport;Ke?.({LitElement:Ge}),(We.litElementVersions??=[]).push(`4.2.2`);var qe={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},Je=e=>(...t)=>({_$litDirective$:e,values:t}),Ye=class{constructor(e){}get _$AU(){return this._$AM._$AU}_$AT(e,t,n){this._$Ct=e,this._$AM=t,this._$Ci=n}_$AS(e,t){return this.update(e,t)}update(e,t){return this.render(...t)}},Xe=Je(class extends Ye{constructor(e){if(super(e),e.type!==qe.ATTRIBUTE||e.name!==`class`||e.strings?.length>2)throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.")}render(e){return` `+Object.keys(e).filter(t=>e[t]).join(` `)+` `}update(e,[t]){if(this.st===void 0){this.st=new Set,e.strings!==void 0&&(this.nt=new Set(e.strings.join(` `).split(/\s/).filter(e=>e!==``)));for(let e in t)t[e]&&!this.nt?.has(e)&&this.st.add(e);return this.render(t)}let n=e.element.classList;for(let e of this.st)e in t||(n.remove(e),this.st.delete(e));for(let e in t){let r=!!t[e];r===this.st.has(e)||this.nt?.has(e)||(r?(n.add(e),this.st.add(e)):(n.remove(e),this.st.delete(e)))}return De}}),{I:Ze}=Ve,Qe=e=>e,$e=e=>e.strings===void 0,et=()=>document.createComment(``),tt=(e,t,n)=>{let r=e._$AA.parentNode,i=t===void 0?e._$AB:t._$AA;if(n===void 0)n=new Ze(r.insertBefore(et(),i),r.insertBefore(et(),i),e,e.options);else{let t=n._$AB.nextSibling,a=n._$AM,o=a!==e;if(o){let t;n._$AQ?.(e),n._$AM=e,n._$AP!==void 0&&(t=e._$AU)!==a._$AU&&n._$AP(t)}if(t!==i||o){let e=n._$AA;for(;e!==t;){let t=Qe(e).nextSibling;Qe(r).insertBefore(e,i),e=t}}}return n},nt=(e,t,n=e)=>(e._$AI(t,n),e),rt={},it=(e,t=rt)=>e._$AH=t,at=e=>e._$AH,ot=e=>{e._$AR(),e._$AA.remove()},st=Je(class extends Ye{constructor(){super(...arguments),this.key=D}render(e,t){return this.key=e,t}update(e,[t,n]){return t!==this.key&&(it(e),this.key=t),n}}),ct=class extends Ye{constructor(e){if(super(e),this.it=D,e.type!==qe.CHILD)throw Error(this.constructor.directiveName+`() can only be used in child bindings`)}render(e){if(e===D||e==null)return this._t=void 0,this.it=e;if(e===De)return e;if(typeof e!=`string`)throw Error(this.constructor.directiveName+`() called with a non-string value`);if(e===this.it)return this._t;this.it=e;let t=[e];return t.raw=t,this._t={_$litType$:this.constructor.resultType,strings:t,values:[]}}};ct.directiveName=`unsafeHTML`,ct.resultType=1;var lt=Je(ct),ut={add_column_right:`<svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M140-780v600h269v-600H140ZM80-120v-720h720v150h-60v-90H469v600h271v-90h60v150H80Zm389-360Zm-60 0h60-60Zm0 0Zm331 110v-80h-80v-60h80v-80h60v80h80v60h-80v80h-60Z"/></svg>`,add_photo_alternate:`<svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M480-480ZM180-120q-24 0-42-18t-18-42v-600q0-24 18-42t42-18h365v60H180v600h600v-365h60v365q0 24-18 42t-42 18H180Zm60-162h480L576-474 449-307l-94-124-115 149Zm453-323v-87h-88v-60h88v-88h60v88h87v60h-87v87h-60Z"/></svg>`,add_row_below:`<svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M180-551h600v-269H180v269Zm-60 391v-720h720v720H690v-60h90v-271H180v271h90v60H120Zm360-331Zm0-60v60-60Zm0 0ZM450-80v-80h-80v-60h80v-80h60v80h80v60h-80v80h-60Z"/></svg>`,close:`<svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m249-207-42-42 231-231-231-231 42-42 231 231 231-231 42 42-231 231 231 231-42 42-231-231-231 231Z"/></svg>`,content_copy:`<svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M300-200q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H300Zm0-60h440v-560H300v560ZM180-80q-24 0-42-18t-18-42v-620h60v620h500v60H180Zm120-180v-560 560Z"/></svg>`,delete:`<svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M261-120q-24.75 0-42.37-17.63Q201-155.25 201-180v-570h-41v-60h188v-30h264v30h188v60h-41v570q0 24-18 42t-42 18H261Zm438-630H261v570h438v-570ZM367-266h60v-399h-60v399Zm166 0h60v-399h-60v399ZM261-750v570-570Z"/></svg>`,find_replace:`<svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M164-572q17-100 95.5-164T440-800q65 0 121.5 30t98.5 81v-111h60v228H492v-60h134q-32-48-80.5-78T440-740q-77 0-137.5 46.5T225-572h-61Zm633 452L613-304q-37 31-81 47t-92 16q-65 0-122.5-27T220-346v106h-60v-228h228v60H249q33 48 83 77.5T440-301q75 0 133.5-47T651-468h61q-5 34-19.5 64.5T656-347l184 184-43 43Z"/></svg>`,folder_open:`<svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M140-160q-23 0-41.5-18.5T80-220v-520q0-23 18.5-41.5T140-800h281l60 60h339q23 0 41.5 18.5T880-680H455l-60-60H140v520l102-400h698L833-206q-6 24-22 35t-41 11H140Zm63-60h572l84-340H287l-84 340Zm0 0 84-340-84 340Zm-63-460v-60 60Z"/></svg>`,code_blocks:`<svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m379-343 44-44-93-93 92-92-44-44-136 136 137 137Zm202 0 137-137-137-137-44 44 93 93-93 93 44 44ZM180-120q-24 0-42-18t-18-42v-600q0-24 18-42t42-18h600q24 0 42 18t18 42v600q0 24-18 42t-42 18H180Zm0-60h600v-600H180v600Zm0-600v600-600Z"/></svg>`,delete_sweep:`<svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M600-230v-60h145v60H600Zm0-368v-60h280v60H600Zm0 184v-60h235v60H600ZM125-675H80v-60h170v-45h135v45h170v60h-45v415q0 24-18 42t-42 18H185q-24 0-42-18t-18-42v-415Zm60 0v415h265v-415H185Zm0 0v415-415Z"/></svg>`,expand_circle_down:`<svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m480-351 173-173-43-42-130 130-130-130-43 42 173 173Zm0 271q-82 0-155-31.5t-127.5-86Q143-252 111.5-325T80-480q0-83 31.5-156t86-127Q252-817 325-848.5T480-880q83 0 156 31.5T763-763q54 54 85.5 127T880-480q0 82-31.5 155T763-197.5q-54 54.5-127 86T480-80Zm0-60q142 0 241-99.5T820-480q0-142-99-241t-241-99q-141 0-240.5 99T140-480q0 141 99.5 240.5T480-140Zm0-340Z"/></svg>`,format_bold:`<svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M275-200v-560h228q66 0 114.5 42T666-612q0 38-21 70t-56 49v6q43 14 69.5 50t26.5 81q0 68-52.5 112T510-200H275Zm86-76h144q38 0 66-25t28-63q0-37-28-62t-66-25H361v175Zm0-247h136q35 0 60.5-23t25.5-58q0-35-25.5-58.5T497-686H361v163Z"/></svg>`,format_h1:`<svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M200-280v-400h60v170h180v-170h60v400h-60v-170H260v170h-60Zm500 0v-340h-80v-60h140v400h-60Z"/></svg>`,format_h2:`<svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M120-280v-400h60v170h180v-170h60v400h-60v-170H180v170h-60Zm420 0v-170q0-24.75 17.63-42.38Q575.25-510 600-510h180v-110H540v-60h240q25 0 42.5 17.62Q840-644.75 840-620v110q0 24.75-17.62 42.37Q804.75-450 780-450H600v110h240v60H540Z"/></svg>`,format_h3:`<svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M120-280v-400h60v170h180v-170h60v400h-60v-170H180v170h-60Zm420 0v-60h240v-110H620v-60h160v-110H540v-60h240q25 0 42.5 17.62Q840-644.75 840-620v280q0 24.75-17.62 42.37Q804.75-280 780-280H540Z"/></svg>`,format_italic:`<svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M224-199v-80h134l139-409H338v-80h380v80H584L445-279h159v80H224Z"/></svg>`,format_list_bulleted:`<svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M377-198v-60h463v60H377Zm0-252v-60h463v60H377Zm0-253v-60h463v60H377ZM189-161q-28.05 0-48.02-19Q121-199 121-227.5t19.5-48q19.5-19.5 48-19.5t47.5 19.98q19 19.97 19 48.02 0 27.23-19.39 46.61Q216.23-161 189-161Zm0-252q-28.05 0-48.02-19.5Q121-452 121-480t19.98-47.5Q160.95-547 189-547q27.23 0 46.61 19.5Q255-508 255-480t-19.39 47.5Q216.23-413 189-413Zm-48.5-272.5Q121-705 121-733t19.5-47.5Q160-800 188-800t47.5 19.5Q255-761 255-733t-19.5 47.5Q216-666 188-666t-47.5-19.5Z"/></svg>`,format_list_numbered:`<svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M120-80v-60h100v-30h-60v-60h60v-30H120v-60h120q17 0 28.5 11.5T280-280v40q0 17-11.5 28.5T240-200q17 0 28.5 11.5T280-160v40q0 17-11.5 28.5T240-80H120Zm0-280v-110q0-17 11.5-28.5T160-510h60v-30H120v-60h120q17 0 28.5 11.5T280-560v70q0 17-11.5 28.5T240-450h-60v30h100v60H120Zm60-280v-180h-60v-60h120v240h-60Zm189 431v-60h471v60H369Zm0-243v-60h471v60H369Zm0-243v-60h471v60H369Z"/></svg>`,format_quote:`<svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m248-240 94-162q-5 1-11 1.5t-11 .5q-66 0-113-47t-47-113q0-66 47-113t113-47q66 0 113 47t47 113q0 21-5.5 41T458-480L320-240h-72Zm360 0 94-162q-5 1-11 1.5t-11 .5q-66 0-113-47t-47-113q0-66 47-113t113-47q66 0 113 47t47 113q0 21-5.5 41T818-480L680-240h-72ZM376.5-503.5Q400-527 400-560t-23.5-56.5Q353-640 320-640t-56.5 23.5Q240-593 240-560t23.5 56.5Q287-480 320-480t56.5-23.5Zm360 0Q760-527 760-560t-23.5-56.5Q713-640 680-640t-56.5 23.5Q600-593 600-560t23.5 56.5Q647-480 680-480t56.5-23.5ZM680-560Zm-360 0Z"/></svg>`,format_underlined:`<svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M200-140v-60h560v60H200Zm123.5-198.5Q267-397 267-497v-343h83v343q0 63 34 101t96 38q62 0 96-38t34-101v-343h83v343q0 100-56.5 158.5T480-280q-100 0-156.5-58.5Z"/></svg>`,fullscreen:`<svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M120-120v-193h60v133h133v60H120Zm527 0v-60h133v-133h60v193H647ZM120-647v-193h193v60H180v133h-60Zm660 0v-133H647v-60h193v193h-60Z"/></svg>`,fullscreen_exit:`<svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M253-120v-133H120v-60h193v193h-60Zm394 0v-193h193v60H707v133h-60ZM120-647v-60h133v-133h60v193H120Zm527 0v-193h60v133h133v60H647Z"/></svg>`,image:`<svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M180-120q-24 0-42-18t-18-42v-600q0-24 18-42t42-18h600q24 0 42 18t18 42v600q0 24-18 42t-42 18H180Zm0-60h600v-600H180v600Zm56-97h489L578-473 446-302l-93-127-117 152Zm-56 97v-600 600Z"/></svg>`,link:`<svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M450-280H280q-83 0-141.5-58.5T80-480q0-83 58.5-141.5T280-680h170v60H280q-58.33 0-99.17 40.76-40.83 40.77-40.83 99Q140-422 180.83-381q40.84 41 99.17 41h170v60ZM325-450v-60h310v60H325Zm185 170v-60h170q58.33 0 99.17-40.76 40.83-40.77 40.83-99Q820-538 779.17-579q-40.84-41-99.17-41H510v-60h170q83 0 141.5 58.5T880-480q0 83-58.5 141.5T680-280H510Z"/></svg>`,manage_search:`<svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M80-200v-60h400v60H80Zm0-210v-60h200v60H80Zm0-210v-60h200v60H80Zm758 420L678-360q-26 20-56 30t-62 10q-83 0-141.5-58.5T360-520q0-83 58.5-141.5T560-720q83 0 141.5 58.5T760-520q0 32-10 62t-30 56l160 160-42 42ZM559.76-380Q618-380 659-420.76q41-40.77 41-99Q700-578 659.24-619q-40.77-41-99-41Q502-660 461-619.24q-41 40.77-41 99Q420-462 460.76-421q40.77 41 99 41Z"/></svg>`,menu:`<svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M120-240v-60h720v60H120Zm0-210v-60h720v60H120Zm0-210v-60h720v60H120Z"/></svg>`,playlist_remove:`<svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m571-80-43-43 114-113-114-113 43-43 113 114 113-114 43 43-114 113 114 113-43 43-113-114L571-80ZM120-330v-60h300v60H120Zm0-165v-60h470v60H120Zm0-165v-60h470v60H120Z"/></svg>`,raw_on:`<svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M120-360v-240h144q23 0 35.5 12.5T312-552v63q0 20-12 30.5T271-446l37 86h-50l-32-81h-58v81h-48Zm226 0 66-240h84l70 240h-54l-18-61h-82l-15 61h-51Zm290 0-61-240h49l37 142 34-142h45l37 142 33-142h50l-58 240h-50l-33-131-37 131h-46ZM426-469h53l-18-67h-17l-18 67Zm-258-20h96v-63h-96v63Z"/></svg>`,read_more:`<svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m288-276-42-42 131-132H80v-60h297L246-642l42-42 204 204-204 204Zm252-34v-60h340v60H540Zm0-280v-60h340v60H540Zm120 140v-60h220v60H660Z"/></svg>`,smart_display:`<svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m392-313 260-169-260-169v338ZM140-160q-24 0-42-18t-18-42v-520q0-24 18-42t42-18h680q24 0 42 18t18 42v520q0 24-18 42t-42 18H140Zm0-60h680v-520H140v520Zm0 0v-520 520Z"/></svg>`,strikethrough_s:`<svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M504-160q-78 0-142-41.5T269-313l69-29q20 48 65 77t101 29q52 0 83-27t31-73q0-23-9.5-48.5T582-430h84q14 23 21 46t7 48q0 78-53 127t-137 49ZM80-490v-60h800v60H80Zm394-316q66 0 117 31t75 86l-69 31q-14-34-46.5-53T474-730q-49 0-79 24t-30 66q0 8 1 15t3 15h-74q-2-8-3-16t-1-16q0-73 51-118.5T474-806Z"/></svg>`,table:`<svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M180-120q-24 0-42-18t-18-42v-600q0-24 18-42t42-18h600q24 0 42 18t18 42v600q0 24-18 42t-42 18H180Zm270-250H180v190h270v-190Zm60 0v190h270v-190H510Zm-60-60v-190H180v190h270Zm60 0h270v-190H510v190ZM180-680h600v-100H180v100Z"/></svg>`,text_decrease:`<svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m40-200 220-560h80l220 560h-75l-57-150H172l-57 150H40Zm156-214h208L302-685h-4L196-414Zm414-36v-60h310v60H610Z"/></svg>`,text_increase:`<svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m40-200 220-560h80l220 560h-75l-57-150H172l-57 150H40Zm156-214h208L302-685h-4L196-414Zm534 94v-130H600v-60h130v-130h60v130h130v60H790v130h-60Z"/></svg>`},dt={Bold:`format_bold`,Italic:`format_italic`,Underline:`format_underlined`,Strikethrough:`strikethrough_s`,Small:`text_decrease`,Big:`text_increase`,Link:`link`,Heading:`format_h2`,Subheading:`format_h3`,"Heading 1":`format_h1`,"Heading 2":`format_h2`,"Heading 3":`format_h3`,"Bullet list":`format_list_bulleted`,"Numbered list":`format_list_numbered`,Quote:`format_quote`,Code:`code_blocks`,Details:`expand_circle_down`,"Image URL":`image`,Table:`table`,"Add row":`add_row_below`,"Add column":`add_column_right`,"Remove row":`playlist_remove`,"Remove column":`playlist_remove`,"Remove table":`delete_sweep`,Embed:`smart_display`,Raw:`raw_on`,"Read more":`read_more`,"Upload image":`add_photo_alternate`,"Choose file":`folder_open`},ft=e=>E`<span class="icon icon-${e}" aria-hidden="true"
3
+ >${lt(ut[e])}</span
4
+ >`,pt=e=>{let t=dt[e];return t?E`${ft(t)}<span class="visually-hidden">${e}</span>`:e},mt=(e,t)=>e.find(e=>e.key===t)?.name??(t?`Unknown embed "${t}"`:`Embed without a kind`),ht=e=>e?.icon?E`<span class="icon embed-icon" aria-hidden="true"
5
+ >${lt(e.icon)}</span
6
+ >`:``,gt=(e,{pressed:t,disabled:n,onClick:r})=>E`<button
7
7
  type="button"
8
8
  class="toolbar-button toolbar-embed"
9
9
  data-embed=${e.key}
@@ -12,11 +12,11 @@ var e=Object.defineProperty,t=Object.getOwnPropertyDescriptor,n=Object.getOwnPro
12
12
  ?disabled=${n}
13
13
  @click=${r}
14
14
  >
15
- ${e.icon?At(e):Dt(`smart_display`)}<span
15
+ ${e.icon?ht(e):ft(`smart_display`)}<span
16
16
  class="visually-hidden"
17
17
  >${e.name}</span
18
18
  >
19
- </button>`,Mt=(e,{protocol:t,hostname:n,port:r}=window.location)=>e&&n===`127.0.0.1`?`${t}//localhost:${r}${e}`:e,Nt=Symbol.for(`yaml.alias`),Pt=Symbol.for(`yaml.document`),Ft=Symbol.for(`yaml.map`),It=Symbol.for(`yaml.pair`),Lt=Symbol.for(`yaml.scalar`),Rt=Symbol.for(`yaml.seq`),zt=Symbol.for(`yaml.node.type`),Bt=e=>!!e&&typeof e==`object`&&e[zt]===Nt,Vt=e=>!!e&&typeof e==`object`&&e[zt]===Pt,Ht=e=>!!e&&typeof e==`object`&&e[zt]===Ft,Ut=e=>!!e&&typeof e==`object`&&e[zt]===It,O=e=>!!e&&typeof e==`object`&&e[zt]===Lt,Wt=e=>!!e&&typeof e==`object`&&e[zt]===Rt;function k(e){if(e&&typeof e==`object`)switch(e[zt]){case Ft:case Rt:return!0}return!1}function Gt(e){if(e&&typeof e==`object`)switch(e[zt]){case Nt:case Ft:case Lt:case Rt:return!0}return!1}var Kt=e=>(O(e)||k(e))&&!!e.anchor,qt=Symbol(`break visit`),Jt=Symbol(`skip children`),Yt=Symbol(`remove node`);function Xt(e,t){let n=Qt(t);Vt(e)?Zt(null,e.contents,n,Object.freeze([e]))===Yt&&(e.contents=null):Zt(null,e,n,Object.freeze([]))}Xt.BREAK=qt,Xt.SKIP=Jt,Xt.REMOVE=Yt;function Zt(e,t,n,r){let i=$t(e,t,n,r);if(Gt(i)||Ut(i))return en(e,r,i),Zt(e,i,n,r);if(typeof i!=`symbol`){if(k(t)){r=Object.freeze(r.concat(t));for(let e=0;e<t.items.length;++e){let i=Zt(e,t.items[e],n,r);if(typeof i==`number`)e=i-1;else if(i===qt)return qt;else i===Yt&&(t.items.splice(e,1),--e)}}else if(Ut(t)){r=Object.freeze(r.concat(t));let e=Zt(`key`,t.key,n,r);if(e===qt)return qt;e===Yt&&(t.key=null);let i=Zt(`value`,t.value,n,r);if(i===qt)return qt;i===Yt&&(t.value=null)}}return i}function Qt(e){return typeof e==`object`&&(e.Collection||e.Node||e.Value)?Object.assign({Alias:e.Node,Map:e.Node,Scalar:e.Node,Seq:e.Node},e.Value&&{Map:e.Value,Scalar:e.Value,Seq:e.Value},e.Collection&&{Map:e.Collection,Seq:e.Collection},e):e}function $t(e,t,n,r){if(typeof n==`function`)return n(e,t,r);if(Ht(t))return n.Map?.(e,t,r);if(Wt(t))return n.Seq?.(e,t,r);if(Ut(t))return n.Pair?.(e,t,r);if(O(t))return n.Scalar?.(e,t,r);if(Bt(t))return n.Alias?.(e,t,r)}function en(e,t,n){let r=t[t.length-1];if(k(r))r.items[e]=n;else if(Ut(r))e===`key`?r.key=n:r.value=n;else if(Vt(r))r.contents=n;else{let e=Bt(r)?`alias`:`scalar`;throw Error(`Cannot replace node with ${e} parent`)}}var tn={"!":`%21`,",":`%2C`,"[":`%5B`,"]":`%5D`,"{":`%7B`,"}":`%7D`},nn=e=>e.replace(/[!,[\]{}]/g,e=>tn[e]),rn=class e{constructor(t,n){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},e.defaultYaml,t),this.tags=Object.assign({},e.defaultTags,n)}clone(){let t=new e(this.yaml,this.tags);return t.docStart=this.docStart,t}atDocument(){let t=new e(this.yaml,this.tags);switch(this.yaml.version){case`1.1`:this.atNextDocument=!0;break;case`1.2`:this.atNextDocument=!1,this.yaml={explicit:e.defaultYaml.explicit,version:`1.2`},this.tags=Object.assign({},e.defaultTags)}return t}add(t,n){this.atNextDocument&&=(this.yaml={explicit:e.defaultYaml.explicit,version:`1.1`},this.tags=Object.assign({},e.defaultTags),!1);let r=t.trim().split(/[ \t]+/),i=r.shift();switch(i){case`%TAG`:{if(r.length!==2&&(n(0,`%TAG directive should contain exactly two parts`),r.length<2))return!1;let[e,t]=r;return this.tags[e]=t,!0}case`%YAML`:{if(this.yaml.explicit=!0,r.length!==1)return n(0,`%YAML directive should contain exactly one part`),!1;let[e]=r;if(e===`1.1`||e===`1.2`)return this.yaml.version=e,!0;{let t=/^\d+\.\d+$/.test(e);return n(6,`Unsupported YAML version ${e}`,t),!1}}default:return n(0,`Unknown directive ${i}`,!0),!1}}tagName(e,t){if(e===`!`)return`!`;if(e[0]!==`!`)return t(`Not a valid tag: ${e}`),null;if(e[1]===`<`){let n=e.slice(2,-1);return n===`!`||n===`!!`?(t(`Verbatim tags aren't resolved, so ${e} is invalid.`),null):(e[e.length-1]!==`>`&&t(`Verbatim tags must end with a >`),n)}let[,n,r]=e.match(/^(.*!)([^!]*)$/s);r||t(`The ${e} tag has no suffix`);let i=this.tags[n];if(i)try{return i+decodeURIComponent(r)}catch(e){return t(String(e)),null}return n===`!`?e:(t(`Could not resolve tag: ${e}`),null)}tagString(e){for(let[t,n]of Object.entries(this.tags))if(e.startsWith(n))return t+nn(e.substring(n.length));return e[0]===`!`?e:`!<${e}>`}toString(e){let t=this.yaml.explicit?[`%YAML ${this.yaml.version||`1.2`}`]:[],n=Object.entries(this.tags),r;if(e&&n.length>0&&Gt(e.contents)){let t={};Xt(e.contents,(e,n)=>{Gt(n)&&n.tag&&(t[n.tag]=!0)}),r=Object.keys(t)}else r=[];for(let[i,a]of n)i===`!!`&&a===`tag:yaml.org,2002:`||e&&!r.some(e=>e.startsWith(a))||t.push(`%TAG ${i} ${a}`);return t.join(`
19
+ </button>`,_t=(e,t=window.location)=>{if(!e)return e;let n=new URL(e,t.href);return n.hostname===`127.0.0.1`?(n.hostname=`localhost`,n.href):e},vt=class extends Error{problems;constructor(e,t){super(e),this.problems=t}},yt=e=>{let t=new URLSearchParams(Object.entries(e).filter(([,e])=>e!==void 0&&e!==``).map(([e,t])=>[e,String(t)]));return t.size?`?${t}`:``},bt=({type:e,slug:t,name:n})=>`/api/files/${e}/${t}/${encodeURIComponent(n)}`,xt=class{fetch;baseUrl;constructor(e={}){let t=typeof e==`function`?{fetch:e}:e,n=(...e)=>fetch(...e),{baseUrl:r=``,fetch:i=n}=t;this.baseUrl=r.replace(/\/+$/,``),this.fetch=i}url(e){return/^\/(?!\/)/.test(e)?`${this.baseUrl}${e}`:e}previewUrl(e){return _t(this.url(e))}async request(e,t){let n=await this.fetch(this.url(e),t);if(n.status===204)return;let r=await n.json().catch(()=>({}));if(!n.ok)throw new vt(r.error??`Request failed with ${n.status}`,r.problems);return r}send(e,t,n){return this.request(t,{method:e,headers:{"Content-Type":`application/json`},body:JSON.stringify(n)})}query(e={}){return this.request(`/api/articles${yt(e)}`)}queryFiles(e={}){return this.request(`/api/files${yt(e)}`)}fileFilters(){return this.request(`/api/files/filters`)}fileReferences(e){return this.request(`${bt(e)}/references`)}replaceFile(e,t){let n=new FormData;return n.append(`file`,t),this.request(bt(e),{method:`PUT`,body:n})}deleteFile(e){return this.request(bt(e),{method:`DELETE`})}recent(){return this.request(`/api/articles/recent`)}filters(){return this.request(`/api/articles/filters`)}metadata(){return this.request(`/api/metadata`)}site(){return this.request(`/api/site`)}types(){return this.request(`/api/types`)}templates(e){return this.request(`/api/templates/${e}`)}read({type:e,slug:t}){return this.request(`/api/articles/${e}/${t}`)}create(e){return this.send(`POST`,`/api/articles`,e)}save(e,t){return this.send(`PUT`,`/api/articles/${e.type}/${e.slug}`,t)}remove({type:e,slug:t}){return this.request(`/api/articles/${e}/${t}`,{method:`DELETE`})}embeds(){return this.request(`/api/embeds`)}async validateEmbed(e,t,n={}){return(await this.send(`POST`,`/api/embed-validations`,{key:e,content:t,options:n})).errors}embedFrame(e,t,n={}){return this.send(`POST`,`/api/embed-frames`,{key:e,content:t,options:n})}async toMarkdown(e,t){return(await this.send(`POST`,`/api/convert/markdown`,{html:e,location:t})).markdown}async toHtml(e,t){return(await this.send(`POST`,`/api/convert/html`,{markdown:e,location:t})).html}async preview(e,t){return(await this.send(`POST`,`/api/preview`,{data:e,location:t})).url}upload({type:e,slug:t},n){let r=new FormData;return r.append(`file`,n),this.request(`/api/articles/${e}/${t}/files`,{method:`POST`,body:r})}},St=(e,t)=>{customElements.get(e)||customElements.define(e,t)},Ct=`important`,wt=` !`+Ct,Tt=Je(class extends Ye{constructor(e){if(super(e),e.type!==qe.ATTRIBUTE||e.name!==`style`||e.strings?.length>2)throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.")}render(e){return Object.keys(e).reduce((t,n)=>{let r=e[n];return r==null?t:t+`${n=n.includes(`-`)?n:n.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,`-$&`).toLowerCase()}:${r};`},``)}update(e,[t]){let{style:n}=e.element;if(this.ft===void 0)return this.ft=new Set(Object.keys(t)),this.render(t);for(let e of this.ft)t[e]??(this.ft.delete(e),e.includes(`-`)?n.removeProperty(e):n[e]=null);for(let e in t){let r=t[e];if(r!=null){this.ft.add(e);let t=typeof r==`string`&&r.endsWith(wt);e.includes(`-`)||t?n.setProperty(e,t?r.slice(0,-11):r,t?Ct:``):n[e]=r}}return De}}),Et={ß:`ss`,æ:`ae`,œ:`oe`,ø:`o`,đ:`d`,ð:`d`,ł:`l`,þ:`th`,ı:`i`},Dt=e=>e.normalize(`NFKD`).replace(/\p{Diacritic}/gu,``).toLowerCase().replace(/[ßæœøđðłþı]/g,e=>Et[e]).replace(/['"‘’“”`´]/g,``).replace(/[^a-z0-9]+/g,`-`).replace(/^-+|-+$/g,``),Ot=e=>{let t=new Set;return e.map(e=>{let n=Dt(e);if(!n)return``;let r=n;for(let e=2;t.has(r);e++)r=`${n}-${e}`;return t.add(r),r})},kt=e=>String(e).padStart(2,`0`),At=e=>{let t=new Date(e);return`${t.getFullYear()}-${kt(t.getMonth()+1)}-${kt(t.getDate())}T${kt(t.getHours())}:${kt(t.getMinutes())}`},jt=e=>{let t=new Date(e);return e&&!Number.isNaN(t.getTime())?t.toISOString():``},Mt=Je(class extends Ye{constructor(e){if(super(e),e.type!==qe.PROPERTY&&e.type!==qe.ATTRIBUTE&&e.type!==qe.BOOLEAN_ATTRIBUTE)throw Error("The `live` directive is not allowed on child or event bindings");if(!$e(e))throw Error("`live` bindings can only contain a single expression")}render(e){return e}update(e,[t]){if(t===De||t===D)return t;let n=e.element,r=e.name;if(e.type===qe.PROPERTY){if(t===n[r])return De}else if(e.type===qe.BOOLEAN_ATTRIBUTE){if(!!t===n.hasAttribute(r))return De}else if(e.type===qe.ATTRIBUTE&&n.getAttribute(r)===t+``)return De;return it(e),t}}),Nt=Symbol.for(`yaml.alias`),Pt=Symbol.for(`yaml.document`),Ft=Symbol.for(`yaml.map`),It=Symbol.for(`yaml.pair`),Lt=Symbol.for(`yaml.scalar`),Rt=Symbol.for(`yaml.seq`),zt=Symbol.for(`yaml.node.type`),Bt=e=>!!e&&typeof e==`object`&&e[zt]===Nt,Vt=e=>!!e&&typeof e==`object`&&e[zt]===Pt,Ht=e=>!!e&&typeof e==`object`&&e[zt]===Ft,Ut=e=>!!e&&typeof e==`object`&&e[zt]===It,O=e=>!!e&&typeof e==`object`&&e[zt]===Lt,Wt=e=>!!e&&typeof e==`object`&&e[zt]===Rt;function k(e){if(e&&typeof e==`object`)switch(e[zt]){case Ft:case Rt:return!0}return!1}function Gt(e){if(e&&typeof e==`object`)switch(e[zt]){case Nt:case Ft:case Lt:case Rt:return!0}return!1}var Kt=e=>(O(e)||k(e))&&!!e.anchor,qt=Symbol(`break visit`),Jt=Symbol(`skip children`),Yt=Symbol(`remove node`);function Xt(e,t){let n=Qt(t);Vt(e)?Zt(null,e.contents,n,Object.freeze([e]))===Yt&&(e.contents=null):Zt(null,e,n,Object.freeze([]))}Xt.BREAK=qt,Xt.SKIP=Jt,Xt.REMOVE=Yt;function Zt(e,t,n,r){let i=$t(e,t,n,r);if(Gt(i)||Ut(i))return en(e,r,i),Zt(e,i,n,r);if(typeof i!=`symbol`){if(k(t)){r=Object.freeze(r.concat(t));for(let e=0;e<t.items.length;++e){let i=Zt(e,t.items[e],n,r);if(typeof i==`number`)e=i-1;else if(i===qt)return qt;else i===Yt&&(t.items.splice(e,1),--e)}}else if(Ut(t)){r=Object.freeze(r.concat(t));let e=Zt(`key`,t.key,n,r);if(e===qt)return qt;e===Yt&&(t.key=null);let i=Zt(`value`,t.value,n,r);if(i===qt)return qt;i===Yt&&(t.value=null)}}return i}function Qt(e){return typeof e==`object`&&(e.Collection||e.Node||e.Value)?Object.assign({Alias:e.Node,Map:e.Node,Scalar:e.Node,Seq:e.Node},e.Value&&{Map:e.Value,Scalar:e.Value,Seq:e.Value},e.Collection&&{Map:e.Collection,Seq:e.Collection},e):e}function $t(e,t,n,r){if(typeof n==`function`)return n(e,t,r);if(Ht(t))return n.Map?.(e,t,r);if(Wt(t))return n.Seq?.(e,t,r);if(Ut(t))return n.Pair?.(e,t,r);if(O(t))return n.Scalar?.(e,t,r);if(Bt(t))return n.Alias?.(e,t,r)}function en(e,t,n){let r=t[t.length-1];if(k(r))r.items[e]=n;else if(Ut(r))e===`key`?r.key=n:r.value=n;else if(Vt(r))r.contents=n;else{let e=Bt(r)?`alias`:`scalar`;throw Error(`Cannot replace node with ${e} parent`)}}var tn={"!":`%21`,",":`%2C`,"[":`%5B`,"]":`%5D`,"{":`%7B`,"}":`%7D`},nn=e=>e.replace(/[!,[\]{}]/g,e=>tn[e]),rn=class e{constructor(t,n){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},e.defaultYaml,t),this.tags=Object.assign({},e.defaultTags,n)}clone(){let t=new e(this.yaml,this.tags);return t.docStart=this.docStart,t}atDocument(){let t=new e(this.yaml,this.tags);switch(this.yaml.version){case`1.1`:this.atNextDocument=!0;break;case`1.2`:this.atNextDocument=!1,this.yaml={explicit:e.defaultYaml.explicit,version:`1.2`},this.tags=Object.assign({},e.defaultTags)}return t}add(t,n){this.atNextDocument&&=(this.yaml={explicit:e.defaultYaml.explicit,version:`1.1`},this.tags=Object.assign({},e.defaultTags),!1);let r=t.trim().split(/[ \t]+/),i=r.shift();switch(i){case`%TAG`:{if(r.length!==2&&(n(0,`%TAG directive should contain exactly two parts`),r.length<2))return!1;let[e,t]=r;return this.tags[e]=t,!0}case`%YAML`:{if(this.yaml.explicit=!0,r.length!==1)return n(0,`%YAML directive should contain exactly one part`),!1;let[e]=r;if(e===`1.1`||e===`1.2`)return this.yaml.version=e,!0;{let t=/^\d+\.\d+$/.test(e);return n(6,`Unsupported YAML version ${e}`,t),!1}}default:return n(0,`Unknown directive ${i}`,!0),!1}}tagName(e,t){if(e===`!`)return`!`;if(e[0]!==`!`)return t(`Not a valid tag: ${e}`),null;if(e[1]===`<`){let n=e.slice(2,-1);return n===`!`||n===`!!`?(t(`Verbatim tags aren't resolved, so ${e} is invalid.`),null):(e[e.length-1]!==`>`&&t(`Verbatim tags must end with a >`),n)}let[,n,r]=e.match(/^(.*!)([^!]*)$/s);r||t(`The ${e} tag has no suffix`);let i=this.tags[n];if(i)try{return i+decodeURIComponent(r)}catch(e){return t(String(e)),null}return n===`!`?e:(t(`Could not resolve tag: ${e}`),null)}tagString(e){for(let[t,n]of Object.entries(this.tags))if(e.startsWith(n))return t+nn(e.substring(n.length));return e[0]===`!`?e:`!<${e}>`}toString(e){let t=this.yaml.explicit?[`%YAML ${this.yaml.version||`1.2`}`]:[],n=Object.entries(this.tags),r;if(e&&n.length>0&&Gt(e.contents)){let t={};Xt(e.contents,(e,n)=>{Gt(n)&&n.tag&&(t[n.tag]=!0)}),r=Object.keys(t)}else r=[];for(let[i,a]of n)i===`!!`&&a===`tag:yaml.org,2002:`||e&&!r.some(e=>e.startsWith(a))||t.push(`%TAG ${i} ${a}`);return t.join(`
20
20
  `)}};rn.defaultYaml={explicit:!1,version:`1.2`},rn.defaultTags={"!!":`tag:yaml.org,2002:`};function an(e){if(/[\x00-\x19\s,[\]{}]/.test(e)){let t=`Anchor must not contain whitespace or control characters: ${JSON.stringify(e)}`;throw Error(t)}return!0}function on(e){let t=new Set;return Xt(e,{Value(e,n){n.anchor&&t.add(n.anchor)}}),t}function sn(e,t){for(let n=1;;++n){let r=`${e}${n}`;if(!t.has(r))return r}}function cn(e,t){let n=[],r=new Map,i=null;return{onAnchor:r=>{n.push(r),i??=on(e);let a=sn(t,i);return i.add(a),a},setAnchors:()=>{for(let e of n){let t=r.get(e);if(typeof t==`object`&&t.anchor&&(O(t.node)||k(t.node)))t.node.anchor=t.anchor;else{let t=Error(`Failed to resolve repeated object (this should not happen)`);throw t.source=e,t}}},sourceObjects:r}}function ln(e,t,n,r){if(r&&typeof r==`object`){if(Array.isArray(r))for(let t=0,n=r.length;t<n;++t){let n=r[t],i=ln(e,r,String(t),n);i===void 0?delete r[t]:i!==n&&(r[t]=i)}else if(r instanceof Map)for(let t of Array.from(r.keys())){let n=r.get(t),i=ln(e,r,t,n);i===void 0?r.delete(t):i!==n&&r.set(t,i)}else if(r instanceof Set)for(let t of Array.from(r)){let n=ln(e,r,t,t);n===void 0?r.delete(t):n!==t&&(r.delete(t),r.add(n))}else for(let[t,n]of Object.entries(r)){let i=ln(e,r,t,n);i===void 0?delete r[t]:i!==n&&(r[t]=i)}}return e.call(t,n,r)}function un(e,t,n){if(Array.isArray(e))return e.map((e,t)=>un(e,String(t),n));if(e&&typeof e.toJSON==`function`){if(!n||!Kt(e))return e.toJSON(t,n);let r={aliasCount:0,count:1,res:void 0};n.anchors.set(e,r),n.onCreate=e=>{r.res=e,delete n.onCreate};let i=e.toJSON(t,n);return n.onCreate&&n.onCreate(i),i}return typeof e==`bigint`&&!n?.keep?Number(e):e}var dn=class{constructor(e){Object.defineProperty(this,zt,{value:e})}clone(){let e=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(e.range=this.range.slice()),e}toJS(e,{mapAsMap:t,maxAliasCount:n,onAnchor:r,reviver:i}={}){if(!Vt(e))throw TypeError(`A document argument is required`);let a={anchors:new Map,doc:e,keep:!0,mapAsMap:t===!0,mapKeyWarned:!1,maxAliasCount:typeof n==`number`?n:100},o=un(this,``,a);if(typeof r==`function`)for(let{count:e,res:t}of a.anchors.values())r(t,e);return typeof i==`function`?ln(i,{"":o},``,o):o}},fn=class extends dn{constructor(e){super(Nt),this.source=e,Object.defineProperty(this,"tag",{set(){throw Error(`Alias nodes cannot have tags`)}})}resolve(e,t){if(t?.maxAliasCount===0)throw ReferenceError(`Alias resolution is disabled`);let n;t?.aliasResolveCache?n=t.aliasResolveCache:(n=[],Xt(e,{Node:(e,t)=>{(Bt(t)||Kt(t))&&n.push(t)}}),t&&(t.aliasResolveCache=n));let r;for(let e of n){if(e===this)break;e.anchor===this.source&&(r=e)}if(r&&t){let{anchors:e,doc:n,maxAliasCount:i}=t,a=e.get(r);if(a||=(un(r,null,t),e.get(r)),a?.res===void 0)throw ReferenceError(`This should not happen: Alias anchor was not resolved?`);if(i>=0&&(a.count+=1,a.aliasCount===0&&(a.aliasCount=pn(n,r,e)),a.count*a.aliasCount>i))throw ReferenceError(`Excessive alias count indicates a resource exhaustion attack`)}return r}toJSON(e,t){if(!t)return{source:this.source};let n=this.resolve(t.doc,t);if(!n){let e=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw ReferenceError(e)}return t.anchors.get(n).res}toString(e,t,n){let r=`*${this.source}`;if(e){if(an(this.source),e.options.verifyAliasOrder&&!e.anchors.has(this.source)){let e=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw Error(e)}if(e.implicitKey)return`${r} `}return r}};function pn(e,t,n){if(Bt(t)){let r=t.resolve(e),i=n&&r&&n.get(r);return i?i.count*i.aliasCount:0}if(k(t)){let r=0;for(let i of t.items){let t=pn(e,i,n);t>r&&(r=t)}return r}if(Ut(t)){let r=pn(e,t.key,n),i=pn(e,t.value,n);return Math.max(r,i)}return 1}var mn=e=>!e||typeof e!=`function`&&typeof e!=`object`,A=class extends dn{constructor(e){super(Lt),this.value=e}toJSON(e,t){return t?.keep?this.value:un(this.value,e,t)}toString(){return String(this.value)}};A.BLOCK_FOLDED=`BLOCK_FOLDED`,A.BLOCK_LITERAL=`BLOCK_LITERAL`,A.PLAIN=`PLAIN`,A.QUOTE_DOUBLE=`QUOTE_DOUBLE`,A.QUOTE_SINGLE=`QUOTE_SINGLE`;var hn=`tag:yaml.org,2002:`;function gn(e,t,n){if(t){let e=n.filter(e=>e.tag===t),r=e.find(e=>!e.format)??e[0];if(!r)throw Error(`Tag ${t} not found`);return r}return n.find(t=>t.identify?.(e)&&!t.format)}function _n(e,t,n){if(Vt(e)&&(e=e.contents),Gt(e))return e;if(Ut(e)){let t=n.schema[Ft].createNode?.(n.schema,null,n);return t.items.push(e),t}(e instanceof String||e instanceof Number||e instanceof Boolean||typeof BigInt<`u`&&e instanceof BigInt)&&(e=e.valueOf());let{aliasDuplicateObjects:r,onAnchor:i,onTagObj:a,schema:o,sourceObjects:s}=n,c;if(r&&e&&typeof e==`object`){if(c=s.get(e),c)return c.anchor??(c.anchor=i(e)),new fn(c.anchor);c={anchor:null,node:null},s.set(e,c)}t?.startsWith(`!!`)&&(t=hn+t.slice(2));let l=gn(e,t,o.tags);if(!l){if(e&&typeof e.toJSON==`function`&&(e=e.toJSON()),!e||typeof e!=`object`){let t=new A(e);return c&&(c.node=t),t}l=e instanceof Map?o[Ft]:Symbol.iterator in Object(e)?o[Rt]:o[Ft]}a&&(a(l),delete n.onTagObj);let u=l?.createNode?l.createNode(n.schema,e,n):typeof l?.nodeClass?.from==`function`?l.nodeClass.from(n.schema,e,n):new A(e);return t?u.tag=t:l.default||(u.tag=l.tag),c&&(c.node=u),u}function vn(e,t,n){let r=n;for(let e=t.length-1;e>=0;--e){let n=t[e];if(typeof n==`number`&&Number.isInteger(n)&&n>=0){let e=[];e[n]=r,r=e}else r=new Map([[n,r]])}return _n(r,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw Error(`This should not happen, please report a bug.`)},schema:e,sourceObjects:new Map})}var yn=e=>e==null||typeof e==`object`&&!!e[Symbol.iterator]().next().done,bn=class extends dn{constructor(e,t){super(e),Object.defineProperty(this,"schema",{value:t,configurable:!0,enumerable:!1,writable:!0})}clone(e){let t=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return e&&(t.schema=e),t.items=t.items.map(t=>Gt(t)||Ut(t)?t.clone(e):t),this.range&&(t.range=this.range.slice()),t}addIn(e,t){if(yn(e))this.add(t);else{let[n,...r]=e,i=this.get(n,!0);if(k(i))i.addIn(r,t);else if(i===void 0&&this.schema)this.set(n,vn(this.schema,r,t));else throw Error(`Expected YAML collection at ${n}. Remaining path: ${r}`)}}deleteIn(e){let[t,...n]=e;if(n.length===0)return this.delete(t);let r=this.get(t,!0);if(k(r))return r.deleteIn(n);throw Error(`Expected YAML collection at ${t}. Remaining path: ${n}`)}getIn(e,t){let[n,...r]=e,i=this.get(n,!0);return r.length===0?!t&&O(i)?i.value:i:k(i)?i.getIn(r,t):void 0}hasAllNullValues(e){return this.items.every(t=>{if(!Ut(t))return!1;let n=t.value;return n==null||e&&O(n)&&n.value==null&&!n.commentBefore&&!n.comment&&!n.tag})}hasIn(e){let[t,...n]=e;if(n.length===0)return this.has(t);let r=this.get(t,!0);return k(r)?r.hasIn(n):!1}setIn(e,t){let[n,...r]=e;if(r.length===0)this.set(n,t);else{let e=this.get(n,!0);if(k(e))e.setIn(r,t);else if(e===void 0&&this.schema)this.set(n,vn(this.schema,r,t));else throw Error(`Expected YAML collection at ${n}. Remaining path: ${r}`)}}},xn=e=>e.replace(/^(?!$)(?: $)?/gm,`#`);function Sn(e,t){return/^\n+$/.test(e)?e.substring(1):t?e.replace(/^(?! *$)/gm,t):e}var Cn=(e,t,n)=>e.endsWith(`
21
21
  `)?Sn(n,t):n.includes(`
22
22
  `)?`
@@ -144,7 +144,7 @@ $&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,`$1$2`).replace(/\
144
144
  `).length-1,i=e.lastIndexOf(`
145
145
  `,t-1)+1,a=e=>n[e]?.trim().startsWith(`|`);if(!a(r))return;let o=r;for(;o>0&&a(o-1);)o--;let s=r;for(;a(s+1);)s++;let c=n.slice(o,s+1).map(Za);if(c.length<2||!c[1].every(e=>Fa.test(e)))return;let l=n.slice(0,o).join(`
146
146
  `).length+ +!!o,u=l+n.slice(o,s+1).join(`
147
- `).length,d=e.slice(i,t).trim().split(/(?<!\\)\|/).length-1,f=c[0].length;return{from:l,to:u,rows:c,row:r-o,column:Math.min(Math.max(d-1,0),f-1)}},eo=(e,{from:t,to:n},r,i,a)=>{let o=Qa(r),s=Qa(r.slice(0,i)).length+ +!!i,c=r[i],l=2+c.slice(0,a).reduce((e,t)=>e+t.length+3,0)+c[a].length;return La(e,t,n,o,s+l,s+l)},to=3,no=e=>{let t=e=>Array(to).fill(e);return Ha(e,Qa([t(`Header`),t(`---`),...Array.from({length:2},()=>t(``))]),2,8)},ro=e=>{let t=$a(e);if(!t)return;let n=Math.max(t.row+1,2),r=[...t.rows];return r.splice(n,0,Array(r[0].length).fill(``)),eo(e.value,t,r,n,0)},io=e=>{let t=$a(e);if(!t)return;let n=t.column+1,r=t.rows.map((e,t)=>{let r=[...e];return r.splice(n,0,t===1?`---`:``),r});return eo(e.value,t,r,t.row,n)},ao=e=>{let t=$a(e);if(!t||t.row<2)return;let n=t.rows.filter((e,n)=>n!==t.row);return eo(e.value,t,n,Math.min(t.row,n.length-1),t.column)},oo=e=>{let t=$a(e);if(!t)return;if(t.rows[0].length<=1)return so(e);let n=t.rows.map(e=>e.filter((e,n)=>n!==t.column));return eo(e.value,t,n,t.row,Math.min(t.column,n[0].length-1))},so=e=>{let t=$a(e);return t?La(e.value,t.from,t.to,``):void 0},co=(e,t)=>{let n=`${`#`.repeat(t)} `;return Ba(e,RegExp(`^${n}`),()=>n,Pa)},lo=e=>Ba(e,/^[-*+] /,()=>`- `,Na),uo=e=>Ba(e,/^\d+[.)] /,e=>`${e+1}. `,Na),fo=e=>Ba(e,/^> ?/,()=>`> `),po=e=>$a(e)!==void 0;ft(`edaha-markdown`,class extends Ge{static properties={value:{attribute:!1},textareaId:{attribute:!1},uploadImage:{attribute:!1},chooseFile:{attribute:!1},embedTools:{attribute:!1}};prompt=(e,t)=>window.prompt(e,t);constructor(){super(),this.value=``,this.textareaId=``}createRenderRoot(){return this}actions=[{label:`Bold`,run:e=>za(e,`**`,`**`)},{label:`Italic`,run:e=>za(e,`_`,`_`)},{label:`Small`,run:e=>za(e,`<small>`,`</small>`)},{label:`Big`,run:e=>za(e,`<big>`,`</big>`)},{label:`Link`,run:e=>{let t=this.prompt(`Link URL (empty to remove)`,Wa(e));return t===null?void 0:Ga(e,t.trim())}},{label:`Heading`,run:e=>co(e,2)},{label:`Subheading`,run:e=>co(e,3)},{label:`Bullet list`,run:lo},{label:`Numbered list`,run:uo},{label:`Quote`,run:fo},{label:`Code`,run:e=>Va(e,"```","```")},{label:`Details`,run:e=>Va(e,`<details>
147
+ `).length,d=e.slice(i,t).trim().split(/(?<!\\)\|/).length-1,f=c[0].length;return{from:l,to:u,rows:c,row:r-o,column:Math.min(Math.max(d-1,0),f-1)}},eo=(e,{from:t,to:n},r,i,a)=>{let o=Qa(r),s=Qa(r.slice(0,i)).length+ +!!i,c=r[i],l=2+c.slice(0,a).reduce((e,t)=>e+t.length+3,0)+c[a].length;return La(e,t,n,o,s+l,s+l)},to=3,no=e=>{let t=e=>Array(to).fill(e);return Ha(e,Qa([t(`Header`),t(`---`),...Array.from({length:2},()=>t(``))]),2,8)},ro=e=>{let t=$a(e);if(!t)return;let n=Math.max(t.row+1,2),r=[...t.rows];return r.splice(n,0,Array(r[0].length).fill(``)),eo(e.value,t,r,n,0)},io=e=>{let t=$a(e);if(!t)return;let n=t.column+1,r=t.rows.map((e,t)=>{let r=[...e];return r.splice(n,0,t===1?`---`:``),r});return eo(e.value,t,r,t.row,n)},ao=e=>{let t=$a(e);if(!t||t.row<2)return;let n=t.rows.filter((e,n)=>n!==t.row);return eo(e.value,t,n,Math.min(t.row,n.length-1),t.column)},oo=e=>{let t=$a(e);if(!t)return;if(t.rows[0].length<=1)return so(e);let n=t.rows.map(e=>e.filter((e,n)=>n!==t.column));return eo(e.value,t,n,t.row,Math.min(t.column,n[0].length-1))},so=e=>{let t=$a(e);return t?La(e.value,t.from,t.to,``):void 0},co=(e,t)=>{let n=`${`#`.repeat(t)} `;return Ba(e,RegExp(`^${n}`),()=>n,Pa)},lo=e=>Ba(e,/^[-*+] /,()=>`- `,Na),uo=e=>Ba(e,/^\d+[.)] /,e=>`${e+1}. `,Na),fo=e=>Ba(e,/^> ?/,()=>`> `),po=e=>$a(e)!==void 0;St(`edaha-markdown`,class extends Ge{static properties={value:{attribute:!1},textareaId:{attribute:!1},uploadImage:{attribute:!1},chooseFile:{attribute:!1},embedTools:{attribute:!1}};prompt=(e,t)=>window.prompt(e,t);constructor(){super(),this.value=``,this.textareaId=``}createRenderRoot(){return this}actions=[{label:`Bold`,run:e=>za(e,`**`,`**`)},{label:`Italic`,run:e=>za(e,`_`,`_`)},{label:`Underline`,run:e=>za(e,`<u>`,`</u>`)},{label:`Strikethrough`,run:e=>za(e,`~~`,`~~`)},{label:`Small`,run:e=>za(e,`<small>`,`</small>`)},{label:`Big`,run:e=>za(e,`<big>`,`</big>`)},{label:`Link`,run:e=>{let t=this.prompt(`Link URL (empty to remove)`,Wa(e));return t===null?void 0:Ga(e,t.trim())}},{label:`Heading`,run:e=>co(e,2)},{label:`Subheading`,run:e=>co(e,3)},{label:`Bullet list`,run:lo},{label:`Numbered list`,run:uo},{label:`Quote`,run:fo},{label:`Code`,run:e=>Va(e,"```","```")},{label:`Details`,run:e=>Va(e,`<details>
148
148
  <summary>Summary</summary>
149
149
  `,`
150
150
  </details>`)},{label:`Image URL`,run:e=>{let t=this.prompt(`Image URL`)?.trim();return t?Ua(e,`![](${t})`):void 0}},{label:`Table`,run:no},{label:`Add row`,run:ro,enabled:po},{label:`Add column`,run:io,enabled:po},{label:`Remove row`,run:ao,enabled:po},{label:`Remove column`,run:oo,enabled:po},{label:`Remove table`,run:so,enabled:po},{label:`Raw`,run:e=>Va(e,`<!-- raw -->`,`<!-- /raw -->`)},{label:`Read more`,run:Xa}];get textarea(){return this.querySelector(`textarea`)}get selection(){let e=this.textarea;return e?{value:e.value,start:e.selectionStart,end:e.selectionEnd}:{value:this.value,start:0,end:0}}sync(){let e=this.textarea.value;e!==this.value&&(this.value=e,this.dispatchEvent(new Event(`markdown-change`,{bubbles:!0})))}apply(e){let t=this.textarea;if(e&&t){if(t.focus(),e.value!==t.value){let{start:n,end:r,text:i}=Ia(t.value,e.value);t.setSelectionRange(n,r),typeof document.execCommand==`function`&&document.execCommand(i?`insertText`:`delete`,!1,i),t.value!==e.value&&(t.value=e.value)}t.setSelectionRange(e.start,e.end),this.sync(),this.requestUpdate()}}async onImageFile(e){let t=e.target,n=t.files?.[0];if(t.value=``,!n||!this.uploadImage)return;let r=this.selection;try{let e=await this.uploadImage(n);this.apply(Ua(r,`![](${e})`))}catch{}}async editEmbed(e,t){let n=qa(e),r=n?.key!==t,i=await this.embedTools?.edit(r?{key:t,content:``,options:{}}:n,r);i?this.apply((r?Ya:Ja)(e,i)):this.textarea?.focus()}async onChooseFile(){let e=this.selection,t=await this.chooseFile?.();t&&this.apply(Ka(e,t.url,t.name,t.kind===`image`))}render(){let e=this.selection,t=()=>this.requestUpdate();return E`
@@ -161,15 +161,15 @@ $&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,`$1$2`).replace(/\
161
161
  ?disabled=${t.enabled?!t.enabled(e):!1}
162
162
  @click=${()=>this.apply(t.run(this.selection))}
163
163
  >
164
- ${Ot(t.label)}
164
+ ${pt(t.label)}
165
165
  </button>`)}
166
- ${this.embedTools?.embeds.map(t=>jt(t,{pressed:qa(e)?.key===t.key,disabled:!1,onClick:()=>void this.editEmbed(this.selection,t.key)}))}
166
+ ${this.embedTools?.embeds.map(t=>gt(t,{pressed:qa(e)?.key===t.key,disabled:!1,onClick:()=>void this.editEmbed(this.selection,t.key)}))}
167
167
  <label
168
168
  class="toolbar-button toolbar-upload"
169
169
  title="Upload image"
170
170
  ?data-disabled=${!this.uploadImage}
171
171
  >
172
- ${Ot(`Upload image`)}
172
+ ${pt(`Upload image`)}
173
173
  <input
174
174
  type="file"
175
175
  class="visually-hidden"
@@ -186,12 +186,12 @@ $&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,`$1$2`).replace(/\
186
186
  ?disabled=${!this.chooseFile}
187
187
  @click=${()=>void this.onChooseFile()}
188
188
  >
189
- ${Ot(`Choose file`)}
189
+ ${pt(`Choose file`)}
190
190
  </button>
191
191
  </div>
192
192
  <textarea
193
193
  id=${this.textareaId}
194
- .value=${St(this.value)}
194
+ .value=${Mt(this.value)}
195
195
  @input=${()=>this.sync()}
196
196
  @keyup=${t}
197
197
  @click=${t}
@@ -345,7 +345,7 @@ img.ProseMirror-separator {
345
345
  `),n=t===-1?e:e.slice(0,t);if(!$O.test(n))return[[],0,[]];let r=dk,i=fk(e,r),a=ok(i);for(;a[1]===i.length&&i.length===r;)r*=2,i=fk(e,r),a=ok(i);return[a[0],a[1],i]}var mk=`listItem`,hk=`textStyle`,gk=/^(\d+)\.\s$/;function _k(e){let t=e.match(/list-style-type\s*:\s*([^;]+)/i);if(!t)return null;switch(t[1].trim().toLowerCase()){case`upper-roman`:return`I`;case`lower-roman`:return`i`;case`upper-alpha`:case`upper-latin`:return`A`;case`lower-alpha`:case`lower-latin`:return`a`;default:return null}}var vk=G.create({name:`orderedList`,addOptions(){return{itemTypeName:`listItem`,HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:`block list`,content(){return`${this.options.itemTypeName}+`},addAttributes(){return{start:{default:1,parseHTML:e=>e.hasAttribute(`start`)?parseInt(e.getAttribute(`start`)||``,10):1},type:{default:null,parseHTML:e=>{let t=e.getAttribute(`type`);if(t)return t;let n=e.getAttribute(`style`);if(n){let e=_k(n);if(e)return e}let r=e.querySelector(`li`);if(r){let e=r.getAttribute(`style`);if(e){let t=_k(e);if(t)return t}}return null}}}},parseHTML(){return[{tag:`ol`}]},renderHTML({HTMLAttributes:e}){let{start:t,type:n,...r}=e,i=U(this.options.HTMLAttributes,r);return t!==1&&(i.start=t),n&&n!==`1`&&(i.type=n),[`ol`,i,0]},markdownTokenName:`list`,parseMarkdown:(e,t)=>{if(e.type!==`list`||!e.ordered)return[];let n=e.start||1,r=e.typeMarker,i=e.items?uk(e.items,t):[],a={};return n!==1&&(a.start=n),r&&(a.type=r),Object.keys(a).length>0?{type:`orderedList`,attrs:a,content:i}:{type:`orderedList`,content:i}},renderMarkdown:(e,t)=>e.content?t.renderChildren(e.content,`
346
346
  `):``,markdownTokenizer:{name:`orderedList`,level:`block`,start:()=>-1,tokenize:(e,t,n)=>{let[r,i,a]=pk(e);if(r.length===0)return;let o=lk(r,r[0].indent,n);if(o.length!==0)return{type:`list`,ordered:!0,start:r[0]?.number||1,typeMarker:r[0]?.type,items:o,raw:a.slice(0,i).join(`
347
347
  `)}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleOrderedList:()=>({commands:e,chain:t})=>this.options.keepAttributes?t().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(mk,this.editor.getAttributes(hk)).run():e.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addProseMirrorPlugins(){return[new L({props:{handlePaste:(e,t)=>{if((t.clipboardData?.getData(`text/html`))?.trim())return!1;let n=t.clipboardData?.getData(`text/plain`);if(!n)return!1;let r=ck(n);if(!r)return!1;try{let t=e.state.schema.nodeFromJSON(r),n=e.state.tr.replaceSelectionWith(t);return e.dispatch(n),!0}catch{return!1}}}})]},addInputRules(){let e=(e,t)=>(!t.attrs.type||t.attrs.type===`1`)&&t.childCount+t.attrs.start===+e[1],t=yb({find:gk,type:this.type,getAttributes:e=>({start:+e[1]}),joinPredicate:e});return(this.options.keepMarks||this.options.keepAttributes)&&(t=yb({find:gk,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(hk)}),joinPredicate:e,editor:this.editor})),[t]}}),yk=/^\s*(\[([( |x])?\])\s$/,bk=`position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0`,xk=(e,t,n)=>{var r;return(n==null||(r=n.checkboxLabel)==null?void 0:r.call(n,e,t))||`Task item checkbox for ${e.textContent||`empty task item`}`},Sk=G.create({name:`taskItem`,addOptions(){return{nested:!1,HTMLAttributes:{},taskListTypeName:`taskList`,a11y:void 0}},content(){return this.options.nested?`paragraph block*`:`paragraph+`},defining:!0,addAttributes(){return{checked:{default:!1,keepOnSplit:!1,parseHTML:e=>{let t=e.getAttribute(`data-checked`);return t===``||t===`true`},renderHTML:e=>({"data-checked":e.checked})}}},parseHTML(){return[{tag:`li[data-type="${this.name}"]`,priority:51,contentElement:e=>e.querySelector(`div`)??e}]},renderHTML({node:e,HTMLAttributes:t}){return[`li`,U(this.options.HTMLAttributes,t,{"data-type":this.name}),[`label`,[`input`,{type:`checkbox`,checked:e.attrs.checked?`checked`:null}],[`span`]],[`div`,0]]},parseMarkdown:(e,t)=>{let n=[];if(e.tokens&&e.tokens.length>0?n.push(t.createNode(`paragraph`,{},t.parseInline(e.tokens))):e.text?n.push(t.createNode(`paragraph`,{},[t.createNode(`text`,{text:e.text})])):n.push(t.createNode(`paragraph`,{},[])),e.nestedTokens&&e.nestedTokens.length>0){let r=t.parseChildren(e.nestedTokens);n.push(...r)}return t.createNode(`taskItem`,{checked:e.checked||!1},n)},renderMarkdown:(e,t)=>Py(e,t,`- [${e.attrs?.checked?`x`:` `}] `,void 0,{indentMainContent:!0}),addExtensions(){return this.options.nested?[yO(this.name,[this.options.taskListTypeName])]:[]},addKeyboardShortcuts(){let e={Enter:()=>this.editor.commands.splitListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)};return this.options.nested?{...e,Tab:()=>this.editor.commands.sinkListItem(this.name)}:e},addNodeView(){return({node:e,HTMLAttributes:t,getPos:n,editor:r})=>{let i=document.createElement(`li`),a=document.createElement(`label`),o=document.createElement(`span`),s=document.createElement(`input`),c=document.createElement(`div`);o.style.cssText=bk;let l=e=>{let t=xk(e,e.attrs.checked,this.options.a11y);s.setAttribute(`aria-label`,t),o.textContent=t};l(e),a.contentEditable=`false`,s.type=`checkbox`,s.addEventListener(`mousedown`,e=>e.preventDefault()),s.addEventListener(`change`,t=>{if(!r.isEditable&&!this.options.onReadOnlyChecked){s.checked=!s.checked;return}let{checked:i}=t.target;r.isEditable&&typeof n==`function`&&r.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:e})=>{let t=n();if(typeof t!=`number`)return!1;let r=e.doc.nodeAt(t);return e.setNodeMarkup(t,void 0,{...r?.attrs,checked:i}),!0}).run(),!r.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(e,i)||(s.checked=!s.checked))}),Object.entries(this.options.HTMLAttributes).forEach(([e,t])=>{i.setAttribute(e,t)}),i.dataset.checked=e.attrs.checked,s.checked=e.attrs.checked,a.append(s,o),i.append(a,c),Object.entries(t).forEach(([e,t])=>{i.setAttribute(e,t)});let u=new Set(Object.keys(t));return{dom:i,contentDOM:c,update:e=>{if(e.type!==this.type)return!1;i.dataset.checked=e.attrs.checked,s.checked=e.attrs.checked,l(e);let t=r.extensionManager.attributes,n=g_(e,t),a=new Set(Object.keys(n)),o=this.options.HTMLAttributes;return u.forEach(e=>{a.has(e)||(e in o?i.setAttribute(e,o[e]):i.removeAttribute(e))}),Object.entries(n).forEach(([e,t])=>{t==null?e in o?i.setAttribute(e,o[e]):i.removeAttribute(e):i.setAttribute(e,t)}),u=a,!0}}}},addInputRules(){return[yb({find:yk,type:this.type,getAttributes:e=>({checked:e[e.length-1]===`x`})})]}}),Ck=G.create({name:`taskList`,addOptions(){return{itemTypeName:`taskItem`,HTMLAttributes:{}}},group:`block list`,content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:`ul[data-type="${this.name}"]`,priority:51}]},renderHTML({HTMLAttributes:e}){return[`ul`,U(this.options.HTMLAttributes,e,{"data-type":this.name}),0]},parseMarkdown:(e,t)=>t.createNode(`taskList`,{},t.parseChildren(e.items||[])),renderMarkdown:(e,t)=>e.content?t.renderChildren(e.content,`
348
- `):``,markdownTokenizer:{name:`taskList`,level:`block`,start(e){let t=e.match(/^\s*[-+*]\s+\[([ xX])\]\s+/)?.index;return t===void 0?-1:t},tokenize(e,t,n){let r=e=>{let t=jy(e,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:e=>({indentLevel:e[1].length,mainContent:e[4],checked:e[3].toLowerCase()===`x`}),createToken:(e,t)=>({type:`taskItem`,raw:``,mainContent:e.mainContent,indentLevel:e.indentLevel,checked:e.checked,text:e.mainContent,tokens:n.inlineTokens(e.mainContent),nestedTokens:t}),customNestedParser:r},n);if(t){let r={type:`taskList`,raw:t.raw,items:t.items},i=e.slice(t.raw.length);return i.trim()?[r,...n.blockTokens(i)]:[r]}return n.blockTokens(e)},i=jy(e,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:e=>({indentLevel:e[1].length,mainContent:e[4],checked:e[3].toLowerCase()===`x`}),createToken:(e,t)=>({type:`taskItem`,raw:``,mainContent:e.mainContent,indentLevel:e.indentLevel,checked:e.checked,text:e.mainContent,tokens:n.inlineTokens(e.mainContent),nestedTokens:t}),customNestedParser:r},n);if(i)return{type:`taskList`,raw:i.raw,items:i.items}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleTaskList:()=>({commands:e})=>e.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}});W.create({name:`listKit`,addExtensions(){let e=[];return this.options.bulletList!==!1&&e.push(hO.configure(this.options.bulletList)),this.options.listItem!==!1&&e.push(UO.configure(this.options.listItem)),this.options.listKeymap!==!1&&e.push(QO.configure(this.options.listKeymap)),this.options.orderedList!==!1&&e.push(vk.configure(this.options.orderedList)),this.options.taskItem!==!1&&e.push(Sk.configure(this.options.taskItem)),this.options.taskList!==!1&&e.push(Ck.configure(this.options.taskList)),e}});var wk=`&nbsp;`,Tk=`\xA0`,Ek=G.create({name:`paragraph`,priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:`block`,content:`inline*`,parseHTML(){return[{tag:`p`}]},renderHTML({HTMLAttributes:e}){return[`p`,U(this.options.HTMLAttributes,e),0]},parseMarkdown:(e,t)=>{let n=e.tokens||[];if(n.length===1&&n[0].type===`image`)return t.parseChildren([n[0]]);let r=t.parseInline(n);return n.length===1&&n[0].type===`text`&&(n[0].raw===wk||n[0].text===wk||n[0].raw===Tk||n[0].text===Tk)&&r.length===1&&r[0].type===`text`&&(r[0].text===wk||r[0].text===Tk)?t.createNode(`paragraph`,void 0,[]):t.createNode(`paragraph`,void 0,r)},renderMarkdown:(e,t,n)=>{if(!e)return``;let r=Array.isArray(e.content)?e.content:[];if(r.length===0){var i,a;let e=Array.isArray(n==null||(i=n.previousNode)==null?void 0:i.content)?n.previousNode.content:[];return(n==null||(a=n.previousNode)==null?void 0:a.type)===`paragraph`&&e.length===0?wk:``}return t.renderChildren(r)},addCommands(){return{setParagraph:()=>({commands:e})=>e.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),Dk=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,Ok=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,kk=Gy.create({name:`strike`,addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:`s`},{tag:`del`},{tag:`strike`},{style:`text-decoration`,consuming:!1,getAttrs:e=>e.includes(`line-through`)?{}:!1}]},renderHTML({HTMLAttributes:e}){return[`s`,U(this.options.HTMLAttributes,e),0]},markdownTokenName:`del`,parseMarkdown:(e,t)=>t.applyMark(`strike`,t.parseInline(e.tokens||[])),renderMarkdown:(e,t)=>`~~${t.renderChildren(e)}~~`,addCommands(){return{setStrike:()=>({commands:e})=>e.setMark(this.name),toggleStrike:()=>({commands:e})=>e.toggleMark(this.name),unsetStrike:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[gb({find:Dk,type:this.type})]},addPasteRules(){return[Sb({find:Ok,type:this.type})]}}),Ak=G.create({name:`text`,group:`inline`,parseMarkdown:e=>({type:`text`,text:e.text||``}),renderMarkdown:e=>e.text||``}),jk=Gy.create({name:`underline`,addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:`u`},{style:`text-decoration`,consuming:!1,getAttrs:e=>e.includes(`underline`)?{}:!1}]},renderHTML({HTMLAttributes:e}){return[`u`,U(this.options.HTMLAttributes,e),0]},parseMarkdown(e,t){return t.applyMark(this.name||`underline`,t.parseInline(e.tokens||[]))},renderMarkdown(e,t){return`<u>${t.renderChildren(e)}</u>`},markdownTokenizer:{name:`underline`,level:`inline`,start(e){return e.toLowerCase().indexOf(`<u>`)},tokenize(e,t,n){if(!/^<u>/i.test(e))return;let r=/\\[\s\S]|`+|<\/u>/gi;r.lastIndex=3;let i=r.exec(e);for(;i;){if(i[0].startsWith("`")){let t=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/.exec(e.slice(i.index));t&&(r.lastIndex=i.index+t[0].length)}else if(!i[0].startsWith(`\\`)){let t=e.slice(3,i.index);return t?{type:`underline`,raw:e.slice(0,r.lastIndex),text:t,tokens:n.inlineTokens(t)}:void 0}i=r.exec(e)}}},addCommands(){return{setUnderline:()=>({commands:e})=>e.setMark(this.name),toggleUnderline:()=>({commands:e})=>e.toggleMark(this.name),unsetUnderline:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}});function Mk(e={}){return new L({view(t){return new Nk(t,e)}})}var Nk=class{constructor(e,t){this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.lastDragEvent=null,this.width=t.width??1,this.color=t.color===!1?void 0:t.color||`black`,this.class=t.class,this.handlers=[`dragover`,`dragend`,`drop`,`dragleave`].map(t=>{let n=e=>{this[t](e)};return e.dom.addEventListener(t,n),{name:t,handler:n}})}destroy(){this.setCursor(null),this.handlers.forEach(({name:e,handler:t})=>this.editorView.dom.removeEventListener(e,t))}update(e,t){if(this.cursorPos!=null&&t.doc!=e.state.doc){if(this.lastDragEvent){let e=this.computeTarget(this.lastDragEvent);e==this.cursorPos?this.updateOverlay():this.setCursor(e)}else this.updateOverlay()}}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,e==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e=this.editorView.state.doc.resolve(this.cursorPos),t=!e.parent.inlineContent,n,r=this.editorView.dom,i=r.getBoundingClientRect(),a=i.width/r.offsetWidth,o=i.height/r.offsetHeight;if(t){let t=e.nodeBefore,r=e.nodeAfter;if(t||r){let e=this.editorView.nodeDOM(this.cursorPos-(t?t.nodeSize:0));if(e){let i=e.getBoundingClientRect(),a=t?i.bottom:i.top;t&&r&&(a=(a+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let s=this.width/2*o;n={left:i.left,right:i.right,top:a-s,bottom:a+s}}}}if(!n){let e=this.editorView.coordsAtPos(this.cursorPos),t=this.width/2*a;n={left:e.left-t,right:e.left+t,top:e.top,bottom:e.bottom}}let s=this.editorView.dom.offsetParent;this.element||(this.element=s.appendChild(document.createElement(`div`)),this.class&&(this.element.className=this.class),this.element.style.cssText=`position: absolute; z-index: 50; pointer-events: none;`,this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle(`prosemirror-dropcursor-block`,t),this.element.classList.toggle(`prosemirror-dropcursor-inline`,!t);let c,l;if(!s||s==document.body&&getComputedStyle(s).position==`static`)c=-pageXOffset,l=-pageYOffset;else{let e=s.getBoundingClientRect(),t=e.width/s.offsetWidth,n=e.height/s.offsetHeight;c=e.left-s.scrollLeft*t,l=e.top-s.scrollTop*n}this.element.style.left=(n.left-c)/a+`px`,this.element.style.top=(n.top-l)/o+`px`,this.element.style.width=(n.right-n.left)/a+`px`,this.element.style.height=(n.bottom-n.top)/o+`px`}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}computeTarget(e){let t=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),n=t&&t.inside>=0&&this.editorView.state.doc.nodeAt(t.inside),r=n&&n.type.spec.disableDropCursor,i=typeof r==`function`?r(this.editorView,t,e):r;if(!t||i)return null;let a=t.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let e=Ic(this.editorView.state.doc,a,this.editorView.dragging.slice);e!=null&&(a=e)}return a}dragover(e){if(!this.editorView.editable)return;this.lastDragEvent=e;let t=this.computeTarget(e);t!=null&&(this.setCursor(t),this.scheduleRemoval(5e3))}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}};W.create({name:`characterCount`,addOptions(){return{limit:null,autoTrim:!0,mode:`textSize`,textCounter:e=>e.length,wordCounter:e=>e.split(` `).filter(e=>e!==``).length}},addStorage(){return{characters:()=>0,words:()=>0}},onBeforeCreate(){this.storage.characters=e=>{let t=e?.node||this.editor.state.doc;if((e?.mode||this.options.mode)===`textSize`){let e=t.textBetween(0,t.content.size,void 0,` `);return this.options.textCounter(e)}return t.nodeSize},this.storage.words=e=>{let t=e?.node||this.editor.state.doc,n=t.textBetween(0,t.content.size,` `,` `);return this.options.wordCounter(n)}},addProseMirrorPlugins(){let e=!1;return[new L({key:new R(`characterCount`),appendTransaction:(t,n,r)=>{if(e)return;let i=this.options.limit,a=this.options.autoTrim;if(i==null||i===0||a===!1){e=!0;return}let o=this.storage.characters({node:r.doc});if(o>i){let t=o-i;console.warn(`[CharacterCount] Initial content exceeded limit of ${i} characters. Content was automatically trimmed.`);let n=r.tr.deleteRange(0,t);return e=!0,n}e=!0},filterTransaction:(e,t)=>{let n=this.options.limit;if(!e.docChanged||n===0||n==null)return!0;let r=this.storage.characters({node:t.doc}),i=this.storage.characters({node:e.doc});if(i<=n||r>n&&i>n&&i<=r)return!0;if(r>n&&i>n&&i>r||!e.getMeta(`paste`))return!1;let a=e.selection.$head.pos,o=a-(i-n),s=a;return e.deleteRange(o,s),!(this.storage.characters({node:e.doc})>n)}})]}});var Pk=W.create({name:`dropCursor`,addOptions(){return{color:`currentColor`,width:1,class:void 0}},addProseMirrorPlugins(){return[Mk(this.options)]}});W.create({name:`focus`,addOptions(){return{className:`has-focus`,mode:`all`}},addProseMirrorPlugins(){return[new L({key:new R(`focus`),props:{decorations:({doc:e,selection:t})=>{let{isEditable:n,isFocused:r}=this.editor,{anchor:i}=t,a=[];if(!n||!r)return B.create(e,[]);let o=0;this.options.mode===`deepest`&&e.descendants((e,t)=>{if(!e.isText){if(!(i>=t&&i<=t+e.nodeSize-1))return!1;o+=1}});let s=0;return e.descendants((e,t)=>{if(e.isText||!(i>=t&&i<=t+e.nodeSize-1))return!1;if(s+=1,this.options.mode===`deepest`&&o-s>0||this.options.mode===`shallowest`&&s>1)return this.options.mode===`deepest`;a.push($p.node(t,t+e.nodeSize,{class:this.options.className}))}),B.create(e,a)}}})]}});var Fk=W.create({name:`gapCursor`,addProseMirrorPlugins(){return[hw()]},extendNodeSchema(e){return{allowGapCursor:H(V(e,`allowGapCursor`,{name:e.name,options:e.options,storage:e.storage}))??null}}}),Ik=`placeholder`,Lk=new R(`tiptap__placeholder`);function Rk(e){let{editor:t,placeholder:n,dataAttribute:r,pos:i,node:a,isEmptyDoc:o,hasAnchor:s,classes:{emptyNode:c,emptyEditor:l}}=e,u=[c];return o&&u.push(l),$p.node(i,i+a.nodeSize,{class:u.join(` `),[r]:typeof n==`function`?n({editor:t,node:a,pos:i,hasAnchor:s}):n})}function zk(e,t){return typeof e==`function`?e(t):e}function Bk({editor:e,options:t,dataAttribute:n,doc:r,selection:i,from:a,to:o}){let{anchor:s}=i,c=[],l=e.isEmpty;return r.nodesBetween(a,o,(r,i)=>{let a=s>=i&&s<=i+r.nodeSize,o=!r.isLeaf&&G_(r);return r.type.isTextblock&&(a||!t.showOnlyCurrent)&&o&&c.push(Rk({editor:e,isEmptyDoc:l,dataAttribute:n,hasAnchor:a,placeholder:t.placeholder,classes:{emptyEditor:t.emptyEditorClass,emptyNode:zk(t.emptyNodeClass,{editor:e,node:r,pos:i,hasAnchor:a})},node:r,pos:i})),t.includeChildren}),c}function Vk({editor:e,options:t,dataAttribute:n,doc:r,selection:i}){if(!e.isEditable&&t.showOnlyWhenEditable)return null;let{anchor:a}=i,o=[],s=e.isEmpty;if(t.showOnlyCurrent&&!t.includeChildren){let i=r.resolve(a),c=i.depth>0?i.node(1):i.nodeAfter,l=i.depth>0?i.before(1):a;if(c&&c.type.isTextblock&&G_(c)){let r=a>=l&&a<=l+c.nodeSize;o.push(Rk({editor:e,isEmptyDoc:s,dataAttribute:n,hasAnchor:r,placeholder:t.placeholder,classes:{emptyEditor:t.emptyEditorClass,emptyNode:zk(t.emptyNodeClass,{editor:e,node:c,pos:l,hasAnchor:r})},node:c,pos:l}))}}else o.push(...Bk({editor:e,options:t,dataAttribute:n,doc:r,selection:i,from:0,to:r.content.size}));return B.create(r,o)}function Hk(e,t){let n=e.resolve(t);if(n.depth===0){let e=n.nodeAfter??n.nodeBefore;if(!e)return{from:t,to:t};let r=n.nodeAfter?t:t-e.nodeSize;return{from:r,to:r+e.nodeSize}}let r=n.before(1);return{from:r,to:r+n.node(1).nodeSize}}function Uk(e,t){return{from:Math.max(0,t.from),to:Math.min(e.content.size,t.to)}}function Wk(e,t,n){let r=[];return e.forEach((e,i)=>{let a=i,o=a+e.nodeSize,s=a+1,c=o+1;s<n&&c>t&&r.push({from:a,to:o})}),r}function Gk(e){if(e.length===0)return[];let t=[...e].sort((e,t)=>e.from-t.from),n=[{...t[0]}];for(let e=1;e<t.length;e+=1){let r=n[n.length-1],i=t[e];i.from<=r.to?r.to=Math.max(r.to,i.to):n.push({...i})}return n}function Kk(e,t){let n=Wk(e,t.from,t.to);return n.push(Uk(e,Hk(e,t.from))),t.to>t.from?n.push(Uk(e,Hk(e,Math.min(t.to,e.content.size+1)-1))):t.from<e.content.size+1&&n.push(Uk(e,Hk(e,Math.min(t.from+1,e.content.size)))),n}function qk(e,t,n){let r=[];if(e.docChanged){let t=M_(e);for(let e of t)r.push(...Kk(n.doc,e.newRange))}return e.selectionSet&&(r.push(Uk(n.doc,Hk(n.doc,e.mapping.map(t.selection.anchor)))),r.push(Uk(n.doc,Hk(n.doc,n.selection.anchor)))),Gk(r)}function Jk(e,t,n){let r=Math.max(0,Math.min(e,n.content.size));return{from:r,to:Math.max(r,Math.min(t,n.content.size))}}function Yk({decorations:e,ranges:t,editor:n,options:r,dataAttribute:i,doc:a,selection:o}){let s=e;for(let e of t){let{from:t,to:c}=Jk(e.from,e.to,a),l=s.find(t,c).filter(e=>e.from>=t&&e.to<=c);l.length&&(s=s.remove(l));let u=Bk({editor:n,options:r,dataAttribute:i,doc:a,selection:o,from:t,to:c});u.length&&(s=s.add(a,u))}return s}function Xk({editor:e,options:t,dataAttribute:n}){return{init(r,i){return Vk({editor:e,options:t,dataAttribute:n,doc:i.doc,selection:i.selection})??B.empty},apply(r,i,a,o){return!r.docChanged&&!r.selectionSet?i:Yk({decorations:i.map(r.mapping,r.doc),ranges:qk(r,a,o),editor:e,options:t,dataAttribute:n,doc:o.doc,selection:o.selection})}}}function Zk(e){return e.replace(/\s+/g,`-`).replace(/[^a-zA-Z0-9-]/g,``).replace(/^[0-9-]+/,``).replace(/^-+/,``).toLowerCase()}function Qk({editor:e,options:t}){let n=t.dataAttribute?`data-${Zk(t.dataAttribute)}`:`data-${Ik}`,r=t.showOnlyCurrent&&!t.includeChildren;return new L({key:Lk,...r?{}:{state:Xk({editor:e,options:t,dataAttribute:n})},props:{decorations:r?({doc:r,selection:i})=>Vk({editor:e,options:t,dataAttribute:n,doc:r,selection:i}):n=>t.showOnlyWhenEditable&&!e.isEditable?B.empty:Lk.getState(n)??B.empty}})}W.create({name:`placeholder`,addOptions(){return{emptyEditorClass:`is-editor-empty`,emptyNodeClass:`is-empty`,dataAttribute:Ik,placeholder:`Write something …`,showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){return[Qk({editor:this.editor,options:this.options})]}});function $k(e,t){return!e.selection.empty&&!K_(e.selection)&&t.isEditable}function eA(e,t){return $k(e,t)&&!t.isFocused&&!t.view.dragging}function tA(){var e;(e=window.getSelection())==null||e.removeAllRanges()}function nA(e){e.focus()}W.create({name:`selection`,addOptions(){return{className:`selection`}},addProseMirrorPlugins(){let{editor:e,options:t}=this;return[new L({key:new R(`selection`),props:{decorations(n){return eA(n,e)?B.create(n.doc,[$p.inline(n.selection.from,n.selection.to,{class:t.className})]):null},handleDOMEvents:{blur(t){return $k(t.state,e)&&tA(),!1},focus(t){return $k(t.state,e)&&requestAnimationFrame(()=>{!e.isDestroyed&&t.hasFocus()&&nA(t)}),!1}}}})]}});function rA({types:e,node:t}){return t&&Array.isArray(e)&&e.includes(t.type)||t?.type===e}var iA=W.create({name:`trailingNode`,addOptions(){return{node:void 0,notAfter:[]}},addProseMirrorPlugins(){let e=new R(this.name),t=this.options.node||this.editor.schema.topNodeType.contentMatch.defaultType?.name||`paragraph`,n=Object.entries(this.editor.schema.nodes).map(([,e])=>e).filter(e=>(this.options.notAfter||[]).concat(t).includes(e.name));return[new L({key:e,appendTransaction:(n,r,i)=>{let{doc:a,tr:o,schema:s}=i,c=e.getState(i),l=a.content.size,u=s.nodes[t];if(!n.some(e=>e.getMeta(`skipTrailingNode`))&&c)return o.insert(l,u.create())},state:{init:(e,t)=>{let r=t.tr.doc.lastChild;return!rA({node:r,types:n})},apply:(e,t)=>{if(!e.docChanged||e.getMeta(`__uniqueIDTransaction`))return t;let r=e.doc.lastChild;return!rA({node:r,types:n})}}})]}}),aA=W.create({name:`undoRedo`,addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:e,dispatch:t})=>Eh(e,t),redo:()=>({state:e,dispatch:t})=>Dh(e,t)}},addProseMirrorPlugins(){return[wh(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-я":()=>this.editor.commands.undo(),"Shift-Mod-я":()=>this.editor.commands.redo()}}}),oA=W.create({name:`starterKit`,addExtensions(){let e=[];return this.options.bold!==!1&&e.push(wT.configure(this.options.bold)),this.options.blockquote!==!1&&e.push(yT.configure(this.options.blockquote)),this.options.bulletList!==!1&&e.push(hO.configure(this.options.bulletList)),this.options.code!==!1&&e.push(OT.configure(this.options.code)),this.options.codeBlock!==!1&&e.push(MT.configure(this.options.codeBlock)),this.options.document!==!1&&e.push(NT.configure(this.options.document)),this.options.dropcursor!==!1&&e.push(Pk.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&e.push(Fk.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&e.push(PT.configure(this.options.hardBreak)),this.options.heading!==!1&&e.push(FT.configure(this.options.heading)),this.options.undoRedo!==!1&&e.push(aA.configure(this.options.undoRedo)),this.options.horizontalRule!==!1&&e.push(IT.configure(this.options.horizontalRule)),this.options.italic!==!1&&e.push(VT.configure(this.options.italic)),this.options.listItem!==!1&&e.push(UO.configure(this.options.listItem)),this.options.listKeymap!==!1&&e.push(QO.configure(this.options?.listKeymap)),this.options.link!==!1&&e.push(dO.configure(this.options?.link)),this.options.orderedList!==!1&&e.push(vk.configure(this.options.orderedList)),this.options.paragraph!==!1&&e.push(Ek.configure(this.options.paragraph)),this.options.strike!==!1&&e.push(kk.configure(this.options.strike)),this.options.text!==!1&&e.push(Ak.configure(this.options.text)),this.options.underline!==!1&&e.push(jk.configure(this.options?.underline)),this.options.trailingNode!==!1&&e.push(iA.configure(this.options?.trailingNode)),e}}),sA=`embed-edit`,cA=`embed-refresh`,lA=(e,t,{editor:n,getPos:r},i=[])=>{let a=document.createElement(`div`);a.className=e,a.contentEditable=`false`;let o=document.createElement(`div`);o.className=`block-header`;let s=document.createElement(`span`);s.textContent=t,o.append(s),a.append(o);let c={text:`Remove`,onClick:e=>{let t=n.state.doc.nodeAt(e);n.chain().focus().deleteRange({from:e,to:e+t.nodeSize}).run()}};for(let{text:e,onClick:t}of[...i,c]){let n=document.createElement(`button`);n.type=`button`,n.textContent=e,n.addEventListener(`click`,()=>{let e=r();typeof e==`number`&&t(e,a)}),o.append(n)}return{view:{dom:a,stopEvent:e=>e.target.closest(`button`)!==null,ignoreMutation:()=>!0},dom:a,title:s}},uA=G.create({name:`readmore`,group:`block`,atom:!0,priority:1e3,parseHTML:()=>[{tag:`hr.readmore`}],renderHTML:()=>[`hr`,{class:`readmore`,title:`Read more`}],addNodeView:()=>e=>lA(`readmore-block`,`Read more`,e).view,addCommands(){return{setReadmore:()=>({chain:e,state:t})=>{let n=[];return t.doc.descendants((e,t)=>{e.type.name===this.name&&n.push(t)}),e().command(({tr:e})=>{for(let t of n.reverse())e.delete(t,t+1);return!0}).insertContent({type:this.name}).command(({tr:e})=>{let n=0;return e.doc.descendants((e,t)=>{e.type.name===this.name&&(n=t+1)}),e.doc.nodeAt(n)?.isTextblock||e.insert(n,t.schema.nodes.paragraph.create()),e.setSelection(F.create(e.doc,n+1)),!0}).run()}}}}),dA=G.create({name:`raw`,group:`block`,content:`text*`,marks:``,code:!0,defining:!0,priority:1e3,parseHTML:()=>[{tag:`pre.raw`,preserveWhitespace:`full`}],renderHTML:()=>[`pre`,{class:`raw`},0],addCommands(){return{toggleRaw:()=>({commands:e})=>e.toggleNode(this.name,`paragraph`)}}}),fA=Gy.create({name:`rawInline`,code:!0,excludes:`_`,parseHTML:()=>[{tag:`span.raw`}],renderHTML:()=>[`span`,{class:`raw`},0]}),pA=Gy.create({name:`small`,parseHTML:()=>[{tag:`small`}],renderHTML:()=>[`small`,0]}),mA=Gy.create({name:`big`,parseHTML:()=>[{tag:`big`}],renderHTML:()=>[`big`,0]}),hA=new Map;addEventListener(`message`,e=>{let t=e.source&&hA.get(e.source),n=e.data?.edahaEmbedHeight;t&&typeof n==`number`&&(t.style.height=`${Math.min(Math.max(n,40),2e3)}px`)});var gA=e=>{for(let[t,n]of hA)e.contains(n)&&hA.delete(t)},_A=()=>document.documentElement.dataset.theme===`dark`||document.documentElement.dataset.theme!==`light`&&globalThis.matchMedia?.(`(prefers-color-scheme: dark)`).matches?`dark`:`light`,vA=G.create({name:`embed`,group:`block`,atom:!0,addOptions:()=>({tools:()=>void 0}),addAttributes:()=>({key:{default:``},content:{default:``},options:{default:{}}}),parseHTML:()=>[{tag:`div.embed`,getAttrs:e=>({key:e.getAttribute(`data-embed`)??``,content:e.getAttribute(`data-content`)??``,options:Da(e.getAttribute(`data-options`))})}],renderHTML:({node:e})=>[`div`,{class:`embed`,"data-embed":e.attrs.key,"data-content":e.attrs.content,"data-options":Object.keys(e.attrs.options).length?JSON.stringify(e.attrs.options):null}],addNodeView(){return e=>{let{editor:t}=e,n=lA(`embed-block`,``,e,[{text:`Edit`,onClick:(e,n)=>{t.commands.setNodeSelection(e),n.dispatchEvent(new Event(sA,{bubbles:!0}))}}]),r=n.dom.querySelector(`button`),i=document.createElement(`span`);i.className=`icon embed-icon`,i.setAttribute(`aria-hidden`,`true`),n.title.before(i);let a=document.createElement(`div`);a.className=`embed-preview`,n.dom.append(a);let o=``,s=e.node.attrs,c=async e=>{let t=`${e.key}\0${JSON.stringify(e.options)}\0${e.content}`;if(t===o)return;o=t;let s=this.options.tools(),c=s?.embeds.find(t=>t.key===e.key);n.title.textContent=kt(s?.embeds??[],e.key),i.innerHTML=c?.icon??``,r.hidden=!c,gA(a),a.replaceChildren();let l=document.createElement(`pre`);if(l.className=`embed-content`,l.textContent=ka(e.content,e.options),!s)a.append(l);else{a.textContent=`Loading…`;try{let r=await s.loadFrame(e);if(o!==t)return;a.replaceChildren();for(let e of r.warnings){let t=document.createElement(`p`);t.className=`embed-warning`,t.textContent=e,a.append(t)}if(r.errors.length){let e=document.createElement(`div`);e.className=`embed-errors`;let t=document.createElement(`p`);t.textContent=`This embed isn't valid, so the website leaves it out:`;let n=document.createElement(`ul`);for(let e of r.errors){let t=document.createElement(`li`);t.textContent=e,n.append(t)}e.append(t,n),a.append(e)}if(r.errors.length||r.warnings.length){a.append(l);return}let i=document.createElement(`iframe`);i.className=`embed-frame`,i.title=`${n.title.textContent}: preview`,i.setAttribute(`sandbox`,`allow-scripts allow-same-origin allow-popups allow-popups-to-escape-sandbox`),i.src=Mt(`${r.url}?theme=${_A()}`),a.append(i),i.contentWindow&&hA.set(i.contentWindow,i)}catch(e){o===t&&(a.textContent=`No preview: ${e.message}`)}}};return c(s),n.dom.addEventListener(cA,()=>{o=``,c(s)}),{...n.view,update:e=>e.type===this.type&&(s=e.attrs,c(s),!0),destroy:()=>gA(a)}}},addCommands(){return{setEmbed:e=>({commands:t,editor:n})=>n.isActive(this.name)?t.updateAttributes(this.name,e):t.insertContent({type:this.name,attrs:e}),insertEmbed:e=>({commands:t,state:n})=>n.selection instanceof I?t.insertContentAt(n.selection.to,{type:this.name,attrs:e}):t.insertContent({type:this.name,attrs:e})}}}),yA=W.create({name:`headingIds`,addProseMirrorPlugins:()=>[new L({key:new R(`headingIds`),props:{decorations:e=>{let t=[];e.doc.descendants((e,n)=>{e.type.name===`heading`&&t.push({pos:n,node:e})});let n=vt(t.map(({node:e})=>e.textContent));return B.create(e.doc,t.flatMap(({pos:e,node:t},r)=>{let i=n[r];if(!i)return[];let a=document.createElement(`span`);return a.className=`heading-id`,a.contentEditable=`false`,a.textContent=`#${i}`,[$p.widget(e+t.nodeSize-1,a,{side:1,key:i,ignoreSelection:!0})]}))}}})]}),bA=W.create({name:`selectDetails`,addProseMirrorPlugins:()=>[new L({key:new R(`selectDetails`),props:{handleClickOn:(e,t,n,r,i,a)=>!a||n.type.name!==`details`?!1:(e.dispatch(e.state.tr.setSelection(I.create(e.state.doc,r))),!0)}})]}),xA=(e,t)=>{let{selection:n,doc:r}=e.state;return(e.view.hasFocus()||t.contains(document.activeElement))&&e.isEditable&&tg(n)&&r.textBetween(n.from,n.to).length>0&&!e.isActive(`codeBlock`)&&!e.isActive(`raw`)&&!e.isActive(`rawInline`)},SA=(e,t,n,r=()=>void 0,i)=>new hb({element:e,content:t,extensions:[oA.configure({link:{openOnClick:!1,autolink:!0},heading:{levels:[1,2,3,4]}}),Ow,lT.configure({table:{resizable:!1}}),ww,Ew,Tw,bA,pA,mA,yA,uA,dA,fA,vA.configure({tools:r}),...i?[lw.configure({element:i,shouldShow:({editor:e})=>xA(e,i)})]:[]],onUpdate:({editor:e})=>n(e.getHTML())}),CA=e=>({label:`Heading ${e}`,run:t=>t.chain().focus().toggleHeading({level:e}).run(),active:t=>t.isActive(`heading`,{level:e})}),wA=(e,t)=>E`<button
348
+ `):``,markdownTokenizer:{name:`taskList`,level:`block`,start(e){let t=e.match(/^\s*[-+*]\s+\[([ xX])\]\s+/)?.index;return t===void 0?-1:t},tokenize(e,t,n){let r=e=>{let t=jy(e,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:e=>({indentLevel:e[1].length,mainContent:e[4],checked:e[3].toLowerCase()===`x`}),createToken:(e,t)=>({type:`taskItem`,raw:``,mainContent:e.mainContent,indentLevel:e.indentLevel,checked:e.checked,text:e.mainContent,tokens:n.inlineTokens(e.mainContent),nestedTokens:t}),customNestedParser:r},n);if(t){let r={type:`taskList`,raw:t.raw,items:t.items},i=e.slice(t.raw.length);return i.trim()?[r,...n.blockTokens(i)]:[r]}return n.blockTokens(e)},i=jy(e,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:e=>({indentLevel:e[1].length,mainContent:e[4],checked:e[3].toLowerCase()===`x`}),createToken:(e,t)=>({type:`taskItem`,raw:``,mainContent:e.mainContent,indentLevel:e.indentLevel,checked:e.checked,text:e.mainContent,tokens:n.inlineTokens(e.mainContent),nestedTokens:t}),customNestedParser:r},n);if(i)return{type:`taskList`,raw:i.raw,items:i.items}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleTaskList:()=>({commands:e})=>e.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}});W.create({name:`listKit`,addExtensions(){let e=[];return this.options.bulletList!==!1&&e.push(hO.configure(this.options.bulletList)),this.options.listItem!==!1&&e.push(UO.configure(this.options.listItem)),this.options.listKeymap!==!1&&e.push(QO.configure(this.options.listKeymap)),this.options.orderedList!==!1&&e.push(vk.configure(this.options.orderedList)),this.options.taskItem!==!1&&e.push(Sk.configure(this.options.taskItem)),this.options.taskList!==!1&&e.push(Ck.configure(this.options.taskList)),e}});var wk=`&nbsp;`,Tk=`\xA0`,Ek=G.create({name:`paragraph`,priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:`block`,content:`inline*`,parseHTML(){return[{tag:`p`}]},renderHTML({HTMLAttributes:e}){return[`p`,U(this.options.HTMLAttributes,e),0]},parseMarkdown:(e,t)=>{let n=e.tokens||[];if(n.length===1&&n[0].type===`image`)return t.parseChildren([n[0]]);let r=t.parseInline(n);return n.length===1&&n[0].type===`text`&&(n[0].raw===wk||n[0].text===wk||n[0].raw===Tk||n[0].text===Tk)&&r.length===1&&r[0].type===`text`&&(r[0].text===wk||r[0].text===Tk)?t.createNode(`paragraph`,void 0,[]):t.createNode(`paragraph`,void 0,r)},renderMarkdown:(e,t,n)=>{if(!e)return``;let r=Array.isArray(e.content)?e.content:[];if(r.length===0){var i,a;let e=Array.isArray(n==null||(i=n.previousNode)==null?void 0:i.content)?n.previousNode.content:[];return(n==null||(a=n.previousNode)==null?void 0:a.type)===`paragraph`&&e.length===0?wk:``}return t.renderChildren(r)},addCommands(){return{setParagraph:()=>({commands:e})=>e.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),Dk=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,Ok=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,kk=Gy.create({name:`strike`,addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:`s`},{tag:`del`},{tag:`strike`},{style:`text-decoration`,consuming:!1,getAttrs:e=>e.includes(`line-through`)?{}:!1}]},renderHTML({HTMLAttributes:e}){return[`s`,U(this.options.HTMLAttributes,e),0]},markdownTokenName:`del`,parseMarkdown:(e,t)=>t.applyMark(`strike`,t.parseInline(e.tokens||[])),renderMarkdown:(e,t)=>`~~${t.renderChildren(e)}~~`,addCommands(){return{setStrike:()=>({commands:e})=>e.setMark(this.name),toggleStrike:()=>({commands:e})=>e.toggleMark(this.name),unsetStrike:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[gb({find:Dk,type:this.type})]},addPasteRules(){return[Sb({find:Ok,type:this.type})]}}),Ak=G.create({name:`text`,group:`inline`,parseMarkdown:e=>({type:`text`,text:e.text||``}),renderMarkdown:e=>e.text||``}),jk=Gy.create({name:`underline`,addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:`u`},{style:`text-decoration`,consuming:!1,getAttrs:e=>e.includes(`underline`)?{}:!1}]},renderHTML({HTMLAttributes:e}){return[`u`,U(this.options.HTMLAttributes,e),0]},parseMarkdown(e,t){return t.applyMark(this.name||`underline`,t.parseInline(e.tokens||[]))},renderMarkdown(e,t){return`<u>${t.renderChildren(e)}</u>`},markdownTokenizer:{name:`underline`,level:`inline`,start(e){return e.toLowerCase().indexOf(`<u>`)},tokenize(e,t,n){if(!/^<u>/i.test(e))return;let r=/\\[\s\S]|`+|<\/u>/gi;r.lastIndex=3;let i=r.exec(e);for(;i;){if(i[0].startsWith("`")){let t=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/.exec(e.slice(i.index));t&&(r.lastIndex=i.index+t[0].length)}else if(!i[0].startsWith(`\\`)){let t=e.slice(3,i.index);return t?{type:`underline`,raw:e.slice(0,r.lastIndex),text:t,tokens:n.inlineTokens(t)}:void 0}i=r.exec(e)}}},addCommands(){return{setUnderline:()=>({commands:e})=>e.setMark(this.name),toggleUnderline:()=>({commands:e})=>e.toggleMark(this.name),unsetUnderline:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}});function Mk(e={}){return new L({view(t){return new Nk(t,e)}})}var Nk=class{constructor(e,t){this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.lastDragEvent=null,this.width=t.width??1,this.color=t.color===!1?void 0:t.color||`black`,this.class=t.class,this.handlers=[`dragover`,`dragend`,`drop`,`dragleave`].map(t=>{let n=e=>{this[t](e)};return e.dom.addEventListener(t,n),{name:t,handler:n}})}destroy(){this.setCursor(null),this.handlers.forEach(({name:e,handler:t})=>this.editorView.dom.removeEventListener(e,t))}update(e,t){if(this.cursorPos!=null&&t.doc!=e.state.doc){if(this.lastDragEvent){let e=this.computeTarget(this.lastDragEvent);e==this.cursorPos?this.updateOverlay():this.setCursor(e)}else this.updateOverlay()}}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,e==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e=this.editorView.state.doc.resolve(this.cursorPos),t=!e.parent.inlineContent,n,r=this.editorView.dom,i=r.getBoundingClientRect(),a=i.width/r.offsetWidth,o=i.height/r.offsetHeight;if(t){let t=e.nodeBefore,r=e.nodeAfter;if(t||r){let e=this.editorView.nodeDOM(this.cursorPos-(t?t.nodeSize:0));if(e){let i=e.getBoundingClientRect(),a=t?i.bottom:i.top;t&&r&&(a=(a+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let s=this.width/2*o;n={left:i.left,right:i.right,top:a-s,bottom:a+s}}}}if(!n){let e=this.editorView.coordsAtPos(this.cursorPos),t=this.width/2*a;n={left:e.left-t,right:e.left+t,top:e.top,bottom:e.bottom}}let s=this.editorView.dom.offsetParent;this.element||(this.element=s.appendChild(document.createElement(`div`)),this.class&&(this.element.className=this.class),this.element.style.cssText=`position: absolute; z-index: 50; pointer-events: none;`,this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle(`prosemirror-dropcursor-block`,t),this.element.classList.toggle(`prosemirror-dropcursor-inline`,!t);let c,l;if(!s||s==document.body&&getComputedStyle(s).position==`static`)c=-pageXOffset,l=-pageYOffset;else{let e=s.getBoundingClientRect(),t=e.width/s.offsetWidth,n=e.height/s.offsetHeight;c=e.left-s.scrollLeft*t,l=e.top-s.scrollTop*n}this.element.style.left=(n.left-c)/a+`px`,this.element.style.top=(n.top-l)/o+`px`,this.element.style.width=(n.right-n.left)/a+`px`,this.element.style.height=(n.bottom-n.top)/o+`px`}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}computeTarget(e){let t=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),n=t&&t.inside>=0&&this.editorView.state.doc.nodeAt(t.inside),r=n&&n.type.spec.disableDropCursor,i=typeof r==`function`?r(this.editorView,t,e):r;if(!t||i)return null;let a=t.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let e=Ic(this.editorView.state.doc,a,this.editorView.dragging.slice);e!=null&&(a=e)}return a}dragover(e){if(!this.editorView.editable)return;this.lastDragEvent=e;let t=this.computeTarget(e);t!=null&&(this.setCursor(t),this.scheduleRemoval(5e3))}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}};W.create({name:`characterCount`,addOptions(){return{limit:null,autoTrim:!0,mode:`textSize`,textCounter:e=>e.length,wordCounter:e=>e.split(` `).filter(e=>e!==``).length}},addStorage(){return{characters:()=>0,words:()=>0}},onBeforeCreate(){this.storage.characters=e=>{let t=e?.node||this.editor.state.doc;if((e?.mode||this.options.mode)===`textSize`){let e=t.textBetween(0,t.content.size,void 0,` `);return this.options.textCounter(e)}return t.nodeSize},this.storage.words=e=>{let t=e?.node||this.editor.state.doc,n=t.textBetween(0,t.content.size,` `,` `);return this.options.wordCounter(n)}},addProseMirrorPlugins(){let e=!1;return[new L({key:new R(`characterCount`),appendTransaction:(t,n,r)=>{if(e)return;let i=this.options.limit,a=this.options.autoTrim;if(i==null||i===0||a===!1){e=!0;return}let o=this.storage.characters({node:r.doc});if(o>i){let t=o-i;console.warn(`[CharacterCount] Initial content exceeded limit of ${i} characters. Content was automatically trimmed.`);let n=r.tr.deleteRange(0,t);return e=!0,n}e=!0},filterTransaction:(e,t)=>{let n=this.options.limit;if(!e.docChanged||n===0||n==null)return!0;let r=this.storage.characters({node:t.doc}),i=this.storage.characters({node:e.doc});if(i<=n||r>n&&i>n&&i<=r)return!0;if(r>n&&i>n&&i>r||!e.getMeta(`paste`))return!1;let a=e.selection.$head.pos,o=a-(i-n),s=a;return e.deleteRange(o,s),!(this.storage.characters({node:e.doc})>n)}})]}});var Pk=W.create({name:`dropCursor`,addOptions(){return{color:`currentColor`,width:1,class:void 0}},addProseMirrorPlugins(){return[Mk(this.options)]}});W.create({name:`focus`,addOptions(){return{className:`has-focus`,mode:`all`}},addProseMirrorPlugins(){return[new L({key:new R(`focus`),props:{decorations:({doc:e,selection:t})=>{let{isEditable:n,isFocused:r}=this.editor,{anchor:i}=t,a=[];if(!n||!r)return B.create(e,[]);let o=0;this.options.mode===`deepest`&&e.descendants((e,t)=>{if(!e.isText){if(!(i>=t&&i<=t+e.nodeSize-1))return!1;o+=1}});let s=0;return e.descendants((e,t)=>{if(e.isText||!(i>=t&&i<=t+e.nodeSize-1))return!1;if(s+=1,this.options.mode===`deepest`&&o-s>0||this.options.mode===`shallowest`&&s>1)return this.options.mode===`deepest`;a.push($p.node(t,t+e.nodeSize,{class:this.options.className}))}),B.create(e,a)}}})]}});var Fk=W.create({name:`gapCursor`,addProseMirrorPlugins(){return[hw()]},extendNodeSchema(e){return{allowGapCursor:H(V(e,`allowGapCursor`,{name:e.name,options:e.options,storage:e.storage}))??null}}}),Ik=`placeholder`,Lk=new R(`tiptap__placeholder`);function Rk(e){let{editor:t,placeholder:n,dataAttribute:r,pos:i,node:a,isEmptyDoc:o,hasAnchor:s,classes:{emptyNode:c,emptyEditor:l}}=e,u=[c];return o&&u.push(l),$p.node(i,i+a.nodeSize,{class:u.join(` `),[r]:typeof n==`function`?n({editor:t,node:a,pos:i,hasAnchor:s}):n})}function zk(e,t){return typeof e==`function`?e(t):e}function Bk({editor:e,options:t,dataAttribute:n,doc:r,selection:i,from:a,to:o}){let{anchor:s}=i,c=[],l=e.isEmpty;return r.nodesBetween(a,o,(r,i)=>{let a=s>=i&&s<=i+r.nodeSize,o=!r.isLeaf&&G_(r);return r.type.isTextblock&&(a||!t.showOnlyCurrent)&&o&&c.push(Rk({editor:e,isEmptyDoc:l,dataAttribute:n,hasAnchor:a,placeholder:t.placeholder,classes:{emptyEditor:t.emptyEditorClass,emptyNode:zk(t.emptyNodeClass,{editor:e,node:r,pos:i,hasAnchor:a})},node:r,pos:i})),t.includeChildren}),c}function Vk({editor:e,options:t,dataAttribute:n,doc:r,selection:i}){if(!e.isEditable&&t.showOnlyWhenEditable)return null;let{anchor:a}=i,o=[],s=e.isEmpty;if(t.showOnlyCurrent&&!t.includeChildren){let i=r.resolve(a),c=i.depth>0?i.node(1):i.nodeAfter,l=i.depth>0?i.before(1):a;if(c&&c.type.isTextblock&&G_(c)){let r=a>=l&&a<=l+c.nodeSize;o.push(Rk({editor:e,isEmptyDoc:s,dataAttribute:n,hasAnchor:r,placeholder:t.placeholder,classes:{emptyEditor:t.emptyEditorClass,emptyNode:zk(t.emptyNodeClass,{editor:e,node:c,pos:l,hasAnchor:r})},node:c,pos:l}))}}else o.push(...Bk({editor:e,options:t,dataAttribute:n,doc:r,selection:i,from:0,to:r.content.size}));return B.create(r,o)}function Hk(e,t){let n=e.resolve(t);if(n.depth===0){let e=n.nodeAfter??n.nodeBefore;if(!e)return{from:t,to:t};let r=n.nodeAfter?t:t-e.nodeSize;return{from:r,to:r+e.nodeSize}}let r=n.before(1);return{from:r,to:r+n.node(1).nodeSize}}function Uk(e,t){return{from:Math.max(0,t.from),to:Math.min(e.content.size,t.to)}}function Wk(e,t,n){let r=[];return e.forEach((e,i)=>{let a=i,o=a+e.nodeSize,s=a+1,c=o+1;s<n&&c>t&&r.push({from:a,to:o})}),r}function Gk(e){if(e.length===0)return[];let t=[...e].sort((e,t)=>e.from-t.from),n=[{...t[0]}];for(let e=1;e<t.length;e+=1){let r=n[n.length-1],i=t[e];i.from<=r.to?r.to=Math.max(r.to,i.to):n.push({...i})}return n}function Kk(e,t){let n=Wk(e,t.from,t.to);return n.push(Uk(e,Hk(e,t.from))),t.to>t.from?n.push(Uk(e,Hk(e,Math.min(t.to,e.content.size+1)-1))):t.from<e.content.size+1&&n.push(Uk(e,Hk(e,Math.min(t.from+1,e.content.size)))),n}function qk(e,t,n){let r=[];if(e.docChanged){let t=M_(e);for(let e of t)r.push(...Kk(n.doc,e.newRange))}return e.selectionSet&&(r.push(Uk(n.doc,Hk(n.doc,e.mapping.map(t.selection.anchor)))),r.push(Uk(n.doc,Hk(n.doc,n.selection.anchor)))),Gk(r)}function Jk(e,t,n){let r=Math.max(0,Math.min(e,n.content.size));return{from:r,to:Math.max(r,Math.min(t,n.content.size))}}function Yk({decorations:e,ranges:t,editor:n,options:r,dataAttribute:i,doc:a,selection:o}){let s=e;for(let e of t){let{from:t,to:c}=Jk(e.from,e.to,a),l=s.find(t,c).filter(e=>e.from>=t&&e.to<=c);l.length&&(s=s.remove(l));let u=Bk({editor:n,options:r,dataAttribute:i,doc:a,selection:o,from:t,to:c});u.length&&(s=s.add(a,u))}return s}function Xk({editor:e,options:t,dataAttribute:n}){return{init(r,i){return Vk({editor:e,options:t,dataAttribute:n,doc:i.doc,selection:i.selection})??B.empty},apply(r,i,a,o){return!r.docChanged&&!r.selectionSet?i:Yk({decorations:i.map(r.mapping,r.doc),ranges:qk(r,a,o),editor:e,options:t,dataAttribute:n,doc:o.doc,selection:o.selection})}}}function Zk(e){return e.replace(/\s+/g,`-`).replace(/[^a-zA-Z0-9-]/g,``).replace(/^[0-9-]+/,``).replace(/^-+/,``).toLowerCase()}function Qk({editor:e,options:t}){let n=t.dataAttribute?`data-${Zk(t.dataAttribute)}`:`data-${Ik}`,r=t.showOnlyCurrent&&!t.includeChildren;return new L({key:Lk,...r?{}:{state:Xk({editor:e,options:t,dataAttribute:n})},props:{decorations:r?({doc:r,selection:i})=>Vk({editor:e,options:t,dataAttribute:n,doc:r,selection:i}):n=>t.showOnlyWhenEditable&&!e.isEditable?B.empty:Lk.getState(n)??B.empty}})}W.create({name:`placeholder`,addOptions(){return{emptyEditorClass:`is-editor-empty`,emptyNodeClass:`is-empty`,dataAttribute:Ik,placeholder:`Write something …`,showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){return[Qk({editor:this.editor,options:this.options})]}});function $k(e,t){return!e.selection.empty&&!K_(e.selection)&&t.isEditable}function eA(e,t){return $k(e,t)&&!t.isFocused&&!t.view.dragging}function tA(){var e;(e=window.getSelection())==null||e.removeAllRanges()}function nA(e){e.focus()}W.create({name:`selection`,addOptions(){return{className:`selection`}},addProseMirrorPlugins(){let{editor:e,options:t}=this;return[new L({key:new R(`selection`),props:{decorations(n){return eA(n,e)?B.create(n.doc,[$p.inline(n.selection.from,n.selection.to,{class:t.className})]):null},handleDOMEvents:{blur(t){return $k(t.state,e)&&tA(),!1},focus(t){return $k(t.state,e)&&requestAnimationFrame(()=>{!e.isDestroyed&&t.hasFocus()&&nA(t)}),!1}}}})]}});function rA({types:e,node:t}){return t&&Array.isArray(e)&&e.includes(t.type)||t?.type===e}var iA=W.create({name:`trailingNode`,addOptions(){return{node:void 0,notAfter:[]}},addProseMirrorPlugins(){let e=new R(this.name),t=this.options.node||this.editor.schema.topNodeType.contentMatch.defaultType?.name||`paragraph`,n=Object.entries(this.editor.schema.nodes).map(([,e])=>e).filter(e=>(this.options.notAfter||[]).concat(t).includes(e.name));return[new L({key:e,appendTransaction:(n,r,i)=>{let{doc:a,tr:o,schema:s}=i,c=e.getState(i),l=a.content.size,u=s.nodes[t];if(!n.some(e=>e.getMeta(`skipTrailingNode`))&&c)return o.insert(l,u.create())},state:{init:(e,t)=>{let r=t.tr.doc.lastChild;return!rA({node:r,types:n})},apply:(e,t)=>{if(!e.docChanged||e.getMeta(`__uniqueIDTransaction`))return t;let r=e.doc.lastChild;return!rA({node:r,types:n})}}})]}}),aA=W.create({name:`undoRedo`,addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:e,dispatch:t})=>Eh(e,t),redo:()=>({state:e,dispatch:t})=>Dh(e,t)}},addProseMirrorPlugins(){return[wh(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-я":()=>this.editor.commands.undo(),"Shift-Mod-я":()=>this.editor.commands.redo()}}}),oA=W.create({name:`starterKit`,addExtensions(){let e=[];return this.options.bold!==!1&&e.push(wT.configure(this.options.bold)),this.options.blockquote!==!1&&e.push(yT.configure(this.options.blockquote)),this.options.bulletList!==!1&&e.push(hO.configure(this.options.bulletList)),this.options.code!==!1&&e.push(OT.configure(this.options.code)),this.options.codeBlock!==!1&&e.push(MT.configure(this.options.codeBlock)),this.options.document!==!1&&e.push(NT.configure(this.options.document)),this.options.dropcursor!==!1&&e.push(Pk.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&e.push(Fk.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&e.push(PT.configure(this.options.hardBreak)),this.options.heading!==!1&&e.push(FT.configure(this.options.heading)),this.options.undoRedo!==!1&&e.push(aA.configure(this.options.undoRedo)),this.options.horizontalRule!==!1&&e.push(IT.configure(this.options.horizontalRule)),this.options.italic!==!1&&e.push(VT.configure(this.options.italic)),this.options.listItem!==!1&&e.push(UO.configure(this.options.listItem)),this.options.listKeymap!==!1&&e.push(QO.configure(this.options?.listKeymap)),this.options.link!==!1&&e.push(dO.configure(this.options?.link)),this.options.orderedList!==!1&&e.push(vk.configure(this.options.orderedList)),this.options.paragraph!==!1&&e.push(Ek.configure(this.options.paragraph)),this.options.strike!==!1&&e.push(kk.configure(this.options.strike)),this.options.text!==!1&&e.push(Ak.configure(this.options.text)),this.options.underline!==!1&&e.push(jk.configure(this.options?.underline)),this.options.trailingNode!==!1&&e.push(iA.configure(this.options?.trailingNode)),e}}),sA=`embed-edit`,cA=`embed-refresh`,lA=(e,t,{editor:n,getPos:r},i=[])=>{let a=document.createElement(`div`);a.className=e,a.contentEditable=`false`;let o=document.createElement(`div`);o.className=`block-header`;let s=document.createElement(`span`);s.textContent=t,o.append(s),a.append(o);let c={text:`Remove`,onClick:e=>{let t=n.state.doc.nodeAt(e);n.chain().focus().deleteRange({from:e,to:e+t.nodeSize}).run()}};for(let{text:e,onClick:t}of[...i,c]){let n=document.createElement(`button`);n.type=`button`,n.textContent=e,n.addEventListener(`click`,()=>{let e=r();typeof e==`number`&&t(e,a)}),o.append(n)}return{view:{dom:a,stopEvent:e=>e.target.closest(`button`)!==null,ignoreMutation:()=>!0},dom:a,title:s}},uA=G.create({name:`readmore`,group:`block`,atom:!0,priority:1e3,parseHTML:()=>[{tag:`hr.readmore`}],renderHTML:()=>[`hr`,{class:`readmore`,title:`Read more`}],addNodeView:()=>e=>lA(`readmore-block`,`Read more`,e).view,addCommands(){return{setReadmore:()=>({chain:e,state:t})=>{let n=[];return t.doc.descendants((e,t)=>{e.type.name===this.name&&n.push(t)}),e().command(({tr:e})=>{for(let t of n.reverse())e.delete(t,t+1);return!0}).insertContent({type:this.name}).command(({tr:e})=>{let n=0;return e.doc.descendants((e,t)=>{e.type.name===this.name&&(n=t+1)}),e.doc.nodeAt(n)?.isTextblock||e.insert(n,t.schema.nodes.paragraph.create()),e.setSelection(F.create(e.doc,n+1)),!0}).run()}}}}),dA=G.create({name:`raw`,group:`block`,content:`text*`,marks:``,code:!0,defining:!0,priority:1e3,parseHTML:()=>[{tag:`pre.raw`,preserveWhitespace:`full`}],renderHTML:()=>[`pre`,{class:`raw`},0],addCommands(){return{toggleRaw:()=>({commands:e})=>e.toggleNode(this.name,`paragraph`)}}}),fA=Gy.create({name:`rawInline`,code:!0,excludes:`_`,parseHTML:()=>[{tag:`span.raw`}],renderHTML:()=>[`span`,{class:`raw`},0]}),pA=Gy.create({name:`small`,parseHTML:()=>[{tag:`small`}],renderHTML:()=>[`small`,0]}),mA=Gy.create({name:`big`,parseHTML:()=>[{tag:`big`}],renderHTML:()=>[`big`,0]}),hA=new Map;addEventListener(`message`,e=>{let t=e.source&&hA.get(e.source),n=e.data?.edahaEmbedHeight;t&&typeof n==`number`&&(t.style.height=`${Math.min(Math.max(n,40),2e3)}px`)});var gA=e=>{for(let[t,n]of hA)e.contains(n)&&hA.delete(t)},_A=()=>document.documentElement.dataset.theme===`dark`||document.documentElement.dataset.theme!==`light`&&globalThis.matchMedia?.(`(prefers-color-scheme: dark)`).matches?`dark`:`light`,vA=G.create({name:`embed`,group:`block`,atom:!0,addOptions:()=>({tools:()=>void 0}),addAttributes:()=>({key:{default:``},content:{default:``},options:{default:{}}}),parseHTML:()=>[{tag:`div.embed`,getAttrs:e=>({key:e.getAttribute(`data-embed`)??``,content:e.getAttribute(`data-content`)??``,options:Da(e.getAttribute(`data-options`))})}],renderHTML:({node:e})=>[`div`,{class:`embed`,"data-embed":e.attrs.key,"data-content":e.attrs.content,"data-options":Object.keys(e.attrs.options).length?JSON.stringify(e.attrs.options):null}],addNodeView(){return e=>{let{editor:t}=e,n=lA(`embed-block`,``,e,[{text:`Edit`,onClick:(e,n)=>{t.commands.setNodeSelection(e),n.dispatchEvent(new Event(sA,{bubbles:!0}))}}]),r=n.dom.querySelector(`button`),i=document.createElement(`span`);i.className=`icon embed-icon`,i.setAttribute(`aria-hidden`,`true`),n.title.before(i);let a=document.createElement(`div`);a.className=`embed-preview`,n.dom.append(a);let o=``,s=e.node.attrs,c=async e=>{let t=`${e.key}\0${JSON.stringify(e.options)}\0${e.content}`;if(t===o)return;o=t;let s=this.options.tools(),c=s?.embeds.find(t=>t.key===e.key);n.title.textContent=mt(s?.embeds??[],e.key),i.innerHTML=c?.icon??``,r.hidden=!c,gA(a),a.replaceChildren();let l=document.createElement(`pre`);if(l.className=`embed-content`,l.textContent=ka(e.content,e.options),!s)a.append(l);else{a.textContent=`Loading…`;try{let r=await s.loadFrame(e);if(o!==t)return;a.replaceChildren();for(let e of r.warnings){let t=document.createElement(`p`);t.className=`embed-warning`,t.textContent=e,a.append(t)}if(r.errors.length){let e=document.createElement(`div`);e.className=`embed-errors`;let t=document.createElement(`p`);t.textContent=`This embed isn't valid, so the website leaves it out:`;let n=document.createElement(`ul`);for(let e of r.errors){let t=document.createElement(`li`);t.textContent=e,n.append(t)}e.append(t,n),a.append(e)}if(r.errors.length||r.warnings.length){a.append(l);return}let i=document.createElement(`iframe`);i.className=`embed-frame`,i.title=`${n.title.textContent}: preview`,i.setAttribute(`sandbox`,`allow-scripts allow-same-origin allow-popups allow-popups-to-escape-sandbox`),i.src=_t(`${r.url}?theme=${_A()}`),a.append(i),i.contentWindow&&hA.set(i.contentWindow,i)}catch(e){o===t&&(a.textContent=`No preview: ${e.message}`)}}};return c(s),n.dom.addEventListener(cA,()=>{o=``,c(s)}),{...n.view,update:e=>e.type===this.type&&(s=e.attrs,c(s),!0),destroy:()=>gA(a)}}},addCommands(){return{setEmbed:e=>({commands:t,editor:n})=>n.isActive(this.name)?t.updateAttributes(this.name,e):t.insertContent({type:this.name,attrs:e}),insertEmbed:e=>({commands:t,state:n})=>n.selection instanceof I?t.insertContentAt(n.selection.to,{type:this.name,attrs:e}):t.insertContent({type:this.name,attrs:e})}}}),yA=W.create({name:`headingIds`,addProseMirrorPlugins:()=>[new L({key:new R(`headingIds`),props:{decorations:e=>{let t=[];e.doc.descendants((e,n)=>{e.type.name===`heading`&&t.push({pos:n,node:e})});let n=Ot(t.map(({node:e})=>e.textContent));return B.create(e.doc,t.flatMap(({pos:e,node:t},r)=>{let i=n[r];if(!i)return[];let a=document.createElement(`span`);return a.className=`heading-id`,a.contentEditable=`false`,a.textContent=`#${i}`,[$p.widget(e+t.nodeSize-1,a,{side:1,key:i,ignoreSelection:!0})]}))}}})]}),bA=W.create({name:`selectDetails`,addProseMirrorPlugins:()=>[new L({key:new R(`selectDetails`),props:{handleClickOn:(e,t,n,r,i,a)=>!a||n.type.name!==`details`?!1:(e.dispatch(e.state.tr.setSelection(I.create(e.state.doc,r))),!0)}})]}),xA=Ow.extend({addOptions(){return{...this.parent?.(),address:e=>e}},addNodeView(){return({node:e})=>{let t=document.createElement(`img`),n=({attrs:e})=>{t.src=this.options.address(String(e.src));for(let n of[`alt`,`title`])e[n]?t.setAttribute(n,String(e[n])):t.removeAttribute(n)};return n(e),{dom:t,update:t=>t.type===e.type&&(n(t),!0)}}}}),SA=(e,t)=>{let{selection:n,doc:r}=e.state;return(e.view.hasFocus()||t.contains(document.activeElement))&&e.isEditable&&tg(n)&&r.textBetween(n.from,n.to).length>0&&!e.isActive(`codeBlock`)&&!e.isActive(`raw`)&&!e.isActive(`rawInline`)},CA=(e,t,n,r=()=>void 0,i,a=e=>e)=>new hb({element:e,content:t,extensions:[oA.configure({link:{openOnClick:!1,autolink:!0},heading:{levels:[1,2,3,4]}}),xA.configure({address:a}),lT.configure({table:{resizable:!1}}),ww,Ew,Tw,bA,pA,mA,yA,uA,dA,fA,vA.configure({tools:r}),...i?[lw.configure({element:i,shouldShow:({editor:e})=>SA(e,i)})]:[]],onUpdate:({editor:e})=>n(e.getHTML())}),wA=e=>({label:`Heading ${e}`,run:t=>t.chain().focus().toggleHeading({level:e}).run(),active:t=>t.isActive(`heading`,{level:e})}),TA=(e,t)=>E`<button
349
349
  type="button"
350
350
  class="toolbar-button"
351
351
  data-action=${e.label}
@@ -354,21 +354,21 @@ img.ProseMirror-separator {
354
354
  aria-pressed=${t&&e.active?String(e.active(t)):`false`}
355
355
  @click=${()=>t&&e.run(t)}
356
356
  >
357
- ${Ot(e.label)}
358
- </button>`,TA=e=>e.isActive(`table`);ft(`edaha-richtext`,class extends Ge{static properties={value:{attribute:!1},uploadImage:{attribute:!1},chooseFile:{attribute:!1},embedTools:{attribute:!1}};editor;formatMenu;prompt=(e,t)=>window.prompt(e,t);constructor(){super(),this.value=``,this.formatMenu=document.createElement(`div`),this.formatMenu.className=`editor-toolbar format-menu`,this.formatMenu.setAttribute(`role`,`toolbar`),this.formatMenu.setAttribute(`aria-label`,`Text format`),this.formatMenu.addEventListener(`mousedown`,e=>e.preventDefault()),this.formatMenu.addEventListener(`keydown`,e=>{e.key===`Escape`&&this.editor?.commands.focus()})}createRenderRoot(){return this}formatActions=[{label:`Bold`,run:e=>e.chain().focus().toggleBold().run(),active:e=>e.isActive(`bold`)},{label:`Italic`,run:e=>e.chain().focus().toggleItalic().run(),active:e=>e.isActive(`italic`)},{label:`Underline`,run:e=>e.chain().focus().toggleUnderline().run(),active:e=>e.isActive(`underline`)},{label:`Strikethrough`,run:e=>e.chain().focus().toggleStrike().run(),active:e=>e.isActive(`strike`)},{label:`Link`,run:e=>this.editLink(e),active:e=>e.isActive(`link`)},CA(1),CA(2),CA(3)];actions=[{label:`Bold`,run:e=>e.chain().focus().toggleBold().run(),active:e=>e.isActive(`bold`)},{label:`Italic`,run:e=>e.chain().focus().toggleItalic().run(),active:e=>e.isActive(`italic`)},{label:`Small`,run:e=>e.chain().focus().toggleMark(`small`).run(),active:e=>e.isActive(`small`)},{label:`Big`,run:e=>e.chain().focus().toggleMark(`big`).run(),active:e=>e.isActive(`big`)},{label:`Link`,run:e=>this.editLink(e),active:e=>e.isActive(`link`)},{label:`Heading`,run:e=>e.chain().focus().toggleHeading({level:2}).run(),active:e=>e.isActive(`heading`,{level:2})},{label:`Subheading`,run:e=>e.chain().focus().toggleHeading({level:3}).run(),active:e=>e.isActive(`heading`,{level:3})},{label:`Bullet list`,run:e=>e.chain().focus().toggleBulletList().run(),active:e=>e.isActive(`bulletList`)},{label:`Numbered list`,run:e=>e.chain().focus().toggleOrderedList().run(),active:e=>e.isActive(`orderedList`)},{label:`Quote`,run:e=>e.chain().focus().toggleBlockquote().run(),active:e=>e.isActive(`blockquote`)},{label:`Code`,run:e=>e.chain().focus().toggleCodeBlock().run(),active:e=>e.isActive(`codeBlock`)},{label:`Details`,run:e=>e.isActive(`details`)?e.chain().focus().unsetDetails().run():e.chain().focus().setDetails().run(),active:e=>e.isActive(`details`)},{label:`Image URL`,run:e=>this.insertImageUrl(e)},{label:`Table`,run:e=>e.chain().focus().insertTable({rows:3,cols:3,withHeaderRow:!0}).run(),active:TA},{label:`Add row`,run:e=>e.chain().focus().addRowAfter().run(),enabled:TA},{label:`Add column`,run:e=>e.chain().focus().addColumnAfter().run(),enabled:TA},{label:`Remove row`,run:e=>e.chain().focus().deleteRow().run(),enabled:TA},{label:`Remove column`,run:e=>e.chain().focus().deleteColumn().run(),enabled:TA},{label:`Remove table`,run:e=>e.chain().focus().deleteTable().run(),enabled:TA},{label:`Raw`,run:e=>e.chain().focus().toggleRaw().run(),active:e=>e.isActive(`raw`)},{label:`Read more`,run:e=>e.isActive(`readmore`)?e.chain().focus().deleteSelection().run():e.chain().focus().setReadmore().run(),active:e=>e.isActive(`readmore`)}];editLink(e){let t=this.prompt(`Link URL (empty to remove)`,e.getAttributes(`link`).href);t!==null&&(t.trim()===``?e.chain().focus().unsetLink().run():e.chain().focus().extendMarkRange(`link`).setLink({href:t.trim()}).run())}insertImageUrl(e){let t=this.prompt(`Image URL`)?.trim();t&&e.chain().focus().setImage({src:t}).run()}async editEmbed(e,t){let n=e.isActive(`embed`)?e.getAttributes(`embed`):void 0,r=t!==void 0&&n?.key!==t,i=r?{key:t,content:``,options:{}}:n;if(!this.embedTools||!i)return;let a=await this.embedTools.edit(i,r);a?r?e.chain().focus().insertEmbed(a).run():e.chain().focus().setEmbed(a).run():e.commands.focus()}async onImageFile(e){let t=e.target,n=t.files?.[0];if(t.value=``,n&&this.uploadImage&&this.editor)try{let e=await this.uploadImage(n);this.editor.chain().focus().setImage({src:e,alt:``}).run()}catch{}}insertFile({url:e,name:t,kind:n}){let r=this.editor?.chain().focus();r&&(n===`image`?r.setImage({src:e,alt:``}).run():this.editor?.state.selection.empty?r.insertContent({type:`text`,text:t,marks:[{type:`link`,attrs:{href:e}}]}).run():r.setLink({href:e}).run())}async onChooseFile(){let e=await this.chooseFile?.();e&&this.insertFile(e)}firstUpdated(){let e=this.querySelector(`.richtext-content`);this.editor=SA(e,this.value,e=>{this.value=e,this.dispatchEvent(new Event(`richtext-change`,{bubbles:!0})),this.requestUpdate()},()=>this.embedTools,this.formatMenu),e.addEventListener(sA,()=>{this.editor&&this.editEmbed(this.editor)}),this.editor.on(`selectionUpdate`,()=>this.requestUpdate()),this.requestUpdate()}updated(e){if(Ue(this.formatActions.map(e=>wA(e,this.editor)),this.formatMenu),e.has(`value`)&&this.editor&&this.editor.getHTML()!==this.value&&this.editor.commands.setContent(this.value,{emitUpdate:!1}),e.has(`embedTools`))for(let e of this.querySelectorAll(`.embed-block`))e.dispatchEvent(new Event(cA))}disconnectedCallback(){super.disconnectedCallback(),this.editor?.destroy(),this.editor=void 0}render(){let e=this.editor;return E`
357
+ ${pt(e.label)}
358
+ </button>`,EA=e=>e.isActive(`table`);St(`edaha-richtext`,class extends Ge{static properties={value:{attribute:!1},uploadImage:{attribute:!1},chooseFile:{attribute:!1},embedTools:{attribute:!1},fileAddress:{attribute:!1}};editor;formatMenu;prompt=(e,t)=>window.prompt(e,t);constructor(){super(),this.value=``,this.formatMenu=document.createElement(`div`),this.formatMenu.className=`editor-toolbar format-menu`,this.formatMenu.setAttribute(`role`,`toolbar`),this.formatMenu.setAttribute(`aria-label`,`Text format`),this.formatMenu.addEventListener(`mousedown`,e=>e.preventDefault()),this.formatMenu.addEventListener(`keydown`,e=>{e.key===`Escape`&&this.editor?.commands.focus()})}createRenderRoot(){return this}formatActions=[{label:`Bold`,run:e=>e.chain().focus().toggleBold().run(),active:e=>e.isActive(`bold`)},{label:`Italic`,run:e=>e.chain().focus().toggleItalic().run(),active:e=>e.isActive(`italic`)},{label:`Underline`,run:e=>e.chain().focus().toggleUnderline().run(),active:e=>e.isActive(`underline`)},{label:`Strikethrough`,run:e=>e.chain().focus().toggleStrike().run(),active:e=>e.isActive(`strike`)},{label:`Link`,run:e=>this.editLink(e),active:e=>e.isActive(`link`)},wA(1),wA(2),wA(3)];actions=[{label:`Bold`,run:e=>e.chain().focus().toggleBold().run(),active:e=>e.isActive(`bold`)},{label:`Italic`,run:e=>e.chain().focus().toggleItalic().run(),active:e=>e.isActive(`italic`)},{label:`Underline`,run:e=>e.chain().focus().toggleUnderline().run(),active:e=>e.isActive(`underline`)},{label:`Strikethrough`,run:e=>e.chain().focus().toggleStrike().run(),active:e=>e.isActive(`strike`)},{label:`Small`,run:e=>e.chain().focus().toggleMark(`small`).run(),active:e=>e.isActive(`small`)},{label:`Big`,run:e=>e.chain().focus().toggleMark(`big`).run(),active:e=>e.isActive(`big`)},{label:`Link`,run:e=>this.editLink(e),active:e=>e.isActive(`link`)},{label:`Heading`,run:e=>e.chain().focus().toggleHeading({level:2}).run(),active:e=>e.isActive(`heading`,{level:2})},{label:`Subheading`,run:e=>e.chain().focus().toggleHeading({level:3}).run(),active:e=>e.isActive(`heading`,{level:3})},{label:`Bullet list`,run:e=>e.chain().focus().toggleBulletList().run(),active:e=>e.isActive(`bulletList`)},{label:`Numbered list`,run:e=>e.chain().focus().toggleOrderedList().run(),active:e=>e.isActive(`orderedList`)},{label:`Quote`,run:e=>e.chain().focus().toggleBlockquote().run(),active:e=>e.isActive(`blockquote`)},{label:`Code`,run:e=>e.chain().focus().toggleCodeBlock().run(),active:e=>e.isActive(`codeBlock`)},{label:`Details`,run:e=>e.isActive(`details`)?e.chain().focus().unsetDetails().run():e.chain().focus().setDetails().run(),active:e=>e.isActive(`details`)},{label:`Image URL`,run:e=>this.insertImageUrl(e)},{label:`Table`,run:e=>e.chain().focus().insertTable({rows:3,cols:3,withHeaderRow:!0}).run(),active:EA},{label:`Add row`,run:e=>e.chain().focus().addRowAfter().run(),enabled:EA},{label:`Add column`,run:e=>e.chain().focus().addColumnAfter().run(),enabled:EA},{label:`Remove row`,run:e=>e.chain().focus().deleteRow().run(),enabled:EA},{label:`Remove column`,run:e=>e.chain().focus().deleteColumn().run(),enabled:EA},{label:`Remove table`,run:e=>e.chain().focus().deleteTable().run(),enabled:EA},{label:`Raw`,run:e=>e.chain().focus().toggleRaw().run(),active:e=>e.isActive(`raw`)},{label:`Read more`,run:e=>e.isActive(`readmore`)?e.chain().focus().deleteSelection().run():e.chain().focus().setReadmore().run(),active:e=>e.isActive(`readmore`)}];editLink(e){let t=this.prompt(`Link URL (empty to remove)`,e.getAttributes(`link`).href);t!==null&&(t.trim()===``?e.chain().focus().unsetLink().run():e.chain().focus().extendMarkRange(`link`).setLink({href:t.trim()}).run())}insertImageUrl(e){let t=this.prompt(`Image URL`)?.trim();t&&e.chain().focus().setImage({src:t}).run()}async editEmbed(e,t){let n=e.isActive(`embed`)?e.getAttributes(`embed`):void 0,r=t!==void 0&&n?.key!==t,i=r?{key:t,content:``,options:{}}:n;if(!this.embedTools||!i)return;let a=await this.embedTools.edit(i,r);a?r?e.chain().focus().insertEmbed(a).run():e.chain().focus().setEmbed(a).run():e.commands.focus()}async onImageFile(e){let t=e.target,n=t.files?.[0];if(t.value=``,n&&this.uploadImage&&this.editor)try{let e=await this.uploadImage(n);this.editor.chain().focus().setImage({src:e,alt:``}).run()}catch{}}insertFile({url:e,name:t,kind:n}){let r=this.editor?.chain().focus();r&&(n===`image`?r.setImage({src:e,alt:``}).run():this.editor?.state.selection.empty?r.insertContent({type:`text`,text:t,marks:[{type:`link`,attrs:{href:e}}]}).run():r.setLink({href:e}).run())}async onChooseFile(){let e=await this.chooseFile?.();e&&this.insertFile(e)}firstUpdated(){let e=this.querySelector(`.richtext-content`);this.editor=CA(e,this.value,e=>{this.value=e,this.dispatchEvent(new Event(`richtext-change`,{bubbles:!0})),this.requestUpdate()},()=>this.embedTools,this.formatMenu,e=>this.fileAddress?.(e)??e),e.addEventListener(sA,()=>{this.editor&&this.editEmbed(this.editor)}),this.editor.on(`selectionUpdate`,()=>this.requestUpdate()),this.requestUpdate()}updated(e){if(Ue(this.formatActions.map(e=>TA(e,this.editor)),this.formatMenu),e.has(`value`)&&this.editor&&this.editor.getHTML()!==this.value&&this.editor.commands.setContent(this.value,{emitUpdate:!1}),e.has(`embedTools`))for(let e of this.querySelectorAll(`.embed-block`))e.dispatchEvent(new Event(cA))}disconnectedCallback(){super.disconnectedCallback(),this.editor?.destroy(),this.editor=void 0}render(){let e=this.editor;return E`
359
359
  <div
360
360
  class="editor-toolbar richtext-toolbar"
361
361
  role="toolbar"
362
362
  aria-label="Formatting"
363
363
  >
364
- ${this.actions.map(t=>wA(t,e))}
365
- ${this.embedTools?.embeds.map(t=>jt(t,{pressed:!!e?.isActive(`embed`,{key:t.key}),disabled:!e,onClick:()=>e&&void this.editEmbed(e,t.key)}))}
364
+ ${this.actions.map(t=>TA(t,e))}
365
+ ${this.embedTools?.embeds.map(t=>gt(t,{pressed:!!e?.isActive(`embed`,{key:t.key}),disabled:!e,onClick:()=>e&&void this.editEmbed(e,t.key)}))}
366
366
  <label
367
367
  class="toolbar-button toolbar-upload"
368
368
  title="Upload image"
369
369
  ?data-disabled=${!e||!this.uploadImage}
370
370
  >
371
- ${Ot(`Upload image`)}
371
+ ${pt(`Upload image`)}
372
372
  <input
373
373
  type="file"
374
374
  class="visually-hidden"
@@ -385,11 +385,11 @@ img.ProseMirror-separator {
385
385
  ?disabled=${!e||!this.chooseFile}
386
386
  @click=${()=>void this.onChooseFile()}
387
387
  >
388
- ${Ot(`Choose file`)}
388
+ ${pt(`Choose file`)}
389
389
  </button>
390
390
  </div>
391
391
  <div class="richtext-content"></div>
392
- `}});var EA=(e,t)=>e.sort===t?e.order===`asc`?{sort:t,order:`desc`}:{}:{sort:t,order:`asc`},DA=(e,t,n,r)=>{let i=n.sort===e?n.order:void 0,a=EA(n,e),o=a.sort?`Sort by ${t.toLowerCase()}, ${a.order===`asc`?`ascending`:`descending`}`:`Go back to the default order`;return E`<th
392
+ `}});var DA=(e,t)=>e.sort===t?e.order===`asc`?{sort:t,order:`desc`}:{}:{sort:t,order:`asc`},OA=(e,t,n,r)=>{let i=n.sort===e?n.order:void 0,a=DA(n,e),o=a.sort?`Sort by ${t.toLowerCase()}, ${a.order===`asc`?`ascending`:`descending`}`:`Go back to the default order`;return E`<th
393
393
  scope="col"
394
394
  aria-sort=${i?i===`asc`?`ascending`:`descending`:`none`}
395
395
  >
@@ -403,7 +403,7 @@ img.ProseMirror-separator {
403
403
  >${i===`asc`?`▲`:i===`desc`?`▼`:``}</span
404
404
  >
405
405
  </button>
406
- </th>`},OA=[{value:`image`,label:`Image`},{value:`document`,label:`Document`},{value:`archive`,label:`Archive`},{value:`video`,label:`Video`},{value:`audio`,label:`Audio`},{value:`other`,label:`Other`}],kA=[{sort:`name`,label:`Name`},{sort:`kind`,label:`Type`},{sort:`size`,label:`Size`},{sort:`location`,label:`Location`}],AA=`files-changed`,jA=(e=``)=>e&&e.split(`,`).every(e=>e.trim().startsWith(`image/`))?`image`:void 0,MA=[`B`,`KB`,`MB`,`GB`],NA=e=>{let t=Math.min(Math.max(Math.floor(Math.log(e)/Math.log(1024)),0),MA.length-1),n=e/1024**t;return`${t&&n<10?Math.round(n*10)/10:Math.round(n)} ${MA[t]}`},PA=e=>`${e} ${e===1?`article`:`articles`}`;ft(`edaha-file-browser`,class extends Ge{static properties={api:{attribute:!1},types:{attribute:!1},search:{state:!0},kind:{state:!0},type:{state:!0},sort:{state:!0},order:{state:!0},page:{state:!0},result:{state:!0},filters:{state:!0},loading:{state:!0},message:{state:!0},error:{state:!0},picking:{state:!0}};searchDelay=250;confirm=e=>window.confirm(e);copy=async e=>{try{await navigator.clipboard.writeText(e);return}catch{}let t=document.createElement(`textarea`);t.value=e,t.className=`visually-hidden`,t.setAttribute(`aria-hidden`,`true`),(this.dialog??this).append(t),t.select();let n=document.execCommand(`copy`);if(t.remove(),!n)throw Error(`Can't copy`)};searchTimer;searches=0;replacing;constructor(){super(),this.types={},this.search=``,this.kind=``,this.type=``,this.page=1,this.filters={kinds:[],types:[]},this.loading=!1,this.message=``,this.error=``}createRenderRoot(){return this}get dialog(){return this.querySelector(`dialog`)}get open(){return this.dialog?.open??!1}async show(){this.finishPicking(),await this.openWith(``)}async openWith(e){this.search=``,this.kind=e,this.type=``,this.page=1,this.message=``,await this.updateComplete,this.open||this.dialog?.showModal(),this.querySelector(`#file-browser-search`)?.focus(),await Promise.all([this.loadFilters(),this.load()])}async pick(e=``){this.finishPicking();let t=new Promise(e=>this.picking=e);return await this.openWith(e),t}finishPicking(e){let t=this.picking;this.picking=void 0,t?.(e)}chooseFile(e){this.finishPicking(e),this.close()}close(){clearTimeout(this.searchTimer),this.open&&this.dialog?.close()}async loadFilters(){try{this.filters=await this.api.fileFilters()}catch{}}async load(){clearTimeout(this.searchTimer);let e=++this.searches;this.loading=!0;try{let t=await this.api.queryFiles({search:this.search,kind:this.kind||void 0,type:this.type,sort:this.sort,order:this.order,page:this.page});if(e!==this.searches)return;this.result=t,this.error=``}catch(t){if(e!==this.searches)return;this.error=t.message}this.loading=!1}choose(e,t){this[e]=t,this.page=1,this.message=``,this.load()}onSearch(e){this.search=e,this.page=1,this.message=``,clearTimeout(this.searchTimer),this.searchTimer=setTimeout(()=>void this.load(),this.searchDelay)}sortBy(e){({sort:this.sort,order:this.order}=EA({sort:this.sort,order:this.order},e)),this.page=1,this.message=``,this.load()}async goTo(e){this.page=e,this.message=``,await this.load(),this.querySelector(`.file-browser-results`)?.scrollTo?.(0,0)}report(e,t=``){this.message=e,this.error=t}async copyUrl(e){try{await this.copy(e.url),this.report(`Copied ${e.url}`)}catch{this.report(``,`Couldn't copy ${e.url}`)}}chooseReplacement(e){this.replacing=e,this.querySelector(`#file-browser-replacement`)?.click()}async changed(e,t){this.dispatchEvent(new CustomEvent(AA,{detail:{file:e,...t},bubbles:!0})),await Promise.all([this.loadFilters(),this.load()])}async replace(e,t){try{let n=await this.api.fileReferences(e);if(!this.confirm(`Replace ${e.name} in ${e.type}/${e.slug} with ${t.name}?${n.length?` ${PA(n.length)} will refer to the new file if its name differs.`:``}`))return;let r=await this.api.replaceFile(e,t);this.report(r.name===e.name?`Replaced ${e.name}`:`Replaced ${e.name} with ${r.name}${r.articles.length?`, updating ${PA(r.articles.length)}`:``}`),await this.changed(e,r)}catch(e){this.report(``,e.message)}}async delete(e){try{let t=await this.api.fileReferences(e);if(!this.confirm(`Delete ${e.name} from ${e.type}/${e.slug}?${t.length?` It will also be removed from ${PA(t.length)}.`:``}`))return;let n=await this.api.deleteFile(e);this.report(`Deleted ${e.name}${n.articles.length?`, updating ${PA(n.articles.length)}`:``}`),await this.changed(e,n)}catch(e){this.report(``,e.message)}}renderSelect(e,t,n,r){let i=`file-browser-${e}`;return E`<div class="article-browser-field">
406
+ </th>`},kA=[{value:`image`,label:`Image`},{value:`document`,label:`Document`},{value:`archive`,label:`Archive`},{value:`video`,label:`Video`},{value:`audio`,label:`Audio`},{value:`other`,label:`Other`}],AA=[{sort:`name`,label:`Name`},{sort:`kind`,label:`Type`},{sort:`size`,label:`Size`},{sort:`location`,label:`Location`}],jA=`files-changed`,MA=(e=``)=>e&&e.split(`,`).every(e=>e.trim().startsWith(`image/`))?`image`:void 0,NA=[`B`,`KB`,`MB`,`GB`],PA=e=>{let t=Math.min(Math.max(Math.floor(Math.log(e)/Math.log(1024)),0),NA.length-1),n=e/1024**t;return`${t&&n<10?Math.round(n*10)/10:Math.round(n)} ${NA[t]}`},FA=e=>`${e} ${e===1?`article`:`articles`}`;St(`edaha-file-browser`,class extends Ge{static properties={api:{attribute:!1},types:{attribute:!1},search:{state:!0},kind:{state:!0},type:{state:!0},sort:{state:!0},order:{state:!0},page:{state:!0},result:{state:!0},filters:{state:!0},loading:{state:!0},message:{state:!0},error:{state:!0},picking:{state:!0}};searchDelay=250;confirm=e=>window.confirm(e);copy=async e=>{try{await navigator.clipboard.writeText(e);return}catch{}let t=document.createElement(`textarea`);t.value=e,t.className=`visually-hidden`,t.setAttribute(`aria-hidden`,`true`),(this.dialog??this).append(t),t.select();let n=document.execCommand(`copy`);if(t.remove(),!n)throw Error(`Can't copy`)};searchTimer;searches=0;replacing;constructor(){super(),this.types={},this.search=``,this.kind=``,this.type=``,this.page=1,this.filters={kinds:[],types:[]},this.loading=!1,this.message=``,this.error=``}createRenderRoot(){return this}get dialog(){return this.querySelector(`dialog`)}get open(){return this.dialog?.open??!1}async show(){this.finishPicking(),await this.openWith(``)}async openWith(e){this.search=``,this.kind=e,this.type=``,this.page=1,this.message=``,await this.updateComplete,this.open||this.dialog?.showModal(),this.querySelector(`#file-browser-search`)?.focus(),await Promise.all([this.loadFilters(),this.load()])}async pick(e=``){this.finishPicking();let t=new Promise(e=>this.picking=e);return await this.openWith(e),t}finishPicking(e){let t=this.picking;this.picking=void 0,t?.(e)}chooseFile(e){this.finishPicking(e),this.close()}close(){clearTimeout(this.searchTimer),this.open&&this.dialog?.close()}async loadFilters(){try{this.filters=await this.api.fileFilters()}catch{}}async load(){clearTimeout(this.searchTimer);let e=++this.searches;this.loading=!0;try{let t=await this.api.queryFiles({search:this.search,kind:this.kind||void 0,type:this.type,sort:this.sort,order:this.order,page:this.page});if(e!==this.searches)return;this.result=t,this.error=``}catch(t){if(e!==this.searches)return;this.error=t.message}this.loading=!1}choose(e,t){this[e]=t,this.page=1,this.message=``,this.load()}onSearch(e){this.search=e,this.page=1,this.message=``,clearTimeout(this.searchTimer),this.searchTimer=setTimeout(()=>void this.load(),this.searchDelay)}sortBy(e){({sort:this.sort,order:this.order}=DA({sort:this.sort,order:this.order},e)),this.page=1,this.message=``,this.load()}async goTo(e){this.page=e,this.message=``,await this.load(),this.querySelector(`.file-browser-results`)?.scrollTo?.(0,0)}report(e,t=``){this.message=e,this.error=t}async copyUrl(e){try{await this.copy(e.url),this.report(`Copied ${e.url}`)}catch{this.report(``,`Couldn't copy ${e.url}`)}}chooseReplacement(e){this.replacing=e,this.querySelector(`#file-browser-replacement`)?.click()}async changed(e,t){this.dispatchEvent(new CustomEvent(jA,{detail:{file:e,...t},bubbles:!0})),await Promise.all([this.loadFilters(),this.load()])}async replace(e,t){try{let n=await this.api.fileReferences(e);if(!this.confirm(`Replace ${e.name} in ${e.type}/${e.slug} with ${t.name}?${n.length?` ${FA(n.length)} will refer to the new file if its name differs.`:``}`))return;let r=await this.api.replaceFile(e,t);this.report(r.name===e.name?`Replaced ${e.name}`:`Replaced ${e.name} with ${r.name}${r.articles.length?`, updating ${FA(r.articles.length)}`:``}`),await this.changed(e,r)}catch(e){this.report(``,e.message)}}async delete(e){try{let t=await this.api.fileReferences(e);if(!this.confirm(`Delete ${e.name} from ${e.type}/${e.slug}?${t.length?` It will also be removed from ${FA(t.length)}.`:``}`))return;let n=await this.api.deleteFile(e);this.report(`Deleted ${e.name}${n.articles.length?`, updating ${FA(n.articles.length)}`:``}`),await this.changed(e,n)}catch(e){this.report(``,e.message)}}renderSelect(e,t,n,r){let i=`file-browser-${e}`;return E`<div class="article-browser-field">
407
407
  <label for=${i}>${t}</label>
408
408
  <select
409
409
  id=${i}
@@ -423,11 +423,11 @@ img.ProseMirror-separator {
423
423
  title=${e}
424
424
  @click=${n}
425
425
  >
426
- ${Dt(t)}<span class="visually-hidden">${e}</span>
427
- </button>`}renderResults(){let e=this.result;if(!e)return D;if(!e.files.length)return E`<p class="article-browser-empty">No files found.</p>`;let t=Object.fromEntries(OA.map(({value:e,label:t})=>[e,t]));return E`<table class="article-browser-table file-browser-table">
426
+ ${ft(t)}<span class="visually-hidden">${e}</span>
427
+ </button>`}renderResults(){let e=this.result;if(!e)return D;if(!e.files.length)return E`<p class="article-browser-empty">No files found.</p>`;let t=Object.fromEntries(kA.map(({value:e,label:t})=>[e,t]));return E`<table class="article-browser-table file-browser-table">
428
428
  <thead>
429
429
  <tr>
430
- ${kA.map(({sort:e,label:t})=>DA(e,t,{sort:this.sort,order:this.order},e=>this.sortBy(e)))}
430
+ ${AA.map(({sort:e,label:t})=>OA(e,t,{sort:this.sort,order:this.order},e=>this.sortBy(e)))}
431
431
  <th scope="col">Operations</th>
432
432
  </tr>
433
433
  </thead>
@@ -435,15 +435,17 @@ img.ProseMirror-separator {
435
435
  ${e.files.map(e=>{let n=`${e.type}/${e.slug}`;return E`<tr>
436
436
  <td>
437
437
  <a
438
- href="/files/${n}/${encodeURIComponent(e.name)}"
438
+ href=${this.api.url(`/files/${n}/${encodeURIComponent(e.name)}`)}
439
439
  target="_blank"
440
440
  >${e.name}</a
441
441
  >
442
442
  </td>
443
443
  <td>${t[e.kind]}</td>
444
- <td>${NA(e.size)}</td>
444
+ <td>${PA(e.size)}</td>
445
445
  <td>
446
- <a href="/#${n}" target="_blank">${n}</a>
446
+ <a href=${this.api.url(`/#${n}`)} target="_blank"
447
+ >${n}</a
448
+ >
447
449
  </td>
448
450
  <td class="file-browser-operations">
449
451
  ${this.picking?E`<button
@@ -477,7 +479,7 @@ img.ProseMirror-separator {
477
479
  >
478
480
  Next
479
481
  </button>
480
- </nav>`}statusText(){if(this.error)return this.error;if(this.message)return this.message;if(this.loading||!this.result)return`Loading…`;let{total:e}=this.result;return`${e} ${e===1?`file`:`files`} found`}render(){let e=OA.filter(({value:e})=>this.filters.kinds.includes(e)),t=this.filters.types.map(e=>({value:e,label:this.types[e]?.labelPlural??e}));return E`<dialog
482
+ </nav>`}statusText(){if(this.error)return this.error;if(this.message)return this.message;if(this.loading||!this.result)return`Loading…`;let{total:e}=this.result;return`${e} ${e===1?`file`:`files`} found`}render(){let e=kA.filter(({value:e})=>this.filters.kinds.includes(e)),t=this.filters.types.map(e=>({value:e,label:this.types[e]?.labelPlural??e}));return E`<dialog
481
483
  class="article-browser file-browser"
482
484
  aria-labelledby="file-browser-title"
483
485
  @close=${()=>{clearTimeout(this.searchTimer),this.finishPicking()}}
@@ -492,7 +494,7 @@ img.ProseMirror-separator {
492
494
  title="Close"
493
495
  @click=${()=>this.close()}
494
496
  >
495
- ${Dt(`close`)}<span class="visually-hidden">Close</span>
497
+ ${ft(`close`)}<span class="visually-hidden">Close</span>
496
498
  </button>
497
499
  </div>
498
500
  <div class="article-browser-controls" role="search">
@@ -526,7 +528,7 @@ img.ProseMirror-separator {
526
528
  aria-hidden="true"
527
529
  @change=${e=>{let t=e.target,n=t.files?.[0],r=this.replacing;t.value=``,this.replacing=void 0,r&&n&&this.replace(r,n)}}
528
530
  />
529
- </dialog>`}});var FA=/\.(png|jpe?g|gif|webp|svg)$/i;ft(`edaha-article-data-field`,class extends Ge{static properties={name:{},type:{},label:{},placeholder:{},accept:{},rows:{type:Number},value:{attribute:!1},options:{attribute:!1},previewUrl:{attribute:!1},uploadImage:{attribute:!1},chooseFile:{attribute:!1},embedTools:{attribute:!1},preview:{type:Boolean},allowchange:{type:Boolean},allowclear:{type:Boolean},disabled:{type:Boolean},changed:{type:Boolean}};constructor(){super(),this.name=``,this.type=`text`,this.label=``,this.placeholder=``,this.accept=``,this.rows=3,this.value=``,this.options=[],this.preview=!1,this.allowchange=!1,this.allowclear=!1,this.disabled=!1,this.changed=!1}createRenderRoot(){return this}change(e){this.value=e,this.dispatchEvent(new CustomEvent(`field-change`,{detail:{name:this.name,value:e},bubbles:!0}))}get inputId(){return`field-${this.name.replace(/[^a-z0-9-]/gi,`-`)}`}renderInput(){let e=e=>this.change(e.target.value);switch(this.type){case`textarea`:return E`<textarea
531
+ </dialog>`}});var IA=/\.(png|jpe?g|gif|webp|svg)$/i;St(`edaha-article-data-field`,class extends Ge{static properties={name:{},type:{},label:{},placeholder:{},accept:{},rows:{type:Number},value:{attribute:!1},options:{attribute:!1},previewUrl:{attribute:!1},uploadImage:{attribute:!1},chooseFile:{attribute:!1},embedTools:{attribute:!1},fileAddress:{attribute:!1},preview:{type:Boolean},allowchange:{type:Boolean},allowclear:{type:Boolean},disabled:{type:Boolean},changed:{type:Boolean}};constructor(){super(),this.name=``,this.type=`text`,this.label=``,this.placeholder=``,this.accept=``,this.rows=3,this.value=``,this.options=[],this.preview=!1,this.allowchange=!1,this.allowclear=!1,this.disabled=!1,this.changed=!1}createRenderRoot(){return this}change(e){this.value=e,this.dispatchEvent(new CustomEvent(`field-change`,{detail:{name:this.name,value:e},bubbles:!0}))}get inputId(){return`field-${this.name.replace(/[^a-z0-9-]/gi,`-`)}`}renderInput(){let e=e=>this.change(e.target.value);switch(this.type){case`textarea`:return E`<textarea
530
532
  id=${this.inputId}
531
533
  rows=${this.rows}
532
534
  placeholder=${this.placeholder}
@@ -550,6 +552,7 @@ img.ProseMirror-separator {
550
552
  .uploadImage=${this.uploadImage}
551
553
  .chooseFile=${this.chooseFile}
552
554
  .embedTools=${this.embedTools}
555
+ .fileAddress=${this.fileAddress}
553
556
  @richtext-change=${e=>{e.stopPropagation(),this.change(e.currentTarget.value)}}
554
557
  ></edaha-richtext>`;case`markdown`:return E`<edaha-markdown
555
558
  .textareaId=${this.inputId}
@@ -565,9 +568,9 @@ img.ProseMirror-separator {
565
568
  ?disabled=${this.disabled}
566
569
  .value=${this.value}
567
570
  @input=${e}
568
- />`}}async chooseExisting(){let e=await this.chooseFile?.(jA(this.accept));e&&this.change(e.url)}renderFile(){let e=!this.value||this.allowchange;return E`
571
+ />`}}async chooseExisting(){let e=await this.chooseFile?.(MA(this.accept));e&&this.change(e.url)}renderFile(){let e=!this.value||this.allowchange;return E`
569
572
  ${this.value?E`<p class="file-current">
570
- ${this.preview&&this.previewUrl&&FA.test(this.value)?E`<img src=${this.previewUrl} alt="" width="120" />`:D}
573
+ ${this.preview&&this.previewUrl&&IA.test(this.value)?E`<img src=${this.previewUrl} alt="" width="120" />`:D}
571
574
  <span>${this.value}</span>
572
575
  </p>`:D}
573
576
  ${e?E`<input
@@ -603,7 +606,7 @@ img.ProseMirror-separator {
603
606
  >
604
607
  Clear
605
608
  </button>`:D}
606
- `}});var IA=`:host{display:block}`;ft(`edaha-article-data-group`,class extends Ge{static properties={name:{},label:{},multiple:{type:Boolean},allowclear:{type:Boolean},disabled:{type:Boolean},changed:{type:Boolean}};static styles=m(IA);constructor(){super(),this.name=``,this.label=``,this.multiple=!1,this.allowclear=!1,this.disabled=!1,this.changed=!1}fire(e){this.dispatchEvent(new CustomEvent(e,{detail:this.name,bubbles:!0}))}render(){return E`<fieldset ?disabled=${this.disabled}>
609
+ `}});var LA=`:host{display:block}`;St(`edaha-article-data-group`,class extends Ge{static properties={name:{},label:{},multiple:{type:Boolean},allowclear:{type:Boolean},disabled:{type:Boolean},changed:{type:Boolean}};static styles=m(LA);constructor(){super(),this.name=``,this.label=``,this.multiple=!1,this.allowclear=!1,this.disabled=!1,this.changed=!1}fire(e){this.dispatchEvent(new CustomEvent(e,{detail:this.name,bubbles:!0}))}render(){return E`<fieldset ?disabled=${this.disabled}>
607
610
  ${this.label?E`<legend>
608
611
  ${this.label}${this.changed?E`<span
609
612
  class="changed"
@@ -627,8 +630,8 @@ img.ProseMirror-separator {
627
630
  >
628
631
  Clear
629
632
  </button>`:D}
630
- </fieldset>`}});var LA=(e,t,n)=>{let r=new Map;for(let i=t;i<=n;i++)r.set(e[i],i);return r},RA=Je(class extends Ye{constructor(e){if(super(e),e.type!==qe.CHILD)throw Error(`repeat() can only be used in text expressions`)}dt(e,t,n){let r;n===void 0?n=t:t!==void 0&&(r=t);let i=[],a=[],o=0;for(let t of e)i[o]=r?r(t,o):o,a[o]=n(t,o),o++;return{values:a,keys:i}}render(e,t,n){return this.dt(e,t,n).values}update(e,[t,n,r]){let i=at(e),{values:a,keys:o}=this.dt(t,n,r);if(!Array.isArray(i))return this.ut=o,a;let s=this.ut??=[],c=[],l,u,d=0,f=i.length-1,p=0,m=a.length-1;for(;d<=f&&p<=m;)if(i[d]===null)d++;else if(i[f]===null)f--;else if(s[d]===o[p])c[p]=nt(i[d],a[p]),d++,p++;else if(s[f]===o[m])c[m]=nt(i[f],a[m]),f--,m--;else if(s[d]===o[m])c[m]=nt(i[d],a[m]),tt(e,c[m+1],i[d]),d++,m--;else if(s[f]===o[p])c[p]=nt(i[f],a[p]),tt(e,i[d],i[f]),f--,p++;else if(l===void 0&&(l=LA(o,p,m),u=LA(s,d,f)),l.has(s[d])){if(l.has(s[f])){let t=u.get(o[p]),n=t===void 0?null:i[t];if(n===null){let t=tt(e,i[d]);nt(t,a[p]),c[p]=t}else c[p]=nt(n,a[p]),tt(e,i[d],n),i[t]=null;p++}else ot(i[f]),f--}else ot(i[d]),d++;for(;p<=m;){let t=tt(e,c[m+1]);nt(t,a[p]),c[p++]=t}for(;d<=f;){let e=i[d++];e!==null&&ot(e)}return this.ut=o,it(e,c),De}}),zA=`edaha-toast`,BA=(e,t)=>{e.dispatchEvent(new CustomEvent(zA,{detail:t,bubbles:!0}))};ft(`edaha-toasts`,class extends Ge{static properties={toasts:{state:!0}};duration=4e3;nextId=0;constructor(){super(),this.toasts=[]}createRenderRoot(){return this}show(e){let t=++this.nextId;this.toasts=[...this.toasts,{...e,id:t}],e.kind===`success`&&setTimeout(()=>this.dismiss(t),this.duration)}dismiss(e){this.toasts=this.toasts.filter(t=>t.id!==e)}render(){return E`<div class="toasts">
631
- ${RA(this.toasts,e=>e.id,e=>E`<div
633
+ </fieldset>`}});var RA=(e,t,n)=>{let r=new Map;for(let i=t;i<=n;i++)r.set(e[i],i);return r},zA=Je(class extends Ye{constructor(e){if(super(e),e.type!==qe.CHILD)throw Error(`repeat() can only be used in text expressions`)}dt(e,t,n){let r;n===void 0?n=t:t!==void 0&&(r=t);let i=[],a=[],o=0;for(let t of e)i[o]=r?r(t,o):o,a[o]=n(t,o),o++;return{values:a,keys:i}}render(e,t,n){return this.dt(e,t,n).values}update(e,[t,n,r]){let i=at(e),{values:a,keys:o}=this.dt(t,n,r);if(!Array.isArray(i))return this.ut=o,a;let s=this.ut??=[],c=[],l,u,d=0,f=i.length-1,p=0,m=a.length-1;for(;d<=f&&p<=m;)if(i[d]===null)d++;else if(i[f]===null)f--;else if(s[d]===o[p])c[p]=nt(i[d],a[p]),d++,p++;else if(s[f]===o[m])c[m]=nt(i[f],a[m]),f--,m--;else if(s[d]===o[m])c[m]=nt(i[d],a[m]),tt(e,c[m+1],i[d]),d++,m--;else if(s[f]===o[p])c[p]=nt(i[f],a[p]),tt(e,i[d],i[f]),f--,p++;else if(l===void 0&&(l=RA(o,p,m),u=RA(s,d,f)),l.has(s[d])){if(l.has(s[f])){let t=u.get(o[p]),n=t===void 0?null:i[t];if(n===null){let t=tt(e,i[d]);nt(t,a[p]),c[p]=t}else c[p]=nt(n,a[p]),tt(e,i[d],n),i[t]=null;p++}else ot(i[f]),f--}else ot(i[d]),d++;for(;p<=m;){let t=tt(e,c[m+1]);nt(t,a[p]),c[p++]=t}for(;d<=f;){let e=i[d++];e!==null&&ot(e)}return this.ut=o,it(e,c),De}}),BA=`edaha-toast`,VA=(e,t)=>{e.dispatchEvent(new CustomEvent(BA,{detail:t,bubbles:!0}))};St(`edaha-toasts`,class extends Ge{static properties={toasts:{state:!0}};duration=4e3;nextId=0;constructor(){super(),this.toasts=[]}createRenderRoot(){return this}show(e){let t=++this.nextId;this.toasts=[...this.toasts,{...e,id:t}],e.kind===`success`&&setTimeout(()=>this.dismiss(t),this.duration)}dismiss(e){this.toasts=this.toasts.filter(t=>t.id!==e)}render(){return E`<div class="toasts">
634
+ ${zA(this.toasts,e=>e.id,e=>E`<div
632
635
  class="toast ${e.kind}"
633
636
  role=${e.kind===`error`?`alert`:`status`}
634
637
  >
@@ -637,20 +640,20 @@ img.ProseMirror-separator {
637
640
  Dismiss
638
641
  </button>
639
642
  </div>`)}
640
- </div>`}});var VA=e=>Array.isArray(e)&&typeof e[0]==`string`,HA=e=>Array.isArray(e)&&!VA(e),UA=(e,t)=>t.split(`.`).reduce((e,t)=>e&&typeof e==`object`?e[t]:void 0,e),WA=(e,t,n)=>{let r=e===n||(e??null)===n;if(t===`=`)return r;if(t===`!=`)return!r;if(typeof e!=typeof n||![`number`,`string`].includes(typeof e))return!1;let[i,a]=[e,n];return t===`>`?i>a:t===`>=`?i>=a:t===`<`?i<a:i<=a},GA=(e,t)=>{if(HA(t))return t.every(t=>GA(e,t));if(VA(t)){let[n,r,i]=t,a=UA(e,n);if(r!==`in`&&r!==`not-in`)return WA(a,r,i);let o=i.some(e=>WA(a,`=`,e));return r===`in`?o:!o}if(`and`in t)return GA(e,t.and);let n=t.or;return HA(n)?n.some(t=>GA(e,t)):GA(e,n)},KA=(e,t)=>(!e?.showWhen||GA(t,e.showWhen))&&!(e?.hideWhen&&GA(t,e.hideWhen)),qA=(e,t=[])=>Object.entries(e).flatMap(([e,n])=>{let r={path:[...t,e],schema:n};return n.type===`object`&&n.properties?[r,...qA(n.properties,r.path)]:[r]}),JA=(e,[t,...n],r)=>{let i=e[t],a=n.length?JA(i&&typeof i==`object`?i:{},n,r):r;return a===void 0?Object.fromEntries(Object.entries(e).filter(([e])=>e!==t)):{...e,[t]:a}},YA=(e,t)=>{let n=qA(e),r=e=>n.reduce((t,{path:n,schema:r})=>{let i=n.join(`.`),{defaultValue:a}=r.$edahaField??{};return e.has(i)?UA(t,i)===void 0?t:JA(t,n,void 0):a!==void 0&&UA(t,i)===void 0?JA(t,n,a):t},t),i=e=>n.reduce((t,{path:n,schema:r})=>((t.has(n.slice(0,-1).join(`.`))||!KA(r.$edahaField,e))&&t.add(n.join(`.`)),t),new Set),a=new Set,o=r(a);for(let e=0;e<=n.length;e++){let e=i(o);if([...e].join(`\0`)===[...a].join(`\0`))break;a=e,o=r(a)}let s=Object.keys(e);return{values:Object.fromEntries(Object.entries(o).sort(([e],[t])=>(s.indexOf(e)+1||1/0)-(s.indexOf(t)+1||1/0))),hidden:a}},XA=a((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.regexpCode=e.getEsmExportName=e.getProperty=e.safeStringify=e.stringify=e.strConcat=e.addCodeArg=e.str=e._=e.nil=e._Code=e.Name=e.IDENTIFIER=e._CodeOrName=void 0;var t=class{};e._CodeOrName=t,e.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var n=class extends t{constructor(t){if(super(),!e.IDENTIFIER.test(t))throw Error(`CodeGen: name must be a valid identifier`);this.str=t}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}};e.Name=n;var r=class extends t{constructor(e){super(),this._items=typeof e==`string`?[e]:e}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let e=this._items[0];return e===``||e===`""`}get str(){return this._str??=this._items.reduce((e,t)=>`${e}${t}`,``)}get names(){return this._names??=this._items.reduce((e,t)=>(t instanceof n&&(e[t.str]=(e[t.str]||0)+1),e),{})}};e._Code=r,e.nil=new r(``);function i(e,...t){let n=[e[0]],i=0;for(;i<t.length;)s(n,t[i]),n.push(e[++i]);return new r(n)}e._=i;var a=new r(`+`);function o(e,...t){let n=[p(e[0])],i=0;for(;i<t.length;)n.push(a),s(n,t[i]),n.push(a,p(e[++i]));return c(n),new r(n)}e.str=o;function s(e,t){t instanceof r?e.push(...t._items):t instanceof n?e.push(t):e.push(d(t))}e.addCodeArg=s;function c(e){let t=1;for(;t<e.length-1;){if(e[t]===a){let n=l(e[t-1],e[t+1]);if(n!==void 0){e.splice(t-1,3,n);continue}e[t++]=`+`}t++}}function l(e,t){if(t===`""`)return e;if(e===`""`)return t;if(typeof e==`string`)return t instanceof n||e[e.length-1]!==`"`?void 0:typeof t==`string`?t[0]===`"`?e.slice(0,-1)+t.slice(1):void 0:`${e.slice(0,-1)}${t}"`;if(typeof t==`string`&&t[0]===`"`&&!(e instanceof n))return`"${e}${t.slice(1)}`}function u(e,t){return t.emptyStr()?e:e.emptyStr()?t:o`${e}${t}`}e.strConcat=u;function d(e){return typeof e==`number`||typeof e==`boolean`||e===null?e:p(Array.isArray(e)?e.join(`,`):e)}function f(e){return new r(p(e))}e.stringify=f;function p(e){return JSON.stringify(e).replace(/\u2028/g,`\\u2028`).replace(/\u2029/g,`\\u2029`)}e.safeStringify=p;function m(t){return typeof t==`string`&&e.IDENTIFIER.test(t)?new r(`.${t}`):i`[${t}]`}e.getProperty=m;function h(t){if(typeof t==`string`&&e.IDENTIFIER.test(t))return new r(`${t}`);throw Error(`CodeGen: invalid export name: ${t}, use explicit $id name mapping`)}e.getEsmExportName=h;function g(e){return new r(e.toString())}e.regexpCode=g})),ZA=a((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.ValueScope=e.ValueScopeName=e.Scope=e.varKinds=e.UsedValueState=void 0;var t=XA(),n=class extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`),this.value=e.value}},r;(function(e){e[e.Started=0]=`Started`,e[e.Completed=1]=`Completed`})(r||(e.UsedValueState=r={})),e.varKinds={const:new t.Name(`const`),let:new t.Name(`let`),var:new t.Name(`var`)};var i=class{constructor({prefixes:e,parent:t}={}){this._names={},this._prefixes=e,this._parent=t}toName(e){return e instanceof t.Name?e:this.name(e)}name(e){return new t.Name(this._newName(e))}_newName(e){let t=this._names[e]||this._nameGroup(e);return`${e}${t.index++}`}_nameGroup(e){if((this._parent?._prefixes)?.has(e)||this._prefixes&&!this._prefixes.has(e))throw Error(`CodeGen: prefix "${e}" is not allowed in this scope`);return this._names[e]={prefix:e,index:0}}};e.Scope=i;var a=class extends t.Name{constructor(e,t){super(t),this.prefix=e}setValue(e,{property:n,itemIndex:r}){this.value=e,this.scopePath=(0,t._)`.${new t.Name(n)}[${r}]`}};e.ValueScopeName=a;var o=(0,t._)`\n`;e.ValueScope=class extends i{constructor(e){super(e),this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?o:t.nil}}get(){return this._scope}name(e){return new a(e,this._newName(e))}value(e,t){if(t.ref===void 0)throw Error(`CodeGen: ref must be passed in value`);let n=this.toName(e),{prefix:r}=n,i=t.key??t.ref,a=this._values[r];if(a){let e=a.get(i);if(e)return e}else a=this._values[r]=new Map;a.set(i,n);let o=this._scope[r]||(this._scope[r]=[]),s=o.length;return o[s]=t.ref,n.setValue(t,{property:r,itemIndex:s}),n}getValue(e,t){let n=this._values[e];if(n)return n.get(t)}scopeRefs(e,n=this._values){return this._reduceValues(n,n=>{if(n.scopePath===void 0)throw Error(`CodeGen: name "${n}" has no value`);return(0,t._)`${e}${n.scopePath}`})}scopeCode(e=this._values,t,n){return this._reduceValues(e,e=>{if(e.value===void 0)throw Error(`CodeGen: name "${e}" has no value`);return e.value.code},t,n)}_reduceValues(i,a,o={},s){let c=t.nil;for(let l in i){let u=i[l];if(!u)continue;let d=o[l]=o[l]||new Map;u.forEach(i=>{if(d.has(i))return;d.set(i,r.Started);let o=a(i);if(o){let n=this.opts.es5?e.varKinds.var:e.varKinds.const;c=(0,t._)`${c}${n} ${i} = ${o};${this.opts._n}`}else if(o=s?.(i))c=(0,t._)`${c}${o}${this.opts._n}`;else throw new n(i);d.set(i,r.Completed)})}return c}}})),Q=a((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.or=e.and=e.not=e.CodeGen=e.operators=e.varKinds=e.ValueScopeName=e.ValueScope=e.Scope=e.Name=e.regexpCode=e.stringify=e.getProperty=e.nil=e.strConcat=e.str=e._=void 0;var t=XA(),n=ZA(),r=XA();Object.defineProperty(e,"_",{enumerable:!0,get:function(){return r._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return r.str}}),Object.defineProperty(e,"strConcat",{enumerable:!0,get:function(){return r.strConcat}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return r.nil}}),Object.defineProperty(e,"getProperty",{enumerable:!0,get:function(){return r.getProperty}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return r.stringify}}),Object.defineProperty(e,"regexpCode",{enumerable:!0,get:function(){return r.regexpCode}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return r.Name}});var i=ZA();Object.defineProperty(e,"Scope",{enumerable:!0,get:function(){return i.Scope}}),Object.defineProperty(e,"ValueScope",{enumerable:!0,get:function(){return i.ValueScope}}),Object.defineProperty(e,"ValueScopeName",{enumerable:!0,get:function(){return i.ValueScopeName}}),Object.defineProperty(e,"varKinds",{enumerable:!0,get:function(){return i.varKinds}}),e.operators={GT:new t._Code(`>`),GTE:new t._Code(`>=`),LT:new t._Code(`<`),LTE:new t._Code(`<=`),EQ:new t._Code(`===`),NEQ:new t._Code(`!==`),NOT:new t._Code(`!`),OR:new t._Code(`||`),AND:new t._Code(`&&`),ADD:new t._Code(`+`)};var a=class{optimizeNodes(){return this}optimizeNames(e,t){return this}},o=class extends a{constructor(e,t,n){super(),this.varKind=e,this.name=t,this.rhs=n}render({es5:e,_n:t}){let r=e?n.varKinds.var:this.varKind,i=this.rhs===void 0?``:` = ${this.rhs}`;return`${r} ${this.name}${i};`+t}optimizeNames(e,t){if(e[this.name.str])return this.rhs&&=re(this.rhs,e,t),this}get names(){return this.rhs instanceof t._CodeOrName?this.rhs.names:{}}},s=class extends a{constructor(e,t,n){super(),this.lhs=e,this.rhs=t,this.sideEffects=n}render({_n:e}){return`${this.lhs} = ${this.rhs};`+e}optimizeNames(e,n){if(!(this.lhs instanceof t.Name&&!e[this.lhs.str]&&!this.sideEffects))return this.rhs=re(this.rhs,e,n),this}get names(){return ne(this.lhs instanceof t.Name?{}:{...this.lhs.names},this.rhs)}},c=class extends s{constructor(e,t,n,r){super(e,n,r),this.op=t}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}},l=class extends a{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}},u=class extends a{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`break${this.label?` ${this.label}`:``};`+e}},d=class extends a{constructor(e){super(),this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}},f=class extends a{constructor(e){super(),this.code=e}render({_n:e}){return`${this.code};`+e}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(e,t){return this.code=re(this.code,e,t),this}get names(){return this.code instanceof t._CodeOrName?this.code.names:{}}},p=class extends a{constructor(e=[]){super(),this.nodes=e}render(e){return this.nodes.reduce((t,n)=>t+n.render(e),``)}optimizeNodes(){let{nodes:e}=this,t=e.length;for(;t--;){let n=e[t].optimizeNodes();Array.isArray(n)?e.splice(t,1,...n):n?e[t]=n:e.splice(t,1)}return e.length>0?this:void 0}optimizeNames(e,t){let{nodes:n}=this,r=n.length;for(;r--;){let i=n[r];i.optimizeNames(e,t)||(ie(e,i.names),n.splice(r,1))}return n.length>0?this:void 0}get names(){return this.nodes.reduce((e,t)=>te(e,t.names),{})}},m=class extends p{render(e){return`{`+e._n+super.render(e)+`}`+e._n}},h=class extends p{},g=class extends m{};g.kind=`else`;var _=class e extends m{constructor(e,t){super(t),this.condition=e}render(e){let t=`if(${this.condition})`+super.render(e);return this.else&&(t+=`else `+this.else.render(e)),t}optimizeNodes(){super.optimizeNodes();let t=this.condition;if(t===!0)return this.nodes;let n=this.else;if(n){let e=n.optimizeNodes();n=this.else=Array.isArray(e)?new g(e):e}if(n)return t===!1?n instanceof e?n:n.nodes:this.nodes.length?this:new e(ae(t),n instanceof e?[n]:n.nodes);if(t!==!1&&this.nodes.length)return this}optimizeNames(e,t){if(this.else=this.else?.optimizeNames(e,t),super.optimizeNames(e,t)||this.else)return this.condition=re(this.condition,e,t),this}get names(){let e=super.names;return ne(e,this.condition),this.else&&te(e,this.else.names),e}};_.kind=`if`;var v=class extends m{};v.kind=`for`;var y=class extends v{constructor(e){super(),this.iteration=e}render(e){return`for(${this.iteration})`+super.render(e)}optimizeNames(e,t){if(super.optimizeNames(e,t))return this.iteration=re(this.iteration,e,t),this}get names(){return te(super.names,this.iteration.names)}},b=class extends v{constructor(e,t,n,r){super(),this.varKind=e,this.name=t,this.from=n,this.to=r}render(e){let t=e.es5?n.varKinds.var:this.varKind,{name:r,from:i,to:a}=this;return`for(${t} ${r}=${i}; ${r}<${a}; ${r}++)`+super.render(e)}get names(){return ne(ne(super.names,this.from),this.to)}},x=class extends v{constructor(e,t,n,r){super(),this.loop=e,this.varKind=t,this.name=n,this.iterable=r}render(e){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(e)}optimizeNames(e,t){if(super.optimizeNames(e,t))return this.iterable=re(this.iterable,e,t),this}get names(){return te(super.names,this.iterable.names)}},S=class extends m{constructor(e,t,n){super(),this.name=e,this.args=t,this.async=n}render(e){return`${this.async?`async `:``}function ${this.name}(${this.args})`+super.render(e)}};S.kind=`func`;var C=class extends p{render(e){return`return `+super.render(e)}};C.kind=`return`;var w=class extends m{render(e){let t=`try`+super.render(e);return this.catch&&(t+=this.catch.render(e)),this.finally&&(t+=this.finally.render(e)),t}optimizeNodes(){var e,t;return super.optimizeNodes(),(e=this.catch)==null||e.optimizeNodes(),(t=this.finally)==null||t.optimizeNodes(),this}optimizeNames(e,t){var n,r;return super.optimizeNames(e,t),(n=this.catch)==null||n.optimizeNames(e,t),(r=this.finally)==null||r.optimizeNames(e,t),this}get names(){let e=super.names;return this.catch&&te(e,this.catch.names),this.finally&&te(e,this.finally.names),e}},ee=class extends m{constructor(e){super(),this.error=e}render(e){return`catch(${this.error})`+super.render(e)}};ee.kind=`catch`;var T=class extends m{render(e){return`finally`+super.render(e)}};T.kind=`finally`,e.CodeGen=class{constructor(e,t={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...t,_n:t.lines?`
641
- `:``},this._extScope=e,this._scope=new n.Scope({parent:e}),this._nodes=[new h]}toString(){return this._root.render(this.opts)}name(e){return this._scope.name(e)}scopeName(e){return this._extScope.name(e)}scopeValue(e,t){let n=this._extScope.value(e,t);return(this._values[n.prefix]||(this._values[n.prefix]=new Set)).add(n),n}getScopeValue(e,t){return this._extScope.getValue(e,t)}scopeRefs(e){return this._extScope.scopeRefs(e,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(e,t,n,r){let i=this._scope.toName(t);return n!==void 0&&r&&(this._constants[i.str]=n),this._leafNode(new o(e,i,n)),i}const(e,t,r){return this._def(n.varKinds.const,e,t,r)}let(e,t,r){return this._def(n.varKinds.let,e,t,r)}var(e,t,r){return this._def(n.varKinds.var,e,t,r)}assign(e,t,n){return this._leafNode(new s(e,t,n))}add(t,n){return this._leafNode(new c(t,e.operators.ADD,n))}code(e){return typeof e==`function`?e():e!==t.nil&&this._leafNode(new f(e)),this}object(...e){let n=[`{`];for(let[r,i]of e)n.length>1&&n.push(`,`),n.push(r),(r!==i||this.opts.es5)&&(n.push(`:`),(0,t.addCodeArg)(n,i));return n.push(`}`),new t._Code(n)}if(e,t,n){if(this._blockNode(new _(e)),t&&n)this.code(t).else().code(n).endIf();else if(t)this.code(t).endIf();else if(n)throw Error(`CodeGen: "else" body without "then" body`);return this}elseIf(e){return this._elseNode(new _(e))}else(){return this._elseNode(new g)}endIf(){return this._endBlockNode(_,g)}_for(e,t){return this._blockNode(e),t&&this.code(t).endFor(),this}for(e,t){return this._for(new y(e),t)}forRange(e,t,r,i,a=this.opts.es5?n.varKinds.var:n.varKinds.let){let o=this._scope.toName(e);return this._for(new b(a,o,t,r),()=>i(o))}forOf(e,r,i,a=n.varKinds.const){let o=this._scope.toName(e);if(this.opts.es5){let e=r instanceof t.Name?r:this.var(`_arr`,r);return this.forRange(`_i`,0,(0,t._)`${e}.length`,n=>{this.var(o,(0,t._)`${e}[${n}]`),i(o)})}return this._for(new x(`of`,a,o,r),()=>i(o))}forIn(e,r,i,a=this.opts.es5?n.varKinds.var:n.varKinds.const){if(this.opts.ownProperties)return this.forOf(e,(0,t._)`Object.keys(${r})`,i);let o=this._scope.toName(e);return this._for(new x(`in`,a,o,r),()=>i(o))}endFor(){return this._endBlockNode(v)}label(e){return this._leafNode(new l(e))}break(e){return this._leafNode(new u(e))}return(e){let t=new C;if(this._blockNode(t),this.code(e),t.nodes.length!==1)throw Error(`CodeGen: "return" should have one node`);return this._endBlockNode(C)}try(e,t,n){if(!t&&!n)throw Error(`CodeGen: "try" without "catch" and "finally"`);let r=new w;if(this._blockNode(r),this.code(e),t){let e=this.name(`e`);this._currNode=r.catch=new ee(e),t(e)}return n&&(this._currNode=r.finally=new T,this.code(n)),this._endBlockNode(ee,T)}throw(e){return this._leafNode(new d(e))}block(e,t){return this._blockStarts.push(this._nodes.length),e&&this.code(e).endBlock(t),this}endBlock(e){let t=this._blockStarts.pop();if(t===void 0)throw Error(`CodeGen: not in self-balancing block`);let n=this._nodes.length-t;if(n<0||e!==void 0&&n!==e)throw Error(`CodeGen: wrong number of nodes: ${n} vs ${e} expected`);return this._nodes.length=t,this}func(e,n=t.nil,r,i){return this._blockNode(new S(e,n,r)),i&&this.code(i).endFunc(),this}endFunc(){return this._endBlockNode(S)}optimize(e=1){for(;e-->0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(e){return this._currNode.nodes.push(e),this}_blockNode(e){this._currNode.nodes.push(e),this._nodes.push(e)}_endBlockNode(e,t){let n=this._currNode;if(n instanceof e||t&&n instanceof t)return this._nodes.pop(),this;throw Error(`CodeGen: not in block "${t?`${e.kind}/${t.kind}`:e.kind}"`)}_elseNode(e){let t=this._currNode;if(!(t instanceof _))throw Error(`CodeGen: "else" without "if"`);return this._currNode=t.else=e,this}get _root(){return this._nodes[0]}get _currNode(){let e=this._nodes;return e[e.length-1]}set _currNode(e){let t=this._nodes;t[t.length-1]=e}};function te(e,t){for(let n in t)e[n]=(e[n]||0)+(t[n]||0);return e}function ne(e,n){return n instanceof t._CodeOrName?te(e,n.names):e}function re(e,n,r){return e instanceof t.Name?i(e):a(e)?new t._Code(e._items.reduce((e,n)=>(n instanceof t.Name&&(n=i(n)),n instanceof t._Code?e.push(...n._items):e.push(n),e),[])):e;function i(e){let t=r[e.str];return t===void 0||n[e.str]!==1?e:(delete n[e.str],t)}function a(e){return e instanceof t._Code&&e._items.some(e=>e instanceof t.Name&&n[e.str]===1&&r[e.str]!==void 0)}}function ie(e,t){for(let n in t)e[n]=(e[n]||0)-(t[n]||0)}function ae(e){return typeof e==`boolean`||typeof e==`number`||e===null?!e:(0,t._)`!${de(e)}`}e.not=ae;var oe=ue(e.operators.AND);function se(...e){return e.reduce(oe)}e.and=se;var ce=ue(e.operators.OR);function le(...e){return e.reduce(ce)}e.or=le;function ue(e){return(n,r)=>n===t.nil?r:r===t.nil?n:(0,t._)`${de(n)} ${e} ${de(r)}`}function de(e){return e instanceof t.Name?e:(0,t._)`(${e})`}})),$=a((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.checkStrictMode=e.getErrorPath=e.Type=e.useFunc=e.setEvaluated=e.evaluatedPropsToName=e.mergeEvaluated=e.eachItem=e.unescapeJsonPointer=e.escapeJsonPointer=e.escapeFragment=e.unescapeFragment=e.schemaRefOrVal=e.schemaHasRulesButRef=e.schemaHasRules=e.checkUnknownRules=e.alwaysValidSchema=e.toHash=void 0;var t=Q(),n=XA();function r(e){let t={};for(let n of e)t[n]=!0;return t}e.toHash=r;function i(e,t){return typeof t==`boolean`?t:Object.keys(t).length===0||(a(e,t),!o(t,e.self.RULES.all))}e.alwaysValidSchema=i;function a(e,t=e.schema){let{opts:n,self:r}=e;if(!n.strictSchema||typeof t==`boolean`)return;let i=r.RULES.keywords;for(let n in t)i[n]||x(e,`unknown keyword: "${n}"`)}e.checkUnknownRules=a;function o(e,t){if(typeof e==`boolean`)return!e;for(let n in e)if(t[n])return!0;return!1}e.schemaHasRules=o;function s(e,t){if(typeof e==`boolean`)return!e;for(let n in e)if(n!==`$ref`&&t.all[n])return!0;return!1}e.schemaHasRulesButRef=s;function c({topSchemaRef:e,schemaPath:n},r,i,a){if(!a){if(typeof r==`number`||typeof r==`boolean`)return r;if(typeof r==`string`)return(0,t._)`${r}`}return(0,t._)`${e}${n}${(0,t.getProperty)(i)}`}e.schemaRefOrVal=c;function l(e){return f(decodeURIComponent(e))}e.unescapeFragment=l;function u(e){return encodeURIComponent(d(e))}e.escapeFragment=u;function d(e){return typeof e==`number`?`${e}`:e.replace(/~/g,`~0`).replace(/\//g,`~1`)}e.escapeJsonPointer=d;function f(e){return e.replace(/~1/g,`/`).replace(/~0/g,`~`)}e.unescapeJsonPointer=f;function p(e,t){if(Array.isArray(e))for(let n of e)t(n);else t(e)}e.eachItem=p;function m({mergeNames:e,mergeToName:n,mergeValues:r,resultToName:i}){return(a,o,s,c)=>{let l=s===void 0?o:s instanceof t.Name?(o instanceof t.Name?e(a,o,s):n(a,o,s),s):o instanceof t.Name?(n(a,s,o),o):r(o,s);return c===t.Name&&!(l instanceof t.Name)?i(a,l):l}}e.mergeEvaluated={props:m({mergeNames:(e,n,r)=>e.if((0,t._)`${r} !== true && ${n} !== undefined`,()=>{e.if((0,t._)`${n} === true`,()=>e.assign(r,!0),()=>e.assign(r,(0,t._)`${r} || {}`).code((0,t._)`Object.assign(${r}, ${n})`))}),mergeToName:(e,n,r)=>e.if((0,t._)`${r} !== true`,()=>{n===!0?e.assign(r,!0):(e.assign(r,(0,t._)`${r} || {}`),g(e,r,n))}),mergeValues:(e,t)=>e===!0||{...e,...t},resultToName:h}),items:m({mergeNames:(e,n,r)=>e.if((0,t._)`${r} !== true && ${n} !== undefined`,()=>e.assign(r,(0,t._)`${n} === true ? true : ${r} > ${n} ? ${r} : ${n}`)),mergeToName:(e,n,r)=>e.if((0,t._)`${r} !== true`,()=>e.assign(r,n===!0||(0,t._)`${r} > ${n} ? ${r} : ${n}`)),mergeValues:(e,t)=>e===!0||Math.max(e,t),resultToName:(e,t)=>e.var(`items`,t)})};function h(e,n){if(n===!0)return e.var(`props`,!0);let r=e.var(`props`,(0,t._)`{}`);return n!==void 0&&g(e,r,n),r}e.evaluatedPropsToName=h;function g(e,n,r){Object.keys(r).forEach(r=>e.assign((0,t._)`${n}${(0,t.getProperty)(r)}`,!0))}e.setEvaluated=g;var _={};function v(e,t){return e.scopeValue(`func`,{ref:t,code:_[t.code]||(_[t.code]=new n._Code(t.code))})}e.useFunc=v;var y;(function(e){e[e.Num=0]=`Num`,e[e.Str=1]=`Str`})(y||(e.Type=y={}));function b(e,n,r){if(e instanceof t.Name){let i=n===y.Num;return r?i?(0,t._)`"[" + ${e} + "]"`:(0,t._)`"['" + ${e} + "']"`:i?(0,t._)`"/" + ${e}`:(0,t._)`"/" + ${e}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return r?(0,t.getProperty)(e).toString():`/`+d(e)}e.getErrorPath=b;function x(e,t,n=e.opts.strictSchema){if(n){if(t=`strict mode: ${t}`,n===!0)throw Error(t);e.self.logger.warn(t)}}e.checkStrictMode=x})),QA=a((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=Q();e.default={data:new t.Name(`data`),valCxt:new t.Name(`valCxt`),instancePath:new t.Name(`instancePath`),parentData:new t.Name(`parentData`),parentDataProperty:new t.Name(`parentDataProperty`),rootData:new t.Name(`rootData`),dynamicAnchors:new t.Name(`dynamicAnchors`),vErrors:new t.Name(`vErrors`),errors:new t.Name(`errors`),this:new t.Name(`this`),self:new t.Name(`self`),scope:new t.Name(`scope`),json:new t.Name(`json`),jsonPos:new t.Name(`jsonPos`),jsonLen:new t.Name(`jsonLen`),jsonPart:new t.Name(`jsonPart`)}})),$A=a((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.extendErrors=e.resetErrorsCount=e.reportExtraError=e.reportError=e.keyword$DataError=e.keywordError=void 0;var t=Q(),n=$(),r=QA();e.keywordError={message:({keyword:e})=>(0,t.str)`must pass "${e}" keyword validation`},e.keyword$DataError={message:({keyword:e,schemaType:n})=>n?(0,t.str)`"${e}" keyword must be ${n} ($data)`:(0,t.str)`"${e}" keyword is invalid ($data)`};function i(n,r=e.keywordError,i,a){let{it:o}=n,{gen:s,compositeRule:u,allErrors:f}=o,p=d(n,r,i);a??(u||f)?c(s,p):l(o,(0,t._)`[${p}]`)}e.reportError=i;function a(t,n=e.keywordError,i){let{it:a}=t,{gen:o,compositeRule:s,allErrors:u}=a;c(o,d(t,n,i)),s||u||l(a,r.default.vErrors)}e.reportExtraError=a;function o(e,n){e.assign(r.default.errors,n),e.if((0,t._)`${r.default.vErrors} !== null`,()=>e.if(n,()=>e.assign((0,t._)`${r.default.vErrors}.length`,n),()=>e.assign(r.default.vErrors,null)))}e.resetErrorsCount=o;function s({gen:e,keyword:n,schemaValue:i,data:a,errsCount:o,it:s}){if(o===void 0)throw Error(`ajv implementation error`);let c=e.name(`err`);e.forRange(`i`,o,r.default.errors,o=>{e.const(c,(0,t._)`${r.default.vErrors}[${o}]`),e.if((0,t._)`${c}.instancePath === undefined`,()=>e.assign((0,t._)`${c}.instancePath`,(0,t.strConcat)(r.default.instancePath,s.errorPath))),e.assign((0,t._)`${c}.schemaPath`,(0,t.str)`${s.errSchemaPath}/${n}`),s.opts.verbose&&(e.assign((0,t._)`${c}.schema`,i),e.assign((0,t._)`${c}.data`,a))})}e.extendErrors=s;function c(e,n){let i=e.const(`err`,n);e.if((0,t._)`${r.default.vErrors} === null`,()=>e.assign(r.default.vErrors,(0,t._)`[${i}]`),(0,t._)`${r.default.vErrors}.push(${i})`),e.code((0,t._)`${r.default.errors}++`)}function l(e,n){let{gen:r,validateName:i,schemaEnv:a}=e;a.$async?r.throw((0,t._)`new ${e.ValidationError}(${n})`):(r.assign((0,t._)`${i}.errors`,n),r.return(!1))}var u={keyword:new t.Name(`keyword`),schemaPath:new t.Name(`schemaPath`),params:new t.Name(`params`),propertyName:new t.Name(`propertyName`),message:new t.Name(`message`),schema:new t.Name(`schema`),parentSchema:new t.Name(`parentSchema`)};function d(e,n,r){let{createErrors:i}=e.it;return i===!1?(0,t._)`{}`:f(e,n,r)}function f(e,t,n={}){let{gen:r,it:i}=e,a=[p(i,n),m(e,n)];return h(e,t,a),r.object(...a)}function p({errorPath:e},{instancePath:i}){let a=i?(0,t.str)`${e}${(0,n.getErrorPath)(i,n.Type.Str)}`:e;return[r.default.instancePath,(0,t.strConcat)(r.default.instancePath,a)]}function m({keyword:e,it:{errSchemaPath:r}},{schemaPath:i,parentSchema:a}){let o=a?r:(0,t.str)`${r}/${e}`;return i&&(o=(0,t.str)`${o}${(0,n.getErrorPath)(i,n.Type.Str)}`),[u.schemaPath,o]}function h(e,{params:n,message:i},a){let{keyword:o,data:s,schemaValue:c,it:l}=e,{opts:d,propertyName:f,topSchemaRef:p,schemaPath:m}=l;a.push([u.keyword,o],[u.params,typeof n==`function`?n(e):n||(0,t._)`{}`]),d.messages&&a.push([u.message,typeof i==`function`?i(e):i]),d.verbose&&a.push([u.schema,c],[u.parentSchema,(0,t._)`${p}${m}`],[r.default.data,s]),f&&a.push([u.propertyName,f])}})),ej=a((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.boolOrEmptySchema=e.topBoolOrEmptySchema=void 0;var t=$A(),n=Q(),r=QA(),i={message:`boolean schema is false`};function a(e){let{gen:t,schema:i,validateName:a}=e;i===!1?s(e,!1):typeof i==`object`&&i.$async===!0?t.return(r.default.data):(t.assign((0,n._)`${a}.errors`,null),t.return(!0))}e.topBoolOrEmptySchema=a;function o(e,t){let{gen:n,schema:r}=e;r===!1?(n.var(t,!1),s(e)):n.var(t,!0)}e.boolOrEmptySchema=o;function s(e,n){let{gen:r,data:a}=e,o={gen:r,keyword:`false schema`,data:a,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:e};(0,t.reportError)(o,i,void 0,n)}})),tj=a((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.getRules=e.isJSONType=void 0;var t=new Set([`string`,`number`,`integer`,`boolean`,`null`,`object`,`array`]);function n(e){return typeof e==`string`&&t.has(e)}e.isJSONType=n;function r(){let e={number:{type:`number`,rules:[]},string:{type:`string`,rules:[]},array:{type:`array`,rules:[]},object:{type:`object`,rules:[]}};return{types:{...e,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},e.number,e.string,e.array,e.object],post:{rules:[]},all:{},keywords:{}}}e.getRules=r})),nj=a((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.shouldUseRule=e.shouldUseGroup=e.schemaHasRulesForType=void 0;function t({schema:e,self:t},r){let i=t.RULES.types[r];return i&&i!==!0&&n(e,i)}e.schemaHasRulesForType=t;function n(e,t){return t.rules.some(t=>r(e,t))}e.shouldUseGroup=n;function r(e,t){return e[t.keyword]!==void 0||t.definition.implements?.some(t=>e[t]!==void 0)}e.shouldUseRule=r})),rj=a((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.reportTypeError=e.checkDataTypes=e.checkDataType=e.coerceAndCheckDataType=e.getJSONTypes=e.getSchemaTypes=e.DataType=void 0;var t=tj(),n=nj(),r=$A(),i=Q(),a=$(),o;(function(e){e[e.Correct=0]=`Correct`,e[e.Wrong=1]=`Wrong`})(o||(e.DataType=o={}));function s(e){let t=c(e.type);if(t.includes(`null`)){if(e.nullable===!1)throw Error(`type: null contradicts nullable: false`)}else{if(!t.length&&e.nullable!==void 0)throw Error(`"nullable" cannot be used without "type"`);e.nullable===!0&&t.push(`null`)}return t}e.getSchemaTypes=s;function c(e){let n=Array.isArray(e)?e:e?[e]:[];if(n.every(t.isJSONType))return n;throw Error(`type must be JSONType or JSONType[]: `+n.join(`,`))}e.getJSONTypes=c;function l(e,t){let{gen:r,data:i,opts:a}=e,s=d(t,a.coerceTypes),c=t.length>0&&!(s.length===0&&t.length===1&&(0,n.schemaHasRulesForType)(e,t[0]));if(c){let n=h(t,i,a.strictNumbers,o.Wrong);r.if(n,()=>{s.length?f(e,t,s):_(e)})}return c}e.coerceAndCheckDataType=l;var u=new Set([`string`,`number`,`integer`,`boolean`,`null`]);function d(e,t){return t?e.filter(e=>u.has(e)||t===`array`&&e===`array`):[]}function f(e,t,n){let{gen:r,data:a,opts:o}=e,s=r.let(`dataType`,(0,i._)`typeof ${a}`),c=r.let(`coerced`,(0,i._)`undefined`);o.coerceTypes===`array`&&r.if((0,i._)`${s} == 'object' && Array.isArray(${a}) && ${a}.length == 1`,()=>r.assign(a,(0,i._)`${a}[0]`).assign(s,(0,i._)`typeof ${a}`).if(h(t,a,o.strictNumbers),()=>r.assign(c,a))),r.if((0,i._)`${c} !== undefined`);for(let e of n)(u.has(e)||e===`array`&&o.coerceTypes===`array`)&&l(e);r.else(),_(e),r.endIf(),r.if((0,i._)`${c} !== undefined`,()=>{r.assign(a,c),p(e,c)});function l(e){switch(e){case`string`:r.elseIf((0,i._)`${s} == "number" || ${s} == "boolean"`).assign(c,(0,i._)`"" + ${a}`).elseIf((0,i._)`${a} === null`).assign(c,(0,i._)`""`);return;case`number`:r.elseIf((0,i._)`${s} == "boolean" || ${a} === null
643
+ </div>`}});var HA=e=>Array.isArray(e)&&typeof e[0]==`string`,UA=e=>Array.isArray(e)&&!HA(e),WA=(e,t)=>t.split(`.`).reduce((e,t)=>e&&typeof e==`object`?e[t]:void 0,e),GA=(e,t,n)=>{let r=e===n||(e??null)===n;if(t===`=`)return r;if(t===`!=`)return!r;if(typeof e!=typeof n||![`number`,`string`].includes(typeof e))return!1;let[i,a]=[e,n];return t===`>`?i>a:t===`>=`?i>=a:t===`<`?i<a:i<=a},KA=(e,t)=>{if(UA(t))return t.every(t=>KA(e,t));if(HA(t)){let[n,r,i]=t,a=WA(e,n);if(r!==`in`&&r!==`not-in`)return GA(a,r,i);let o=i.some(e=>GA(a,`=`,e));return r===`in`?o:!o}if(`and`in t)return KA(e,t.and);let n=t.or;return UA(n)?n.some(t=>KA(e,t)):KA(e,n)},qA=(e,t)=>(!e?.showWhen||KA(t,e.showWhen))&&!(e?.hideWhen&&KA(t,e.hideWhen)),JA=(e,t=[])=>Object.entries(e).flatMap(([e,n])=>{let r={path:[...t,e],schema:n};return n.type===`object`&&n.properties?[r,...JA(n.properties,r.path)]:[r]}),YA=(e,[t,...n],r)=>{let i=e[t],a=n.length?YA(i&&typeof i==`object`?i:{},n,r):r;return a===void 0?Object.fromEntries(Object.entries(e).filter(([e])=>e!==t)):{...e,[t]:a}},XA=(e,t)=>{let n=JA(e),r=e=>n.reduce((t,{path:n,schema:r})=>{let i=n.join(`.`),{defaultValue:a}=r.$edahaField??{};return e.has(i)?WA(t,i)===void 0?t:YA(t,n,void 0):a!==void 0&&WA(t,i)===void 0?YA(t,n,a):t},t),i=e=>n.reduce((t,{path:n,schema:r})=>((t.has(n.slice(0,-1).join(`.`))||!qA(r.$edahaField,e))&&t.add(n.join(`.`)),t),new Set),a=new Set,o=r(a);for(let e=0;e<=n.length;e++){let e=i(o);if([...e].join(`\0`)===[...a].join(`\0`))break;a=e,o=r(a)}let s=Object.keys(e);return{values:Object.fromEntries(Object.entries(o).sort(([e],[t])=>(s.indexOf(e)+1||1/0)-(s.indexOf(t)+1||1/0))),hidden:a}},ZA=a((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.regexpCode=e.getEsmExportName=e.getProperty=e.safeStringify=e.stringify=e.strConcat=e.addCodeArg=e.str=e._=e.nil=e._Code=e.Name=e.IDENTIFIER=e._CodeOrName=void 0;var t=class{};e._CodeOrName=t,e.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var n=class extends t{constructor(t){if(super(),!e.IDENTIFIER.test(t))throw Error(`CodeGen: name must be a valid identifier`);this.str=t}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}};e.Name=n;var r=class extends t{constructor(e){super(),this._items=typeof e==`string`?[e]:e}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let e=this._items[0];return e===``||e===`""`}get str(){return this._str??=this._items.reduce((e,t)=>`${e}${t}`,``)}get names(){return this._names??=this._items.reduce((e,t)=>(t instanceof n&&(e[t.str]=(e[t.str]||0)+1),e),{})}};e._Code=r,e.nil=new r(``);function i(e,...t){let n=[e[0]],i=0;for(;i<t.length;)s(n,t[i]),n.push(e[++i]);return new r(n)}e._=i;var a=new r(`+`);function o(e,...t){let n=[p(e[0])],i=0;for(;i<t.length;)n.push(a),s(n,t[i]),n.push(a,p(e[++i]));return c(n),new r(n)}e.str=o;function s(e,t){t instanceof r?e.push(...t._items):t instanceof n?e.push(t):e.push(d(t))}e.addCodeArg=s;function c(e){let t=1;for(;t<e.length-1;){if(e[t]===a){let n=l(e[t-1],e[t+1]);if(n!==void 0){e.splice(t-1,3,n);continue}e[t++]=`+`}t++}}function l(e,t){if(t===`""`)return e;if(e===`""`)return t;if(typeof e==`string`)return t instanceof n||e[e.length-1]!==`"`?void 0:typeof t==`string`?t[0]===`"`?e.slice(0,-1)+t.slice(1):void 0:`${e.slice(0,-1)}${t}"`;if(typeof t==`string`&&t[0]===`"`&&!(e instanceof n))return`"${e}${t.slice(1)}`}function u(e,t){return t.emptyStr()?e:e.emptyStr()?t:o`${e}${t}`}e.strConcat=u;function d(e){return typeof e==`number`||typeof e==`boolean`||e===null?e:p(Array.isArray(e)?e.join(`,`):e)}function f(e){return new r(p(e))}e.stringify=f;function p(e){return JSON.stringify(e).replace(/\u2028/g,`\\u2028`).replace(/\u2029/g,`\\u2029`)}e.safeStringify=p;function m(t){return typeof t==`string`&&e.IDENTIFIER.test(t)?new r(`.${t}`):i`[${t}]`}e.getProperty=m;function h(t){if(typeof t==`string`&&e.IDENTIFIER.test(t))return new r(`${t}`);throw Error(`CodeGen: invalid export name: ${t}, use explicit $id name mapping`)}e.getEsmExportName=h;function g(e){return new r(e.toString())}e.regexpCode=g})),QA=a((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.ValueScope=e.ValueScopeName=e.Scope=e.varKinds=e.UsedValueState=void 0;var t=ZA(),n=class extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`),this.value=e.value}},r;(function(e){e[e.Started=0]=`Started`,e[e.Completed=1]=`Completed`})(r||(e.UsedValueState=r={})),e.varKinds={const:new t.Name(`const`),let:new t.Name(`let`),var:new t.Name(`var`)};var i=class{constructor({prefixes:e,parent:t}={}){this._names={},this._prefixes=e,this._parent=t}toName(e){return e instanceof t.Name?e:this.name(e)}name(e){return new t.Name(this._newName(e))}_newName(e){let t=this._names[e]||this._nameGroup(e);return`${e}${t.index++}`}_nameGroup(e){if((this._parent?._prefixes)?.has(e)||this._prefixes&&!this._prefixes.has(e))throw Error(`CodeGen: prefix "${e}" is not allowed in this scope`);return this._names[e]={prefix:e,index:0}}};e.Scope=i;var a=class extends t.Name{constructor(e,t){super(t),this.prefix=e}setValue(e,{property:n,itemIndex:r}){this.value=e,this.scopePath=(0,t._)`.${new t.Name(n)}[${r}]`}};e.ValueScopeName=a;var o=(0,t._)`\n`;e.ValueScope=class extends i{constructor(e){super(e),this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?o:t.nil}}get(){return this._scope}name(e){return new a(e,this._newName(e))}value(e,t){if(t.ref===void 0)throw Error(`CodeGen: ref must be passed in value`);let n=this.toName(e),{prefix:r}=n,i=t.key??t.ref,a=this._values[r];if(a){let e=a.get(i);if(e)return e}else a=this._values[r]=new Map;a.set(i,n);let o=this._scope[r]||(this._scope[r]=[]),s=o.length;return o[s]=t.ref,n.setValue(t,{property:r,itemIndex:s}),n}getValue(e,t){let n=this._values[e];if(n)return n.get(t)}scopeRefs(e,n=this._values){return this._reduceValues(n,n=>{if(n.scopePath===void 0)throw Error(`CodeGen: name "${n}" has no value`);return(0,t._)`${e}${n.scopePath}`})}scopeCode(e=this._values,t,n){return this._reduceValues(e,e=>{if(e.value===void 0)throw Error(`CodeGen: name "${e}" has no value`);return e.value.code},t,n)}_reduceValues(i,a,o={},s){let c=t.nil;for(let l in i){let u=i[l];if(!u)continue;let d=o[l]=o[l]||new Map;u.forEach(i=>{if(d.has(i))return;d.set(i,r.Started);let o=a(i);if(o){let n=this.opts.es5?e.varKinds.var:e.varKinds.const;c=(0,t._)`${c}${n} ${i} = ${o};${this.opts._n}`}else if(o=s?.(i))c=(0,t._)`${c}${o}${this.opts._n}`;else throw new n(i);d.set(i,r.Completed)})}return c}}})),Q=a((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.or=e.and=e.not=e.CodeGen=e.operators=e.varKinds=e.ValueScopeName=e.ValueScope=e.Scope=e.Name=e.regexpCode=e.stringify=e.getProperty=e.nil=e.strConcat=e.str=e._=void 0;var t=ZA(),n=QA(),r=ZA();Object.defineProperty(e,"_",{enumerable:!0,get:function(){return r._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return r.str}}),Object.defineProperty(e,"strConcat",{enumerable:!0,get:function(){return r.strConcat}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return r.nil}}),Object.defineProperty(e,"getProperty",{enumerable:!0,get:function(){return r.getProperty}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return r.stringify}}),Object.defineProperty(e,"regexpCode",{enumerable:!0,get:function(){return r.regexpCode}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return r.Name}});var i=QA();Object.defineProperty(e,"Scope",{enumerable:!0,get:function(){return i.Scope}}),Object.defineProperty(e,"ValueScope",{enumerable:!0,get:function(){return i.ValueScope}}),Object.defineProperty(e,"ValueScopeName",{enumerable:!0,get:function(){return i.ValueScopeName}}),Object.defineProperty(e,"varKinds",{enumerable:!0,get:function(){return i.varKinds}}),e.operators={GT:new t._Code(`>`),GTE:new t._Code(`>=`),LT:new t._Code(`<`),LTE:new t._Code(`<=`),EQ:new t._Code(`===`),NEQ:new t._Code(`!==`),NOT:new t._Code(`!`),OR:new t._Code(`||`),AND:new t._Code(`&&`),ADD:new t._Code(`+`)};var a=class{optimizeNodes(){return this}optimizeNames(e,t){return this}},o=class extends a{constructor(e,t,n){super(),this.varKind=e,this.name=t,this.rhs=n}render({es5:e,_n:t}){let r=e?n.varKinds.var:this.varKind,i=this.rhs===void 0?``:` = ${this.rhs}`;return`${r} ${this.name}${i};`+t}optimizeNames(e,t){if(e[this.name.str])return this.rhs&&=re(this.rhs,e,t),this}get names(){return this.rhs instanceof t._CodeOrName?this.rhs.names:{}}},s=class extends a{constructor(e,t,n){super(),this.lhs=e,this.rhs=t,this.sideEffects=n}render({_n:e}){return`${this.lhs} = ${this.rhs};`+e}optimizeNames(e,n){if(!(this.lhs instanceof t.Name&&!e[this.lhs.str]&&!this.sideEffects))return this.rhs=re(this.rhs,e,n),this}get names(){return ne(this.lhs instanceof t.Name?{}:{...this.lhs.names},this.rhs)}},c=class extends s{constructor(e,t,n,r){super(e,n,r),this.op=t}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}},l=class extends a{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}},u=class extends a{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`break${this.label?` ${this.label}`:``};`+e}},d=class extends a{constructor(e){super(),this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}},f=class extends a{constructor(e){super(),this.code=e}render({_n:e}){return`${this.code};`+e}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(e,t){return this.code=re(this.code,e,t),this}get names(){return this.code instanceof t._CodeOrName?this.code.names:{}}},p=class extends a{constructor(e=[]){super(),this.nodes=e}render(e){return this.nodes.reduce((t,n)=>t+n.render(e),``)}optimizeNodes(){let{nodes:e}=this,t=e.length;for(;t--;){let n=e[t].optimizeNodes();Array.isArray(n)?e.splice(t,1,...n):n?e[t]=n:e.splice(t,1)}return e.length>0?this:void 0}optimizeNames(e,t){let{nodes:n}=this,r=n.length;for(;r--;){let i=n[r];i.optimizeNames(e,t)||(ie(e,i.names),n.splice(r,1))}return n.length>0?this:void 0}get names(){return this.nodes.reduce((e,t)=>te(e,t.names),{})}},m=class extends p{render(e){return`{`+e._n+super.render(e)+`}`+e._n}},h=class extends p{},g=class extends m{};g.kind=`else`;var _=class e extends m{constructor(e,t){super(t),this.condition=e}render(e){let t=`if(${this.condition})`+super.render(e);return this.else&&(t+=`else `+this.else.render(e)),t}optimizeNodes(){super.optimizeNodes();let t=this.condition;if(t===!0)return this.nodes;let n=this.else;if(n){let e=n.optimizeNodes();n=this.else=Array.isArray(e)?new g(e):e}if(n)return t===!1?n instanceof e?n:n.nodes:this.nodes.length?this:new e(ae(t),n instanceof e?[n]:n.nodes);if(t!==!1&&this.nodes.length)return this}optimizeNames(e,t){if(this.else=this.else?.optimizeNames(e,t),super.optimizeNames(e,t)||this.else)return this.condition=re(this.condition,e,t),this}get names(){let e=super.names;return ne(e,this.condition),this.else&&te(e,this.else.names),e}};_.kind=`if`;var v=class extends m{};v.kind=`for`;var y=class extends v{constructor(e){super(),this.iteration=e}render(e){return`for(${this.iteration})`+super.render(e)}optimizeNames(e,t){if(super.optimizeNames(e,t))return this.iteration=re(this.iteration,e,t),this}get names(){return te(super.names,this.iteration.names)}},b=class extends v{constructor(e,t,n,r){super(),this.varKind=e,this.name=t,this.from=n,this.to=r}render(e){let t=e.es5?n.varKinds.var:this.varKind,{name:r,from:i,to:a}=this;return`for(${t} ${r}=${i}; ${r}<${a}; ${r}++)`+super.render(e)}get names(){return ne(ne(super.names,this.from),this.to)}},x=class extends v{constructor(e,t,n,r){super(),this.loop=e,this.varKind=t,this.name=n,this.iterable=r}render(e){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(e)}optimizeNames(e,t){if(super.optimizeNames(e,t))return this.iterable=re(this.iterable,e,t),this}get names(){return te(super.names,this.iterable.names)}},S=class extends m{constructor(e,t,n){super(),this.name=e,this.args=t,this.async=n}render(e){return`${this.async?`async `:``}function ${this.name}(${this.args})`+super.render(e)}};S.kind=`func`;var C=class extends p{render(e){return`return `+super.render(e)}};C.kind=`return`;var w=class extends m{render(e){let t=`try`+super.render(e);return this.catch&&(t+=this.catch.render(e)),this.finally&&(t+=this.finally.render(e)),t}optimizeNodes(){var e,t;return super.optimizeNodes(),(e=this.catch)==null||e.optimizeNodes(),(t=this.finally)==null||t.optimizeNodes(),this}optimizeNames(e,t){var n,r;return super.optimizeNames(e,t),(n=this.catch)==null||n.optimizeNames(e,t),(r=this.finally)==null||r.optimizeNames(e,t),this}get names(){let e=super.names;return this.catch&&te(e,this.catch.names),this.finally&&te(e,this.finally.names),e}},ee=class extends m{constructor(e){super(),this.error=e}render(e){return`catch(${this.error})`+super.render(e)}};ee.kind=`catch`;var T=class extends m{render(e){return`finally`+super.render(e)}};T.kind=`finally`,e.CodeGen=class{constructor(e,t={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...t,_n:t.lines?`
644
+ `:``},this._extScope=e,this._scope=new n.Scope({parent:e}),this._nodes=[new h]}toString(){return this._root.render(this.opts)}name(e){return this._scope.name(e)}scopeName(e){return this._extScope.name(e)}scopeValue(e,t){let n=this._extScope.value(e,t);return(this._values[n.prefix]||(this._values[n.prefix]=new Set)).add(n),n}getScopeValue(e,t){return this._extScope.getValue(e,t)}scopeRefs(e){return this._extScope.scopeRefs(e,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(e,t,n,r){let i=this._scope.toName(t);return n!==void 0&&r&&(this._constants[i.str]=n),this._leafNode(new o(e,i,n)),i}const(e,t,r){return this._def(n.varKinds.const,e,t,r)}let(e,t,r){return this._def(n.varKinds.let,e,t,r)}var(e,t,r){return this._def(n.varKinds.var,e,t,r)}assign(e,t,n){return this._leafNode(new s(e,t,n))}add(t,n){return this._leafNode(new c(t,e.operators.ADD,n))}code(e){return typeof e==`function`?e():e!==t.nil&&this._leafNode(new f(e)),this}object(...e){let n=[`{`];for(let[r,i]of e)n.length>1&&n.push(`,`),n.push(r),(r!==i||this.opts.es5)&&(n.push(`:`),(0,t.addCodeArg)(n,i));return n.push(`}`),new t._Code(n)}if(e,t,n){if(this._blockNode(new _(e)),t&&n)this.code(t).else().code(n).endIf();else if(t)this.code(t).endIf();else if(n)throw Error(`CodeGen: "else" body without "then" body`);return this}elseIf(e){return this._elseNode(new _(e))}else(){return this._elseNode(new g)}endIf(){return this._endBlockNode(_,g)}_for(e,t){return this._blockNode(e),t&&this.code(t).endFor(),this}for(e,t){return this._for(new y(e),t)}forRange(e,t,r,i,a=this.opts.es5?n.varKinds.var:n.varKinds.let){let o=this._scope.toName(e);return this._for(new b(a,o,t,r),()=>i(o))}forOf(e,r,i,a=n.varKinds.const){let o=this._scope.toName(e);if(this.opts.es5){let e=r instanceof t.Name?r:this.var(`_arr`,r);return this.forRange(`_i`,0,(0,t._)`${e}.length`,n=>{this.var(o,(0,t._)`${e}[${n}]`),i(o)})}return this._for(new x(`of`,a,o,r),()=>i(o))}forIn(e,r,i,a=this.opts.es5?n.varKinds.var:n.varKinds.const){if(this.opts.ownProperties)return this.forOf(e,(0,t._)`Object.keys(${r})`,i);let o=this._scope.toName(e);return this._for(new x(`in`,a,o,r),()=>i(o))}endFor(){return this._endBlockNode(v)}label(e){return this._leafNode(new l(e))}break(e){return this._leafNode(new u(e))}return(e){let t=new C;if(this._blockNode(t),this.code(e),t.nodes.length!==1)throw Error(`CodeGen: "return" should have one node`);return this._endBlockNode(C)}try(e,t,n){if(!t&&!n)throw Error(`CodeGen: "try" without "catch" and "finally"`);let r=new w;if(this._blockNode(r),this.code(e),t){let e=this.name(`e`);this._currNode=r.catch=new ee(e),t(e)}return n&&(this._currNode=r.finally=new T,this.code(n)),this._endBlockNode(ee,T)}throw(e){return this._leafNode(new d(e))}block(e,t){return this._blockStarts.push(this._nodes.length),e&&this.code(e).endBlock(t),this}endBlock(e){let t=this._blockStarts.pop();if(t===void 0)throw Error(`CodeGen: not in self-balancing block`);let n=this._nodes.length-t;if(n<0||e!==void 0&&n!==e)throw Error(`CodeGen: wrong number of nodes: ${n} vs ${e} expected`);return this._nodes.length=t,this}func(e,n=t.nil,r,i){return this._blockNode(new S(e,n,r)),i&&this.code(i).endFunc(),this}endFunc(){return this._endBlockNode(S)}optimize(e=1){for(;e-->0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(e){return this._currNode.nodes.push(e),this}_blockNode(e){this._currNode.nodes.push(e),this._nodes.push(e)}_endBlockNode(e,t){let n=this._currNode;if(n instanceof e||t&&n instanceof t)return this._nodes.pop(),this;throw Error(`CodeGen: not in block "${t?`${e.kind}/${t.kind}`:e.kind}"`)}_elseNode(e){let t=this._currNode;if(!(t instanceof _))throw Error(`CodeGen: "else" without "if"`);return this._currNode=t.else=e,this}get _root(){return this._nodes[0]}get _currNode(){let e=this._nodes;return e[e.length-1]}set _currNode(e){let t=this._nodes;t[t.length-1]=e}};function te(e,t){for(let n in t)e[n]=(e[n]||0)+(t[n]||0);return e}function ne(e,n){return n instanceof t._CodeOrName?te(e,n.names):e}function re(e,n,r){return e instanceof t.Name?i(e):a(e)?new t._Code(e._items.reduce((e,n)=>(n instanceof t.Name&&(n=i(n)),n instanceof t._Code?e.push(...n._items):e.push(n),e),[])):e;function i(e){let t=r[e.str];return t===void 0||n[e.str]!==1?e:(delete n[e.str],t)}function a(e){return e instanceof t._Code&&e._items.some(e=>e instanceof t.Name&&n[e.str]===1&&r[e.str]!==void 0)}}function ie(e,t){for(let n in t)e[n]=(e[n]||0)-(t[n]||0)}function ae(e){return typeof e==`boolean`||typeof e==`number`||e===null?!e:(0,t._)`!${de(e)}`}e.not=ae;var oe=ue(e.operators.AND);function se(...e){return e.reduce(oe)}e.and=se;var ce=ue(e.operators.OR);function le(...e){return e.reduce(ce)}e.or=le;function ue(e){return(n,r)=>n===t.nil?r:r===t.nil?n:(0,t._)`${de(n)} ${e} ${de(r)}`}function de(e){return e instanceof t.Name?e:(0,t._)`(${e})`}})),$=a((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.checkStrictMode=e.getErrorPath=e.Type=e.useFunc=e.setEvaluated=e.evaluatedPropsToName=e.mergeEvaluated=e.eachItem=e.unescapeJsonPointer=e.escapeJsonPointer=e.escapeFragment=e.unescapeFragment=e.schemaRefOrVal=e.schemaHasRulesButRef=e.schemaHasRules=e.checkUnknownRules=e.alwaysValidSchema=e.toHash=void 0;var t=Q(),n=ZA();function r(e){let t={};for(let n of e)t[n]=!0;return t}e.toHash=r;function i(e,t){return typeof t==`boolean`?t:Object.keys(t).length===0||(a(e,t),!o(t,e.self.RULES.all))}e.alwaysValidSchema=i;function a(e,t=e.schema){let{opts:n,self:r}=e;if(!n.strictSchema||typeof t==`boolean`)return;let i=r.RULES.keywords;for(let n in t)i[n]||x(e,`unknown keyword: "${n}"`)}e.checkUnknownRules=a;function o(e,t){if(typeof e==`boolean`)return!e;for(let n in e)if(t[n])return!0;return!1}e.schemaHasRules=o;function s(e,t){if(typeof e==`boolean`)return!e;for(let n in e)if(n!==`$ref`&&t.all[n])return!0;return!1}e.schemaHasRulesButRef=s;function c({topSchemaRef:e,schemaPath:n},r,i,a){if(!a){if(typeof r==`number`||typeof r==`boolean`)return r;if(typeof r==`string`)return(0,t._)`${r}`}return(0,t._)`${e}${n}${(0,t.getProperty)(i)}`}e.schemaRefOrVal=c;function l(e){return f(decodeURIComponent(e))}e.unescapeFragment=l;function u(e){return encodeURIComponent(d(e))}e.escapeFragment=u;function d(e){return typeof e==`number`?`${e}`:e.replace(/~/g,`~0`).replace(/\//g,`~1`)}e.escapeJsonPointer=d;function f(e){return e.replace(/~1/g,`/`).replace(/~0/g,`~`)}e.unescapeJsonPointer=f;function p(e,t){if(Array.isArray(e))for(let n of e)t(n);else t(e)}e.eachItem=p;function m({mergeNames:e,mergeToName:n,mergeValues:r,resultToName:i}){return(a,o,s,c)=>{let l=s===void 0?o:s instanceof t.Name?(o instanceof t.Name?e(a,o,s):n(a,o,s),s):o instanceof t.Name?(n(a,s,o),o):r(o,s);return c===t.Name&&!(l instanceof t.Name)?i(a,l):l}}e.mergeEvaluated={props:m({mergeNames:(e,n,r)=>e.if((0,t._)`${r} !== true && ${n} !== undefined`,()=>{e.if((0,t._)`${n} === true`,()=>e.assign(r,!0),()=>e.assign(r,(0,t._)`${r} || {}`).code((0,t._)`Object.assign(${r}, ${n})`))}),mergeToName:(e,n,r)=>e.if((0,t._)`${r} !== true`,()=>{n===!0?e.assign(r,!0):(e.assign(r,(0,t._)`${r} || {}`),g(e,r,n))}),mergeValues:(e,t)=>e===!0||{...e,...t},resultToName:h}),items:m({mergeNames:(e,n,r)=>e.if((0,t._)`${r} !== true && ${n} !== undefined`,()=>e.assign(r,(0,t._)`${n} === true ? true : ${r} > ${n} ? ${r} : ${n}`)),mergeToName:(e,n,r)=>e.if((0,t._)`${r} !== true`,()=>e.assign(r,n===!0||(0,t._)`${r} > ${n} ? ${r} : ${n}`)),mergeValues:(e,t)=>e===!0||Math.max(e,t),resultToName:(e,t)=>e.var(`items`,t)})};function h(e,n){if(n===!0)return e.var(`props`,!0);let r=e.var(`props`,(0,t._)`{}`);return n!==void 0&&g(e,r,n),r}e.evaluatedPropsToName=h;function g(e,n,r){Object.keys(r).forEach(r=>e.assign((0,t._)`${n}${(0,t.getProperty)(r)}`,!0))}e.setEvaluated=g;var _={};function v(e,t){return e.scopeValue(`func`,{ref:t,code:_[t.code]||(_[t.code]=new n._Code(t.code))})}e.useFunc=v;var y;(function(e){e[e.Num=0]=`Num`,e[e.Str=1]=`Str`})(y||(e.Type=y={}));function b(e,n,r){if(e instanceof t.Name){let i=n===y.Num;return r?i?(0,t._)`"[" + ${e} + "]"`:(0,t._)`"['" + ${e} + "']"`:i?(0,t._)`"/" + ${e}`:(0,t._)`"/" + ${e}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return r?(0,t.getProperty)(e).toString():`/`+d(e)}e.getErrorPath=b;function x(e,t,n=e.opts.strictSchema){if(n){if(t=`strict mode: ${t}`,n===!0)throw Error(t);e.self.logger.warn(t)}}e.checkStrictMode=x})),$A=a((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=Q();e.default={data:new t.Name(`data`),valCxt:new t.Name(`valCxt`),instancePath:new t.Name(`instancePath`),parentData:new t.Name(`parentData`),parentDataProperty:new t.Name(`parentDataProperty`),rootData:new t.Name(`rootData`),dynamicAnchors:new t.Name(`dynamicAnchors`),vErrors:new t.Name(`vErrors`),errors:new t.Name(`errors`),this:new t.Name(`this`),self:new t.Name(`self`),scope:new t.Name(`scope`),json:new t.Name(`json`),jsonPos:new t.Name(`jsonPos`),jsonLen:new t.Name(`jsonLen`),jsonPart:new t.Name(`jsonPart`)}})),ej=a((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.extendErrors=e.resetErrorsCount=e.reportExtraError=e.reportError=e.keyword$DataError=e.keywordError=void 0;var t=Q(),n=$(),r=$A();e.keywordError={message:({keyword:e})=>(0,t.str)`must pass "${e}" keyword validation`},e.keyword$DataError={message:({keyword:e,schemaType:n})=>n?(0,t.str)`"${e}" keyword must be ${n} ($data)`:(0,t.str)`"${e}" keyword is invalid ($data)`};function i(n,r=e.keywordError,i,a){let{it:o}=n,{gen:s,compositeRule:u,allErrors:f}=o,p=d(n,r,i);a??(u||f)?c(s,p):l(o,(0,t._)`[${p}]`)}e.reportError=i;function a(t,n=e.keywordError,i){let{it:a}=t,{gen:o,compositeRule:s,allErrors:u}=a;c(o,d(t,n,i)),s||u||l(a,r.default.vErrors)}e.reportExtraError=a;function o(e,n){e.assign(r.default.errors,n),e.if((0,t._)`${r.default.vErrors} !== null`,()=>e.if(n,()=>e.assign((0,t._)`${r.default.vErrors}.length`,n),()=>e.assign(r.default.vErrors,null)))}e.resetErrorsCount=o;function s({gen:e,keyword:n,schemaValue:i,data:a,errsCount:o,it:s}){if(o===void 0)throw Error(`ajv implementation error`);let c=e.name(`err`);e.forRange(`i`,o,r.default.errors,o=>{e.const(c,(0,t._)`${r.default.vErrors}[${o}]`),e.if((0,t._)`${c}.instancePath === undefined`,()=>e.assign((0,t._)`${c}.instancePath`,(0,t.strConcat)(r.default.instancePath,s.errorPath))),e.assign((0,t._)`${c}.schemaPath`,(0,t.str)`${s.errSchemaPath}/${n}`),s.opts.verbose&&(e.assign((0,t._)`${c}.schema`,i),e.assign((0,t._)`${c}.data`,a))})}e.extendErrors=s;function c(e,n){let i=e.const(`err`,n);e.if((0,t._)`${r.default.vErrors} === null`,()=>e.assign(r.default.vErrors,(0,t._)`[${i}]`),(0,t._)`${r.default.vErrors}.push(${i})`),e.code((0,t._)`${r.default.errors}++`)}function l(e,n){let{gen:r,validateName:i,schemaEnv:a}=e;a.$async?r.throw((0,t._)`new ${e.ValidationError}(${n})`):(r.assign((0,t._)`${i}.errors`,n),r.return(!1))}var u={keyword:new t.Name(`keyword`),schemaPath:new t.Name(`schemaPath`),params:new t.Name(`params`),propertyName:new t.Name(`propertyName`),message:new t.Name(`message`),schema:new t.Name(`schema`),parentSchema:new t.Name(`parentSchema`)};function d(e,n,r){let{createErrors:i}=e.it;return i===!1?(0,t._)`{}`:f(e,n,r)}function f(e,t,n={}){let{gen:r,it:i}=e,a=[p(i,n),m(e,n)];return h(e,t,a),r.object(...a)}function p({errorPath:e},{instancePath:i}){let a=i?(0,t.str)`${e}${(0,n.getErrorPath)(i,n.Type.Str)}`:e;return[r.default.instancePath,(0,t.strConcat)(r.default.instancePath,a)]}function m({keyword:e,it:{errSchemaPath:r}},{schemaPath:i,parentSchema:a}){let o=a?r:(0,t.str)`${r}/${e}`;return i&&(o=(0,t.str)`${o}${(0,n.getErrorPath)(i,n.Type.Str)}`),[u.schemaPath,o]}function h(e,{params:n,message:i},a){let{keyword:o,data:s,schemaValue:c,it:l}=e,{opts:d,propertyName:f,topSchemaRef:p,schemaPath:m}=l;a.push([u.keyword,o],[u.params,typeof n==`function`?n(e):n||(0,t._)`{}`]),d.messages&&a.push([u.message,typeof i==`function`?i(e):i]),d.verbose&&a.push([u.schema,c],[u.parentSchema,(0,t._)`${p}${m}`],[r.default.data,s]),f&&a.push([u.propertyName,f])}})),tj=a((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.boolOrEmptySchema=e.topBoolOrEmptySchema=void 0;var t=ej(),n=Q(),r=$A(),i={message:`boolean schema is false`};function a(e){let{gen:t,schema:i,validateName:a}=e;i===!1?s(e,!1):typeof i==`object`&&i.$async===!0?t.return(r.default.data):(t.assign((0,n._)`${a}.errors`,null),t.return(!0))}e.topBoolOrEmptySchema=a;function o(e,t){let{gen:n,schema:r}=e;r===!1?(n.var(t,!1),s(e)):n.var(t,!0)}e.boolOrEmptySchema=o;function s(e,n){let{gen:r,data:a}=e,o={gen:r,keyword:`false schema`,data:a,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:e};(0,t.reportError)(o,i,void 0,n)}})),nj=a((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.getRules=e.isJSONType=void 0;var t=new Set([`string`,`number`,`integer`,`boolean`,`null`,`object`,`array`]);function n(e){return typeof e==`string`&&t.has(e)}e.isJSONType=n;function r(){let e={number:{type:`number`,rules:[]},string:{type:`string`,rules:[]},array:{type:`array`,rules:[]},object:{type:`object`,rules:[]}};return{types:{...e,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},e.number,e.string,e.array,e.object],post:{rules:[]},all:{},keywords:{}}}e.getRules=r})),rj=a((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.shouldUseRule=e.shouldUseGroup=e.schemaHasRulesForType=void 0;function t({schema:e,self:t},r){let i=t.RULES.types[r];return i&&i!==!0&&n(e,i)}e.schemaHasRulesForType=t;function n(e,t){return t.rules.some(t=>r(e,t))}e.shouldUseGroup=n;function r(e,t){return e[t.keyword]!==void 0||t.definition.implements?.some(t=>e[t]!==void 0)}e.shouldUseRule=r})),ij=a((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.reportTypeError=e.checkDataTypes=e.checkDataType=e.coerceAndCheckDataType=e.getJSONTypes=e.getSchemaTypes=e.DataType=void 0;var t=nj(),n=rj(),r=ej(),i=Q(),a=$(),o;(function(e){e[e.Correct=0]=`Correct`,e[e.Wrong=1]=`Wrong`})(o||(e.DataType=o={}));function s(e){let t=c(e.type);if(t.includes(`null`)){if(e.nullable===!1)throw Error(`type: null contradicts nullable: false`)}else{if(!t.length&&e.nullable!==void 0)throw Error(`"nullable" cannot be used without "type"`);e.nullable===!0&&t.push(`null`)}return t}e.getSchemaTypes=s;function c(e){let n=Array.isArray(e)?e:e?[e]:[];if(n.every(t.isJSONType))return n;throw Error(`type must be JSONType or JSONType[]: `+n.join(`,`))}e.getJSONTypes=c;function l(e,t){let{gen:r,data:i,opts:a}=e,s=d(t,a.coerceTypes),c=t.length>0&&!(s.length===0&&t.length===1&&(0,n.schemaHasRulesForType)(e,t[0]));if(c){let n=h(t,i,a.strictNumbers,o.Wrong);r.if(n,()=>{s.length?f(e,t,s):_(e)})}return c}e.coerceAndCheckDataType=l;var u=new Set([`string`,`number`,`integer`,`boolean`,`null`]);function d(e,t){return t?e.filter(e=>u.has(e)||t===`array`&&e===`array`):[]}function f(e,t,n){let{gen:r,data:a,opts:o}=e,s=r.let(`dataType`,(0,i._)`typeof ${a}`),c=r.let(`coerced`,(0,i._)`undefined`);o.coerceTypes===`array`&&r.if((0,i._)`${s} == 'object' && Array.isArray(${a}) && ${a}.length == 1`,()=>r.assign(a,(0,i._)`${a}[0]`).assign(s,(0,i._)`typeof ${a}`).if(h(t,a,o.strictNumbers),()=>r.assign(c,a))),r.if((0,i._)`${c} !== undefined`);for(let e of n)(u.has(e)||e===`array`&&o.coerceTypes===`array`)&&l(e);r.else(),_(e),r.endIf(),r.if((0,i._)`${c} !== undefined`,()=>{r.assign(a,c),p(e,c)});function l(e){switch(e){case`string`:r.elseIf((0,i._)`${s} == "number" || ${s} == "boolean"`).assign(c,(0,i._)`"" + ${a}`).elseIf((0,i._)`${a} === null`).assign(c,(0,i._)`""`);return;case`number`:r.elseIf((0,i._)`${s} == "boolean" || ${a} === null
642
645
  || (${s} == "string" && ${a} && ${a} == +${a})`).assign(c,(0,i._)`+${a}`);return;case`integer`:r.elseIf((0,i._)`${s} === "boolean" || ${a} === null
643
646
  || (${s} === "string" && ${a} && ${a} == +${a} && !(${a} % 1))`).assign(c,(0,i._)`+${a}`);return;case`boolean`:r.elseIf((0,i._)`${a} === "false" || ${a} === 0 || ${a} === null`).assign(c,!1).elseIf((0,i._)`${a} === "true" || ${a} === 1`).assign(c,!0);return;case`null`:r.elseIf((0,i._)`${a} === "" || ${a} === 0 || ${a} === false`),r.assign(c,null);return;case`array`:r.elseIf((0,i._)`${s} === "string" || ${s} === "number"
644
- || ${s} === "boolean" || ${a} === null`).assign(c,(0,i._)`[${a}]`)}}}function p({gen:e,parentData:t,parentDataProperty:n},r){e.if((0,i._)`${t} !== undefined`,()=>e.assign((0,i._)`${t}[${n}]`,r))}function m(e,t,n,r=o.Correct){let a=r===o.Correct?i.operators.EQ:i.operators.NEQ,s;switch(e){case`null`:return(0,i._)`${t} ${a} null`;case`array`:s=(0,i._)`Array.isArray(${t})`;break;case`object`:s=(0,i._)`${t} && typeof ${t} == "object" && !Array.isArray(${t})`;break;case`integer`:s=c((0,i._)`!(${t} % 1) && !isNaN(${t})`);break;case`number`:s=c();break;default:return(0,i._)`typeof ${t} ${a} ${e}`}return r===o.Correct?s:(0,i.not)(s);function c(e=i.nil){return(0,i.and)((0,i._)`typeof ${t} == "number"`,e,n?(0,i._)`isFinite(${t})`:i.nil)}}e.checkDataType=m;function h(e,t,n,r){if(e.length===1)return m(e[0],t,n,r);let o,s=(0,a.toHash)(e);if(s.array&&s.object){let e=(0,i._)`typeof ${t} != "object"`;o=s.null?e:(0,i._)`!${t} || ${e}`,delete s.null,delete s.array,delete s.object}else o=i.nil;s.number&&delete s.integer;for(let e in s)o=(0,i.and)(o,m(e,t,n,r));return o}e.checkDataTypes=h;var g={message:({schema:e})=>`must be ${e}`,params:({schema:e,schemaValue:t})=>typeof e==`string`?(0,i._)`{type: ${e}}`:(0,i._)`{type: ${t}}`};function _(e){let t=v(e);(0,r.reportError)(t,g)}e.reportTypeError=_;function v(e){let{gen:t,data:n,schema:r}=e,i=(0,a.schemaRefOrVal)(e,r,`type`);return{gen:t,keyword:`type`,data:n,schema:r.type,schemaCode:i,schemaValue:i,parentSchema:r,params:{},it:e}}})),ij=a((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.assignDefaults=void 0;var t=Q(),n=$();function r(e,t){let{properties:n,items:r}=e.schema;if(t===`object`&&n)for(let t in n)i(e,t,n[t].default);else t===`array`&&Array.isArray(r)&&r.forEach((t,n)=>i(e,n,t.default))}e.assignDefaults=r;function i(e,r,i){let{gen:a,compositeRule:o,data:s,opts:c}=e;if(i===void 0)return;let l=(0,t._)`${s}${(0,t.getProperty)(r)}`;if(o){(0,n.checkStrictMode)(e,`default is ignored for: ${l}`);return}let u=(0,t._)`${l} === undefined`;c.useDefaults===`empty`&&(u=(0,t._)`${u} || ${l} === null || ${l} === ""`),a.if(u,(0,t._)`${l} = ${(0,t.stringify)(i)}`)}})),aj=a((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.validateUnion=e.validateArray=e.usePattern=e.callValidateCode=e.schemaProperties=e.allSchemaProperties=e.noPropertyInData=e.propertyInData=e.isOwnProperty=e.hasPropFunc=e.reportMissingProp=e.checkMissingProp=e.checkReportMissingProp=void 0;var t=Q(),n=$(),r=QA(),i=$();function a(e,n){let{gen:r,data:i,it:a}=e;r.if(d(r,i,n,a.opts.ownProperties),()=>{e.setParams({missingProperty:(0,t._)`${n}`},!0),e.error()})}e.checkReportMissingProp=a;function o({gen:e,data:n,it:{opts:r}},i,a){return(0,t.or)(...i.map(i=>(0,t.and)(d(e,n,i,r.ownProperties),(0,t._)`${a} = ${i}`)))}e.checkMissingProp=o;function s(e,t){e.setParams({missingProperty:t},!0),e.error()}e.reportMissingProp=s;function c(e){return e.scopeValue(`func`,{ref:Object.prototype.hasOwnProperty,code:(0,t._)`Object.prototype.hasOwnProperty`})}e.hasPropFunc=c;function l(e,n,r){return(0,t._)`${c(e)}.call(${n}, ${r})`}e.isOwnProperty=l;function u(e,n,r,i){let a=(0,t._)`${n}${(0,t.getProperty)(r)} !== undefined`;return i?(0,t._)`${a} && ${l(e,n,r)}`:a}e.propertyInData=u;function d(e,n,r,i){let a=(0,t._)`${n}${(0,t.getProperty)(r)} === undefined`;return i?(0,t.or)(a,(0,t.not)(l(e,n,r))):a}e.noPropertyInData=d;function f(e){return e?Object.keys(e).filter(e=>e!==`__proto__`):[]}e.allSchemaProperties=f;function p(e,t){return f(t).filter(r=>!(0,n.alwaysValidSchema)(e,t[r]))}e.schemaProperties=p;function m({schemaCode:e,data:n,it:{gen:i,topSchemaRef:a,schemaPath:o,errorPath:s},it:c},l,u,d){let f=d?(0,t._)`${e}, ${n}, ${a}${o}`:n,p=[[r.default.instancePath,(0,t.strConcat)(r.default.instancePath,s)],[r.default.parentData,c.parentData],[r.default.parentDataProperty,c.parentDataProperty],[r.default.rootData,r.default.rootData]];c.opts.dynamicRef&&p.push([r.default.dynamicAnchors,r.default.dynamicAnchors]);let m=(0,t._)`${f}, ${i.object(...p)}`;return u===t.nil?(0,t._)`${l}(${m})`:(0,t._)`${l}.call(${u}, ${m})`}e.callValidateCode=m;var h=(0,t._)`new RegExp`;function g({gen:e,it:{opts:n}},r){let a=n.unicodeRegExp?`u`:``,{regExp:o}=n.code,s=o(r,a);return e.scopeValue(`pattern`,{key:s.toString(),ref:s,code:(0,t._)`${o.code===`new RegExp`?h:(0,i.useFunc)(e,o)}(${r}, ${a})`})}e.usePattern=g;function _(e){let{gen:r,data:i,keyword:a,it:o}=e,s=r.name(`valid`);if(o.allErrors){let e=r.let(`valid`,!0);return c(()=>r.assign(e,!1)),e}return r.var(s,!0),c(()=>r.break()),s;function c(o){let c=r.const(`len`,(0,t._)`${i}.length`);r.forRange(`i`,0,c,i=>{e.subschema({keyword:a,dataProp:i,dataPropType:n.Type.Num},s),r.if((0,t.not)(s),o)})}}e.validateArray=_;function v(e){let{gen:r,schema:i,keyword:a,it:o}=e;if(!Array.isArray(i))throw Error(`ajv implementation error`);if(i.some(e=>(0,n.alwaysValidSchema)(o,e))&&!o.opts.unevaluated)return;let s=r.let(`valid`,!1),c=r.name(`_valid`);r.block(()=>i.forEach((n,i)=>{let o=e.subschema({keyword:a,schemaProp:i,compositeRule:!0},c);r.assign(s,(0,t._)`${s} || ${c}`),e.mergeValidEvaluated(o,c)||r.if((0,t.not)(s))})),e.result(s,()=>e.reset(),()=>e.error(!0))}e.validateUnion=v})),oj=a((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.validateKeywordUsage=e.validSchemaType=e.funcKeywordCode=e.macroKeywordCode=void 0;var t=Q(),n=QA(),r=aj(),i=$A();function a(e,n){let{gen:r,keyword:i,schema:a,parentSchema:o,it:s}=e,c=n.macro.call(s.self,a,o,s),l=u(r,i,c);s.opts.validateSchema!==!1&&s.self.validateSchema(c,!0);let d=r.name(`valid`);e.subschema({schema:c,schemaPath:t.nil,errSchemaPath:`${s.errSchemaPath}/${i}`,topSchemaRef:l,compositeRule:!0},d),e.pass(d,()=>e.error(!0))}e.macroKeywordCode=a;function o(e,i){let{gen:a,keyword:o,schema:d,parentSchema:f,$data:p,it:m}=e;l(m,i);let h=u(a,o,!p&&i.compile?i.compile.call(m.self,d,f,m):i.validate),g=a.let(`valid`);e.block$data(g,_),e.ok(i.valid??g);function _(){if(i.errors===!1)b(),i.modifying&&s(e),x(()=>e.error());else{let t=i.async?v():y();i.modifying&&s(e),x(()=>c(e,t))}}function v(){let e=a.let(`ruleErrs`,null);return a.try(()=>b((0,t._)`await `),n=>a.assign(g,!1).if((0,t._)`${n} instanceof ${m.ValidationError}`,()=>a.assign(e,(0,t._)`${n}.errors`),()=>a.throw(n))),e}function y(){let e=(0,t._)`${h}.errors`;return a.assign(e,null),b(t.nil),e}function b(o=i.async?(0,t._)`await `:t.nil){let s=m.opts.passContext?n.default.this:n.default.self,c=!(`compile`in i&&!p||i.schema===!1);a.assign(g,(0,t._)`${o}${(0,r.callValidateCode)(e,h,s,c)}`,i.modifying)}function x(e){a.if((0,t.not)(i.valid??g),e)}}e.funcKeywordCode=o;function s(e){let{gen:n,data:r,it:i}=e;n.if(i.parentData,()=>n.assign(r,(0,t._)`${i.parentData}[${i.parentDataProperty}]`))}function c(e,r){let{gen:a}=e;a.if((0,t._)`Array.isArray(${r})`,()=>{a.assign(n.default.vErrors,(0,t._)`${n.default.vErrors} === null ? ${r} : ${n.default.vErrors}.concat(${r})`).assign(n.default.errors,(0,t._)`${n.default.vErrors}.length`),(0,i.extendErrors)(e)},()=>e.error())}function l({schemaEnv:e},t){if(t.async&&!e.$async)throw Error(`async keyword in sync schema`)}function u(e,n,r){if(r===void 0)throw Error(`keyword "${n}" failed to compile`);return e.scopeValue(`keyword`,typeof r==`function`?{ref:r}:{ref:r,code:(0,t.stringify)(r)})}function d(e,t,n=!1){return!t.length||t.some(t=>t===`array`?Array.isArray(e):t===`object`?e&&typeof e==`object`&&!Array.isArray(e):typeof e==t||n&&e===void 0)}e.validSchemaType=d;function f({schema:e,opts:t,self:n,errSchemaPath:r},i,a){if(Array.isArray(i.keyword)?!i.keyword.includes(a):i.keyword!==a)throw Error(`ajv implementation error`);let o=i.dependencies;if(o?.some(t=>!Object.prototype.hasOwnProperty.call(e,t)))throw Error(`parent schema must have dependencies of ${a}: ${o.join(`,`)}`);if(i.validateSchema&&!i.validateSchema(e[a])){let e=`keyword "${a}" value is invalid at path "${r}": `+n.errorsText(i.validateSchema.errors);if(t.validateSchema===`log`)n.logger.error(e);else throw Error(e)}}e.validateKeywordUsage=f})),sj=a((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.extendSubschemaMode=e.extendSubschemaData=e.getSubschema=void 0;var t=Q(),n=$();function r(e,{keyword:r,schemaProp:i,schema:a,schemaPath:o,errSchemaPath:s,topSchemaRef:c}){if(r!==void 0&&a!==void 0)throw Error(`both "keyword" and "schema" passed, only one allowed`);if(r!==void 0){let a=e.schema[r];return i===void 0?{schema:a,schemaPath:(0,t._)`${e.schemaPath}${(0,t.getProperty)(r)}`,errSchemaPath:`${e.errSchemaPath}/${r}`}:{schema:a[i],schemaPath:(0,t._)`${e.schemaPath}${(0,t.getProperty)(r)}${(0,t.getProperty)(i)}`,errSchemaPath:`${e.errSchemaPath}/${r}/${(0,n.escapeFragment)(i)}`}}if(a!==void 0){if(o===void 0||s===void 0||c===void 0)throw Error(`"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"`);return{schema:a,schemaPath:o,topSchemaRef:c,errSchemaPath:s}}throw Error(`either "keyword" or "schema" must be passed`)}e.getSubschema=r;function i(e,r,{dataProp:i,dataPropType:a,data:o,dataTypes:s,propertyName:c}){if(o!==void 0&&i!==void 0)throw Error(`both "data" and "dataProp" passed, only one allowed`);let{gen:l}=r;if(i!==void 0){let{errorPath:o,dataPathArr:s,opts:c}=r;u(l.let(`data`,(0,t._)`${r.data}${(0,t.getProperty)(i)}`,!0)),e.errorPath=(0,t.str)`${o}${(0,n.getErrorPath)(i,a,c.jsPropertySyntax)}`,e.parentDataProperty=(0,t._)`${i}`,e.dataPathArr=[...s,e.parentDataProperty]}o!==void 0&&(u(o instanceof t.Name?o:l.let(`data`,o,!0)),c!==void 0&&(e.propertyName=c)),s&&(e.dataTypes=s);function u(t){e.data=t,e.dataLevel=r.dataLevel+1,e.dataTypes=[],r.definedProperties=new Set,e.parentData=r.data,e.dataNames=[...r.dataNames,t]}}e.extendSubschemaData=i;function a(e,{jtdDiscriminator:t,jtdMetadata:n,compositeRule:r,createErrors:i,allErrors:a}){r!==void 0&&(e.compositeRule=r),i!==void 0&&(e.createErrors=i),a!==void 0&&(e.allErrors=a),e.jtdDiscriminator=t,e.jtdMetadata=n}e.extendSubschemaMode=a})),cj=a(((e,t)=>{t.exports=function e(t,n){if(t===n)return!0;if(t&&n&&typeof t==`object`&&typeof n==`object`){if(t.constructor!==n.constructor)return!1;var r,i,a;if(Array.isArray(t)){if(r=t.length,r!=n.length)return!1;for(i=r;i--!==0;)if(!e(t[i],n[i]))return!1;return!0}if(t.constructor===RegExp)return t.source===n.source&&t.flags===n.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===n.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===n.toString();if(a=Object.keys(t),r=a.length,r!==Object.keys(n).length)return!1;for(i=r;i--!==0;)if(!Object.prototype.hasOwnProperty.call(n,a[i]))return!1;for(i=r;i--!==0;){var o=a[i];if(!e(t[o],n[o]))return!1}return!0}return t!==t&&n!==n}})),lj=a(((e,t)=>{var n=t.exports=function(e,t,n){typeof t==`function`&&(n=t,t={}),n=t.cb||n;var i=typeof n==`function`?n:n.pre||function(){},a=n.post||function(){};r(t,i,a,e,``,e)};n.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0},n.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0},n.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0},n.skipKeywords={default:!0,enum:!0,const:!0,required:!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};function r(e,t,a,o,s,c,l,u,d,f){if(o&&typeof o==`object`&&!Array.isArray(o)){for(var p in t(o,s,c,l,u,d,f),o){var m=o[p];if(Array.isArray(m)){if(p in n.arrayKeywords)for(var h=0;h<m.length;h++)r(e,t,a,m[h],s+`/`+p+`/`+h,c,s,p,o,h)}else if(p in n.propsKeywords){if(m&&typeof m==`object`)for(var g in m)r(e,t,a,m[g],s+`/`+p+`/`+i(g),c,s,p,o,g)}else(p in n.keywords||e.allKeys&&!(p in n.skipKeywords))&&r(e,t,a,m,s+`/`+p,c,s,p,o)}a(o,s,c,l,u,d,f)}}function i(e){return e.replace(/~/g,`~0`).replace(/\//g,`~1`)}})),uj=a((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.getSchemaRefs=e.resolveUrl=e.normalizeId=e._getFullPath=e.getFullPath=e.inlineRef=void 0;var t=$(),n=cj(),r=lj(),i=new Set([`type`,`format`,`pattern`,`maxLength`,`minLength`,`maxProperties`,`minProperties`,`maxItems`,`minItems`,`maximum`,`minimum`,`uniqueItems`,`multipleOf`,`required`,`enum`,`const`]);function a(e,t=!0){return typeof e==`boolean`?!0:t===!0?!s(e):t?c(e)<=t:!1}e.inlineRef=a;var o=new Set([`$ref`,`$recursiveRef`,`$recursiveAnchor`,`$dynamicRef`,`$dynamicAnchor`]);function s(e){for(let t in e){if(o.has(t))return!0;let n=e[t];if(Array.isArray(n)&&n.some(s)||typeof n==`object`&&s(n))return!0}return!1}function c(e){let n=0;for(let r in e)if(r===`$ref`||(n++,!i.has(r)&&(typeof e[r]==`object`&&(0,t.eachItem)(e[r],e=>n+=c(e)),n===1/0)))return 1/0;return n}function l(e,t=``,n){return n!==!1&&(t=f(t)),u(e,e.parse(t))}e.getFullPath=l;function u(e,t){return e.serialize(t).split(`#`)[0]+`#`}e._getFullPath=u;var d=/#\/?$/;function f(e){return e?e.replace(d,``):``}e.normalizeId=f;function p(e,t,n){return n=f(n),e.resolve(t,n)}e.resolveUrl=p;var m=/^[a-z_][-a-z0-9._]*$/i;function h(e,t){if(typeof e==`boolean`)return{};let{schemaId:i,uriResolver:a}=this.opts,o=f(e[i]||t),s={"":o},c=l(a,o,!1),u={},d=new Set;return r(e,{allKeys:!0},(e,t,n,r)=>{if(r===void 0)return;let a=c+t,o=s[r];typeof e[i]==`string`&&(o=l.call(this,e[i])),g.call(this,e.$anchor),g.call(this,e.$dynamicAnchor),s[t]=o;function l(t){let n=this.opts.uriResolver.resolve;if(t=f(o?n(o,t):t),d.has(t))throw h(t);d.add(t);let r=this.refs[t];return typeof r==`string`&&(r=this.refs[r]),typeof r==`object`?p(e,r.schema,t):t!==f(a)&&(t[0]===`#`?(p(e,u[t],t),u[t]=e):this.refs[t]=a),t}function g(e){if(typeof e==`string`){if(!m.test(e))throw Error(`invalid anchor "${e}"`);l.call(this,`#${e}`)}}}),u;function p(e,t,r){if(t!==void 0&&!n(e,t))throw h(r)}function h(e){return Error(`reference "${e}" resolves to more than one schema`)}}e.getSchemaRefs=h})),dj=a((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.getData=e.KeywordCxt=e.validateFunctionCode=void 0;var t=ej(),n=rj(),r=nj(),i=rj(),a=ij(),o=oj(),s=sj(),c=Q(),l=QA(),u=uj(),d=$(),f=$A();function p(e){S(e)&&(w(e),x(e))?_(e):m(e,()=>(0,t.topBoolOrEmptySchema)(e))}e.validateFunctionCode=p;function m({gen:e,validateName:t,schema:n,schemaEnv:r,opts:i},a){i.code.es5?e.func(t,(0,c._)`${l.default.data}, ${l.default.valCxt}`,r.$async,()=>{e.code((0,c._)`"use strict"; ${y(n,i)}`),g(e,i),e.code(a)}):e.func(t,(0,c._)`${l.default.data}, ${h(i)}`,r.$async,()=>e.code(y(n,i)).code(a))}function h(e){return(0,c._)`{${l.default.instancePath}="", ${l.default.parentData}, ${l.default.parentDataProperty}, ${l.default.rootData}=${l.default.data}${e.dynamicRef?(0,c._)`, ${l.default.dynamicAnchors}={}`:c.nil}}={}`}function g(e,t){e.if(l.default.valCxt,()=>{e.var(l.default.instancePath,(0,c._)`${l.default.valCxt}.${l.default.instancePath}`),e.var(l.default.parentData,(0,c._)`${l.default.valCxt}.${l.default.parentData}`),e.var(l.default.parentDataProperty,(0,c._)`${l.default.valCxt}.${l.default.parentDataProperty}`),e.var(l.default.rootData,(0,c._)`${l.default.valCxt}.${l.default.rootData}`),t.dynamicRef&&e.var(l.default.dynamicAnchors,(0,c._)`${l.default.valCxt}.${l.default.dynamicAnchors}`)},()=>{e.var(l.default.instancePath,(0,c._)`""`),e.var(l.default.parentData,(0,c._)`undefined`),e.var(l.default.parentDataProperty,(0,c._)`undefined`),e.var(l.default.rootData,l.default.data),t.dynamicRef&&e.var(l.default.dynamicAnchors,(0,c._)`{}`)})}function _(e){let{schema:t,opts:n,gen:r}=e;m(e,()=>{n.$comment&&t.$comment&&ie(e),te(e),r.let(l.default.vErrors,null),r.let(l.default.errors,0),n.unevaluated&&v(e),ee(e),ae(e)})}function v(e){let{gen:t,validateName:n}=e;e.evaluated=t.const(`evaluated`,(0,c._)`${n}.evaluated`),t.if((0,c._)`${e.evaluated}.dynamicProps`,()=>t.assign((0,c._)`${e.evaluated}.props`,(0,c._)`undefined`)),t.if((0,c._)`${e.evaluated}.dynamicItems`,()=>t.assign((0,c._)`${e.evaluated}.items`,(0,c._)`undefined`))}function y(e,t){let n=typeof e==`object`&&e[t.schemaId];return n&&(t.code.source||t.code.process)?(0,c._)`/*# sourceURL=${n} */`:c.nil}function b(e,n){S(e)&&(w(e),x(e))?C(e,n):(0,t.boolOrEmptySchema)(e,n)}function x({schema:e,self:t}){if(typeof e==`boolean`)return!e;for(let n in e)if(t.RULES.all[n])return!0;return!1}function S(e){return typeof e.schema!=`boolean`}function C(e,t){let{schema:n,gen:r,opts:i}=e;i.$comment&&n.$comment&&ie(e),ne(e),re(e);let a=r.const(`_errs`,l.default.errors);ee(e,a),r.var(t,(0,c._)`${a} === ${l.default.errors}`)}function w(e){(0,d.checkUnknownRules)(e),T(e)}function ee(e,t){if(e.opts.jtd)return se(e,[],!1,t);let r=(0,n.getSchemaTypes)(e.schema);se(e,r,!(0,n.coerceAndCheckDataType)(e,r),t)}function T(e){let{schema:t,errSchemaPath:n,opts:r,self:i}=e;t.$ref&&r.ignoreKeywordsWithRef&&(0,d.schemaHasRulesButRef)(t,i.RULES)&&i.logger.warn(`$ref: keywords ignored in schema at path "${n}"`)}function te(e){let{schema:t,opts:n}=e;t.default!==void 0&&n.useDefaults&&n.strictSchema&&(0,d.checkStrictMode)(e,`default is ignored in the schema root`)}function ne(e){let t=e.schema[e.opts.schemaId];t&&(e.baseId=(0,u.resolveUrl)(e.opts.uriResolver,e.baseId,t))}function re(e){if(e.schema.$async&&!e.schemaEnv.$async)throw Error(`async schema in sync schema`)}function ie({gen:e,schemaEnv:t,schema:n,errSchemaPath:r,opts:i}){let a=n.$comment;if(i.$comment===!0)e.code((0,c._)`${l.default.self}.logger.log(${a})`);else if(typeof i.$comment==`function`){let n=(0,c.str)`${r}/$comment`,i=e.scopeValue(`root`,{ref:t.root});e.code((0,c._)`${l.default.self}.opts.$comment(${a}, ${n}, ${i}.schema)`)}}function ae(e){let{gen:t,schemaEnv:n,validateName:r,ValidationError:i,opts:a}=e;n.$async?t.if((0,c._)`${l.default.errors} === 0`,()=>t.return(l.default.data),()=>t.throw((0,c._)`new ${i}(${l.default.vErrors})`)):(t.assign((0,c._)`${r}.errors`,l.default.vErrors),a.unevaluated&&oe(e),t.return((0,c._)`${l.default.errors} === 0`))}function oe({gen:e,evaluated:t,props:n,items:r}){n instanceof c.Name&&e.assign((0,c._)`${t}.props`,n),r instanceof c.Name&&e.assign((0,c._)`${t}.items`,r)}function se(e,t,n,a){let{gen:o,schema:s,data:u,allErrors:f,opts:p,self:m}=e,{RULES:h}=m;if(s.$ref&&(p.ignoreKeywordsWithRef||!(0,d.schemaHasRulesButRef)(s,h))){o.block(()=>ve(e,`$ref`,h.all.$ref.definition));return}p.jtd||le(e,t),o.block(()=>{for(let e of h.rules)g(e);g(h.post)});function g(d){(0,r.shouldUseGroup)(s,d)&&(d.type?(o.if((0,i.checkDataType)(d.type,u,p.strictNumbers)),ce(e,d),t.length===1&&t[0]===d.type&&n&&(o.else(),(0,i.reportTypeError)(e)),o.endIf()):ce(e,d),f||o.if((0,c._)`${l.default.errors} === ${a||0}`))}}function ce(e,t){let{gen:n,schema:i,opts:{useDefaults:o}}=e;o&&(0,a.assignDefaults)(e,t.type),n.block(()=>{for(let n of t.rules)(0,r.shouldUseRule)(i,n)&&ve(e,n.keyword,n.definition,t.type)})}function le(e,t){!e.schemaEnv.meta&&e.opts.strictTypes&&(ue(e,t),e.opts.allowUnionTypes||de(e,t),fe(e,e.dataTypes))}function ue(e,t){t.length&&(e.dataTypes.length?(t.forEach(t=>{me(e.dataTypes,t)||ge(e,`type "${t}" not allowed by context "${e.dataTypes.join(`,`)}"`)}),he(e,t)):e.dataTypes=t)}function de(e,t){t.length>1&&!(t.length===2&&t.includes(`null`))&&ge(e,`use allowUnionTypes to allow union type keyword`)}function fe(e,t){let n=e.self.RULES.all;for(let i in n){let a=n[i];if(typeof a==`object`&&(0,r.shouldUseRule)(e.schema,a)){let{type:n}=a.definition;n.length&&!n.some(e=>pe(t,e))&&ge(e,`missing type "${n.join(`,`)}" for keyword "${i}"`)}}}function pe(e,t){return e.includes(t)||t===`number`&&e.includes(`integer`)}function me(e,t){return e.includes(t)||t===`integer`&&e.includes(`number`)}function he(e,t){let n=[];for(let r of e.dataTypes)me(t,r)?n.push(r):t.includes(`integer`)&&r===`number`&&n.push(`integer`);e.dataTypes=n}function ge(e,t){let n=e.schemaEnv.baseId+e.errSchemaPath;t+=` at "${n}" (strictTypes)`,(0,d.checkStrictMode)(e,t,e.opts.strictTypes)}var _e=class{constructor(e,t,n){if((0,o.validateKeywordUsage)(e,t,n),this.gen=e.gen,this.allErrors=e.allErrors,this.keyword=n,this.data=e.data,this.schema=e.schema[n],this.$data=t.$data&&e.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,d.schemaRefOrVal)(e,this.schema,n,this.$data),this.schemaType=t.schemaType,this.parentSchema=e.schema,this.params={},this.it=e,this.def=t,this.$data)this.schemaCode=e.gen.const(`vSchema`,xe(this.$data,e));else if(this.schemaCode=this.schemaValue,!(0,o.validSchemaType)(this.schema,t.schemaType,t.allowUndefined))throw Error(`${n} value must be ${JSON.stringify(t.schemaType)}`);(`code`in t?t.trackErrors:t.errors!==!1)&&(this.errsCount=e.gen.const(`_errs`,l.default.errors))}result(e,t,n){this.failResult((0,c.not)(e),t,n)}failResult(e,t,n){this.gen.if(e),n?n():this.error(),t?(this.gen.else(),t(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(e,t){this.failResult((0,c.not)(e),void 0,t)}fail(e){e===void 0?(this.error(),this.allErrors||this.gen.if(!1)):(this.gen.if(e),this.error(),this.allErrors?this.gen.endIf():this.gen.else())}fail$data(e){if(!this.$data)return this.fail(e);let{schemaCode:t}=this;this.fail((0,c._)`${t} !== undefined && (${(0,c.or)(this.invalid$data(),e)})`)}error(e,t,n){t?(this.setParams(t),this._error(e,n),this.setParams({})):this._error(e,n)}_error(e,t){(e?f.reportExtraError:f.reportError)(this,this.def.error,t)}$dataError(){(0,f.reportError)(this,this.def.$dataError||f.keyword$DataError)}reset(){if(this.errsCount===void 0)throw Error(`add "trackErrors" to keyword definition`);(0,f.resetErrorsCount)(this.gen,this.errsCount)}ok(e){this.allErrors||this.gen.if(e)}setParams(e,t){t?Object.assign(this.params,e):this.params=e}block$data(e,t,n=c.nil){this.gen.block(()=>{this.check$data(e,n),t()})}check$data(e=c.nil,t=c.nil){if(!this.$data)return;let{gen:n,schemaCode:r,schemaType:i,def:a}=this;n.if((0,c.or)((0,c._)`${r} === undefined`,t)),e!==c.nil&&n.assign(e,!0),(i.length||a.validateSchema)&&(n.elseIf(this.invalid$data()),this.$dataError(),e!==c.nil&&n.assign(e,!1)),n.else()}invalid$data(){let{gen:e,schemaCode:t,schemaType:n,def:r,it:a}=this;return(0,c.or)(o(),s());function o(){if(n.length){if(!(t instanceof c.Name))throw Error(`ajv implementation error`);let e=Array.isArray(n)?n:[n];return(0,c._)`${(0,i.checkDataTypes)(e,t,a.opts.strictNumbers,i.DataType.Wrong)}`}return c.nil}function s(){if(r.validateSchema){let n=e.scopeValue(`validate$data`,{ref:r.validateSchema});return(0,c._)`!${n}(${t})`}return c.nil}}subschema(e,t){let n=(0,s.getSubschema)(this.it,e);(0,s.extendSubschemaData)(n,this.it,e),(0,s.extendSubschemaMode)(n,e);let r={...this.it,...n,items:void 0,props:void 0};return b(r,t),r}mergeEvaluated(e,t){let{it:n,gen:r}=this;n.opts.unevaluated&&(n.props!==!0&&e.props!==void 0&&(n.props=d.mergeEvaluated.props(r,e.props,n.props,t)),n.items!==!0&&e.items!==void 0&&(n.items=d.mergeEvaluated.items(r,e.items,n.items,t)))}mergeValidEvaluated(e,t){let{it:n,gen:r}=this;if(n.opts.unevaluated&&(n.props!==!0||n.items!==!0))return r.if(t,()=>this.mergeEvaluated(e,c.Name)),!0}};e.KeywordCxt=_e;function ve(e,t,n,r){let i=new _e(e,n,t);`code`in n?n.code(i,r):i.$data&&n.validate?(0,o.funcKeywordCode)(i,n):`macro`in n?(0,o.macroKeywordCode)(i,n):(n.compile||n.validate)&&(0,o.funcKeywordCode)(i,n)}var ye=/^\/(?:[^~]|~0|~1)*$/,be=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function xe(e,{dataLevel:t,dataNames:n,dataPathArr:r}){let i,a;if(e===``)return l.default.rootData;if(e[0]===`/`){if(!ye.test(e))throw Error(`Invalid JSON-pointer: ${e}`);i=e,a=l.default.rootData}else{let o=be.exec(e);if(!o)throw Error(`Invalid JSON-pointer: ${e}`);let s=+o[1];if(i=o[2],i===`#`){if(s>=t)throw Error(u(`property/index`,s));return r[t-s]}if(s>t)throw Error(u(`data`,s));if(a=n[t-s],!i)return a}let o=a,s=i.split(`/`);for(let e of s)e&&(a=(0,c._)`${a}${(0,c.getProperty)((0,d.unescapeJsonPointer)(e))}`,o=(0,c._)`${o} && ${a}`);return o;function u(e,n){return`Cannot access ${e} ${n} levels up, current level is ${t}`}}e.getData=xe})),fj=a((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default=class extends Error{constructor(e){super(`validation failed`),this.errors=e,this.ajv=this.validation=!0}}})),pj=a((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=uj();e.default=class extends Error{constructor(e,n,r,i){super(i||`can't resolve reference ${r} from id ${n}`),this.missingRef=(0,t.resolveUrl)(e,n,r),this.missingSchema=(0,t.normalizeId)((0,t.getFullPath)(e,this.missingRef))}}})),mj=a((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.resolveSchema=e.getCompilingSchema=e.resolveRef=e.compileSchema=e.SchemaEnv=void 0;var t=Q(),n=fj(),r=QA(),i=uj(),a=$(),o=dj(),s=class{constructor(e){this.refs={},this.dynamicAnchors={};let t;typeof e.schema==`object`&&(t=e.schema),this.schema=e.schema,this.schemaId=e.schemaId,this.root=e.root||this,this.baseId=e.baseId??(0,i.normalizeId)(t?.[e.schemaId||`$id`]),this.schemaPath=e.schemaPath,this.localRefs=e.localRefs,this.meta=e.meta,this.$async=t?.$async,this.refs={}}};e.SchemaEnv=s;function c(e){let a=d.call(this,e);if(a)return a;let s=(0,i.getFullPath)(this.opts.uriResolver,e.root.baseId),{es5:c,lines:l}=this.opts.code,{ownProperties:u}=this.opts,f=new t.CodeGen(this.scope,{es5:c,lines:l,ownProperties:u}),p;e.$async&&(p=f.scopeValue(`Error`,{ref:n.default,code:(0,t._)`require("ajv/dist/runtime/validation_error").default`}));let m=f.scopeName(`validate`);e.validateName=m;let h={gen:f,allErrors:this.opts.allErrors,data:r.default.data,parentData:r.default.parentData,parentDataProperty:r.default.parentDataProperty,dataNames:[r.default.data],dataPathArr:[t.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:f.scopeValue(`schema`,this.opts.code.source===!0?{ref:e.schema,code:(0,t.stringify)(e.schema)}:{ref:e.schema}),validateName:m,ValidationError:p,schema:e.schema,schemaEnv:e,rootId:s,baseId:e.baseId||s,schemaPath:t.nil,errSchemaPath:e.schemaPath||(this.opts.jtd?``:`#`),errorPath:(0,t._)`""`,opts:this.opts,self:this},g;try{this._compilations.add(e),(0,o.validateFunctionCode)(h),f.optimize(this.opts.code.optimize);let n=f.toString();g=`${f.scopeRefs(r.default.scope)}return ${n}`,this.opts.code.process&&(g=this.opts.code.process(g,e));let i=Function(`${r.default.self}`,`${r.default.scope}`,g)(this,this.scope.get());if(this.scope.value(m,{ref:i}),i.errors=null,i.schema=e.schema,i.schemaEnv=e,e.$async&&(i.$async=!0),this.opts.code.source===!0&&(i.source={validateName:m,validateCode:n,scopeValues:f._values}),this.opts.unevaluated){let{props:e,items:n}=h;i.evaluated={props:e instanceof t.Name?void 0:e,items:n instanceof t.Name?void 0:n,dynamicProps:e instanceof t.Name,dynamicItems:n instanceof t.Name},i.source&&(i.source.evaluated=(0,t.stringify)(i.evaluated))}return e.validate=i,e}catch(t){throw delete e.validate,delete e.validateName,g&&this.logger.error(`Error compiling schema, function code:`,g),t}finally{this._compilations.delete(e)}}e.compileSchema=c;function l(e,t,n){n=(0,i.resolveUrl)(this.opts.uriResolver,t,n);let r=e.refs[n];if(r)return r;let a=p.call(this,e,n);if(a===void 0){let r=e.localRefs?.[n],{schemaId:i}=this.opts;r&&(a=new s({schema:r,schemaId:i,root:e,baseId:t}))}if(a!==void 0)return e.refs[n]=u.call(this,a)}e.resolveRef=l;function u(e){return(0,i.inlineRef)(e.schema,this.opts.inlineRefs)?e.schema:e.validate?e:c.call(this,e)}function d(e){for(let t of this._compilations)if(f(t,e))return t}e.getCompilingSchema=d;function f(e,t){return e.schema===t.schema&&e.root===t.root&&e.baseId===t.baseId}function p(e,t){let n;for(;typeof(n=this.refs[t])==`string`;)t=n;return n||this.schemas[t]||m.call(this,e,t)}function m(e,t){let n=this.opts.uriResolver.parse(t),r=(0,i._getFullPath)(this.opts.uriResolver,n),a=(0,i.getFullPath)(this.opts.uriResolver,e.baseId,void 0);if(Object.keys(e.schema).length>0&&r===a)return g.call(this,n,e);let o=(0,i.normalizeId)(r),l=this.refs[o]||this.schemas[o];if(typeof l==`string`){let t=m.call(this,e,l);return typeof t?.schema==`object`?g.call(this,n,t):void 0}if(typeof l?.schema==`object`){if(l.validate||c.call(this,l),o===(0,i.normalizeId)(t)){let{schema:t}=l,{schemaId:n}=this.opts,r=t[n];return r&&(a=(0,i.resolveUrl)(this.opts.uriResolver,a,r)),new s({schema:t,schemaId:n,root:e,baseId:a})}return g.call(this,n,l)}}e.resolveSchema=m;var h=new Set([`properties`,`patternProperties`,`enum`,`dependencies`,`definitions`]);function g(e,{baseId:t,schema:n,root:r}){if(e.fragment?.[0]!==`/`)return;for(let r of e.fragment.slice(1).split(`/`)){if(typeof n==`boolean`)return;let e=n[(0,a.unescapeFragment)(r)];if(e===void 0)return;n=e;let o=typeof n==`object`&&n[this.opts.schemaId];!h.has(r)&&o&&(t=(0,i.resolveUrl)(this.opts.uriResolver,t,o))}let o;if(typeof n!=`boolean`&&n.$ref&&!(0,a.schemaHasRulesButRef)(n,this.RULES)){let e=(0,i.resolveUrl)(this.opts.uriResolver,t,n.$ref);o=m.call(this,r,e)}let{schemaId:c}=this.opts;if(o||=new s({schema:n,schemaId:c,root:r,baseId:t}),o.schema!==o.root.schema)return o}})),hj=o({$id:()=>gj,additionalProperties:()=>!1,default:()=>xj,description:()=>_j,properties:()=>bj,required:()=>yj,type:()=>vj}),gj,_j,vj,yj,bj,xj,Sj=i((()=>{gj=`https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#`,_j=`Meta-schema for $data reference (JSON AnySchema extension proposal)`,vj=`object`,yj=[`$data`],bj={$data:{type:`string`,anyOf:[{format:`relative-json-pointer`},{format:`json-pointer`}]}},xj={$id:gj,description:_j,type:vj,required:yj,properties:bj,additionalProperties:!1}})),Cj=a(((e,t)=>{var 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),i=RegExp.prototype.test.bind(/^\d*$/u),a=RegExp.prototype.test.bind(/^[\da-f]{2}$/iu),o=RegExp.prototype.test.bind(/^[\da-z\-._~]$/iu),s=RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:@/]$/u),c=RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:@/?]$/u),l=RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:]$/u),u=Array(256);{let e=`0123456789ABCDEF`;for(let t=0;t<256;t++)u[t]=`%`+e[t>>4]+e[t&15]}function d(e){return e<2048?u[192|e>>6]+u[128|e&63]:e<65536?u[224|e>>12]+u[128|e>>6&63]+u[128|e&63]:u[240|e>>18]+u[128|e>>12&63]+u[128|e>>6&63]+u[128|e&63]}function f(e){let t=``,n=0,r=0;for(r=0;r<e.length;r++)if(n=e[r].charCodeAt(0),n!==48){if(!(n>=48&&n<=57||n>=65&&n<=70||n>=97&&n<=102))return``;t+=e[r];break}for(r+=1;r<e.length;r++){if(n=e[r].charCodeAt(0),!(n>=48&&n<=57||n>=65&&n<=70||n>=97&&n<=102))return``;t+=e[r]}return t}var 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);function _(e){if(e.length===0)return!1;for(let t=0;t<e.length;t++)if(!h(e[t])){if(e[t]===`%`&&t+2<e.length&&a(e.slice(t+1,t+3)))t+=2;else return!1}return!0}function v(e){let t=-1,n=0,r=-1,i=0;for(let a=0;a<e.length;a++)e[a]===`0`?(r===-1&&(r=a),i++,i>n&&(n=i,t=r)):(r=-1,i=0);if(n<2)return e.join(`:`);let a=e.slice(0,t).join(`:`),o=e.slice(t+n).join(`:`);return a+`::`+o}function y(e){let t=e.indexOf(`::`);if(t!==-1&&e.indexOf(`::`,t+1)!==-1)return;let n=t===-1?e.split(`:`):e.slice(0,t).split(`:`),i=t===-1?[]:e.slice(t+2).split(`:`);t!==-1&&(n.length===1&&n[0]===``&&(n.length=0),i.length===1&&i[0]===``&&(i.length=0));let a=n.concat(i),o=0;for(let e=0;e<a.length;e++){let n=a[e];if(n===``)return;if(n.indexOf(`.`)!==-1){if(e!==a.length-1||t!==-1&&i.length===0||!r(n))return;o+=2}else{if(!p(n))return;a[e]=parseInt(n,16).toString(16),o++}}if(t===-1)return o===8?v(a):void 0;if(o>=8)return;let s=a.slice(0,n.length);for(let e=o;e<8;e++)s.push(`0`);for(let e=n.length;e<a.length;e++)s.push(a[e]);return v(s)}function b(e){let t=e[0]===`[`&&e[e.length-1]===`]`;if((e[0]===`[`||e[e.length-1]===`]`)&&!t)return{host:e,isIPV6:!1,error:!0};let n=t?e.slice(1,-1):e;if(t&&m(n))return n=n.toLowerCase(),{host:`[${n}]`,escapedHost:n,isIPV6:!1,isIPVFuture:!0};if(x(n,`:`)<2)return{host:e,isIPV6:!1,error:t};let r=``,i=n.indexOf(`%`);if(i!==-1){let t=n.slice(i,i+3).toLowerCase()===`%25`?3:1;if(r=n.slice(i+t),!_(r))return{host:e,isIPV6:!1,error:!0};n=n.slice(0,i)}let a=y(n);return a===void 0?{host:e,isIPV6:!1,error:!0}:{host:a+(r?`%`+r:``),escapedHost:a+(r?`%25`+r:``),isIPV6:!0}}function x(e,t){let n=0;for(let r=0;r<e.length;r++)e[r]===t&&n++;return n}function S(e){let t=e,n=[],r=-1,i=0;for(;i=t.length;){if(i===1){if(t===`.`)break;if(t===`/`){n.push(`/`);break}n.push(t);break}if(i===2){if(t[0]===`.`){if(t[1]===`.`)break;if(t[1]===`/`){t=t.slice(2);continue}}else if(t[0]===`/`&&(t[1]===`.`||t[1]===`/`)){n.push(`/`);break}}else if(i===3&&t===`/..`){n.length!==0&&n.pop(),n.push(`/`);break}if(t[0]===`.`){if(t[1]===`.`){if(t[2]===`/`){t=t.slice(3);continue}}else if(t[1]===`/`){t=t.slice(2);continue}}else if(t[0]===`/`&&t[1]===`.`){if(t[2]===`/`){t=t.slice(2);continue}if(t[2]===`.`&&t[3]===`/`){t=t.slice(3),n.length!==0&&n.pop();continue}}if((r=t.indexOf(`/`,1))===-1){n.push(t);break}n.push(t.slice(0,r)),t=t.slice(r)}return n.join(``)}function C(e){if(e===``||e[0]===`/`)return S(e);let t=e.split(`/`),n=t.length-1,r=[],i=!1;for(let e=0;e<=n;e++){let a=t[e];a===`.`||a===`..`?(a===`..`&&(r.length!==0&&r[r.length-1]!==`..`?r.pop():r.push(`..`)),i=e===n):r.push(a)}return i&&r[r.length-1]!==`..`&&r.push(``),(r.length===0||r[0]===``||r[0].includes(`:`))&&r.unshift(`.`),r.join(`/`)}var w={"@":`%40`,"/":`%2F`,"?":`%3F`,"#":`%23`,":":`%3A`},ee=/[@/?#:]/g,T=/[@/?#]/g;function te(e,t){let n=t?T:ee;return n.lastIndex=0,e.replace(n,e=>w[e])}function ne(e,t=!1){if(e.indexOf(`%`)===-1)return e;let n=``;for(let r=0;r<e.length;r++){if(e[r]===`%`&&r+2<e.length){let i=e.slice(r+1,r+3);if(a(i)){let e=i.toUpperCase(),a=String.fromCharCode(parseInt(e,16));t&&o(a)?n+=a:n+=`%`+e,r+=2;continue}}n+=e[r]}return n}function re(e){let t=``;for(let n=0;n<e.length;n++){let r=e[n];if(r===`%`&&n+2<e.length){let r=e.slice(n+1,n+3);if(a(r)){let e=r.toUpperCase(),i=String.fromCharCode(parseInt(e,16));i!==`.`&&o(i)?t+=i:t+=`%`+e,n+=2;continue}}if(s(r))t+=r;else{let i=e.charCodeAt(n);if(i<128)t+=le(i)?r:u[i];else if(i<55296||i>57343)t+=d(i);else if(i<=56319&&n+1<e.length){let r=e.charCodeAt(n+1);r>=56320&&r<=57343?(t+=d(65536+(i-55296<<10)+(r-56320)),n++):t+=d(65533)}else t+=d(65533)}}return t}function ie(e,t=!1){let n=``,r=t&&e[0]!==`/`;for(let t=0;t<e.length;t++){let i=e[t];if(i===`%`&&t+2<e.length){let r=e.slice(t+1,t+3);if(a(r)){n+=`%`+r.toUpperCase(),t+=2;continue}}if(i===`/`&&(r=!1),s(i)&&(i!==`:`||!r))n+=i;else{let r=e.charCodeAt(t);if(r<128)n+=u[r];else if(r<55296||r>57343)n+=d(r);else if(r<=56319&&t+1<e.length){let i=e.charCodeAt(t+1);i>=56320&&i<=57343?(n+=d(65536+(r-55296<<10)+(i-56320)),t++):n+=d(65533)}else n+=d(65533)}}return n}function ae(e,t){let n=``;for(let r=0;r<e.length;r++){let i=e[r];if(i===`%`&&r+2<e.length){let t=e.slice(r+1,r+3);if(a(t)){n+=`%`+t.toUpperCase(),r+=2;continue}}if(t(i))n+=i;else{let t=e.charCodeAt(r);if(t<128)n+=u[t];else if(t<55296||t>57343)n+=d(t);else if(t<=56319&&r+1<e.length){let i=e.charCodeAt(r+1);i>=56320&&i<=57343?(n+=d(65536+(t-55296<<10)+(i-56320)),r++):n+=d(65533)}else n+=d(65533)}}return n}function oe(e){return ae(e,l)}function se(e){return ae(e,c)}function ce(e){return ae(e,c)}function le(e){return e>=48&&e<=57||e>=65&&e<=90||e>=97&&e<=122||e===42||e===43||e===45||e===46||e===47||e===64||e===95}function ue(e){let t=``;for(let n=0;n<e.length;n++){let r=e[n];if(r===`%`&&n+2<e.length){let r=e.slice(n+1,n+3);if(a(r)){let e=r.toUpperCase(),i=String.fromCharCode(parseInt(e,16));o(i)?t+=i:t+=`%`+e,n+=2;continue}}if(c(r))t+=r;else{let i=e.charCodeAt(n);if(i<128)t+=le(i)?r:u[i];else if(i<55296||i>57343)t+=d(i);else if(i<=56319&&n+1<e.length){let r=e.charCodeAt(n+1);r>=56320&&r<=57343?(t+=d(65536+(i-55296<<10)+(r-56320)),n++):t+=d(65533)}else t+=d(65533)}}return t}function de(e){let t=``;for(let n=0;n<e.length;n++){if(e[n]===`%`&&n+2<e.length){let r=e.slice(n+1,n+3);if(a(r)){t+=`%`+r.toUpperCase(),n+=2;continue}}t+=escape(e[n])}return t}function fe(e){let t=[];if(e.userinfo!==void 0&&(t.push(oe(e.userinfo)),t.push(`@`)),e.host!==void 0){let n=e.host;if(!r(n)){let e=b(n);e.isIPV6!==!0&&e.isIPVFuture!==!0&&(n=ne(n,!0),e=b(n)),n=e.isIPV6===!0||e.isIPVFuture===!0?`[${e.escapedHost}]`:te(n,!1)}t.push(n)}if(typeof e.port==`number`||typeof e.port==`string`){let n=String(e.port);if(!i(n))throw TypeError(`URI port is malformed.`);t.push(`:`),t.push(n)}return t.length?t.join(``):void 0}t.exports={nonSimpleDomain:g,recomposeAuthority:fe,reescapeHostDelimiters:te,normalizePercentEncoding:ne,normalizePathEncoding:re,serializePathEncoding:ie,normalizeQueryFragmentEncoding:ue,encodeUserinfo:oe,encodeQuery:se,encodeFragment:ce,escapePreservingEscapes:de,removeDotSegments:S,removeDotSegmentsRelative:C,isIPv4:r,isUUID:n,normalizeIPv6:b,stringArrayToHexStripped:f}})),wj=a(((e,t)=>{var{isUUID:n}=Cj(),r=/^([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-./:;=@]|%[\da-f]{2})+)$/iu,i=[`http`,`https`,`ws`,`wss`,`urn`,`urn:uuid`];function a(e){return i.indexOf(e)!==-1}function o(e){return e.secure===!0?!0:e.secure===!1?!1:e.scheme?e.scheme.length===3&&(e.scheme[0]===`w`||e.scheme[0]===`W`)&&(e.scheme[1]===`s`||e.scheme[1]===`S`)&&(e.scheme[2]===`s`||e.scheme[2]===`S`):!1}function s(e){return e.host||(e.error=e.error||`HTTP URIs must have a host.`),e}function c(e){let t=String(e.scheme).toLowerCase()===`https`;return(e.port===(t?443:80)||e.port===``)&&(e.port=void 0),e.path||=`/`,e}function l(e){return e.secure=o(e),e.resourceName=(e.path||`/`)+(e.query?`?`+e.query:``),e.path=void 0,e.query=void 0,e}function u(e){if((e.port===(o(e)?443:80)||e.port===``)&&(e.port=void 0),typeof e.secure==`boolean`&&(e.scheme=e.secure?`wss`:`ws`,e.secure=void 0),e.resourceName){let t=e.resourceName.indexOf(`?`),n=t===-1?e.resourceName:e.resourceName.slice(0,t);e.path=n&&n!==`/`?n:void 0,e.query=t===-1?void 0:e.resourceName.slice(t+1),e.resourceName=void 0}return e.fragment=void 0,e}function d(e,t){if(!e.path)return e.error=`URN can not be parsed`,e;let n=e.path.match(r);if(n&&n[0]===e.path){let r=t.scheme||e.scheme||`urn`;e.nid=n[1].toLowerCase(),e.nss=n[2];let i=y(`${r}:${t.nid||e.nid}`);e.path=void 0,i&&(e=i.parse(e,t))}else e.error=e.error||`URN can not be parsed.`;return e}function f(e,t){if(e.nid===void 0)throw Error(`URN without nid cannot be serialized`);let n=t.scheme||e.scheme||`urn`,r=e.nid.toLowerCase(),i=y(`${n}:${t.nid||r}`);i&&(e=i.serialize(e,t));let a=e,o=e.nss;return a.path=`${r||t.nid}:${o}`,t.skipEscape=!0,a}function p(e,t){let r=e;return r.uuid=r.nss,r.nss=void 0,t.tolerant||r.uuid&&n(r.uuid)||(r.error=r.error||`UUID is not valid.`),r}function m(e){let t=e;return t.nss=(e.uuid||``).toLowerCase(),t}var h={scheme:`http`,domainHost:!0,parse:s,serialize:c},g={scheme:`https`,domainHost:h.domainHost,parse:s,serialize:c},_={scheme:`ws`,domainHost:!0,parse:l,serialize:u},v={http:h,https:g,ws:_,wss:{scheme:`wss`,domainHost:_.domainHost,parse:_.parse,serialize:_.serialize},urn:{scheme:`urn`,parse:d,serialize:f,skipNormalize:!0},"urn:uuid":{scheme:`urn:uuid`,parse:p,serialize:m,skipNormalize:!0}};Object.setPrototypeOf(v,null);function y(e){return e&&(v[e]||v[e.toLowerCase()])||void 0}t.exports={wsIsSecure:o,SCHEMES:v,isValidSchemeName:a,getSchemeHandler:y}})),Tj=a(((e,t)=>{var{normalizeIPv6:n,removeDotSegments:r,removeDotSegmentsRelative:i,recomposeAuthority:a,normalizePercentEncoding:o,normalizePathEncoding:s,serializePathEncoding:c,normalizeQueryFragmentEncoding:l,encodeQuery:u,encodeFragment:d,reescapeHostDelimiters:f,isIPv4:p,nonSimpleDomain:m}=Cj(),{SCHEMES:h,getSchemeHandler:g}=wj(),_=/^[A-Za-z][A-Za-z0-9+.-]*$/u,v=`URI scheme is malformed.`,y=`URI host is malformed.`,b=/[\0-\x20"#/:<>?@[\\\]^`{|}\x7F]/u;function x(e){let t=String(e);if(!_.test(t))throw TypeError(v);return t}function S(e,t){return typeof e==`string`?e=pe(e,t):typeof e==`object`&&(e=fe(T(e,t),t)),e}function C(e,t,r){let i=r?Object.assign({scheme:`null`},r):{scheme:`null`},{parsed:a,malformedAuthorityOrPort:o,malformedPercentEncoding:s,malformedSchemeSpecific:c,malformedHost:l,malformedScheme:u}=de(e,i),{parsed:d,malformedAuthorityOrPort:f,malformedPercentEncoding:m,malformedSchemeSpecific:h,malformedHost:_,malformedScheme:v}=de(t,i);if(o||f||s||m||c||h||l||_||u||v)throw Error(a.error||d.error||`URI is malformed.`);let b=w(a,d,i,!0),x=g(r&&r.scheme||b.scheme),S=b.host,C=S!==void 0&&S!==``&&(p(S)||n(S).isIPV6);if(le(b,r||{},x,C))throw Error(y);ce(b,r||{},x,C);let ee=S&&S.indexOf(`%`)!==-1&&!/\P{ASCII}/u.test(S);if(b.error&&!ee)throw Error(b.error);return i.skipEscape=!0,T(b,i)}function w(e,t,n,a){let o={};if(a||(e=fe(T(e,n),n),t=fe(T(t,n),n)),n||={},!n.tolerant&&t.scheme)o.scheme=t.scheme,o.userinfo=t.userinfo,o.host=t.host,o.port=t.port,o.path=r(t.path||``),o.query=t.query;else{if(t.userinfo!==void 0||t.host!==void 0||t.port!==void 0)o.userinfo=t.userinfo,o.host=t.host,o.port=t.port,o.path=r(t.path||``),o.query=t.query;else{if(!t.path)o.path=e.path,o.query=t.query===void 0?e.query:t.query;else{if(t.path[0]===`/`)o.path=r(t.path);else{let n=e.userinfo!==void 0||e.host!==void 0||e.port!==void 0;o.path=n&&!e.path?`/`+t.path:e.path?e.path.slice(0,e.path.lastIndexOf(`/`)+1)+t.path:t.path,o.path=e.scheme===void 0&&!n&&o.path[0]!==`/`?i(o.path):r(o.path)}o.query=t.query}o.userinfo=e.userinfo,o.host=e.host,o.port=e.port}o.scheme=e.scheme}return o.fragment=t.fragment,o}function ee(e,t,n){let r=he(e,n),i=he(t,n);return r!==void 0&&i!==void 0&&r===i}function T(e,t){let n={host:e.host,scheme:e.scheme,userinfo:e.userinfo,port:e.port,path:e.path,query:e.query,nid:e.nid,nss:e.nss,uuid:e.uuid,fragment:e.fragment,reference:e.reference,resourceName:e.resourceName,secure:e.secure,error:``},s=Object.assign({},t),l=[];n.scheme&&=x(n.scheme);let f=g(s.scheme||n.scheme);f&&f.serialize&&f.serialize(n,s);let p=n.userinfo!==void 0||n.host!==void 0||n.port!==void 0,m=(n.scheme===void 0||s.reference===`suffix`)&&!p,h=!s.skipEscape&&m;n.path!==void 0&&(n.path=s.skipEscape?o(n.path):c(n.path,h)),s.reference!==`suffix`&&n.scheme&&(n.scheme=x(n.scheme),l.push(n.scheme,`:`));let _=a(n);if(_!==void 0&&(s.reference!==`suffix`&&l.push(`//`),l.push(_),n.path&&n.path[0]!==`/`&&l.push(`/`)),n.path!==void 0){let e=n.path;s.absolutePath||f&&f.absolutePath||(e=m&&e[0]!==`/`?i(e):r(e)),m&&(e=c(e,!0)),_===void 0&&e[0]===`/`&&e[1]===`/`&&(e=`/%2F`+e.slice(2)),l.push(e)}return n.query!==void 0&&l.push(`?`,u(n.query)),n.fragment!==void 0&&l.push(`#`,d(n.fragment)),l.join(``)}var te=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u,ne=/^(?:[^#/:?]+:)?\/\/([^/?#]*)/,re=/^(?:[^#/:?]+:)?([/\\\t\n\r]*)/;function ie(e,t){if(t[2]!==void 0&&e.path&&e.path[0]!==`/`)return`URI path must start with "/" when authority is present.`;if(typeof e.port==`number`&&(e.port<0||e.port>65535))return`URI port is malformed.`}function ae(e){if(e===void 0)return!1;let t=e.indexOf(`%`);for(;t!==-1;){if(t+2>=e.length||!/^[\da-f]{2}$/iu.test(e.slice(t+1,t+3)))return!0;t=e.indexOf(`%`,t+3)}return!1}function oe(e){return e[0]===`[`&&e[e.length-1]===`]`}function se(e){let t=e[4];return ae(e[3])||t!==void 0&&!oe(t)&&ae(t)||ae(e[6])||ae(e[7])||ae(e[8])}function ce(e,t,n,r){if(le(e,t,n,r))return e.error=e.error||y,!0;if(!t.unicodeSupport&&(!n||!n.unicodeSupport)&&e.host&&!oe(e.host)&&(t.domainHost||n&&n.domainHost)&&r===!1&&m(e.host)){let t;try{t=new URL(`http://`+e.host)}catch(t){return e.error=e.error||`Host's domain name can not be converted to ASCII: `+t,!0}if(!ue(t))return e.error=e.error||y,!0;e.host=t.hostname}return!1}function le(e,t,n,r){return!!(e.host&&r===!1&&!oe(e.host)&&(t.domainHost||n&&n.domainHost)&&b.test(e.host))}function ue(e){return e.username===``&&e.password===``&&e.port===``&&e.pathname===`/`&&e.search===``&&e.hash===``&&e.hostname!==``}function de(e,t){let r=Object.assign({},t),i={scheme:void 0,userinfo:void 0,host:``,port:void 0,path:``,query:void 0,fragment:void 0},a=!1,c=!1,u=!1,d=!1,m=!1,b=!1,x=!1;r.reference===`suffix`&&(e=r.scheme?r.scheme+`:`+e:`//`+e);let S=e.match(ne);S!==null&&S[1].indexOf(`\\`)!==-1&&(i.error=`URI authority must not contain a literal backslash.`,a=!0);let C=e.match(re);if(C!==null){let e=C[1],t=e.replace(/[\t\n\r]/g,``);t.length>=2&&(t.slice(0,2)===`//`?e.length!==t.length&&(i.error=i.error||`URI authority introducer must not contain whitespace.`,a=!0):(i.error=i.error||`URI authority must not contain a literal backslash.`,a=!0))}let w=e.match(te);if(w){i.scheme=w[1],i.userinfo=w[3],i.host=w[4],i.port=parseInt(w[5],10),i.path=w[6]||``,i.query=w[7],i.fragment=w[8],i.scheme!==void 0&&(_.test(i.scheme)?i.scheme=i.scheme.toLowerCase():(i.error=i.error||v,b=!0)),c=se(w),c&&(i.error=i.error||`URI contains malformed percent-encoding.`),isNaN(i.port)&&(i.port=w[5]);let t=ie(i,w);if(t!==void 0&&(i.error=i.error||t,a=!0),i.host){if(p(i.host)===!1){let e=oe(i.host),t=i.host.indexOf(`[`)!==-1||i.host.indexOf(`]`)!==-1,r=n(i.host);x=r.isIPV6||r.isIPVFuture===!0,m=t&&(!e||r.error===!0),i.host=x?r.host:r.host.toLowerCase(),m&&(i.error=i.error||y,a=!0)}else x=!0}i.reference=i.scheme===void 0&&i.userinfo===void 0&&i.host===void 0&&i.port===void 0&&i.query===void 0&&!i.path?`same-document`:i.scheme===void 0?`relative`:i.fragment===void 0?`absolute`:`uri`,r.reference&&r.reference!==`suffix`&&r.reference!==i.reference&&(i.error=i.error||`URI is not a `+r.reference+` reference.`);let S=g(r.scheme||i.scheme);if(m||(d=ce(i,r,S,x)),e.indexOf(`%`)!==-1&&i.host!==void 0&&!m){let e=x?i.host:o(i.host,!0);x||(e=o(e.toLowerCase())),i.host=x||r.scheme!==`null`?f(e,x):e}(!S||S&&!S.skipNormalize)&&(i.path&&=s(i.path),i.query&&=l(i.query),i.fragment&&=l(i.fragment)),S&&S.parse&&(S.parse(i,r),S===h.urn&&i.nid===void 0&&(u=!0))}else i.error=i.error||`URI can not be parsed.`;return{parsed:i,malformedAuthorityOrPort:a,malformedPercentEncoding:c,malformedSchemeSpecific:u,malformedHost:d,malformedScheme:b}}function fe(e,t){return de(e,t).parsed}function pe(e,t){return me(e,t).normalized}function me(e,t){let{parsed:n,malformedAuthorityOrPort:r,malformedPercentEncoding:i,malformedSchemeSpecific:a,malformedHost:o,malformedScheme:s}=de(e,t);return{normalized:r||i||a||o||s?e:T(n,t),malformedAuthorityOrPort:r,malformedPercentEncoding:i,malformedSchemeSpecific:a,malformedHost:o,malformedScheme:s}}function he(e,t){if(typeof e!=`string`&&typeof e!=`object`)return;let n;try{n=typeof e==`string`?e:T(e,t)}catch{return}let{normalized:r,malformedAuthorityOrPort:i,malformedPercentEncoding:a,malformedSchemeSpecific:o,malformedHost:s,malformedScheme:c}=me(n,t);return i||a||o||s||c?void 0:r}var ge={SCHEMES:h,normalize:S,resolve:C,resolveComponent:w,equal:ee,serialize:T,parse:fe};t.exports=ge,t.exports.default=ge,t.exports.fastUri=ge})),Ej=a((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=Tj();t.code=`require("ajv/dist/runtime/uri").default`,e.default=t})),Dj=a((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.CodeGen=e.Name=e.nil=e.stringify=e.str=e._=e.KeywordCxt=void 0;var t=dj();Object.defineProperty(e,"KeywordCxt",{enumerable:!0,get:function(){return t.KeywordCxt}});var n=Q();Object.defineProperty(e,"_",{enumerable:!0,get:function(){return n._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return n.str}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return n.stringify}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return n.nil}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return n.Name}}),Object.defineProperty(e,"CodeGen",{enumerable:!0,get:function(){return n.CodeGen}});var r=fj(),i=pj(),a=tj(),o=mj(),s=Q(),l=uj(),u=rj(),d=$(),f=(Sj(),c(hj).default),p=Ej(),m=(e,t)=>new RegExp(e,t);m.code=`new RegExp`;var h=[`removeAdditional`,`useDefaults`,`coerceTypes`],g=new Set([`validate`,`serialize`,`parse`,`wrapper`,`root`,`schema`,`keyword`,`pattern`,`formats`,`validate$data`,`func`,`obj`,`Error`]),_={errorDataPath:``,format:"`validateFormats: false` can be used instead.",nullable:`"nullable" keyword is supported by default.`,jsonPointers:`Deprecated jsPropertySyntax can be used instead.`,extendRefs:`Deprecated ignoreKeywordsWithRef can be used instead.`,missingRefs:`Pass empty schema with $id that should be ignored to ajv.addSchema.`,processCode:"Use option `code: {process: (code, schemaEnv: object) => string}`",sourceCode:"Use option `code: {source: true}`",strictDefaults:"It is default now, see option `strict`.",strictKeywords:"It is default now, see option `strict`.",uniqueItems:`"uniqueItems" keyword is always validated.`,unknownFormats:"Disable strict mode or pass `true` to `ajv.addFormat` (or `formats` option).",cache:`Map is used as cache, schema object as key.`,serialize:`Map is used as cache, schema object as key.`,ajvErrors:`It is default now.`},v={ignoreKeywordsWithRef:``,jsPropertySyntax:``,unicode:`"minLength"/"maxLength" account for unicode characters by default.`},y=200;function b(e){let t=e.strict,n=e.code?.optimize,r=n===!0||n===void 0?1:n||0,i=e.code?.regExp??m,a=e.uriResolver??p.default;return{strictSchema:e.strictSchema??t??!0,strictNumbers:e.strictNumbers??t??!0,strictTypes:e.strictTypes??t??`log`,strictTuples:e.strictTuples??t??`log`,strictRequired:e.strictRequired??t??!1,code:e.code?{...e.code,optimize:r,regExp:i}:{optimize:r,regExp:i},loopRequired:e.loopRequired??y,loopEnum:e.loopEnum??y,meta:e.meta??!0,messages:e.messages??!0,inlineRefs:e.inlineRefs??!0,schemaId:e.schemaId??`$id`,addUsedSchema:e.addUsedSchema??!0,validateSchema:e.validateSchema??!0,validateFormats:e.validateFormats??!0,unicodeRegExp:e.unicodeRegExp??!0,int32range:e.int32range??!0,uriResolver:a}}var x=class{constructor(e={}){this.schemas={},this.refs={},this.formats=Object.create(null),this._compilations=new Set,this._loading={},this._cache=new Map,e=this.opts={...e,...b(e)};let{es5:t,lines:n}=this.opts.code;this.scope=new s.ValueScope({scope:{},prefixes:g,es5:t,lines:n}),this.logger=re(e.logger);let r=e.validateFormats;e.validateFormats=!1,this.RULES=(0,a.getRules)(),S.call(this,_,e,`NOT SUPPORTED`),S.call(this,v,e,`DEPRECATED`,`warn`),this._metaOpts=te.call(this),e.formats&&ee.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),e.keywords&&T.call(this,e.keywords),typeof e.meta==`object`&&this.addMetaSchema(e.meta),w.call(this),e.validateFormats=r}_addVocabularies(){this.addKeyword(`$async`)}_addDefaultMetaSchema(){let{$data:e,meta:t,schemaId:n}=this.opts,r=f;n===`id`&&(r={...f},r.id=r.$id,delete r.$id),t&&e&&this.addMetaSchema(r,r[n],!1)}defaultMeta(){let{meta:e,schemaId:t}=this.opts;return this.opts.defaultMeta=typeof e==`object`?e[t]||e:void 0}validate(e,t){let n;if(typeof e==`string`){if(n=this.getSchema(e),!n)throw Error(`no schema with key or ref "${e}"`)}else n=this.compile(e);let r=n(t);return`$async`in n||(this.errors=n.errors),r}compile(e,t){let n=this._addSchema(e,t);return n.validate||this._compileSchemaEnv(n)}compileAsync(e,t){if(typeof this.opts.loadSchema!=`function`)throw Error(`options.loadSchema should be a function`);let{loadSchema:n}=this.opts;return r.call(this,e,t);async function r(e,t){await a.call(this,e.$schema);let n=this._addSchema(e,t);return n.validate||o.call(this,n)}async function a(e){e&&!this.getSchema(e)&&await r.call(this,{$ref:e},!0)}async function o(e){try{return this._compileSchemaEnv(e)}catch(t){if(!(t instanceof i.default))throw t;return s.call(this,t),await c.call(this,t.missingSchema),o.call(this,e)}}function s({missingSchema:e,missingRef:t}){if(this.refs[e])throw Error(`AnySchema ${e} is loaded but ${t} cannot be resolved`)}async function c(e){let n=await l.call(this,e);this.refs[e]||await a.call(this,n.$schema),this.refs[e]||this.addSchema(n,e,t)}async function l(e){let t=this._loading[e];if(t)return t;try{return await(this._loading[e]=n(e))}finally{delete this._loading[e]}}}addSchema(e,t,n,r=this.opts.validateSchema){if(Array.isArray(e)){for(let t of e)this.addSchema(t,void 0,n,r);return this}let i;if(typeof e==`object`){let{schemaId:t}=this.opts;if(i=e[t],i!==void 0&&typeof i!=`string`)throw Error(`schema ${t} must be string`)}return t=(0,l.normalizeId)(t||i),this._checkUnique(t),this.schemas[t]=this._addSchema(e,n,t,r,!0),this}addMetaSchema(e,t,n=this.opts.validateSchema){return this.addSchema(e,t,!0,n),this}validateSchema(e,t){if(typeof e==`boolean`)return!0;let n;if(n=e.$schema,n!==void 0&&typeof n!=`string`)throw Error(`$schema must be a string`);if(n=n||this.opts.defaultMeta||this.defaultMeta(),!n)return this.logger.warn(`meta-schema not available`),this.errors=null,!0;let r=this.validate(n,e);if(!r&&t){let e=`schema is invalid: `+this.errorsText();if(this.opts.validateSchema===`log`)this.logger.error(e);else throw Error(e)}return r}getSchema(e){let t;for(;typeof(t=C.call(this,e))==`string`;)e=t;if(t===void 0){let{schemaId:n}=this.opts,r=new o.SchemaEnv({schema:{},schemaId:n});if(t=o.resolveSchema.call(this,r,e),!t)return;this.refs[e]=t}return t.validate||this._compileSchemaEnv(t)}removeSchema(e){if(e instanceof RegExp)return this._removeAllSchemas(this.schemas,e),this._removeAllSchemas(this.refs,e),this;switch(typeof e){case`undefined`:return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case`string`:{let t=C.call(this,e);return typeof t==`object`&&this._cache.delete(t.schema),delete this.schemas[e],delete this.refs[e],this}case`object`:{let t=e;this._cache.delete(t);let n=e[this.opts.schemaId];return n&&(n=(0,l.normalizeId)(n),delete this.schemas[n],delete this.refs[n]),this}default:throw Error(`ajv.removeSchema: invalid parameter`)}}addVocabulary(e){for(let t of e)this.addKeyword(t);return this}addKeyword(e,t){let n;if(typeof e==`string`)n=e,typeof t==`object`&&(this.logger.warn(`these parameters are deprecated, see docs for addKeyword`),t.keyword=n);else if(typeof e==`object`&&t===void 0){if(t=e,n=t.keyword,Array.isArray(n)&&!n.length)throw Error(`addKeywords: keyword must be string or non-empty array`)}else throw Error(`invalid addKeywords parameters`);if(ae.call(this,n,t),!t)return(0,d.eachItem)(n,e=>oe.call(this,e)),this;ce.call(this,t);let r={...t,type:(0,u.getJSONTypes)(t.type),schemaType:(0,u.getJSONTypes)(t.schemaType)};return(0,d.eachItem)(n,r.type.length===0?e=>oe.call(this,e,r):e=>r.type.forEach(t=>oe.call(this,e,r,t))),this}getKeyword(e){let t=this.RULES.all[e];return typeof t==`object`?t.definition:!!t}removeKeyword(e){let{RULES:t}=this;delete t.keywords[e],delete t.all[e];for(let n of t.rules){let t=n.rules.findIndex(t=>t.keyword===e);t>=0&&n.rules.splice(t,1)}return this}addFormat(e,t){return typeof t==`string`&&(t=new RegExp(t)),this.formats[e]=t,this}errorsText(e=this.errors,{separator:t=`, `,dataVar:n=`data`}={}){return!e||e.length===0?`No errors`:e.map(e=>`${n}${e.instancePath} ${e.message}`).reduce((e,n)=>e+t+n)}$dataMetaSchema(e,t){let n=this.RULES.all;e=JSON.parse(JSON.stringify(e));for(let r of t){let t=r.split(`/`).slice(1),i=e;for(let e of t)i=i[e];for(let e in n){let t=n[e];if(typeof t!=`object`)continue;let{$data:r}=t.definition,a=i[e];r&&a&&(i[e]=ue(a))}}return e}_removeAllSchemas(e,t){for(let n in e){let r=e[n];(!t||t.test(n))&&(typeof r==`string`?delete e[n]:r&&!r.meta&&(this._cache.delete(r.schema),delete e[n]))}}_addSchema(e,t,n,r=this.opts.validateSchema,i=this.opts.addUsedSchema){let a,{schemaId:s}=this.opts;if(typeof e==`object`)a=e[s];else if(this.opts.jtd)throw Error(`schema must be object`);else if(typeof e!=`boolean`)throw Error(`schema must be object or boolean`);let c=this._cache.get(e);if(c!==void 0)return c;n=(0,l.normalizeId)(a||n);let u=l.getSchemaRefs.call(this,e,n);return c=new o.SchemaEnv({schema:e,schemaId:s,meta:t,baseId:n,localRefs:u}),this._cache.set(c.schema,c),i&&!n.startsWith(`#`)&&(n&&this._checkUnique(n),this.refs[n]=c),r&&this.validateSchema(e,!0),c}_checkUnique(e){if(this.schemas[e]||this.refs[e])throw Error(`schema with key or id "${e}" already exists`)}_compileSchemaEnv(e){if(e.meta?this._compileMetaSchema(e):o.compileSchema.call(this,e),!e.validate)throw Error(`ajv implementation error`);return e.validate}_compileMetaSchema(e){let t=this.opts;this.opts=this._metaOpts;try{o.compileSchema.call(this,e)}finally{this.opts=t}}};x.ValidationError=r.default,x.MissingRefError=i.default,e.default=x;function S(e,t,n,r=`error`){for(let i in e){let a=i;a in t&&this.logger[r](`${n}: option ${i}. ${e[a]}`)}}function C(e){return e=(0,l.normalizeId)(e),this.schemas[e]||this.refs[e]}function w(){let e=this.opts.schemas;if(e){if(Array.isArray(e))this.addSchema(e);else for(let t in e)this.addSchema(e[t],t)}}function ee(){for(let e in this.opts.formats){let t=this.opts.formats[e];t&&this.addFormat(e,t)}}function T(e){if(Array.isArray(e))this.addVocabulary(e);else{this.logger.warn(`keywords option as map is deprecated, pass array`);for(let t in e){let n=e[t];n.keyword||=t,this.addKeyword(n)}}}function te(){let e={...this.opts};for(let t of h)delete e[t];return e}var ne={log(){},warn(){},error(){}};function re(e){if(e===!1)return ne;if(e===void 0)return console;if(e.log&&e.warn&&e.error)return e;throw Error(`logger must implement log, warn and error methods`)}var ie=/^[a-z_$][a-z0-9_$:-]*$/i;function ae(e,t){let{RULES:n}=this;if((0,d.eachItem)(e,e=>{if(n.keywords[e])throw Error(`Keyword ${e} is already defined`);if(!ie.test(e))throw Error(`Keyword ${e} has invalid name`)}),t&&t.$data&&!(`code`in t||`validate`in t))throw Error(`$data keyword must have "code" or "validate" function`)}function oe(e,t,n){var r;let i=t?.post;if(n&&i)throw Error(`keyword with "post" flag cannot have "type"`);let{RULES:a}=this,o=i?a.post:a.rules.find(({type:e})=>e===n);if(o||(o={type:n,rules:[]},a.rules.push(o)),a.keywords[e]=!0,!t)return;let s={keyword:e,definition:{...t,type:(0,u.getJSONTypes)(t.type),schemaType:(0,u.getJSONTypes)(t.schemaType)}};t.before?se.call(this,o,s,t.before):o.rules.push(s),a.all[e]=s,(r=t.implements)==null||r.forEach(e=>this.addKeyword(e))}function se(e,t,n){let r=e.rules.findIndex(e=>e.keyword===n);r>=0?e.rules.splice(r,0,t):(e.rules.push(t),this.logger.warn(`rule ${n} is not defined`))}function ce(e){let{metaSchema:t}=e;t!==void 0&&(e.$data&&this.opts.$data&&(t=ue(t)),e.validateSchema=this.compile(t,!0))}var le={$ref:`https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#`};function ue(e){return{anyOf:[e,le]}}})),Oj=a((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default={keyword:`id`,code(){throw Error(`NOT SUPPORTED: keyword "id", use "$id" for schema ID`)}}})),kj=a((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.callRef=e.getValidate=void 0;var t=pj(),n=aj(),r=Q(),i=QA(),a=mj(),o=$(),s={keyword:`$ref`,schemaType:`string`,code(e){let{gen:n,schema:i,it:o}=e,{baseId:s,schemaEnv:u,validateName:d,opts:f,self:p}=o,{root:m}=u;if((i===`#`||i===`#/`)&&s===m.baseId)return g();let h=a.resolveRef.call(p,m,s,i);if(h===void 0)throw new t.default(o.opts.uriResolver,s,i);return h instanceof a.SchemaEnv?_(h):v(h);function g(){if(u===m)return l(e,d,u,u.$async);let t=n.scopeValue(`root`,{ref:m});return l(e,(0,r._)`${t}.validate`,m,m.$async)}function _(t){l(e,c(e,t),t,t.$async)}function v(t){let a=n.scopeValue(`schema`,f.code.source===!0?{ref:t,code:(0,r.stringify)(t)}:{ref:t}),o=n.name(`valid`),s=e.subschema({schema:t,dataTypes:[],schemaPath:r.nil,topSchemaRef:a,errSchemaPath:i},o);e.mergeEvaluated(s),e.ok(o)}}};function c(e,t){let{gen:n}=e;return t.validate?n.scopeValue(`validate`,{ref:t.validate}):(0,r._)`${n.scopeValue(`wrapper`,{ref:t})}.validate`}e.getValidate=c;function l(e,t,a,s){let{gen:c,it:l}=e,{allErrors:u,schemaEnv:d,opts:f}=l,p=f.passContext?i.default.this:r.nil;s?m():h();function m(){if(!d.$async)throw Error(`async schema referenced by sync schema`);let i=c.let(`valid`);c.try(()=>{c.code((0,r._)`await ${(0,n.callValidateCode)(e,t,p)}`),_(t),u||c.assign(i,!0)},e=>{c.if((0,r._)`!(${e} instanceof ${l.ValidationError})`,()=>c.throw(e)),g(e),u||c.assign(i,!1)}),e.ok(i)}function h(){e.result((0,n.callValidateCode)(e,t,p),()=>_(t),()=>g(t))}function g(e){let t=(0,r._)`${e}.errors`;c.assign(i.default.vErrors,(0,r._)`${i.default.vErrors} === null ? ${t} : ${i.default.vErrors}.concat(${t})`),c.assign(i.default.errors,(0,r._)`${i.default.vErrors}.length`)}function _(e){if(!l.opts.unevaluated)return;let t=a?.validate?.evaluated;if(l.props!==!0){if(t&&!t.dynamicProps)t.props!==void 0&&(l.props=o.mergeEvaluated.props(c,t.props,l.props));else{let t=c.var(`props`,(0,r._)`${e}.evaluated.props`);l.props=o.mergeEvaluated.props(c,t,l.props,r.Name)}}if(l.items!==!0){if(t&&!t.dynamicItems)t.items!==void 0&&(l.items=o.mergeEvaluated.items(c,t.items,l.items));else{let t=c.var(`items`,(0,r._)`${e}.evaluated.items`);l.items=o.mergeEvaluated.items(c,t,l.items,r.Name)}}}}e.callRef=l,e.default=s})),Aj=a((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=Oj(),n=kj();e.default=[`$schema`,`$id`,`$defs`,`$vocabulary`,{keyword:`$comment`},`definitions`,t.default,n.default]})),jj=a((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=Q(),n=t.operators,r={maximum:{okStr:`<=`,ok:n.LTE,fail:n.GT},minimum:{okStr:`>=`,ok:n.GTE,fail:n.LT},exclusiveMaximum:{okStr:`<`,ok:n.LT,fail:n.GTE},exclusiveMinimum:{okStr:`>`,ok:n.GT,fail:n.LTE}};e.default={keyword:Object.keys(r),type:`number`,schemaType:`number`,$data:!0,error:{message:({keyword:e,schemaCode:n})=>(0,t.str)`must be ${r[e].okStr} ${n}`,params:({keyword:e,schemaCode:n})=>(0,t._)`{comparison: ${r[e].okStr}, limit: ${n}}`},code(e){let{keyword:n,data:i,schemaCode:a}=e;e.fail$data((0,t._)`${i} ${r[n].fail} ${a} || isNaN(${i})`)}}})),Mj=a((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=Q();e.default={keyword:`multipleOf`,type:`number`,schemaType:`number`,$data:!0,error:{message:({schemaCode:e})=>(0,t.str)`must be multiple of ${e}`,params:({schemaCode:e})=>(0,t._)`{multipleOf: ${e}}`},code(e){let{gen:n,data:r,schemaCode:i,it:a}=e,o=a.opts.multipleOfPrecision,s=n.let(`res`),c=o?(0,t._)`Math.abs(Math.round(${s}) - ${s}) > 1e-${o}`:(0,t._)`${s} !== parseInt(${s})`;e.fail$data((0,t._)`(${i} === 0 || (${s} = ${r}/${i}, ${c}))`)}}})),Nj=a((e=>{Object.defineProperty(e,"__esModule",{value:!0});function t(e){let t=e.length,n=0,r=0,i;for(;r<t;)n++,i=e.charCodeAt(r++),i>=55296&&i<=56319&&r<t&&(i=e.charCodeAt(r),(i&64512)==56320&&r++);return n}e.default=t,t.code=`require("ajv/dist/runtime/ucs2length").default`})),Pj=a((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=Q(),n=$(),r=Nj();e.default={keyword:[`maxLength`,`minLength`],type:`string`,schemaType:`number`,$data:!0,error:{message({keyword:e,schemaCode:n}){let r=e===`maxLength`?`more`:`fewer`;return(0,t.str)`must NOT have ${r} than ${n} characters`},params:({schemaCode:e})=>(0,t._)`{limit: ${e}}`},code(e){let{keyword:i,data:a,schemaCode:o,it:s}=e,c=i===`maxLength`?t.operators.GT:t.operators.LT,l=s.opts.unicode===!1?(0,t._)`${a}.length`:(0,t._)`${(0,n.useFunc)(e.gen,r.default)}(${a})`;e.fail$data((0,t._)`${l} ${c} ${o}`)}}})),Fj=a((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=aj(),n=$(),r=Q();e.default={keyword:`pattern`,type:`string`,schemaType:`string`,$data:!0,error:{message:({schemaCode:e})=>(0,r.str)`must match pattern "${e}"`,params:({schemaCode:e})=>(0,r._)`{pattern: ${e}}`},code(e){let{gen:i,data:a,$data:o,schema:s,schemaCode:c,it:l}=e,u=l.opts.unicodeRegExp?`u`:``;if(o){let{regExp:t}=l.opts.code,o=t.code===`new RegExp`?(0,r._)`new RegExp`:(0,n.useFunc)(i,t),s=i.let(`valid`);i.try(()=>i.assign(s,(0,r._)`${o}(${c}, ${u}).test(${a})`),()=>i.assign(s,!1)),e.fail$data((0,r._)`!${s}`)}else{let n=(0,t.usePattern)(e,s);e.fail$data((0,r._)`!${n}.test(${a})`)}}}})),Ij=a((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=Q();e.default={keyword:[`maxProperties`,`minProperties`],type:`object`,schemaType:`number`,$data:!0,error:{message({keyword:e,schemaCode:n}){let r=e===`maxProperties`?`more`:`fewer`;return(0,t.str)`must NOT have ${r} than ${n} properties`},params:({schemaCode:e})=>(0,t._)`{limit: ${e}}`},code(e){let{keyword:n,data:r,schemaCode:i}=e,a=n===`maxProperties`?t.operators.GT:t.operators.LT;e.fail$data((0,t._)`Object.keys(${r}).length ${a} ${i}`)}}})),Lj=a((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=aj(),n=Q(),r=$();e.default={keyword:`required`,type:`object`,schemaType:`array`,$data:!0,error:{message:({params:{missingProperty:e}})=>(0,n.str)`must have required property '${e}'`,params:({params:{missingProperty:e}})=>(0,n._)`{missingProperty: ${e}}`},code(e){let{gen:i,schema:a,schemaCode:o,data:s,$data:c,it:l}=e,{opts:u}=l;if(!c&&a.length===0)return;let d=a.length>=u.loopRequired;if(l.allErrors?f():p(),u.strictRequired){let t=e.parentSchema.properties,{definedProperties:n}=e.it;for(let e of a)if(t?.[e]===void 0&&!n.has(e)){let t=`required property "${e}" is not defined at "${l.schemaEnv.baseId+l.errSchemaPath}" (strictRequired)`;(0,r.checkStrictMode)(l,t,l.opts.strictRequired)}}function f(){if(d||c)e.block$data(n.nil,m);else for(let n of a)(0,t.checkReportMissingProp)(e,n)}function p(){let n=i.let(`missing`);if(d||c){let t=i.let(`valid`,!0);e.block$data(t,()=>h(n,t)),e.ok(t)}else i.if((0,t.checkMissingProp)(e,a,n)),(0,t.reportMissingProp)(e,n),i.else()}function m(){i.forOf(`prop`,o,n=>{e.setParams({missingProperty:n}),i.if((0,t.noPropertyInData)(i,s,n,u.ownProperties),()=>e.error())})}function h(r,a){e.setParams({missingProperty:r}),i.forOf(r,o,()=>{i.assign(a,(0,t.propertyInData)(i,s,r,u.ownProperties)),i.if((0,n.not)(a),()=>{e.error(),i.break()})},n.nil)}}}})),Rj=a((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=Q();e.default={keyword:[`maxItems`,`minItems`],type:`array`,schemaType:`number`,$data:!0,error:{message({keyword:e,schemaCode:n}){let r=e===`maxItems`?`more`:`fewer`;return(0,t.str)`must NOT have ${r} than ${n} items`},params:({schemaCode:e})=>(0,t._)`{limit: ${e}}`},code(e){let{keyword:n,data:r,schemaCode:i}=e,a=n===`maxItems`?t.operators.GT:t.operators.LT;e.fail$data((0,t._)`${r}.length ${a} ${i}`)}}})),zj=a((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=cj();t.code=`require("ajv/dist/runtime/equal").default`,e.default=t})),Bj=a((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=rj(),n=Q(),r=$(),i=zj();e.default={keyword:`uniqueItems`,type:`array`,schemaType:`boolean`,$data:!0,error:{message:({params:{i:e,j:t}})=>(0,n.str)`must NOT have duplicate items (items ## ${t} and ${e} are identical)`,params:({params:{i:e,j:t}})=>(0,n._)`{i: ${e}, j: ${t}}`},code(e){let{gen:a,data:o,$data:s,schema:c,parentSchema:l,schemaCode:u,it:d}=e;if(!s&&!c)return;let f=a.let(`valid`),p=l.items?(0,t.getSchemaTypes)(l.items):[];e.block$data(f,m,(0,n._)`${u} === false`),e.ok(f);function m(){let t=a.let(`i`,(0,n._)`${o}.length`),r=a.let(`j`);e.setParams({i:t,j:r}),a.assign(f,!0),a.if((0,n._)`${t} > 1`,()=>(h()?g:_)(t,r))}function h(){return p.length>0&&!p.some(e=>e===`object`||e===`array`)}function g(r,i){let s=a.name(`item`),c=(0,t.checkDataTypes)(p,s,d.opts.strictNumbers,t.DataType.Wrong),l=a.const(`indices`,(0,n._)`{}`);a.for((0,n._)`;${r}--;`,()=>{a.let(s,(0,n._)`${o}[${r}]`),a.if(c,(0,n._)`continue`),p.length>1&&a.if((0,n._)`typeof ${s} == "string"`,(0,n._)`${s} += "_"`),a.if((0,n._)`typeof ${l}[${s}] == "number"`,()=>{a.assign(i,(0,n._)`${l}[${s}]`),e.error(),a.assign(f,!1).break()}).code((0,n._)`${l}[${s}] = ${r}`)})}function _(t,s){let c=(0,r.useFunc)(a,i.default),l=a.name(`outer`);a.label(l).for((0,n._)`;${t}--;`,()=>a.for((0,n._)`${s} = ${t}; ${s}--;`,()=>a.if((0,n._)`${c}(${o}[${t}], ${o}[${s}])`,()=>{e.error(),a.assign(f,!1).break(l)})))}}}})),Vj=a((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=Q(),n=$(),r=zj();e.default={keyword:`const`,$data:!0,error:{message:`must be equal to constant`,params:({schemaCode:e})=>(0,t._)`{allowedValue: ${e}}`},code(e){let{gen:i,data:a,$data:o,schemaCode:s,schema:c}=e;o||c&&typeof c==`object`?e.fail$data((0,t._)`!${(0,n.useFunc)(i,r.default)}(${a}, ${s})`):e.fail((0,t._)`${c} !== ${a}`)}}})),Hj=a((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=Q(),n=$(),r=zj();e.default={keyword:`enum`,schemaType:`array`,$data:!0,error:{message:`must be equal to one of the allowed values`,params:({schemaCode:e})=>(0,t._)`{allowedValues: ${e}}`},code(e){let{gen:i,data:a,$data:o,schema:s,schemaCode:c,it:l}=e;if(!o&&s.length===0)throw Error(`enum must have non-empty array`);let u=s.length>=l.opts.loopEnum,d,f=()=>d??=(0,n.useFunc)(i,r.default),p;if(u||o)p=i.let(`valid`),e.block$data(p,m);else{if(!Array.isArray(s))throw Error(`ajv implementation error`);let e=i.const(`vSchema`,c);p=(0,t.or)(...s.map((t,n)=>h(e,n)))}e.pass(p);function m(){i.assign(p,!1),i.forOf(`v`,c,e=>i.if((0,t._)`${f()}(${a}, ${e})`,()=>i.assign(p,!0).break()))}function h(e,n){let r=s[n];return typeof r==`object`&&r?(0,t._)`${f()}(${a}, ${e}[${n}])`:(0,t._)`${a} === ${r}`}}}})),Uj=a((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=jj(),n=Mj(),r=Pj(),i=Fj(),a=Ij(),o=Lj(),s=Rj(),c=Bj(),l=Vj(),u=Hj();e.default=[t.default,n.default,r.default,i.default,a.default,o.default,s.default,c.default,{keyword:`type`,schemaType:[`string`,`array`]},{keyword:`nullable`,schemaType:`boolean`},l.default,u.default]})),Wj=a((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.validateAdditionalItems=void 0;var t=Q(),n=$(),r={keyword:`additionalItems`,type:`array`,schemaType:[`boolean`,`object`],before:`uniqueItems`,error:{message:({params:{len:e}})=>(0,t.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,t._)`{limit: ${e}}`},code(e){let{parentSchema:t,it:r}=e,{items:a}=t;Array.isArray(a)?i(e,a):(0,n.checkStrictMode)(r,`"additionalItems" is ignored when "items" is not an array of schemas`)}};function i(e,r){let{gen:i,schema:a,data:o,keyword:s,it:c}=e;c.items=!0;let l=i.const(`len`,(0,t._)`${o}.length`);if(a===!1)e.setParams({len:r.length}),e.pass((0,t._)`${l} <= ${r.length}`);else if(typeof a==`object`&&!(0,n.alwaysValidSchema)(c,a)){let n=i.var(`valid`,(0,t._)`${l} <= ${r.length}`);i.if((0,t.not)(n),()=>u(n)),e.ok(n)}function u(a){i.forRange(`i`,r.length,l,r=>{e.subschema({keyword:s,dataProp:r,dataPropType:n.Type.Num},a),c.allErrors||i.if((0,t.not)(a),()=>i.break())})}}e.validateAdditionalItems=i,e.default=r})),Gj=a((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.validateTuple=void 0;var t=Q(),n=$(),r=aj(),i={keyword:`items`,type:`array`,schemaType:[`object`,`array`,`boolean`],before:`uniqueItems`,code(e){let{schema:t,it:i}=e;if(Array.isArray(t))return a(e,`additionalItems`,t);i.items=!0,(0,n.alwaysValidSchema)(i,t)||e.ok((0,r.validateArray)(e))}};function a(e,r,i=e.schema){let{gen:a,parentSchema:o,data:s,keyword:c,it:l}=e;f(o),l.opts.unevaluated&&i.length&&l.items!==!0&&(l.items=n.mergeEvaluated.items(a,i.length,l.items));let u=a.name(`valid`),d=a.const(`len`,(0,t._)`${s}.length`);i.forEach((r,i)=>{(0,n.alwaysValidSchema)(l,r)||(a.if((0,t._)`${d} > ${i}`,()=>e.subschema({keyword:c,schemaProp:i,dataProp:i},u)),e.ok(u))});function f(e){let{opts:t,errSchemaPath:a}=l,o=i.length,s=o===e.minItems&&(o===e.maxItems||e[r]===!1);if(t.strictTuples&&!s){let e=`"${c}" is ${o}-tuple, but minItems or maxItems/${r} are not specified or different at path "${a}"`;(0,n.checkStrictMode)(l,e,t.strictTuples)}}}e.validateTuple=a,e.default=i})),Kj=a((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=Gj();e.default={keyword:`prefixItems`,type:`array`,schemaType:[`array`],before:`uniqueItems`,code:e=>(0,t.validateTuple)(e,`items`)}})),qj=a((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=Q(),n=$(),r=aj(),i=Wj();e.default={keyword:`items`,type:`array`,schemaType:[`object`,`boolean`],before:`uniqueItems`,error:{message:({params:{len:e}})=>(0,t.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,t._)`{limit: ${e}}`},code(e){let{schema:t,parentSchema:a,it:o}=e,{prefixItems:s}=a;o.items=!0,(0,n.alwaysValidSchema)(o,t)||(s?(0,i.validateAdditionalItems)(e,s):e.ok((0,r.validateArray)(e)))}}})),Jj=a((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=Q(),n=$();e.default={keyword:`contains`,type:`array`,schemaType:[`object`,`boolean`],before:`uniqueItems`,trackErrors:!0,error:{message:({params:{min:e,max:n}})=>n===void 0?(0,t.str)`must contain at least ${e} valid item(s)`:(0,t.str)`must contain at least ${e} and no more than ${n} valid item(s)`,params:({params:{min:e,max:n}})=>n===void 0?(0,t._)`{minContains: ${e}}`:(0,t._)`{minContains: ${e}, maxContains: ${n}}`},code(e){let{gen:r,schema:i,parentSchema:a,data:o,it:s}=e,c,l,{minContains:u,maxContains:d}=a;s.opts.next?(c=u===void 0?1:u,l=d):c=1;let f=r.const(`len`,(0,t._)`${o}.length`);if(e.setParams({min:c,max:l}),l===void 0&&c===0){(0,n.checkStrictMode)(s,`"minContains" == 0 without "maxContains": "contains" keyword ignored`);return}if(l!==void 0&&c>l){(0,n.checkStrictMode)(s,`"minContains" > "maxContains" is always invalid`),e.fail();return}if((0,n.alwaysValidSchema)(s,i)){let n=(0,t._)`${f} >= ${c}`;l!==void 0&&(n=(0,t._)`${n} && ${f} <= ${l}`),e.pass(n);return}s.items=!0;let p=r.name(`valid`);l===void 0&&c===1?h(p,()=>r.if(p,()=>r.break())):c===0?(r.let(p,!0),l!==void 0&&r.if((0,t._)`${o}.length > 0`,m)):(r.let(p,!1),m()),e.result(p,()=>e.reset());function m(){let e=r.name(`_valid`),t=r.let(`count`,0);h(e,()=>r.if(e,()=>g(t)))}function h(t,i){r.forRange(`i`,0,f,r=>{e.subschema({keyword:`contains`,dataProp:r,dataPropType:n.Type.Num,compositeRule:!0},t),i()})}function g(e){r.code((0,t._)`${e}++`),l===void 0?r.if((0,t._)`${e} >= ${c}`,()=>r.assign(p,!0).break()):(r.if((0,t._)`${e} > ${l}`,()=>r.assign(p,!1).break()),c===1?r.assign(p,!0):r.if((0,t._)`${e} >= ${c}`,()=>r.assign(p,!0)))}}}})),Yj=a((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.validateSchemaDeps=e.validatePropertyDeps=e.error=void 0;var t=Q(),n=$(),r=aj();e.error={message:({params:{property:e,depsCount:n,deps:r}})=>{let i=n===1?`property`:`properties`;return(0,t.str)`must have ${i} ${r} when property ${e} is present`},params:({params:{property:e,depsCount:n,deps:r,missingProperty:i}})=>(0,t._)`{property: ${e},
647
+ || ${s} === "boolean" || ${a} === null`).assign(c,(0,i._)`[${a}]`)}}}function p({gen:e,parentData:t,parentDataProperty:n},r){e.if((0,i._)`${t} !== undefined`,()=>e.assign((0,i._)`${t}[${n}]`,r))}function m(e,t,n,r=o.Correct){let a=r===o.Correct?i.operators.EQ:i.operators.NEQ,s;switch(e){case`null`:return(0,i._)`${t} ${a} null`;case`array`:s=(0,i._)`Array.isArray(${t})`;break;case`object`:s=(0,i._)`${t} && typeof ${t} == "object" && !Array.isArray(${t})`;break;case`integer`:s=c((0,i._)`!(${t} % 1) && !isNaN(${t})`);break;case`number`:s=c();break;default:return(0,i._)`typeof ${t} ${a} ${e}`}return r===o.Correct?s:(0,i.not)(s);function c(e=i.nil){return(0,i.and)((0,i._)`typeof ${t} == "number"`,e,n?(0,i._)`isFinite(${t})`:i.nil)}}e.checkDataType=m;function h(e,t,n,r){if(e.length===1)return m(e[0],t,n,r);let o,s=(0,a.toHash)(e);if(s.array&&s.object){let e=(0,i._)`typeof ${t} != "object"`;o=s.null?e:(0,i._)`!${t} || ${e}`,delete s.null,delete s.array,delete s.object}else o=i.nil;s.number&&delete s.integer;for(let e in s)o=(0,i.and)(o,m(e,t,n,r));return o}e.checkDataTypes=h;var g={message:({schema:e})=>`must be ${e}`,params:({schema:e,schemaValue:t})=>typeof e==`string`?(0,i._)`{type: ${e}}`:(0,i._)`{type: ${t}}`};function _(e){let t=v(e);(0,r.reportError)(t,g)}e.reportTypeError=_;function v(e){let{gen:t,data:n,schema:r}=e,i=(0,a.schemaRefOrVal)(e,r,`type`);return{gen:t,keyword:`type`,data:n,schema:r.type,schemaCode:i,schemaValue:i,parentSchema:r,params:{},it:e}}})),aj=a((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.assignDefaults=void 0;var t=Q(),n=$();function r(e,t){let{properties:n,items:r}=e.schema;if(t===`object`&&n)for(let t in n)i(e,t,n[t].default);else t===`array`&&Array.isArray(r)&&r.forEach((t,n)=>i(e,n,t.default))}e.assignDefaults=r;function i(e,r,i){let{gen:a,compositeRule:o,data:s,opts:c}=e;if(i===void 0)return;let l=(0,t._)`${s}${(0,t.getProperty)(r)}`;if(o){(0,n.checkStrictMode)(e,`default is ignored for: ${l}`);return}let u=(0,t._)`${l} === undefined`;c.useDefaults===`empty`&&(u=(0,t._)`${u} || ${l} === null || ${l} === ""`),a.if(u,(0,t._)`${l} = ${(0,t.stringify)(i)}`)}})),oj=a((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.validateUnion=e.validateArray=e.usePattern=e.callValidateCode=e.schemaProperties=e.allSchemaProperties=e.noPropertyInData=e.propertyInData=e.isOwnProperty=e.hasPropFunc=e.reportMissingProp=e.checkMissingProp=e.checkReportMissingProp=void 0;var t=Q(),n=$(),r=$A(),i=$();function a(e,n){let{gen:r,data:i,it:a}=e;r.if(d(r,i,n,a.opts.ownProperties),()=>{e.setParams({missingProperty:(0,t._)`${n}`},!0),e.error()})}e.checkReportMissingProp=a;function o({gen:e,data:n,it:{opts:r}},i,a){return(0,t.or)(...i.map(i=>(0,t.and)(d(e,n,i,r.ownProperties),(0,t._)`${a} = ${i}`)))}e.checkMissingProp=o;function s(e,t){e.setParams({missingProperty:t},!0),e.error()}e.reportMissingProp=s;function c(e){return e.scopeValue(`func`,{ref:Object.prototype.hasOwnProperty,code:(0,t._)`Object.prototype.hasOwnProperty`})}e.hasPropFunc=c;function l(e,n,r){return(0,t._)`${c(e)}.call(${n}, ${r})`}e.isOwnProperty=l;function u(e,n,r,i){let a=(0,t._)`${n}${(0,t.getProperty)(r)} !== undefined`;return i?(0,t._)`${a} && ${l(e,n,r)}`:a}e.propertyInData=u;function d(e,n,r,i){let a=(0,t._)`${n}${(0,t.getProperty)(r)} === undefined`;return i?(0,t.or)(a,(0,t.not)(l(e,n,r))):a}e.noPropertyInData=d;function f(e){return e?Object.keys(e).filter(e=>e!==`__proto__`):[]}e.allSchemaProperties=f;function p(e,t){return f(t).filter(r=>!(0,n.alwaysValidSchema)(e,t[r]))}e.schemaProperties=p;function m({schemaCode:e,data:n,it:{gen:i,topSchemaRef:a,schemaPath:o,errorPath:s},it:c},l,u,d){let f=d?(0,t._)`${e}, ${n}, ${a}${o}`:n,p=[[r.default.instancePath,(0,t.strConcat)(r.default.instancePath,s)],[r.default.parentData,c.parentData],[r.default.parentDataProperty,c.parentDataProperty],[r.default.rootData,r.default.rootData]];c.opts.dynamicRef&&p.push([r.default.dynamicAnchors,r.default.dynamicAnchors]);let m=(0,t._)`${f}, ${i.object(...p)}`;return u===t.nil?(0,t._)`${l}(${m})`:(0,t._)`${l}.call(${u}, ${m})`}e.callValidateCode=m;var h=(0,t._)`new RegExp`;function g({gen:e,it:{opts:n}},r){let a=n.unicodeRegExp?`u`:``,{regExp:o}=n.code,s=o(r,a);return e.scopeValue(`pattern`,{key:s.toString(),ref:s,code:(0,t._)`${o.code===`new RegExp`?h:(0,i.useFunc)(e,o)}(${r}, ${a})`})}e.usePattern=g;function _(e){let{gen:r,data:i,keyword:a,it:o}=e,s=r.name(`valid`);if(o.allErrors){let e=r.let(`valid`,!0);return c(()=>r.assign(e,!1)),e}return r.var(s,!0),c(()=>r.break()),s;function c(o){let c=r.const(`len`,(0,t._)`${i}.length`);r.forRange(`i`,0,c,i=>{e.subschema({keyword:a,dataProp:i,dataPropType:n.Type.Num},s),r.if((0,t.not)(s),o)})}}e.validateArray=_;function v(e){let{gen:r,schema:i,keyword:a,it:o}=e;if(!Array.isArray(i))throw Error(`ajv implementation error`);if(i.some(e=>(0,n.alwaysValidSchema)(o,e))&&!o.opts.unevaluated)return;let s=r.let(`valid`,!1),c=r.name(`_valid`);r.block(()=>i.forEach((n,i)=>{let o=e.subschema({keyword:a,schemaProp:i,compositeRule:!0},c);r.assign(s,(0,t._)`${s} || ${c}`),e.mergeValidEvaluated(o,c)||r.if((0,t.not)(s))})),e.result(s,()=>e.reset(),()=>e.error(!0))}e.validateUnion=v})),sj=a((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.validateKeywordUsage=e.validSchemaType=e.funcKeywordCode=e.macroKeywordCode=void 0;var t=Q(),n=$A(),r=oj(),i=ej();function a(e,n){let{gen:r,keyword:i,schema:a,parentSchema:o,it:s}=e,c=n.macro.call(s.self,a,o,s),l=u(r,i,c);s.opts.validateSchema!==!1&&s.self.validateSchema(c,!0);let d=r.name(`valid`);e.subschema({schema:c,schemaPath:t.nil,errSchemaPath:`${s.errSchemaPath}/${i}`,topSchemaRef:l,compositeRule:!0},d),e.pass(d,()=>e.error(!0))}e.macroKeywordCode=a;function o(e,i){let{gen:a,keyword:o,schema:d,parentSchema:f,$data:p,it:m}=e;l(m,i);let h=u(a,o,!p&&i.compile?i.compile.call(m.self,d,f,m):i.validate),g=a.let(`valid`);e.block$data(g,_),e.ok(i.valid??g);function _(){if(i.errors===!1)b(),i.modifying&&s(e),x(()=>e.error());else{let t=i.async?v():y();i.modifying&&s(e),x(()=>c(e,t))}}function v(){let e=a.let(`ruleErrs`,null);return a.try(()=>b((0,t._)`await `),n=>a.assign(g,!1).if((0,t._)`${n} instanceof ${m.ValidationError}`,()=>a.assign(e,(0,t._)`${n}.errors`),()=>a.throw(n))),e}function y(){let e=(0,t._)`${h}.errors`;return a.assign(e,null),b(t.nil),e}function b(o=i.async?(0,t._)`await `:t.nil){let s=m.opts.passContext?n.default.this:n.default.self,c=!(`compile`in i&&!p||i.schema===!1);a.assign(g,(0,t._)`${o}${(0,r.callValidateCode)(e,h,s,c)}`,i.modifying)}function x(e){a.if((0,t.not)(i.valid??g),e)}}e.funcKeywordCode=o;function s(e){let{gen:n,data:r,it:i}=e;n.if(i.parentData,()=>n.assign(r,(0,t._)`${i.parentData}[${i.parentDataProperty}]`))}function c(e,r){let{gen:a}=e;a.if((0,t._)`Array.isArray(${r})`,()=>{a.assign(n.default.vErrors,(0,t._)`${n.default.vErrors} === null ? ${r} : ${n.default.vErrors}.concat(${r})`).assign(n.default.errors,(0,t._)`${n.default.vErrors}.length`),(0,i.extendErrors)(e)},()=>e.error())}function l({schemaEnv:e},t){if(t.async&&!e.$async)throw Error(`async keyword in sync schema`)}function u(e,n,r){if(r===void 0)throw Error(`keyword "${n}" failed to compile`);return e.scopeValue(`keyword`,typeof r==`function`?{ref:r}:{ref:r,code:(0,t.stringify)(r)})}function d(e,t,n=!1){return!t.length||t.some(t=>t===`array`?Array.isArray(e):t===`object`?e&&typeof e==`object`&&!Array.isArray(e):typeof e==t||n&&e===void 0)}e.validSchemaType=d;function f({schema:e,opts:t,self:n,errSchemaPath:r},i,a){if(Array.isArray(i.keyword)?!i.keyword.includes(a):i.keyword!==a)throw Error(`ajv implementation error`);let o=i.dependencies;if(o?.some(t=>!Object.prototype.hasOwnProperty.call(e,t)))throw Error(`parent schema must have dependencies of ${a}: ${o.join(`,`)}`);if(i.validateSchema&&!i.validateSchema(e[a])){let e=`keyword "${a}" value is invalid at path "${r}": `+n.errorsText(i.validateSchema.errors);if(t.validateSchema===`log`)n.logger.error(e);else throw Error(e)}}e.validateKeywordUsage=f})),cj=a((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.extendSubschemaMode=e.extendSubschemaData=e.getSubschema=void 0;var t=Q(),n=$();function r(e,{keyword:r,schemaProp:i,schema:a,schemaPath:o,errSchemaPath:s,topSchemaRef:c}){if(r!==void 0&&a!==void 0)throw Error(`both "keyword" and "schema" passed, only one allowed`);if(r!==void 0){let a=e.schema[r];return i===void 0?{schema:a,schemaPath:(0,t._)`${e.schemaPath}${(0,t.getProperty)(r)}`,errSchemaPath:`${e.errSchemaPath}/${r}`}:{schema:a[i],schemaPath:(0,t._)`${e.schemaPath}${(0,t.getProperty)(r)}${(0,t.getProperty)(i)}`,errSchemaPath:`${e.errSchemaPath}/${r}/${(0,n.escapeFragment)(i)}`}}if(a!==void 0){if(o===void 0||s===void 0||c===void 0)throw Error(`"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"`);return{schema:a,schemaPath:o,topSchemaRef:c,errSchemaPath:s}}throw Error(`either "keyword" or "schema" must be passed`)}e.getSubschema=r;function i(e,r,{dataProp:i,dataPropType:a,data:o,dataTypes:s,propertyName:c}){if(o!==void 0&&i!==void 0)throw Error(`both "data" and "dataProp" passed, only one allowed`);let{gen:l}=r;if(i!==void 0){let{errorPath:o,dataPathArr:s,opts:c}=r;u(l.let(`data`,(0,t._)`${r.data}${(0,t.getProperty)(i)}`,!0)),e.errorPath=(0,t.str)`${o}${(0,n.getErrorPath)(i,a,c.jsPropertySyntax)}`,e.parentDataProperty=(0,t._)`${i}`,e.dataPathArr=[...s,e.parentDataProperty]}o!==void 0&&(u(o instanceof t.Name?o:l.let(`data`,o,!0)),c!==void 0&&(e.propertyName=c)),s&&(e.dataTypes=s);function u(t){e.data=t,e.dataLevel=r.dataLevel+1,e.dataTypes=[],r.definedProperties=new Set,e.parentData=r.data,e.dataNames=[...r.dataNames,t]}}e.extendSubschemaData=i;function a(e,{jtdDiscriminator:t,jtdMetadata:n,compositeRule:r,createErrors:i,allErrors:a}){r!==void 0&&(e.compositeRule=r),i!==void 0&&(e.createErrors=i),a!==void 0&&(e.allErrors=a),e.jtdDiscriminator=t,e.jtdMetadata=n}e.extendSubschemaMode=a})),lj=a(((e,t)=>{t.exports=function e(t,n){if(t===n)return!0;if(t&&n&&typeof t==`object`&&typeof n==`object`){if(t.constructor!==n.constructor)return!1;var r,i,a;if(Array.isArray(t)){if(r=t.length,r!=n.length)return!1;for(i=r;i--!==0;)if(!e(t[i],n[i]))return!1;return!0}if(t.constructor===RegExp)return t.source===n.source&&t.flags===n.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===n.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===n.toString();if(a=Object.keys(t),r=a.length,r!==Object.keys(n).length)return!1;for(i=r;i--!==0;)if(!Object.prototype.hasOwnProperty.call(n,a[i]))return!1;for(i=r;i--!==0;){var o=a[i];if(!e(t[o],n[o]))return!1}return!0}return t!==t&&n!==n}})),uj=a(((e,t)=>{var n=t.exports=function(e,t,n){typeof t==`function`&&(n=t,t={}),n=t.cb||n;var i=typeof n==`function`?n:n.pre||function(){},a=n.post||function(){};r(t,i,a,e,``,e)};n.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0},n.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0},n.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0},n.skipKeywords={default:!0,enum:!0,const:!0,required:!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};function r(e,t,a,o,s,c,l,u,d,f){if(o&&typeof o==`object`&&!Array.isArray(o)){for(var p in t(o,s,c,l,u,d,f),o){var m=o[p];if(Array.isArray(m)){if(p in n.arrayKeywords)for(var h=0;h<m.length;h++)r(e,t,a,m[h],s+`/`+p+`/`+h,c,s,p,o,h)}else if(p in n.propsKeywords){if(m&&typeof m==`object`)for(var g in m)r(e,t,a,m[g],s+`/`+p+`/`+i(g),c,s,p,o,g)}else(p in n.keywords||e.allKeys&&!(p in n.skipKeywords))&&r(e,t,a,m,s+`/`+p,c,s,p,o)}a(o,s,c,l,u,d,f)}}function i(e){return e.replace(/~/g,`~0`).replace(/\//g,`~1`)}})),dj=a((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.getSchemaRefs=e.resolveUrl=e.normalizeId=e._getFullPath=e.getFullPath=e.inlineRef=void 0;var t=$(),n=lj(),r=uj(),i=new Set([`type`,`format`,`pattern`,`maxLength`,`minLength`,`maxProperties`,`minProperties`,`maxItems`,`minItems`,`maximum`,`minimum`,`uniqueItems`,`multipleOf`,`required`,`enum`,`const`]);function a(e,t=!0){return typeof e==`boolean`?!0:t===!0?!s(e):t?c(e)<=t:!1}e.inlineRef=a;var o=new Set([`$ref`,`$recursiveRef`,`$recursiveAnchor`,`$dynamicRef`,`$dynamicAnchor`]);function s(e){for(let t in e){if(o.has(t))return!0;let n=e[t];if(Array.isArray(n)&&n.some(s)||typeof n==`object`&&s(n))return!0}return!1}function c(e){let n=0;for(let r in e)if(r===`$ref`||(n++,!i.has(r)&&(typeof e[r]==`object`&&(0,t.eachItem)(e[r],e=>n+=c(e)),n===1/0)))return 1/0;return n}function l(e,t=``,n){return n!==!1&&(t=f(t)),u(e,e.parse(t))}e.getFullPath=l;function u(e,t){return e.serialize(t).split(`#`)[0]+`#`}e._getFullPath=u;var d=/#\/?$/;function f(e){return e?e.replace(d,``):``}e.normalizeId=f;function p(e,t,n){return n=f(n),e.resolve(t,n)}e.resolveUrl=p;var m=/^[a-z_][-a-z0-9._]*$/i;function h(e,t){if(typeof e==`boolean`)return{};let{schemaId:i,uriResolver:a}=this.opts,o=f(e[i]||t),s={"":o},c=l(a,o,!1),u={},d=new Set;return r(e,{allKeys:!0},(e,t,n,r)=>{if(r===void 0)return;let a=c+t,o=s[r];typeof e[i]==`string`&&(o=l.call(this,e[i])),g.call(this,e.$anchor),g.call(this,e.$dynamicAnchor),s[t]=o;function l(t){let n=this.opts.uriResolver.resolve;if(t=f(o?n(o,t):t),d.has(t))throw h(t);d.add(t);let r=this.refs[t];return typeof r==`string`&&(r=this.refs[r]),typeof r==`object`?p(e,r.schema,t):t!==f(a)&&(t[0]===`#`?(p(e,u[t],t),u[t]=e):this.refs[t]=a),t}function g(e){if(typeof e==`string`){if(!m.test(e))throw Error(`invalid anchor "${e}"`);l.call(this,`#${e}`)}}}),u;function p(e,t,r){if(t!==void 0&&!n(e,t))throw h(r)}function h(e){return Error(`reference "${e}" resolves to more than one schema`)}}e.getSchemaRefs=h})),fj=a((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.getData=e.KeywordCxt=e.validateFunctionCode=void 0;var t=tj(),n=ij(),r=rj(),i=ij(),a=aj(),o=sj(),s=cj(),c=Q(),l=$A(),u=dj(),d=$(),f=ej();function p(e){S(e)&&(w(e),x(e))?_(e):m(e,()=>(0,t.topBoolOrEmptySchema)(e))}e.validateFunctionCode=p;function m({gen:e,validateName:t,schema:n,schemaEnv:r,opts:i},a){i.code.es5?e.func(t,(0,c._)`${l.default.data}, ${l.default.valCxt}`,r.$async,()=>{e.code((0,c._)`"use strict"; ${y(n,i)}`),g(e,i),e.code(a)}):e.func(t,(0,c._)`${l.default.data}, ${h(i)}`,r.$async,()=>e.code(y(n,i)).code(a))}function h(e){return(0,c._)`{${l.default.instancePath}="", ${l.default.parentData}, ${l.default.parentDataProperty}, ${l.default.rootData}=${l.default.data}${e.dynamicRef?(0,c._)`, ${l.default.dynamicAnchors}={}`:c.nil}}={}`}function g(e,t){e.if(l.default.valCxt,()=>{e.var(l.default.instancePath,(0,c._)`${l.default.valCxt}.${l.default.instancePath}`),e.var(l.default.parentData,(0,c._)`${l.default.valCxt}.${l.default.parentData}`),e.var(l.default.parentDataProperty,(0,c._)`${l.default.valCxt}.${l.default.parentDataProperty}`),e.var(l.default.rootData,(0,c._)`${l.default.valCxt}.${l.default.rootData}`),t.dynamicRef&&e.var(l.default.dynamicAnchors,(0,c._)`${l.default.valCxt}.${l.default.dynamicAnchors}`)},()=>{e.var(l.default.instancePath,(0,c._)`""`),e.var(l.default.parentData,(0,c._)`undefined`),e.var(l.default.parentDataProperty,(0,c._)`undefined`),e.var(l.default.rootData,l.default.data),t.dynamicRef&&e.var(l.default.dynamicAnchors,(0,c._)`{}`)})}function _(e){let{schema:t,opts:n,gen:r}=e;m(e,()=>{n.$comment&&t.$comment&&ie(e),te(e),r.let(l.default.vErrors,null),r.let(l.default.errors,0),n.unevaluated&&v(e),ee(e),ae(e)})}function v(e){let{gen:t,validateName:n}=e;e.evaluated=t.const(`evaluated`,(0,c._)`${n}.evaluated`),t.if((0,c._)`${e.evaluated}.dynamicProps`,()=>t.assign((0,c._)`${e.evaluated}.props`,(0,c._)`undefined`)),t.if((0,c._)`${e.evaluated}.dynamicItems`,()=>t.assign((0,c._)`${e.evaluated}.items`,(0,c._)`undefined`))}function y(e,t){let n=typeof e==`object`&&e[t.schemaId];return n&&(t.code.source||t.code.process)?(0,c._)`/*# sourceURL=${n} */`:c.nil}function b(e,n){S(e)&&(w(e),x(e))?C(e,n):(0,t.boolOrEmptySchema)(e,n)}function x({schema:e,self:t}){if(typeof e==`boolean`)return!e;for(let n in e)if(t.RULES.all[n])return!0;return!1}function S(e){return typeof e.schema!=`boolean`}function C(e,t){let{schema:n,gen:r,opts:i}=e;i.$comment&&n.$comment&&ie(e),ne(e),re(e);let a=r.const(`_errs`,l.default.errors);ee(e,a),r.var(t,(0,c._)`${a} === ${l.default.errors}`)}function w(e){(0,d.checkUnknownRules)(e),T(e)}function ee(e,t){if(e.opts.jtd)return se(e,[],!1,t);let r=(0,n.getSchemaTypes)(e.schema);se(e,r,!(0,n.coerceAndCheckDataType)(e,r),t)}function T(e){let{schema:t,errSchemaPath:n,opts:r,self:i}=e;t.$ref&&r.ignoreKeywordsWithRef&&(0,d.schemaHasRulesButRef)(t,i.RULES)&&i.logger.warn(`$ref: keywords ignored in schema at path "${n}"`)}function te(e){let{schema:t,opts:n}=e;t.default!==void 0&&n.useDefaults&&n.strictSchema&&(0,d.checkStrictMode)(e,`default is ignored in the schema root`)}function ne(e){let t=e.schema[e.opts.schemaId];t&&(e.baseId=(0,u.resolveUrl)(e.opts.uriResolver,e.baseId,t))}function re(e){if(e.schema.$async&&!e.schemaEnv.$async)throw Error(`async schema in sync schema`)}function ie({gen:e,schemaEnv:t,schema:n,errSchemaPath:r,opts:i}){let a=n.$comment;if(i.$comment===!0)e.code((0,c._)`${l.default.self}.logger.log(${a})`);else if(typeof i.$comment==`function`){let n=(0,c.str)`${r}/$comment`,i=e.scopeValue(`root`,{ref:t.root});e.code((0,c._)`${l.default.self}.opts.$comment(${a}, ${n}, ${i}.schema)`)}}function ae(e){let{gen:t,schemaEnv:n,validateName:r,ValidationError:i,opts:a}=e;n.$async?t.if((0,c._)`${l.default.errors} === 0`,()=>t.return(l.default.data),()=>t.throw((0,c._)`new ${i}(${l.default.vErrors})`)):(t.assign((0,c._)`${r}.errors`,l.default.vErrors),a.unevaluated&&oe(e),t.return((0,c._)`${l.default.errors} === 0`))}function oe({gen:e,evaluated:t,props:n,items:r}){n instanceof c.Name&&e.assign((0,c._)`${t}.props`,n),r instanceof c.Name&&e.assign((0,c._)`${t}.items`,r)}function se(e,t,n,a){let{gen:o,schema:s,data:u,allErrors:f,opts:p,self:m}=e,{RULES:h}=m;if(s.$ref&&(p.ignoreKeywordsWithRef||!(0,d.schemaHasRulesButRef)(s,h))){o.block(()=>ve(e,`$ref`,h.all.$ref.definition));return}p.jtd||le(e,t),o.block(()=>{for(let e of h.rules)g(e);g(h.post)});function g(d){(0,r.shouldUseGroup)(s,d)&&(d.type?(o.if((0,i.checkDataType)(d.type,u,p.strictNumbers)),ce(e,d),t.length===1&&t[0]===d.type&&n&&(o.else(),(0,i.reportTypeError)(e)),o.endIf()):ce(e,d),f||o.if((0,c._)`${l.default.errors} === ${a||0}`))}}function ce(e,t){let{gen:n,schema:i,opts:{useDefaults:o}}=e;o&&(0,a.assignDefaults)(e,t.type),n.block(()=>{for(let n of t.rules)(0,r.shouldUseRule)(i,n)&&ve(e,n.keyword,n.definition,t.type)})}function le(e,t){!e.schemaEnv.meta&&e.opts.strictTypes&&(ue(e,t),e.opts.allowUnionTypes||de(e,t),fe(e,e.dataTypes))}function ue(e,t){t.length&&(e.dataTypes.length?(t.forEach(t=>{me(e.dataTypes,t)||ge(e,`type "${t}" not allowed by context "${e.dataTypes.join(`,`)}"`)}),he(e,t)):e.dataTypes=t)}function de(e,t){t.length>1&&!(t.length===2&&t.includes(`null`))&&ge(e,`use allowUnionTypes to allow union type keyword`)}function fe(e,t){let n=e.self.RULES.all;for(let i in n){let a=n[i];if(typeof a==`object`&&(0,r.shouldUseRule)(e.schema,a)){let{type:n}=a.definition;n.length&&!n.some(e=>pe(t,e))&&ge(e,`missing type "${n.join(`,`)}" for keyword "${i}"`)}}}function pe(e,t){return e.includes(t)||t===`number`&&e.includes(`integer`)}function me(e,t){return e.includes(t)||t===`integer`&&e.includes(`number`)}function he(e,t){let n=[];for(let r of e.dataTypes)me(t,r)?n.push(r):t.includes(`integer`)&&r===`number`&&n.push(`integer`);e.dataTypes=n}function ge(e,t){let n=e.schemaEnv.baseId+e.errSchemaPath;t+=` at "${n}" (strictTypes)`,(0,d.checkStrictMode)(e,t,e.opts.strictTypes)}var _e=class{constructor(e,t,n){if((0,o.validateKeywordUsage)(e,t,n),this.gen=e.gen,this.allErrors=e.allErrors,this.keyword=n,this.data=e.data,this.schema=e.schema[n],this.$data=t.$data&&e.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,d.schemaRefOrVal)(e,this.schema,n,this.$data),this.schemaType=t.schemaType,this.parentSchema=e.schema,this.params={},this.it=e,this.def=t,this.$data)this.schemaCode=e.gen.const(`vSchema`,xe(this.$data,e));else if(this.schemaCode=this.schemaValue,!(0,o.validSchemaType)(this.schema,t.schemaType,t.allowUndefined))throw Error(`${n} value must be ${JSON.stringify(t.schemaType)}`);(`code`in t?t.trackErrors:t.errors!==!1)&&(this.errsCount=e.gen.const(`_errs`,l.default.errors))}result(e,t,n){this.failResult((0,c.not)(e),t,n)}failResult(e,t,n){this.gen.if(e),n?n():this.error(),t?(this.gen.else(),t(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(e,t){this.failResult((0,c.not)(e),void 0,t)}fail(e){e===void 0?(this.error(),this.allErrors||this.gen.if(!1)):(this.gen.if(e),this.error(),this.allErrors?this.gen.endIf():this.gen.else())}fail$data(e){if(!this.$data)return this.fail(e);let{schemaCode:t}=this;this.fail((0,c._)`${t} !== undefined && (${(0,c.or)(this.invalid$data(),e)})`)}error(e,t,n){t?(this.setParams(t),this._error(e,n),this.setParams({})):this._error(e,n)}_error(e,t){(e?f.reportExtraError:f.reportError)(this,this.def.error,t)}$dataError(){(0,f.reportError)(this,this.def.$dataError||f.keyword$DataError)}reset(){if(this.errsCount===void 0)throw Error(`add "trackErrors" to keyword definition`);(0,f.resetErrorsCount)(this.gen,this.errsCount)}ok(e){this.allErrors||this.gen.if(e)}setParams(e,t){t?Object.assign(this.params,e):this.params=e}block$data(e,t,n=c.nil){this.gen.block(()=>{this.check$data(e,n),t()})}check$data(e=c.nil,t=c.nil){if(!this.$data)return;let{gen:n,schemaCode:r,schemaType:i,def:a}=this;n.if((0,c.or)((0,c._)`${r} === undefined`,t)),e!==c.nil&&n.assign(e,!0),(i.length||a.validateSchema)&&(n.elseIf(this.invalid$data()),this.$dataError(),e!==c.nil&&n.assign(e,!1)),n.else()}invalid$data(){let{gen:e,schemaCode:t,schemaType:n,def:r,it:a}=this;return(0,c.or)(o(),s());function o(){if(n.length){if(!(t instanceof c.Name))throw Error(`ajv implementation error`);let e=Array.isArray(n)?n:[n];return(0,c._)`${(0,i.checkDataTypes)(e,t,a.opts.strictNumbers,i.DataType.Wrong)}`}return c.nil}function s(){if(r.validateSchema){let n=e.scopeValue(`validate$data`,{ref:r.validateSchema});return(0,c._)`!${n}(${t})`}return c.nil}}subschema(e,t){let n=(0,s.getSubschema)(this.it,e);(0,s.extendSubschemaData)(n,this.it,e),(0,s.extendSubschemaMode)(n,e);let r={...this.it,...n,items:void 0,props:void 0};return b(r,t),r}mergeEvaluated(e,t){let{it:n,gen:r}=this;n.opts.unevaluated&&(n.props!==!0&&e.props!==void 0&&(n.props=d.mergeEvaluated.props(r,e.props,n.props,t)),n.items!==!0&&e.items!==void 0&&(n.items=d.mergeEvaluated.items(r,e.items,n.items,t)))}mergeValidEvaluated(e,t){let{it:n,gen:r}=this;if(n.opts.unevaluated&&(n.props!==!0||n.items!==!0))return r.if(t,()=>this.mergeEvaluated(e,c.Name)),!0}};e.KeywordCxt=_e;function ve(e,t,n,r){let i=new _e(e,n,t);`code`in n?n.code(i,r):i.$data&&n.validate?(0,o.funcKeywordCode)(i,n):`macro`in n?(0,o.macroKeywordCode)(i,n):(n.compile||n.validate)&&(0,o.funcKeywordCode)(i,n)}var ye=/^\/(?:[^~]|~0|~1)*$/,be=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function xe(e,{dataLevel:t,dataNames:n,dataPathArr:r}){let i,a;if(e===``)return l.default.rootData;if(e[0]===`/`){if(!ye.test(e))throw Error(`Invalid JSON-pointer: ${e}`);i=e,a=l.default.rootData}else{let o=be.exec(e);if(!o)throw Error(`Invalid JSON-pointer: ${e}`);let s=+o[1];if(i=o[2],i===`#`){if(s>=t)throw Error(u(`property/index`,s));return r[t-s]}if(s>t)throw Error(u(`data`,s));if(a=n[t-s],!i)return a}let o=a,s=i.split(`/`);for(let e of s)e&&(a=(0,c._)`${a}${(0,c.getProperty)((0,d.unescapeJsonPointer)(e))}`,o=(0,c._)`${o} && ${a}`);return o;function u(e,n){return`Cannot access ${e} ${n} levels up, current level is ${t}`}}e.getData=xe})),pj=a((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default=class extends Error{constructor(e){super(`validation failed`),this.errors=e,this.ajv=this.validation=!0}}})),mj=a((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=dj();e.default=class extends Error{constructor(e,n,r,i){super(i||`can't resolve reference ${r} from id ${n}`),this.missingRef=(0,t.resolveUrl)(e,n,r),this.missingSchema=(0,t.normalizeId)((0,t.getFullPath)(e,this.missingRef))}}})),hj=a((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.resolveSchema=e.getCompilingSchema=e.resolveRef=e.compileSchema=e.SchemaEnv=void 0;var t=Q(),n=pj(),r=$A(),i=dj(),a=$(),o=fj(),s=class{constructor(e){this.refs={},this.dynamicAnchors={};let t;typeof e.schema==`object`&&(t=e.schema),this.schema=e.schema,this.schemaId=e.schemaId,this.root=e.root||this,this.baseId=e.baseId??(0,i.normalizeId)(t?.[e.schemaId||`$id`]),this.schemaPath=e.schemaPath,this.localRefs=e.localRefs,this.meta=e.meta,this.$async=t?.$async,this.refs={}}};e.SchemaEnv=s;function c(e){let a=d.call(this,e);if(a)return a;let s=(0,i.getFullPath)(this.opts.uriResolver,e.root.baseId),{es5:c,lines:l}=this.opts.code,{ownProperties:u}=this.opts,f=new t.CodeGen(this.scope,{es5:c,lines:l,ownProperties:u}),p;e.$async&&(p=f.scopeValue(`Error`,{ref:n.default,code:(0,t._)`require("ajv/dist/runtime/validation_error").default`}));let m=f.scopeName(`validate`);e.validateName=m;let h={gen:f,allErrors:this.opts.allErrors,data:r.default.data,parentData:r.default.parentData,parentDataProperty:r.default.parentDataProperty,dataNames:[r.default.data],dataPathArr:[t.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:f.scopeValue(`schema`,this.opts.code.source===!0?{ref:e.schema,code:(0,t.stringify)(e.schema)}:{ref:e.schema}),validateName:m,ValidationError:p,schema:e.schema,schemaEnv:e,rootId:s,baseId:e.baseId||s,schemaPath:t.nil,errSchemaPath:e.schemaPath||(this.opts.jtd?``:`#`),errorPath:(0,t._)`""`,opts:this.opts,self:this},g;try{this._compilations.add(e),(0,o.validateFunctionCode)(h),f.optimize(this.opts.code.optimize);let n=f.toString();g=`${f.scopeRefs(r.default.scope)}return ${n}`,this.opts.code.process&&(g=this.opts.code.process(g,e));let i=Function(`${r.default.self}`,`${r.default.scope}`,g)(this,this.scope.get());if(this.scope.value(m,{ref:i}),i.errors=null,i.schema=e.schema,i.schemaEnv=e,e.$async&&(i.$async=!0),this.opts.code.source===!0&&(i.source={validateName:m,validateCode:n,scopeValues:f._values}),this.opts.unevaluated){let{props:e,items:n}=h;i.evaluated={props:e instanceof t.Name?void 0:e,items:n instanceof t.Name?void 0:n,dynamicProps:e instanceof t.Name,dynamicItems:n instanceof t.Name},i.source&&(i.source.evaluated=(0,t.stringify)(i.evaluated))}return e.validate=i,e}catch(t){throw delete e.validate,delete e.validateName,g&&this.logger.error(`Error compiling schema, function code:`,g),t}finally{this._compilations.delete(e)}}e.compileSchema=c;function l(e,t,n){n=(0,i.resolveUrl)(this.opts.uriResolver,t,n);let r=e.refs[n];if(r)return r;let a=p.call(this,e,n);if(a===void 0){let r=e.localRefs?.[n],{schemaId:i}=this.opts;r&&(a=new s({schema:r,schemaId:i,root:e,baseId:t}))}if(a!==void 0)return e.refs[n]=u.call(this,a)}e.resolveRef=l;function u(e){return(0,i.inlineRef)(e.schema,this.opts.inlineRefs)?e.schema:e.validate?e:c.call(this,e)}function d(e){for(let t of this._compilations)if(f(t,e))return t}e.getCompilingSchema=d;function f(e,t){return e.schema===t.schema&&e.root===t.root&&e.baseId===t.baseId}function p(e,t){let n;for(;typeof(n=this.refs[t])==`string`;)t=n;return n||this.schemas[t]||m.call(this,e,t)}function m(e,t){let n=this.opts.uriResolver.parse(t),r=(0,i._getFullPath)(this.opts.uriResolver,n),a=(0,i.getFullPath)(this.opts.uriResolver,e.baseId,void 0);if(Object.keys(e.schema).length>0&&r===a)return g.call(this,n,e);let o=(0,i.normalizeId)(r),l=this.refs[o]||this.schemas[o];if(typeof l==`string`){let t=m.call(this,e,l);return typeof t?.schema==`object`?g.call(this,n,t):void 0}if(typeof l?.schema==`object`){if(l.validate||c.call(this,l),o===(0,i.normalizeId)(t)){let{schema:t}=l,{schemaId:n}=this.opts,r=t[n];return r&&(a=(0,i.resolveUrl)(this.opts.uriResolver,a,r)),new s({schema:t,schemaId:n,root:e,baseId:a})}return g.call(this,n,l)}}e.resolveSchema=m;var h=new Set([`properties`,`patternProperties`,`enum`,`dependencies`,`definitions`]);function g(e,{baseId:t,schema:n,root:r}){if(e.fragment?.[0]!==`/`)return;for(let r of e.fragment.slice(1).split(`/`)){if(typeof n==`boolean`)return;let e=n[(0,a.unescapeFragment)(r)];if(e===void 0)return;n=e;let o=typeof n==`object`&&n[this.opts.schemaId];!h.has(r)&&o&&(t=(0,i.resolveUrl)(this.opts.uriResolver,t,o))}let o;if(typeof n!=`boolean`&&n.$ref&&!(0,a.schemaHasRulesButRef)(n,this.RULES)){let e=(0,i.resolveUrl)(this.opts.uriResolver,t,n.$ref);o=m.call(this,r,e)}let{schemaId:c}=this.opts;if(o||=new s({schema:n,schemaId:c,root:r,baseId:t}),o.schema!==o.root.schema)return o}})),gj=o({$id:()=>_j,additionalProperties:()=>!1,default:()=>Sj,description:()=>vj,properties:()=>xj,required:()=>bj,type:()=>yj}),_j,vj,yj,bj,xj,Sj,Cj=i((()=>{_j=`https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#`,vj=`Meta-schema for $data reference (JSON AnySchema extension proposal)`,yj=`object`,bj=[`$data`],xj={$data:{type:`string`,anyOf:[{format:`relative-json-pointer`},{format:`json-pointer`}]}},Sj={$id:_j,description:vj,type:yj,required:bj,properties:xj,additionalProperties:!1}})),wj=a(((e,t)=>{var 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),i=RegExp.prototype.test.bind(/^\d*$/u),a=RegExp.prototype.test.bind(/^[\da-f]{2}$/iu),o=RegExp.prototype.test.bind(/^[\da-z\-._~]$/iu),s=RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:@/]$/u),c=RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:@/?]$/u),l=RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:]$/u),u=Array(256);{let e=`0123456789ABCDEF`;for(let t=0;t<256;t++)u[t]=`%`+e[t>>4]+e[t&15]}function d(e){return e<2048?u[192|e>>6]+u[128|e&63]:e<65536?u[224|e>>12]+u[128|e>>6&63]+u[128|e&63]:u[240|e>>18]+u[128|e>>12&63]+u[128|e>>6&63]+u[128|e&63]}function f(e){let t=``,n=0,r=0;for(r=0;r<e.length;r++)if(n=e[r].charCodeAt(0),n!==48){if(!(n>=48&&n<=57||n>=65&&n<=70||n>=97&&n<=102))return``;t+=e[r];break}for(r+=1;r<e.length;r++){if(n=e[r].charCodeAt(0),!(n>=48&&n<=57||n>=65&&n<=70||n>=97&&n<=102))return``;t+=e[r]}return t}var 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);function _(e){if(e.length===0)return!1;for(let t=0;t<e.length;t++)if(!h(e[t])){if(e[t]===`%`&&t+2<e.length&&a(e.slice(t+1,t+3)))t+=2;else return!1}return!0}function v(e){let t=-1,n=0,r=-1,i=0;for(let a=0;a<e.length;a++)e[a]===`0`?(r===-1&&(r=a),i++,i>n&&(n=i,t=r)):(r=-1,i=0);if(n<2)return e.join(`:`);let a=e.slice(0,t).join(`:`),o=e.slice(t+n).join(`:`);return a+`::`+o}function y(e){let t=e.indexOf(`::`);if(t!==-1&&e.indexOf(`::`,t+1)!==-1)return;let n=t===-1?e.split(`:`):e.slice(0,t).split(`:`),i=t===-1?[]:e.slice(t+2).split(`:`);t!==-1&&(n.length===1&&n[0]===``&&(n.length=0),i.length===1&&i[0]===``&&(i.length=0));let a=n.concat(i),o=0;for(let e=0;e<a.length;e++){let n=a[e];if(n===``)return;if(n.indexOf(`.`)!==-1){if(e!==a.length-1||t!==-1&&i.length===0||!r(n))return;o+=2}else{if(!p(n))return;a[e]=parseInt(n,16).toString(16),o++}}if(t===-1)return o===8?v(a):void 0;if(o>=8)return;let s=a.slice(0,n.length);for(let e=o;e<8;e++)s.push(`0`);for(let e=n.length;e<a.length;e++)s.push(a[e]);return v(s)}function b(e){let t=e[0]===`[`&&e[e.length-1]===`]`;if((e[0]===`[`||e[e.length-1]===`]`)&&!t)return{host:e,isIPV6:!1,error:!0};let n=t?e.slice(1,-1):e;if(t&&m(n))return n=n.toLowerCase(),{host:`[${n}]`,escapedHost:n,isIPV6:!1,isIPVFuture:!0};if(x(n,`:`)<2)return{host:e,isIPV6:!1,error:t};let r=``,i=n.indexOf(`%`);if(i!==-1){let t=n.slice(i,i+3).toLowerCase()===`%25`?3:1;if(r=n.slice(i+t),!_(r))return{host:e,isIPV6:!1,error:!0};n=n.slice(0,i)}let a=y(n);return a===void 0?{host:e,isIPV6:!1,error:!0}:{host:a+(r?`%`+r:``),escapedHost:a+(r?`%25`+r:``),isIPV6:!0}}function x(e,t){let n=0;for(let r=0;r<e.length;r++)e[r]===t&&n++;return n}function S(e){let t=e,n=[],r=-1,i=0;for(;i=t.length;){if(i===1){if(t===`.`)break;if(t===`/`){n.push(`/`);break}n.push(t);break}if(i===2){if(t[0]===`.`){if(t[1]===`.`)break;if(t[1]===`/`){t=t.slice(2);continue}}else if(t[0]===`/`&&(t[1]===`.`||t[1]===`/`)){n.push(`/`);break}}else if(i===3&&t===`/..`){n.length!==0&&n.pop(),n.push(`/`);break}if(t[0]===`.`){if(t[1]===`.`){if(t[2]===`/`){t=t.slice(3);continue}}else if(t[1]===`/`){t=t.slice(2);continue}}else if(t[0]===`/`&&t[1]===`.`){if(t[2]===`/`){t=t.slice(2);continue}if(t[2]===`.`&&t[3]===`/`){t=t.slice(3),n.length!==0&&n.pop();continue}}if((r=t.indexOf(`/`,1))===-1){n.push(t);break}n.push(t.slice(0,r)),t=t.slice(r)}return n.join(``)}function C(e){if(e===``||e[0]===`/`)return S(e);let t=e.split(`/`),n=t.length-1,r=[],i=!1;for(let e=0;e<=n;e++){let a=t[e];a===`.`||a===`..`?(a===`..`&&(r.length!==0&&r[r.length-1]!==`..`?r.pop():r.push(`..`)),i=e===n):r.push(a)}return i&&r[r.length-1]!==`..`&&r.push(``),(r.length===0||r[0]===``||r[0].includes(`:`))&&r.unshift(`.`),r.join(`/`)}var w={"@":`%40`,"/":`%2F`,"?":`%3F`,"#":`%23`,":":`%3A`},ee=/[@/?#:]/g,T=/[@/?#]/g;function te(e,t){let n=t?T:ee;return n.lastIndex=0,e.replace(n,e=>w[e])}function ne(e,t=!1){if(e.indexOf(`%`)===-1)return e;let n=``;for(let r=0;r<e.length;r++){if(e[r]===`%`&&r+2<e.length){let i=e.slice(r+1,r+3);if(a(i)){let e=i.toUpperCase(),a=String.fromCharCode(parseInt(e,16));t&&o(a)?n+=a:n+=`%`+e,r+=2;continue}}n+=e[r]}return n}function re(e){let t=``;for(let n=0;n<e.length;n++){let r=e[n];if(r===`%`&&n+2<e.length){let r=e.slice(n+1,n+3);if(a(r)){let e=r.toUpperCase(),i=String.fromCharCode(parseInt(e,16));i!==`.`&&o(i)?t+=i:t+=`%`+e,n+=2;continue}}if(s(r))t+=r;else{let i=e.charCodeAt(n);if(i<128)t+=le(i)?r:u[i];else if(i<55296||i>57343)t+=d(i);else if(i<=56319&&n+1<e.length){let r=e.charCodeAt(n+1);r>=56320&&r<=57343?(t+=d(65536+(i-55296<<10)+(r-56320)),n++):t+=d(65533)}else t+=d(65533)}}return t}function ie(e,t=!1){let n=``,r=t&&e[0]!==`/`;for(let t=0;t<e.length;t++){let i=e[t];if(i===`%`&&t+2<e.length){let r=e.slice(t+1,t+3);if(a(r)){n+=`%`+r.toUpperCase(),t+=2;continue}}if(i===`/`&&(r=!1),s(i)&&(i!==`:`||!r))n+=i;else{let r=e.charCodeAt(t);if(r<128)n+=u[r];else if(r<55296||r>57343)n+=d(r);else if(r<=56319&&t+1<e.length){let i=e.charCodeAt(t+1);i>=56320&&i<=57343?(n+=d(65536+(r-55296<<10)+(i-56320)),t++):n+=d(65533)}else n+=d(65533)}}return n}function ae(e,t){let n=``;for(let r=0;r<e.length;r++){let i=e[r];if(i===`%`&&r+2<e.length){let t=e.slice(r+1,r+3);if(a(t)){n+=`%`+t.toUpperCase(),r+=2;continue}}if(t(i))n+=i;else{let t=e.charCodeAt(r);if(t<128)n+=u[t];else if(t<55296||t>57343)n+=d(t);else if(t<=56319&&r+1<e.length){let i=e.charCodeAt(r+1);i>=56320&&i<=57343?(n+=d(65536+(t-55296<<10)+(i-56320)),r++):n+=d(65533)}else n+=d(65533)}}return n}function oe(e){return ae(e,l)}function se(e){return ae(e,c)}function ce(e){return ae(e,c)}function le(e){return e>=48&&e<=57||e>=65&&e<=90||e>=97&&e<=122||e===42||e===43||e===45||e===46||e===47||e===64||e===95}function ue(e){let t=``;for(let n=0;n<e.length;n++){let r=e[n];if(r===`%`&&n+2<e.length){let r=e.slice(n+1,n+3);if(a(r)){let e=r.toUpperCase(),i=String.fromCharCode(parseInt(e,16));o(i)?t+=i:t+=`%`+e,n+=2;continue}}if(c(r))t+=r;else{let i=e.charCodeAt(n);if(i<128)t+=le(i)?r:u[i];else if(i<55296||i>57343)t+=d(i);else if(i<=56319&&n+1<e.length){let r=e.charCodeAt(n+1);r>=56320&&r<=57343?(t+=d(65536+(i-55296<<10)+(r-56320)),n++):t+=d(65533)}else t+=d(65533)}}return t}function de(e){let t=``;for(let n=0;n<e.length;n++){if(e[n]===`%`&&n+2<e.length){let r=e.slice(n+1,n+3);if(a(r)){t+=`%`+r.toUpperCase(),n+=2;continue}}t+=escape(e[n])}return t}function fe(e){let t=[];if(e.userinfo!==void 0&&(t.push(oe(e.userinfo)),t.push(`@`)),e.host!==void 0){let n=e.host;if(!r(n)){let e=b(n);e.isIPV6!==!0&&e.isIPVFuture!==!0&&(n=ne(n,!0),e=b(n)),n=e.isIPV6===!0||e.isIPVFuture===!0?`[${e.escapedHost}]`:te(n,!1)}t.push(n)}if(typeof e.port==`number`||typeof e.port==`string`){let n=String(e.port);if(!i(n))throw TypeError(`URI port is malformed.`);t.push(`:`),t.push(n)}return t.length?t.join(``):void 0}t.exports={nonSimpleDomain:g,recomposeAuthority:fe,reescapeHostDelimiters:te,normalizePercentEncoding:ne,normalizePathEncoding:re,serializePathEncoding:ie,normalizeQueryFragmentEncoding:ue,encodeUserinfo:oe,encodeQuery:se,encodeFragment:ce,escapePreservingEscapes:de,removeDotSegments:S,removeDotSegmentsRelative:C,isIPv4:r,isUUID:n,normalizeIPv6:b,stringArrayToHexStripped:f}})),Tj=a(((e,t)=>{var{isUUID:n}=wj(),r=/^([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-./:;=@]|%[\da-f]{2})+)$/iu,i=[`http`,`https`,`ws`,`wss`,`urn`,`urn:uuid`];function a(e){return i.indexOf(e)!==-1}function o(e){return e.secure===!0?!0:e.secure===!1?!1:e.scheme?e.scheme.length===3&&(e.scheme[0]===`w`||e.scheme[0]===`W`)&&(e.scheme[1]===`s`||e.scheme[1]===`S`)&&(e.scheme[2]===`s`||e.scheme[2]===`S`):!1}function s(e){return e.host||(e.error=e.error||`HTTP URIs must have a host.`),e}function c(e){let t=String(e.scheme).toLowerCase()===`https`;return(e.port===(t?443:80)||e.port===``)&&(e.port=void 0),e.path||=`/`,e}function l(e){return e.secure=o(e),e.resourceName=(e.path||`/`)+(e.query?`?`+e.query:``),e.path=void 0,e.query=void 0,e}function u(e){if((e.port===(o(e)?443:80)||e.port===``)&&(e.port=void 0),typeof e.secure==`boolean`&&(e.scheme=e.secure?`wss`:`ws`,e.secure=void 0),e.resourceName){let t=e.resourceName.indexOf(`?`),n=t===-1?e.resourceName:e.resourceName.slice(0,t);e.path=n&&n!==`/`?n:void 0,e.query=t===-1?void 0:e.resourceName.slice(t+1),e.resourceName=void 0}return e.fragment=void 0,e}function d(e,t){if(!e.path)return e.error=`URN can not be parsed`,e;let n=e.path.match(r);if(n&&n[0]===e.path){let r=t.scheme||e.scheme||`urn`;e.nid=n[1].toLowerCase(),e.nss=n[2];let i=y(`${r}:${t.nid||e.nid}`);e.path=void 0,i&&(e=i.parse(e,t))}else e.error=e.error||`URN can not be parsed.`;return e}function f(e,t){if(e.nid===void 0)throw Error(`URN without nid cannot be serialized`);let n=t.scheme||e.scheme||`urn`,r=e.nid.toLowerCase(),i=y(`${n}:${t.nid||r}`);i&&(e=i.serialize(e,t));let a=e,o=e.nss;return a.path=`${r||t.nid}:${o}`,t.skipEscape=!0,a}function p(e,t){let r=e;return r.uuid=r.nss,r.nss=void 0,t.tolerant||r.uuid&&n(r.uuid)||(r.error=r.error||`UUID is not valid.`),r}function m(e){let t=e;return t.nss=(e.uuid||``).toLowerCase(),t}var h={scheme:`http`,domainHost:!0,parse:s,serialize:c},g={scheme:`https`,domainHost:h.domainHost,parse:s,serialize:c},_={scheme:`ws`,domainHost:!0,parse:l,serialize:u},v={http:h,https:g,ws:_,wss:{scheme:`wss`,domainHost:_.domainHost,parse:_.parse,serialize:_.serialize},urn:{scheme:`urn`,parse:d,serialize:f,skipNormalize:!0},"urn:uuid":{scheme:`urn:uuid`,parse:p,serialize:m,skipNormalize:!0}};Object.setPrototypeOf(v,null);function y(e){return e&&(v[e]||v[e.toLowerCase()])||void 0}t.exports={wsIsSecure:o,SCHEMES:v,isValidSchemeName:a,getSchemeHandler:y}})),Ej=a(((e,t)=>{var{normalizeIPv6:n,removeDotSegments:r,removeDotSegmentsRelative:i,recomposeAuthority:a,normalizePercentEncoding:o,normalizePathEncoding:s,serializePathEncoding:c,normalizeQueryFragmentEncoding:l,encodeQuery:u,encodeFragment:d,reescapeHostDelimiters:f,isIPv4:p,nonSimpleDomain:m}=wj(),{SCHEMES:h,getSchemeHandler:g}=Tj(),_=/^[A-Za-z][A-Za-z0-9+.-]*$/u,v=`URI scheme is malformed.`,y=`URI host is malformed.`,b=/[\0-\x20"#/:<>?@[\\\]^`{|}\x7F]/u;function x(e){let t=String(e);if(!_.test(t))throw TypeError(v);return t}function S(e,t){return typeof e==`string`?e=pe(e,t):typeof e==`object`&&(e=fe(T(e,t),t)),e}function C(e,t,r){let i=r?Object.assign({scheme:`null`},r):{scheme:`null`},{parsed:a,malformedAuthorityOrPort:o,malformedPercentEncoding:s,malformedSchemeSpecific:c,malformedHost:l,malformedScheme:u}=de(e,i),{parsed:d,malformedAuthorityOrPort:f,malformedPercentEncoding:m,malformedSchemeSpecific:h,malformedHost:_,malformedScheme:v}=de(t,i);if(o||f||s||m||c||h||l||_||u||v)throw Error(a.error||d.error||`URI is malformed.`);let b=w(a,d,i,!0),x=g(r&&r.scheme||b.scheme),S=b.host,C=S!==void 0&&S!==``&&(p(S)||n(S).isIPV6);if(le(b,r||{},x,C))throw Error(y);ce(b,r||{},x,C);let ee=S&&S.indexOf(`%`)!==-1&&!/\P{ASCII}/u.test(S);if(b.error&&!ee)throw Error(b.error);return i.skipEscape=!0,T(b,i)}function w(e,t,n,a){let o={};if(a||(e=fe(T(e,n),n),t=fe(T(t,n),n)),n||={},!n.tolerant&&t.scheme)o.scheme=t.scheme,o.userinfo=t.userinfo,o.host=t.host,o.port=t.port,o.path=r(t.path||``),o.query=t.query;else{if(t.userinfo!==void 0||t.host!==void 0||t.port!==void 0)o.userinfo=t.userinfo,o.host=t.host,o.port=t.port,o.path=r(t.path||``),o.query=t.query;else{if(!t.path)o.path=e.path,o.query=t.query===void 0?e.query:t.query;else{if(t.path[0]===`/`)o.path=r(t.path);else{let n=e.userinfo!==void 0||e.host!==void 0||e.port!==void 0;o.path=n&&!e.path?`/`+t.path:e.path?e.path.slice(0,e.path.lastIndexOf(`/`)+1)+t.path:t.path,o.path=e.scheme===void 0&&!n&&o.path[0]!==`/`?i(o.path):r(o.path)}o.query=t.query}o.userinfo=e.userinfo,o.host=e.host,o.port=e.port}o.scheme=e.scheme}return o.fragment=t.fragment,o}function ee(e,t,n){let r=he(e,n),i=he(t,n);return r!==void 0&&i!==void 0&&r===i}function T(e,t){let n={host:e.host,scheme:e.scheme,userinfo:e.userinfo,port:e.port,path:e.path,query:e.query,nid:e.nid,nss:e.nss,uuid:e.uuid,fragment:e.fragment,reference:e.reference,resourceName:e.resourceName,secure:e.secure,error:``},s=Object.assign({},t),l=[];n.scheme&&=x(n.scheme);let f=g(s.scheme||n.scheme);f&&f.serialize&&f.serialize(n,s);let p=n.userinfo!==void 0||n.host!==void 0||n.port!==void 0,m=(n.scheme===void 0||s.reference===`suffix`)&&!p,h=!s.skipEscape&&m;n.path!==void 0&&(n.path=s.skipEscape?o(n.path):c(n.path,h)),s.reference!==`suffix`&&n.scheme&&(n.scheme=x(n.scheme),l.push(n.scheme,`:`));let _=a(n);if(_!==void 0&&(s.reference!==`suffix`&&l.push(`//`),l.push(_),n.path&&n.path[0]!==`/`&&l.push(`/`)),n.path!==void 0){let e=n.path;s.absolutePath||f&&f.absolutePath||(e=m&&e[0]!==`/`?i(e):r(e)),m&&(e=c(e,!0)),_===void 0&&e[0]===`/`&&e[1]===`/`&&(e=`/%2F`+e.slice(2)),l.push(e)}return n.query!==void 0&&l.push(`?`,u(n.query)),n.fragment!==void 0&&l.push(`#`,d(n.fragment)),l.join(``)}var te=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u,ne=/^(?:[^#/:?]+:)?\/\/([^/?#]*)/,re=/^(?:[^#/:?]+:)?([/\\\t\n\r]*)/;function ie(e,t){if(t[2]!==void 0&&e.path&&e.path[0]!==`/`)return`URI path must start with "/" when authority is present.`;if(typeof e.port==`number`&&(e.port<0||e.port>65535))return`URI port is malformed.`}function ae(e){if(e===void 0)return!1;let t=e.indexOf(`%`);for(;t!==-1;){if(t+2>=e.length||!/^[\da-f]{2}$/iu.test(e.slice(t+1,t+3)))return!0;t=e.indexOf(`%`,t+3)}return!1}function oe(e){return e[0]===`[`&&e[e.length-1]===`]`}function se(e){let t=e[4];return ae(e[3])||t!==void 0&&!oe(t)&&ae(t)||ae(e[6])||ae(e[7])||ae(e[8])}function ce(e,t,n,r){if(le(e,t,n,r))return e.error=e.error||y,!0;if(!t.unicodeSupport&&(!n||!n.unicodeSupport)&&e.host&&!oe(e.host)&&(t.domainHost||n&&n.domainHost)&&r===!1&&m(e.host)){let t;try{t=new URL(`http://`+e.host)}catch(t){return e.error=e.error||`Host's domain name can not be converted to ASCII: `+t,!0}if(!ue(t))return e.error=e.error||y,!0;e.host=t.hostname}return!1}function le(e,t,n,r){return!!(e.host&&r===!1&&!oe(e.host)&&(t.domainHost||n&&n.domainHost)&&b.test(e.host))}function ue(e){return e.username===``&&e.password===``&&e.port===``&&e.pathname===`/`&&e.search===``&&e.hash===``&&e.hostname!==``}function de(e,t){let r=Object.assign({},t),i={scheme:void 0,userinfo:void 0,host:``,port:void 0,path:``,query:void 0,fragment:void 0},a=!1,c=!1,u=!1,d=!1,m=!1,b=!1,x=!1;r.reference===`suffix`&&(e=r.scheme?r.scheme+`:`+e:`//`+e);let S=e.match(ne);S!==null&&S[1].indexOf(`\\`)!==-1&&(i.error=`URI authority must not contain a literal backslash.`,a=!0);let C=e.match(re);if(C!==null){let e=C[1],t=e.replace(/[\t\n\r]/g,``);t.length>=2&&(t.slice(0,2)===`//`?e.length!==t.length&&(i.error=i.error||`URI authority introducer must not contain whitespace.`,a=!0):(i.error=i.error||`URI authority must not contain a literal backslash.`,a=!0))}let w=e.match(te);if(w){i.scheme=w[1],i.userinfo=w[3],i.host=w[4],i.port=parseInt(w[5],10),i.path=w[6]||``,i.query=w[7],i.fragment=w[8],i.scheme!==void 0&&(_.test(i.scheme)?i.scheme=i.scheme.toLowerCase():(i.error=i.error||v,b=!0)),c=se(w),c&&(i.error=i.error||`URI contains malformed percent-encoding.`),isNaN(i.port)&&(i.port=w[5]);let t=ie(i,w);if(t!==void 0&&(i.error=i.error||t,a=!0),i.host){if(p(i.host)===!1){let e=oe(i.host),t=i.host.indexOf(`[`)!==-1||i.host.indexOf(`]`)!==-1,r=n(i.host);x=r.isIPV6||r.isIPVFuture===!0,m=t&&(!e||r.error===!0),i.host=x?r.host:r.host.toLowerCase(),m&&(i.error=i.error||y,a=!0)}else x=!0}i.reference=i.scheme===void 0&&i.userinfo===void 0&&i.host===void 0&&i.port===void 0&&i.query===void 0&&!i.path?`same-document`:i.scheme===void 0?`relative`:i.fragment===void 0?`absolute`:`uri`,r.reference&&r.reference!==`suffix`&&r.reference!==i.reference&&(i.error=i.error||`URI is not a `+r.reference+` reference.`);let S=g(r.scheme||i.scheme);if(m||(d=ce(i,r,S,x)),e.indexOf(`%`)!==-1&&i.host!==void 0&&!m){let e=x?i.host:o(i.host,!0);x||(e=o(e.toLowerCase())),i.host=x||r.scheme!==`null`?f(e,x):e}(!S||S&&!S.skipNormalize)&&(i.path&&=s(i.path),i.query&&=l(i.query),i.fragment&&=l(i.fragment)),S&&S.parse&&(S.parse(i,r),S===h.urn&&i.nid===void 0&&(u=!0))}else i.error=i.error||`URI can not be parsed.`;return{parsed:i,malformedAuthorityOrPort:a,malformedPercentEncoding:c,malformedSchemeSpecific:u,malformedHost:d,malformedScheme:b}}function fe(e,t){return de(e,t).parsed}function pe(e,t){return me(e,t).normalized}function me(e,t){let{parsed:n,malformedAuthorityOrPort:r,malformedPercentEncoding:i,malformedSchemeSpecific:a,malformedHost:o,malformedScheme:s}=de(e,t);return{normalized:r||i||a||o||s?e:T(n,t),malformedAuthorityOrPort:r,malformedPercentEncoding:i,malformedSchemeSpecific:a,malformedHost:o,malformedScheme:s}}function he(e,t){if(typeof e!=`string`&&typeof e!=`object`)return;let n;try{n=typeof e==`string`?e:T(e,t)}catch{return}let{normalized:r,malformedAuthorityOrPort:i,malformedPercentEncoding:a,malformedSchemeSpecific:o,malformedHost:s,malformedScheme:c}=me(n,t);return i||a||o||s||c?void 0:r}var ge={SCHEMES:h,normalize:S,resolve:C,resolveComponent:w,equal:ee,serialize:T,parse:fe};t.exports=ge,t.exports.default=ge,t.exports.fastUri=ge})),Dj=a((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=Ej();t.code=`require("ajv/dist/runtime/uri").default`,e.default=t})),Oj=a((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.CodeGen=e.Name=e.nil=e.stringify=e.str=e._=e.KeywordCxt=void 0;var t=fj();Object.defineProperty(e,"KeywordCxt",{enumerable:!0,get:function(){return t.KeywordCxt}});var n=Q();Object.defineProperty(e,"_",{enumerable:!0,get:function(){return n._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return n.str}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return n.stringify}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return n.nil}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return n.Name}}),Object.defineProperty(e,"CodeGen",{enumerable:!0,get:function(){return n.CodeGen}});var r=pj(),i=mj(),a=nj(),o=hj(),s=Q(),l=dj(),u=ij(),d=$(),f=(Cj(),c(gj).default),p=Dj(),m=(e,t)=>new RegExp(e,t);m.code=`new RegExp`;var h=[`removeAdditional`,`useDefaults`,`coerceTypes`],g=new Set([`validate`,`serialize`,`parse`,`wrapper`,`root`,`schema`,`keyword`,`pattern`,`formats`,`validate$data`,`func`,`obj`,`Error`]),_={errorDataPath:``,format:"`validateFormats: false` can be used instead.",nullable:`"nullable" keyword is supported by default.`,jsonPointers:`Deprecated jsPropertySyntax can be used instead.`,extendRefs:`Deprecated ignoreKeywordsWithRef can be used instead.`,missingRefs:`Pass empty schema with $id that should be ignored to ajv.addSchema.`,processCode:"Use option `code: {process: (code, schemaEnv: object) => string}`",sourceCode:"Use option `code: {source: true}`",strictDefaults:"It is default now, see option `strict`.",strictKeywords:"It is default now, see option `strict`.",uniqueItems:`"uniqueItems" keyword is always validated.`,unknownFormats:"Disable strict mode or pass `true` to `ajv.addFormat` (or `formats` option).",cache:`Map is used as cache, schema object as key.`,serialize:`Map is used as cache, schema object as key.`,ajvErrors:`It is default now.`},v={ignoreKeywordsWithRef:``,jsPropertySyntax:``,unicode:`"minLength"/"maxLength" account for unicode characters by default.`},y=200;function b(e){let t=e.strict,n=e.code?.optimize,r=n===!0||n===void 0?1:n||0,i=e.code?.regExp??m,a=e.uriResolver??p.default;return{strictSchema:e.strictSchema??t??!0,strictNumbers:e.strictNumbers??t??!0,strictTypes:e.strictTypes??t??`log`,strictTuples:e.strictTuples??t??`log`,strictRequired:e.strictRequired??t??!1,code:e.code?{...e.code,optimize:r,regExp:i}:{optimize:r,regExp:i},loopRequired:e.loopRequired??y,loopEnum:e.loopEnum??y,meta:e.meta??!0,messages:e.messages??!0,inlineRefs:e.inlineRefs??!0,schemaId:e.schemaId??`$id`,addUsedSchema:e.addUsedSchema??!0,validateSchema:e.validateSchema??!0,validateFormats:e.validateFormats??!0,unicodeRegExp:e.unicodeRegExp??!0,int32range:e.int32range??!0,uriResolver:a}}var x=class{constructor(e={}){this.schemas={},this.refs={},this.formats=Object.create(null),this._compilations=new Set,this._loading={},this._cache=new Map,e=this.opts={...e,...b(e)};let{es5:t,lines:n}=this.opts.code;this.scope=new s.ValueScope({scope:{},prefixes:g,es5:t,lines:n}),this.logger=re(e.logger);let r=e.validateFormats;e.validateFormats=!1,this.RULES=(0,a.getRules)(),S.call(this,_,e,`NOT SUPPORTED`),S.call(this,v,e,`DEPRECATED`,`warn`),this._metaOpts=te.call(this),e.formats&&ee.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),e.keywords&&T.call(this,e.keywords),typeof e.meta==`object`&&this.addMetaSchema(e.meta),w.call(this),e.validateFormats=r}_addVocabularies(){this.addKeyword(`$async`)}_addDefaultMetaSchema(){let{$data:e,meta:t,schemaId:n}=this.opts,r=f;n===`id`&&(r={...f},r.id=r.$id,delete r.$id),t&&e&&this.addMetaSchema(r,r[n],!1)}defaultMeta(){let{meta:e,schemaId:t}=this.opts;return this.opts.defaultMeta=typeof e==`object`?e[t]||e:void 0}validate(e,t){let n;if(typeof e==`string`){if(n=this.getSchema(e),!n)throw Error(`no schema with key or ref "${e}"`)}else n=this.compile(e);let r=n(t);return`$async`in n||(this.errors=n.errors),r}compile(e,t){let n=this._addSchema(e,t);return n.validate||this._compileSchemaEnv(n)}compileAsync(e,t){if(typeof this.opts.loadSchema!=`function`)throw Error(`options.loadSchema should be a function`);let{loadSchema:n}=this.opts;return r.call(this,e,t);async function r(e,t){await a.call(this,e.$schema);let n=this._addSchema(e,t);return n.validate||o.call(this,n)}async function a(e){e&&!this.getSchema(e)&&await r.call(this,{$ref:e},!0)}async function o(e){try{return this._compileSchemaEnv(e)}catch(t){if(!(t instanceof i.default))throw t;return s.call(this,t),await c.call(this,t.missingSchema),o.call(this,e)}}function s({missingSchema:e,missingRef:t}){if(this.refs[e])throw Error(`AnySchema ${e} is loaded but ${t} cannot be resolved`)}async function c(e){let n=await l.call(this,e);this.refs[e]||await a.call(this,n.$schema),this.refs[e]||this.addSchema(n,e,t)}async function l(e){let t=this._loading[e];if(t)return t;try{return await(this._loading[e]=n(e))}finally{delete this._loading[e]}}}addSchema(e,t,n,r=this.opts.validateSchema){if(Array.isArray(e)){for(let t of e)this.addSchema(t,void 0,n,r);return this}let i;if(typeof e==`object`){let{schemaId:t}=this.opts;if(i=e[t],i!==void 0&&typeof i!=`string`)throw Error(`schema ${t} must be string`)}return t=(0,l.normalizeId)(t||i),this._checkUnique(t),this.schemas[t]=this._addSchema(e,n,t,r,!0),this}addMetaSchema(e,t,n=this.opts.validateSchema){return this.addSchema(e,t,!0,n),this}validateSchema(e,t){if(typeof e==`boolean`)return!0;let n;if(n=e.$schema,n!==void 0&&typeof n!=`string`)throw Error(`$schema must be a string`);if(n=n||this.opts.defaultMeta||this.defaultMeta(),!n)return this.logger.warn(`meta-schema not available`),this.errors=null,!0;let r=this.validate(n,e);if(!r&&t){let e=`schema is invalid: `+this.errorsText();if(this.opts.validateSchema===`log`)this.logger.error(e);else throw Error(e)}return r}getSchema(e){let t;for(;typeof(t=C.call(this,e))==`string`;)e=t;if(t===void 0){let{schemaId:n}=this.opts,r=new o.SchemaEnv({schema:{},schemaId:n});if(t=o.resolveSchema.call(this,r,e),!t)return;this.refs[e]=t}return t.validate||this._compileSchemaEnv(t)}removeSchema(e){if(e instanceof RegExp)return this._removeAllSchemas(this.schemas,e),this._removeAllSchemas(this.refs,e),this;switch(typeof e){case`undefined`:return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case`string`:{let t=C.call(this,e);return typeof t==`object`&&this._cache.delete(t.schema),delete this.schemas[e],delete this.refs[e],this}case`object`:{let t=e;this._cache.delete(t);let n=e[this.opts.schemaId];return n&&(n=(0,l.normalizeId)(n),delete this.schemas[n],delete this.refs[n]),this}default:throw Error(`ajv.removeSchema: invalid parameter`)}}addVocabulary(e){for(let t of e)this.addKeyword(t);return this}addKeyword(e,t){let n;if(typeof e==`string`)n=e,typeof t==`object`&&(this.logger.warn(`these parameters are deprecated, see docs for addKeyword`),t.keyword=n);else if(typeof e==`object`&&t===void 0){if(t=e,n=t.keyword,Array.isArray(n)&&!n.length)throw Error(`addKeywords: keyword must be string or non-empty array`)}else throw Error(`invalid addKeywords parameters`);if(ae.call(this,n,t),!t)return(0,d.eachItem)(n,e=>oe.call(this,e)),this;ce.call(this,t);let r={...t,type:(0,u.getJSONTypes)(t.type),schemaType:(0,u.getJSONTypes)(t.schemaType)};return(0,d.eachItem)(n,r.type.length===0?e=>oe.call(this,e,r):e=>r.type.forEach(t=>oe.call(this,e,r,t))),this}getKeyword(e){let t=this.RULES.all[e];return typeof t==`object`?t.definition:!!t}removeKeyword(e){let{RULES:t}=this;delete t.keywords[e],delete t.all[e];for(let n of t.rules){let t=n.rules.findIndex(t=>t.keyword===e);t>=0&&n.rules.splice(t,1)}return this}addFormat(e,t){return typeof t==`string`&&(t=new RegExp(t)),this.formats[e]=t,this}errorsText(e=this.errors,{separator:t=`, `,dataVar:n=`data`}={}){return!e||e.length===0?`No errors`:e.map(e=>`${n}${e.instancePath} ${e.message}`).reduce((e,n)=>e+t+n)}$dataMetaSchema(e,t){let n=this.RULES.all;e=JSON.parse(JSON.stringify(e));for(let r of t){let t=r.split(`/`).slice(1),i=e;for(let e of t)i=i[e];for(let e in n){let t=n[e];if(typeof t!=`object`)continue;let{$data:r}=t.definition,a=i[e];r&&a&&(i[e]=ue(a))}}return e}_removeAllSchemas(e,t){for(let n in e){let r=e[n];(!t||t.test(n))&&(typeof r==`string`?delete e[n]:r&&!r.meta&&(this._cache.delete(r.schema),delete e[n]))}}_addSchema(e,t,n,r=this.opts.validateSchema,i=this.opts.addUsedSchema){let a,{schemaId:s}=this.opts;if(typeof e==`object`)a=e[s];else if(this.opts.jtd)throw Error(`schema must be object`);else if(typeof e!=`boolean`)throw Error(`schema must be object or boolean`);let c=this._cache.get(e);if(c!==void 0)return c;n=(0,l.normalizeId)(a||n);let u=l.getSchemaRefs.call(this,e,n);return c=new o.SchemaEnv({schema:e,schemaId:s,meta:t,baseId:n,localRefs:u}),this._cache.set(c.schema,c),i&&!n.startsWith(`#`)&&(n&&this._checkUnique(n),this.refs[n]=c),r&&this.validateSchema(e,!0),c}_checkUnique(e){if(this.schemas[e]||this.refs[e])throw Error(`schema with key or id "${e}" already exists`)}_compileSchemaEnv(e){if(e.meta?this._compileMetaSchema(e):o.compileSchema.call(this,e),!e.validate)throw Error(`ajv implementation error`);return e.validate}_compileMetaSchema(e){let t=this.opts;this.opts=this._metaOpts;try{o.compileSchema.call(this,e)}finally{this.opts=t}}};x.ValidationError=r.default,x.MissingRefError=i.default,e.default=x;function S(e,t,n,r=`error`){for(let i in e){let a=i;a in t&&this.logger[r](`${n}: option ${i}. ${e[a]}`)}}function C(e){return e=(0,l.normalizeId)(e),this.schemas[e]||this.refs[e]}function w(){let e=this.opts.schemas;if(e){if(Array.isArray(e))this.addSchema(e);else for(let t in e)this.addSchema(e[t],t)}}function ee(){for(let e in this.opts.formats){let t=this.opts.formats[e];t&&this.addFormat(e,t)}}function T(e){if(Array.isArray(e))this.addVocabulary(e);else{this.logger.warn(`keywords option as map is deprecated, pass array`);for(let t in e){let n=e[t];n.keyword||=t,this.addKeyword(n)}}}function te(){let e={...this.opts};for(let t of h)delete e[t];return e}var ne={log(){},warn(){},error(){}};function re(e){if(e===!1)return ne;if(e===void 0)return console;if(e.log&&e.warn&&e.error)return e;throw Error(`logger must implement log, warn and error methods`)}var ie=/^[a-z_$][a-z0-9_$:-]*$/i;function ae(e,t){let{RULES:n}=this;if((0,d.eachItem)(e,e=>{if(n.keywords[e])throw Error(`Keyword ${e} is already defined`);if(!ie.test(e))throw Error(`Keyword ${e} has invalid name`)}),t&&t.$data&&!(`code`in t||`validate`in t))throw Error(`$data keyword must have "code" or "validate" function`)}function oe(e,t,n){var r;let i=t?.post;if(n&&i)throw Error(`keyword with "post" flag cannot have "type"`);let{RULES:a}=this,o=i?a.post:a.rules.find(({type:e})=>e===n);if(o||(o={type:n,rules:[]},a.rules.push(o)),a.keywords[e]=!0,!t)return;let s={keyword:e,definition:{...t,type:(0,u.getJSONTypes)(t.type),schemaType:(0,u.getJSONTypes)(t.schemaType)}};t.before?se.call(this,o,s,t.before):o.rules.push(s),a.all[e]=s,(r=t.implements)==null||r.forEach(e=>this.addKeyword(e))}function se(e,t,n){let r=e.rules.findIndex(e=>e.keyword===n);r>=0?e.rules.splice(r,0,t):(e.rules.push(t),this.logger.warn(`rule ${n} is not defined`))}function ce(e){let{metaSchema:t}=e;t!==void 0&&(e.$data&&this.opts.$data&&(t=ue(t)),e.validateSchema=this.compile(t,!0))}var le={$ref:`https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#`};function ue(e){return{anyOf:[e,le]}}})),kj=a((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default={keyword:`id`,code(){throw Error(`NOT SUPPORTED: keyword "id", use "$id" for schema ID`)}}})),Aj=a((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.callRef=e.getValidate=void 0;var t=mj(),n=oj(),r=Q(),i=$A(),a=hj(),o=$(),s={keyword:`$ref`,schemaType:`string`,code(e){let{gen:n,schema:i,it:o}=e,{baseId:s,schemaEnv:u,validateName:d,opts:f,self:p}=o,{root:m}=u;if((i===`#`||i===`#/`)&&s===m.baseId)return g();let h=a.resolveRef.call(p,m,s,i);if(h===void 0)throw new t.default(o.opts.uriResolver,s,i);return h instanceof a.SchemaEnv?_(h):v(h);function g(){if(u===m)return l(e,d,u,u.$async);let t=n.scopeValue(`root`,{ref:m});return l(e,(0,r._)`${t}.validate`,m,m.$async)}function _(t){l(e,c(e,t),t,t.$async)}function v(t){let a=n.scopeValue(`schema`,f.code.source===!0?{ref:t,code:(0,r.stringify)(t)}:{ref:t}),o=n.name(`valid`),s=e.subschema({schema:t,dataTypes:[],schemaPath:r.nil,topSchemaRef:a,errSchemaPath:i},o);e.mergeEvaluated(s),e.ok(o)}}};function c(e,t){let{gen:n}=e;return t.validate?n.scopeValue(`validate`,{ref:t.validate}):(0,r._)`${n.scopeValue(`wrapper`,{ref:t})}.validate`}e.getValidate=c;function l(e,t,a,s){let{gen:c,it:l}=e,{allErrors:u,schemaEnv:d,opts:f}=l,p=f.passContext?i.default.this:r.nil;s?m():h();function m(){if(!d.$async)throw Error(`async schema referenced by sync schema`);let i=c.let(`valid`);c.try(()=>{c.code((0,r._)`await ${(0,n.callValidateCode)(e,t,p)}`),_(t),u||c.assign(i,!0)},e=>{c.if((0,r._)`!(${e} instanceof ${l.ValidationError})`,()=>c.throw(e)),g(e),u||c.assign(i,!1)}),e.ok(i)}function h(){e.result((0,n.callValidateCode)(e,t,p),()=>_(t),()=>g(t))}function g(e){let t=(0,r._)`${e}.errors`;c.assign(i.default.vErrors,(0,r._)`${i.default.vErrors} === null ? ${t} : ${i.default.vErrors}.concat(${t})`),c.assign(i.default.errors,(0,r._)`${i.default.vErrors}.length`)}function _(e){if(!l.opts.unevaluated)return;let t=a?.validate?.evaluated;if(l.props!==!0){if(t&&!t.dynamicProps)t.props!==void 0&&(l.props=o.mergeEvaluated.props(c,t.props,l.props));else{let t=c.var(`props`,(0,r._)`${e}.evaluated.props`);l.props=o.mergeEvaluated.props(c,t,l.props,r.Name)}}if(l.items!==!0){if(t&&!t.dynamicItems)t.items!==void 0&&(l.items=o.mergeEvaluated.items(c,t.items,l.items));else{let t=c.var(`items`,(0,r._)`${e}.evaluated.items`);l.items=o.mergeEvaluated.items(c,t,l.items,r.Name)}}}}e.callRef=l,e.default=s})),jj=a((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=kj(),n=Aj();e.default=[`$schema`,`$id`,`$defs`,`$vocabulary`,{keyword:`$comment`},`definitions`,t.default,n.default]})),Mj=a((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=Q(),n=t.operators,r={maximum:{okStr:`<=`,ok:n.LTE,fail:n.GT},minimum:{okStr:`>=`,ok:n.GTE,fail:n.LT},exclusiveMaximum:{okStr:`<`,ok:n.LT,fail:n.GTE},exclusiveMinimum:{okStr:`>`,ok:n.GT,fail:n.LTE}};e.default={keyword:Object.keys(r),type:`number`,schemaType:`number`,$data:!0,error:{message:({keyword:e,schemaCode:n})=>(0,t.str)`must be ${r[e].okStr} ${n}`,params:({keyword:e,schemaCode:n})=>(0,t._)`{comparison: ${r[e].okStr}, limit: ${n}}`},code(e){let{keyword:n,data:i,schemaCode:a}=e;e.fail$data((0,t._)`${i} ${r[n].fail} ${a} || isNaN(${i})`)}}})),Nj=a((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=Q();e.default={keyword:`multipleOf`,type:`number`,schemaType:`number`,$data:!0,error:{message:({schemaCode:e})=>(0,t.str)`must be multiple of ${e}`,params:({schemaCode:e})=>(0,t._)`{multipleOf: ${e}}`},code(e){let{gen:n,data:r,schemaCode:i,it:a}=e,o=a.opts.multipleOfPrecision,s=n.let(`res`),c=o?(0,t._)`Math.abs(Math.round(${s}) - ${s}) > 1e-${o}`:(0,t._)`${s} !== parseInt(${s})`;e.fail$data((0,t._)`(${i} === 0 || (${s} = ${r}/${i}, ${c}))`)}}})),Pj=a((e=>{Object.defineProperty(e,"__esModule",{value:!0});function t(e){let t=e.length,n=0,r=0,i;for(;r<t;)n++,i=e.charCodeAt(r++),i>=55296&&i<=56319&&r<t&&(i=e.charCodeAt(r),(i&64512)==56320&&r++);return n}e.default=t,t.code=`require("ajv/dist/runtime/ucs2length").default`})),Fj=a((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=Q(),n=$(),r=Pj();e.default={keyword:[`maxLength`,`minLength`],type:`string`,schemaType:`number`,$data:!0,error:{message({keyword:e,schemaCode:n}){let r=e===`maxLength`?`more`:`fewer`;return(0,t.str)`must NOT have ${r} than ${n} characters`},params:({schemaCode:e})=>(0,t._)`{limit: ${e}}`},code(e){let{keyword:i,data:a,schemaCode:o,it:s}=e,c=i===`maxLength`?t.operators.GT:t.operators.LT,l=s.opts.unicode===!1?(0,t._)`${a}.length`:(0,t._)`${(0,n.useFunc)(e.gen,r.default)}(${a})`;e.fail$data((0,t._)`${l} ${c} ${o}`)}}})),Ij=a((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=oj(),n=$(),r=Q();e.default={keyword:`pattern`,type:`string`,schemaType:`string`,$data:!0,error:{message:({schemaCode:e})=>(0,r.str)`must match pattern "${e}"`,params:({schemaCode:e})=>(0,r._)`{pattern: ${e}}`},code(e){let{gen:i,data:a,$data:o,schema:s,schemaCode:c,it:l}=e,u=l.opts.unicodeRegExp?`u`:``;if(o){let{regExp:t}=l.opts.code,o=t.code===`new RegExp`?(0,r._)`new RegExp`:(0,n.useFunc)(i,t),s=i.let(`valid`);i.try(()=>i.assign(s,(0,r._)`${o}(${c}, ${u}).test(${a})`),()=>i.assign(s,!1)),e.fail$data((0,r._)`!${s}`)}else{let n=(0,t.usePattern)(e,s);e.fail$data((0,r._)`!${n}.test(${a})`)}}}})),Lj=a((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=Q();e.default={keyword:[`maxProperties`,`minProperties`],type:`object`,schemaType:`number`,$data:!0,error:{message({keyword:e,schemaCode:n}){let r=e===`maxProperties`?`more`:`fewer`;return(0,t.str)`must NOT have ${r} than ${n} properties`},params:({schemaCode:e})=>(0,t._)`{limit: ${e}}`},code(e){let{keyword:n,data:r,schemaCode:i}=e,a=n===`maxProperties`?t.operators.GT:t.operators.LT;e.fail$data((0,t._)`Object.keys(${r}).length ${a} ${i}`)}}})),Rj=a((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=oj(),n=Q(),r=$();e.default={keyword:`required`,type:`object`,schemaType:`array`,$data:!0,error:{message:({params:{missingProperty:e}})=>(0,n.str)`must have required property '${e}'`,params:({params:{missingProperty:e}})=>(0,n._)`{missingProperty: ${e}}`},code(e){let{gen:i,schema:a,schemaCode:o,data:s,$data:c,it:l}=e,{opts:u}=l;if(!c&&a.length===0)return;let d=a.length>=u.loopRequired;if(l.allErrors?f():p(),u.strictRequired){let t=e.parentSchema.properties,{definedProperties:n}=e.it;for(let e of a)if(t?.[e]===void 0&&!n.has(e)){let t=`required property "${e}" is not defined at "${l.schemaEnv.baseId+l.errSchemaPath}" (strictRequired)`;(0,r.checkStrictMode)(l,t,l.opts.strictRequired)}}function f(){if(d||c)e.block$data(n.nil,m);else for(let n of a)(0,t.checkReportMissingProp)(e,n)}function p(){let n=i.let(`missing`);if(d||c){let t=i.let(`valid`,!0);e.block$data(t,()=>h(n,t)),e.ok(t)}else i.if((0,t.checkMissingProp)(e,a,n)),(0,t.reportMissingProp)(e,n),i.else()}function m(){i.forOf(`prop`,o,n=>{e.setParams({missingProperty:n}),i.if((0,t.noPropertyInData)(i,s,n,u.ownProperties),()=>e.error())})}function h(r,a){e.setParams({missingProperty:r}),i.forOf(r,o,()=>{i.assign(a,(0,t.propertyInData)(i,s,r,u.ownProperties)),i.if((0,n.not)(a),()=>{e.error(),i.break()})},n.nil)}}}})),zj=a((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=Q();e.default={keyword:[`maxItems`,`minItems`],type:`array`,schemaType:`number`,$data:!0,error:{message({keyword:e,schemaCode:n}){let r=e===`maxItems`?`more`:`fewer`;return(0,t.str)`must NOT have ${r} than ${n} items`},params:({schemaCode:e})=>(0,t._)`{limit: ${e}}`},code(e){let{keyword:n,data:r,schemaCode:i}=e,a=n===`maxItems`?t.operators.GT:t.operators.LT;e.fail$data((0,t._)`${r}.length ${a} ${i}`)}}})),Bj=a((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=lj();t.code=`require("ajv/dist/runtime/equal").default`,e.default=t})),Vj=a((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=ij(),n=Q(),r=$(),i=Bj();e.default={keyword:`uniqueItems`,type:`array`,schemaType:`boolean`,$data:!0,error:{message:({params:{i:e,j:t}})=>(0,n.str)`must NOT have duplicate items (items ## ${t} and ${e} are identical)`,params:({params:{i:e,j:t}})=>(0,n._)`{i: ${e}, j: ${t}}`},code(e){let{gen:a,data:o,$data:s,schema:c,parentSchema:l,schemaCode:u,it:d}=e;if(!s&&!c)return;let f=a.let(`valid`),p=l.items?(0,t.getSchemaTypes)(l.items):[];e.block$data(f,m,(0,n._)`${u} === false`),e.ok(f);function m(){let t=a.let(`i`,(0,n._)`${o}.length`),r=a.let(`j`);e.setParams({i:t,j:r}),a.assign(f,!0),a.if((0,n._)`${t} > 1`,()=>(h()?g:_)(t,r))}function h(){return p.length>0&&!p.some(e=>e===`object`||e===`array`)}function g(r,i){let s=a.name(`item`),c=(0,t.checkDataTypes)(p,s,d.opts.strictNumbers,t.DataType.Wrong),l=a.const(`indices`,(0,n._)`{}`);a.for((0,n._)`;${r}--;`,()=>{a.let(s,(0,n._)`${o}[${r}]`),a.if(c,(0,n._)`continue`),p.length>1&&a.if((0,n._)`typeof ${s} == "string"`,(0,n._)`${s} += "_"`),a.if((0,n._)`typeof ${l}[${s}] == "number"`,()=>{a.assign(i,(0,n._)`${l}[${s}]`),e.error(),a.assign(f,!1).break()}).code((0,n._)`${l}[${s}] = ${r}`)})}function _(t,s){let c=(0,r.useFunc)(a,i.default),l=a.name(`outer`);a.label(l).for((0,n._)`;${t}--;`,()=>a.for((0,n._)`${s} = ${t}; ${s}--;`,()=>a.if((0,n._)`${c}(${o}[${t}], ${o}[${s}])`,()=>{e.error(),a.assign(f,!1).break(l)})))}}}})),Hj=a((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=Q(),n=$(),r=Bj();e.default={keyword:`const`,$data:!0,error:{message:`must be equal to constant`,params:({schemaCode:e})=>(0,t._)`{allowedValue: ${e}}`},code(e){let{gen:i,data:a,$data:o,schemaCode:s,schema:c}=e;o||c&&typeof c==`object`?e.fail$data((0,t._)`!${(0,n.useFunc)(i,r.default)}(${a}, ${s})`):e.fail((0,t._)`${c} !== ${a}`)}}})),Uj=a((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=Q(),n=$(),r=Bj();e.default={keyword:`enum`,schemaType:`array`,$data:!0,error:{message:`must be equal to one of the allowed values`,params:({schemaCode:e})=>(0,t._)`{allowedValues: ${e}}`},code(e){let{gen:i,data:a,$data:o,schema:s,schemaCode:c,it:l}=e;if(!o&&s.length===0)throw Error(`enum must have non-empty array`);let u=s.length>=l.opts.loopEnum,d,f=()=>d??=(0,n.useFunc)(i,r.default),p;if(u||o)p=i.let(`valid`),e.block$data(p,m);else{if(!Array.isArray(s))throw Error(`ajv implementation error`);let e=i.const(`vSchema`,c);p=(0,t.or)(...s.map((t,n)=>h(e,n)))}e.pass(p);function m(){i.assign(p,!1),i.forOf(`v`,c,e=>i.if((0,t._)`${f()}(${a}, ${e})`,()=>i.assign(p,!0).break()))}function h(e,n){let r=s[n];return typeof r==`object`&&r?(0,t._)`${f()}(${a}, ${e}[${n}])`:(0,t._)`${a} === ${r}`}}}})),Wj=a((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=Mj(),n=Nj(),r=Fj(),i=Ij(),a=Lj(),o=Rj(),s=zj(),c=Vj(),l=Hj(),u=Uj();e.default=[t.default,n.default,r.default,i.default,a.default,o.default,s.default,c.default,{keyword:`type`,schemaType:[`string`,`array`]},{keyword:`nullable`,schemaType:`boolean`},l.default,u.default]})),Gj=a((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.validateAdditionalItems=void 0;var t=Q(),n=$(),r={keyword:`additionalItems`,type:`array`,schemaType:[`boolean`,`object`],before:`uniqueItems`,error:{message:({params:{len:e}})=>(0,t.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,t._)`{limit: ${e}}`},code(e){let{parentSchema:t,it:r}=e,{items:a}=t;Array.isArray(a)?i(e,a):(0,n.checkStrictMode)(r,`"additionalItems" is ignored when "items" is not an array of schemas`)}};function i(e,r){let{gen:i,schema:a,data:o,keyword:s,it:c}=e;c.items=!0;let l=i.const(`len`,(0,t._)`${o}.length`);if(a===!1)e.setParams({len:r.length}),e.pass((0,t._)`${l} <= ${r.length}`);else if(typeof a==`object`&&!(0,n.alwaysValidSchema)(c,a)){let n=i.var(`valid`,(0,t._)`${l} <= ${r.length}`);i.if((0,t.not)(n),()=>u(n)),e.ok(n)}function u(a){i.forRange(`i`,r.length,l,r=>{e.subschema({keyword:s,dataProp:r,dataPropType:n.Type.Num},a),c.allErrors||i.if((0,t.not)(a),()=>i.break())})}}e.validateAdditionalItems=i,e.default=r})),Kj=a((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.validateTuple=void 0;var t=Q(),n=$(),r=oj(),i={keyword:`items`,type:`array`,schemaType:[`object`,`array`,`boolean`],before:`uniqueItems`,code(e){let{schema:t,it:i}=e;if(Array.isArray(t))return a(e,`additionalItems`,t);i.items=!0,(0,n.alwaysValidSchema)(i,t)||e.ok((0,r.validateArray)(e))}};function a(e,r,i=e.schema){let{gen:a,parentSchema:o,data:s,keyword:c,it:l}=e;f(o),l.opts.unevaluated&&i.length&&l.items!==!0&&(l.items=n.mergeEvaluated.items(a,i.length,l.items));let u=a.name(`valid`),d=a.const(`len`,(0,t._)`${s}.length`);i.forEach((r,i)=>{(0,n.alwaysValidSchema)(l,r)||(a.if((0,t._)`${d} > ${i}`,()=>e.subschema({keyword:c,schemaProp:i,dataProp:i},u)),e.ok(u))});function f(e){let{opts:t,errSchemaPath:a}=l,o=i.length,s=o===e.minItems&&(o===e.maxItems||e[r]===!1);if(t.strictTuples&&!s){let e=`"${c}" is ${o}-tuple, but minItems or maxItems/${r} are not specified or different at path "${a}"`;(0,n.checkStrictMode)(l,e,t.strictTuples)}}}e.validateTuple=a,e.default=i})),qj=a((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=Kj();e.default={keyword:`prefixItems`,type:`array`,schemaType:[`array`],before:`uniqueItems`,code:e=>(0,t.validateTuple)(e,`items`)}})),Jj=a((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=Q(),n=$(),r=oj(),i=Gj();e.default={keyword:`items`,type:`array`,schemaType:[`object`,`boolean`],before:`uniqueItems`,error:{message:({params:{len:e}})=>(0,t.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,t._)`{limit: ${e}}`},code(e){let{schema:t,parentSchema:a,it:o}=e,{prefixItems:s}=a;o.items=!0,(0,n.alwaysValidSchema)(o,t)||(s?(0,i.validateAdditionalItems)(e,s):e.ok((0,r.validateArray)(e)))}}})),Yj=a((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=Q(),n=$();e.default={keyword:`contains`,type:`array`,schemaType:[`object`,`boolean`],before:`uniqueItems`,trackErrors:!0,error:{message:({params:{min:e,max:n}})=>n===void 0?(0,t.str)`must contain at least ${e} valid item(s)`:(0,t.str)`must contain at least ${e} and no more than ${n} valid item(s)`,params:({params:{min:e,max:n}})=>n===void 0?(0,t._)`{minContains: ${e}}`:(0,t._)`{minContains: ${e}, maxContains: ${n}}`},code(e){let{gen:r,schema:i,parentSchema:a,data:o,it:s}=e,c,l,{minContains:u,maxContains:d}=a;s.opts.next?(c=u===void 0?1:u,l=d):c=1;let f=r.const(`len`,(0,t._)`${o}.length`);if(e.setParams({min:c,max:l}),l===void 0&&c===0){(0,n.checkStrictMode)(s,`"minContains" == 0 without "maxContains": "contains" keyword ignored`);return}if(l!==void 0&&c>l){(0,n.checkStrictMode)(s,`"minContains" > "maxContains" is always invalid`),e.fail();return}if((0,n.alwaysValidSchema)(s,i)){let n=(0,t._)`${f} >= ${c}`;l!==void 0&&(n=(0,t._)`${n} && ${f} <= ${l}`),e.pass(n);return}s.items=!0;let p=r.name(`valid`);l===void 0&&c===1?h(p,()=>r.if(p,()=>r.break())):c===0?(r.let(p,!0),l!==void 0&&r.if((0,t._)`${o}.length > 0`,m)):(r.let(p,!1),m()),e.result(p,()=>e.reset());function m(){let e=r.name(`_valid`),t=r.let(`count`,0);h(e,()=>r.if(e,()=>g(t)))}function h(t,i){r.forRange(`i`,0,f,r=>{e.subschema({keyword:`contains`,dataProp:r,dataPropType:n.Type.Num,compositeRule:!0},t),i()})}function g(e){r.code((0,t._)`${e}++`),l===void 0?r.if((0,t._)`${e} >= ${c}`,()=>r.assign(p,!0).break()):(r.if((0,t._)`${e} > ${l}`,()=>r.assign(p,!1).break()),c===1?r.assign(p,!0):r.if((0,t._)`${e} >= ${c}`,()=>r.assign(p,!0)))}}}})),Xj=a((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.validateSchemaDeps=e.validatePropertyDeps=e.error=void 0;var t=Q(),n=$(),r=oj();e.error={message:({params:{property:e,depsCount:n,deps:r}})=>{let i=n===1?`property`:`properties`;return(0,t.str)`must have ${i} ${r} when property ${e} is present`},params:({params:{property:e,depsCount:n,deps:r,missingProperty:i}})=>(0,t._)`{property: ${e},
645
648
  missingProperty: ${i},
646
649
  depsCount: ${n},
647
- deps: ${r}}`};var i={keyword:`dependencies`,type:`object`,schemaType:`object`,error:e.error,code(e){let[t,n]=a(e);o(e,t),s(e,n)}};function a({schema:e}){let t={},n={};for(let r in e){if(r===`__proto__`)continue;let i=Array.isArray(e[r])?t:n;i[r]=e[r]}return[t,n]}function o(e,n=e.schema){let{gen:i,data:a,it:o}=e;if(Object.keys(n).length===0)return;let s=i.let(`missing`);for(let c in n){let l=n[c];if(l.length===0)continue;let u=(0,r.propertyInData)(i,a,c,o.opts.ownProperties);e.setParams({property:c,depsCount:l.length,deps:l.join(`, `)}),o.allErrors?i.if(u,()=>{for(let t of l)(0,r.checkReportMissingProp)(e,t)}):(i.if((0,t._)`${u} && (${(0,r.checkMissingProp)(e,l,s)})`),(0,r.reportMissingProp)(e,s),i.else())}}e.validatePropertyDeps=o;function s(e,t=e.schema){let{gen:i,data:a,keyword:o,it:s}=e,c=i.name(`valid`);for(let l in t)(0,n.alwaysValidSchema)(s,t[l])||(i.if((0,r.propertyInData)(i,a,l,s.opts.ownProperties),()=>{let t=e.subschema({keyword:o,schemaProp:l},c);e.mergeValidEvaluated(t,c)},()=>i.var(c,!0)),e.ok(c))}e.validateSchemaDeps=s,e.default=i})),Xj=a((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=Q(),n=$();e.default={keyword:`propertyNames`,type:`object`,schemaType:[`object`,`boolean`],error:{message:`property name must be valid`,params:({params:e})=>(0,t._)`{propertyName: ${e.propertyName}}`},code(e){let{gen:r,schema:i,data:a,it:o}=e;if((0,n.alwaysValidSchema)(o,i))return;let s=r.name(`valid`);r.forIn(`key`,a,n=>{e.setParams({propertyName:n}),e.subschema({keyword:`propertyNames`,data:n,dataTypes:[`string`],propertyName:n,compositeRule:!0},s),r.if((0,t.not)(s),()=>{e.error(!0),o.allErrors||r.break()})}),e.ok(s)}}})),Zj=a((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=aj(),n=Q(),r=QA(),i=$();e.default={keyword:`additionalProperties`,type:[`object`],schemaType:[`boolean`,`object`],allowUndefined:!0,trackErrors:!0,error:{message:`must NOT have additional properties`,params:({params:e})=>(0,n._)`{additionalProperty: ${e.additionalProperty}}`},code(e){let{gen:a,schema:o,parentSchema:s,data:c,errsCount:l,it:u}=e;if(!l)throw Error(`ajv implementation error`);let{allErrors:d,opts:f}=u;if(u.props=!0,f.removeAdditional!==`all`&&(0,i.alwaysValidSchema)(u,o))return;let p=(0,t.allSchemaProperties)(s.properties),m=(0,t.allSchemaProperties)(s.patternProperties);h(),e.ok((0,n._)`${l} === ${r.default.errors}`);function h(){a.forIn(`key`,c,e=>{!p.length&&!m.length?v(e):a.if(g(e),()=>v(e))})}function g(r){let o;if(p.length>8){let e=(0,i.schemaRefOrVal)(u,s.properties,`properties`);o=(0,t.isOwnProperty)(a,e,r)}else o=p.length?(0,n.or)(...p.map(e=>(0,n._)`${r} === ${e}`)):n.nil;return m.length&&(o=(0,n.or)(o,...m.map(i=>(0,n._)`${(0,t.usePattern)(e,i)}.test(${r})`))),(0,n.not)(o)}function _(e){a.code((0,n._)`delete ${c}[${e}]`)}function v(t){if(f.removeAdditional===`all`||f.removeAdditional&&o===!1)_(t);else if(o===!1)e.setParams({additionalProperty:t}),e.error(),d||a.break();else if(typeof o==`object`&&!(0,i.alwaysValidSchema)(u,o)){let r=a.name(`valid`);f.removeAdditional===`failing`?(y(t,r,!1),a.if((0,n.not)(r),()=>{e.reset(),_(t)})):(y(t,r),d||a.if((0,n.not)(r),()=>a.break()))}}function y(t,n,r){let a={keyword:`additionalProperties`,dataProp:t,dataPropType:i.Type.Str};r===!1&&Object.assign(a,{compositeRule:!0,createErrors:!1,allErrors:!1}),e.subschema(a,n)}}}})),Qj=a((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=dj(),n=aj(),r=$(),i=Zj();e.default={keyword:`properties`,type:`object`,schemaType:`object`,code(e){let{gen:a,schema:o,parentSchema:s,data:c,it:l}=e;l.opts.removeAdditional===`all`&&s.additionalProperties===void 0&&i.default.code(new t.KeywordCxt(l,i.default,`additionalProperties`));let u=(0,n.allSchemaProperties)(o);for(let e of u)l.definedProperties.add(e);l.opts.unevaluated&&u.length&&l.props!==!0&&(l.props=r.mergeEvaluated.props(a,(0,r.toHash)(u),l.props));let d=u.filter(e=>!(0,r.alwaysValidSchema)(l,o[e]));if(d.length===0)return;let f=a.name(`valid`);for(let t of d)p(t)?m(t):(a.if((0,n.propertyInData)(a,c,t,l.opts.ownProperties)),m(t),l.allErrors||a.else().var(f,!0),a.endIf()),e.it.definedProperties.add(t),e.ok(f);function p(e){return l.opts.useDefaults&&!l.compositeRule&&o[e].default!==void 0}function m(t){e.subschema({keyword:`properties`,schemaProp:t,dataProp:t},f)}}}})),$j=a((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=aj(),n=Q(),r=$(),i=$();e.default={keyword:`patternProperties`,type:`object`,schemaType:`object`,code(e){let{gen:a,schema:o,data:s,parentSchema:c,it:l}=e,{opts:u}=l,d=(0,t.allSchemaProperties)(o),f=d.filter(e=>(0,r.alwaysValidSchema)(l,o[e]));if(d.length===0||f.length===d.length&&(!l.opts.unevaluated||l.props===!0))return;let p=u.strictSchema&&!u.allowMatchingProperties&&c.properties,m=a.name(`valid`);l.props!==!0&&!(l.props instanceof n.Name)&&(l.props=(0,i.evaluatedPropsToName)(a,l.props));let{props:h}=l;g();function g(){for(let e of d)p&&_(e),l.allErrors?v(e):(a.var(m,!0),v(e),a.if(m))}function _(e){for(let t in p)new RegExp(e).test(t)&&(0,r.checkStrictMode)(l,`property ${t} matches pattern ${e} (use allowMatchingProperties)`)}function v(r){a.forIn(`key`,s,o=>{a.if((0,n._)`${(0,t.usePattern)(e,r)}.test(${o})`,()=>{let t=f.includes(r);t||e.subschema({keyword:`patternProperties`,schemaProp:r,dataProp:o,dataPropType:i.Type.Str},m),l.opts.unevaluated&&h!==!0?a.assign((0,n._)`${h}[${o}]`,!0):!t&&!l.allErrors&&a.if((0,n.not)(m),()=>a.break())})})}}}})),eM=a((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=$();e.default={keyword:`not`,schemaType:[`object`,`boolean`],trackErrors:!0,code(e){let{gen:n,schema:r,it:i}=e;if((0,t.alwaysValidSchema)(i,r)){e.fail();return}let a=n.name(`valid`);e.subschema({keyword:`not`,compositeRule:!0,createErrors:!1,allErrors:!1},a),e.failResult(a,()=>e.reset(),()=>e.error())},error:{message:`must NOT be valid`}}})),tM=a((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default={keyword:`anyOf`,schemaType:`array`,trackErrors:!0,code:aj().validateUnion,error:{message:`must match a schema in anyOf`}}})),nM=a((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=Q(),n=$();e.default={keyword:`oneOf`,schemaType:`array`,trackErrors:!0,error:{message:`must match exactly one schema in oneOf`,params:({params:e})=>(0,t._)`{passingSchemas: ${e.passing}}`},code(e){let{gen:r,schema:i,parentSchema:a,it:o}=e;if(!Array.isArray(i))throw Error(`ajv implementation error`);if(o.opts.discriminator&&a.discriminator)return;let s=i,c=r.let(`valid`,!1),l=r.let(`passing`,null),u=r.name(`_valid`);e.setParams({passing:l}),r.block(d),e.result(c,()=>e.reset(),()=>e.error(!0));function d(){s.forEach((i,a)=>{let s;(0,n.alwaysValidSchema)(o,i)?r.var(u,!0):s=e.subschema({keyword:`oneOf`,schemaProp:a,compositeRule:!0},u),a>0&&r.if((0,t._)`${u} && ${c}`).assign(c,!1).assign(l,(0,t._)`[${l}, ${a}]`).else(),r.if(u,()=>{r.assign(c,!0),r.assign(l,a),s&&e.mergeEvaluated(s,t.Name)})})}}}})),rM=a((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=$();e.default={keyword:`allOf`,schemaType:`array`,code(e){let{gen:n,schema:r,it:i}=e;if(!Array.isArray(r))throw Error(`ajv implementation error`);let a=n.name(`valid`);r.forEach((n,r)=>{if((0,t.alwaysValidSchema)(i,n))return;let o=e.subschema({keyword:`allOf`,schemaProp:r},a);e.ok(a),e.mergeEvaluated(o)})}}})),iM=a((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=Q(),n=$(),r={keyword:`if`,schemaType:[`object`,`boolean`],trackErrors:!0,error:{message:({params:e})=>(0,t.str)`must match "${e.ifClause}" schema`,params:({params:e})=>(0,t._)`{failingKeyword: ${e.ifClause}}`},code(e){let{gen:r,parentSchema:a,it:o}=e;a.then===void 0&&a.else===void 0&&(0,n.checkStrictMode)(o,`"if" without "then" and "else" is ignored`);let s=i(o,`then`),c=i(o,`else`);if(!s&&!c)return;let l=r.let(`valid`,!0),u=r.name(`_valid`);if(d(),e.reset(),s&&c){let t=r.let(`ifClause`);e.setParams({ifClause:t}),r.if(u,f(`then`,t),f(`else`,t))}else s?r.if(u,f(`then`)):r.if((0,t.not)(u),f(`else`));e.pass(l,()=>e.error(!0));function d(){let t=e.subschema({keyword:`if`,compositeRule:!0,createErrors:!1,allErrors:!1},u);e.mergeEvaluated(t)}function f(n,i){return()=>{let a=e.subschema({keyword:n},u);r.assign(l,u),e.mergeValidEvaluated(a,l),i?r.assign(i,(0,t._)`${n}`):e.setParams({ifClause:n})}}}};function i(e,t){let r=e.schema[t];return r!==void 0&&!(0,n.alwaysValidSchema)(e,r)}e.default=r})),aM=a((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=$();e.default={keyword:[`then`,`else`],schemaType:[`object`,`boolean`],code({keyword:e,parentSchema:n,it:r}){n.if===void 0&&(0,t.checkStrictMode)(r,`"${e}" without "if" is ignored`)}}})),oM=a((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=Wj(),n=Kj(),r=Gj(),i=qj(),a=Jj(),o=Yj(),s=Xj(),c=Zj(),l=Qj(),u=$j(),d=eM(),f=tM(),p=nM(),m=rM(),h=iM(),g=aM();function _(e=!1){let _=[d.default,f.default,p.default,m.default,h.default,g.default,s.default,c.default,o.default,l.default,u.default];return e?_.push(n.default,i.default):_.push(t.default,r.default),_.push(a.default),_}e.default=_})),sM=a((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=Q();e.default={keyword:`format`,type:[`number`,`string`],schemaType:`string`,$data:!0,error:{message:({schemaCode:e})=>(0,t.str)`must match format "${e}"`,params:({schemaCode:e})=>(0,t._)`{format: ${e}}`},code(e,n){let{gen:r,data:i,$data:a,schema:o,schemaCode:s,it:c}=e,{opts:l,errSchemaPath:u,schemaEnv:d,self:f}=c;if(!l.validateFormats)return;a?p():m();function p(){let a=r.scopeValue(`formats`,{ref:f.formats,code:l.code.formats}),o=r.const(`fDef`,(0,t._)`${a}[${s}]`),c=r.let(`fType`),u=r.let(`format`);r.if((0,t._)`typeof ${o} == "object" && !(${o} instanceof RegExp)`,()=>r.assign(c,(0,t._)`${o}.type || "string"`).assign(u,(0,t._)`${o}.validate`),()=>r.assign(c,(0,t._)`"string"`).assign(u,o)),e.fail$data((0,t.or)(p(),m()));function p(){return l.strictSchema===!1?t.nil:(0,t._)`${s} && !${u}`}function m(){let e=d.$async?(0,t._)`(${o}.async ? await ${u}(${i}) : ${u}(${i}))`:(0,t._)`${u}(${i})`,r=(0,t._)`(typeof ${u} == "function" ? ${e} : ${u}.test(${i}))`;return(0,t._)`${u} && ${u} !== true && ${c} === ${n} && !${r}`}}function m(){let a=f.formats[o];if(!a){m();return}if(a===!0)return;let[s,c,p]=h(a);s===n&&e.pass(g());function m(){if(l.strictSchema===!1){f.logger.warn(e());return}throw Error(e());function e(){return`unknown format "${o}" ignored in schema at path "${u}"`}}function h(e){let n=e instanceof RegExp?(0,t.regexpCode)(e):l.code.formats?(0,t._)`${l.code.formats}${(0,t.getProperty)(o)}`:void 0,i=r.scopeValue(`formats`,{key:o,ref:e,code:n});return typeof e==`object`&&!(e instanceof RegExp)?[e.type||`string`,e.validate,(0,t._)`${i}.validate`]:[`string`,e,i]}function g(){if(typeof a==`object`&&!(a instanceof RegExp)&&a.async){if(!d.$async)throw Error(`async format in sync schema`);return(0,t._)`await ${p}(${i})`}return typeof c==`function`?(0,t._)`${p}(${i})`:(0,t._)`${p}.test(${i})`}}}}})),cM=a((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default=[sM().default]})),lM=a((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.contentVocabulary=e.metadataVocabulary=void 0,e.metadataVocabulary=[`title`,`description`,`default`,`deprecated`,`readOnly`,`writeOnly`,`examples`],e.contentVocabulary=[`contentMediaType`,`contentEncoding`,`contentSchema`]})),uM=a((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=Aj(),n=Uj(),r=oM(),i=cM(),a=lM();e.default=[t.default,n.default,(0,r.default)(),i.default,a.metadataVocabulary,a.contentVocabulary]})),dM=a((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.DiscrError=void 0;var t;(function(e){e.Tag=`tag`,e.Mapping=`mapping`})(t||(e.DiscrError=t={}))})),fM=a((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=Q(),n=dM(),r=mj(),i=pj(),a=$();e.default={keyword:`discriminator`,type:`object`,schemaType:`object`,error:{message:({params:{discrError:e,tagName:t}})=>e===n.DiscrError.Tag?`tag "${t}" must be string`:`value of tag "${t}" must be in oneOf`,params:({params:{discrError:e,tag:n,tagName:r}})=>(0,t._)`{error: ${e}, tag: ${r}, tagValue: ${n}}`},code(e){let{gen:o,data:s,schema:c,parentSchema:l,it:u}=e,{oneOf:d}=l;if(!u.opts.discriminator)throw Error(`discriminator: requires discriminator option`);let f=c.propertyName;if(typeof f!=`string`)throw Error(`discriminator: requires propertyName`);if(c.mapping)throw Error(`discriminator: mapping is not supported`);if(!d)throw Error(`discriminator: requires oneOf keyword`);let p=o.let(`valid`,!1),m=o.const(`tag`,(0,t._)`${s}${(0,t.getProperty)(f)}`);o.if((0,t._)`typeof ${m} == "string"`,()=>h(),()=>e.error(!1,{discrError:n.DiscrError.Tag,tag:m,tagName:f})),e.ok(p);function h(){let r=_();o.if(!1);for(let e in r)o.elseIf((0,t._)`${m} === ${e}`),o.assign(p,g(r[e]));o.else(),e.error(!1,{discrError:n.DiscrError.Mapping,tag:m,tagName:f}),o.endIf()}function g(n){let r=o.name(`valid`),i=e.subschema({keyword:`oneOf`,schemaProp:n},r);return e.mergeEvaluated(i,t.Name),r}function _(){let e={},t=o(l),n=!0;for(let e=0;e<d.length;e++){let c=d[e];if(c?.$ref&&!(0,a.schemaHasRulesButRef)(c,u.self.RULES)){let e=c.$ref;if(c=r.resolveRef.call(u.self,u.schemaEnv.root,u.baseId,e),c instanceof r.SchemaEnv&&(c=c.schema),c===void 0)throw new i.default(u.opts.uriResolver,u.baseId,e)}let l=c?.properties?.[f];if(typeof l!=`object`)throw Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${f}"`);n&&=t||o(c),s(l,e)}if(!n)throw Error(`discriminator: "${f}" must be required`);return e;function o({required:e}){return Array.isArray(e)&&e.includes(f)}function s(e,t){if(e.const)c(e.const,t);else if(e.enum)for(let n of e.enum)c(n,t);else throw Error(`discriminator: "properties/${f}" must have "const" or "enum"`)}function c(t,n){if(typeof t!=`string`||t in e)throw Error(`discriminator: "${f}" values must be unique strings`);e[t]=n}}}}})),pM=o({$id:()=>hM,$schema:()=>mM,default:()=>bM,definitions:()=>_M,properties:()=>yM,title:()=>gM,type:()=>vM}),mM,hM,gM,_M,vM,yM,bM,xM=i((()=>{mM=`http://json-schema.org/draft-07/schema#`,hM=`http://json-schema.org/draft-07/schema#`,gM=`Core schema meta-schema`,_M={schemaArray:{type:`array`,minItems:1,items:{$ref:`#`}},nonNegativeInteger:{type:`integer`,minimum:0},nonNegativeIntegerDefault0:{allOf:[{$ref:`#/definitions/nonNegativeInteger`},{default:0}]},simpleTypes:{enum:[`array`,`boolean`,`integer`,`null`,`number`,`object`,`string`]},stringArray:{type:`array`,items:{type:`string`},uniqueItems:!0,default:[]}},vM=[`object`,`boolean`],yM={$id:{type:`string`,format:`uri-reference`},$schema:{type:`string`,format:`uri`},$ref:{type:`string`,format:`uri-reference`},$comment:{type:`string`},title:{type:`string`},description:{type:`string`},default:!0,readOnly:{type:`boolean`,default:!1},examples:{type:`array`,items:!0},multipleOf:{type:`number`,exclusiveMinimum:0},maximum:{type:`number`},exclusiveMaximum:{type:`number`},minimum:{type:`number`},exclusiveMinimum:{type:`number`},maxLength:{$ref:`#/definitions/nonNegativeInteger`},minLength:{$ref:`#/definitions/nonNegativeIntegerDefault0`},pattern:{type:`string`,format:`regex`},additionalItems:{$ref:`#`},items:{anyOf:[{$ref:`#`},{$ref:`#/definitions/schemaArray`}],default:!0},maxItems:{$ref:`#/definitions/nonNegativeInteger`},minItems:{$ref:`#/definitions/nonNegativeIntegerDefault0`},uniqueItems:{type:`boolean`,default:!1},contains:{$ref:`#`},maxProperties:{$ref:`#/definitions/nonNegativeInteger`},minProperties:{$ref:`#/definitions/nonNegativeIntegerDefault0`},required:{$ref:`#/definitions/stringArray`},additionalProperties:{$ref:`#`},definitions:{type:`object`,additionalProperties:{$ref:`#`},default:{}},properties:{type:`object`,additionalProperties:{$ref:`#`},default:{}},patternProperties:{type:`object`,additionalProperties:{$ref:`#`},propertyNames:{format:`regex`},default:{}},dependencies:{type:`object`,additionalProperties:{anyOf:[{$ref:`#`},{$ref:`#/definitions/stringArray`}]}},propertyNames:{$ref:`#`},const:!0,enum:{type:`array`,items:!0,minItems:1,uniqueItems:!0},type:{anyOf:[{$ref:`#/definitions/simpleTypes`},{type:`array`,items:{$ref:`#/definitions/simpleTypes`},minItems:1,uniqueItems:!0}]},format:{type:`string`},contentMediaType:{type:`string`},contentEncoding:{type:`string`},if:{$ref:`#`},then:{$ref:`#`},else:{$ref:`#`},allOf:{$ref:`#/definitions/schemaArray`},anyOf:{$ref:`#/definitions/schemaArray`},oneOf:{$ref:`#/definitions/schemaArray`},not:{$ref:`#`}},bM={$schema:mM,$id:hM,title:gM,definitions:_M,type:vM,properties:yM,default:!0}})),SM=a(((e,t)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.MissingRefError=e.ValidationError=e.CodeGen=e.Name=e.nil=e.stringify=e.str=e._=e.KeywordCxt=e.Ajv=void 0;var n=Dj(),r=uM(),i=fM(),a=(xM(),c(pM).default),o=[`/properties`],s=`http://json-schema.org/draft-07/schema`,l=class extends n.default{_addVocabularies(){super._addVocabularies(),r.default.forEach(e=>this.addVocabulary(e)),this.opts.discriminator&&this.addKeyword(i.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let e=this.opts.$data?this.$dataMetaSchema(a,o):a;this.addMetaSchema(e,s,!1),this.refs[`http://json-schema.org/schema`]=s}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(s)?s:void 0)}};e.Ajv=l,t.exports=e=l,t.exports.Ajv=l,Object.defineProperty(e,"__esModule",{value:!0}),e.default=l;var u=dj();Object.defineProperty(e,"KeywordCxt",{enumerable:!0,get:function(){return u.KeywordCxt}});var d=Q();Object.defineProperty(e,"_",{enumerable:!0,get:function(){return d._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return d.str}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return d.stringify}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return d.nil}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return d.Name}}),Object.defineProperty(e,"CodeGen",{enumerable:!0,get:function(){return d.CodeGen}});var f=fj();Object.defineProperty(e,"ValidationError",{enumerable:!0,get:function(){return f.default}});var p=pj();Object.defineProperty(e,"MissingRefError",{enumerable:!0,get:function(){return p.default}})})),CM=a((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.formatNames=e.fastFormats=e.fullFormats=void 0;function t(e,t){return{validate:e,compare:t}}e.fullFormats={date:t(a,o),time:t(c(!0),l),"date-time":t(f(!0),p),"iso-time":t(c(),u),"iso-date-time":t(f(),m),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:_,"uri-reference":/^(?:[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,"uri-template":/^(?:(?:[^\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,url:/^(?:https?|ftp):\/\/(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|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-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)(?:\.(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu,email:/^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i,hostname:/^(?=.{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,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)$/,ipv6:/^((([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,regex:T,uuid:/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,"json-pointer":/^(?:\/(?:[^~/]|~0|~1)*)*$/,"json-pointer-uri-fragment":/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,"relative-json-pointer":/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,byte:y,int32:{type:`number`,validate:S},int64:{type:`number`,validate:C},float:{type:`number`,validate:w},double:{type:`number`,validate:w},password:!0,binary:!0},e.fastFormats={...e.fullFormats,date:t(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,o),time:t(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,l),"date-time":t(/^\d\d\d\d-[0-1]\d-[0-3]\dt(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,p),"iso-time":t(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,u),"iso-date-time":t(/^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,m),uri:/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,"uri-reference":/^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,email:/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i},e.formatNames=Object.keys(e.fullFormats);function n(e){return e%4==0&&(e%100!=0||e%400==0)}var r=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,i=[0,31,28,31,30,31,30,31,31,30,31,30,31];function a(e){let t=r.exec(e);if(!t)return!1;let a=+t[1],o=+t[2],s=+t[3];return o>=1&&o<=12&&s>=1&&s<=(o===2&&n(a)?29:i[o])}function o(e,t){if(e&&t)return e>t?1:e<t?-1:0}var s=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function c(e){return function(t){let n=s.exec(t);if(!n)return!1;let r=+n[1],i=+n[2],a=+n[3],o=n[4],c=n[5]===`-`?-1:1,l=+(n[6]||0),u=+(n[7]||0);if(l>23||u>59||e&&!o)return!1;if(r<=23&&i<=59&&a<60)return!0;let d=i-u*c,f=r-l*c-+(d<0);return(f===23||f===-1)&&(d===59||d===-1)&&a<61}}function l(e,t){if(!(e&&t))return;let n=new Date(`2020-01-01T`+e).valueOf(),r=new Date(`2020-01-01T`+t).valueOf();if(n&&r)return n-r}function u(e,t){if(!(e&&t))return;let n=s.exec(e),r=s.exec(t);if(n&&r)return e=n[1]+n[2]+n[3],t=r[1]+r[2]+r[3],e>t?1:e<t?-1:0}var d=/t|\s/i;function f(e){let t=c(e);return function(e){let n=e.split(d);return n.length===2&&a(n[0])&&t(n[1])}}function p(e,t){if(!(e&&t))return;let n=new Date(e).valueOf(),r=new Date(t).valueOf();if(n&&r)return n-r}function m(e,t){if(!(e&&t))return;let[n,r]=e.split(d),[i,a]=t.split(d),s=o(n,i);if(s!==void 0)return s||l(r,a)}var h=/\/|:/,g=/^(?:[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 _(e){return h.test(e)&&g.test(e)}var v=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function y(e){return v.lastIndex=0,v.test(e)}var b=-(2**31),x=2**31-1;function S(e){return Number.isInteger(e)&&e<=x&&e>=b}function C(e){return Number.isInteger(e)}function w(){return!0}var ee=/[^\\]\\Z/;function T(e){if(ee.test(e))return!1;try{return new RegExp(e),!0}catch{return!1}}})),wM=SM(),TM=CM();new Intl.DateTimeFormat(`en-GB`,{day:`numeric`,month:`long`,year:`numeric`,timeZone:`UTC`});var EM=[`text`,`email`,`url`,`tel`,`color`,`date`,`time`,`datetime-local`,`number`,`range`,`textarea`,`select`,`checkbox`,`radio`,`file`],DM=e=>EM.find(t=>t in e),OM=e=>!!(e&&typeof e==`object`&&EM.some(t=>t in e)),kM=e=>{let t=e[DM(e)];return t&&typeof t==`object`?t:{}},AM=()=>{let e=new wM.Ajv({allErrors:!0,strict:!1,formats:TM.fullFormats});return e.addKeyword({keyword:`$edahaField`,schemaType:`object`}),e},jM=(e,t)=>t===void 0?Object.keys(e):t===!1?[]:t,MM={string:`text`,number:`a number`,integer:`a whole number`,boolean:`yes or no`,array:`a list`,object:`a group of settings`,null:`empty`},NM={email:`an email address`,uri:`a full web address, e.g. https://example.com`,url:`a full web address, e.g. https://example.com`,"uri-reference":`a web address or path`,date:`a date, e.g. 2026-11-19`,time:`a time, e.g. 14:30:00`,"date-time":`a date and time, e.g. 2026-11-19T14:30:00Z`,hostname:`a host name, e.g. example.com`,ipv4:`an IPv4 address`,ipv6:`an IPv6 address`,uuid:`a UUID`,regex:`a regular expression`},PM=(e,t)=>`${e} ${t}${e===1?``:`s`}`,FM=e=>typeof e==`string`?`"${e}"`:JSON.stringify(e),IM=e=>{let t=e.params,n=t.limit;switch(e.keyword){case`type`:return`must be ${String(t.type).split(`,`).map(e=>MM[e]).join(` or `)}`;case`minimum`:return`must be at least ${n}`;case`maximum`:return`must be at most ${n}`;case`exclusiveMinimum`:return`must be more than ${n}`;case`exclusiveMaximum`:return`must be less than ${n}`;case`multipleOf`:return`must be a multiple of ${t.multipleOf}`;case`minLength`:return n===1?`can't be empty`:`must be at least ${PM(n,`character`)}`;case`maxLength`:return`must be at most ${PM(n,`character`)}`;case`pattern`:return`isn't in the right form`;case`format`:return`must be ${NM[t.format]??`a valid ${t.format}`}`;case`enum`:return`must be one of ${t.allowedValues.map(FM).join(`, `)}`;case`const`:return`must be ${FM(t.allowedValue)}`;case`required`:return`is required`;case`minItems`:return`must have at least ${PM(n,`item`)}`;case`maxItems`:return`can have at most ${PM(n,`item`)}`;case`uniqueItems`:return`can't have the same item twice`;case`additionalProperties`:return`isn't a known setting`;default:return e.message}},LM=(e,t)=>{let n=t.params,r=n.missingProperty??n.additionalProperty;return{path:e+t.instancePath+(r?`/${r}`:``),message:IM(t),level:`error`}},RM=class{ajv=AM();compiled=new Map;definitions;constructor(e){this.definitions=e}validate(e,t){let n=this.compiled.get(e);return n||(n=this.ajv.compile(this.definitions[e]),this.compiled.set(e,n)),n(t)?[]:n.errors.map(t=>LM(e,t))}},zM=(e,t)=>t.$edahaField?.title??t.title??e,BM=e=>e.$edahaField?.description??e.description,VM=e=>OM(e.$edahaField)?DM(e.$edahaField):e.type===`object`?`object`:`list`,HM=e=>{let t=e.$edahaField?kM(e.$edahaField):{};return Array.isArray(t.options)?t.options:(e.enum??e.items?.enum??[]).map(e=>({value:e}))},UM={minLength:`minlength`,maxLength:`maxlength`},WM={minLength:`minlength`,maxLength:`maxlength`,pattern:`pattern`,minimum:`min`,maximum:`max`,multipleOf:`step`},GM=[`options`,`list`,`multiple`],KM=e=>{let t={};for(let[n,r]of Object.entries(WM))e[n]!==void 0&&(t[r]=String(e[n]));let n=e.$edahaField?kM(e.$edahaField):{};for(let[e,r]of Object.entries(n))!GM.includes(e)&&r!=null&&(t[UM[e]??e.toLowerCase()]=String(r));return t},qM=(e,t,n)=>{let[r,...i]=t;if(r===void 0)return n;if(Array.isArray(e)){let t=[...e];return t[Number(r)]=qM(t[Number(r)],i,n),t}let a={...e&&typeof e==`object`?e:{}},o=qM(a[r],i,n);return Object.fromEntries(Object.entries({...a,[r]:o}).filter(([,e])=>e!==void 0))},JM=(e,t)=>{if(typeof t==`boolean`)return t;if(t!==``)return e===`number`||e===`range`?Number(t):t},YM=e=>{let{value:t}=e.$edahaField?kM(e.$edahaField):{};return t===void 0?{checked:!0,unchecked:!1}:{checked:t,unchecked:void 0}},XM=/^#?([0-9a-f]{6})$/i,ZM=e=>{let t=XM.exec(String(e??``));return t?`#${t[1].toLowerCase()}`:``},QM=(e,t)=>typeof t==`string`&&/^[0-9a-f]{6}$/i.test(t)?e.replace(/^#/,``):e,$M=(e,t)=>e.filter(e=>e.path===t),eN=e=>E`<span class="visually-hidden">${e}</span>`,tN=e=>`meta-${e.replace(/[^\w-]/g,`-`)}`;ft(`edaha-metadata-field`,class extends Ge{static properties={path:{},label:{},schema:{attribute:!1},value:{attribute:!1},problems:{attribute:!1},hiddenFields:{attribute:!1},required:{type:Boolean},uploadFile:{attribute:!1},chooseFile:{attribute:!1},fileUrl:{attribute:!1}};constructor(){super(),this.path=``,this.schema={},this.problems=[],this.hiddenFields=new Set,this.required=!1}createRenderRoot(){return this}change(e,t){this.dispatchEvent(new CustomEvent(`metadata-change`,{detail:{path:e,value:t},bubbles:!0}))}get key(){return this.path.split(`/`).at(-1)}get fieldTitle(){return this.label??zM(this.key,this.schema)}renderNotes(e){let t=BM(this.schema),n=this.schema.$edahaField?.info,r=$M(this.problems,this.path);return E`${t?E`<p class="metadata-description" id="${e}-description">
650
+ deps: ${r}}`};var i={keyword:`dependencies`,type:`object`,schemaType:`object`,error:e.error,code(e){let[t,n]=a(e);o(e,t),s(e,n)}};function a({schema:e}){let t={},n={};for(let r in e){if(r===`__proto__`)continue;let i=Array.isArray(e[r])?t:n;i[r]=e[r]}return[t,n]}function o(e,n=e.schema){let{gen:i,data:a,it:o}=e;if(Object.keys(n).length===0)return;let s=i.let(`missing`);for(let c in n){let l=n[c];if(l.length===0)continue;let u=(0,r.propertyInData)(i,a,c,o.opts.ownProperties);e.setParams({property:c,depsCount:l.length,deps:l.join(`, `)}),o.allErrors?i.if(u,()=>{for(let t of l)(0,r.checkReportMissingProp)(e,t)}):(i.if((0,t._)`${u} && (${(0,r.checkMissingProp)(e,l,s)})`),(0,r.reportMissingProp)(e,s),i.else())}}e.validatePropertyDeps=o;function s(e,t=e.schema){let{gen:i,data:a,keyword:o,it:s}=e,c=i.name(`valid`);for(let l in t)(0,n.alwaysValidSchema)(s,t[l])||(i.if((0,r.propertyInData)(i,a,l,s.opts.ownProperties),()=>{let t=e.subschema({keyword:o,schemaProp:l},c);e.mergeValidEvaluated(t,c)},()=>i.var(c,!0)),e.ok(c))}e.validateSchemaDeps=s,e.default=i})),Zj=a((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=Q(),n=$();e.default={keyword:`propertyNames`,type:`object`,schemaType:[`object`,`boolean`],error:{message:`property name must be valid`,params:({params:e})=>(0,t._)`{propertyName: ${e.propertyName}}`},code(e){let{gen:r,schema:i,data:a,it:o}=e;if((0,n.alwaysValidSchema)(o,i))return;let s=r.name(`valid`);r.forIn(`key`,a,n=>{e.setParams({propertyName:n}),e.subschema({keyword:`propertyNames`,data:n,dataTypes:[`string`],propertyName:n,compositeRule:!0},s),r.if((0,t.not)(s),()=>{e.error(!0),o.allErrors||r.break()})}),e.ok(s)}}})),Qj=a((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=oj(),n=Q(),r=$A(),i=$();e.default={keyword:`additionalProperties`,type:[`object`],schemaType:[`boolean`,`object`],allowUndefined:!0,trackErrors:!0,error:{message:`must NOT have additional properties`,params:({params:e})=>(0,n._)`{additionalProperty: ${e.additionalProperty}}`},code(e){let{gen:a,schema:o,parentSchema:s,data:c,errsCount:l,it:u}=e;if(!l)throw Error(`ajv implementation error`);let{allErrors:d,opts:f}=u;if(u.props=!0,f.removeAdditional!==`all`&&(0,i.alwaysValidSchema)(u,o))return;let p=(0,t.allSchemaProperties)(s.properties),m=(0,t.allSchemaProperties)(s.patternProperties);h(),e.ok((0,n._)`${l} === ${r.default.errors}`);function h(){a.forIn(`key`,c,e=>{!p.length&&!m.length?v(e):a.if(g(e),()=>v(e))})}function g(r){let o;if(p.length>8){let e=(0,i.schemaRefOrVal)(u,s.properties,`properties`);o=(0,t.isOwnProperty)(a,e,r)}else o=p.length?(0,n.or)(...p.map(e=>(0,n._)`${r} === ${e}`)):n.nil;return m.length&&(o=(0,n.or)(o,...m.map(i=>(0,n._)`${(0,t.usePattern)(e,i)}.test(${r})`))),(0,n.not)(o)}function _(e){a.code((0,n._)`delete ${c}[${e}]`)}function v(t){if(f.removeAdditional===`all`||f.removeAdditional&&o===!1)_(t);else if(o===!1)e.setParams({additionalProperty:t}),e.error(),d||a.break();else if(typeof o==`object`&&!(0,i.alwaysValidSchema)(u,o)){let r=a.name(`valid`);f.removeAdditional===`failing`?(y(t,r,!1),a.if((0,n.not)(r),()=>{e.reset(),_(t)})):(y(t,r),d||a.if((0,n.not)(r),()=>a.break()))}}function y(t,n,r){let a={keyword:`additionalProperties`,dataProp:t,dataPropType:i.Type.Str};r===!1&&Object.assign(a,{compositeRule:!0,createErrors:!1,allErrors:!1}),e.subschema(a,n)}}}})),$j=a((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=fj(),n=oj(),r=$(),i=Qj();e.default={keyword:`properties`,type:`object`,schemaType:`object`,code(e){let{gen:a,schema:o,parentSchema:s,data:c,it:l}=e;l.opts.removeAdditional===`all`&&s.additionalProperties===void 0&&i.default.code(new t.KeywordCxt(l,i.default,`additionalProperties`));let u=(0,n.allSchemaProperties)(o);for(let e of u)l.definedProperties.add(e);l.opts.unevaluated&&u.length&&l.props!==!0&&(l.props=r.mergeEvaluated.props(a,(0,r.toHash)(u),l.props));let d=u.filter(e=>!(0,r.alwaysValidSchema)(l,o[e]));if(d.length===0)return;let f=a.name(`valid`);for(let t of d)p(t)?m(t):(a.if((0,n.propertyInData)(a,c,t,l.opts.ownProperties)),m(t),l.allErrors||a.else().var(f,!0),a.endIf()),e.it.definedProperties.add(t),e.ok(f);function p(e){return l.opts.useDefaults&&!l.compositeRule&&o[e].default!==void 0}function m(t){e.subschema({keyword:`properties`,schemaProp:t,dataProp:t},f)}}}})),eM=a((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=oj(),n=Q(),r=$(),i=$();e.default={keyword:`patternProperties`,type:`object`,schemaType:`object`,code(e){let{gen:a,schema:o,data:s,parentSchema:c,it:l}=e,{opts:u}=l,d=(0,t.allSchemaProperties)(o),f=d.filter(e=>(0,r.alwaysValidSchema)(l,o[e]));if(d.length===0||f.length===d.length&&(!l.opts.unevaluated||l.props===!0))return;let p=u.strictSchema&&!u.allowMatchingProperties&&c.properties,m=a.name(`valid`);l.props!==!0&&!(l.props instanceof n.Name)&&(l.props=(0,i.evaluatedPropsToName)(a,l.props));let{props:h}=l;g();function g(){for(let e of d)p&&_(e),l.allErrors?v(e):(a.var(m,!0),v(e),a.if(m))}function _(e){for(let t in p)new RegExp(e).test(t)&&(0,r.checkStrictMode)(l,`property ${t} matches pattern ${e} (use allowMatchingProperties)`)}function v(r){a.forIn(`key`,s,o=>{a.if((0,n._)`${(0,t.usePattern)(e,r)}.test(${o})`,()=>{let t=f.includes(r);t||e.subschema({keyword:`patternProperties`,schemaProp:r,dataProp:o,dataPropType:i.Type.Str},m),l.opts.unevaluated&&h!==!0?a.assign((0,n._)`${h}[${o}]`,!0):!t&&!l.allErrors&&a.if((0,n.not)(m),()=>a.break())})})}}}})),tM=a((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=$();e.default={keyword:`not`,schemaType:[`object`,`boolean`],trackErrors:!0,code(e){let{gen:n,schema:r,it:i}=e;if((0,t.alwaysValidSchema)(i,r)){e.fail();return}let a=n.name(`valid`);e.subschema({keyword:`not`,compositeRule:!0,createErrors:!1,allErrors:!1},a),e.failResult(a,()=>e.reset(),()=>e.error())},error:{message:`must NOT be valid`}}})),nM=a((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default={keyword:`anyOf`,schemaType:`array`,trackErrors:!0,code:oj().validateUnion,error:{message:`must match a schema in anyOf`}}})),rM=a((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=Q(),n=$();e.default={keyword:`oneOf`,schemaType:`array`,trackErrors:!0,error:{message:`must match exactly one schema in oneOf`,params:({params:e})=>(0,t._)`{passingSchemas: ${e.passing}}`},code(e){let{gen:r,schema:i,parentSchema:a,it:o}=e;if(!Array.isArray(i))throw Error(`ajv implementation error`);if(o.opts.discriminator&&a.discriminator)return;let s=i,c=r.let(`valid`,!1),l=r.let(`passing`,null),u=r.name(`_valid`);e.setParams({passing:l}),r.block(d),e.result(c,()=>e.reset(),()=>e.error(!0));function d(){s.forEach((i,a)=>{let s;(0,n.alwaysValidSchema)(o,i)?r.var(u,!0):s=e.subschema({keyword:`oneOf`,schemaProp:a,compositeRule:!0},u),a>0&&r.if((0,t._)`${u} && ${c}`).assign(c,!1).assign(l,(0,t._)`[${l}, ${a}]`).else(),r.if(u,()=>{r.assign(c,!0),r.assign(l,a),s&&e.mergeEvaluated(s,t.Name)})})}}}})),iM=a((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=$();e.default={keyword:`allOf`,schemaType:`array`,code(e){let{gen:n,schema:r,it:i}=e;if(!Array.isArray(r))throw Error(`ajv implementation error`);let a=n.name(`valid`);r.forEach((n,r)=>{if((0,t.alwaysValidSchema)(i,n))return;let o=e.subschema({keyword:`allOf`,schemaProp:r},a);e.ok(a),e.mergeEvaluated(o)})}}})),aM=a((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=Q(),n=$(),r={keyword:`if`,schemaType:[`object`,`boolean`],trackErrors:!0,error:{message:({params:e})=>(0,t.str)`must match "${e.ifClause}" schema`,params:({params:e})=>(0,t._)`{failingKeyword: ${e.ifClause}}`},code(e){let{gen:r,parentSchema:a,it:o}=e;a.then===void 0&&a.else===void 0&&(0,n.checkStrictMode)(o,`"if" without "then" and "else" is ignored`);let s=i(o,`then`),c=i(o,`else`);if(!s&&!c)return;let l=r.let(`valid`,!0),u=r.name(`_valid`);if(d(),e.reset(),s&&c){let t=r.let(`ifClause`);e.setParams({ifClause:t}),r.if(u,f(`then`,t),f(`else`,t))}else s?r.if(u,f(`then`)):r.if((0,t.not)(u),f(`else`));e.pass(l,()=>e.error(!0));function d(){let t=e.subschema({keyword:`if`,compositeRule:!0,createErrors:!1,allErrors:!1},u);e.mergeEvaluated(t)}function f(n,i){return()=>{let a=e.subschema({keyword:n},u);r.assign(l,u),e.mergeValidEvaluated(a,l),i?r.assign(i,(0,t._)`${n}`):e.setParams({ifClause:n})}}}};function i(e,t){let r=e.schema[t];return r!==void 0&&!(0,n.alwaysValidSchema)(e,r)}e.default=r})),oM=a((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=$();e.default={keyword:[`then`,`else`],schemaType:[`object`,`boolean`],code({keyword:e,parentSchema:n,it:r}){n.if===void 0&&(0,t.checkStrictMode)(r,`"${e}" without "if" is ignored`)}}})),sM=a((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=Gj(),n=qj(),r=Kj(),i=Jj(),a=Yj(),o=Xj(),s=Zj(),c=Qj(),l=$j(),u=eM(),d=tM(),f=nM(),p=rM(),m=iM(),h=aM(),g=oM();function _(e=!1){let _=[d.default,f.default,p.default,m.default,h.default,g.default,s.default,c.default,o.default,l.default,u.default];return e?_.push(n.default,i.default):_.push(t.default,r.default),_.push(a.default),_}e.default=_})),cM=a((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=Q();e.default={keyword:`format`,type:[`number`,`string`],schemaType:`string`,$data:!0,error:{message:({schemaCode:e})=>(0,t.str)`must match format "${e}"`,params:({schemaCode:e})=>(0,t._)`{format: ${e}}`},code(e,n){let{gen:r,data:i,$data:a,schema:o,schemaCode:s,it:c}=e,{opts:l,errSchemaPath:u,schemaEnv:d,self:f}=c;if(!l.validateFormats)return;a?p():m();function p(){let a=r.scopeValue(`formats`,{ref:f.formats,code:l.code.formats}),o=r.const(`fDef`,(0,t._)`${a}[${s}]`),c=r.let(`fType`),u=r.let(`format`);r.if((0,t._)`typeof ${o} == "object" && !(${o} instanceof RegExp)`,()=>r.assign(c,(0,t._)`${o}.type || "string"`).assign(u,(0,t._)`${o}.validate`),()=>r.assign(c,(0,t._)`"string"`).assign(u,o)),e.fail$data((0,t.or)(p(),m()));function p(){return l.strictSchema===!1?t.nil:(0,t._)`${s} && !${u}`}function m(){let e=d.$async?(0,t._)`(${o}.async ? await ${u}(${i}) : ${u}(${i}))`:(0,t._)`${u}(${i})`,r=(0,t._)`(typeof ${u} == "function" ? ${e} : ${u}.test(${i}))`;return(0,t._)`${u} && ${u} !== true && ${c} === ${n} && !${r}`}}function m(){let a=f.formats[o];if(!a){m();return}if(a===!0)return;let[s,c,p]=h(a);s===n&&e.pass(g());function m(){if(l.strictSchema===!1){f.logger.warn(e());return}throw Error(e());function e(){return`unknown format "${o}" ignored in schema at path "${u}"`}}function h(e){let n=e instanceof RegExp?(0,t.regexpCode)(e):l.code.formats?(0,t._)`${l.code.formats}${(0,t.getProperty)(o)}`:void 0,i=r.scopeValue(`formats`,{key:o,ref:e,code:n});return typeof e==`object`&&!(e instanceof RegExp)?[e.type||`string`,e.validate,(0,t._)`${i}.validate`]:[`string`,e,i]}function g(){if(typeof a==`object`&&!(a instanceof RegExp)&&a.async){if(!d.$async)throw Error(`async format in sync schema`);return(0,t._)`await ${p}(${i})`}return typeof c==`function`?(0,t._)`${p}(${i})`:(0,t._)`${p}.test(${i})`}}}}})),lM=a((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default=[cM().default]})),uM=a((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.contentVocabulary=e.metadataVocabulary=void 0,e.metadataVocabulary=[`title`,`description`,`default`,`deprecated`,`readOnly`,`writeOnly`,`examples`],e.contentVocabulary=[`contentMediaType`,`contentEncoding`,`contentSchema`]})),dM=a((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=jj(),n=Wj(),r=sM(),i=lM(),a=uM();e.default=[t.default,n.default,(0,r.default)(),i.default,a.metadataVocabulary,a.contentVocabulary]})),fM=a((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.DiscrError=void 0;var t;(function(e){e.Tag=`tag`,e.Mapping=`mapping`})(t||(e.DiscrError=t={}))})),pM=a((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=Q(),n=fM(),r=hj(),i=mj(),a=$();e.default={keyword:`discriminator`,type:`object`,schemaType:`object`,error:{message:({params:{discrError:e,tagName:t}})=>e===n.DiscrError.Tag?`tag "${t}" must be string`:`value of tag "${t}" must be in oneOf`,params:({params:{discrError:e,tag:n,tagName:r}})=>(0,t._)`{error: ${e}, tag: ${r}, tagValue: ${n}}`},code(e){let{gen:o,data:s,schema:c,parentSchema:l,it:u}=e,{oneOf:d}=l;if(!u.opts.discriminator)throw Error(`discriminator: requires discriminator option`);let f=c.propertyName;if(typeof f!=`string`)throw Error(`discriminator: requires propertyName`);if(c.mapping)throw Error(`discriminator: mapping is not supported`);if(!d)throw Error(`discriminator: requires oneOf keyword`);let p=o.let(`valid`,!1),m=o.const(`tag`,(0,t._)`${s}${(0,t.getProperty)(f)}`);o.if((0,t._)`typeof ${m} == "string"`,()=>h(),()=>e.error(!1,{discrError:n.DiscrError.Tag,tag:m,tagName:f})),e.ok(p);function h(){let r=_();o.if(!1);for(let e in r)o.elseIf((0,t._)`${m} === ${e}`),o.assign(p,g(r[e]));o.else(),e.error(!1,{discrError:n.DiscrError.Mapping,tag:m,tagName:f}),o.endIf()}function g(n){let r=o.name(`valid`),i=e.subschema({keyword:`oneOf`,schemaProp:n},r);return e.mergeEvaluated(i,t.Name),r}function _(){let e={},t=o(l),n=!0;for(let e=0;e<d.length;e++){let c=d[e];if(c?.$ref&&!(0,a.schemaHasRulesButRef)(c,u.self.RULES)){let e=c.$ref;if(c=r.resolveRef.call(u.self,u.schemaEnv.root,u.baseId,e),c instanceof r.SchemaEnv&&(c=c.schema),c===void 0)throw new i.default(u.opts.uriResolver,u.baseId,e)}let l=c?.properties?.[f];if(typeof l!=`object`)throw Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${f}"`);n&&=t||o(c),s(l,e)}if(!n)throw Error(`discriminator: "${f}" must be required`);return e;function o({required:e}){return Array.isArray(e)&&e.includes(f)}function s(e,t){if(e.const)c(e.const,t);else if(e.enum)for(let n of e.enum)c(n,t);else throw Error(`discriminator: "properties/${f}" must have "const" or "enum"`)}function c(t,n){if(typeof t!=`string`||t in e)throw Error(`discriminator: "${f}" values must be unique strings`);e[t]=n}}}}})),mM=o({$id:()=>gM,$schema:()=>hM,default:()=>xM,definitions:()=>vM,properties:()=>bM,title:()=>_M,type:()=>yM}),hM,gM,_M,vM,yM,bM,xM,SM=i((()=>{hM=`http://json-schema.org/draft-07/schema#`,gM=`http://json-schema.org/draft-07/schema#`,_M=`Core schema meta-schema`,vM={schemaArray:{type:`array`,minItems:1,items:{$ref:`#`}},nonNegativeInteger:{type:`integer`,minimum:0},nonNegativeIntegerDefault0:{allOf:[{$ref:`#/definitions/nonNegativeInteger`},{default:0}]},simpleTypes:{enum:[`array`,`boolean`,`integer`,`null`,`number`,`object`,`string`]},stringArray:{type:`array`,items:{type:`string`},uniqueItems:!0,default:[]}},yM=[`object`,`boolean`],bM={$id:{type:`string`,format:`uri-reference`},$schema:{type:`string`,format:`uri`},$ref:{type:`string`,format:`uri-reference`},$comment:{type:`string`},title:{type:`string`},description:{type:`string`},default:!0,readOnly:{type:`boolean`,default:!1},examples:{type:`array`,items:!0},multipleOf:{type:`number`,exclusiveMinimum:0},maximum:{type:`number`},exclusiveMaximum:{type:`number`},minimum:{type:`number`},exclusiveMinimum:{type:`number`},maxLength:{$ref:`#/definitions/nonNegativeInteger`},minLength:{$ref:`#/definitions/nonNegativeIntegerDefault0`},pattern:{type:`string`,format:`regex`},additionalItems:{$ref:`#`},items:{anyOf:[{$ref:`#`},{$ref:`#/definitions/schemaArray`}],default:!0},maxItems:{$ref:`#/definitions/nonNegativeInteger`},minItems:{$ref:`#/definitions/nonNegativeIntegerDefault0`},uniqueItems:{type:`boolean`,default:!1},contains:{$ref:`#`},maxProperties:{$ref:`#/definitions/nonNegativeInteger`},minProperties:{$ref:`#/definitions/nonNegativeIntegerDefault0`},required:{$ref:`#/definitions/stringArray`},additionalProperties:{$ref:`#`},definitions:{type:`object`,additionalProperties:{$ref:`#`},default:{}},properties:{type:`object`,additionalProperties:{$ref:`#`},default:{}},patternProperties:{type:`object`,additionalProperties:{$ref:`#`},propertyNames:{format:`regex`},default:{}},dependencies:{type:`object`,additionalProperties:{anyOf:[{$ref:`#`},{$ref:`#/definitions/stringArray`}]}},propertyNames:{$ref:`#`},const:!0,enum:{type:`array`,items:!0,minItems:1,uniqueItems:!0},type:{anyOf:[{$ref:`#/definitions/simpleTypes`},{type:`array`,items:{$ref:`#/definitions/simpleTypes`},minItems:1,uniqueItems:!0}]},format:{type:`string`},contentMediaType:{type:`string`},contentEncoding:{type:`string`},if:{$ref:`#`},then:{$ref:`#`},else:{$ref:`#`},allOf:{$ref:`#/definitions/schemaArray`},anyOf:{$ref:`#/definitions/schemaArray`},oneOf:{$ref:`#/definitions/schemaArray`},not:{$ref:`#`}},xM={$schema:hM,$id:gM,title:_M,definitions:vM,type:yM,properties:bM,default:!0}})),CM=a(((e,t)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.MissingRefError=e.ValidationError=e.CodeGen=e.Name=e.nil=e.stringify=e.str=e._=e.KeywordCxt=e.Ajv=void 0;var n=Oj(),r=dM(),i=pM(),a=(SM(),c(mM).default),o=[`/properties`],s=`http://json-schema.org/draft-07/schema`,l=class extends n.default{_addVocabularies(){super._addVocabularies(),r.default.forEach(e=>this.addVocabulary(e)),this.opts.discriminator&&this.addKeyword(i.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let e=this.opts.$data?this.$dataMetaSchema(a,o):a;this.addMetaSchema(e,s,!1),this.refs[`http://json-schema.org/schema`]=s}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(s)?s:void 0)}};e.Ajv=l,t.exports=e=l,t.exports.Ajv=l,Object.defineProperty(e,"__esModule",{value:!0}),e.default=l;var u=fj();Object.defineProperty(e,"KeywordCxt",{enumerable:!0,get:function(){return u.KeywordCxt}});var d=Q();Object.defineProperty(e,"_",{enumerable:!0,get:function(){return d._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return d.str}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return d.stringify}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return d.nil}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return d.Name}}),Object.defineProperty(e,"CodeGen",{enumerable:!0,get:function(){return d.CodeGen}});var f=pj();Object.defineProperty(e,"ValidationError",{enumerable:!0,get:function(){return f.default}});var p=mj();Object.defineProperty(e,"MissingRefError",{enumerable:!0,get:function(){return p.default}})})),wM=a((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.formatNames=e.fastFormats=e.fullFormats=void 0;function t(e,t){return{validate:e,compare:t}}e.fullFormats={date:t(a,o),time:t(c(!0),l),"date-time":t(f(!0),p),"iso-time":t(c(),u),"iso-date-time":t(f(),m),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:_,"uri-reference":/^(?:[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,"uri-template":/^(?:(?:[^\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,url:/^(?:https?|ftp):\/\/(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|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-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)(?:\.(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu,email:/^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i,hostname:/^(?=.{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,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)$/,ipv6:/^((([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,regex:T,uuid:/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,"json-pointer":/^(?:\/(?:[^~/]|~0|~1)*)*$/,"json-pointer-uri-fragment":/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,"relative-json-pointer":/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,byte:y,int32:{type:`number`,validate:S},int64:{type:`number`,validate:C},float:{type:`number`,validate:w},double:{type:`number`,validate:w},password:!0,binary:!0},e.fastFormats={...e.fullFormats,date:t(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,o),time:t(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,l),"date-time":t(/^\d\d\d\d-[0-1]\d-[0-3]\dt(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,p),"iso-time":t(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,u),"iso-date-time":t(/^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,m),uri:/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,"uri-reference":/^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,email:/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i},e.formatNames=Object.keys(e.fullFormats);function n(e){return e%4==0&&(e%100!=0||e%400==0)}var r=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,i=[0,31,28,31,30,31,30,31,31,30,31,30,31];function a(e){let t=r.exec(e);if(!t)return!1;let a=+t[1],o=+t[2],s=+t[3];return o>=1&&o<=12&&s>=1&&s<=(o===2&&n(a)?29:i[o])}function o(e,t){if(e&&t)return e>t?1:e<t?-1:0}var s=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function c(e){return function(t){let n=s.exec(t);if(!n)return!1;let r=+n[1],i=+n[2],a=+n[3],o=n[4],c=n[5]===`-`?-1:1,l=+(n[6]||0),u=+(n[7]||0);if(l>23||u>59||e&&!o)return!1;if(r<=23&&i<=59&&a<60)return!0;let d=i-u*c,f=r-l*c-+(d<0);return(f===23||f===-1)&&(d===59||d===-1)&&a<61}}function l(e,t){if(!(e&&t))return;let n=new Date(`2020-01-01T`+e).valueOf(),r=new Date(`2020-01-01T`+t).valueOf();if(n&&r)return n-r}function u(e,t){if(!(e&&t))return;let n=s.exec(e),r=s.exec(t);if(n&&r)return e=n[1]+n[2]+n[3],t=r[1]+r[2]+r[3],e>t?1:e<t?-1:0}var d=/t|\s/i;function f(e){let t=c(e);return function(e){let n=e.split(d);return n.length===2&&a(n[0])&&t(n[1])}}function p(e,t){if(!(e&&t))return;let n=new Date(e).valueOf(),r=new Date(t).valueOf();if(n&&r)return n-r}function m(e,t){if(!(e&&t))return;let[n,r]=e.split(d),[i,a]=t.split(d),s=o(n,i);if(s!==void 0)return s||l(r,a)}var h=/\/|:/,g=/^(?:[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 _(e){return h.test(e)&&g.test(e)}var v=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function y(e){return v.lastIndex=0,v.test(e)}var b=-(2**31),x=2**31-1;function S(e){return Number.isInteger(e)&&e<=x&&e>=b}function C(e){return Number.isInteger(e)}function w(){return!0}var ee=/[^\\]\\Z/;function T(e){if(ee.test(e))return!1;try{return new RegExp(e),!0}catch{return!1}}})),TM=CM(),EM=wM();new Intl.DateTimeFormat(`en-GB`,{day:`numeric`,month:`long`,year:`numeric`,timeZone:`UTC`});var DM=[`text`,`email`,`url`,`tel`,`color`,`date`,`time`,`datetime-local`,`number`,`range`,`textarea`,`select`,`checkbox`,`radio`,`file`],OM=e=>DM.find(t=>t in e),kM=e=>!!(e&&typeof e==`object`&&DM.some(t=>t in e)),AM=e=>{let t=e[OM(e)];return t&&typeof t==`object`?t:{}},jM=()=>{let e=new TM.Ajv({allErrors:!0,strict:!1,formats:EM.fullFormats});return e.addKeyword({keyword:`$edahaField`,schemaType:`object`}),e},MM=(e,t)=>t===void 0?Object.keys(e):t===!1?[]:t,NM={string:`text`,number:`a number`,integer:`a whole number`,boolean:`yes or no`,array:`a list`,object:`a group of settings`,null:`empty`},PM={email:`an email address`,uri:`a full web address, e.g. https://example.com`,url:`a full web address, e.g. https://example.com`,"uri-reference":`a web address or path`,date:`a date, e.g. 2026-11-19`,time:`a time, e.g. 14:30:00`,"date-time":`a date and time, e.g. 2026-11-19T14:30:00Z`,hostname:`a host name, e.g. example.com`,ipv4:`an IPv4 address`,ipv6:`an IPv6 address`,uuid:`a UUID`,regex:`a regular expression`},FM=(e,t)=>`${e} ${t}${e===1?``:`s`}`,IM=e=>typeof e==`string`?`"${e}"`:JSON.stringify(e),LM=e=>{let t=e.params,n=t.limit;switch(e.keyword){case`type`:return`must be ${String(t.type).split(`,`).map(e=>NM[e]).join(` or `)}`;case`minimum`:return`must be at least ${n}`;case`maximum`:return`must be at most ${n}`;case`exclusiveMinimum`:return`must be more than ${n}`;case`exclusiveMaximum`:return`must be less than ${n}`;case`multipleOf`:return`must be a multiple of ${t.multipleOf}`;case`minLength`:return n===1?`can't be empty`:`must be at least ${FM(n,`character`)}`;case`maxLength`:return`must be at most ${FM(n,`character`)}`;case`pattern`:return`isn't in the right form`;case`format`:return`must be ${PM[t.format]??`a valid ${t.format}`}`;case`enum`:return`must be one of ${t.allowedValues.map(IM).join(`, `)}`;case`const`:return`must be ${IM(t.allowedValue)}`;case`required`:return`is required`;case`minItems`:return`must have at least ${FM(n,`item`)}`;case`maxItems`:return`can have at most ${FM(n,`item`)}`;case`uniqueItems`:return`can't have the same item twice`;case`additionalProperties`:return`isn't a known setting`;default:return e.message}},RM=(e,t)=>{let n=t.params,r=n.missingProperty??n.additionalProperty;return{path:e+t.instancePath+(r?`/${r}`:``),message:LM(t),level:`error`}},zM=class{ajv=jM();compiled=new Map;definitions;constructor(e){this.definitions=e}validate(e,t){let n=this.compiled.get(e);return n||(n=this.ajv.compile(this.definitions[e]),this.compiled.set(e,n)),n(t)?[]:n.errors.map(t=>RM(e,t))}},BM=(e,t)=>t.$edahaField?.title??t.title??e,VM=e=>e.$edahaField?.description??e.description,HM=e=>kM(e.$edahaField)?OM(e.$edahaField):e.type===`object`?`object`:`list`,UM=e=>{let t=e.$edahaField?AM(e.$edahaField):{};return Array.isArray(t.options)?t.options:(e.enum??e.items?.enum??[]).map(e=>({value:e}))},WM={minLength:`minlength`,maxLength:`maxlength`},GM={minLength:`minlength`,maxLength:`maxlength`,pattern:`pattern`,minimum:`min`,maximum:`max`,multipleOf:`step`},KM=[`options`,`list`,`multiple`],qM=e=>{let t={};for(let[n,r]of Object.entries(GM))e[n]!==void 0&&(t[r]=String(e[n]));let n=e.$edahaField?AM(e.$edahaField):{};for(let[e,r]of Object.entries(n))!KM.includes(e)&&r!=null&&(t[WM[e]??e.toLowerCase()]=String(r));return t},JM=(e,t,n)=>{let[r,...i]=t;if(r===void 0)return n;if(Array.isArray(e)){let t=[...e];return t[Number(r)]=JM(t[Number(r)],i,n),t}let a={...e&&typeof e==`object`?e:{}},o=JM(a[r],i,n);return Object.fromEntries(Object.entries({...a,[r]:o}).filter(([,e])=>e!==void 0))},YM=(e,t)=>{if(typeof t==`boolean`)return t;if(t!==``)return e===`number`||e===`range`?Number(t):t},XM=e=>{let{value:t}=e.$edahaField?AM(e.$edahaField):{};return t===void 0?{checked:!0,unchecked:!1}:{checked:t,unchecked:void 0}},ZM=/^#?([0-9a-f]{6})$/i,QM=e=>{let t=ZM.exec(String(e??``));return t?`#${t[1].toLowerCase()}`:``},$M=(e,t)=>typeof t==`string`&&/^[0-9a-f]{6}$/i.test(t)?e.replace(/^#/,``):e,eN=(e,t)=>e.filter(e=>e.path===t),tN=e=>E`<span class="visually-hidden">${e}</span>`,nN=e=>`meta-${e.replace(/[^\w-]/g,`-`)}`;St(`edaha-metadata-field`,class extends Ge{static properties={path:{},label:{},schema:{attribute:!1},value:{attribute:!1},problems:{attribute:!1},hiddenFields:{attribute:!1},required:{type:Boolean},uploadFile:{attribute:!1},chooseFile:{attribute:!1},fileUrl:{attribute:!1}};constructor(){super(),this.path=``,this.schema={},this.problems=[],this.hiddenFields=new Set,this.required=!1}createRenderRoot(){return this}change(e,t){this.dispatchEvent(new CustomEvent(`metadata-change`,{detail:{path:e,value:t},bubbles:!0}))}get key(){return this.path.split(`/`).at(-1)}get fieldTitle(){return this.label??BM(this.key,this.schema)}renderNotes(e){let t=VM(this.schema),n=this.schema.$edahaField?.info,r=eN(this.problems,this.path);return E`${t?E`<p class="metadata-description" id="${e}-description">
648
651
  ${t}
649
652
  </p>`:D}${n?E`<p class="metadata-info" id="${e}-info">${n}</p>`:D}${r.length?E`<ul class="metadata-problems" id="${e}-problems">
650
653
  ${r.map(e=>E`<li class=${e.level}>
651
654
  ${this.fieldTitle} ${e.message}
652
655
  </li>`)}
653
- </ul>`:D}`}describedBy(e){return[BM(this.schema)&&`${e}-description`,this.schema.$edahaField?.info&&`${e}-info`,$M(this.problems,this.path).length&&`${e}-problems`].filter(Boolean).join(` `)}renderChild(e,t,n,r={}){return E`<edaha-metadata-field
656
+ </ul>`:D}`}describedBy(e){return[VM(this.schema)&&`${e}-description`,this.schema.$edahaField?.info&&`${e}-info`,eN(this.problems,this.path).length&&`${e}-problems`].filter(Boolean).join(` `)}renderChild(e,t,n,r={}){return E`<edaha-metadata-field
654
657
  path=${e}
655
658
  .label=${r.label}
656
659
  .schema=${t}
@@ -681,7 +684,7 @@ img.ProseMirror-separator {
681
684
  class="btn btn-xs"
682
685
  @click=${()=>this.change(this.path,t.filter((e,t)=>t!==n))}
683
686
  >
684
- Delete${eN(` ${this.fieldTitle} ${n+1}`)}
687
+ Delete${tN(` ${this.fieldTitle} ${n+1}`)}
685
688
  </button>
686
689
  </div>`)}
687
690
  <button
@@ -690,16 +693,16 @@ img.ProseMirror-separator {
690
693
  ?disabled=${r}
691
694
  @click=${()=>this.change(this.path,[...t,void 0])}
692
695
  >
693
- Add${eN(` to ${this.fieldTitle}`)}
696
+ Add${tN(` to ${this.fieldTitle}`)}
694
697
  </button>
695
- </fieldset>`}renderSelect(e,t){let n=kM(this.schema.$edahaField),r=HM(this.schema),i=n.multiple===!0,a=i?(this.value??[]).map(String):[String(this.value??``)];return E`<select
698
+ </fieldset>`}renderSelect(e,t){let n=AM(this.schema.$edahaField),r=UM(this.schema),i=n.multiple===!0,a=i?(this.value??[]).map(String):[String(this.value??``)];return E`<select
696
699
  id=${e}
697
700
  ?multiple=${i}
698
701
  size=${n.list===!0?r.length+ +!i:D}
699
702
  ?required=${this.required}
700
- aria-invalid=${$M(this.problems,this.path).length?`true`:`false`}
703
+ aria-invalid=${eN(this.problems,this.path).length?`true`:`false`}
701
704
  aria-describedby=${this.describedBy(e)||D}
702
- @change=${e=>{let n=[...e.target.selectedOptions].map(e=>r[Number(e.dataset.index)]?.value??void 0);this.change(this.path,i?n:n[0]??JM(t,``))}}
705
+ @change=${e=>{let n=[...e.target.selectedOptions].map(e=>r[Number(e.dataset.index)]?.value??void 0);this.change(this.path,i?n:n[0]??YM(t,``))}}
703
706
  >
704
707
  ${i?D:E`<option value="">—</option>`}
705
708
  ${r.map((e,t)=>E`<option
@@ -715,11 +718,11 @@ img.ProseMirror-separator {
715
718
  >
716
719
  <legend>${this.fieldTitle}</legend>
717
720
  ${this.renderNotes(e)}
718
- ${HM(this.schema).map((t,n)=>E`<label class="metadata-choice">
721
+ ${UM(this.schema).map((t,n)=>E`<label class="metadata-choice">
719
722
  <input
720
723
  type="radio"
721
724
  name=${e}
722
- .checked=${St(this.value===t.value)}
725
+ .checked=${Mt(this.value===t.value)}
723
726
  ?required=${this.required}
724
727
  aria-describedby=${t.description?`${e}-${n}`:D}
725
728
  @change=${()=>this.change(this.path,t.value)}
@@ -727,34 +730,34 @@ img.ProseMirror-separator {
727
730
  ${t.title??String(t.value)}
728
731
  ${t.description?E`<small id="${e}-${n}">${t.description}</small>`:D}
729
732
  </label>`)}
730
- </fieldset>`}async chooseExisting(){let e=await this.chooseFile?.(jA(KM(this.schema).accept));e&&this.change(this.path,e.url)}renderFile(e){let t=typeof this.value==`string`?this.value:``,n=t?this.fileUrl?.(t):void 0;return E`${t?E`<p class="metadata-file">
733
+ </fieldset>`}async chooseExisting(){let e=await this.chooseFile?.(MA(qM(this.schema).accept));e&&this.change(this.path,e.url)}renderFile(e){let t=typeof this.value==`string`?this.value:``,n=t?this.fileUrl?.(t):void 0;return E`${t?E`<p class="metadata-file">
731
734
  ${n?E`<a href=${n} target="_blank">${t}</a>`:t}
732
735
  <button
733
736
  type="button"
734
737
  class="btn btn-xs"
735
738
  @click=${()=>this.change(this.path,void 0)}
736
739
  >
737
- Clear${eN(` ${this.fieldTitle}`)}
740
+ Clear${tN(` ${this.fieldTitle}`)}
738
741
  </button>
739
742
  </p>`:D}<input
740
743
  type="file"
741
744
  id=${e}
742
745
  ?disabled=${!this.uploadFile}
743
746
  ?required=${this.required&&!t}
744
- aria-invalid=${$M(this.problems,this.path).length?`true`:`false`}
747
+ aria-invalid=${eN(this.problems,this.path).length?`true`:`false`}
745
748
  aria-describedby=${this.describedBy(e)||D}
746
- accept=${KM(this.schema).accept??D}
749
+ accept=${qM(this.schema).accept??D}
747
750
  @change=${async e=>{let t=e.target,n=t.files?.[0];if(t.value=``,n&&this.uploadFile)try{this.change(this.path,await this.uploadFile(n))}catch{}}}
748
751
  />${this.chooseFile?E`<button
749
752
  type="button"
750
753
  class="btn btn-choose-file"
751
754
  @click=${()=>void this.chooseExisting()}
752
755
  >
753
- Choose existing file…${eN(` for ${this.fieldTitle}`)}
754
- </button>`:D}`}renderInput(e,t){let n=$M(this.problems,this.path).length?`true`:`false`,r=this.describedBy(e)||D;if(t===`select`)return this.renderSelect(e,t);if(t===`file`)return this.renderFile(e);if(t===`checkbox`){let{checked:t,unchecked:i}=YM(this.schema);return E`<input
756
+ Choose existing file…${tN(` for ${this.fieldTitle}`)}
757
+ </button>`:D}`}renderInput(e,t){let n=eN(this.problems,this.path).length?`true`:`false`,r=this.describedBy(e)||D;if(t===`select`)return this.renderSelect(e,t);if(t===`file`)return this.renderFile(e);if(t===`checkbox`){let{checked:t,unchecked:i}=XM(this.schema);return E`<input
755
758
  type="checkbox"
756
759
  id=${e}
757
- .checked=${St(this.value===t)}
760
+ .checked=${Mt(this.value===t)}
758
761
  aria-invalid=${n}
759
762
  aria-describedby=${r}
760
763
  @change=${e=>this.change(this.path,e.target.checked?t:i)}
@@ -763,9 +766,9 @@ img.ProseMirror-separator {
763
766
  id=${e}
764
767
  aria-invalid=${n}
765
768
  aria-describedby=${r}
766
- .value=${St(ZM(this.value))}
767
- @input=${e=>this.change(this.path,QM(e.target.value,this.value))}
768
- />`;let i=KM(this.schema),a=e=>this.change(this.path,JM(t,e.target.value));return t===`textarea`?E`<textarea
769
+ .value=${Mt(QM(this.value))}
770
+ @input=${e=>this.change(this.path,$M(e.target.value,this.value))}
771
+ />`;let i=qM(this.schema),a=e=>this.change(this.path,YM(t,e.target.value));return t===`textarea`?E`<textarea
769
772
  id=${e}
770
773
  rows=${i.rows??3}
771
774
  minlength=${i.minlength??D}
@@ -774,7 +777,7 @@ img.ProseMirror-separator {
774
777
  ?required=${this.required}
775
778
  aria-invalid=${n}
776
779
  aria-describedby=${r}
777
- .value=${St(String(this.value??``))}
780
+ .value=${Mt(String(this.value??``))}
778
781
  @input=${a}
779
782
  ></textarea>`:E`<input
780
783
  type=${t}
@@ -789,9 +792,9 @@ img.ProseMirror-separator {
789
792
  ?required=${this.required}
790
793
  aria-invalid=${n}
791
794
  aria-describedby=${r}
792
- .value=${St(String(this.value??``))}
795
+ .value=${Mt(String(this.value??``))}
793
796
  @input=${a}
794
- />`}render(){let e=tN(this.path),t=VM(this.schema),n=()=>this.dispatchEvent(new CustomEvent(`metadata-blur`,{detail:this.path,bubbles:!0})),r=e=>{this.contains(e.relatedTarget)||n()};if(t===`object`)return E`<div @focusout=${r}>${this.renderObject(e)}</div>`;if(t===`list`)return E`<div @focusout=${r}>${this.renderList(e)}</div>`;if(t===`radio`)return E`<div @focusout=${r}>${this.renderRadio(e)}</div>`;let i=E`<label for=${e}
797
+ />`}render(){let e=nN(this.path),t=HM(this.schema),n=()=>this.dispatchEvent(new CustomEvent(`metadata-blur`,{detail:this.path,bubbles:!0})),r=e=>{this.contains(e.relatedTarget)||n()};if(t===`object`)return E`<div @focusout=${r}>${this.renderObject(e)}</div>`;if(t===`list`)return E`<div @focusout=${r}>${this.renderList(e)}</div>`;if(t===`radio`)return E`<div @focusout=${r}>${this.renderRadio(e)}</div>`;let i=E`<label for=${e}
795
798
  >${this.fieldTitle}${this.required?E`<span class="required" aria-hidden="true"> *</span>`:D}</label
796
799
  >`;return t===`checkbox`?E`<div
797
800
  class="metadata-field metadata-checkbox"
@@ -801,12 +804,12 @@ img.ProseMirror-separator {
801
804
  ${this.renderNotes(e)}
802
805
  </div>`:E`<div class="metadata-field" @focusout=${r}>
803
806
  ${i} ${this.renderNotes(e)} ${this.renderInput(e,t)}
804
- </div>`}});var nN=`embed-options`;ft(`edaha-embed-dialog`,class extends Ge{static properties={embed:{state:!0},content:{state:!0},options:{state:!0},changing:{state:!0},errors:{state:!0},checking:{state:!0}};editing;validator;constructor(){super(),this.content=``,this.options={},this.changing=!1,this.errors=[],this.checking=!1}createRenderRoot(){return this}get dialog(){return this.querySelector(`dialog`)}get textarea(){return this.querySelector(`#embed-dialog-content`)}async edit(e,{content:t,options:n},r,i){this.finish(void 0),this.embed=e,this.content=t,this.options=n,this.changing=!r,this.validator=i,this.errors=[];let a=new Promise(e=>this.editing=e);return await this.updateComplete,this.dialog?.showModal(),this.textarea?.focus(),a}finish(e){let t=this.editing;this.editing=void 0,t?.(e)}resolvedOptions(){return YA(this.embed?.options??{},this.options)}close(){this.dialog?.close()}async save(e){e.preventDefault();let t=this.content.trim();if(!this.embed||!t&&!this.embed.contentOptional||this.checking)return;let n={key:this.embed.key,content:t,options:this.resolvedOptions().values};if(this.validator){let e=this.options;this.checking=!0;try{this.errors=await this.validator(n)}catch(e){this.errors=[`The content couldn't be checked: ${e.message}`]}this.checking=!1;let r=t!==this.content.trim()||e!==this.options;if(r&&(this.errors=[]),r||this.errors.length){this.textarea?.focus();return}}this.finish(n),this.close()}onOptionChange(e){e.stopPropagation();let t=e.detail.path.split(`/`).slice(1);this.options=qM(this.options,t,e.detail.value),this.errors=[]}renderOptionFields(){let e=this.embed?.options??{};if(!Object.keys(e).length)return D;let{values:t,hidden:n}=this.resolvedOptions();return E`<edaha-metadata-field
807
+ </div>`}});var rN=`embed-options`;St(`edaha-embed-dialog`,class extends Ge{static properties={embed:{state:!0},content:{state:!0},options:{state:!0},changing:{state:!0},errors:{state:!0},checking:{state:!0}};editing;validator;constructor(){super(),this.content=``,this.options={},this.changing=!1,this.errors=[],this.checking=!1}createRenderRoot(){return this}get dialog(){return this.querySelector(`dialog`)}get textarea(){return this.querySelector(`#embed-dialog-content`)}async edit(e,{content:t,options:n},r,i){this.finish(void 0),this.embed=e,this.content=t,this.options=n,this.changing=!r,this.validator=i,this.errors=[];let a=new Promise(e=>this.editing=e);return await this.updateComplete,this.dialog?.showModal(),this.textarea?.focus(),a}finish(e){let t=this.editing;this.editing=void 0,t?.(e)}resolvedOptions(){return XA(this.embed?.options??{},this.options)}close(){this.dialog?.close()}async save(e){e.preventDefault();let t=this.content.trim();if(!this.embed||!t&&!this.embed.contentOptional||this.checking)return;let n={key:this.embed.key,content:t,options:this.resolvedOptions().values};if(this.validator){let e=this.options;this.checking=!0;try{this.errors=await this.validator(n)}catch(e){this.errors=[`The content couldn't be checked: ${e.message}`]}this.checking=!1;let r=t!==this.content.trim()||e!==this.options;if(r&&(this.errors=[]),r||this.errors.length){this.textarea?.focus();return}}this.finish(n),this.close()}onOptionChange(e){e.stopPropagation();let t=e.detail.path.split(`/`).slice(1);this.options=JM(this.options,t,e.detail.value),this.errors=[]}renderOptionFields(){let e=this.embed?.options??{};if(!Object.keys(e).length)return D;let{values:t,hidden:n}=this.resolvedOptions();return E`<edaha-metadata-field
805
808
  class="embed-dialog-options"
806
- path=${nN}
809
+ path=${rN}
807
810
  .schema=${{title:`Options`,type:`object`,properties:e}}
808
811
  .value=${t}
809
- .hiddenFields=${new Set([...n].map(e=>`${nN}.${e}`))}
812
+ .hiddenFields=${new Set([...n].map(e=>`${rN}.${e}`))}
810
813
  @metadata-change=${this.onOptionChange}
811
814
  @metadata-blur=${e=>e.stopPropagation()}
812
815
  ></edaha-metadata-field>`}render(){let{embed:e}=this;return E`<dialog
@@ -825,12 +828,12 @@ img.ProseMirror-separator {
825
828
  title="Close"
826
829
  @click=${()=>this.close()}
827
830
  >
828
- ${Dt(`close`)}<span class="visually-hidden">Close</span>
831
+ ${ft(`close`)}<span class="visually-hidden">Close</span>
829
832
  </button>
830
833
  </div>
831
834
  <div class="embed-dialog-body">
832
835
  <p class="embed-dialog-about">
833
- ${At(e)} <span>${e?.description??``}</span>
836
+ ${ht(e)} <span>${e?.description??``}</span>
834
837
  </p>
835
838
  <label for="embed-dialog-content">Content</label>
836
839
  <p id="embed-dialog-content-hint" class="embed-dialog-hint">
@@ -870,7 +873,7 @@ img.ProseMirror-separator {
870
873
  </button>
871
874
  </div>
872
875
  </form>
873
- </dialog>`}});var rN=[{key:`info`,title:`Info`,openedByDefault:!0,fields:[`type`,`status`,`slug`,`date`,`author`]},{key:`categorise`,title:`Categorise`,openedByDefault:!1,fields:[`tags`]},{key:`customise`,title:`Customise`,openedByDefault:!0,fields:[`excerpt`,`template`]},{key:`files`,title:`Files`,openedByDefault:!0,fields:[`thumbnail`,`attachments`,`uploaded`]},{key:`custom`,title:`Custom`,openedByDefault:!1,fields:[]}],iN=[{value:`published`,label:`Published`},{value:`draft`,label:`Draft`},{value:`unlisted`,label:`Unlisted`}],aN=[{mode:`wysiwyg`,label:`WYSIWYG`},{mode:`markdown`,label:`Markdown`},{mode:`preview`,label:`Preview`}],oN=[{value:`full`,label:`Full`,width:`100%`},{value:`900`,label:`900px`,width:`900px`},{value:`600`,label:`600px`,width:`600px`},{value:`320`,label:`320px`,width:`320px`}],sN=e=>`body-tab-${e}`,cN=(e,t,n)=>{switch(e){case`ArrowRight`:return(t+1)%n;case`ArrowLeft`:return(t-1+n)%n;case`Home`:return 0;case`End`:return n-1;default:return}},lN=(e=new Date)=>({type:`article`,slug:``,status:`draft`,date:e.toISOString(),title:``,author:void 0,excerpt:void 0,thumbnail:void 0,tags:[],attachments:[],bodyHtml:``}),uN=(e,t,n)=>{let r=/^author\[(name|email|url)\]$/.exec(t);if(r){let t={name:``,...e.author||{},[r[1]]:n||void 0};return{...e,author:t.name||t.email||t.url?{...t,name:t.name??``}:void 0}}let i=/^tags\[(\d+)\]$/.exec(t);if(i){let t=[...e.tags];return t[Number(i[1])]=n,{...e,tags:t}}let a=/^attachments\[(\d+)\]\[(url|name|thumbnail)\]$/.exec(t);if(a){let t=[...e.attachments],r=Number(a[1]),i=a[2],o=t[r]??{url:``};return t[r]=i===`url`?{...o,url:n}:{...o,[i]:n||void 0},{...e,attachments:t}}switch(t){case`date`:return{...e,date:xt(n)||e.date};case`body`:return{...e,bodyHtml:n};case`excerpt`:case`thumbnail`:return{...e,[t]:n||void 0};case`template`:return{...e,template:n===`single`?void 0:n};case`title`:case`slug`:case`type`:case`status`:return{...e,[t]:n};default:return e}},dN=e=>({...e,slug:e.slug.trim()||_t(e.title),title:e.title.trim(),tags:e.tags.map(e=>e.trim()).filter(Boolean),attachments:e.attachments.filter(e=>e.url.trim())}),fN=[`title`,`type`,`template`,`status`,`slug`,`date`,`author`,`excerpt`,`thumbnail`,`tags`,`attachments`,`meta`],pN=e=>Array.isArray(e)?e.map(pN):e&&typeof e==`object`?Object.fromEntries(Object.entries(e).filter(([,e])=>e!==void 0).sort(([e],[t])=>e.localeCompare(t)).map(([e,t])=>[e,pN(t)])):e,mN=(e,t)=>new Set(fN.filter(n=>JSON.stringify(pN(e[n]))!==JSON.stringify(pN(t[n])))),hN=[`type`,`status`,`slug`,`date`,`author`,`tags`,`excerpt`,`template`,`thumbnail`,`attachments`,`uploaded`],gN=e=>hN.includes(e),_N=e=>E`<span class="visually-hidden">${e}</span>`,vN=e=>new Set(e.filter(e=>e.openedByDefault).map(e=>e.key)),yN=`Some values aren't valid. Fix the fields marked ⚠️ in the settings.`;ft(`edaha-article`,class extends Ge{static properties={api:{attribute:!1},article:{attribute:!1},typeOptions:{attribute:!1},data:{state:!0},files:{state:!0},location:{state:!0},busy:{state:!0},message:{state:!0},error:{state:!0},templates:{state:!0},mode:{state:!0},bodyMarkdown:{state:!0},previewUrl:{state:!0},previewWidth:{state:!0},metadataOpen:{state:!0},savedData:{state:!0},bodyChanged:{state:!0},metadata:{attribute:!1},site:{attribute:!1},metaProblems:{state:!0},openGroups:{state:!0},compact:{attribute:!1},focusMode:{attribute:!1},pickFile:{attribute:!1},embedTools:{state:!0}};groupsOpened=!1;savedProblems=[];validatorFor;bodyCheckDelay=300;savedBodyMarkdown=``;bodyChecks=0;savedBodies=0;bodyTimer;templatesType=``;confirm=e=>window.confirm(e);constructor(){super(),this.typeOptions=[],this.data=lN(),this.files=[],this.busy=!1,this.message=``,this.error=``,this.templates=[],this.mode=`wysiwyg`,this.bodyMarkdown=``,this.previewUrl=``,this.previewWidth=`full`,this.metadataOpen=!1,this.savedData=structuredClone(this.data),this.bodyChanged=!1,this.metaProblems=[],this.openGroups=vN(rN),this.compact=!1,this.focusMode=!1}createRenderRoot(){return this}toggleFocusMode(){this.dispatchEvent(new CustomEvent(`focus-mode-change`,{detail:!this.focusMode,bubbles:!0,composed:!0}))}connectedCallback(){super.connectedCallback(),this.loadEmbeds()}async firstUpdated(){if(this.article)return;let e=this.querySelector(`edaha-article-data-field[name="title"]`);await e?.updateComplete,e?.querySelector(`input`)?.focus()}willUpdate(e){if(e.get(`compact`)&&!this.compact&&(this.metadataOpen=!1),e.has(`metadata`)&&this.metadata&&!this.groupsOpened&&(this.groupsOpened=!0,this.openGroups=vN(this.metadata.groups)),e.has(`metaProblems`)){let e=this.groupsWithErrors();[...e].some(e=>!this.openGroups.has(e))&&(this.openGroups=new Set([...this.openGroups,...e]))}if(e.has(`article`)){let{files:e,problems:t=[],...n}=this.article??{...lN(),files:[]};this.savedProblems=t.filter(({level:e})=>e===`error`),this.metaProblems=this.savedProblems,this.data=n,this.files=e,this.location=this.article?{type:this.article.type,slug:this.article.slug}:void 0,this.message=``,this.error=``,this.mode=`wysiwyg`,this.savedData=structuredClone(n),this.bodyChanged=!1,this.rememberBody(n.bodyHtml,this.article?void 0:``)}if(this.api&&this.data.type!==this.templatesType){let e=this.data.type;this.templatesType=e,this.api.templates(e).then(t=>{this.data.type===e&&(this.templates=t)},()=>{this.data.type===e&&(this.templates=[])})}}fileUrl(e){return!e||!this.location||/^([a-z][a-z0-9+.-]*:|\/)/i.test(e)?e:`/files/${this.location.type}/${this.location.slug}/${e}`}async run(e){this.busy=!0,this.error=``,this.message=``;try{return await e()}catch(e){this.error=e.message,e instanceof ct&&e.problems&&(this.metaProblems=e.problems),BA(this,{kind:`error`,message:this.error});return}finally{this.busy=!1}}async upload(e){let t=this.location;if(!t)return;let n=await this.run(()=>this.api.upload(t,e));return n&&!this.files.includes(n.name)&&(this.files=[...this.files,n.name].sort()),n?.name}uploadImage=async e=>{let t=await this.upload(e);if(!t)throw Error(`Upload failed`);return this.fileUrl(t)};uploadMarkdownImage=async e=>{let t=await this.upload(e);if(!t)throw Error(`Upload failed`);return t};chooseFile=async e=>{let t=await this.pickFile?.(e);if(t)return{url:t.type===this.location?.type&&t.slug===this.location.slug?t.name:t.url,name:t.name,kind:t.kind}};chooseBodyFile=async e=>{let t=await this.chooseFile(e);return t&&{...t,url:this.fileUrl(t.url)}};choosers(){return this.pickFile?{file:this.chooseFile,body:this.chooseBodyFile}:{file:void 0,body:void 0}}async loadEmbeds(){try{let e=await this.api.embeds();this.embedTools={embeds:e,edit:async(t,n)=>{let r=e.find(e=>e.key===t.key),i=this.querySelector(`edaha-embed-dialog`);return r?i.edit(r,t,n,e=>this.api.validateEmbed(e.key,e.content,e.options)):void 0},loadFrame:({key:e,content:t,options:n})=>this.api.embedFrame(e,t,n)}}catch{this.embedTools=void 0}}onFieldChange(e){let{name:t,value:n}=e.detail;t===`bodyMarkdown`?this.bodyMarkdown=n:this.data=uN(this.data,t,n),(t===`body`||t===`bodyMarkdown`)&&this.scheduleBodyCheck()}async currentBodyMarkdown(){return this.mode===`markdown`?this.bodyMarkdown:this.api.toMarkdown(this.data.bodyHtml,this.location)}scheduleBodyCheck(){clearTimeout(this.bodyTimer),this.bodyTimer=setTimeout(()=>void this.checkBody(),this.bodyCheckDelay)}async checkBody(){clearTimeout(this.bodyTimer);let e=++this.bodyChecks,t=await this.currentBodyMarkdown().catch(()=>void 0);e===this.bodyChecks&&t!==void 0&&this.savedBodyMarkdown!==void 0&&(this.bodyChanged=t!==this.savedBodyMarkdown)}async rememberBody(e,t){let n=++this.savedBodies,r=t;try{r??=await this.api.toMarkdown(e,this.location)}catch{}n===this.savedBodies&&(this.savedBodyMarkdown=r,await this.checkBody())}get dirty(){return this.bodyChanged||mN(this.data,this.savedData).size>0}async hasChanges(){return await this.checkBody(),this.dirty}async onFieldFile(e){let t=e.target.name,n=await this.upload(e.detail);n&&(this.data=uN(this.data,t,n))}async syncBody(){if(this.mode!==`markdown`)return!0;let e=await this.run(()=>this.api.toHtml(this.bodyMarkdown,this.location));return e!==void 0&&(this.data={...this.data,bodyHtml:e},!0)}async setMode(e){if(e!==this.mode&&await this.syncBody()){if(e===`markdown`){let e=await this.run(()=>this.api.toMarkdown(this.data.bodyHtml,this.location));if(e===void 0)return;this.bodyMarkdown=e}else if(e===`preview`){let e=await this.run(()=>this.api.preview(dN(this.data),this.location));if(e===void 0)return;this.previewUrl=e}this.mode=e}}async save(){let{values:e}=this.resolvedMeta(),t=this.metadataKeys().flatMap(t=>this.checkMetadata(t,e));if(t.length)return this.metaProblems=t,BA(this,{kind:`error`,message:yN}),!1;if(!await this.syncBody())return!1;let n=this.metadataKeys(),r=dN({...this.data,meta:{...Object.fromEntries(Object.entries(this.data.meta??{}).filter(([e])=>!n.includes(e))),...e}}),i=this.location,a=await this.run(()=>i?this.api.save(i,r):this.api.create(r));return a?(this.data=r,this.savedData=structuredClone(r),this.savedProblems=[],this.metaProblems=[],this.location=a,this.message=`Saved`,BA(this,{kind:`success`,message:this.message}),this.bodyChanged=!1,this.rememberBody(r.bodyHtml,this.mode===`markdown`?this.bodyMarkdown:void 0),this.dispatchEvent(new CustomEvent(`article-saved`,{detail:a,bubbles:!0})),!0):!1}reset(){this.confirm(`Reset this article to how it was last saved? Your changes will be lost.`)&&(clearTimeout(this.bodyTimer),this.bodyChecks++,this.data=structuredClone(this.savedData),this.metaProblems=this.savedProblems,this.mode=`wysiwyg`,this.bodyChanged=!1,this.error=``,this.message=`Reset to the last saved version`,BA(this,{kind:`success`,message:this.message}))}async deleteArticle(){let e=this.location;e&&this.confirm(`Delete "${this.data.title}" and all its files?`)&&await this.run(async()=>(await this.api.remove(e),!0))&&(BA(this,{kind:`success`,message:`Deleted "${this.data.title}"`}),this.dispatchEvent(new CustomEvent(`article-deleted`,{bubbles:!0})))}validator(){let{definitions:e}=this.metadata;return this.validatorFor?.definitions!==e&&(this.validatorFor={definitions:e,validator:new RM(e)}),this.validatorFor.validator}metadataKeys(){return jM(this.metadata?.definitions??{},this.metadata?.types[this.data.type])}resolvedMeta(){let e=this.metadata?.definitions??{},t=Object.fromEntries(this.metadataKeys().map(t=>[t,e[t]]));return YA(t,Object.fromEntries(Object.entries(this.data.meta??{}).filter(([e])=>e in t)))}checkMetadata(e,t=this.resolvedMeta().values){let n=t[e];return n===void 0?[]:this.validator().validate(e,n)}onMetadataChange(e){let{path:t,value:n}=e.detail;this.data={...this.data,meta:qM(this.data.meta,t.split(`/`),n)}}onMetadataBlur(e){let t=e.detail.split(`/`)[0],n=e=>e.path.split(`/`)[0]===t,r=this.metaProblems.some(n),i=this.checkMetadata(t);this.metaProblems=[...this.metaProblems.filter(e=>!n(e)),...i],i.length&&!r&&BA(this,{kind:`error`,message:yN})}removeSetting(e){this.data={...this.data,meta:qM(this.data.meta,[e],void 0)}}metadataWarnings(){let e=this.metadataKeys(),t=this.metadata?.definitions??{};return Object.keys(this.data.meta??{}).filter(t=>!e.includes(t)).map(e=>({path:e,message:e in t?`isn't used by this article's type`:`isn't a known setting`,level:`warning`}))}isChanged(e){return mN(this.data,this.savedData).has(e)}defaultAuthor(){if(!this.site)return;let e=this.site.types[this.data.type];return e===void 0?this.site.author:e||void 0}renderAuthor(){let e=this.data.author===!1,t=e?void 0:this.data.author,n=this.defaultAuthor(),r=t||e?void 0:n,i=e?``:this.site?n?`Defaults to ${n.name}`:`No author unless you name one`:`Defaults to the site name`;return E`<edaha-article-data-group
876
+ </dialog>`}});var iN=[{key:`info`,title:`Info`,openedByDefault:!0,fields:[`type`,`status`,`slug`,`date`,`author`]},{key:`categorise`,title:`Categorise`,openedByDefault:!1,fields:[`tags`]},{key:`customise`,title:`Customise`,openedByDefault:!0,fields:[`excerpt`,`template`]},{key:`files`,title:`Files`,openedByDefault:!0,fields:[`thumbnail`,`attachments`,`uploaded`]},{key:`custom`,title:`Custom`,openedByDefault:!1,fields:[]}],aN=[{value:`published`,label:`Published`},{value:`draft`,label:`Draft`},{value:`unlisted`,label:`Unlisted`}],oN=[{mode:`wysiwyg`,label:`WYSIWYG`},{mode:`markdown`,label:`Markdown`},{mode:`preview`,label:`Preview`}],sN=[{value:`full`,label:`Full`,width:`100%`},{value:`900`,label:`900px`,width:`900px`},{value:`600`,label:`600px`,width:`600px`},{value:`320`,label:`320px`,width:`320px`}],cN=e=>`body-tab-${e}`,lN=(e,t,n)=>{switch(e){case`ArrowRight`:return(t+1)%n;case`ArrowLeft`:return(t-1+n)%n;case`Home`:return 0;case`End`:return n-1;default:return}},uN=(e=new Date)=>({type:`article`,slug:``,status:`draft`,date:e.toISOString(),title:``,author:void 0,excerpt:void 0,thumbnail:void 0,tags:[],attachments:[],bodyHtml:``}),dN=(e,t,n)=>{let r=/^author\[(name|email|url)\]$/.exec(t);if(r){let t={name:``,...e.author||{},[r[1]]:n||void 0};return{...e,author:t.name||t.email||t.url?{...t,name:t.name??``}:void 0}}let i=/^tags\[(\d+)\]$/.exec(t);if(i){let t=[...e.tags];return t[Number(i[1])]=n,{...e,tags:t}}let a=/^attachments\[(\d+)\]\[(url|name|thumbnail)\]$/.exec(t);if(a){let t=[...e.attachments],r=Number(a[1]),i=a[2],o=t[r]??{url:``};return t[r]=i===`url`?{...o,url:n}:{...o,[i]:n||void 0},{...e,attachments:t}}switch(t){case`date`:return{...e,date:jt(n)||e.date};case`body`:return{...e,bodyHtml:n};case`excerpt`:case`thumbnail`:return{...e,[t]:n||void 0};case`template`:return{...e,template:n===`single`?void 0:n};case`title`:case`slug`:case`type`:case`status`:return{...e,[t]:n};default:return e}},fN=e=>({...e,slug:e.slug.trim()||Dt(e.title),title:e.title.trim(),tags:e.tags.map(e=>e.trim()).filter(Boolean),attachments:e.attachments.filter(e=>e.url.trim())}),pN=[`title`,`type`,`template`,`status`,`slug`,`date`,`author`,`excerpt`,`thumbnail`,`tags`,`attachments`,`meta`],mN=e=>Array.isArray(e)?e.map(mN):e&&typeof e==`object`?Object.fromEntries(Object.entries(e).filter(([,e])=>e!==void 0).sort(([e],[t])=>e.localeCompare(t)).map(([e,t])=>[e,mN(t)])):e,hN=(e,t)=>new Set(pN.filter(n=>JSON.stringify(mN(e[n]))!==JSON.stringify(mN(t[n])))),gN=[`type`,`status`,`slug`,`date`,`author`,`tags`,`excerpt`,`template`,`thumbnail`,`attachments`,`uploaded`],_N=e=>gN.includes(e),vN=e=>E`<span class="visually-hidden">${e}</span>`,yN=e=>new Set(e.filter(e=>e.openedByDefault).map(e=>e.key)),bN=`Some values aren't valid. Fix the fields marked ⚠️ in the settings.`;St(`edaha-article`,class extends Ge{static properties={api:{attribute:!1},article:{attribute:!1},typeOptions:{attribute:!1},data:{state:!0},files:{state:!0},location:{state:!0},busy:{state:!0},message:{state:!0},error:{state:!0},templates:{state:!0},mode:{state:!0},bodyMarkdown:{state:!0},previewUrl:{state:!0},previewWidth:{state:!0},metadataOpen:{state:!0},savedData:{state:!0},bodyChanged:{state:!0},metadata:{attribute:!1},site:{attribute:!1},metaProblems:{state:!0},openGroups:{state:!0},compact:{attribute:!1},focusMode:{attribute:!1},pickFile:{attribute:!1},embedTools:{state:!0}};groupsOpened=!1;savedProblems=[];validatorFor;bodyCheckDelay=300;savedBodyMarkdown=``;bodyChecks=0;savedBodies=0;bodyTimer;templatesType=``;confirm=e=>window.confirm(e);constructor(){super(),this.typeOptions=[],this.data=uN(),this.files=[],this.busy=!1,this.message=``,this.error=``,this.templates=[],this.mode=`wysiwyg`,this.bodyMarkdown=``,this.previewUrl=``,this.previewWidth=`full`,this.metadataOpen=!1,this.savedData=structuredClone(this.data),this.bodyChanged=!1,this.metaProblems=[],this.openGroups=yN(iN),this.compact=!1,this.focusMode=!1}createRenderRoot(){return this}toggleFocusMode(){this.dispatchEvent(new CustomEvent(`focus-mode-change`,{detail:!this.focusMode,bubbles:!0,composed:!0}))}connectedCallback(){super.connectedCallback(),this.loadEmbeds()}async firstUpdated(){if(this.article)return;let e=this.querySelector(`edaha-article-data-field[name="title"]`);await e?.updateComplete,e?.querySelector(`input`)?.focus()}willUpdate(e){if(e.get(`compact`)&&!this.compact&&(this.metadataOpen=!1),e.has(`metadata`)&&this.metadata&&!this.groupsOpened&&(this.groupsOpened=!0,this.openGroups=yN(this.metadata.groups)),e.has(`metaProblems`)){let e=this.groupsWithErrors();[...e].some(e=>!this.openGroups.has(e))&&(this.openGroups=new Set([...this.openGroups,...e]))}if(e.has(`article`)){let{files:e,problems:t=[],...n}=this.article??{...uN(),files:[]};this.savedProblems=t.filter(({level:e})=>e===`error`),this.metaProblems=this.savedProblems,this.data=n,this.files=e,this.location=this.article?{type:this.article.type,slug:this.article.slug}:void 0,this.message=``,this.error=``,this.mode=`wysiwyg`,this.savedData=structuredClone(n),this.bodyChanged=!1,this.rememberBody(n.bodyHtml,this.article?void 0:``)}if(this.api&&this.data.type!==this.templatesType){let e=this.data.type;this.templatesType=e,this.api.templates(e).then(t=>{this.data.type===e&&(this.templates=t)},()=>{this.data.type===e&&(this.templates=[])})}}fileUrl(e){return!e||!this.location||/^([a-z][a-z0-9+.-]*:|\/)/i.test(e)?e:`/files/${this.location.type}/${this.location.slug}/${e}`}fileAddress=e=>{let t=this.fileUrl(e);return t&&this.api.url(t)};bodyFileAddress=e=>this.api.url(e);async run(e){this.busy=!0,this.error=``,this.message=``;try{return await e()}catch(e){this.error=e.message,e instanceof vt&&e.problems&&(this.metaProblems=e.problems),VA(this,{kind:`error`,message:this.error});return}finally{this.busy=!1}}async upload(e){let t=this.location;if(!t)return;let n=await this.run(()=>this.api.upload(t,e));return n&&!this.files.includes(n.name)&&(this.files=[...this.files,n.name].sort()),n?.name}uploadImage=async e=>{let t=await this.upload(e);if(!t)throw Error(`Upload failed`);return this.fileUrl(t)};uploadMarkdownImage=async e=>{let t=await this.upload(e);if(!t)throw Error(`Upload failed`);return t};chooseFile=async e=>{let t=await this.pickFile?.(e);if(t)return{url:t.type===this.location?.type&&t.slug===this.location.slug?t.name:t.url,name:t.name,kind:t.kind}};chooseBodyFile=async e=>{let t=await this.chooseFile(e);return t&&{...t,url:this.fileUrl(t.url)}};choosers(){return this.pickFile?{file:this.chooseFile,body:this.chooseBodyFile}:{file:void 0,body:void 0}}async loadEmbeds(){try{let e=await this.api.embeds();this.embedTools={embeds:e,edit:async(t,n)=>{let r=e.find(e=>e.key===t.key),i=this.querySelector(`edaha-embed-dialog`);return r?i.edit(r,t,n,e=>this.api.validateEmbed(e.key,e.content,e.options)):void 0},loadFrame:async({key:e,content:t,options:n})=>{let r=await this.api.embedFrame(e,t,n);return{...r,url:r.url&&this.api.previewUrl(r.url)}}}}catch{this.embedTools=void 0}}onFieldChange(e){let{name:t,value:n}=e.detail;t===`bodyMarkdown`?this.bodyMarkdown=n:this.data=dN(this.data,t,n),(t===`body`||t===`bodyMarkdown`)&&this.scheduleBodyCheck()}async currentBodyMarkdown(){return this.mode===`markdown`?this.bodyMarkdown:this.api.toMarkdown(this.data.bodyHtml,this.location)}scheduleBodyCheck(){clearTimeout(this.bodyTimer),this.bodyTimer=setTimeout(()=>void this.checkBody(),this.bodyCheckDelay)}async checkBody(){clearTimeout(this.bodyTimer);let e=++this.bodyChecks,t=await this.currentBodyMarkdown().catch(()=>void 0);e===this.bodyChecks&&t!==void 0&&this.savedBodyMarkdown!==void 0&&(this.bodyChanged=t!==this.savedBodyMarkdown)}async rememberBody(e,t){let n=++this.savedBodies,r=t;try{r??=await this.api.toMarkdown(e,this.location)}catch{}n===this.savedBodies&&(this.savedBodyMarkdown=r,await this.checkBody())}get dirty(){return this.bodyChanged||hN(this.data,this.savedData).size>0}async hasChanges(){return await this.checkBody(),this.dirty}async onFieldFile(e){let t=e.target.name,n=await this.upload(e.detail);n&&(this.data=dN(this.data,t,n))}async syncBody(){if(this.mode!==`markdown`)return!0;let e=await this.run(()=>this.api.toHtml(this.bodyMarkdown,this.location));return e!==void 0&&(this.data={...this.data,bodyHtml:e},!0)}async setMode(e){if(e!==this.mode&&await this.syncBody()){if(e===`markdown`){let e=await this.run(()=>this.api.toMarkdown(this.data.bodyHtml,this.location));if(e===void 0)return;this.bodyMarkdown=e}else if(e===`preview`){let e=await this.run(()=>this.api.preview(fN(this.data),this.location));if(e===void 0)return;this.previewUrl=e}this.mode=e}}async save(){let{values:e}=this.resolvedMeta(),t=this.metadataKeys().flatMap(t=>this.checkMetadata(t,e));if(t.length)return this.metaProblems=t,VA(this,{kind:`error`,message:bN}),!1;if(!await this.syncBody())return!1;let n=this.metadataKeys(),r=fN({...this.data,meta:{...Object.fromEntries(Object.entries(this.data.meta??{}).filter(([e])=>!n.includes(e))),...e}}),i=this.location,a=await this.run(()=>i?this.api.save(i,r):this.api.create(r));return a?(this.data=r,this.savedData=structuredClone(r),this.savedProblems=[],this.metaProblems=[],this.location=a,this.message=`Saved`,VA(this,{kind:`success`,message:this.message}),this.bodyChanged=!1,this.rememberBody(r.bodyHtml,this.mode===`markdown`?this.bodyMarkdown:void 0),this.dispatchEvent(new CustomEvent(`article-saved`,{detail:a,bubbles:!0})),!0):!1}reset(){this.confirm(`Reset this article to how it was last saved? Your changes will be lost.`)&&(clearTimeout(this.bodyTimer),this.bodyChecks++,this.data=structuredClone(this.savedData),this.metaProblems=this.savedProblems,this.mode=`wysiwyg`,this.bodyChanged=!1,this.error=``,this.message=`Reset to the last saved version`,VA(this,{kind:`success`,message:this.message}))}async deleteArticle(){let e=this.location;e&&this.confirm(`Delete "${this.data.title}" and all its files?`)&&await this.run(async()=>(await this.api.remove(e),!0))&&(VA(this,{kind:`success`,message:`Deleted "${this.data.title}"`}),this.dispatchEvent(new CustomEvent(`article-deleted`,{bubbles:!0})))}validator(){let{definitions:e}=this.metadata;return this.validatorFor?.definitions!==e&&(this.validatorFor={definitions:e,validator:new zM(e)}),this.validatorFor.validator}metadataKeys(){return MM(this.metadata?.definitions??{},this.metadata?.types[this.data.type])}resolvedMeta(){let e=this.metadata?.definitions??{},t=Object.fromEntries(this.metadataKeys().map(t=>[t,e[t]]));return XA(t,Object.fromEntries(Object.entries(this.data.meta??{}).filter(([e])=>e in t)))}checkMetadata(e,t=this.resolvedMeta().values){let n=t[e];return n===void 0?[]:this.validator().validate(e,n)}onMetadataChange(e){let{path:t,value:n}=e.detail;this.data={...this.data,meta:JM(this.data.meta,t.split(`/`),n)}}onMetadataBlur(e){let t=e.detail.split(`/`)[0],n=e=>e.path.split(`/`)[0]===t,r=this.metaProblems.some(n),i=this.checkMetadata(t);this.metaProblems=[...this.metaProblems.filter(e=>!n(e)),...i],i.length&&!r&&VA(this,{kind:`error`,message:bN})}removeSetting(e){this.data={...this.data,meta:JM(this.data.meta,[e],void 0)}}metadataWarnings(){let e=this.metadataKeys(),t=this.metadata?.definitions??{};return Object.keys(this.data.meta??{}).filter(t=>!e.includes(t)).map(e=>({path:e,message:e in t?`isn't used by this article's type`:`isn't a known setting`,level:`warning`}))}isChanged(e){return hN(this.data,this.savedData).has(e)}defaultAuthor(){if(!this.site)return;let e=this.site.types[this.data.type];return e===void 0?this.site.author:e||void 0}renderAuthor(){let e=this.data.author===!1,t=e?void 0:this.data.author,n=this.defaultAuthor(),r=t||e?void 0:n,i=e?``:this.site?n?`Defaults to ${n.name}`:`No author unless you name one`:`Defaults to the site name`;return E`<edaha-article-data-group
874
877
  name="author"
875
878
  label="Author"
876
879
  ?changed=${this.isChanged(`author`)}
@@ -943,7 +946,7 @@ img.ProseMirror-separator {
943
946
  accept="image/png, image/jpeg, image/gif, application/zip, application/pdf"
944
947
  .value=${t.url}
945
948
  preview
946
- .previewUrl=${this.fileUrl(t.url)}
949
+ .previewUrl=${this.fileAddress(t.url)}
947
950
  .chooseFile=${this.choosers().file}
948
951
  allowchange
949
952
  ?disabled=${e}
@@ -985,7 +988,7 @@ img.ProseMirror-separator {
985
988
  id="preview-width"
986
989
  @change=${e=>this.previewWidth=e.target.value}
987
990
  >
988
- ${oN.map(({value:e,label:t})=>E`<option
991
+ ${sN.map(({value:e,label:t})=>E`<option
989
992
  value=${e}
990
993
  ?selected=${this.previewWidth===e}
991
994
  >
@@ -997,8 +1000,8 @@ img.ProseMirror-separator {
997
1000
  <iframe
998
1001
  class="preview"
999
1002
  title="Preview"
1000
- src=${Mt(this.previewUrl)}
1001
- style=${ht({width:oN.find(({value:e})=>e===this.previewWidth)?.width})}
1003
+ src=${this.api.previewUrl(this.previewUrl)}
1004
+ style=${Tt({width:sN.find(({value:e})=>e===this.previewWidth)?.width})}
1002
1005
  ></iframe>
1003
1006
  </div>`:E`<edaha-article-data-field
1004
1007
  name="body"
@@ -1009,16 +1012,17 @@ img.ProseMirror-separator {
1009
1012
  .uploadImage=${this.location?this.uploadImage:void 0}
1010
1013
  .chooseFile=${this.choosers().body}
1011
1014
  .embedTools=${this.embedTools}
1015
+ .fileAddress=${this.bodyFileAddress}
1012
1016
  ></edaha-article-data-field>`,E`<div
1013
1017
  class="body-tabs"
1014
1018
  role="tablist"
1015
1019
  aria-label="Body"
1016
1020
  @keydown=${this.onTabKey}
1017
1021
  >
1018
- ${aN.map(({mode:e,label:t})=>E`<button
1022
+ ${oN.map(({mode:e,label:t})=>E`<button
1019
1023
  type="button"
1020
1024
  role="tab"
1021
- id=${sN(e)}
1025
+ id=${cN(e)}
1022
1026
  data-mode=${e}
1023
1027
  aria-selected=${this.mode===e?`true`:`false`}
1024
1028
  aria-controls="body-panel"
@@ -1033,10 +1037,10 @@ img.ProseMirror-separator {
1033
1037
  class="body-panel body-panel-${this.mode}"
1034
1038
  id="body-panel"
1035
1039
  role="tabpanel"
1036
- aria-labelledby=${sN(this.mode)}
1040
+ aria-labelledby=${cN(this.mode)}
1037
1041
  >
1038
1042
  ${e}
1039
- </div>`}onTabKey(e){let t=[...e.currentTarget.querySelectorAll(`[role="tab"]`)],n=t.indexOf(e.target),r=cN(e.key,n,t.length);r!==void 0&&(e.preventDefault(),t[r]?.focus())}groups(){return this.metadata?.groups??rN}groupsWithErrors(){let e=new Set(this.metaProblems.filter(({level:e})=>e===`error`).map(({path:e})=>e.split(`/`)[0]));return new Set(this.groups().filter(t=>t.fields.some(t=>e.has(t))).map(e=>e.key))}settingChanged(e,t){return t.has(e)?!0:!gN(e)&&JSON.stringify(pN(this.data.meta?.[e]))!==JSON.stringify(pN(this.savedData.meta?.[e]))}renderSetting(e,t,n){let{data:r}=this;switch(e){case`type`:return E`<edaha-article-data-field
1043
+ </div>`}onTabKey(e){let t=[...e.currentTarget.querySelectorAll(`[role="tab"]`)],n=t.indexOf(e.target),r=lN(e.key,n,t.length);r!==void 0&&(e.preventDefault(),t[r]?.focus())}groups(){return this.metadata?.groups??iN}groupsWithErrors(){let e=new Set(this.metaProblems.filter(({level:e})=>e===`error`).map(({path:e})=>e.split(`/`)[0]));return new Set(this.groups().filter(t=>t.fields.some(t=>e.has(t))).map(e=>e.key))}settingChanged(e,t){return t.has(e)?!0:!_N(e)&&JSON.stringify(mN(this.data.meta?.[e]))!==JSON.stringify(mN(this.savedData.meta?.[e]))}renderSetting(e,t,n){let{data:r}=this;switch(e){case`type`:return E`<edaha-article-data-field
1040
1044
  name="type"
1041
1045
  ?changed=${t.has(`type`)}
1042
1046
  type="select"
@@ -1048,20 +1052,20 @@ img.ProseMirror-separator {
1048
1052
  ?changed=${t.has(`status`)}
1049
1053
  type="select"
1050
1054
  label="Status"
1051
- .options=${iN}
1055
+ .options=${aN}
1052
1056
  .value=${r.status}
1053
1057
  ></edaha-article-data-field>`;case`slug`:return E`<edaha-article-data-field
1054
1058
  name="slug"
1055
1059
  ?changed=${t.has(`slug`)}
1056
1060
  label="Slug"
1057
- placeholder=${_t(r.title)||`title-converted-to-slug`}
1061
+ placeholder=${Dt(r.title)||`title-converted-to-slug`}
1058
1062
  .value=${r.slug}
1059
1063
  ></edaha-article-data-field>`;case`date`:return E`<edaha-article-data-field
1060
1064
  name="date"
1061
1065
  ?changed=${t.has(`date`)}
1062
1066
  type="datetime-local"
1063
1067
  label="Publication date"
1064
- .value=${bt(r.date)}
1068
+ .value=${At(r.date)}
1065
1069
  ></edaha-article-data-field>`;case`author`:return this.renderAuthor();case`tags`:return this.renderTags();case`excerpt`:return E`<edaha-article-data-field
1066
1070
  name="excerpt"
1067
1071
  ?changed=${t.has(`excerpt`)}
@@ -1085,7 +1089,7 @@ img.ProseMirror-separator {
1085
1089
  accept="image/png, image/jpeg"
1086
1090
  .value=${r.thumbnail??``}
1087
1091
  preview
1088
- .previewUrl=${this.fileUrl(r.thumbnail)}
1092
+ .previewUrl=${this.fileAddress(r.thumbnail)}
1089
1093
  .chooseFile=${this.choosers().file}
1090
1094
  allowchange
1091
1095
  allowclear
@@ -1095,7 +1099,7 @@ img.ProseMirror-separator {
1095
1099
  Files in this article's folder (${this.files.length})
1096
1100
  </h3>
1097
1101
  <ul>
1098
- ${this.files.map(e=>E`<li><a href=${this.fileUrl(e)} target="_blank">${e}</a></li>`)}
1102
+ ${this.files.map(e=>E`<li><a href=${this.fileAddress(e)} target="_blank">${e}</a></li>`)}
1099
1103
  </ul>
1100
1104
  </div>`:D:E`<p class="hint">Save the article before uploading files.</p>`}renderCustomField(e,{values:t,hidden:n}){return n.has(e)?D:E`<edaha-metadata-field
1101
1105
  path=${e}
@@ -1105,8 +1109,8 @@ img.ProseMirror-separator {
1105
1109
  .hiddenFields=${n}
1106
1110
  .uploadFile=${this.location?this.uploadMarkdownImage:void 0}
1107
1111
  .chooseFile=${this.choosers().file}
1108
- .fileUrl=${e=>this.fileUrl(e)}
1109
- ></edaha-metadata-field>`}renderGroups(e,t){let n=this.metadataKeys(),r=this.resolvedMeta(),i=this.metadataWarnings(),a=this.groupsWithErrors();return this.groups().map(o=>{let s=o.fields.filter(e=>gN(e)||n.includes(e)).map(n=>gN(n)?this.renderSetting(n,e,t):this.renderCustomField(n,r)).filter(e=>e!==D),c=o.key===`custom`?i:[];if(!s.length&&!c.length)return D;let l=o.fields.some(t=>this.settingChanged(t,e)),u=a.has(o.key);return E`<details
1112
+ .fileUrl=${e=>this.fileAddress(e)}
1113
+ ></edaha-metadata-field>`}renderGroups(e,t){let n=this.metadataKeys(),r=this.resolvedMeta(),i=this.metadataWarnings(),a=this.groupsWithErrors();return this.groups().map(o=>{let s=o.fields.filter(e=>_N(e)||n.includes(e)).map(n=>_N(n)?this.renderSetting(n,e,t):this.renderCustomField(n,r)).filter(e=>e!==D),c=o.key===`custom`?i:[];if(!s.length&&!c.length)return D;let l=o.fields.some(t=>this.settingChanged(t,e)),u=a.has(o.key);return E`<details
1110
1114
  class="settings-group ${Xe({"has-errors":u})}"
1111
1115
  data-group=${o.key}
1112
1116
  ?open=${this.openGroups.has(o.key)}
@@ -1136,11 +1140,11 @@ img.ProseMirror-separator {
1136
1140
  class="btn btn-xs"
1137
1141
  @click=${()=>this.removeSetting(e)}
1138
1142
  >
1139
- Remove${_N(` "${e}"`)}
1143
+ Remove${vN(` "${e}"`)}
1140
1144
  </button>
1141
1145
  </li>`)}
1142
1146
  </ul>`:D}
1143
- </details>`})}render(){let{data:e}=this,t=mN(e,this.savedData),n=this.typeOptions.some(t=>t.value===e.type)?this.typeOptions:[...this.typeOptions,{value:e.type,label:e.type}];return E`<form
1147
+ </details>`})}render(){let{data:e}=this,t=hN(e,this.savedData),n=this.typeOptions.some(t=>t.value===e.type)?this.typeOptions:[...this.typeOptions,{value:e.type,label:e.type}];return E`<form
1144
1148
  @field-change=${this.onFieldChange}
1145
1149
  @metadata-change=${this.onMetadataChange}
1146
1150
  @metadata-blur=${this.onMetadataBlur}
@@ -1165,7 +1169,7 @@ img.ProseMirror-separator {
1165
1169
  aria-pressed=${this.focusMode?`true`:`false`}
1166
1170
  @click=${()=>this.toggleFocusMode()}
1167
1171
  >
1168
- ${Dt(this.focusMode?`fullscreen_exit`:`fullscreen`)}<span
1172
+ ${ft(this.focusMode?`fullscreen_exit`:`fullscreen`)}<span
1169
1173
  class="visually-hidden"
1170
1174
  >Focus mode</span
1171
1175
  >
@@ -1229,7 +1233,7 @@ img.ProseMirror-separator {
1229
1233
  </aside>
1230
1234
  </form>
1231
1235
  <!-- Outside the form, as it has its own -->
1232
- <edaha-embed-dialog></edaha-embed-dialog>`}});var bN=[{value:`errors`,label:`With errors`},{value:`warnings`,label:`With warnings`},{value:`any`,label:`With errors or warnings`}],xN=(e=[])=>{let t=t=>{let n=e.filter(e=>e.level===t).length;return n?`${n} ${t}${n===1?``:`s`}`:``};return[t(`error`),t(`warning`)].filter(Boolean).join(`, `)},SN=[{value:`published`,label:`Published`},{value:`draft`,label:`Draft`},{value:`unlisted`,label:`Unlisted`}],CN=[{sort:`title`,label:`Title`},{sort:`type`,label:`Type`},{sort:`status`,label:`Status`},{sort:`date`,label:`Published`},{sort:`updated`,label:`Changed`}],wN=`article-choose`,TN=(e,t)=>e[t]?.labelSingle??t;ft(`edaha-article-browser`,class extends Ge{static properties={api:{attribute:!1},types:{attribute:!1},search:{state:!0},type:{state:!0},author:{state:!0},tag:{state:!0},status:{state:!0},problems:{state:!0},sort:{state:!0},order:{state:!0},page:{state:!0},result:{state:!0},filters:{state:!0},loading:{state:!0},error:{state:!0}};searchDelay=250;searchTimer;searches=0;constructor(){super(),this.types={},this.search=``,this.type=``,this.author=``,this.tag=``,this.status=``,this.problems=``,this.page=1,this.filters={types:[],authors:[],tags:[]},this.loading=!1,this.error=``}createRenderRoot(){return this}get dialog(){return this.querySelector(`dialog`)}get open(){return this.dialog?.open??!1}async show(e={}){this.search=e.search??``,this.type=e.type??``,this.author=``,this.tag=``,this.status=``,this.problems=e.problems??``,this.page=1,await this.updateComplete,this.open||this.dialog?.showModal(),this.querySelector(`#article-browser-search`)?.focus(),await Promise.all([this.loadFilters(),this.load()])}close(){clearTimeout(this.searchTimer),this.open&&this.dialog?.close()}async loadFilters(){try{this.filters=await this.api.filters()}catch{}}async load(){clearTimeout(this.searchTimer);let e=++this.searches;this.loading=!0;try{let t=await this.api.query({search:this.search,type:this.type,author:this.author,tag:this.tag,status:this.status||void 0,problems:this.problems||void 0,sort:this.sort,order:this.order,page:this.page});if(e!==this.searches)return;this.result=t,this.error=``}catch(t){if(e!==this.searches)return;this.error=t.message}this.loading=!1}choose(e,t){this[e]=t,this.page=1,this.load()}onSearch(e){this.search=e,this.page=1,clearTimeout(this.searchTimer),this.searchTimer=setTimeout(()=>void this.load(),this.searchDelay)}sortBy(e){({sort:this.sort,order:this.order}=EA({sort:this.sort,order:this.order},e)),this.page=1,this.load()}async goTo(e){this.page=e,await this.load(),this.querySelector(`.article-browser-results`)?.scrollTo?.(0,0)}chooseArticle(e){this.close(),this.dispatchEvent(new CustomEvent(wN,{detail:{type:e.type,slug:e.slug},bubbles:!0}))}renderSelect(e,t,n,r){let i=`article-browser-${e}`;return E`<div class="article-browser-field">
1236
+ <edaha-embed-dialog></edaha-embed-dialog>`}});var xN=[{value:`errors`,label:`With errors`},{value:`warnings`,label:`With warnings`},{value:`any`,label:`With errors or warnings`}],SN=(e=[])=>{let t=t=>{let n=e.filter(e=>e.level===t).length;return n?`${n} ${t}${n===1?``:`s`}`:``};return[t(`error`),t(`warning`)].filter(Boolean).join(`, `)},CN=[{value:`published`,label:`Published`},{value:`draft`,label:`Draft`},{value:`unlisted`,label:`Unlisted`}],wN=[{sort:`title`,label:`Title`},{sort:`type`,label:`Type`},{sort:`status`,label:`Status`},{sort:`date`,label:`Published`},{sort:`updated`,label:`Changed`}],TN=`article-choose`,EN=(e,t)=>e[t]?.labelSingle??t;St(`edaha-article-browser`,class extends Ge{static properties={api:{attribute:!1},types:{attribute:!1},search:{state:!0},type:{state:!0},author:{state:!0},tag:{state:!0},status:{state:!0},problems:{state:!0},sort:{state:!0},order:{state:!0},page:{state:!0},result:{state:!0},filters:{state:!0},loading:{state:!0},error:{state:!0}};searchDelay=250;searchTimer;searches=0;constructor(){super(),this.types={},this.search=``,this.type=``,this.author=``,this.tag=``,this.status=``,this.problems=``,this.page=1,this.filters={types:[],authors:[],tags:[]},this.loading=!1,this.error=``}createRenderRoot(){return this}get dialog(){return this.querySelector(`dialog`)}get open(){return this.dialog?.open??!1}async show(e={}){this.search=e.search??``,this.type=e.type??``,this.author=``,this.tag=``,this.status=``,this.problems=e.problems??``,this.page=1,await this.updateComplete,this.open||this.dialog?.showModal(),this.querySelector(`#article-browser-search`)?.focus(),await Promise.all([this.loadFilters(),this.load()])}close(){clearTimeout(this.searchTimer),this.open&&this.dialog?.close()}async loadFilters(){try{this.filters=await this.api.filters()}catch{}}async load(){clearTimeout(this.searchTimer);let e=++this.searches;this.loading=!0;try{let t=await this.api.query({search:this.search,type:this.type,author:this.author,tag:this.tag,status:this.status||void 0,problems:this.problems||void 0,sort:this.sort,order:this.order,page:this.page});if(e!==this.searches)return;this.result=t,this.error=``}catch(t){if(e!==this.searches)return;this.error=t.message}this.loading=!1}choose(e,t){this[e]=t,this.page=1,this.load()}onSearch(e){this.search=e,this.page=1,clearTimeout(this.searchTimer),this.searchTimer=setTimeout(()=>void this.load(),this.searchDelay)}sortBy(e){({sort:this.sort,order:this.order}=DA({sort:this.sort,order:this.order},e)),this.page=1,this.load()}async goTo(e){this.page=e,await this.load(),this.querySelector(`.article-browser-results`)?.scrollTo?.(0,0)}chooseArticle(e){this.close(),this.dispatchEvent(new CustomEvent(TN,{detail:{type:e.type,slug:e.slug},bubbles:!0}))}renderSelect(e,t,n,r){let i=`article-browser-${e}`;return E`<div class="article-browser-field">
1233
1237
  <label for=${i}>${t}</label>
1234
1238
  <select
1235
1239
  id=${i}
@@ -1243,10 +1247,10 @@ img.ProseMirror-separator {
1243
1247
  ${t.label}
1244
1248
  </option>`)}
1245
1249
  </select>
1246
- </div>`}renderResults(){let e=this.result;if(!e)return D;if(!e.articles.length)return E`<p class="article-browser-empty">No articles found.</p>`;let t=Object.fromEntries(SN.map(({value:e,label:t})=>[e,t]));return E`<table class="article-browser-table">
1250
+ </div>`}renderResults(){let e=this.result;if(!e)return D;if(!e.articles.length)return E`<p class="article-browser-empty">No articles found.</p>`;let t=Object.fromEntries(CN.map(({value:e,label:t})=>[e,t]));return E`<table class="article-browser-table">
1247
1251
  <thead>
1248
1252
  <tr>
1249
- ${CN.map(({sort:e,label:t})=>DA(e,t,{sort:this.sort,order:this.order},e=>this.sortBy(e)))}
1253
+ ${wN.map(({sort:e,label:t})=>OA(e,t,{sort:this.sort,order:this.order},e=>this.sortBy(e)))}
1250
1254
  </tr>
1251
1255
  </thead>
1252
1256
  <tbody>
@@ -1259,10 +1263,10 @@ img.ProseMirror-separator {
1259
1263
  >
1260
1264
  ${e.error?E`<small class="error">${e.error}</small>`:D}
1261
1265
  ${e.problems?E`<small class="problems"
1262
- >⚠️ ${xN(e.problems)}</small
1266
+ >⚠️ ${SN(e.problems)}</small
1263
1267
  >`:D}
1264
1268
  </td>
1265
- <td>${TN(this.types,e.type)}</td>
1269
+ <td>${EN(this.types,e.type)}</td>
1266
1270
  <td>${t[e.status]}</td>
1267
1271
  <td>${e.date.slice(0,10)}</td>
1268
1272
  <td>${e.updated.slice(0,10)}</td>
@@ -1286,7 +1290,7 @@ img.ProseMirror-separator {
1286
1290
  >
1287
1291
  Next
1288
1292
  </button>
1289
- </nav>`}statusText(){if(this.error)return this.error;if(this.loading||!this.result)return`Loading…`;let{total:e}=this.result;return`${e} ${e===1?`article`:`articles`} found`}render(){let e=e=>e.map(e=>({value:e,label:e})),t=[...new Set([...Object.keys(this.types),...this.filters.types])].map(e=>({value:e,label:TN(this.types,e)}));return E`<dialog
1293
+ </nav>`}statusText(){if(this.error)return this.error;if(this.loading||!this.result)return`Loading…`;let{total:e}=this.result;return`${e} ${e===1?`article`:`articles`} found`}render(){let e=e=>e.map(e=>({value:e,label:e})),t=[...new Set([...Object.keys(this.types),...this.filters.types])].map(e=>({value:e,label:EN(this.types,e)}));return E`<dialog
1290
1294
  class="article-browser"
1291
1295
  aria-labelledby="article-browser-title"
1292
1296
  @close=${()=>clearTimeout(this.searchTimer)}
@@ -1299,7 +1303,7 @@ img.ProseMirror-separator {
1299
1303
  title="Close"
1300
1304
  @click=${()=>this.close()}
1301
1305
  >
1302
- ${Dt(`close`)}<span class="visually-hidden">Close</span>
1306
+ ${ft(`close`)}<span class="visually-hidden">Close</span>
1303
1307
  </button>
1304
1308
  </div>
1305
1309
  <div class="article-browser-controls" role="search">
@@ -1315,8 +1319,8 @@ img.ProseMirror-separator {
1315
1319
  ${this.renderSelect(`type`,`Type`,`All types`,t)}
1316
1320
  ${this.renderSelect(`author`,`Author`,`Any author`,e(this.filters.authors))}
1317
1321
  ${this.renderSelect(`tag`,`Tag`,`Any tag`,e(this.filters.tags))}
1318
- ${this.renderSelect(`status`,`Status`,`Any status`,SN)}
1319
- ${this.renderSelect(`problems`,`Problems`,`Any article`,bN)}
1322
+ ${this.renderSelect(`status`,`Status`,`Any status`,CN)}
1323
+ ${this.renderSelect(`problems`,`Problems`,`Any article`,xN)}
1320
1324
  </div>
1321
1325
  <p
1322
1326
  class="article-browser-status ${this.error?`error`:``}"
@@ -1327,7 +1331,7 @@ img.ProseMirror-separator {
1327
1331
  <div class="article-browser-results">
1328
1332
  ${this.renderResults()} ${this.renderPages()}
1329
1333
  </div>
1330
- </dialog>`}});var EN=`edaha-editor-theme`,DN=()=>typeof window.matchMedia==`function`?window.matchMedia(`(prefers-color-scheme: dark)`):void 0,ON=()=>{let e=document.documentElement.dataset.theme;return e===`light`||e===`dark`?e:DN()?.matches?`dark`:`light`},kN=e=>{document.documentElement.dataset.theme=e;try{localStorage.setItem(EN,e)}catch{}},AN=()=>{let e=ON()===`dark`?`light`:`dark`;return kN(e),e},jN=()=>`Switch to the ${ON()===`dark`?`light`:`dark`} theme`,MN=e=>{let t=DN();return t?.addEventListener(`change`,e),()=>t?.removeEventListener(`change`,e)},NN=`(max-width: 899.98px)`,PN=()=>typeof window.matchMedia==`function`?window.matchMedia(NN):void 0,FN=()=>PN()?.matches??!1,IN=e=>{let t=PN();return t?.addEventListener(`change`,e),()=>t?.removeEventListener(`change`,e)},LN=e=>[e.slug,e.status,e.date.slice(0,10)].filter(Boolean).join(` · `),RN={heading:`Save changes first?`,message:`This article has changes that aren't saved.`,choices:[{value:`save`,label:`Save`},{value:`discard`,label:`Don't save`},{value:`cancel`,label:`Cancel`}]},zN=(e,t)=>{let n=Object.keys(t),r=e=>n.includes(e)?n.indexOf(e):n.length;return e.map(e=>({...e,label:t[e.type]?.labelPlural??e.type})).sort((e,t)=>r(e.type)-r(t.type)||e.type.localeCompare(t.type))};ft(`edaha-editor`,class extends Ge{static properties={api:{attribute:!1},recent:{state:!0},types:{state:!0},selected:{state:!0},article:{state:!0},editing:{state:!0},formKey:{state:!0},error:{state:!0},searchText:{state:!0},searchResult:{state:!0},welcome:{state:!0},metadata:{state:!0},attention:{state:!0},site:{state:!0},unsaved:{state:!0},navOpen:{state:!0},narrow:{state:!0},focusMode:{state:!0}};wasCompact=!1;onBeforeUnload=e=>{this.form()?.dirty&&e.preventDefault()};stopWatchingTheme;stopWatchingNarrow;searchDelay=250;searchTimer;searches=0;onToast=e=>this.toast(e.detail);constructor(){super(),this.api=new dt,this.recent=[],this.types={},this.editing=!1,this.formKey=0,this.error=``,this.searchText=``,this.navOpen=!1,this.narrow=!1,this.focusMode=!1}get compact(){return this.narrow||this.focusMode}createRenderRoot(){return this}connectedCallback(){super.connectedCallback(),window.addEventListener(`beforeunload`,this.onBeforeUnload),this.addEventListener(zA,this.onToast),this.stopWatchingTheme=MN(()=>this.requestUpdate()),this.narrow=FN(),this.stopWatchingNarrow=IN(()=>this.narrow=FN()),this.refresh().then(()=>this.openFromAddress())}async openFromAddress(){let[,e,t]=/^#([a-z0-9-]+)\/([a-z0-9-]+)$/.exec(window.location.hash)??[];e&&t&&await this.open({type:e,slug:t})}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener(`beforeunload`,this.onBeforeUnload),this.removeEventListener(zA,this.onToast),this.stopWatchingTheme?.(),this.stopWatchingNarrow?.(),clearTimeout(this.searchTimer)}willUpdate(){let e=this.compact;this.wasCompact&&!e&&(this.navOpen=!1),this.wasCompact=e,this.toggleAttribute(`compact`,e),this.toggleAttribute(`focus-mode`,this.focusMode)}async openNav(){this.navOpen=!0,await this.updateComplete,this.querySelector(`.nav-close`)?.focus()}closeNav(){this.navOpen&&(this.navOpen=!1,this.querySelector(`.edaha-editor-nav`)?.contains(document.activeElement)&&this.querySelector(`.nav-toggle`)?.focus())}pickFile=e=>this.querySelector(`edaha-file-browser`).pick(e);form(){return this.querySelector(`edaha-article`)}toast(e){this.querySelector(`edaha-toasts`)?.show(e)}askUnsaved(){return new Promise(e=>{this.unsaved=t=>{this.unsaved=void 0,e(t)}})}async leaveForm(){let e=this.form();if(!e||!await e.hasChanges())return!0;let t=await this.askUnsaved();return t===`save`?e.save():t===`discard`}async refresh(){try{[this.recent,this.types,this.welcome,this.metadata,this.attention,this.site]=await Promise.all([this.api.recent(),this.api.types(),this.api.query({sort:`updated`,perPage:6}),this.api.metadata(),this.api.query({problems:`any`,sort:`title`,perPage:5}),this.api.site()]),this.error=``}catch(e){this.error=e.message,this.toast({kind:`error`,message:this.error})}this.searchText.trim()&&await this.searchTitles()}async searchTitles(){clearTimeout(this.searchTimer);let e=++this.searches,t=this.searchText.trim();if(!t)this.searchResult=void 0;else try{let n=await this.api.query({search:t,perPage:10});e===this.searches&&(this.searchResult=n)}catch(t){if(e!==this.searches)return;this.error=t.message,this.toast({kind:`error`,message:this.error})}}onSearchInput(e){this.searchText=e,clearTimeout(this.searchTimer),this.searchTimer=setTimeout(()=>void this.searchTitles(),this.searchDelay)}async openFiles(){await this.querySelector(`edaha-file-browser`)?.show()}async onFilesChanged({file:e,articles:t}){await this.refresh();let n=this.selected;n&&[e,...t].some(({type:e,slug:t})=>e===n.type&&t===n.slug)&&(this.form()?.dirty?this.toast({kind:`error`,message:`The open article's files changed, but it has unsaved changes, so it still shows the old ones. Saving keeps its old references.`}):await this.open(n))}async openBrowser(e={}){await this.querySelector(`edaha-article-browser`)?.show(e)}async open(e){if(await this.leaveForm())try{this.article=await this.api.read(e),this.selected=e,this.editing=!0,this.formKey++,this.error=``}catch(e){this.error=e.message,this.toast({kind:`error`,message:this.error})}}typeOptions(){let e=Object.entries(this.types).map(([e,{labelSingle:t}])=>({value:e,label:t}));for(let{type:t}of this.recent)this.types[t]||e.push({value:t,label:t});return e}async showWelcome(){this.closeNav(),await this.leaveForm()&&(this.article=void 0,this.selected=void 0,this.editing=!1,await this.refresh())}async create(){await this.leaveForm()&&(this.article=void 0,this.selected=void 0,this.editing=!0,this.formKey++)}async onSaved(e){this.selected=e.detail,await this.refresh()}async onDeleted(){this.article=void 0,this.selected=void 0,this.editing=!1,await this.refresh()}renderUnsaved(){let e=this.unsaved;return e?E`<div class="dialog-backdrop">
1334
+ </dialog>`}});var DN=`edaha-editor-theme`,ON=()=>typeof window.matchMedia==`function`?window.matchMedia(`(prefers-color-scheme: dark)`):void 0,kN=()=>{let e=document.documentElement.dataset.theme;return e===`light`||e===`dark`?e:ON()?.matches?`dark`:`light`},AN=e=>{document.documentElement.dataset.theme=e;try{localStorage.setItem(DN,e)}catch{}},jN=()=>{let e=kN()===`dark`?`light`:`dark`;return AN(e),e},MN=()=>`Switch to the ${kN()===`dark`?`light`:`dark`} theme`,NN=e=>{let t=ON();return t?.addEventListener(`change`,e),()=>t?.removeEventListener(`change`,e)},PN=`(max-width: 899.98px)`,FN=()=>typeof window.matchMedia==`function`?window.matchMedia(PN):void 0,IN=()=>FN()?.matches??!1,LN=e=>{let t=FN();return t?.addEventListener(`change`,e),()=>t?.removeEventListener(`change`,e)},RN=e=>[e.slug,e.status,e.date.slice(0,10)].filter(Boolean).join(` · `),zN={heading:`Save changes first?`,message:`This article has changes that aren't saved.`,choices:[{value:`save`,label:`Save`},{value:`discard`,label:`Don't save`},{value:`cancel`,label:`Cancel`}]},BN=(e,t)=>{let n=Object.keys(t),r=e=>n.includes(e)?n.indexOf(e):n.length;return e.map(e=>({...e,label:t[e.type]?.labelPlural??e.type})).sort((e,t)=>r(e.type)-r(t.type)||e.type.localeCompare(t.type))};St(`edaha-editor`,class extends Ge{static properties={api:{attribute:!1},hideTitle:{type:Boolean,attribute:`hide-title`},hideThemeSwitcher:{type:Boolean,attribute:`hide-theme-switcher`},recent:{state:!0},types:{state:!0},selected:{state:!0},article:{state:!0},editing:{state:!0},formKey:{state:!0},error:{state:!0},searchText:{state:!0},searchResult:{state:!0},welcome:{state:!0},metadata:{state:!0},attention:{state:!0},site:{state:!0},unsaved:{state:!0},navOpen:{state:!0},narrow:{state:!0},focusMode:{state:!0}};wasCompact=!1;onBeforeUnload=e=>{this.form()?.dirty&&e.preventDefault()};stopWatchingTheme;stopWatchingNarrow;searchDelay=250;searchTimer;searches=0;onToast=e=>this.toast(e.detail);constructor(){super(),this.api=new xt,this.hideTitle=!1,this.hideThemeSwitcher=!1,this.recent=[],this.types={},this.editing=!1,this.formKey=0,this.error=``,this.searchText=``,this.navOpen=!1,this.narrow=!1,this.focusMode=!1}get compact(){return this.narrow||this.focusMode}createRenderRoot(){return this}connectedCallback(){super.connectedCallback(),window.addEventListener(`beforeunload`,this.onBeforeUnload),this.addEventListener(BA,this.onToast),this.stopWatchingTheme=NN(()=>this.requestUpdate()),this.hideThemeSwitcher&&delete document.documentElement.dataset.theme,this.narrow=IN(),this.stopWatchingNarrow=LN(()=>this.narrow=IN()),this.refresh().then(()=>this.openFromAddress())}async openFromAddress(){let[,e,t]=/^#([a-z0-9-]+)\/([a-z0-9-]+)$/.exec(window.location.hash)??[];e&&t&&await this.open({type:e,slug:t})}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener(`beforeunload`,this.onBeforeUnload),this.removeEventListener(BA,this.onToast),this.stopWatchingTheme?.(),this.stopWatchingNarrow?.(),clearTimeout(this.searchTimer)}willUpdate(){let e=this.compact;this.wasCompact&&!e&&(this.navOpen=!1),this.wasCompact=e,this.toggleAttribute(`compact`,e),this.toggleAttribute(`focus-mode`,this.focusMode)}async openNav(){this.navOpen=!0,await this.updateComplete,this.querySelector(`.nav-close`)?.focus()}closeNav(){this.navOpen&&(this.navOpen=!1,this.querySelector(`.edaha-editor-nav`)?.contains(document.activeElement)&&this.querySelector(`.nav-toggle`)?.focus())}pickFile=e=>this.querySelector(`edaha-file-browser`).pick(e);form(){return this.querySelector(`edaha-article`)}toast(e){this.querySelector(`edaha-toasts`)?.show(e)}askUnsaved(){return new Promise(e=>{this.unsaved=t=>{this.unsaved=void 0,e(t)}})}get dirty(){return this.form()?.dirty??!1}async leaveForm(){let e=this.form();if(!e||!await e.hasChanges())return!0;let t=await this.askUnsaved();return t===`save`?e.save():t===`discard`}async refresh(){try{[this.recent,this.types,this.welcome,this.metadata,this.attention,this.site]=await Promise.all([this.api.recent(),this.api.types(),this.api.query({sort:`updated`,perPage:6}),this.api.metadata(),this.api.query({problems:`any`,sort:`title`,perPage:5}),this.api.site()]),this.error=``}catch(e){this.error=e.message,this.toast({kind:`error`,message:this.error})}this.searchText.trim()&&await this.searchTitles()}async searchTitles(){clearTimeout(this.searchTimer);let e=++this.searches,t=this.searchText.trim();if(!t)this.searchResult=void 0;else try{let n=await this.api.query({search:t,perPage:10});e===this.searches&&(this.searchResult=n)}catch(t){if(e!==this.searches)return;this.error=t.message,this.toast({kind:`error`,message:this.error})}}onSearchInput(e){this.searchText=e,clearTimeout(this.searchTimer),this.searchTimer=setTimeout(()=>void this.searchTitles(),this.searchDelay)}async openFiles(){await this.querySelector(`edaha-file-browser`)?.show()}async onFilesChanged({file:e,articles:t}){await this.refresh();let n=this.selected;n&&[e,...t].some(({type:e,slug:t})=>e===n.type&&t===n.slug)&&(this.form()?.dirty?this.toast({kind:`error`,message:`The open article's files changed, but it has unsaved changes, so it still shows the old ones. Saving keeps its old references.`}):await this.open(n))}async openBrowser(e={}){await this.querySelector(`edaha-article-browser`)?.show(e)}async open(e){if(await this.leaveForm())try{this.article=await this.api.read(e),this.selected=e,this.editing=!0,this.formKey++,this.error=``}catch(e){this.error=e.message,this.toast({kind:`error`,message:this.error})}}typeOptions(){let e=Object.entries(this.types).map(([e,{labelSingle:t}])=>({value:e,label:t}));for(let{type:t}of this.recent)this.types[t]||e.push({value:t,label:t});return e}async showWelcome(){this.closeNav(),await this.leaveForm()&&(this.article=void 0,this.selected=void 0,this.editing=!1,await this.refresh())}async create(){await this.leaveForm()&&(this.article=void 0,this.selected=void 0,this.editing=!0,this.formKey++)}async onSaved(e){this.selected=e.detail,await this.refresh()}async onDeleted(){this.article=void 0,this.selected=void 0,this.editing=!1,await this.refresh()}renderUnsaved(){let e=this.unsaved;return e?E`<div class="dialog-backdrop">
1331
1335
  <div
1332
1336
  class="dialog unsaved"
1333
1337
  role="alertdialog"
@@ -1335,9 +1339,9 @@ img.ProseMirror-separator {
1335
1339
  aria-labelledby="unsaved-heading"
1336
1340
  aria-describedby="unsaved-message"
1337
1341
  >
1338
- <h2 id="unsaved-heading">${RN.heading}</h2>
1339
- <p id="unsaved-message">${RN.message}</p>
1340
- ${RN.choices.map(({value:t,label:n})=>E`<button
1342
+ <h2 id="unsaved-heading">${zN.heading}</h2>
1343
+ <p id="unsaved-message">${zN.message}</p>
1344
+ ${zN.choices.map(({value:t,label:n})=>E`<button
1341
1345
  type="button"
1342
1346
  data-choice=${t}
1343
1347
  @click=${()=>e(t)}
@@ -1376,7 +1380,7 @@ img.ProseMirror-separator {
1376
1380
  >${e.title}</a
1377
1381
  >
1378
1382
  <small class="welcome-prompt-meta"
1379
- >${TN(this.types,e.type)} · changed
1383
+ >${EN(this.types,e.type)} · changed
1380
1384
  ${e.updated.slice(0,10)}</small
1381
1385
  >
1382
1386
  </li>`)}
@@ -1404,7 +1408,7 @@ img.ProseMirror-separator {
1404
1408
  >
1405
1409
  <small class="welcome-prompt-meta"
1406
1410
  >⚠️
1407
- ${xN(e.problems)}${t?E`: "${t.path}" ${t.message}`:D}</small
1411
+ ${SN(e.problems)}${t?E`: "${t.path}" ${t.message}`:D}</small
1408
1412
  >
1409
1413
  </li>`})}
1410
1414
  </ul>
@@ -1429,7 +1433,7 @@ img.ProseMirror-separator {
1429
1433
  >
1430
1434
  See all results
1431
1435
  </button>`:D}
1432
- </div>`}renderGroups(e){return zN(this.recent,this.types).map(t=>E`<div class="edaha-editor-article-group" data-type=${t.type}>
1436
+ </div>`}renderGroups(e){return BN(this.recent,this.types).map(t=>E`<div class="edaha-editor-article-group" data-type=${t.type}>
1433
1437
  <h2 class="edaha-editor-article-group-title">${t.label}</h2>
1434
1438
  <ul class="edaha-editor-article-group-list">
1435
1439
  ${t.articles.map(e)}
@@ -1451,7 +1455,7 @@ img.ProseMirror-separator {
1451
1455
  >${t.title}</a
1452
1456
  >
1453
1457
  <small class="edaha-editor-article-group-item-meta"
1454
- >${LN(t)}</small
1458
+ >${RN(t)}</small
1455
1459
  >
1456
1460
  ${t.error?E`<small class="error">${t.error}</small>`:D}
1457
1461
  </li>`;return E`
@@ -1464,9 +1468,9 @@ img.ProseMirror-separator {
1464
1468
  aria-controls="edaha-editor-nav"
1465
1469
  @click=${()=>void this.openNav()}
1466
1470
  >
1467
- ${Dt(`menu`)}<span class="visually-hidden">Articles</span>
1471
+ ${ft(`menu`)}<span class="visually-hidden">Articles</span>
1468
1472
  </button>
1469
- <span class="edaha-editor-bar-title">edaha.md</span>
1473
+ ${this.hideTitle?D:E`<span class="edaha-editor-bar-title">edaha.md</span>`}
1470
1474
  </div>
1471
1475
  <div
1472
1476
  class="nav-backdrop ${Xe({open:this.navOpen})}"
@@ -1484,27 +1488,29 @@ img.ProseMirror-separator {
1484
1488
  title="Close articles"
1485
1489
  @click=${()=>this.closeNav()}
1486
1490
  >
1487
- ${Dt(`close`)}<span class="visually-hidden">Close articles</span>
1488
- </button>
1489
- <button
1490
- type="button"
1491
- class="theme-switcher"
1492
- title=${jN()}
1493
- @click=${()=>{AN(),this.requestUpdate()}}
1494
- >
1495
- <span class="visually-hidden">${jN()}</span>
1491
+ ${ft(`close`)}<span class="visually-hidden">Close articles</span>
1496
1492
  </button>
1497
- <!-- Goes back to the welcome prompt; a button for keyboards and screen readers, but looking like the title -->
1498
- <h1 class="edaha-title">
1499
- <button
1500
- type="button"
1501
- class="edaha-title-button"
1502
- title="Show the welcome prompt"
1503
- @click=${()=>void this.showWelcome()}
1504
- >
1505
- edaha.md<span class="leaf-device"></span>
1506
- </button>
1507
- </h1>
1493
+ ${this.hideThemeSwitcher?D:E`<button
1494
+ type="button"
1495
+ class="theme-switcher"
1496
+ title=${MN()}
1497
+ @click=${()=>{jN(),this.requestUpdate()}}
1498
+ >
1499
+ <span class="visually-hidden">${MN()}</span>
1500
+ </button>`}
1501
+ ${this.hideTitle?E`<h1 class="visually-hidden">
1502
+ ${this.site?.name??`Articles`}
1503
+ </h1>`:E`<!-- Goes back to the welcome prompt; a button for keyboards and screen readers, but looking like the title -->
1504
+ <h1 class="edaha-title">
1505
+ <button
1506
+ type="button"
1507
+ class="edaha-title-button"
1508
+ title="Show the welcome prompt"
1509
+ @click=${()=>void this.showWelcome()}
1510
+ >
1511
+ edaha.md<span class="leaf-device"></span>
1512
+ </button>
1513
+ </h1>`}
1508
1514
  <div class="edaha-editor-new">
1509
1515
  <button
1510
1516
  type="button"
@@ -1532,7 +1538,7 @@ img.ProseMirror-separator {
1532
1538
  title="All articles"
1533
1539
  @click=${()=>{this.closeNav(),this.openBrowser()}}
1534
1540
  >
1535
- ${Dt(`manage_search`)}<span class="visually-hidden"
1541
+ ${ft(`manage_search`)}<span class="visually-hidden"
1536
1542
  >All articles</span
1537
1543
  >
1538
1544
  </button>
@@ -1542,9 +1548,17 @@ img.ProseMirror-separator {
1542
1548
  title="Files"
1543
1549
  @click=${()=>{this.closeNav(),this.openFiles()}}
1544
1550
  >
1545
- ${Dt(`folder_open`)}<span class="visually-hidden">Files</span>
1551
+ ${ft(`folder_open`)}<span class="visually-hidden">Files</span>
1546
1552
  </button>
1547
1553
  </div>
1554
+ <!-- Goes back to the welcome prompt, which is the editor's home -->
1555
+ <a
1556
+ href="#"
1557
+ class="edaha-editor-home edaha-editor-article-group-item-title"
1558
+ aria-current=${this.editing?`false`:`page`}
1559
+ @click=${e=>{e.preventDefault(),this.showWelcome()}}
1560
+ >Home</a
1561
+ >
1548
1562
  ${this.searchResult?this.renderSearchResult(this.searchResult,t):this.renderGroups(t)}
1549
1563
  </nav>
1550
1564
  <!-- Out of reach while the article list is open over it -->