iwmlib/dist/iwmlib.3rdparty.min.js

1 line
1.7 MiB
JavaScript
Raw Normal View History

2019-07-18 08:52:46 +02:00
var e;!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.OptimalSelect=t():e.OptimalSelect=t()}(this,function(){return function(r){var i={};function n(e){if(i[e])return i[e].exports;var t=i[e]={i:e,l:!1,exports:{}};return r[e].call(t.exports,t,t.exports,n),t.l=!0,t.exports}return n.m=r,n.c=i,n.i=function(e){return e},n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:r})},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=6)}([function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.convertNodeList=function(e){for(var t=e.length,r=new Array(t),i=0;i<t;i++)r[i]=e[i];return r},t.escapeValue=function(e){return e&&e.replace(/['"`\\/:\?&!#$%^()[\]{|}*+;,.<=>@~]/g,"\\$&").replace(/\n/g,"A")}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getCommonAncestor=function(e){var t=(1<arguments.length&&void 0!==arguments[1]?arguments[1]:{}).root,i=void 0===t?document:t,n=[];e.forEach(function(e,t){for(var r=[];e!==i;)e=e.parentNode,r.unshift(e);n[t]=r}),n.sort(function(e,t){return e.length-t.length});for(var r=n.shift(),a=null,o=function(){var t=r[s],e=n.some(function(e){return!e.some(function(e){return e===t})});if(e)return"break";a=t},s=0,u=r.length;s<u;s++){var l=o();if("break"===l)break}return a},t.getCommonProperties=function(e){var c={classes:[],attributes:{},tag:null};return e.forEach(function(e){var n,i,t,r,a=c.classes,o=c.attributes,s=c.tag;if(void 0!==a){var u=e.getAttribute("class");u?(u=u.trim().split(" "),a.length?(a=a.filter(function(t){return u.some(function(e){return e===t})})).length?c.classes=a:delete c.classes:c.classes=u):delete c.classes}if(void 0!==o&&(n=e.attributes,i=Object.keys(n).reduce(function(e,t){var r=n[t],i=r.name;return r&&"class"!==i&&(e[i]=r.value),e},{}),t=Object.keys(i),r=Object.keys(o),t.length?r.length?(o=r.reduce(function(e,t){var r=o[t];return r===i[t]&&(e[t]=r),e},{}),Object.keys(o).length?c.attributes=o:delete c.attributes):c.attributes=i:delete c.attributes),void 0!==s){var l=e.tagName.toLowerCase();s?l!==s&&delete c.tag:c.tag=l}}),c}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t){var r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{};Array.isArray(t)||(t=t.length?(0,h.convertNodeList)(t):[t]);if(!t.length||t.some(function(e){return 1!==e.nodeType}))throw new Error('Invalid input - to compare HTMLElements its necessary to provide a reference of the selected node(s)! (missing "elements")');(0,c.default)(t[0],r);var i=e.replace(/> /g,">").split(/\s+(?=(?:(?:[^"]*"){2})*[^"]*$)/);if(i.length<2)return f("",e,"",t);var n=[i.pop()];for(;1<i.length;){var a=i.pop(),o=i.join(" "),s=n.join(" "),u=o+" "+s,l=document.querySelectorAll(u);l.length!==t.length&&n.unshift(f(o,a,s,t))}n.unshift(i[0]),(i=n)[0]=f("",i[0],i.slice(1).join(" "),t),i[i.length-1]=f(i.slice(0,-1).join(" "),i[i.length-1],"",t);return i.join(" ").replace(/>/g,"> ").trim()};var i,n=r(3),c=(i=n)&&i.__esModule?i:{default:i},h=r(0);function f(r,i,n,a){if(r.length&&(r+=" "),n.length&&(n=" "+n),/\[*\]/.test(i)){var e=i.replace(/=.*$/,"]"),o=""+r+e+n;if(g(document.querySelectorAll(o),a))i=e;else for(var s=document.querySelectorAll(""+r+e),t=function(){var t=s[u];if(a.some(function(e){return t.contains(e)})){var e=t.tagName.toLowerCase();return o=""+r+e+n,g(document.querySelectorAll(o),a)&&(i=e),"break"}},u=0,l=s.length;u<l;u++){if("break"===t())break}}if(/>/.test(i)){var c=i.replace(/>/,"");o=""+r+c+n;g(document.querySelectorAll(o),a)&&(i=c)}if(/:nth-child/.test(i)){var h=i.replace(/nth-child/g,"nth-of-type");o=""+r+h+n;g(document.querySelectorAll(o),a)&&(i=h)}if(/\.\S+\.\S+/.test(i)){for(var f=i.trim().split(".").slice(1).map(function(e){return"."+e}).sort(function(e,t){return e.length-t.length});f.length;){var d=i.replace(f.shif