diff --git a/readthedocsext/theme/static/readthedocsext/theme/js/site.js b/readthedocsext/theme/static/readthedocsext/theme/js/site.js index e85f4a32..579cfed8 100644 --- a/readthedocsext/theme/static/readthedocsext/theme/js/site.js +++ b/readthedocsext/theme/static/readthedocsext/theme/js/site.js @@ -1 +1 @@ -(()=>{"use strict";var e,t,r,n,o,i={286:()=>{},8488:e=>{if("undefined"==typeof moment){var t=new Error("Cannot find module 'moment'");throw t.code="MODULE_NOT_FOUND",t}e.exports=moment},9085:(e,t,r)=>{var n=r(9755),o=r(8527),i=r(2152);function a(e){return a="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},a(e)}function u(e,t){for(var r=0;r0&&void 0!==arguments[0]?arguments[0]:"body";console.debug("Attaching application to selector:",e),o.applyBindings(this,n(e)[0])}},{key:"show_modal",value:function(e){return function(t,r){var o="[data-modal-id="+e+"]";console.debug("Showing modal:",o),0===n(o).modal("show").length&&console.debug("Modal not found:",o)}}},{key:"post_child_form",value:function(e,t){var r=t.currentTarget.querySelector(":scope > form");return r&&r.submit(),!1}}],r&&u(t.prototype,r),i&&u(t,i),Object.defineProperty(t,"prototype",{writable:!1}),e}();globalThis.jQuery=n;r(4238),r(7239),r(8105),r(7030),r(83),r(4567),r(1714),r(5082),r(8225),r(4696),r(5812),r(2208),r(3441),r(4671),r(9610),r(4115),r(2445),r(6426),r(3150),r(8329),r(1307),r(8182);var l=r(9755);function f(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,i,a,u=[],s=!0,c=!1;try{if(i=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;s=!1}else for(;!(s=(n=i.call(r)).done)&&(u.push(n.value),u.length!==t);s=!0);}catch(e){c=!0,o=e}finally{try{if(!s&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(c)throw o}}return u}}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return b(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return b(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function b(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r1?o-1:0),a=1;ae.length)&&(t=e.length);for(var r=0,n=new Array(t);re.length)&&(t=e.length);for(var r=0,n=new Array(t);r0&&r.is_expanded(!0)})),this.output=o.observable(),this.output_lines=o.computed((function(){return r.output().split(/\n/).map((function(e,t){return new M({command:r,output:e,line_number:t+1})}))}),null,{deferEvaluation:!0}),this.output(t.output)}return $(e,[{key:"color_output",value:function(e){return Promise.all([r.e("ansi_up").then(r.t.bind(r,4431,19)).then((function(e){return e.default})),r.e("sanitize-html").then(r.t.bind(r,1036,19)).then((function(e){return e.default}))]).then((function(t){var r,n,o=B(t,2);r=o[0],n=o[1];var i=new r;return i.use_classes=!0,e=n(e=i.ansi_to_html(e),{allowedTags:["span"],allowedAttributes:{span:["class"]}})}))}},{key:"toggle_expanded",value:function(){return this.is_expanded(!this.is_expanded()),!1}}]),e}(),K=function(){function e(){var t=this,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};z(this,e),this.id=r.id,this.api_url="/api/v2/build/",this.success=o.observable(r.success),this.error=o.observable(r.error),this.state=o.observable(r.state),this.state_display=o.observable(r.state_display),this.is_finished=o.observable(!1),this.is_loading=o.observable(!0),this.can_cancel=o.observable(!1),this.can_retry=o.observable(!1),this.can_view_docs=o.observable(!1),this.poll_api_counts=0,this.state.subscribe((function(e){t.update_state(e)})),this.progress_config=o.computed((function(){var e=t.state(),r=["triggered","queued","cloning","installing","building","uploading","finished"];if(o.computedContext.isInitial())return{autoSuccess:!1,value:r.indexOf(e),total:r.length-1,label:t.state_display()};if(t.is_finished()){var n="cancelled"===e,i=t.error()||!1===t.success();return n?function(e){e("set warning","Build cancelled")}:i?function(e){e("set error","Build failed")}:function(e){e("set success","Build succeeded")}}return function(n){n("set progress",r.indexOf(e)),n("set label",t.state_display())}})).extend({deferred:!0}),this.date=o.observable(r.date),this.length=o.observable(r.length),this.date_display=o.observable(),this.date_display_since=o.observable(),this.length_display=o.observable(),R.extend(I),R.extend(V),R.extend(D),this.date.subscribe((function(e){var r=R(e);t.date_display(r.format("llll")),t.date_display_since(r.fromNow())})),this.length.subscribe((function(e){t.length_display(R.duration(e,"seconds").humanize())})),this.config=o.observable(),this.builder=o.observable(r.builder),this.commands=o.observableArray(r.commands),this.commit=o.observable(r.commit),this.commit_short=o.computed((function(){var e=t.commit();if(e)return e.substring(0,8)})),this.docs_url=o.observable(r.docs_url),this.commit_url=o.observable(r.commit_url),this.legacy_output=o.observable(!1),this.selected_hash=o.observable(n(location).attr("hash")),this.selected_hash.subscribe((function(e){n(location).attr("hash",e)})),this.selected_line=o.observable(),this.selected_line.subscribe((function(e){e&&e.is_selected(!1)}),this,"beforeChange"),this.selected_line.subscribe((function(e){e.command.is_expanded(!0),e.is_selected(!0),t.selected_hash(e.anchor_id())})),this.show_debug=o.observable(!1),this.is_polling=o.observable(!0),this.is_polling.subscribe((function(e){e||t.set_selected_line_from_hash(t.selected_hash())})),this.poll_api()}return $(e,[{key:"poll_api",value:function(){var e=this;n.getJSON(this.api_url+this.id+"/").then((function(t){e.date(t.date),e.success(t.success),e.error(t.error),e.length(t.length),e.commit(t.commit),e.docs_url(t.docs_url),e.commit_url(t.commit_url),e.builder(t.builder),e.config(t.config),e.state(t.state),e.state_display(t.state_display),e.poll_api_counts=e.poll_api_counts+1,e.add_command({id:0,command:"readthedocs-build --show-config",output:JSON.stringify(t.config,null," "),exit_code:0,run_time:0,is_debug:!0});var r,n=function(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=q(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,o=function(){};return{s:o,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,u=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return a=e.done,e},e:function(e){u=!0,i=e},f:function(){try{a||null==r.return||r.return()}finally{if(u)throw i}}}}(t.commands);try{for(n.s();!(r=n.n()).done;){var o=r.value;e.add_command(o)}}catch(e){n.e(e)}finally{n.f()}e.is_loading(!1)})),this.is_finished()?(this.is_polling(!1),1!==this.poll_api_counts&&location.reload()):setTimeout((function(){e.poll_api()}),2e3)}},{key:"add_command",value:function(e){o.utils.arrayFirst(this.commands(),(function(t){return t.id()===e.id}))||this.commands.push(new F(e))}},{key:"set_selected_line",value:function(e){this.selected_line(e);var t=document.querySelector("[data-selected=true]");return t&&(t.scrollIntoView?t.scrollIntoView({behavior:"auto",block:"center",inline:"center"}):n(t).focus()),!1}},{key:"set_selected_line_from_hash",value:function(e){if(e){var t=e.match(/^#(\d+)--(\d+)$/);if(!t)return;var r=o.utils.arrayFirst(this.commands(),(function(e){return e.id()==t[1]}));if(r){var n=o.utils.arrayFirst(r.output_lines(),(function(e){return e.line_number()==t[2]}));n&&this.set_selected_line(n)}}}},{key:"show_legacy_output",value:function(){this.legacy_output(!0)}},{key:"toggle_debug",value:function(){var e=this.show_debug();this.show_debug(!e)}},{key:"update_state",value:function(e){["finished","cancelled"].includes(e)?(this.is_finished(!0),this.can_cancel(!1),this.can_retry(!0),this.success()&&this.can_view_docs(!0)):this.can_cancel(!0)}}]),e}();function W(e){return W="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},W(e)}function Q(e,t){for(var r=0;r=Z[o];t.device[o](i)}}));var r=n(window),i=function(){t.viewport_width(r.width())};r.on("resize",i),i()})),te=function(){function e(t){Y(this,e),this.id=t.id,this.url=t.url,this.loaded=o.observable(!1),this.loading=o.observable(!1),this.promise=null,this.data=o.observable()}return X(e,[{key:"fetch",value:function(){var e=this;if(this.promise)return this.promise;this.promise=new Promise((function(t,r){if(e.loaded())return t(e.data());e.loading(!0),n.getJSON(e.url).then((function(r){return e.data(r),e.loaded(!0),e.loading(!1),t(r)}))}))}}]),e}(),re=X((function e(){var t=this;Y(this,e),this.config=o.observable(),this.search_project_config=o.observable(),this.config.subscribe((function(e){if(void 0!==e){var r=new URL(e.api_projects_list_url,window.location.origin);r.search="?name={query}",t.search_project_config({type:"category",apiSettings:{url:r.href,onResponse:function(e){return{results:{"category-projects":{name:"Projects",results:e.results.map((function(e,t){var r=e.slug;e.subproject_of?r="Subproject of "+e.subproject_of.name:e.translation_of&&(r=e.language.name+" translation of "+e.translation_of.name);var n=new URL(e.urls.home),o=new URL(window.location.href);return n.hostname!=o.hostname&&(n.hostname=o.hostname),{title:e.name,description:r,url:n.toString()}}))}}}}},minCharacters:2})}}))}));function ne(e){return ne="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},ne(e)}function oe(e,t){for(var r=0;r=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,u=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return a=e.done,e},e:function(e){u=!0,i=e},f:function(){try{a||null==r.return||r.return()}finally{if(u)throw i}}}}function le(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r0&&void 0!==arguments[0]&&arguments[0];!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.is_collapsed=o.observable(r),this.dropdown_class=o.computed((function(){return t.is_collapsed()?"fa-ellipsis":"fa-caret-down"}))}var t,r,n;return t=e,r=[{key:"toggle_collapsed",value:function(){var e=this.is_collapsed();this.is_collapsed(!e)}}],r&&Te(t.prototype,r),n&&Te(t,n),Object.defineProperty(t,"prototype",{writable:!1}),e}();function Ce(e){return Ce="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},Ce(e)}function Ae(e,t){for(var r=0;r0)setTimeout(o,2e3);else{var n=e.statusText;e.responseJSON&&(n=e.responseJSON.detail),t.reject({message:n})}}))}),2e3),t})(e).then((function(){t.resolve()})).fail((function(e){t.reject(e)}))},error:function(e){var r=e.responseJSON.detail||e.statusText;t.reject({message:r})}}),t}function tt(e){return tt="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},tt(e)}function rt(e,t){return rt=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},rt(e,t)}function nt(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=ot(e);if(t){var o=ot(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return function(e,t){if(t&&("object"===tt(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(this,r)}}function ot(e){return ot=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},ot(e)}function it(e,t){for(var r=0;r0}))})),lt=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&rt(e,t)}(r,e);var t=nt(r);function r(){var e;return st(this,r),(e=t.call(this)).config=o.observable(),e.search_config=o.observable(),e.selected=o.observable(),e.is_loading=o.observable(!1),e.is_syncing=o.observable(!1),e.is_selected=o.computed((function(){return void 0!==e.selected()})),e.allow_private_repos=o.observable(!1),e.error=o.observable(),e.config.subscribe((function(t){void 0!==t&&(e.allow_private_repos(t.allow_private_repos),e.init_search())})),e}return at(r,[{key:"sync_remote_repos",value:function(){var e=this,t=this.config(),r={url:t.urls.api_sync_remote_repositories,token:t.csrf_token};return this.is_syncing(!0),this.is_loading(!0),et(r).fail((function(t){console.error("Error syncing remote repositories:",t.message),e.error(t.message)})).always((function(){e.is_syncing(!1),e.is_loading(!1)}))}},{key:"init_search",value:function(){var e=this,t=this.config().urls.remoterepository_list+"?expand=projects&full_name={query}";this.search_config({type:"knockout",templates:{knockout:function(e){var t=n("
");o.applyBindingsToNode(t[0],{template:{name:"remote-repo-results",data:{remote_repos:e.results.map((function(e){return new ct(e)}))}}});var r=t.html();return t.remove(),r}},apiSettings:{url:t},selector:{prompt:".ui.text",title:".title .text"},fullTextSearch:!0,onSelect:function(t,r){e.selected(new ct(t))}})}},{key:"is_repository_supported",value:function(e){return!e.is_private()||this.allow_private_repos()}}]),r}(ee);function ft(e){return ft="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},ft(e)}function bt(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&dt(e,t)}function dt(e,t){return dt=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},dt(e,t)}function pt(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=vt(e);if(t){var o=vt(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return function(e,t){if(t&&("object"===ft(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(this,r)}}function vt(e){return vt=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},vt(e)}function ht(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function yt(e,t){for(var r=0;r select").dropdown({placeholder:""}),n("[data-content]:not([data-semanticui-popup])").popup({position:"top center",delay:{show:500},variation:"small"}),n(".ui.menu > .item[data-tab]").tab(),new i("[data-clipboard-text], [data-clipboard-target]"),n("[data-clipboard-text], [data-clipboard-target]").popup({on:"click",hoverable:!1,content:"Copied!"})}}])&&Tt(t.prototype,a),u&&Tt(t,u),Object.defineProperty(t,"prototype",{writable:!1}),e}();n(document).ready((function(){(new Et).run()}))}},a={};function u(e){var t=a[e];if(void 0!==t)return t.exports;var r=a[e]={exports:{}};return i[e].call(r.exports,r,r.exports,u),r.exports}u.m=i,e=[],u.O=(t,r,n,o)=>{if(!r){var i=1/0;for(l=0;l=o)&&Object.keys(u.O).every((e=>u.O[e](r[s])))?r.splice(s--,1):(a=!1,o0&&e[l-1][2]>o;l--)e[l]=e[l-1];e[l]=[r,n,o]},r=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,u.t=function(e,n){if(1&n&&(e=this(e)),8&n)return e;if("object"==typeof e&&e){if(4&n&&e.__esModule)return e;if(16&n&&"function"==typeof e.then)return e}var o=Object.create(null);u.r(o);var i={};t=t||[null,r({}),r([]),r(r)];for(var a=2&n&&e;"object"==typeof a&&!~t.indexOf(a);a=r(a))Object.getOwnPropertyNames(a).forEach((t=>i[t]=()=>e[t]));return i.default=()=>e,u.d(o,i),o},u.d=(e,t)=>{for(var r in t)u.o(t,r)&&!u.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},u.f={},u.e=e=>Promise.all(Object.keys(u.f).reduce(((t,r)=>(u.f[r](e,t),t)),[])),u.u=e=>"js/vendors~"+e+".js?"+{chartjs:"88d308352093cb9caa38",ansi_up:"d27561856946166026c2","sanitize-html":"fe70b4790c12dedf5bc9"}[e],u.miniCssF=e=>{},u.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n={},o="readthedocsext-theme:",u.l=(e,t,r,i)=>{if(n[e])n[e].push(t);else{var a,s;if(void 0!==r)for(var c=document.getElementsByTagName("script"),l=0;l{a.onerror=a.onload=null,clearTimeout(d);var o=n[e];if(delete n[e],a.parentNode&&a.parentNode.removeChild(a),o&&o.forEach((e=>e(r))),t)return t(r)},d=setTimeout(b.bind(null,void 0,{type:"timeout",target:a}),12e4);a.onerror=b.bind(null,a.onerror),a.onload=b.bind(null,a.onload),s&&document.head.appendChild(a)}},u.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},u.p="./",(()=>{var e={site:0};u.f.j=(t,r)=>{var n=u.o(e,t)?e[t]:void 0;if(0!==n)if(n)r.push(n[2]);else{var o=new Promise(((r,o)=>n=e[t]=[r,o]));r.push(n[2]=o);var i=u.p+u.u(t),a=new Error;u.l(i,(r=>{if(u.o(e,t)&&(0!==(n=e[t])&&(e[t]=void 0),n)){var o=r&&("load"===r.type?"missing":r.type),i=r&&r.target&&r.target.src;a.message="Loading chunk "+t+" failed.\n("+o+": "+i+")",a.name="ChunkLoadError",a.type=o,a.request=i,n[1](a)}}),"chunk-"+t,t)}},u.O.j=t=>0===e[t];var t=(t,r)=>{var n,o,[i,a,s]=r,c=0;if(i.some((t=>0!==e[t]))){for(n in a)u.o(a,n)&&(u.m[n]=a[n]);if(s)var l=s(u)}for(t&&t(r);cu(286)));var s=u.O(void 0,["vendor"],(()=>u(9085)));s=u.O(s)})(); \ No newline at end of file +(()=>{"use strict";var e,t,r,n,o,i={286:()=>{},8488:e=>{if("undefined"==typeof moment){var t=new Error("Cannot find module 'moment'");throw t.code="MODULE_NOT_FOUND",t}e.exports=moment},9085:(e,t,r)=>{var n=r(9755),o=r(8527),i=r(2152);function a(e){return a="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},a(e)}function u(e,t){for(var r=0;r0&&void 0!==arguments[0]?arguments[0]:"body";console.debug("Attaching application to selector:",e),o.applyBindings(this,n(e)[0])}},{key:"show_modal",value:function(e){return function(t,r){var o="[data-modal-id="+e+"]";console.debug("Showing modal:",o),0===n(o).modal("show").length&&console.debug("Modal not found:",o)}}},{key:"post_child_form",value:function(e,t){var r=t.currentTarget.querySelector(":scope > form");return r&&r.submit(),!1}}],r&&u(t.prototype,r),i&&u(t,i),Object.defineProperty(t,"prototype",{writable:!1}),e}();globalThis.jQuery=n;r(4238),r(7239),r(8105),r(7030),r(83),r(4567),r(1714),r(5082),r(8225),r(4696),r(5812),r(2208),r(3441),r(4671),r(9610),r(4115),r(2445),r(6426),r(3150),r(8329),r(1307),r(8182);var l=r(9755);function f(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,i,a,u=[],s=!0,c=!1;try{if(i=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;s=!1}else for(;!(s=(n=i.call(r)).done)&&(u.push(n.value),u.length!==t);s=!0);}catch(e){c=!0,o=e}finally{try{if(!s&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(c)throw o}}return u}}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return b(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return b(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function b(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r1?o-1:0),a=1;ae.length)&&(t=e.length);for(var r=0,n=new Array(t);re.length)&&(t=e.length);for(var r=0,n=new Array(t);r0&&r.is_expanded(!0)})),this.output=o.observable(),this.output_lines=o.computed((function(){return r.output().split(/\n/).map((function(e,t){return new M({command:r,output:e,line_number:t+1})}))}),null,{deferEvaluation:!0}),this.output(t.output)}return z(e,[{key:"color_output",value:function(e){return Promise.all([r.e("ansi_up").then(r.t.bind(r,4431,19)).then((function(e){return e.default})),r.e("sanitize-html").then(r.t.bind(r,1036,19)).then((function(e){return e.default}))]).then((function(t){var r,n,o=B(t,2);r=o[0],n=o[1];var i=new r;return i.use_classes=!0,e=n(e=i.ansi_to_html(e),{allowedTags:["span"],allowedAttributes:{span:["class"]}})}))}},{key:"toggle_expanded",value:function(){return this.is_expanded(!this.is_expanded()),!1}}]),e}(),K=function(){function e(){var t=this,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};J(this,e),this.id=r.id,this.api_url="/api/v2/build/",this.success=o.observable(r.success),this.error=o.observable(r.error),this.state=o.observable(r.state),this.state_display=o.observable(r.state_display),this.is_finished=o.observable(!1),this.is_loading=o.observable(!0),this.can_cancel=o.observable(!1),this.can_retry=o.observable(!1),this.can_view_docs=o.observable(!1),this.poll_api_counts=0,this.state.subscribe((function(e){t.update_state(e)})),this.progress_config=o.computed((function(){var e=t.state(),r=["triggered","queued","cloning","installing","building","uploading","finished"];if(o.computedContext.isInitial())return{autoSuccess:!1,value:r.indexOf(e),total:r.length-1,label:t.state_display()};if(t.is_finished()){var n="cancelled"===e,i=t.error()||!1===t.success();return n?function(e){e("set warning","Build cancelled")}:i?function(e){e("set error","Build failed")}:function(e){e("set success","Build succeeded")}}return function(n){n("set progress",r.indexOf(e)),n("set label",t.state_display())}})).extend({deferred:!0}),this.date=o.observable(r.date),this.length=o.observable(r.length),this.date_display=o.observable(),this.date_display_since=o.observable(),this.length_display=o.observable(),R.extend(I),R.extend(V),R.extend(D),this.date.subscribe((function(e){var r=R(e);t.date_display(r.format("llll")),t.date_display_since(r.fromNow())})),this.length.subscribe((function(e){t.length_display(R.duration(e,"seconds").humanize())})),this.config=o.observable(),this.builder=o.observable(r.builder),this.commands=o.observableArray(r.commands),this.commit=o.observable(r.commit),this.commit_short=o.computed((function(){var e=t.commit();if(e)return e.substring(0,8)})),this.docs_url=o.observable(r.docs_url),this.commit_url=o.observable(r.commit_url),this.legacy_output=o.observable(!1),this.selected_hash=o.observable(n(location).attr("hash")),this.selected_hash.subscribe((function(e){n(location).attr("hash",e)})),this.selected_line=o.observable(),this.selected_line.subscribe((function(e){e&&e.is_selected(!1)}),this,"beforeChange"),this.selected_line.subscribe((function(e){e.command.is_expanded(!0),e.is_selected(!0),t.selected_hash(e.anchor_id())})),this.show_debug=o.observable(!1),this.is_polling=o.observable(!0),this.is_polling.subscribe((function(e){e||t.set_selected_line_from_hash(t.selected_hash())})),this.poll_api()}return z(e,[{key:"poll_api",value:function(){var e=this;n.getJSON(this.api_url+this.id+"/").then((function(t){e.date(t.date),e.success(t.success),e.error(t.error),e.length(t.length),e.commit(t.commit),e.docs_url(t.docs_url),e.commit_url(t.commit_url),e.builder(t.builder),e.config(t.config),e.state(t.state),e.state_display(t.state_display),e.poll_api_counts=e.poll_api_counts+1,e.add_command({id:0,command:"readthedocs-build --show-config",output:JSON.stringify(t.config,null," "),exit_code:0,run_time:0,is_debug:!0});var r,n=function(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=q(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,o=function(){};return{s:o,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,u=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return a=e.done,e},e:function(e){u=!0,i=e},f:function(){try{a||null==r.return||r.return()}finally{if(u)throw i}}}}(t.commands);try{for(n.s();!(r=n.n()).done;){var o=r.value;e.add_command(o)}}catch(e){n.e(e)}finally{n.f()}e.is_loading(!1)})),this.is_finished()?(this.is_polling(!1),1!==this.poll_api_counts&&location.reload()):setTimeout((function(){e.poll_api()}),2e3)}},{key:"add_command",value:function(e){o.utils.arrayFirst(this.commands(),(function(t){return t.id()===e.id}))||this.commands.push(new F(e))}},{key:"set_selected_line",value:function(e){this.selected_line(e);var t=document.querySelector("[data-selected=true]");return t&&(t.scrollIntoView?t.scrollIntoView({behavior:"auto",block:"center",inline:"center"}):n(t).focus()),!1}},{key:"set_selected_line_from_hash",value:function(e){if(e){var t=e.match(/^#(\d+)--(\d+)$/);if(!t)return;var r=o.utils.arrayFirst(this.commands(),(function(e){return e.id()==t[1]}));if(r){var n=o.utils.arrayFirst(r.output_lines(),(function(e){return e.line_number()==t[2]}));n&&this.set_selected_line(n)}}}},{key:"show_legacy_output",value:function(){this.legacy_output(!0)}},{key:"toggle_debug",value:function(){var e=this.show_debug();this.show_debug(!e)}},{key:"update_state",value:function(e){["finished","cancelled"].includes(e)?(this.is_finished(!0),this.can_cancel(!1),this.can_retry(!0),this.success()&&this.can_view_docs(!0)):this.can_cancel(!0)}}]),e}();function W(e){return W="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},W(e)}function Q(e,t){for(var r=0;r=Z[o];t.device[o](i)}}));var r=n(window),i=function(){t.viewport_width(r.width())};r.on("resize",i),i()})),te=function(){function e(t){Y(this,e),this.id=t.id,this.url=t.url,this.loaded=o.observable(!1),this.loading=o.observable(!1),this.promise=null,this.data=o.observable()}return X(e,[{key:"fetch",value:function(){var e=this;if(this.promise)return this.promise;this.promise=new Promise((function(t,r){if(e.loaded())return t(e.data());e.loading(!0),n.getJSON(e.url).then((function(r){return e.data(r),e.loaded(!0),e.loading(!1),t(r)}))}))}}]),e}(),re=X((function e(){var t=this;Y(this,e),this.config=o.observable(),this.search_project_config=o.observable(),this.config.subscribe((function(e){if(void 0!==e){var r=new URL(e.api_projects_list_url,window.location.origin);r.search="?name={query}",t.search_project_config({type:"category",apiSettings:{url:r.href,onResponse:function(e){return{results:{"category-projects":{name:"Projects",results:e.results.map((function(e,t){var r=e.slug;e.subproject_of?r="Subproject of "+e.subproject_of.name:e.translation_of&&(r=e.language.name+" translation of "+e.translation_of.name);var n=new URL(e.urls.home),o=new URL(window.location.href);return n.hostname!=o.hostname&&(n.hostname=o.hostname),{title:e.name,description:r,url:n.toString()}}))}}}}},minCharacters:2})}}))}));function ne(e){return ne="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},ne(e)}function oe(e,t){for(var r=0;r=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,u=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return a=e.done,e},e:function(e){u=!0,i=e},f:function(){try{a||null==r.return||r.return()}finally{if(u)throw i}}}}function le(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r0&&void 0!==arguments[0]&&arguments[0];!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.is_collapsed=o.observable(r),this.dropdown_class=o.computed((function(){return t.is_collapsed()?"fa-ellipsis":"fa-caret-down"}))}var t,r,n;return t=e,r=[{key:"toggle_collapsed",value:function(){var e=this.is_collapsed();this.is_collapsed(!e)}}],r&&Te(t.prototype,r),n&&Te(t,n),Object.defineProperty(t,"prototype",{writable:!1}),e}();function Ce(e){return Ce="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},Ce(e)}function Ae(e,t){for(var r=0;r0)setTimeout(o,2e3);else{var n=e.statusText;e.responseJSON&&(n=e.responseJSON.detail),t.reject({message:n})}}))}),2e3),t})(e).then((function(){t.resolve()})).fail((function(e){t.reject(e)}))},error:function(e){var r=e.responseJSON.detail||e.statusText;t.reject({message:r})}}),t}function ot(e){return ot="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},ot(e)}function it(e,t){return it=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},it(e,t)}function at(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=ut(e);if(t){var o=ut(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return function(e,t){if(t&&("object"===ot(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(this,r)}}function ut(e){return ut=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},ut(e)}function st(e,t){for(var r=0;r0}))})),dt=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&it(e,t)}(r,e);var t=at(r);function r(){var e;return ft(this,r),(e=t.call(this)).config=o.observable(),e.search_config=o.observable(),e.selected=o.observable(),e.is_loading=o.observable(!1),e.is_syncing=o.observable(!1),e.is_selected=o.computed((function(){return void 0!==e.selected()})),e.allow_private_repos=o.observable(!1),e.error=o.observable(),e.config.subscribe((function(t){void 0!==t&&(e.allow_private_repos(t.allow_private_repos),e.init_search())})),e}return ct(r,[{key:"sync_remote_repos",value:function(){var e=this,t=this.config(),r={url:t.urls.api_sync_remote_repositories,token:t.csrf_token};return this.is_syncing(!0),this.is_loading(!0),nt(r).fail((function(t){console.error("Error syncing remote repositories:",t.message),e.error(t.message)})).always((function(){e.is_syncing(!1),e.is_loading(!1)}))}},{key:"init_search",value:function(){var e=this,t=this.config().urls.remoterepository_list+"?expand=projects&full_name={query}";this.search_config({type:"knockout",templates:{knockout:function(e){var t=n("
");o.applyBindingsToNode(t[0],{template:{name:"remote-repo-results",data:{remote_repos:e.results.map((function(e){return new bt(e)}))}}});var r=t.html();return t.remove(),r}},apiSettings:{url:t},selector:{prompt:".ui.text",title:".title .text"},fullTextSearch:!0,onSelect:function(t,r){e.selected(new bt(t))}})}},{key:"is_repository_supported",value:function(e){return!e.is_private()||this.allow_private_repos()}}]),r}(ee);function pt(e){return pt="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},pt(e)}function vt(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&ht(e,t)}function ht(e,t){return ht=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},ht(e,t)}function yt(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=mt(e);if(t){var o=mt(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return function(e,t){if(t&&("object"===pt(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(this,r)}}function mt(e){return mt=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},mt(e)}function _t(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function gt(e,t){for(var r=0;r select").dropdown({placeholder:""}),n("[data-content]:not([data-semanticui-popup])").popup({position:"top center",delay:{show:500},variation:"small"}),n(".ui.menu > .item[data-tab]").tab(),new i("[data-clipboard-text], [data-clipboard-target]"),n("[data-clipboard-text], [data-clipboard-target]").popup({on:"click",hoverable:!1,content:"Copied!"})}}])&&Ct(t.prototype,a),u&&Ct(t,u),Object.defineProperty(t,"prototype",{writable:!1}),e}();n(document).ready((function(){(new Nt).run()}))}},a={};function u(e){var t=a[e];if(void 0!==t)return t.exports;var r=a[e]={exports:{}};return i[e].call(r.exports,r,r.exports,u),r.exports}u.m=i,e=[],u.O=(t,r,n,o)=>{if(!r){var i=1/0;for(l=0;l=o)&&Object.keys(u.O).every((e=>u.O[e](r[s])))?r.splice(s--,1):(a=!1,o0&&e[l-1][2]>o;l--)e[l]=e[l-1];e[l]=[r,n,o]},r=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,u.t=function(e,n){if(1&n&&(e=this(e)),8&n)return e;if("object"==typeof e&&e){if(4&n&&e.__esModule)return e;if(16&n&&"function"==typeof e.then)return e}var o=Object.create(null);u.r(o);var i={};t=t||[null,r({}),r([]),r(r)];for(var a=2&n&&e;"object"==typeof a&&!~t.indexOf(a);a=r(a))Object.getOwnPropertyNames(a).forEach((t=>i[t]=()=>e[t]));return i.default=()=>e,u.d(o,i),o},u.d=(e,t)=>{for(var r in t)u.o(t,r)&&!u.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},u.f={},u.e=e=>Promise.all(Object.keys(u.f).reduce(((t,r)=>(u.f[r](e,t),t)),[])),u.u=e=>"js/vendors~"+e+".js?"+{chartjs:"88d308352093cb9caa38",ansi_up:"d27561856946166026c2","sanitize-html":"fe70b4790c12dedf5bc9"}[e],u.miniCssF=e=>{},u.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n={},o="readthedocsext-theme:",u.l=(e,t,r,i)=>{if(n[e])n[e].push(t);else{var a,s;if(void 0!==r)for(var c=document.getElementsByTagName("script"),l=0;l{a.onerror=a.onload=null,clearTimeout(d);var o=n[e];if(delete n[e],a.parentNode&&a.parentNode.removeChild(a),o&&o.forEach((e=>e(r))),t)return t(r)},d=setTimeout(b.bind(null,void 0,{type:"timeout",target:a}),12e4);a.onerror=b.bind(null,a.onerror),a.onload=b.bind(null,a.onload),s&&document.head.appendChild(a)}},u.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},u.p="./",(()=>{var e={site:0};u.f.j=(t,r)=>{var n=u.o(e,t)?e[t]:void 0;if(0!==n)if(n)r.push(n[2]);else{var o=new Promise(((r,o)=>n=e[t]=[r,o]));r.push(n[2]=o);var i=u.p+u.u(t),a=new Error;u.l(i,(r=>{if(u.o(e,t)&&(0!==(n=e[t])&&(e[t]=void 0),n)){var o=r&&("load"===r.type?"missing":r.type),i=r&&r.target&&r.target.src;a.message="Loading chunk "+t+" failed.\n("+o+": "+i+")",a.name="ChunkLoadError",a.type=o,a.request=i,n[1](a)}}),"chunk-"+t,t)}},u.O.j=t=>0===e[t];var t=(t,r)=>{var n,o,[i,a,s]=r,c=0;if(i.some((t=>0!==e[t]))){for(n in a)u.o(a,n)&&(u.m[n]=a[n]);if(s)var l=s(u)}for(t&&t(r);cu(286)));var s=u.O(void 0,["vendor"],(()=>u(9085)));s=u.O(s)})(); \ No newline at end of file diff --git a/readthedocsext/theme/templates/organizations/settings/sso_edit.html b/readthedocsext/theme/templates/organizations/settings/sso_edit.html index 0df7d5fc..975acafe 100644 --- a/readthedocsext/theme/templates/organizations/settings/sso_edit.html +++ b/readthedocsext/theme/templates/organizations/settings/sso_edit.html @@ -1,10 +1,11 @@ {% extends "organizations/settings/base.html" %} {% load i18n %} -{% load organizations %} -{% load corporate %} {% load crispy_forms_tags %} +{% load corporate %} +{% load ext_theme_tags %} +{% load organizations %} {% block title %}{{ organization.name }} - {% trans "Authorization" %}{% endblock %} @@ -41,104 +42,85 @@
{% endif %} -
- {% csrf_token %} - - {% comment %} - Django built in forms don't provide enough flexibility to make this UI nice, - so we build the entire form outside the backend forms and models instead. - - {# form | crispy #} - {% endcomment %} - - -
- - {# TODO Reused the existing title for now, but is "authorization" the most correct here? #} - -
-
- - +
+ + {% csrf_token %} + +
+
+ +
+ +
+
+ {{ form.PROVIDER_DEFAULT }} + + {% trans "Default" %} + + +
+
+ {% blocktrans trimmed %} + Use built-in organization teams to manage access to your projects and documentation. + {% endblocktrans %} +
+
+
+ +
+ +
+
{{ form.PROVIDER_ALLAUTH }}
+
+ {% blocktrans trimmed %} + Control all access to your projects by reusing permissions from your repository's version control provider. + This replaces Read the Docs managed teams. + {% endblocktrans %} +
+
+
+ +
+ +
+
+ {{ form.PROVIDER_EMAIL }} + + Pro plan + +
+
+ {% blocktrans trimmed %} + Users with a verified Google Workspace email account matching your domain will auto-join your organization. + All users in your organization are required to have a connected Google account. + Project permissions and authorization are managed using Read the Docs teams. + {% endblocktrans %} +
+
+
+
-
-
- - +
+ {% alter_field form.provider data_bind="valueInit: provider, value: provider" %} + {{ form.provider | as_crispy_field }} + + -
-
-
- - + - {% if not has_google_sso_feature %} - {# Because the field above is disabled, the label above isn't linkable. This is a redundant element for now #} - - {% trans "Upgrade your plan" %} - - {% endif %}
-
- - {# TODO expose domain field and move jQuery logic to a knockout view #} - {% comment %} - {% block extra_scripts %} - - {% endblock %} - {% endcomment %} - - - + + +
{% endblock organization_edit_content %} diff --git a/src/js/organization/index.js b/src/js/organization/index.js index e5a1b080..9c8a3b7b 100644 --- a/src/js/organization/index.js +++ b/src/js/organization/index.js @@ -58,3 +58,40 @@ export class OrganizationListView { } } Registry.add_view(OrganizationListView); + +/** + * Organization authorization settings + */ +export class OrganizationSettingsAuthorizationView { + static view_name = "OrganizationSettingsAuthorizationView"; + + constructor() { + this.provider_original = undefined; + this.provider = ko.observable(); + + this.show_warning = ko.observable(false); + this.provider.subscribe( + (value) => { + if (this.provider_original === undefined) { + this.provider_original = value; + } + }, + this, + "beforeChange", + ); + this.provider.subscribe((value) => { + if ( + this.provider_original !== undefined && + value !== this.provider_original + ) { + this.show_warning(true); + } else { + this.show_warning(false); + } + }); + this.use_domain = ko.computed(() => { + return this.provider() === "email"; + }); + } +} +Registry.add_view(OrganizationSettingsAuthorizationView); diff --git a/src/js/tests/views/organization_authorization.test.html b/src/js/tests/views/organization_authorization.test.html new file mode 100644 index 00000000..87fe4f10 --- /dev/null +++ b/src/js/tests/views/organization_authorization.test.html @@ -0,0 +1,68 @@ + + +
+
+ +
+
+
+ + + +