@atlassian/bitbucket-server
Version:
Bitbucket Server API client for Browser and Node.js
13 lines • 36.5 kB
JavaScript
var BitbucketServer=function(e){var t={};function r(n){if(t[n])return t[n].exports;var s=t[n]={i:n,l:!1,exports:{}};return e[n].call(s.exports,s,s.exports,r),s.l=!0,s.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var s in e)r.d(n,s,function(t){return e[t]}.bind(null,s));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=2)}([function(e,t){const r={304:"Not Modified",400:"Bad Request",404:"Not Found",500:"Internal Server Error",504:"Gateway Timeout"};e.exports=class extends Error{constructor(e,t,n){super("string"==typeof e?e:e.error.message),Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=t,this.status=r[t],this.headers=n,this.error=e}toJSON(){return{code:this.code,error:this.error,status:this.status,message:this.message}}}},function(e,t,r){const n=r(7),s=e=>n(e)||Array.isArray(e),i=e=>s(e)?o((e=>Array.isArray(e)?[]:{})(e),e):e,o=(e,t)=>{let r=Array.isArray(t);return r===Array.isArray(e)?r?((e,t)=>e.concat(t).map(e=>i(e)))(e,t):((e,t)=>{let r={};return s(e)&&Object.keys(e).forEach(t=>{r[t]=i(e[t])}),Object.keys(t).forEach(n=>{s(t[n])&&e[n]?r[n]=o(e[n],t[n]):r[n]=i(t[n])}),r})(e,t):i(t)};e.exports=o},function(e,t,r){const n=r(3),s=r(1),i=r(9),o=[r(23),r(27),r(32)],p={headers:{},options:{timeout:0}};e.exports=class{constructor(e={}){this.options=s(p,e),this.hook=new n,this.request=this.request.bind(this),o.forEach(e=>this.addPlugin(e))}addPlugin(e){new e(this).inject()}request(e={}){return this.hook("request",s(this.options,e),i)}}},function(e,t,r){var n=r(4),s=r(5),i=r(6),o=Function.bind,p=o.bind(o);function a(e,t,r){var n=p(i,null).apply(null,r?[t,null,r]:[t,null]);e.api={remove:n},e.remove=n,["before","error","after","wrap"].forEach(function(n){var o=r?[t,n,r]:[t,n];e[n]=e.api[n]=p(s,null).apply(null,o),e.remove[n]=e.api.remove[n]=p(i,null).apply(null,o)})}function u(){var e={registry:{}},t=n.bind(null,e);return a(t,e),t}var c=!1;function l(){return c||(console.warn('[before-after-hook]: "Hook()" repurposing warning, use "Hook.Collection()". Read more: https://git.io/upgrade-before-after-hook-to-1.4'),c=!0),u()}l.Singular=function(){var e={registry:{}},t=n.bind(null,e,"h");return a(t,e,"h"),t}.bind(),l.Collection=u.bind(),e.exports=l,e.exports.Hook=l,e.exports.Singular=l.Singular,e.exports.Collection=l.Collection},function(e,t){e.exports=function e(t,r,n,s){3===arguments.length&&(s=n,n={});if("function"!=typeof s)throw new Error("method for before hook must be a function");if("object"!=typeof n)throw new Error("options for before hook must be an object");if(Array.isArray(r))return r.reverse().reduce(function(r,s){return e.bind(null,t,s,n,r)},s)();return Promise.resolve().then(function(){return t.registry[r]?t.registry[r].reduce(function(e,t){return t.hook.bind(null,e,n)},s)():s(n)})}},function(e,t){e.exports=function(e,t,r,n){var s=n;e.registry[r]||(e.registry[r]=[]);"before"===t&&(n=function(e,t){return Promise.resolve().then(s.bind(null,t)).then(e.bind(null,t))});"after"===t&&(n=function(e,t){var r;return Promise.resolve().then(e.bind(null,t)).then(function(e){return s(r=e,t)}).then(function(){return r})});"error"===t&&(n=function(e,t){return Promise.resolve().then(e.bind(null,t)).catch(function(e){return s(e,t)})});e.registry[r].push({hook:n,orig:s})}},function(e,t){e.exports=function(e,t,r,n){t&&console.warn("hook.remove.%s(name, method) is deprecated, use hook.remove(name, method)",t);if(!e.registry[r])return;var s=e.registry[r].map(function(e){return e.orig}).indexOf(n);if(-1===s)return;e.registry[r].splice(s,1)}},function(e,t,r){"use strict";
/*!
* is-plain-object <https://github.com/jonschlinkert/is-plain-object>
*
* Copyright (c) 2014-2017, Jon Schlinkert.
* Released under the MIT License.
*/var n=r(8);function s(e){return!0===n(e)&&"[object Object]"===Object.prototype.toString.call(e)}e.exports=function(e){var t,r;return!1!==s(e)&&("function"==typeof(t=e.constructor)&&(!1!==s(r=t.prototype)&&!1!==r.hasOwnProperty("isPrototypeOf")))}},function(e,t,r){"use strict";
/*!
* isobject <https://github.com/jonschlinkert/isobject>
*
* Copyright (c) 2014-2017, Jon Schlinkert.
* Released under the MIT License.
*/e.exports=function(e){return null!=e&&"object"==typeof e&&!1===Array.isArray(e)}},function(e,t,r){const n=r(10),s=r(16);e.exports=e=>{let t=n(e);return s(t)}},function(e,t,r){const n=r(11),s=r(12),i=r(1),o=r(0),p=r(13);e.exports=(e={})=>{let{accepts:t=[],baseUrl:r,body:a,headers:u,method:c,url:l,options:y,...d}=i(p,e),{_paramGroups:h={},...g}=d,f={};if(Object.keys(h).forEach(e=>{f[e]={},h[e].forEach(t=>{void 0!==g[t]&&(f[e][t]=g[t])})}),l=n.parse(l).expand(f.path||{}),/^http/.test(l)||(l=`${r}${l}`),f.query&&(l=s(l,f.query)),f.body&&Object.keys(f.body).length){let e=(a=f.body.body||{}).constructor.name;if(/form-?data/i.test(e)){let r="multipart/form-data";if(!~t.indexOf(r))throw new o(`Invalid Body Type: ${e}`,400);u["content-type"]=r}else{let e="application/x-www-form-urlencoded";Object.keys(f.body).forEach(e=>{"body"!==e&&(a[e]=f.body[e])}),~t.indexOf(e)?(a=s("",a).substring(1),u["content-type"]=e):(a=JSON.stringify(a),u["content-type"]="application/json; charset=utf-8")}}else a&&(a=JSON.stringify(a),u["content-type"]="application/json; charset=utf-8");return{...y,method:c,url:l,headers:u,body:a}}},function(e,t,r){e.exports=function(){function e(){}return e.prototype.encodeReserved=function(e){return e.split(/(%[0-9A-Fa-f]{2})/g).map(function(e){return/%[0-9A-Fa-f]/.test(e)||(e=encodeURI(e).replace(/%5B/g,"[").replace(/%5D/g,"]")),e}).join("")},e.prototype.encodeUnreserved=function(e){return encodeURIComponent(e).replace(/[!'()*]/g,function(e){return"%"+e.charCodeAt(0).toString(16).toUpperCase()})},e.prototype.encodeValue=function(e,t,r){return t="+"===e||"#"===e?this.encodeReserved(t):this.encodeUnreserved(t),r?this.encodeUnreserved(r)+"="+t:t},e.prototype.isDefined=function(e){return null!=e},e.prototype.isKeyOperator=function(e){return";"===e||"&"===e||"?"===e},e.prototype.getValues=function(e,t,r,n){var s=e[r],i=[];if(this.isDefined(s)&&""!==s)if("string"==typeof s||"number"==typeof s||"boolean"==typeof s)s=s.toString(),n&&"*"!==n&&(s=s.substring(0,parseInt(n,10))),i.push(this.encodeValue(t,s,this.isKeyOperator(t)?r:null));else if("*"===n)Array.isArray(s)?s.filter(this.isDefined).forEach(function(e){i.push(this.encodeValue(t,e,this.isKeyOperator(t)?r:null))},this):Object.keys(s).forEach(function(e){this.isDefined(s[e])&&i.push(this.encodeValue(t,s[e],e))},this);else{var o=[];Array.isArray(s)?s.filter(this.isDefined).forEach(function(e){o.push(this.encodeValue(t,e))},this):Object.keys(s).forEach(function(e){this.isDefined(s[e])&&(o.push(this.encodeUnreserved(e)),o.push(this.encodeValue(t,s[e].toString())))},this),this.isKeyOperator(t)?i.push(this.encodeUnreserved(r)+"="+o.join(",")):0!==o.length&&i.push(o.join(","))}else";"===t?this.isDefined(s)&&i.push(this.encodeUnreserved(r)):""!==s||"&"!==t&&"?"!==t?""===s&&i.push(""):i.push(this.encodeUnreserved(r)+"=");return i},e.prototype.parse=function(e){var t=this,r=["+","#",".","/",";","?","&"];return{expand:function(n){return e.replace(/\{([^\{\}]+)\}|([^\{\}]+)/g,function(e,s,i){if(s){var o=null,p=[];if(-1!==r.indexOf(s.charAt(0))&&(o=s.charAt(0),s=s.substr(1)),s.split(/,/g).forEach(function(e){var r=/([^:\*]*)(?::(\d+)|(\*))?/.exec(e);p.push.apply(p,t.getValues(n,o,r[1],r[2]||r[3]))}),o&&"+"!==o){var a=",";return"?"===o?a="&":"#"!==o&&(a=o),(0!==p.length?o:"")+p.join(a)}return p.join(",")}return t.encodeReserved(i)})}}},new e}()},function(e,t){e.exports=(e,t={})=>{e=`${e}${/\?/.test(e)?"&":"?"}markup&avatarSize=64`;const r=Object.keys(t);return 0===r.length?e:`${e}&${r.map(e=>"q"===e?Object.keys(t.q).map(e=>`${e}=${encodeURIComponent(t.q[e])}`).join("&"):`${e}=${encodeURIComponent(t[e])}`).join("&")}`}},function(e,t,r){const{version:n}=r(14),{basePath:s,host:i,produces:o,schemes:p}=r(15),a={baseUrl:`${p[0]}://${i}${s}`,headers:{accept:`${o.join(",")}`,"user-agent":`NodeBitbucketServerKit/${n}`},method:"GET",options:{}};e.exports=a},function(e){e.exports={name:"@atlassian/bitbucket-server",version:"0.0.6",description:"Bitbucket Server API client for Browser and Node.js",keywords:["bitbucket-server","api-client","rest"],homepage:"https://bitbucket.org/atlassianlabs/bitbucket-server",bugs:"https://bitbucket.org/atlassianlabs/bitbucket-server/issues",license:"MIT",author:"Atlassian",files:["src","dist/*.js"],main:"src/index.js",types:"src/index.d.ts",browser:{"./src/utils/get-buffer-response.js":"./src/utils/get-buffer-response-browser.js"},repository:"https://bitbucket.org/atlassianlabs/bitbucket-server",scripts:{build:"npm-run-all -p build:*","prebuild:browser":"mkdirp dist","build:browser":"npm-run-all -p build:browser:*","build:browser:development":"webpack --mode development","build:browser:production":"webpack --mode production --output-filename=bitbucker-server.min.js","prebuild:docs":"mkdirp docs","build:docs":"npm run generate:api-docs","postbuild:docs":"apidoc -i docs -o docs","generate:specification":"node scripts/generate-specification.js","generate:api-names":"node scripts/generate-api-names.js","generate:routes":"node scripts/generate-routes.js","generate:api-docs":"node scripts/generate-api-docs.js","generate:type-defs":"node scripts/generate-type-defs.js","generate:types":"npm-run-all -p generate:types:*","generate:types:ts":"node scripts/generate-types-ts.js",validate:"npm-run-all -p validate:*","validate:types":"npm-run-all -p validate:types:*","prevalidate:types:ts":"npm run generate:types:ts","validate:types:ts":"tsc --target es6 src/index.d.ts",prepare:"npm-run-all -s build:browser generate:types","reset:routes":"node scripts/reset-routes.js","reset:api-names":"node scripts/reset-api-names.js","reset:spec":"node scripts/reset-spec.js","reset:types":"node scripts/reset-types.js","reset:type-defs":"node scripts/reset-type-defs.js",reset:"npm-run-all -p reset:*",regenerate:"npm run reset && npm run generate:specification && npm run generate:api-names && npm run generate:routes && npm run generate:type-defs && npm run generate:types","regen:routes":"npm run reset:routes && npm run generate:routes","regen:api-names":"npm run reset:api-names && npm run generate:api-names","regen:spec":"npm run reset:spec && npm run generate:specification","regen:types":"npm run reset:types && npm run generate:types","regen:type-defs":"npm run reset:type-defs && npm run generate:type-defs",test:"jest"},dependencies:{"before-after-hook":"^1.1.0","btoa-lite":"^1.0.0",debug:"^3.1.0","is-plain-object":"^2.0.4","node-fetch":"^2.1.2","url-template":"^2.0.8"},devDependencies:{apidoc:"^0.17.6","clean-deep":"^3.0.2","deep-sort-object":"^1.0.2",eslint:"^4.19.1","eslint-config-prettier":"^2.9.0","eslint-config-standard":"^11.0.0","eslint-plugin-import":"^2.12.0","eslint-plugin-jest":"^21.15.2","eslint-plugin-node":"^6.0.1","eslint-plugin-prettier":"^2.6.0","eslint-plugin-promise":"^3.8.0","eslint-plugin-standard":"^3.1.0","form-data":"^2.3.2",jest:"^23.0.0","json-schema-to-typescript":"^6.0.1",lodash:"^4.17.10",mkdirp:"^0.5.1",mustache:"^2.3.0","npm-run-all":"^4.1.3",prettier:"^1.12.1",typescript:"^2.8.3",webpack:"^4.33.0","webpack-cli":"^3.3.4"}}},function(e){e.exports={consumes:["application/json"],produces:["application/json"],schemes:["http"],swagger:"2.0"}},function(e,t,r){const n=r(17),s=r(18)("bitbucket-server"),i=r(22),o=r(0),p=e=>{let t=e.headers.get("content-type");return/application\/json/.test(t)?e.body&&204!==e.status?e.json():"":!t||/^text\/|charset=utf-8$/.test(t)?e.text():i(e)};e.exports=e=>{s("REQUEST:",e);let{method:t,url:r,headers:i,body:a,timeout:u,agent:c}=e;t=t.toUpperCase();let l={};return n(r,{method:t,headers:i,body:a,timeout:u,agent:c}).then(e=>{for(let[t,r]of e.headers.entries())l[t]=r;return e.status>=400||[304].includes(e.status)?p(e).then(t=>{Array.isArray(t.errors)&&t.errors.length>0&&(t=t.errors[0]);var r="";throw t.error&&(r=t.error),t.errorMessages&&(r=t.errorMessages[0]),t.message&&(r=t.message),new o(r,e.status,l)}):p(e)}).then(e=>({data:e,headers:l})).catch(e=>{if(e instanceof o)throw e;throw new o(e.message,500,l)})}},function(e,t,r){"use strict";var n=function(){if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if(void 0!==n)return n;throw new Error("unable to locate global object")}();e.exports=t=n.fetch,t.default=n.fetch.bind(n),t.Headers=n.Headers,t.Request=n.Request,t.Response=n.Response},function(e,t,r){"use strict";(function(n){function s(e){return(s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}t.log=function(){var e;return"object"===("undefined"==typeof console?"undefined":s(console))&&console.log&&(e=console).log.apply(e,arguments)},t.formatArgs=function(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+e.exports.humanize(this.diff),!this.useColors)return;var r="color: "+this.color;t.splice(1,0,r,"color: inherit");var n=0,s=0;t[0].replace(/%[a-zA-Z%]/g,function(e){"%%"!==e&&(n++,"%c"===e&&(s=n))}),t.splice(s,0,r)},t.save=function(e){try{e?t.storage.setItem("debug",e):t.storage.removeItem("debug")}catch(e){}},t.load=function(){var e;try{e=t.storage.getItem("debug")}catch(e){}!e&&void 0!==n&&"env"in n&&(e=n.env.DEBUG);return e},t.useColors=function(){if("undefined"!=typeof window&&window.process&&("renderer"===window.process.type||window.process.__nwjs))return!0;if("undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;return"undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)},t.storage=function(){try{return localStorage}catch(e){}}(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],e.exports=r(20)(t),e.exports.formatters.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}}).call(this,r(19))},function(e,t){var r,n,s=e.exports={};function i(){throw new Error("setTimeout has not been defined")}function o(){throw new Error("clearTimeout has not been defined")}function p(e){if(r===setTimeout)return setTimeout(e,0);if((r===i||!r)&&setTimeout)return r=setTimeout,setTimeout(e,0);try{return r(e,0)}catch(t){try{return r.call(null,e,0)}catch(t){return r.call(this,e,0)}}}!function(){try{r="function"==typeof setTimeout?setTimeout:i}catch(e){r=i}try{n="function"==typeof clearTimeout?clearTimeout:o}catch(e){n=o}}();var a,u=[],c=!1,l=-1;function y(){c&&a&&(c=!1,a.length?u=a.concat(u):l=-1,u.length&&d())}function d(){if(!c){var e=p(y);c=!0;for(var t=u.length;t;){for(a=u,u=[];++l<t;)a&&a[l].run();l=-1,t=u.length}a=null,c=!1,function(e){if(n===clearTimeout)return clearTimeout(e);if((n===o||!n)&&clearTimeout)return n=clearTimeout,clearTimeout(e);try{n(e)}catch(t){try{return n.call(null,e)}catch(t){return n.call(this,e)}}}(e)}}function h(e,t){this.fun=e,this.array=t}function g(){}s.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)t[r-1]=arguments[r];u.push(new h(e,t)),1!==u.length||c||p(d)},h.prototype.run=function(){this.fun.apply(null,this.array)},s.title="browser",s.browser=!0,s.env={},s.argv=[],s.version="",s.versions={},s.on=g,s.addListener=g,s.once=g,s.off=g,s.removeListener=g,s.removeAllListeners=g,s.emit=g,s.prependListener=g,s.prependOnceListener=g,s.listeners=function(e){return[]},s.binding=function(e){throw new Error("process.binding is not supported")},s.cwd=function(){return"/"},s.chdir=function(e){throw new Error("process.chdir is not supported")},s.umask=function(){return 0}},function(e,t,r){"use strict";e.exports=function(e){function t(e){for(var t=0,r=0;r<e.length;r++)t=(t<<5)-t+e.charCodeAt(r),t|=0;return n.colors[Math.abs(t)%n.colors.length]}function n(e){var r;function o(){if(o.enabled){for(var e=arguments.length,t=new Array(e),s=0;s<e;s++)t[s]=arguments[s];var i=o,p=Number(new Date),a=p-(r||p);i.diff=a,i.prev=r,i.curr=p,r=p,t[0]=n.coerce(t[0]),"string"!=typeof t[0]&&t.unshift("%O");var u=0;t[0]=t[0].replace(/%([a-zA-Z%])/g,function(e,r){if("%%"===e)return e;u++;var s=n.formatters[r];if("function"==typeof s){var o=t[u];e=s.call(i,o),t.splice(u,1),u--}return e}),n.formatArgs.call(i,t),(i.log||n.log).apply(i,t)}}return o.namespace=e,o.enabled=n.enabled(e),o.useColors=n.useColors(),o.color=t(e),o.destroy=s,o.extend=i,"function"==typeof n.init&&n.init(o),n.instances.push(o),o}function s(){var e=n.instances.indexOf(this);return-1!==e&&(n.instances.splice(e,1),!0)}function i(e,t){return n(this.namespace+(void 0===t?":":t)+e)}return n.debug=n,n.default=n,n.coerce=function(e){return e instanceof Error?e.stack||e.message:e},n.disable=function(){n.enable("")},n.enable=function(e){var t;n.save(e),n.names=[],n.skips=[];var r=("string"==typeof e?e:"").split(/[\s,]+/),s=r.length;for(t=0;t<s;t++)r[t]&&("-"===(e=r[t].replace(/\*/g,".*?"))[0]?n.skips.push(new RegExp("^"+e.substr(1)+"$")):n.names.push(new RegExp("^"+e+"$")));for(t=0;t<n.instances.length;t++){var i=n.instances[t];i.enabled=n.enabled(i.namespace)}},n.enabled=function(e){if("*"===e[e.length-1])return!0;var t,r;for(t=0,r=n.skips.length;t<r;t++)if(n.skips[t].test(e))return!1;for(t=0,r=n.names.length;t<r;t++)if(n.names[t].test(e))return!0;return!1},n.humanize=r(21),Object.keys(e).forEach(function(t){n[t]=e[t]}),n.instances=[],n.names=[],n.skips=[],n.formatters={},n.selectColor=t,n.enable(n.load()),n}},function(e,t){var r=1e3,n=60*r,s=60*n,i=24*s,o=7*i,p=365.25*i;function a(e,t,r,n){var s=t>=1.5*r;return Math.round(e/r)+" "+n+(s?"s":"")}e.exports=function(e,t){t=t||{};var u=typeof e;if("string"===u&&e.length>0)return function(e){if((e=String(e)).length>100)return;var t=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(!t)return;var a=parseFloat(t[1]);switch((t[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return a*p;case"weeks":case"week":case"w":return a*o;case"days":case"day":case"d":return a*i;case"hours":case"hour":case"hrs":case"hr":case"h":return a*s;case"minutes":case"minute":case"mins":case"min":case"m":return a*n;case"seconds":case"second":case"secs":case"sec":case"s":return a*r;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return a;default:return}}(e);if("number"===u&&isFinite(e))return t.long?function(e){var t=Math.abs(e);if(t>=i)return a(e,t,i,"day");if(t>=s)return a(e,t,s,"hour");if(t>=n)return a(e,t,n,"minute");if(t>=r)return a(e,t,r,"second");return e+" ms"}(e):function(e){var t=Math.abs(e);if(t>=i)return Math.round(e/i)+"d";if(t>=s)return Math.round(e/s)+"h";if(t>=n)return Math.round(e/n)+"m";if(t>=r)return Math.round(e/r)+"s";return e+"ms"}(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))}},function(e,t){e.exports=e=>e.arrayBuffer()},function(e,t,r){const n=r(24),s=r(25);e.exports=class{constructor(e){this.core=e,this.state={auth:!1}}inject(){this.core.authenticate=n.bind(null,this.state),this.core.hook.before("request",s.bind(null,this.state))}}},function(e,t){e.exports=(e,t={})=>{if(t.type){switch(t.type){case"basic":case"apppassword":if(!t.username||!t.password)throw new Error("Basic authentication requires both a username and password to be set");break;case"oauth":if(!(t.token||t.key&&t.secret))throw new Error("OAuth2 authentication requires a token or key & secret to be set");break;case"token":if(!t.token)throw new Error("Token authentication requires a token to be set");break;default:throw new Error("Invalid authentication type, must be 'basic', 'oauth' or 'token'")}e.auth=t}else e.auth=!1}},function(e,t,r){const n=r(26);e.exports=(e,t)=>{if(!e.auth.type)return;if(["basic","apppassword"].includes(e.auth.type)){const r=n(`${e.auth.username}:${e.auth.password}`);return void(t.headers.authorization=`Basic ${r}`)}if("token"===e.auth.type)return void(t.headers.authorization=`Bearer ${e.auth.token}`);if(t.url+=-1===t.url.indexOf("?")?"?":"&",e.auth.token)return void(t.url+=`access_token=${encodeURIComponent(e.auth.token)}`);const r=encodeURIComponent(e.auth.key),s=encodeURIComponent(e.auth.secret);t.url+=`client_id=${r}&client_secret=${s}`}},function(e,t){e.exports=function(e){return btoa(e)}},function(e,t,r){const n=r(28),s=r(29),i=r(31);e.exports=class{constructor(e){this.core=e}inject(){Object.keys(n).forEach(e=>{this.core[e]={},Object.keys(n[e]).forEach(t=>{let r=n[e][t];if(r.alias){let[e,t]=r.alias.split(".");r=n[e][t]}let{accepts:o,method:p,params:a,url:u,...c}=r,l={method:p,url:u,...c,_paramGroups:i(a)};o&&(l.accepts=o),this.core[e][t]=s.bind(null,this.core,l,a)})})}}},function(e){e.exports={api:{getApplicationProperties:{headers:{accept:"application/json"},method:"GET",params:{q:{in:"query",type:"object"}},url:"/rest/api/1.0/application-properties"},getUser:{headers:{accept:"application/json"},method:"GET",params:{q:{in:"query",type:"object"},userSlug:{in:"path",required:!0,type:"string"}},returns:"User",url:"/rest/api/1.0/users/{userSlug}"},getUsers:{headers:{accept:"application/json"},method:"GET",params:{limit:{in:"query",type:"integer"},q:{in:"query",type:"any"},start:{in:"query",type:"integer"}},returns:"PaginatedUsers",url:"/rest/api/1.0/users"},preview:{headers:{accept:"application/json"},method:"POST",params:{body:{in:"body",required:!0,schema:"PreviewRequest",type:"any"},q:{in:"query",type:"object"}},url:"/rest/api/1.0/markup/preview"}},comments:{getComment:{headers:{accept:"application/json"},method:"GET",params:{commentId:{in:"path",required:!0,type:"integer"},projectKey:{in:"path",required:!0,type:"string"},pullRequestId:{in:"path",required:!0,type:"string"},q:{in:"query",type:"object"},repositorySlug:{in:"path",required:!0,type:"string"}},url:"/rest/api/1.0/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId}/comments/{commentId}"},updateComment:{headers:{accept:"application/json"},method:"PUT",params:{body:{in:"body",required:!0,schema:"UpdateCommentRequest",type:"any"},commentId:{in:"path",required:!0,type:"integer"},projectKey:{in:"path",required:!0,type:"string"},pullRequestId:{in:"path",required:!0,type:"string"},q:{in:"query",type:"object"},repositorySlug:{in:"path",required:!0,type:"string"}},url:"/rest/api/1.0/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId}/comments/{commentId}"}},commits:{getPullRequests:{headers:{accept:"application/json"},method:"GET",params:{commitId:{in:"path",required:!0,type:"string"},projectKey:{in:"path",required:!0,type:"string"},q:{in:"query",type:"object"},repositorySlug:{in:"path",required:!0,type:"string"}},url:"/rest/api/1.0/projects/{projectKey}/repos/{repositorySlug}/commits/{commitId}/pull-requests"}},participants:{updateStatus:{headers:{accept:"application/json"},method:"PUT",params:{body:{in:"body",required:!0,schema:"UpdateStatusRequest",type:"any"},projectKey:{in:"path",required:!0,type:"string"},pullRequestId:{in:"path",required:!0,type:"integer"},q:{in:"query",type:"object"},repositorySlug:{in:"path",required:!0,type:"string"},userSlug:{in:"path",required:!0,type:"string"}},url:"/rest/api/1.0/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId}/participants/{userSlug}"}},pullRequests:{approve:{headers:{accept:"application/json"},method:"POST",params:{projectKey:{in:"path",required:!0,type:"string"},pullRequestId:{in:"path",required:!0,type:"integer"},q:{in:"query",type:"object"},repositorySlug:{in:"path",required:!0,type:"string"}},url:"/rest/api/1.0/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId}/approve"},canMerge:{headers:{accept:"application/json"},method:"GET",params:{projectKey:{in:"path",required:!0,type:"string"},pullRequestId:{in:"path",required:!0,type:"integer"},q:{in:"query",type:"object"},repositorySlug:{in:"path",required:!0,type:"string"}},url:"/rest/api/1.0/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId}/merge"},createComment:{headers:{accept:"application/json"},method:"POST",params:{body:{in:"body",required:!0,schema:"CreateCommentRequest",type:"any"},projectKey:{in:"path",required:!0,type:"string"},pullRequestId:{in:"path",required:!0,type:"string"},q:{in:"query",type:"object"},repositorySlug:{in:"path",required:!0,type:"string"}},url:"/rest/api/1.0/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId}/comments"},decline:{headers:{accept:"application/json"},method:"POST",params:{projectKey:{in:"path",required:!0,type:"string"},pullRequestId:{in:"path",required:!0,type:"integer"},q:{in:"query",type:"object"},repositorySlug:{in:"path",required:!0,type:"string"},version:{in:"query",type:"integer"}},url:"/rest/api/1.0/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId}/decline"},get:{headers:{accept:"application/json"},method:"GET",params:{projectKey:{in:"path",required:!0,type:"string"},pullRequestId:{in:"path",required:!0,type:"integer"},q:{in:"query",type:"object"},repositorySlug:{in:"path",required:!0,type:"string"}},url:"/rest/api/1.0/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId}"},getActivities:{headers:{accept:"application/json"},method:"GET",params:{fromId:{in:"query",type:"integer"},fromType:{in:"query",type:"string"},limit:{in:"query",type:"integer"},projectKey:{in:"path",required:!0,type:"string"},pullRequestId:{in:"path",required:!0,type:"integer"},q:{in:"query",type:"any"},repositorySlug:{in:"path",required:!0,type:"string"},start:{in:"query",type:"integer"}},returns:"PaginatedPullRequestActivities",url:"/rest/api/1.0/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId}/activities"},getComments:{headers:{accept:"application/json"},method:"GET",params:{anchorState:{in:"query",type:"string"},diffType:{in:"query",type:"string"},fromHash:{in:"query",type:"string"},path:{in:"query",type:"string"},projectKey:{in:"path",required:!0,type:"string"},pullRequestId:{in:"path",required:!0,type:"string"},q:{in:"query",type:"object"},repositorySlug:{in:"path",required:!0,type:"string"},toHash:{in:"query",type:"string"}},url:"/rest/api/1.0/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId}/comments"},getCommits:{headers:{accept:"application/json"},method:"GET",params:{projectKey:{in:"path",required:!0,type:"string"},pullRequestId:{in:"path",required:!0,type:"integer"},q:{in:"query",type:"object"},repositorySlug:{in:"path",required:!0,type:"string"},withCounts:{in:"query",type:"boolean"}},url:"/rest/api/1.0/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId}/commits"},getPullRequestSettings:{headers:{accept:"application/json"},method:"GET",params:{projectKey:{in:"path",required:!0,type:"string"},q:{in:"query",type:"object"},scmId:{in:"path",required:!0,type:"string"}},url:"/rest/api/1.0/projects/{projectKey}/settings/pull-requests/{scmId}"},getTaskCount:{headers:{accept:"application/json"},method:"GET",params:{projectKey:{in:"path",required:!0,type:"string"},pullRequestId:{in:"path",required:!0,type:"string"},q:{in:"query",type:"object"},repositorySlug:{in:"path",required:!0,type:"string"}},url:"/rest/api/1.0/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId}/tasks/count"},listParticipants:{headers:{accept:"application/json"},method:"GET",params:{limit:{in:"query",type:"integer"},projectKey:{in:"path",required:!0,type:"string"},pullRequestId:{in:"path",required:!0,type:"integer"},q:{in:"query",type:"any"},repositorySlug:{in:"path",required:!0,type:"string"},start:{in:"query",type:"integer"}},url:"/rest/api/1.0/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId}/participants"},merge:{headers:{accept:"application/json"},method:"POST",params:{projectKey:{in:"path",required:!0,type:"string"},pullRequestId:{in:"path",required:!0,type:"integer"},q:{in:"query",type:"object"},repositorySlug:{in:"path",required:!0,type:"string"},version:{in:"query",type:"integer"}},url:"/rest/api/1.0/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId}/merge"},reopen:{headers:{accept:"application/json"},method:"POST",params:{projectKey:{in:"path",required:!0,type:"string"},pullRequestId:{in:"path",required:!0,type:"integer"},q:{in:"query",type:"object"},repositorySlug:{in:"path",required:!0,type:"string"},version:{in:"query",type:"integer"}},url:"/rest/api/1.0/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId}/reopen"},streamChanges:{headers:{accept:"application/json"},method:"GET",params:{changeScope:{in:"query",type:"string"},projectKey:{in:"path",required:!0,type:"string"},pullRequestId:{in:"path",required:!0,type:"string"},q:{in:"query",type:"object"},repositorySlug:{in:"path",required:!0,type:"string"},sinceId:{in:"query",type:"string"},untilId:{in:"query",type:"string"},withComments:{in:"query",type:"boolean"}},url:"/rest/api/1.0/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId}/changes"},update:{headers:{accept:"application/json"},method:"PUT",params:{body:{in:"body",required:!0,schema:"UpdateRequest",type:"any"},projectKey:{in:"path",required:!0,type:"string"},pullRequestId:{in:"path",required:!0,type:"integer"},q:{in:"query",type:"object"},repositorySlug:{in:"path",required:!0,type:"string"}},url:"/rest/api/1.0/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId}"}},repos:{createPullRequest:{headers:{accept:"application/json"},method:"POST",params:{body:{in:"body",required:!0,schema:"CreateRequest",type:"any"},projectKey:{in:"path",required:!0,type:"string"},q:{in:"query",type:"object"},repositorySlug:{in:"path",required:!0,type:"string"}},url:"/rest/api/1.0/projects/{projectKey}/repos/{repositorySlug}/pull-requests"},getBranches:{headers:{accept:"application/json"},method:"GET",params:{base:{in:"query",type:"string"},details:{in:"query",type:"boolean"},filterText:{in:"query",type:"string"},orderBy:{in:"query",type:"string"},projectKey:{in:"path",required:!0,type:"string"},q:{in:"query",type:"object"},repositorySlug:{in:"path",required:!0,type:"string"}},url:"/rest/api/1.0/projects/{projectKey}/repos/{repositorySlug}/branches"},getBranchModel:{headers:{accept:"application/json"},method:"GET",params:{projectKey:{in:"path",required:!0,type:"string"},q:{in:"query",type:"object"},repositorySlug:{in:"path",required:!0,type:"string"}},url:"/rest/branch-utils/1.0/projects/{projectKey}/repos/{repositorySlug}/branchmodel"},getCommits:{headers:{accept:"application/json"},method:"GET",params:{followRenames:{in:"query",type:"boolean"},ignoreMissing:{in:"query",type:"boolean"},merges:{in:"query",type:"string"},path:{in:"query",type:"string"},projectKey:{in:"path",required:!0,type:"string"},q:{in:"query",type:"object"},repositorySlug:{in:"path",required:!0,type:"string"},since:{in:"query",type:"string"},until:{in:"query",type:"string"},withCounts:{in:"query",type:"boolean"}},url:"/rest/api/1.0/projects/{projectKey}/repos/{repositorySlug}/commits"},getDefaultBranch:{headers:{accept:"application/json"},method:"GET",params:{projectKey:{in:"path",required:!0,type:"string"},q:{in:"query",type:"object"},repositorySlug:{in:"path",required:!0,type:"string"}},url:"/rest/api/1.0/projects/{projectKey}/repos/{repositorySlug}/branches/default"},getDefaultReviewers:{headers:{accept:"application/json"},method:"GET",params:{limit:{in:"query",type:"integer"},projectKey:{in:"path",required:!0,type:"string"},q:{in:"query",type:"any"},repositorySlug:{in:"path",required:!0,type:"string"},sourceRefId:{in:"query",required:!0,type:"string"},sourceRepoId:{in:"query",required:!0,type:"number"},start:{in:"query",type:"integer"},targetRefId:{in:"query",required:!0,type:"string"},targetRepoId:{in:"query",required:!0,type:"number"}},returns:"PaginatedUsers",url:"/rest/default-reviewers/1.0/projects/{projectKey}/repos/{repositorySlug}/reviewers"},getPullRequests:{headers:{accept:"application/json"},method:"GET",params:{at:{in:"query",type:"string"},direction:{in:"query",type:"string"},limit:{in:"query",type:"integer"},order:{in:"query",type:"string"},projectKey:{in:"path",required:!0,type:"string"},q:{in:"query",type:"any"},repositorySlug:{in:"path",required:!0,type:"string"},start:{in:"query",type:"integer"},state:{in:"query",type:"string"},withAttributes:{in:"query",type:"boolean"},withProperties:{in:"query",type:"boolean"}},returns:"PaginatedPullRequests",url:"/rest/api/1.0/projects/{projectKey}/repos/{repositorySlug}/pull-requests"},getRepository:{headers:{accept:"application/json"},method:"GET",params:{projectKey:{in:"path",required:!0,type:"string"},q:{in:"query",type:"object"},repositorySlug:{in:"path",required:!0,type:"string"}},url:"/rest/api/1.0/projects/{projectKey}/repos/{repositorySlug}"},search:{headers:{accept:"application/json"},method:"GET",params:{direction:{in:"query",type:"string"},filter:{in:"query",type:"string"},projectKey:{in:"path",required:!0,type:"string"},q:{in:"query",type:"object"},repositorySlug:{in:"path",required:!0,type:"string"},role:{in:"query",type:"string"}},url:"/rest/api/1.0/projects/{projectKey}/repos/{repositorySlug}/participants"}}}},function(e,t,r){const n=r(1),s=r(30);e.exports=(e,t,r,i={},o)=>{let p=n(t,i),a=Promise.resolve(p).then(e=>s(r,e)).then(e.request);if(!o)return a;a.then(e=>{o(null,e)}).catch(o)}},function(e,t,r){const n=r(0);e.exports=(e={},t)=>(Object.keys(e).forEach(r=>{let s=e[r],i=s.type,o=t[r],p=void 0!==o;if(s.required||p){if(s.required&&!p)throw new n(`Parameter required: '${r}'`,400);if("integer"===i){let e=o;if(o=parseInt(o,10),Number.isNaN(o))throw new n(`Invalid Type of Parameter '${r}': ${JSON.stringify(e)}, Expected Type: ${i}`,400)}if("boolean"===i&&!("string"==typeof o?["false","true"].includes(o):"boolean"==typeof o))throw new n(`Invalid Type of Parameter '${r}': ${JSON.stringify(o)}, Expected Type: ${i}`,400);if(s.enum&&!s.enum.includes(o))throw new n(`Invalid Value for Parameter '${r}': ${JSON.stringify(o)}, Expected one of [${s.enum.join(",")}]`,400)}}),t)},function(e,t){e.exports=(e={})=>{let t={body:[],path:[],query:[],header:[]};return Object.keys(e).forEach(r=>{let n=e[r].in||"body";t[n].push(r)}),t}},function(e,t,r){const n=r(33);e.exports=class{constructor(e){this.core=e}inject(){this.core.hasNextPage=({next:e})=>Boolean(e),this.core.getNextPage=(e,t)=>n(this.core,e,"next",t),this.core.hasPreviousPage=({previous:e})=>Boolean(e),this.core.getPreviousPage=(e,t)=>n(this.core,e,"previous",t)}}},function(e,t,r){const n=r(0);e.exports=(e,t,r,s)=>{let i=t[r];if(!i){let e=new n(`No ${r} URL found`,404);return s?s(e):Promise.reject(e)}let o={url:i},p=e.request(o);if(!s)return p;p.then(e=>{s(null,e)}).catch(s)}}]);