Current File : /home/pacjaorg/wpt.pacja.org/km/media/system/js/highlight.min.js
class DOMIterator{constructor(e,t=!0,s=[],i=5e3){this.ctx=e,this.iframes=t,this.exclude=s,this.iframesTimeout=i}static matches(e,t){const s=typeof t=="string"?[t]:t,i=e.matches||e.matchesSelector||e.msMatchesSelector||e.mozMatchesSelector||e.oMatchesSelector||e.webkitMatchesSelector;if(i){let a=!1;return s.every(r=>i.call(e,r)?(a=!0,!1):!0),a}else return!1}getContexts(){let e,t=[];return typeof this.ctx>"u"||!this.ctx?e=[]:NodeList.prototype.isPrototypeOf(this.ctx)?e=Array.prototype.slice.call(this.ctx):Array.isArray(this.ctx)?e=this.ctx:typeof this.ctx=="string"?e=Array.prototype.slice.call(document.querySelectorAll(this.ctx)):e=[this.ctx],e.forEach(s=>{const i=t.filter(a=>a.contains(s)).length>0;t.indexOf(s)===-1&&!i&&t.push(s)}),t}getIframeContents(e,t,s=()=>{}){let i;try{const a=e.contentWindow;if(i=a.document,!a||!i)throw new Error("iframe inaccessible")}catch{s()}i&&t(i)}isIframeBlank(e){const t="about:blank",s=e.getAttribute("src").trim();return e.contentWindow.location.href===t&&s!==t&&s}observeIframeLoad(e,t,s){let i=!1,a=null;const r=()=>{if(!i){i=!0,clearTimeout(a);try{this.isIframeBlank(e)||(e.removeEventListener("load",r),this.getIframeContents(e,t,s))}catch{s()}}};e.addEventListener("load",r),a=setTimeout(r,this.iframesTimeout)}onIframeReady(e,t,s){try{e.contentWindow.document.readyState==="complete"?this.isIframeBlank(e)?this.observeIframeLoad(e,t,s):this.getIframeContents(e,t,s):this.observeIframeLoad(e,t,s)}catch{s()}}waitForIframes(e,t){let s=0;this.forEachIframe(e,()=>!0,i=>{s++,this.waitForIframes(i.querySelector("html"),()=>{--s||t()})},i=>{i||t()})}forEachIframe(e,t,s,i=()=>{}){let a=e.querySelectorAll("iframe"),r=a.length,o=0;a=Array.prototype.slice.call(a);const n=()=>{--r<=0&&i(o)};r||n(),a.forEach(l=>{DOMIterator.matches(l,this.exclude)?n():this.onIframeReady(l,h=>{t(l)&&(o++,s(h)),n()},n)})}createIterator(e,t,s){return document.createNodeIterator(e,t,s,!1)}createInstanceOnIframe(e){return new DOMIterator(e.querySelector("html"),this.iframes)}compareNodeIframe(e,t,s){const i=e.compareDocumentPosition(s),a=Node.DOCUMENT_POSITION_PRECEDING;if(i&a)if(t!==null){const r=t.compareDocumentPosition(s),o=Node.DOCUMENT_POSITION_FOLLOWING;if(r&o)return!0}else return!0;return!1}getIteratorNode(e){const t=e.previousNode();let s;return t===null?s=e.nextNode():s=e.nextNode()&&e.nextNode(),{prevNode:t,node:s}}checkIframeFilter(e,t,s,i){let a=!1,r=!1;return i.forEach((o,n)=>{o.val===s&&(a=n,r=o.handled)}),this.compareNodeIframe(e,t,s)?(a===!1&&!r?i.push({val:s,handled:!0}):a!==!1&&!r&&(i[a].handled=!0),!0):(a===!1&&i.push({val:s,handled:!1}),!1)}handleOpenIframes(e,t,s,i){e.forEach(a=>{a.handled||this.getIframeContents(a.val,r=>{this.createInstanceOnIframe(r).forEachNode(t,s,i)})})}iterateThroughNodes(e,t,s,i,a){const r=this.createIterator(t,e,i);let o=[],n=[],l,h,c=()=>({prevNode:h,node:l}=this.getIteratorNode(r),l);for(;c();)this.iframes&&this.forEachIframe(t,p=>this.checkIframeFilter(l,h,p,o),p=>{this.createInstanceOnIframe(p).forEachNode(e,f=>n.push(f),i)}),n.push(l);n.forEach(p=>{s(p)}),this.iframes&&this.handleOpenIframes(o,e,s,i),a()}forEachNode(e,t,s,i=()=>{}){const a=this.getContexts();let r=a.length;r||i(),a.forEach(o=>{const n=()=>{this.iterateThroughNodes(e,o,t,s,()=>{--r<=0&&i()})};this.iframes?this.waitForIframes(o,n):n()})}}class Mark$1{constructor(e){this.ctx=e,this.ie=!1;const t=window.navigator.userAgent;(t.indexOf("MSIE")>-1||t.indexOf("Trident")>-1)&&(this.ie=!0)}set opt(e){this._opt=Object.assign({},{element:"",className:"",exclude:[],iframes:!1,iframesTimeout:5e3,separateWordSearch:!0,diacritics:!0,synonyms:{},accuracy:"partially",acrossElements:!1,caseSensitive:!1,ignoreJoiners:!1,ignoreGroups:0,ignorePunctuation:[],wildcards:"disabled",each:()=>{},noMatch:()=>{},filter:()=>!0,done:()=>{},debug:!1,log:window.console},e)}get opt(){return this._opt}get iterator(){return new DOMIterator(this.ctx,this.opt.iframes,this.opt.exclude,this.opt.iframesTimeout)}log(e,t="debug"){const s=this.opt.log;this.opt.debug&&typeof s=="object"&&typeof s[t]=="function"&&s[t](`mark.js: ${e}`)}escapeStr(e){return e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")}createRegExp(e){return this.opt.wildcards!=="disabled"&&(e=this.setupWildcardsRegExp(e)),e=this.escapeStr(e),Object.keys(this.opt.synonyms).length&&(e=this.createSynonymsRegExp(e)),(this.opt.ignoreJoiners||this.opt.ignorePunctuation.length)&&(e=this.setupIgnoreJoinersRegExp(e)),this.opt.diacritics&&(e=this.createDiacriticsRegExp(e)),e=this.createMergedBlanksRegExp(e),(this.opt.ignoreJoiners||this.opt.ignorePunctuation.length)&&(e=this.createJoinersRegExp(e)),this.opt.wildcards!=="disabled"&&(e=this.createWildcardsRegExp(e)),e=this.createAccuracyRegExp(e),e}createSynonymsRegExp(e){const t=this.opt.synonyms,s=this.opt.caseSensitive?"":"i",i=this.opt.ignoreJoiners||this.opt.ignorePunctuation.length?"\0":"";for(let a in t)if(t.hasOwnProperty(a)){const r=t[a],o=this.opt.wildcards!=="disabled"?this.setupWildcardsRegExp(a):this.escapeStr(a),n=this.opt.wildcards!=="disabled"?this.setupWildcardsRegExp(r):this.escapeStr(r);o!==""&&n!==""&&(e=e.replace(new RegExp(`(${this.escapeStr(o)}|${this.escapeStr(n)})`,`gm${s}`),i+`(${this.processSynomyms(o)}|${this.processSynomyms(n)})`+i))}return e}processSynomyms(e){return(this.opt.ignoreJoiners||this.opt.ignorePunctuation.length)&&(e=this.setupIgnoreJoinersRegExp(e)),e}setupWildcardsRegExp(e){return e=e.replace(/(?:\\)*\?/g,t=>t.charAt(0)==="\\"?"?":""),e.replace(/(?:\\)*\*/g,t=>t.charAt(0)==="\\"?"*":"")}createWildcardsRegExp(e){let t=this.opt.wildcards==="withSpaces";return e.replace(/\u0001/g,t?"[\\S\\s]?":"\\S?").replace(/\u0002/g,t?"[\\S\\s]*?":"\\S*")}setupIgnoreJoinersRegExp(e){return e.replace(/[^(|)\\]/g,(t,s,i)=>{let a=i.charAt(s+1);return/[(|)\\]/.test(a)||a===""?t:t+"\0"})}createJoinersRegExp(e){let t=[];const s=this.opt.ignorePunctuation;return Array.isArray(s)&&s.length&&t.push(this.escapeStr(s.join(""))),this.opt.ignoreJoiners&&t.push("\\u00ad\\u200b\\u200c\\u200d"),t.length?e.split(/\u0000+/).join(`[${t.join("")}]*`):e}createDiacriticsRegExp(e){const t=this.opt.caseSensitive?"":"i",s=this.opt.caseSensitive?["a\xE0\xE1\u1EA3\xE3\u1EA1\u0103\u1EB1\u1EAF\u1EB3\u1EB5\u1EB7\xE2\u1EA7\u1EA5\u1EA9\u1EAB\u1EAD\xE4\xE5\u0101\u0105","A\xC0\xC1\u1EA2\xC3\u1EA0\u0102\u1EB0\u1EAE\u1EB2\u1EB4\u1EB6\xC2\u1EA6\u1EA4\u1EA8\u1EAA\u1EAC\xC4\xC5\u0100\u0104","c\xE7\u0107\u010D","C\xC7\u0106\u010C","d\u0111\u010F","D\u0110\u010E","e\xE8\xE9\u1EBB\u1EBD\u1EB9\xEA\u1EC1\u1EBF\u1EC3\u1EC5\u1EC7\xEB\u011B\u0113\u0119","E\xC8\xC9\u1EBA\u1EBC\u1EB8\xCA\u1EC0\u1EBE\u1EC2\u1EC4\u1EC6\xCB\u011A\u0112\u0118","i\xEC\xED\u1EC9\u0129\u1ECB\xEE\xEF\u012B","I\xCC\xCD\u1EC8\u0128\u1ECA\xCE\xCF\u012A","l\u0142","L\u0141","n\xF1\u0148\u0144","N\xD1\u0147\u0143","o\xF2\xF3\u1ECF\xF5\u1ECD\xF4\u1ED3\u1ED1\u1ED5\u1ED7\u1ED9\u01A1\u1EDF\u1EE1\u1EDB\u1EDD\u1EE3\xF6\xF8\u014D","O\xD2\xD3\u1ECE\xD5\u1ECC\xD4\u1ED2\u1ED0\u1ED4\u1ED6\u1ED8\u01A0\u1EDE\u1EE0\u1EDA\u1EDC\u1EE2\xD6\xD8\u014C","r\u0159","R\u0158","s\u0161\u015B\u0219\u015F","S\u0160\u015A\u0218\u015E","t\u0165\u021B\u0163","T\u0164\u021A\u0162","u\xF9\xFA\u1EE7\u0169\u1EE5\u01B0\u1EEB\u1EE9\u1EED\u1EEF\u1EF1\xFB\xFC\u016F\u016B","U\xD9\xDA\u1EE6\u0168\u1EE4\u01AF\u1EEA\u1EE8\u1EEC\u1EEE\u1EF0\xDB\xDC\u016E\u016A","y\xFD\u1EF3\u1EF7\u1EF9\u1EF5\xFF","Y\xDD\u1EF2\u1EF6\u1EF8\u1EF4\u0178","z\u017E\u017C\u017A","Z\u017D\u017B\u0179"]:["a\xE0\xE1\u1EA3\xE3\u1EA1\u0103\u1EB1\u1EAF\u1EB3\u1EB5\u1EB7\xE2\u1EA7\u1EA5\u1EA9\u1EAB\u1EAD\xE4\xE5\u0101\u0105A\xC0\xC1\u1EA2\xC3\u1EA0\u0102\u1EB0\u1EAE\u1EB2\u1EB4\u1EB6\xC2\u1EA6\u1EA4\u1EA8\u1EAA\u1EAC\xC4\xC5\u0100\u0104","c\xE7\u0107\u010DC\xC7\u0106\u010C","d\u0111\u010FD\u0110\u010E","e\xE8\xE9\u1EBB\u1EBD\u1EB9\xEA\u1EC1\u1EBF\u1EC3\u1EC5\u1EC7\xEB\u011B\u0113\u0119E\xC8\xC9\u1EBA\u1EBC\u1EB8\xCA\u1EC0\u1EBE\u1EC2\u1EC4\u1EC6\xCB\u011A\u0112\u0118","i\xEC\xED\u1EC9\u0129\u1ECB\xEE\xEF\u012BI\xCC\xCD\u1EC8\u0128\u1ECA\xCE\xCF\u012A","l\u0142L\u0141","n\xF1\u0148\u0144N\xD1\u0147\u0143","o\xF2\xF3\u1ECF\xF5\u1ECD\xF4\u1ED3\u1ED1\u1ED5\u1ED7\u1ED9\u01A1\u1EDF\u1EE1\u1EDB\u1EDD\u1EE3\xF6\xF8\u014DO\xD2\xD3\u1ECE\xD5\u1ECC\xD4\u1ED2\u1ED0\u1ED4\u1ED6\u1ED8\u01A0\u1EDE\u1EE0\u1EDA\u1EDC\u1EE2\xD6\xD8\u014C","r\u0159R\u0158","s\u0161\u015B\u0219\u015FS\u0160\u015A\u0218\u015E","t\u0165\u021B\u0163T\u0164\u021A\u0162","u\xF9\xFA\u1EE7\u0169\u1EE5\u01B0\u1EEB\u1EE9\u1EED\u1EEF\u1EF1\xFB\xFC\u016F\u016BU\xD9\xDA\u1EE6\u0168\u1EE4\u01AF\u1EEA\u1EE8\u1EEC\u1EEE\u1EF0\xDB\xDC\u016E\u016A","y\xFD\u1EF3\u1EF7\u1EF9\u1EF5\xFFY\xDD\u1EF2\u1EF6\u1EF8\u1EF4\u0178","z\u017E\u017C\u017AZ\u017D\u017B\u0179"];let i=[];return e.split("").forEach(a=>{s.every(r=>{if(r.indexOf(a)!==-1){if(i.indexOf(r)>-1)return!1;e=e.replace(new RegExp(`[${r}]`,`gm${t}`),`[${r}]`),i.push(r)}return!0})}),e}createMergedBlanksRegExp(e){return e.replace(/[\s]+/gmi,"[\\s]+")}createAccuracyRegExp(e){const t="!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~\xA1\xBF";let s=this.opt.accuracy,i=typeof s=="string"?s:s.value,a=typeof s=="string"?[]:s.limiters,r="";switch(a.forEach(o=>{r+=`|${this.escapeStr(o)}`}),i){case"partially":default:return`()(${e})`;case"complementary":return r="\\s"+(r||this.escapeStr(t)),`()([^${r}]*${e}[^${r}]*)`;case"exactly":return`(^|\\s${r})(${e})(?=$|\\s${r})`}}getSeparatedKeywords(e){let t=[];return e.forEach(s=>{this.opt.separateWordSearch?s.split(" ").forEach(i=>{i.trim()&&t.indexOf(i)===-1&&t.push(i)}):s.trim()&&t.indexOf(s)===-1&&t.push(s)}),{keywords:t.sort((s,i)=>i.length-s.length),length:t.length}}isNumeric(e){return Number(parseFloat(e))==e}checkRanges(e){if(!Array.isArray(e)||Object.prototype.toString.call(e[0])!=="[object Object]")return this.log("markRanges() will only accept an array of objects"),this.opt.noMatch(e),[];const t=[];let s=0;return e.sort((i,a)=>i.start-a.start).forEach(i=>{let{start:a,end:r,valid:o}=this.callNoMatchOnInvalidRanges(i,s);o&&(i.start=a,i.length=r-a,t.push(i),s=r)}),t}callNoMatchOnInvalidRanges(e,t){let s,i,a=!1;return e&&typeof e.start<"u"?(s=parseInt(e.start,10),i=s+parseInt(e.length,10),this.isNumeric(e.start)&&this.isNumeric(e.length)&&i-t>0&&i-s>0?a=!0:(this.log(`Ignoring invalid or overlapping range: ${JSON.stringify(e)}`),this.opt.noMatch(e))):(this.log(`Ignoring invalid range: ${JSON.stringify(e)}`),this.opt.noMatch(e)),{start:s,end:i,valid:a}}checkWhitespaceRanges(e,t,s){let i,a=!0,r=s.length,o=t-r,n=parseInt(e.start,10)-o;return n=n>r?r:n,i=n+parseInt(e.length,10),i>r&&(i=r,this.log(`End range automatically set to the max value of ${r}`)),n<0||i-n<0||n>r||i>r?(a=!1,this.log(`Invalid range: ${JSON.stringify(e)}`),this.opt.noMatch(e)):s.substring(n,i).replace(/\s+/g,"")===""&&(a=!1,this.log("Skipping whitespace only range: "+JSON.stringify(e)),this.opt.noMatch(e)),{start:n,end:i,valid:a}}getTextNodes(e){let t="",s=[];this.iterator.forEachNode(NodeFilter.SHOW_TEXT,i=>{s.push({start:t.length,end:(t+=i.textContent).length,node:i})},i=>this.matchesExclude(i.parentNode)?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT,()=>{e({value:t,nodes:s})})}matchesExclude(e){return DOMIterator.matches(e,this.opt.exclude.concat(["script","style","title","head","html"]))}wrapRangeInTextNode(e,t,s){const i=this.opt.element?this.opt.element:"mark",a=e.splitText(t),r=a.splitText(s-t);let o=document.createElement(i);return o.setAttribute("data-markjs","true"),this.opt.className&&o.setAttribute("class",this.opt.className),o.textContent=a.textContent,a.parentNode.replaceChild(o,a),r}wrapRangeInMappedTextNode(e,t,s,i,a){e.nodes.every((r,o)=>{const n=e.nodes[o+1];if(typeof n>"u"||n.start>t){if(!i(r.node))return!1;const l=t-r.start,h=(s>r.end?r.end:s)-r.start,c=e.value.substr(0,r.start),p=e.value.substr(h+r.start);if(r.node=this.wrapRangeInTextNode(r.node,l,h),e.value=c+p,e.nodes.forEach((f,u)=>{u>=o&&(e.nodes[u].start>0&&u!==o&&(e.nodes[u].start-=h),e.nodes[u].end-=h)}),s-=h,a(r.node.previousSibling,r.start),s>r.end)t=r.end;else return!1}return!0})}wrapMatches(e,t,s,i,a){const r=t===0?0:t+1;this.getTextNodes(o=>{o.nodes.forEach(n=>{n=n.node;let l;for(;(l=e.exec(n.textContent))!==null&&l[r]!=="";){if(!s(l[r],n))continue;let h=l.index;if(r!==0)for(let c=1;c<r;c++)h+=l[c].length;n=this.wrapRangeInTextNode(n,h,h+l[r].length),i(n.previousSibling),e.lastIndex=0}}),a()})}wrapMatchesAcrossElements(e,t,s,i,a){const r=t===0?0:t+1;this.getTextNodes(o=>{let n;for(;(n=e.exec(o.value))!==null&&n[r]!=="";){let l=n.index;if(r!==0)for(let c=1;c<r;c++)l+=n[c].length;const h=l+n[r].length;this.wrapRangeInMappedTextNode(o,l,h,c=>s(n[r],c),(c,p)=>{e.lastIndex=p,i(c)})}a()})}wrapRangeFromIndex(e,t,s,i){this.getTextNodes(a=>{const r=a.value.length;e.forEach((o,n)=>{let{start:l,end:h,valid:c}=this.checkWhitespaceRanges(o,r,a.value);c&&this.wrapRangeInMappedTextNode(a,l,h,p=>t(p,o,a.value.substring(l,h),n),p=>{s(p,o)})}),i()})}unwrapMatches(e){const t=e.parentNode;let s=document.createDocumentFragment();for(;e.firstChild;)s.appendChild(e.removeChild(e.firstChild));t.replaceChild(s,e),this.ie?this.normalizeTextNode(t):t.normalize()}normalizeTextNode(e){if(e){if(e.nodeType===3)for(;e.nextSibling&&e.nextSibling.nodeType===3;)e.nodeValue+=e.nextSibling.nodeValue,e.parentNode.removeChild(e.nextSibling);else this.normalizeTextNode(e.firstChild);this.normalizeTextNode(e.nextSibling)}}markRegExp(e,t){this.opt=t,this.log(`Searching with expression "${e}"`);let s=0,i="wrapMatches";const a=r=>{s++,this.opt.each(r)};this.opt.acrossElements&&(i="wrapMatchesAcrossElements"),this[i](e,this.opt.ignoreGroups,(r,o)=>this.opt.filter(o,r,s),a,()=>{s===0&&this.opt.noMatch(e),this.opt.done(s)})}mark(e,t){this.opt=t;let s=0,i="wrapMatches";const{keywords:a,length:r}=this.getSeparatedKeywords(typeof e=="string"?[e]:e),o=this.opt.caseSensitive?"":"i",n=l=>{let h=new RegExp(this.createRegExp(l),`gm${o}`),c=0;this.log(`Searching with expression "${h}"`),this[i](h,1,(p,f)=>this.opt.filter(f,l,s,c),p=>{c++,s++,this.opt.each(p)},()=>{c===0&&this.opt.noMatch(l),a[r-1]===l?this.opt.done(s):n(a[a.indexOf(l)+1])})};this.opt.acrossElements&&(i="wrapMatchesAcrossElements"),r===0?this.opt.done(s):n(a[0])}markRanges(e,t){this.opt=t;let s=0,i=this.checkRanges(e);i&&i.length?(this.log("Starting to mark with the following ranges: "+JSON.stringify(i)),this.wrapRangeFromIndex(i,(a,r,o,n)=>this.opt.filter(a,r,o,n),(a,r)=>{s++,this.opt.each(a,r)},()=>{this.opt.done(s)})):this.opt.done(s)}unmark(e){this.opt=e;let t=this.opt.element?this.opt.element:"*";t+="[data-markjs]",this.opt.className&&(t+=`.${this.opt.className}`),this.log(`Removal selector "${t}"`),this.iterator.forEachNode(NodeFilter.SHOW_ELEMENT,s=>{this.unwrapMatches(s)},s=>{const i=DOMIterator.matches(s,t),a=this.matchesExclude(s);return!i||a?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT},this.opt.done)}}function Mark(d){const e=new Mark$1(d);return this.mark=(t,s)=>(e.mark(t,s),this),this.markRegExp=(t,s)=>(e.markRegExp(t,s),this),this.markRanges=(t,s)=>(e.markRanges(t,s),this),this.unmark=t=>(e.unmark(t),this),this}const defaultOptions={exclude:[],separateWordSearch:!0,accuracy:"partially",diacritics:!0,synonyms:{},iframes:!1,iframesTimeout:5e3,acrossElements:!0,caseSensitive:!1,ignoreJoiners:!1,wildcards:"disabled",compatibility:!1};Joomla.getOptions&&typeof Joomla.getOptions=="function"&&Joomla.getOptions("highlight")&&Joomla.getOptions("highlight").forEach(e=>{const t={...defaultOptions,...e};if(t.compatibility){const s=document.querySelector(`#${t.start}`);document.querySelector(`#${t.end}`);const i=s.parentNode,a=[];Array.from(i.childNodes).forEach(o=>{}),a.forEach(o=>{const n=new Mark(o);t.highLight.map(l=>n.mark(l,t))})}else{const s=document.querySelector(`.${t.class}`);if(s){const i=new Mark(s);t.highLight.forEach(a=>{i.mark(a,t)})}}});
Site is undergoing maintenance

PACJA Events

Maintenance mode is on

Site will be available soon. Thank you for your patience!