diff --git a/README.md b/README.md index 31a04ba..cff6e42 100644 --- a/README.md +++ b/README.md @@ -96,6 +96,7 @@ Copy the entire `dist/TeiConverter` folder to the root of your project (or a sui - [Damage](/documentation/customEvents/damageHover.md); - [Deletions](/documentation/customEvents/delHover.md); - [Gaps](/documentation/customEvents/gapHover.md); + - [Unclear text](/documentation/customEvents/unclearHover.md); ### Running Tests diff --git a/dist/TeiConverter/TeiConverter.config.json b/dist/TeiConverter/TeiConverter.config.json index c75b1a9..0b24559 100644 --- a/dist/TeiConverter/TeiConverter.config.json +++ b/dist/TeiConverter/TeiConverter.config.json @@ -80,6 +80,11 @@ "showPlaces": false, "standOffPosition": "top" }, + "unclear": { + "render": "event", + "marker": ["[", "]"], + "message": "text unclear" + }, "elementsSelected": { "ab" : { "include": true, @@ -158,6 +163,9 @@ }, "standOff": { "include": true + }, + "unclear": { + "include": true } }, "addCustomBehaviours": { diff --git a/dist/TeiConverter/tei-converter.umd.js b/dist/TeiConverter/tei-converter.umd.js index 899f9fa..852e45f 100644 --- a/dist/TeiConverter/tei-converter.umd.js +++ b/dist/TeiConverter/tei-converter.umd.js @@ -1,8 +1,8 @@ (function(y){typeof define=="function"&&define.amd?define(y):y()})(function(){"use strict";var y=document.createElement("style");y.textContent=`[lang=ar],[lang=ota],[lang=fa],[lang=he],[lang*=-Arab-AR]{direction:rtl;text-align:right}[lang=en],[lang=fr],[lang=de],[lang=it],[lang*=ar-Latn-],[lang*=ota-Latn-]{direction:ltr;text-align:left}tei-ab{display:block;margin-top:1em;margin-bottom:1em}tei-accMat{display:block}tei-accMat:before{content:"accompanying materials: "}tei-acquisition{display:block;margin-top:0;margin-bottom:0}tei-acquisition:before{font-weight:700;content:"acquisition"}tei-activity{display:block}tei-activity:before{content:"activity: "}tei-add[place=above]{vertical-align:super}tei-add[place=inline]:before{content:"«"}tei-add[place=inline]:after{content:"»"}tei-add[place=below]{vertical-align:sub}tei-additional{display:block}tei-additions{display:block}tei-additions:before{content:"Significant additions within the document: "}tei-addrLine{display:block}tei-address[data-tei-rend~=block],addresss[data-tei-rendition~="#block"]{display:block}tei-adminInfo{display:block}tei-app tei-note{display:none}tei-appInfo{display:block}tei-appInfo:before{content:"Application information: "}tei-application{display:block}tei-application:after{content:" " attr(version)}tei-argument{display:block}tei-att{font-family:Courier,monospace}tei-att:before{content:"@"}tei-titlestmt>tei-author{display:block;margin-bottom:1em}tei-publicationstmt>tei-availability{font-size:80%}tei-publicationstmt>tei-availability:before{font-weight:700;content:"Availability: "}tei-publicationstmt>tei-availability[data-tei-status]:before{font-weight:700;content:"Availability (" attr(status) "): "}tei-back{display:block}tei-bibl[data-tei-rend~=block],bibl[data-tei-rendition~="#block"]{display:block;padding-left:2em;text-indent:-2em}tei-biblFull{display:block}tei-binding{display:block}tei-binding:before{content:"Binding: \\a";white-space:pre-wrap}tei-binding[data-tei-contemporary]:before{content:"Binding: \\a" "Contemporary: " attr(contemporary) "\\a";white-space:pre-wrap}tei-bindingdesc{display:block}tei-bindngdesc:before{content:"Binding description: \\a"}tei-birth{display:block}tei-birth:before{content:"Birth: "}tei-cRefPattern{display:none}tei-caption{display:block;margin-top:1em;margin-bottom:1em}tei-case[data-tei-value]:before{font-weight:700;content:attr(value) " "}tei-castgroup{display:block;margin-top:1em;margin-bottom:1em}tei-castitem{display:list-item}tei-castlist{display:block;list-style-type:none;margin-top:1em;margin-bottom:1em;margin-left:2em}tei-cb{display:block;margin-top:1em;margin-bottom:1em}tei-cb:before{content:"[column break]"}tei-cell{border-right:thin solid black;border-bottom:thin solid black;padding:2px}tei-cell[data-tei-role=label]{font-weight:700}tei-climate{display:block;margin-top:1em;margin-bottom:1em}tei-climate:before{font-weight:700;content:"Climate: "}tei-code{font-family:Courier,monospace}tei-collation{display:block;margin-top:1em;margin-bottom:1em}tei-condition{display:block;margin-top:1em;margin-bottom:1em}tei-constitution{display:block;margin-top:1em;margin-bottom:1em}tei-constitution:before{font-weight:700;content:"Constitution: "}tei-constitution[data-tei-type]{display:block;margin-top:1em;margin-bottom:1em}tei-constitution[data-tei-type]:before{font-weight:700;content:"Constitution (" attr(type) "): "}tei-constitution[data-tei-type=frags]{display:block;margin-top:1em;margin-bottom:1em}tei-constitution[data-tei-type=frags]:before{font-weight:700;content:"Constitution (fragments): "}tei-custevent{display:list-item}tei-custodialhist{display:block;margin-top:1em;margin-bottom:1em}tei-date[data-tei-when]:empty:before{content:attr(when)}tei-editionstmt{display:block}teieg-egxml{display:block;font-size:80%;margin-left:1em;padding-left:1em;border-left:1px solid #aaaaaa;margin-top:.75em;margin-bottom:.75em;padding-top:.75em;padding-bottom:.75em;font-family:monospace;white-space:pre}tei-emph{font-style:italic}tei-encodingdesc{display:none}tei-epigraph{display:block;margin-top:1em;margin-bottom:1em}tei-explicit{font-style:italic}tei-filedesc>tei-extent{display:none}tei-figure{display:block;text-align:center;margin-left:auto;margin-right:auto}tei-foreign{font-style:italic}tei-gap[data-tei-reason=lost]:before{content:"["}tei-gap[data-tei-reason=lost]:after{content:attr(data-content) "]"}tei-gap[data-tei-reason=illegible]:after{content:attr(data-content)}tei-gi{font-family:Courier,monospace}tei-gi:before{content:"<"}tei-gi:after{content:">"}tei-head{display:block;font-family:Arvo,sans-serif;font-weight:400}tei-body>tei-head{font-size:180%;text-indent:-.5em}tei-div.textpart{display:none}tei-div>tei-head{font-size:170%;text-indent:-.5em}tei-div>tei-div>tei-head{font-size:155%}tei-div>tei-div>tei-div>tei-head{font-size:140%}tei-div>tei-div>tei-div>tei-div>tei-head,list>tei-head{font-size:130%}tei-div>tei-div>tei-div>tei-div>tei-div>tei-head{font-size:120%}tei-div>tei-div>tei-div>tei-div>tei-div>tei-div tei-head{font-size:110%}tei-figure>tei-head{display:block;margin:1.5em auto;padding:.5em 1.5em 1.5em;border:1px solid black;border-radius:15px;width:325px;position:relative;border:1px solid #aaaaaa;background:#fafafa;text-indent:0;font-size:85%;text-align:justify;-webkit-box-shadow:0px 1px 3px rgba(0,0,0,.25);-moz-box-shadow:0px 1px 3px rgba(0,0,0,.25);box-shadow:0 1px 3px #00000040;width:85%;font-family:Georgia,Serif;font-size:13pt}tei-hi[rend~=caps]{font-weight:700}tei-hi[rend~=italic]{font-style:italic}tei-hi[rend~=underline]{text-decoration:underline}tei-hi[rend~=strikethrough]{text-decoration:line-through}tei-ident{font-family:Courier,monospace}tei-incipit{font-style:italic}tei-item{display:list-item;margin-left:1em}tei-cell item{margin-left:1em}tei-l{display:block;width:35em}tei-l[data-lineno]:before{content:attr(data-lineno);position:absolute;left:2em}tei-lb:after{content:"\\a";white-space:pre}tei-lg{display:block;margin-top:1em;margin-bottom:1em}tei-list{display:block;margin-top:1em;margin-bottom:1em;list-style-type:none}tei-item>tei-list{margin-top:0}tei-sourcedesc tei-list{list-style-type:none}tei-sourcedesc>tei-list>tei-head{font-size:140%;font-weight:700}tei-sourcedesc tei-list>tei-item{display:list-item}tei-text tei-list[type=simple]{list-style-type:none}tei-text tei-list[type=bulleted]{list-style-type:disc}tei-text tei-list[type=ordered]{list-style-type:none;counter-reset:items 0}tei-text tei-list[type=ordered]>tei-item{display:list-item;margin-left:0}tei-text tei-list[type=ordered]>item:before{counter-increment:items 1;content:counter(items,decimal) ". "}tei-text tei-list[type=gloss]{list-style-type:none}tei-list[type=gloss]>tei-label{display:block;margin-top:.25em;margin-bottom:.25em;font-weight:700}tei-list[type=gloss]>tei-item{margin-left:2em}tei-item>tei-list[type=ordered]{margin-left:1em}tei-listapp{display:block;margin:1em;padding:1em}tei-listbibl{display:block;list-style-type:none;margin-left:.5 em;margin-top:.5em}tei-listbibl>tei-head{font-size:120%;font-weight:700}tei-listbibl>tei-bibl{display:list-item;margin-left:.5em}tei-listwit{display:block;list-style-type:none;margin-left:.5em}tei-listwit>tei-head{font-size:120%;font-weight:700}tei-listwit>tei-witness{display:list-item;margin-left:2em;text-indent:-1.1em}tei-witness>tei-listwit{display:inline}tei-witness>tei-listwit>tei-head{display:inline}tei-witness>tei-listwit>tei-witness{display:inline}tei-locus{display:none}tei-milestone{display:none;margin-left:auto;margin-right:auto;text-align:center}tei-musicNotation{font-weight:700}tei-musicNotation:before{font-weight:700;content:"Musical Notation: "}tei-node{display:none}tei-notesstmt{display:none}tei-ovar{font-style:italic}tei-origPlace{font-weight:700}tei-origPlace:before{font-weight:700;content:"Place of Origin: "}tei-p{display:block;margin-top:1em;margin-bottom:1em;text-align:justify}*[data-tei-rendition~="#center"] p{text-align:center}tei-availability>p:first-child{margin-top:0}tei-performance{display:block;margin-top:1em;margin-bottom:1em}tei-person{display:block;margin-top:1em;margin-bottom:1em}tei-personGrp{display:block;margin-top:1em;margin-bottom:1em}tei-postscript{display:block;margin-top:2em}tei-principal{font-weight:700}tei-principal:before{font-weight:700;content:"Principal: "}tei-profiledesc{display:none}tei-publicationstmt>*{display:none}tei-publicationstmt{display:block;margin-top:1em;margin-bottom:1em}tei-publicationstmt>date{display:none}tei-publicationstmt>publisher{display:none}tei-q{quotes:"“" "”" "‘" "’" "“" "”" "‘" "’" "“" "”" "‘" "’" "“" "”"}tei-q:before{content:""}tei-q:after{content:""}tei-q[data-tei-next]:after{content:""!important}tei-q[data-tei-prev]:before{content:""!important}tei-quote{font-style:italic}tei-app tei-rdg{display:none}tei-re{display:block;margin-top:0;margin-bottom:0}tei-recordhist{display:block;margin-top:1em;margin-bottom:1em}tei-ref{color:#5f0000;text-decoration:underline;cursor:pointer}tei-remarks{font-weight:700}tei-remarks:before{font-weight:700;content:"remarks: "}tei-respstmt{display:block;margin-top:0;margin-bottom:0}tei-revisiondesc{display:none}tei-row{display:grid;grid-auto-flow:column;grid-auto-columns:1fr}tei-salute{display:block;margin-top:1em;margin-bottom:1em}tei-samplingdecl{display:block;margin-top:0;margin-bottom:0}tei-scriptnote{display:block;margin-top:1em;margin-bottom:1em}tei-seal{display:block;margin-top:0;margin-bottom:0}tei-seal:before{font-weight:700;content:"Seal: "}tei-sealdesc{display:block;margin-top:1em;margin-bottom:1em}tei-secFol:before{font-weight:700;content:"Second Folio: "}tei-secl>*:first-child:before{content:"\\a[";white-space:pre}tei-secl>*:last-child:after{content:"]\\a\\a";white-space:pre}tei-seg{outline:0px solid transparent}tei-sense{display:block;margin-top:0;margin-bottom:0}tei-seriesstmt{display:none}tei-setting{display:block;margin-top:0;margin-bottom:0}tei-signed{display:block;margin-top:2em}tei-soCalled{quotes:"“" "”" "‘" "’" "“" "”" "‘" "’" "“" "”" "‘" "’" "“" "”"}tei-soCalled:before{content:open-quote}tei-soCalled:after{content:close-quote}tei-soCalled[data-tei-next]:after{content:""!important}tei-soCalled[data-tei-prev]:before{content:""!important}tei-sound{font-style:italic}tei-source{display:block;margin-top:0;margin-bottom:0}tei-sourcedesc{display:none}tei-space:before{font-weight:700;content:""}tei-span[data-tei-data-n]:before{content:attr(data-n)}tei-speaker{font-weight:700;margin-right:0}tei-sponsor{display:block;margin-top:0;margin-bottom:0}tei-sponsor:before{font-weight:700;content:"Sponsor:"}tei-stage{display:block;margin-top:1em;margin-bottom:1em;font-style:italic}tei-stamp{display:block;margin-top:1em;margin-bottom:1em}tei-stamp:before{font-weight:700;content:"Stamped: "}tei-surplus>*:first-child:before{content:"\\a[";white-space:pre}tei-surplus>*:last-child:after{content:"]\\a\\a";white-space:pre}tei-tei{display:block}tei-table{display:block;border-top:thin solid black;border-left:thin solid black}tei-table{margin-top:2em;margin-bottom:2em;font-size:12pt}tei-table>tei-head{border-bottom:thin solid black;border-right:thin solid black;font-size:120%;font-weight:700;padding:2px;text-align:center}tei-teiheader{display:block;margin-top:2em;margin-bottom:2em}tei-tei>tei-text{display:block;line-height:1.5}tei-textclass{display:none}tei-textdesc{display:none}tei-tei tei-title{display:inline}tei-tei tei-title[level=a]{quotes:"“" "”" "‘" "’" "“" "”" "‘" "’" "“" "”" "‘" "’" "“" "”"}tei-tei tei-title[level=a]:before{content:open-quote}tei-tei tei-title[level=a]:after{content:close-quote}tei-tei tei-title[level=a][next]:after{content:""!important}tei-tei tei-title[level=a][prev]:before{content:""!important}tei-title[level=m]{font-style:italic}tei-titlestmt>tei-title{display:block;font-family:Arvo,sans-serif;font-weight:400;font-weight:700!important;font-size:150%}tei-typedesc{display:none}tei-u:before{content:"-"}tei-view{font-style:italic}tei-wit{display:inline}tei-witdetail{display:none}.event{text-decoration:underline dashed} -`,document.head.appendChild(y);function w(){}function U(t){return t()}function F(){return Object.create(null)}function A(t){t.forEach(U)}function V(t){return typeof t=="function"}function oe(t,e){return t!=t?e==e:t!==e||t&&typeof t=="object"||typeof t=="function"}function ae(t){return Object.keys(t).length===0}function se(t,e){t.appendChild(e)}function _(t,e,i){t.insertBefore(e,i||null)}function k(t){t.parentNode&&t.parentNode.removeChild(t)}function O(t){return document.createElement(t)}function le(t){return document.createTextNode(t)}function E(t,e,i){i==null?t.removeAttribute(e):t.getAttribute(e)!==i&&t.setAttribute(e,i)}function de(t){return Array.from(t.childNodes)}function ce(t,e){e=""+e,t.data!==e&&(t.data=e)}function ue(t){const e={};return t.childNodes.forEach(i=>{e[i.slot||"default"]=!0}),e}let v;function $(t){v=t}function fe(){if(!v)throw new Error("Function called outside component initialization");return v}function me(t){fe().$$.on_mount.push(t)}const m=[],G=[];let p=[];const J=[],pe=Promise.resolve();let I=!1;function he(){I||(I=!0,pe.then(x))}function P(t){p.push(t)}const S=new Set;let h=0;function x(){if(h!==0)return;const t=v;do{try{for(;ht.indexOf(n)===-1?e.push(n):i.push(n)),i.forEach(n=>n()),p=e}const ye=new Set;function we(t,e){t&&t.i&&(ye.delete(t),t.i(e))}function ve(t,e,i){const{fragment:n,after_update:r}=t.$$;n&&n.m(e,i),P(()=>{const o=t.$$.on_mount.map(U).filter(V);t.$$.on_destroy?t.$$.on_destroy.push(...o):A(o),t.$$.on_mount=[]}),r.forEach(P)}function $e(t,e){const i=t.$$;i.fragment!==null&&(be(i.after_update),A(i.on_destroy),i.fragment&&i.fragment.d(e),i.on_destroy=i.fragment=null,i.ctx=[])}function Ae(t,e){t.$$.dirty[0]===-1&&(m.push(t),he(),t.$$.dirty.fill(0)),t.$$.dirty[e/31|0]|=1<{const f=b.length?b[0]:L;return l.ctx&&r(l.ctx[c],l.ctx[c]=f)&&(!l.skip_bound&&l.bound[c]&&l.bound[c](f),u&&Ae(t,c)),L}):[],l.update(),u=!0,A(l.before_update),l.fragment=n?n(l.ctx):!1,e.target){if(e.hydrate){const c=de(e.target);l.fragment&&l.fragment.l(c),c.forEach(k)}else l.fragment&&l.fragment.c();e.intro&&we(t.$$.fragment),ve(t,e.target,e.anchor),x()}$(d)}let W;typeof HTMLElement=="function"&&(W=class extends HTMLElement{$$ctor;$$s;$$c;$$cn=!1;$$d={};$$r=!1;$$p_d={};$$l={};$$l_u=new Map;constructor(t,e,i){super(),this.$$ctor=t,this.$$s=e,i&&this.attachShadow({mode:"open"})}addEventListener(t,e,i){if(this.$$l[t]=this.$$l[t]||[],this.$$l[t].push(e),this.$$c){const n=this.$$c.$on(t,e);this.$$l_u.set(e,n)}super.addEventListener(t,e,i)}removeEventListener(t,e,i){if(super.removeEventListener(t,e,i),this.$$c){const n=this.$$l_u.get(e);n&&(n(),this.$$l_u.delete(e))}}async connectedCallback(){if(this.$$cn=!0,!this.$$c){let t=function(r){return()=>{let o;return{c:function(){o=O("slot"),r!=="default"&&E(o,"name",r)},m:function(d,l){_(d,o,l)},d:function(d){d&&k(o)}}}};if(await Promise.resolve(),!this.$$cn)return;const e={},i=ue(this);for(const r of this.$$s)r in i&&(e[r]=[t(r)]);for(const r of this.attributes){const o=this.$$g_p(r.name);o in this.$$d||(this.$$d[o]=N(o,r.value,this.$$p_d,"toProp"))}for(const r in this.$$p_d)!(r in this.$$d)&&this[r]!==void 0&&(this.$$d[r]=this[r],delete this[r]);this.$$c=new this.$$ctor({target:this.shadowRoot||this,props:{...this.$$d,$$slots:e,$$scope:{ctx:[]}}});const n=()=>{this.$$r=!0;for(const r in this.$$p_d)if(this.$$d[r]=this.$$c.$$.ctx[this.$$c.$$.props[r]],this.$$p_d[r].reflect){const o=N(r,this.$$d[r],this.$$p_d,"toAttribute");o==null?this.removeAttribute(this.$$p_d[r].attribute||r):this.setAttribute(this.$$p_d[r].attribute||r,o)}this.$$r=!1};this.$$c.$$.after_update.push(n),n();for(const r in this.$$l)for(const o of this.$$l[r]){const a=this.$$c.$on(r,o);this.$$l_u.set(o,a)}this.$$l={}}}attributeChangedCallback(t,e,i){this.$$r||(t=this.$$g_p(t),this.$$d[t]=N(t,i,this.$$p_d,"toProp"),this.$$c?.$set({[t]:this.$$d[t]}))}disconnectedCallback(){this.$$cn=!1,Promise.resolve().then(()=>{this.$$cn||(this.$$c.$destroy(),this.$$c=void 0)})}$$g_p(t){return Object.keys(this.$$p_d).find(e=>this.$$p_d[e].attribute===t||!this.$$p_d[e].attribute&&e.toLowerCase()===t)||t}});function N(t,e,i,n){const r=i[t]?.type;if(e=r==="Boolean"&&typeof e!="boolean"?e!=null:e,!n||!i[t])return e;if(n==="toAttribute")switch(r){case"Object":case"Array":return e==null?null:JSON.stringify(e);case"Boolean":return e?"":null;case"Number":return e??null;default:return e}else switch(r){case"Object":case"Array":return e&&JSON.parse(e);case"Boolean":return e;case"Number":return e!=null?+e:e;default:return e}}function Ee(t,e,i,n,r,o){let a=class extends W{constructor(){super(t,i,r),this.$$p_d=e}static get observedAttributes(){return Object.keys(e).map(s=>(e[s].attribute||s).toLowerCase())}};return Object.keys(e).forEach(s=>{Object.defineProperty(a.prototype,s,{get(){return this.$$c&&s in this.$$c?this.$$c[s]:this.$$d[s]},set(d){d=N(s,d,e),this.$$d[s]=d,this.$$c?.$set({[s]:d})}})}),n.forEach(s=>{Object.defineProperty(a.prototype,s,{get(){return this.$$c?.[s]}})}),o&&(a=o(a)),t.element=a,a}class xe{$$=void 0;$$set=void 0;$destroy(){$e(this,1),this.$destroy=w}$on(e,i){if(!V(i))return w;const n=this.$$.callbacks[e]||(this.$$.callbacks[e]=[]);return n.push(i),()=>{const r=n.indexOf(i);r!==-1&&n.splice(r,1)}}$set(e){this.$$set&&!ae(e)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}}const Ne="4";typeof window<"u"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(Ne);const Ce={namespaces:{tei:"http://www.tei-c.org/ns/1.0",teieg:"http://www.tei-c.org/ns/Examples",rng:"http://relaxng.org/ns/structure/1.0"},tei:{eg:["
","
"],ptr:['$@target'],ref:[["[target]",['',""]]],graphic:function(t){let e=new Image;return e.src=this.rw(t.getAttribute("url")),t.hasAttribute("width")&&e.setAttribute("width",t.getAttribute("width")),t.hasAttribute("height")&&e.setAttribute("height",t.getAttribute("height")),e},list:[["[type=gloss]",function(t){const e=t.ownerDocument;let i=e.createElement("dl");for(let n of Array.from(t.children))if(n.nodeType==1){if(n.localName=="tei-label"){let r=e.createElement("dt");r.innerHTML=n.innerHTML,i.appendChild(r)}if(n.localName=="tei-item"){let r=e.createElement("dd");r.innerHTML=n.innerHTML,i.appendChild(r)}}return i}]],note:[["[place=end]",function(t){const e=t.ownerDocument;this.noteIndex?this.noteIndex++:this.noteIndex=1;let i="_note_"+this.noteIndex,n=e.createElement("a");n.setAttribute("id","src"+i),n.setAttribute("href","#"+i),n.innerHTML=this.noteIndex;let r=e.createElement("sup");r.appendChild(n);let o=e.querySelector("ol.notes");o||(o=e.createElement("ol"),o.setAttribute("class","notes"),this.dom.appendChild(o));let a=e.createElement("li");return a.id=i,a.innerHTML=t.innerHTML,o.appendChild(a),r}],["_",["(",")"]]],teiHeader:function(t){this.hideContent(t,!1)},title:[["tei-titlestmt>tei-title",function(t){const e=t.ownerDocument;let i=e.createElement("title");i.innerHTML=t.innerText,e.querySelector("head").appendChild(i)}]]},teieg:{egXML:function(t){let i=t.ownerDocument.createElement("pre"),n=this.serialize(t,!0).replace(/{let r=n.nodeType===1?e.createElement(n.nodeName):n.cloneNode(!0);if(n.attributes)for(let o of Array.from(n.attributes))o.name!=="data-processed"&&r.setAttribute(o.name,o.value);for(let o of Array.from(n.childNodes))if(o.nodeType==1){if(!n.hasAttribute("data-empty"))if(o.hasAttribute("data-original")){for(let a of Array.from(o.childNodes)){let s=r.appendChild(i(a));s.nodeType===1&&s.hasAttribute("data-origid")&&(s.setAttribute("id",s.getAttribute("data-origid")),s.removeAttribute("data-origid"))}return r}else r.appendChild(i(o))}else r.appendChild(o.cloneNode());return r};return i(t)}function _e(t){return t.replace(/ .*$/,"")}function Y(t,e=!0){const i=t.ownerDocument;if(t.childNodes.length>0){let n=i.createElement("span");t.appendChild(n),n.setAttribute("hidden",""),n.setAttribute("data-original","");for(let r of Array.from(t.childNodes))if(r!==n){if(r.nodeType===1){r.setAttribute("data-processed","");for(let o of r.querySelectorAll("*"))o.setAttribute("data-processed","")}n.appendChild(t.removeChild(r))}if(e)for(let r of Array.from(n.querySelectorAll("*")))r.hasAttribute("id")&&(r.setAttribute("data-origid",r.getAttribute("id")),r.removeAttribute("id"))}}function Oe(t){return this.rw(this.first(t))}function Ie(t,e){let i="";for(let n=0;n!/[^\t\n\r ]/.test(o);if(!e&&t.nodeType==1){typeof i=="string"&&i!==""?n+=` +`,document.head.appendChild(y);function w(){}function U(t){return t()}function F(){return Object.create(null)}function A(t){t.forEach(U)}function V(t){return typeof t=="function"}function ae(t,e){return t!=t?e==e:t!==e||t&&typeof t=="object"||typeof t=="function"}function se(t){return Object.keys(t).length===0}function le(t,e){t.appendChild(e)}function _(t,e,i){t.insertBefore(e,i||null)}function E(t){t.parentNode&&t.parentNode.removeChild(t)}function O(t){return document.createElement(t)}function de(t){return document.createTextNode(t)}function k(t,e,i){i==null?t.removeAttribute(e):t.getAttribute(e)!==i&&t.setAttribute(e,i)}function ce(t){return Array.from(t.childNodes)}function ue(t,e){e=""+e,t.data!==e&&(t.data=e)}function fe(t){const e={};return t.childNodes.forEach(i=>{e[i.slot||"default"]=!0}),e}let v;function $(t){v=t}function me(){if(!v)throw new Error("Function called outside component initialization");return v}function pe(t){me().$$.on_mount.push(t)}const m=[],G=[];let p=[];const J=[],he=Promise.resolve();let I=!1;function ge(){I||(I=!0,he.then(x))}function P(t){p.push(t)}const S=new Set;let h=0;function x(){if(h!==0)return;const t=v;do{try{for(;ht.indexOf(n)===-1?e.push(n):i.push(n)),i.forEach(n=>n()),p=e}const we=new Set;function ve(t,e){t&&t.i&&(we.delete(t),t.i(e))}function $e(t,e,i){const{fragment:n,after_update:r}=t.$$;n&&n.m(e,i),P(()=>{const o=t.$$.on_mount.map(U).filter(V);t.$$.on_destroy?t.$$.on_destroy.push(...o):A(o),t.$$.on_mount=[]}),r.forEach(P)}function Ae(t,e){const i=t.$$;i.fragment!==null&&(ye(i.after_update),A(i.on_destroy),i.fragment&&i.fragment.d(e),i.on_destroy=i.fragment=null,i.ctx=[])}function Ee(t,e){t.$$.dirty[0]===-1&&(m.push(t),ge(),t.$$.dirty.fill(0)),t.$$.dirty[e/31|0]|=1<{const f=b.length?b[0]:L;return l.ctx&&r(l.ctx[c],l.ctx[c]=f)&&(!l.skip_bound&&l.bound[c]&&l.bound[c](f),u&&Ee(t,c)),L}):[],l.update(),u=!0,A(l.before_update),l.fragment=n?n(l.ctx):!1,e.target){if(e.hydrate){const c=ce(e.target);l.fragment&&l.fragment.l(c),c.forEach(E)}else l.fragment&&l.fragment.c();e.intro&&ve(t.$$.fragment),$e(t,e.target,e.anchor),x()}$(d)}let W;typeof HTMLElement=="function"&&(W=class extends HTMLElement{$$ctor;$$s;$$c;$$cn=!1;$$d={};$$r=!1;$$p_d={};$$l={};$$l_u=new Map;constructor(t,e,i){super(),this.$$ctor=t,this.$$s=e,i&&this.attachShadow({mode:"open"})}addEventListener(t,e,i){if(this.$$l[t]=this.$$l[t]||[],this.$$l[t].push(e),this.$$c){const n=this.$$c.$on(t,e);this.$$l_u.set(e,n)}super.addEventListener(t,e,i)}removeEventListener(t,e,i){if(super.removeEventListener(t,e,i),this.$$c){const n=this.$$l_u.get(e);n&&(n(),this.$$l_u.delete(e))}}async connectedCallback(){if(this.$$cn=!0,!this.$$c){let t=function(r){return()=>{let o;return{c:function(){o=O("slot"),r!=="default"&&k(o,"name",r)},m:function(d,l){_(d,o,l)},d:function(d){d&&E(o)}}}};if(await Promise.resolve(),!this.$$cn)return;const e={},i=fe(this);for(const r of this.$$s)r in i&&(e[r]=[t(r)]);for(const r of this.attributes){const o=this.$$g_p(r.name);o in this.$$d||(this.$$d[o]=N(o,r.value,this.$$p_d,"toProp"))}for(const r in this.$$p_d)!(r in this.$$d)&&this[r]!==void 0&&(this.$$d[r]=this[r],delete this[r]);this.$$c=new this.$$ctor({target:this.shadowRoot||this,props:{...this.$$d,$$slots:e,$$scope:{ctx:[]}}});const n=()=>{this.$$r=!0;for(const r in this.$$p_d)if(this.$$d[r]=this.$$c.$$.ctx[this.$$c.$$.props[r]],this.$$p_d[r].reflect){const o=N(r,this.$$d[r],this.$$p_d,"toAttribute");o==null?this.removeAttribute(this.$$p_d[r].attribute||r):this.setAttribute(this.$$p_d[r].attribute||r,o)}this.$$r=!1};this.$$c.$$.after_update.push(n),n();for(const r in this.$$l)for(const o of this.$$l[r]){const a=this.$$c.$on(r,o);this.$$l_u.set(o,a)}this.$$l={}}}attributeChangedCallback(t,e,i){this.$$r||(t=this.$$g_p(t),this.$$d[t]=N(t,i,this.$$p_d,"toProp"),this.$$c?.$set({[t]:this.$$d[t]}))}disconnectedCallback(){this.$$cn=!1,Promise.resolve().then(()=>{this.$$cn||(this.$$c.$destroy(),this.$$c=void 0)})}$$g_p(t){return Object.keys(this.$$p_d).find(e=>this.$$p_d[e].attribute===t||!this.$$p_d[e].attribute&&e.toLowerCase()===t)||t}});function N(t,e,i,n){const r=i[t]?.type;if(e=r==="Boolean"&&typeof e!="boolean"?e!=null:e,!n||!i[t])return e;if(n==="toAttribute")switch(r){case"Object":case"Array":return e==null?null:JSON.stringify(e);case"Boolean":return e?"":null;case"Number":return e??null;default:return e}else switch(r){case"Object":case"Array":return e&&JSON.parse(e);case"Boolean":return e;case"Number":return e!=null?+e:e;default:return e}}function xe(t,e,i,n,r,o){let a=class extends W{constructor(){super(t,i,r),this.$$p_d=e}static get observedAttributes(){return Object.keys(e).map(s=>(e[s].attribute||s).toLowerCase())}};return Object.keys(e).forEach(s=>{Object.defineProperty(a.prototype,s,{get(){return this.$$c&&s in this.$$c?this.$$c[s]:this.$$d[s]},set(d){d=N(s,d,e),this.$$d[s]=d,this.$$c?.$set({[s]:d})}})}),n.forEach(s=>{Object.defineProperty(a.prototype,s,{get(){return this.$$c?.[s]}})}),o&&(a=o(a)),t.element=a,a}class Ne{$$=void 0;$$set=void 0;$destroy(){Ae(this,1),this.$destroy=w}$on(e,i){if(!V(i))return w;const n=this.$$.callbacks[e]||(this.$$.callbacks[e]=[]);return n.push(i),()=>{const r=n.indexOf(i);r!==-1&&n.splice(r,1)}}$set(e){this.$$set&&!se(e)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}}const Ce="4";typeof window<"u"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(Ce);const Te={namespaces:{tei:"http://www.tei-c.org/ns/1.0",teieg:"http://www.tei-c.org/ns/Examples",rng:"http://relaxng.org/ns/structure/1.0"},tei:{eg:["
","
"],ptr:['$@target'],ref:[["[target]",['',""]]],graphic:function(t){let e=new Image;return e.src=this.rw(t.getAttribute("url")),t.hasAttribute("width")&&e.setAttribute("width",t.getAttribute("width")),t.hasAttribute("height")&&e.setAttribute("height",t.getAttribute("height")),e},list:[["[type=gloss]",function(t){const e=t.ownerDocument;let i=e.createElement("dl");for(let n of Array.from(t.children))if(n.nodeType==1){if(n.localName=="tei-label"){let r=e.createElement("dt");r.innerHTML=n.innerHTML,i.appendChild(r)}if(n.localName=="tei-item"){let r=e.createElement("dd");r.innerHTML=n.innerHTML,i.appendChild(r)}}return i}]],note:[["[place=end]",function(t){const e=t.ownerDocument;this.noteIndex?this.noteIndex++:this.noteIndex=1;let i="_note_"+this.noteIndex,n=e.createElement("a");n.setAttribute("id","src"+i),n.setAttribute("href","#"+i),n.innerHTML=this.noteIndex;let r=e.createElement("sup");r.appendChild(n);let o=e.querySelector("ol.notes");o||(o=e.createElement("ol"),o.setAttribute("class","notes"),this.dom.appendChild(o));let a=e.createElement("li");return a.id=i,a.innerHTML=t.innerHTML,o.appendChild(a),r}],["_",["(",")"]]],teiHeader:function(t){this.hideContent(t,!1)},title:[["tei-titlestmt>tei-title",function(t){const e=t.ownerDocument;let i=e.createElement("title");i.innerHTML=t.innerText,e.querySelector("head").appendChild(i)}]]},teieg:{egXML:function(t){let i=t.ownerDocument.createElement("pre"),n=this.serialize(t,!0).replace(/{let r=n.nodeType===1?e.createElement(n.nodeName):n.cloneNode(!0);if(n.attributes)for(let o of Array.from(n.attributes))o.name!=="data-processed"&&r.setAttribute(o.name,o.value);for(let o of Array.from(n.childNodes))if(o.nodeType==1){if(!n.hasAttribute("data-empty"))if(o.hasAttribute("data-original")){for(let a of Array.from(o.childNodes)){let s=r.appendChild(i(a));s.nodeType===1&&s.hasAttribute("data-origid")&&(s.setAttribute("id",s.getAttribute("data-origid")),s.removeAttribute("data-origid"))}return r}else r.appendChild(i(o))}else r.appendChild(o.cloneNode());return r};return i(t)}function Oe(t){return t.replace(/ .*$/,"")}function Y(t,e=!0){const i=t.ownerDocument;if(t.childNodes.length>0){let n=i.createElement("span");t.appendChild(n),n.setAttribute("hidden",""),n.setAttribute("data-original","");for(let r of Array.from(t.childNodes))if(r!==n){if(r.nodeType===1){r.setAttribute("data-processed","");for(let o of r.querySelectorAll("*"))o.setAttribute("data-processed","")}n.appendChild(t.removeChild(r))}if(e)for(let r of Array.from(n.querySelectorAll("*")))r.hasAttribute("id")&&(r.setAttribute("data-origid",r.getAttribute("id")),r.removeAttribute("id"))}}function Ie(t){return this.rw(this.first(t))}function Pe(t,e){let i="";for(let n=0;n!/[^\t\n\r ]/.test(o);if(!e&&t.nodeType==1){typeof i=="string"&&i!==""?n+=` `+i+"<":n+="<",n+=t.getAttribute("data-origname");let o=t.hasAttribute("data-origatts")?t.getAttribute("data-origatts").split(" "):[];for(let a of Array.from(t.attributes))!a.name.startsWith("data-")&&!["id","lang","class"].includes(a.name)&&(n+=" "+o.find(function(s){return s.toLowerCase()==a.name})+'="'+a.value+'"'),a.name=="data-xmlns"&&(n+=' xmlns="'+a.value+'"');t.childNodes.length>0?n+=">":n+="/>"}for(let o of Array.from(t.childNodes))switch(o.nodeType){case 1:typeof i=="string"?n+=B(o,!1,i+" "):n+=B(o,!1,i);break;case 7:n+="";break;case 8:n+="";break;default:if(e&&r(o.nodeValue)&&(n+=o.nodeValue.replace(/^\s*\n/,"")),typeof i=="string"&&r(o.nodeValue))break;n+=o.nodeValue}return!e&&t.childNodes.length>0&&(typeof i=="string"?n+=` -`+i+""),n}function je(t){return t.replace(/>/,">").replace(/"/,'"').replace(/'/,"'").replace(/&/,"&")}function C(t){return t.includes(":"),t.replace(/:/,"-").toLowerCase()}function Z(t,e=null,i=!1){try{window.customElements.define(C(t),class extends HTMLElement{constructor(){super(),this.matches(":defined")||(e&&e.call(this),this.setAttribute("data-processed",""))}connectedCallback(){this.hasAttribute("data-processed")||(e&&e.call(this),this.setAttribute("data-processed",""))}})}catch(n){i&&(console.log(C(t)+" couldn't be registered or is already registered."),console.log(n))}}const j=Object.freeze(Object.defineProperty({__proto__:null,copyAndReset:Le,defineCustomElement:Z,first:_e,getOrdinality:Te,getPrefixDef:Se,hideContent:Y,normalizeURI:Oe,repeat:Ie,resolveURI:Pe,rw:Be,serialize:B,tagName:C,unEscapeEntities:je},Symbol.toStringTag,{value:"Module"}));function Me(t){if(t.namespaces)for(let e of Object.keys(t.namespaces))!this.namespaces.has(t.namespaces[e])&&!Array.from(this.namespaces.values()).includes(e)&&this.namespaces.set(t.namespaces[e],e);for(let e of this.namespaces.values())if(t[e])for(let i of Object.keys(t[e]))this.behaviors[`${e}:${i}`]=t[e][i];if(t.functions)for(let e of Object.keys(t.functions))this.utilities[e]=t.functions[e];t.handlers&&console.log("Behavior handlers are no longer used."),t.fallbacks&&console.log("Fallback behaviors are no longer used.")}function De(t,e,i){let n;if(t===Object(t))for(let r of Object.keys(t))this.namespaces.has(t[r])||(this.namespaces.set(t[r],r),n=r);else n=t;this.behaviors[`${n}:${e}`]=i}function He(t,e){let i;if(t===Object(t))for(let n of Object.keys(t))this.namespaces.has(t[n])||(this.namespaces.set(t[n],n),i=n);else i=t;delete this.behaviors[`${i}:${e}`]}function Re(t,e){const i=t.documentElement;let n=1,r=function(a){return e.has(a.namespaceURI?a.namespaceURI:"")||e.set(a.namespaceURI,"ns"+n++),e.get(a.namespaceURI?a.namespaceURI:"")+":"+a.localName};const o=new Set(Array.from(i.querySelectorAll("*"),r));return o.add(r(i)),o}function ze(t){return Array.from(t.querySelectorAll("*[data-origname]"),e=>e.localName.replace(/(\w+)-.+/,"$1:")+e.getAttribute("data-origname"))}class g{constructor(e){this.options=e||{},this.document=this.options.documentObject?this.options.documentObject:void 0,this.document===void 0&&(typeof window<"u"&&window.document?this.document=window.document:typeof global<"u"&&global.document&&(this.document=global.document)),this.addBehaviors=Me.bind(this),this.addBehavior=De.bind(this),this.removeBehavior=He.bind(this),this.utilities={};for(const i of Object.keys(j))["getPrefixDef","rw","resolveURI"].includes(i)?this.utilities[i]=j[i].bind(this):this.utilities[i]=j[i];if(this.els=[],this.namespaces=new Map,this.behaviors={},this.hasStyle=!1,this.prefixDefs=[],this.debug=this.options.debug===!0,this.discardContent=this.options.discardContent===!0,this.options.base)this.base=this.options.base;else try{window&&(this.base=window.location.href.replace(/\/[^\/]*$/,"/"))}catch{this.base=""}this.options.omitDefaultBehaviors||this.addBehaviors(Ce),this.options.ignoreFragmentId&&window&&window.removeEventListener("ceteiceanload",g.restorePosition)}getHTML5(e,i,n){return window&&window.location.href.startsWith(this.base)&&e.indexOf("/")>=0&&(this.base=e.replace(/\/[^\/]*$/,"/")),new Promise(function(o,a){let s=new XMLHttpRequest;s.open("GET",e),s.send(),s.onload=function(){this.status>=200&&this.status<300?o(this.response):a(this.statusText)},s.onerror=function(){a(this.statusText)}}).catch(function(o){console.log("Could not get XML file."),this.debug&&console.log(o)}).then(o=>this.makeHTML5(o,i,n))}makeHTML5(e,i,n){return this.XML_dom=new DOMParser().parseFromString(e,"text/xml"),this.domToHTML5(this.XML_dom,i,n)}preprocess(e,i,n){this.els=Re(e,this.namespaces);let r=o=>{let a;if(this.namespaces.has(o.namespaceURI?o.namespaceURI:"")){let s=this.namespaces.get(o.namespaceURI?o.namespaceURI:"");a=this.document.createElement(`${s}-${o.localName}`)}else a=this.document.importNode(o,!1);for(let s of Array.from(o.attributes))s.name=="xmlns"?a.setAttribute("data-xmlns",s.value):a.setAttribute(s.name,s.value),s.name=="xml:id"&&a.setAttribute("id",s.value),s.name=="xml:lang"&&a.setAttribute("lang",s.value),s.name=="rendition"&&a.setAttribute("class",s.value.replace(/#/g,""));if(a.setAttribute("data-origname",o.localName),o.hasAttributes()&&a.setAttribute("data-origatts",o.getAttributeNames().join(" ")),o.childNodes.length==0&&a.setAttribute("data-empty",""),o.localName=="head"){let s=e.evaluate("count(ancestor::*[tei:head])",o,function(d){if(d=="tei")return"http://www.tei-c.org/ns/1.0"},1,null);a.setAttribute("data-level",s.numberValue)}if(o.localName=="tagsDecl"){let s=this.document.createElement("style");for(let d of Array.from(o.childNodes))if(d.nodeType==1&&d.localName=="rendition"&&d.getAttribute("scheme")=="css"){let l="";d.hasAttribute("selector")?(l+=d.getAttribute("selector").replace(/([^#, >]+\w*)/g,"tei-$1").replace(/#tei-/g,"#")+`{ +`+i+""),n}function Me(t){return t.replace(/>/,">").replace(/"/,'"').replace(/'/,"'").replace(/&/,"&")}function C(t){return t.includes(":"),t.replace(/:/,"-").toLowerCase()}function Z(t,e=null,i=!1){try{window.customElements.define(C(t),class extends HTMLElement{constructor(){super(),this.matches(":defined")||(e&&e.call(this),this.setAttribute("data-processed",""))}connectedCallback(){this.hasAttribute("data-processed")||(e&&e.call(this),this.setAttribute("data-processed",""))}})}catch(n){i&&(console.log(C(t)+" couldn't be registered or is already registered."),console.log(n))}}const j=Object.freeze(Object.defineProperty({__proto__:null,copyAndReset:_e,defineCustomElement:Z,first:Oe,getOrdinality:Le,getPrefixDef:Be,hideContent:Y,normalizeURI:Ie,repeat:Pe,resolveURI:Se,rw:je,serialize:B,tagName:C,unEscapeEntities:Me},Symbol.toStringTag,{value:"Module"}));function De(t){if(t.namespaces)for(let e of Object.keys(t.namespaces))!this.namespaces.has(t.namespaces[e])&&!Array.from(this.namespaces.values()).includes(e)&&this.namespaces.set(t.namespaces[e],e);for(let e of this.namespaces.values())if(t[e])for(let i of Object.keys(t[e]))this.behaviors[`${e}:${i}`]=t[e][i];if(t.functions)for(let e of Object.keys(t.functions))this.utilities[e]=t.functions[e];t.handlers&&console.log("Behavior handlers are no longer used."),t.fallbacks&&console.log("Fallback behaviors are no longer used.")}function He(t,e,i){let n;if(t===Object(t))for(let r of Object.keys(t))this.namespaces.has(t[r])||(this.namespaces.set(t[r],r),n=r);else n=t;this.behaviors[`${n}:${e}`]=i}function Re(t,e){let i;if(t===Object(t))for(let n of Object.keys(t))this.namespaces.has(t[n])||(this.namespaces.set(t[n],n),i=n);else i=t;delete this.behaviors[`${i}:${e}`]}function ze(t,e){const i=t.documentElement;let n=1,r=function(a){return e.has(a.namespaceURI?a.namespaceURI:"")||e.set(a.namespaceURI,"ns"+n++),e.get(a.namespaceURI?a.namespaceURI:"")+":"+a.localName};const o=new Set(Array.from(i.querySelectorAll("*"),r));return o.add(r(i)),o}function qe(t){return Array.from(t.querySelectorAll("*[data-origname]"),e=>e.localName.replace(/(\w+)-.+/,"$1:")+e.getAttribute("data-origname"))}class g{constructor(e){this.options=e||{},this.document=this.options.documentObject?this.options.documentObject:void 0,this.document===void 0&&(typeof window<"u"&&window.document?this.document=window.document:typeof global<"u"&&global.document&&(this.document=global.document)),this.addBehaviors=De.bind(this),this.addBehavior=He.bind(this),this.removeBehavior=Re.bind(this),this.utilities={};for(const i of Object.keys(j))["getPrefixDef","rw","resolveURI"].includes(i)?this.utilities[i]=j[i].bind(this):this.utilities[i]=j[i];if(this.els=[],this.namespaces=new Map,this.behaviors={},this.hasStyle=!1,this.prefixDefs=[],this.debug=this.options.debug===!0,this.discardContent=this.options.discardContent===!0,this.options.base)this.base=this.options.base;else try{window&&(this.base=window.location.href.replace(/\/[^\/]*$/,"/"))}catch{this.base=""}this.options.omitDefaultBehaviors||this.addBehaviors(Te),this.options.ignoreFragmentId&&window&&window.removeEventListener("ceteiceanload",g.restorePosition)}getHTML5(e,i,n){return window&&window.location.href.startsWith(this.base)&&e.indexOf("/")>=0&&(this.base=e.replace(/\/[^\/]*$/,"/")),new Promise(function(o,a){let s=new XMLHttpRequest;s.open("GET",e),s.send(),s.onload=function(){this.status>=200&&this.status<300?o(this.response):a(this.statusText)},s.onerror=function(){a(this.statusText)}}).catch(function(o){console.log("Could not get XML file."),this.debug&&console.log(o)}).then(o=>this.makeHTML5(o,i,n))}makeHTML5(e,i,n){return this.XML_dom=new DOMParser().parseFromString(e,"text/xml"),this.domToHTML5(this.XML_dom,i,n)}preprocess(e,i,n){this.els=ze(e,this.namespaces);let r=o=>{let a;if(this.namespaces.has(o.namespaceURI?o.namespaceURI:"")){let s=this.namespaces.get(o.namespaceURI?o.namespaceURI:"");a=this.document.createElement(`${s}-${o.localName}`)}else a=this.document.importNode(o,!1);for(let s of Array.from(o.attributes))s.name=="xmlns"?a.setAttribute("data-xmlns",s.value):a.setAttribute(s.name,s.value),s.name=="xml:id"&&a.setAttribute("id",s.value),s.name=="xml:lang"&&a.setAttribute("lang",s.value),s.name=="rendition"&&a.setAttribute("class",s.value.replace(/#/g,""));if(a.setAttribute("data-origname",o.localName),o.hasAttributes()&&a.setAttribute("data-origatts",o.getAttributeNames().join(" ")),o.childNodes.length==0&&a.setAttribute("data-empty",""),o.localName=="head"){let s=e.evaluate("count(ancestor::*[tei:head])",o,function(d){if(d=="tei")return"http://www.tei-c.org/ns/1.0"},1,null);a.setAttribute("data-level",s.numberValue)}if(o.localName=="tagsDecl"){let s=this.document.createElement("style");for(let d of Array.from(o.childNodes))if(d.nodeType==1&&d.localName=="rendition"&&d.getAttribute("scheme")=="css"){let l="";d.hasAttribute("selector")?(l+=d.getAttribute("selector").replace(/([^#, >]+\w*)/g,"tei-$1").replace(/#tei-/g,"#")+`{ `,l+=d.textContent):(l+="."+d.getAttribute("xml:id")+`{ `,l+=d.textContent),l+=` } -`,s.appendChild(this.document.createTextNode(l))}s.childNodes.length>0&&(a.appendChild(s),this.hasStyle=!0)}o.localName=="prefixDef"&&(this.prefixDefs.push(o.getAttribute("ident")),this.prefixDefs[o.getAttribute("ident")]={matchPattern:o.getAttribute("matchPattern"),replacementPattern:o.getAttribute("replacementPattern")});for(let s of Array.from(o.childNodes))s.nodeType==1?a.appendChild(r(s)):a.appendChild(s.cloneNode());return n&&n(a,o),a};if(this.dom=r(e.documentElement),this.utilities.dom=this.dom,i)i(this.dom,this),window&&window.dispatchEvent(T);else return typeof window<"u"&&window.dispatchEvent(T),this.dom}domToHTML5(e,i,n){if(this.preprocess(e,null,n),this.applyBehaviors(),this.done=!0,i)i(this.dom,this),window&&window.dispatchEvent(T);else return typeof window<"u"&&window.dispatchEvent(T),this.dom}processPage(){this.els=ze(this.document),this.applyBehaviors()}unsetNamespace(e){this.namespaces.delete(e)}setBaseUrl(e){this.base=e}append(e,i){let n=this;if(i){let r=e.call(n.utilities,i);r&&!n.childExists(i.firstElementChild,r.nodeName)&&n.appendBasic(i,r)}else return function(){if(!this.hasAttribute("data-processed")){let r=e.call(n.utilities,this);r&&!n.childExists(this.firstElementChild,r.nodeName)&&n.appendBasic(this,r)}}}appendBasic(e,i){this.discardContent?e.innerHTML="":Y(e,!0),e.appendChild(i)}bName(e){return e.tagName.substring(0,e.tagName.indexOf("-")).toLowerCase()+":"+e.getAttribute("data-origname")}childExists(e,i){return e&&e.nodeName==i?!0:e&&e.nextElementSibling&&this.childExists(e.nextElementSibling,i)}decorator(e){if(Array.isArray(e)&&e.length==0)return function(n){};if(Array.isArray(e)&&!Array.isArray(e[0]))return this.applyDecorator(e);let i=this;return function(n){for(let r of e)if(n.matches(r[0])||r[0]==="_")return Array.isArray(r[1])?i.decorator(r[1]).call(this,n):r[1].call(this,n)}}applyDecorator(e){let i=this;return function(n){let r=[];for(let o=0;o]+>")&&i[1]&&i[1].match("<[^>]+>"))n.innerHTML=i[0]+e.innerHTML+(i[1]?i[1]:"");else{n.innerHTML=i[0],n.setAttribute("data-before",i[0].replace(/<[^>]+>/g,"").length);for(let r of Array.from(e.childNodes))n.appendChild(r.cloneNode(!0));i.length>1&&(n.innerHTML+=i[1],n.setAttribute("data-after",i[1].replace(/<[^>]+>/g,"").length))}return n}processElement(e){if(e.hasAttribute("data-origname")&&!e.hasAttribute("data-processed")){let i=this.getFallback(this.bName(e));i&&(this.append(i,e),e.setAttribute("data-processed",""))}for(let i of Array.from(e.childNodes))i.nodeType===1&&this.processElement(i)}template(e,i){let n=e;if(e.search(/\$(\w*)(@([a-zA-Z:]+))/)){let r=/\$(\w*)@([a-zA-Z:]+)/g,o;for(;o=r.exec(e);)i.hasAttribute(o[2])?o[1]&&this.utilities[o[1]]?n=n.replace(o[0],this.utilities[o[1]](i.getAttribute(o[2]))):n=n.replace(o[0],i.getAttribute(o[2])):n=n.replace(o[0],"")}return n}applyBehaviors(){typeof window<"u"&&window.customElements?this.define.call(this,this.els):this.fallback.call(this,this.els)}define(e){for(let i of e){const n=this.getHandler(this.behaviors,i);Z(i,n,this.debug)}}fallback(e){for(let i of e){let n=this.getFallback(this.behaviors,i);if(n)for(let r of Array.from((this.dom&&!this.done?this.dom:this.document).getElementsByTagName(C(i))))r.hasAttribute("data-processed")||this.append(n,r)}}static savePosition(){window.sessionStorage.setItem(window.location+"-scroll",window.scrollY)}static restorePosition(){if(window.location.hash)setTimeout(function(){let e=this.document.querySelector(window.decodeURI(window.location.hash));e&&e.scrollIntoView()},100);else{let e;(e=window.sessionStorage.getItem(window.location+"-scroll"))&&setTimeout(function(){window.scrollTo(0,e)},100)}}}try{if(typeof window<"u"){window.CETEI=g,window.addEventListener("beforeunload",g.savePosition);var T=new Event("ceteiceanload");window.addEventListener("ceteiceanload",g.restorePosition)}}catch(t){console.log(t)}function X(t){let e=t.split(" "),i=[];for(let n of e)i.push(n.split(",").map(r=>parseInt(r)));return i}function qe(t){const[e,i,n,r]=[t.getAttribute("ulx"),t.getAttribute("uly"),t.getAttribute("lrx"),t.getAttribute("lry")];return[[parseInt(e),parseInt(i)],[parseInt(n),parseInt(r)]]}function M(t,e){let i={};if(t===null)throw new Error(`Could not find metadata for entity with reference ${e}`);for(const n of t.children)if(n.getAttribute("data-origname")==="ptr")i.authority={provider:n.getAttribute("type"),url:n.getAttribute("target")};else if(n.getAttribute("data-origname")==="event"){let r="event";n.getAttribute("type")!=null&&(r=n.getAttribute("type"));let o=n.children[0].innerHTML;n.getAttribute("when")!=null&&(o=n.getAttribute("when")),i[r]=o}else if(n.getAttribute("data-origname")==="idno"&&n.getAttribute("type")!=null){let r={};r.provider=n.getAttribute("type"),r.id=n.innerHTML,n.getAttribute("target")!=null?r.url=n.getAttribute("target"):t.getAttribute("corresp")!=null&&(r.url=t.getAttribute("corresp")),i.authority=r}else i[n.getAttribute("data-origname")]=n.innerHTML;return Object.keys(i).includes("authority")||(t.getAttribute("corresp")!=null&&t.getAttribute("corresp")!=""?i.otherURL=t.getAttribute("corresp"):i.noURL=!0),i}function D(t,e,i){let n;if(i.addLink!=""&&i.addLink!=!1&&i.addLink!="none"){if(n=document.createElement("a"),i.addLink==="authority")if(e.authority)n.setAttribute("href",e.authority.url);else if(e.otherURL)n.setAttribute("href",e.otherURL);else throw new Error(`${JSON.stringify(e)} does not have any authority or authority-like URL`);else if(i.addLink==="document")n.setAttribute("href",`/${t.getAttribute("ref")}`);else throw new Error('Invalid option: addLink must be either "authority", "document", "none", or false (boolean)');for(let r of t.childNodes)n.appendChild(r.cloneNode())}return n}function K(t){const e=t.getElementsByTagName("TEI-NOTE")[0];return t.getElementsByTagName("TEI-NOTE")[0].remove(),e}function H(t,e,i){let n=document.createElement("a");n.setAttribute("id",`src-note-${e}`),n.setAttribute("href",`#${i}`),n.innerHTML=e;let r=document.createElement("span");r.innerHTML=t.innerHTML;let o=document.createElement("sup");return o.append(n),r.append(o),r}function R(t){let e=document.getElementById("teiContainer"),i=e.querySelector("#document-notes"),n=1;i?n=Array.from(i.children).length+1:(i=document.createElement("ol"),i.setAttribute("id","document-notes"),e.append(i));let r=document.createElement("li");const o=`target-note-${n}`;r.setAttribute("id",o),r.append(t);let a=document.createElement("a");return a.setAttribute("href",`#src-note-${n}`),a.innerHTML=" ^ ",r.append(a),i.append(r),{targetId:o,noteIndex:n}}function Q(t,e=!1){let i={},n={},r={};if(r.type=t.getAttribute("type"),e){const o=t.children;if(o.length>0)for(const a of o){const s={};for(const l of a.children){const u=l.tagName.toLowerCase().split("-")[1];s[u]=l.innerText}const d=a.tagName.toLowerCase().split("-")[1];i[d]=s}else n=t.innerText;Object.keys(i).length>0?r.note={...i}:r.note=n}else r.note=t.innerText;return r}function ee(t,e){if(e.render==="inline"||!e.useOriginal)if(e.marker.length===2)t.before(e.marker[0]),t.after(e.marker[1]),t.classList.add("intervention");else throw new Error(`You must provide a starting and an ending marker. Provided: ${e.marker}`)}function Ue(t,e){if(e.marker.length===2)t.insertAdjacentText("afterbegin",e.marker[0]),t.insertAdjacentText("beforeend",e.marker[1]),t.classList.add("intervention");else throw new Error(`You must provide a starting and an ending marker. Provided: ${e.marker}`)}function te(t,e){let i,n,r,o="expanded",a="expansion";for(const s of t.children)(s.tagName.toLowerCase()==="tei-expan"||s.tagName.toLowerCase()==="tei-corr")&&(n=s.innerText,e.useOriginal&&(r=s),s.tagName.toLowerCase()==="tei-corr"&&(a="correction",o="corrected")),(s.tagName.toLowerCase()==="tei-abbr"||s.tagName.toLowerCase()==="tei-sic")&&(i=s.innerText,e.useOriginal||(r=s));if(r&&r.remove(),n!=null){let s={bubbles:!0,detail:{[a]:{original:i,[o]:n}}},d=new CustomEvent("choiceHover",s);t.onmouseenter=function(){dispatchEvent(d)},t.classList.add("event"),t.setAttribute("behaviour-processed",!0)}else throw new Error(`Could not find an editorial intervention for ${t.innerText}`)}function Fe(t){for(const e of t.children){const i=e.querySelectorAll('[class="iso-date"]');let n={};if(i.length>1){for(const[r,o]of i.entries())Object.keys(n).includes(o.innerText)?n[o.innerText]=[...n[o.innerText],r]:n[o.innerText]=[r];for(const r of Object.keys(n)){let o;if(n[r].pop(),o=n[r],o){for(const a of o)i[a].remove();console.warn(`Removing duplicate dates of${r}...`)}}}}}function Ve(t){const e=t.getElementsByTagName("tei-figDesc");let i=[];for(const n of e)i.push(n.innerText);return i}function Ge(t,e){const i=t.getElementsByTagName("tei-ab");for(const n of i)e.push(n.children);return e}let ie=function(t){return{ab:[["tei-body tei-ab",function(e){let i=e.childNodes,n=[],r="";for(let a of i)if(a.tagName==="TEI-LB"){r!=""&&(n.push(r),r=""),r=document.createElement("span"),r.classList.add("line-span"),r.appendChild(a.cloneNode(!0));let s={},d=a.getAttribute("facs"),l=document.getElementById(d.slice(1)),u=l.getAttribute("points"),c=X(u),L=l.getAttribute("rendition");s[L]={id:l.id,points:c};let b={};const f=l.parentElement;let Ke=X(f.getAttribute("points"));b[f.getAttribute("rendition")]={points:Ke,id:f.id};let z={};const q=f.parentElement;let re=[];for(a of q.children)a.tagName==="TEI-GRAPHIC"&&re.push({url:a.getAttribute("url"),width:a.getAttribute("width"),height:a.getAttribute("height")});if(z.Facsimile={id:q.id,imgFiles:re,points:qe(q)},t.customEvents){let Qe={bubbles:!0,detail:{...s,...b,...z}},et=new CustomEvent("drawBox",Qe);r.onmouseenter=function(){dispatchEvent(et)}}t.elementAttribute&&r.setAttribute("line-data",JSON.stringify({...s,...b,...z}))}else r!=""&&r.appendChild(a.cloneNode(!0));n.push(r);let o=document.createElement("div");for(let a of n)o.appendChild(a);return t.removeDuplicatesWorkaround&&Fe(o),o}]],add:function(e){if(t.customEvents){e.classList.add("event");let i=e.getAttribute("place");i||(i="not recorded");const n={place:i};let r=new CustomEvent("addHover",{bubbles:!0,detail:{...n}});e.onmouseenter=function(){dispatchEvent(r)}}},choice:function(e){const i=["inline","event"];let n;if(e.children.length>1){if(e.getElementsByTagName("tei-corr").length>0?n=!1:n=!0,n)if(i.includes(t.abbreviations.render))t.abbreviations.render==="inline"||t.abbreviations.render==="event"&&!e.getAttribute("behaviour-processed")&&te(e,t.abbreviations);else throw new Error(`'${t.abbreviations.render}' is not a valid rendering option. Valid options are: '${i}'`);else if(!n)if(i.includes(t.corrections.render))t.corrections.render==="inline"||t.corrections.render==="event"&&!e.getAttribute("behaviour-processed")&&te(e,t.corrections);else throw new Error(`'${t.corrections.render}' is not a valid rendering option. Valid options are: '${i}'`)}else console.warn(`The element ${e.outerHTML} contains only one child -- a choice must contain at least two.`)},corr:function(e){ee(e,t.corrections)},damage:function(e){if(t.customEvents){e.classList.add("event");let i=e.getAttribute("type");i||(i="not recorded");const n={agent:i};let r=new CustomEvent("damageHover",{bubbles:!0,detail:{...n}});e.onmouseenter=function(){dispatchEvent(r)}}},date:function(e){let i=!0;if(e.parentElement&&e.parentElement.tagName.toLowerCase()==="tei-bibl"&&t.ignoreBibliography&&(i=!1,console.warn("Ignoring date in bibliographic reference...")),i){let n=["[","]"];if(t.showISODate)if(t.marker.length!=2?console.warn("Markers for are not correctly formatted, using default"):n=t.marker,!e.getAttribute("when"))console.warn(`${e.outerHTML} does not contain an ISO Date (@when) attribute`);else{const r=document.createElement("span");r.classList.add("iso-date"),r.innerText=` ${n[0]}${e.getAttribute("when")}${n[1]}`,e.appendChild(r)}}},del:function(e){if(!["inline","event"].includes(t.render))console.error(`${t.render} is not a valid rendering option for elements, using defaults instead`);else if(t.render==="inline")e.style.textDecoration="line-through";else if(t.render==="event"){Ue(e,t);let n=new CustomEvent("delHover",{bubbles:!0,detail:{rendition:e.getAttribute("rend")}});e.classList.add("event"),e.onmouseenter=function(){dispatchEvent(n)}}},expan:function(e){ee(e,t.abbreviations)},figure:function(e){let i=Ve(e);t.showAb&&(i=Ge(e,i));let n=document.createElement("span");n.classList.add("figure-description-group");for(const r of i){const o=document.createElement("span");o.classList.add("figure-description"),typeof r=="string"?o.appendChild(document.createTextNode(r)):typeof r=="object"&&Array.from(r).forEach(a=>o.appendChild(a)),n.appendChild(o)}if(t.placeholder){let r=document.createElement("div");r.classList.add("figure-placeholder");let o;if(t.placeholderType==="text"?(o=document.createElement("span"),o.classList.add("text-placeholder"),o.appendChild(document.createTextNode("[FIGURE]"))):t.placeholderType==="icon"?(o=document.createElement("img"),o.setAttribute("height",t.sizeIcon),o.setAttribute("width",t.sizeIcon),o.setAttribute("src","./dist/TeiConverter/imgPlaceholder.png")):console.error(`${t.placeholderType} is not a valid option; valid options are 'text' or 'icon'`),r.appendChild(o),t.descPosition==="inline"){const a=document.createElement("div");a.append(...n.children),n.remove(),a.classList.add("figure-description-group"),r.appendChild(a)}else if(t.descPosition==="footnote"){n.prepend(document.createTextNode("Description of figure: "));const{targetId:a,noteIndex:s}=R(n);r=H(r,s,a)}else console.error(`${t.descPosition} is not a valid option; valid options are 'inline' or 'footnote'`);return r}else if(!t.placeholder&&t.image.loadIfAvailable){const r=e.getElementsByTagName("tei-graphic");if(r.length>0)for(const o of r){const a=document.createElement("figure");a.classList.add("inline-figure-container");const s=document.createElement("figcaption");s.append(n);const d=o.getAttribute("url"),l=document.createElement("img");return l.setAttribute("src",d),t.image.fitToContainer&&l.setAttribute("style","width: 100%; height: 100%; object-fit: contain;"),a.appendChild(l),a.appendChild(s),a}else console.error("Could not find an element inside
")}},graphic:function(e){t.showLogs&&console.log("ignoring graphics")},gap:function(e){if(e.append(document.createTextNode(t.marker)),t.render==="event"){let i=new CustomEvent("gapHover",{bubbles:!0,detail:{reason:e.getAttribute("reason")}});e.classList.add("event"),e.onmouseenter=function(){dispatchEvent(i)}}else console.error(`${t.render} is not a valid rendering option. Valid options are: 'event'.`)},note:function(e){},listOrg:function(e){t.showOrgs||(e.hidden=!0)},listPerson:function(e){t.showPeople||(e.hidden=!0)},listPlace:function(e){t.showPlaces||(e.hidden=!0)},orgName:[["tei-orgname[ref]",function(e){let i,n;e.getAttribute("ref").includes("#")?i=e.getAttribute("ref").substring(1):(console.warn(`Looks like ${e.getAttribute("ref")} might be missing an initial '#'. Adding '#' and trying again...`),i=e.getAttribute("ref"));const r=document.getElementById(i);try{n=M(r,i)}catch(a){console.warn(a)}if(t.customEvents){let a=new CustomEvent("orgHover",{detail:{...n}});e.onmouseenter=function(){dispatchEvent(a)}}t.elementAttribute&&e.setAttribute("org-data",JSON.stringify(n));let o;try{o=D(e,n,t)}catch{console.warn(`Could not turn element with ref ${i} into a link; dataObject has no valid URL`)}if(o!=null)return o}]],placeName:[["tei-placename[ref]",function(e){let i;e.getAttribute("ref").includes("#")?i=e.getAttribute("ref").substring(1):(console.warn(`Looks like ${e.getAttribute("ref")} might be missing an initial '#'. Adding '#' and trying again...`),i=e.getAttribute("ref"));const n=document.getElementById(i),r=M(n);if(t.customEvents){let a=new CustomEvent("placeHover",{bubbles:!0,detail:{...r}});e.onmouseenter=function(){dispatchEvent(a)},e.classList.add("event")}t.elementAttribute&&e.setAttribute("place-data",JSON.stringify(r));let o;try{o=D(e,r,t)}catch{console.warn(`Could not turn element with ref ${i} into a link; dataObject has no valid URL`)}if(o!=null)return o}]],persName:[["tei-persName[ref]",function(e){let i;e.getAttribute("ref").includes("#")?i=e.getAttribute("ref").substring(1):(console.warn(`Looks like ${e.getAttribute("ref")} might be missing an initial '#'. Adding '#' and trying again...`),i=e.getAttribute("ref"));const n=document.getElementById(i),r=M(n);if(t.customEvents){let a=new CustomEvent("persHover",{bubbles:!0,detail:{...r}});e.onmouseenter=function(){dispatchEvent(a)},e.classList.add("event")}t.elementAttribute&&e.setAttribute("pers-data",JSON.stringify(r));let o;try{o=D(e,r,t)}catch{console.warn(`Could not turn element with ref ${i} into a link; dataObject has no valid URL`)}if(o!=null)return o}]],seg:[["[type=bibliographicNote-target-text]",function(e){const i=K(e),n=["endnote","inline","event"];if(t.bibliographicNotes.include)if(n.includes(t.bibliographicNotes.render)){if(t.bibliographicNotes.render==="endnote"){const{targetId:r,noteIndex:o}=R(i);return H(e,o,r)}else if(t.bibliographicNotes.render==="inline")i.setAttribute("class","note-text"),e.appendChild(i);else if(t.bibliographicNotes.render==="event"){const r=Q(i,t.bibliographicNotes.structured);let o=new CustomEvent("noteHover",{bubbles:!0,detail:{...r}});e.onmouseenter=function(){dispatchEvent(o)},e.classList.add("event")}}else throw new Error(`'${t.bibliographicNotes.render}' is not a valid rendering option. Valid options are: '${n}'`)}],["[type=editorialNote-target-text]",function(e){const i=K(e),n=["endnote","inline","event"];if(t.editorialNotes.include)if(n.includes(t.editorialNotes.render)){if(t.editorialNotes.render==="endnote"){const{targetId:r,noteIndex:o}=R(i);return H(e,o,r)}else if(t.editorialNotes.render==="inline")i.setAttribute("class","note-text"),e.appendChild(i);else if(t.editorialNotes.render==="event"){const r=Q(i,t.editorialNotes.structured);let o=new CustomEvent("noteHover",{bubbles:!0,detail:{...r}});e.onmouseenter=function(){dispatchEvent(o)},e.classList.add("event")}}else throw new Error(`'${t.editorialNotes.render}' is not a valid rendering option. Valid options are: '${n}'`)}],["tei-seg",function(e){console.warn(`No custom behaviour for with type "${e.getAttribute("type")}" has been defined`)}]],standOff:function(e){const i=["top","bottom"];if(t.showStandOffMetadata||(e.hidden=!0),i.includes(t.standOffPosition))t.standOffPosition==="bottom"&&e.parentNode.appendChild(e);else throw e.hidden=!0,new Error(`${t.standOffPosition} is not a valid position for the standOff element. Valid positions are 'top' and 'bottom'.`)}}},Je=function(t){let e={tei:{}};for(const[i,n]of Object.entries(t.elementsSelected)){let r={...n.options};n.include&&(i==="ab"&&(t.teiFileStructure==="EvolvingHands"?r={...r,...t.facsimileCoordinates,...t.dates}:r={...r,customEvents:!1,elementAttribute:!1,...t.dates}),(i==="standOff"||i==="listOrg"||i==="listPerson"||i==="listPlace")&&(r={...r,...t.standOffMetadata}),i==="orgName"&&(r={...r,...t.orgData}),i==="placeName"&&(r={...r,...t.placeData}),i==="persName"&&(r={...r,...t.persData}),i==="seg"&&(r={...r,...t.notes}),(i==="choice"||i==="abbr"||i==="expan"||i==="sic"||i==="corr")&&(r={...r,...t.choice}),i==="add"&&(r={...r,...t.additions}),i==="damage"&&(r={...r,...t.damage}),i==="date"&&(r={...r,...t.dates}),i==="del"&&(r={...r,...t.deletions}),i==="figure"&&(r={...r,...t.figures}),i==="gap"&&(r={...r,...t.gap}),e.tei[i]=ie(r)[i])}if(!t.displayInlineGraphics){let i={};Object.keys(t.elementsSelected).includes("graphic")&&(i=t.elementsSelected.graphic.options),e.tei.graphic=ie(i).graphic}if(t.addCustomBehaviours.applyCustomBehaviours)try{for(const[i,n]of Object.entries(customBehaviours))try{(t.addCustomBehaviours.applyAll||t.addCustomBehaviours.applyElements.includes(i))&&(e.tei[i]=n,t.addCustomBehaviours.showLogs&&console.log(`Added ${i} behaviour`))}catch{console.warn(`Could not add custom behaviour for element ${i}`)}}catch{console.error("Error: custom behaviours must be in a variable called customBehaviours")}return e};const We={useCustomBehaviours:!0,displayInlineGraphics:!1,teiFileStructure:"EvolvingHands",facsimileCoordinates:{customEvents:!0,elementAttribute:!1},additions:{customEvents:!0},choice:{abbreviations:{render:"event",marker:["[","]"],useOriginal:!0},corrections:{render:"event",marker:["[","]"],useOriginal:!1}},damage:{customEvents:!0},dates:{showISODate:!0,marker:["[","]"],ignoreBibliography:!0,removeDuplicatesWorkaround:!0},deletions:{render:"event",marker:["[","]"]},figures:{placeholder:!0,placeholderType:"icon",sizeIcon:150,descPosition:"inline",showAb:!0,image:{loadIfAvailable:!1,fitToContainer:!0}},gap:{render:"event",marker:"[…]"},notes:{bibliographicNotes:{include:!0,render:"event",structured:!0},editorialNotes:{include:!0,render:"event",structured:!0}},orgData:{customEvents:!0,elementAttribute:!1},placeData:{customEvents:!0,elementAttribute:!1},persData:{customEvents:!0,elementAttribute:!1},standOffMetadata:{showStandOffMetadata:!1,showOrgs:!1,showPeople:!1,showPlaces:!1,standOffPosition:"top"},elementsSelected:{ab:{include:!0,options:{}},add:{include:!0},abbr:{include:!0},choice:{include:!0},corr:{include:!0},damage:{include:!0},date:{include:!0},del:{include:!0},expan:{include:!0},figure:{include:!0},gap:{include:!0},graphic:{include:!0,options:{showLogs:!1}},listOrg:{include:!0},listPerson:{include:!0},listPlace:{include:!0},note:{include:!0},orgName:{include:!0,options:{addLink:"authority"}},placeName:{include:!0,options:{addLink:"authority"}},persName:{include:!0,options:{addLink:!1}},seg:{include:!0},sic:{include:!0},standOff:{include:!0}},addCustomBehaviours:{applyCustomBehaviours:!1,applyAll:!1,applyElements:"['persName', 'placeName', 'seg']",showLogs:!0}};function ne(t){let e,i;return{c(){e=O("p"),i=le(t[0]),E(e,"data-testid","error-message")},m(n,r){_(n,e,r),se(e,i)},p(n,r){r&1&&ce(i,n[0])},d(n){n&&k(e)}}}function Ye(t){let e,i=t[0]&&ne(t);return{c(){e=O("div"),i&&i.c(),E(e,"id","TEI-container"),E(e,"data-testid","TEI-container")},m(n,r){_(n,e,r),i&&i.m(e,null)},p(n,[r]){n[0]?i?i.p(n,r):(i=ne(n),i.c(),i.m(e,null)):i&&(i.d(1),i=null)},i:w,o:w,d(n){n&&k(e),i&&i.d()}}}function Ze(t,e,i){let{path:n=""}=e,{configPath:r="TeiConverter/TeiConverter.config.json"}=e,o,a=!1,s;return me(async()=>{try{s=await fetch(r).then(l=>l.json())}catch(l){console.log("Could not load config file, using default values",l);try{s=We}catch(u){console.log("Could not load default values",u)}}try{if(n==="")throw"No path specified";var d=new g;s.useCustomBehaviours&&d.addBehaviors(Je(s)),d.getHTML5(n,function(l){document.getElementById("TEI-container").appendChild(l)}),a=!0}catch(l){i(0,o=l.toString()),a=!0;return}}),t.$$set=d=>{"path"in d&&i(1,n=d.path),"configPath"in d&&i(2,r=d.configPath)},[o,n,r]}class Xe extends xe{constructor(e){super(),ke(this,e,Ze,Ye,oe,{path:1,configPath:2})}get path(){return this.$$.ctx[1]}set path(e){this.$$set({path:e}),x()}get configPath(){return this.$$.ctx[2]}set configPath(e){this.$$set({configPath:e}),x()}}customElements.define("tei-converter",Ee(Xe,{path:{},configPath:{}},[],[],!1))}); +`,s.appendChild(this.document.createTextNode(l))}s.childNodes.length>0&&(a.appendChild(s),this.hasStyle=!0)}o.localName=="prefixDef"&&(this.prefixDefs.push(o.getAttribute("ident")),this.prefixDefs[o.getAttribute("ident")]={matchPattern:o.getAttribute("matchPattern"),replacementPattern:o.getAttribute("replacementPattern")});for(let s of Array.from(o.childNodes))s.nodeType==1?a.appendChild(r(s)):a.appendChild(s.cloneNode());return n&&n(a,o),a};if(this.dom=r(e.documentElement),this.utilities.dom=this.dom,i)i(this.dom,this),window&&window.dispatchEvent(T);else return typeof window<"u"&&window.dispatchEvent(T),this.dom}domToHTML5(e,i,n){if(this.preprocess(e,null,n),this.applyBehaviors(),this.done=!0,i)i(this.dom,this),window&&window.dispatchEvent(T);else return typeof window<"u"&&window.dispatchEvent(T),this.dom}processPage(){this.els=qe(this.document),this.applyBehaviors()}unsetNamespace(e){this.namespaces.delete(e)}setBaseUrl(e){this.base=e}append(e,i){let n=this;if(i){let r=e.call(n.utilities,i);r&&!n.childExists(i.firstElementChild,r.nodeName)&&n.appendBasic(i,r)}else return function(){if(!this.hasAttribute("data-processed")){let r=e.call(n.utilities,this);r&&!n.childExists(this.firstElementChild,r.nodeName)&&n.appendBasic(this,r)}}}appendBasic(e,i){this.discardContent?e.innerHTML="":Y(e,!0),e.appendChild(i)}bName(e){return e.tagName.substring(0,e.tagName.indexOf("-")).toLowerCase()+":"+e.getAttribute("data-origname")}childExists(e,i){return e&&e.nodeName==i?!0:e&&e.nextElementSibling&&this.childExists(e.nextElementSibling,i)}decorator(e){if(Array.isArray(e)&&e.length==0)return function(n){};if(Array.isArray(e)&&!Array.isArray(e[0]))return this.applyDecorator(e);let i=this;return function(n){for(let r of e)if(n.matches(r[0])||r[0]==="_")return Array.isArray(r[1])?i.decorator(r[1]).call(this,n):r[1].call(this,n)}}applyDecorator(e){let i=this;return function(n){let r=[];for(let o=0;o]+>")&&i[1]&&i[1].match("<[^>]+>"))n.innerHTML=i[0]+e.innerHTML+(i[1]?i[1]:"");else{n.innerHTML=i[0],n.setAttribute("data-before",i[0].replace(/<[^>]+>/g,"").length);for(let r of Array.from(e.childNodes))n.appendChild(r.cloneNode(!0));i.length>1&&(n.innerHTML+=i[1],n.setAttribute("data-after",i[1].replace(/<[^>]+>/g,"").length))}return n}processElement(e){if(e.hasAttribute("data-origname")&&!e.hasAttribute("data-processed")){let i=this.getFallback(this.bName(e));i&&(this.append(i,e),e.setAttribute("data-processed",""))}for(let i of Array.from(e.childNodes))i.nodeType===1&&this.processElement(i)}template(e,i){let n=e;if(e.search(/\$(\w*)(@([a-zA-Z:]+))/)){let r=/\$(\w*)@([a-zA-Z:]+)/g,o;for(;o=r.exec(e);)i.hasAttribute(o[2])?o[1]&&this.utilities[o[1]]?n=n.replace(o[0],this.utilities[o[1]](i.getAttribute(o[2]))):n=n.replace(o[0],i.getAttribute(o[2])):n=n.replace(o[0],"")}return n}applyBehaviors(){typeof window<"u"&&window.customElements?this.define.call(this,this.els):this.fallback.call(this,this.els)}define(e){for(let i of e){const n=this.getHandler(this.behaviors,i);Z(i,n,this.debug)}}fallback(e){for(let i of e){let n=this.getFallback(this.behaviors,i);if(n)for(let r of Array.from((this.dom&&!this.done?this.dom:this.document).getElementsByTagName(C(i))))r.hasAttribute("data-processed")||this.append(n,r)}}static savePosition(){window.sessionStorage.setItem(window.location+"-scroll",window.scrollY)}static restorePosition(){if(window.location.hash)setTimeout(function(){let e=this.document.querySelector(window.decodeURI(window.location.hash));e&&e.scrollIntoView()},100);else{let e;(e=window.sessionStorage.getItem(window.location+"-scroll"))&&setTimeout(function(){window.scrollTo(0,e)},100)}}}try{if(typeof window<"u"){window.CETEI=g,window.addEventListener("beforeunload",g.savePosition);var T=new Event("ceteiceanload");window.addEventListener("ceteiceanload",g.restorePosition)}}catch(t){console.log(t)}function X(t){let e=t.split(" "),i=[];for(let n of e)i.push(n.split(",").map(r=>parseInt(r)));return i}function Ue(t){const[e,i,n,r]=[t.getAttribute("ulx"),t.getAttribute("uly"),t.getAttribute("lrx"),t.getAttribute("lry")];return[[parseInt(e),parseInt(i)],[parseInt(n),parseInt(r)]]}function M(t,e){let i={};if(t===null)throw new Error(`Could not find metadata for entity with reference ${e}`);for(const n of t.children)if(n.getAttribute("data-origname")==="ptr")i.authority={provider:n.getAttribute("type"),url:n.getAttribute("target")};else if(n.getAttribute("data-origname")==="event"){let r="event";n.getAttribute("type")!=null&&(r=n.getAttribute("type"));let o=n.children[0].innerHTML;n.getAttribute("when")!=null&&(o=n.getAttribute("when")),i[r]=o}else if(n.getAttribute("data-origname")==="idno"&&n.getAttribute("type")!=null){let r={};r.provider=n.getAttribute("type"),r.id=n.innerHTML,n.getAttribute("target")!=null?r.url=n.getAttribute("target"):t.getAttribute("corresp")!=null&&(r.url=t.getAttribute("corresp")),i.authority=r}else i[n.getAttribute("data-origname")]=n.innerHTML;return Object.keys(i).includes("authority")||(t.getAttribute("corresp")!=null&&t.getAttribute("corresp")!=""?i.otherURL=t.getAttribute("corresp"):i.noURL=!0),i}function D(t,e,i){let n;if(i.addLink!=""&&i.addLink!=!1&&i.addLink!="none"){if(n=document.createElement("a"),i.addLink==="authority")if(e.authority)n.setAttribute("href",e.authority.url);else if(e.otherURL)n.setAttribute("href",e.otherURL);else throw new Error(`${JSON.stringify(e)} does not have any authority or authority-like URL`);else if(i.addLink==="document")n.setAttribute("href",`/${t.getAttribute("ref")}`);else throw new Error('Invalid option: addLink must be either "authority", "document", "none", or false (boolean)');for(let r of t.childNodes)n.appendChild(r.cloneNode())}return n}function K(t){const e=t.getElementsByTagName("TEI-NOTE")[0];return t.getElementsByTagName("TEI-NOTE")[0].remove(),e}function H(t,e,i){let n=document.createElement("a");n.setAttribute("id",`src-note-${e}`),n.setAttribute("href",`#${i}`),n.innerHTML=e;let r=document.createElement("span");r.innerHTML=t.innerHTML;let o=document.createElement("sup");return o.append(n),r.append(o),r}function R(t){let e=document.getElementById("teiContainer"),i=e.querySelector("#document-notes"),n=1;i?n=Array.from(i.children).length+1:(i=document.createElement("ol"),i.setAttribute("id","document-notes"),e.append(i));let r=document.createElement("li");const o=`target-note-${n}`;r.setAttribute("id",o),r.append(t);let a=document.createElement("a");return a.setAttribute("href",`#src-note-${n}`),a.innerHTML=" ^ ",r.append(a),i.append(r),{targetId:o,noteIndex:n}}function Q(t,e=!1){let i={},n={},r={};if(r.type=t.getAttribute("type"),e){const o=t.children;if(o.length>0)for(const a of o){const s={};for(const l of a.children){const u=l.tagName.toLowerCase().split("-")[1];s[u]=l.innerText}const d=a.tagName.toLowerCase().split("-")[1];i[d]=s}else n=t.innerText;Object.keys(i).length>0?r.note={...i}:r.note=n}else r.note=t.innerText;return r}function ee(t,e){if(e.render==="inline"||!e.useOriginal)if(e.marker.length===2)t.before(e.marker[0]),t.after(e.marker[1]),t.classList.add("intervention");else throw new Error(`You must provide a starting and an ending marker. Provided: ${e.marker}`)}function te(t,e){if(e.marker.length===2)t.insertAdjacentText("afterbegin",e.marker[0]),t.insertAdjacentText("beforeend",e.marker[1]),t.classList.add("intervention");else throw new Error(`You must provide a starting and an ending marker. Provided: ${e.marker}`)}function ie(t,e){let i,n,r,o="expanded",a="expansion";for(const s of t.children)(s.tagName.toLowerCase()==="tei-expan"||s.tagName.toLowerCase()==="tei-corr")&&(n=s.innerText,e.useOriginal&&(r=s),s.tagName.toLowerCase()==="tei-corr"&&(a="correction",o="corrected")),(s.tagName.toLowerCase()==="tei-abbr"||s.tagName.toLowerCase()==="tei-sic")&&(i=s.innerText,e.useOriginal||(r=s));if(r&&r.remove(),n!=null){let s={bubbles:!0,detail:{[a]:{original:i,[o]:n}}},d=new CustomEvent("choiceHover",s);t.onmouseenter=function(){dispatchEvent(d)},t.classList.add("event"),t.setAttribute("behaviour-processed",!0)}else throw new Error(`Could not find an editorial intervention for ${t.innerText}`)}function Fe(t){for(const e of t.children){const i=e.querySelectorAll('[class="iso-date"]');let n={};if(i.length>1){for(const[r,o]of i.entries())Object.keys(n).includes(o.innerText)?n[o.innerText]=[...n[o.innerText],r]:n[o.innerText]=[r];for(const r of Object.keys(n)){let o;if(n[r].pop(),o=n[r],o){for(const a of o)i[a].remove();console.warn(`Removing duplicate dates of${r}...`)}}}}}function Ve(t){const e=t.getElementsByTagName("tei-figDesc");let i=[];for(const n of e)i.push(n.innerText);return i}function Ge(t,e){const i=t.getElementsByTagName("tei-ab");for(const n of i)e.push(n.children);return e}let ne=function(t){return{ab:[["tei-body tei-ab",function(e){let i=e.childNodes,n=[],r="";for(let a of i)if(a.tagName==="TEI-LB"){r!=""&&(n.push(r),r=""),r=document.createElement("span"),r.classList.add("line-span"),r.appendChild(a.cloneNode(!0));let s={},d=a.getAttribute("facs"),l=document.getElementById(d.slice(1)),u=l.getAttribute("points"),c=X(u),L=l.getAttribute("rendition");s[L]={id:l.id,points:c};let b={};const f=l.parentElement;let Ke=X(f.getAttribute("points"));b[f.getAttribute("rendition")]={points:Ke,id:f.id};let z={};const q=f.parentElement;let oe=[];for(a of q.children)a.tagName==="TEI-GRAPHIC"&&oe.push({url:a.getAttribute("url"),width:a.getAttribute("width"),height:a.getAttribute("height")});if(z.Facsimile={id:q.id,imgFiles:oe,points:Ue(q)},t.customEvents){let Qe={bubbles:!0,detail:{...s,...b,...z}},et=new CustomEvent("drawBox",Qe);r.onmouseenter=function(){dispatchEvent(et)}}t.elementAttribute&&r.setAttribute("line-data",JSON.stringify({...s,...b,...z}))}else r!=""&&r.appendChild(a.cloneNode(!0));n.push(r);let o=document.createElement("div");for(let a of n)o.appendChild(a);return t.removeDuplicatesWorkaround&&Fe(o),o}]],add:function(e){if(t.customEvents){e.classList.add("event");let i=e.getAttribute("place");i||(i="not recorded");const n={place:i};let r=new CustomEvent("addHover",{bubbles:!0,detail:{...n}});e.onmouseenter=function(){dispatchEvent(r)}}},choice:function(e){const i=["inline","event"];let n;if(e.children.length>1){if(e.getElementsByTagName("tei-corr").length>0?n=!1:n=!0,n)if(i.includes(t.abbreviations.render))t.abbreviations.render==="inline"||t.abbreviations.render==="event"&&!e.getAttribute("behaviour-processed")&&ie(e,t.abbreviations);else throw new Error(`'${t.abbreviations.render}' is not a valid rendering option. Valid options are: '${i}'`);else if(!n)if(i.includes(t.corrections.render))t.corrections.render==="inline"||t.corrections.render==="event"&&!e.getAttribute("behaviour-processed")&&ie(e,t.corrections);else throw new Error(`'${t.corrections.render}' is not a valid rendering option. Valid options are: '${i}'`)}else console.warn(`The element ${e.outerHTML} contains only one child -- a choice must contain at least two.`)},corr:function(e){ee(e,t.corrections)},damage:function(e){if(t.customEvents){e.classList.add("event");let i=e.getAttribute("type");i||(i="not recorded");const n={agent:i};let r=new CustomEvent("damageHover",{bubbles:!0,detail:{...n}});e.onmouseenter=function(){dispatchEvent(r)}}},date:function(e){let i=!0;if(e.parentElement&&e.parentElement.tagName.toLowerCase()==="tei-bibl"&&t.ignoreBibliography&&(i=!1,console.warn("Ignoring date in bibliographic reference...")),i){let n=["[","]"];if(t.showISODate)if(t.marker.length!=2?console.warn("Markers for are not correctly formatted, using default"):n=t.marker,!e.getAttribute("when"))console.warn(`${e.outerHTML} does not contain an ISO Date (@when) attribute`);else{const r=document.createElement("span");r.classList.add("iso-date"),r.innerText=` ${n[0]}${e.getAttribute("when")}${n[1]}`,e.appendChild(r)}}},del:function(e){if(!["inline","event"].includes(t.render))console.error(`${t.render} is not a valid rendering option for elements, using defaults instead`);else if(t.render==="inline")e.style.textDecoration="line-through";else if(t.render==="event"){te(e,t);let n=new CustomEvent("delHover",{bubbles:!0,detail:{rendition:e.getAttribute("rend")}});e.classList.add("event"),e.onmouseenter=function(){dispatchEvent(n)}}},expan:function(e){ee(e,t.abbreviations)},figure:function(e){let i=Ve(e);t.showAb&&(i=Ge(e,i));let n=document.createElement("span");n.classList.add("figure-description-group");for(const r of i){const o=document.createElement("span");o.classList.add("figure-description"),typeof r=="string"?o.appendChild(document.createTextNode(r)):typeof r=="object"&&Array.from(r).forEach(a=>o.appendChild(a)),n.appendChild(o)}if(t.placeholder){let r=document.createElement("div");r.classList.add("figure-placeholder");let o;if(t.placeholderType==="text"?(o=document.createElement("span"),o.classList.add("text-placeholder"),o.appendChild(document.createTextNode("[FIGURE]"))):t.placeholderType==="icon"?(o=document.createElement("img"),o.setAttribute("height",t.sizeIcon),o.setAttribute("width",t.sizeIcon),o.setAttribute("src","./dist/TeiConverter/imgPlaceholder.png")):console.error(`${t.placeholderType} is not a valid option; valid options are 'text' or 'icon'`),r.appendChild(o),t.descPosition==="inline"){const a=document.createElement("div");a.append(...n.children),n.remove(),a.classList.add("figure-description-group"),r.appendChild(a)}else if(t.descPosition==="footnote"){n.prepend(document.createTextNode("Description of figure: "));const{targetId:a,noteIndex:s}=R(n);r=H(r,s,a)}else console.error(`${t.descPosition} is not a valid option; valid options are 'inline' or 'footnote'`);return r}else if(!t.placeholder&&t.image.loadIfAvailable){const r=e.getElementsByTagName("tei-graphic");if(r.length>0)for(const o of r){const a=document.createElement("figure");a.classList.add("inline-figure-container");const s=document.createElement("figcaption");s.append(n);const d=o.getAttribute("url"),l=document.createElement("img");return l.setAttribute("src",d),t.image.fitToContainer&&l.setAttribute("style","width: 100%; height: 100%; object-fit: contain;"),a.appendChild(l),a.appendChild(s),a}else console.error("Could not find an element inside
")}},graphic:function(e){t.showLogs&&console.log("ignoring graphics")},gap:function(e){if(e.append(document.createTextNode(t.marker)),t.render==="event"){let i=new CustomEvent("gapHover",{bubbles:!0,detail:{reason:e.getAttribute("reason")}});e.classList.add("event"),e.onmouseenter=function(){dispatchEvent(i)}}else console.error(`${t.render} is not a valid rendering option. Valid options are: 'event'.`)},note:function(e){},listOrg:function(e){t.showOrgs||(e.hidden=!0)},listPerson:function(e){t.showPeople||(e.hidden=!0)},listPlace:function(e){t.showPlaces||(e.hidden=!0)},orgName:[["tei-orgname[ref]",function(e){let i,n;e.getAttribute("ref").includes("#")?i=e.getAttribute("ref").substring(1):(console.warn(`Looks like ${e.getAttribute("ref")} might be missing an initial '#'. Adding '#' and trying again...`),i=e.getAttribute("ref"));const r=document.getElementById(i);try{n=M(r,i)}catch(a){console.warn(a)}if(t.customEvents){let a=new CustomEvent("orgHover",{detail:{...n}});e.onmouseenter=function(){dispatchEvent(a)}}t.elementAttribute&&e.setAttribute("org-data",JSON.stringify(n));let o;try{o=D(e,n,t)}catch{console.warn(`Could not turn element with ref ${i} into a link; dataObject has no valid URL`)}if(o!=null)return o}]],placeName:[["tei-placename[ref]",function(e){let i;e.getAttribute("ref").includes("#")?i=e.getAttribute("ref").substring(1):(console.warn(`Looks like ${e.getAttribute("ref")} might be missing an initial '#'. Adding '#' and trying again...`),i=e.getAttribute("ref"));const n=document.getElementById(i),r=M(n);if(t.customEvents){let a=new CustomEvent("placeHover",{bubbles:!0,detail:{...r}});e.onmouseenter=function(){dispatchEvent(a)},e.classList.add("event")}t.elementAttribute&&e.setAttribute("place-data",JSON.stringify(r));let o;try{o=D(e,r,t)}catch{console.warn(`Could not turn element with ref ${i} into a link; dataObject has no valid URL`)}if(o!=null)return o}]],persName:[["tei-persName[ref]",function(e){let i;e.getAttribute("ref").includes("#")?i=e.getAttribute("ref").substring(1):(console.warn(`Looks like ${e.getAttribute("ref")} might be missing an initial '#'. Adding '#' and trying again...`),i=e.getAttribute("ref"));const n=document.getElementById(i),r=M(n);if(t.customEvents){let a=new CustomEvent("persHover",{bubbles:!0,detail:{...r}});e.onmouseenter=function(){dispatchEvent(a)},e.classList.add("event")}t.elementAttribute&&e.setAttribute("pers-data",JSON.stringify(r));let o;try{o=D(e,r,t)}catch{console.warn(`Could not turn element with ref ${i} into a link; dataObject has no valid URL`)}if(o!=null)return o}]],seg:[["[type=bibliographicNote-target-text]",function(e){const i=K(e),n=["endnote","inline","event"];if(t.bibliographicNotes.include)if(n.includes(t.bibliographicNotes.render)){if(t.bibliographicNotes.render==="endnote"){const{targetId:r,noteIndex:o}=R(i);return H(e,o,r)}else if(t.bibliographicNotes.render==="inline")i.setAttribute("class","note-text"),e.appendChild(i);else if(t.bibliographicNotes.render==="event"){const r=Q(i,t.bibliographicNotes.structured);let o=new CustomEvent("noteHover",{bubbles:!0,detail:{...r}});e.onmouseenter=function(){dispatchEvent(o)},e.classList.add("event")}}else throw new Error(`'${t.bibliographicNotes.render}' is not a valid rendering option. Valid options are: '${n}'`)}],["[type=editorialNote-target-text]",function(e){const i=K(e),n=["endnote","inline","event"];if(t.editorialNotes.include)if(n.includes(t.editorialNotes.render)){if(t.editorialNotes.render==="endnote"){const{targetId:r,noteIndex:o}=R(i);return H(e,o,r)}else if(t.editorialNotes.render==="inline")i.setAttribute("class","note-text"),e.appendChild(i);else if(t.editorialNotes.render==="event"){const r=Q(i,t.editorialNotes.structured);let o=new CustomEvent("noteHover",{bubbles:!0,detail:{...r}});e.onmouseenter=function(){dispatchEvent(o)},e.classList.add("event")}}else throw new Error(`'${t.editorialNotes.render}' is not a valid rendering option. Valid options are: '${n}'`)}],["tei-seg",function(e){console.warn(`No custom behaviour for with type "${e.getAttribute("type")}" has been defined`)}]],standOff:function(e){const i=["top","bottom"];if(t.showStandOffMetadata||(e.hidden=!0),i.includes(t.standOffPosition))t.standOffPosition==="bottom"&&e.parentNode.appendChild(e);else throw e.hidden=!0,new Error(`${t.standOffPosition} is not a valid position for the standOff element. Valid positions are 'top' and 'bottom'.`)},unclear:function(e){if(!["event"].includes(t.render))console.error(`${t.render} is not a valid rendering option for elements, using defaults instead`);else if(t.render==="event"){te(e,t);let n=new CustomEvent("unclearHover",{bubbles:!0,detail:{message:t.message}});e.classList.add("event"),e.onmouseenter=function(){dispatchEvent(n)}}}}},Je=function(t){let e={tei:{}};for(const[i,n]of Object.entries(t.elementsSelected)){let r={...n.options};n.include&&(i==="ab"&&(t.teiFileStructure==="EvolvingHands"?r={...r,...t.facsimileCoordinates,...t.dates}:r={...r,customEvents:!1,elementAttribute:!1,...t.dates}),(i==="standOff"||i==="listOrg"||i==="listPerson"||i==="listPlace")&&(r={...r,...t.standOffMetadata}),i==="orgName"&&(r={...r,...t.orgData}),i==="placeName"&&(r={...r,...t.placeData}),i==="persName"&&(r={...r,...t.persData}),i==="seg"&&(r={...r,...t.notes}),(i==="choice"||i==="abbr"||i==="expan"||i==="sic"||i==="corr")&&(r={...r,...t.choice}),i==="add"&&(r={...r,...t.additions}),i==="damage"&&(r={...r,...t.damage}),i==="date"&&(r={...r,...t.dates}),i==="del"&&(r={...r,...t.deletions}),i==="figure"&&(r={...r,...t.figures}),i==="gap"&&(r={...r,...t.gap}),i==="unclear"&&(r={...r,...t.unclear}),e.tei[i]=ne(r)[i])}if(!t.displayInlineGraphics){let i={};Object.keys(t.elementsSelected).includes("graphic")&&(i=t.elementsSelected.graphic.options),e.tei.graphic=ne(i).graphic}if(t.addCustomBehaviours.applyCustomBehaviours)try{for(const[i,n]of Object.entries(customBehaviours))try{(t.addCustomBehaviours.applyAll||t.addCustomBehaviours.applyElements.includes(i))&&(e.tei[i]=n,t.addCustomBehaviours.showLogs&&console.log(`Added ${i} behaviour`))}catch{console.warn(`Could not add custom behaviour for element ${i}`)}}catch{console.error("Error: custom behaviours must be in a variable called customBehaviours")}return e};const We={useCustomBehaviours:!0,displayInlineGraphics:!1,teiFileStructure:"EvolvingHands",facsimileCoordinates:{customEvents:!0,elementAttribute:!1},additions:{customEvents:!0},choice:{abbreviations:{render:"event",marker:["[","]"],useOriginal:!0},corrections:{render:"event",marker:["[","]"],useOriginal:!1}},damage:{customEvents:!0},dates:{showISODate:!0,marker:["[","]"],ignoreBibliography:!0,removeDuplicatesWorkaround:!0},deletions:{render:"event",marker:["[","]"]},figures:{placeholder:!0,placeholderType:"icon",sizeIcon:150,descPosition:"inline",showAb:!0,image:{loadIfAvailable:!1,fitToContainer:!0}},gap:{render:"event",marker:"[…]"},notes:{bibliographicNotes:{include:!0,render:"event",structured:!0},editorialNotes:{include:!0,render:"event",structured:!0}},orgData:{customEvents:!0,elementAttribute:!1},placeData:{customEvents:!0,elementAttribute:!1},persData:{customEvents:!0,elementAttribute:!1},standOffMetadata:{showStandOffMetadata:!1,showOrgs:!1,showPeople:!1,showPlaces:!1,standOffPosition:"top"},unclear:{render:"event",marker:["[","]"],message:"text unclear"},elementsSelected:{ab:{include:!0,options:{}},add:{include:!0},abbr:{include:!0},choice:{include:!0},corr:{include:!0},damage:{include:!0},date:{include:!0},del:{include:!0},expan:{include:!0},figure:{include:!0},gap:{include:!0},graphic:{include:!0,options:{showLogs:!1}},listOrg:{include:!0},listPerson:{include:!0},listPlace:{include:!0},note:{include:!0},orgName:{include:!0,options:{addLink:"authority"}},placeName:{include:!0,options:{addLink:"authority"}},persName:{include:!0,options:{addLink:!1}},seg:{include:!0},sic:{include:!0},standOff:{include:!0},unclear:{include:!0}},addCustomBehaviours:{applyCustomBehaviours:!1,applyAll:!1,applyElements:"['persName', 'placeName', 'seg']",showLogs:!0}};function re(t){let e,i;return{c(){e=O("p"),i=de(t[0]),k(e,"data-testid","error-message")},m(n,r){_(n,e,r),le(e,i)},p(n,r){r&1&&ue(i,n[0])},d(n){n&&E(e)}}}function Ye(t){let e,i=t[0]&&re(t);return{c(){e=O("div"),i&&i.c(),k(e,"id","TEI-container"),k(e,"data-testid","TEI-container")},m(n,r){_(n,e,r),i&&i.m(e,null)},p(n,[r]){n[0]?i?i.p(n,r):(i=re(n),i.c(),i.m(e,null)):i&&(i.d(1),i=null)},i:w,o:w,d(n){n&&E(e),i&&i.d()}}}function Ze(t,e,i){let{path:n=""}=e,{configPath:r="TeiConverter/TeiConverter.config.json"}=e,o,a=!1,s;return pe(async()=>{try{s=await fetch(r).then(l=>l.json())}catch(l){console.log("Could not load config file, using default values",l);try{s=We}catch(u){console.log("Could not load default values",u)}}try{if(n==="")throw"No path specified";var d=new g;s.useCustomBehaviours&&d.addBehaviors(Je(s)),d.getHTML5(n,function(l){document.getElementById("TEI-container").appendChild(l)}),a=!0}catch(l){i(0,o=l.toString()),a=!0;return}}),t.$$set=d=>{"path"in d&&i(1,n=d.path),"configPath"in d&&i(2,r=d.configPath)},[o,n,r]}class Xe extends Ne{constructor(e){super(),ke(this,e,Ze,Ye,ae,{path:1,configPath:2})}get path(){return this.$$.ctx[1]}set path(e){this.$$set({path:e}),x()}get configPath(){return this.$$.ctx[2]}set configPath(e){this.$$set({configPath:e}),x()}}customElements.define("tei-converter",xe(Xe,{path:{},configPath:{}},[],[],!1))}); diff --git a/documentation/TeiConverter.config.md b/documentation/TeiConverter.config.md index 225a0d2..fb2dc3b 100644 --- a/documentation/TeiConverter.config.md +++ b/documentation/TeiConverter.config.md @@ -325,6 +325,27 @@ Defines whether to display any list of place information included in the metadat ### scope: `global` Defines whether to append the metadata in the `` element to the top or the bottom of the TEI container. If any other value is set for this option, the `` element will not be rendered and an error will be thrown in the console. +## unclear +### type: `object` +### scope: `global` +An object containing options for `` elements. + +## unclear.render +### type: `string` +### values: `event` +### scope: `global` +Defines whether unclear elements should be shown inline and given as an object in custom event ([`unclearHover`](/documentation/customEvents/unclearHover.md)). Currently available options are `event`. Any other value will not make any modifications to the text and will display an error on the console. + +## unclear.marker +### type: `array | string` +### scope: `global` +If [`unclear.render`](#unclearrender) is `event`, defines what typographical marker is used to distinguish the unclear text from the transcription. Default is to use square brackets ('[]'). + +## unclear.message +### type: `string` +### scope: `global` +If [`unclear.render`](#unclearrender) is `event`, defines what message is passed in the event. Default is 'text unclear'. + # Element options ## elementsSelected diff --git a/documentation/customEvents/unclearHover.md b/documentation/customEvents/unclearHover.md new file mode 100644 index 0000000..b396c6b --- /dev/null +++ b/documentation/customEvents/unclearHover.md @@ -0,0 +1,29 @@ +# Introduction + +Places where the text is unclear can be served through a custom event to the client, allowing for more flexibility on the frontend design. The custom event is called `unclearHover`, and is triggered everytime a user hovers over a relevant anchor text. The anchor includes a class `.event` to allow for styling. + +# Usage +Create an event listener for our custom event `unclearHover` as you would normally. Use the event handler to collect the data from `event.detail` trigger the host interface response. For example: + +```js +addEventListener('unclearHover', (event) => { + console.log(event.detail); + // useful code... + }) +``` + +# Event object +The message for the `` element is included in the `event.detail` object, which you should capture when adding the event listener. According to the standard document, the event should return the following message: 'text unclear'. The specific structure should normally be as follows: + +``` +event.detail: object { + message: string // message defined in the config +} +``` + +Here is an example from `GB-1-1-2-1-17-20.xml`: +```json +{ + "message": "text unclear" +} +``` diff --git a/index.html b/index.html index d2d1e7c..f3d91ba 100644 --- a/index.html +++ b/index.html @@ -48,6 +48,10 @@ console.log(event.detail); }); + addEventListener('unclearHover', (event) => { + console.log(event.detail); + }); + @@ -74,7 +78,7 @@

TEI

+ path="https://raw.githubusercontent.com/evolvinghands/EvolvingHandsNcl/main/GB-1-1-2-1-17-20.xml" configPath="dist/TeiConverter/TeiConverter.config.json"/>
diff --git a/static/TeiConverter.config.json b/static/TeiConverter.config.json index c75b1a9..0b24559 100644 --- a/static/TeiConverter.config.json +++ b/static/TeiConverter.config.json @@ -80,6 +80,11 @@ "showPlaces": false, "standOffPosition": "top" }, + "unclear": { + "render": "event", + "marker": ["[", "]"], + "message": "text unclear" + }, "elementsSelected": { "ab" : { "include": true, @@ -158,6 +163,9 @@ }, "standOff": { "include": true + }, + "unclear": { + "include": true } }, "addCustomBehaviours": { diff --git a/static/behavioursDictionary.js b/static/behavioursDictionary.js index ac3bae8..21bc7ea 100644 --- a/static/behavioursDictionary.js +++ b/static/behavioursDictionary.js @@ -603,7 +603,24 @@ export let behaviours = function (options) { } else if (options.standOffPosition === 'bottom') { elt.parentNode.appendChild(elt); } - // else if top, nothing needs to be done + + }, + + "unclear": function (elt) { + const legalRenders = ['event']; + + if (!legalRenders.includes(options.render)) { + console.error(`${options.render} is not a valid rendering option for elements, using defaults instead`) + } else if (options.render === 'event') { + // add markers + addMarkersToElement(elt, options); + // create custom event + let event = new CustomEvent('unclearHover', { bubbles: true, detail: { message: options.message } }) + elt.classList.add('event'); + elt.onmouseenter = function () { + dispatchEvent(event) + } + } } } } \ No newline at end of file diff --git a/static/teiBehaviours.js b/static/teiBehaviours.js index b5e223e..86de9af 100644 --- a/static/teiBehaviours.js +++ b/static/teiBehaviours.js @@ -53,6 +53,9 @@ export let teiBehaviours = function (config) { if (choice === 'gap') { options = {...options, ...config.gap} } + if (choice === 'unclear') { + options = {...options, ...config.unclear} + } behavioursObject['tei'][choice] = behaviours(options)[choice]; } }