@loomhq/loom-embed
Advanced tools
Comparing version 1.1.6 to 1.1.7
@@ -1,2 +0,2 @@ | ||
!function(t,r){"object"==typeof exports&&"object"==typeof module?module.exports=r():"function"==typeof define&&define.amd?define([],r):"object"==typeof exports?exports.loom=r():t.loom=r()}("undefined"!=typeof self?self:this,(function(){return function(t){var r={};function e(n){if(r[n])return r[n].exports;var o=r[n]={i:n,l:!1,exports:{}};return t[n].call(o.exports,o,o.exports,e),o.l=!0,o.exports}return e.m=t,e.c=r,e.d=function(t,r,n){e.o(t,r)||Object.defineProperty(t,r,{enumerable:!0,get:n})},e.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},e.t=function(t,r){if(1&r&&(t=e(t)),8&r)return t;if(4&r&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(e.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&r&&"string"!=typeof t)for(var o in t)e.d(n,o,function(r){return t[r]}.bind(null,o));return n},e.n=function(t){var r=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(r,"a",r),r},e.o=function(t,r){return Object.prototype.hasOwnProperty.call(t,r)},e.p="",e(e.s=12)}([,function(t,r,e){t.exports=e(16)},,function(t,r,e){"use strict";e.d(r,"d",(function(){return n})),e.d(r,"c",(function(){return o})),e.d(r,"b",(function(){return i})),e.d(r,"a",(function(){return a}));var n=new RegExp("^".concat("(https?://)?(www.)?((use)?loom.com/share/[a-f0-9]+)","$")),o=new RegExp("".concat("(https?://)?(www.)?((use)?loom.com/share/[a-f0-9]+)"),"g"),i=/((use)?loom)+\.com/i,a="lo-link-replaced"},function(t,r){t.exports=function(t,r,e){return r in t?Object.defineProperty(t,r,{value:e,enumerable:!0,configurable:!0,writable:!0}):t[r]=e,t}},function(t,r){function e(t,r,e,n,o,i,a){try{var c=t[i](a),u=c.value}catch(t){return void e(t)}c.done?r(u):Promise.resolve(u).then(n,o)}t.exports=function(t){return function(){var r=this,n=arguments;return new Promise((function(o,i){var a=t.apply(r,n);function c(t){e(a,o,i,c,u,"next",t)}function u(t){e(a,o,i,c,u,"throw",t)}c(void 0)}))}}},,,,,,function(t,r,e){var n=e(20),o=e(21),i=e(14),a=e(22);t.exports=function(t,r){return n(t)||o(t,r)||i(t,r)||a()}},function(t,r,e){"use strict";e.r(r),e.d(r,"oembed",(function(){return j})),e.d(r,"linkReplace",(function(){return L})),e.d(r,"textReplace",(function(){return k})),e.d(r,"validate",(function(){return m}));var n=e(1),o=e.n(n),i=e(5),a=e.n(i),c=e(15),u=e.n(c),f=e(4),l=e.n(f),s=e(11),p=e.n(s),h=e(3),d=function(t){return h.d.test(t)},y=function(t){return d(t)},v=function(t){return"A"===t.nodeName&&!t.className.includes(h.a)&&y(t.href)},m={isLoomUrl:d};function b(t,r){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable}))),e.push.apply(e,n)}return e}function g(t){for(var r=1;r<arguments.length;r++){var e=null!=arguments[r]?arguments[r]:{};r%2?b(Object(e),!0).forEach((function(r){l()(t,r,e[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(e)):b(Object(e)).forEach((function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(e,r))}))}return t}var w=/src=["']+(https?:\/\/[a-zA-z\d\.\/?&]+)/,x=function(t,r){var e=r.width,n=r.height,o=t.width,i=t.height;if(e||n)return t;var a,c,u,f,l=t.html.match(w),s=p()(l,2)[1],h=i/o;return g(g({},t),{},{html:(a=s,c=h,u="".concat(100*c,"%"),f="position: relative; padding-bottom: ".concat(u,"; height: 0;"),'<div class="lo-emb-vid" style="'.concat(f,'"><iframe src="').concat(a,'" ')+'frameborder="0" webkitallowfullscreen mozallowfullscreen '+'allowfullscreen style="'.concat("position: absolute; top: 0; left: 0; width: 100%; height: 100%;",'"></iframe></div>'))})},O=function(t,r){if(d(t))return function(t,r){var e=r.width,n=r.height,o=e?"&maxwidth=".concat(e):"",i=n?"&maxheight=".concat(n):"",a=t.match(h.b),c=p()(a,1)[0];return"https://www.".concat(c,"/v1/oembed?url=").concat(t).concat(o).concat(i)}(t,r);throw new Error("URL is not from a supported video provider")},j=function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},e=y(t);if(e)return fetch(O(t,r)).then((function(t){return t.json()})).then((function(t){return x(t,r)})).catch((function(){throw new Error("Unable to fetch oembed data")}));throw new Error("URL is not from a supported video provider")},E=function(t,r){var e,n,o=(e=r,(n=document.createElement("div")).innerHTML=e,n.firstChild);t.parentNode.insertBefore(o,t)},L=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"a",r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:document,n=u()(e.querySelectorAll(t));n.filter(v).forEach(function(){var t=a()(o.a.mark((function t(e){var n,i;return o.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,j(e.href,r);case 2:return n=t.sent,i=n.html,E(e,i),e.className="".concat(e.className," ").concat(h.a),t.abrupt("return",!0);case 7:case"end":return t.stop()}}),t)})));return function(r){return t.apply(this,arguments)}}())};function P(t,r){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable}))),e.push.apply(e,n)}return e}function S(t){for(var r=1;r<arguments.length;r++){var e=null!=arguments[r]?arguments[r]:{};r%2?P(Object(e),!0).forEach((function(r){l()(t,r,e[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(e)):P(Object(e)).forEach((function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(e,r))}))}return t}var _=function(t){var r=t.match(h.d),e=p()(r,4)[3];return{originalUrl:t,requestUrl:"https://".concat(e)}},k=function(){var t=a()(o.a.mark((function t(r,e){var n,i,c,u;return o.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(i=(n=r||"").match(h.c)){t.next=4;break}return t.abrupt("return",n);case 4:return c=i.map(_).map(function(){var t=a()(o.a.mark((function t(r){var n,i;return o.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,j(r.requestUrl,e);case 2:return n=t.sent,i=n.html,t.abrupt("return",S(S({},r),{},{embedCode:i}));case 5:case"end":return t.stop()}}),t)})));return function(r){return t.apply(this,arguments)}}()),t.next=7,Promise.all(c);case 7:return u=t.sent,t.abrupt("return",u.reduce((function(t,r){var e=r.originalUrl,n=r.embedCode,o=new RegExp(e,"g");return t.replace(o,n)}),n));case 9:case"end":return t.stop()}}),t)})));return function(r,e){return t.apply(this,arguments)}}()},function(t,r){t.exports=function(t,r){(null==r||r>t.length)&&(r=t.length);for(var e=0,n=new Array(r);e<r;e++)n[e]=t[e];return n}},function(t,r,e){var n=e(13);t.exports=function(t,r){if(t){if("string"==typeof t)return n(t,r);var e=Object.prototype.toString.call(t).slice(8,-1);return"Object"===e&&t.constructor&&(e=t.constructor.name),"Map"===e||"Set"===e?Array.from(t):"Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?n(t,r):void 0}}},function(t,r,e){var n=e(17),o=e(18),i=e(14),a=e(19);t.exports=function(t){return n(t)||o(t)||i(t)||a()}},function(t,r,e){var n=function(t){"use strict";var r=Object.prototype,e=r.hasOwnProperty,n="function"==typeof Symbol?Symbol:{},o=n.iterator||"@@iterator",i=n.asyncIterator||"@@asyncIterator",a=n.toStringTag||"@@toStringTag";function c(t,r,e){return Object.defineProperty(t,r,{value:e,enumerable:!0,configurable:!0,writable:!0}),t[r]}try{c({},"")}catch(t){c=function(t,r,e){return t[r]=e}}function u(t,r,e,n){var o=r&&r.prototype instanceof s?r:s,i=Object.create(o.prototype),a=new j(n||[]);return i._invoke=function(t,r,e){var n="suspendedStart";return function(o,i){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw i;return L()}for(e.method=o,e.arg=i;;){var a=e.delegate;if(a){var c=w(a,e);if(c){if(c===l)continue;return c}}if("next"===e.method)e.sent=e._sent=e.arg;else if("throw"===e.method){if("suspendedStart"===n)throw n="completed",e.arg;e.dispatchException(e.arg)}else"return"===e.method&&e.abrupt("return",e.arg);n="executing";var u=f(t,r,e);if("normal"===u.type){if(n=e.done?"completed":"suspendedYield",u.arg===l)continue;return{value:u.arg,done:e.done}}"throw"===u.type&&(n="completed",e.method="throw",e.arg=u.arg)}}}(t,e,a),i}function f(t,r,e){try{return{type:"normal",arg:t.call(r,e)}}catch(t){return{type:"throw",arg:t}}}t.wrap=u;var l={};function s(){}function p(){}function h(){}var d={};d[o]=function(){return this};var y=Object.getPrototypeOf,v=y&&y(y(E([])));v&&v!==r&&e.call(v,o)&&(d=v);var m=h.prototype=s.prototype=Object.create(d);function b(t){["next","throw","return"].forEach((function(r){c(t,r,(function(t){return this._invoke(r,t)}))}))}function g(t,r){var n;this._invoke=function(o,i){function a(){return new r((function(n,a){!function n(o,i,a,c){var u=f(t[o],t,i);if("throw"!==u.type){var l=u.arg,s=l.value;return s&&"object"==typeof s&&e.call(s,"__await")?r.resolve(s.__await).then((function(t){n("next",t,a,c)}),(function(t){n("throw",t,a,c)})):r.resolve(s).then((function(t){l.value=t,a(l)}),(function(t){return n("throw",t,a,c)}))}c(u.arg)}(o,i,n,a)}))}return n=n?n.then(a,a):a()}}function w(t,r){var e=t.iterator[r.method];if(void 0===e){if(r.delegate=null,"throw"===r.method){if(t.iterator.return&&(r.method="return",r.arg=void 0,w(t,r),"throw"===r.method))return l;r.method="throw",r.arg=new TypeError("The iterator does not provide a 'throw' method")}return l}var n=f(e,t.iterator,r.arg);if("throw"===n.type)return r.method="throw",r.arg=n.arg,r.delegate=null,l;var o=n.arg;return o?o.done?(r[t.resultName]=o.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=void 0),r.delegate=null,l):o:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,l)}function x(t){var r={tryLoc:t[0]};1 in t&&(r.catchLoc=t[1]),2 in t&&(r.finallyLoc=t[2],r.afterLoc=t[3]),this.tryEntries.push(r)}function O(t){var r=t.completion||{};r.type="normal",delete r.arg,t.completion=r}function j(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(x,this),this.reset(!0)}function E(t){if(t){var r=t[o];if(r)return r.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,i=function r(){for(;++n<t.length;)if(e.call(t,n))return r.value=t[n],r.done=!1,r;return r.value=void 0,r.done=!0,r};return i.next=i}}return{next:L}}function L(){return{value:void 0,done:!0}}return p.prototype=m.constructor=h,h.constructor=p,p.displayName=c(h,a,"GeneratorFunction"),t.isGeneratorFunction=function(t){var r="function"==typeof t&&t.constructor;return!!r&&(r===p||"GeneratorFunction"===(r.displayName||r.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,h):(t.__proto__=h,c(t,a,"GeneratorFunction")),t.prototype=Object.create(m),t},t.awrap=function(t){return{__await:t}},b(g.prototype),g.prototype[i]=function(){return this},t.AsyncIterator=g,t.async=function(r,e,n,o,i){void 0===i&&(i=Promise);var a=new g(u(r,e,n,o),i);return t.isGeneratorFunction(e)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},b(m),c(m,a,"Generator"),m[o]=function(){return this},m.toString=function(){return"[object Generator]"},t.keys=function(t){var r=[];for(var e in t)r.push(e);return r.reverse(),function e(){for(;r.length;){var n=r.pop();if(n in t)return e.value=n,e.done=!1,e}return e.done=!0,e}},t.values=E,j.prototype={constructor:j,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(O),!t)for(var r in this)"t"===r.charAt(0)&&e.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var r=this;function n(e,n){return a.type="throw",a.arg=t,r.next=e,n&&(r.method="next",r.arg=void 0),!!n}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var c=e.call(i,"catchLoc"),u=e.call(i,"finallyLoc");if(c&&u){if(this.prev<i.catchLoc)return n(i.catchLoc,!0);if(this.prev<i.finallyLoc)return n(i.finallyLoc)}else if(c){if(this.prev<i.catchLoc)return n(i.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return n(i.finallyLoc)}}}},abrupt:function(t,r){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&e.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=r&&r<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=r,i?(this.method="next",this.next=i.finallyLoc,l):this.complete(a)},complete:function(t,r){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&r&&(this.next=r),l},finish:function(t){for(var r=this.tryEntries.length-1;r>=0;--r){var e=this.tryEntries[r];if(e.finallyLoc===t)return this.complete(e.completion,e.afterLoc),O(e),l}},catch:function(t){for(var r=this.tryEntries.length-1;r>=0;--r){var e=this.tryEntries[r];if(e.tryLoc===t){var n=e.completion;if("throw"===n.type){var o=n.arg;O(e)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,r,e){return this.delegate={iterator:E(t),resultName:r,nextLoc:e},"next"===this.method&&(this.arg=void 0),l}},t}(t.exports);try{regeneratorRuntime=n}catch(t){Function("r","regeneratorRuntime = r")(n)}},function(t,r,e){var n=e(13);t.exports=function(t){if(Array.isArray(t))return n(t)}},function(t,r){t.exports=function(t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(t))return Array.from(t)}},function(t,r){t.exports=function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}},function(t,r){t.exports=function(t){if(Array.isArray(t))return t}},function(t,r){t.exports=function(t,r){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(t)){var e=[],n=!0,o=!1,i=void 0;try{for(var a,c=t[Symbol.iterator]();!(n=(a=c.next()).done)&&(e.push(a.value),!r||e.length!==r);n=!0);}catch(t){o=!0,i=t}finally{try{n||null==c.return||c.return()}finally{if(o)throw i}}return e}}},function(t,r){t.exports=function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}}])})); | ||
!function(t,r){"object"==typeof exports&&"object"==typeof module?module.exports=r():"function"==typeof define&&define.amd?define([],r):"object"==typeof exports?exports.loom=r():t.loom=r()}("undefined"!=typeof self?self:this,function(){return function(t){var r={};function e(n){if(r[n])return r[n].exports;var o=r[n]={i:n,l:!1,exports:{}};return t[n].call(o.exports,o,o.exports,e),o.l=!0,o.exports}return e.m=t,e.c=r,e.d=function(t,r,n){e.o(t,r)||Object.defineProperty(t,r,{enumerable:!0,get:n})},e.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},e.t=function(t,r){if(1&r&&(t=e(t)),8&r)return t;if(4&r&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(e.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&r&&"string"!=typeof t)for(var o in t)e.d(n,o,function(r){return t[r]}.bind(null,o));return n},e.n=function(t){var r=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(r,"a",r),r},e.o=function(t,r){return Object.prototype.hasOwnProperty.call(t,r)},e.p="",e(e.s=12)}([,function(t,r,e){t.exports=e(14)},function(t,r,e){"use strict";e.d(r,"d",function(){return o}),e.d(r,"c",function(){return i}),e.d(r,"b",function(){return c}),e.d(r,"a",function(){return a});var n="(?:https?://)?((?:stage.loom.com|loom.com|www.loom.com|loomlocal.com:4444)/share/[a-f0-9]+)",o=new RegExp("^".concat(n,"$")),i=new RegExp("".concat(n),"g"),c=/(www\.loom\.com|loom\.com|stage\.loom\.com|loomlocal\.com:4444)/i,a="lo-link-replaced"},function(t,r){t.exports=function(t,r,e){return r in t?Object.defineProperty(t,r,{value:e,enumerable:!0,configurable:!0,writable:!0}):t[r]=e,t}},function(t,r){function e(t,r,e,n,o,i,c){try{var a=t[i](c),u=a.value}catch(t){return void e(t)}a.done?r(u):Promise.resolve(u).then(n,o)}t.exports=function(t){return function(){var r=this,n=arguments;return new Promise(function(o,i){var c=t.apply(r,n);function a(t){e(c,o,i,a,u,"next",t)}function u(t){e(c,o,i,a,u,"throw",t)}a(void 0)})}}},,,,,,,function(t,r,e){var n=e(18),o=e(19),i=e(20);t.exports=function(t,r){return n(t)||o(t,r)||i()}},function(t,r,e){"use strict";e.r(r);var n=e(1),o=e.n(n),i=e(4),c=e.n(i),a=e(13),u=e.n(a),f=e(3),l=e.n(f),s=e(11),h=e.n(s),p=e(2),d=function(t){return p.d.test(t)},y=function(t){return d(t)},v=function(t){return"A"===t.nodeName&&!t.className.includes(p.a)&&y(t.href)},m={isLoomUrl:d};function g(t,r){var e=Object.keys(t);return Object.getOwnPropertySymbols&&e.push.apply(e,Object.getOwnPropertySymbols(t)),r&&(e=e.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),e}var w=/src=["']+(https?:\/\/[a-zA-z\d:\.\/?&]+)/,b=function(t,r){var e=r.width,n=r.height,o=t.width,i=t.height;if(e||n)return t;var c,a,u,f,s=t.html.match(w),p=h()(s,2)[1];return function(t){for(var r=1;r<arguments.length;r++){var e=null!=arguments[r]?arguments[r]:{};r%2?g(e,!0).forEach(function(r){l()(t,r,e[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(e)):g(e).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(e,r))})}return t}({},t,{html:(c=p,a=i/o,u="".concat(100*a,"%"),f="position: relative; padding-bottom: ".concat(u,"; height: 0;"),'<div class="lo-emb-vid" style="'.concat(f,'"><iframe src="').concat(c,'" ')+'frameborder="0" webkitallowfullscreen mozallowfullscreen '+'allowfullscreen style="'.concat("position: absolute; top: 0; left: 0; width: 100%; height: 100%;",'"></iframe></div>'))})},x=function(t,r){if(d(t))return function(t,r){var e=r.width,n=r.height,o=e?"&maxwidth=".concat(e):"",i=n?"&maxheight=".concat(n):"",c=t.match(p.b),a=h()(c,1)[0],u=a;return"loom.com"===a&&(u="www.".concat(a)),"https://".concat(u,"/v1/oembed?url=").concat(t).concat(o).concat(i)}(t,r);throw new Error("URL is not from a supported video provider")},O=function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},e=y(t);if(e)return fetch(x(t,r)).then(function(t){return t.json()}).then(function(t){return b(t,r)}).catch(function(){throw new Error("Unable to fetch oembed data")});throw new Error("URL is not from a supported video provider")},j=function(t,r){var e,n,o=(e=r,(n=document.createElement("div")).innerHTML=e,n.firstChild);t.parentNode.insertBefore(o,t)},E=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"a",r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:document,n=u()(e.querySelectorAll(t));n.filter(v).forEach((i=c()(o.a.mark(function t(e){var n,i;return o.a.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,O(e.href,r);case 2:return n=t.sent,i=n.html,j(e,i),e.className="".concat(e.className," ").concat(p.a),t.abrupt("return",!0);case 7:case"end":return t.stop()}},t)})),function(t){return i.apply(this,arguments)}));var i};function L(t,r){var e=Object.keys(t);return Object.getOwnPropertySymbols&&e.push.apply(e,Object.getOwnPropertySymbols(t)),r&&(e=e.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),e}function P(t){for(var r=1;r<arguments.length;r++){var e=null!=arguments[r]?arguments[r]:{};r%2?L(e,!0).forEach(function(r){l()(t,r,e[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(e)):L(e).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(e,r))})}return t}var _=function(t){var r=t.match(p.d),e=h()(r,2)[1];return{originalUrl:t,requestUrl:"https://".concat(e)}},S=function(){var t=c()(o.a.mark(function t(r,e){var n,i,a,u;return o.a.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(i=(n=r||"").match(p.c)){t.next=4;break}return t.abrupt("return",n);case 4:return a=i.map(_).map(function(){var t=c()(o.a.mark(function t(r){var n,i;return o.a.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,O(r.requestUrl,e);case 2:return n=t.sent,i=n.html,t.abrupt("return",P({},r,{embedCode:i}));case 5:case"end":return t.stop()}},t)}));return function(r){return t.apply(this,arguments)}}()),t.next=7,Promise.all(a);case 7:return u=t.sent,t.abrupt("return",u.reduce(function(t,r){var e=r.originalUrl,n=r.embedCode,o=new RegExp(e,"g");return t.replace(o,n)},n));case 9:case"end":return t.stop()}},t)}));return function(r,e){return t.apply(this,arguments)}}();e.d(r,"oembed",function(){return O}),e.d(r,"linkReplace",function(){return E}),e.d(r,"textReplace",function(){return S}),e.d(r,"validate",function(){return m})},function(t,r,e){var n=e(15),o=e(16),i=e(17);t.exports=function(t){return n(t)||o(t)||i()}},function(t,r,e){var n=function(t){"use strict";var r,e=Object.prototype,n=e.hasOwnProperty,o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",c=o.asyncIterator||"@@asyncIterator",a=o.toStringTag||"@@toStringTag";function u(t,r,e,n){var o=r&&r.prototype instanceof y?r:y,i=Object.create(o.prototype),c=new _(n||[]);return i._invoke=function(t,r,e){var n=l;return function(o,i){if(n===h)throw new Error("Generator is already running");if(n===p){if("throw"===o)throw i;return k()}for(e.method=o,e.arg=i;;){var c=e.delegate;if(c){var a=E(c,e);if(a){if(a===d)continue;return a}}if("next"===e.method)e.sent=e._sent=e.arg;else if("throw"===e.method){if(n===l)throw n=p,e.arg;e.dispatchException(e.arg)}else"return"===e.method&&e.abrupt("return",e.arg);n=h;var u=f(t,r,e);if("normal"===u.type){if(n=e.done?p:s,u.arg===d)continue;return{value:u.arg,done:e.done}}"throw"===u.type&&(n=p,e.method="throw",e.arg=u.arg)}}}(t,e,c),i}function f(t,r,e){try{return{type:"normal",arg:t.call(r,e)}}catch(t){return{type:"throw",arg:t}}}t.wrap=u;var l="suspendedStart",s="suspendedYield",h="executing",p="completed",d={};function y(){}function v(){}function m(){}var g={};g[i]=function(){return this};var w=Object.getPrototypeOf,b=w&&w(w(S([])));b&&b!==e&&n.call(b,i)&&(g=b);var x=m.prototype=y.prototype=Object.create(g);function O(t){["next","throw","return"].forEach(function(r){t[r]=function(t){return this._invoke(r,t)}})}function j(t){var r;this._invoke=function(e,o){function i(){return new Promise(function(r,i){!function r(e,o,i,c){var a=f(t[e],t,o);if("throw"!==a.type){var u=a.arg,l=u.value;return l&&"object"==typeof l&&n.call(l,"__await")?Promise.resolve(l.__await).then(function(t){r("next",t,i,c)},function(t){r("throw",t,i,c)}):Promise.resolve(l).then(function(t){u.value=t,i(u)},function(t){return r("throw",t,i,c)})}c(a.arg)}(e,o,r,i)})}return r=r?r.then(i,i):i()}}function E(t,e){var n=t.iterator[e.method];if(n===r){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=r,E(t,e),"throw"===e.method))return d;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return d}var o=f(n,t.iterator,e.arg);if("throw"===o.type)return e.method="throw",e.arg=o.arg,e.delegate=null,d;var i=o.arg;return i?i.done?(e[t.resultName]=i.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=r),e.delegate=null,d):i:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,d)}function L(t){var r={tryLoc:t[0]};1 in t&&(r.catchLoc=t[1]),2 in t&&(r.finallyLoc=t[2],r.afterLoc=t[3]),this.tryEntries.push(r)}function P(t){var r=t.completion||{};r.type="normal",delete r.arg,t.completion=r}function _(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(L,this),this.reset(!0)}function S(t){if(t){var e=t[i];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,c=function e(){for(;++o<t.length;)if(n.call(t,o))return e.value=t[o],e.done=!1,e;return e.value=r,e.done=!0,e};return c.next=c}}return{next:k}}function k(){return{value:r,done:!0}}return v.prototype=x.constructor=m,m.constructor=v,m[a]=v.displayName="GeneratorFunction",t.isGeneratorFunction=function(t){var r="function"==typeof t&&t.constructor;return!!r&&(r===v||"GeneratorFunction"===(r.displayName||r.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,m):(t.__proto__=m,a in t||(t[a]="GeneratorFunction")),t.prototype=Object.create(x),t},t.awrap=function(t){return{__await:t}},O(j.prototype),j.prototype[c]=function(){return this},t.AsyncIterator=j,t.async=function(r,e,n,o){var i=new j(u(r,e,n,o));return t.isGeneratorFunction(e)?i:i.next().then(function(t){return t.done?t.value:i.next()})},O(x),x[a]="Generator",x[i]=function(){return this},x.toString=function(){return"[object Generator]"},t.keys=function(t){var r=[];for(var e in t)r.push(e);return r.reverse(),function e(){for(;r.length;){var n=r.pop();if(n in t)return e.value=n,e.done=!1,e}return e.done=!0,e}},t.values=S,_.prototype={constructor:_,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=r,this.done=!1,this.delegate=null,this.method="next",this.arg=r,this.tryEntries.forEach(P),!t)for(var e in this)"t"===e.charAt(0)&&n.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=r)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function o(n,o){return a.type="throw",a.arg=t,e.next=n,o&&(e.method="next",e.arg=r),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var c=this.tryEntries[i],a=c.completion;if("root"===c.tryLoc)return o("end");if(c.tryLoc<=this.prev){var u=n.call(c,"catchLoc"),f=n.call(c,"finallyLoc");if(u&&f){if(this.prev<c.catchLoc)return o(c.catchLoc,!0);if(this.prev<c.finallyLoc)return o(c.finallyLoc)}else if(u){if(this.prev<c.catchLoc)return o(c.catchLoc,!0)}else{if(!f)throw new Error("try statement without catch or finally");if(this.prev<c.finallyLoc)return o(c.finallyLoc)}}}},abrupt:function(t,r){for(var e=this.tryEntries.length-1;e>=0;--e){var o=this.tryEntries[e];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=r&&r<=i.finallyLoc&&(i=null);var c=i?i.completion:{};return c.type=t,c.arg=r,i?(this.method="next",this.next=i.finallyLoc,d):this.complete(c)},complete:function(t,r){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&r&&(this.next=r),d},finish:function(t){for(var r=this.tryEntries.length-1;r>=0;--r){var e=this.tryEntries[r];if(e.finallyLoc===t)return this.complete(e.completion,e.afterLoc),P(e),d}},catch:function(t){for(var r=this.tryEntries.length-1;r>=0;--r){var e=this.tryEntries[r];if(e.tryLoc===t){var n=e.completion;if("throw"===n.type){var o=n.arg;P(e)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:S(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=r),d}},t}(t.exports);try{regeneratorRuntime=n}catch(t){Function("r","regeneratorRuntime = r")(n)}},function(t,r){t.exports=function(t){if(Array.isArray(t)){for(var r=0,e=new Array(t.length);r<t.length;r++)e[r]=t[r];return e}}},function(t,r){t.exports=function(t){if(Symbol.iterator in Object(t)||"[object Arguments]"===Object.prototype.toString.call(t))return Array.from(t)}},function(t,r){t.exports=function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}},function(t,r){t.exports=function(t){if(Array.isArray(t))return t}},function(t,r){t.exports=function(t,r){var e=[],n=!0,o=!1,i=void 0;try{for(var c,a=t[Symbol.iterator]();!(n=(c=a.next()).done)&&(e.push(c.value),!r||e.length!==r);n=!0);}catch(t){o=!0,i=t}finally{try{n||null==a.return||a.return()}finally{if(o)throw i}}return e}},function(t,r){t.exports=function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}}])}); | ||
//# sourceMappingURL=sdk.js.map |
{ | ||
"name": "@loomhq/loom-embed", | ||
"version": "1.1.6", | ||
"version": "1.1.7", | ||
"description": "SDK for easy embedding videos", | ||
@@ -5,0 +5,0 @@ "main": "dist/sdk.js", |
@@ -1,7 +0,7 @@ | ||
const LOOM_BASE_REGEX_STR = '(https?:\/\/)?(www\.)?((use)?loom\.com\/share\/[a-f0-9]+)'; | ||
const LOOM_BASE_REGEX_STR = '(?:https?:\/\/)?((?:stage\.loom\.com|loom\.com|www\.loom.com|loomlocal\.com:4444)\/share\/[a-f0-9]+)'; | ||
export const LOOM_URL_REGEX = new RegExp(`^${LOOM_BASE_REGEX_STR}$`); | ||
export const LOOM_URL_MATCH_REGEX = new RegExp(`${LOOM_BASE_REGEX_STR}`, 'g'); | ||
export const LOOM_HOSTNAME_CAPTURE = /((use)?loom)+\.com/i; | ||
export const LOOM_HOSTNAME_CAPTURE = /(www\.loom\.com|loom\.com|stage\.loom\.com|loomlocal\.com:4444)/i; | ||
export const LINK_REPLACED_CLASS = 'lo-link-replaced'; |
@@ -1,5 +0,6 @@ | ||
import { isValidEmbedUrl, isLoomUrl } from './validate'; | ||
import { isLoomUrl, isValidEmbedUrl } from './validate'; | ||
import { LOOM_HOSTNAME_CAPTURE } from './common'; | ||
const SRC_URL_REGEX = /src=["']+(https?:\/\/[a-zA-z\d\.\/?&]+)/ | ||
const SRC_URL_REGEX = /src=["']+(https?:\/\/[a-zA-z\d:\.\/?&]+)/ | ||
@@ -43,4 +44,9 @@ const getResponsiveEmbedCode = (embedURL, heightAspectRatio) => { | ||
const [loomDomain] = url.match(LOOM_HOSTNAME_CAPTURE); | ||
let loomBaseDomain = loomDomain; | ||
return `https://www.${loomDomain}/v1/oembed?url=${url}${maxWidth}${maxHeight}`; | ||
if (loomDomain === 'loom.com') { | ||
loomBaseDomain = `www.${loomDomain}`; | ||
} | ||
return `https://${loomBaseDomain}/v1/oembed?url=${url}${maxWidth}${maxHeight}`; | ||
}; | ||
@@ -47,0 +53,0 @@ |
import { LOOM_URL_MATCH_REGEX, LOOM_URL_REGEX } from './common'; | ||
import oembed from './oembed'; | ||
const normalizeUrls = (url) => { | ||
const [,,, loomBaseUrl] = url.match(LOOM_URL_REGEX); | ||
const [, loomBaseUrl] = url.match(LOOM_URL_REGEX); | ||
@@ -7,0 +8,0 @@ return { |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
651277
1504
4