UNPKG

datocms-plugin-record-comments

Version:

A plugin that allows you and your project collaborators to leave comments under a record

23 lines (22 loc) 944 kB
(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))r(o);new MutationObserver(o=>{for(const i of o)if(i.type==="childList")for(const s of i.addedNodes)s.tagName==="LINK"&&s.rel==="modulepreload"&&r(s)}).observe(document,{childList:!0,subtree:!0});function n(o){const i={};return o.integrity&&(i.integrity=o.integrity),o.referrerPolicy&&(i.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?i.credentials="include":o.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function r(o){if(o.ep)return;o.ep=!0;const i=n(o);fetch(o.href,i)}})();var st=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function pi(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var d_={exports:{}},Td={},f_={exports:{}},ve={};/** * @license React * react.production.min.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */var xa=Symbol.for("react.element"),JT=Symbol.for("react.portal"),QT=Symbol.for("react.fragment"),XT=Symbol.for("react.strict_mode"),ZT=Symbol.for("react.profiler"),eC=Symbol.for("react.provider"),tC=Symbol.for("react.context"),nC=Symbol.for("react.forward_ref"),rC=Symbol.for("react.suspense"),oC=Symbol.for("react.memo"),iC=Symbol.for("react.lazy"),Wg=Symbol.iterator;function sC(t){return t===null||typeof t!="object"?null:(t=Wg&&t[Wg]||t["@@iterator"],typeof t=="function"?t:null)}var p_={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},h_=Object.assign,m_={};function Ps(t,e,n){this.props=t,this.context=e,this.refs=m_,this.updater=n||p_}Ps.prototype.isReactComponent={};Ps.prototype.setState=function(t,e){if(typeof t!="object"&&typeof t!="function"&&t!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,t,e,"setState")};Ps.prototype.forceUpdate=function(t){this.updater.enqueueForceUpdate(this,t,"forceUpdate")};function y_(){}y_.prototype=Ps.prototype;function Lm(t,e,n){this.props=t,this.context=e,this.refs=m_,this.updater=n||p_}var Bm=Lm.prototype=new y_;Bm.constructor=Lm;h_(Bm,Ps.prototype);Bm.isPureReactComponent=!0;var Kg=Array.isArray,g_=Object.prototype.hasOwnProperty,Fm={current:null},v_={key:!0,ref:!0,__self:!0,__source:!0};function w_(t,e,n){var r,o={},i=null,s=null;if(e!=null)for(r in e.ref!==void 0&&(s=e.ref),e.key!==void 0&&(i=""+e.key),e)g_.call(e,r)&&!v_.hasOwnProperty(r)&&(o[r]=e[r]);var l=arguments.length-2;if(l===1)o.children=n;else if(1<l){for(var u=Array(l),a=0;a<l;a++)u[a]=arguments[a+2];o.children=u}if(t&&t.defaultProps)for(r in l=t.defaultProps,l)o[r]===void 0&&(o[r]=l[r]);return{$$typeof:xa,type:t,key:i,ref:s,props:o,_owner:Fm.current}}function lC(t,e){return{$$typeof:xa,type:t.type,key:e,ref:t.ref,props:t.props,_owner:t._owner}}function $m(t){return typeof t=="object"&&t!==null&&t.$$typeof===xa}function aC(t){var e={"=":"=0",":":"=2"};return"$"+t.replace(/[=:]/g,function(n){return e[n]})}var Gg=/\/+/g;function mf(t,e){return typeof t=="object"&&t!==null&&t.key!=null?aC(""+t.key):e.toString(36)}function xu(t,e,n,r,o){var i=typeof t;(i==="undefined"||i==="boolean")&&(t=null);var s=!1;if(t===null)s=!0;else switch(i){case"string":case"number":s=!0;break;case"object":switch(t.$$typeof){case xa:case JT:s=!0}}if(s)return s=t,o=o(s),t=r===""?"."+mf(s,0):r,Kg(o)?(n="",t!=null&&(n=t.replace(Gg,"$&/")+"/"),xu(o,e,n,"",function(a){return a})):o!=null&&($m(o)&&(o=lC(o,n+(!o.key||s&&s.key===o.key?"":(""+o.key).replace(Gg,"$&/")+"/")+t)),e.push(o)),1;if(s=0,r=r===""?".":r+":",Kg(t))for(var l=0;l<t.length;l++){i=t[l];var u=r+mf(i,l);s+=xu(i,e,n,u,o)}else if(u=sC(t),typeof u=="function")for(t=u.call(t),l=0;!(i=t.next()).done;)i=i.value,u=r+mf(i,l++),s+=xu(i,e,n,u,o);else if(i==="object")throw e=String(t),Error("Objects are not valid as a React child (found: "+(e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)+"). If you meant to render a collection of children, use an array instead.");return s}function Da(t,e,n){if(t==null)return t;var r=[],o=0;return xu(t,r,"","",function(i){return e.call(n,i,o++)}),r}function uC(t){if(t._status===-1){var e=t._result;e=e(),e.then(function(n){(t._status===0||t._status===-1)&&(t._status=1,t._result=n)},function(n){(t._status===0||t._status===-1)&&(t._status=2,t._result=n)}),t._status===-1&&(t._status=0,t._result=e)}if(t._status===1)return t._result.default;throw t._result}var zt={current:null},Eu={transition:null},cC={ReactCurrentDispatcher:zt,ReactCurrentBatchConfig:Eu,ReactCurrentOwner:Fm};function __(){throw Error("act(...) is not supported in production builds of React.")}ve.Children={map:Da,forEach:function(t,e,n){Da(t,function(){e.apply(this,arguments)},n)},count:function(t){var e=0;return Da(t,function(){e++}),e},toArray:function(t){return Da(t,function(e){return e})||[]},only:function(t){if(!$m(t))throw Error("React.Children.only expected to receive a single React element child.");return t}};ve.Component=Ps;ve.Fragment=QT;ve.Profiler=ZT;ve.PureComponent=Lm;ve.StrictMode=XT;ve.Suspense=rC;ve.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=cC;ve.act=__;ve.cloneElement=function(t,e,n){if(t==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+t+".");var r=h_({},t.props),o=t.key,i=t.ref,s=t._owner;if(e!=null){if(e.ref!==void 0&&(i=e.ref,s=Fm.current),e.key!==void 0&&(o=""+e.key),t.type&&t.type.defaultProps)var l=t.type.defaultProps;for(u in e)g_.call(e,u)&&!v_.hasOwnProperty(u)&&(r[u]=e[u]===void 0&&l!==void 0?l[u]:e[u])}var u=arguments.length-2;if(u===1)r.children=n;else if(1<u){l=Array(u);for(var a=0;a<u;a++)l[a]=arguments[a+2];r.children=l}return{$$typeof:xa,type:t.type,key:o,ref:i,props:r,_owner:s}};ve.createContext=function(t){return t={$$typeof:tC,_currentValue:t,_currentValue2:t,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},t.Provider={$$typeof:eC,_context:t},t.Consumer=t};ve.createElement=w_;ve.createFactory=function(t){var e=w_.bind(null,t);return e.type=t,e};ve.createRef=function(){return{current:null}};ve.forwardRef=function(t){return{$$typeof:nC,render:t}};ve.isValidElement=$m;ve.lazy=function(t){return{$$typeof:iC,_payload:{_status:-1,_result:t},_init:uC}};ve.memo=function(t,e){return{$$typeof:oC,type:t,compare:e===void 0?null:e}};ve.startTransition=function(t){var e=Eu.transition;Eu.transition={};try{t()}finally{Eu.transition=e}};ve.unstable_act=__;ve.useCallback=function(t,e){return zt.current.useCallback(t,e)};ve.useContext=function(t){return zt.current.useContext(t)};ve.useDebugValue=function(){};ve.useDeferredValue=function(t){return zt.current.useDeferredValue(t)};ve.useEffect=function(t,e){return zt.current.useEffect(t,e)};ve.useId=function(){return zt.current.useId()};ve.useImperativeHandle=function(t,e,n){return zt.current.useImperativeHandle(t,e,n)};ve.useInsertionEffect=function(t,e){return zt.current.useInsertionEffect(t,e)};ve.useLayoutEffect=function(t,e){return zt.current.useLayoutEffect(t,e)};ve.useMemo=function(t,e){return zt.current.useMemo(t,e)};ve.useReducer=function(t,e,n){return zt.current.useReducer(t,e,n)};ve.useRef=function(t){return zt.current.useRef(t)};ve.useState=function(t){return zt.current.useState(t)};ve.useSyncExternalStore=function(t,e,n){return zt.current.useSyncExternalStore(t,e,n)};ve.useTransition=function(){return zt.current.useTransition()};ve.version="18.3.1";f_.exports=ve;var b=f_.exports;const ue=pi(b);/** * @license React * react-jsx-runtime.production.min.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */var dC=b,fC=Symbol.for("react.element"),pC=Symbol.for("react.fragment"),hC=Object.prototype.hasOwnProperty,mC=dC.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,yC={key:!0,ref:!0,__self:!0,__source:!0};function b_(t,e,n){var r,o={},i=null,s=null;n!==void 0&&(i=""+n),e.key!==void 0&&(i=""+e.key),e.ref!==void 0&&(s=e.ref);for(r in e)hC.call(e,r)&&!yC.hasOwnProperty(r)&&(o[r]=e[r]);if(t&&t.defaultProps)for(r in e=t.defaultProps,e)o[r]===void 0&&(o[r]=e[r]);return{$$typeof:fC,type:t,key:i,ref:s,props:o,_owner:mC.current}}Td.Fragment=pC;Td.jsx=b_;Td.jsxs=b_;d_.exports=Td;var g=d_.exports,Ip={exports:{}},rt={};Object.defineProperty(rt,"__esModule",{value:!0});rt.DATA_CLONE_ERROR=rt.MESSAGE=rt.REJECTED=rt.FULFILLED=rt.REPLY=rt.CALL=rt.HANDSHAKE_REPLY=rt.HANDSHAKE=void 0;const gC="handshake";rt.HANDSHAKE=gC;const vC="handshake-reply";rt.HANDSHAKE_REPLY=vC;const wC="call";rt.CALL=wC;const _C="reply";rt.REPLY=_C;const bC="fulfilled";rt.FULFILLED=bC;const SC="rejected";rt.REJECTED=SC;const kC="message";rt.MESSAGE=kC;const xC="DataCloneError";rt.DATA_CLONE_ERROR=xC;var Bn={};Object.defineProperty(Bn,"__esModule",{value:!0});Bn.ERR_NO_IFRAME_SRC=Bn.ERR_NOT_IN_IFRAME=Bn.ERR_CONNECTION_TIMEOUT=Bn.ERR_CONNECTION_DESTROYED=void 0;const EC="ConnectionDestroyed";Bn.ERR_CONNECTION_DESTROYED=EC;const TC="ConnectionTimeout";Bn.ERR_CONNECTION_TIMEOUT=TC;const CC="NotInIframe";Bn.ERR_NOT_IN_IFRAME=CC;const MC="NoIframeSrc";Bn.ERR_NO_IFRAME_SRC=MC;var Pp={exports:{}};(function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var n=()=>{const r=[];let o=!1;return{destroy(){o=!0,r.forEach(i=>{i()})},onDestroy(i){o?i():r.push(i)}}};e.default=n,t.exports=e.default})(Pp,Pp.exports);var OC=Pp.exports,Rp={exports:{}},Qo={};Object.defineProperty(Qo,"__esModule",{value:!0});Qo.deserializeError=Qo.serializeError=void 0;const NC=t=>{let e=t.name,n=t.message,r=t.stack;return{name:e,message:n,stack:r}};Qo.serializeError=NC;const AC=t=>{const e=new Error;return Object.keys(t).forEach(n=>e[n]=t[n]),e};Qo.deserializeError=AC;(function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var n=rt,r=Qo,o=(i,s,l)=>{const u=i.localName,a=i.local,c=i.remote,d=i.originForSending,f=i.originForReceiving;let p=!1;l(`${u}: Connecting call receiver`);const h=m=>{if(m.source!==c||m.data.penpal!==n.CALL)return;if(m.origin!==f){l(`${u} received message from origin ${m.origin} which did not match expected origin ${f}`);return}const v=m.data,y=v.methodName,w=v.args,_=v.id;l(`${u}: Received ${y}() call`);const S=k=>E=>{if(l(`${u}: Sending ${y}() reply`),p){l(`${u}: Unable to send ${y}() reply due to destroyed connection`);return}const x={penpal:n.REPLY,id:_,resolution:k,returnValue:E};k===n.REJECTED&&E instanceof Error&&(x.returnValue=(0,r.serializeError)(E),x.returnValueIsError=!0);try{c.postMessage(x,d)}catch(T){throw T.name===n.DATA_CLONE_ERROR&&c.postMessage({penpal:n.REPLY,id:_,resolution:n.REJECTED,returnValue:(0,r.serializeError)(T),returnValueIsError:!0},d),T}};new Promise(k=>k(s[y].apply(s,w))).then(S(n.FULFILLED),S(n.REJECTED))};return a.addEventListener(n.MESSAGE,h),()=>{p=!0,a.removeEventListener(n.MESSAGE,h)}};e.default=o,t.exports=e.default})(Rp,Rp.exports);var IC=Rp.exports,Dp={exports:{}},jp={exports:{}};(function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;let n=0;var r=()=>++n;e.default=r,t.exports=e.default})(jp,jp.exports);var PC=jp.exports;(function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var n=rt,r=Bn,o=s(PC),i=Qo;function s(u){return u&&u.__esModule?u:{default:u}}var l=(u,a,c,d,f)=>{const p=a.localName,h=a.local,m=a.remote,v=a.originForSending,y=a.originForReceiving;let w=!1;f(`${p}: Connecting call sender`);const _=S=>function(){for(var k=arguments.length,E=new Array(k),x=0;x<k;x++)E[x]=arguments[x];f(`${p}: Sending ${S}() call`);let T;try{m.closed&&(T=!0)}catch{T=!0}if(T&&d(),w){const M=new Error(`Unable to send ${S}() call due to destroyed connection`);throw M.code=r.ERR_CONNECTION_DESTROYED,M}return new Promise((M,N)=>{const L=(0,o.default)(),A=D=>{if(D.source!==m||D.data.penpal!==n.REPLY||D.data.id!==L)return;if(D.origin!==y){f(`${p} received message from origin ${D.origin} which did not match expected origin ${y}`);return}f(`${p}: Received ${S}() reply`),h.removeEventListener(n.MESSAGE,A);let W=D.data.returnValue;D.data.returnValueIsError&&(W=(0,i.deserializeError)(W)),(D.data.resolution===n.FULFILLED?M:N)(W)};h.addEventListener(n.MESSAGE,A),m.postMessage({penpal:n.CALL,id:L,methodName:S,args:E},v)})};return c.reduce((S,k)=>(S[k]=_(k),S),u),()=>{w=!0}};e.default=l,t.exports=e.default})(Dp,Dp.exports);var RC=Dp.exports,Lp={exports:{}};(function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var n=r=>function(){if(r){for(var o=arguments.length,i=new Array(o),s=0;s<o;s++)i[s]=arguments[s];console.log("[Penpal]",...i)}};e.default=n,t.exports=e.default})(Lp,Lp.exports);var DC=Lp.exports;(function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var n=rt,r=Bn,o=u(OC),i=u(IC),s=u(RC),l=u(DC);function u(c){return c&&c.__esModule?c:{default:c}}var a=function(){let d=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},f=d.parentOrigin,p=f===void 0?"*":f,h=d.methods,m=h===void 0?{}:h,v=d.timeout,y=d.debug;const w=(0,l.default)(y);if(window===window.top){const M=new Error("connectToParent() must be called within an iframe");throw M.code=r.ERR_NOT_IN_IFRAME,M}const _=(0,o.default)(),S=_.destroy,k=_.onDestroy,E=window,x=E.parent;return{promise:new Promise((M,N)=>{let L;v!==void 0&&(L=setTimeout(()=>{const D=new Error(`Connection to parent timed out after ${v}ms`);D.code=r.ERR_CONNECTION_TIMEOUT,N(D),S()},v));const A=D=>{try{clearTimeout()}catch{return}if(D.source!==x||D.data.penpal!==n.HANDSHAKE_REPLY)return;if(p!=="*"&&p!==D.origin){w(`Child received handshake reply from origin ${D.origin} which did not match expected origin ${p}`);return}w("Child: Received handshake reply"),E.removeEventListener(n.MESSAGE,A);const W={localName:"Child",local:E,remote:x,originForSending:D.origin==="null"?"*":D.origin,originForReceiving:D.origin},j={},U=(0,i.default)(W,m,w);k(U);const K=(0,s.default)(j,W,D.data.methodNames,S,w);k(K),clearTimeout(L),M(j)};E.addEventListener(n.MESSAGE,A),k(()=>{E.removeEventListener(n.MESSAGE,A);const D=new Error("Connection destroyed");D.code=r.ERR_CONNECTION_DESTROYED,N(D)}),w("Child: Sending handshake"),x.postMessage({penpal:n.HANDSHAKE,methodNames:Object.keys(m)},p)}),destroy:S}};e.default=a,t.exports=e.default})(Ip,Ip.exports);var jC=Ip.exports;const LC=pi(jC);var er=function(){return er=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++){e=arguments[n];for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o])}return t},er.apply(this,arguments)};function Yg(t,e){for(var n=er({},t),r=0,o=e;r<o.length;r++){var i=o[r];delete n[i]}return n}function yf(t){return function(e,n){if(t){for(var r={},o=0,i=e;o<i.length;o++){var s=i[o],l=n.itemTypes[s.relationships.item_type.data.id];r[s.id]=t(s,er(er({},n),{itemType:l}))}return r}}}function Or(t,e){var n=function(r,o,i){if(i.mode===t){var s=FC(o),l=function(u){e(r,er(er(er({},o),u),s))};return l(i),l}};return n.mode=t,n}function Ea(t,e){var n=function(r,o,i){if(i.mode===t){var s=function(l){e(r,er(er({},o),l))};return s(i),s}};return n.mode=t,n}function BC(){for(var t=document.querySelectorAll("body *"),e=0,n=0;n<t.length;n++)e=Math.max(t[n].getBoundingClientRect().bottom,e);return e}var FC=function(t){var e=null,n=function(a){var c=a===void 0?Math.max(document.body.scrollHeight,document.body.offsetHeight,document.documentElement.getBoundingClientRect().height,BC()):a;c!==e&&(t.setHeight(c),e=c)},r=null,o=null,i=function(){return n()},s=function(){n(),r||(r=new ResizeObserver(i),r.observe(document.documentElement)),o||(o=new MutationObserver(i),o.observe(window.document.body,{attributes:!0,childList:!0,subtree:!0,characterData:!0}))},l=function(){r&&(r.disconnect(),r=null),o&&(o.disconnect(),o=null)},u=function(){return!!r};return{updateHeight:n,startAutoResizer:s,stopAutoResizer:l,isAutoResizerActive:u}},$C=Or("renderAssetSource",function(t,e){t.renderAssetSource&&t.renderAssetSource(e.assetSourceId,e)}),zC=Or("renderConfigScreen",function(t,e){t.renderConfigScreen&&t.renderConfigScreen(e)}),UC=Or("renderFieldExtension",function(t,e){t.renderFieldExtension&&t.renderFieldExtension(e.fieldExtensionId,e)}),VC=Ea("renderInspector",function(t,e){t.renderInspector&&t.renderInspector(e.inspectorId,e)}),qC=Ea("renderInspectorPanel",function(t,e){t.renderInspectorPanel&&t.renderInspectorPanel(e.panelId,e)}),HC=Or("renderItemCollectionOutlet",function(t,e){t.renderItemCollectionOutlet&&t.renderItemCollectionOutlet(e.itemCollectionOutletId,e)}),WC=Or("renderItemFormOutlet",function(t,e){t.renderItemFormOutlet&&t.renderItemFormOutlet(e.itemFormOutletId,e)}),KC=Ea("renderItemFormSidebar",function(t,e){t.renderItemFormSidebar&&t.renderItemFormSidebar(e.sidebarId,e)}),GC=Or("renderItemFormSidebarPanel",function(t,e){t.renderItemFormSidebarPanel&&t.renderItemFormSidebarPanel(e.sidebarPaneId,e)}),YC=Or("renderManualFieldExtensionConfigScreen",function(t,e){t.renderManualFieldExtensionConfigScreen&&t.renderManualFieldExtensionConfigScreen(e.fieldExtensionId,e)}),JC=Or("renderModal",function(t,e){t.renderModal&&t.renderModal(e.modalId,e)}),QC=Ea("renderPage",function(t,e){t.renderPage&&t.renderPage(e.pageId,e)}),XC=Ea("renderUploadSidebar",function(t,e){t.renderUploadSidebar&&t.renderUploadSidebar(e.sidebarId,e)}),ZC=Or("renderUploadSidebarPanel",function(t,e){t.renderUploadSidebarPanel&&t.renderUploadSidebarPanel(e.sidebarPaneId,e)}),mn=function(){return mn=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++){e=arguments[n];for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o])}return t},mn.apply(this,arguments)},eM=function(t,e,n,r){function o(i){return i instanceof n?i:new n(function(s){s(i)})}return new(n||(n=Promise))(function(i,s){function l(c){try{a(r.next(c))}catch(d){s(d)}}function u(c){try{a(r.throw(c))}catch(d){s(d)}}function a(c){c.done?i(c.value):o(c.value).then(l,u)}a((r=r.apply(t,e||[])).next())})},tM=function(t,e){var n={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},r,o,i,s=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return s.next=l(0),s.throw=l(1),s.return=l(2),typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function l(a){return function(c){return u([a,c])}}function u(a){if(r)throw new TypeError("Generator is already executing.");for(;s&&(s=0,a[0]&&(n=0)),n;)try{if(r=1,o&&(i=a[0]&2?o.return:a[0]?o.throw||((i=o.return)&&i.call(o),0):o.next)&&!(i=i.call(o,a[1])).done)return i;switch(o=0,i&&(a=[a[0]&2,i.value]),a[0]){case 0:case 1:i=a;break;case 4:return n.label++,{value:a[1],done:!1};case 5:n.label++,o=a[1],a=[0];continue;case 7:a=n.ops.pop(),n.trys.pop();continue;default:if(i=n.trys,!(i=i.length>0&&i[i.length-1])&&(a[0]===6||a[0]===2)){n=0;continue}if(a[0]===3&&(!i||a[1]>i[0]&&a[1]<i[3])){n.label=a[1];break}if(a[0]===6&&n.label<i[1]){n.label=i[1],i=a;break}if(i&&n.label<i[2]){n.label=i[2],n.ops.push(a);break}i[2]&&n.ops.pop(),n.trys.pop();continue}a=e.call(t,n)}catch(c){a=[6,c],o=0}finally{r=i=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}},Jg=function(t,e,n){if(n||arguments.length===2)for(var r=0,o=e.length,i;r<o;r++)(i||!(r in e))&&(i||(i=Array.prototype.slice.call(e,0,r)),i[r]=e[r]);return t.concat(i||Array.prototype.slice.call(e))};function nM(){return eM(this,arguments,void 0,function(t){var e,n,r,o,i,s,l,u,a,c,d,f;return t===void 0&&(t={}),tM(this,function(p){switch(p.label){case 0:return e=null,n=null,r=mn(mn({},t),{overrideFieldExtensions:yf(t.overrideFieldExtensions),customMarksForStructuredTextField:yf(t.customMarksForStructuredTextField),customBlockStylesForStructuredTextField:yf(t.customBlockStylesForStructuredTextField)}),o=LC({methods:mn(mn({sdkVersion:function(){return"0.3.0"},implementedHooks:function(){return Object.fromEntries(Object.keys(t).map(function(h){return[h,!0]}))}},Object.fromEntries(Object.entries(r).filter(function(h){var m=h[0];return!m.startsWith("render")}))),{onChange:function(h){e&&e(h)},callMethodMergingBootCtx:function(h,m,v,y,w){return n?n(h,m,v,y,w):null}})}),[4,o.promise];case 1:return i=p.sent(),[4,i.getSettings()];case 2:for(s=p.sent(),s.mode==="onBoot"&&(l=s,e=function(h){l=h},n=function(h,m,v,y,w){var _;if(h in r)return(_=r)[h].apply(_,Jg(Jg([],m,!1),[mn(mn(mn(mn({},Yg(i,["getSettings","setHeight"])),Yg(l,["mode","bodyPadding"])),Object.fromEntries(y.map(function(S){return[S,function(){for(var E=[],x=0;x<arguments.length;x++)E[x]=arguments[x];return i.callAdditionalCtxMethod(w,S,E)}]}))),v)],!1))},r.onBoot&&r.onBoot(mn(mn({},i),l))),u={renderAssetSource:$C,renderConfigScreen:zC,renderFieldExtension:UC,renderItemCollectionOutlet:HC,renderItemFormOutlet:WC,renderItemFormSidebar:KC,renderItemFormSidebarPanel:GC,renderManualFieldExtensionConfigScreen:YC,renderModal:JC,renderPage:QC,renderInspector:VC,renderInspectorPanel:qC,renderUploadSidebar:XC,renderUploadSidebarPanel:ZC},a=0,c=Object.values(u);a<c.length;a++)if(d=c[a],f=d(r,i,s),f){e=f;break}return[2]}})})}var No=function(){return No=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++){e=arguments[n];for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o])}return t},No.apply(this,arguments)};function rM(t){return typeof t=="object"&&!!t&&"data"in t}function kr(t){var e=t.id,n=t.type,r=t.attributes,o=t.relationships,i=t.meta;return No(No(No(No(No({},e?{id:e}:{}),n?{type:n}:{}),r||{}),o?Object.fromEntries(Object.entries(o).map(function(s){var l=s[0],u=s[1];return[l,u==null?void 0:u.data]})):{}),i?{meta:i}:{})}function O(t){if(!rM(t))throw new Error("Invalid body!");return Array.isArray(t.data)?t.data.map(kr):kr(t.data)}var S_=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var i in o)Object.prototype.hasOwnProperty.call(o,i)&&(r[i]=o[i])},t(e,n)};return function(e,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");t(e,n);function r(){this.constructor=e}e.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}();function oM(t){if(typeof t!="object"||t===null||!("data"in t))return!1;var e=t;if(!Array.isArray(e.data))return!1;var n=e;if(n.data.length===0)return!1;var r=n.data[0];return!(typeof r!="object"||r===null||!("id"in r)||!("type"in r)||!("attributes"in r)||r.type!=="api_error")}var iM=function(t){S_(e,t);function e(n){var r=this.constructor,o=t.call(this,"API Error!")||this;return Object.setPrototypeOf(o,r.prototype),"captureStackTrace"in Error?Error.captureStackTrace(o,Yi):o.stack=new Error().stack,o.request=n.request,o.preCallStack=n.preCallStack,o.message="".concat(n.request.method," ").concat(n.request.url,": Timeout error"),o.preCallStack&&(o.stack+=` Caused By: `.concat(o.preCallStack)),o}return e}(Error),Yi=function(t){S_(e,t);function e(n){var r=this.constructor,o=t.call(this,"API Error!")||this;Object.setPrototypeOf(o,r.prototype),"captureStackTrace"in Error?Error.captureStackTrace(o,e):o.stack=new Error().stack,o.request=n.request,o.response=n.response,o.preCallStack=n.preCallStack;var i="".concat(n.request.method," ").concat(n.request.url,": ").concat(o.response.status," ").concat(o.response.statusText);return o.errors.length>0&&(i+=` `.concat(JSON.stringify(o.errors,null,2))),o.message=i,o.preCallStack&&(o.stack+=` Caused By: `.concat(o.preCallStack)),o}return Object.defineProperty(e.prototype,"errors",{get:function(){return oM(this.response.body)?this.response.body.data:[]},enumerable:!1,configurable:!0}),e.prototype.findError=function(n,r){var o=Array.isArray(n)?n:[n];return this.errors.find(function(i){return o.includes(i.attributes.code)&&(!r||(typeof r=="function"?r(i.attributes.details):Object.entries(r).every(function(s){var l=s[0],u=s[1];return i.attributes.details[l]===u})))})},e}(Error),sM=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var i in o)Object.prototype.hasOwnProperty.call(o,i)&&(r[i]=o[i])},t(e,n)};return function(e,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");t(e,n);function r(){this.constructor=e}e.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}(),Cd=function(t){sM(e,t);function e(){var n=this.constructor,r=t.call(this,"Promise canceled!")||this;return Object.setPrototypeOf(r,n.prototype),r}return e}(Error);function Md(t,e){var n=null,r=new Promise(function(o,i){n=function(){try{e&&e(),i(new Cd)}catch(l){i(l)}};var s=typeof t=="function"?t():t;s.then(o,i)});return n&&(r.cancel=n),r}function Tu(t){return new Promise(function(e){setTimeout(e,t)})}var lM=function(t,e,n,r){function o(i){return i instanceof n?i:new n(function(s){s(i)})}return new(n||(n=Promise))(function(i,s){function l(c){try{a(r.next(c))}catch(d){s(d)}}function u(c){try{a(r.throw(c))}catch(d){s(d)}}function a(c){c.done?i(c.value):o(c.value).then(l,u)}a((r=r.apply(t,e||[])).next())})},aM=function(t,e){var n={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},r,o,i,s;return s={next:l(0),throw:l(1),return:l(2)},typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function l(a){return function(c){return u([a,c])}}function u(a){if(r)throw new TypeError("Generator is already executing.");for(;s&&(s=0,a[0]&&(n=0)),n;)try{if(r=1,o&&(i=a[0]&2?o.return:a[0]?o.throw||((i=o.return)&&i.call(o),0):o.next)&&!(i=i.call(o,a[1])).done)return i;switch(o=0,i&&(a=[a[0]&2,i.value]),a[0]){case 0:case 1:i=a;break;case 4:return n.label++,{value:a[1],done:!1};case 5:n.label++,o=a[1],a=[0];continue;case 7:a=n.ops.pop(),n.trys.pop();continue;default:if(i=n.trys,!(i=i.length>0&&i[i.length-1])&&(a[0]===6||a[0]===2)){n=0;continue}if(a[0]===3&&(!i||a[1]>i[0]&&a[1]<i[3])){n.label=a[1];break}if(a[0]===6&&n.label<i[1]){n.label=i[1],i=a;break}if(i&&n.label<i[2]){n.label=i[2],n.ops.push(a);break}i[2]&&n.ops.pop(),n.trys.pop();continue}a=e.call(t,n)}catch(c){a=[6,c],o=0}finally{r=i=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}};function uM(t){return lM(this,void 0,void 0,function(){var e,n,r;return aM(this,function(o){switch(o.label){case 0:n=0,o.label=1;case 1:return o.trys.push([1,4,,5]),n+=1,[4,Tu(n*1e3)];case 2:return o.sent(),[4,t()];case 3:return e=o.sent(),[3,5];case 4:if(r=o.sent(),!(r instanceof Yi)||r.response.status!==404)throw r;return[3,5];case 5:if(!e)return[3,1];o.label=6;case 6:return[2,e]}})})}var k_={},zm={},Um={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.TaskCollisionStrategy=void 0,function(e){e[e.DEFAULT=0]="DEFAULT",e[e.KEEP_THIS=1]="KEEP_THIS",e[e.KEEP_OTHER=2]="KEEP_OTHER",e[e.KEEP_BOTH=3]="KEEP_BOTH",e[e.RESOLVE_THIS=4]="RESOLVE_THIS",e[e.RESOLVE_OTHER=5]="RESOLVE_OTHER"}(t.TaskCollisionStrategy||(t.TaskCollisionStrategy={}))})(Um);var Od={};Object.defineProperty(Od,"__esModule",{value:!0});class cM{constructor(e,n){this._code=e,this._message=n}get code(){return this._code}get message(){return this._message}}Od.default=cM;var Xo={};Object.defineProperty(Xo,"__esModule",{value:!0});Xo.mutexEquality=Xo.mutexBitwiseAnd=void 0;function dM(t,e){return(t&e)!==0}Xo.mutexBitwiseAnd=dM;function fM(t,e){return t===e}Xo.mutexEquality=fM;var Vm={};Object.defineProperty(Vm,"__esModule",{value:!0});class pM{constructor(e,n){this._meta=void 0,this._task=e,this._scheduler=n}withDescriptor(e){return this._descriptor=e,this}withMutex(e){return this._mutex=e,this}withMeta(e){return this._meta=e,this}runBeforeExecuting(e){return this._onPreExecute=e,this}handleCollisions(e){return this._onTaskCollision=e,this}execute(e){return this._scheduler.enqueue({priority:e,mutex:this._mutex,descriptor:this._descriptor,meta:this._meta,execute:this._task,onPreExecute:this._onPreExecute,onTaskCollision:this._onTaskCollision})}}Vm.default=pM;var hM=st&&st.__awaiter||function(t,e,n,r){function o(i){return i instanceof n?i:new n(function(s){s(i)})}return new(n||(n=Promise))(function(i,s){function l(c){try{a(r.next(c))}catch(d){s(d)}}function u(c){try{a(r.throw(c))}catch(d){s(d)}}function a(c){c.done?i(c.value):o(c.value).then(l,u)}a((r=r.apply(t,e||[])).next())})},x_=st&&st.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(zm,"__esModule",{value:!0});const qn=Um,mM=x_(Od),yM=Xo,gM=x_(Vm);var yn;(function(t){t[t.PENDING=0]="PENDING",t[t.EXECUTING=1]="EXECUTING",t[t.TERMINATED=2]="TERMINATED"})(yn||(yn={}));function Qg(t,e){for(let n of t.listeners)n.reject(e)}class vM{constructor(e,n={}){this._queue=[],this._isExecuting=!1,this._idleListeners=[],this._maxConcurrentTasks=e,this._samePriorityMutex=!!n.samePriorityMutex,this._mutexStrategy=n.mutexStrategy||yM.mutexEquality,n.disableLogging?this._errorLog=()=>{}:this._errorLog=console.error}enqueue(e){return new Promise((n,r)=>{typeof e=="function"&&(e={priority:0,execute:e});const o=this._checkMutexes(e,n,r);o.task?this._addTask(o.task):o.canceled&&r(this.createCanceledError())})}prepare(e){return new gM.default(e,this)}_addTask(e){this._queue.push(e),this._applyPriorities(),this._isExecuting||(this._isExecuting=!0,setTimeout(this._executeNextTasks.bind(this)))}get executingTasks(){return this._queue.reduce((e,n)=>n.state===yn.EXECUTING?e+1:e,0)}createCanceledError(){return new mM.default(50,"Task has been canceled in favor of another task")}_findFirstPendingTask(){return this._queue.find(e=>e.state===yn.PENDING)}_isIdle(){return this._queue.length===0||!this._queue.find(e=>e.state!==yn.TERMINATED)}_removeTaskAt(e){this._queue.splice(e,1)}_executeTask(e){return hM(this,void 0,void 0,function*(){try{return e.task.onPreExecute&&e.task.onPreExecute(),yield e.task.execute()}catch(n){throw n}finally{e.state=yn.TERMINATED;let n=this._queue.indexOf(e);this._removeTaskAt(n),this._executeNextTasks()}})}_executeNextTasks(){let e=this.executingTasks;if(e>=this._maxConcurrentTasks)return;let n=this._maxConcurrentTasks-e;for(let r=0;r<n;r++){const o=this._findFirstPendingTask();if(!o){this._isIdle()&&this._switchToIdle();return}o.state=yn.EXECUTING,this._executeTask(o).then(i=>{for(const{resolve:s}of o.listeners)try{s(i)}catch(l){this._errorLog("An error occurred while resolving listener",l)}}).catch(i=>{for(const{reject:s}of o.listeners)try{s(i)}catch(l){this._errorLog("An error occurred while rejecting listener",l)}})}}_switchToIdle(){this._isExecuting=!1;const e=this._idleListeners;this._idleListeners=[];for(const{resolve:n}of e)try{n()}catch{}}waitForIdle(){return this._isExecuting?new Promise((e,n)=>{this._idleListeners.push({resolve:e,reject:n})}):Promise.resolve()}_applyPriorities(){this._queue.sort((e,n)=>n.task.priority-e.task.priority)}_checkMutexes(e,n,r){for(let o=0;o<this._queue.length;o++){let i=this._queue[o];if(i.state===yn.TERMINATED||this._samePriorityMutex&&i.task.priority!=e.priority||!i.task.mutex||!e.mutex||!this._mutexStrategy(i.task.mutex,e.mutex))continue;let s,l;if(i.task.onTaskCollision)if(s=i.task.onTaskCollision(e),s===qn.TaskCollisionStrategy.KEEP_OTHER&&i.state!==yn.EXECUTING){this._removeTaskAt(o--),Qg(i,this.createCanceledError());continue}else{if(s===qn.TaskCollisionStrategy.KEEP_THIS)return{canceled:!0};if(s===qn.TaskCollisionStrategy.RESOLVE_OTHER)return this._removeTaskAt(o--),{canceled:!1,task:{task:e,state:yn.PENDING,listeners:[{resolve:n,reject:r},...i.listeners]}};if(s===qn.TaskCollisionStrategy.RESOLVE_THIS)return i.listeners=[...i.listeners,{resolve:n,reject:r}],{canceled:!1}}if(e.onTaskCollision){if(l=e.onTaskCollision(i.task),l===qn.TaskCollisionStrategy.KEEP_OTHER)return{canceled:!0};if(l===qn.TaskCollisionStrategy.KEEP_THIS){this._removeTaskAt(o--),Qg(i,this.createCanceledError());continue}else{if(l===qn.TaskCollisionStrategy.RESOLVE_OTHER)return i.listeners=[...i.listeners,{resolve:n,reject:r}],{canceled:!1};if(l===qn.TaskCollisionStrategy.RESOLVE_THIS)return this._removeTaskAt(o--),{canceled:!1,task:{task:e,state:yn.PENDING,listeners:[{resolve:n,reject:r},...i.listeners]}}}}if(!(s===qn.TaskCollisionStrategy.KEEP_BOTH&&l===qn.TaskCollisionStrategy.KEEP_BOTH))return{canceled:!0}}return{canceled:!1,task:{task:e,state:yn.PENDING,listeners:[{resolve:n,reject:r}]}}}}zm.default=vM;(function(t){var e=st&&st.__importDefault||function(s){return s&&s.__esModule?s:{default:s}};Object.defineProperty(t,"__esModule",{value:!0}),t.mutexEquality=t.mutexBitwiseAnd=t.SchedulerError=t.TaskCollisionStrategy=t.Scheduler=void 0;const n=e(zm);t.Scheduler=n.default;const r=Um;Object.defineProperty(t,"TaskCollisionStrategy",{enumerable:!0,get:function(){return r.TaskCollisionStrategy}});const o=e(Od);t.SchedulerError=o.default;const i=Xo;Object.defineProperty(t,"mutexBitwiseAnd",{enumerable:!0,get:function(){return i.mutexBitwiseAnd}}),Object.defineProperty(t,"mutexEquality",{enumerable:!0,get:function(){return i.mutexEquality}})})(k_);var wM=function(t,e){var n={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},r,o,i,s;return s={next:l(0),throw:l(1),return:l(2)},typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function l(a){return function(c){return u([a,c])}}function u(a){if(r)throw new TypeError("Generator is already executing.");for(;s&&(s=0,a[0]&&(n=0)),n;)try{if(r=1,o&&(i=a[0]&2?o.return:a[0]?o.throw||((i=o.return)&&i.call(o),0):o.next)&&!(i=i.call(o,a[1])).done)return i;switch(o=0,i&&(a=[a[0]&2,i.value]),a[0]){case 0:case 1:i=a;break;case 4:return n.label++,{value:a[1],done:!1};case 5:n.label++,o=a[1],a=[0];continue;case 7:a=n.ops.pop(),n.trys.pop();continue;default:if(i=n.trys,!(i=i.length>0&&i[i.length-1])&&(a[0]===6||a[0]===2)){n=0;continue}if(a[0]===3&&(!i||a[1]>i[0]&&a[1]<i[3])){n.label=a[1];break}if(a[0]===6&&n.label<i[1]){n.label=i[1],i=a;break}if(i&&n.label<i[2]){n.label=i[2],n.ops.push(a);break}i[2]&&n.ops.pop(),n.trys.pop();continue}a=e.call(t,n)}catch(c){a=[6,c],o=0}finally{r=i=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}},Ro=function(t){return this instanceof Ro?(this.v=t,this):new Ro(t)},_M=function(t,e,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r=n.apply(t,e||[]),o,i=[];return o={},s("next"),s("throw"),s("return"),o[Symbol.asyncIterator]=function(){return this},o;function s(f){r[f]&&(o[f]=function(p){return new Promise(function(h,m){i.push([f,p,h,m])>1||l(f,p)})})}function l(f,p){try{u(r[f](p))}catch(h){d(i[0][3],h)}}function u(f){f.value instanceof Ro?Promise.resolve(f.value.v).then(a,c):d(i[0][2],f)}function a(f){l("next",f)}function c(f){l("throw",f)}function d(f,p){f(p),i.shift(),i.length&&l(i[0][0],i[0][1])}};function hi(t,e,n){return _M(this,arguments,function(){var o,i,s,l,u,y,a,c,d,f,p,h,m,v,y;return wM(this,function(w){switch(w.label){case 0:if(o=(n==null?void 0:n.perPage)||t.defaultLimit,o>t.maxLimit)throw new Error("perPage option cannot exceed maximum value of ".concat(t.maxLimit));if(i=(n==null?void 0:n.concurrency)||1,i>10)throw new Error("concurrency option cannot exceed maximum value of 10");return[4,Ro(e({limit:o,offset:0}))];case 1:s=w.sent(),l=0,u=s.data,w.label=2;case 2:return l<u.length?(y=u[l],[4,Ro(y)]):[3,6];case 3:return[4,w.sent()];case 4:w.sent(),w.label=5;case 5:return l++,[3,2];case 6:for(a=s.meta.total_count,c=new k_.Scheduler(i),d=[],f=function(_){d.push(c.enqueue(function(){return e({limit:o,offset:_})}))},p=o;p<a;p+=o)f(p);w.label=7;case 7:return d.length>0?[4,Ro(d.shift())]:[3,14];case 8:h=w.sent(),m=0,v=h.data,w.label=9;case 9:return m<v.length?(y=v[m],[4,Ro(y)]):[3,13];case 10:return[4,w.sent()];case 11:w.sent(),w.label=12;case 12:return m++,[3,9];case 13:return[3,7];case 14:return[2]}})})}function mi(t){t&&"page"in t&&console.warn("Passing a `page` query param on paged iterators has no effect: use the `perPage` option instead.")}var ja=function(t,e,n){if(n||arguments.length===2)for(var r=0,o=e.length,i;r<o;r++)(i||!(r in e))&&(i||(i=Array.prototype.slice.call(e,0,r)),i[r]=e[r]);return t.concat(i||Array.prototype.slice.call(e))},E_="__ARRAY_INDEX__";function bM(t){return t.reduce(function(e,n,r){return r===0?n:n===E_?"".concat(e,"[]"):"".concat(e,"[").concat(n,"]")},"")}function SM(t){if(typeof t=="number"||typeof t=="string")return t.toString();if(t===!0)return"true";if(t===!1)return"false";throw"Don't know how to serialize param value ".concat(JSON.stringify(t))}function Bp(t,e){e===void 0&&(e=[]);var n=[];if(typeof t=="number"||typeof t=="string"||typeof t=="boolean")n.push([bM(e),SM(t)]);else if(typeof t=="object"){if(Array.isArray(t))for(var r=0,o=t;r<o.length;r++)for(var i=o[r],s=0,l=Bp(i,ja(ja([],e,!0),[E_],!1));s<l.length;s++){var u=l[s];n.push(u)}else if(t)for(var a=0,c=Object.entries(t);a<c.length;a++)for(var d=c[a],f=d[0],i=d[1],p=0,h=Bp(i,ja(ja([],e,!0),[f],!1));p<h.length;p++){var u=h[p];n.push(u)}}return n}var dr=function(){return dr=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++){e=arguments[n];for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o])}return t},dr.apply(this,arguments)},kM=function(t,e,n,r){function o(i){return i instanceof n?i:new n(function(s){s(i)})}return new(n||(n=Promise))(function(i,s){function l(c){try{a(r.next(c))}catch(d){s(d)}}function u(c){try{a(r.throw(c))}catch(d){s(d)}}function a(c){c.done?i(c.value):o(c.value).then(l,u)}a((r=r.apply(t,e||[])).next())})},xM=function(t,e){var n={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},r,o,i,s;return s={next:l(0),throw:l(1),return:l(2)},typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function l(a){return function(c){return u([a,c])}}function u(a){if(r)throw new TypeError("Generator is already executing.");for(;s&&(s=0,a[0]&&(n=0)),n;)try{if(r=1,o&&(i=a[0]&2?o.return:a[0]?o.throw||((i=o.return)&&i.call(o),0):o.next)&&!(i=i.call(o,a[1])).done)return i;switch(o=0,i&&(a=[a[0]&2,i.value]),a[0]){case 0:case 1:i=a;break;case 4:return n.label++,{value:a[1],done:!1};case 5:n.label++,o=a[1],a=[0];continue;case 7:a=n.ops.pop(),n.trys.pop();continue;default:if(i=n.trys,!(i=i.length>0&&i[i.length-1])&&(a[0]===6||a[0]===2)){n=0;continue}if(a[0]===3&&(!i||a[1]>i[0]&&a[1]<i[3])){n.label=a[1];break}if(a[0]===6&&n.label<i[1]){n.label=i[1],i=a;break}if(i&&n.label<i[2]){n.label=i[2],n.ops.push(a);break}i[2]&&n.ops.pop(),n.trys.pop();continue}a=e.call(t,n)}catch(c){a=[6,c],o=0}finally{r=i=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}},EM=typeof window<"u"&&typeof window.document<"u",TM=5,gn;(function(t){t[t.NONE=0]="NONE",t[t.BASIC=1]="BASIC",t[t.BODY=2]="BODY",t[t.BODY_AND_HEADERS=3]="BODY_AND_HEADERS"})(gn||(gn={}));function CM(t){var e={};return t.forEach(function(n,r){e[r]=n}),e}function Xg(t,e,n,r,o,i,s){return{request:{url:e,method:t,headers:n,body:r},response:{status:o.status,statusText:o.statusText,headers:CM(o.headers),body:i},preCallStack:s}}function MM(t,e,n,r,o){return{request:{url:e,method:t,headers:n,body:r},preCallStack:o}}function OM(t,e,n,r,o,i,s){return{request:{url:e,method:t,headers:n,body:r},response:{status:o,statusText:"N/A",headers:{},body:i},preCallStack:s}}function NM(t){return typeof t=="object"&&!!t&&"code"in t}function AM(t){return Object.fromEntries(Object.entries(t).map(function(e){var n=e[0],r=e[1];return[n.toLowerCase(),r]}))}var Zg=1;function Cu(t){var e;return kM(this,void 0,void 0,function(){var n,r,o,i,s,l,u,a,c,d,f,p,h,m,v,y,N,L,w,_,S,k,E,x,T,M,N,L,A,D,W,j,U,K;return xM(this,function(R){switch(R.label){case 0:if(n=Zg,Zg+=1,r=t.fetchFn||(typeof fetch>"u"?void 0:fetch)||(typeof globalThis>"u"?void 0:globalThis.fetch),typeof r>"u")throw new Error("fetch() is not available: either polyfill it globally, or provide it as fetchFn option.");if(o=t.preCallStack,i=t.userAgent||"@datocms/rest-client-utils",s=t.retryCount||1,l=t.logLevel||gn.NONE,u="autoRetry"in t?t.autoRetry:!0,a=t.logFn||function(){return!0},c=dr({"content-type":"application/json",accept:"application/json",authorization:"Bearer ".concat(t.apiToken),"user-agent":i},t.extraHeaders?AM(t.extraHeaders):{}),EM&&delete c["user-agent"],d=t.baseUrl.replace(/\/$/,""),f=t.body?JSON.stringify(t.body,null,2):void 0,p=t.queryParams&&Object.keys(t.queryParams).length>0?"?".concat(new URLSearchParams(Bp(t.queryParams)).toString()):"",h="".concat(d).concat(t.url).concat(p),l>=gn.BASIC){if(a("[".concat(n,"] ").concat(t.method," ").concat(h)),l>=gn.BODY_AND_HEADERS)for(m=0,v=Object.entries(c||{});m<v.length;m++)y=v[m],N=y[0],L=y[1],a("[".concat(n,"] ").concat(N,": ").concat(L));l>=gn.BODY&&f&&a("[".concat(n,"] ").concat(f))}R.label=1;case 1:return R.trys.push([1,12,,16]),w=Md(r(h,{method:t.method,headers:c,body:f})),_=setTimeout(function(){w.cancel()},t.requestTimeout||3e4),[4,w];case 2:if(S=R.sent(),clearTimeout(_),k=S.headers.get("Content-Type"),E=k&&!k.includes("application/json"),!(S.status===429||E))return[3,4];if(!u||E&&t.method!=="GET")throw new Yi(Xg(t.method,h,c,t.body,S,void 0,o));return x=S.headers.has("X-RateLimit-Reset")?Number.parseInt(S.headers.get("X-RateLimit-Reset"),10):s,l>=gn.BASIC&&(S.status===429?a("[".concat(n,"] Rate limit exceeded, wait ").concat(x," seconds then retry...")):a("[".concat(n,'] Invalid response content type "').concat(k,'" (status ').concat(S.status,"). Wait ").concat(x," seconds then retry..."))),[4,Tu(x*1e3)];case 3:return R.sent(),[2,Cu(dr(dr({},t),{retryCount:s+1}))];case 4:if(l>=gn.BASIC&&(a("[".concat(n,"] Status: ").concat(S.status," (").concat(S.statusText,")")),l>=gn.BODY_AND_HEADERS))for(T=0,M=["x-api-version","x-environment","x-queue-time","x-ratelimit-remaining","x-request-id","cf-ray"];T<M.length;T++)N=M[T],L=S.headers.get(N),L&&a("[".concat(n,"] ").concat(N,": ").concat(L));return S.status!==204?[3,5]:(D=void 0,[3,7]);case 5:return[4,S.json()];case 6:D=R.sent(),R.label=7;case 7:return A=D,l>=gn.BODY&&A&&a("[".concat(n,"] ").concat(JSON.stringify(A,null,2))),S.status!==202?[3,9]:[4,t.fetchJobResult(A.data.id)];case 8:if(W=R.sent(),W.status<200||W.status>=300)throw new Yi(OM(t.method,h,c,t.body,W.status,W.payload,o));A=W.payload,R.label=9;case 9:return S.status>=200&&S.status<300?[2,A]:(j=new Yi(Xg(t.method,h,c,t.body,S,A,o)),U=(e=j.errors.find(function(z){return z.attributes.transient}))===null||e===void 0?void 0:e.attributes.code,u&&U?(l>=gn.BASIC&&a("[".concat(n,"] ").concat(U,", wait ").concat(s," seconds then retry...")),[4,Tu(s*1e3)]):[3,11]);case 10:return R.sent(),[2,Cu(dr(dr({},t),{retryCount:s+1}))];case 11:throw j;case 12:return K=R.sent(),K instanceof Cd||NM(K)&&K.code.includes("ETIMEDOUT")?u&&s<TM?(l>=gn.BASIC&&a("[".concat(n,"] Timeout error, wait ").concat(s," seconds then retry...")),[4,Tu(s*1e3)]):[3,14]:[3,15];case 13:return R.sent(),[2,Cu(dr(dr({},t),{retryCount:s+1}))];case 14:throw new iM(MM(t.method,h,c,t.body,o));case 15:throw K;case 16:return[2]}})})}var Ao=function(){return Ao=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++){e=arguments[n];for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o])}return t},Ao.apply(this,arguments)},IM=function(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,r=Object.getOwnPropertySymbols(t);o<r.length;o++)e.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(t,r[o])&&(n[r[o]]=t[r[o]]);return n};function Mu(t){return typeof t=="object"&&!!t&&"id"in t&&"type"in t}function gf(t){return Array.isArray(t)&&t.every(Mu)}function X(t,e){if(typeof t!="object"||!t)throw new Error("Invalid body!");if(Array.isArray(t))return{data:t.map(function(T){var M;return(M=X(T,e))===null||M===void 0?void 0:M.data})};var n=t,r=n.id,o=n.type,i=n.meta,s=IM(n,["id","type","meta"]),l={},u={};if(e.attributes==="*")for(var a=0,c=Object.entries(s);a<c.length;a++){var d=c[a],f=d[0],p=d[1];if(e.relationships.includes(f))if(Mu(p)){var h=p.id,m=p.type;u[f]={data:{id:h,type:m}}}else gf(p)?u[f]={data:p.map(function(T){var M=T.id,N=T.type;return{id:M,type:N}})}:u[f]={data:null};else l[f]=p}else if(e.relationships==="*")for(var v=0,y=Object.entries(s);v<y.length;v++){var w=y[v],f=w[0],p=w[1];if(e.attributes.includes(f))l[f]=p;else if(Mu(p)){var _=p.id,m=p.type;u[f]={data:{id:_,type:m}}}else gf(p)?u[f]={data:p.map(function(N){var L=N.id,A=N.type;return{id:L,type:A}})}:u[f]={data:null}}else{for(var S=0,k=Object.entries(s);S<k.length;S++){var E=k[S],f=E[0],p=E[1];if(e.attributes.includes(f))l[f]=p;else if(e.relationships.includes(f))if(Mu(p)){var x=p.id,m=p.type;u[f]={data:{id:x,type:m}}}else gf(p)?u[f]={data:p.map(function(N){var L=N.id,A=N.type;return{id:L,type:A}})}:u[f]={data:null}}e.attributes.includes("type")&&(l.type=o)}return{data:Ao(Ao(Ao(Ao(Ao({},r||e.id?{id:r||e.id}:{}),{type:e.type}),Object.keys(l).length>0?{attributes:l}:{}),Object.keys(u).length>0?{relationships:u}:{}),i?{meta:i}:{})}}function P(t){return typeof t=="string"?t:t.id}var de=function(){function t(e){this.client=e}return t}(),PM=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var i in o)Object.prototype.hasOwnProperty.call(o,i)&&(r[i]=o[i])},t(e,n)};return function(e,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");t(e,n);function r(){this.constructor=e}e.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}(),RM=function(t){PM(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e.prototype.create=function(n){return this.rawCreate(X(n,{type:"role",attributes:["name","can_edit_favicon","can_edit_site","can_edit_schema","can_manage_menu","can_edit_environment","can_promote_environments","environments_access","can_manage_users","can_manage_shared_filters","can_manage_upload_collections","can_manage_build_triggers","can_manage_webhooks","can_manage_environments","can_manage_sso","can_access_audit_log","can_manage_workflows","can_manage_access_tokens","can_perform_site_search","can_access_build_events_log","positive_item_type_permissions","negative_item_type_permissions","positive_upload_permissions","negative_upload_permissions","positive_build_trigger_permissions","negative_build_trigger_permissions"],relationships:["inherits_permissions_from"]})).then(function(r){return O(r)})},e.prototype.rawCreate=function(n){return this.client.request({method:"POST",url:"/roles",body:n})},e.prototype.update=function(n,r){return this.rawUpdate(P(n),X(r,{id:P(n),type:"role",attributes:["name","can_edit_favicon","can_edit_site","can_edit_schema","can_manage_menu","can_edit_environment","can_promote_environments","environments_access","can_manage_users","can_manage_shared_filters","can_manage_upload_collections","can_manage_build_triggers","can_manage_webhooks","can_manage_environments","can_manage_sso","can_access_audit_log","can_manage_workflows","can_manage_access_tokens","can_perform_site_search","can_access_build_events_log","positive_item_type_permissions","negative_item_type_permissions","positive_upload_permissions","negative_upload_permissions","positive_build_trigger_permissions","negative_build_trigger_permissions"],relationships:["inherits_permissions_from"]})).then(function(o){return O(o)})},e.prototype.rawUpdate=function(n,r){return this.client.request({method:"PUT",url:"/roles/".concat(n),body:r})},e.prototype.list=function(){return this.rawList().then(function(n){return O(n)})},e.prototype.rawList=function(){return this.client.request({method:"GET",url:"/roles"})},e.prototype.find=function(n){return this.rawFind(P(n)).then(function(r){return O(r)})},e.prototype.rawFind=function(n){return this.client.request({method:"GET",url:"/roles/".concat(n)})},e.prototype.destroy=function(n){return this.rawDestroy(P(n)).then(function(r){return O(r)})},e.prototype.rawDestroy=function(n){return this.client.request({method:"DELETE",url:"/roles/".concat(n)})},e.prototype.duplicate=function(n){return this.rawDuplicate(P(n)).then(function(r){return O(r)})},e.prototype.rawDuplicate=function(n){return this.client.request({method:"POST",url:"/roles/".concat(n,"/duplicate")})},e.TYPE="role",e}(de),DM=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var i in o)Object.prototype.hasOwnProperty.call(o,i)&&(r[i]=o[i])},t(e,n)};return function(e,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");t(e,n);function r(){this.constructor=e}e.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}(),Uo=function(){return Uo=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++){e=arguments[n];for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o])}return t},Uo.apply(this,arguments)},jM=function(t,e,n,r){function o(i){return i instanceof n?i:new n(function(s){s(i)})}return new(n||(n=Promise))(function(i,s){function l(c){try{a(r.next(c))}catch(d){s(d)}}function u(c){try{a(r.throw(c))}catch(d){s(d)}}function a(c){c.done?i(c.value):o(c.value).then(l,u)}a((r=r.apply(t,e||[])).next())})},LM=function(t,e){var n={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},r,o,i,s;return s={next:l(0),throw:l(1),return:l(2)},typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function l(a){return function(c){return u([a,c])}}function u(a){if(r)throw new TypeError("Generator is already executing.");for(;s&&(s=0,a[0]&&(n=0)),n;)try{if(r=1,o&&(i=a[0]&2?o.return:a[0]?o.throw||((i=o.return)&&i.call(o),0):o.next)&&!(i=i.call(o,a[1])).done)return i;swit