momentic 1.1.6 → 1.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/cli.js +8 -6
- package/package.json +1 -1
package/bin/cli.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="
|
|
3
|
+
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="731773fe-aebe-5d08-bd54-61cc5f454fec")}catch(e){}}();
|
|
4
4
|
var ax=Object.create;var Iu=Object.defineProperty;var lx=Object.getOwnPropertyDescriptor;var cx=Object.getOwnPropertyNames;var dx=Object.getPrototypeOf,px=Object.prototype.hasOwnProperty;var rn=(n,e)=>()=>(e||n((e={exports:{}}).exports,e),e.exports);var ux=(n,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of cx(e))!px.call(n,o)&&o!==t&&Iu(n,o,{get:()=>e[o],enumerable:!(r=lx(e,o))||r.enumerable});return n};var Pu=(n,e,t)=>(t=n!=null?ax(dx(n)):{},ux(e||!n||!n.__esModule?Iu(t,"default",{value:n,enumerable:!0}):t,n));var dy=rn((Ja,$d)=>{"use strict";(function(n){typeof define=="function"&&define.amd?define([],n):typeof Ja=="object"?(Ja=n(),typeof $d=="object"&&($d.exports=Ja)):window?window.JClass=n():typeof console=="object"&&console.error instanceof Function&&console.error("cannot determine environment")})(function(){var n=function(i){return i instanceof Function},e=function(i){var s=Array.prototype.slice.call(arguments,1);for(var a in s){var l=s[a];if(typeof l=="object")for(var c in l)i[c]=l[c]}return i},t={_isClassObject:!1},r=!1,o=function(){};return o._subClasses=[],o.prototype.init=function(){},o._extend=function(i,s,a){i===void 0&&(i={}),s===void 0&&(s={}),a===void 0&&(a={}),a=e({},t,a);var l=function(){r||(this._class=l,this.init instanceof Function&&this.init.apply(this,arguments))},c=this;r=!0;var p=new c;r=!1;var d=c.prototype;l.prototype=p,l.prototype.constructor=l,l._superClass=c,l._subClasses=[],c._subClasses.push(l),l._extend=c._extend,l._extends=function(b){return this._superClass==o?!1:b==this._superClass||b==o?!0:this._superClass._extends(b)};for(var u in i){var m=Object.getOwnPropertyDescriptor(i,u),h=m.value;if(h!==null&&typeof h=="object"&&h.descriptor)Object.defineProperty(p,u,h);else if(!("value"in m)&&("set"in m||"get"in m))Object.defineProperty(p,u,m);else{p[u]=h;var g=d[u];n(h)&&n(g)&&h!==g&&(h._super=g)}}if(!a._isClassObject){var f=c._members===void 0?o:c._members._class,S=e({},a,{_isClassObject:!0}),x=f._extend(s,{},S);x._instanceClass=l,l._members=new x}return l},o._convert=function(i,s){var a=i.prototype;return a.init=function(){var l=this._origin=o._construct(i,arguments);Object.keys(l).forEach(function(c){l.hasOwnProperty(c)&&Object.defineProperty(this,c,{get:function(){return l[c]}})},this)},o._extend(a,{},s)},o._construct=function(i,s){s===void 0&&(s=[]);var a=function(){return i.apply(this,s)};return a.prototype=i.prototype,new a},o._superDescriptor=function(i,s){if("_class"in i&&i instanceof i._class&&(i=i._class),"_extends"in i&&i._extends instanceof Function&&i._extends(this))return Object.getOwnPropertyDescriptor(i._superClass.prototype,s)},o})});var uy=rn((O7,py)=>{"use strict";var mP=dy(),Wr=mP._extend({init:function(n,e,t){n=n instanceof Array?n:[n],this._map={},this._list=[],this.callback=e,this.keyFields=n,this.isHashArray=!0,this.options=t||{ignoreDuplicates:!1},e&&e("construct")},addOne:function(n){var e=!1;for(var t in this.keyFields){t=this.keyFields[t];var r=this.objectAt(n,t);if(r)if(this.has(r)){if(this.options.ignoreDuplicates)return;if(this._map[r].indexOf(n)!=-1){e=!0;continue}this._map[r].push(n)}else this._map[r]=[n]}(!e||this._list.indexOf(n)==-1)&&this._list.push(n)},add:function(){for(var n=0;n<arguments.length;n++)this.addOne(arguments[n]);return this.callback&&this.callback("add",Array.prototype.slice.call(arguments,0)),this},addAll:function(n){if(n.length<100)this.add.apply(this,n);else for(var e=0;e<n.length;e++)this.add(n[e]);return this},addMap:function(n,e){return this._map[n]=e,this.callback&&this.callback("addMap",{key:n,obj:e}),this},intersection:function(n){var e=this;if(!n||!n.isHashArray)throw Error("Cannot HashArray.intersection() on a non-hasharray object. You passed in: ",n);var t=this.clone(null,!0),r=this.clone(null,!0).addAll(this.all.concat(n.all));return r.all.forEach(function(o){e.collides(o)&&n.collides(o)&&t.add(o)}),t},complement:function(n){var e=this;if(!n||!n.isHashArray)throw Error("Cannot HashArray.complement() on a non-hasharray object. You passed in: ",n);var t=this.clone(null,!0);return this.all.forEach(function(r){n.collides(r)||t.add(r)}),t},get:function(n){if(this.has(n))return!(this._map[n]instanceof Array)||this._map[n].length!=1?this._map[n]:this._map[n][0]},getAll:function(n){if(n=n instanceof Array?n:[n],n[0]=="*")return this.all;var e=new Wr(this.keyFields);for(var t in n)e.add.apply(e,this.getAsArray(n[t]));return e.all},getAsArray:function(n){return this._map[n]||[]},getUniqueRandomIntegers:function(n,e,t){var r=[],o={};for(n=Math.min(Math.max(t-e,1),n);r.length<n;){var i=Math.floor(e+Math.random()*(t+1));o[i]||(o[i]=!0,r.push(i))}return r},sample:function(n,e){var t=this.all,r={},o=[];e&&(t=this.getAll(e));for(var i=this.getUniqueRandomIntegers(n,0,t.length-1),s=0;s<i.length;s++)o.push(t[i[s]]);return o},has:function(n){return this._map.hasOwnProperty(n)},collides:function(n){for(var e in this.keyFields)if(this.has(this.objectAt(n,this.keyFields[e])))return!0;return!1},hasMultiple:function(n){return this._map[n]instanceof Array},removeByKey:function(){for(var n=[],e=0;e<arguments.length;e++){var t=arguments[e],r=this._map[t].concat();if(r){n=n.concat(r);for(var o in r){var i=r[o];for(var s in this.keyFields){var a=this.objectAt(i,this.keyFields[s]);if(a&&this.has(a)){var s=this._map[a].indexOf(i);s!=-1&&this._map[a].splice(s,1),this._map[a].length==0&&delete this._map[a]}}this._list.splice(this._list.indexOf(i),1)}}delete this._map[t]}return this.callback&&this.callback("removeByKey",n),this},remove:function(){for(var n=0;n<arguments.length;n++){var e=arguments[n];for(var r in this.keyFields){var t=this.objectAt(e,this.keyFields[r]);if(t){var r=this._map[t].indexOf(e);if(r!=-1)this._map[t].splice(r,1);else throw new Error("HashArray: attempting to remove an object that was never added!"+t);this._map[t].length==0&&delete this._map[t]}}var r=this._list.indexOf(e);if(r!=-1)this._list.splice(r,1);else throw new Error("HashArray: attempting to remove an object that was never added!"+t)}return this.callback&&this.callback("remove",arguments),this},removeAll:function(){var n=this._list.concat();return this._map={},this._list=[],this.callback&&this.callback("remove",n),this},objectAt:function(n,e){if(typeof e=="string")return n[e];for(var t=e.concat();t.length&&n;)n=n[t.shift()];return n},forEach:function(n,e){n=n instanceof Array?n:[n];var t=this.getAll(n);return t.forEach(e),this},forEachDeep:function(n,e,t){n=n instanceof Array?n:[n];var r=this,o=this.getAll(n);return o.forEach(function(i){t(r.objectAt(i,e),i)}),this},clone:function(n,e){var t=new Wr(this.keyFields.concat(),n||this.callback);return e||t.add.apply(t,this.all.concat()),t},sum:function(n,e,t){var r=this,o=0;return this.forEachDeep(n,e,function(i,s){t!==void 0&&(i*=r.objectAt(s,t)),o+=i}),o},average:function(n,e,t){var r=0,o=0,i=0,s=this;return t!==void 0&&this.forEachDeep(n,t,function(a){i+=a}),this.forEachDeep(n,e,function(a,l){t!==void 0&&(a*=s.objectAt(l,t)/i),r+=a,o++}),t!==void 0?r:r/o},filter:function(n,e){var t=this,r=typeof e=="function"?e:i,o=new Wr(this.keyFields);return o.addAll(this.getAll(n).filter(r)),o;function i(s){var a=t.objectAt(s,e);return a!==void 0&&a!==!1}}});Object.defineProperty(Wr.prototype,"all",{get:function(){return this._list}});Object.defineProperty(Wr.prototype,"map",{get:function(){return this._map}});py.exports=Wr;typeof window<"u"&&(window.HashArray=Wr)});var hy=rn((k7,my)=>{"use strict";my.exports=uy()});var fy=rn((N7,gy)=>{"use strict";(function(){var n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",e={rotl:function(t,r){return t<<r|t>>>32-r},rotr:function(t,r){return t<<32-r|t>>>r},endian:function(t){if(t.constructor==Number)return e.rotl(t,8)&16711935|e.rotl(t,24)&4278255360;for(var r=0;r<t.length;r++)t[r]=e.endian(t[r]);return t},randomBytes:function(t){for(var r=[];t>0;t--)r.push(Math.floor(Math.random()*256));return r},bytesToWords:function(t){for(var r=[],o=0,i=0;o<t.length;o++,i+=8)r[i>>>5]|=t[o]<<24-i%32;return r},wordsToBytes:function(t){for(var r=[],o=0;o<t.length*32;o+=8)r.push(t[o>>>5]>>>24-o%32&255);return r},bytesToHex:function(t){for(var r=[],o=0;o<t.length;o++)r.push((t[o]>>>4).toString(16)),r.push((t[o]&15).toString(16));return r.join("")},hexToBytes:function(t){for(var r=[],o=0;o<t.length;o+=2)r.push(parseInt(t.substr(o,2),16));return r},bytesToBase64:function(t){for(var r=[],o=0;o<t.length;o+=3)for(var i=t[o]<<16|t[o+1]<<8|t[o+2],s=0;s<4;s++)o*8+s*6<=t.length*8?r.push(n.charAt(i>>>6*(3-s)&63)):r.push("=");return r.join("")},base64ToBytes:function(t){t=t.replace(/[^A-Z0-9+\/]/ig,"");for(var r=[],o=0,i=0;o<t.length;i=++o%4)i!=0&&r.push((n.indexOf(t.charAt(o-1))&Math.pow(2,-2*i+8)-1)<<i*2|n.indexOf(t.charAt(o))>>>6-i*2);return r}};gy.exports=e})()});var Gd=rn((_7,Sy)=>{"use strict";var Wd={utf8:{stringToBytes:function(n){return Wd.bin.stringToBytes(unescape(encodeURIComponent(n)))},bytesToString:function(n){return decodeURIComponent(escape(Wd.bin.bytesToString(n)))}},bin:{stringToBytes:function(n){for(var e=[],t=0;t<n.length;t++)e.push(n.charCodeAt(t)&255);return e},bytesToString:function(n){for(var e=[],t=0;t<n.length;t++)e.push(String.fromCharCode(n[t]));return e.join("")}}};Sy.exports=Wd});var wy=rn((M7,by)=>{"use strict";by.exports=function(n){return n!=null&&(yy(n)||hP(n)||!!n._isBuffer)};function yy(n){return!!n.constructor&&typeof n.constructor.isBuffer=="function"&&n.constructor.isBuffer(n)}function hP(n){return typeof n.readFloatLE=="function"&&typeof n.slice=="function"&&yy(n.slice(0,0))}});var xy=rn((F7,vy)=>{"use strict";(function(){var n=fy(),e=Gd().utf8,t=wy(),r=Gd().bin,o=function(i,s){i.constructor==String?s&&s.encoding==="binary"?i=r.stringToBytes(i):i=e.stringToBytes(i):t(i)?i=Array.prototype.slice.call(i,0):!Array.isArray(i)&&i.constructor!==Uint8Array&&(i=i.toString());for(var a=n.bytesToWords(i),l=i.length*8,c=1732584193,p=-271733879,d=-1732584194,u=271733878,m=0;m<a.length;m++)a[m]=(a[m]<<8|a[m]>>>24)&16711935|(a[m]<<24|a[m]>>>8)&4278255360;a[l>>>5]|=128<<l%32,a[(l+64>>>9<<4)+14]=l;for(var h=o._ff,g=o._gg,f=o._hh,S=o._ii,m=0;m<a.length;m+=16){var x=c,b=p,w=d,E=u;c=h(c,p,d,u,a[m+0],7,-680876936),u=h(u,c,p,d,a[m+1],12,-389564586),d=h(d,u,c,p,a[m+2],17,606105819),p=h(p,d,u,c,a[m+3],22,-1044525330),c=h(c,p,d,u,a[m+4],7,-176418897),u=h(u,c,p,d,a[m+5],12,1200080426),d=h(d,u,c,p,a[m+6],17,-1473231341),p=h(p,d,u,c,a[m+7],22,-45705983),c=h(c,p,d,u,a[m+8],7,1770035416),u=h(u,c,p,d,a[m+9],12,-1958414417),d=h(d,u,c,p,a[m+10],17,-42063),p=h(p,d,u,c,a[m+11],22,-1990404162),c=h(c,p,d,u,a[m+12],7,1804603682),u=h(u,c,p,d,a[m+13],12,-40341101),d=h(d,u,c,p,a[m+14],17,-1502002290),p=h(p,d,u,c,a[m+15],22,1236535329),c=g(c,p,d,u,a[m+1],5,-165796510),u=g(u,c,p,d,a[m+6],9,-1069501632),d=g(d,u,c,p,a[m+11],14,643717713),p=g(p,d,u,c,a[m+0],20,-373897302),c=g(c,p,d,u,a[m+5],5,-701558691),u=g(u,c,p,d,a[m+10],9,38016083),d=g(d,u,c,p,a[m+15],14,-660478335),p=g(p,d,u,c,a[m+4],20,-405537848),c=g(c,p,d,u,a[m+9],5,568446438),u=g(u,c,p,d,a[m+14],9,-1019803690),d=g(d,u,c,p,a[m+3],14,-187363961),p=g(p,d,u,c,a[m+8],20,1163531501),c=g(c,p,d,u,a[m+13],5,-1444681467),u=g(u,c,p,d,a[m+2],9,-51403784),d=g(d,u,c,p,a[m+7],14,1735328473),p=g(p,d,u,c,a[m+12],20,-1926607734),c=f(c,p,d,u,a[m+5],4,-378558),u=f(u,c,p,d,a[m+8],11,-2022574463),d=f(d,u,c,p,a[m+11],16,1839030562),p=f(p,d,u,c,a[m+14],23,-35309556),c=f(c,p,d,u,a[m+1],4,-1530992060),u=f(u,c,p,d,a[m+4],11,1272893353),d=f(d,u,c,p,a[m+7],16,-155497632),p=f(p,d,u,c,a[m+10],23,-1094730640),c=f(c,p,d,u,a[m+13],4,681279174),u=f(u,c,p,d,a[m+0],11,-358537222),d=f(d,u,c,p,a[m+3],16,-722521979),p=f(p,d,u,c,a[m+6],23,76029189),c=f(c,p,d,u,a[m+9],4,-640364487),u=f(u,c,p,d,a[m+12],11,-421815835),d=f(d,u,c,p,a[m+15],16,530742520),p=f(p,d,u,c,a[m+2],23,-995338651),c=S(c,p,d,u,a[m+0],6,-198630844),u=S(u,c,p,d,a[m+7],10,1126891415),d=S(d,u,c,p,a[m+14],15,-1416354905),p=S(p,d,u,c,a[m+5],21,-57434055),c=S(c,p,d,u,a[m+12],6,1700485571),u=S(u,c,p,d,a[m+3],10,-1894986606),d=S(d,u,c,p,a[m+10],15,-1051523),p=S(p,d,u,c,a[m+1],21,-2054922799),c=S(c,p,d,u,a[m+8],6,1873313359),u=S(u,c,p,d,a[m+15],10,-30611744),d=S(d,u,c,p,a[m+6],15,-1560198380),p=S(p,d,u,c,a[m+13],21,1309151649),c=S(c,p,d,u,a[m+4],6,-145523070),u=S(u,c,p,d,a[m+11],10,-1120210379),d=S(d,u,c,p,a[m+2],15,718787259),p=S(p,d,u,c,a[m+9],21,-343485551),c=c+x>>>0,p=p+b>>>0,d=d+w>>>0,u=u+E>>>0}return n.endian([c,p,d,u])};o._ff=function(i,s,a,l,c,p,d){var u=i+(s&a|~s&l)+(c>>>0)+d;return(u<<p|u>>>32-p)+s},o._gg=function(i,s,a,l,c,p,d){var u=i+(s&l|a&~l)+(c>>>0)+d;return(u<<p|u>>>32-p)+s},o._hh=function(i,s,a,l,c,p,d){var u=i+(s^a^l)+(c>>>0)+d;return(u<<p|u>>>32-p)+s},o._ii=function(i,s,a,l,c,p,d){var u=i+(a^(s|~l))+(c>>>0)+d;return(u<<p|u>>>32-p)+s},o._blocksize=16,o._digestsize=16,vy.exports=function(i,s){if(i==null)throw new Error("Illegal argument "+i);var a=n.wordsToBytes(o(i,s));return s&&s.asBytes?a:s&&s.asString?r.bytesToString(a):n.bytesToHex(a)}})()});var Ey=rn((D7,Kd)=>{"use strict";var Vd=hy(),gP=xy(),fP=1024,Ty=/^[\s]*$/,SP=[{regex:/[åäàáâãæ]/ig,alternate:"a"},{regex:/[èéêë]/ig,alternate:"e"},{regex:/[ìíîï]/ig,alternate:"i"},{regex:/[òóôõö]/ig,alternate:"o"},{regex:/[ùúûü]/ig,alternate:"u"},{regex:/[æ]/ig,alternate:"ae"}];String.prototype.replaceCharAt=function(n,e){return this.substring(0,n)+e+this.substr(n+e.length)};var Xi=function(n,e){this.options=e||{},this.options.ignoreCase=this.options.ignoreCase===void 0?!0:this.options.ignoreCase,this.options.maxCacheSize=this.options.maxCacheSize||fP,this.options.cache=this.options.hasOwnProperty("cache")?this.options.cache:!0,this.options.splitOnRegEx=this.options.hasOwnProperty("splitOnRegEx")?this.options.splitOnRegEx:/[\s.,\/#!$%\^&\*;:{}=\-_`~()]/g,this.options.splitOnGetRegEx=this.options.hasOwnProperty("splitOnGetRegEx")?this.options.splitOnGetRegEx:this.options.splitOnRegEx,this.options.min=this.options.min||1,this.options.keepAll=this.options.hasOwnProperty("keepAll")?this.options.keepAll:!1,this.options.keepAllKey=this.options.hasOwnProperty("keepAllKey")?this.options.keepAllKey:"id",this.options.idFieldOrFunction=this.options.hasOwnProperty("idFieldOrFunction")?this.options.idFieldOrFunction:void 0,this.options.expandRegexes=this.options.expandRegexes||SP,this.options.insertFullUnsplitKey=this.options.hasOwnProperty("insertFullUnsplitKey")?this.options.insertFullUnsplitKey:!1,this.options.defaultReducer=this.options.hasOwnProperty("defaultReducer")?this.options.defaultReducer:Xi.UNION_REDUCER,this.keyFields=n?n instanceof Array?n:[n]:[],this.root={},this.size=0,this.options.cache&&(this.getCache=new Vd("key"))};function qd(n,e){return e.length===1?n[e[0]]:qd(n[e[0]],e.slice(1,e.length))}Xi.prototype={add:function(n,e){this.options.cache&&this.clearCache(),typeof e=="number"&&(e=void 0);var t=e||this.keyFields;for(var r in t){var o=t[r],i=o instanceof Array,s=i?qd(n,o):n[o];if(s){s=s.toString(),this.options.ignoreCase&&(s=s.toLowerCase());for(var a=this.expandString(s),l=0;l<a.length;l++){var c=a[l];this.map(c,n,e)}}}},remove:function(n,e){if(n){n=n.toString(),n=this.options.ignoreCase?n.toLowerCase():n,e=e||this.keyFields,e=e instanceof Array?e:[e],this.options.cache&&this.clearCache();var t=this.expandString(n);for(var r of t){var o=this.options.splitOnRegEx?r.split(this.options.splitOnRegEx):[r];for(var i of o)this.removeNode(this.root,e,n,i)}}},removeNode:function(n,e,t,r){if(!n)return null;if(!r.length){n.value&&(n.value=n.value.filter(i=>!e.some(s=>{var a=i[s]||"";return a=this.options.ignoreCase?a.toLowerCase():a,a.indexOf(t)>-1})),n.value.length||delete n.value);return}var o=r[0];n[o]&&(this.removeNode(n[o],e,t,r.slice(1)),this.deleteNodeIfEmpty(n,o))},deleteNodeIfEmpty:function(n,e){Object.keys(n[e]).length===0&&(delete n[e],this.size--)},expandString:function(n){var e=[n];if(this.options.expandRegexes&&this.options.expandRegexes.length)for(var t=0;t<this.options.expandRegexes.length;t++)for(var r=this.options.expandRegexes[t],o;(o=r.regex.exec(n))!==null;){var i=n.replaceCharAt(o.index,r.alternate);e.push(i)}return e},addAll:function(n,e){for(var t=0;t<n.length;t++)this.add(n[t],e)},reset:function(){this.root={},this.size=0},clearCache:function(){this.getCache=new Vd("key")},cleanCache:function(){for(;this.getCache.all.length>this.options.maxCacheSize;)this.getCache.remove(this.getCache.all[0])},addFromObject:function(n,e){this.options.cache&&this.clearCache(),e=e||"value",this.keyFields.indexOf("_key_")==-1&&this.keyFields.push("_key_");for(var t in n){var r={_key_:t};r[e]=n[t],this.add(r)}},map:function(n,e,t){if(this.options.splitOnRegEx&&this.options.splitOnRegEx.test(n)){var r=n.split(this.options.splitOnRegEx),o=r.filter(function(u){return Ty.test(u)}),i=r.filter(function(u){return u===n}),s=i.length+o.length===r.length;if(!s){for(var a=0,l=r.length;a<l;a++)Ty.test(r[a])||this.map(r[a],e,t);if(!this.options.insertFullUnsplitKey)return}}this.options.cache&&this.clearCache(),this.options.keepAll&&(this.indexed=this.indexed||new Vd([this.options.keepAllKey]),this.indexed.add(e)),this.options.ignoreCase&&(n=n.toLowerCase());var c=this.keyToArr(n),p=this;d(c,e,this.root);try{e.$tsid=this.getId(e,t)}catch(u){throw console.warn("TrieSearch: since version 2.2 you cannot insert primitives as items, you must wrap them in an Object. This was done for performance."),u}function d(u,m,h){if(u.length==0){h.value=h.value||[],h.value.push(m);return}var g=u.shift();h[g]||p.size++,h[g]=h[g]||{},d(u,m,h[g])}},keyToArr:function(n){var e;if(this.options.min&&this.options.min>1){if(n.length<this.options.min)return[];e=[n.substring(0,this.options.min)],e=e.concat(n.substring(this.options.min).split(""))}else e=n.split("");return e},findNode:function(n){return e(this.keyToArr(n),this.root);function e(t,r){if(r){if(t.length===0)return r;var o=t.shift();return e(t,r[o])}}},_getCacheKey:function(n,e){var t=n;return e&&(t=n+"_"+e),t},_get:function(n,e){var t=this;n=this.options.ignoreCase?n.toLowerCase():n;var r,o,i=[],s={};if(this.options.cache&&(r=this.getCache.get(this._getCacheKey(n,e))))return r.value;if(o=this.findNode(n),o&&l(o),this.options.cache){var a=this._getCacheKey(n,e);this.getCache.add({key:a,value:i}),this.cleanCache()}return i;function l(c){if(i.length!==e){if(c.value&&c.value.length)for(let u=0;u<c.value.length;u++){var p=c.value[u];if(!e||i.length<e){let m=t.getId(p);if(s[m])continue;i.push(p),s[m]=p}}if(i.length!==e)for(var d in c)d!=="value"&&l(c[d])}}},get:function(n,e,t){var r=void 0;e=e||this.options.defaultReducer,typeof n=="string"&&(n=this.options.splitOnGetRegEx?n.split(this.options.splitOnGetRegEx):[n]),n=n.filter(l=>!this.options.min||l.length>=this.options.min);for(var o=0,i=n.length;o<i;o++){var s=n[o],a=this._get(s,t);r=e(r,s,a,this)}return r||[]},search:function(n,e,t){return this.get(n,e,t)},getId:function(n,e){if(n.$tsid)return n.$tsid;if(!this.options.idFieldOrFunction){var t="",r=e||this.keyFields;for(let s=0;s<r.length;s++){var o=r[s],i=typeof o=="string"?n[o]:qd(n,o);if(i==null)throw new Error(`Since 2.2.0 of TrieSearch, if you have undefined/null keyFields (or customKeys) on your items you must specify an idFieldOrFunction. item.${o} === ${i}`);t+=i.toString()}return gP(t)}return typeof this.options.idFieldOrFunction=="function"?this.options.idFieldOrFunction(n):n[this.options.idFieldOrFunction]}};Xi.UNION_REDUCER=function(n,e,t,r){if(n===void 0)return t;var o={},i=[];return n.forEach(function(s){o[r.getId(s)]=!0}),t.forEach(function(s){var a=r.getId(s);o[a]&&i.push(s)}),i};Kd.exports=Xi;Kd.exports.default=Xi});var Ry=rn((U7,Cy)=>{"use strict";Cy.exports=Ey()});var yb=rn((hie,Sb)=>{"use strict";Sb.exports=gb;function gb(n,e,t){n instanceof RegExp&&(n=hb(n,t)),e instanceof RegExp&&(e=hb(e,t));var r=fb(n,e,t);return r&&{start:r[0],end:r[1],pre:t.slice(0,r[0]),body:t.slice(r[0]+n.length,r[1]),post:t.slice(r[1]+e.length)}}function hb(n,e){var t=e.match(n);return t?t[0]:null}gb.range=fb;function fb(n,e,t){var r,o,i,s,a,l=t.indexOf(n),c=t.indexOf(e,l+1),p=l;if(l>=0&&c>0){if(n===e)return[l,c];for(r=[],i=t.length;p>=0&&!a;)p==l?(r.push(p),l=t.indexOf(n,p+1)):r.length==1?a=[r.pop(),c]:(o=r.pop(),o<i&&(i=o,s=c),c=t.indexOf(e,p+1)),p=l<c&&l>=0?l:c;r.length&&(a=[i,s])}return a}});var Rb=rn((gie,Cb)=>{"use strict";var bb=yb();Cb.exports=NL;var wb="\0SLASH"+Math.random()+"\0",vb="\0OPEN"+Math.random()+"\0",mp="\0CLOSE"+Math.random()+"\0",xb="\0COMMA"+Math.random()+"\0",Tb="\0PERIOD"+Math.random()+"\0";function up(n){return parseInt(n,10)==n?parseInt(n,10):n.charCodeAt(0)}function OL(n){return n.split("\\\\").join(wb).split("\\{").join(vb).split("\\}").join(mp).split("\\,").join(xb).split("\\.").join(Tb)}function kL(n){return n.split(wb).join("\\").split(vb).join("{").split(mp).join("}").split(xb).join(",").split(Tb).join(".")}function Eb(n){if(!n)return[""];var e=[],t=bb("{","}",n);if(!t)return n.split(",");var r=t.pre,o=t.body,i=t.post,s=r.split(",");s[s.length-1]+="{"+o+"}";var a=Eb(i);return i.length&&(s[s.length-1]+=a.shift(),s.push.apply(s,a)),e.push.apply(e,s),e}function NL(n){return n?(n.substr(0,2)==="{}"&&(n="\\{\\}"+n.substr(2)),is(OL(n),!0).map(kL)):[]}function _L(n){return"{"+n+"}"}function ML(n){return/^-?0\d/.test(n)}function FL(n,e){return n<=e}function DL(n,e){return n>=e}function is(n,e){var t=[],r=bb("{","}",n);if(!r)return[n];var o=r.pre,i=r.post.length?is(r.post,!1):[""];if(/\$$/.test(r.pre))for(var s=0;s<i.length;s++){var a=o+"{"+r.body+"}"+i[s];t.push(a)}else{var l=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(r.body),c=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(r.body),p=l||c,d=r.body.indexOf(",")>=0;if(!p&&!d)return r.post.match(/,.*\}/)?(n=r.pre+"{"+r.body+mp+r.post,is(n)):[n];var u;if(p)u=r.body.split(/\.\./);else if(u=Eb(r.body),u.length===1&&(u=is(u[0],!1).map(_L),u.length===1))return i.map(function(D){return r.pre+u[0]+D});var m;if(p){var h=up(u[0]),g=up(u[1]),f=Math.max(u[0].length,u[1].length),S=u.length==3?Math.abs(up(u[2])):1,x=FL,b=g<h;b&&(S*=-1,x=DL);var w=u.some(ML);m=[];for(var E=h;x(E,g);E+=S){var C;if(c)C=String.fromCharCode(E),C==="\\"&&(C="");else if(C=String(E),w){var I=f-C.length;if(I>0){var N=new Array(I+1).join("0");E<0?C="-"+N+C.slice(1):C=N+C}}m.push(C)}}else{m=[];for(var P=0;P<u.length;P++)m.push.apply(m,is(u[P],!1))}for(var P=0;P<m.length;P++)for(var s=0;s<i.length;s++){var a=o+m[P]+i[s];(!e||p||a)&&t.push(a)}}return t}});var nc=(n,e)=>{},mi=()=>{},rc=!1;try{let n=await import("@sentry/node"),{nodeProfilingIntegration:e}=await import("@sentry/profiling-node");nc=n.captureException,mi=n.profiler.stopProfiler,n.init({dsn:"https://89e980855f7b9c6e56fc6c7e7143888b@o4506426201800704.ingest.us.sentry.io/4508343221354497",integrations:[e()],environment:"production",release:process.env.SENTRY_RELEASE_NAME,tracesSampleRate:1}),n.profiler.startProfiler(),rc=!0}catch{}import{Command as c_,Option as tn}from"@commander-js/extra-typings";import{execSync as d_}from"child_process";import Bw from"body-parser";import Uk from"cors";import Bk from"dedent";import zk from"events";import zw,{Router as jk}from"express";import Hk from"http";import{z as Lu}from"zod";var T_=Lu.object({input:Lu.string()});import{z as je}from"zod";var R_=je.object({srcs:je.array(je.string()),urls:je.array(je.string()),desiredSrc:je.string().optional(),desiredUrl:je.string().optional()}),Ou=je.object({srcRegex:je.string().optional(),urlRegex:je.string().optional()}),ku=je.object({x:je.number(),y:je.number(),correlation:je.number()}),A_=je.object({searchImageBase64String:je.string(),pageImageBase64String:je.string(),id:je.string().uuid(),timeoutMs:je.number().max(1e4).min(0).optional()});import{z as k}from"zod";import{v4 as Ie}from"uuid";import*as v from"zod";function ye(n){if(typeof n.ZodType.prototype.openapi<"u")return;n.ZodType.prototype.openapi=function(o){return new this.constructor({...this._def,openapi:o})};let e=n.ZodObject.prototype.extend;n.ZodObject.prototype.extend=function(...o){let i=e.apply(this,o);return i._def.extendMetadata={extends:this},delete i._def.openapi,i};let t=n.ZodObject.prototype.omit;n.ZodObject.prototype.omit=function(...o){let i=t.apply(this,o);return delete i._def.extendMetadata,delete i._def.openapi,i};let r=n.ZodObject.prototype.pick;n.ZodObject.prototype.pick=function(...o){let i=r.apply(this,o);return delete i._def.extendMetadata,delete i._def.openapi,i}}import{z as pe}from"zod";ye(pe);var Nu=pe.object({plan:pe.string().optional(),evidence:pe.string().optional(),thoughts:pe.string(),result:pe.boolean(),relevantElements:pe.array(pe.number()).optional()}),io=(o=>(o.CONTAINS="CONTAINS",o.STARTS_WITH="STARTS_WITH",o.EQUALS="EQUALS",o.EXISTS="EXISTS",o))(io||{});var mx=pe.object({type:pe.literal("ELEMENT_CONTENT"),negated:pe.boolean().optional(),operation:pe.nativeEnum(io),value:pe.string()}).openapi({ref:"ElementContentAssertion"}),hx=pe.object({type:pe.literal("ELEMENT_ATTRIBUTE"),negated:pe.boolean().optional(),operation:pe.nativeEnum(io),attr:pe.string(),value:pe.string()}).openapi({ref:"ElementAttributeValueAssertion"}),hi=(o=>(o.EXISTS="EXISTS",o.VISIBLE="VISIBLE",o.ENABLED="ENABLED",o.EDITABLE="EDITABLE",o))(hi||{}),gx=pe.object({type:pe.literal("ELEMENT_EXISTENCE"),negated:pe.boolean().optional(),condition:pe.nativeEnum(hi).describe("Treated as the element exists AND is also ...")}).openapi({ref:"ElementExistenceAssertion"}),_u=pe.discriminatedUnion("type",[mx,hx,gx]).openapi({ref:"ManualElementAssertion"});var fx=pe.object({type:pe.literal("CONTENT"),negated:pe.boolean().optional(),value:pe.string()}).openapi({ref:"PageContentAssertion"}),Mu=pe.discriminatedUnion("type",[fx]).openapi({ref:"ManualPageAssertion"});import*as K from"zod";ye(K);var Gn=(a=>(a.AI="AI",a.AI_HEALED="AI_HEALED",a.CLICK_TO_FIND="CLICK_TO_FIND",a.XY_PERCENT="XY_PERCENT",a.RECORDING="RECORDING",a.USER_CSS_SELECTOR="USER_CSS_SELECTOR",a.HEURISTIC_HEALED="HEURISTIC_HEALED",a))(Gn||{}),Sx=K.object({mPathSelectorTokens:K.string().array(),frameSrcRegex:K.string().optional(),frameUrlRegex:K.string().optional(),indices:K.number().array()}),br=K.object({id:K.number().int(),dataMomenticId:K.number().int().optional(),selector:K.string().optional(),generatedSelectors:K.string().array().optional(),role:K.string().optional(),name:K.string().optional(),numChildren:K.number().optional(),content:K.string().optional(),pathFromRoot:K.string().optional(),serializedForm:K.string().optional(),nodeOnlySerializedForm:K.string().optional(),serializedHtml:K.string().optional().describe("pruned html including 1 neighbor and 1 layer of children. value for text inputs pruned."),nodeOnlySerializedHtml:K.string().optional().describe("outerHtml of the element without any children. value for text inputs pruned."),screenshotUrl:K.string().url().optional(),boundingBox:K.object({x:K.number().optional(),y:K.number().optional(),width:K.number(),height:K.number()}).describe("css pixel bounding box").optional(),frameCache:Sx.optional(),inputDescription:K.string().optional().describe("the description that generated this cache"),targetSource:K.nativeEnum(Gn).optional(),targetUpdateTime:K.string().optional()}).openapi({ref:"A11yTargetWithCache"});function Fu(n){return!!(n.name||n.role||n.content||n.serializedForm||n.serializedHtml||n.screenshotUrl)}var yx=K.object({type:K.literal("description"),elementDescriptor:K.string(),a11yData:br.optional().describe("DEPRECATED: new a11y cache is stored in DB and resolved into the 'cache' field")}).openapi({ref:"DescriptionTarget"}),bx=K.object({x:K.number(),y:K.number()}),wx=K.object({type:K.literal("coordinates"),pixels:bx}).openapi({ref:"CoordinatesTarget"});function Vn(n){return n.type==="description"}function Sn(n){return n.type==="coordinates"}var dt=K.discriminatedUnion("type",[yx,wx]).openapi({ref:"ElementTarget"});function oc(n){if(!n)return!1;switch(n.type){case"description":return!!n.elementDescriptor}return!0}function pt(n){if(!n)return"";switch(n.type){case"description":return n.elementDescriptor;case"coordinates":return`x: ${n.pixels.x}, y: ${n.pixels.y}`}}import{z as oe}from"zod";var Ps=oe.object({url:oe.string(),method:oe.union([oe.literal("GET"),oe.literal("POST"),oe.literal("PUT"),oe.literal("DELETE"),oe.literal("PATCH")]),headers:oe.record(oe.string(),oe.string()).optional(),params:oe.record(oe.string(),oe.string()).optional(),body:oe.string().optional(),timeout:oe.number().int().optional().describe("Max seconds to wait for the request to complete")}),Du=oe.object({url:oe.string(),headers:oe.record(oe.string(),oe.string()).optional(),query:oe.string(),variables:oe.record(oe.string(),oe.string()).optional(),timeout:oe.number().int().optional().describe("Max seconds to wait for the request to complete")}),Ls=oe.object({code:oe.string(),fragment:oe.boolean().optional(),environment:oe.union([oe.literal("NODE"),oe.literal("BROWSER")]).optional().describe("default NODE"),timeout:oe.number().int().max(60).optional().describe("Max seconds for the code to complete")});var Be=(G=>(G.AI_EXTRACT="AI_EXTRACT",G.AI_ASSERTION="AI_ASSERTION",G.AI_WAIT="AI_WAIT",G.AUTH_LOAD="AUTH_LOAD",G.AUTH_SAVE="AUTH_SAVE",G.BLUR="BLUR",G.CAPTCHA="CAPTCHA",G.CLICK="CLICK",G.COOKIE="COOKIE",G.COPY="COPY",G.DIALOG="DIALOG",G.DRAG="DRAG",G.ELEMENT_CHECK="ELEMENT_CHECK",G.FILE_UPLOAD="FILE_UPLOAD",G.FOCUS="FOCUS",G.GO_BACK="GO_BACK",G.GO_FORWARD="GO_FORWARD",G.HOVER="HOVER",G.JAVASCRIPT="JAVASCRIPT",G.LOCAL_STORAGE="LOCAL_STORAGE",G.MOUSE_DRAG="MOUSE_DRAG",G.NAVIGATE="NAVIGATE",G.NEW_TAB="NEW_TAB",G.PAGE_CHECK="PAGE_CHECK",G.PASTE="PASTE",G.PRESS="PRESS",G.REFRESH="REFRESH",G.REQUEST="REQUEST",G.GRAPHQL_REQUEST="GRAPHQL_REQUEST",G.SCROLL_DOWN="SCROLL_DOWN",G.SCROLL_UP="SCROLL_UP",G.SCROLL_LEFT="SCROLL_LEFT",G.SCROLL_RIGHT="SCROLL_RIGHT",G.SELECT_OPTION="SELECT_OPTION",G.SWITCH_TAB="TAB",G.TYPE="TYPE",G.VISUAL_DIFF="VISUAL_DIFF",G.WAIT="WAIT",G.WAIT_FOR_URL="WAIT_FOR_URL",G.REGISTER_REQUEST_LISTENER="REGISTER_REQUEST_LISTENER",G.AWAIT_LISTENER="AWAIT_LISTENER",G.SUCCESS="SUCCESS",G))(Be||{});ye(v);var Y=v.object({thoughts:v.string().optional(),id:v.string().uuid().describe("unique identifier to this step, used for step cache")}),Wt=v.object({useSelector:v.boolean().optional(),force:v.boolean().optional(),disableCache:v.boolean().optional().describe("disable element caching for this step"),iframeUrl:v.string().optional().describe("url or url regex for the iframe")}).openapi({ref:"CommonTargetingOptions"}),yn=v.object({target:br}).optional().openapi({ref:"SingleTargetCache"}),ks=v.object({loadTimeout:v.number().int().max(60).optional().describe("Max seconds for the page to load")}),vx=Y.merge(ks).merge(v.object({type:v.literal("NAVIGATE"),url:v.string()})).openapi({ref:"NavigateCommand"}),Ns=Wt.merge(v.object({cache:yn})),so=Y.merge(Ns.merge(v.object({target:dt.optional(),type:v.literal("SCROLL_UP"),deltaY:v.number().optional()}))).openapi({ref:"ScrollUpCommand"}),ao=Y.merge(Ns.merge(v.object({target:dt.optional(),type:v.literal("SCROLL_DOWN"),deltaY:v.number().optional()}))).openapi({ref:"ScrollDownCommand"}),lo=Y.merge(Ns.merge(v.object({target:dt.optional(),type:v.literal("SCROLL_LEFT"),deltaX:v.number().optional()}))).openapi({ref:"ScrollLeftCommand"}),co=Y.merge(Ns.merge(v.object({target:dt.optional(),type:v.literal("SCROLL_RIGHT"),deltaX:v.number().optional()}))).openapi({ref:"ScrollRightCommand"}),W_=v.discriminatedUnion("type",[so,ao,lo,co]).openapi({ref:"AllScrollCommands"}),xx=Y.merge(v.object({type:v.literal("DIALOG"),action:v.union([v.literal("ACCEPT"),v.literal("DISMISS")])})).openapi({ref:"DialogCommand"}),Tx=Y.merge(v.object({type:v.literal("WAIT"),delay:v.number()})).openapi({ref:"WaitCommand"}),Ex=v.discriminatedUnion("type",[v.object({type:v.literal("SUBSTRING"),url:v.string()}),v.object({type:v.literal("GLOB"),glob:v.string()}),v.object({type:v.literal("REGEX"),regex:v.string()})]),Cx=v.object({caseInsensitive:v.boolean().optional().describe("Whether to ignore case when matching the URL"),negated:v.boolean().optional().describe("Wait for the URL to NOT match the provided matcher instead."),timeout:v.number().int().optional().describe("Max seconds to wait for the URL to match")}),Rx=Y.extend({type:v.literal("WAIT_FOR_URL"),url:v.string().optional().describe("Deprecated: url or glob to wait for. New commands should use the discriminated matcher field."),matcher:Ex.optional()}).merge(Cx).openapi({ref:"WaitUrlCommand"}),Ax=Y.merge(ks).merge(v.object({type:v.literal("REFRESH")})).openapi({ref:"RefreshCommand"}),Ix=Y.merge(v.object({type:v.literal("GO_BACK")})).openapi({ref:"GoBackCommand"}),Px=Y.merge(v.object({type:v.literal("GO_FORWARD")})).openapi({ref:"GoForwardCommand"}),Lx=Y.extend({type:v.literal("AUTH_SAVE")}).openapi({ref:"AuthSaveCommand"}),Ox=Y.extend({type:v.literal("AUTH_LOAD"),storageState:v.string().describe("JSON string auth state. Leave blank or set to the empty string to clear all existing authentication.")}).openapi({ref:"AuthLoadCommand"}),sc=Y.merge(Wt).extend({type:v.literal("CAPTCHA")}).openapi({ref:"CaptchaCommand"}),kx=Y.extend({type:v.literal("COPY"),value:v.string()}).openapi({ref:"CopyCommand"}),Nx=Y.extend({type:v.literal("PASTE")}).openapi({ref:"PasteCommand"}),_x=Y.merge(Ls).extend({type:v.literal("JAVASCRIPT"),envKey:v.string().optional()}).openapi({ref:"JavaScriptCommand"}),gi=Y.merge(Wt).merge(v.object({type:v.literal("CLICK"),target:dt,doubleClick:v.boolean().optional(),rightClick:v.boolean().optional(),waitForUrl:v.string().optional().describe("Deprecated: wait for the click to trigger a page load or new tab that matches the provided URL or URL glob (e.g. https://google.com/**/*)."),waitForDownload:v.boolean().optional().describe("Wait for the click to trigger a file download and for the file download to complete."),delayMs:v.number().optional(),downloadTimeoutMs:v.number().optional(),cache:yn,relativePosition:v.object({x:v.number(),y:v.number()}).optional()})).openapi({ref:"ClickCommand"}),fi=Y.merge(Wt).merge(v.object({type:v.literal("DRAG"),fromTarget:dt,toTarget:dt,steps:v.number().optional(),hoverSeconds:v.number().optional().describe("Seconds to hover the object before dropping"),cache:v.object({fromTarget:br.optional(),toTarget:br.optional()}).optional()})).openapi({ref:"DragCommand"}),Si=Y.merge(Wt).merge(v.object({type:v.literal("MOUSE_DRAG"),target:dt.optional(),deltaX:v.string().describe("pixels to move horizontally, can be template"),deltaY:v.string().describe("pixels to move vertically, can be template"),steps:v.number().optional(),cache:yn})).openapi({ref:"MouseDragCommand"}),yi=Y.merge(Wt).merge(v.object({type:v.literal("HOVER"),target:dt,cache:yn})).openapi({ref:"HoverCommand"}),bi=Y.merge(Wt).merge(v.object({type:v.literal("FOCUS"),target:dt,cache:yn})).openapi({ref:"FocusCommand"}),wi=Y.merge(Wt).extend({type:v.literal("BLUR"),target:dt.optional(),cache:yn}).openapi({ref:"BlurCommand"}),Mx=v.object({type:v.literal("URL"),url:v.string()}).describe("Accessible link to the file, either public http or local file://").openapi({ref:"UrlSource"}),Fx=v.object({type:v.literal("USER_FILE"),name:v.string()}).describe("Accessible link to the file, references the google cloud file").openapi({ref:"UploadedFileSource"}),Dx=Y.extend({type:v.literal("FILE_UPLOAD"),fileSource:v.discriminatedUnion("type",[Mx,Fx]),filename:v.string().optional()}).openapi({ref:"FileUploadCommand"}),Ux=v.discriminatedUnion("type",[v.object({type:v.literal("VALUE"),value:v.string()}),v.object({type:v.literal("LABEL"),label:v.string()}),v.object({type:v.literal("INDEX"),index:v.number().int()})]),vi=Y.merge(Wt).extend({type:v.literal("SELECT_OPTION"),target:dt,cache:yn,option:v.string().describe("option value, deprecated old field").optional(),choice:Ux.optional().describe("new field for selecting options, optional for backcompat")}).openapi({ref:"SelectOptionCommand"}),ac=v.union([v.literal("MULTIMODAL"),v.literal("VISION_ONLY")]),lc=Y.merge(v.object({type:v.literal("AI_ASSERTION"),assertion:v.string(),disableCache:v.boolean().optional(),iframeUrl:v.string().optional(),contextChoice:ac.optional(),timeout:v.number().int().optional().describe("Max seconds to wait for assertion to be true")})).openapi({ref:"AIAssertionCommand"}),Bx=lc.extend({type:v.literal("AI_WAIT")}).openapi({ref:"AIWaitCommand"}),bn=5,cc=600,xi=Y.merge(Wt).extend({type:v.literal("ELEMENT_CHECK"),target:dt,assertion:_u,cache:yn,timeout:v.number().int().min(0).max(cc).optional().describe("max seconds to wait for the assertion to be true")}).openapi({ref:"ElementAssertionCommand"}),zx=Y.extend({type:v.literal("PAGE_CHECK"),assertion:Mu,iframeUrl:v.string().optional().describe("url or url regex for the iframe"),timeout:v.number().int().min(0).max(cc).optional().describe("max seconds to wait for the assertion to be true")}).openapi({ref:"PageAssertionCommand"}),jx=Y.merge(v.object({type:v.literal("AI_EXTRACT"),goal:v.string(),schema:v.string().optional(),envKey:v.string().optional(),disableCache:v.boolean().optional(),iframeUrl:v.string().optional()})).openapi({ref:"AIExtractCommand"}),Hx=v.object({clearContent:v.boolean().optional(),forceClearContent:v.boolean().optional(),pressKeysSequentially:v.boolean().optional().describe("Deprecated: this is now the default. Please set delay to zero if you wish to achieve instant typing behavior."),delay:v.number().min(0).max(1e3).optional().describe("Delay between each press in milliseconds."),force:v.boolean().optional(),pressEnter:v.boolean().optional()}),Uu=25,Ti=Y.merge(Wt).merge(Hx).extend({type:v.literal("TYPE"),target:dt.optional(),value:v.string(),cache:yn}).openapi({ref:"TypeCommand"}),$x=Y.merge(v.object({type:v.literal("PRESS"),value:v.string(),repeat:v.number().optional(),convertMeta:v.boolean().optional(),delayMs:v.number().optional()})).openapi({ref:"PressCommand"}),Wx=v.object({type:v.literal("SUBSTRING"),substring:v.string()}),Gx=v.object({type:v.literal("REGEX"),pattern:v.string()}),Vx=v.object({type:v.literal("INDEX"),index:v.number()}),qx=v.discriminatedUnion("type",[Wx,Gx,Vx]),Kx=Y.merge(ks).merge(v.object({type:v.literal("TAB"),url:v.string().optional().describe("deprecated field - new instances should use the discriminated union"),action:qx.optional()})).openapi({ref:"TabCommand"}),Yx=Y.merge(ks).merge(v.object({type:v.literal("NEW_TAB"),url:v.string()})).openapi({ref:"NewTabCommand"}),Jx=Y.merge(v.object({type:v.literal("COOKIE"),value:v.string()})).openapi({ref:"CookieCommand"}),Xx=Y.merge(v.object({type:v.literal("LOCAL_STORAGE"),key:v.string(),value:v.string()})).openapi({ref:"LocalStorageCommand"}),Zx=Y.extend({type:v.literal("REQUEST")}).merge(Ps).openapi({ref:"RequestCommand"}),Qx=Y.extend({type:v.literal("GRAPHQL_REQUEST")}).merge(Du).openapi({ref:"GraphQLRequestCommand"}),eT=Y.merge(v.object({type:v.literal("SUCCESS"),condition:lc.optional()})).openapi({ref:"SuccessCommand"}),tT=Y.merge(v.object({type:v.literal("FAILURE")})).openapi({ref:"FailureCommand"}),nT=v.object({data:v.string().describe("location at which to find a jpg"),width:v.number(),height:v.number()}),Ei=Y.merge(Wt).merge(v.object({type:v.literal("VISUAL_DIFF"),threshold:v.number().optional().describe("default 0.1"),target:dt.optional(),screenshot:nT.optional(),cache:yn})).openapi({ref:"VisualDiffCommand"}),rT=Y.merge(v.object({type:v.literal("REGISTER_REQUEST_LISTENER"),pattern:v.string(),key:v.string()})).openapi({ref:"RegisterRequestListenerCommand"}),oT=Y.merge(v.object({type:v.literal("AWAIT_LISTENER"),key:v.string(),timeout:v.number().optional().describe("timeout")})).openapi({ref:"WaitForListenerCommand"}),Bu=v.discriminatedUnion("type",[gi,Ti,$x,vi,vx,ao,so,lc,yi,Tx,eT]),iT=v.discriminatedUnion("type",[Bx,jx,Ox,Lx,sc,Jx,kx,xx,fi,xi,Dx,Ix,Px,_x,Xx,Si,Yx,zx,Nx,Ax,Zx,Qx,lo,co,Kx,Ei,bi,wi,Rx,rT,oT]),po=v.discriminatedUnion("type",[...Bu.options,...iT.options]).openapi({ref:"Command"}),_s=v.discriminatedUnion("type",[...Bu.options,tT]);function On(n){let e;switch(n){case"PASTE":case"AUTH_SAVE":case"VISUAL_DIFF":case"SUCCESS":case"SCROLL_DOWN":case"SCROLL_UP":case"SCROLL_LEFT":case"SCROLL_RIGHT":case"CAPTCHA":case"GO_BACK":case"GO_FORWARD":case"REFRESH":e={id:Ie(),type:n};break;case"AUTH_LOAD":{e={id:Ie(),type:n,storageState:""};break}case"AI_EXTRACT":e={id:Ie(),type:n,goal:""};break;case"DIALOG":e={id:Ie(),type:n,action:"DISMISS"};break;case"DRAG":e={id:Ie(),type:n,fromTarget:{type:"description",elementDescriptor:""},toTarget:{type:"description",elementDescriptor:""}};break;case"MOUSE_DRAG":e={id:Ie(),type:n,deltaX:"0",deltaY:"0",steps:1};break;case"WAIT_FOR_URL":e={id:Ie(),type:n,url:""};break;case"WAIT":e={id:Ie(),type:n,delay:1};break;case"BLUR":e={id:Ie(),type:n};break;case"HOVER":case"FOCUS":case"CLICK":e={id:Ie(),type:n,target:{type:"description",elementDescriptor:""}};break;case"COOKIE":case"PRESS":case"COPY":case"TYPE":e={id:Ie(),type:n,value:"",clearContent:!0};break;case"SELECT_OPTION":e={id:Ie(),type:n,target:{type:"description",elementDescriptor:""},choice:{type:"VALUE",value:""}};break;case"NAVIGATE":case"NEW_TAB":case"TAB":e={id:Ie(),type:n,url:""};break;case"REQUEST":e={id:Ie(),type:n,url:"",method:"GET"};break;case"GRAPHQL_REQUEST":e={id:Ie(),type:n,url:"",query:""};break;case"LOCAL_STORAGE":e={id:Ie(),type:n,key:"",value:""};break;case"JAVASCRIPT":e={id:Ie(),type:n,code:""};break;case"AI_WAIT":case"AI_ASSERTION":e={id:Ie(),type:n,assertion:""};break;case"FILE_UPLOAD":{e={id:Ie(),type:n,fileSource:{type:"URL",url:""}};break}case"ELEMENT_CHECK":{e={id:Ie(),type:n,target:{type:"description",elementDescriptor:""},assertion:{type:"ELEMENT_EXISTENCE",condition:"EXISTS"}};break}case"PAGE_CHECK":{e={id:Ie(),type:n,assertion:{type:"CONTENT",value:""}};break}case"REGISTER_REQUEST_LISTENER":{e={id:Ie(),type:n,pattern:"",key:""};break}case"AWAIT_LISTENER":{e={id:Ie(),type:n,key:""};break}default:return(r=>{throw"If Typescript complains about the line below, you missed a case or break in the switch above"})(n)}return e}function zu(n){switch(n.type){case"BLUR":case"CLICK":case"DRAG":case"FOCUS":case"HOVER":case"MOUSE_DRAG":case"PRESS":case"SCROLL_DOWN":case"SCROLL_UP":case"SCROLL_LEFT":case"SCROLL_RIGHT":case"TYPE":return!0;case"AUTH_LOAD":case"AUTH_SAVE":case"AWAIT_LISTENER":case"SUCCESS":case"AI_ASSERTION":case"AI_WAIT":case"AI_EXTRACT":case"CAPTCHA":case"COOKIE":case"COPY":case"DIALOG":case"ELEMENT_CHECK":case"FILE_UPLOAD":case"GO_BACK":case"GO_FORWARD":case"GRAPHQL_REQUEST":case"JAVASCRIPT":case"LOCAL_STORAGE":case"NAVIGATE":case"NEW_TAB":case"PASTE":case"PAGE_CHECK":case"REGISTER_REQUEST_LISTENER":case"REFRESH":case"REQUEST":case"SELECT_OPTION":case"TAB":case"VISUAL_DIFF":case"WAIT":case"WAIT_FOR_URL":return!1;default:return(t=>{throw"If Typescript complains about the line below, you missed a case or break in the switch above"})(n)}}import{z as sT}from"zod";var Y_=sT.discriminatedUnion("type",[wi,sc,gi,fi,bi,yi,Si,so,ao,lo,co,vi,Ti,Ei,xi]);function ju(n){return["AI_ASSERTION","ELEMENT_CHECK","PAGE_CHECK"].includes(n)}import{z as aT}from"zod";var Ct={type:!0,cache:!0},wr=aT.discriminatedUnion("type",[wi.pick(Ct),gi.pick(Ct),fi.pick(Ct),xi.pick(Ct),bi.pick(Ct),yi.pick(Ct),Si.pick(Ct),so.pick(Ct),ao.pick(Ct),lo.pick(Ct),co.pick(Ct),vi.pick(Ct),Ti.pick(Ct),Ei.pick(Ct)]),dc=Object.values(Be).filter(n=>wr.options.some(e=>e.shape.type.safeParse(n).success));po.options.forEach(n=>{if("target"in n.shape&&!dc.includes(n.shape.type.value))throw new Error(`Command ${n.shape.type.value} has a target but no cache`)});import{z as uc}from"zod";import{z as pc}from"zod";import{z as uo}from"zod";var Rt=uo.object({index:uo.number().optional().describe("global index within a test (in-order traversal)"),id:uo.string(),skipped:uo.boolean().optional(),envKey:uo.string().optional().describe("key in the environment to save the result of this step to"),aiSuggested:uo.boolean().optional()});ye(pc);var At=Rt.extend({type:pc.literal("PRESET_ACTION"),command:po,skipped:pc.boolean().optional()}).openapi({ref:"PresetAction"});ye(uc);var vr=Rt.extend({type:uc.literal("AI_ACTION"),text:uc.string(),steps:At.array().optional()}).openapi({ref:"AIAction"});import{z as se}from"zod";var lT=se.object({cacheKey:se.string(),cacheExpiryMs:se.number()}),mc=Rt.extend({id:se.string().uuid().describe("ID of the module step itself. Used to 'namespace' step cache entries."),inputs:se.record(se.string()).optional(),cacheConfig:lT.optional()}),kn=mc.extend({type:se.literal("MODULE"),moduleId:se.string().uuid()}),cT=se.union([kn.pick({type:!0,moduleId:!0}),se.record(se.unknown())]),dT=se.object({type:se.literal("URL_REGEX"),regex:se.string()}),pT=se.object({type:se.literal("PAGE_CHECK"),substring:se.string()}),hc=se.object({cacheInvalidation:se.discriminatedUnion("type",[pT,dT]).optional()}),It=se.object({moduleId:se.string().uuid(),name:se.string(),description:se.string().nullish(),enabled:se.boolean().nullish(),parameters:se.string().array().nullish(),defaultParameters:se.record(se.string(),se.string()).nullish(),defaultCacheKey:se.string().nullish(),defaultCacheTtl:se.number().nullish(),defaultCacheAllInvocations:se.boolean().nullish(),autoAuth:se.boolean().nullish(),advanced:hc.nullish()});import{z as ot}from"zod";import{z as gc}from"zod";ye(gc);var mo=Rt.extend({type:gc.literal("AI_ACTION_DYNAMIC"),text:gc.string()}).openapi({ref:"AIActionDynamic"});import{z as Hu}from"zod";var fc=Rt.extend({type:Hu.literal("CONDITIONAL"),skipped:Hu.boolean().optional()});import{z as Ms}from"zod";var uT=Ms.object({type:Ms.literal("url"),url:Ms.string()}),Ci=Rt.extend({type:Ms.literal("IFRAME"),identifier:uT});import{z as Gt}from"zod";var Sc=(r=>(r.ALWAYS="ALWAYS",r.ON_FAILURE="ON_FAILURE",r.ON_ACTION_FAILURE="ON_ACTION_FAILURE",r))(Sc||{});var mT=Gt.discriminatedUnion("type",[Gt.object({type:Gt.literal("NAVIGATE_URL"),url:Gt.string().url()}),Gt.object({type:Gt.literal("GO_TO_SECTION_START")})]),hT=Gt.object({trigger:Gt.nativeEnum(Sc).optional(),attempts:Gt.number().int().optional(),restartBehavior:mT}),Ri=Rt.extend({type:Gt.literal("SECTION"),description:Gt.string().describe("user provided goal of what the section should accomplish"),plan:Gt.string().array().optional(),autohealingConfig:hT.optional()});var $u=It.merge(mc).extend({type:ot.literal("RESOLVED_MODULE"),steps:ot.lazy(()=>ve.array())}),yc=It.extend({steps:ot.lazy(()=>ve.array())}),bc=Ci.extend({steps:ot.lazy(()=>Ke.array())}),gT=Ci.extend({steps:ot.lazy(()=>ve.array())}),wc=Ri.extend({steps:ot.lazy(()=>Ke.array())}),fT=Ri.extend({steps:ot.lazy(()=>ve.array())}),xr=fc.extend({blocks:ot.object({assertion:ot.lazy(()=>At),steps:ot.lazy(()=>Ke.array())}).array(),elseSteps:ot.lazy(()=>Ke.array().optional())}),ST=fc.extend({blocks:ot.object({assertion:ot.lazy(()=>At),steps:ot.lazy(()=>ve.array())}).array(),elseSteps:ot.lazy(()=>ve.array().optional())}),Ke=ot.discriminatedUnion("type",[At,vr,mo,kn,xr,bc,wc]),ve=ot.discriminatedUnion("type",[At,vr,mo,$u,ST,gT,fT]);import{z as Vt}from"zod";var yT=Vt.object({steps:Ke.array(),beforeSteps:Ke.array().nullish(),afterSteps:Ke.array().nullish()}),ho=Vt.object({steps:ve.array(),beforeSteps:ve.array().nullish(),afterSteps:ve.array().nullish()}),Tr=Vt.object({steps:Vt.record(Vt.string(),Vt.unknown()).array(),beforeSteps:Vt.record(Vt.string(),Vt.unknown()).array().nullish(),afterSteps:Vt.record(Vt.string(),Vt.unknown()).array().nullish()});var He="1.0.19";import{z as Er}from"zod";var vc=Er.object({key:Er.string(),testId:Er.string().optional(),moduleId:Er.string().optional(),organizationId:Er.string(),value:wr}),Wu=Er.record(Er.string(),vc);var Gu=k.object({phrase:k.string()}),xc=k.object({thoughts:k.string().optional(),result:k.union([k.literal("NOT_FOUND"),k.string(),k.number(),k.array(k.unknown()),k.record(k.unknown(),k.unknown()),k.unknown()])}),KF=k.object({text:k.string()}),Vu=k.object({thoughts:k.string(),review:k.string().optional(),id:k.number().int()}),Fs=(u=>(u.NO_DESCRIPTION_PROVIDED="NO_DESCRIPTION_PROVIDED",u.FEW_WORDS="FEW_WORDS",u.STYLE_TAG="STYLE_TAG",u.TYPE_IN_DESCRIPTION="TYPE_IN_DESCRIPTION",u.HARDCODED_ATTRIBUTE="HARDCODED_ATTRIBUTE",u.NONE="NONE",u.AMBIGUOUS_DESCRIPTION="AMBIGUOUS_DESCRIPTION",u.AMBIGUOUS_ASSERTION="AMBIGUOUS_ASSERTION",u.PREFER_PAGE_CHECK="PREFER_PAGE_CHECK",u.PREFER_ASSERTION="PREFER_ASSERTION",u.HTML_ELEMENTS="HTML_ELEMENTS",u.MULTIPLE_ELEMENTS_DESCRIPTION="MULTIPLE_ELEMENTS_DESCRIPTION",u))(Fs||{});var qu=k.object({thoughts:k.string(),category:k.nativeEnum(Fs)}),bT=k.discriminatedUnion("op",[k.object({op:k.literal("replace"),path:k.string(),value:k.string()}),k.object({op:k.literal("add"),path:k.string(),value:k.string()}),k.object({op:k.literal("remove"),path:k.string()})]),YF=k.object({thoughts:k.string(),patches:bT.array()}),Ku=[k.literal("add"),k.literal("replace"),k.literal("remove")],wT=k.object({op:k.union(Ku),path:k.string(),value:ve.optional()}),Yu=k.object({patches:wT.array(),thoughts:k.string()});var vT=k.object({thoughts:k.string(),op:k.union(Ku),value:k.union([k.null(),ve])}),Ju=k.object({reasoning:k.string(),scenario:k.string(),patch:vT.or(k.null())}),JF=k.object({thoughts:k.string(),evaluation:k.number().min(1).max(10)}),XF=k.object({observations:k.string(),reasoning:k.string(),command:_s});var Tc=k.object({summary:k.string(),reasoning:k.string(),evaluation:k.discriminatedUnion("type",[k.object({type:k.literal("DONE")}),k.object({type:k.literal("RIGHT_TRACK")}),k.object({type:k.literal("WRONG_TRACK"),feedback:k.string()}),k.object({type:k.literal("IMPOSSIBLE")})])});import{z as F}from"zod";import*as te from"zod";var rD=te.object({thoughts:te.string().optional().describe("only provided if a description was provided"),target:br.optional().describe("only provided if a description was provided"),pageState:te.string().optional().describe("serialized a11y tree, only provided if a description was provided"),options:te.object({label:te.string(),value:te.string()}).array().optional().describe("list of options, provided for <select> elements only"),screenshot:te.object({data:te.string(),height:te.number().int(),width:te.number().int()}).optional().describe("only provided if returnScreenshot is true")}),Xu=te.union([te.literal("NEGATED_CHECK"),te.literal("SELECT_OPTION"),te.literal("TYPE")]);function Ai(n){if(!("useSelector"in n&&n.useSelector)){if(n.type==="SELECT_OPTION")return"SELECT_OPTION";if(n.type==="TYPE")return"TYPE";if(n.type==="ELEMENT_CHECK"&&n.assertion.type==="ELEMENT_EXISTENCE"&&n.assertion.negated)return"NEGATED_CHECK"}}var Ii=(s=>(s.A11Y_ID="A11Y_ID",s.USER_SELECTOR="USER_SELECTOR",s.CSS_SELECTOR="CSS_SELECTOR",s.HTML_DISTANCE="HTML_DISTANCE",s.TEMPLATE_MATCHING="TEMPLATE_MATCHING",s.AUTO_FRAME="AUTO_FRAME",s))(Ii||{}),go=te.object({matched:te.boolean(),reason:te.string().optional().describe("Human understandable description"),logs:te.string().array().optional().describe("Logs for debugging")}),xT=go.extend({type:te.literal("A11Y_ID")}),TT=go.extend({type:te.literal("USER_SELECTOR")}),ET=go.extend({type:te.literal("CSS_SELECTOR"),selectors:te.string().array()}),CT=go.extend({type:te.literal("HTML_DISTANCE"),distance:te.number().optional(),closestElement:te.string().optional(),savedElement:te.string().optional()}),RT=go.extend({type:te.literal("TEMPLATE_MATCHING"),elementImageUrl:te.string().url()}),AT=go.extend({type:te.literal("AUTO_FRAME"),logs:te.string().array().optional()}),Zu=te.discriminatedUnion("type",[xT,TT,ET,CT,RT,AT]);import{z as _i}from"zod";import{z as YE}from"zod";import*as J from"zod";import{cloneDeep as Oi}from"lodash-es";var IT=n=>{let e=Qu(n,0);if(e===void 0||!LT(n[e]))return;let t=Qu(n,e+1);if(t!==void 0)return OT(n,e,t)},em=IT,Qu=(n,e)=>{for(let t=e;t<n.length;t+=1){let r=n[t];if(!PT(r))return t}},PT=n=>n===" "||n===" "||n===`
|
|
5
5
|
`||n==="\r",LT=n=>n==="{"||n==="[",OT=(n,e,t)=>{let r;for(let o=t-1;o>e;o-=1){let i=n[o];if(i==="\r")return;if(i===`
|
|
6
6
|
`)return kT(r);if(r===void 0)r=i;else if(r[0]===i)r+=i;else return}},kT=n=>n===void 0?0:n[0]===" "?n.length:n;var tm=(n,e)=>{let t=Ec(n,"toPrecision",e,e);return t===void 0?Ec(n,"toExponential",e,e):t},Ec=(n,e,t,r)=>{let i=n[e](r).replace(NT,"$1").replace(_T,"$1");return i.length<=t?i:r===1?void 0:Ec(n,e,t,r-1)},NT=/(e)\+/iu,_T=/\.?0*($|e)/iu;var rm=(n,e)=>{if(typeof n!="string")throw new TypeError(`Input must be a JSON string: ${n}`);MT(e)},MT=n=>{if(FT(n),n<0)throw new TypeError(`"maxSize" argument must be positive: ${n}`);if(n<nm)throw new TypeError(`"maxSize" argument must be at least ${nm}: ${n}`)},FT=n=>{if(n===void 0)throw new TypeError('"maxSize" argument must be defined');if(!Number.isInteger(n))throw new TypeError(`"maxSize" argument must be an integer: ${n}`)},nm=7;var Ds=(n,e,t)=>{let r=im(e,t);return om(n,e,r)},om=(n,e,t)=>{if(t>=e)return t;let r=n[t];return r>=GT&&r<=VT?om(n,e,t+1):t},Us=(n,e,t)=>{if(t===void 0)return t;let r=im(e,t);return DT(n,r)},DT=(n,e)=>UT(n,e)?e-3:BT(n,e)?e-2:zT(n,e)?e-1:e,UT=(n,e)=>e>=3&&n[e-3]>=jT&&n[e-3]<=HT,BT=(n,e)=>e>=2&&n[e-2]>=$T,zT=(n,e)=>e>=1&&n[e-1]>=WT,im=(n,e)=>e<0||Object.is(e,-0)?Math.max(n+e,0):e,jT=240,HT=244,$T=224,WT=194,GT=128,VT=191;var sm=(n,e,t)=>{let r=globalThis.Buffer.from(n),o=Ds(r,r.length,e),i=Us(r,r.length,t);return o===0&&i>=r.length?r.toString():r.toString("utf8",o,i)};var am=/[\uD800-\uDFFF]/gu,lm="\uFFFD";var Bs=n=>qT(n)?n.replace(am,lm):n,qT=n=>{for(let e=0;e<n.length;e+=1){let t=n.codePointAt(e);if(t>=55296&&t<=57343)return!0}return!1};var Ac=({input:n,targetByteCount:e,firstStartSurrogate:t,lastStartSurrogate:r,firstEndSurrogate:o,lastEndSurrogate:i,increment:s,canBacktrack:a,shift:l,charIndexInit:c})=>{let p=c,d=p,u=0;for(;u<e;p+=s){d=p;let h=n.charCodeAt(p);if(Number.isNaN(h))break;if(h<=127){u+=1;continue}if(h<=2047){u+=2;continue}if(u+=3,h<t||h>r)continue;let g=n.charCodeAt(p+s);Number.isNaN(g)||g<o||g>i||(u+=1,p+=s)}return(a&&u>e?d:p)+l};var Ic=(n,e,t)=>e<0||Object.is(e,-0)?QT(n,e,t):ZT(n,e,t),ZT=(n,e,t)=>Ac({input:n,targetByteCount:e,firstStartSurrogate:55296,lastStartSurrogate:56319,firstEndSurrogate:56320,lastEndSurrogate:57343,increment:1,canBacktrack:t,shift:0,charIndexInit:0}),QT=(n,e,t)=>Ac({input:n,targetByteCount:-e,firstStartSurrogate:56320,lastStartSurrogate:57343,firstEndSurrogate:55296,lastEndSurrogate:56319,increment:-1,canBacktrack:!t,shift:1,charIndexInit:n.length-1});var zs=(n,e,t)=>{let r=Ic(n,e,!1),o=eE(n,t),i=r===0&&o===void 0?n:n.slice(r,o);return Bs(i)},eE=(n,e)=>{if(e===void 0)return e;let t=Ic(n,e,!0);return t===n.length?void 0:t};var dm=(n,e,t)=>{let{textEncoder:r,textDecoder:o}=tE(),i=nE(n),{written:s}=r.encodeInto(n,i),a=Ds(i,s,e),l=Us(i,s,t),c=l===void 0?s:Math.min(l,s),p=i.subarray(a,c);return o.decode(p)},tE=()=>(Pc===void 0&&(Pc=new globalThis.TextEncoder,cm=new globalThis.TextDecoder("utf8",{fatal:!1})),{textEncoder:Pc,textDecoder:cm}),Pc,cm,nE=n=>{let e=n.length*3;return e>rE?new Uint8Array(e):((js===void 0||js.length<e)&&(js=new Uint8Array(e)),js)},rE=1e5,js;var pm=(n,e)=>{if(e===void 0)return e;let t=Lc(n,e);return t>=n.length*um?void 0:t},Lc=(n,e)=>e<=n.length*-um?0:e,um=4;var mm=(n,e,t)=>{if(typeof n!="string")throw new TypeError(`First argument must be a string: ${n}`);oE(e),iE(t)},oE=n=>{if(n===void 0)throw new TypeError("Second argument is required.");hm("Second",n)},iE=n=>{n!==void 0&&hm("Third",n)},hm=(n,e)=>{if(!Number.isInteger(e))throw new TypeError(`${n} argument must be an integer: ${e}`)};var gm=n=>{let e=!0,t=0;for(let r=0;r<Oc;r+=1){let o=sE(n,r);o<=127||(e&&(e=!1),o>2047&&(t+=1))}return{asciiOnly:e,longCharsPercentage:t/Oc}},sE=(n,e)=>{let t=Oc-1,r=1-(t-e)/t,o=Math.round(r*(n.length-1));return n.charCodeAt(o)},Oc=50;var aE=(n,e,t)=>{if(mm(n,e,t),n==="")return n;let r=Lc(n,e),o=pm(n,t);return o===void 0&&Object.is(r,0)?Bs(n):lE(n,r,o)},fm=aE,lE=(n,e,t)=>{if(n.length<=cE)return zs(n,e,t);let{asciiOnly:r,longCharsPercentage:o}=gm(n);return r?pE(n,e,t):o>=dE?zs(n,e,t):Sm(n,e,t)},cE=200,dE=.4,pE=(n,e,t)=>"Buffer"in globalThis&&"from"in globalThis.Buffer?sm(n,e,t):Sm(n,e,t),Sm=(n,e,t)=>"TextEncoder"in globalThis?dm(n,e,t):zs(n,e,t);var bm=(n,e)=>{let t=JSON.stringify(n),r=hE(t),o=fm(r,0,e-ym.length-Pi.length*2),s=`${uE(o)}${ym}`;return gE(s)},uE=n=>n.replace(mE,""),mE=/(\\|\\u[0-9a-fA-F]{0,3})$/u,hE=n=>n.slice(Pi.length,-Pi.length),gE=n=>`${Pi}${n}${Pi}`,Pi='"',ym="...";var wm=n=>globalThis.Buffer.byteLength(n);var kc=n=>{let e=n.length,t=e;for(let r=0;r<e;r+=1){let o=n.charCodeAt(r);if(o<=fE)continue;if(o<=SE){t+=1;continue}if(t+=2,o<yE||o>bE)continue;let i=n.charCodeAt(r+1);i<wE||i>vE||(r+=1)}return t},fE=127,SE=2047,yE=55296,bE=56319,wE=56320,vE=57343;var vm=()=>xE.bind(void 0,new TextEncoder),xE=(n,e)=>{let t=TE(e);return n.encodeInto(e,t).written},TE=n=>{let e=n.length*3;return e>EE?new Uint8Array(e):((Hs===void 0||Hs.length<e)&&(Hs=new Uint8Array(e)),Hs)},EE=1e5,Hs;var RE=()=>"Buffer"in globalThis&&"byteLength"in globalThis.Buffer?wm:"TextEncoder"in globalThis?AE.bind(void 0,vm()):kc,AE=(n,e)=>e.length<100?kc(e):n(e),xm=RE();var Tm=n=>{if(n===null)return IE;if(n===!0)return PE;if(n===!1)return LE;let e=typeof n;return e==="object"?OE:e==="number"?JSON.stringify(n).length:Nc(n)},IE=4,PE=4,LE=5,OE=2,Nc=n=>xm(JSON.stringify(n));var $s=({size:n,increment:e,maxSize:t,truncatedProps:r,path:o,value:i})=>{let s=n+e,a=s>t;return a?{size:n,stop:a,truncatedProps:[...r,{path:o,value:i}]}:{size:s,stop:a,truncatedProps:r}},Cm=n=>Tm(n),Rm=(n,e,t)=>{let r=Im({empty:n,indent:e,depth:t,keySpaceSize:0}),o=Pm(n);return r+o},Am=({key:n,empty:e,indent:t,depth:r})=>{let o=Im({empty:e,indent:t,depth:r,keySpaceSize:1}),i=Nc(n),s=Pm(e);return o+i+kE+s},kE=1,Im=({empty:n,indent:e,depth:t,keySpaceSize:r})=>{if(e===void 0)return 0;let o=Em+e*(t+1),i=n?Em+e*t:0;return r+o+i},Em=1,Pm=n=>n?0:NE,NE=1;var Ws=({parent:n,truncatedProps:e,path:t,increment:r,maxSize:o,key:i,empty:s,size:a,truncateValue:l,indent:c,depth:p})=>{let d=n[i],u=[...t,i],{size:m,stop:h,truncatedProps:g}=$s({size:a,increment:r,maxSize:o,truncatedProps:e,path:u,value:d});return h?{empty:s,size:m,truncatedProps:g}:_E({value:d,truncatedProps:e,path:u,maxSize:o,empty:s,size:a,newSize:m,truncateValue:l,indent:c,depth:p})},_E=({value:n,truncatedProps:e,path:t,maxSize:r,empty:o,size:i,newSize:s,truncateValue:a,indent:l,depth:c})=>{let{value:p,size:d,truncatedProps:u}=a({value:n,truncatedProps:e,path:t,size:s,maxSize:r,indent:l,depth:c+1});return p===void 0?{empty:o,size:i,truncatedProps:u}:{empty:!1,size:d,value:p,truncatedProps:u}};var Lm=({array:n,truncatedProps:e,path:t,size:r,maxSize:o,truncateValue:i,indent:s,depth:a})=>{let l=[],c={empty:!0,size:r,truncatedProps:e};for(let p=0;p<n.length;p+=1){let d=Rm(c.empty,s,a);c=Ws({parent:n,truncatedProps:c.truncatedProps,path:t,increment:d,maxSize:o,key:p,empty:c.empty,size:c.size,truncateValue:i,indent:s,depth:a}),c.value!==void 0&&l.push(c.value)}return{value:l,size:c.size,truncatedProps:c.truncatedProps}};var Om=({object:n,truncatedProps:e,path:t,size:r,maxSize:o,truncateValue:i,indent:s,depth:a})=>{let l={},c={empty:!0,size:r,truncatedProps:e};for(let p in n){let d=Am({key:p,empty:c.empty,indent:s,depth:a});c=Ws({parent:n,truncatedProps:c.truncatedProps,path:t,increment:d,maxSize:o,key:p,empty:c.empty,size:c.size,truncateValue:i,indent:s,depth:a}),c.value!==void 0&&(l[p]=c.value)}return{value:l,size:c.size,truncatedProps:c.truncatedProps}};var Gs=({value:n,truncatedProps:e,path:t,size:r,maxSize:o,indent:i,depth:s})=>{let a=Cm(n),{size:l,stop:c,truncatedProps:p}=$s({size:r,increment:a,maxSize:o,truncatedProps:e,path:t,value:n});return c?{value:void 0,size:l,truncatedProps:p}:ME({value:n,truncatedProps:p,path:t,size:l,maxSize:o,indent:i,depth:s})},ME=({value:n,truncatedProps:e,path:t,size:r,maxSize:o,indent:i,depth:s})=>typeof n!="object"||n===null?{value:n,size:r,truncatedProps:e}:Array.isArray(n)?Lm({array:n,truncatedProps:e,path:t,size:r,maxSize:o,truncateValue:Gs,indent:i,depth:s}):Om({object:n,truncatedProps:e,path:t,size:r,maxSize:o,truncateValue:Gs,indent:i,depth:s});var FE=(n,e)=>{rm(n,e);let t=DE(n),r=UE(n),{value:o,truncatedProps:i}=Gs({value:r,truncatedProps:[],path:[],size:0,maxSize:e,indent:t,depth:0});return{jsonString:BE({newValue:o,value:r,maxSize:e,indent:t}),truncatedProps:i}},Li=FE,DE=n=>{let e=em(n);return typeof e=="string"?e.length:e},UE=n=>{try{return JSON.parse(n)}catch(e){throw new TypeError(`Invalid JSON string: "${n}"
|
|
@@ -283,11 +283,13 @@ var momenticConstants = {
|
|
|
283
283
|
"data-action",
|
|
284
284
|
"data-aria-hidden",
|
|
285
285
|
"data-hidden",
|
|
286
|
+
"data-automation-id",
|
|
286
287
|
"data-content-editable-leaf",
|
|
287
288
|
// notion
|
|
288
|
-
"data-automation-id",
|
|
289
289
|
"data-wf-icon",
|
|
290
290
|
// webflow specific
|
|
291
|
+
"data-tns",
|
|
292
|
+
// compass specific
|
|
291
293
|
// react flow
|
|
292
294
|
"data-handleid",
|
|
293
295
|
"data-handlepos",
|
|
@@ -3539,7 +3541,7 @@ function registerAllMomenticListeners() {
|
|
|
3539
3541
|
|
|
3540
3542
|
// src/html/index.ts
|
|
3541
3543
|
registerAllMomenticListeners();
|
|
3542
|
-
`,cssGeneratorLibJs:'// Taken from https://cdn.jsdelivr.net/npm/css-selector-generator@3.6.8/build/index.min.js\n!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.CssSelectorGenerator=e():t.CssSelectorGenerator=e()}(self,(()=>(()=>{"use strict";var t={d:(e,n)=>{for(var o in n)t.o(n,o)&&!t.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:n[o]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};function n(t){return"object"==typeof t&&null!==t&&t.nodeType===Node.ELEMENT_NODE}t.r(e),t.d(e,{default:()=>K,getCssSelector:()=>J});const o={NONE:"",DESCENDANT:" ",CHILD:" > "},r={id:"id",class:"class",tag:"tag",attribute:"attribute",nthchild:"nthchild",nthoftype:"nthoftype"},i="CssSelectorGenerator";function c(t="unknown problem",...e){console.warn(`${i}: ${t}`,...e)}const u={selectors:[r.id,r.class,r.tag,r.attribute],includeTag:!1,whitelist:[],blacklist:[],combineWithinSelector:!0,combineBetweenSelectors:!0,root:null,maxCombinations:Number.POSITIVE_INFINITY,maxCandidates:Number.POSITIVE_INFINITY};function s(t){return t instanceof RegExp}function a(t){return["string","function"].includes(typeof t)||s(t)}function l(t){return Array.isArray(t)?t.filter(a):[]}function f(t){const e=[Node.DOCUMENT_NODE,Node.DOCUMENT_FRAGMENT_NODE,Node.ELEMENT_NODE];return function(t){return t instanceof Node}(t)&&e.includes(t.nodeType)}function d(t,e){if(f(t))return t.contains(e)||c("element root mismatch","Provided root does not contain the element. This will most likely result in producing a fallback selector using element\'s real root node. If you plan to use the selector using provided root (e.g. `root.querySelector`), it will nto work as intended."),t;const n=e.getRootNode({composed:!1});return f(n)?(n!==document&&c("shadow root inferred","You did not provide a root and the element is a child of Shadow DOM. This will produce a selector using ShadowRoot as a root. If you plan to use the selector using document as a root (e.g. `document.querySelector`), it will not work as intended."),n):e.ownerDocument.querySelector(":root")}function m(t){return"number"==typeof t?t:Number.POSITIVE_INFINITY}function p(t=[]){const[e=[],...n]=t;return 0===n.length?e:n.reduce(((t,e)=>t.filter((t=>e.includes(t)))),e)}function h(t){return[].concat(...t)}function g(t){const e=t.map((t=>{if(s(t))return e=>t.test(e);if("function"==typeof t)return e=>{const n=t(e);return"boolean"!=typeof n?(c("pattern matcher function invalid","Provided pattern matching function does not return boolean. It\'s result will be ignored.",t),!1):n};if("string"==typeof t){const e=new RegExp("^"+t.replace(/[|\\\\{}()[\\]^$+?.]/g,"\\\\$&").replace(/\\*/g,".+")+"$");return t=>e.test(t)}return c("pattern matcher invalid","Pattern matching only accepts strings, regular expressions and/or functions. This item is invalid and will be ignored.",t),()=>!1}));return t=>e.some((e=>e(t)))}function y(t,e,n){const o=Array.from(d(n,t[0]).querySelectorAll(e));return o.length===t.length&&t.every((t=>o.includes(t)))}function b(t,e){e=null!=e?e:function(t){return t.ownerDocument.querySelector(":root")}(t);const o=[];let r=t;for(;n(r)&&r!==e;)o.push(r),r=r.parentElement;return o}function N(t,e){return p(t.map((t=>b(t,e))))}const S=", ",E=new RegExp(["^$","\\\\s"].join("|")),w=new RegExp(["^$"].join("|")),I=[r.nthoftype,r.tag,r.id,r.class,r.attribute,r.nthchild],v=g(["class","id","ng-*"]);function T({name:t}){return`[${t}]`}function C({name:t,value:e}){return`[${t}=\'${e}\']`}function O({nodeName:t,nodeValue:e}){return{name:V(t),value:V(e)}}function x(t){const e=Array.from(t.attributes).filter((e=>function({nodeName:t},e){const n=e.tagName.toLowerCase();return!(["input","option"].includes(n)&&"value"===t||v(t))}(e,t))).map(O);return[...e.map(T),...e.map(C)]}function j(t){return(t.getAttribute("class")||"").trim().split(/\\s+/).filter((t=>!w.test(t))).map((t=>`.${V(t)}`))}function A(t){const e=t.getAttribute("id")||"",n=`#${V(e)}`,o=t.getRootNode({composed:!1});return!E.test(e)&&y([t],n,o)?[n]:[]}function $(t){const e=t.parentNode;if(e){const o=Array.from(e.childNodes).filter(n).indexOf(t);if(o>-1)return[`:nth-child(${o+1})`]}return[]}function D(t){return[V(t.tagName.toLowerCase())]}function R(t){const e=[...new Set(h(t.map(D)))];return 0===e.length||e.length>1?[]:[e[0]]}function P(t){const e=R([t])[0],n=t.parentElement;if(n){const o=Array.from(n.children).filter((t=>t.tagName.toLowerCase()===e)),r=o.indexOf(t);if(r>-1)return[`${e}:nth-of-type(${r+1})`]}return[]}function _(t=[],{maxResults:e=Number.POSITIVE_INFINITY}={}){return Array.from(function*(t=[],{maxResults:e=Number.POSITIVE_INFINITY}={}){let n=0,o=L(1);for(;o.length<=t.length&&n<e;){n+=1;const e=o.map((e=>t[e]));yield e,o=k(o,t.length-1)}}(t,{maxResults:e}))}function k(t=[],e=0){const n=t.length;if(0===n)return[];const o=[...t];o[n-1]+=1;for(let t=n-1;t>=0;t--)if(o[t]>e){if(0===t)return L(n+1);o[t-1]++,o[t]=o[t-1]+1}return o[n-1]>e?L(n+1):o}function L(t=1){return Array.from(Array(t).keys())}const M=":".charCodeAt(0).toString(16).toUpperCase(),F=/[ !"#$%&\'()\\[\\]{|}<>*+,./;=?@^`~\\\\]/;function V(t=""){var e,n;return null!==(n=null===(e=null===CSS||void 0===CSS?void 0:CSS.escape)||void 0===e?void 0:e.call(CSS,t))&&void 0!==n?n:function(t=""){return t.split("").map((t=>":"===t?`\\\\${M} `:F.test(t)?`\\\\${t}`:escape(t).replace(/%/g,"\\\\"))).join("")}(t)}const Y={tag:R,id:function(t){return 0===t.length||t.length>1?[]:A(t[0])},class:function(t){return p(t.map(j))},attribute:function(t){return p(t.map(x))},nthchild:function(t){return p(t.map($))},nthoftype:function(t){return p(t.map(P))}},q={tag:D,id:A,class:j,attribute:x,nthchild:$,nthoftype:P};function B(t){return t.includes(r.tag)||t.includes(r.nthoftype)?[...t]:[...t,r.tag]}function G(t={}){const e=[...I];return t[r.tag]&&t[r.nthoftype]&&e.splice(e.indexOf(r.tag),1),e.map((e=>{return(o=t)[n=e]?o[n].join(""):"";var n,o})).join("")}function H(t,e,n="",r){const i=function(t,e){return""===e?t:function(t,e){return[...t.map((t=>e+o.DESCENDANT+t)),...t.map((t=>e+o.CHILD+t))]}(t,e)}(function(t,e,n){const o=function(t,e){const{blacklist:n,whitelist:o,combineWithinSelector:r,maxCombinations:i}=e,c=g(n),u=g(o);return function(t){const{selectors:e,includeTag:n}=t,o=[].concat(e);return n&&!o.includes("tag")&&o.push("tag"),o}(e).reduce(((e,n)=>{const o=function(t,e){var n;return(null!==(n=Y[e])&&void 0!==n?n:()=>[])(t)}(t,n),s=function(t=[],e,n){return t.filter((t=>n(t)||!e(t)))}(o,c,u),a=function(t=[],e){return t.sort(((t,n)=>{const o=e(t),r=e(n);return o&&!r?-1:!o&&r?1:0}))}(s,u);return e[n]=r?_(a,{maxResults:i}):a.map((t=>[t])),e}),{})}(t,n),r=function(t,e){return function(t){const{selectors:e,combineBetweenSelectors:n,includeTag:o,maxCandidates:r}=t,i=n?_(e,{maxResults:r}):e.map((t=>[t]));return o?i.map(B):i}(e).map((e=>function(t,e){const n={};return t.forEach((t=>{const o=e[t];o.length>0&&(n[t]=o)})),function(t={}){let e=[];return Object.entries(t).forEach((([t,n])=>{e=n.flatMap((n=>0===e.length?[{[t]:n}]:e.map((e=>Object.assign(Object.assign({},e),{[t]:n})))))})),e}(n).map(G)}(e,t))).filter((t=>t.length>0))}(o,n),i=h(r);return[...new Set(i)]}(t,r.root,r),n);for(const e of i)if(y(t,e,r.root))return e;return null}function W(t){return{value:t,include:!1}}function U({selectors:t,operator:e}){let n=[...I];t[r.tag]&&t[r.nthoftype]&&(n=n.filter((t=>t!==r.tag)));let o="";return n.forEach((e=>{(t[e]||[]).forEach((({value:t,include:e})=>{e&&(o+=t)}))})),e+o}function z(t){return[":root",...b(t).reverse().map((t=>{const e=function(t,e,n=o.NONE){const r={};return e.forEach((e=>{Reflect.set(r,e,function(t,e){return q[e](t)}(t,e).map(W))})),{element:t,operator:n,selectors:r}}(t,[r.nthchild],o.CHILD);return e.selectors.nthchild.forEach((t=>{t.include=!0})),e})).map(U)].join("")}function J(t,e={}){const o=function(t){(t instanceof NodeList||t instanceof HTMLCollection)&&(t=Array.from(t));const e=(Array.isArray(t)?t:[t]).filter(n);return[...new Set(e)]}(t),i=function(t,e={}){const n=Object.assign(Object.assign({},u),e);return{selectors:(o=n.selectors,Array.isArray(o)?o.filter((t=>{return e=r,n=t,Object.values(e).includes(n);var e,n})):[]),whitelist:l(n.whitelist),blacklist:l(n.blacklist),root:d(n.root,t),combineWithinSelector:!!n.combineWithinSelector,combineBetweenSelectors:!!n.combineBetweenSelectors,includeTag:!!n.includeTag,maxCombinations:m(n.maxCombinations),maxCandidates:m(n.maxCandidates)};var o}(o[0],e);let c="",s=i.root;function a(){return function(t,e,n="",o){if(0===t.length)return null;const r=[t.length>1?t:[],...N(t,e).map((t=>[t]))];for(const t of r){const e=H(t,0,n,o);if(e)return{foundElements:t,selector:e}}return null}(o,s,c,i)}let f=a();for(;f;){const{foundElements:t,selector:e}=f;if(y(o,e,i.root))return e;s=t[0],c=e,f=a()}return o.length>1?o.map((t=>J(t,i))).join(S):function(t){return t.map(z).join(S)}(o)}const K=J;return e})()));'};import{execSync as TP}from"child_process";import{randomUUID as Ly}from"crypto";import{existsSync as el,mkdirSync as EP,readFileSync as CP,writeFileSync as RP}from"fs";import{Jimp as AP}from"jimp";import IP from"js-beautify";import{cloneDeep as PP}from"lodash-es";var dS={"application/prs.cww":["cww"],"application/prs.xsf+xml":["xsf"],"application/vnd.1000minds.decision-model+xml":["1km"],"application/vnd.3gpp.pic-bw-large":["plb"],"application/vnd.3gpp.pic-bw-small":["psb"],"application/vnd.3gpp.pic-bw-var":["pvb"],"application/vnd.3gpp2.tcap":["tcap"],"application/vnd.3m.post-it-notes":["pwn"],"application/vnd.accpac.simply.aso":["aso"],"application/vnd.accpac.simply.imp":["imp"],"application/vnd.acucobol":["acu"],"application/vnd.acucorp":["atc","acutc"],"application/vnd.adobe.air-application-installer-package+zip":["air"],"application/vnd.adobe.formscentral.fcdt":["fcdt"],"application/vnd.adobe.fxp":["fxp","fxpl"],"application/vnd.adobe.xdp+xml":["xdp"],"application/vnd.adobe.xfdf":["*xfdf"],"application/vnd.age":["age"],"application/vnd.ahead.space":["ahead"],"application/vnd.airzip.filesecure.azf":["azf"],"application/vnd.airzip.filesecure.azs":["azs"],"application/vnd.amazon.ebook":["azw"],"application/vnd.americandynamics.acc":["acc"],"application/vnd.amiga.ami":["ami"],"application/vnd.android.package-archive":["apk"],"application/vnd.anser-web-certificate-issue-initiation":["cii"],"application/vnd.anser-web-funds-transfer-initiation":["fti"],"application/vnd.antix.game-component":["atx"],"application/vnd.apple.installer+xml":["mpkg"],"application/vnd.apple.keynote":["key"],"application/vnd.apple.mpegurl":["m3u8"],"application/vnd.apple.numbers":["numbers"],"application/vnd.apple.pages":["pages"],"application/vnd.apple.pkpass":["pkpass"],"application/vnd.aristanetworks.swi":["swi"],"application/vnd.astraea-software.iota":["iota"],"application/vnd.audiograph":["aep"],"application/vnd.balsamiq.bmml+xml":["bmml"],"application/vnd.blueice.multipass":["mpm"],"application/vnd.bmi":["bmi"],"application/vnd.businessobjects":["rep"],"application/vnd.chemdraw+xml":["cdxml"],"application/vnd.chipnuts.karaoke-mmd":["mmd"],"application/vnd.cinderella":["cdy"],"application/vnd.citationstyles.style+xml":["csl"],"application/vnd.claymore":["cla"],"application/vnd.cloanto.rp9":["rp9"],"application/vnd.clonk.c4group":["c4g","c4d","c4f","c4p","c4u"],"application/vnd.cluetrust.cartomobile-config":["c11amc"],"application/vnd.cluetrust.cartomobile-config-pkg":["c11amz"],"application/vnd.commonspace":["csp"],"application/vnd.contact.cmsg":["cdbcmsg"],"application/vnd.cosmocaller":["cmc"],"application/vnd.crick.clicker":["clkx"],"application/vnd.crick.clicker.keyboard":["clkk"],"application/vnd.crick.clicker.palette":["clkp"],"application/vnd.crick.clicker.template":["clkt"],"application/vnd.crick.clicker.wordbank":["clkw"],"application/vnd.criticaltools.wbs+xml":["wbs"],"application/vnd.ctc-posml":["pml"],"application/vnd.cups-ppd":["ppd"],"application/vnd.curl.car":["car"],"application/vnd.curl.pcurl":["pcurl"],"application/vnd.dart":["dart"],"application/vnd.data-vision.rdz":["rdz"],"application/vnd.dbf":["dbf"],"application/vnd.dece.data":["uvf","uvvf","uvd","uvvd"],"application/vnd.dece.ttml+xml":["uvt","uvvt"],"application/vnd.dece.unspecified":["uvx","uvvx"],"application/vnd.dece.zip":["uvz","uvvz"],"application/vnd.denovo.fcselayout-link":["fe_launch"],"application/vnd.dna":["dna"],"application/vnd.dolby.mlp":["mlp"],"application/vnd.dpgraph":["dpg"],"application/vnd.dreamfactory":["dfac"],"application/vnd.ds-keypoint":["kpxx"],"application/vnd.dvb.ait":["ait"],"application/vnd.dvb.service":["svc"],"application/vnd.dynageo":["geo"],"application/vnd.ecowin.chart":["mag"],"application/vnd.enliven":["nml"],"application/vnd.epson.esf":["esf"],"application/vnd.epson.msf":["msf"],"application/vnd.epson.quickanime":["qam"],"application/vnd.epson.salt":["slt"],"application/vnd.epson.ssf":["ssf"],"application/vnd.eszigno3+xml":["es3","et3"],"application/vnd.ezpix-album":["ez2"],"application/vnd.ezpix-package":["ez3"],"application/vnd.fdf":["*fdf"],"application/vnd.fdsn.mseed":["mseed"],"application/vnd.fdsn.seed":["seed","dataless"],"application/vnd.flographit":["gph"],"application/vnd.fluxtime.clip":["ftc"],"application/vnd.framemaker":["fm","frame","maker","book"],"application/vnd.frogans.fnc":["fnc"],"application/vnd.frogans.ltf":["ltf"],"application/vnd.fsc.weblaunch":["fsc"],"application/vnd.fujitsu.oasys":["oas"],"application/vnd.fujitsu.oasys2":["oa2"],"application/vnd.fujitsu.oasys3":["oa3"],"application/vnd.fujitsu.oasysgp":["fg5"],"application/vnd.fujitsu.oasysprs":["bh2"],"application/vnd.fujixerox.ddd":["ddd"],"application/vnd.fujixerox.docuworks":["xdw"],"application/vnd.fujixerox.docuworks.binder":["xbd"],"application/vnd.fuzzysheet":["fzs"],"application/vnd.genomatix.tuxedo":["txd"],"application/vnd.geogebra.file":["ggb"],"application/vnd.geogebra.tool":["ggt"],"application/vnd.geometry-explorer":["gex","gre"],"application/vnd.geonext":["gxt"],"application/vnd.geoplan":["g2w"],"application/vnd.geospace":["g3w"],"application/vnd.gmx":["gmx"],"application/vnd.google-apps.document":["gdoc"],"application/vnd.google-apps.presentation":["gslides"],"application/vnd.google-apps.spreadsheet":["gsheet"],"application/vnd.google-earth.kml+xml":["kml"],"application/vnd.google-earth.kmz":["kmz"],"application/vnd.grafeq":["gqf","gqs"],"application/vnd.groove-account":["gac"],"application/vnd.groove-help":["ghf"],"application/vnd.groove-identity-message":["gim"],"application/vnd.groove-injector":["grv"],"application/vnd.groove-tool-message":["gtm"],"application/vnd.groove-tool-template":["tpl"],"application/vnd.groove-vcard":["vcg"],"application/vnd.hal+xml":["hal"],"application/vnd.handheld-entertainment+xml":["zmm"],"application/vnd.hbci":["hbci"],"application/vnd.hhe.lesson-player":["les"],"application/vnd.hp-hpgl":["hpgl"],"application/vnd.hp-hpid":["hpid"],"application/vnd.hp-hps":["hps"],"application/vnd.hp-jlyt":["jlt"],"application/vnd.hp-pcl":["pcl"],"application/vnd.hp-pclxl":["pclxl"],"application/vnd.hydrostatix.sof-data":["sfd-hdstx"],"application/vnd.ibm.minipay":["mpy"],"application/vnd.ibm.modcap":["afp","listafp","list3820"],"application/vnd.ibm.rights-management":["irm"],"application/vnd.ibm.secure-container":["sc"],"application/vnd.iccprofile":["icc","icm"],"application/vnd.igloader":["igl"],"application/vnd.immervision-ivp":["ivp"],"application/vnd.immervision-ivu":["ivu"],"application/vnd.insors.igm":["igm"],"application/vnd.intercon.formnet":["xpw","xpx"],"application/vnd.intergeo":["i2g"],"application/vnd.intu.qbo":["qbo"],"application/vnd.intu.qfx":["qfx"],"application/vnd.ipunplugged.rcprofile":["rcprofile"],"application/vnd.irepository.package+xml":["irp"],"application/vnd.is-xpr":["xpr"],"application/vnd.isac.fcs":["fcs"],"application/vnd.jam":["jam"],"application/vnd.jcp.javame.midlet-rms":["rms"],"application/vnd.jisp":["jisp"],"application/vnd.joost.joda-archive":["joda"],"application/vnd.kahootz":["ktz","ktr"],"application/vnd.kde.karbon":["karbon"],"application/vnd.kde.kchart":["chrt"],"application/vnd.kde.kformula":["kfo"],"application/vnd.kde.kivio":["flw"],"application/vnd.kde.kontour":["kon"],"application/vnd.kde.kpresenter":["kpr","kpt"],"application/vnd.kde.kspread":["ksp"],"application/vnd.kde.kword":["kwd","kwt"],"application/vnd.kenameaapp":["htke"],"application/vnd.kidspiration":["kia"],"application/vnd.kinar":["kne","knp"],"application/vnd.koan":["skp","skd","skt","skm"],"application/vnd.kodak-descriptor":["sse"],"application/vnd.las.las+xml":["lasxml"],"application/vnd.llamagraphics.life-balance.desktop":["lbd"],"application/vnd.llamagraphics.life-balance.exchange+xml":["lbe"],"application/vnd.lotus-1-2-3":["123"],"application/vnd.lotus-approach":["apr"],"application/vnd.lotus-freelance":["pre"],"application/vnd.lotus-notes":["nsf"],"application/vnd.lotus-organizer":["org"],"application/vnd.lotus-screencam":["scm"],"application/vnd.lotus-wordpro":["lwp"],"application/vnd.macports.portpkg":["portpkg"],"application/vnd.mapbox-vector-tile":["mvt"],"application/vnd.mcd":["mcd"],"application/vnd.medcalcdata":["mc1"],"application/vnd.mediastation.cdkey":["cdkey"],"application/vnd.mfer":["mwf"],"application/vnd.mfmp":["mfm"],"application/vnd.micrografx.flo":["flo"],"application/vnd.micrografx.igx":["igx"],"application/vnd.mif":["mif"],"application/vnd.mobius.daf":["daf"],"application/vnd.mobius.dis":["dis"],"application/vnd.mobius.mbk":["mbk"],"application/vnd.mobius.mqy":["mqy"],"application/vnd.mobius.msl":["msl"],"application/vnd.mobius.plc":["plc"],"application/vnd.mobius.txf":["txf"],"application/vnd.mophun.application":["mpn"],"application/vnd.mophun.certificate":["mpc"],"application/vnd.mozilla.xul+xml":["xul"],"application/vnd.ms-artgalry":["cil"],"application/vnd.ms-cab-compressed":["cab"],"application/vnd.ms-excel":["xls","xlm","xla","xlc","xlt","xlw"],"application/vnd.ms-excel.addin.macroenabled.12":["xlam"],"application/vnd.ms-excel.sheet.binary.macroenabled.12":["xlsb"],"application/vnd.ms-excel.sheet.macroenabled.12":["xlsm"],"application/vnd.ms-excel.template.macroenabled.12":["xltm"],"application/vnd.ms-fontobject":["eot"],"application/vnd.ms-htmlhelp":["chm"],"application/vnd.ms-ims":["ims"],"application/vnd.ms-lrm":["lrm"],"application/vnd.ms-officetheme":["thmx"],"application/vnd.ms-outlook":["msg"],"application/vnd.ms-pki.seccat":["cat"],"application/vnd.ms-pki.stl":["*stl"],"application/vnd.ms-powerpoint":["ppt","pps","pot"],"application/vnd.ms-powerpoint.addin.macroenabled.12":["ppam"],"application/vnd.ms-powerpoint.presentation.macroenabled.12":["pptm"],"application/vnd.ms-powerpoint.slide.macroenabled.12":["sldm"],"application/vnd.ms-powerpoint.slideshow.macroenabled.12":["ppsm"],"application/vnd.ms-powerpoint.template.macroenabled.12":["potm"],"application/vnd.ms-project":["*mpp","mpt"],"application/vnd.ms-word.document.macroenabled.12":["docm"],"application/vnd.ms-word.template.macroenabled.12":["dotm"],"application/vnd.ms-works":["wps","wks","wcm","wdb"],"application/vnd.ms-wpl":["wpl"],"application/vnd.ms-xpsdocument":["xps"],"application/vnd.mseq":["mseq"],"application/vnd.musician":["mus"],"application/vnd.muvee.style":["msty"],"application/vnd.mynfc":["taglet"],"application/vnd.neurolanguage.nlu":["nlu"],"application/vnd.nitf":["ntf","nitf"],"application/vnd.noblenet-directory":["nnd"],"application/vnd.noblenet-sealer":["nns"],"application/vnd.noblenet-web":["nnw"],"application/vnd.nokia.n-gage.ac+xml":["*ac"],"application/vnd.nokia.n-gage.data":["ngdat"],"application/vnd.nokia.n-gage.symbian.install":["n-gage"],"application/vnd.nokia.radio-preset":["rpst"],"application/vnd.nokia.radio-presets":["rpss"],"application/vnd.novadigm.edm":["edm"],"application/vnd.novadigm.edx":["edx"],"application/vnd.novadigm.ext":["ext"],"application/vnd.oasis.opendocument.chart":["odc"],"application/vnd.oasis.opendocument.chart-template":["otc"],"application/vnd.oasis.opendocument.database":["odb"],"application/vnd.oasis.opendocument.formula":["odf"],"application/vnd.oasis.opendocument.formula-template":["odft"],"application/vnd.oasis.opendocument.graphics":["odg"],"application/vnd.oasis.opendocument.graphics-template":["otg"],"application/vnd.oasis.opendocument.image":["odi"],"application/vnd.oasis.opendocument.image-template":["oti"],"application/vnd.oasis.opendocument.presentation":["odp"],"application/vnd.oasis.opendocument.presentation-template":["otp"],"application/vnd.oasis.opendocument.spreadsheet":["ods"],"application/vnd.oasis.opendocument.spreadsheet-template":["ots"],"application/vnd.oasis.opendocument.text":["odt"],"application/vnd.oasis.opendocument.text-master":["odm"],"application/vnd.oasis.opendocument.text-template":["ott"],"application/vnd.oasis.opendocument.text-web":["oth"],"application/vnd.olpc-sugar":["xo"],"application/vnd.oma.dd2+xml":["dd2"],"application/vnd.openblox.game+xml":["obgx"],"application/vnd.openofficeorg.extension":["oxt"],"application/vnd.openstreetmap.data+xml":["osm"],"application/vnd.openxmlformats-officedocument.presentationml.presentation":["pptx"],"application/vnd.openxmlformats-officedocument.presentationml.slide":["sldx"],"application/vnd.openxmlformats-officedocument.presentationml.slideshow":["ppsx"],"application/vnd.openxmlformats-officedocument.presentationml.template":["potx"],"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":["xlsx"],"application/vnd.openxmlformats-officedocument.spreadsheetml.template":["xltx"],"application/vnd.openxmlformats-officedocument.wordprocessingml.document":["docx"],"application/vnd.openxmlformats-officedocument.wordprocessingml.template":["dotx"],"application/vnd.osgeo.mapguide.package":["mgp"],"application/vnd.osgi.dp":["dp"],"application/vnd.osgi.subsystem":["esa"],"application/vnd.palm":["pdb","pqa","oprc"],"application/vnd.pawaafile":["paw"],"application/vnd.pg.format":["str"],"application/vnd.pg.osasli":["ei6"],"application/vnd.picsel":["efif"],"application/vnd.pmi.widget":["wg"],"application/vnd.pocketlearn":["plf"],"application/vnd.powerbuilder6":["pbd"],"application/vnd.previewsystems.box":["box"],"application/vnd.proteus.magazine":["mgz"],"application/vnd.publishare-delta-tree":["qps"],"application/vnd.pvi.ptid1":["ptid"],"application/vnd.pwg-xhtml-print+xml":["xhtm"],"application/vnd.quark.quarkxpress":["qxd","qxt","qwd","qwt","qxl","qxb"],"application/vnd.rar":["rar"],"application/vnd.realvnc.bed":["bed"],"application/vnd.recordare.musicxml":["mxl"],"application/vnd.recordare.musicxml+xml":["musicxml"],"application/vnd.rig.cryptonote":["cryptonote"],"application/vnd.rim.cod":["cod"],"application/vnd.rn-realmedia":["rm"],"application/vnd.rn-realmedia-vbr":["rmvb"],"application/vnd.route66.link66+xml":["link66"],"application/vnd.sailingtracker.track":["st"],"application/vnd.seemail":["see"],"application/vnd.sema":["sema"],"application/vnd.semd":["semd"],"application/vnd.semf":["semf"],"application/vnd.shana.informed.formdata":["ifm"],"application/vnd.shana.informed.formtemplate":["itp"],"application/vnd.shana.informed.interchange":["iif"],"application/vnd.shana.informed.package":["ipk"],"application/vnd.simtech-mindmapper":["twd","twds"],"application/vnd.smaf":["mmf"],"application/vnd.smart.teacher":["teacher"],"application/vnd.software602.filler.form+xml":["fo"],"application/vnd.solent.sdkm+xml":["sdkm","sdkd"],"application/vnd.spotfire.dxp":["dxp"],"application/vnd.spotfire.sfs":["sfs"],"application/vnd.stardivision.calc":["sdc"],"application/vnd.stardivision.draw":["sda"],"application/vnd.stardivision.impress":["sdd"],"application/vnd.stardivision.math":["smf"],"application/vnd.stardivision.writer":["sdw","vor"],"application/vnd.stardivision.writer-global":["sgl"],"application/vnd.stepmania.package":["smzip"],"application/vnd.stepmania.stepchart":["sm"],"application/vnd.sun.wadl+xml":["wadl"],"application/vnd.sun.xml.calc":["sxc"],"application/vnd.sun.xml.calc.template":["stc"],"application/vnd.sun.xml.draw":["sxd"],"application/vnd.sun.xml.draw.template":["std"],"application/vnd.sun.xml.impress":["sxi"],"application/vnd.sun.xml.impress.template":["sti"],"application/vnd.sun.xml.math":["sxm"],"application/vnd.sun.xml.writer":["sxw"],"application/vnd.sun.xml.writer.global":["sxg"],"application/vnd.sun.xml.writer.template":["stw"],"application/vnd.sus-calendar":["sus","susp"],"application/vnd.svd":["svd"],"application/vnd.symbian.install":["sis","sisx"],"application/vnd.syncml+xml":["xsm"],"application/vnd.syncml.dm+wbxml":["bdm"],"application/vnd.syncml.dm+xml":["xdm"],"application/vnd.syncml.dmddf+xml":["ddf"],"application/vnd.tao.intent-module-archive":["tao"],"application/vnd.tcpdump.pcap":["pcap","cap","dmp"],"application/vnd.tmobile-livetv":["tmo"],"application/vnd.trid.tpt":["tpt"],"application/vnd.triscape.mxs":["mxs"],"application/vnd.trueapp":["tra"],"application/vnd.ufdl":["ufd","ufdl"],"application/vnd.uiq.theme":["utz"],"application/vnd.umajin":["umj"],"application/vnd.unity":["unityweb"],"application/vnd.uoml+xml":["uoml","uo"],"application/vnd.vcx":["vcx"],"application/vnd.visio":["vsd","vst","vss","vsw"],"application/vnd.visionary":["vis"],"application/vnd.vsf":["vsf"],"application/vnd.wap.wbxml":["wbxml"],"application/vnd.wap.wmlc":["wmlc"],"application/vnd.wap.wmlscriptc":["wmlsc"],"application/vnd.webturbo":["wtb"],"application/vnd.wolfram.player":["nbp"],"application/vnd.wordperfect":["wpd"],"application/vnd.wqd":["wqd"],"application/vnd.wt.stf":["stf"],"application/vnd.xara":["xar"],"application/vnd.xfdl":["xfdl"],"application/vnd.yamaha.hv-dic":["hvd"],"application/vnd.yamaha.hv-script":["hvs"],"application/vnd.yamaha.hv-voice":["hvp"],"application/vnd.yamaha.openscoreformat":["osf"],"application/vnd.yamaha.openscoreformat.osfpvg+xml":["osfpvg"],"application/vnd.yamaha.smaf-audio":["saf"],"application/vnd.yamaha.smaf-phrase":["spf"],"application/vnd.yellowriver-custom-menu":["cmp"],"application/vnd.zul":["zir","zirz"],"application/vnd.zzazz.deck+xml":["zaz"],"application/x-7z-compressed":["7z"],"application/x-abiword":["abw"],"application/x-ace-compressed":["ace"],"application/x-apple-diskimage":["*dmg"],"application/x-arj":["arj"],"application/x-authorware-bin":["aab","x32","u32","vox"],"application/x-authorware-map":["aam"],"application/x-authorware-seg":["aas"],"application/x-bcpio":["bcpio"],"application/x-bdoc":["*bdoc"],"application/x-bittorrent":["torrent"],"application/x-blorb":["blb","blorb"],"application/x-bzip":["bz"],"application/x-bzip2":["bz2","boz"],"application/x-cbr":["cbr","cba","cbt","cbz","cb7"],"application/x-cdlink":["vcd"],"application/x-cfs-compressed":["cfs"],"application/x-chat":["chat"],"application/x-chess-pgn":["pgn"],"application/x-chrome-extension":["crx"],"application/x-cocoa":["cco"],"application/x-conference":["nsc"],"application/x-cpio":["cpio"],"application/x-csh":["csh"],"application/x-debian-package":["*deb","udeb"],"application/x-dgc-compressed":["dgc"],"application/x-director":["dir","dcr","dxr","cst","cct","cxt","w3d","fgd","swa"],"application/x-doom":["wad"],"application/x-dtbncx+xml":["ncx"],"application/x-dtbook+xml":["dtb"],"application/x-dtbresource+xml":["res"],"application/x-dvi":["dvi"],"application/x-envoy":["evy"],"application/x-eva":["eva"],"application/x-font-bdf":["bdf"],"application/x-font-ghostscript":["gsf"],"application/x-font-linux-psf":["psf"],"application/x-font-pcf":["pcf"],"application/x-font-snf":["snf"],"application/x-font-type1":["pfa","pfb","pfm","afm"],"application/x-freearc":["arc"],"application/x-futuresplash":["spl"],"application/x-gca-compressed":["gca"],"application/x-glulx":["ulx"],"application/x-gnumeric":["gnumeric"],"application/x-gramps-xml":["gramps"],"application/x-gtar":["gtar"],"application/x-hdf":["hdf"],"application/x-httpd-php":["php"],"application/x-install-instructions":["install"],"application/x-iso9660-image":["*iso"],"application/x-iwork-keynote-sffkey":["*key"],"application/x-iwork-numbers-sffnumbers":["*numbers"],"application/x-iwork-pages-sffpages":["*pages"],"application/x-java-archive-diff":["jardiff"],"application/x-java-jnlp-file":["jnlp"],"application/x-keepass2":["kdbx"],"application/x-latex":["latex"],"application/x-lua-bytecode":["luac"],"application/x-lzh-compressed":["lzh","lha"],"application/x-makeself":["run"],"application/x-mie":["mie"],"application/x-mobipocket-ebook":["*prc","mobi"],"application/x-ms-application":["application"],"application/x-ms-shortcut":["lnk"],"application/x-ms-wmd":["wmd"],"application/x-ms-wmz":["wmz"],"application/x-ms-xbap":["xbap"],"application/x-msaccess":["mdb"],"application/x-msbinder":["obd"],"application/x-mscardfile":["crd"],"application/x-msclip":["clp"],"application/x-msdos-program":["*exe"],"application/x-msdownload":["*exe","*dll","com","bat","*msi"],"application/x-msmediaview":["mvb","m13","m14"],"application/x-msmetafile":["*wmf","*wmz","*emf","emz"],"application/x-msmoney":["mny"],"application/x-mspublisher":["pub"],"application/x-msschedule":["scd"],"application/x-msterminal":["trm"],"application/x-mswrite":["wri"],"application/x-netcdf":["nc","cdf"],"application/x-ns-proxy-autoconfig":["pac"],"application/x-nzb":["nzb"],"application/x-perl":["pl","pm"],"application/x-pilot":["*prc","*pdb"],"application/x-pkcs12":["p12","pfx"],"application/x-pkcs7-certificates":["p7b","spc"],"application/x-pkcs7-certreqresp":["p7r"],"application/x-rar-compressed":["*rar"],"application/x-redhat-package-manager":["rpm"],"application/x-research-info-systems":["ris"],"application/x-sea":["sea"],"application/x-sh":["sh"],"application/x-shar":["shar"],"application/x-shockwave-flash":["swf"],"application/x-silverlight-app":["xap"],"application/x-sql":["*sql"],"application/x-stuffit":["sit"],"application/x-stuffitx":["sitx"],"application/x-subrip":["srt"],"application/x-sv4cpio":["sv4cpio"],"application/x-sv4crc":["sv4crc"],"application/x-t3vm-image":["t3"],"application/x-tads":["gam"],"application/x-tar":["tar"],"application/x-tcl":["tcl","tk"],"application/x-tex":["tex"],"application/x-tex-tfm":["tfm"],"application/x-texinfo":["texinfo","texi"],"application/x-tgif":["*obj"],"application/x-ustar":["ustar"],"application/x-virtualbox-hdd":["hdd"],"application/x-virtualbox-ova":["ova"],"application/x-virtualbox-ovf":["ovf"],"application/x-virtualbox-vbox":["vbox"],"application/x-virtualbox-vbox-extpack":["vbox-extpack"],"application/x-virtualbox-vdi":["vdi"],"application/x-virtualbox-vhd":["vhd"],"application/x-virtualbox-vmdk":["vmdk"],"application/x-wais-source":["src"],"application/x-web-app-manifest+json":["webapp"],"application/x-x509-ca-cert":["der","crt","pem"],"application/x-xfig":["fig"],"application/x-xliff+xml":["*xlf"],"application/x-xpinstall":["xpi"],"application/x-xz":["xz"],"application/x-zmachine":["z1","z2","z3","z4","z5","z6","z7","z8"],"audio/vnd.dece.audio":["uva","uvva"],"audio/vnd.digital-winds":["eol"],"audio/vnd.dra":["dra"],"audio/vnd.dts":["dts"],"audio/vnd.dts.hd":["dtshd"],"audio/vnd.lucent.voice":["lvp"],"audio/vnd.ms-playready.media.pya":["pya"],"audio/vnd.nuera.ecelp4800":["ecelp4800"],"audio/vnd.nuera.ecelp7470":["ecelp7470"],"audio/vnd.nuera.ecelp9600":["ecelp9600"],"audio/vnd.rip":["rip"],"audio/x-aac":["*aac"],"audio/x-aiff":["aif","aiff","aifc"],"audio/x-caf":["caf"],"audio/x-flac":["flac"],"audio/x-m4a":["*m4a"],"audio/x-matroska":["mka"],"audio/x-mpegurl":["m3u"],"audio/x-ms-wax":["wax"],"audio/x-ms-wma":["wma"],"audio/x-pn-realaudio":["ram","ra"],"audio/x-pn-realaudio-plugin":["rmp"],"audio/x-realaudio":["*ra"],"audio/x-wav":["*wav"],"chemical/x-cdx":["cdx"],"chemical/x-cif":["cif"],"chemical/x-cmdf":["cmdf"],"chemical/x-cml":["cml"],"chemical/x-csml":["csml"],"chemical/x-xyz":["xyz"],"image/prs.btif":["btif","btf"],"image/prs.pti":["pti"],"image/vnd.adobe.photoshop":["psd"],"image/vnd.airzip.accelerator.azv":["azv"],"image/vnd.dece.graphic":["uvi","uvvi","uvg","uvvg"],"image/vnd.djvu":["djvu","djv"],"image/vnd.dvb.subtitle":["*sub"],"image/vnd.dwg":["dwg"],"image/vnd.dxf":["dxf"],"image/vnd.fastbidsheet":["fbs"],"image/vnd.fpx":["fpx"],"image/vnd.fst":["fst"],"image/vnd.fujixerox.edmics-mmr":["mmr"],"image/vnd.fujixerox.edmics-rlc":["rlc"],"image/vnd.microsoft.icon":["ico"],"image/vnd.ms-dds":["dds"],"image/vnd.ms-modi":["mdi"],"image/vnd.ms-photo":["wdp"],"image/vnd.net-fpx":["npx"],"image/vnd.pco.b16":["b16"],"image/vnd.tencent.tap":["tap"],"image/vnd.valve.source.texture":["vtf"],"image/vnd.wap.wbmp":["wbmp"],"image/vnd.xiff":["xif"],"image/vnd.zbrush.pcx":["pcx"],"image/x-3ds":["3ds"],"image/x-cmu-raster":["ras"],"image/x-cmx":["cmx"],"image/x-freehand":["fh","fhc","fh4","fh5","fh7"],"image/x-icon":["*ico"],"image/x-jng":["jng"],"image/x-mrsid-image":["sid"],"image/x-ms-bmp":["*bmp"],"image/x-pcx":["*pcx"],"image/x-pict":["pic","pct"],"image/x-portable-anymap":["pnm"],"image/x-portable-bitmap":["pbm"],"image/x-portable-graymap":["pgm"],"image/x-portable-pixmap":["ppm"],"image/x-rgb":["rgb"],"image/x-tga":["tga"],"image/x-xbitmap":["xbm"],"image/x-xpixmap":["xpm"],"image/x-xwindowdump":["xwd"],"message/vnd.wfa.wsc":["wsc"],"model/vnd.cld":["cld"],"model/vnd.collada+xml":["dae"],"model/vnd.dwf":["dwf"],"model/vnd.gdl":["gdl"],"model/vnd.gtw":["gtw"],"model/vnd.mts":["mts"],"model/vnd.opengex":["ogex"],"model/vnd.parasolid.transmit.binary":["x_b"],"model/vnd.parasolid.transmit.text":["x_t"],"model/vnd.pytha.pyox":["pyo","pyox"],"model/vnd.sap.vds":["vds"],"model/vnd.usda":["usda"],"model/vnd.usdz+zip":["usdz"],"model/vnd.valve.source.compiled-map":["bsp"],"model/vnd.vtu":["vtu"],"text/prs.lines.tag":["dsc"],"text/vnd.curl":["curl"],"text/vnd.curl.dcurl":["dcurl"],"text/vnd.curl.mcurl":["mcurl"],"text/vnd.curl.scurl":["scurl"],"text/vnd.dvb.subtitle":["sub"],"text/vnd.familysearch.gedcom":["ged"],"text/vnd.fly":["fly"],"text/vnd.fmi.flexstor":["flx"],"text/vnd.graphviz":["gv"],"text/vnd.in3d.3dml":["3dml"],"text/vnd.in3d.spot":["spot"],"text/vnd.sun.j2me.app-descriptor":["jad"],"text/vnd.wap.wml":["wml"],"text/vnd.wap.wmlscript":["wmls"],"text/x-asm":["s","asm"],"text/x-c":["c","cc","cxx","cpp","h","hh","dic"],"text/x-component":["htc"],"text/x-fortran":["f","for","f77","f90"],"text/x-handlebars-template":["hbs"],"text/x-java-source":["java"],"text/x-lua":["lua"],"text/x-markdown":["mkd"],"text/x-nfo":["nfo"],"text/x-opml":["opml"],"text/x-org":["*org"],"text/x-pascal":["p","pas"],"text/x-processing":["pde"],"text/x-sass":["sass"],"text/x-scss":["scss"],"text/x-setext":["etx"],"text/x-sfv":["sfv"],"text/x-suse-ymp":["ymp"],"text/x-uuencode":["uu"],"text/x-vcalendar":["vcs"],"text/x-vcard":["vcf"],"video/vnd.dece.hd":["uvh","uvvh"],"video/vnd.dece.mobile":["uvm","uvvm"],"video/vnd.dece.pd":["uvp","uvvp"],"video/vnd.dece.sd":["uvs","uvvs"],"video/vnd.dece.video":["uvv","uvvv"],"video/vnd.dvb.file":["dvb"],"video/vnd.fvt":["fvt"],"video/vnd.mpegurl":["mxu","m4u"],"video/vnd.ms-playready.media.pyv":["pyv"],"video/vnd.uvvu.mp4":["uvu","uvvu"],"video/vnd.vivo":["viv"],"video/x-f4v":["f4v"],"video/x-fli":["fli"],"video/x-flv":["flv"],"video/x-m4v":["m4v"],"video/x-matroska":["mkv","mk3d","mks"],"video/x-mng":["mng"],"video/x-ms-asf":["asf","asx"],"video/x-ms-vob":["vob"],"video/x-ms-wm":["wm"],"video/x-ms-wmv":["wmv"],"video/x-ms-wmx":["wmx"],"video/x-ms-wvx":["wvx"],"video/x-msvideo":["avi"],"video/x-sgi-movie":["movie"],"video/x-smv":["smv"],"x-conference/x-cooltalk":["ice"]};Object.freeze(dS);var pS=dS;var uS={"application/andrew-inset":["ez"],"application/appinstaller":["appinstaller"],"application/applixware":["aw"],"application/appx":["appx"],"application/appxbundle":["appxbundle"],"application/atom+xml":["atom"],"application/atomcat+xml":["atomcat"],"application/atomdeleted+xml":["atomdeleted"],"application/atomsvc+xml":["atomsvc"],"application/atsc-dwd+xml":["dwd"],"application/atsc-held+xml":["held"],"application/atsc-rsat+xml":["rsat"],"application/automationml-aml+xml":["aml"],"application/automationml-amlx+zip":["amlx"],"application/bdoc":["bdoc"],"application/calendar+xml":["xcs"],"application/ccxml+xml":["ccxml"],"application/cdfx+xml":["cdfx"],"application/cdmi-capability":["cdmia"],"application/cdmi-container":["cdmic"],"application/cdmi-domain":["cdmid"],"application/cdmi-object":["cdmio"],"application/cdmi-queue":["cdmiq"],"application/cpl+xml":["cpl"],"application/cu-seeme":["cu"],"application/cwl":["cwl"],"application/dash+xml":["mpd"],"application/dash-patch+xml":["mpp"],"application/davmount+xml":["davmount"],"application/docbook+xml":["dbk"],"application/dssc+der":["dssc"],"application/dssc+xml":["xdssc"],"application/ecmascript":["ecma"],"application/emma+xml":["emma"],"application/emotionml+xml":["emotionml"],"application/epub+zip":["epub"],"application/exi":["exi"],"application/express":["exp"],"application/fdf":["fdf"],"application/fdt+xml":["fdt"],"application/font-tdpfr":["pfr"],"application/geo+json":["geojson"],"application/gml+xml":["gml"],"application/gpx+xml":["gpx"],"application/gxf":["gxf"],"application/gzip":["gz"],"application/hjson":["hjson"],"application/hyperstudio":["stk"],"application/inkml+xml":["ink","inkml"],"application/ipfix":["ipfix"],"application/its+xml":["its"],"application/java-archive":["jar","war","ear"],"application/java-serialized-object":["ser"],"application/java-vm":["class"],"application/javascript":["*js"],"application/json":["json","map"],"application/json5":["json5"],"application/jsonml+json":["jsonml"],"application/ld+json":["jsonld"],"application/lgr+xml":["lgr"],"application/lost+xml":["lostxml"],"application/mac-binhex40":["hqx"],"application/mac-compactpro":["cpt"],"application/mads+xml":["mads"],"application/manifest+json":["webmanifest"],"application/marc":["mrc"],"application/marcxml+xml":["mrcx"],"application/mathematica":["ma","nb","mb"],"application/mathml+xml":["mathml"],"application/mbox":["mbox"],"application/media-policy-dataset+xml":["mpf"],"application/mediaservercontrol+xml":["mscml"],"application/metalink+xml":["metalink"],"application/metalink4+xml":["meta4"],"application/mets+xml":["mets"],"application/mmt-aei+xml":["maei"],"application/mmt-usd+xml":["musd"],"application/mods+xml":["mods"],"application/mp21":["m21","mp21"],"application/mp4":["*mp4","*mpg4","mp4s","m4p"],"application/msix":["msix"],"application/msixbundle":["msixbundle"],"application/msword":["doc","dot"],"application/mxf":["mxf"],"application/n-quads":["nq"],"application/n-triples":["nt"],"application/node":["cjs"],"application/octet-stream":["bin","dms","lrf","mar","so","dist","distz","pkg","bpk","dump","elc","deploy","exe","dll","deb","dmg","iso","img","msi","msp","msm","buffer"],"application/oda":["oda"],"application/oebps-package+xml":["opf"],"application/ogg":["ogx"],"application/omdoc+xml":["omdoc"],"application/onenote":["onetoc","onetoc2","onetmp","onepkg"],"application/oxps":["oxps"],"application/p2p-overlay+xml":["relo"],"application/patch-ops-error+xml":["xer"],"application/pdf":["pdf"],"application/pgp-encrypted":["pgp"],"application/pgp-keys":["asc"],"application/pgp-signature":["sig","*asc"],"application/pics-rules":["prf"],"application/pkcs10":["p10"],"application/pkcs7-mime":["p7m","p7c"],"application/pkcs7-signature":["p7s"],"application/pkcs8":["p8"],"application/pkix-attr-cert":["ac"],"application/pkix-cert":["cer"],"application/pkix-crl":["crl"],"application/pkix-pkipath":["pkipath"],"application/pkixcmp":["pki"],"application/pls+xml":["pls"],"application/postscript":["ai","eps","ps"],"application/provenance+xml":["provx"],"application/pskc+xml":["pskcxml"],"application/raml+yaml":["raml"],"application/rdf+xml":["rdf","owl"],"application/reginfo+xml":["rif"],"application/relax-ng-compact-syntax":["rnc"],"application/resource-lists+xml":["rl"],"application/resource-lists-diff+xml":["rld"],"application/rls-services+xml":["rs"],"application/route-apd+xml":["rapd"],"application/route-s-tsid+xml":["sls"],"application/route-usd+xml":["rusd"],"application/rpki-ghostbusters":["gbr"],"application/rpki-manifest":["mft"],"application/rpki-roa":["roa"],"application/rsd+xml":["rsd"],"application/rss+xml":["rss"],"application/rtf":["rtf"],"application/sbml+xml":["sbml"],"application/scvp-cv-request":["scq"],"application/scvp-cv-response":["scs"],"application/scvp-vp-request":["spq"],"application/scvp-vp-response":["spp"],"application/sdp":["sdp"],"application/senml+xml":["senmlx"],"application/sensml+xml":["sensmlx"],"application/set-payment-initiation":["setpay"],"application/set-registration-initiation":["setreg"],"application/shf+xml":["shf"],"application/sieve":["siv","sieve"],"application/smil+xml":["smi","smil"],"application/sparql-query":["rq"],"application/sparql-results+xml":["srx"],"application/sql":["sql"],"application/srgs":["gram"],"application/srgs+xml":["grxml"],"application/sru+xml":["sru"],"application/ssdl+xml":["ssdl"],"application/ssml+xml":["ssml"],"application/swid+xml":["swidtag"],"application/tei+xml":["tei","teicorpus"],"application/thraud+xml":["tfi"],"application/timestamped-data":["tsd"],"application/toml":["toml"],"application/trig":["trig"],"application/ttml+xml":["ttml"],"application/ubjson":["ubj"],"application/urc-ressheet+xml":["rsheet"],"application/urc-targetdesc+xml":["td"],"application/voicexml+xml":["vxml"],"application/wasm":["wasm"],"application/watcherinfo+xml":["wif"],"application/widget":["wgt"],"application/winhlp":["hlp"],"application/wsdl+xml":["wsdl"],"application/wspolicy+xml":["wspolicy"],"application/xaml+xml":["xaml"],"application/xcap-att+xml":["xav"],"application/xcap-caps+xml":["xca"],"application/xcap-diff+xml":["xdf"],"application/xcap-el+xml":["xel"],"application/xcap-ns+xml":["xns"],"application/xenc+xml":["xenc"],"application/xfdf":["xfdf"],"application/xhtml+xml":["xhtml","xht"],"application/xliff+xml":["xlf"],"application/xml":["xml","xsl","xsd","rng"],"application/xml-dtd":["dtd"],"application/xop+xml":["xop"],"application/xproc+xml":["xpl"],"application/xslt+xml":["*xsl","xslt"],"application/xspf+xml":["xspf"],"application/xv+xml":["mxml","xhvml","xvml","xvm"],"application/yang":["yang"],"application/yin+xml":["yin"],"application/zip":["zip"],"audio/3gpp":["*3gpp"],"audio/aac":["adts","aac"],"audio/adpcm":["adp"],"audio/amr":["amr"],"audio/basic":["au","snd"],"audio/midi":["mid","midi","kar","rmi"],"audio/mobile-xmf":["mxmf"],"audio/mp3":["*mp3"],"audio/mp4":["m4a","mp4a"],"audio/mpeg":["mpga","mp2","mp2a","mp3","m2a","m3a"],"audio/ogg":["oga","ogg","spx","opus"],"audio/s3m":["s3m"],"audio/silk":["sil"],"audio/wav":["wav"],"audio/wave":["*wav"],"audio/webm":["weba"],"audio/xm":["xm"],"font/collection":["ttc"],"font/otf":["otf"],"font/ttf":["ttf"],"font/woff":["woff"],"font/woff2":["woff2"],"image/aces":["exr"],"image/apng":["apng"],"image/avci":["avci"],"image/avcs":["avcs"],"image/avif":["avif"],"image/bmp":["bmp","dib"],"image/cgm":["cgm"],"image/dicom-rle":["drle"],"image/dpx":["dpx"],"image/emf":["emf"],"image/fits":["fits"],"image/g3fax":["g3"],"image/gif":["gif"],"image/heic":["heic"],"image/heic-sequence":["heics"],"image/heif":["heif"],"image/heif-sequence":["heifs"],"image/hej2k":["hej2"],"image/hsj2":["hsj2"],"image/ief":["ief"],"image/jls":["jls"],"image/jp2":["jp2","jpg2"],"image/jpeg":["jpeg","jpg","jpe"],"image/jph":["jph"],"image/jphc":["jhc"],"image/jpm":["jpm","jpgm"],"image/jpx":["jpx","jpf"],"image/jxr":["jxr"],"image/jxra":["jxra"],"image/jxrs":["jxrs"],"image/jxs":["jxs"],"image/jxsc":["jxsc"],"image/jxsi":["jxsi"],"image/jxss":["jxss"],"image/ktx":["ktx"],"image/ktx2":["ktx2"],"image/png":["png"],"image/sgi":["sgi"],"image/svg+xml":["svg","svgz"],"image/t38":["t38"],"image/tiff":["tif","tiff"],"image/tiff-fx":["tfx"],"image/webp":["webp"],"image/wmf":["wmf"],"message/disposition-notification":["disposition-notification"],"message/global":["u8msg"],"message/global-delivery-status":["u8dsn"],"message/global-disposition-notification":["u8mdn"],"message/global-headers":["u8hdr"],"message/rfc822":["eml","mime"],"model/3mf":["3mf"],"model/gltf+json":["gltf"],"model/gltf-binary":["glb"],"model/iges":["igs","iges"],"model/jt":["jt"],"model/mesh":["msh","mesh","silo"],"model/mtl":["mtl"],"model/obj":["obj"],"model/prc":["prc"],"model/step+xml":["stpx"],"model/step+zip":["stpz"],"model/step-xml+zip":["stpxz"],"model/stl":["stl"],"model/u3d":["u3d"],"model/vrml":["wrl","vrml"],"model/x3d+binary":["*x3db","x3dbz"],"model/x3d+fastinfoset":["x3db"],"model/x3d+vrml":["*x3dv","x3dvz"],"model/x3d+xml":["x3d","x3dz"],"model/x3d-vrml":["x3dv"],"text/cache-manifest":["appcache","manifest"],"text/calendar":["ics","ifb"],"text/coffeescript":["coffee","litcoffee"],"text/css":["css"],"text/csv":["csv"],"text/html":["html","htm","shtml"],"text/jade":["jade"],"text/javascript":["js","mjs"],"text/jsx":["jsx"],"text/less":["less"],"text/markdown":["md","markdown"],"text/mathml":["mml"],"text/mdx":["mdx"],"text/n3":["n3"],"text/plain":["txt","text","conf","def","list","log","in","ini"],"text/richtext":["rtx"],"text/rtf":["*rtf"],"text/sgml":["sgml","sgm"],"text/shex":["shex"],"text/slim":["slim","slm"],"text/spdx":["spdx"],"text/stylus":["stylus","styl"],"text/tab-separated-values":["tsv"],"text/troff":["t","tr","roff","man","me","ms"],"text/turtle":["ttl"],"text/uri-list":["uri","uris","urls"],"text/vcard":["vcard"],"text/vtt":["vtt"],"text/wgsl":["wgsl"],"text/xml":["*xml"],"text/yaml":["yaml","yml"],"video/3gpp":["3gp","3gpp"],"video/3gpp2":["3g2"],"video/h261":["h261"],"video/h263":["h263"],"video/h264":["h264"],"video/iso.segment":["m4s"],"video/jpeg":["jpgv"],"video/jpm":["*jpm","*jpgm"],"video/mj2":["mj2","mjp2"],"video/mp2t":["ts"],"video/mp4":["mp4","mp4v","mpg4"],"video/mpeg":["mpeg","mpg","mpe","m1v","m2v"],"video/ogg":["ogv"],"video/quicktime":["qt","mov"],"video/webm":["webm"]};Object.freeze(uS);var mS=uS;var Xt=function(n,e,t,r){if(t==="a"&&!r)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?n!==e||!r:!e.has(n))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?r:t==="a"?r.call(n):r?r.value:e.get(n)},_o,Yi,zr,vd=class{constructor(...e){_o.set(this,new Map),Yi.set(this,new Map),zr.set(this,new Map);for(let t of e)this.define(t)}define(e,t=!1){for(let[r,o]of Object.entries(e)){r=r.toLowerCase(),o=o.map(a=>a.toLowerCase()),Xt(this,zr,"f").has(r)||Xt(this,zr,"f").set(r,new Set);let i=Xt(this,zr,"f").get(r),s=!0;for(let a of o){let l=a.startsWith("*");if(a=l?a.slice(1):a,i?.add(a),s&&Xt(this,Yi,"f").set(r,a),s=!1,l)continue;let c=Xt(this,_o,"f").get(a);if(c&&c!=r&&!t)throw new Error(`"${r} -> ${a}" conflicts with "${c} -> ${a}". Pass \`force=true\` to override this definition.`);Xt(this,_o,"f").set(a,r)}}return this}getType(e){if(typeof e!="string")return null;let t=e.replace(/^.*[/\\]/,"").toLowerCase(),r=t.replace(/^.*\./,"").toLowerCase(),o=t.length<e.length;return!(r.length<t.length-1)&&o?null:Xt(this,_o,"f").get(r)??null}getExtension(e){return typeof e!="string"?null:(e=e?.split?.(";")[0],(e&&Xt(this,Yi,"f").get(e.trim().toLowerCase()))??null)}getAllExtensions(e){return typeof e!="string"?null:Xt(this,zr,"f").get(e.toLowerCase())??null}_freeze(){this.define=()=>{throw new Error("define() not allowed for built-in Mime objects. See https://github.com/broofa/mime/blob/main/README.md#custom-mime-instances")},Object.freeze(this);for(let e of Xt(this,zr,"f").values())Object.freeze(e);return this}_getTestState(){return{types:Xt(this,_o,"f"),extensions:Xt(this,Yi,"f")}}};_o=new WeakMap,Yi=new WeakMap,zr=new WeakMap;var xd=vd;var hS=new xd(mS,pS)._freeze();import{homedir as ky,hostname as LP,platform as OP}from"os";import{basename as kP,extname as NP,join as Zi,resolve as _P}from"path";import{chromium as Ny,devices as MP}from"playwright";import{addExtra as FP}from"playwright-extra";import DP from"puppeteer-extra-plugin-recaptcha";import{v4 as UP}from"uuid";import{rmSync as ZS}from"fs";import{basename as GI,join as VI}from"path";import{errors as qI}from"playwright-core";var Dn={bannedClassSubstrings:["relative","flex","center","justify","auto","sticky","absolute","top","right","left","bottom","items-center","notion-selectable","notion-page-block","notion-collection-item","MuiSvgIcon","css-","rt-"],nonDynamicInputTypes:["button","file","hidden","image","radio","reset","submit"],generalStateAttributes:["aria-expanded","aria-haspopup","aria-checked","aria-pressed","aria-selected","aria-invalid","checked","open","aria-busy"],bannedElementTagNames:["html","head","meta","script","style","path","br","::marker","noscript","polygon","defs"],bannedElementAttributes:["data-momentic-id","aria-keyshortcuts","data-ved","aria-controls","d"],relevantElementAttributes:["name","id","value","type","class","height","width","target","title","href","src","alt","role","headers","scope","checked","required","action","tooltip","min","max","minlength","maxlength","multiple","pattern","placeholder","accept","contenteditable","data-value","data-testid","data-cy","data-pw","data-test-id","data-test","data-role","data-type","data-key","data-action","data-aria-hidden","data-hidden","data-content-editable-leaf","data-automation-id","data-wf-icon","data-handleid","data-handlepos","data-col-index","data-row-index","data-row","data-col","col-index","row-index","row","col","data-momentic-description","aria-label","aria-role","aria-selected","aria-disabled","aria-hidden","aria-describedby","aria-valuenow","aria-valuemin","aria-valuemax"],alwaysUsefulAttributesForCssSelectorGeneration:["src","href","aria-describedby","aria-labelledby","aria-label"],alwaysInterestingClassNames:["cm-line","cm-activeLine","cm-content"],alwaysInterestingClassPrefixes:["notion-",".w-"],alwaysInterestingTruthyPropertyNames:["contenteditable"],visualAttributesForSvgSerialization:["fill","stroke","color","patternContentUnits","xlink:href","transform","path","d","points","viewBox","preserveAspectRatio","r","rx","ry","cx","cy","x1","y1","x2","y2","font","text-anchor","dominant-baseline","gradient","pattern","stop-color"]};var GA=new Set(["b","c","d","f","g","h","j","k","l","m","n","p","q","r","s","t","v","w","x","y","z"]),VA=new Set(["a","e","i","o","u","y"]);function gS(n){if(n.length>75)return!1;if(n[0]?.match(/[0-9a-zA-Z]/)===null)return!0;if(n.length>10){let u=Math.floor(n.length/8);if((n.match(/[-_:A-Z/ ]/g)??[]).length<u)return!0}if((n.match(/[^0-9a-zA-Z-_.]/g)??[]).length/n.length>.2)return!0;let t=(n.match(/[0-9]/g)??[]).length;if(t/n.length>.3)return!0;let r=(n.toLowerCase().match(/[aeiou]/gi)??[]).length;if((n.toLowerCase().match(/[bcdfghjklmnpqrstvwxyz]/gi)??[]).length/r>5)return!0;let i=0,s=0;for(let u of n.toLowerCase())GA.has(u)?(s++,s>i&&(i=s)):s=0;if(i>4)return!0;let a=0,l=0;for(let u of n.toLowerCase())u>="a"&&u<="z"&&!VA.has(u)?(l++,l>a&&(a=l)):l=0;if(a>4)return!0;let c=(n.match(/[A-Z]/g)??[]).length,p=(n.match(/[a-z]/g)??[]).length,d=Math.ceil(n.length*.3);return!!(p&&t&&Math.abs(p-t)<d||p&&c&&Math.abs(p-c)<d)}import{randomUUID as nI}from"crypto";import{cloneDeep as Ad}from"lodash-es";import{randomUUID as ZA}from"crypto";var fS=new Set(["about:blank","chrome-error://chromewebdata/"]);var wt="data-momentic-id";var Td=["button","image","generic","graphics-symbol","tab","link","menuitem","group"],Ed=1e4,Ji=500;function ir(n,e){let t=n.findIndex(r=>r===e);if(!(t===-1||!n[t+1]))return n[t+1]}import{createHash as qA}from"crypto";var KA="v1";function ja(n,e){if(n.tagName.toLowerCase()==="svg"&&!JA(n))try{let t=SS(n,e),r=YA(JSON.stringify(t));return{version:KA,json:t,hash:r}}catch{return}}function YA(n){return qA("md5").update(n).digest("hex")}function SS(n,e){let t=n.tagName.toLowerCase(),r=XA(n);if(t==="image"&&r["xlink:href"])throw new Error("Image tags within SVGs are not supported");let o={type:t,props:r,children:[]};for(let i of n.childrenBackendIds){let s=e.backendIdToNode[i];if(s&&s.nodeType===1){let a=SS(s,e);a&&o.children.push(a)}}return o}function JA(n){let e=n.computedStyles.display,t=n.computedStyles.visibility,r=n.computedStyles.opacity;return e==="none"||t==="hidden"||r==="0"}function XA(n){let e={},t=n.attributes;for(let r of Object.keys(t))Dn.visualAttributesForSvgSerialization.includes(r)&&(e[r]=t[r]);return t.id&&n.tagName.toLowerCase()!=="svg"&&(e.id=t.id),e}var jr={r:147,g:196,b:125,a:.55},wS={showRulers:!1,showStyles:!1,showExtensionLines:!1,contrastAlgorithm:"aa",contentColor:jr,paddingColor:jr,borderColor:jr,marginColor:jr,eventTargetColor:jr,shapeColor:jr,shapeMarginColor:jr,showInfo:!0,showAccessibilityInfo:!0},Ha=["display","opacity","visibility","height","position"];function vS({snapshot:n,devicePixelRatio:e,logger:t}){let r=n.strings,o=n.documents,i={},s={},a={roots:[],backendIdToNode:i,frameIndexToIframeNode:s};return o.forEach((l,c)=>{let p=QA({allDocuments:o,stringConstants:r,frameIndex:c,devicePixelRatio:e,backendIdToNode:i,frameIndexToIframeNode:s,logger:t});a.roots.push(p)}),a}function QA({allDocuments:n,stringConstants:e,devicePixelRatio:t,frameIndex:r,frameIndexToIframeNode:o,backendIdToNode:i,logger:s}){let a=n[r],l=a.layout,c={};l.nodeIndex.forEach((C,I)=>{c[C]=I});let p=l.styles,d=l.bounds??[],u=a.nodes,m=u.contentDocumentIndex??{index:[],value:[]},h=u.backendNodeId??[],g=u.attributes??[],f=u.parentIndex??[],S=u.nodeName??[],x=u.nodeType??[],b=u.pseudoType??{index:[],value:[]},w=u.inputChecked??{index:[]},E=e[a.frameId];for(let C=0;C<h.length;C++){let I=h[C],N=x[C],P=g[C]??[],D=f[C]!==void 0&&f[C]>=0?f[C]:void 0,W=D!==void 0?h[D]:void 0,_=W!==void 0?i[W]:void 0,B=b.index.indexOf(C),L=B!==-1?e[b.value[B]]:void 0,j=c[C],O;j?O=d[j]??[]:O=[];let ee=S[C]!==void 0?e[S[C]]?.toLowerCase():void 0;if(!ee){s.warn({backendNodeId:I,frameId:E,frameIndex:r,nodeBounds:O},"DOM node has no tag name");continue}let me={backendNodeId:I,psuedoType:L,nodeType:N,frameIndex:r,parentFrameId:E,ownedFrameId:void 0,bounds:{x:O[0]??null,y:O[1]??null,width:O[2]??null,height:O[3]??null},computedStyles:{},attributes:{},parentBackendNodeId:W??null,tagName:ee,parent:_??void 0,childrenBackendIds:[],momenticIgnored:void 0,mPathSelector:void 0};_&&_.childrenBackendIds.push(I);let nt=m.index.indexOf(C);if(nt!==-1){let Se=m.value[nt];o[Se]=me;let De=n[Se]?.frameId;me.ownedFrameId=De!==void 0?e[De]:void 0}for(let Se of Object.keys(me.bounds)){let De=Se;me.bounds[De]!==null&&(me.bounds[De]/=t)}let ue=j!==void 0?p[j]??[]:[];for(let Se=0;Se<ue.length&&!(Se>=Ha.length);Se++){let De=ue[Se];if(De===void 0||isNaN(De))continue;let rt=e[De];if(rt===void 0)continue;let ft=Ha[Se];me.computedStyles[ft]=rt}for(let Se=0;Se<P.length;Se+=2){let De=P[Se],rt=P[Se+1];if(!De||!rt)continue;let ft=e[De],Pn=e[rt];!ft||!Pn||(me.attributes[ft]=Pn)}w.index.includes(C)&&(me.attributes.checked="true"),i[me.backendNodeId]=me}return i[h[0]]}function Rd(n,e){if(n.mPathSelector)return n.mPathSelector;let t=n.parent,r;if(!t)r=n.tagName;else if(n.tagName==="body")r="body";else{let i=t.childrenBackendIds.filter(l=>e.backendIdToNode[l]?.nodeType===1&&!e.backendIdToNode[l]?.psuedoType).indexOf(n.backendNodeId),s=` > ${n.tagName}:nth-child(${i+1})`;r=`${Rd(t,e)}${s}`}return n.mPathSelector=r,r}function yS({originalNode:n,candidate:e,logKey:t,logger:r}){if(!e.bounds)return r.debug({candidate:e},"Filtering out click candidate since it has no bounding box"),!1;let o=n.bounds,i=o.x??0,s=o.width??0,a=o.height??0,l=i+s,c=o.y??0,p=c+(o.height??0),d=e.bounds,u=d.width??0,m=d.height??0,h=d.x??0,g=h+(d.width??0),f=d.y??0,S=f+(d.height??0);return h<l&&g>i&&f<p&&S>c?Math.abs(s-u)<200||Math.abs(a-m)<200?!0:(Nr({logger:r,logKey:t,maxCount:5,intervalMs:3e3},{candidate:e,originalNode:n},"Filtering out click candidate since it has a significantly different area"),!1):(Nr({logger:r,logKey:t,maxCount:5,intervalMs:3e3},{candidate:e},"Filtering out click candidate since it does not intersect with the original node"),!1)}function $a(n,e,t){let r=Object.values(e.backendIdToNode),o,i=ZA();for(let c of r)if(c.attributes?.[wt]===n){o=c;break}if(!o)return[];let s=[],a=e.backendIdToNode[o.parentBackendNodeId??-1];for(;a&&(a?.momenticIgnored||!yS({originalNode:o,candidate:a,logKey:i,logger:t}));)a=e.backendIdToNode[a.parentBackendNodeId??-1];a&&s.push(a);let l=[o];for(;l.length;){let c=l.shift();for(let p of c.childrenBackendIds??[]){let d=e.backendIdToNode[p];d&&!d.momenticIgnored&&yS({originalNode:o,candidate:d,logKey:i,logger:t})?s.push(d):d&&l.push(d)}}return s}function bS(n,e){return n.parentBackendNodeId!==null?e.backendIdToNode[n.parentBackendNodeId]:n.frameIndex===0?void 0:e.frameIndexToIframeNode[n.frameIndex]}var eI=["html","#document","#document-fragment"];function xS({node:n,domGraph:e}){let t=[],r=n,o=bS(n,e);if(!o)return[n.tagName];let i=()=>{if(r=o,o=bS(o,e),!o&&r.frameIndex!==0)throw new Error("No parent node but not in main frame")},s=0;for(;o&&s<1e6;){if(s++,eI.includes(r.tagName)){i();continue}if(r.tagName==="body")t.push("body");else{let l=!1,c=1;for(let p=0;p<o.childrenBackendIds.length;p++){let d=o.childrenBackendIds[p],u=e.backendIdToNode[d];if(d===r.backendNodeId){t.push(`${r.tagName}:nth-child(${c})`),l=!0;break}else u?.nodeType===1&&!u.psuedoType&&c++}if(!l)throw new Error(`Could not find child (${r.tagName}) in parent's children list (${o.tagName})`)}i()}return t.reverse()}function TS(n,e){let t=n.locator("html"),r=[];for(let o=0;o<e.length;o++){let i=e[o];if(r.push(i),i.startsWith("iframe")){let s=r.join(" > ");r=[],o<e.length-1?t=t.frameLocator(s):t=t.locator(s)}}if(r.length&&(t=t.locator(r.join(" > "))),"owner"in t)throw new Error("Final locator from mpath is a frame locator");return t}async function ES(n,e){await n.send({method:"DOM.getDocument",params:{depth:0},timeout:2e3});let t=await n.send({method:"DOM.requestNode",params:{objectId:e},timeout:2e3}),o=(await n.send({method:"DOM.getAttributes",params:{nodeId:t.nodeId},timeout:2e3})).attributes,i=ir(o,wt);if(!i)throw new Error(`Could not find attribute ${wt} for object ${e}`);return i}function CS(n){let e=[];for(let t=0;t<n.domGraph.roots.length;t++){let r=n.domGraph.roots[t],o=tI({root:r,domGraph:n.domGraph,existingHashes:n.existingHashes,flagStore:n.flagStore,logger:n.logger});e=e.concat(o)}return e}function tI(n){let{root:e,domGraph:t,existingHashes:r}=n,o=[],i=[e];for(;i.length;){let s=i.pop();if(s.nodeType===1&&s.tagName.toLowerCase()==="svg"){let a=ja(s,t);a&&!r[a.hash]&&o.push(a)}for(let a of s.childrenBackendIds){let l=t.backendIdToNode[a];l&&i.push(l)}}return o}var rI=["focusable","keyshortcuts","controls","live","relevant","orientation"],oI=["selected","readonly","modal","required","invalid"],iI=["id","name","role","content"],RS=["absolute","fixed","sticky"],sI=["path"],aI=["statictext","textbox","checkbox","combobox","iframe","rootwebarea","table","caption","columnheader","rowheader","gridcell","grid","row","rowgroup","cell","image","graphics-symbol","graphics-document","graphics-object","svgroot","button","link","list","listitem","tablist","tabpanel","tab","searchbox","menu","menubar","form","dialog","alertdialog","banner","navigation","main","menuitem","menuitemcheckbox","menuitemradio","option","radio","progressbar","switch","tree","treeitem","separator"],lI=["activeAriaModalDialog","activeFullscreenElement","activeModalDialog","ariaHiddenElement","ariaHiddenSubtree","hiddenByChildTree","inertElement","inertSubtree","notRendered","notVisible"],cI=["menulistpopup","statictext","inlinetextbox"],dI=80,AS=100,Wa=["StaticText","ListMarker","RootWebArea","LineBreak","emphasis","::before","::after"],pI=["cite"],uI={LabelText:["label"],listitem:["li"],image:["img","svg"],link:["a"],RootWebArea:["#document"],paragraph:["p"],LineBreak:["br"],separator:["hr"],"graphics-symbol":["svg","rect"],gridcell:["td","th"],SvgRoot:["svg"],navigation:["nav"],cell:["td","th"],row:["tr"],list:["ul"],heading:["h1","h2","h3","h4","h5","h6"]},mI={name:!0,value:!0,title:!0,alt:!0,placeholder:!0,checked:!0,selected:!0,contenteditable:!0},IS={indentLevel:0},Id=class n{id;role;name;nameSources;tagName;content;properties;internalProperties;dataMomenticId;pathFromRoot;parent;children;parentFrame;domNode;backendNodeId;ignoredByCDP;constructor(e){if(this.id=e.id,this.role=e.role,this.name=e.name,this.nameSources=e.nameSources,this.content=e.content,this.properties={},this.pathFromRoot=e.pathFromRoot,this.children=e.children,this.backendNodeId=e.backendNodeID,this.ignoredByCDP=e.ignoredByCDP,this.internalProperties=e.internalProperties??{},this.parentFrame=e.parentFrame,e.properties&&e.properties.forEach(t=>{t.name==="keyshortcuts"?this.dataMomenticId=parseInt(t.value.value):this.properties[t.name]=t.value.value}),e.domNode){this.domNode=e.domNode,this.tagName=e.domNode.tagName||void 0;let t=e.domNode.attributes.id;this.name=this.name||e.domNode.attributes.name||(t&&!gS(t)?t:""),this.role=this.role||(e.domNode.attributes.role??""),SI(this.properties,e.domNode)}bI(this)}getSerializedFormWithContext(){return this.serialize({noId:!0,maxLevel:1,neighbors:1})}getNodeOnlySerializedForm(){return this.serialize({noId:!0,noChildren:!0,noContent:!0})}getLogForm(){return JSON.stringify({id:this.id,name:this.name??"",role:this.role??"",backendNodeId:this.backendNodeId})}isInteresting(){if(this.domNode&&this.domNode.tagName==="div"&&!this.domNode.bounds.x&&!this.domNode.bounds.y&&!this.domNode.bounds.width&&!this.domNode.bounds.height||this.domNode&&sI.includes(this.domNode.tagName))return!1;if(aI.includes(this.role.toLowerCase()))return!0;if(this.domNode?.computedStyles.display==="contents")return!1;if(this.role.toLowerCase()==="inlinetextbox"&&this.tagName||!this.properties.hidden&&(this.properties.focusable||this.properties.settable)||Dn.alwaysInterestingTruthyPropertyNames.some(t=>!!this.properties[t]))return!0;let e=this.properties.class;return typeof e=="string"&&e.split(" ").some(t=>kS(t))?!0:this.children.every(t=>t.role==="StaticText")&&this.internalProperties?.inCodeMirrorEditor?!1:this.children.some(t=>t.role==="StaticText")?!0:!!this.name.trim()||!!this.content||Object.keys(this.properties).some(t=>t.startsWith("data"))}serialize(e=IS){let t=Object.assign({},IS,e),{indentLevel:r,noChildren:o,noProperties:i,noId:s,noContent:a,condensedMode:l}=t,c=Ad(this.properties),p=" ".repeat(r),d=this.role||"",u=this.tagName??"unknown",m=this.name;d==="heading"&&m==="heading"&&(m=""),this.nameSources?.find(E=>!E.superseded&&E.type==="contents")&&this.children.length>0&&(m="");let g=this.nameSources?.find(E=>!E.superseded);if(g&&!g.nativeSource&&g.type==="relatedElement"){let E=g.attributeValue?.relatedNodes??[];E.length===1&&E[0].text&&E[0].text===m&&(m="")}let f=Wa.includes(this.role)||pI.includes(this.tagName||"");if(this.role==="StaticText"||this.role==="ListMarker")return`${p}${m}
|
|
3544
|
+
`,cssGeneratorLibJs:'// Taken from https://cdn.jsdelivr.net/npm/css-selector-generator@3.6.8/build/index.min.js\n!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.CssSelectorGenerator=e():t.CssSelectorGenerator=e()}(self,(()=>(()=>{"use strict";var t={d:(e,n)=>{for(var o in n)t.o(n,o)&&!t.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:n[o]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};function n(t){return"object"==typeof t&&null!==t&&t.nodeType===Node.ELEMENT_NODE}t.r(e),t.d(e,{default:()=>K,getCssSelector:()=>J});const o={NONE:"",DESCENDANT:" ",CHILD:" > "},r={id:"id",class:"class",tag:"tag",attribute:"attribute",nthchild:"nthchild",nthoftype:"nthoftype"},i="CssSelectorGenerator";function c(t="unknown problem",...e){console.warn(`${i}: ${t}`,...e)}const u={selectors:[r.id,r.class,r.tag,r.attribute],includeTag:!1,whitelist:[],blacklist:[],combineWithinSelector:!0,combineBetweenSelectors:!0,root:null,maxCombinations:Number.POSITIVE_INFINITY,maxCandidates:Number.POSITIVE_INFINITY};function s(t){return t instanceof RegExp}function a(t){return["string","function"].includes(typeof t)||s(t)}function l(t){return Array.isArray(t)?t.filter(a):[]}function f(t){const e=[Node.DOCUMENT_NODE,Node.DOCUMENT_FRAGMENT_NODE,Node.ELEMENT_NODE];return function(t){return t instanceof Node}(t)&&e.includes(t.nodeType)}function d(t,e){if(f(t))return t.contains(e)||c("element root mismatch","Provided root does not contain the element. This will most likely result in producing a fallback selector using element\'s real root node. If you plan to use the selector using provided root (e.g. `root.querySelector`), it will nto work as intended."),t;const n=e.getRootNode({composed:!1});return f(n)?(n!==document&&c("shadow root inferred","You did not provide a root and the element is a child of Shadow DOM. This will produce a selector using ShadowRoot as a root. If you plan to use the selector using document as a root (e.g. `document.querySelector`), it will not work as intended."),n):e.ownerDocument.querySelector(":root")}function m(t){return"number"==typeof t?t:Number.POSITIVE_INFINITY}function p(t=[]){const[e=[],...n]=t;return 0===n.length?e:n.reduce(((t,e)=>t.filter((t=>e.includes(t)))),e)}function h(t){return[].concat(...t)}function g(t){const e=t.map((t=>{if(s(t))return e=>t.test(e);if("function"==typeof t)return e=>{const n=t(e);return"boolean"!=typeof n?(c("pattern matcher function invalid","Provided pattern matching function does not return boolean. It\'s result will be ignored.",t),!1):n};if("string"==typeof t){const e=new RegExp("^"+t.replace(/[|\\\\{}()[\\]^$+?.]/g,"\\\\$&").replace(/\\*/g,".+")+"$");return t=>e.test(t)}return c("pattern matcher invalid","Pattern matching only accepts strings, regular expressions and/or functions. This item is invalid and will be ignored.",t),()=>!1}));return t=>e.some((e=>e(t)))}function y(t,e,n){const o=Array.from(d(n,t[0]).querySelectorAll(e));return o.length===t.length&&t.every((t=>o.includes(t)))}function b(t,e){e=null!=e?e:function(t){return t.ownerDocument.querySelector(":root")}(t);const o=[];let r=t;for(;n(r)&&r!==e;)o.push(r),r=r.parentElement;return o}function N(t,e){return p(t.map((t=>b(t,e))))}const S=", ",E=new RegExp(["^$","\\\\s"].join("|")),w=new RegExp(["^$"].join("|")),I=[r.nthoftype,r.tag,r.id,r.class,r.attribute,r.nthchild],v=g(["class","id","ng-*"]);function T({name:t}){return`[${t}]`}function C({name:t,value:e}){return`[${t}=\'${e}\']`}function O({nodeName:t,nodeValue:e}){return{name:V(t),value:V(e)}}function x(t){const e=Array.from(t.attributes).filter((e=>function({nodeName:t},e){const n=e.tagName.toLowerCase();return!(["input","option"].includes(n)&&"value"===t||v(t))}(e,t))).map(O);return[...e.map(T),...e.map(C)]}function j(t){return(t.getAttribute("class")||"").trim().split(/\\s+/).filter((t=>!w.test(t))).map((t=>`.${V(t)}`))}function A(t){const e=t.getAttribute("id")||"",n=`#${V(e)}`,o=t.getRootNode({composed:!1});return!E.test(e)&&y([t],n,o)?[n]:[]}function $(t){const e=t.parentNode;if(e){const o=Array.from(e.childNodes).filter(n).indexOf(t);if(o>-1)return[`:nth-child(${o+1})`]}return[]}function D(t){return[V(t.tagName.toLowerCase())]}function R(t){const e=[...new Set(h(t.map(D)))];return 0===e.length||e.length>1?[]:[e[0]]}function P(t){const e=R([t])[0],n=t.parentElement;if(n){const o=Array.from(n.children).filter((t=>t.tagName.toLowerCase()===e)),r=o.indexOf(t);if(r>-1)return[`${e}:nth-of-type(${r+1})`]}return[]}function _(t=[],{maxResults:e=Number.POSITIVE_INFINITY}={}){return Array.from(function*(t=[],{maxResults:e=Number.POSITIVE_INFINITY}={}){let n=0,o=L(1);for(;o.length<=t.length&&n<e;){n+=1;const e=o.map((e=>t[e]));yield e,o=k(o,t.length-1)}}(t,{maxResults:e}))}function k(t=[],e=0){const n=t.length;if(0===n)return[];const o=[...t];o[n-1]+=1;for(let t=n-1;t>=0;t--)if(o[t]>e){if(0===t)return L(n+1);o[t-1]++,o[t]=o[t-1]+1}return o[n-1]>e?L(n+1):o}function L(t=1){return Array.from(Array(t).keys())}const M=":".charCodeAt(0).toString(16).toUpperCase(),F=/[ !"#$%&\'()\\[\\]{|}<>*+,./;=?@^`~\\\\]/;function V(t=""){var e,n;return null!==(n=null===(e=null===CSS||void 0===CSS?void 0:CSS.escape)||void 0===e?void 0:e.call(CSS,t))&&void 0!==n?n:function(t=""){return t.split("").map((t=>":"===t?`\\\\${M} `:F.test(t)?`\\\\${t}`:escape(t).replace(/%/g,"\\\\"))).join("")}(t)}const Y={tag:R,id:function(t){return 0===t.length||t.length>1?[]:A(t[0])},class:function(t){return p(t.map(j))},attribute:function(t){return p(t.map(x))},nthchild:function(t){return p(t.map($))},nthoftype:function(t){return p(t.map(P))}},q={tag:D,id:A,class:j,attribute:x,nthchild:$,nthoftype:P};function B(t){return t.includes(r.tag)||t.includes(r.nthoftype)?[...t]:[...t,r.tag]}function G(t={}){const e=[...I];return t[r.tag]&&t[r.nthoftype]&&e.splice(e.indexOf(r.tag),1),e.map((e=>{return(o=t)[n=e]?o[n].join(""):"";var n,o})).join("")}function H(t,e,n="",r){const i=function(t,e){return""===e?t:function(t,e){return[...t.map((t=>e+o.DESCENDANT+t)),...t.map((t=>e+o.CHILD+t))]}(t,e)}(function(t,e,n){const o=function(t,e){const{blacklist:n,whitelist:o,combineWithinSelector:r,maxCombinations:i}=e,c=g(n),u=g(o);return function(t){const{selectors:e,includeTag:n}=t,o=[].concat(e);return n&&!o.includes("tag")&&o.push("tag"),o}(e).reduce(((e,n)=>{const o=function(t,e){var n;return(null!==(n=Y[e])&&void 0!==n?n:()=>[])(t)}(t,n),s=function(t=[],e,n){return t.filter((t=>n(t)||!e(t)))}(o,c,u),a=function(t=[],e){return t.sort(((t,n)=>{const o=e(t),r=e(n);return o&&!r?-1:!o&&r?1:0}))}(s,u);return e[n]=r?_(a,{maxResults:i}):a.map((t=>[t])),e}),{})}(t,n),r=function(t,e){return function(t){const{selectors:e,combineBetweenSelectors:n,includeTag:o,maxCandidates:r}=t,i=n?_(e,{maxResults:r}):e.map((t=>[t]));return o?i.map(B):i}(e).map((e=>function(t,e){const n={};return t.forEach((t=>{const o=e[t];o.length>0&&(n[t]=o)})),function(t={}){let e=[];return Object.entries(t).forEach((([t,n])=>{e=n.flatMap((n=>0===e.length?[{[t]:n}]:e.map((e=>Object.assign(Object.assign({},e),{[t]:n})))))})),e}(n).map(G)}(e,t))).filter((t=>t.length>0))}(o,n),i=h(r);return[...new Set(i)]}(t,r.root,r),n);for(const e of i)if(y(t,e,r.root))return e;return null}function W(t){return{value:t,include:!1}}function U({selectors:t,operator:e}){let n=[...I];t[r.tag]&&t[r.nthoftype]&&(n=n.filter((t=>t!==r.tag)));let o="";return n.forEach((e=>{(t[e]||[]).forEach((({value:t,include:e})=>{e&&(o+=t)}))})),e+o}function z(t){return[":root",...b(t).reverse().map((t=>{const e=function(t,e,n=o.NONE){const r={};return e.forEach((e=>{Reflect.set(r,e,function(t,e){return q[e](t)}(t,e).map(W))})),{element:t,operator:n,selectors:r}}(t,[r.nthchild],o.CHILD);return e.selectors.nthchild.forEach((t=>{t.include=!0})),e})).map(U)].join("")}function J(t,e={}){const o=function(t){(t instanceof NodeList||t instanceof HTMLCollection)&&(t=Array.from(t));const e=(Array.isArray(t)?t:[t]).filter(n);return[...new Set(e)]}(t),i=function(t,e={}){const n=Object.assign(Object.assign({},u),e);return{selectors:(o=n.selectors,Array.isArray(o)?o.filter((t=>{return e=r,n=t,Object.values(e).includes(n);var e,n})):[]),whitelist:l(n.whitelist),blacklist:l(n.blacklist),root:d(n.root,t),combineWithinSelector:!!n.combineWithinSelector,combineBetweenSelectors:!!n.combineBetweenSelectors,includeTag:!!n.includeTag,maxCombinations:m(n.maxCombinations),maxCandidates:m(n.maxCandidates)};var o}(o[0],e);let c="",s=i.root;function a(){return function(t,e,n="",o){if(0===t.length)return null;const r=[t.length>1?t:[],...N(t,e).map((t=>[t]))];for(const t of r){const e=H(t,0,n,o);if(e)return{foundElements:t,selector:e}}return null}(o,s,c,i)}let f=a();for(;f;){const{foundElements:t,selector:e}=f;if(y(o,e,i.root))return e;s=t[0],c=e,f=a()}return o.length>1?o.map((t=>J(t,i))).join(S):function(t){return t.map(z).join(S)}(o)}const K=J;return e})()));'};import{execSync as TP}from"child_process";import{randomUUID as Ly}from"crypto";import{existsSync as el,mkdirSync as EP,readFileSync as CP,writeFileSync as RP}from"fs";import{Jimp as AP}from"jimp";import IP from"js-beautify";import{cloneDeep as PP}from"lodash-es";var dS={"application/prs.cww":["cww"],"application/prs.xsf+xml":["xsf"],"application/vnd.1000minds.decision-model+xml":["1km"],"application/vnd.3gpp.pic-bw-large":["plb"],"application/vnd.3gpp.pic-bw-small":["psb"],"application/vnd.3gpp.pic-bw-var":["pvb"],"application/vnd.3gpp2.tcap":["tcap"],"application/vnd.3m.post-it-notes":["pwn"],"application/vnd.accpac.simply.aso":["aso"],"application/vnd.accpac.simply.imp":["imp"],"application/vnd.acucobol":["acu"],"application/vnd.acucorp":["atc","acutc"],"application/vnd.adobe.air-application-installer-package+zip":["air"],"application/vnd.adobe.formscentral.fcdt":["fcdt"],"application/vnd.adobe.fxp":["fxp","fxpl"],"application/vnd.adobe.xdp+xml":["xdp"],"application/vnd.adobe.xfdf":["*xfdf"],"application/vnd.age":["age"],"application/vnd.ahead.space":["ahead"],"application/vnd.airzip.filesecure.azf":["azf"],"application/vnd.airzip.filesecure.azs":["azs"],"application/vnd.amazon.ebook":["azw"],"application/vnd.americandynamics.acc":["acc"],"application/vnd.amiga.ami":["ami"],"application/vnd.android.package-archive":["apk"],"application/vnd.anser-web-certificate-issue-initiation":["cii"],"application/vnd.anser-web-funds-transfer-initiation":["fti"],"application/vnd.antix.game-component":["atx"],"application/vnd.apple.installer+xml":["mpkg"],"application/vnd.apple.keynote":["key"],"application/vnd.apple.mpegurl":["m3u8"],"application/vnd.apple.numbers":["numbers"],"application/vnd.apple.pages":["pages"],"application/vnd.apple.pkpass":["pkpass"],"application/vnd.aristanetworks.swi":["swi"],"application/vnd.astraea-software.iota":["iota"],"application/vnd.audiograph":["aep"],"application/vnd.balsamiq.bmml+xml":["bmml"],"application/vnd.blueice.multipass":["mpm"],"application/vnd.bmi":["bmi"],"application/vnd.businessobjects":["rep"],"application/vnd.chemdraw+xml":["cdxml"],"application/vnd.chipnuts.karaoke-mmd":["mmd"],"application/vnd.cinderella":["cdy"],"application/vnd.citationstyles.style+xml":["csl"],"application/vnd.claymore":["cla"],"application/vnd.cloanto.rp9":["rp9"],"application/vnd.clonk.c4group":["c4g","c4d","c4f","c4p","c4u"],"application/vnd.cluetrust.cartomobile-config":["c11amc"],"application/vnd.cluetrust.cartomobile-config-pkg":["c11amz"],"application/vnd.commonspace":["csp"],"application/vnd.contact.cmsg":["cdbcmsg"],"application/vnd.cosmocaller":["cmc"],"application/vnd.crick.clicker":["clkx"],"application/vnd.crick.clicker.keyboard":["clkk"],"application/vnd.crick.clicker.palette":["clkp"],"application/vnd.crick.clicker.template":["clkt"],"application/vnd.crick.clicker.wordbank":["clkw"],"application/vnd.criticaltools.wbs+xml":["wbs"],"application/vnd.ctc-posml":["pml"],"application/vnd.cups-ppd":["ppd"],"application/vnd.curl.car":["car"],"application/vnd.curl.pcurl":["pcurl"],"application/vnd.dart":["dart"],"application/vnd.data-vision.rdz":["rdz"],"application/vnd.dbf":["dbf"],"application/vnd.dece.data":["uvf","uvvf","uvd","uvvd"],"application/vnd.dece.ttml+xml":["uvt","uvvt"],"application/vnd.dece.unspecified":["uvx","uvvx"],"application/vnd.dece.zip":["uvz","uvvz"],"application/vnd.denovo.fcselayout-link":["fe_launch"],"application/vnd.dna":["dna"],"application/vnd.dolby.mlp":["mlp"],"application/vnd.dpgraph":["dpg"],"application/vnd.dreamfactory":["dfac"],"application/vnd.ds-keypoint":["kpxx"],"application/vnd.dvb.ait":["ait"],"application/vnd.dvb.service":["svc"],"application/vnd.dynageo":["geo"],"application/vnd.ecowin.chart":["mag"],"application/vnd.enliven":["nml"],"application/vnd.epson.esf":["esf"],"application/vnd.epson.msf":["msf"],"application/vnd.epson.quickanime":["qam"],"application/vnd.epson.salt":["slt"],"application/vnd.epson.ssf":["ssf"],"application/vnd.eszigno3+xml":["es3","et3"],"application/vnd.ezpix-album":["ez2"],"application/vnd.ezpix-package":["ez3"],"application/vnd.fdf":["*fdf"],"application/vnd.fdsn.mseed":["mseed"],"application/vnd.fdsn.seed":["seed","dataless"],"application/vnd.flographit":["gph"],"application/vnd.fluxtime.clip":["ftc"],"application/vnd.framemaker":["fm","frame","maker","book"],"application/vnd.frogans.fnc":["fnc"],"application/vnd.frogans.ltf":["ltf"],"application/vnd.fsc.weblaunch":["fsc"],"application/vnd.fujitsu.oasys":["oas"],"application/vnd.fujitsu.oasys2":["oa2"],"application/vnd.fujitsu.oasys3":["oa3"],"application/vnd.fujitsu.oasysgp":["fg5"],"application/vnd.fujitsu.oasysprs":["bh2"],"application/vnd.fujixerox.ddd":["ddd"],"application/vnd.fujixerox.docuworks":["xdw"],"application/vnd.fujixerox.docuworks.binder":["xbd"],"application/vnd.fuzzysheet":["fzs"],"application/vnd.genomatix.tuxedo":["txd"],"application/vnd.geogebra.file":["ggb"],"application/vnd.geogebra.tool":["ggt"],"application/vnd.geometry-explorer":["gex","gre"],"application/vnd.geonext":["gxt"],"application/vnd.geoplan":["g2w"],"application/vnd.geospace":["g3w"],"application/vnd.gmx":["gmx"],"application/vnd.google-apps.document":["gdoc"],"application/vnd.google-apps.presentation":["gslides"],"application/vnd.google-apps.spreadsheet":["gsheet"],"application/vnd.google-earth.kml+xml":["kml"],"application/vnd.google-earth.kmz":["kmz"],"application/vnd.grafeq":["gqf","gqs"],"application/vnd.groove-account":["gac"],"application/vnd.groove-help":["ghf"],"application/vnd.groove-identity-message":["gim"],"application/vnd.groove-injector":["grv"],"application/vnd.groove-tool-message":["gtm"],"application/vnd.groove-tool-template":["tpl"],"application/vnd.groove-vcard":["vcg"],"application/vnd.hal+xml":["hal"],"application/vnd.handheld-entertainment+xml":["zmm"],"application/vnd.hbci":["hbci"],"application/vnd.hhe.lesson-player":["les"],"application/vnd.hp-hpgl":["hpgl"],"application/vnd.hp-hpid":["hpid"],"application/vnd.hp-hps":["hps"],"application/vnd.hp-jlyt":["jlt"],"application/vnd.hp-pcl":["pcl"],"application/vnd.hp-pclxl":["pclxl"],"application/vnd.hydrostatix.sof-data":["sfd-hdstx"],"application/vnd.ibm.minipay":["mpy"],"application/vnd.ibm.modcap":["afp","listafp","list3820"],"application/vnd.ibm.rights-management":["irm"],"application/vnd.ibm.secure-container":["sc"],"application/vnd.iccprofile":["icc","icm"],"application/vnd.igloader":["igl"],"application/vnd.immervision-ivp":["ivp"],"application/vnd.immervision-ivu":["ivu"],"application/vnd.insors.igm":["igm"],"application/vnd.intercon.formnet":["xpw","xpx"],"application/vnd.intergeo":["i2g"],"application/vnd.intu.qbo":["qbo"],"application/vnd.intu.qfx":["qfx"],"application/vnd.ipunplugged.rcprofile":["rcprofile"],"application/vnd.irepository.package+xml":["irp"],"application/vnd.is-xpr":["xpr"],"application/vnd.isac.fcs":["fcs"],"application/vnd.jam":["jam"],"application/vnd.jcp.javame.midlet-rms":["rms"],"application/vnd.jisp":["jisp"],"application/vnd.joost.joda-archive":["joda"],"application/vnd.kahootz":["ktz","ktr"],"application/vnd.kde.karbon":["karbon"],"application/vnd.kde.kchart":["chrt"],"application/vnd.kde.kformula":["kfo"],"application/vnd.kde.kivio":["flw"],"application/vnd.kde.kontour":["kon"],"application/vnd.kde.kpresenter":["kpr","kpt"],"application/vnd.kde.kspread":["ksp"],"application/vnd.kde.kword":["kwd","kwt"],"application/vnd.kenameaapp":["htke"],"application/vnd.kidspiration":["kia"],"application/vnd.kinar":["kne","knp"],"application/vnd.koan":["skp","skd","skt","skm"],"application/vnd.kodak-descriptor":["sse"],"application/vnd.las.las+xml":["lasxml"],"application/vnd.llamagraphics.life-balance.desktop":["lbd"],"application/vnd.llamagraphics.life-balance.exchange+xml":["lbe"],"application/vnd.lotus-1-2-3":["123"],"application/vnd.lotus-approach":["apr"],"application/vnd.lotus-freelance":["pre"],"application/vnd.lotus-notes":["nsf"],"application/vnd.lotus-organizer":["org"],"application/vnd.lotus-screencam":["scm"],"application/vnd.lotus-wordpro":["lwp"],"application/vnd.macports.portpkg":["portpkg"],"application/vnd.mapbox-vector-tile":["mvt"],"application/vnd.mcd":["mcd"],"application/vnd.medcalcdata":["mc1"],"application/vnd.mediastation.cdkey":["cdkey"],"application/vnd.mfer":["mwf"],"application/vnd.mfmp":["mfm"],"application/vnd.micrografx.flo":["flo"],"application/vnd.micrografx.igx":["igx"],"application/vnd.mif":["mif"],"application/vnd.mobius.daf":["daf"],"application/vnd.mobius.dis":["dis"],"application/vnd.mobius.mbk":["mbk"],"application/vnd.mobius.mqy":["mqy"],"application/vnd.mobius.msl":["msl"],"application/vnd.mobius.plc":["plc"],"application/vnd.mobius.txf":["txf"],"application/vnd.mophun.application":["mpn"],"application/vnd.mophun.certificate":["mpc"],"application/vnd.mozilla.xul+xml":["xul"],"application/vnd.ms-artgalry":["cil"],"application/vnd.ms-cab-compressed":["cab"],"application/vnd.ms-excel":["xls","xlm","xla","xlc","xlt","xlw"],"application/vnd.ms-excel.addin.macroenabled.12":["xlam"],"application/vnd.ms-excel.sheet.binary.macroenabled.12":["xlsb"],"application/vnd.ms-excel.sheet.macroenabled.12":["xlsm"],"application/vnd.ms-excel.template.macroenabled.12":["xltm"],"application/vnd.ms-fontobject":["eot"],"application/vnd.ms-htmlhelp":["chm"],"application/vnd.ms-ims":["ims"],"application/vnd.ms-lrm":["lrm"],"application/vnd.ms-officetheme":["thmx"],"application/vnd.ms-outlook":["msg"],"application/vnd.ms-pki.seccat":["cat"],"application/vnd.ms-pki.stl":["*stl"],"application/vnd.ms-powerpoint":["ppt","pps","pot"],"application/vnd.ms-powerpoint.addin.macroenabled.12":["ppam"],"application/vnd.ms-powerpoint.presentation.macroenabled.12":["pptm"],"application/vnd.ms-powerpoint.slide.macroenabled.12":["sldm"],"application/vnd.ms-powerpoint.slideshow.macroenabled.12":["ppsm"],"application/vnd.ms-powerpoint.template.macroenabled.12":["potm"],"application/vnd.ms-project":["*mpp","mpt"],"application/vnd.ms-word.document.macroenabled.12":["docm"],"application/vnd.ms-word.template.macroenabled.12":["dotm"],"application/vnd.ms-works":["wps","wks","wcm","wdb"],"application/vnd.ms-wpl":["wpl"],"application/vnd.ms-xpsdocument":["xps"],"application/vnd.mseq":["mseq"],"application/vnd.musician":["mus"],"application/vnd.muvee.style":["msty"],"application/vnd.mynfc":["taglet"],"application/vnd.neurolanguage.nlu":["nlu"],"application/vnd.nitf":["ntf","nitf"],"application/vnd.noblenet-directory":["nnd"],"application/vnd.noblenet-sealer":["nns"],"application/vnd.noblenet-web":["nnw"],"application/vnd.nokia.n-gage.ac+xml":["*ac"],"application/vnd.nokia.n-gage.data":["ngdat"],"application/vnd.nokia.n-gage.symbian.install":["n-gage"],"application/vnd.nokia.radio-preset":["rpst"],"application/vnd.nokia.radio-presets":["rpss"],"application/vnd.novadigm.edm":["edm"],"application/vnd.novadigm.edx":["edx"],"application/vnd.novadigm.ext":["ext"],"application/vnd.oasis.opendocument.chart":["odc"],"application/vnd.oasis.opendocument.chart-template":["otc"],"application/vnd.oasis.opendocument.database":["odb"],"application/vnd.oasis.opendocument.formula":["odf"],"application/vnd.oasis.opendocument.formula-template":["odft"],"application/vnd.oasis.opendocument.graphics":["odg"],"application/vnd.oasis.opendocument.graphics-template":["otg"],"application/vnd.oasis.opendocument.image":["odi"],"application/vnd.oasis.opendocument.image-template":["oti"],"application/vnd.oasis.opendocument.presentation":["odp"],"application/vnd.oasis.opendocument.presentation-template":["otp"],"application/vnd.oasis.opendocument.spreadsheet":["ods"],"application/vnd.oasis.opendocument.spreadsheet-template":["ots"],"application/vnd.oasis.opendocument.text":["odt"],"application/vnd.oasis.opendocument.text-master":["odm"],"application/vnd.oasis.opendocument.text-template":["ott"],"application/vnd.oasis.opendocument.text-web":["oth"],"application/vnd.olpc-sugar":["xo"],"application/vnd.oma.dd2+xml":["dd2"],"application/vnd.openblox.game+xml":["obgx"],"application/vnd.openofficeorg.extension":["oxt"],"application/vnd.openstreetmap.data+xml":["osm"],"application/vnd.openxmlformats-officedocument.presentationml.presentation":["pptx"],"application/vnd.openxmlformats-officedocument.presentationml.slide":["sldx"],"application/vnd.openxmlformats-officedocument.presentationml.slideshow":["ppsx"],"application/vnd.openxmlformats-officedocument.presentationml.template":["potx"],"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":["xlsx"],"application/vnd.openxmlformats-officedocument.spreadsheetml.template":["xltx"],"application/vnd.openxmlformats-officedocument.wordprocessingml.document":["docx"],"application/vnd.openxmlformats-officedocument.wordprocessingml.template":["dotx"],"application/vnd.osgeo.mapguide.package":["mgp"],"application/vnd.osgi.dp":["dp"],"application/vnd.osgi.subsystem":["esa"],"application/vnd.palm":["pdb","pqa","oprc"],"application/vnd.pawaafile":["paw"],"application/vnd.pg.format":["str"],"application/vnd.pg.osasli":["ei6"],"application/vnd.picsel":["efif"],"application/vnd.pmi.widget":["wg"],"application/vnd.pocketlearn":["plf"],"application/vnd.powerbuilder6":["pbd"],"application/vnd.previewsystems.box":["box"],"application/vnd.proteus.magazine":["mgz"],"application/vnd.publishare-delta-tree":["qps"],"application/vnd.pvi.ptid1":["ptid"],"application/vnd.pwg-xhtml-print+xml":["xhtm"],"application/vnd.quark.quarkxpress":["qxd","qxt","qwd","qwt","qxl","qxb"],"application/vnd.rar":["rar"],"application/vnd.realvnc.bed":["bed"],"application/vnd.recordare.musicxml":["mxl"],"application/vnd.recordare.musicxml+xml":["musicxml"],"application/vnd.rig.cryptonote":["cryptonote"],"application/vnd.rim.cod":["cod"],"application/vnd.rn-realmedia":["rm"],"application/vnd.rn-realmedia-vbr":["rmvb"],"application/vnd.route66.link66+xml":["link66"],"application/vnd.sailingtracker.track":["st"],"application/vnd.seemail":["see"],"application/vnd.sema":["sema"],"application/vnd.semd":["semd"],"application/vnd.semf":["semf"],"application/vnd.shana.informed.formdata":["ifm"],"application/vnd.shana.informed.formtemplate":["itp"],"application/vnd.shana.informed.interchange":["iif"],"application/vnd.shana.informed.package":["ipk"],"application/vnd.simtech-mindmapper":["twd","twds"],"application/vnd.smaf":["mmf"],"application/vnd.smart.teacher":["teacher"],"application/vnd.software602.filler.form+xml":["fo"],"application/vnd.solent.sdkm+xml":["sdkm","sdkd"],"application/vnd.spotfire.dxp":["dxp"],"application/vnd.spotfire.sfs":["sfs"],"application/vnd.stardivision.calc":["sdc"],"application/vnd.stardivision.draw":["sda"],"application/vnd.stardivision.impress":["sdd"],"application/vnd.stardivision.math":["smf"],"application/vnd.stardivision.writer":["sdw","vor"],"application/vnd.stardivision.writer-global":["sgl"],"application/vnd.stepmania.package":["smzip"],"application/vnd.stepmania.stepchart":["sm"],"application/vnd.sun.wadl+xml":["wadl"],"application/vnd.sun.xml.calc":["sxc"],"application/vnd.sun.xml.calc.template":["stc"],"application/vnd.sun.xml.draw":["sxd"],"application/vnd.sun.xml.draw.template":["std"],"application/vnd.sun.xml.impress":["sxi"],"application/vnd.sun.xml.impress.template":["sti"],"application/vnd.sun.xml.math":["sxm"],"application/vnd.sun.xml.writer":["sxw"],"application/vnd.sun.xml.writer.global":["sxg"],"application/vnd.sun.xml.writer.template":["stw"],"application/vnd.sus-calendar":["sus","susp"],"application/vnd.svd":["svd"],"application/vnd.symbian.install":["sis","sisx"],"application/vnd.syncml+xml":["xsm"],"application/vnd.syncml.dm+wbxml":["bdm"],"application/vnd.syncml.dm+xml":["xdm"],"application/vnd.syncml.dmddf+xml":["ddf"],"application/vnd.tao.intent-module-archive":["tao"],"application/vnd.tcpdump.pcap":["pcap","cap","dmp"],"application/vnd.tmobile-livetv":["tmo"],"application/vnd.trid.tpt":["tpt"],"application/vnd.triscape.mxs":["mxs"],"application/vnd.trueapp":["tra"],"application/vnd.ufdl":["ufd","ufdl"],"application/vnd.uiq.theme":["utz"],"application/vnd.umajin":["umj"],"application/vnd.unity":["unityweb"],"application/vnd.uoml+xml":["uoml","uo"],"application/vnd.vcx":["vcx"],"application/vnd.visio":["vsd","vst","vss","vsw"],"application/vnd.visionary":["vis"],"application/vnd.vsf":["vsf"],"application/vnd.wap.wbxml":["wbxml"],"application/vnd.wap.wmlc":["wmlc"],"application/vnd.wap.wmlscriptc":["wmlsc"],"application/vnd.webturbo":["wtb"],"application/vnd.wolfram.player":["nbp"],"application/vnd.wordperfect":["wpd"],"application/vnd.wqd":["wqd"],"application/vnd.wt.stf":["stf"],"application/vnd.xara":["xar"],"application/vnd.xfdl":["xfdl"],"application/vnd.yamaha.hv-dic":["hvd"],"application/vnd.yamaha.hv-script":["hvs"],"application/vnd.yamaha.hv-voice":["hvp"],"application/vnd.yamaha.openscoreformat":["osf"],"application/vnd.yamaha.openscoreformat.osfpvg+xml":["osfpvg"],"application/vnd.yamaha.smaf-audio":["saf"],"application/vnd.yamaha.smaf-phrase":["spf"],"application/vnd.yellowriver-custom-menu":["cmp"],"application/vnd.zul":["zir","zirz"],"application/vnd.zzazz.deck+xml":["zaz"],"application/x-7z-compressed":["7z"],"application/x-abiword":["abw"],"application/x-ace-compressed":["ace"],"application/x-apple-diskimage":["*dmg"],"application/x-arj":["arj"],"application/x-authorware-bin":["aab","x32","u32","vox"],"application/x-authorware-map":["aam"],"application/x-authorware-seg":["aas"],"application/x-bcpio":["bcpio"],"application/x-bdoc":["*bdoc"],"application/x-bittorrent":["torrent"],"application/x-blorb":["blb","blorb"],"application/x-bzip":["bz"],"application/x-bzip2":["bz2","boz"],"application/x-cbr":["cbr","cba","cbt","cbz","cb7"],"application/x-cdlink":["vcd"],"application/x-cfs-compressed":["cfs"],"application/x-chat":["chat"],"application/x-chess-pgn":["pgn"],"application/x-chrome-extension":["crx"],"application/x-cocoa":["cco"],"application/x-conference":["nsc"],"application/x-cpio":["cpio"],"application/x-csh":["csh"],"application/x-debian-package":["*deb","udeb"],"application/x-dgc-compressed":["dgc"],"application/x-director":["dir","dcr","dxr","cst","cct","cxt","w3d","fgd","swa"],"application/x-doom":["wad"],"application/x-dtbncx+xml":["ncx"],"application/x-dtbook+xml":["dtb"],"application/x-dtbresource+xml":["res"],"application/x-dvi":["dvi"],"application/x-envoy":["evy"],"application/x-eva":["eva"],"application/x-font-bdf":["bdf"],"application/x-font-ghostscript":["gsf"],"application/x-font-linux-psf":["psf"],"application/x-font-pcf":["pcf"],"application/x-font-snf":["snf"],"application/x-font-type1":["pfa","pfb","pfm","afm"],"application/x-freearc":["arc"],"application/x-futuresplash":["spl"],"application/x-gca-compressed":["gca"],"application/x-glulx":["ulx"],"application/x-gnumeric":["gnumeric"],"application/x-gramps-xml":["gramps"],"application/x-gtar":["gtar"],"application/x-hdf":["hdf"],"application/x-httpd-php":["php"],"application/x-install-instructions":["install"],"application/x-iso9660-image":["*iso"],"application/x-iwork-keynote-sffkey":["*key"],"application/x-iwork-numbers-sffnumbers":["*numbers"],"application/x-iwork-pages-sffpages":["*pages"],"application/x-java-archive-diff":["jardiff"],"application/x-java-jnlp-file":["jnlp"],"application/x-keepass2":["kdbx"],"application/x-latex":["latex"],"application/x-lua-bytecode":["luac"],"application/x-lzh-compressed":["lzh","lha"],"application/x-makeself":["run"],"application/x-mie":["mie"],"application/x-mobipocket-ebook":["*prc","mobi"],"application/x-ms-application":["application"],"application/x-ms-shortcut":["lnk"],"application/x-ms-wmd":["wmd"],"application/x-ms-wmz":["wmz"],"application/x-ms-xbap":["xbap"],"application/x-msaccess":["mdb"],"application/x-msbinder":["obd"],"application/x-mscardfile":["crd"],"application/x-msclip":["clp"],"application/x-msdos-program":["*exe"],"application/x-msdownload":["*exe","*dll","com","bat","*msi"],"application/x-msmediaview":["mvb","m13","m14"],"application/x-msmetafile":["*wmf","*wmz","*emf","emz"],"application/x-msmoney":["mny"],"application/x-mspublisher":["pub"],"application/x-msschedule":["scd"],"application/x-msterminal":["trm"],"application/x-mswrite":["wri"],"application/x-netcdf":["nc","cdf"],"application/x-ns-proxy-autoconfig":["pac"],"application/x-nzb":["nzb"],"application/x-perl":["pl","pm"],"application/x-pilot":["*prc","*pdb"],"application/x-pkcs12":["p12","pfx"],"application/x-pkcs7-certificates":["p7b","spc"],"application/x-pkcs7-certreqresp":["p7r"],"application/x-rar-compressed":["*rar"],"application/x-redhat-package-manager":["rpm"],"application/x-research-info-systems":["ris"],"application/x-sea":["sea"],"application/x-sh":["sh"],"application/x-shar":["shar"],"application/x-shockwave-flash":["swf"],"application/x-silverlight-app":["xap"],"application/x-sql":["*sql"],"application/x-stuffit":["sit"],"application/x-stuffitx":["sitx"],"application/x-subrip":["srt"],"application/x-sv4cpio":["sv4cpio"],"application/x-sv4crc":["sv4crc"],"application/x-t3vm-image":["t3"],"application/x-tads":["gam"],"application/x-tar":["tar"],"application/x-tcl":["tcl","tk"],"application/x-tex":["tex"],"application/x-tex-tfm":["tfm"],"application/x-texinfo":["texinfo","texi"],"application/x-tgif":["*obj"],"application/x-ustar":["ustar"],"application/x-virtualbox-hdd":["hdd"],"application/x-virtualbox-ova":["ova"],"application/x-virtualbox-ovf":["ovf"],"application/x-virtualbox-vbox":["vbox"],"application/x-virtualbox-vbox-extpack":["vbox-extpack"],"application/x-virtualbox-vdi":["vdi"],"application/x-virtualbox-vhd":["vhd"],"application/x-virtualbox-vmdk":["vmdk"],"application/x-wais-source":["src"],"application/x-web-app-manifest+json":["webapp"],"application/x-x509-ca-cert":["der","crt","pem"],"application/x-xfig":["fig"],"application/x-xliff+xml":["*xlf"],"application/x-xpinstall":["xpi"],"application/x-xz":["xz"],"application/x-zmachine":["z1","z2","z3","z4","z5","z6","z7","z8"],"audio/vnd.dece.audio":["uva","uvva"],"audio/vnd.digital-winds":["eol"],"audio/vnd.dra":["dra"],"audio/vnd.dts":["dts"],"audio/vnd.dts.hd":["dtshd"],"audio/vnd.lucent.voice":["lvp"],"audio/vnd.ms-playready.media.pya":["pya"],"audio/vnd.nuera.ecelp4800":["ecelp4800"],"audio/vnd.nuera.ecelp7470":["ecelp7470"],"audio/vnd.nuera.ecelp9600":["ecelp9600"],"audio/vnd.rip":["rip"],"audio/x-aac":["*aac"],"audio/x-aiff":["aif","aiff","aifc"],"audio/x-caf":["caf"],"audio/x-flac":["flac"],"audio/x-m4a":["*m4a"],"audio/x-matroska":["mka"],"audio/x-mpegurl":["m3u"],"audio/x-ms-wax":["wax"],"audio/x-ms-wma":["wma"],"audio/x-pn-realaudio":["ram","ra"],"audio/x-pn-realaudio-plugin":["rmp"],"audio/x-realaudio":["*ra"],"audio/x-wav":["*wav"],"chemical/x-cdx":["cdx"],"chemical/x-cif":["cif"],"chemical/x-cmdf":["cmdf"],"chemical/x-cml":["cml"],"chemical/x-csml":["csml"],"chemical/x-xyz":["xyz"],"image/prs.btif":["btif","btf"],"image/prs.pti":["pti"],"image/vnd.adobe.photoshop":["psd"],"image/vnd.airzip.accelerator.azv":["azv"],"image/vnd.dece.graphic":["uvi","uvvi","uvg","uvvg"],"image/vnd.djvu":["djvu","djv"],"image/vnd.dvb.subtitle":["*sub"],"image/vnd.dwg":["dwg"],"image/vnd.dxf":["dxf"],"image/vnd.fastbidsheet":["fbs"],"image/vnd.fpx":["fpx"],"image/vnd.fst":["fst"],"image/vnd.fujixerox.edmics-mmr":["mmr"],"image/vnd.fujixerox.edmics-rlc":["rlc"],"image/vnd.microsoft.icon":["ico"],"image/vnd.ms-dds":["dds"],"image/vnd.ms-modi":["mdi"],"image/vnd.ms-photo":["wdp"],"image/vnd.net-fpx":["npx"],"image/vnd.pco.b16":["b16"],"image/vnd.tencent.tap":["tap"],"image/vnd.valve.source.texture":["vtf"],"image/vnd.wap.wbmp":["wbmp"],"image/vnd.xiff":["xif"],"image/vnd.zbrush.pcx":["pcx"],"image/x-3ds":["3ds"],"image/x-cmu-raster":["ras"],"image/x-cmx":["cmx"],"image/x-freehand":["fh","fhc","fh4","fh5","fh7"],"image/x-icon":["*ico"],"image/x-jng":["jng"],"image/x-mrsid-image":["sid"],"image/x-ms-bmp":["*bmp"],"image/x-pcx":["*pcx"],"image/x-pict":["pic","pct"],"image/x-portable-anymap":["pnm"],"image/x-portable-bitmap":["pbm"],"image/x-portable-graymap":["pgm"],"image/x-portable-pixmap":["ppm"],"image/x-rgb":["rgb"],"image/x-tga":["tga"],"image/x-xbitmap":["xbm"],"image/x-xpixmap":["xpm"],"image/x-xwindowdump":["xwd"],"message/vnd.wfa.wsc":["wsc"],"model/vnd.cld":["cld"],"model/vnd.collada+xml":["dae"],"model/vnd.dwf":["dwf"],"model/vnd.gdl":["gdl"],"model/vnd.gtw":["gtw"],"model/vnd.mts":["mts"],"model/vnd.opengex":["ogex"],"model/vnd.parasolid.transmit.binary":["x_b"],"model/vnd.parasolid.transmit.text":["x_t"],"model/vnd.pytha.pyox":["pyo","pyox"],"model/vnd.sap.vds":["vds"],"model/vnd.usda":["usda"],"model/vnd.usdz+zip":["usdz"],"model/vnd.valve.source.compiled-map":["bsp"],"model/vnd.vtu":["vtu"],"text/prs.lines.tag":["dsc"],"text/vnd.curl":["curl"],"text/vnd.curl.dcurl":["dcurl"],"text/vnd.curl.mcurl":["mcurl"],"text/vnd.curl.scurl":["scurl"],"text/vnd.dvb.subtitle":["sub"],"text/vnd.familysearch.gedcom":["ged"],"text/vnd.fly":["fly"],"text/vnd.fmi.flexstor":["flx"],"text/vnd.graphviz":["gv"],"text/vnd.in3d.3dml":["3dml"],"text/vnd.in3d.spot":["spot"],"text/vnd.sun.j2me.app-descriptor":["jad"],"text/vnd.wap.wml":["wml"],"text/vnd.wap.wmlscript":["wmls"],"text/x-asm":["s","asm"],"text/x-c":["c","cc","cxx","cpp","h","hh","dic"],"text/x-component":["htc"],"text/x-fortran":["f","for","f77","f90"],"text/x-handlebars-template":["hbs"],"text/x-java-source":["java"],"text/x-lua":["lua"],"text/x-markdown":["mkd"],"text/x-nfo":["nfo"],"text/x-opml":["opml"],"text/x-org":["*org"],"text/x-pascal":["p","pas"],"text/x-processing":["pde"],"text/x-sass":["sass"],"text/x-scss":["scss"],"text/x-setext":["etx"],"text/x-sfv":["sfv"],"text/x-suse-ymp":["ymp"],"text/x-uuencode":["uu"],"text/x-vcalendar":["vcs"],"text/x-vcard":["vcf"],"video/vnd.dece.hd":["uvh","uvvh"],"video/vnd.dece.mobile":["uvm","uvvm"],"video/vnd.dece.pd":["uvp","uvvp"],"video/vnd.dece.sd":["uvs","uvvs"],"video/vnd.dece.video":["uvv","uvvv"],"video/vnd.dvb.file":["dvb"],"video/vnd.fvt":["fvt"],"video/vnd.mpegurl":["mxu","m4u"],"video/vnd.ms-playready.media.pyv":["pyv"],"video/vnd.uvvu.mp4":["uvu","uvvu"],"video/vnd.vivo":["viv"],"video/x-f4v":["f4v"],"video/x-fli":["fli"],"video/x-flv":["flv"],"video/x-m4v":["m4v"],"video/x-matroska":["mkv","mk3d","mks"],"video/x-mng":["mng"],"video/x-ms-asf":["asf","asx"],"video/x-ms-vob":["vob"],"video/x-ms-wm":["wm"],"video/x-ms-wmv":["wmv"],"video/x-ms-wmx":["wmx"],"video/x-ms-wvx":["wvx"],"video/x-msvideo":["avi"],"video/x-sgi-movie":["movie"],"video/x-smv":["smv"],"x-conference/x-cooltalk":["ice"]};Object.freeze(dS);var pS=dS;var uS={"application/andrew-inset":["ez"],"application/appinstaller":["appinstaller"],"application/applixware":["aw"],"application/appx":["appx"],"application/appxbundle":["appxbundle"],"application/atom+xml":["atom"],"application/atomcat+xml":["atomcat"],"application/atomdeleted+xml":["atomdeleted"],"application/atomsvc+xml":["atomsvc"],"application/atsc-dwd+xml":["dwd"],"application/atsc-held+xml":["held"],"application/atsc-rsat+xml":["rsat"],"application/automationml-aml+xml":["aml"],"application/automationml-amlx+zip":["amlx"],"application/bdoc":["bdoc"],"application/calendar+xml":["xcs"],"application/ccxml+xml":["ccxml"],"application/cdfx+xml":["cdfx"],"application/cdmi-capability":["cdmia"],"application/cdmi-container":["cdmic"],"application/cdmi-domain":["cdmid"],"application/cdmi-object":["cdmio"],"application/cdmi-queue":["cdmiq"],"application/cpl+xml":["cpl"],"application/cu-seeme":["cu"],"application/cwl":["cwl"],"application/dash+xml":["mpd"],"application/dash-patch+xml":["mpp"],"application/davmount+xml":["davmount"],"application/docbook+xml":["dbk"],"application/dssc+der":["dssc"],"application/dssc+xml":["xdssc"],"application/ecmascript":["ecma"],"application/emma+xml":["emma"],"application/emotionml+xml":["emotionml"],"application/epub+zip":["epub"],"application/exi":["exi"],"application/express":["exp"],"application/fdf":["fdf"],"application/fdt+xml":["fdt"],"application/font-tdpfr":["pfr"],"application/geo+json":["geojson"],"application/gml+xml":["gml"],"application/gpx+xml":["gpx"],"application/gxf":["gxf"],"application/gzip":["gz"],"application/hjson":["hjson"],"application/hyperstudio":["stk"],"application/inkml+xml":["ink","inkml"],"application/ipfix":["ipfix"],"application/its+xml":["its"],"application/java-archive":["jar","war","ear"],"application/java-serialized-object":["ser"],"application/java-vm":["class"],"application/javascript":["*js"],"application/json":["json","map"],"application/json5":["json5"],"application/jsonml+json":["jsonml"],"application/ld+json":["jsonld"],"application/lgr+xml":["lgr"],"application/lost+xml":["lostxml"],"application/mac-binhex40":["hqx"],"application/mac-compactpro":["cpt"],"application/mads+xml":["mads"],"application/manifest+json":["webmanifest"],"application/marc":["mrc"],"application/marcxml+xml":["mrcx"],"application/mathematica":["ma","nb","mb"],"application/mathml+xml":["mathml"],"application/mbox":["mbox"],"application/media-policy-dataset+xml":["mpf"],"application/mediaservercontrol+xml":["mscml"],"application/metalink+xml":["metalink"],"application/metalink4+xml":["meta4"],"application/mets+xml":["mets"],"application/mmt-aei+xml":["maei"],"application/mmt-usd+xml":["musd"],"application/mods+xml":["mods"],"application/mp21":["m21","mp21"],"application/mp4":["*mp4","*mpg4","mp4s","m4p"],"application/msix":["msix"],"application/msixbundle":["msixbundle"],"application/msword":["doc","dot"],"application/mxf":["mxf"],"application/n-quads":["nq"],"application/n-triples":["nt"],"application/node":["cjs"],"application/octet-stream":["bin","dms","lrf","mar","so","dist","distz","pkg","bpk","dump","elc","deploy","exe","dll","deb","dmg","iso","img","msi","msp","msm","buffer"],"application/oda":["oda"],"application/oebps-package+xml":["opf"],"application/ogg":["ogx"],"application/omdoc+xml":["omdoc"],"application/onenote":["onetoc","onetoc2","onetmp","onepkg"],"application/oxps":["oxps"],"application/p2p-overlay+xml":["relo"],"application/patch-ops-error+xml":["xer"],"application/pdf":["pdf"],"application/pgp-encrypted":["pgp"],"application/pgp-keys":["asc"],"application/pgp-signature":["sig","*asc"],"application/pics-rules":["prf"],"application/pkcs10":["p10"],"application/pkcs7-mime":["p7m","p7c"],"application/pkcs7-signature":["p7s"],"application/pkcs8":["p8"],"application/pkix-attr-cert":["ac"],"application/pkix-cert":["cer"],"application/pkix-crl":["crl"],"application/pkix-pkipath":["pkipath"],"application/pkixcmp":["pki"],"application/pls+xml":["pls"],"application/postscript":["ai","eps","ps"],"application/provenance+xml":["provx"],"application/pskc+xml":["pskcxml"],"application/raml+yaml":["raml"],"application/rdf+xml":["rdf","owl"],"application/reginfo+xml":["rif"],"application/relax-ng-compact-syntax":["rnc"],"application/resource-lists+xml":["rl"],"application/resource-lists-diff+xml":["rld"],"application/rls-services+xml":["rs"],"application/route-apd+xml":["rapd"],"application/route-s-tsid+xml":["sls"],"application/route-usd+xml":["rusd"],"application/rpki-ghostbusters":["gbr"],"application/rpki-manifest":["mft"],"application/rpki-roa":["roa"],"application/rsd+xml":["rsd"],"application/rss+xml":["rss"],"application/rtf":["rtf"],"application/sbml+xml":["sbml"],"application/scvp-cv-request":["scq"],"application/scvp-cv-response":["scs"],"application/scvp-vp-request":["spq"],"application/scvp-vp-response":["spp"],"application/sdp":["sdp"],"application/senml+xml":["senmlx"],"application/sensml+xml":["sensmlx"],"application/set-payment-initiation":["setpay"],"application/set-registration-initiation":["setreg"],"application/shf+xml":["shf"],"application/sieve":["siv","sieve"],"application/smil+xml":["smi","smil"],"application/sparql-query":["rq"],"application/sparql-results+xml":["srx"],"application/sql":["sql"],"application/srgs":["gram"],"application/srgs+xml":["grxml"],"application/sru+xml":["sru"],"application/ssdl+xml":["ssdl"],"application/ssml+xml":["ssml"],"application/swid+xml":["swidtag"],"application/tei+xml":["tei","teicorpus"],"application/thraud+xml":["tfi"],"application/timestamped-data":["tsd"],"application/toml":["toml"],"application/trig":["trig"],"application/ttml+xml":["ttml"],"application/ubjson":["ubj"],"application/urc-ressheet+xml":["rsheet"],"application/urc-targetdesc+xml":["td"],"application/voicexml+xml":["vxml"],"application/wasm":["wasm"],"application/watcherinfo+xml":["wif"],"application/widget":["wgt"],"application/winhlp":["hlp"],"application/wsdl+xml":["wsdl"],"application/wspolicy+xml":["wspolicy"],"application/xaml+xml":["xaml"],"application/xcap-att+xml":["xav"],"application/xcap-caps+xml":["xca"],"application/xcap-diff+xml":["xdf"],"application/xcap-el+xml":["xel"],"application/xcap-ns+xml":["xns"],"application/xenc+xml":["xenc"],"application/xfdf":["xfdf"],"application/xhtml+xml":["xhtml","xht"],"application/xliff+xml":["xlf"],"application/xml":["xml","xsl","xsd","rng"],"application/xml-dtd":["dtd"],"application/xop+xml":["xop"],"application/xproc+xml":["xpl"],"application/xslt+xml":["*xsl","xslt"],"application/xspf+xml":["xspf"],"application/xv+xml":["mxml","xhvml","xvml","xvm"],"application/yang":["yang"],"application/yin+xml":["yin"],"application/zip":["zip"],"audio/3gpp":["*3gpp"],"audio/aac":["adts","aac"],"audio/adpcm":["adp"],"audio/amr":["amr"],"audio/basic":["au","snd"],"audio/midi":["mid","midi","kar","rmi"],"audio/mobile-xmf":["mxmf"],"audio/mp3":["*mp3"],"audio/mp4":["m4a","mp4a"],"audio/mpeg":["mpga","mp2","mp2a","mp3","m2a","m3a"],"audio/ogg":["oga","ogg","spx","opus"],"audio/s3m":["s3m"],"audio/silk":["sil"],"audio/wav":["wav"],"audio/wave":["*wav"],"audio/webm":["weba"],"audio/xm":["xm"],"font/collection":["ttc"],"font/otf":["otf"],"font/ttf":["ttf"],"font/woff":["woff"],"font/woff2":["woff2"],"image/aces":["exr"],"image/apng":["apng"],"image/avci":["avci"],"image/avcs":["avcs"],"image/avif":["avif"],"image/bmp":["bmp","dib"],"image/cgm":["cgm"],"image/dicom-rle":["drle"],"image/dpx":["dpx"],"image/emf":["emf"],"image/fits":["fits"],"image/g3fax":["g3"],"image/gif":["gif"],"image/heic":["heic"],"image/heic-sequence":["heics"],"image/heif":["heif"],"image/heif-sequence":["heifs"],"image/hej2k":["hej2"],"image/hsj2":["hsj2"],"image/ief":["ief"],"image/jls":["jls"],"image/jp2":["jp2","jpg2"],"image/jpeg":["jpeg","jpg","jpe"],"image/jph":["jph"],"image/jphc":["jhc"],"image/jpm":["jpm","jpgm"],"image/jpx":["jpx","jpf"],"image/jxr":["jxr"],"image/jxra":["jxra"],"image/jxrs":["jxrs"],"image/jxs":["jxs"],"image/jxsc":["jxsc"],"image/jxsi":["jxsi"],"image/jxss":["jxss"],"image/ktx":["ktx"],"image/ktx2":["ktx2"],"image/png":["png"],"image/sgi":["sgi"],"image/svg+xml":["svg","svgz"],"image/t38":["t38"],"image/tiff":["tif","tiff"],"image/tiff-fx":["tfx"],"image/webp":["webp"],"image/wmf":["wmf"],"message/disposition-notification":["disposition-notification"],"message/global":["u8msg"],"message/global-delivery-status":["u8dsn"],"message/global-disposition-notification":["u8mdn"],"message/global-headers":["u8hdr"],"message/rfc822":["eml","mime"],"model/3mf":["3mf"],"model/gltf+json":["gltf"],"model/gltf-binary":["glb"],"model/iges":["igs","iges"],"model/jt":["jt"],"model/mesh":["msh","mesh","silo"],"model/mtl":["mtl"],"model/obj":["obj"],"model/prc":["prc"],"model/step+xml":["stpx"],"model/step+zip":["stpz"],"model/step-xml+zip":["stpxz"],"model/stl":["stl"],"model/u3d":["u3d"],"model/vrml":["wrl","vrml"],"model/x3d+binary":["*x3db","x3dbz"],"model/x3d+fastinfoset":["x3db"],"model/x3d+vrml":["*x3dv","x3dvz"],"model/x3d+xml":["x3d","x3dz"],"model/x3d-vrml":["x3dv"],"text/cache-manifest":["appcache","manifest"],"text/calendar":["ics","ifb"],"text/coffeescript":["coffee","litcoffee"],"text/css":["css"],"text/csv":["csv"],"text/html":["html","htm","shtml"],"text/jade":["jade"],"text/javascript":["js","mjs"],"text/jsx":["jsx"],"text/less":["less"],"text/markdown":["md","markdown"],"text/mathml":["mml"],"text/mdx":["mdx"],"text/n3":["n3"],"text/plain":["txt","text","conf","def","list","log","in","ini"],"text/richtext":["rtx"],"text/rtf":["*rtf"],"text/sgml":["sgml","sgm"],"text/shex":["shex"],"text/slim":["slim","slm"],"text/spdx":["spdx"],"text/stylus":["stylus","styl"],"text/tab-separated-values":["tsv"],"text/troff":["t","tr","roff","man","me","ms"],"text/turtle":["ttl"],"text/uri-list":["uri","uris","urls"],"text/vcard":["vcard"],"text/vtt":["vtt"],"text/wgsl":["wgsl"],"text/xml":["*xml"],"text/yaml":["yaml","yml"],"video/3gpp":["3gp","3gpp"],"video/3gpp2":["3g2"],"video/h261":["h261"],"video/h263":["h263"],"video/h264":["h264"],"video/iso.segment":["m4s"],"video/jpeg":["jpgv"],"video/jpm":["*jpm","*jpgm"],"video/mj2":["mj2","mjp2"],"video/mp2t":["ts"],"video/mp4":["mp4","mp4v","mpg4"],"video/mpeg":["mpeg","mpg","mpe","m1v","m2v"],"video/ogg":["ogv"],"video/quicktime":["qt","mov"],"video/webm":["webm"]};Object.freeze(uS);var mS=uS;var Xt=function(n,e,t,r){if(t==="a"&&!r)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?n!==e||!r:!e.has(n))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?r:t==="a"?r.call(n):r?r.value:e.get(n)},_o,Yi,zr,vd=class{constructor(...e){_o.set(this,new Map),Yi.set(this,new Map),zr.set(this,new Map);for(let t of e)this.define(t)}define(e,t=!1){for(let[r,o]of Object.entries(e)){r=r.toLowerCase(),o=o.map(a=>a.toLowerCase()),Xt(this,zr,"f").has(r)||Xt(this,zr,"f").set(r,new Set);let i=Xt(this,zr,"f").get(r),s=!0;for(let a of o){let l=a.startsWith("*");if(a=l?a.slice(1):a,i?.add(a),s&&Xt(this,Yi,"f").set(r,a),s=!1,l)continue;let c=Xt(this,_o,"f").get(a);if(c&&c!=r&&!t)throw new Error(`"${r} -> ${a}" conflicts with "${c} -> ${a}". Pass \`force=true\` to override this definition.`);Xt(this,_o,"f").set(a,r)}}return this}getType(e){if(typeof e!="string")return null;let t=e.replace(/^.*[/\\]/,"").toLowerCase(),r=t.replace(/^.*\./,"").toLowerCase(),o=t.length<e.length;return!(r.length<t.length-1)&&o?null:Xt(this,_o,"f").get(r)??null}getExtension(e){return typeof e!="string"?null:(e=e?.split?.(";")[0],(e&&Xt(this,Yi,"f").get(e.trim().toLowerCase()))??null)}getAllExtensions(e){return typeof e!="string"?null:Xt(this,zr,"f").get(e.toLowerCase())??null}_freeze(){this.define=()=>{throw new Error("define() not allowed for built-in Mime objects. See https://github.com/broofa/mime/blob/main/README.md#custom-mime-instances")},Object.freeze(this);for(let e of Xt(this,zr,"f").values())Object.freeze(e);return this}_getTestState(){return{types:Xt(this,_o,"f"),extensions:Xt(this,Yi,"f")}}};_o=new WeakMap,Yi=new WeakMap,zr=new WeakMap;var xd=vd;var hS=new xd(mS,pS)._freeze();import{homedir as ky,hostname as LP,platform as OP}from"os";import{basename as kP,extname as NP,join as Zi,resolve as _P}from"path";import{chromium as Ny,devices as MP}from"playwright";import{addExtra as FP}from"playwright-extra";import DP from"puppeteer-extra-plugin-recaptcha";import{v4 as UP}from"uuid";import{rmSync as ZS}from"fs";import{basename as GI,join as VI}from"path";import{errors as qI}from"playwright-core";var Dn={bannedClassSubstrings:["relative","flex","center","justify","auto","sticky","absolute","top","right","left","bottom","items-center","notion-selectable","notion-page-block","notion-collection-item","MuiSvgIcon","css-","rt-"],nonDynamicInputTypes:["button","file","hidden","image","radio","reset","submit"],generalStateAttributes:["aria-expanded","aria-haspopup","aria-checked","aria-pressed","aria-selected","aria-invalid","checked","open","aria-busy"],bannedElementTagNames:["html","head","meta","script","style","path","br","::marker","noscript","polygon","defs"],bannedElementAttributes:["data-momentic-id","aria-keyshortcuts","data-ved","aria-controls","d"],relevantElementAttributes:["name","id","value","type","class","height","width","target","title","href","src","alt","role","headers","scope","checked","required","action","tooltip","min","max","minlength","maxlength","multiple","pattern","placeholder","accept","contenteditable","data-value","data-testid","data-cy","data-pw","data-test-id","data-test","data-role","data-type","data-key","data-action","data-aria-hidden","data-hidden","data-automation-id","data-content-editable-leaf","data-wf-icon","data-tns","data-handleid","data-handlepos","data-col-index","data-row-index","data-row","data-col","col-index","row-index","row","col","data-momentic-description","aria-label","aria-role","aria-selected","aria-disabled","aria-hidden","aria-describedby","aria-valuenow","aria-valuemin","aria-valuemax"],alwaysUsefulAttributesForCssSelectorGeneration:["src","href","aria-describedby","aria-labelledby","aria-label"],alwaysInterestingClassNames:["cm-line","cm-activeLine","cm-content"],alwaysInterestingClassPrefixes:["notion-",".w-"],alwaysInterestingTruthyPropertyNames:["contenteditable"],visualAttributesForSvgSerialization:["fill","stroke","color","patternContentUnits","xlink:href","transform","path","d","points","viewBox","preserveAspectRatio","r","rx","ry","cx","cy","x1","y1","x2","y2","font","text-anchor","dominant-baseline","gradient","pattern","stop-color"]};var GA=new Set(["b","c","d","f","g","h","j","k","l","m","n","p","q","r","s","t","v","w","x","y","z"]),VA=new Set(["a","e","i","o","u","y"]);function gS(n){if(n.length>75)return!1;if(n[0]?.match(/[0-9a-zA-Z]/)===null)return!0;if(n.length>10){let u=Math.floor(n.length/8);if((n.match(/[-_:A-Z/ ]/g)??[]).length<u)return!0}if((n.match(/[^0-9a-zA-Z-_.]/g)??[]).length/n.length>.2)return!0;let t=(n.match(/[0-9]/g)??[]).length;if(t/n.length>.3)return!0;let r=(n.toLowerCase().match(/[aeiou]/gi)??[]).length;if((n.toLowerCase().match(/[bcdfghjklmnpqrstvwxyz]/gi)??[]).length/r>5)return!0;let i=0,s=0;for(let u of n.toLowerCase())GA.has(u)?(s++,s>i&&(i=s)):s=0;if(i>4)return!0;let a=0,l=0;for(let u of n.toLowerCase())u>="a"&&u<="z"&&!VA.has(u)?(l++,l>a&&(a=l)):l=0;if(a>4)return!0;let c=(n.match(/[A-Z]/g)??[]).length,p=(n.match(/[a-z]/g)??[]).length,d=Math.ceil(n.length*.3);return!!(p&&t&&Math.abs(p-t)<d||p&&c&&Math.abs(p-c)<d)}import{randomUUID as nI}from"crypto";import{cloneDeep as Ad}from"lodash-es";import{randomUUID as ZA}from"crypto";var fS=new Set(["about:blank","chrome-error://chromewebdata/"]);var wt="data-momentic-id";var Td=["button","image","generic","graphics-symbol","tab","link","menuitem","group"],Ed=1e4,Ji=500;function ir(n,e){let t=n.findIndex(r=>r===e);if(!(t===-1||!n[t+1]))return n[t+1]}import{createHash as qA}from"crypto";var KA="v1";function ja(n,e){if(n.tagName.toLowerCase()==="svg"&&!JA(n))try{let t=SS(n,e),r=YA(JSON.stringify(t));return{version:KA,json:t,hash:r}}catch{return}}function YA(n){return qA("md5").update(n).digest("hex")}function SS(n,e){let t=n.tagName.toLowerCase(),r=XA(n);if(t==="image"&&r["xlink:href"])throw new Error("Image tags within SVGs are not supported");let o={type:t,props:r,children:[]};for(let i of n.childrenBackendIds){let s=e.backendIdToNode[i];if(s&&s.nodeType===1){let a=SS(s,e);a&&o.children.push(a)}}return o}function JA(n){let e=n.computedStyles.display,t=n.computedStyles.visibility,r=n.computedStyles.opacity;return e==="none"||t==="hidden"||r==="0"}function XA(n){let e={},t=n.attributes;for(let r of Object.keys(t))Dn.visualAttributesForSvgSerialization.includes(r)&&(e[r]=t[r]);return t.id&&n.tagName.toLowerCase()!=="svg"&&(e.id=t.id),e}var jr={r:147,g:196,b:125,a:.55},wS={showRulers:!1,showStyles:!1,showExtensionLines:!1,contrastAlgorithm:"aa",contentColor:jr,paddingColor:jr,borderColor:jr,marginColor:jr,eventTargetColor:jr,shapeColor:jr,shapeMarginColor:jr,showInfo:!0,showAccessibilityInfo:!0},Ha=["display","opacity","visibility","height","position"];function vS({snapshot:n,devicePixelRatio:e,logger:t}){let r=n.strings,o=n.documents,i={},s={},a={roots:[],backendIdToNode:i,frameIndexToIframeNode:s};return o.forEach((l,c)=>{let p=QA({allDocuments:o,stringConstants:r,frameIndex:c,devicePixelRatio:e,backendIdToNode:i,frameIndexToIframeNode:s,logger:t});a.roots.push(p)}),a}function QA({allDocuments:n,stringConstants:e,devicePixelRatio:t,frameIndex:r,frameIndexToIframeNode:o,backendIdToNode:i,logger:s}){let a=n[r],l=a.layout,c={};l.nodeIndex.forEach((C,I)=>{c[C]=I});let p=l.styles,d=l.bounds??[],u=a.nodes,m=u.contentDocumentIndex??{index:[],value:[]},h=u.backendNodeId??[],g=u.attributes??[],f=u.parentIndex??[],S=u.nodeName??[],x=u.nodeType??[],b=u.pseudoType??{index:[],value:[]},w=u.inputChecked??{index:[]},E=e[a.frameId];for(let C=0;C<h.length;C++){let I=h[C],N=x[C],P=g[C]??[],D=f[C]!==void 0&&f[C]>=0?f[C]:void 0,W=D!==void 0?h[D]:void 0,_=W!==void 0?i[W]:void 0,B=b.index.indexOf(C),L=B!==-1?e[b.value[B]]:void 0,j=c[C],O;j?O=d[j]??[]:O=[];let ee=S[C]!==void 0?e[S[C]]?.toLowerCase():void 0;if(!ee){s.warn({backendNodeId:I,frameId:E,frameIndex:r,nodeBounds:O},"DOM node has no tag name");continue}let me={backendNodeId:I,psuedoType:L,nodeType:N,frameIndex:r,parentFrameId:E,ownedFrameId:void 0,bounds:{x:O[0]??null,y:O[1]??null,width:O[2]??null,height:O[3]??null},computedStyles:{},attributes:{},parentBackendNodeId:W??null,tagName:ee,parent:_??void 0,childrenBackendIds:[],momenticIgnored:void 0,mPathSelector:void 0};_&&_.childrenBackendIds.push(I);let nt=m.index.indexOf(C);if(nt!==-1){let Se=m.value[nt];o[Se]=me;let De=n[Se]?.frameId;me.ownedFrameId=De!==void 0?e[De]:void 0}for(let Se of Object.keys(me.bounds)){let De=Se;me.bounds[De]!==null&&(me.bounds[De]/=t)}let ue=j!==void 0?p[j]??[]:[];for(let Se=0;Se<ue.length&&!(Se>=Ha.length);Se++){let De=ue[Se];if(De===void 0||isNaN(De))continue;let rt=e[De];if(rt===void 0)continue;let ft=Ha[Se];me.computedStyles[ft]=rt}for(let Se=0;Se<P.length;Se+=2){let De=P[Se],rt=P[Se+1];if(!De||!rt)continue;let ft=e[De],Pn=e[rt];!ft||!Pn||(me.attributes[ft]=Pn)}w.index.includes(C)&&(me.attributes.checked="true"),i[me.backendNodeId]=me}return i[h[0]]}function Rd(n,e){if(n.mPathSelector)return n.mPathSelector;let t=n.parent,r;if(!t)r=n.tagName;else if(n.tagName==="body")r="body";else{let i=t.childrenBackendIds.filter(l=>e.backendIdToNode[l]?.nodeType===1&&!e.backendIdToNode[l]?.psuedoType).indexOf(n.backendNodeId),s=` > ${n.tagName}:nth-child(${i+1})`;r=`${Rd(t,e)}${s}`}return n.mPathSelector=r,r}function yS({originalNode:n,candidate:e,logKey:t,logger:r}){if(!e.bounds)return r.debug({candidate:e},"Filtering out click candidate since it has no bounding box"),!1;let o=n.bounds,i=o.x??0,s=o.width??0,a=o.height??0,l=i+s,c=o.y??0,p=c+(o.height??0),d=e.bounds,u=d.width??0,m=d.height??0,h=d.x??0,g=h+(d.width??0),f=d.y??0,S=f+(d.height??0);return h<l&&g>i&&f<p&&S>c?Math.abs(s-u)<200||Math.abs(a-m)<200?!0:(Nr({logger:r,logKey:t,maxCount:5,intervalMs:3e3},{candidate:e,originalNode:n},"Filtering out click candidate since it has a significantly different area"),!1):(Nr({logger:r,logKey:t,maxCount:5,intervalMs:3e3},{candidate:e},"Filtering out click candidate since it does not intersect with the original node"),!1)}function $a(n,e,t){let r=Object.values(e.backendIdToNode),o,i=ZA();for(let c of r)if(c.attributes?.[wt]===n){o=c;break}if(!o)return[];let s=[],a=e.backendIdToNode[o.parentBackendNodeId??-1];for(;a&&(a?.momenticIgnored||!yS({originalNode:o,candidate:a,logKey:i,logger:t}));)a=e.backendIdToNode[a.parentBackendNodeId??-1];a&&s.push(a);let l=[o];for(;l.length;){let c=l.shift();for(let p of c.childrenBackendIds??[]){let d=e.backendIdToNode[p];d&&!d.momenticIgnored&&yS({originalNode:o,candidate:d,logKey:i,logger:t})?s.push(d):d&&l.push(d)}}return s}function bS(n,e){return n.parentBackendNodeId!==null?e.backendIdToNode[n.parentBackendNodeId]:n.frameIndex===0?void 0:e.frameIndexToIframeNode[n.frameIndex]}var eI=["html","#document","#document-fragment"];function xS({node:n,domGraph:e}){let t=[],r=n,o=bS(n,e);if(!o)return[n.tagName];let i=()=>{if(r=o,o=bS(o,e),!o&&r.frameIndex!==0)throw new Error("No parent node but not in main frame")},s=0;for(;o&&s<1e6;){if(s++,eI.includes(r.tagName)){i();continue}if(r.tagName==="body")t.push("body");else{let l=!1,c=1;for(let p=0;p<o.childrenBackendIds.length;p++){let d=o.childrenBackendIds[p],u=e.backendIdToNode[d];if(d===r.backendNodeId){t.push(`${r.tagName}:nth-child(${c})`),l=!0;break}else u?.nodeType===1&&!u.psuedoType&&c++}if(!l)throw new Error(`Could not find child (${r.tagName}) in parent's children list (${o.tagName})`)}i()}return t.reverse()}function TS(n,e){let t=n.locator("html"),r=[];for(let o=0;o<e.length;o++){let i=e[o];if(r.push(i),i.startsWith("iframe")){let s=r.join(" > ");r=[],o<e.length-1?t=t.frameLocator(s):t=t.locator(s)}}if(r.length&&(t=t.locator(r.join(" > "))),"owner"in t)throw new Error("Final locator from mpath is a frame locator");return t}async function ES(n,e){await n.send({method:"DOM.getDocument",params:{depth:0},timeout:2e3});let t=await n.send({method:"DOM.requestNode",params:{objectId:e},timeout:2e3}),o=(await n.send({method:"DOM.getAttributes",params:{nodeId:t.nodeId},timeout:2e3})).attributes,i=ir(o,wt);if(!i)throw new Error(`Could not find attribute ${wt} for object ${e}`);return i}function CS(n){let e=[];for(let t=0;t<n.domGraph.roots.length;t++){let r=n.domGraph.roots[t],o=tI({root:r,domGraph:n.domGraph,existingHashes:n.existingHashes,flagStore:n.flagStore,logger:n.logger});e=e.concat(o)}return e}function tI(n){let{root:e,domGraph:t,existingHashes:r}=n,o=[],i=[e];for(;i.length;){let s=i.pop();if(s.nodeType===1&&s.tagName.toLowerCase()==="svg"){let a=ja(s,t);a&&!r[a.hash]&&o.push(a)}for(let a of s.childrenBackendIds){let l=t.backendIdToNode[a];l&&i.push(l)}}return o}var rI=["focusable","keyshortcuts","controls","live","relevant","orientation"],oI=["selected","readonly","modal","required","invalid"],iI=["id","name","role","content"],RS=["absolute","fixed","sticky"],sI=["path"],aI=["statictext","textbox","checkbox","combobox","iframe","rootwebarea","table","caption","columnheader","rowheader","gridcell","grid","row","rowgroup","cell","image","graphics-symbol","graphics-document","graphics-object","svgroot","button","link","list","listitem","tablist","tabpanel","tab","searchbox","menu","menubar","form","dialog","alertdialog","banner","navigation","main","menuitem","menuitemcheckbox","menuitemradio","option","radio","progressbar","switch","tree","treeitem","separator"],lI=["activeAriaModalDialog","activeFullscreenElement","activeModalDialog","ariaHiddenElement","ariaHiddenSubtree","hiddenByChildTree","inertElement","inertSubtree","notRendered","notVisible"],cI=["menulistpopup","statictext","inlinetextbox"],dI=80,AS=100,Wa=["StaticText","ListMarker","RootWebArea","LineBreak","emphasis","::before","::after"],pI=["cite"],uI={LabelText:["label"],listitem:["li"],image:["img","svg"],link:["a"],RootWebArea:["#document"],paragraph:["p"],LineBreak:["br"],separator:["hr"],"graphics-symbol":["svg","rect"],gridcell:["td","th"],SvgRoot:["svg"],navigation:["nav"],cell:["td","th"],row:["tr"],list:["ul"],heading:["h1","h2","h3","h4","h5","h6"]},mI={name:!0,value:!0,title:!0,alt:!0,placeholder:!0,checked:!0,selected:!0,contenteditable:!0},IS={indentLevel:0},Id=class n{id;role;name;nameSources;tagName;content;properties;internalProperties;dataMomenticId;pathFromRoot;parent;children;parentFrame;domNode;backendNodeId;ignoredByCDP;constructor(e){if(this.id=e.id,this.role=e.role,this.name=e.name,this.nameSources=e.nameSources,this.content=e.content,this.properties={},this.pathFromRoot=e.pathFromRoot,this.children=e.children,this.backendNodeId=e.backendNodeID,this.ignoredByCDP=e.ignoredByCDP,this.internalProperties=e.internalProperties??{},this.parentFrame=e.parentFrame,e.properties&&e.properties.forEach(t=>{t.name==="keyshortcuts"?this.dataMomenticId=parseInt(t.value.value):this.properties[t.name]=t.value.value}),e.domNode){this.domNode=e.domNode,this.tagName=e.domNode.tagName||void 0;let t=e.domNode.attributes.id;this.name=this.name||e.domNode.attributes.name||(t&&!gS(t)?t:""),this.role=this.role||(e.domNode.attributes.role??""),SI(this.properties,e.domNode)}bI(this)}getSerializedFormWithContext(){return this.serialize({noId:!0,maxLevel:1,neighbors:1})}getNodeOnlySerializedForm(){return this.serialize({noId:!0,noChildren:!0,noContent:!0})}getLogForm(){return JSON.stringify({id:this.id,name:this.name??"",role:this.role??"",backendNodeId:this.backendNodeId})}isInteresting(){if(this.domNode&&this.domNode.tagName==="div"&&!this.domNode.bounds.x&&!this.domNode.bounds.y&&!this.domNode.bounds.width&&!this.domNode.bounds.height||this.domNode&&sI.includes(this.domNode.tagName))return!1;if(aI.includes(this.role.toLowerCase()))return!0;if(this.domNode?.computedStyles.display==="contents")return!1;if(this.role.toLowerCase()==="inlinetextbox"&&this.tagName||!this.properties.hidden&&(this.properties.focusable||this.properties.settable)||Dn.alwaysInterestingTruthyPropertyNames.some(t=>!!this.properties[t]))return!0;let e=this.properties.class;return typeof e=="string"&&e.split(" ").some(t=>kS(t))?!0:this.children.every(t=>t.role==="StaticText")&&this.internalProperties?.inCodeMirrorEditor?!1:this.children.some(t=>t.role==="StaticText")?!0:!!this.name.trim()||!!this.content||Object.keys(this.properties).some(t=>t.startsWith("data"))}serialize(e=IS){let t=Object.assign({},IS,e),{indentLevel:r,noChildren:o,noProperties:i,noId:s,noContent:a,condensedMode:l}=t,c=Ad(this.properties),p=" ".repeat(r),d=this.role||"",u=this.tagName??"unknown",m=this.name;d==="heading"&&m==="heading"&&(m=""),this.nameSources?.find(E=>!E.superseded&&E.type==="contents")&&this.children.length>0&&(m="");let g=this.nameSources?.find(E=>!E.superseded);if(g&&!g.nativeSource&&g.type==="relatedElement"){let E=g.attributeValue?.relatedNodes??[];E.length===1&&E[0].text&&E[0].text===m&&(m="")}let f=Wa.includes(this.role)||pI.includes(this.tagName||"");if(this.role==="StaticText"||this.role==="ListMarker")return`${p}${m}
|
|
3543
3545
|
`;let S=`${p}<${u}`;!s&&!f&&(S+=` id="${this.id}"`);let x=a??!1;(c.multiline||c.contenteditable)&&this.children.length>0&&(x=!0),d&&d!=="generic"&&d!==u&&!(uI[d]??[]).includes(u)&&(S+=` role=${JSON.stringify(d)}`),m&&(S+=` name=${JSON.stringify(m)}`),this.content&&!x&&(S+=` content=${JSON.stringify(this.content)}`);let b=Date.now();if(Object.keys(c).length>0&&!i){if(Date.now()-b>1e3)throw new Error(`Serialization for the HTML element with tag ${u} and internal ID ${this.id} took too long. Please ensure your machine has enough resources to run Momentic.`);Object.entries(c).forEach(([E,C])=>{if(!rI.includes(E)){{if(oI.includes(E)&&(!C||C==="false"))return;if(E==="value"&&x&&(c.type==="text"||this.role==="textbox"))return;if(E==="level"&&`${C}`=="1")return;if(E==="url"&&c.src&&u==="img")return;if(E==="url"&&c.href&&u==="a")return;if(E==="editable"&&C==="plaintext")return;if(E==="type"&&C===u)return;if(l&&!mI[E])return}typeof C=="string"?S+=` ${E}="${Me(C,AS,!0)}"`:typeof C=="boolean"?C?S+=` ${E}`:S+=` ${E}={false}`:typeof C<"u"&&(S+=` ${E}={${Me(JSON.stringify(C),AS,!0)}}`)}})}if(u==="::before"||u==="::after"){let E="";for(let C of this.children)E+=C.serialize({...e,indentLevel:r,neighbors:0});return E}let w=e.maxLevel!==void 0&&r/2>=e.maxLevel;if(this.children.length===0||o||w)S+=` />
|
|
3544
3546
|
`;else{let E="";for(let I of this.children)E+=I.serialize({...e,indentLevel:r+2,neighbors:0});let C=E.trim();C.length<=dI&&!C.includes(`
|
|
3545
3547
|
`)?S+=`>${C}</${u}>
|
|
@@ -3575,7 +3577,7 @@ ${i.stack}`),a.status(500).send("Internal Server Error")}),n){let i=zw.static(n,
|
|
|
3575
3577
|
|
|
3576
3578
|
Using Command Prompt on Windows:
|
|
3577
3579
|
for /f "tokens=5" %a in ('netstat -ano ^| findstr :58888') do taskkill /PID %a /F
|
|
3578
|
-
`)}import p_ from"events";import Cu from"fs";import u_ from"open";import ec from"path";import{fileURLToPath as m_}from"url";import lN from"diff-lines";import{gt as cN}from"semver";import{execSync as Wk}from"child_process";import{platform as Gk}from"os";function Kp(){return Ww()?(y.info("Setting device pixel ratio to 2 automatically since a Mac OS Retina screen was detected."),y.info("If you are using a low pixel-density monitor, you should manually set --pixel-ratio to 1 to avoid incorrect viewport calculations."),y.info("Confirm your device's pixel-ratio at https://www.mydevice.io."),2):(y.info("Setting device pixel ratio to 1."),y.info("If you are using Momentic on a high-pixel density (HiDPI) monitor, relaunch with the --pixel-ratio option to avoid incorrect viewport calculations"),y.info("Confirm your device's pixel-ratio at https://www.mydevice.io."),1)}function Ww(){return Gk()==="darwin"&&Wk("system_profiler SPDisplaysDataType").toString().includes("Retina")}function Yp(n){Ww()&&n===1&&(y.warn("If you are using Momentic on a Retina screen, relaunch with the --pixel-ratio option to avoid incorrect viewport calculations."),y.warn("Confirm your device's pixel-ratio at https://www.mydevice.io."))}import Vk from"@actions/exec";import qk from"@actions/io";import Kk from"quote";import Yk from"string-argv";async function Gw(n,e=!0){let t=Yk(n),r=await qk.which(t[0],!0),o=t.slice(1),i=Vk.exec(Kk(r),o,{delay:100});if(e)return i}import{existsSync as Jk,statSync as Xk}from"fs";var Ll=!!process.env.CI||!process.stdout.isTTY||!!process.env.TF_BUILD;function Es(n){try{return Jk(n)&&Xk(n).isDirectory()}catch(e){return y.error({err:e},`Error reading path ${n} during directory existence check`),!1}}import Zk from"csv-parser";import{createReadStream as Qk}from"fs";function Jp(n){return new Promise((e,t)=>{let r=[];Qk(n).pipe(Zk()).on("data",o=>r.push(o)).on("end",()=>e(r)).on("error",o=>t(o))})}import Ol from"semver";import{z as kl}from"zod";var Ht="1.1.
|
|
3580
|
+
`)}import p_ from"events";import Cu from"fs";import u_ from"open";import ec from"path";import{fileURLToPath as m_}from"url";import lN from"diff-lines";import{gt as cN}from"semver";import{execSync as Wk}from"child_process";import{platform as Gk}from"os";function Kp(){return Ww()?(y.info("Setting device pixel ratio to 2 automatically since a Mac OS Retina screen was detected."),y.info("If you are using a low pixel-density monitor, you should manually set --pixel-ratio to 1 to avoid incorrect viewport calculations."),y.info("Confirm your device's pixel-ratio at https://www.mydevice.io."),2):(y.info("Setting device pixel ratio to 1."),y.info("If you are using Momentic on a high-pixel density (HiDPI) monitor, relaunch with the --pixel-ratio option to avoid incorrect viewport calculations"),y.info("Confirm your device's pixel-ratio at https://www.mydevice.io."),1)}function Ww(){return Gk()==="darwin"&&Wk("system_profiler SPDisplaysDataType").toString().includes("Retina")}function Yp(n){Ww()&&n===1&&(y.warn("If you are using Momentic on a Retina screen, relaunch with the --pixel-ratio option to avoid incorrect viewport calculations."),y.warn("Confirm your device's pixel-ratio at https://www.mydevice.io."))}import Vk from"@actions/exec";import qk from"@actions/io";import Kk from"quote";import Yk from"string-argv";async function Gw(n,e=!0){let t=Yk(n),r=await qk.which(t[0],!0),o=t.slice(1),i=Vk.exec(Kk(r),o,{delay:100});if(e)return i}import{existsSync as Jk,statSync as Xk}from"fs";var Ll=!!process.env.CI||!process.stdout.isTTY||!!process.env.TF_BUILD;function Es(n){try{return Jk(n)&&Xk(n).isDirectory()}catch(e){return y.error({err:e},`Error reading path ${n} during directory existence check`),!1}}import Zk from"csv-parser";import{createReadStream as Qk}from"fs";function Jp(n){return new Promise((e,t)=>{let r=[];Qk(n).pipe(Zk()).on("data",o=>r.push(o)).on("end",()=>e(r)).on("error",o=>t(o))})}import Ol from"semver";import{z as kl}from"zod";var Ht="1.1.7",eN="https://registry.npmjs.org/momentic",tN=kl.object({versions:kl.record(kl.string(),kl.unknown()).optional()});async function Vw(n){try{await nN(n)}catch(e){y.warn({err:e},"Failed to check CLI version against NPM servers")}}async function nN(n){if(!Ht){n.warn("Unable to check CLI version because CLI_VERSION is not set");return}let e;for(let r=0;r<2;r++)try{let o=await U(fetch(eN),{milliseconds:5e3});if(!o.ok)throw new Error(`Got error status code ${o.statusText}`);let i=await o.json();e=tN.parse(i).versions;break}catch(o){n.warn({err:o},"Failed to fetch npm registry data")}if(!e){n.warn("Failed to fetch npm registry data. Skipping version check.");return}let t;for(let r of Object.keys(e))Ol.valid(r)&&(!t||Ol.gt(r,t))&&Ol.gt(r,Ht)&&Ol.lt(r,"2.0.0")&&!r.includes("alpha")&&(t=r);t&&(y.warn(`Update available: v${Ht} -> v${t}`),y.warn("This version may be missing critical fixes, features, and security updates."),y.warn(`Run "npx momentic@${t} -V" to update`))}import{existsSync as oN,mkdirSync as iN,statSync as sN}from"fs";import{dirname as aN}from"path";import Kw from"readline/promises";import{hostname as rN}from"os";var Q=Cl({app:"cli",clientToken:"pub7eb923f18fb3f1d42ac5eba8c5ea13a5",hostname:rN(),disableConsoleLogs:!0}).child({version:"1.1.7"});var Xp=!1,Yw=(()=>{try{return sN("/.dockerenv"),!0}catch{return!1}})();async function lt(n,e){if(Ll||Xp||Yw)return!0;Q.flush(),await new Promise(s=>setTimeout(s,500));let t=Kw.createInterface({input:process.stdin,output:process.stdout}),r=n.split("."),o;if(r.length===1)o=n;else{let s=`${r.slice(0,r.length-1).join(".").trim()}.`;e?y.warn(s):y.log(s),o=r[r.length-1].trim()}let i=await t.question(`${o} ('y' for yes / n for no / 'A' to accept all) `);return t.close(),i==="A"?(Xp=!0,setTimeout(()=>{Xp=!1},3e3),!0):i.toLowerCase()==="y"}async function Zp(n){let e=aN(n);return Es(e)?oN(n)?lt(`File '${qw(n)}' already exists. Overwrite existing content?`,!0):!0:await lt(`Directory '${qw(e)}' doesn't exist. Create it now?`,!0)?(iN(e,{recursive:!0}),!0):!1}function qw(n){return n.replace(/(\s+)/g,"\\$1")}async function Jw(n,e){if(Ll||Yw)return e;let t=Kw.createInterface({input:process.stdin,output:process.stdout}),r=await t.question(`${n} `);return t.close(),r.trim()||e}async function Xw({test:n,fragment:e,entities:t,client:r,logger:o,yes:i}){cN(e.schemaVersion,He)&&(y.error(`This version of the CLI does not support the schema version of the fragment (${e.schemaVersion}). Please update to the latest version of the CLI and retry this command.`),process.exit(1)),Ng(e.steps).forEach(g=>{t.modules[g]||(y.error(`The test patch contains a module with id ${g} that could not be found in the current project. This suggests that either this test patch or your local file system may be out of date.`),process.exit(1))}),e.createdAt.getTime()<Date.now()-7*24*60*60*1e3&&!i&&!await lt("The test patch you are applying is more than 7 days old. Are you sure you want to continue?",!0)&&process.exit(1);let a=n.lastModified.getTime();e.createdAt.getTime()+60*60*1e3<a&&!i&&!await lt("The test patch you are applying was created before the test was last updated. Are you sure you want to continue?",!0)&&process.exit(1);let l=ns(n.fullFilePath,o,t),c=l.steps;if(!Array.isArray(c))throw new Error(`Test ${n.fullFilePath} is missing steps array`);let p,d;if(e.schemaVersion!==He){let{steps:g,newVersion:f}=await Wi({metadata:{id:e.id,schemaVersion:e.schemaVersion},steps:e.steps,logger:y});p=f,d=ve.array().parse(g)}else d=ve.array().parse(e.steps);let{stepsToSave:u,moduleUpdates:m}=await Xe({stepLists:{steps:d}});u.beforeSteps=l.beforeSteps??void 0,u.afterSteps=l.afterSteps??void 0;let h=lN(JSON.stringify(c,void 0,2),JSON.stringify(u,void 0,2),{n_surrounding:5});y.dimmed("=".repeat(30)),y.dimmed(h),y.dimmed("=".repeat(30)),y.dimmed(""),p&&y.warn(`If this patch is applied, your test will also be automatically upgraded to the latest schema version (${p}). Schema upgrades have no impact on functionality, although you may notice minor differences in the test YAML.`),!i&&!await lt("Do you want to apply this patch?")&&(y.dimmed("Cancelled."),process.exit(1)),Yr(n.relativePath,u,p??e.schemaVersion,t.project),y.success("Patch applied successfully."),await r.patchTestFragment(e.id,{applied:!0,appliedAt:new Date})}import{randomUUID as Zw}from"crypto";async function Qw({fix:n,project:e}){let t=ke(e,y),r=Object.values(t.tests),o={},i={},s=new Set,a=0;for(let l of r)try{let c=ns(l.fullFilePath,Q,t),p=c.steps;if(!p||p.length===0||!Array.isArray(p)){y.debug(`Test ${l.name} (${l.relativePath}) has no steps, skipping...`);continue}let d=Nt.parse(c),u=await dd(d,p,y),m=!1,h=!1;u.steps.forEach((g,f)=>{if(!g.id){y.error(`Step ${f} in test '${l.name}' (${l.relativePath}) does not have an ID`),h=!0;return}let S=o[g.id]?.testId,x=o[g.id]?.testRelativePath;if(S?(a++,h=!0,S===l.id?y.error(`Multiple steps in the test '${l.name}' (${l.relativePath}) have the same ID '${g.id}'`):y.error(`Step ${f} in test '${l.name}' (${l.relativePath}) has the ID ${g.id} which is duplicated in test ${x}`),n&&(m=!0,g.id=Zw())):o[g.id]={testId:l.id,testRelativePath:l.relativePath},g.type!=="PRESET_ACTION")return;let b=g.command.id,w=i[b]?.testId,E=i[b]?.testRelativePath;w?(a++,h=!0,w===l.id?y.error(`Multiple commands in the test '${l.name}' (${l.relativePath}) have the same ID '${b}'`):y.error(`Command ${f} in test '${l.name}' (${l.relativePath}) has the ID ${b} which is duplicated in test ${E}`),n&&(m=!0,g.command.id=Zw())):i[b]={testId:l.id,testRelativePath:l.relativePath}}),h&&y.dimmed("=".repeat(80)),m&&n&&(Yr(l.relativePath,{beforeSteps:c.beforeSteps,steps:u.steps,afterSteps:c.afterSteps},He,e),s.add(l.fullFilePath))}catch(c){y.error({err:c},`Failed to parse test ${l.name} (${l.relativePath})`);continue}a>0?(y.error(`Found errors in ${a} steps`),n?y.warn(`Modified the following files:
|
|
3579
3581
|
${[...s].map(l=>`- ${l}`).join(`
|
|
3580
3582
|
`)}`):y.warn("To fix these errors automatically, re-run this check with the --fix flag and then commit the resulting changes"),process.exit(1)):(y.success("No step ID errors found!"),process.exit(0))}async function ev({project:n}){let e=ke(n,y),t=Object.values(e.tests),r=await ol(e,Q),o={},i={},s={},a={},l=new Set,c=new Set,p=new Set,d=new Set;for(let m of t)o[m.id]?s[m.id]?s[m.id].push(m.fullFilePath):s[m.id]=[o[m.id],m.fullFilePath]:o[m.id]=m.fullFilePath,i[m.name]?a[m.name]?a[m.name].push(m.fullFilePath):a[m.name]=[i[m.name],m.fullFilePath]:i[m.name]=m.fullFilePath;for(let m of r)d.has(m.moduleId)&&l.add(m.moduleId),p.has(m.name)&&c.add(m.name),d.add(m.moduleId),p.add(m.name);if(Object.entries(s).length>0||Object.entries(a).length>0||l.size>0||c.size>0){for(let[m,h]of Object.entries(s))for(let g of h)y.error(`Test ID ${m} is duplicated in ${g}`);for(let[m,h]of Object.entries(a))for(let g of h)y.error(`Test Name ${m} is duplicated in ${g}`);for(let m of l)y.error(`Module id ${m} is duplicated in your project`);for(let m of c)y.error(`Module name ${m} is duplicated in your project`);process.exit(1)}y.success("No duplicates detected. All test and module names and ids are unique."),process.exit(0)}import{cloneDeep as dN}from"lodash-es";async function Nl({client:n,skipPrompts:e,project:t}){let r=await n.getAllEnvironments(),o=dN(t.config);o.environments||(o.environments=[]);for(let i of r){let s=o.environments?.find(a=>a.name===i.name);if(s)!e&&!await lt(`Environment ${i.name} already exists in the project configuration file. Would you like to overwrite its variables?`)&&process.exit(1),s.baseUrl=i.variables[Pe],delete i.variables[Pe],s.envVariables=i.variables;else{let a=i.variables[Pe];delete i.variables[Pe],o.environments.push({name:i.name,baseUrl:a,envVariables:i.variables})}}Zo(o,t.configFilePath),y.success(`Pulled ${r.length} environments successfully! Please make sure to commit any changes to your project configuration file.`)}import{createHash as tv}from"crypto";import nv from"fs";async function ov({testsToFetch:n,client:e,all:t,yes:r}){let{tests:o,modules:i}=await e.getTestYAMLExport({paths:n,all:t}),s=0;for(let[l,c]of Object.entries(o)){let p=rv(l,he.TEST);!r&&!await Zp(p)||(s+=1,nv.writeFileSync(p,c,"utf-8"),Q.info({checksum:tv("md5").update(c).digest("hex")},`Wrote '${p}'`))}let a=0;for(let[l,c]of Object.entries(i)){let p=rv(l,he.MODULE);!r&&!await Zp(p)||(a+=1,nv.writeFileSync(p,c,"utf-8"),Q.info({checksum:tv("md5").update(c).digest("hex")},`Wrote '${p}'`))}s===0?y.success("Pulled 0 tests."):y.success(`Pulled ${s} test${s>1?"s":""}${a?` and ${a} module${a>1?"s":""}`:""}!`)}function rv(n,e){switch(e){case he.TEST:return`${Le(n)}.${_t.TEST}`;case he.MODULE:return`${Le(n)}.${_t.MODULE}`;default:throw new Error(`Unknown entity type ${e}`)}}async function iv(n){let{project:e,client:t,skipPrompts:r}=n;y.info("Welcome to the Momentic Cloud importer wizard! \u{1F636}\u200D\u{1F32B}\uFE0F"),y.info("Importing environments from Momentic Cloud."),y.info(`This command will overwrite all local environment configuration in ${e.configFilePath} with environments from Momentic Cloud.`),await lt("Are you sure you want to proceed?",!0)||(y.info("Aborting..."),process.exit(1)),await Nl({client:t,project:e,skipPrompts:r}),y.success(`Successfully imported environments from Momentic Cloud. We recommend pulling secrets out of ${e.configFilePath} into .env files or dynamically set environment variables for security.`),y.info("Importing tests and modules from Momentic Cloud."),await ov({testsToFetch:[],client:t,all:!0,yes:r}),y.success("Successfully imported tests and modules from Momentic Cloud. You can move them to the desired location in your project. We recommend committing these files to version control so you can share them with team members and run Momentic tests in CI.")}import $t from"fs";import Qr from"path";import pN from"yaml";function sv(){Es("momentic")||(y.error(`The migration command should be ran from the v0 root Momentic directory, which should contain a folder called 'momentic'. No folder named 'momentic' was found in the current working directory (${process.cwd()}).`),process.exit(1));let n={name:"default",include:vs,environments:[]};y.info("Migrating environments");let e=av(["momentic/environments"],uN);for(let r of e){let o=pN.parse($t.readFileSync(r,"utf-8"));try{let i=Ys.parse(o),s=i.variables[Pe]??"";delete i.variables[Pe],n.environments?.push({name:i.name,baseUrl:s,envVariables:i.variables})}catch(i){y.error(`${r} failed to parse as a valid environment file.`),y.error(i),process.exit(1)}}y.info("Migrating tests");let t=pp("./momentic",y);for(let r of t){let o=Qr.join(...r.fullPathSegments),i=Qr.join(Qr.dirname(o),`${r.fileName.slice(0,-5)}.test.yaml`);y.info(`Moving test ${o} to ${i}`),$t.renameSync(o,i)}if(Es("momentic/modules")){y.info("Migrating modules");for(let r of $t.readdirSync("./momentic/modules")){if(!r.endsWith(".yaml"))continue;let o=Qr.resolve(Qr.join("./momentic/modules",r));if(!$t.readFileSync(o,"utf-8").includes("schemaVersion")){y.warn(`Skipping file ${o} since it does not have valid Momentic module contents`);continue}let s=`${o.slice(0,-5)}.module.yaml`;y.info(`Moving module ${o} to ${s}`),$t.renameSync(o,s)}}return y.info("Writing new project configuration file"),Zo(n,"momentic.config.yaml"),$t.rmSync("./momentic/environments",{recursive:!0,force:!0}),$t.rmSync("./momentic/fixtures",{recursive:!0,force:!0}),y.success("Migration succeeded!"),y.info("Going forward:"),y.info(` - You can store test and module files anywhere under the project root (${process.cwd()})`),y.info(" - Environment details and other common options are tracked in the root momentic.config.yaml file"),n}function av(n,e,t=new Set){for(let r of n){let o=Qr.resolve(r),i=!1;try{i=$t.existsSync(o)&&$t.statSync(o).isDirectory()}catch(s){y.error({err:s},`Error reading path ${o} during collect paths`)}if(o&&i){let s=$t.readdirSync(o).map(a=>Qr.join(o,a));av(s,e,t);continue}if(o.endsWith(".yaml")){try{if(!$t.existsSync(o)||!$t.statSync(o).isFile()){y.warn(`File not found or unreadable: ${o}`);continue}}catch(s){y.error({err:s},`Error reading file ${o} during collect paths`);continue}if(!e(o))continue;t.add(o)}}return t}function uN(n){return n.endsWith(".yaml")?$t.readFileSync(n,"utf8").includes("momentic/environment")?!0:(y.warn(`Skipping YAML that is not a Momentic environment: ${n}`),!1):!1}import{Argument as ii,Option as Ne}from"@commander-js/extra-typings";import{validateHeaderValue as mN}from"http";import{cpus as lv}from"os";import{parse as Lpe}from"yaml";import{z as q}from"zod";var _l=58888,Qp=30*60*1e3,jn=new Ne("--api-key <key>","API key for authentication. If not supplied, attempts to read the MOMENTIC_API_KEY env var."),gr=new Ne("--server <server>","Momentic server to use. Leave unchanged unless using Momentic on-premise."),fr=new Ne("-y, --yes","Skip all confirmation prompts."),eu=new Ne("-w, --wait","Wait for tests to finish running before exiting. Only applicable when running tests remotely").implies({remote:!0}),tu=new Ne("--wait-timeout <waitTimeout>",`The maximum number of seconds to wait for tests to complete. Only applicable when the --wait option is specified. Defaults to ${Qp/1e3} seconds.`),Ml=new Ne("--custom-headers <customHeaders...>","Specify custom headers in the form HEADER=VALUE to be sent with each request during the test. Multiple entries can be provided."),nu=new Ne("--no-report","Skip reporting test results to Momentic Cloud when running with the --local flag.").implies({local:!0}),dv=new Ne("--reporter <reporter>","Output report files in a standardized format to a local directory. See the --reporter-dir flag for information on the output directory.").choices(Object.values(Mi)),pv=new Ne("--reporter-dir <reporterDir>","Output directory to store report files. Relative paths are resolved relative to the project root, which is defined by the detected momentic.config.yaml. Defaults to 'reports' if unset."),ru=new Ne("--output-dir <outputDir>","[Alpha] Output directory to store run artifacts such as screenshots, results, and logs. Relative paths are resolved relative to the project root, which is defined by the detected momentic.config.yaml. This directory will be cleared at the start of execution."),uv=new Ne("--include <includePatterns...>","Only include tests that match the provided regex patterns. Multiple patterns can be provided. The patterns will be matched against the test file paths and the pattern only needs to match a part of the path for the test to be included."),mv=new Ne("--exclude <excludePatterns...>","The inverted version of --include: a test that matches any of the provided exclusion patterns will be excluded from running."),ou=new Ne("--pixel-ratio <pixelRatio>","Device pixel ratio of your screen or monitor. Mac OS Retina displays and machines marketed as 'HiDPI' should set this to 2. Visit https://www.mydevice.io/ to find your device's pixel ratio."),hv=new Ne("--port <port>",`Port to run the app on. Defaults to ${_l}.`),iu=new Ne("--input-csv <inputCsv>","Path to a CSV file on disk where each row represents a set of inputs that will be made available to all tests that are ran. The first line of the CSV must be the input names."),Fl=new Ne("--env <env>","Name of the environment to use when running tests."),Dl=new Ne("--url-override <urlOverride>","Fully qualified url (e.g. https://www.google.com) to start all tests from. Overrides any default starting url set from the test or environment."),gv=new Ne("--shard-index <shardIndex>","The index of the shard to run tests for. Defaults to 1.").default(1).argParser(n=>parseInt(n,10)),Sr=new Ne("-c, --config <configPath>","Absolute or relative path to a Momentic configuration file (*.momentic.config.yaml)"),su=new Ne("-f, --filter <filter>","Run tests within the project that has a name equal to the filter provided. This option cannot be used together with file path or directory arguments, but substring matches are allowed."),fv=new Ne("--shard-count <shardCount>","The number of shards that tests are being run on. Defaults to 1.").default(1).argParser(n=>parseInt(n,10)),Sv=new Ne("--fix","Attempt to fix any issues found. This option will write changes to your local file system."),yv=new ii("<tests...>",`One or more test paths to queue on Momentic Cloud.
|
|
3581
3583
|
|
|
@@ -3591,7 +3593,7 @@ ${n.map(d=>` - ${d}`).join(`
|
|
|
3591
3593
|
`),n.forEach(d=>{if(!uu.existsSync(d))throw new Error(`Path '${d}' does not exist.`);let u,m;try{u=uu.statSync(d),m=u.isDirectory()}catch(g){y.warn({err:g},`Skipping path ${d} because it cannot be read`);return}let h=mu.resolve(d);Object.values(e.tests).filter(g=>m?g.fullFilePath.startsWith(h):g.fullFilePath===h).forEach(g=>{a.add(g.fullFilePath)})})):(y.info(`Reading all tests from the project and running those matching the following substring filters:
|
|
3592
3594
|
${n.map(d=>` - ${d}`).join(`
|
|
3593
3595
|
`)}`),Object.values(e.tests).forEach(d=>{n.some(u=>d.relativePath.includes(u))&&a.add(d.fullFilePath)}))}else{!r&&!await lt("No test paths or substrings were provided. Do you want to run all tests?")&&(y.error("Cancelled by user."),process.exit(1));let c=Object.values(e.tests);y.info(`Reading all ${c.length} tests in the project from local disk.`),c.forEach(p=>{a.add(p.fullFilePath)})}for(let c of a){let p=mu.relative(t.rootDir,c);o&&!o.some(d=>new RegExp(d).test(p))&&a.delete(c),i&&i.some(d=>new RegExp(d).test(p))&&a.delete(c)}let l=Array.from(a).map(async c=>{try{let p=await rs(c,Q,e);if(BN.gt(p.schemaVersion,He)&&y.warn(`Test ${c} has schema version ${p.schemaVersion}, which is greater than what is currently supported by this SDK. Please update your momentic package version to avoid unexpected behavior.`),p.disabled)return null;if(s&&s.length>0){let d=p.labels||[];if(!s.some(m=>d.includes(m)))return null}return{...p,fullFilePath:c,relativeFilePath:mu.relative(t.rootDir,c)}}catch(p){y.error(`Failed to read and resolve test at '${c}': ${p}`),process.exit(1)}});return Promise.all(l).then(DN)}import{cloneDeep as Gv}from"lodash-es";async function jv({orgId:n,codeEvalTools:e,logger:t,outputDefinitions:r,testContext:o,flagStore:i}){let s={};for(let a of r){let{name:l,value:c}=a;s[l]=await Ut({orgId:n,s:c,localTools:e,logger:t,context:o,flagStore:i})}return s}async function Hv({baseUrl:n,envName:e,devicePixelRatio:t,apiClient:r,test:o,storageClient:i,codeEvalTools:s,generator:a,orgId:l,variables:c,logger:p,customHeaders:d,testInputs:u,localBrowserConfig:m,visualDiffScreenshotStorage:h,flagStore:g}){let f=await za({advanced:{...m,...o.advanced},customHeaders:d,envVariables:c,envName:e,baseUrl:n,logger:p,localTools:s,orgId:l,flagStore:g}),S={baseUrl:r.baseUrl,apiKey:r.apiKey,logger:Q};f.browserType==="Google Chrome"&&await eo(["chrome"]);let x=g.isBooleanFlagEnabled("icon_knowledge_base")?await i.fetchIconKnowledgeBase(l,p):null,b;try{b=await dn.init({baseUrl:n,logger:p,userBrowserSettings:f,storage:i,flagStore:g,enricher:new Br(S),contextArgs:{viewport:o.advanced.viewport??Dt,deviceScaleFactor:t},iconKnowledgeBase:x})}catch(C){let I=C.message;if(I.includes("Executable doesn't exist")||I.includes("install your dependencies"))y.error("The headless browser used by Momentic is not installed correctly. Re-installing the necessary dependencies before starting the test. We strongly recommend installing browsers correctly before execution."),await eo(au,!0),b=await dn.init({baseUrl:n,logger:p,userBrowserSettings:f,storage:i,flagStore:g,enricher:new Br(S),contextArgs:{viewport:o.advanced.viewport??Dt,deviceScaleFactor:t},iconKnowledgeBase:x});else throw C}let w=new Bo({browser:b,generator:a,logger:p,orgId:l,scratchPadId:void 0,storage:i,flagStore:g,localCodeEvalTools:s,visualDiffScreenshotStorage:h,analytics:new ni,slowMoMs:f.slowMoMs}),E=new Pt({baseUrl:n,currentUrl:w.browser.url(),variablesFromEnvironment:c,envName:e});return o.parameters&&await Promise.all(o.parameters.map(async C=>{let{name:I,defaultValue:N,required:P}=C,D=u?.[I];P&&D===void 0&&(y.error(`Required parameter '${I}' is required by test '${o.name}' but not provided`),process.exit(1));let W=await Ut({orgId:l,s:D??N,localTools:s,logger:p,context:Pt.dummyContext(E.getEnvName()),flagStore:g});E.setMomenticSystemVariable(I,W)})),{controller:w,context:E}}import{randomUUID as zN}from"crypto";async function $v({testId:n,apiClient:e,testAdvancedSettings:t,aiSettingsFromEnv:r,logger:o,noReport:i}){if(i)return o.debug("The CLI is not running in a CI environment or --no-report was explicitly passed"),!1;if(t.failureRecovery===!1||t.failureRecovery===void 0&&!r?.failureRecovery)return!1;let s;try{s=await e.getPastTestResults(n,{afterTime:Date.now()-7*24*60*60*1e3})}catch(l){return o.error({err:l},"Test is not eligible for recovery since we failed to fetch the recent test results"),!1}return s.some(l=>l.status==="PASSED")?!0:(o.debug({recentRuns:s},"Test is not eligible for recovery because there are only failures in the past 7 days"),!1)}async function Wv({attemptInputs:n,attemptFixtures:e,attemptMetadata:t}){let{attemptNumber:r,orgId:o,runId:i,runAttemptId:s}=t,{controller:a,context:l,flagStore:c,analytics:p,codeEvalTools:d,storageClient:u,debugDataStorage:m,logger:h,apiClient:g,billingReporter:f,tracer:S}=e,{test:x,orgSettings:b,noReport:w}=n;h.info(`Running test '${x.name}' locally${w?"":` and reporting results to https://app.momentic.ai/runs/${i}`}`);let E={controller:a,storage:u,debugDataStorage:m,billingReporter:f,analytics:p,context:l,logger:h,codeEvalTools:d},C={orgId:o,runId:i||zN(),runAttemptId:s,testMetadata:x,steps:x.steps,beforeSteps:x.beforeSteps,afterSteps:x.afterSteps},I={collectDebugData:!0,reinitializeBrowser:!0,disableHealing:!await $v({noReport:w,currentAttempt:r,testId:x.id,flagStore:c,apiClient:g,testAdvancedSettings:x.advanced,aiSettingsFromEnv:b.ai,logger:h})};return await Ba({fixtures:E,inputs:C,options:I,callbacks:{step:{},test:{onTestComplete:async()=>{await a.browser.cleanup()},onProposedTestSteps:async D=>g.uploadProposedSteps(D,h)}},testParams:{tracer:S}})}async function Vv(n){let{testDefinition:e,logger:t}=n,r=new Date;try{return await jN(n)}catch(o){let i="Fatal error running test";return y.error(`${i}: ${o.message}`),t.error({err:o},i),{parameters:n,failureReason:"UnknownError",failureDetails:{errorMessage:o.message,errorStack:o.stack},status:"FAILED",attempts:0,test:e,filePath:e.relativeFilePath,startedAt:r,lastAttemptStartedAt:r,finishedAt:new Date,outputs:{}}}}async function jN(n){let{testDefinition:e,project:t,apiClient:r,orgId:o,urlOverride:i,runSigIntHandlers:s,runGroupTracer:a,logger:l}=n,c=new Ro(r,o),p=Gv(e.steps);try{await c.resolveStepCacheEntries({organizationId:o,testId:e.id,steps:p,schemaVersion:e.schemaVersion,logger:l})}catch(S){throw l.error({err:S},"Failed to resolve step cache entries"),new Error(`Failed to resolve step cache entries. Please ensure you are running using a supported version of Momentic. If you believe this is a Momentic issue, please contact Support with the following error: ${S}`)}let d=n.envName??$N(e),u,m={};if(d){try{u=os(d,t,l)}catch(S){let x=`Failed to resolve environment ${d} for test ${e.name}: ${S}`;throw new Error(x)}m=u.variables}let h=e.baseUrl;if(i)h=i;else if(!h){let S=m[Pe];typeof S=="string"&&(h=S)}if(!h){let S=`Cannot run test with no base URL and no ${Pe} variable defined in its environment`;throw new Error(S)}let g=await a.startRun({logger:l,originalSteps:{beforeSteps:e.beforeSteps,steps:e.steps,afterSteps:e.afterSteps},testId:e.id,testName:e.name,testLabels:e.labels,baseUrl:h,environmentName:d,schemaVersion:e.schemaVersion}),f=l.child(g.loggerBindings||{});Object.entries(g.envVarBindings||{}).forEach(([S,x])=>{m[S]=x});try{let S=await HN({...n,variables:m,envName:d,stepsWithCaches:p,resolvedEnv:u,baseUrl:h,storageClient:c,tracer:g,logger:f});return await g.finish({logger:l,status:S.status,finishedAt:S.finishedAt,failureDetails:S.failureDetails,failureReason:S.failureReason,isFlake:S.isFlake}),{runId:g.runId,...S}}finally{s?.pop()}}async function HN(n){let{testDefinition:e,stepsWithCaches:t,project:r,regenerateGoldenFiles:o,apiClient:i,generator:s,baseUrl:a,storageClient:l,orgId:c,envName:p,urlOverride:d,customHeaders:u,testInputs:m,variables:h,resolvedEnv:g,noReport:f,retriesOverride:S,devicePixelRatio:x,logUpdate:b,tracer:w,logger:E}=n,C=new Date,I=new ei(r,o),N={ai:r.config.ai},P={envName:p,urlOverride:d,customHeaders:u,testInputs:m},D,W=Math.abs(S??r.config.retries??e.retries??0),_=[];E.info("Starting test run using CLI");for(let B=0;B<=W;B++){let L=await w.startAttempt(),j=E.child(L.loggerBindings||{}),O={...e,steps:Gv(t)};B!==0&&b("RETRY",`attempt ${B+1}/${W+1}`);let ee=new Date,me=await Po.init(c,i),nt=new er({httpClient:new Mt({baseUrl:i.baseUrl,apiKey:i.apiKey,logger:j}),fakerSeed:me.isBooleanFlagEnabled("faker_constant_seed")?ph:void 0});try{let{controller:ue,context:Se}=await Hv({baseUrl:a,envName:p,apiClient:i,devicePixelRatio:x,logger:j,storageClient:l,codeEvalTools:nt,test:O,generator:s,orgId:c,variables:h,customHeaders:u,testInputs:m,localBrowserConfig:g?.browser??r.config.browser,visualDiffScreenshotStorage:I,flagStore:me});D=await Wv({attemptMetadata:{attemptNumber:B+1,orgId:c,runId:w.runId},attemptFixtures:{logger:j,storageClient:l,billingReporter:new xo,analytics:new ni,debugDataStorage:new Or,codeEvalTools:nt,flagStore:me,apiClient:i,context:Se,controller:ue,tracer:L},attemptInputs:{test:O,orgSettings:N,noReport:f}});let De=new Date;await L.finish({logger:j,result:D,updatedSteps:{steps:O.steps,beforeSteps:O.beforeSteps,afterSteps:O.afterSteps}}),_.unshift(D.status);let rt=await jv({orgId:c,codeEvalTools:nt,logger:j,outputDefinitions:e.outputs??[],testContext:Se,flagStore:me}),ft=$m(_),Pn=B+1;if(D.status!=="FAILED")return{...D,parameters:P,test:O,filePath:O.relativeFilePath,startedAt:C,lastAttemptStartedAt:ee,finishedAt:De,attempts:Pn,baseUrl:a,outputs:rt,isFlake:ft};let G=D.failedStepResult,nn=G?.message||"Unknown failure",di=G?.failureReason??vh(nn)??"UnknownError",Ue=j.child({errResult:G,failureReason:di,errorMessage:nn,numAttempts:W+1,name:O.name});if(B<W){Ue.warn(`Retrying failed execution attempt for run: ${nn}`);continue}return Ue.error(`Test failed after all exhausting attempts: ${nn}`),{...D,parameters:P,failureDetails:{errorMessage:nn},failureReason:di,test:O,filePath:O.relativeFilePath,startedAt:C,lastAttemptStartedAt:ee,finishedAt:De,attempts:B+1,baseUrl:a,outputs:rt}}catch(ue){let Se=`Encountered fatal platform error while running test '${O.name}': ${ue}`,De=new Date,rt=B+1;j.error({err:ue},Se),y.error(Se);let ft={errorMessage:ue.message,errStack:ue.stack},Pn={status:"FAILED",failureDetails:ft,failureReason:"InternalPlatformError",finishedAt:De};return await L.finish({logger:j,result:{status:"FAILED",results:[]}}),{...Pn,parameters:P,test:O,filePath:O.relativeFilePath,startedAt:C,lastAttemptStartedAt:ee,finishedAt:new Date,attempts:rt,baseUrl:a,outputs:{}}}}throw new Error("This code should not be reachable")}function $N(n){for(let e of n.envs??[])if(e.default)return e.name}import{diff as WN}from"deep-object-diff";async function li(n,e,t,r,o){let i=Di(o.type);if(i&&await e.reportCreditsUsed(n,o.type,i,{testId:t,testName:r}),"command"in o){let s=Ui(o.command);s&&await e.reportCreditsUsed(n,o.command.type,s,{testId:t,testName:r})}}var hu=class{constructor(e,t,r,o){this.testId=e;this.testName=t;this.billingReporter=r;this.asyncWork=o}getParentStepIdChain(){return[]}attachBeforeScreenshot(){}attachAfterScreenshot(){}attachBeforeHtmlSnapshot(){}attachAfterHtmlSnapshot(){}heal(){}async finish(){}async startSubSteps(){return new Gl(this.testId,this.testName,this.billingReporter,this.asyncWork)}},Gl=class{constructor(e,t,r,o){this.testId=e;this.testName=t;this.billingReporter=r;this.asyncWork=o}getParentStepIdChain(){return[]}async startStep(e){let{logger:t,step:r}=e;return this.asyncWork.push(li(t,this.billingReporter,this.testId,this.testName,r)),new hu(this.testId,this.testName,this.billingReporter,this.asyncWork)}},gu=class{constructor(e,t,r,o,i,s,a){this.orgId=e;this.testId=t;this.testName=r;this.client=o;this.billingReporter=i;this.originalSteps=s;this.asyncWork=a}trackStatus(){}attachNetworkLogs(){}attachConsoleLogs(){}async finish(e){let{logger:t,result:r,updatedSteps:o}=e;if(r?.status!=="PASSED"||!o)return;let i=WN(this.originalSteps,o);if(Object.keys(i).length!==0){t.debug({changes:i},"Updating steps post-run success in cli");try{let{cachesToSave:s}=await Xe({stepLists:o,cacheCreationParams:{testId:this.testId,orgId:this.orgId}});await this.client.updateStepCaches({testId:this.testId,entries:s})}catch(s){t.error({err:s},"Failed to save step caches after successful execution. This is not critical, but can impact future performance.")}}}async startStepList(){return new Gl(this.testId,this.testName,this.billingReporter,this.asyncWork)}},fu=class{constructor(e,t,r,o,i,s,a){this.orgId=e;this.testId=t;this.testName=r;this.client=o;this.billingReporter=i;this.originalSteps=s;this.asyncWork=a}async finish(){}trackStatus(){}async startAttempt(){return new gu(this.orgId,this.testId,this.testName,this.client,this.billingReporter,this.originalSteps,this.asyncWork)}},Vl=class{constructor(e,t,r){this.orgId=e;this.client=t;this.billingReporter=r}asyncWork=[];async finish(){await Promise.allSettled(this.asyncWork)}trackStatus(){}async startRun(e){return this.asyncWork.push(this.billingReporter.reportBillableEvent(e.logger,"test-run",{testId:e.testId,testName:e.testName})),new fu(this.orgId,e.testId,e.testName,this.client,this.billingReporter,e.originalSteps,this.asyncWork)}};import{randomUUID as qv}from"crypto";import{diff as e_}from"deep-object-diff";import GN from"adm-zip";import Hn from"fs";import to from"path";var As=class n{constructor(e){this.filePath=e;Hn.rmSync(this.filePath,{recursive:!0,force:!0}),Hn.mkdirSync(this.filePath,{recursive:!0})}cd(e){return new n(to.join(this.filePath,e))}storeFile(e){let{name:t,contents:r}=e,o=to.join(this.filePath,t);Hn.writeFileSync(o,r)}createRunArchive(e){return new Su(to.join(this.filePath,"runs"),e)}},Su=class{constructor(e,t){this.filePath=e;this.tempPath=to.join(e,`.${t}`),this.finalPath=to.join(e,`${t}.zip`),Hn.rmSync(this.tempPath,{recursive:!0,force:!0}),Hn.rmSync(this.finalPath,{recursive:!0,force:!0}),Hn.mkdirSync(this.tempPath,{recursive:!0})}tempPath;finalPath;cd(e){return new As(to.join(this.tempPath,e))}storeFile(e){let{name:t,contents:r}=e,o=to.join(this.tempPath,t);Hn.writeFileSync(o,r)}close(){let e=new GN;e.addLocalFolder(this.tempPath,void 0,r=>r!==".DS_Store");let t=e.toBuffer();Hn.writeFileSync(this.finalPath,t),Hn.rmSync(this.tempPath,{recursive:!0,force:!0})}};import VN from"simple-git";var Re=VN();function ql(n){if(n.startsWith("git@")){let e=n.split(":");if(e.length===2){let t=e[1].replace(".git","").split("/");if(t.length===2){let r=t[0],o=t[1];return`${r}/${o}`}}}else if(n.startsWith("http")||n.startsWith("https")){let t=new URL(n).pathname.split("/").filter(Boolean);if(t.length>=2){let r=t[0],o=t[1].replace(".git","");return`${r}/${o}`}}}async function Ae(n){try{return(await n).trim()}catch(e){Q.error({err:e},"Failed to run git command");return}}function qN(){if(process.env.GITHUB_ACTION)return"GithubActions";if(process.env.GITLAB_CI)return"GitlabCI";if(process.env.CIRCLECI)return"CircleCI";if(process.env.BUILDKITE)return"Buildkite";if(process.env["System.CollectionUri"]?.includes("azure"))return"AzureDevOps"}async function KN(){let[n,e,t,r]=await Promise.all([Ae(Re.show(["--no-patch","--format=%ci"])),Ae(Re.listRemote(["--get-url","origin"])),Ae(Re.show(["-s","--pretty=%B"])),Ae(Re.show(["-s","--pretty=%an"]))]);return{gitCommitSha:process.env.GITHUB_SHA,gitCommitShaShort:process.env.GITHUB_SHA?.slice(0,6),gitCommitTimestamp:n?new Date(n):void 0,gitBranchName:process.env.GITHUB_HEAD_REF||process.env.GITHUB_REF_NAME,gitOriginUrl:e,gitCommitMessage:t,gitCommitAuthorName:r,githubRepository:process.env.GITHUB_REPOSITORY,pipelineId:`${process.env.GITHUB_RUN_ID}:${process.env.GITHUB_RUN_ATTEMPT}`}}async function YN(){let[n,e,t]=await Promise.all([Ae(Re.listRemote(["--get-url","origin"])),Ae(Re.show(["-s","--pretty=%B"])),Ae(Re.show(["-s","--pretty=%an"]))]);return{gitCommitSha:process.env.CI_COMMIT_SHA,gitCommitShaShort:process.env.CI_COMMIT_SHORT_SHA,gitCommitTimestamp:process.env.CI_COMMIT_TIMESTAMP?new Date(process.env.CI_COMMIT_TIMESTAMP):void 0,gitBranchName:process.env.CI_COMMIT_BRANCH||process.env.CI_COMMIT_REF_NAME,gitOriginUrl:n,gitCommitMessage:e,gitCommitAuthorName:t,gitlabProjectPath:process.env.CI_SERVER_HOST,pipelineId:`${process.env.CI_PIPELINE_ID}:${process.env.CI_JOB_ID}`}}async function JN(){let[n,e,t,r]=await Promise.all([Ae(Re.show(["--no-patch","--format=%ci"])),Ae(Re.listRemote(["--get-url","origin"])),Ae(Re.show(["-s","--pretty=%B"])),Ae(Re.show(["-s","--pretty=%an"]))]),o=e?.includes("github.com"),i=e?.includes("gitlab.com"),s=e?ql(e):void 0;return{gitCommitSha:process.env.CIRCLE_SHA1,gitCommitShaShort:process.env.CIRCLE_SHA1?.slice(0,6),gitCommitTimestamp:n?new Date(n):void 0,gitBranchName:process.env.CIRCLE_BRANCH,gitOriginUrl:process.env.CIRCLE_REPOSITORY_URL,gitCommitMessage:t,gitCommitAuthorName:r,githubRepository:o?s:void 0,gitlabProjectPath:i?s:void 0,pipelineId:`${process.env.CIRCLE_WORKFLOW_ID}:${process.env.CIRCLE_WORKFLOW_JOB_ID}`}}async function XN(){let[n,e,t]=await Promise.all([Ae(Re.show(["--no-patch","--format=%ci"])),Ae(Re.show(["-s","--pretty=%B"])),Ae(Re.show(["-s","--pretty=%an"]))]),r=process.env.BUILDKITE_REPO,o=r?.includes("github.com"),i=r?.includes("gitlab.com"),s=r?ql(r):void 0;return{gitCommitSha:process.env.BUILDKITE_COMMIT,gitCommitShaShort:process.env.BUILDKITE_COMMIT?.slice(0,6),gitCommitTimestamp:n?new Date(n):void 0,gitBranchName:process.env.BUILDKITE_BRANCH,gitOriginUrl:r,gitCommitMessage:e,gitCommitAuthorName:t,githubRepository:o?s:void 0,gitlabProjectPath:i?s:void 0,pipelineId:`${process.env.BUILDKITE_PIPELINE_ID}:${process.env.BUILDKITE_BUILD_ID}:${process.env.BUILDKITE_JOB_ID}`}}async function ZN(){let[n,e,t]=await Promise.all([Ae(Re.show(["--no-patch","--format=%ci"])),Ae(Re.show(["-s","--pretty=%B"])),Ae(Re.show(["-s","--pretty=%an"]))]),r=process.env["Build.Repository.Uri"],o=r?.includes("github.com"),i=r?.includes("gitlab.com"),s=r?ql(r):void 0;return{gitCommitSha:process.env["Build.SourceVersion"],gitCommitShaShort:process.env["Build.SourceVersion"]?.slice(0,6),gitCommitTimestamp:n?new Date(n):void 0,gitBranchName:process.env["Build.SourceBranchName"],gitOriginUrl:r,gitCommitMessage:e,gitCommitAuthorName:t,githubRepository:o?s:void 0,gitlabProjectPath:i?s:void 0,pipelineId:`${process.env["System.JobId"]}:${process.env["System.JobAttempt"]}`}}async function QN(){let[n,e,t,r,o,i,s]=await Promise.all([Ae(Re.revparse(["HEAD"])),Ae(Re.revparse(["--short","HEAD"])),Ae(Re.revparse(["--abbrev-ref","HEAD"])),Ae(Re.listRemote(["--get-url","origin"])),Ae(Re.show(["--no-patch","--format=%ci"])),Ae(Re.show(["-s","--pretty=%B"])),Ae(Re.show(["-s","--pretty=%an"]))]),a=r?.includes("github.com"),l=r?.includes("gitlab.com"),c=r?ql(r):void 0;return{gitCommitSha:n,gitCommitShaShort:e,gitBranchName:t,gitOriginUrl:r,gitCommitTimestamp:o?new Date(o):void 0,gitCommitMessage:i,gitCommitAuthorName:s,githubRepository:a?c:void 0,gitlabProjectPath:l?c:void 0,pipelineId:void 0}}async function Kl(n){let e=qN();if(!e)return n.debug("No CI run environment detected, falling back to git"),QN();switch(n.debug(`Using CI runner environment variables from ${e} to get git metadata`),e){case"GithubActions":return KN();case"GitlabCI":return YN();case"CircleCI":return JN();case"Buildkite":return XN();case"AzureDevOps":return ZN()}}function t_(n){switch(n){case"PASSED":return"SUCCESS";case"FAILED":return"FAILED";case"CANCELLED":return"CANCELLED";case"RUNNING":case"PENDING":case"RETRYING":case"WAITING_FOR_USER":return"RUNNING"}}function n_(n){switch(n){case"SUCCESS":return"PASSED";case"FAILED":return"FAILED";case"CANCELLED":return"CANCELLED";case"RUNNING":return"RUNNING";case"IDLE":return"PENDING"}}var yu=class{constructor(e,t,r,o,i,s){this.testId=e;this.testName=t;this.metadata=r;this.diskStorage=o;this.billingReporter=i;this.asyncWork=s}children=[];finished=!1;getParentStepIdChain(){return[]}attachBeforeScreenshot(e){let{snapshotId:t,screenshot:r}=e;this.metadata.beforeSnapshotId=t,this.diskStorage.storeFile({name:"before.jpeg",contents:r})}attachAfterScreenshot(e){let{snapshotId:t,screenshot:r}=e;this.metadata.afterSnapshotId=t,this.diskStorage.storeFile({name:"after.jpeg",contents:r})}attachBeforeHtmlSnapshot(e){let{snapshotId:t,html:r}=e;this.metadata.beforeSnapshotId=t,this.diskStorage.storeFile({name:"before.html",contents:r})}attachAfterHtmlSnapshot(e){let{snapshotId:t,html:r}=e;this.metadata.afterSnapshotId=t,this.diskStorage.storeFile({name:"after.html",contents:r})}heal(e){let{healType:t}=e;this.metadata.healMetadata={healType:t,healedAt:new Date}}async finishInternal(e){if(this.finished)return;this.finished=!0,await Promise.all(this.children.map(r=>r.finish({status:n_(e.status),finishedAt:e.finishedAt})));let t={...this.metadata,status:e.status,finishedAt:e.finishedAt,message:e.message};this.diskStorage.storeFile({name:"metadata.json",contents:JSON.stringify(t,null,2)})}async finish(e){await this.finishInternal(e.step)}async startSubSteps(){let e=this.diskStorage.cd("substeps"),t=new Yl(this.testId,this.testName,e,this.billingReporter,this.asyncWork);return this.children.push(t),t}},Yl=class{constructor(e,t,r,o,i){this.testId=e;this.testName=t;this.diskStorage=r;this.billingReporter=o;this.asyncWork=i}children=[];finished=!1;getParentStepIdChain(){return[]}async startStep(e){let{logger:t,step:r}=e;this.asyncWork.push(li(t,this.billingReporter,this.testId,this.testName,r));let o=this.diskStorage.cd(r.id),i={step:r,status:"RUNNING",startedAt:new Date};o.storeFile({name:"metadata.json",contents:JSON.stringify(i,null,2)});let s=new yu(this.testId,this.testName,i,o,this.billingReporter,this.asyncWork);return this.children.push(s),s}async finish(e){this.finished||(this.finished=!0,await Promise.all(this.children.map(t=>t.finishInternal({status:t_(e.status),finishedAt:e.finishedAt}))))}},bu=class{constructor(e,t,r,o,i,s,a,l,c){this.orgId=e;this.testId=t;this.testName=r;this.originalSteps=o;this.metadata=i;this.client=s;this.diskStorage=a;this.billingReporter=l;this.asyncWork=c}finished=!1;children=[];trackStatus(){}attachNetworkLogs(e){let{logs:t}=e;this.diskStorage.storeFile({name:"network.har",contents:JSON.stringify(t,null,2)})}attachConsoleLogs(e){let{logs:t}=e;this.diskStorage.storeFile({name:"console.json",contents:JSON.stringify(t,null,2)})}async finish(e){if(this.finished)return;this.finished=!0;let{logger:t,result:r,updatedSteps:o}=e,i={...this.metadata,status:r.status,finishedAt:new Date,results:r.results,beforeResults:r.beforeResults,afterResults:r.afterResults};if(await Promise.all(this.children.map(a=>a.finish({status:i.status,finishedAt:i.finishedAt}))),this.diskStorage.storeFile({name:"metadata.json",contents:JSON.stringify(i,null,2)}),r?.status!=="PASSED"||!o)return;let s=e_(this.originalSteps,o);if(Object.keys(s).length!==0){t.debug({changes:s},"Updating steps post-run success in cli");try{let{cachesToSave:a}=await Xe({stepLists:o,cacheCreationParams:{testId:this.testId,orgId:this.orgId}});await this.client.updateStepCaches({testId:this.testId,entries:a})}catch(a){t.error({err:a},"Failed to save step caches after successful execution. This is not critical, but can impact future performance.")}}}async startStepList(){let e=this.diskStorage.cd("steps"),t=new Yl(this.testId,this.testName,e,this.billingReporter,this.asyncWork);return this.children.push(t),t}},wu=class{constructor(e,t,r,o,i,s,a,l,c,p){this.orgId=e;this.testId=t;this.testName=r;this.internalRunId=o;this.originalSteps=i;this.metadata=s;this.client=a;this.diskStorage=l;this.billingReporter=c;this.asyncWork=p}children=[];finished=!1;get envVarBindings(){return{[Da]:this.internalRunId}}async finish(e){if(this.finished)return;this.finished=!0;let t={...this.metadata,finishedAt:e.finishedAt||new Date,status:e.status,failureDetails:e.failureDetails,failureReason:e.failureReason,flake:e.isFlake||!1};await Promise.all(this.children.map(r=>r.finish({logger:e.logger,result:{status:t.status,results:[],beforeResults:[],afterResults:[]}}))),this.diskStorage.storeFile({name:"metadata.json",contents:JSON.stringify(t,null,2)}),this.diskStorage.close()}trackStatus(){}async startAttempt(){this.metadata.attempts=this.metadata.attempts+1,this.metadata.status="RUNNING",this.diskStorage.storeFile({name:"metadata.json",contents:JSON.stringify(this.metadata,null,2)});let e=this.diskStorage.cd(`attempts/${this.metadata.attempts}`),t={startedAt:new Date,status:"RUNNING"};e.storeFile({name:"metadata.json",contents:JSON.stringify(t,null,2)});let r=new bu(this.orgId,this.testId,this.testName,this.originalSteps,t,this.client,e,this.billingReporter,this.asyncWork);return this.children.push(r),r}},Jl=class n{constructor(e,t,r,o,i,s){this.orgId=e;this.runGroupId=t;this.metadata=r;this.client=o;this.diskStorage=i;this.billingReporter=s;this.asyncWork=[]}children=[];finished=!1;asyncWork;get loggerBindings(){return{orgId:this.orgId,runGroupId:this.runGroupId,branch:this.metadata.gitBranchName}}static async start(e,t,r,o){let i=await Kl(y),s=qv(),a={...i,trigger:Lt.CLI,startedAt:new Date,status:"RUNNING",cliVersion:Ht||He},l=new As(t);return l.storeFile({name:"metadata.json",contents:JSON.stringify(a,null,2)}),new n(e,s,a,r,l,o)}async finish(e){if(this.finished)return;this.finished=!0;let{status:t}=e,r={...this.metadata,status:t,updatedAt:new Date,finishedAt:new Date};await Promise.all(this.children.map(o=>o.finish({logger:e.logger,status:r.status,finishedAt:r.finishedAt}))),this.diskStorage.storeFile({name:"metadata.json",contents:JSON.stringify(r,null,2)}),await Promise.allSettled(this.asyncWork)}trackStatus(){}async startRun(e){let t=qv(),r=this.diskStorage.createRunArchive(t),o={stepsSnapshot:e.originalSteps.steps,runGroupId:this.runGroupId,testId:e.testId,testName:e.testName,labels:e.testLabels,trigger:"CLI",status:"RUNNING",resolvedBaseUrl:e.baseUrl,environmentName:e.environmentName,cliVersion:Ht,schemaVersion:e.schemaVersion,startedAt:new Date,attempts:0};r.storeFile({name:"metadata.json",contents:JSON.stringify(o,null,2)}),this.asyncWork.push(this.billingReporter.reportBillableEvent(e.logger,"test-run",{eventId:t,testId:e.testId,testName:e.testName}));let i=new wu(this.orgId,e.testId,e.testName,t,e.originalSteps,o,this.client,r,this.billingReporter,this.asyncWork);return this.children.push(i),i}};import{diff as r_}from"deep-object-diff";var vu=class{constructor(e,t,r,o,i,s,a,l,c,p,d,u){this.orgId=e;this.testId=t;this.testName=r;this.runId=o;this.attemptId=i;this.step=s;this.originalSteps=a;this.client=l;this.analytics=c;this.debugDataStorage=p;this.billingReporter=d;this.asyncWork=u}startedAt=new Date;getParentStepIdChain(){return[]}attachBeforeScreenshot(e){let{logger:t,snapshotId:r,screenshot:o}=e;this.asyncWork.push(this.debugDataStorage.storeScreenshot(t,r,o))}attachAfterScreenshot(e){let{logger:t,snapshotId:r,screenshot:o}=e;this.asyncWork.push(this.debugDataStorage.storeScreenshot(t,r,o))}attachBeforeHtmlSnapshot(e){let{logger:t,snapshotId:r,html:o}=e;this.asyncWork.push(this.debugDataStorage.storeHtmlSnapshot(t,r,o))}attachAfterHtmlSnapshot(e){let{logger:t,snapshotId:r,html:o}=e;this.asyncWork.push(this.debugDataStorage.storeHtmlSnapshot(t,r,o))}heal(e){let{healType:t}=e;this.step.type==="PRESET_ACTION"&&this.analytics.track({type:"execution:step_heal",heal_type:t,step_type:this.step.type,command_type:this.step.command.type,duration_ms:Date.now()-this.startedAt.getTime()})}async finish(e){let{step:t}=e,r=new Date;switch(t.status){case"SUCCESS":this.analytics.track({type:"execution:step_success",step_type:t.type,command_type:"command"in t?t.command.type:void 0,duration_ms:r.getTime()-this.startedAt.getTime()});break;case"FAILED":{let o="command"in t?t.command.type:t.type;this.analytics.track({type:"execution:step_fail",step_type:t.type,command_type:"command"in t?t.command.type:void 0,duration_ms:r.getTime()-this.startedAt.getTime(),fail_reason:t.message??`${o} failed`});break}case"CANCELLED":this.analytics.track({type:"execution:step_cancel",step_type:t.type,command_type:"command"in t?t.command.type:void 0,duration_ms:r.getTime()-this.startedAt.getTime()});break;default:throw new Error(`Unexpected status: ${t.status}`)}}async startSubSteps(){return new Xl(this.orgId,this.testId,this.testName,this.runId,this.attemptId,this.originalSteps,this.client,this.analytics,this.debugDataStorage,this.billingReporter,this.asyncWork)}},Xl=class{constructor(e,t,r,o,i,s,a,l,c,p,d){this.orgId=e;this.testId=t;this.testName=r;this.runId=o;this.attemptId=i;this.originalSteps=s;this.client=a;this.analytics=l;this.debugDataStorage=c;this.billingReporter=p;this.asyncWork=d}getParentStepIdChain(){return[]}async startStep(e){let{logger:t,step:r}=e;this.asyncWork.push(li(t,this.billingReporter,this.testId,this.testName,r));let o=this.analytics.child({step_id:r.id});return o.track({type:"execution:step_start",step_type:r.type==="RESOLVED_MODULE"?"MODULE":r.type,command_type:"command"in r?r.command.type:void 0}),new vu(this.orgId,this.testId,this.testName,this.runId,this.attemptId,r,this.originalSteps,this.client,o,this.debugDataStorage,this.billingReporter,this.asyncWork)}},xu=class{constructor(e,t,r,o,i,s,a,l,c,p,d){this.orgId=e;this.testId=t;this.testName=r;this.runId=o;this.attemptId=i;this.originalSteps=s;this.client=a;this.analytics=l;this.debugDataStorage=c;this.billingReporter=p;this.asyncWork=d}get loggerBindings(){return{runAttemptId:this.attemptId}}trackStatus(){}attachNetworkLogs(e){let{logger:t,logs:r}=e;this.asyncWork.push(this.debugDataStorage.storeNetworkLogsForRunAttempt(t,this.runId,this.attemptId,r))}attachConsoleLogs(e){let{logger:t,logs:r}=e;this.asyncWork.push(this.debugDataStorage.storeConsoleLogsForRunAttempt(t,this.runId,this.attemptId,r))}async finish(e){let{logger:t,result:r,updatedSteps:o}=e;if(await this.client.updateRunAttempt(this.runId,this.attemptId,{status:r.status,finishedAt:new Date,results:r.results,beforeResults:r.beforeResults,afterResults:r.afterResults}),r?.status!=="PASSED"||!o)return;let i=r_(this.originalSteps,o);if(Object.keys(i).length!==0){t.debug({changes:i},"Updating steps post-run success in cli");try{let{cachesToSave:s}=await Xe({stepLists:o,cacheCreationParams:{testId:this.testId,orgId:this.orgId}});await this.client.updateStepCaches({testId:this.testId,entries:s})}catch(s){t.error({err:s},"Failed to save step caches after successful execution. This is not critical, but can impact future performance.")}}}async startStepList(){return new Xl(this.orgId,this.testId,this.testName,this.runId,this.attemptId,this.originalSteps,this.client,this.analytics,this.debugDataStorage,this.billingReporter,this.asyncWork)}},Tu=class{constructor(e,t,r,o,i,s,a,l,c,p){this.orgId=e;this.testId=t;this.testName=r;this.runId=o;this.originalSteps=i;this.client=s;this.analytics=a;this.debugDataStorage=l;this.billingReporter=c;this.asyncWork=p;this.startedAt=new Date}attempts=0;startedAt=new Date;get loggerBindings(){return{runId:this.runId}}get envVarBindings(){return{[Da]:this.runId}}async finish(e){let t=e.finishedAt||new Date,r=t.getTime()-this.startedAt.getTime();switch(e.status){case"PASSED":this.analytics.track({type:"execution:test_success",attempt_count:this.attempts,duration_ms:r,is_flake:e.isFlake||!1});break;case"CANCELLED":this.analytics.track({type:"execution:test_cancel",duration_ms:r,attempt_count:this.attempts});break;case"FAILED":this.analytics.track({type:"execution:test_fail",attempt_count:this.attempts,duration_ms:r,fail_reason:e.failureDetails?.errorMessage??"unknown"});break}await this.client.updateRun(this.runId,{status:e.status,finishedAt:t,flake:e.isFlake,failureDetails:e.failureDetails,failureReason:e.failureReason})}trackStatus(){}async startAttempt(){this.attempts++,await this.client.updateRun(this.runId,{status:"RUNNING",attempts:this.attempts});let{id:e}=await this.client.createRunAttempt(this.runId);return new xu(this.orgId,this.testId,this.testName,this.runId,e,this.originalSteps,this.client,this.analytics,this.debugDataStorage,this.billingReporter,this.asyncWork)}},Zl=class n{constructor(e,t,r,o,i,s,a,l){this.orgId=e;this.runGroupId=t;this.gitMetadata=r;this.client=o;this.analytics=i;this.debugDataStorage=s;this.billingReporter=a;this.startedAt=l;this.asyncWork=[]}asyncWork;get loggerBindings(){return{orgId:this.orgId,runGroupId:this.runGroupId,branch:this.gitMetadata.gitBranchName}}static async start(e,t,r,o,i){let s=await Kl(y),a=new Date,{id:l}=await t.createRunGroup({...s,trigger:Lt.CLI,startedAt:a,status:"RUNNING",cliVersion:Ht}),c=r.child({commit_sha:s?.gitCommitSha,commit_sha_short:s?.gitCommitShaShort,branch_name:s?.gitBranchName,origin_url:s?.gitOriginUrl,commit_timestamp:s?.gitCommitTimestamp,github_repository:s?.githubRepository,gitlab_project_path:s?.gitlabProjectPath,pipeline_id:s?.pipelineId,run_group_id:l});return new n(e,l,s,t,c,o,i,a)}async finish(e){let{status:t}=e,r=new Date;await this.client.updateRunGroup(this.runGroupId,{status:t,finishedAt:r});let o=r.getTime()-this.startedAt.getTime();switch(t){case"PASSED":this.analytics.track({type:"execution:run_group_success",duration_ms:o});break;case"FAILED":this.analytics.track({type:"execution:run_group_fail",duration_ms:o});break;case"CANCELLED":this.analytics.track({type:"execution:run_group_cancel",duration_ms:o});break}await Promise.allSettled(this.asyncWork)}trackStatus(){}async startRun(e){let{id:t}=await this.client.createRun({stepsSnapshot:e.originalSteps.steps,runGroupId:this.runGroupId,testId:e.testId,testName:e.testName,labels:e.testLabels,trigger:"CLI",resolvedBaseUrl:e.baseUrl,environmentName:e.environmentName,cliVersion:Ht,schemaVersion:e.schemaVersion}),r=this.analytics.child({run_id:t,test_id:e.testId,test_name:e.testName,label_names:e.testLabels});return this.asyncWork.push(this.billingReporter.reportBillableEvent(e.logger,"test-run",{eventId:t,testId:e.testId,testName:e.testName})),r.track({type:"execution:test_start"}),new Tu(this.orgId,e.testId,e.testName,t,e.originalSteps,this.client,r,this.debugDataStorage,this.billingReporter,this.asyncWork)}};async function Kv(n){let{logger:e,tests:t,yes:r,start:o,waitOn:i,client:s,debugDataStorage:a,billingReporter:l,analytics:c,project:p,report:d,retriesOverride:u,urlOverride:m,envName:h,orgId:g,devicePixelRatio:f,customHeaders:S,testInputMatrix:x,reporter:b,include:w,exclude:E,labels:C,reporterDir:I="reports",outputDir:N,waitOnTimeout:P=60,parallel:D=p.config.parallel??1,shardIndex:W=1,shardCount:_=1,regenerateGoldenFiles:B}=n;o&&(e.info({orgId:g},`Executing start command: ${o}`),await Gw(o,!1)),i&&(e.info({orgId:g},`Waiting for url: ${i} with timeout: ${P} seconds.`),await i_({resources:[i],interval:2500,timeout:P*1e3,headers:{Accept:"*/*"},followRedirect:!0,verbose:!1,log:!0,strictSSL:!1}));let L=new Io({baseUrl:s.baseUrl,apiKey:s.apiKey,logger:e}),j=ke(p,y),O=await zv({tests:t,momenticFiles:j,yes:r,project:p,include:w,exclude:E,labels:C}),ee=[];O.forEach((Ue,Wn)=>{x?x.forEach((ro,St)=>{ee.push({testIndex:Wn,inputs:ro,inputIndex:St})}):ee.push({testIndex:Wn,inputs:void 0,inputIndex:void 0})}),_&&_>1&&(ee=s_(ee,W,_));let me=`Running ${ee.length} tests with ${D} workers`;e.info({allTestsToRunWithInputs:ee,shardCount:_,shardIndex:W,orgId:g},me),y.dimmed(me),ee.forEach(Ue=>{y.dimmed(` - ${[O[Ue.testIndex].relativeFilePath]}${typeof Ue.inputIndex=="number"?` with input set ${Ue.inputIndex}`:""}`)}),y.log("");let nt=[],ue=new Date,Se=new Set,De=()=>{let Ue=s.getAppUrl(),Wn=si({results:nt,startTime:ue.getTime(),onFailed:St=>{Hl(St,St.filePath)},getDisplayLine:St=>{let yr=` - ${St.filePath}${St.proposedTest?" [AUTO-HEALED] ":""}`;return d&&St.runId&&(yr+=` (${Ue}/runs/${St.runId})`),yr},entity:"test"}),ro=nt.filter(St=>!!St.proposedTest);return ro.length>0&&y.warn(`${ro.length} tests passed with auto-healing. Please use the run links printed above to review proposed changes and apply them locally.`),Wn},rt=new Vl(g,s,l);N?rt=await Jl.start(g,N,s,l):d&&(rt=await Zl.start(g,s,c,a,l));let ft=e.child(rt.loggerBindings||{}),Pn=[],G=async()=>{y.warn("SIGINT received. Stopping tests and printing latest results..."),await rt.finish({logger:ft,status:"CANCELLED"}),De(),await Promise.allSettled(Pn.map(Ue=>Ue())),process.exit(1)};process.on("SIGINT",G);let nn={};for(let Ue=0;Ue<ee.length;Ue++){let Wn=Object.values(nn);Wn.length===D&&await Promise.race(Wn.map(yr=>yr.promise));let ro=ee[Ue],St=`test-${Ue}`;nn[St]={done:!1,promise:(async({testIndex:yr,inputs:Ru})=>{let pi=O[yr];Se.add({testIndex:yr,inputs:Ru});let ox=pi.relativeFilePath.includes("..")?pi.fullFilePath:pi.relativeFilePath,Is=(ct,ui)=>{let oo=(tc,Au)=>{let sx=Math.floor((Au-tc.length)/2);return tc.padStart(sx+tc.length).padEnd(Au)};ct=ct.toUpperCase();let Ln=ct;ct.includes("FAIL")?Ln=ci.bgRed.white(oo("FAIL",8)):ct.includes("PASS")?Ln=ci.bgGreen.white(oo("PASS",8)):ct.includes("START")?Ln=ci.bgBlue.white(oo("START",8)):ct.includes("CANCEL")?Ln=ci.bgYellow.white(oo("CANCEL",8)):ct.includes("RETRY")?Ln=ci.bgYellow.white(oo("RETRY",8)):ct.includes("RUN")||ct.includes("PROG")?Ln=ci.bgMagenta.white(oo("RUNNING",8)):ft.warn(`Unknown status tried to be logged in run test locally: ${ct}`),o_||(Ln=`[${Ln}]`),y.log(`${Ln} ${ox} ${ui?`${ui} `:""}(${Se.size}/${ee.length})`)};Is("START");let ix=setInterval(()=>Is("RUN"),5*60*1e3);try{let ct=await Vv({testDefinition:pi,project:p,testInputs:Ru,orgId:g,devicePixelRatio:f,apiClient:s,runGroupTracer:rt,generator:L,retriesOverride:u,urlOverride:m,envName:h,noReport:!d,customHeaders:S,regenerateGoldenFiles:B,logUpdate:Is,runSigIntHandlers:d?Pn:void 0,logger:ft});Is(ct.status),nt.push(ct)}catch(ct){let ui=`Encountered unexpected fatal error when running test '${pi.name}': ${ct.message}`;y.error(ui),ft.error(ui)}finally{clearInterval(ix),nn[St].done=!0,delete nn[St]}})(ro)}}await Promise.allSettled(Object.values(nn).map(Ue=>Ue.promise));let di="PASSED";return nt.some(Ue=>Ue.status==="FAILED")&&(di="FAILED"),await rt.finish({logger:ft,status:di}),process.off("SIGINT",G),b&&await Bv(ft,a,b,{projectConfigPath:p.configFilePath,suiteName:p.config.name,startedAt:ue,finishedAt:new Date,runs:nt},I??"reports"),De()}function s_(n,e,t){if(t>n.length&&(y.warn(`Shard count ${t} is greater than the number of tests ${n.length}! Some workers won't have any tests to run.`),t=Math.max(t,n.length),e>t))return[];let r=Math.floor((e-1)*(n.length/t)),o=Math.floor(e*(n.length/t));return n.sort().filter((s,a)=>a>=r&&a<o)}import $n from"fs";import no from"path";var Yv={status:(n,e)=>{if(n===e)return n;if(n==="PASSED"&&e==="PASSED")return"PASSED";if(n==="FAILED"||e==="FAILED")return"FAILED";if(n==="CANCELLED"||e==="CANCELLED")return"PASSED";throw new Error("Invalid run status merge")},startedAt:(n,e)=>{if(!n||!e)throw new Error("Invalid start time merge");return n<e?n:e},updatedAt:(n,e)=>{if(!n||!e)throw new Error("Invalid update time merge");return n>e?n:e},finishedAt:(n,e)=>{if(!n||!e)throw new Error("Invalid finish time merge");return n>e?n:e},gitCommitTimestamp:(n,e)=>{if(!(!n&&!e)){if(!n||!e||n.getTime()!==e.getTime())throw new Error("Git commit timestamps must match to be merged");return n}}};function Jv(n,e){let t=n[e];if(!t)throw new Error(`No metadata value found for key: ${e}`);return t}function a_(n,e,t){let r=Jv(n,t),o=Jv(e,t);if(t in Yv){let i=Yv[t];return i(r,o)}if(r!==o)throw new Error(`Metadata values for key "${t}" do not match: "${r}" vs "${o}"`);return r}function Xv(n,e){$n.rmSync(n,{recursive:!0,force:!0});let t=$n.readdirSync(e).filter(s=>s!==".DS_Store").map(s=>no.join(e,s));$n.mkdirSync(n,{recursive:!0});let r=no.join(t[0],"metadata.json"),o=od.parse(JSON.parse($n.readFileSync(r,"utf-8")));for(let s of t){let a=no.join(s,"runs");if(!$n.existsSync(a))continue;let l=$n.readdirSync(a);for(let d of l){let u=no.join(a,d),m=no.join(n,"runs",d);$n.cpSync(u,m,{recursive:!0})}let c=no.join(s,"metadata.json"),p=od.parse(JSON.parse($n.readFileSync(c,"utf-8")));for(let d in p){let u=d;o[u]=a_(o,p,u)}}let i=no.join(n,"metadata.json");$n.writeFileSync(i,JSON.stringify(o,null,2))}import Zv from"adm-zip";import l_ from"fs";import Ql from"path";function Qv(n){let e=new Zv;e.addLocalFile(Ql.join(n,"metadata.json"));for(let t of l_.readdirSync(Ql.join(n,"runs"))){if(!t.endsWith(".zip"))continue;let r=t.replace(/\.zip$/,""),o=new Zv(Ql.join(n,"runs",t));for(let i of o.getEntries())i.isDirectory||e.addFile(Ql.join("runs",r,i.entryName),i.getData())}return e.toBuffer()}var ex=new ri({platform:"cli"},{flushAt:1,flushInterval:0});rc||Q.warn("Sentry is not enabled in this environment due to unsupported node version");var h_=process.argv.some(n=>n.includes("--log-level"))&&process.argv.some(n=>n.includes("debug")),Eu=n=>{h_&&y.dimmed(n)},Et=new c_;Et.name("momentic").description("CLI").version(Ht||"unknown");Et.command("install-browsers").option("-f, --force","Force reinstallation even if the browser executables already exist on disk.").argument("[browsers...]","Browsers to install",["chromium"]).action(async(n,e)=>{await eo(Rv(n),e.force)});Et.addOption(new tn("--log-level <level>").choices(["debug","info","warn","error"]).default("info")).on("option:log-level",n=>{n==="debug"&&y.info("Enabling debug logging"),y.setMinLevel(n.toLowerCase())});Et.addOption(new tn("--verbose","enable verbose logging")).on("option:verbose",()=>{Q.enableConsoleLogs(),y.setMinLevel(0)});Et.command("check-config").addOption(Sr).action(async n=>{gn({configFilePath:n.config})});var tx=Et.command("checks").alias("check").description("Perform various project checks");tx.command("duplicate-ids").description("Checks if any steps in your entire Momentic test repository share the same ID.").addOption(Sr).addOption(Sv).action(async n=>{let e=await fn(n),t=gn({configFilePath:n.config});await Qw({project:t,fix:e.fix})});tx.command("duplicate-names").description("Checks if tests or modules with duplicate names or ids exist").addOption(Sr).action(async n=>{let e=gn({configFilePath:n.config});await ev({project:e})});var g_=Et.command("migrate").description("Migrate and upgrade tooling");g_.command("v0-v1").addOption(fr).addOption(jn).action(async n=>{let e=await fn(n);if(!e.yes&&!await lt("This command will migrate and then delete your previous Momentic files. All members of your team should transition to the V1 CLI at the same time. Please backup your local directory for safety before proceeding. Continue?",!0)&&process.exit(1),!sv().environments?.length&&await lt("In the V1 CLI, all environment configuration should be committed to a central `momentic.config.yaml` file, which you should commit to your source control repository. Sensitive data can be managed through `.env` files or by injecting the secret into the environment and then referencing them in `envVariables` with ${VAR} syntax. Would you like to pull the latest environments from Momentic Cloud into your `momentic.config.yaml` file?",!0)){let{apiKey:r,server:o}=e,i=gn({}),s=new st({baseUrl:o,apiKey:r,logger:Q});await Nl({client:s,project:i,skipPrompts:e.yes}),y.success("Successfully imported environments from Momentic Cloud.")}});Et.command("import-from-cloud").addOption(jn).addOption(gr).addOption(Sr).addOption(fr).action(async n=>{let e=await fn(n),{apiKey:t,server:r,config:o,yes:i}=e,s=gn({configFilePath:o}),a=new st({baseUrl:r,apiKey:t,logger:Q});await iv({client:a,project:s,skipPrompts:i}),process.exit(0)});Et.command("init").description("Initialize an empty Momentic project in the current working directory").addOption(new tn("--name <name>","Name of the project")).action(async n=>{y.info(`Welcome to the Momentic project setup wizard! \u{1F680}
|
|
3594
|
-
`),y.info("This wizard will help you bootstrap a new Momentic project. If you need to import existing assets from Momentic Cloud, you can call the 'import-from-cloud' command after initialization."),Cu.existsSync(Xo)&&(y.error("A momentic.config.yaml file already exists in this directory. Please rename or remove it to initialize a new project."),process.exit(1));let t={name:n.name??await Jw("Choose an identifier for your project, such as a service, product, or team name (default: 'app'):","app"),include:vs};Zo(t,Xo),y.success(`Initialized Momentic project file at ${ec.resolve(Xo)}`)});Et.command("app").addOption(jn).addOption(gr).addOption(fr).addOption(ou).addOption(hv).addOption(Sr).action(async n=>{let e=await fn(n),{apiKey:t,port:r=_l,yes:o,server:i,pixelRatio:s}=e,a=new st({baseUrl:i,apiKey:t,logger:Q});await lu({client:a,skipPrompts:o,installBrowsers:!0});let l=m_(import.meta.url),c=ec.dirname(l),p=ec.resolve(c,"..","static"),d=ec.resolve(c,"..","assets"),u=s??Kp();Yp(u),mi(),await Hw({momenticServerUrl:i,apiKey:t,serverPort:r,appPort:r,staticDir:p,assetsDir:d,devicePixelRatio:u,version:"1.1.
|
|
3596
|
+
`),y.info("This wizard will help you bootstrap a new Momentic project. If you need to import existing assets from Momentic Cloud, you can call the 'import-from-cloud' command after initialization."),Cu.existsSync(Xo)&&(y.error("A momentic.config.yaml file already exists in this directory. Please rename or remove it to initialize a new project."),process.exit(1));let t={name:n.name??await Jw("Choose an identifier for your project, such as a service, product, or team name (default: 'app'):","app"),include:vs};Zo(t,Xo),y.success(`Initialized Momentic project file at ${ec.resolve(Xo)}`)});Et.command("app").addOption(jn).addOption(gr).addOption(fr).addOption(ou).addOption(hv).addOption(Sr).action(async n=>{let e=await fn(n),{apiKey:t,port:r=_l,yes:o,server:i,pixelRatio:s}=e,a=new st({baseUrl:i,apiKey:t,logger:Q});await lu({client:a,skipPrompts:o,installBrowsers:!0});let l=m_(import.meta.url),c=ec.dirname(l),p=ec.resolve(c,"..","static"),d=ec.resolve(c,"..","assets"),u=s??Kp();Yp(u),mi(),await Hw({momenticServerUrl:i,apiKey:t,serverPort:r,appPort:r,staticDir:p,assetsDir:d,devicePixelRatio:u,version:"1.1.7"});let m=`http://localhost:${r}`;await u_(m)});var nx=Et.command("queue").description("Queue tests or suites to run on Momentic Cloud");nx.command("suites").description("Run one or more suites on Momentic Cloud").addOption(jn).addOption(gr).addOption(eu).addOption(tu).addOption(fr).addArgument(wv).addOption(Dl).addOption(Fl).addOption(Ml).action(async(n,e)=>{let{apiKey:t,server:r,wait:o,waitTimeout:i,env:s,urlOverride:a,customHeaders:l}=await fn(e),c=new st({baseUrl:r,apiKey:t,logger:Q});(!n||!Array.isArray(n)||!n.length)&&(y.error("Must pass at least one suite to run."),process.exit(1));let{orgId:p}=await c.getAuthInfo();await Ov({client:c,orgId:p,wait:o,suitePaths:n,waitTimeout:i,env:s,urlOverride:a,customHeaders:Ul(l)})});nx.command("tests").description("Run one or more tests on Momentic Cloud").addOption(jn).addOption(gr).addOption(fr).addOption(Ml).addOption(iu).addOption(Dl).addOption(Fl).addOption(eu).addOption(tu).addArgument(yv).action(async(n,e)=>{let t=await fn(e),{all:r,apiKey:o,customHeaders:i,env:s,server:a,inputCsv:l,urlOverride:c,wait:p,waitTimeout:d,yes:u}=t,m=Ul(i);for(let S of n)(S.endsWith(".yaml")||Cu.existsSync(S))&&y.warn("Are you trying to run a test on your local machine? If so, please use the 'run' command instead of the 'queue' command");let h=new st({baseUrl:a,apiKey:o,logger:Q}),{orgId:g}=await h.getAuthInfo(),f;l&&(f=await Jp(l)),await kv({client:h,orgId:g,tests:n,all:r,customHeaders:m,env:s,urlOverride:c,wait:p,waitTimeout:d,testInputMatrix:f,yes:u}),process.exit(0)});var f_=Et.command("run").alias("test").description("Run tests on the local machine");f_.addOption(jn).addOption(gr).addOption(Sr).addOption(su).addOption(fr).addOption(Ml).addOption(iu).addOption(Fl).addOption(Dl).addOption(nu).addOption(ou).addOption(new tn("--start <start>","Arbitrary setup command that will run before Momentic steps begin.")).addOption(new tn("--wait-on <waitOn>","URL to wait to become accessible before Momentic tests begin.")).addOption(new tn("--wait-on-timeout <waitOnTimeout>","Max time in seconds to wait for the --wait-on URL to become accessible.")).addOption(new tn("--retries <retries>","Number of retries to attempt when running tests locally. Defaults to each test's own retry configuration.")).addOption(new tn("-p, --parallel <parallel>","When running with the --local flag, the number of tests to run in parallel. Defaults to 1.")).addOption(new tn("--labels <labels...>","Only run tests with the specified label(s).")).addOption(new tn("--update-golden-files","Update locally stored golden files for steps that this is enabled for.")).addOption(nu).addOption(dv).addOption(pv).addOption(ru).addOption(gv).addOption(fv).addOption(uv).addOption(mv).addArgument(bv).action(async(n,e)=>{y.debug("Run tests invoked");let t=await fn(e);y.debug(t,"Parsed CLI options");let r=Ul(t.customHeaders),o=gn({configFilePath:t.config,nameFilter:t.filter});y.debug({projectName:o.config.name},"Identified project config");let i=new st({baseUrl:t.server,apiKey:t.apiKey,logger:Q});y.debug("Checking API key and dependencies");let{orgId:s,userId:a}=await lu({client:i,skipPrompts:t.yes,installBrowsers:!0});y.debug("API key check and browser installation complete");let l=new wa(i),c=new va(i),p=t.outputDir??o.config.outputDir,d=ex.child({org_id:s,user_id:a,cli_version:Ht,trigger:"CLI"}),u;t.inputCsv&&(u=await Jp(t.inputCsv));let m=t.pixelRatio??Kp();Yp(m);let h=Q.child({orgId:s,userId:a,cliVersion:Ht,trigger:"CLI"});try{(await Kv({...t,retriesOverride:t.retries,devicePixelRatio:m,tests:n,project:o,client:i,debugDataStorage:c,billingReporter:l,analytics:d,outputDir:p,customHeaders:r,envName:t.env,orgId:s,testInputMatrix:u,logger:h,regenerateGoldenFiles:t.updateGoldenFiles})).failed>0?process.exit(1):process.exit(0)}catch(g){y.error("Failed to run tests locally. Please check the error message below or run with the --verbose flag."),y.error(g),process.exit(1)}});var S_=Et.command("apply").description("Apply an operation to local resources");S_.command("patch").addOption(jn).addOption(gr).addOption(Sr).addOption(su).addOption(fr).addOption(new tn("--from <from>","Name or ID of the patch to apply").makeOptionMandatory()).addOption(new tn("--to <to>","Name or ID of the test to apply the patch to").makeOptionMandatory()).action(async n=>{let e=await fn(n),{apiKey:t,server:r,config:o,yes:i}=e,s=gn({configFilePath:o}),a=new st({baseUrl:r,apiKey:t,logger:Q}),l=ke(s,y),c=l.tests[n.to]??Object.values(l.tests).find(d=>Le(d.name)===n.to.trim());c||(y.error(`No test matching '${n.to}' could be found in the current project.`),process.exit(1));let p=await a.fetchTestFragment(n.from);await Xw({client:a,test:c,fragment:p,yes:i,entities:l,logger:Q}),process.exit(0)});var rx=Et.command("results").description("Merge and upload test results.");rx.command("merge").description("Merge test results files.").addOption(ru).addArgument(vv).action(async(n,e)=>{let t=await fn(e),{outputDir:r}=t;r||(y.error("Output directory is required."),process.exit(1)),Xv(r,n)});rx.command("upload").description("Upload test results to Momentic cloud.").addOption(jn).addOption(gr).addArgument(xv).action(async(n,e)=>{let t=await fn(e),{apiKey:r,server:o}=t,i=new st({baseUrl:o,apiKey:r,logger:Q}),s=new La(i);try{let a=Qv(n);Cu.writeFileSync("test.zip",a);let l=await s.uploadResultsArchive(a),c=`${i.getAppUrl()}/run-groups/${l}`;y.success(`Successfully uploaded test results. Once processed, your results can be found at ${c}`),process.exit(0)}catch(a){let l;a instanceof Error?l=a.message:typeof a=="string"?l=a:l="Unknown error",y.error(`Failed to upload test results: ${l}.`),process.exit(1)}});async function y_(){Eu("Main program started"),await Vw(Q),Eu("CLI version check complete");try{await Et.parseAsync(process.argv),mi()}catch(n){let e={};try{e.playwrightVersion=d_("npx playwright --version").toString()}catch(t){Q.error({err:t},"Error fetching debug information")}Q.error({err:n,debugInfo:e},"Uncaught error in CLI"),Q.flush(),nc(n,e),y.error(n),mi(),process.exit(1)}}p_.setMaxListeners(50);process.on("warning",n=>{Q.warn({err:n},`Node warning received on CLI: ${n.message}`)});Eu("CLI parsing setup complete");y_();
|
|
3595
3597
|
/*! Bundled license information:
|
|
3596
3598
|
|
|
3597
3599
|
is-buffer/index.js:
|
|
@@ -3603,4 +3605,4 @@ is-buffer/index.js:
|
|
|
3603
3605
|
*)
|
|
3604
3606
|
*/
|
|
3605
3607
|
//# sourceMappingURL=cli.js.map
|
|
3606
|
-
//# debugId=
|
|
3608
|
+
//# debugId=731773fe-aebe-5d08-bd54-61cc5f454fec
|