OwlCyberSecurity - MANAGER
Edit File: amp-validated-url-post-edit-screen.js
(()=>{var e={576:function(e){var t;t=function(){return function(){var e={686:function(e,t,n){"use strict";n.d(t,{default:function(){return E}});var r=n(279),o=n.n(r),c=n(370),i=n.n(c),a=n(817),u=n.n(a);function l(e){try{return document.execCommand(e)}catch(e){return!1}}var s=function(e){var t=u()(e);return l("cut"),t},d=function(e,t){var n=function(e){var t="rtl"===document.documentElement.getAttribute("dir"),n=document.createElement("textarea");n.style.fontSize="12pt",n.style.border="0",n.style.padding="0",n.style.margin="0",n.style.position="absolute",n.style[t?"right":"left"]="-9999px";var r=window.pageYOffset||document.documentElement.scrollTop;return n.style.top="".concat(r,"px"),n.setAttribute("readonly",""),n.value=e,n}(e);t.container.appendChild(n);var r=u()(n);return l("copy"),n.remove(),r},f=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{container:document.body},n="";return"string"==typeof e?n=d(e,t):e instanceof HTMLInputElement&&!["text","search","url","tel","password"].includes(null==e?void 0:e.type)?n=d(e.value,t):(n=u()(e),l("copy")),n};function p(e){return p="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},p(e)}function y(e){return y="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},y(e)}function m(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function h(e,t){return h=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},h(e,t)}function v(e){return v=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},v(e)}function g(e,t){var n="data-clipboard-".concat(e);if(t.hasAttribute(n))return t.getAttribute(n)}var b=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&h(e,t)}(u,e);var t,n,r,o,c,a=(o=u,c=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,t,n=v(o);if(c){var r=v(this).constructor;e=Reflect.construct(n,arguments,r)}else e=n.apply(this,arguments);return!(t=e)||"object"!==y(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(this):t});function u(e,t){var n;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,u),(n=a.call(this)).resolveOptions(t),n.listenClick(e),n}return t=u,n=[{key:"resolveOptions",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.action="function"==typeof e.action?e.action:this.defaultAction,this.target="function"==typeof e.target?e.target:this.defaultTarget,this.text="function"==typeof e.text?e.text:this.defaultText,this.container="object"===y(e.container)?e.container:document.body}},{key:"listenClick",value:function(e){var t=this;this.listener=i()(e,"click",(function(e){return t.onClick(e)}))}},{key:"onClick",value:function(e){var t=e.delegateTarget||e.currentTarget,n=this.action(t)||"copy",r=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.action,n=void 0===t?"copy":t,r=e.container,o=e.target,c=e.text;if("copy"!==n&&"cut"!==n)throw new Error('Invalid "action" value, use either "copy" or "cut"');if(void 0!==o){if(!o||"object"!==p(o)||1!==o.nodeType)throw new Error('Invalid "target" value, use a valid Element');if("copy"===n&&o.hasAttribute("disabled"))throw new Error('Invalid "target" attribute. Please use "readonly" instead of "disabled" attribute');if("cut"===n&&(o.hasAttribute("readonly")||o.hasAttribute("disabled")))throw new Error('Invalid "target" attribute. You can\'t cut text from elements with "readonly" or "disabled" attributes')}return c?f(c,{container:r}):o?"cut"===n?s(o):f(o,{container:r}):void 0}({action:n,container:this.container,target:this.target(t),text:this.text(t)});this.emit(r?"success":"error",{action:n,text:r,trigger:t,clearSelection:function(){t&&t.focus(),window.getSelection().removeAllRanges()}})}},{key:"defaultAction",value:function(e){return g("action",e)}},{key:"defaultTarget",value:function(e){var t=g("target",e);if(t)return document.querySelector(t)}},{key:"defaultText",value:function(e){return g("text",e)}},{key:"destroy",value:function(){this.listener.destroy()}}],r=[{key:"copy",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{container:document.body};return f(e,t)}},{key:"cut",value:function(e){return s(e)}},{key:"isSupported",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:["copy","cut"],t="string"==typeof e?[e]:e,n=!!document.queryCommandSupported;return t.forEach((function(e){n=n&&!!document.queryCommandSupported(e)})),n}}],n&&m(t.prototype,n),r&&m(t,r),u}(o()),E=b},828:function(e){if("undefined"!=typeof Element&&!Element.prototype.matches){var t=Element.prototype;t.matches=t.matchesSelector||t.mozMatchesSelector||t.msMatchesSelector||t.oMatchesSelector||t.webkitMatchesSelector}e.exports=function(e,t){for(;e&&9!==e.nodeType;){if("function"==typeof e.matches&&e.matches(t))return e;e=e.parentNode}}},438:function(e,t,n){var r=n(828);function o(e,t,n,r,o){var i=c.apply(this,arguments);return e.addEventListener(n,i,o),{destroy:function(){e.removeEventListener(n,i,o)}}}function c(e,t,n,o){return function(n){n.delegateTarget=r(n.target,t),n.delegateTarget&&o.call(e,n)}}e.exports=function(e,t,n,r,c){return"function"==typeof e.addEventListener?o.apply(null,arguments):"function"==typeof n?o.bind(null,document).apply(null,arguments):("string"==typeof e&&(e=document.querySelectorAll(e)),Array.prototype.map.call(e,(function(e){return o(e,t,n,r,c)})))}},879:function(e,t){t.node=function(e){return void 0!==e&&e instanceof HTMLElement&&1===e.nodeType},t.nodeList=function(e){var n=Object.prototype.toString.call(e);return void 0!==e&&("[object NodeList]"===n||"[object HTMLCollection]"===n)&&"length"in e&&(0===e.length||t.node(e[0]))},t.string=function(e){return"string"==typeof e||e instanceof String},t.fn=function(e){return"[object Function]"===Object.prototype.toString.call(e)}},370:function(e,t,n){var r=n(879),o=n(438);e.exports=function(e,t,n){if(!e&&!t&&!n)throw new Error("Missing required arguments");if(!r.string(t))throw new TypeError("Second argument must be a String");if(!r.fn(n))throw new TypeError("Third argument must be a Function");if(r.node(e))return function(e,t,n){return e.addEventListener(t,n),{destroy:function(){e.removeEventListener(t,n)}}}(e,t,n);if(r.nodeList(e))return function(e,t,n){return Array.prototype.forEach.call(e,(function(e){e.addEventListener(t,n)})),{destroy:function(){Array.prototype.forEach.call(e,(function(e){e.removeEventListener(t,n)}))}}}(e,t,n);if(r.string(e))return function(e,t,n){return o(document.body,e,t,n)}(e,t,n);throw new TypeError("First argument must be a String, HTMLElement, HTMLCollection, or NodeList")}},817:function(e){e.exports=function(e){var t;if("SELECT"===e.nodeName)e.focus(),t=e.value;else if("INPUT"===e.nodeName||"TEXTAREA"===e.nodeName){var n=e.hasAttribute("readonly");n||e.setAttribute("readonly",""),e.select(),e.setSelectionRange(0,e.value.length),n||e.removeAttribute("readonly"),t=e.value}else{e.hasAttribute("contenteditable")&&e.focus();var r=window.getSelection(),o=document.createRange();o.selectNodeContents(e),r.removeAllRanges(),r.addRange(o),t=r.toString()}return t}},279:function(e){function t(){}t.prototype={on:function(e,t,n){var r=this.e||(this.e={});return(r[e]||(r[e]=[])).push({fn:t,ctx:n}),this},once:function(e,t,n){var r=this;function o(){r.off(e,o),t.apply(n,arguments)}return o._=t,this.on(e,o,n)},emit:function(e){for(var t=[].slice.call(arguments,1),n=((this.e||(this.e={}))[e]||[]).slice(),r=0,o=n.length;r<o;r++)n[r].fn.apply(n[r].ctx,t);return this},off:function(e,t){var n=this.e||(this.e={}),r=n[e],o=[];if(r&&t)for(var c=0,i=r.length;c<i;c++)r[c].fn!==t&&r[c].fn._!==t&&o.push(r[c]);return o.length?n[e]=o:delete n[e],this}},e.exports=t,e.exports.TinyEmitter=t}},t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={exports:{}};return e[r](o,o.exports,n),o.exports}return n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,{a:t}),t},n.d=function(e,t){for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n(686)}().default},e.exports=t()}},t={};function n(r){var o=t[r];if(void 0!==o)return o.exports;var c=t[r]={exports:{}};return e[r].call(c.exports,c,c.exports,n),c.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{"use strict";const e=window.wp.domReady;var t=n.n(e);const r=window.wp.i18n;var o=n(576),c=n.n(o);function i(e={}){const t=[...document.querySelectorAll("select.amp-validation-error-status")].map((e=>e.closest("tr")));return!0!==e.checkedOnly?t:t.filter((e=>e.querySelector(".check-column input[type=checkbox]").checked))}function a({trigger:e}){e.focus();const t=(0,r.__)("Copied to clipboard","amp");if(e.innerText===t)return;const n=e.innerText;e.innerText=t,setTimeout((()=>{document.body.contains(e)&&(e.innerText=n)}),4e3)}const u="number-errors",l="show-all-errors";t()((()=>{h(),v(),g(),b(),E(),f(),S(),function(){const e=[];e.push(new(c())("button.single-url-detail-copy",{text:e=>JSON.stringify(JSON.parse(e.getAttribute("data-error-json")),null,"\t")})),e.push(new(c())("button.copy-all",{text:()=>{const e=i({checkedOnly:!0}).map((e=>{const t=e.querySelector(".single-url-detail-copy");return t?JSON.parse(t.getAttribute("data-error-json")):null})).filter((e=>e));return JSON.stringify(e,null,"\t")}})),e.forEach((e=>{e.on("success",a)}))}()}));let s=!1;const d=()=>{s||(n.g.addEventListener("beforeunload",p),document.querySelector("#major-publishing-actions").addEventListener("click",(()=>{n.g.removeEventListener("beforeunload",p)})),s=!0)},f=()=>{const e=t=>{(t.target.matches(".amp-validation-error-status")||t.target.matches(".amp-validation-error-status-review"))&&(document.getElementById("post").removeEventListener("change",e),d())};document.getElementById("post").addEventListener("change",e)},p=e=>(e.preventDefault(),e.returnValue=(0,r.__)("You have unsaved changes. Are you sure you want to leave?","amp"),(0,r.__)("You have unsaved changes. Are you sure you want to leave?","amp")),y=(e,t)=>{const n=document.getElementById(l);let o,c,i=document.getElementById(u);const a=document.getElementsByTagName("thead");a[0]&&!i&&(o=a[0],i=document.createElement("tr"),c=document.createElement("th"),c.setAttribute("id",u),c.setAttribute("colspan","6"),i.appendChild(c),o.appendChild(i)),e===t?(n&&n.classList.add("hidden"),i.classList.add("hidden")):null!==e&&(document.getElementById(u).innerText=(0,r.sprintf)(/* translators: 1: number of errors being displayed. 2: total number of errors found. */ /* translators: 1: number of errors being displayed. 2: total number of errors found. */ (0,r._n)("Showing %1$s of %2$s validation error","Showing %1$s of %2$s validation errors",t,"amp"),e,t),document.getElementById(u).classList.remove("hidden"),m(),document.getElementById(l)&&document.getElementById(l).classList.remove("hidden"))},m=()=>{const e=document.getElementById("url-post-filter");let t=document.getElementById(l);!t&&e&&(t=document.createElement("button"),t.id=l,t.classList.add("button"),t.innerText=(0,r.__)("Show all","amp"),e.appendChild(t))},h=()=>{document.getElementById("url-post-filter").addEventListener("click",(e=>{if(!e.target.matches("#"+l))return;e.preventDefault();const t=document.querySelectorAll("[data-error-type]");t.forEach((e=>{e.parentElement.parentElement.classList.remove("hidden")})),y(t.length,t.length),e.target.classList.add("hidden"),document.getElementById("amp_validation_error_type").selectedIndex=0}))},v=()=>{document.getElementById("amp_validation_error_type").addEventListener("change",(e=>{if(!e.target.matches("select"))return;e.preventDefault();const t=document.getElementById(l),n="-1"===e.target.value,r=document.querySelectorAll("[data-error-type]");n&&t&&t.classList.add("hidden");let o=0;r.forEach((t=>{const r=t.getAttribute("data-error-type");n||!e.target.value||e.target.value===r?(t.parentElement.parentElement.classList.remove("hidden"),o++):t.parentElement.parentElement.classList.add("hidden")})),y(o,r.length)}))},g=()=>{const e=document.getElementById("search-submit");e&&e.addEventListener("click",(e=>{if(e.preventDefault(),!e.target.matches("input"))return;const t=document.getElementById("invalid-url-search-search-input").value,n=document.querySelectorAll("tbody .column-details");let r=0;n.forEach((e=>{let n=!1;e.querySelectorAll(".detailed").forEach((e=>{-1!==e.innerText.indexOf(t)&&(n=!0)})),n?(e.parentElement.classList.remove("hidden"),r++):e.parentElement.classList.add("hidden")})),y(r,n.length)}))},b=()=>{document.querySelectorAll('tr[id^="tag-"]').forEach((e=>{const t=e.querySelector(".amp-validation-error-status"),n=e.querySelector(".amp-validation-error-status-review");t&&t.addEventListener("change",(()=>e.classList.toggle("kept"))),n&&n.addEventListener("change",(()=>e.classList.toggle("new")))}))},E=()=>{const e=document.querySelector("button.action.remove"),t=document.querySelector("button.action.keep"),r=document.getElementById("remove-keep-buttons"),o=e=>{let t;e.target.matches("[type=checkbox]")&&(e.target.checked?r.classList.remove("hidden"):(t=!1,document.querySelectorAll(".check-column [type=checkbox]").forEach((e=>{e.checked&&(t=!0)})),t||r.classList.add("hidden")))};document.querySelectorAll(".check-column [type=checkbox]").forEach((e=>{e.addEventListener("change",o)})),e.addEventListener("click",(()=>{Array.prototype.forEach.call(document.querySelectorAll("select.amp-validation-error-status"),(e=>{const t=e.closest("tr");t.querySelector(".check-column input[type=checkbox]").checked&&(e.value="3",t.classList.remove("kept"),d())}))})),t.addEventListener("click",(()=>{Array.prototype.forEach.call(document.querySelectorAll("select.amp-validation-error-status"),(e=>{const t=e.closest("tr");t.querySelector(".check-column input[type=checkbox]").checked&&(e.value="2",t.classList.add("kept"),d())}))})),n.g.addEventListener("click",(({target:e})=>{if(!e.classList.contains("reviewed-toggle"))return;const t=e.classList.contains("reviewed");i({checkedOnly:!0}).forEach((e=>{e.querySelector("input[type=checkbox].amp-validation-error-status-review").checked=t,e.classList.toggle("new",!t),d()}))}))},S=()=>{const e=document.getElementById("amp_stylesheets");for(const t of e.querySelectorAll(".toggle-stylesheet-details")){const e=t.closest("tr");t.addEventListener("click",(()=>{e.classList.toggle("expanded")}))}for(const t of e.querySelectorAll(".stylesheet-details")){const e=t.querySelector(".shaken-stylesheet"),n=t.querySelector(".show-removed-styles");n&&n.addEventListener("click",(()=>{e.classList.toggle("removed-styles-shown",n.checked)}))}}})()})();