You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

2 lines
124 KiB

/*! For license information please see background.js.LICENSE.txt */
(()=>{var e={8608:(e,t,r)=>{"use strict";var a=r(4663),n=r(1413),i=n(a("String.prototype.indexOf"));e.exports=function(e,t){var r=a(e,!!t);return"function"==typeof r&&i(e,".prototype.")>-1?n(r):r}},1413:(e,t,r)=>{"use strict";var a=r(4672),n=r(4663),i=r(7319),o=n("%TypeError%"),s=n("%Function.prototype.apply%"),c=n("%Function.prototype.call%"),l=n("%Reflect.apply%",!0)||a.call(c,s),u=n("%Object.defineProperty%",!0),d=n("%Math.max%");if(u)try{u({},"a",{value:1})}catch(e){u=null}e.exports=function(e){if("function"!=typeof e)throw new o("a function is required");var t=l(a,c,arguments);return i(t,1+d(0,e.length-(arguments.length-1)),!0)};var p=function(){return l(a,s,arguments)};u?u(e.exports,"apply",{value:p}):e.exports.apply=p},8531:(e,t,r)=>{"use strict";var a=r(3219)(),n=r(4663),i=a&&n("%Object.defineProperty%",!0);if(i)try{i({},"a",{value:1})}catch(e){i=!1}var o=n("%SyntaxError%"),s=n("%TypeError%"),c=r(8337);e.exports=function(e,t,r){if(!e||"object"!=typeof e&&"function"!=typeof e)throw new s("`obj` must be an object or a function`");if("string"!=typeof t&&"symbol"!=typeof t)throw new s("`property` must be a string or a symbol`");if(arguments.length>3&&"boolean"!=typeof arguments[3]&&null!==arguments[3])throw new s("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&"boolean"!=typeof arguments[4]&&null!==arguments[4])throw new s("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&"boolean"!=typeof arguments[5]&&null!==arguments[5])throw new s("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&"boolean"!=typeof arguments[6])throw new s("`loose`, if provided, must be a boolean");var a=arguments.length>3?arguments[3]:null,n=arguments.length>4?arguments[4]:null,l=arguments.length>5?arguments[5]:null,u=arguments.length>6&&arguments[6],d=!!c&&c(e,t);if(i)i(e,t,{configurable:null===l&&d?d.configurable:!l,enumerable:null===a&&d?d.enumerable:!a,value:r,writable:null===n&&d?d.writable:!n});else{if(!u&&(a||n||l))throw new o("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.");e[t]=r}}},3351:e=>{"use strict";var t=Object.prototype.toString,r=Math.max,a=function(e,t){for(var r=[],a=0;a<e.length;a+=1)r[a]=e[a];for(var n=0;n<t.length;n+=1)r[n+e.length]=t[n];return r};e.exports=function(e){var n=this;if("function"!=typeof n||"[object Function]"!==t.apply(n))throw new TypeError("Function.prototype.bind called on incompatible "+n);for(var i,o=function(e,t){for(var r=[],a=1,n=0;a<e.length;a+=1,n+=1)r[n]=e[a];return r}(arguments),s=r(0,n.length-o.length),c=[],l=0;l<s;l++)c[l]="$"+l;if(i=Function("binder","return function ("+function(e,t){for(var r="",a=0;a<e.length;a+=1)r+=e[a],a+1<e.length&&(r+=",");return r}(c)+"){ return binder.apply(this,arguments); }")((function(){if(this instanceof i){var t=n.apply(this,a(o,arguments));return Object(t)===t?t:this}return n.apply(e,a(o,arguments))})),n.prototype){var u=function(){};u.prototype=n.prototype,i.prototype=new u,u.prototype=null}return i}},4672:(e,t,r)=>{"use strict";var a=r(3351);e.exports=Function.prototype.bind||a},4663:(e,t,r)=>{"use strict";var a,n=SyntaxError,i=Function,o=TypeError,s=function(e){try{return i('"use strict"; return ('+e+").constructor;")()}catch(e){}},c=Object.getOwnPropertyDescriptor;if(c)try{c({},"")}catch(e){c=null}var l=function(){throw new o},u=c?function(){try{return l}catch(e){try{return c(arguments,"callee").get}catch(e){return l}}}():l,d=r(4573)(),p=r(8912)(),h=Object.getPrototypeOf||(p?function(e){return e.__proto__}:null),m={},f="undefined"!=typeof Uint8Array&&h?h(Uint8Array):a,y={"%AggregateError%":"undefined"==typeof AggregateError?a:AggregateError,"%Array%":Array,"%ArrayBuffer%":"undefined"==typeof ArrayBuffer?a:ArrayBuffer,"%ArrayIteratorPrototype%":d&&h?h([][Symbol.iterator]()):a,"%AsyncFromSyncIteratorPrototype%":a,"%AsyncFunction%":m,"%AsyncGenerator%":m,"%AsyncGeneratorFunction%":m,"%AsyncIteratorPrototype%":m,"%Atomics%":"undefined"==typeof Atomics?a:Atomics,"%BigInt%":"undefined"==typeof BigInt?a:BigInt,"%BigInt64Array%":"undefined"==typeof BigInt64Array?a:BigInt64Array,"%BigUint64Array%":"undefined"==typeof BigUint64Array?a:BigUint64Array,"%Boolean%":Boolean,"%DataView%":"undefined"==typeof DataView?a:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Error,"%eval%":eval,"%EvalError%":EvalError,"%Float32Array%":"undefined"==typeof Float32Array?a:Float32Array,"%Float64Array%":"undefined"==typeof Float64Array?a:Float64Array,"%FinalizationRegistry%":"undefined"==typeof FinalizationRegistry?a:FinalizationRegistry,"%Function%":i,"%GeneratorFunction%":m,"%Int8Array%":"undefined"==typeof Int8Array?a:Int8Array,"%Int16Array%":"undefined"==typeof Int16Array?a:Int16Array,"%Int32Array%":"undefined"==typeof Int32Array?a:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":d&&h?h(h([][Symbol.iterator]())):a,"%JSON%":"object"==typeof JSON?JSON:a,"%Map%":"undefined"==typeof Map?a:Map,"%MapIteratorPrototype%":"undefined"!=typeof Map&&d&&h?h((new Map)[Symbol.iterator]()):a,"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":"undefined"==typeof Promise?a:Promise,"%Proxy%":"undefined"==typeof Proxy?a:Proxy,"%RangeError%":RangeError,"%ReferenceError%":ReferenceError,"%Reflect%":"undefined"==typeof Reflect?a:Reflect,"%RegExp%":RegExp,"%Set%":"undefined"==typeof Set?a:Set,"%SetIteratorPrototype%":"undefined"!=typeof Set&&d&&h?h((new Set)[Symbol.iterator]()):a,"%SharedArrayBuffer%":"undefined"==typeof SharedArrayBuffer?a:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":d&&h?h(""[Symbol.iterator]()):a,"%Symbol%":d?Symbol:a,"%SyntaxError%":n,"%ThrowTypeError%":u,"%TypedArray%":f,"%TypeError%":o,"%Uint8Array%":"undefined"==typeof Uint8Array?a:Uint8Array,"%Uint8ClampedArray%":"undefined"==typeof Uint8ClampedArray?a:Uint8ClampedArray,"%Uint16Array%":"undefined"==typeof Uint16Array?a:Uint16Array,"%Uint32Array%":"undefined"==typeof Uint32Array?a:Uint32Array,"%URIError%":URIError,"%WeakMap%":"undefined"==typeof WeakMap?a:WeakMap,"%WeakRef%":"undefined"==typeof WeakRef?a:WeakRef,"%WeakSet%":"undefined"==typeof WeakSet?a:WeakSet};if(h)try{null.error}catch(e){var g=h(h(e));y["%Error.prototype%"]=g}var b=function e(t){var r;if("%AsyncFunction%"===t)r=s("async function () {}");else if("%GeneratorFunction%"===t)r=s("function* () {}");else if("%AsyncGeneratorFunction%"===t)r=s("async function* () {}");else if("%AsyncGenerator%"===t){var a=e("%AsyncGeneratorFunction%");a&&(r=a.prototype)}else if("%AsyncIteratorPrototype%"===t){var n=e("%AsyncGenerator%");n&&h&&(r=h(n.prototype))}return y[t]=r,r},v={"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},w=r(4672),A=r(2907),x=w.call(Function.call,Array.prototype.concat),S=w.call(Function.apply,Array.prototype.splice),F=w.call(Function.call,String.prototype.replace),_=w.call(Function.call,String.prototype.slice),P=w.call(Function.call,RegExp.prototype.exec),k=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,E=/\\(\\)?/g,j=function(e,t){var r,a=e;if(A(v,a)&&(a="%"+(r=v[a])[0]+"%"),A(y,a)){var i=y[a];if(i===m&&(i=b(a)),void 0===i&&!t)throw new o("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:r,name:a,value:i}}throw new n("intrinsic "+e+" does not exist!")};e.exports=function(e,t){if("string"!=typeof e||0===e.length)throw new o("intrinsic name must be a non-empty string");if(arguments.length>1&&"boolean"!=typeof t)throw new o('"allowMissing" argument must be a boolean');if(null===P(/^%?[^%]*%?$/,e))throw new n("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var r=function(e){var t=_(e,0,1),r=_(e,-1);if("%"===t&&"%"!==r)throw new n("invalid intrinsic syntax, expected closing `%`");if("%"===r&&"%"!==t)throw new n("invalid intrinsic syntax, expected opening `%`");var a=[];return F(e,k,(function(e,t,r,n){a[a.length]=r?F(n,E,"$1"):t||e})),a}(e),a=r.length>0?r[0]:"",i=j("%"+a+"%",t),s=i.name,l=i.value,u=!1,d=i.alias;d&&(a=d[0],S(r,x([0,1],d)));for(var p=1,h=!0;p<r.length;p+=1){var m=r[p],f=_(m,0,1),g=_(m,-1);if(('"'===f||"'"===f||"`"===f||'"'===g||"'"===g||"`"===g)&&f!==g)throw new n("property names with quotes must have matching quotes");if("constructor"!==m&&h||(u=!0),A(y,s="%"+(a+="."+m)+"%"))l=y[s];else if(null!=l){if(!(m in l)){if(!t)throw new o("base intrinsic for "+e+" exists, but the property is not available.");return}if(c&&p+1>=r.length){var b=c(l,m);l=(h=!!b)&&"get"in b&&!("originalValue"in b.get)?b.get:l[m]}else h=A(l,m),l=l[m];h&&!u&&(y[s]=l)}}return l}},8337:(e,t,r)=>{"use strict";var a=r(4663)("%Object.getOwnPropertyDescriptor%",!0);if(a)try{a([],"length")}catch(e){a=null}e.exports=a},3219:(e,t,r)=>{"use strict";var a=r(4663)("%Object.defineProperty%",!0),n=function(){if(a)try{return a({},"a",{value:1}),!0}catch(e){return!1}return!1};n.hasArrayLengthDefineBug=function(){if(!n())return null;try{return 1!==a([],"length",{value:1}).length}catch(e){return!0}},e.exports=n},8912:e=>{"use strict";var t={foo:{}},r=Object;e.exports=function(){return{__proto__:t}.foo===t.foo&&!({__proto__:null}instanceof r)}},4573:(e,t,r)=>{"use strict";var a="undefined"!=typeof Symbol&&Symbol,n=r(4283);e.exports=function(){return"function"==typeof a&&"function"==typeof Symbol&&"symbol"==typeof a("foo")&&"symbol"==typeof Symbol("bar")&&n()}},4283:e=>{"use strict";e.exports=function(){if("function"!=typeof Symbol||"function"!=typeof Object.getOwnPropertySymbols)return!1;if("symbol"==typeof Symbol.iterator)return!0;var e={},t=Symbol("test"),r=Object(t);if("string"==typeof t)return!1;if("[object Symbol]"!==Object.prototype.toString.call(t))return!1;if("[object Symbol]"!==Object.prototype.toString.call(r))return!1;for(t in e[t]=42,e)return!1;if("function"==typeof Object.keys&&0!==Object.keys(e).length)return!1;if("function"==typeof Object.getOwnPropertyNames&&0!==Object.getOwnPropertyNames(e).length)return!1;var a=Object.getOwnPropertySymbols(e);if(1!==a.length||a[0]!==t)return!1;if(!Object.prototype.propertyIsEnumerable.call(e,t))return!1;if("function"==typeof Object.getOwnPropertyDescriptor){var n=Object.getOwnPropertyDescriptor(e,t);if(42!==n.value||!0!==n.enumerable)return!1}return!0}},2907:(e,t,r)=>{"use strict";var a=Function.prototype.call,n=Object.prototype.hasOwnProperty,i=r(4672);e.exports=i.call(a,n)},9427:(e,t,r)=>{"use strict";var a=r(1020),n=a.ValidatorResult,i=a.SchemaError,o={ignoreProperties:{id:!0,default:!0,description:!0,title:!0,additionalItems:!0,then:!0,else:!0,$schema:!0,$ref:!0,extends:!0}},s=o.validators={};function c(e,t,r,a,n){var i=t.throwError,o=t.throwAll;t.throwError=!1,t.throwAll=!1;var s=this.validateSchema(e,n,t,r);return t.throwError=i,t.throwAll=o,!s.valid&&a instanceof Function&&a(s),s.valid}function l(e,t){if(Object.hasOwnProperty.call(e,t))return e[t];if(t in e)for(;e=Object.getPrototypeOf(e);)if(Object.propertyIsEnumerable.call(e,t))return e[t]}function u(e,t,r,a,n,i){if(this.types.object(e)&&(!t.properties||void 0===t.properties[n]))if(!1===t.additionalProperties)i.addError({name:"additionalProperties",argument:n,message:"is not allowed to have the additional property "+JSON.stringify(n)});else{var o=t.additionalProperties||{};"function"==typeof r.preValidateProperty&&r.preValidateProperty(e,n,o,r,a);var s=this.validateSchema(e[n],o,r,a.makeChild(o,n));s.instance!==i.instance[n]&&(i.instance[n]=s.instance),i.importErrors(s)}}s.type=function(e,t,r,a){if(void 0===e)return null;var i=new n(e,t,r,a),o=Array.isArray(t.type)?t.type:[t.type];if(!o.some(this.testType.bind(this,e,t,r,a))){var s=o.map((function(e){if(e){var t=e.$id||e.id;return t?"<"+t+">":e+""}}));i.addError({name:"type",argument:s,message:"is not of a type(s) "+s})}return i},s.anyOf=function(e,t,r,a){if(void 0===e)return null;var o=new n(e,t,r,a),s=new n(e,t,r,a);if(!Array.isArray(t.anyOf))throw new i("anyOf must be an array");if(!t.anyOf.some(c.bind(this,e,r,a,(function(e){s.importErrors(e)})))){var l=t.anyOf.map((function(e,t){var r=e.$id||e.id;return r?"<"+r+">":e.title&&JSON.stringify(e.title)||e.$ref&&"<"+e.$ref+">"||"[subschema "+t+"]"}));r.nestedErrors&&o.importErrors(s),o.addError({name:"anyOf",argument:l,message:"is not any of "+l.join(",")})}return o},s.allOf=function(e,t,r,a){if(void 0===e)return null;if(!Array.isArray(t.allOf))throw new i("allOf must be an array");var o=new n(e,t,r,a),s=this;return t.allOf.forEach((function(t,n){var i=s.validateSchema(e,t,r,a);if(!i.valid){var c=t.$id||t.id||t.title&&JSON.stringify(t.title)||t.$ref&&"<"+t.$ref+">"||"[subschema "+n+"]";o.addError({name:"allOf",argument:{id:c,length:i.errors.length,valid:i},message:"does not match allOf schema "+c+" with "+i.errors.length+" error[s]:"}),o.importErrors(i)}})),o},s.oneOf=function(e,t,r,a){if(void 0===e)return null;if(!Array.isArray(t.oneOf))throw new i("oneOf must be an array");var o=new n(e,t,r,a),s=new n(e,t,r,a),l=t.oneOf.filter(c.bind(this,e,r,a,(function(e){s.importErrors(e)}))).length,u=t.oneOf.map((function(e,t){return e.$id||e.id||e.title&&JSON.stringify(e.title)||e.$ref&&"<"+e.$ref+">"||"[subschema "+t+"]"}));return 1!==l&&(r.nestedErrors&&o.importErrors(s),o.addError({name:"oneOf",argument:u,message:"is not exactly one from "+u.join(",")})),o},s.if=function(e,t,r,i){if(void 0===e)return null;if(!a.isSchema(t.if))throw new Error('Expected "if" keyword to be a schema');var o,s=c.call(this,e,r,i,null,t.if),l=new n(e,t,r,i);if(s){if(void 0===t.then)return;if(!a.isSchema(t.then))throw new Error('Expected "then" keyword to be a schema');o=this.validateSchema(e,t.then,r,i.makeChild(t.then)),l.importErrors(o)}else{if(void 0===t.else)return;if(!a.isSchema(t.else))throw new Error('Expected "else" keyword to be a schema');o=this.validateSchema(e,t.else,r,i.makeChild(t.else)),l.importErrors(o)}return l},s.propertyNames=function(e,t,r,o){if(this.types.object(e)){var s=new n(e,t,r,o),c=void 0!==t.propertyNames?t.propertyNames:{};if(!a.isSchema(c))throw new i('Expected "propertyNames" to be a schema (object or boolean)');for(var u in e)if(void 0!==l(e,u)){var d=this.validateSchema(u,c,r,o.makeChild(c));s.importErrors(d)}return s}},s.properties=function(e,t,r,a){if(this.types.object(e)){var o=new n(e,t,r,a),s=t.properties||{};for(var c in s){var u=s[c];if(void 0!==u){if(null===u)throw new i('Unexpected null, expected schema in "properties"');"function"==typeof r.preValidateProperty&&r.preValidateProperty(e,c,u,r,a);var d=l(e,c),p=this.validateSchema(d,u,r,a.makeChild(u,c));p.instance!==o.instance[c]&&(o.instance[c]=p.instance),o.importErrors(p)}}return o}},s.patternProperties=function(e,t,r,a){if(this.types.object(e)){var o=new n(e,t,r,a),s=t.patternProperties||{};for(var c in e){var l=!0;for(var d in s){var p=s[d];if(void 0!==p){if(null===p)throw new i('Unexpected null, expected schema in "patternProperties"');try{var h=new RegExp(d,"u")}catch(e){h=new RegExp(d)}if(h.test(c)){l=!1,"function"==typeof r.preValidateProperty&&r.preValidateProperty(e,c,p,r,a);var m=this.validateSchema(e[c],p,r,a.makeChild(p,c));m.instance!==o.instance[c]&&(o.instance[c]=m.instance),o.importErrors(m)}}}l&&u.call(this,e,t,r,a,c,o)}return o}},s.additionalProperties=function(e,t,r,a){if(this.types.object(e)){if(t.patternProperties)return null;var i=new n(e,t,r,a);for(var o in e)u.call(this,e,t,r,a,o,i);return i}},s.minProperties=function(e,t,r,a){if(this.types.object(e)){var i=new n(e,t,r,a);return Object.keys(e).length>=t.minProperties||i.addError({name:"minProperties",argument:t.minProperties,message:"does not meet minimum property length of "+t.minProperties}),i}},s.maxProperties=function(e,t,r,a){if(this.types.object(e)){var i=new n(e,t,r,a);return Object.keys(e).length<=t.maxProperties||i.addError({name:"maxProperties",argument:t.maxProperties,message:"does not meet maximum property length of "+t.maxProperties}),i}},s.items=function(e,t,r,a){var i=this;if(this.types.array(e)&&void 0!==t.items){var o=new n(e,t,r,a);return e.every((function(e,n){if(Array.isArray(t.items))var s=void 0===t.items[n]?t.additionalItems:t.items[n];else s=t.items;if(void 0===s)return!0;if(!1===s)return o.addError({name:"items",message:"additionalItems not permitted"}),!1;var c=i.validateSchema(e,s,r,a.makeChild(s,n));return c.instance!==o.instance[n]&&(o.instance[n]=c.instance),o.importErrors(c),!0})),o}},s.contains=function(e,t,r,i){var o=this;if(this.types.array(e)&&void 0!==t.contains){if(!a.isSchema(t.contains))throw new Error('Expected "contains" keyword to be a schema');var s=new n(e,t,r,i);return!1===e.some((function(e,a){return 0===o.validateSchema(e,t.contains,r,i.makeChild(t.contains,a)).errors.length}))&&s.addError({name:"contains",argument:t.contains,message:"must contain an item matching given schema"}),s}},s.minimum=function(e,t,r,a){if(this.types.number(e)){var i=new n(e,t,r,a);return t.exclusiveMinimum&&!0===t.exclusiveMinimum?e>t.minimum||i.addError({name:"minimum",argument:t.minimum,message:"must be greater than "+t.minimum}):e>=t.minimum||i.addError({name:"minimum",argument:t.minimum,message:"must be greater than or equal to "+t.minimum}),i}},s.maximum=function(e,t,r,a){if(this.types.number(e)){var i=new n(e,t,r,a);return t.exclusiveMaximum&&!0===t.exclusiveMaximum?e<t.maximum||i.addError({name:"maximum",argument:t.maximum,message:"must be less than "+t.maximum}):e<=t.maximum||i.addError({name:"maximum",argument:t.maximum,message:"must be less than or equal to "+t.maximum}),i}},s.exclusiveMinimum=function(e,t,r,a){if("boolean"!=typeof t.exclusiveMinimum&&this.types.number(e)){var i=new n(e,t,r,a);return e>t.exclusiveMinimum||i.addError({name:"exclusiveMinimum",argument:t.exclusiveMinimum,message:"must be strictly greater than "+t.exclusiveMinimum}),i}},s.exclusiveMaximum=function(e,t,r,a){if("boolean"!=typeof t.exclusiveMaximum&&this.types.number(e)){var i=new n(e,t,r,a);return e<t.exclusiveMaximum||i.addError({name:"exclusiveMaximum",argument:t.exclusiveMaximum,message:"must be strictly less than "+t.exclusiveMaximum}),i}};var d=function(e,t,r,o,s,c){if(this.types.number(e)){var l=t[s];if(0==l)throw new i(s+" cannot be zero");var u=new n(e,t,r,o),d=a.getDecimalPlaces(e),p=a.getDecimalPlaces(l),h=Math.max(d,p),m=Math.pow(10,h);return Math.round(e*m)%Math.round(l*m)!=0&&u.addError({name:s,argument:l,message:c+JSON.stringify(l)}),u}};function p(e,t,r){var n,i=r.length;for(n=t+1;n<i;n++)if(a.deepCompareStrict(e,r[n]))return!1;return!0}s.multipleOf=function(e,t,r,a){return d.call(this,e,t,r,a,"multipleOf","is not a multiple of (divisible by) ")},s.divisibleBy=function(e,t,r,a){return d.call(this,e,t,r,a,"divisibleBy","is not divisible by (multiple of) ")},s.required=function(e,t,r,a){var i=new n(e,t,r,a);return void 0===e&&!0===t.required?i.addError({name:"required",message:"is required"}):this.types.object(e)&&Array.isArray(t.required)&&t.required.forEach((function(t){void 0===l(e,t)&&i.addError({name:"required",argument:t,message:"requires property "+JSON.stringify(t)})})),i},s.pattern=function(e,t,r,a){if(this.types.string(e)){var i=new n(e,t,r,a),o=t.pattern;try{var s=new RegExp(o,"u")}catch(e){s=new RegExp(o)}return e.match(s)||i.addError({name:"pattern",argument:t.pattern,message:"does not match pattern "+JSON.stringify(t.pattern.toString())}),i}},s.format=function(e,t,r,i){if(void 0!==e){var o=new n(e,t,r,i);return o.disableFormat||a.isFormat(e,t.format,this)||o.addError({name:"format",argument:t.format,message:"does not conform to the "+JSON.stringify(t.format)+" format"}),o}},s.minLength=function(e,t,r,a){if(this.types.string(e)){var i=new n(e,t,r,a),o=e.match(/[\uDC00-\uDFFF]/g);return e.length-(o?o.length:0)>=t.minLength||i.addError({name:"minLength",argument:t.minLength,message:"does not meet minimum length of "+t.minLength}),i}},s.maxLength=function(e,t,r,a){if(this.types.string(e)){var i=new n(e,t,r,a),o=e.match(/[\uDC00-\uDFFF]/g);return e.length-(o?o.length:0)<=t.maxLength||i.addError({name:"maxLength",argument:t.maxLength,message:"does not meet maximum length of "+t.maxLength}),i}},s.minItems=function(e,t,r,a){if(this.types.array(e)){var i=new n(e,t,r,a);return e.length>=t.minItems||i.addError({name:"minItems",argument:t.minItems,message:"does not meet minimum length of "+t.minItems}),i}},s.maxItems=function(e,t,r,a){if(this.types.array(e)){var i=new n(e,t,r,a);return e.length<=t.maxItems||i.addError({name:"maxItems",argument:t.maxItems,message:"does not meet maximum length of "+t.maxItems}),i}},s.uniqueItems=function(e,t,r,a){if(!0===t.uniqueItems&&this.types.array(e)){var i=new n(e,t,r,a);return e.every(p)||i.addError({name:"uniqueItems",message:"contains duplicate item"}),i}},s.dependencies=function(e,t,r,a){if(this.types.object(e)){var i=new n(e,t,r,a);for(var o in t.dependencies)if(void 0!==e[o]){var s=t.dependencies[o],c=a.makeChild(s,o);if("string"==typeof s&&(s=[s]),Array.isArray(s))s.forEach((function(t){void 0===e[t]&&i.addError({name:"dependencies",argument:c.propertyPath,message:"property "+t+" not found, required by "+c.propertyPath})}));else{var l=this.validateSchema(e,s,r,c);i.instance!==l.instance&&(i.instance=l.instance),l&&l.errors.length&&(i.addError({name:"dependencies",argument:c.propertyPath,message:"does not meet dependency required by "+c.propertyPath}),i.importErrors(l))}}return i}},s.enum=function(e,t,r,o){if(void 0===e)return null;if(!Array.isArray(t.enum))throw new i("enum expects an array",t);var s=new n(e,t,r,o);return t.enum.some(a.deepCompareStrict.bind(null,e))||s.addError({name:"enum",argument:t.enum,message:"is not one of enum values: "+t.enum.map(String).join(",")}),s},s.const=function(e,t,r,i){if(void 0===e)return null;var o=new n(e,t,r,i);return a.deepCompareStrict(t.const,e)||o.addError({name:"const",argument:t.const,message:"does not exactly match expected constant: "+t.const}),o},s.not=s.disallow=function(e,t,r,a){var i=this;if(void 0===e)return null;var o=new n(e,t,r,a),s=t.not||t.disallow;return s?(Array.isArray(s)||(s=[s]),s.forEach((function(n){if(i.testType(e,t,r,a,n)){var s=n&&(n.$id||n.id)||n;o.addError({name:"not",argument:s,message:"is of prohibited type "+s})}})),o):null},e.exports=o},1020:(e,t,r)=>{"use strict";var a=r(8526),n=t.ValidationError=function(e,t,r,a,n,i){if(Array.isArray(a)?(this.path=a,this.property=a.reduce((function(e,t){return e+d(t)}),"instance")):void 0!==a&&(this.property=a),e&&(this.message=e),r){var o=r.$id||r.id;this.schema=o||r}void 0!==t&&(this.instance=t),this.name=n,this.argument=i,this.stack=this.toString()};n.prototype.toString=function(){return this.property+" "+this.message};var i=t.ValidatorResult=function(e,t,r,a){this.instance=e,this.schema=t,this.options=r,this.path=a.path,this.propertyPath=a.propertyPath,this.errors=[],this.throwError=r&&r.throwError,this.throwFirst=r&&r.throwFirst,this.throwAll=r&&r.throwAll,this.disableFormat=r&&!0===r.disableFormat};function o(e,t){return t+": "+e.toString()+"\n"}function s(e){Error.captureStackTrace&&Error.captureStackTrace(this,s),this.instance=e.instance,this.schema=e.schema,this.options=e.options,this.errors=e.errors}i.prototype.addError=function(e){var t;if("string"==typeof e)t=new n(e,this.instance,this.schema,this.path);else{if(!e)throw new Error("Missing error detail");if(!e.message)throw new Error("Missing error message");if(!e.name)throw new Error("Missing validator type");t=new n(e.message,this.instance,this.schema,this.path,e.name,e.argument)}if(this.errors.push(t),this.throwFirst)throw new s(this);if(this.throwError)throw t;return t},i.prototype.importErrors=function(e){"string"==typeof e||e&&e.validatorType?this.addError(e):e&&e.errors&&(this.errors=this.errors.concat(e.errors))},i.prototype.toString=function(e){return this.errors.map(o).join("")},Object.defineProperty(i.prototype,"valid",{get:function(){return!this.errors.length}}),e.exports.ValidatorResultError=s,s.prototype=new Error,s.prototype.constructor=s,s.prototype.name="Validation Error";var c=t.SchemaError=function e(t,r){this.message=t,this.schema=r,Error.call(this,t),Error.captureStackTrace(this,e)};c.prototype=Object.create(Error.prototype,{constructor:{value:c,enumerable:!1},name:{value:"SchemaError",enumerable:!1}});var l=t.SchemaContext=function(e,t,r,a,n){this.schema=e,this.options=t,Array.isArray(r)?(this.path=r,this.propertyPath=r.reduce((function(e,t){return e+d(t)}),"instance")):this.propertyPath=r,this.base=a,this.schemas=n};l.prototype.resolve=function(e){return a.resolve(this.base,e)},l.prototype.makeChild=function(e,t){var r=void 0===t?this.path:this.path.concat([t]),n=e.$id||e.id,i=a.resolve(this.base,n||""),o=new l(e,this.options,r,i,Object.create(this.schemas));return n&&!o.schemas[i]&&(o.schemas[i]=e),o};var u=t.FORMAT_REGEXPS={"date-time":/^\d{4}-(?:0[0-9]{1}|1[0-2]{1})-(3[01]|0[1-9]|[12][0-9])[tT ](2[0-4]|[01][0-9]):([0-5][0-9]):(60|[0-5][0-9])(\.\d+)?([zZ]|[+-]([0-5][0-9]):(60|[0-5][0-9]))$/,date:/^\d{4}-(?:0[0-9]{1}|1[0-2]{1})-(3[01]|0[1-9]|[12][0-9])$/,time:/^(2[0-4]|[01][0-9]):([0-5][0-9]):(60|[0-5][0-9])$/,duration:/P(T\d+(H(\d+M(\d+S)?)?|M(\d+S)?|S)|\d+(D|M(\d+D)?|Y(\d+M(\d+D)?)?)(T\d+(H(\d+M(\d+S)?)?|M(\d+S)?|S))?|\d+W)/i,email:/^(?:[\w\!\#\$\%\&\'\*\+\-\/\=\?\^\`\{\|\}\~]+\.)*[\w\!\#\$\%\&\'\*\+\-\/\=\?\^\`\{\|\}\~]+@(?:(?:(?:[a-zA-Z0-9](?:[a-zA-Z0-9\-](?!\.)){0,61}[a-zA-Z0-9]?\.)+[a-zA-Z0-9](?:[a-zA-Z0-9\-](?!$)){0,61}[a-zA-Z0-9]?)|(?:\[(?:(?:[01]?\d{1,2}|2[0-4]\d|25[0-5])\.){3}(?:[01]?\d{1,2}|2[0-4]\d|25[0-5])\]))$/,"idn-email":/^("(?:[!#-\[\]-\u{10FFFF}]|\\[\t -\u{10FFFF}])*"|[!#-'*+\-/-9=?A-Z\^-\u{10FFFF}](?:\.?[!#-'*+\-/-9=?A-Z\^-\u{10FFFF}])*)@([!#-'*+\-/-9=?A-Z\^-\u{10FFFF}](?:\.?[!#-'*+\-/-9=?A-Z\^-\u{10FFFF}])*|\[[!-Z\^-\u{10FFFF}]*\])$/u,"ip-address":/^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/,ipv6:/^\s*((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(%.+)?\s*$/,uri:/^[a-zA-Z][a-zA-Z0-9+.-]*:[^\s]*$/,"uri-reference":/^(((([A-Za-z][+\-.0-9A-Za-z]*(:%[0-9A-Fa-f]{2}|:[!$&-.0-;=?-Z_a-z~]|[/?])|\?)(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*|([A-Za-z][+\-.0-9A-Za-z]*:?)?)|([A-Za-z][+\-.0-9A-Za-z]*:)?\/((%[0-9A-Fa-f]{2}|\/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~])+|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~]+)?|[.0-:A-Fa-f]+)\])?)(:\d*)?[/?]|[!$&-.0-;=?-Z_a-z~])(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*|(\/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~])+|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~]+)?|[.0-:A-Fa-f]+)\])?)(:\d*)?)?))#(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*|(([A-Za-z][+\-.0-9A-Za-z]*)?%[0-9A-Fa-f]{2}|[!$&-.0-9;=@_~]|[A-Za-z][+\-.0-9A-Za-z]*[!$&-*,;=@_~])(%[0-9A-Fa-f]{2}|[!$&-.0-9;=@-Z_a-z~])*((([/?](%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*)?#|[/?])(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*)?|([A-Za-z][+\-.0-9A-Za-z]*(:%[0-9A-Fa-f]{2}|:[!$&-.0-;=?-Z_a-z~]|[/?])|\?)(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*|([A-Za-z][+\-.0-9A-Za-z]*:)?\/((%[0-9A-Fa-f]{2}|\/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~])+|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~]+)?|[.0-:A-Fa-f]+)\])?)(:\d*)?[/?]|[!$&-.0-;=?-Z_a-z~])(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*|\/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~])+(:\d*)?|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~]+)?|[.0-:A-Fa-f]+)\])?:\d*|\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~]+)?|[.0-:A-Fa-f]+)\])?)?|[A-Za-z][+\-.0-9A-Za-z]*:?)?$/,iri:/^[a-zA-Z][a-zA-Z0-9+.-]*:[^\s]*$/,"iri-reference":/^(((([A-Za-z][+\-.0-9A-Za-z]*(:%[0-9A-Fa-f]{2}|:[!$&-.0-;=?-Z_a-z~-\u{10FFFF}]|[/?])|\?)(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~-\u{10FFFF}])*|([A-Za-z][+\-.0-9A-Za-z]*:?)?)|([A-Za-z][+\-.0-9A-Za-z]*:)?\/((%[0-9A-Fa-f]{2}|\/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~-\u{10FFFF}])+|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~-\u{10FFFF}]+)?|[.0-:A-Fa-f]+)\])?)(:\d*)?[/?]|[!$&-.0-;=?-Z_a-z~-\u{10FFFF}])(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~-\u{10FFFF}])*|(\/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~-\u{10FFFF}])+|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~-\u{10FFFF}]+)?|[.0-:A-Fa-f]+)\])?)(:\d*)?)?))#(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~-\u{10FFFF}])*|(([A-Za-z][+\-.0-9A-Za-z]*)?%[0-9A-Fa-f]{2}|[!$&-.0-9;=@_~-\u{10FFFF}]|[A-Za-z][+\-.0-9A-Za-z]*[!$&-*,;=@_~-\u{10FFFF}])(%[0-9A-Fa-f]{2}|[!$&-.0-9;=@-Z_a-z~-\u{10FFFF}])*((([/?](%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~-\u{10FFFF}])*)?#|[/?])(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~-\u{10FFFF}])*)?|([A-Za-z][+\-.0-9A-Za-z]*(:%[0-9A-Fa-f]{2}|:[!$&-.0-;=?-Z_a-z~-\u{10FFFF}]|[/?])|\?)(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~-\u{10FFFF}])*|([A-Za-z][+\-.0-9A-Za-z]*:)?\/((%[0-9A-Fa-f]{2}|\/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~-\u{10FFFF}])+|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~-\u{10FFFF}]+)?|[.0-:A-Fa-f]+)\])?)(:\d*)?[/?]|[!$&-.0-;=?-Z_a-z~-\u{10FFFF}])(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~-\u{10FFFF}])*|\/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~-\u{10FFFF}])+(:\d*)?|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~-\u{10FFFF}]+)?|[.0-:A-Fa-f]+)\])?:\d*|\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~-\u{10FFFF}]+)?|[.0-:A-Fa-f]+)\])?)?|[A-Za-z][+\-.0-9A-Za-z]*:?)?$/u,uuid:/^[0-9A-F]{8}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{12}$/i,"uri-template":/(%[0-9a-f]{2}|[!#$&(-;=?@\[\]_a-z~]|\{[!#&+,./;=?@|]?(%[0-9a-f]{2}|[0-9_a-z])(\.?(%[0-9a-f]{2}|[0-9_a-z]))*(:[1-9]\d{0,3}|\*)?(,(%[0-9a-f]{2}|[0-9_a-z])(\.?(%[0-9a-f]{2}|[0-9_a-z]))*(:[1-9]\d{0,3}|\*)?)*\})*/iu,"json-pointer":/^(\/([\x00-\x2e0-@\[-}\x7f]|~[01])*)*$/iu,"relative-json-pointer":/^\d+(#|(\/([\x00-\x2e0-@\[-}\x7f]|~[01])*)*)$/iu,hostname:/^(?=.{1,255}$)[0-9A-Za-z](?:(?:[0-9A-Za-z]|-){0,61}[0-9A-Za-z])?(?:\.[0-9A-Za-z](?:(?:[0-9A-Za-z]|-){0,61}[0-9A-Za-z])?)*\.?$/,"host-name":/^(?=.{1,255}$)[0-9A-Za-z](?:(?:[0-9A-Za-z]|-){0,61}[0-9A-Za-z])?(?:\.[0-9A-Za-z](?:(?:[0-9A-Za-z]|-){0,61}[0-9A-Za-z])?)*\.?$/,"utc-millisec":function(e){return"string"==typeof e&&parseFloat(e)===parseInt(e,10)&&!isNaN(e)},regex:function(e){var t=!0;try{new RegExp(e)}catch(e){t=!1}return t},style:/[\r\n\t ]*[^\r\n\t ][^:]*:[\r\n\t ]*[^\r\n\t ;]*[\r\n\t ]*;?/,color:/^(#?([0-9A-Fa-f]{3}){1,2}\b|aqua|black|blue|fuchsia|gray|green|lime|maroon|navy|olive|orange|purple|red|silver|teal|white|yellow|(rgb\(\s*\b([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\b\s*,\s*\b([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\b\s*,\s*\b([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\b\s*\))|(rgb\(\s*(\d?\d%|100%)+\s*,\s*(\d?\d%|100%)+\s*,\s*(\d?\d%|100%)+\s*\)))$/,phone:/^\+(?:[0-9] ?){6,14}[0-9]$/,alpha:/^[a-zA-Z]+$/,alphanumeric:/^[a-zA-Z0-9]+$/};u.regexp=u.regex,u.pattern=u.regex,u.ipv4=u["ip-address"],t.isFormat=function(e,t,r){if("string"==typeof e&&void 0!==u[t]){if(u[t]instanceof RegExp)return u[t].test(e);if("function"==typeof u[t])return u[t](e)}else if(r&&r.customFormats&&"function"==typeof r.customFormats[t])return r.customFormats[t](e);return!0};var d=t.makeSuffix=function(e){return(e=e.toString()).match(/[.\s\[\]]/)||e.match(/^[\d]/)?e.match(/^\d+$/)?"["+e+"]":"["+JSON.stringify(e)+"]":"."+e};function p(e,t,r,a){"object"==typeof r?t[a]=f(e[a],r):-1===e.indexOf(r)&&t.push(r)}function h(e,t,r){t[r]=e[r]}function m(e,t,r,a){"object"==typeof t[a]&&t[a]&&e[a]?r[a]=f(e[a],t[a]):r[a]=t[a]}function f(e,t){var r=Array.isArray(t),a=r&&[]||{};return r?(e=e||[],a=a.concat(e),t.forEach(p.bind(null,e,a))):(e&&"object"==typeof e&&Object.keys(e).forEach(h.bind(null,e,a)),Object.keys(t).forEach(m.bind(null,e,t,a))),a}function y(e){return"/"+encodeURIComponent(e).replace(/~/g,"%7E")}t.deepCompareStrict=function e(t,r){if(typeof t!=typeof r)return!1;if(Array.isArray(t))return!!Array.isArray(r)&&t.length===r.length&&t.every((function(a,n){return e(t[n],r[n])}));if("object"==typeof t){if(!t||!r)return t===r;var a=Object.keys(t),n=Object.keys(r);return a.length===n.length&&a.every((function(a){return e(t[a],r[a])}))}return t===r},e.exports.deepMerge=f,t.objectGetPath=function(e,t){for(var r,a=t.split("/").slice(1);"string"==typeof(r=a.shift());){var n=decodeURIComponent(r.replace(/~0/,"~").replace(/~1/g,"/"));if(!(n in e))return;e=e[n]}return e},t.encodePath=function(e){return e.map(y).join("")},t.getDecimalPlaces=function(e){var t=0;if(isNaN(e))return t;"number"!=typeof e&&(e=Number(e));var r=e.toString().split("e");if(2===r.length){if("-"!==r[1][0])return t;t=Number(r[1].slice(1))}var a=r[0].split(".");return 2===a.length&&(t+=a[1].length),t},t.isSchema=function(e){return"object"==typeof e&&e||"boolean"==typeof e}},4445:(e,t,r)=>{"use strict";r(6719);r(1020).ValidatorResult,r(1020).ValidatorResultError,r(1020).ValidationError,r(1020).SchemaError,r(3107),r(3107).R},3107:(e,t,r)=>{"use strict";var a=r(8526),n=r(1020);function i(e,t){this.id=e,this.ref=t}e.exports.R=function(e,t){function r(e,t){if(t&&"object"==typeof t)if(t.$ref){var i=a.resolve(e,t.$ref);l[i]=l[i]?l[i]+1:0}else{var u=t.$id||t.id,d=u?a.resolve(e,u):e;if(d){if(d.indexOf("#")<0&&(d+="#"),c[d]){if(!n.deepCompareStrict(c[d],t))throw new Error("Schema <"+d+"> already exists with different definition");return c[d]}c[d]=t,"#"==d[d.length-1]&&(c[d.substring(0,d.length-1)]=t)}o(d+"/items",Array.isArray(t.items)?t.items:[t.items]),o(d+"/extends",Array.isArray(t.extends)?t.extends:[t.extends]),r(d+"/additionalItems",t.additionalItems),s(d+"/properties",t.properties),r(d+"/additionalProperties",t.additionalProperties),s(d+"/definitions",t.definitions),s(d+"/patternProperties",t.patternProperties),s(d+"/dependencies",t.dependencies),o(d+"/disallow",t.disallow),o(d+"/allOf",t.allOf),o(d+"/anyOf",t.anyOf),o(d+"/oneOf",t.oneOf),r(d+"/not",t.not)}}function o(e,t){if(Array.isArray(t))for(var a=0;a<t.length;a++)r(e+"/"+a,t[a])}function s(e,t){if(t&&"object"==typeof t)for(var a in t)r(e+"/"+a,t[a])}var c={},l={};return r(e,t),new i(c,l)}},6719:(e,t,r)=>{"use strict";var a=r(8526),n=r(9427),i=r(1020),o=r(3107).R,s=i.ValidatorResult,c=i.ValidatorResultError,l=i.SchemaError,u=i.SchemaContext,d=function e(){this.customFormats=Object.create(e.prototype.customFormats),this.schemas={},this.unresolvedRefs=[],this.types=Object.create(h),this.attributes=Object.create(n.validators)};function p(e){var t="string"==typeof e?e:e.$ref;return"string"==typeof t&&t}d.prototype.customFormats={},d.prototype.schemas=null,d.prototype.types=null,d.prototype.attributes=null,d.prototype.unresolvedRefs=null,d.prototype.addSchema=function(e,t){var r=this;if(!e)return null;var a=o(t||"/",e),n=t||e.$id||e.id;for(var i in a.id)this.schemas[i]=a.id[i];for(var i in a.ref)this.unresolvedRefs.push(i);return this.unresolvedRefs=this.unresolvedRefs.filter((function(e){return void 0===r.schemas[e]})),this.schemas[n]},d.prototype.addSubSchemaArray=function(e,t){if(Array.isArray(t))for(var r=0;r<t.length;r++)this.addSubSchema(e,t[r])},d.prototype.addSubSchemaObject=function(e,t){if(t&&"object"==typeof t)for(var r in t)this.addSubSchema(e,t[r])},d.prototype.setSchemas=function(e){this.schemas=e},d.prototype.getSchema=function(e){return this.schemas[e]},d.prototype.validate=function(e,t,r,n){if("boolean"!=typeof t&&"object"!=typeof t||null===t)throw new l("Expected `schema` to be an object or boolean");r||(r={});var i,d=t.$id||t.id,p=a.resolve(r.base||"/",d||"");if(!n){(n=new u(t,r,[],p,Object.create(this.schemas))).schemas[p]||(n.schemas[p]=t);var h=o(p,t);for(var m in h.id){var f=h.id[m];n.schemas[m]=f}}if(r.required&&void 0===e)return(i=new s(e,t,r,n)).addError("is required, but is undefined"),i;if(!(i=this.validateSchema(e,t,r,n)))throw new Error("Result undefined");if(r.throwAll&&i.errors.length)throw new c(i);return i},d.prototype.validateSchema=function(e,t,r,a){var o=new s(e,t,r,a);if("boolean"==typeof t)!0===t?t={}:!1===t&&(t={type:[]});else if(!t)throw new Error("schema is undefined");if(t.extends)if(Array.isArray(t.extends)){var c={schema:t,ctx:a};t.extends.forEach(this.schemaTraverser.bind(this,c)),t=c.schema,c.schema=null,c.ctx=null,c=null}else t=i.deepMerge(t,this.superResolve(t.extends,a));var d=p(t);if(d){var h=this.resolve(t,d,a),m=new u(h.subschema,r,a.path,h.switchSchema,a.schemas);return this.validateSchema(e,h.subschema,r,m)}var f=r&&r.skipAttributes||[];for(var y in t)if(!n.ignoreProperties[y]&&f.indexOf(y)<0){var g=null,b=this.attributes[y];if(b)g=b.call(this,e,t,r,a);else if(!1===r.allowUnknownAttributes)throw new l("Unsupported attribute: "+y,t);g&&o.importErrors(g)}if("function"==typeof r.rewrite){var v=r.rewrite.call(this,e,t,r,a);o.instance=v}return o},d.prototype.schemaTraverser=function(e,t){e.schema=i.deepMerge(e.schema,this.superResolve(t,e.ctx))},d.prototype.superResolve=function(e,t){var r=p(e);return r?this.resolve(e,r,t).subschema:e},d.prototype.resolve=function(e,t,r){if(t=r.resolve(t),r.schemas[t])return{subschema:r.schemas[t],switchSchema:t};var n=a.parse(t),o=n&&n.hash,s=o&&o.length&&t.substr(0,t.length-o.length);if(!s||!r.schemas[s])throw new l("no such schema <"+t+">",e);var c=i.objectGetPath(r.schemas[s],o.substr(1));if(void 0===c)throw new l("no such schema "+o+" located in <"+s+">",e);return{subschema:c,switchSchema:t}},d.prototype.testType=function(e,t,r,a,n){if(void 0!==n){if(null===n)throw new l('Unexpected null in "type" keyword');if("function"==typeof this.types[n])return this.types[n].call(this,e);if(n&&"object"==typeof n){var i=this.validateSchema(e,n,r,a);return void 0===i||!(i&&i.errors.length)}return!0}};var h=d.prototype.types={};h.string=function(e){return"string"==typeof e},h.number=function(e){return"number"==typeof e&&isFinite(e)},h.integer=function(e){return"number"==typeof e&&e%1==0},h.boolean=function(e){return"boolean"==typeof e},h.array=function(e){return Array.isArray(e)},h.null=function(e){return null===e},h.date=function(e){return e instanceof Date},h.any=function(e){return!0},h.object=function(e){return e&&"object"==typeof e&&!Array.isArray(e)&&!(e instanceof Date)},e.exports=d},201:(e,t,r)=>{var a="function"==typeof Map&&Map.prototype,n=Object.getOwnPropertyDescriptor&&a?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,i=a&&n&&"function"==typeof n.get?n.get:null,o=a&&Map.prototype.forEach,s="function"==typeof Set&&Set.prototype,c=Object.getOwnPropertyDescriptor&&s?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,l=s&&c&&"function"==typeof c.get?c.get:null,u=s&&Set.prototype.forEach,d="function"==typeof WeakMap&&WeakMap.prototype?WeakMap.prototype.has:null,p="function"==typeof WeakSet&&WeakSet.prototype?WeakSet.prototype.has:null,h="function"==typeof WeakRef&&WeakRef.prototype?WeakRef.prototype.deref:null,m=Boolean.prototype.valueOf,f=Object.prototype.toString,y=Function.prototype.toString,g=String.prototype.match,b=String.prototype.slice,v=String.prototype.replace,w=String.prototype.toUpperCase,A=String.prototype.toLowerCase,x=RegExp.prototype.test,S=Array.prototype.concat,F=Array.prototype.join,_=Array.prototype.slice,P=Math.floor,k="function"==typeof BigInt?BigInt.prototype.valueOf:null,E=Object.getOwnPropertySymbols,j="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?Symbol.prototype.toString:null,O="function"==typeof Symbol&&"object"==typeof Symbol.iterator,R="function"==typeof Symbol&&Symbol.toStringTag&&(Symbol.toStringTag,1)?Symbol.toStringTag:null,T=Object.prototype.propertyIsEnumerable,I=("function"==typeof Reflect?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(e){return e.__proto__}:null);function C(e,t){if(e===1/0||e===-1/0||e!=e||e&&e>-1e3&&e<1e3||x.call(/e/,t))return t;var r=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if("number"==typeof e){var a=e<0?-P(-e):P(e);if(a!==e){var n=String(a),i=b.call(t,n.length+1);return v.call(n,r,"$&_")+"."+v.call(v.call(i,/([0-9]{3})/g,"$&_"),/_$/,"")}}return v.call(t,r,"$&_")}var M=r(6553),$=M.custom,N=D($)?$:null;function z(e,t,r){var a="double"===(r.quoteStyle||t)?'"':"'";return a+e+a}function U(e){return v.call(String(e),/"/g,"&quot;")}function B(e){return!("[object Array]"!==q(e)||R&&"object"==typeof e&&R in e)}function Z(e){return!("[object RegExp]"!==q(e)||R&&"object"==typeof e&&R in e)}function D(e){if(O)return e&&"object"==typeof e&&e instanceof Symbol;if("symbol"==typeof e)return!0;if(!e||"object"!=typeof e||!j)return!1;try{return j.call(e),!0}catch(e){}return!1}e.exports=function e(t,a,n,s){var c=a||{};if(V(c,"quoteStyle")&&"single"!==c.quoteStyle&&"double"!==c.quoteStyle)throw new TypeError('option "quoteStyle" must be "single" or "double"');if(V(c,"maxStringLength")&&("number"==typeof c.maxStringLength?c.maxStringLength<0&&c.maxStringLength!==1/0:null!==c.maxStringLength))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var f=!V(c,"customInspect")||c.customInspect;if("boolean"!=typeof f&&"symbol"!==f)throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(V(c,"indent")&&null!==c.indent&&"\t"!==c.indent&&!(parseInt(c.indent,10)===c.indent&&c.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(V(c,"numericSeparator")&&"boolean"!=typeof c.numericSeparator)throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var w=c.numericSeparator;if(void 0===t)return"undefined";if(null===t)return"null";if("boolean"==typeof t)return t?"true":"false";if("string"==typeof t)return H(t,c);if("number"==typeof t){if(0===t)return 1/0/t>0?"0":"-0";var x=String(t);return w?C(t,x):x}if("bigint"==typeof t){var P=String(t)+"n";return w?C(t,P):P}var E=void 0===c.depth?5:c.depth;if(void 0===n&&(n=0),n>=E&&E>0&&"object"==typeof t)return B(t)?"[Array]":"[Object]";var $,L=function(e,t){var r;if("\t"===e.indent)r="\t";else{if(!("number"==typeof e.indent&&e.indent>0))return null;r=F.call(Array(e.indent+1)," ")}return{base:r,prev:F.call(Array(t+1),r)}}(c,n);if(void 0===s)s=[];else if(W(s,t)>=0)return"[Circular]";function G(t,r,a){if(r&&(s=_.call(s)).push(r),a){var i={depth:c.depth};return V(c,"quoteStyle")&&(i.quoteStyle=c.quoteStyle),e(t,i,n+1,s)}return e(t,c,n+1,s)}if("function"==typeof t&&!Z(t)){var ee=function(e){if(e.name)return e.name;var t=g.call(y.call(e),/^function\s*([\w$]+)/);return t?t[1]:null}(t),te=K(t,G);return"[Function"+(ee?": "+ee:" (anonymous)")+"]"+(te.length>0?" { "+F.call(te,", ")+" }":"")}if(D(t)){var re=O?v.call(String(t),/^(Symbol\(.*\))_[^)]*$/,"$1"):j.call(t);return"object"!=typeof t||O?re:J(re)}if(($=t)&&"object"==typeof $&&("undefined"!=typeof HTMLElement&&$ instanceof HTMLElement||"string"==typeof $.nodeName&&"function"==typeof $.getAttribute)){for(var ae="<"+A.call(String(t.nodeName)),ne=t.attributes||[],ie=0;ie<ne.length;ie++)ae+=" "+ne[ie].name+"="+z(U(ne[ie].value),"double",c);return ae+=">",t.childNodes&&t.childNodes.length&&(ae+="..."),ae+"</"+A.call(String(t.nodeName))+">"}if(B(t)){if(0===t.length)return"[]";var oe=K(t,G);return L&&!function(e){for(var t=0;t<e.length;t++)if(W(e[t],"\n")>=0)return!1;return!0}(oe)?"["+Y(oe,L)+"]":"[ "+F.call(oe,", ")+" ]"}if(function(e){return!("[object Error]"!==q(e)||R&&"object"==typeof e&&R in e)}(t)){var se=K(t,G);return"cause"in Error.prototype||!("cause"in t)||T.call(t,"cause")?0===se.length?"["+String(t)+"]":"{ ["+String(t)+"] "+F.call(se,", ")+" }":"{ ["+String(t)+"] "+F.call(S.call("[cause]: "+G(t.cause),se),", ")+" }"}if("object"==typeof t&&f){if(N&&"function"==typeof t[N]&&M)return M(t,{depth:E-n});if("symbol"!==f&&"function"==typeof t.inspect)return t.inspect()}if(function(e){if(!i||!e||"object"!=typeof e)return!1;try{i.call(e);try{l.call(e)}catch(e){return!0}return e instanceof Map}catch(e){}return!1}(t)){var ce=[];return o&&o.call(t,(function(e,r){ce.push(G(r,t,!0)+" => "+G(e,t))})),X("Map",i.call(t),ce,L)}if(function(e){if(!l||!e||"object"!=typeof e)return!1;try{l.call(e);try{i.call(e)}catch(e){return!0}return e instanceof Set}catch(e){}return!1}(t)){var le=[];return u&&u.call(t,(function(e){le.push(G(e,t))})),X("Set",l.call(t),le,L)}if(function(e){if(!d||!e||"object"!=typeof e)return!1;try{d.call(e,d);try{p.call(e,p)}catch(e){return!0}return e instanceof WeakMap}catch(e){}return!1}(t))return Q("WeakMap");if(function(e){if(!p||!e||"object"!=typeof e)return!1;try{p.call(e,p);try{d.call(e,d)}catch(e){return!0}return e instanceof WeakSet}catch(e){}return!1}(t))return Q("WeakSet");if(function(e){if(!h||!e||"object"!=typeof e)return!1;try{return h.call(e),!0}catch(e){}return!1}(t))return Q("WeakRef");if(function(e){return!("[object Number]"!==q(e)||R&&"object"==typeof e&&R in e)}(t))return J(G(Number(t)));if(function(e){if(!e||"object"!=typeof e||!k)return!1;try{return k.call(e),!0}catch(e){}return!1}(t))return J(G(k.call(t)));if(function(e){return!("[object Boolean]"!==q(e)||R&&"object"==typeof e&&R in e)}(t))return J(m.call(t));if(function(e){return!("[object String]"!==q(e)||R&&"object"==typeof e&&R in e)}(t))return J(G(String(t)));if("undefined"!=typeof window&&t===window)return"{ [object Window] }";if(t===r.g)return"{ [object globalThis] }";if(!function(e){return!("[object Date]"!==q(e)||R&&"object"==typeof e&&R in e)}(t)&&!Z(t)){var ue=K(t,G),de=I?I(t)===Object.prototype:t instanceof Object||t.constructor===Object,pe=t instanceof Object?"":"null prototype",he=!de&&R&&Object(t)===t&&R in t?b.call(q(t),8,-1):pe?"Object":"",me=(de||"function"!=typeof t.constructor?"":t.constructor.name?t.constructor.name+" ":"")+(he||pe?"["+F.call(S.call([],he||[],pe||[]),": ")+"] ":"");return 0===ue.length?me+"{}":L?me+"{"+Y(ue,L)+"}":me+"{ "+F.call(ue,", ")+" }"}return String(t)};var L=Object.prototype.hasOwnProperty||function(e){return e in this};function V(e,t){return L.call(e,t)}function q(e){return f.call(e)}function W(e,t){if(e.indexOf)return e.indexOf(t);for(var r=0,a=e.length;r<a;r++)if(e[r]===t)return r;return-1}function H(e,t){if(e.length>t.maxStringLength){var r=e.length-t.maxStringLength,a="... "+r+" more character"+(r>1?"s":"");return H(b.call(e,0,t.maxStringLength),t)+a}return z(v.call(v.call(e,/(['\\])/g,"\\$1"),/[\x00-\x1f]/g,G),"single",t)}function G(e){var t=e.charCodeAt(0),r={8:"b",9:"t",10:"n",12:"f",13:"r"}[t];return r?"\\"+r:"\\x"+(t<16?"0":"")+w.call(t.toString(16))}function J(e){return"Object("+e+")"}function Q(e){return e+" { ? }"}function X(e,t,r,a){return e+" ("+t+") {"+(a?Y(r,a):F.call(r,", "))+"}"}function Y(e,t){if(0===e.length)return"";var r="\n"+t.prev+t.base;return r+F.call(e,","+r)+"\n"+t.prev}function K(e,t){var r=B(e),a=[];if(r){a.length=e.length;for(var n=0;n<e.length;n++)a[n]=V(e,n)?t(e[n],e):""}var i,o="function"==typeof E?E(e):[];if(O){i={};for(var s=0;s<o.length;s++)i["$"+o[s]]=o[s]}for(var c in e)V(e,c)&&(r&&String(Number(c))===c&&c<e.length||O&&i["$"+c]instanceof Symbol||(x.call(/[^\w$]/,c)?a.push(t(c,e)+": "+t(e[c],e)):a.push(c+": "+t(e[c],e))));if("function"==typeof E)for(var l=0;l<o.length;l++)T.call(e,o[l])&&a.push("["+t(o[l])+"]: "+t(e[o[l]],e));return a}},2565:(e,t,r)=>{"use strict";var a=r(3298),n=/[\/\?<>\\:\*\|"]/g,i=/[\x00-\x1f\x80-\x9f]/g,o=/^\.+$/,s=/^(con|prn|aux|nul|com[0-9]|lpt[0-9])(\..*)?$/i,c=/[\. ]+$/;function l(e,t){if("string"!=typeof e)throw new Error("Input must be string");var r=e.replace(n,t).replace(i,t).replace(o,t).replace(s,t).replace(c,t);return a(r,255)}e.exports=function(e,t){var r=t&&t.replacement||"",a=l(e,r);return""===r?a:l(a,"")}},7319:(e,t,r)=>{"use strict";var a=r(4663),n=r(8531),i=r(3219)(),o=r(8337),s=a("%TypeError%"),c=a("%Math.floor%");e.exports=function(e,t){if("function"!=typeof e)throw new s("`fn` is not a function");if("number"!=typeof t||t<0||t>4294967295||c(t)!==t)throw new s("`length` must be a positive 32-bit integer");var r=arguments.length>2&&!!arguments[2],a=!0,l=!0;if("length"in e&&o){var u=o(e,"length");u&&!u.configurable&&(a=!1),u&&!u.writable&&(l=!1)}return(a||l||!r)&&(i?n(e,"length",t,!0,!0):n(e,"length",t)),e}},8959:(e,t,r)=>{"use strict";var a=r(4663),n=r(8608),i=r(201),o=a("%TypeError%"),s=a("%WeakMap%",!0),c=a("%Map%",!0),l=n("WeakMap.prototype.get",!0),u=n("WeakMap.prototype.set",!0),d=n("WeakMap.prototype.has",!0),p=n("Map.prototype.get",!0),h=n("Map.prototype.set",!0),m=n("Map.prototype.has",!0),f=function(e,t){for(var r,a=e;null!==(r=a.next);a=r)if(r.key===t)return a.next=r.next,r.next=e.next,e.next=r,r};e.exports=function(){var e,t,r,a={assert:function(e){if(!a.has(e))throw new o("Side channel does not contain "+i(e))},get:function(a){if(s&&a&&("object"==typeof a||"function"==typeof a)){if(e)return l(e,a)}else if(c){if(t)return p(t,a)}else if(r)return function(e,t){var r=f(e,t);return r&&r.value}(r,a)},has:function(a){if(s&&a&&("object"==typeof a||"function"==typeof a)){if(e)return d(e,a)}else if(c){if(t)return m(t,a)}else if(r)return function(e,t){return!!f(e,t)}(r,a);return!1},set:function(a,n){s&&a&&("object"==typeof a||"function"==typeof a)?(e||(e=new s),u(e,a,n)):c?(t||(t=new c),h(t,a,n)):(r||(r={key:{},next:null}),function(e,t,r){var a=f(e,t);a?a.value=r:e.next={key:t,next:e.next,value:r}}(r,a,n))}};return a}},3298:(e,t,r)=>{"use strict";var a=r(2815),n=r(2875);e.exports=a.bind(null,n)},2815:e=>{"use strict";function t(e){return e>=55296&&e<=56319}function r(e){return e>=56320&&e<=57343}e.exports=function(e,a,n){if("string"!=typeof a)throw new Error("Input must be string");for(var i,o,s=a.length,c=0,l=0;l<s;l+=1){if(i=a.charCodeAt(l),o=a[l],t(i)&&r(a.charCodeAt(l+1))&&(o+=a[l+=1]),(c+=e(o))===n)return a.slice(0,l+1);if(c>n)return a.slice(0,l-o.length+1)}return a}},9177:function(e,t,r){var a;e=r.nmd(e),function(n){t&&t.nodeType,e&&e.nodeType;var i="object"==typeof r.g&&r.g;i.global!==i&&i.window!==i&&i.self;var o,s=2147483647,c=36,l=26,u=38,d=700,p=/^xn--/,h=/[^\x20-\x7E]/,m=/[\x2E\u3002\uFF0E\uFF61]/g,f={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},y=c-1,g=Math.floor,b=String.fromCharCode;function v(e){throw new RangeError(f[e])}function w(e,t){for(var r=e.length,a=[];r--;)a[r]=t(e[r]);return a}function A(e,t){var r=e.split("@"),a="";return r.length>1&&(a=r[0]+"@",e=r[1]),a+w((e=e.replace(m,".")).split("."),t).join(".")}function x(e){for(var t,r,a=[],n=0,i=e.length;n<i;)(t=e.charCodeAt(n++))>=55296&&t<=56319&&n<i?56320==(64512&(r=e.charCodeAt(n++)))?a.push(((1023&t)<<10)+(1023&r)+65536):(a.push(t),n--):a.push(t);return a}function S(e){return w(e,(function(e){var t="";return e>65535&&(t+=b((e-=65536)>>>10&1023|55296),e=56320|1023&e),t+b(e)})).join("")}function F(e,t){return e+22+75*(e<26)-((0!=t)<<5)}function _(e,t,r){var a=0;for(e=r?g(e/d):e>>1,e+=g(e/t);e>y*l>>1;a+=c)e=g(e/y);return g(a+(y+1)*e/(e+u))}function P(e){var t,r,a,n,i,o,u,d,p,h,m,f=[],y=e.length,b=0,w=128,A=72;for((r=e.lastIndexOf("-"))<0&&(r=0),a=0;a<r;++a)e.charCodeAt(a)>=128&&v("not-basic"),f.push(e.charCodeAt(a));for(n=r>0?r+1:0;n<y;){for(i=b,o=1,u=c;n>=y&&v("invalid-input"),((d=(m=e.charCodeAt(n++))-48<10?m-22:m-65<26?m-65:m-97<26?m-97:c)>=c||d>g((s-b)/o))&&v("overflow"),b+=d*o,!(d<(p=u<=A?1:u>=A+l?l:u-A));u+=c)o>g(s/(h=c-p))&&v("overflow"),o*=h;A=_(b-i,t=f.length+1,0==i),g(b/t)>s-w&&v("overflow"),w+=g(b/t),b%=t,f.splice(b++,0,w)}return S(f)}function k(e){var t,r,a,n,i,o,u,d,p,h,m,f,y,w,A,S=[];for(f=(e=x(e)).length,t=128,r=0,i=72,o=0;o<f;++o)(m=e[o])<128&&S.push(b(m));for(a=n=S.length,n&&S.push("-");a<f;){for(u=s,o=0;o<f;++o)(m=e[o])>=t&&m<u&&(u=m);for(u-t>g((s-r)/(y=a+1))&&v("overflow"),r+=(u-t)*y,t=u,o=0;o<f;++o)if((m=e[o])<t&&++r>s&&v("overflow"),m==t){for(d=r,p=c;!(d<(h=p<=i?1:p>=i+l?l:p-i));p+=c)A=d-h,w=c-h,S.push(b(F(h+A%w,0))),d=g(A/w);S.push(b(F(d,0))),i=_(r,y,a==n),r=0,++a}++r,++t}return S.join("")}o={version:"1.4.1",ucs2:{decode:x,encode:S},decode:P,encode:k,toASCII:function(e){return A(e,(function(e){return h.test(e)?"xn--"+k(e):e}))},toUnicode:function(e){return A(e,(function(e){return p.test(e)?P(e.slice(4).toLowerCase()):e}))}},void 0===(a=function(){return o}.call(t,r,t,e))||(e.exports=a)}()},7032:e=>{"use strict";var t=String.prototype.replace,r=/%20/g,a="RFC3986";e.exports={default:a,formatters:{RFC1738:function(e){return t.call(e,r,"+")},RFC3986:function(e){return String(e)}},RFC1738:"RFC1738",RFC3986:a}},3184:(e,t,r)=>{"use strict";var a=r(1645),n=r(5610),i=r(7032);e.exports={formats:i,parse:n,stringify:a}},5610:(e,t,r)=>{"use strict";var a=r(8206),n=Object.prototype.hasOwnProperty,i=Array.isArray,o={allowDots:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decoder:a.decode,delimiter:"&",depth:5,ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictNullHandling:!1},s=function(e){return e.replace(/&#(\d+);/g,(function(e,t){return String.fromCharCode(parseInt(t,10))}))},c=function(e,t){return e&&"string"==typeof e&&t.comma&&e.indexOf(",")>-1?e.split(","):e},l=function(e,t,r,a){if(e){var i=r.allowDots?e.replace(/\.([^.[]+)/g,"[$1]"):e,o=/(\[[^[\]]*])/g,s=r.depth>0&&/(\[[^[\]]*])/.exec(i),l=s?i.slice(0,s.index):i,u=[];if(l){if(!r.plainObjects&&n.call(Object.prototype,l)&&!r.allowPrototypes)return;u.push(l)}for(var d=0;r.depth>0&&null!==(s=o.exec(i))&&d<r.depth;){if(d+=1,!r.plainObjects&&n.call(Object.prototype,s[1].slice(1,-1))&&!r.allowPrototypes)return;u.push(s[1])}return s&&u.push("["+i.slice(s.index)+"]"),function(e,t,r,a){for(var n=a?t:c(t,r),i=e.length-1;i>=0;--i){var o,s=e[i];if("[]"===s&&r.parseArrays)o=[].concat(n);else{o=r.plainObjects?Object.create(null):{};var l="["===s.charAt(0)&&"]"===s.charAt(s.length-1)?s.slice(1,-1):s,u=parseInt(l,10);r.parseArrays||""!==l?!isNaN(u)&&s!==l&&String(u)===l&&u>=0&&r.parseArrays&&u<=r.arrayLimit?(o=[])[u]=n:"__proto__"!==l&&(o[l]=n):o={0:n}}n=o}return n}(u,t,r,a)}};e.exports=function(e,t){var r=function(e){if(!e)return o;if(null!==e.decoder&&void 0!==e.decoder&&"function"!=typeof e.decoder)throw new TypeError("Decoder has to be a function.");if(void 0!==e.charset&&"utf-8"!==e.charset&&"iso-8859-1"!==e.charset)throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var t=void 0===e.charset?o.charset:e.charset;return{allowDots:void 0===e.allowDots?o.allowDots:!!e.allowDots,allowPrototypes:"boolean"==typeof e.allowPrototypes?e.allowPrototypes:o.allowPrototypes,allowSparse:"boolean"==typeof e.allowSparse?e.allowSparse:o.allowSparse,arrayLimit:"number"==typeof e.arrayLimit?e.arrayLimit:o.arrayLimit,charset:t,charsetSentinel:"boolean"==typeof e.charsetSentinel?e.charsetSentinel:o.charsetSentinel,comma:"boolean"==typeof e.comma?e.comma:o.comma,decoder:"function"==typeof e.decoder?e.decoder:o.decoder,delimiter:"string"==typeof e.delimiter||a.isRegExp(e.delimiter)?e.delimiter:o.delimiter,depth:"number"==typeof e.depth||!1===e.depth?+e.depth:o.depth,ignoreQueryPrefix:!0===e.ignoreQueryPrefix,interpretNumericEntities:"boolean"==typeof e.interpretNumericEntities?e.interpretNumericEntities:o.interpretNumericEntities,parameterLimit:"number"==typeof e.parameterLimit?e.parameterLimit:o.parameterLimit,parseArrays:!1!==e.parseArrays,plainObjects:"boolean"==typeof e.plainObjects?e.plainObjects:o.plainObjects,strictNullHandling:"boolean"==typeof e.strictNullHandling?e.strictNullHandling:o.strictNullHandling}}(t);if(""===e||null==e)return r.plainObjects?Object.create(null):{};for(var u="string"==typeof e?function(e,t){var r,l={__proto__:null},u=t.ignoreQueryPrefix?e.replace(/^\?/,""):e,d=t.parameterLimit===1/0?void 0:t.parameterLimit,p=u.split(t.delimiter,d),h=-1,m=t.charset;if(t.charsetSentinel)for(r=0;r<p.length;++r)0===p[r].indexOf("utf8=")&&("utf8=%E2%9C%93"===p[r]?m="utf-8":"utf8=%26%2310003%3B"===p[r]&&(m="iso-8859-1"),h=r,r=p.length);for(r=0;r<p.length;++r)if(r!==h){var f,y,g=p[r],b=g.indexOf("]="),v=-1===b?g.indexOf("="):b+1;-1===v?(f=t.decoder(g,o.decoder,m,"key"),y=t.strictNullHandling?null:""):(f=t.decoder(g.slice(0,v),o.decoder,m,"key"),y=a.maybeMap(c(g.slice(v+1),t),(function(e){return t.decoder(e,o.decoder,m,"value")}))),y&&t.interpretNumericEntities&&"iso-8859-1"===m&&(y=s(y)),g.indexOf("[]=")>-1&&(y=i(y)?[y]:y),n.call(l,f)?l[f]=a.combine(l[f],y):l[f]=y}return l}(e,r):e,d=r.plainObjects?Object.create(null):{},p=Object.keys(u),h=0;h<p.length;++h){var m=p[h],f=l(m,u[m],r,"string"==typeof e);d=a.merge(d,f,r)}return!0===r.allowSparse?d:a.compact(d)}},1645:(e,t,r)=>{"use strict";var a=r(8959),n=r(8206),i=r(7032),o=Object.prototype.hasOwnProperty,s={brackets:function(e){return e+"[]"},comma:"comma",indices:function(e,t){return e+"["+t+"]"},repeat:function(e){return e}},c=Array.isArray,l=Array.prototype.push,u=function(e,t){l.apply(e,c(t)?t:[t])},d=Date.prototype.toISOString,p=i.default,h={addQueryPrefix:!1,allowDots:!1,charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encoder:n.encode,encodeValuesOnly:!1,format:p,formatter:i.formatters[p],indices:!1,serializeDate:function(e){return d.call(e)},skipNulls:!1,strictNullHandling:!1},m={},f=function e(t,r,i,o,s,l,d,p,f,y,g,b,v,w,A,x){for(var S,F=t,_=x,P=0,k=!1;void 0!==(_=_.get(m))&&!k;){var E=_.get(t);if(P+=1,void 0!==E){if(E===P)throw new RangeError("Cyclic object value");k=!0}void 0===_.get(m)&&(P=0)}if("function"==typeof p?F=p(r,F):F instanceof Date?F=g(F):"comma"===i&&c(F)&&(F=n.maybeMap(F,(function(e){return e instanceof Date?g(e):e}))),null===F){if(s)return d&&!w?d(r,h.encoder,A,"key",b):r;F=""}if("string"==typeof(S=F)||"number"==typeof S||"boolean"==typeof S||"symbol"==typeof S||"bigint"==typeof S||n.isBuffer(F))return d?[v(w?r:d(r,h.encoder,A,"key",b))+"="+v(d(F,h.encoder,A,"value",b))]:[v(r)+"="+v(String(F))];var j,O=[];if(void 0===F)return O;if("comma"===i&&c(F))w&&d&&(F=n.maybeMap(F,d)),j=[{value:F.length>0?F.join(",")||null:void 0}];else if(c(p))j=p;else{var R=Object.keys(F);j=f?R.sort(f):R}for(var T=o&&c(F)&&1===F.length?r+"[]":r,I=0;I<j.length;++I){var C=j[I],M="object"==typeof C&&void 0!==C.value?C.value:F[C];if(!l||null!==M){var $=c(F)?"function"==typeof i?i(T,C):T:T+(y?"."+C:"["+C+"]");x.set(t,P);var N=a();N.set(m,x),u(O,e(M,$,i,o,s,l,"comma"===i&&w&&c(F)?null:d,p,f,y,g,b,v,w,A,N))}}return O};e.exports=function(e,t){var r,n=e,l=function(e){if(!e)return h;if(null!==e.encoder&&void 0!==e.encoder&&"function"!=typeof e.encoder)throw new TypeError("Encoder has to be a function.");var t=e.charset||h.charset;if(void 0!==e.charset&&"utf-8"!==e.charset&&"iso-8859-1"!==e.charset)throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var r=i.default;if(void 0!==e.format){if(!o.call(i.formatters,e.format))throw new TypeError("Unknown format option provided.");r=e.format}var a=i.formatters[r],n=h.filter;return("function"==typeof e.filter||c(e.filter))&&(n=e.filter),{addQueryPrefix:"boolean"==typeof e.addQueryPrefix?e.addQueryPrefix:h.addQueryPrefix,allowDots:void 0===e.allowDots?h.allowDots:!!e.allowDots,charset:t,charsetSentinel:"boolean"==typeof e.charsetSentinel?e.charsetSentinel:h.charsetSentinel,delimiter:void 0===e.delimiter?h.delimiter:e.delimiter,encode:"boolean"==typeof e.encode?e.encode:h.encode,encoder:"function"==typeof e.encoder?e.encoder:h.encoder,encodeValuesOnly:"boolean"==typeof e.encodeValuesOnly?e.encodeValuesOnly:h.encodeValuesOnly,filter:n,format:r,formatter:a,serializeDate:"function"==typeof e.serializeDate?e.serializeDate:h.serializeDate,skipNulls:"boolean"==typeof e.skipNulls?e.skipNulls:h.skipNulls,sort:"function"==typeof e.sort?e.sort:null,strictNullHandling:"boolean"==typeof e.strictNullHandling?e.strictNullHandling:h.strictNullHandling}}(t);"function"==typeof l.filter?n=(0,l.filter)("",n):c(l.filter)&&(r=l.filter);var d,p=[];if("object"!=typeof n||null===n)return"";d=t&&t.arrayFormat in s?t.arrayFormat:t&&"indices"in t?t.indices?"indices":"repeat":"indices";var m=s[d];if(t&&"commaRoundTrip"in t&&"boolean"!=typeof t.commaRoundTrip)throw new TypeError("`commaRoundTrip` must be a boolean, or absent");var y="comma"===m&&t&&t.commaRoundTrip;r||(r=Object.keys(n)),l.sort&&r.sort(l.sort);for(var g=a(),b=0;b<r.length;++b){var v=r[b];l.skipNulls&&null===n[v]||u(p,f(n[v],v,m,y,l.strictNullHandling,l.skipNulls,l.encode?l.encoder:null,l.filter,l.sort,l.allowDots,l.serializeDate,l.format,l.formatter,l.encodeValuesOnly,l.charset,g))}var w=p.join(l.delimiter),A=!0===l.addQueryPrefix?"?":"";return l.charsetSentinel&&("iso-8859-1"===l.charset?A+="utf8=%26%2310003%3B&":A+="utf8=%E2%9C%93&"),w.length>0?A+w:""}},8206:(e,t,r)=>{"use strict";var a=r(7032),n=Object.prototype.hasOwnProperty,i=Array.isArray,o=function(){for(var e=[],t=0;t<256;++t)e.push("%"+((t<16?"0":"")+t.toString(16)).toUpperCase());return e}(),s=function(e,t){for(var r=t&&t.plainObjects?Object.create(null):{},a=0;a<e.length;++a)void 0!==e[a]&&(r[a]=e[a]);return r};e.exports={arrayToObject:s,assign:function(e,t){return Object.keys(t).reduce((function(e,r){return e[r]=t[r],e}),e)},combine:function(e,t){return[].concat(e,t)},compact:function(e){for(var t=[{obj:{o:e},prop:"o"}],r=[],a=0;a<t.length;++a)for(var n=t[a],o=n.obj[n.prop],s=Object.keys(o),c=0;c<s.length;++c){var l=s[c],u=o[l];"object"==typeof u&&null!==u&&-1===r.indexOf(u)&&(t.push({obj:o,prop:l}),r.push(u))}return function(e){for(;e.length>1;){var t=e.pop(),r=t.obj[t.prop];if(i(r)){for(var a=[],n=0;n<r.length;++n)void 0!==r[n]&&a.push(r[n]);t.obj[t.prop]=a}}}(t),e},decode:function(e,t,r){var a=e.replace(/\+/g," ");if("iso-8859-1"===r)return a.replace(/%[0-9a-f]{2}/gi,unescape);try{return decodeURIComponent(a)}catch(e){return a}},encode:function(e,t,r,n,i){if(0===e.length)return e;var s=e;if("symbol"==typeof e?s=Symbol.prototype.toString.call(e):"string"!=typeof e&&(s=String(e)),"iso-8859-1"===r)return escape(s).replace(/%u[0-9a-f]{4}/gi,(function(e){return"%26%23"+parseInt(e.slice(2),16)+"%3B"}));for(var c="",l=0;l<s.length;++l){var u=s.charCodeAt(l);45===u||46===u||95===u||126===u||u>=48&&u<=57||u>=65&&u<=90||u>=97&&u<=122||i===a.RFC1738&&(40===u||41===u)?c+=s.charAt(l):u<128?c+=o[u]:u<2048?c+=o[192|u>>6]+o[128|63&u]:u<55296||u>=57344?c+=o[224|u>>12]+o[128|u>>6&63]+o[128|63&u]:(l+=1,u=65536+((1023&u)<<10|1023&s.charCodeAt(l)),c+=o[240|u>>18]+o[128|u>>12&63]+o[128|u>>6&63]+o[128|63&u])}return c},isBuffer:function(e){return!(!e||"object"!=typeof e||!(e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer(e)))},isRegExp:function(e){return"[object RegExp]"===Object.prototype.toString.call(e)},maybeMap:function(e,t){if(i(e)){for(var r=[],a=0;a<e.length;a+=1)r.push(t(e[a]));return r}return t(e)},merge:function e(t,r,a){if(!r)return t;if("object"!=typeof r){if(i(t))t.push(r);else{if(!t||"object"!=typeof t)return[t,r];(a&&(a.plainObjects||a.allowPrototypes)||!n.call(Object.prototype,r))&&(t[r]=!0)}return t}if(!t||"object"!=typeof t)return[t].concat(r);var o=t;return i(t)&&!i(r)&&(o=s(t,a)),i(t)&&i(r)?(r.forEach((function(r,i){if(n.call(t,i)){var o=t[i];o&&"object"==typeof o&&r&&"object"==typeof r?t[i]=e(o,r,a):t.push(r)}else t[i]=r})),t):Object.keys(r).reduce((function(t,i){var o=r[i];return n.call(t,i)?t[i]=e(t[i],o,a):t[i]=o,t}),o)}}},8526:(e,t,r)=>{"use strict";var a=r(9177);function n(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}var i=/^([a-z0-9.+-]+:)/i,o=/:[0-9]*$/,s=/^(\/\/?(?!\/)[^?\s]*)(\?[^\s]*)?$/,c=["{","}","|","\\","^","`"].concat(["<",">",'"',"`"," ","\r","\n","\t"]),l=["'"].concat(c),u=["%","/","?",";","#"].concat(l),d=["/","?","#"],p=/^[+a-z0-9A-Z_-]{0,63}$/,h=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,m={javascript:!0,"javascript:":!0},f={javascript:!0,"javascript:":!0},y={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},g=r(3184);function b(e,t,r){if(e&&"object"==typeof e&&e instanceof n)return e;var a=new n;return a.parse(e,t,r),a}n.prototype.parse=function(e,t,r){if("string"!=typeof e)throw new TypeError("Parameter 'url' must be a string, not "+typeof e);var n=e.indexOf("?"),o=-1!==n&&n<e.indexOf("#")?"?":"#",c=e.split(o);c[0]=c[0].replace(/\\/g,"/");var b=e=c.join(o);if(b=b.trim(),!r&&1===e.split("#").length){var v=s.exec(b);if(v)return this.path=b,this.href=b,this.pathname=v[1],v[2]?(this.search=v[2],this.query=t?g.parse(this.search.substr(1)):this.search.substr(1)):t&&(this.search="",this.query={}),this}var w=i.exec(b);if(w){var A=(w=w[0]).toLowerCase();this.protocol=A,b=b.substr(w.length)}if(r||w||b.match(/^\/\/[^@/]+@[^@/]+/)){var x="//"===b.substr(0,2);!x||w&&f[w]||(b=b.substr(2),this.slashes=!0)}if(!f[w]&&(x||w&&!y[w])){for(var S,F,_=-1,P=0;P<d.length;P++)-1!==(k=b.indexOf(d[P]))&&(-1===_||k<_)&&(_=k);for(-1!==(F=-1===_?b.lastIndexOf("@"):b.lastIndexOf("@",_))&&(S=b.slice(0,F),b=b.slice(F+1),this.auth=decodeURIComponent(S)),_=-1,P=0;P<u.length;P++){var k;-1!==(k=b.indexOf(u[P]))&&(-1===_||k<_)&&(_=k)}-1===_&&(_=b.length),this.host=b.slice(0,_),b=b.slice(_),this.parseHost(),this.hostname=this.hostname||"";var E="["===this.hostname[0]&&"]"===this.hostname[this.hostname.length-1];if(!E)for(var j=this.hostname.split(/\./),O=(P=0,j.length);P<O;P++){var R=j[P];if(R&&!R.match(p)){for(var T="",I=0,C=R.length;I<C;I++)R.charCodeAt(I)>127?T+="x":T+=R[I];if(!T.match(p)){var M=j.slice(0,P),$=j.slice(P+1),N=R.match(h);N&&(M.push(N[1]),$.unshift(N[2])),$.length&&(b="/"+$.join(".")+b),this.hostname=M.join(".");break}}}this.hostname.length>255?this.hostname="":this.hostname=this.hostname.toLowerCase(),E||(this.hostname=a.toASCII(this.hostname));var z=this.port?":"+this.port:"",U=this.hostname||"";this.host=U+z,this.href+=this.host,E&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),"/"!==b[0]&&(b="/"+b))}if(!m[A])for(P=0,O=l.length;P<O;P++){var B=l[P];if(-1!==b.indexOf(B)){var Z=encodeURIComponent(B);Z===B&&(Z=escape(B)),b=b.split(B).join(Z)}}var D=b.indexOf("#");-1!==D&&(this.hash=b.substr(D),b=b.slice(0,D));var L=b.indexOf("?");if(-1!==L?(this.search=b.substr(L),this.query=b.substr(L+1),t&&(this.query=g.parse(this.query)),b=b.slice(0,L)):t&&(this.search="",this.query={}),b&&(this.pathname=b),y[A]&&this.hostname&&!this.pathname&&(this.pathname="/"),this.pathname||this.search){z=this.pathname||"";var V=this.search||"";this.path=z+V}return this.href=this.format(),this},n.prototype.format=function(){var e=this.auth||"";e&&(e=(e=encodeURIComponent(e)).replace(/%3A/i,":"),e+="@");var t=this.protocol||"",r=this.pathname||"",a=this.hash||"",n=!1,i="";this.host?n=e+this.host:this.hostname&&(n=e+(-1===this.hostname.indexOf(":")?this.hostname:"["+this.hostname+"]"),this.port&&(n+=":"+this.port)),this.query&&"object"==typeof this.query&&Object.keys(this.query).length&&(i=g.stringify(this.query,{arrayFormat:"repeat",addQueryPrefix:!1}));var o=this.search||i&&"?"+i||"";return t&&":"!==t.substr(-1)&&(t+=":"),this.slashes||(!t||y[t])&&!1!==n?(n="//"+(n||""),r&&"/"!==r.charAt(0)&&(r="/"+r)):n||(n=""),a&&"#"!==a.charAt(0)&&(a="#"+a),o&&"?"!==o.charAt(0)&&(o="?"+o),t+n+(r=r.replace(/[?#]/g,(function(e){return encodeURIComponent(e)})))+(o=o.replace("#","%23"))+a},n.prototype.resolve=function(e){return this.resolveObject(b(e,!1,!0)).format()},n.prototype.resolveObject=function(e){if("string"==typeof e){var t=new n;t.parse(e,!1,!0),e=t}for(var r=new n,a=Object.keys(this),i=0;i<a.length;i++){var o=a[i];r[o]=this[o]}if(r.hash=e.hash,""===e.href)return r.href=r.format(),r;if(e.slashes&&!e.protocol){for(var s=Object.keys(e),c=0;c<s.length;c++){var l=s[c];"protocol"!==l&&(r[l]=e[l])}return y[r.protocol]&&r.hostname&&!r.pathname&&(r.pathname="/",r.path=r.pathname),r.href=r.format(),r}if(e.protocol&&e.protocol!==r.protocol){if(!y[e.protocol]){for(var u=Object.keys(e),d=0;d<u.length;d++){var p=u[d];r[p]=e[p]}return r.href=r.format(),r}if(r.protocol=e.protocol,e.host||f[e.protocol])r.pathname=e.pathname;else{for(var h=(e.pathname||"").split("/");h.length&&!(e.host=h.shift()););e.host||(e.host=""),e.hostname||(e.hostname=""),""!==h[0]&&h.unshift(""),h.length<2&&h.unshift(""),r.pathname=h.join("/")}if(r.search=e.search,r.query=e.query,r.host=e.host||"",r.auth=e.auth,r.hostname=e.hostname||e.host,r.port=e.port,r.pathname||r.search){var m=r.pathname||"",g=r.search||"";r.path=m+g}return r.slashes=r.slashes||e.slashes,r.href=r.format(),r}var b=r.pathname&&"/"===r.pathname.charAt(0),v=e.host||e.pathname&&"/"===e.pathname.charAt(0),w=v||b||r.host&&e.pathname,A=w,x=r.pathname&&r.pathname.split("/")||[],S=(h=e.pathname&&e.pathname.split("/")||[],r.protocol&&!y[r.protocol]);if(S&&(r.hostname="",r.port=null,r.host&&(""===x[0]?x[0]=r.host:x.unshift(r.host)),r.host="",e.protocol&&(e.hostname=null,e.port=null,e.host&&(""===h[0]?h[0]=e.host:h.unshift(e.host)),e.host=null),w=w&&(""===h[0]||""===x[0])),v)r.host=e.host||""===e.host?e.host:r.host,r.hostname=e.hostname||""===e.hostname?e.hostname:r.hostname,r.search=e.search,r.query=e.query,x=h;else if(h.length)x||(x=[]),x.pop(),x=x.concat(h),r.search=e.search,r.query=e.query;else if(null!=e.search)return S&&(r.host=x.shift(),r.hostname=r.host,(E=!!(r.host&&r.host.indexOf("@")>0)&&r.host.split("@"))&&(r.auth=E.shift(),r.hostname=E.shift(),r.host=r.hostname)),r.search=e.search,r.query=e.query,null===r.pathname&&null===r.search||(r.path=(r.pathname?r.pathname:"")+(r.search?r.search:"")),r.href=r.format(),r;if(!x.length)return r.pathname=null,r.search?r.path="/"+r.search:r.path=null,r.href=r.format(),r;for(var F=x.slice(-1)[0],_=(r.host||e.host||x.length>1)&&("."===F||".."===F)||""===F,P=0,k=x.length;k>=0;k--)"."===(F=x[k])?x.splice(k,1):".."===F?(x.splice(k,1),P++):P&&(x.splice(k,1),P--);if(!w&&!A)for(;P--;P)x.unshift("..");!w||""===x[0]||x[0]&&"/"===x[0].charAt(0)||x.unshift(""),_&&"/"!==x.join("/").substr(-1)&&x.push("");var E,j=""===x[0]||x[0]&&"/"===x[0].charAt(0);return S&&(r.hostname=j?"":x.length?x.shift():"",r.host=r.hostname,(E=!!(r.host&&r.host.indexOf("@")>0)&&r.host.split("@"))&&(r.auth=E.shift(),r.hostname=E.shift(),r.host=r.hostname)),(w=w||r.host&&x.length)&&!j&&x.unshift(""),x.length>0?r.pathname=x.join("/"):(r.pathname=null,r.path=null),null===r.pathname&&null===r.search||(r.path=(r.pathname?r.pathname:"")+(r.search?r.search:"")),r.auth=e.auth||r.auth,r.slashes=r.slashes||e.slashes,r.href=r.format(),r},n.prototype.parseHost=function(){var e=this.host,t=o.exec(e);t&&(":"!==(t=t[0])&&(this.port=t.substr(1)),e=e.substr(0,e.length-t.length)),e&&(this.hostname=e)},t.parse=b,t.resolve=function(e,t){return b(e,!1,!0).resolve(t)},t.resolveObject=function(e,t){return e?b(e,!1,!0).resolveObject(t):t},t.format=function(e){return"string"==typeof e&&(e=b(e)),e instanceof n?e.format():n.prototype.format.call(e)},t.Url=n},2875:e=>{"use strict";function t(e){return e>=55296&&e<=56319}function r(e){return e>=56320&&e<=57343}e.exports=function(e){if("string"!=typeof e)throw new Error("Input must be string");for(var a=e.length,n=0,i=null,o=null,s=0;s<a;s++)r(i=e.charCodeAt(s))?null!=o&&t(o)?n+=1:n+=3:i<=127?n+=1:i>=128&&i<=2047?n+=2:i>=2048&&i<=65535&&(n+=3),o=i;return n}},6553:()=>{}},t={};function r(a){var n=t[a];if(void 0!==n)return n.exports;var i=t[a]={id:a,loaded:!1,exports:{}};return e[a].call(i.exports,i,i.exports,r),i.loaded=!0,i.exports}r.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},r.d=(e,t)=>{for(var a in t)r.o(t,a)&&!r.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:t[a]})},r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.nmd=e=>(e.paths=[],e.children||(e.children=[]),e),(()=>{"use strict";var e,t=r(2565),a=r.n(t);function n(e,t=!1){const r=Math.floor(e/1e3);let a;a=t?Math.round(e/1e3%60*10)/10:r%60;const n=Math.floor(r/60)%60,i=Math.floor(r/3600);return i>0?i+"h"+String(n).padStart(2,"0")+"m"+String(a).padStart(2,"0")+"s":n+"m"+String(a).padStart(2,"0")+"s"}function i(e,t){const r=window.URL.createObjectURL(e),n=document.createElement("a");document.body.appendChild(n),n.style.display="none",n.href=r,n.download=a()(t),n.click(),URL.revokeObjectURL(r),n.remove()}!function(e){e[e.forward=0]="forward",e[e.backward=1]="backward"}(e||(e={}));const o=["version","action","params"],s=["guiAddCards","deckNames","modelNames","modelFieldNames","findNotes","guiBrowse","requestPermission","findNotes","notesInfo","updateNoteFields","addNote","storeMediaFile","version"],c=`chrome-extension://${chrome.runtime.id}/background-page.html`,l=Object.keys({ankiConnectUrl:!0,deck:!0,noteType:!0,sentenceField:!0,definitionField:!0,audioField:!0,imageField:!0,wordField:!0,sourceField:!0,urlField:!0,customAnkiFields:!0,tags:!0,preferMp3:!0,audioPaddingStart:!0,audioPaddingEnd:!0,maxImageWidth:!0,maxImageHeight:!0,surroundingSubtitlesCountRadius:!0,surroundingSubtitlesTimeRadius:!0});var u;!function(e){e.noSubtitleList="noSubtitleList",e.app="app"}(u||(u={}));const d={},p=e=>e in d;class h{constructor(e,t,r){this._name=e,this._base64=t,this._extension=r}get name(){return this._name}get extension(){return this._extension}isAvailable(){return!0}async base64(){return this._base64}async blob(){return await this._blob()}async _blob(){return this.cachedBlob||(this.cachedBlob=await(await fetch(this._dataUrl())).blob()),this.cachedBlob}async dataUrl(){return this._dataUrl()}_dataUrl(){return"data:image/"+this.extension+";base64,"+this._base64}}class m{constructor(e,t,r,a){this._file=e,this._name=e.name+"_"+Math.floor(t)+".jpeg",this._timestamp=t,this._maxWidth=r,this._maxHeight=a}get name(){return this._name}get extension(){return"jpeg"}isAvailable(){return!!this._file.blobUrl&&p(this._file.blobUrl)}async base64(){return new Promise(((e,t)=>{this._canvas().then((t=>{const r=t.toDataURL("image/jpeg");e(r.substring(r.indexOf(",")+1))})).catch(t)}))}async blob(){return new Promise(((e,t)=>{this._canvas().then((r=>{r.toBlob((r=>{null===r?t(new Error("Could not obtain blob")):e(r)}),"image/jpeg")})).catch(t)}))}async dataUrl(){return(await this._canvas()).toDataURL()}async _canvas(){return new Promise((async(e,t)=>{const r=this._videoElement(this._file);r.oncanplay=async t=>{const a=document.createElement("canvas");a.width=r.videoWidth,a.height=r.videoHeight;const n=a.getContext("2d");n.drawImage(r,0,0,a.width,a.height),this._maxWidth>0||this._maxHeight>0?(await((e,t,r,a)=>new Promise(((n,i)=>{const o=r<=0?1:r/e.width,s=a<=0?1:a/e.height,c=Math.min(1,Math.min(o,s));if(c<1){const r=e.width*c,a=e.height*c;createImageBitmap(e,{resizeWidth:r,resizeHeight:a,resizeQuality:"high"}).then((i=>{e.width=r,e.height=a,t.drawImage(i,0,0),n(e)})).catch((e=>i(e)))}else n(e)})))(a,n,this._maxWidth,this._maxHeight),e(a)):e(a)},r.onerror=()=>{t(r.error?.message??"Could not load video to obtain screenshot")}}))}_videoElement(e){const t=document.createElement("video");return t.src=e.blobUrl,t.preload="metadata",t.currentTime=this._timestamp/1e3,t}}class f{constructor(e,t){this._name=`${e}_${Math.floor(t)}`}get name(){return this._name}get extension(){return"jpeg"}isAvailable(){return!1}base64(){throw new Error("Not supported")}dataUrl(){throw new Error("Not supported")}blob(){throw new Error("Not supported")}}class y{constructor(e){this.data=e}static fromCard(e,t,r){return e.image?y.fromBase64(e.subtitleFileName,e.subtitle.start,e.image.base64,e.image.extension):e.file?y.fromFile(e.file,e.mediaTimestamp??e.subtitle.start,t,r):void 0}static fromBase64(e,t,r,a){const n=e.substring(0,e.lastIndexOf("."))+"_"+Math.floor(t)+"."+a;return new y(new h(n,r,a))}static fromFile(e,t,r,a){return new y(new m(e,t,r,a))}static fromMissingFile(e,t){return new y(new f(e,t))}get name(){return this.data.name}get extension(){return this.data.extension}isAvailable(){return this.data.isAvailable()}async base64(){return await this.data.base64()}async dataUrl(){return await this.data.dataUrl()}async blob(){return await this.data.blob()}async pngBlob(){return new Promise((async(e,t)=>{try{createImageBitmap(await this.blob()).then((r=>{const a=document.createElement("canvas");a.width=r.width,a.height=r.height,a.getContext("2d").drawImage(r,0,0),a.toBlob((r=>{r?e(r):t("Failed to convert to PNG")}),"image/png")}))}catch(e){t(e)}}))}async download(){i(await this.data.blob(),this.data.name)}}var g,b,v;!function(e){e[e.none=0]="none",e[e.showAnkiDialog=1]="showAnkiDialog",e[e.updateLastCard=2]="updateLastCard"}(g||(g={})),function(e){e[e.atStart=1]="atStart",e[e.atEnd=2]="atEnd"}(b||(b={})),function(e){e[e.normal=1]="normal",e[e.condensed=2]="condensed",e[e.autoPause=3]="autoPause",e[e.fastForward=4]="fastForward"}(v||(v={}));class w{async fetch(e,t){const r=await fetch(e,{method:"POST",body:JSON.stringify(t)});return await r.json()}}const A=(navigator.userAgentData?.platform??navigator.platform)?.toUpperCase()?.indexOf("MAC")>-1,x={ankiConnectUrl:"http://127.0.0.1:8765",deck:"",noteType:"",sentenceField:"",definitionField:"",audioField:"",imageField:"",wordField:"",sourceField:"",urlField:"",subtitleSize:36,subtitleColor:"#ffffff",subtitleThickness:700,subtitleOutlineThickness:0,subtitleOutlineColor:"#000000",subtitleShadowThickness:2,subtitleShadowColor:"#000000",subtitleBackgroundColor:"#000000",subtitleBackgroundOpacity:.5,subtitleFontFamily:"",subtitlePreview:"アあ安Aa",subtitlePositionOffset:75,subtitleAlignment:"bottom",audioPaddingStart:0,audioPaddingEnd:500,maxImageWidth:0,maxImageHeight:0,surroundingSubtitlesCountRadius:2,surroundingSubtitlesTimeRadius:1e4,autoPausePreference:b.atEnd,fastForwardModePlaybackRate:2.7,keyBindSet:{togglePlay:{keys:"space"},toggleAutoPause:{keys:A?"⇧+P":"shift+P"},toggleCondensedPlayback:{keys:A?"⇧+O":"shift+O"},toggleFastForwardPlayback:{keys:A?"⇧+F":"shift+F"},toggleSubtitles:{keys:"down"},toggleVideoSubtitleTrack1:{keys:"1"},toggleVideoSubtitleTrack2:{keys:"2"},toggleVideoSubtitleTrack3:{keys:"3"},toggleAsbplayerSubtitleTrack1:{keys:"W+1"},toggleAsbplayerSubtitleTrack2:{keys:"W+2"},toggleAsbplayerSubtitleTrack3:{keys:"W+3"},seekBackward:{keys:"A"},seekForward:{keys:"D"},seekToPreviousSubtitle:{keys:"left"},seekToNextSubtitle:{keys:"right"},seekToBeginningOfCurrentSubtitle:{keys:"up"},adjustOffsetToPreviousSubtitle:{keys:A?"⇧+left":"ctrl+left"},adjustOffsetToNextSubtitle:{keys:A?"⇧+right":"ctrl+right"},decreaseOffset:{keys:A?"⇧+⌃+right":"ctrl+shift+right"},increaseOffset:{keys:A?"⇧+⌃+left":"ctrl+shift+left"},resetOffset:{keys:A?"⇧+⌃+down":"ctrl+shift+down"},copySubtitle:{keys:A?"⇧+⌃+Z":"ctrl+shift+Z"},ankiExport:{keys:A?"⇧+⌃+X":"ctrl+shift+X"},updateLastCard:{keys:A?"⇧+⌃+U":"ctrl+shift+U"},takeScreenshot:{keys:A?"⇧+⌃+V":"ctrl+shift+V"},decreasePlaybackRate:{keys:A?"⇧+⌃+[":"ctrl+shift+["},increasePlaybackRate:{keys:A?"⇧+⌃+]":"ctrl+shift+]"},toggleSidePanel:{keys:"`"}},preferMp3:!0,miningHistoryStorageLimit:25,preCacheSubtitleDom:!0,clickToMineDefaultAction:g.showAnkiDialog,themeType:"dark",copyToClipboardOnMine:!1,rememberSubtitleOffset:!0,lastSubtitleOffset:0,autoCopyCurrentSubtitle:!1,subtitleRegexFilter:"",subtitleRegexFilterTextReplacement:"",language:"en",customAnkiFields:{},tags:[],imageBasedSubtitleScaleFactor:1,subtitleCustomStyles:[],streamingAppUrl:"https://killergerbah.github.io/asbplayer",streamingDisplaySubtitles:!0,streamingRecordMedia:!0,streamingTakeScreenshot:!0,streamingCleanScreenshot:!0,streamingCropScreenshot:!0,streamingSubsDragAndDrop:!0,streamingAutoSync:!1,streamingLastLanguagesSynced:{},streamingCondensedPlaybackMinimumSkipIntervalMs:1e3,streamingScreenshotDelay:1e3,streamingSubtitleListPreference:u.noSubtitleList};Object.fromEntries(Object.entries(x).map((([e,t])=>{if("string"==typeof t)return[e,e=>e];if("boolean"==typeof t)return[e,e=>"true"===e];if("number"==typeof t)return[e,e=>Number(e)];if("keyBindSet"===e)return[e,e=>{const t=JSON.parse(e);for(const e of Object.keys(x.keyBindSet)){const r=e;void 0===t[r]&&(t[r]=x.keyBindSet[r])}return t}];if("object"==typeof t)return[e,e=>JSON.parse(e)];throw new Error("Could not determine deserializer for setting")})));class S{constructor(e){this._storage=e}async getAll(){return this.get(Object.keys(x))}async getSingle(e){return(await this.get([e]))[e]}async get(e){let t={};for(const r of e)t[r]=x[r];const r=await this._storage.get(t),a={};for(const e in t)a[e]=r[e]??x[e];return a}async set(e){await this._storage.set(e)}}r(4445);const F=["en","es","de","ja","pl","pt_BR","zh_CN"];class _{async get(e){return await chrome.storage.local.get(e)}async set(e){await chrome.storage.local.set(e)}}const P=new S(new _),k=async(e=!1)=>{if(!e){const e=(await chrome.storage.session.get(["config"])).config;if("-"===e)return;if(void 0!==e)return e}try{const e=`${await P.getSingle("streamingAppUrl")}/extension.json`,t=await(await fetch(e)).json();if(E(t))return await chrome.storage.session.set({config:t}),t}catch(e){console.error(e)}},E=e=>void 0!==e&&j(e.latest)&&O(e.languages),j=e=>"string"==typeof e.version&&"string"==typeof e.url,O=e=>{if(void 0===e||"object"!=typeof e||!Array.isArray(e))return!1;for(const t of e)if("string"!=typeof t.code||"string"!=typeof t.url||"number"!=typeof t.version)return!1;return!0},R=e=>`locVersion-${e}`,T=new S(new _),I=async e=>{try{let t=await k();if(void 0===t)return;const r=t.languages.find((t=>t.code===e))??(await k(!0))?.languages.find((t=>t.code===e));if(void 0===r)return;const a=R(e),n=(await chrome.storage.local.get(a))[a];(void 0===n||n<r.version)&&await C(r)}catch(e){console.error(e)}},C=async({code:e,url:t,version:r})=>{const a=await T.getSingle("streamingAppUrl"),n=t.startsWith("http://")||t.startsWith("https://")?t:`${a}/${t}`;try{const t=await(await fetch(n)).json();if("object"==typeof t){const a=R(e),n=`locStrings-${e}`;await chrome.storage.local.set({[n]:t,[a]:r})}}catch(e){console.error(e)}},M="tabRequestingActiveTabPermission";var $,N=new Uint8Array(16);function z(){if(!$&&!($="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto)))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return $(N)}const U=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;for(var B=[],Z=0;Z<256;++Z)B.push((Z+256).toString(16).substr(1));const D=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=(B[e[t+0]]+B[e[t+1]]+B[e[t+2]]+B[e[t+3]]+"-"+B[e[t+4]]+B[e[t+5]]+"-"+B[e[t+6]]+B[e[t+7]]+"-"+B[e[t+8]]+B[e[t+9]]+"-"+B[e[t+10]]+B[e[t+11]]+B[e[t+12]]+B[e[t+13]]+B[e[t+14]]+B[e[t+15]]).toLowerCase();if(!function(e){return"string"==typeof e&&U.test(e)}(r))throw TypeError("Stringified UUID is invalid");return r},L=function(e,t,r){var a=(e=e||{}).random||(e.rng||z)();if(a[6]=15&a[6]|64,a[8]=63&a[8]|128,t){r=r||0;for(var n=0;n<16;++n)t[r+n]=a[n];return t}return D(a)};class V{static async encode(e,t){return new Promise((async(r,a)=>{var n=new FileReader;n.onload=async e=>{try{const n=new AudioContext;if(null===e.target)return void a(new Error("Could not obtain buffer to encode"));const i=await n.decodeAudioData(e.target.result),o=[];for(let e=0;e<i.numberOfChannels;++e)o.push(i.getChannelData(e));const s=t();s.postMessage({command:"encode",audioBuffer:{channels:o,numberOfChannels:i.numberOfChannels,length:i.length,sampleRate:i.sampleRate}}),s.onmessage=e=>{r(new Blob(e.data.buffer,{type:"audio/mp3"})),s.terminate()},s.onerror=e=>{const t=e?.error??new Error("MP3 encoding failed: "+e?.message);a(t),s.terminate()}}catch(e){a(e)}},n.readAsArrayBuffer(e)}))}}class q{constructor(e,t,r,a,n,i){this._name=e+"_"+Math.floor(t)+"_"+Math.floor(r),this._start=t,this._end=r,this.playbackRate=a,this._base64=n,this._extension=i}get name(){return this._name}get extension(){return this._extension}get start(){return this._start}get end(){return this._end}async base64(){return this._base64}async blob(){return await this._blob()}async play(){if(this.playingAudio)return this.stopAudio(this.playingAudio),clearTimeout(this.stopAudioTimeout),this.playingAudio=void 0,void(this.stopAudioTimeout=void 0);const e=await this._blob(),t=new Audio;t.src=URL.createObjectURL(e),t.preload="metadata",this.playingAudio=t,await t.play(),this.stopAudioTimeout=setTimeout((()=>{this.stopAudio(t),this.playingAudio=void 0,this.stopAudioTimeout=void 0}),(this._end-this._start)/this.playbackRate+100)}stopAudio(e){e.pause();const t=e.src;e.removeAttribute("src"),e.load(),URL.revokeObjectURL(t)}async _blob(){return this.cachedBlob||(this.cachedBlob=await(await fetch("data:audio/"+this.extension+";base64,"+this._base64)).blob()),this.cachedBlob}slice(e,t){return this}isSliceable(){return!1}isPlayable(){return!0}}class W{constructor(e,t,r,a,n){const[i,o]=function(){const e={"audio/ogg;codecs=opus":"ogg","audio/webm;codecs=opus":"webm"};return Object.keys(e).filter(MediaRecorder.isTypeSupported).map((t=>[t,e[t]]))[0]}();this.recorderMimeType=i,this.file=e,this._name=e.name+"_"+t+"_"+r,this._start=t,this._end=r,this.playbackRate=a,this.trackId=n,this._extension=o}get name(){return this._name}get extension(){return this._extension}get start(){return this._start}get end(){return this._end}async base64(){return new Promise((async(e,t)=>{var r=new FileReader;const a=await this.blob();void 0===a?t("Did not finish recording blob"):(r.readAsDataURL(a),r.onloadend=()=>{const t=r.result,a=t.substring(t.indexOf(",")+1);e(a)})}))}async play(){if(!this._blob)return void(this._blob=await this._clipAudio());if(this.playingAudio)return this.stopAudio(this.playingAudio,!0),clearTimeout(this.stopAudioTimeout),this.playingAudio=void 0,void(this.stopAudioTimeout=void 0);const e=await this._audioElement(URL.createObjectURL(this._blob),!1);e.currentTime=0,await e.play(),this.playingAudio=e,this.stopAudioTimeout=setTimeout((()=>{this.stopAudio(e,!0),this.stopAudioTimeout=void 0,this.playingAudio=void 0}),(this._end-this._start)/this.playbackRate+100)}async blob(){if(this._blob||(this._blob=await this._clipAudio()),void 0===this._blob)throw new Error("Did not finish recording blob");return this._blob}async _clipAudio(){return this.clippingAudio?(this.stopAudio(this.clippingAudio,!1),clearTimeout(this.stopClippingTimeout),this.clippingAudioReject?.("Did not finish recording blob"),this.clippingAudio=void 0,this.stopClippingTimeout=void 0,void(this.clippingAudioReject=void 0)):new Promise((async(e,t)=>{try{const r=await this._audioElement(this.file.blobUrl,!0);r.oncanplay=async a=>{r.play();const n=this._captureStream(r),i=new MediaRecorder(n,{mimeType:this.recorderMimeType}),o=[];i.ondataavailable=e=>{o.push(e.data)};let s=!1;i.onstop=t=>{s&&e(new Blob(o,{type:this.recorderMimeType}))},i.start(),this.clippingAudioReject=t,this.clippingAudio=r,this.stopClippingTimeout=setTimeout((()=>{this.stopAudio(r,!1),this.clippingAudio=void 0,this.stopClippingTimeout=void 0,this.clippingAudioReject=void 0,s=!0,i.stop();for(const e of n.getAudioTracks())e.stop()}),(this._end-this._start)/this.playbackRate+100),r.oncanplay=null}}catch(e){t(e)}}))}_audioElement(e,t){const r=new Audio;return r.preload="metadata",r.src=e,new Promise(((e,a)=>{r.onloadedmetadata=()=>{if(t&&this.trackId&&r.audioTracks&&r.audioTracks.length>0)for(const e of r.audioTracks)e.enabled=this.trackId===e.id;r.currentTime=this._start/1e3,r.playbackRate=this.playbackRate,e(r)},r.onerror=()=>{a(r.error?.message??"Could not load audio")}}))}stopAudio(e,t){e.pause();const r=e.src;e.removeAttribute("src"),e.load(),t&&URL.revokeObjectURL(r)}_captureStream(e){let t;if("function"==typeof e.captureStream&&(t=e.captureStream()),"function"==typeof e.mozCaptureStream&&(t=e.mozCaptureStream()),void 0===t)throw new Error("Unable to capture stream from audio");const r=new MediaStream;for(const e of t.getVideoTracks())e.stop();for(const e of t.getAudioTracks())e.enabled&&r.addTrack(e);return r}slice(e,t){return new W(this.file,e,t,this.playbackRate,this.trackId)}isSliceable(){return!0}isPlayable(){return!!this.file.blobUrl&&p(this.file.blobUrl)}}class H{constructor(e,t){this.data=e,this.workerFactory=t}get name(){return this.data.name}get extension(){return"mp3"}get start(){return this.data.start}get end(){return this.data.end}async base64(){return new Promise((async(e,t)=>{try{var r=new FileReader;r.readAsDataURL(await this.blob()),r.onloadend=()=>{const t=r.result,a=t.substring(t.indexOf(",")+1);e(a)}}catch(e){t(e)}}))}async play(){await this.data.play()}async blob(){return this._blob||(this._blob=await V.encode(await this.data.blob(),this.workerFactory)),this._blob}slice(e,t){return new H(this.data.slice(e,t),this.workerFactory)}isSliceable(){return this.data.isSliceable()}isPlayable(){return this.data.isPlayable()}}class G{constructor(e){this.data=e}static fromCard(e,t,r){if(e.audio){const t=e.audio.start??e.subtitle.start,r=e.audio.end??e.subtitle.end;return G.fromBase64(e.subtitleFileName,Math.max(0,t-(e.audio.paddingStart??0)),r+(e.audio.paddingEnd??0),e.audio.playbackRate??1,e.audio.base64,e.audio.extension)}if(e.file)return G.fromFile(e.file,Math.max(0,e.subtitle.start-t),e.subtitle.end+r,e.file?.playbackRate??1,e.file?.audioTrack)}static fromBase64(e,t,r,a,n,i){return new G(new q(e.substring(0,e.lastIndexOf(".")),t,r,a,n,i))}static fromFile(e,t,r,a,n){return new G(new W(e,t,r,a,n))}get start(){return this.data.start}get end(){return this.data.end}get name(){return this.data.name+"."+this.data.extension}get extension(){return this.data.extension}async play(){await this.data.play()}async base64(){return await this.data.base64()}async download(){i(await this.data.blob(),this.name)}toMp3(e){return this.data instanceof H||"mp3"===this.data.extension?this:new G(new H(this.data,e))}slice(e,t){return new G(this.data.slice(e,t))}isSliceable(){return this.data.isSliceable()}isPlayable(){return this.data.isPlayable()}}const J=['"',"*","_","\\",":"];class Q{constructor(e,t=new w){this.settingsProvider=e,this.fetcher=t}async deckNames(e){return(await this._executeAction("deckNames",null,e)).result}async modelNames(e){return(await this._executeAction("modelNames",null,e)).result}async modelFieldNames(e,t){return(await this._executeAction("modelFieldNames",{modelName:e},t)).result}async findNotesWithWord(e,t){return(await this._executeAction("findNotes",{query:this.settingsProvider.wordField+":"+this._escapeQuery(e)},t)).result}async findNotesWithWordGui(e,t){return(await this._executeAction("guiBrowse",{query:this.settingsProvider.wordField+":"+this._escapeQuery(e)},t)).result}_escapeQuery(e){let t="";for(let r=0;r<e.length;++r){const a=e[r];J.includes(a)?t+=`\\${a}`:t+=a}return`"${t}"`}async requestPermission(e){return(await this._executeAction("requestPermission",null,e)).result}async version(e){return(await this._executeAction("version",null,e)).result}async export(e,t,r,a,n,i,o,s,c,l,u){const d={};if(this._appendField(d,this.settingsProvider.sentenceField,e,!0),this._appendField(d,this.settingsProvider.definitionField,t,!0),this._appendField(d,this.settingsProvider.wordField,n,!1),this._appendField(d,this.settingsProvider.sourceField,i,!1),this._appendField(d,this.settingsProvider.urlField,o,!1),s)for(const e of Object.keys(s))this._appendField(d,this.settingsProvider.customAnkiFields[e],s[e],!0);const p={note:{deckName:this.settingsProvider.deck,modelName:this.settingsProvider.noteType,tags:c,options:{allowDuplicate:!1,duplicateScope:"deck",duplicateScopeOptions:{deckName:this.settingsProvider.deck,checkChildren:!1}}}},h="gui"===l,m="updateLast"===l;if(this.settingsProvider.audioField&&r&&r.isPlayable()){const e=this._sanitizeFileName(r.name),t=await r.base64();if(t)if(h||m){const r=(await this._storeMediaFile(e,t,u)).result;this._appendField(d,this.settingsProvider.audioField,`[sound:${r}]`,!1)}else p.note.audio={filename:e,data:t,fields:[this.settingsProvider.audioField]}}if(this.settingsProvider.imageField&&a&&a.isAvailable()){const e=this._sanitizeFileName(a.name),t=await a.base64();if(t)if(h||m){const r=(await this._storeMediaFile(e,t,u)).result;this._appendField(d,this.settingsProvider.imageField,`<div><img src="${r}"></div>`,!1)}else p.note.picture={filename:e,data:t,fields:[this.settingsProvider.imageField]}}switch(p.note.fields=d,l){case"gui":return(await this._executeAction("guiAddCards",p,u)).result;case"updateLast":const e=(await this._executeAction("findNotes",{query:"added:1"},u)).result.sort();if(0===e.length)throw new Error("Could not find note to update");const t=e[e.length-1];p.note.id=t;const r=await this._executeAction("notesInfo",{notes:[t]});if(r.result.length>0&&r.result[0].noteId===t){const e=r.result[0];if(this.settingsProvider.sentenceField&&e.fields&&"string"==typeof e.fields[this.settingsProvider.sentenceField]?.value&&"string"==typeof p.note.fields[this.settingsProvider.sentenceField]&&(p.note.fields[this.settingsProvider.sentenceField]=this._inheritHtmlMarkup(p.note.fields[this.settingsProvider.sentenceField],e.fields[this.settingsProvider.sentenceField].value)),await this._executeAction("updateNoteFields",p,u),c.length>0&&await this._executeAction("addTags",{notes:[t],tags:c.join(" ")},u),!this.settingsProvider.wordField||!e.fields)return e.noteId;const a=e.fields[this.settingsProvider.wordField];return a&&a.value?a.value:e.noteId}throw new Error("Could not update last card because the card info could not be fetched");case"default":return(await this._executeAction("addNote",p,u)).result;default:throw new Error("Unknown export mode: "+l)}}_appendField(e,t,r,a){if(!t||!r)return;let n=a?r.split("\n").join("<br>"):r;const i=e[t];i&&(n=i+"<br>"+n),e[t]=n}_sanitizeFileName(e){return a()(e,{replacement:"_"})}_inheritHtmlMarkup(e,t){const r=RegExp("<[^>]*>(.*?)</[^>]*>","ig"),a=t.replace("<br>","");let n=e;for(;;){const e=r.exec(a);if(null===e||e.length<2)break;n=n.replace(e[1],e[0])}return n}async _storeMediaFile(e,t,r){return this._executeAction("storeMediaFile",{filename:e,data:t},r)}async _executeAction(e,t,r){const a={action:e,version:6};t&&(a.params=t);const n=await this.fetcher.fetch(r||this.settingsProvider.ankiConnectUrl,a);if(n.error)throw new Error(n.error);return n}}chrome.storage.session.setAccessLevel({accessLevel:"TRUSTED_AND_UNTRUSTED_CONTEXTS"});const X=new S(new _);chrome.runtime.onInstalled.addListener((async e=>{if(e.reason!==chrome.runtime.OnInstalledReason.INSTALL)return;const t=chrome.i18n.getUILanguage();(await(async()=>{const e=await k();return void 0===e?F:e.languages.map((e=>e.code))})()).includes(t)&&(await X.set({language:t}),I(t)),chrome.tabs.create({url:chrome.runtime.getURL("ftue-ui.html"),active:!0})})),chrome.runtime.onStartup.addListener((async()=>{I(await X.getSingle("language"))}));const Y=new class{constructor(e){this._settings=e,chrome.tabs.onRemoved.addListener(((e,t)=>{this._videoElements()})),chrome.tabs.onUpdated.addListener(((e,t)=>{"loading"===t.status&&void 0===t.url?(this._videoElements((t=>{let r=!1;for(const[a,n]of Object.entries(t))n.tab.id===e&&(delete t[a],r=!0);return r})),this._asbplayers((t=>{let r=!1;for(const[a,n]of Object.entries(t))n.tab?.id===e&&(delete t[a],r=!0);return r}))):this._videoElements()}))}async _fetchVideoElementState(){return(await chrome.storage.session.get("tabRegistryVideoElements")).tabRegistryVideoElements??{}}async _saveVideoElementState(e){await chrome.storage.session.set({tabRegistryVideoElements:e})}async _videoElements(e){const t=await chrome.tabs.query({}),r=await this._fetchVideoElementState(),a={...r};let n=!1;for(const e in r){const a=r[e];void 0===t.find((e=>e.id===a.tab.id&&e.url===a.tab.url))&&(n=!0,delete r[e])}void 0!==e&&(n=e(r)||n),n&&await this._saveVideoElementState(r);const i=void 0!==Object.values(a).find((e=>e.synced)),o=void 0!==Object.values(r).find((e=>e.synced));return void 0!==this._onNoSyncedElementsCallback&&i&&!o?this._onNoSyncedElementsCallback():void 0!==this._onSyncedElementCallback&&!i&&o&&this._onSyncedElementCallback(),r}async _fetchAsbplayerState(){return(await chrome.storage.session.get("tabRegistryAsbplayers")).tabRegistryAsbplayers??{}}async _saveAsbplayerState(e){await chrome.storage.session.set({tabRegistryAsbplayers:e})}async _asbplayers(e){const t=await chrome.tabs.query({}),r=await this._fetchAsbplayerState(),a={...r},n=Date.now();let i=!1;for(const e in r){const a=r[e];(a.sidePanel&&n-a.timestamp>=5e3||void 0!==a.tab&&void 0===t.find((e=>e.id===a.tab?.id&&e.url===a.tab?.url)))&&(i=!0,delete r[e])}void 0!==e&&(i=e(r)||i);let o=!1;return i&&(await this._saveAsbplayerState(r),o=Object.keys(r).some((e=>!(e in a)))),o&&this._onAsbplayerInstanceCallback?.(),r}async onAsbplayerHeartbeat(e,t,r,a,n){this._updateAsbplayers(e,t,r,a,n);try{const t={sender:"asbplayer-extension-to-player",message:{command:"tabs",tabs:await this._activeVideoElements(),asbplayers:await this._asbplayerInstances(),ackRequested:!1}};e?.id?await chrome.tabs.sendMessage(e.id,t):await chrome.runtime.sendMessage(t)}catch(e){}}async onAsbplayerAckTabs(e,t,r,a){this._updateAsbplayers(e,t,!1,r,a)}async _updateAsbplayers(e,t,r,a,n){const i=void 0===e||void 0===e.id?void 0:{id:e.id,title:e.title??"",url:e.url??""};await this._asbplayers((e=>(e[t]={tab:i,id:t,timestamp:Date.now(),receivedTabs:n,sidePanel:a,videoPlayer:r},!0)))}async _activeVideoElements(){const e=await this._videoElements(),t=[];for(const r in e){const a=e[r];if(a.tab.id){const e={id:a.tab.id,title:a.tab.title,src:a.src,subscribed:a.subscribed,synced:a.synced,syncedTimestamp:a.syncedTimestamp};t.push(e)}}return t}async _asbplayerInstances(){const e=await this._asbplayers(),t=[];for(const r of Object.values(e))t.push({id:r.id,tabId:r.tab?.id,sidePanel:r.sidePanel??!1,timestamp:r.timestamp,videoPlayer:r.videoPlayer});return t}async onVideoElementHeartbeat(e,t,r,a,n){if(void 0===e.id)return;const i=e.id;await this._videoElements((o=>(o[`${e.id}:${t}`]={tab:{id:i,title:e.title??"",url:e.url??""},src:t,subscribed:r,timestamp:Date.now(),synced:a,syncedTimestamp:n},!0)))}async onVideoElementDisappeared(e,t){await this._videoElements((r=>{const a=`${e.id}:${t}`;return a in r&&(delete r[a],!0)}))}onNoSyncedElements(e){this._onNoSyncedElementsCallback=e}onSyncedElement(e){this._onSyncedElementCallback=e}onAsbplayerInstance(e){this._onAsbplayerInstanceCallback=e}async publishTabsToAsbplayers(){const e={sender:"asbplayer-extension-to-player",message:{command:"tabs",tabs:await this._activeVideoElements(),asbplayers:await this._asbplayerInstances(),ackRequested:!0}};await this.publishCommandToAsbplayers({commandFactory:t=>t.videoPlayer?void 0:e})}async publishCommandToAsbplayers({asbplayerId:e,commandFactory:t}){const r=await this._asbplayers();if(void 0!==e){if(e in r){const a=t(r[e]);void 0!==a&&await this._sendCommand(r[e],a)}}else for(const e in r){const a=r[e],n=t(a);void 0!==n&&await this._sendCommand(a,n)}}async _sendCommand(e,t){try{void 0!==e.tab?.id?await chrome.tabs.sendMessage(e.tab.id,t):e.sidePanel&&await chrome.runtime.sendMessage(t)}catch(e){}}async publishCommandToVideoElements(e){const t=await this._videoElements();for(const r in t){const a=t[r],n=a.tab.id;if(void 0!==n){const t=e(a);void 0!==t&&chrome.tabs.sendMessage(n,t)}}}async publishCommandToVideoElementTabs(e){const t=await this._videoElements(),r=[];for(const e of Object.values(t))void 0===r.find((t=>t.id===e.tab.id))&&r.push(e.tab);if(r.length>0)for(const t of r){const r=e(t);void 0!==r&&chrome.tabs.sendMessage(t.id,r)}}async findAsbplayer(e){let t=null;const r=Date.now();let a=null;const n=await this._asbplayers();let i=0;for(const o in n){const s=n[o];if(s.sidePanel||++i,void 0===e||e(s)){const e=r-s.timestamp;(null===a||e<a)&&(a=e,t=s.id)}}return t||new Promise((async(t,r)=>{0===i&&await this._createNewTab(),this._anyAsbplayerTab(t,r,0,10,e)}))}async _createNewTab(){return new Promise((async(e,t)=>{const r=await chrome.tabs.query({active:!0}),a=r&&0!==r.length?r[0].index+1:void 0;chrome.tabs.create({active:!1,selected:!1,url:await this._settings.getSingle("streamingAppUrl"),index:a},e)}))}async _anyAsbplayerTab(e,t,r,a,n){if(r>=a)return void t(new Error("Could not find or create an asbplayer tab"));const i=await this._asbplayers();for(const t in i)if(void 0===n||n(i[t]))return void e(t);setTimeout((()=>this._anyAsbplayerTab(e,t,r+1,a,n)),1e3)}}(X),K=new class{constructor(e){this._tabRegistry=e,e.onNoSyncedElements((async()=>{this._removeBackgroundPage()})),e.onSyncedElement((async()=>{this._backgroundPageTabId()})),e.onAsbplayerInstance((async()=>{this._backgroundPageTabId()})),this._removeOrphanedBackgroundPage()}async tabId(){return await this._fetchBackgroundPageTabId()}async _removeBackgroundPage(){const e=await this._fetchBackgroundPageTabId();await this._tabDoesNotExist(e)||await chrome.tabs.remove(e)}async _removeOrphanedBackgroundPage(){const e=await this._fetchBackgroundPageTabId(),t=await chrome.tabs.query({});for(const r of t)r.url===c&&r.id&&r.id!==e&&await chrome.tabs.remove(r.id)}onBackgroundPageReady(e){return void 0!==this.backgroundPageResolve&&(this.backgroundPageResolve(e),this.backgroundPageResolve=void 0,!0)}onAudioBase64(e){this.audioBase64Resolve?.(e),this.audioBase64Resolve=void 0}async startWithTimeout(e,t,{tabId:r,src:a}){const n=await this._backgroundPageTabId();if(void 0!==this.audioBase64Resolve)throw new Error("Already recording");const i={sender:"asbplayer-extension-to-background-page",message:{command:"start-recording-audio-with-timeout",timeout:e,preferMp3:t}};if(!await chrome.tabs.sendMessage(n,i))throw void 0!==r&&this._requestActiveTab(r,a),new Error("Failed to start recording");this._notifyRecordingStarted();try{return await this._audioBase64()}finally{this._notifyRecordingFinished()}}async start({tabId:e,src:t}){const r=await this._backgroundPageTabId();if(void 0!==this.audioBase64Resolve)throw new Error("Already recording");if(!await chrome.tabs.sendMessage(r,{sender:"asbplayer-extension-to-background-page",message:{command:"start-recording-audio"}}))throw void 0!==e&&this._requestActiveTab(e,t),new Error("Failed to start recording");this._notifyRecordingStarted()}_requestActiveTab(e,t){const r={sender:"asbplayer-extension-to-video",message:{command:"request-active-tab-permission"},src:t};chrome.tabs.sendMessage(e,r)}async stop(e){const t=await this._backgroundPageTabId(),r={sender:"asbplayer-extension-to-background-page",message:{command:"stop-recording-audio",preferMp3:e}};return chrome.tabs.sendMessage(t,r),this._notifyRecordingFinished(),await this._audioBase64()}async _backgroundPageTabId(){const e=await this._fetchBackgroundPageTabId();if(await this._tabDoesNotExist(e)){this.audioBase64Resolve=void 0,await chrome.tabs.create({pinned:!0,active:!1,url:c});const e=await this._backgroundPageReady();return await this._setBackgroundPageTabId(e.id),e.id}return e}async _tabDoesNotExist(e){if(void 0===e)return!0;try{return await chrome.tabs.get(e),!1}catch(e){return!0}}_audioBase64(){return new Promise(((e,t)=>{this.audioBase64Resolve=e}))}_backgroundPageReady(){return new Promise(((e,t)=>{this.backgroundPageResolve=e}))}async _fetchBackgroundPageTabId(){return(await chrome.storage.session.get("backgroundPageTabId")).backgroundPageTabId}async _setBackgroundPageTabId(e){await chrome.storage.session.set({backgroundPageTabId:e})}_notifyRecordingStarted(){const e={sender:"asbplayer-extension-to-player",message:{command:"recording-started"}};this._tabRegistry.publishCommandToAsbplayers({commandFactory:t=>t.sidePanel?e:void 0})}_notifyRecordingFinished(){const e={sender:"asbplayer-extension-to-player",message:{command:"recording-finished"}};this._tabRegistry.publishCommandToAsbplayers({commandFactory:t=>t.sidePanel?e:void 0})}}(Y),ee=new class{constructor(e){this.settings=e}get lastImageBase64(){return this._lastImageBase64}capture(e,t,r,a){return this._lastImageBase64=void 0,void 0!==this.imageBase64Resolve&&void 0!==this.imageBase64Promise?(this._captureWithDelay(e,t,r,a,this.imageBase64Resolve),this.imageBase64Promise):(this.imageBase64Promise=new Promise(((n,i)=>{this.imageBase64Resolve=n,this._captureWithDelay(e,t,r,a,this.imageBase64Resolve)})),this.imageBase64Promise)}_captureWithDelay(e,t,r,a,n){const i=setTimeout((()=>{chrome.tabs.captureVisibleTab({format:"jpeg"},(async r=>{if(i!==this.lastCaptureTimeoutId)return;const o=await this._cropAndResize(r,e,t,a);i===this.lastCaptureTimeoutId&&(this._lastImageBase64=o.substring(o.indexOf(",")+1),n(this._lastImageBase64),this.imageBase64Promise=void 0,this.imageBase64Resolve=void 0,this.lastCaptureTimeoutId=void 0)}))}),r);this.lastCaptureTimeoutId=i}_cropAndResize(e,t,r,a){return new Promise((async(n,i)=>{if(!await this.settings.getSingle("streamingCropScreenshot"))return void n(e);const o={sender:"asbplayer-extension-to-video",message:{command:"crop-and-resize",dataUrl:e,...a},src:r};n((await chrome.tabs.sendMessage(t,o)).dataUrl)}))}}(X),te=new class{constructor(e,t){this._backgroundPageManager=e,this._settingsProvider=t}async publish(e,t,r,a){const i=L(),o=this._saveCardToRepository(i,e);var s,c;if(void 0!==r&&void 0!==a)if(t==g.showAnkiDialog){const t={sender:"asbplayer-extension-to-video",message:{...e,id:i,command:"show-anki-ui"},src:a};chrome.tabs.sendMessage(r,t)}else if(t==g.updateLastCard){const t={sender:"asbplayer-extension-to-video",message:{command:"card-updated",cardName:`${await async function(e,t,r,a,n,i,o){const s=new Q(e);let c=void 0===a?void 0:G.fromBase64(i,t.start,t.end,a.playbackRate??1,a.base64,a.extension);return await s.export(function(e,t){if(0===t.length)return e.text;const r=[e.start,e.end];return a=t.filter((e=>function(e,t){const r=Math.max(0,e.end-e.start);if(0===r)return!1;const a=Math.max(e.start,t[0]);return Math.min(e.end,t[1])-a>=r/2}(e,r))),a.filter((e=>""!==e.text.trim())).map((e=>e.text)).join("\n");var a}(t,r),void 0,c,void 0===n?void 0:y.fromBase64(i,t.start,n.base64,n.extension),void 0,i,o,{},e.tags,"updateLast")}(await this._settingsProvider.get(l),e.subtitle,e.surroundingSubtitles,e.audio,e.image,(s=e.subtitleFileName,c=e.mediaTimestamp,0===c?s:`${s} (${n(c)})`),e.url)}`,subtitle:e.subtitle,surroundingSubtitles:e.surroundingSubtitles,audio:e.audio,image:e.image,url:e.url},src:a};chrome.tabs.sendMessage(r,t)}else t==g.none&&o.then((t=>{if(t){const t={sender:"asbplayer-extension-to-video",message:{command:"card-saved",text:e.subtitle.text||n(e.mediaTimestamp)},src:a};chrome.tabs.sendMessage(r,t)}}))}async _saveCardToRepository(e,t){try{const r={sender:"asbplayer-extension-to-background-page",message:{...t,id:e,command:"copy"}},a=await this._backgroundPageManager.tabId();return void 0!==a&&await chrome.tabs.sendMessage(a,r)}catch(e){return console.error(e),!1}}}(K,X),re=[new class{constructor(e){this.tabRegistry=e}get sender(){return"asbplayer-video"}get command(){return"heartbeat"}handle(e,t){const r=e;return t.tab&&this.tabRegistry.onVideoElementHeartbeat(t.tab,r.src,r.message.subscribed,r.message.synced,r.message.syncedTimestamp),!1}}(Y),new class{constructor(e,t,r,a){this._audioRecorder=e,this._imageCapturer=t,this._cardPublisher=r,this._settingsProvider=a}get sender(){return"asbplayer-video"}get command(){return"record-media-and-forward-subtitle"}async handle(e,t){const r=t.tab,a=e;try{const e=a.message.subtitle;let n,i,o,s;const c=await this._settingsProvider.getSingle("preferMp3");if(a.message.record){const r=(e.end-e.start)/a.message.playbackRate+a.message.audioPaddingEnd;n=this._audioRecorder.startWithTimeout(r,c,{src:a.src,tabId:t.tab?.id})}if(a.message.screenshot){const{maxWidth:t,maxHeight:n,rect:o,frameId:s}=a.message;i=this._imageCapturer.capture(r.id,a.src,Math.min(e.end-e.start,a.message.imageDelay),{maxWidth:t,maxHeight:n,rect:o,frameId:s})}let l;if(i){l=await i;const e={sender:"asbplayer-extension-to-video",message:{command:"screenshot-taken"},src:a.src};chrome.tabs.sendMessage(r.id,e)}n&&(s={base64:await n,extension:c?"mp3":"webm",paddingStart:a.message.audioPaddingStart,paddingEnd:a.message.audioPaddingEnd,playbackRate:a.message.playbackRate}),i&&(o={base64:l,extension:"jpeg"});const u={image:o,audio:s,...a.message};this._cardPublisher.publish(u,a.message.postMineAction,r.id,a.src)}finally{if(a.message.record){const e={sender:"asbplayer-extension-to-video",message:{command:"recording-finished"},src:a.src};chrome.tabs.sendMessage(r.id,e)}}}}(K,ee,te,X),new class{constructor(e,t){this._audioRecorder=e,this._cardPublisher=t}get sender(){return"asbplayer-video"}get command(){return"rerecord-media"}async handle(e,t){const r=e;try{const e={base64:await this._audioRecorder.startWithTimeout(r.message.duration/r.message.playbackRate+r.message.audioPaddingEnd,!1,{src:r.src,tabId:t.tab?.id}),extension:"webm",paddingStart:r.message.audioPaddingStart,paddingEnd:r.message.audioPaddingEnd,start:r.message.timestamp,end:r.message.timestamp+r.message.duration/r.message.playbackRate,playbackRate:r.message.playbackRate};this._cardPublisher.publish({audio:e,image:r.message.uiState.image,url:r.message.uiState.url,subtitle:r.message.uiState.subtitle,surroundingSubtitles:r.message.uiState.surroundingSubtitles,subtitleFileName:r.message.subtitleFileName,mediaTimestamp:r.message.timestamp},void 0,t.tab.id,r.src);const a={sender:"asbplayer-extension-to-video",message:{command:"show-anki-ui-after-rerecord",uiState:{...r.message.uiState,audio:e,lastAppliedTimestampIntervalToAudio:r.message.uiState.timestampInterval}},src:r.src};chrome.tabs.sendMessage(t.tab.id,a)}finally{const e={sender:"asbplayer-extension-to-video",message:{command:"recording-finished"},src:r.src};chrome.tabs.sendMessage(t.tab.id,e)}}}(K,te),new class{constructor(e,t,r){this._audioRecorder=e,this._imageCapturer=t,this._cardPublisher=r}get sender(){return"asbplayer-video"}get command(){return"start-recording-media"}async handle(e,t){const r=e;let a;if(r.message.record&&this._audioRecorder.start({src:r.src,tabId:t.tab?.id}),r.message.screenshot){const e=r.message.record?r.message.imageDelay:0,{maxWidth:n,maxHeight:i,rect:o,frameId:s}=r.message;a=await this._imageCapturer.capture(t.tab.id,r.src,e,{maxWidth:n,maxHeight:i,rect:o,frameId:s});const c={sender:"asbplayer-extension-to-video",message:{command:"screenshot-taken"},src:r.src};chrome.tabs.sendMessage(t.tab.id,c)}if(!r.message.record){const e={text:"",start:r.message.mediaTimestamp,originalStart:r.message.mediaTimestamp,end:r.message.mediaTimestamp,originalEnd:r.message.mediaTimestamp,track:0};let n;a&&(n={base64:a,extension:"jpeg"}),this._cardPublisher.publish({subtitle:e,surroundingSubtitles:[],image:n,url:r.message.url,subtitleFileName:r.message.subtitleFileName,mediaTimestamp:r.message.mediaTimestamp},r.message.postMineAction,t.tab.id,r.src)}}}(K,ee,te),new class{constructor(e,t,r,a){this._audioRecorder=e,this._imageCapturer=t,this._cardPublisher=r,this._settingsProvider=a}get sender(){return"asbplayer-video"}get command(){return"stop-recording-media"}async handle(e,t){const r=e;try{const e=r.message.subtitle??{text:"",start:r.message.startTimestamp,end:r.message.endTimestamp,originalStart:r.message.startTimestamp,originalEnd:r.message.startTimestamp,track:0},a=r.message.surroundingSubtitles??function(e,t,r){const a=[e],n=e.start-e.originalStart;if(e.end<t){const r=Math.min(t,e.end+5e3);a.push({text:"",start:e.end,end:r,originalStart:e.end-n,originalEnd:r-n,track:e.track})}if(e.start>0){const t=Math.max(0,e.start-5e3);a.unshift({text:"",start:t,end:e.start,originalStart:t-n,originalEnd:e.start-n,track:e.track})}return a}(e,r.message.videoDuration);let n;if(r.message.screenshot){let e=this._imageCapturer.lastImageBase64;if(void 0===e){const{maxWidth:a,maxHeight:n,rect:i,frameId:o}=r.message;e=await this._imageCapturer.capture(t.tab.id,r.src,0,{maxWidth:a,maxHeight:n,rect:i,frameId:o})}n={base64:e,extension:"jpeg"}}const i=await this._settingsProvider.getSingle("preferMp3"),o={base64:await this._audioRecorder.stop(i),extension:i?"mp3":"webm",paddingStart:0,paddingEnd:0,start:r.message.startTimestamp,end:r.message.endTimestamp,playbackRate:r.message.playbackRate};this._cardPublisher.publish({subtitle:e,surroundingSubtitles:a,image:n,audio:o,url:r.message.url,subtitleFileName:r.message.subtitleFileName,mediaTimestamp:r.message.startTimestamp},r.message.postMineAction,t.tab.id,r.src)}finally{const e={sender:"asbplayer-extension-to-video",message:{command:"recording-finished"},src:r.src};chrome.tabs.sendMessage(t.tab.id,e)}}}(K,ee,te,X),new class{constructor(e,t){this._imageCapturer=e,this._cardPublisher=t}get sender(){return"asbplayer-video"}get command(){return"take-screenshot"}async handle(e,t){const r=t.tab,a=e,{maxWidth:n,maxHeight:i,rect:o,frameId:s}=a.message,c=await this._imageCapturer.capture(t.tab.id,a.src,0,{maxWidth:n,maxHeight:i,rect:o,frameId:s});let l;a.message.ankiUiState&&(l=a.message.ankiUiState,l.image={base64:c,extension:"jpeg"},this._cardPublisher.publish({audio:l.audio,image:l.image,file:l.file,url:l.url,subtitle:l.subtitle,surroundingSubtitles:l.surroundingSubtitles,subtitleFileName:a.message.subtitleFileName,mediaTimestamp:a.message.mediaTimestamp},void 0,r.id,a.src));const u={sender:"asbplayer-extension-to-video",message:{command:"screenshot-taken",ankiUiState:l},src:a.src};chrome.tabs.sendMessage(r.id,u)}}(ee,te),new class{constructor(e,t){this.settings=e,this.tabRegistry=t}get sender(){return"asbplayer-video"}get command(){return"toggle-subtitles"}async handle(e,t){const r=await this.settings.getSingle("streamingDisplaySubtitles");await this.settings.set({streamingDisplaySubtitles:!r}),this.tabRegistry.publishCommandToVideoElements((e=>({sender:"asbplayer-extension-to-video",message:{command:"settings-updated"},src:e.src})))}}(X,Y),new class{constructor(e){this.tabRegistry=e}get sender(){return"asbplayer-video"}get command(){return"sync"}async handle(e,t){try{const r=e;await this.tabRegistry.publishTabsToAsbplayers();const a=await this.tabRegistry.findAsbplayer((e=>void 0!==e.receivedTabs&&void 0!==t.tab&&!e.sidePanel&&void 0!==e.receivedTabs.find((e=>e.id===t.tab.id&&e.src===r.src)))),n={sender:"asbplayer-extension-to-player",message:{command:"syncv2",subtitles:r.message.subtitles,flatten:r.message.flatten},src:r.src,tabId:t.tab.id};this.tabRegistry.publishCommandToAsbplayers({asbplayerId:a,commandFactory:()=>n})}catch(e){console.error(e)}}}(Y),new class{constructor(){}get sender(){return["asbplayer-video","asbplayer-video-tab","asbplayer-popup"]}get command(){return"http-post"}handle(e,t,r){const a=e.message;if(this._validateBody(a.body))return fetch(a.url,{method:"POST",body:JSON.stringify(a.body)}).then((e=>e.json())).then((e=>r(e))).catch((e=>r({error:e.message}))),!0;r({error:"Invalid request"})}_validateBody(e){const t=Object.keys(e);for(const e of t)if(!o.includes(e))return!1;const r=e.version;if(void 0!==r&&"number"!=typeof r)return!1;const a=e.action;return!(void 0!==a&&!s.includes(a))}},new class{constructor(e){this._tabRegistry=e}get sender(){return["asbplayer-video-tab","asbplayerv2"]}get command(){return"toggle-side-panel"}handle(e,t){let r=!1;return this._tabRegistry.publishCommandToAsbplayers({commandFactory:e=>{if(e.sidePanel)return r=!0,{sender:"asbplayer-extension-to-player",message:{command:"close-side-panel"}}}}),r||chrome.windows.getLastFocused((e=>chrome.sidePanel.open({windowId:e.id}))),!1}}(Y),new class{get sender(){return["asbplayer-video","asbplayer-video-tab"]}get command(){return"open-asbplayer-settings"}async handle(e,t){chrome.runtime.openOptionsPage()}},new class{constructor(){}get sender(){return["asbplayer-video","asbplayer-video-tab"]}get command(){return"copy-to-clipboard"}handle(e,t,r){const a=t.tab?.id;if(void 0===a)return;const n={sender:"asbplayer-extension-to-video",message:e.message};return chrome.tabs.sendMessage(a,n),!1}},new class{constructor(e){this._tabRegistry=e}get sender(){return"asbplayer-video"}get command(){return"video-disappeared"}handle(e,t,r){if(void 0===t.tab)return;const a=e;return this._tabRegistry.onVideoElementDisappeared(t.tab,a.src),!1}}(Y),new class{get sender(){return"asbplayer-video"}get command(){return"requesting-active-tab-permission"}handle(e,t){const r=e;return void 0!==t.tab?.id&&(async(e,t,r)=>{if(r){const r=await(async e=>(await chrome.tabs.query({})).find((t=>t.id===e)))(e);void 0===r?await chrome.storage.session.remove(M):await chrome.storage.session.set({[M]:{tabId:e,src:t,url:r.url}})}else await chrome.storage.session.remove(M)})(t.tab.id,r.src,r.message.requesting),!1}},new class{constructor(e){this._tabRegistry=e}get sender(){return"asbplayerv2"}get command(){return"copy-subtitle"}handle(e,t){const r=e;return this._tabRegistry.publishCommandToVideoElements((e=>{if(e.src===r.src&&e.tab.id===r.tabId)return{sender:"asbplayer-extension-to-video",message:{command:"copy-subtitle",postMineAction:r.message.postMineAction,subtitle:r.message.subtitle,surroundingSubtitles:r.message.surroundingSubtitles},src:e.src}})),!1}}(Y),new class{constructor(e){this._tabRegistry=e}get sender(){return"asbplayerv2"}get command(){return"load-subtitles"}handle(e,t){const r=e,a={sender:"asbplayer-extension-to-video",message:{command:"toggle-video-select"}};return this._tabRegistry.publishCommandToVideoElementTabs((e=>e.id===r.tabId?a:void 0)),!1}}(Y),new class{constructor(e){this._cardPublisher=e}get sender(){return"asbplayerv2"}get command(){return"publish-card"}handle(e,t){const r=e.message;return this._cardPublisher.publish(r),!1}}(te),new class{constructor(e){this._tabRegistry=e}get sender(){return"asbplayer-video"}get command(){return"ack-message"}handle(e,t,r){const a={sender:"asbplayer-extension-to-player",message:e.message};return this._tabRegistry.publishCommandToAsbplayers({commandFactory:()=>a}),!1}}(Y),new class{constructor(e){this.tabRegistry=e}get sender(){return"asbplayer-video"}get command(){return null}handle(e,t){const r=e;if(void 0!==t.tab?.id){const a={sender:"asbplayer-extension-to-player",message:e.message,tabId:t.tab.id,src:r.src};this.tabRegistry.publishCommandToAsbplayers({commandFactory:()=>a})}return!1}}(Y),new class{get sender(){return"asbplayer"}get command(){return null}handle(e,t){const r=e,a={sender:"asbplayer-extension-to-video",message:r.message,src:r.src};return chrome.tabs.sendMessage(r.tabId,a),!1}},new class{constructor(e){this.tabRegistry=e}get sender(){return"asbplayerv2"}get command(){return"heartbeat"}handle(e,t){const r=e.message;return this.tabRegistry.onAsbplayerHeartbeat(t.tab,r.id,r.videoPlayer,r.sidePanel??!1,r.receivedTabs),!1}}(Y),new class{constructor(e){this.tabRegistry=e}get sender(){return"asbplayerv2"}get command(){return"ackTabs"}handle(e,t){const r=e.message;return this.tabRegistry.onAsbplayerAckTabs(t.tab,r.id,r.sidePanel??!1,r.receivedTabs),!1}}(Y),new class{constructor(e,t){this._tabRegistry=e,this._settingsProvider=t}get sender(){return"asbplayerv2"}get command(){return"settings-updated"}handle(e,t){const r=e;return this._settingsProvider.getSingle("language").then(I),this._tabRegistry.publishCommandToVideoElements((e=>({sender:"asbplayer-extension-to-video",message:{command:"settings-updated"},src:e.src}))),this._tabRegistry.publishCommandToAsbplayers({commandFactory:e=>{if(void 0===r.asbplayerId||r.asbplayerId!==e.id)return{sender:"asbplayer-extension-to-player",message:{command:"settings-updated"}}}}),!1}}(Y,X),new class{get sender(){return"asbplayerv2"}get command(){return"open-extension-shortcuts"}handle(e,t){return chrome.tabs.create({active:!0,url:"chrome://extensions/shortcuts"}),!1}},new class{get sender(){return"asbplayerv2"}get command(){return"extension-commands"}handle(e,t,r){return chrome.commands.getAll((e=>{const t={};for(const r of e)r.name&&r.shortcut&&(t[r.name]=r.shortcut);r(t)})),!0}},new class{constructor(){}get sender(){return"asbplayerv2"}get command(){return null}handle(e,t){const r=e;if(r.tabId){const e={sender:"asbplayer-extension-to-video",message:r.message,src:r.src};chrome.tabs.sendMessage(r.tabId,e)}return!1}},new class{constructor(e){this.tabRegistry=e}get sender(){return["asbplayer-popup","asbplayer-settings"]}get command(){return"settings-updated"}handle(e,t){return this.tabRegistry.publishCommandToVideoElements((e=>({sender:"asbplayer-extension-to-video",message:{command:"settings-updated"},src:e.src}))),this.tabRegistry.publishCommandToAsbplayers({commandFactory:()=>({sender:"asbplayer-extension-to-player",message:{command:"settings-updated"}})}),!1}}(Y),new class{constructor(e){this.backgroundPageAudioRecorder=e}get sender(){return"asbplayer-background-page"}get command(){return"background-page-ready"}handle(e,t,r){if(t.tab)return r(this.backgroundPageAudioRecorder.onBackgroundPageReady(t.tab)),!1;r(!1)}}(K),new class{constructor(e){this.backgroundPageAudioRecorder=e}get sender(){return"asbplayer-background-page"}get command(){return"audio-base64"}handle(e,t){const r=e;return this.backgroundPageAudioRecorder.onAudioBase64(r.message.base64),!1}}(K),new class{get sender(){return"asbplayer-foreground"}get command(){return"capture-visible-tab"}handle(e,t,r){return chrome.tabs.captureVisibleTab({format:"jpeg"},(e=>{r(e)})),!0}}];chrome.runtime.onMessage.addListener(((e,t,r)=>{for(const a of re)if(("string"==typeof a.sender&&a.sender===e.sender||"object"==typeof a.sender&&a.sender.includes(e.sender))&&(null===a.command||a.command===e.message.command)){if(!0===a.handle(e,t,r))return!0;break}})),chrome.runtime.onInstalled.addListener((()=>{chrome.contextMenus.create({id:"load-subtitles",title:chrome.i18n.getMessage("contextMenuLoadSubtitles"),contexts:["page","video"]}),chrome.contextMenus.create({id:"mine-subtitle",title:chrome.i18n.getMessage("contextMenuMineSubtitle"),contexts:["page","video"]})})),chrome.contextMenus.onClicked.addListener((e=>{if("load-subtitles"===e.menuItemId){const t={sender:"asbplayer-extension-to-video",message:{command:"toggle-video-select"}};Y.publishCommandToVideoElementTabs((r=>{if(e.pageUrl===r.url)return t}))}else"mine-subtitle"===e.menuItemId&&Y.publishCommandToVideoElements((t=>{if(!(void 0!==e.srcUrl&&t.src!==e.srcUrl||void 0===e.srcUrl&&e.pageUrl!==t.tab.url))return{sender:"asbplayer-extension-to-video",message:{command:"copy-subtitle",postMineAction:g.showAnkiDialog},src:t.src}}))})),chrome.commands.onCommand.addListener((e=>{chrome.tabs.query({active:!0,currentWindow:!0},(t=>{const r=e=>{if(e.sidePanel)return!1;const r=e.tab;return!r||void 0!==t.find((e=>e.id===r.id))};switch(e){case"copy-subtitle":case"update-last-card":case"copy-subtitle-with-dialog":const a=function(e){switch(e){case"copy-subtitle":return g.none;case"copy-subtitle-with-dialog":return g.showAnkiDialog;case"update-last-card":return g.updateLastCard;default:throw new Error("Cannot determine post mine action for unknown command "+e)}}(e);Y.publishCommandToVideoElements((e=>{if(void 0!==t.find((t=>t.id===e.tab.id)))return{sender:"asbplayer-extension-to-video",message:{command:"copy-subtitle",postMineAction:a},src:e.src}})),Y.publishCommandToAsbplayers({commandFactory:e=>{if(r(e))return{sender:"asbplayer-extension-to-player",message:{command:"copy-subtitle",postMineAction:a},asbplayerId:e.id}}});break;case"toggle-video-select":for(const e of t)if(void 0!==e.id){const t={sender:"asbplayer-extension-to-video",message:{command:"toggle-video-select"}};chrome.tabs.sendMessage(e.id,t)}break;case"take-screenshot":Y.publishCommandToVideoElements((e=>{if(void 0!==t.find((t=>t.id===e.tab.id)))return{sender:"asbplayer-extension-to-video",message:{command:"take-screenshot"},src:e.src}})),Y.publishCommandToAsbplayers({commandFactory:e=>{if(r(e))return{sender:"asbplayer-extension-to-player",message:{command:"take-screenshot"}}}});break;case"toggle-recording":Y.publishCommandToVideoElements((e=>{if(void 0!==t.find((t=>t.id===e.tab.id)))return{sender:"asbplayer-extension-to-video",message:{command:"toggle-recording"},src:e.src}}));break;default:throw new Error("Unknown command "+e)}}))}))})()})();