Mini Kabibi Habibi
/*! For license information please see 8505.js.LICENSE.txt */
"use strict";(globalThis.webpackChunkUniversalAssetBrowser=globalThis.webpackChunkUniversalAssetBrowser||[]).push([[8505],{48505:(e,t,i)=>{i.d(t,{initializeSharedAssetModel:()=>Al});var s,r,n,o,a,c,l,d,u,h,p,_,m,f,g,y,v,O,b,I,E,T,S,A,P,w,C,R,L,N,D,M,x,k,H,j,U,B,F,V,K,G,$,W,z,q,Y,Q,J,X,Z,ee,te,ie,se,re,ne,oe,ae,ce,le,de,ue,he,pe,_e,me,fe,ge,ye,ve,Oe,be,Ie,Ee,Te,Se,Ae,Pe,we,Ce,Re,Le,Ne,De,Me,xe,ke,He,je,Ue=i(48494);!function(e){e.NotImplemented="not_implemented",e.Success="success",e.Cancel="cancel",e.Close="close",e.Error="error"}(s||(s={})),function(e){var t,i;(t=e.ActionType||(e.ActionType={})).Asset="asset",t.Route="route",(i=e.ClickSelectType||(e.ClickSelectType={})).Single="single",i.Double="double",i.None="none"}(r||(r={})),function(e){e.CloudDocuments="cloud-documents",e.Deleted="deleted",e.SharedWithYou="shared-with-you",e.Recents="recents",e.ReviewLinks="review-links",e.ConvertToSketch="sketch",e.Libraries="libraries",e.Local="local",e.Projects="projects",e.Project="project",e.GenerationHistory="generation-history",e.FFBoards="ffboards",e.Favorites="favorites",e.AssetPreview="asset-preview"}(n||(n={})),function(e){e.AllFiles="ALL_FILES",e.Folder="FOLDER",e.Project="PROJECT",e.ReviewLink="REVIEW_LINK",e.AllCompatible="ALL_COMPATIBLE"}(o||(o={})),function(e){e.Assets3d="ASSETS_3D",e.Images="IMAGES",e.Videos="VIDEOS",e.Audio="AUDIO"}(a||(a={})),function(e){e.Photoshop="PHOTOSHOP",e.Illustrator="ILLUSTRATOR",e.Express="EXPRESS",e.Acrobat="PDF",e.InDesign="INDESIGN",e.Aero="AERO",e.XD="XD",e.Concept="CONCEPT",e.Squirrel="SQUIRREL"}(c||(c={})),function(e){e.Libraries="LIBRARIES",e.Brands="BRANDS"}(l||(l={})),function(e){e.AllBrands="ALL_BRANDS",e.CreatedByYou="CREATED_BY_YOU",e.Drafts="DRAFTS",e.Published="PUBLISHED",e.MyBrands="MY_BRANDS",e.Public="PUBLIC"}(d||(d={})),function(e){e.GenerationAll="FIREFLY_GENERATION_ALL",e.GenerationImage="FIREFLY_GENERATION_IMAGE",e.GenerationVideo="FIREFLY_GENERATION_VIDEO",e.GenerationVector="FIREFLY_GENERATION_VECTOR",e.GenerationAudio="FIREFLY_GENERATION_AUDIO"}(u||(u={})),function(e){e.All="SHARED_VIEW_ALL",e.Yours="SHARED_VIEW_YOURS",e.SharedWithYou="SHARED_VIEW_SHARED_WITH_YOU"}(h||(h={})),Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},a),c),o),l),u),h),d),function(e){e[e.Off=0]="Off",e[e.Medium=1]="Medium",e[e.High=2]="High"}(p||(p={})),function(e){e[e.DEBUG=0]="DEBUG",e[e.INFO=1]="INFO",e[e.WARN=2]="WARN",e[e.ERROR=3]="ERROR",e[e.DISABLED=4]="DISABLED"}(_||(_={})),function(e){e.Personal="type1",e.Enterprise="type2",e.Business="type3",e.Federated="type2e"}(m||(m={})),function(e){e.placeLinkOrEmbed="placeLinkOrEmbed",e.linkAssets="linkAssets",e.open="open",e.saveAs="saveAs",e.saveAsCopy="saveAsCopy",e.saveToFolder="saveToFolder",e.export="export",e.copy="copy",e.move="move",e.moveFrom="moveFrom",e.add="add"}(f||(f={})),function(e){e.Ok="ok",e.Cancel="cancel",e.CancelBecauseOpen="cancel-open"}(g||(g={})),function(e){e.ShareSheetInvite="invite",e.ShareSheetLink="getLink",e.ShareSheetAction="share"}(y||(y={})),function(e){e.UpToDate="UpToDate",e.OutOfDate="OutOfDate",e.MetadataOutOfDate="MetadataOutOfDate",e.Restricted="Restricted",e.Discarded="Discarded",e.Broken="Broken"}(v||(v={})),function(e){e.Edit="Edit",e.View="View",e.None="None"}(O||(O={})),function(e){e.assets="ccac.dap.in.notify.assets",e.update="ccac.dap.out.notify.update",e.config="ccac.dap.in.notify.config",e.showShare="ccac.dap.out.notify.showShare",e.requestAction="ccac.libraries.out.request.action",e.requestUpdate="ccac.libraries.in.request.update",e.applyElements="ccac.libraries.out.request.apply"}(b||(b={})),function(e){e.openPicker="openPicker",e.openShareSheet="openShareSheet",e.openPreview="openPreview"}(I||(I={})),function(e){e.animation="application/vnd.adobe.element.animation+dcx",e.audio="application/vnd.adobe.element.audio+dcx",e.brush="application/vnd.adobe.element.brush+dcx",e.characterstyle="application/vnd.adobe.element.characterstyle+dcx",e.color="application/vnd.adobe.element.color+dcx",e.colortheme="application/vnd.adobe.element.colortheme+dcx",e.component="application/vnd.adobe.element.component+dcx",e.font="application/vnd.adobe.element.font+dcx",e.gradient="application/vnd.adobe.element.gradient+dcx",e.graphic="application/vnd.adobe.element.image+dcx",e.layerstyle="application/vnd.adobe.element.layerstyle+dcx",e.light="application/vnd.adobe.element.light+dcx",e.look="application/vnd.adobe.element.look+dcx",e.material="application/vnd.adobe.element.material+dcx",e.model="application/vnd.adobe.element.3d+dcx",e.mogrt="application/vnd.adobe.element.graphic+dcx",e.multicolorswatch="application/vnd.adobe.element.multicolorswatch+dcx",e.paragraphstyle="application/vnd.adobe.element.paragraphstyle+dcx",e.pattern="application/vnd.adobe.element.pattern+dcx",e.template="application/vnd.adobe.element.template+dcx",e.text="application/vnd.adobe.element.text+dcx",e.video="application/vnd.adobe.element.video+dcx",e.artifact="application/vnd.adobe.element.artifact+dcx"}(E||(E={})),function(e){e.primary="primary",e.rendition="rendition"}(T||(T={})),function(e){e[e.InSync=0]="InSync",e[e.OutOfSync=1]="OutOfSync",e[e.SyncConflict=2]="SyncConflict",e[e.SyncError=3]="SyncError",e[e.Syncing=4]="Syncing"}(S||(S={})),function(e){e[e.None=0]="None",e[e.CloudContentCorrupted=1]="CloudContentCorrupted",e[e.LocalContentCorrupted=2]="LocalContentCorrupted",e[e.HasTooManyComponents=3]="HasTooManyComponents",e[e.HasTooManyChildren=4]="HasTooManyChildren",e[e.MaximumSizeExceeded=5]="MaximumSizeExceeded",e[e.Unknown=6]="Unknown"}(A||(A={})),function(e){e[e.NoErr=0]="NoErr",e[e.Conflict=1]="Conflict",e[e.DeleteConflict=2]="DeleteConflict",e[e.ParentDeletedConflict=3]="ParentDeletedConflict"}(P||(P={})),function(e){e[e.Initializing=0]="Initializing",e[e.Offline=1]="Offline",e[e.NotStarted=2]="NotStarted",e[e.Disabled=3]="Disabled",e[e.Synchronized=4]="Synchronized",e[e.InProgress=5]="InProgress",e[e.ErrorQuotaExceeded=6]="ErrorQuotaExceeded",e[e.ErrorSyncDown=7]="ErrorSyncDown",e[e.ErrorOther=8]="ErrorOther"}(w||(w={})),function(e){e[e.Offline=0]="Offline",e[e.Wan=1]="Wan",e[e.Cellular=2]="Cellular",e[e.OnlineUnknown=3]="OnlineUnknown"}(C||(C={})),function(e){e.Text="text",e.AssetLink="assetLink"}(R||(R={})),function(e){e.OWNER="OWNER",e.POSTER="POSTER",e.VIEWER="VIEWER",e.UNKNOWN="UNKNOWN"}(L||(L={})),function(e){e.CLASSROOM="classroom"}(N||(N={})),function(e){e.Size50="50",e.Size100="100",e.Size115="115",e.Size230="230",e.Size138="138",e.Size276="276"}(D||(D={})),function(e){e[e.Stage=0]="Stage",e[e.Production=1]="Production"}(M||(M={})),function(e){e[e.NotStarted=1]="NotStarted",e[e.HadLoaderErrors=2]="HadLoaderErrors",e[e.Loading=3]="Loading",e[e.ReadyHasMorePages=4]="ReadyHasMorePages",e[e.ReadyFullyLoaded=5]="ReadyFullyLoaded"}(x||(x={})),function(e){e[e.Ascending=0]="Ascending",e[e.Descending=1]="Descending"}(k||(k={})),function(e){e[e.Name=0]="Name",e[e.Modified=1]="Modified",e[e.Created=2]="Created",e[e.Shared=3]="Shared"}(H||(H={})),function(e){e[e.Off=0]="Off",e[e.Err=1]="Err",e[e.Warn=2]="Warn",e[e.Info=3]="Info",e[e.Debug=4]="Debug"}(j||(j={})),function(e){e[e.UNKNOWN=1]="UNKNOWN",e[e.FULL_LOCAL_DISK_SPACE=2]="FULL_LOCAL_DISK_SPACE",e[e.FULL_CLOUD_STORAGE=3]="FULL_CLOUD_STORAGE",e[e.DEVICE_OFFLINE=4]="DEVICE_OFFLINE",e[e.NETWORK_ERROR=5]="NETWORK_ERROR",e[e.REQUEST_TIMED_OUT=6]="REQUEST_TIMED_OUT",e[e.USER_CANCELLED=7]="USER_CANCELLED",e[e.CORESYNC_FAILURE=8]="CORESYNC_FAILURE",e[e.SYNC_PAUSED=9]="SYNC_PAUSED",e[e.USER_ALREADY_REGISTERED=10]="USER_ALREADY_REGISTERED",e[e.PENDING_UNCOMMITTED_CHANGES_FROM_THIS_APP=11]="PENDING_UNCOMMITTED_CHANGES_FROM_THIS_APP",e[e.PENDING_UNCOMMITTED_CHANGES_FROM_ANOTHER_APP=12]="PENDING_UNCOMMITTED_CHANGES_FROM_ANOTHER_APP",e[e.INTERNAL_ERROR=13]="INTERNAL_ERROR",e[e.OPERATION_IGNORED=14]="OPERATION_IGNORED",e[e.CONFLICT=15]="CONFLICT",e[e.ACCESS_DENIED=16]="ACCESS_DENIED",e[e.UNSUPPORTED=17]="UNSUPPORTED",e[e.ASSET_NOT_IN_SYNC=18]="ASSET_NOT_IN_SYNC",e[e.BAD_REQUEST=19]="BAD_REQUEST",e[e.SYNC_ERROR=20]="SYNC_ERROR",e[e.NOT_FOUND=21]="NOT_FOUND",e[e.AUTHORIZATION_ERROR=22]="AUTHORIZATION_ERROR",e[e.INVALID_OPERATION=23]="INVALID_OPERATION",e[e.INVALID_CONTEXT=24]="INVALID_CONTEXT",e[e.COMMIT_ERROR=25]="COMMIT_ERROR",e[e.PARENT_NOT_FOUND=26]="PARENT_NOT_FOUND",e[e.PARENT_DISCARDED=27]="PARENT_DISCARDED",e[e.PROJECT_LIMIT_EXCEEDED=28]="PROJECT_LIMIT_EXCEEDED",e[e.SERVICE_NOT_PROVISIONED=29]="SERVICE_NOT_PROVISIONED",e[e.TRANSFER_OF_OWNERSHIP_DISABLED=30]="TRANSFER_OF_OWNERSHIP_DISABLED",e[e.MOVES_FROM_ORG_DISALLOWED=31]="MOVES_FROM_ORG_DISALLOWED"}(U||(U={})),function(e){e[e.NONE=0]="NONE",e[e.CORESYNC_NOT_REACHABLE=1]="CORESYNC_NOT_REACHABLE",e[e.CORESYNC_NOT_COMPATIBLE=2]="CORESYNC_NOT_COMPATIBLE",e[e.CORESYNC_BINARY_NOT_FOUND=3]="CORESYNC_BINARY_NOT_FOUND",e[e.CORESYNC_NOT_INSTALLED=4]="CORESYNC_NOT_INSTALLED",e[e.SYNC_FAILED=5]="SYNC_FAILED",e[e.SYNC_FAILED_EDIT_EDIT_RESOLVED=6]="SYNC_FAILED_EDIT_EDIT_RESOLVED",e[e.SYNC_FAILED_EDIT_DELETE_RESOLVED=7]="SYNC_FAILED_EDIT_DELETE_RESOLVED",e[e.COMMIT_ON_ORPHAN_ERROR=8]="COMMIT_ON_ORPHAN_ERROR",e[e.PROJECTS_ADMIN_ONLY=9]="PROJECTS_ADMIN_ONLY",e[e.PROJECTS_INVALID_REPOSITORY=10]="PROJECTS_INVALID_REPOSITORY",e[e.PROJECTS_NO_HOME_REPOSITORY=11]="PROJECTS_NO_HOME_REPOSITORY"}(B||(B={})),function(e){e.LIMIT_CHANGELOGRETENTION="http://ns.adobe.com/adobecloud/problem/limit/changelogretention",e.OPERATION_FAILED="adobecloud/problem/operation_failed",e.SUBSCRIPTION_COUNT="http://ns.adobe.com/adobecloud/problem/limit/subscriptioncount",e.QUOTA_EXCEEDED="http://ns.adobe.com/adobecloud/problem/quotaexceeded",e.CHILDREN_LIMIT_EXCEEDED="http://ns.adobe.com/adobecloud/problem/limit/childrencount",e.NO_HOME_REPOSITORY="http://ns.adobe.com/projects/problem/no-home-repository",e.INVALID_HOME_REPOSITORY="http://ns.adobe.com/projects/problem/invalid-repository",e.ADMIN_ONLY="http://ns.adobe.com/projects/problem/admin-only",e.ACCESS_DENIED="http://ns.adobe.com/adobecloud/problem/accessdenied"}(F||(F={})),function(e){e[e.authLoggedOut=0]="authLoggedOut",e[e.authLoggedIn=1]="authLoggedIn",e[e.authExpired=2]="authExpired"}(V||(V={})),function(e){e.DRAFT="draft",e.READY="ready",e.PUBLISHED="published",e.UNPUBLISHED="unpublished",e.QUEUED="queued",e.TRAINING="training",e.FAILED="failed",e.CANCELLED="cancelled",e.ALL="all"}(K||(K={})),function(e){e.MODIFY_DATE="modifyDate",e.CREATE_DATE="createDate",e.NAME="name"}(G||(G={})),function(e){e.NEVER="never",e.PUBLISHED="published",e.UNPUBLISHED="unpublished",e.DRAFT="draft",e.READY="ready",e.QUEUED="queued",e.TRAINING="training",e.FAILED="failed",e.CANCELLED="cancelled",e.ALL="all"}($||($={})),function(e){e.MODIFY_DATE="modified_date",e.CREATE_DATE="created_date",e.NAME="name"}(W||(W={})),function(e){e.PRIMARY="http://ns.adobe.com/adobecloud/rel/primary",e.ID="http://ns.adobe.com/adobecloud/rel/id",e.PATH="http://ns.adobe.com/adobecloud/rel/path",e.RENDITION="http://ns.adobe.com/adobecloud/rel/rendition",e.COMPONENT_RENDITION="http://ns.adobe.com/adobecloud/rel/componentRendition",e.MANIFEST="http://ns.adobe.com/adobecloud/rel/manifest",e.QUOTA="http://ns.adobe.com/adobecloud/rel/quota",e.COMPONENT="http://ns.adobe.com/adobecloud/rel/component",e.PAGE="http://ns.adobe.com/adobecloud/rel/page",e.DISCARD="http://ns.adobe.com/adobecloud/rel/discard",e.RESTORE="http://ns.adobe.com/adobecloud/rel/restore",e.DIRECTORY="http://ns.adobe.com/adobecloud/rel/directory",e.DIRECTORY_BASE="http://ns.adobe.com/adobecloud/rel/directory/base",e.AC_EFFECTIVE="http://ns.adobe.com/adobecloud/rel/ac/effective",e.AC_POLICY="http://ns.adobe.com/adobecloud/rel/ac/policy",e.AC_CHECK="http://ns.adobe.com/adobecloud/rel/ac/check",e.CREATE="http://ns.adobe.com/adobecloud/rel/create",e.REPOSITORY="http://ns.adobe.com/adobecloud/rel/repository",e.RESOLVE_ID="http://ns.adobe.com/adobecloud/rel/resolve/id",e.RESOLVE_PATH="http://ns.adobe.com/adobecloud/rel/resolve/path",e.OPS="http://ns.adobe.com/adobecloud/rel/ops",e.BLOCK_INITIALIZE="http://ns.adobe.com/adobecloud/rel/block/init",e.BLOCK_TRANSFER="http://ns.adobe.com/adobecloud/rel/block/transfer",e.BLOCK_FINALIZE="http://ns.adobe.com/adobecloud/rel/block/finalize",e.REPO_METADATA="http://ns.adobe.com/adobecloud/rel/metadata/repository",e.APP_METADATA="http://ns.adobe.com/adobecloud/rel/metadata/application",e.EMBEDDED_METADATA="http://ns.adobe.com/adobecloud/rel/metadata/embedded",e.PERUSER_METADATA="http://ns.adobe.com/adobecloud/rel/metadata/peruser",e.ANNOTATIONS="http://ns.adobe.com/adobecloud/rel/annotations",e.DOWNLOAD="http://ns.adobe.com/adobecloud/rel/download",e.DESCRIBED_BY="describedBy",e.VERSION="version-history",e.SUBSCRIPTION_CREATE="subscription/create",e.NOTIFICATIONS_LONGPOLL="notifications/longpoll",e.ONS_CHANGELOG="ons/changelog",e.REPOSITORIES_PAGE="http://ns.adobe.com/repositories/rel/page",e.TEAMS_CREATE="http://ns.adobe.com/teams/rel/create",e.TEAMS_DISCARD="http://ns.adobe.com/teams/rel/discard",e.TEAMS_RESTORE="http://ns.adobe.com/teams/rel/restore",e.TEAMS_RENAME="http://ns.adobe.com/teams/rel/rename",e.TEAMS_PROPERTIES="http://ns.adobe.com/teams/rel/properties",e.TEAMS_PAGE="http://ns.adobe.com/teams/rel/page",e.TEAMS_PRIMARY="http://ns.adobe.com/teams/rel/primary",e.TEAM_PROVISION="http://ns.adobe.com/teams/rel/provision",e.WORKSPACES_CONTEXT="http://ns.adobe.com/ccprojects/rel/context",e.WORKSPACES_BOOKMARKS_BATCH="http://ns.adobe.com/ccprojects/rel/bookmarks/batch",e.WORKSPACES_PRIMARY="http://ns.adobe.com/ccprojects/rel/primary",e.WORKSPACES_CREATE="http://ns.adobe.com/ccprojects/rel/create",e.WORKSPACES_PAGE="http://ns.adobe.com/ccprojects/rel/page",e.PROJECTS_LIBRARIES_PAGE="http://ns.adobe.com/ccprojects/rel/libraries/page",e.PROJECTS_LIBRARIES_CREATE="http://ns.adobe.com/ccprojects/rel/libraries/create",e.PROJECTS_LIBRARIES_BATCH="http://ns.adobe.com/ccprojects/rel/libraries/batch",e.GENERIC_PAGE="page",e.GENERIC_NEXT="next",e.ATS_MOVE="http://ns.adobe.com/ats/rel/move",e.REVIEW_SERVICE_PROVISION="http://ns.adobe.com/ccassetreview/rel/provision",e.REVIEW_SERVICE_DISCARD="http://ns.adobe.com/ccassetreview/rel/discard",e.REVIEW_SERVICE_OUTPUTS="http://ns.adobe.com/ccassetreview/rel/outputs",e.REVIEW_SERIVCE_HAS_OUTPUTS="http://ns.adobe.com/ccassetreview/rel/hasoutputs",e.PROJECTS_CONTEXT="http://ns.adobe.com/projects/rel/context",e.PROJECTS_PRIMARY="http://ns.adobe.com/projects/rel/primary",e.PROJECTS_COLLECTION="http://ns.adobe.com/projects/rel/collection",e.PROJECTS_CREATE="http://ns.adobe.com/projects/rel/create",e.PROJECTS_RENAME="http://ns.adobe.com/projects/rel/rename",e.PROJECTS_CREATOR="http://ns.adobe.com/projects/rel/creator",e.PROJECTS_GRADIENTS_COLLECTION="http://ns.adobe.com/gradients/rel/collection",e.PROJECTS_CAPABILITY="http://ns.adobe.com/projects/rel/capability",e.ORGANIZATIONS_COLLECTION="http://ns.adobe.com/organizations/rel/collection",e.PROJECTS_RECENT="http://ns.adobe.com/projects/rel/recent",e.PROJECTS_REFERENCE_CREATE="http://ns.adobe.com/projects/rel/references/create",e.PROJECTS_REFERENCE_PRIMARY="http://ns.adobe.com/projects/rel/references/primary",e.ASSIGNMENTS_ASSIGN="http://ns.adobe.com/assignments/rel/assign",e.ASSIGNMENTS_CODE="http://ns.adobe.com/assignments/rel/code",e.ASSIGNMENTS_COLLECTION="http://ns.adobe.com/assignments/rel/collection",e.ASSIGNMENTS_CREATE="http://ns.adobe.com/assignments/rel/create",e.ASSIGNMENTS_PRIMARY="http://ns.adobe.com/assignments/rel/primary",e.ASSIGNMENTS_RETURN="http://ns.adobe.com/assignments/rel/return",e.ASSIGNMENTS_START="http://ns.adobe.com/assignments/rel/start",e.ASSIGNMENTS_SUBMIT="http://ns.adobe.com/assignments/rel/submit",e.STUDENT_ASSIGNMENTS_COLLECTION="http://ns.adobe.com/studentAssignments/rel/collection",e.STUDENT_ASSIGNMENTS_PRIMARY="http://ns.adobe.com/studentAssignments/rel/primary"}(z||(z={})),function(e){e.GRADIENT_ID="/project:rendition/gradientId"}(q||(q={})),function(e){e[e.All=0]="All",e[e.Yours=1]="Yours",e[e.SWY=2]="SWY",e[e.Admin=3]="Admin",e[e.Organization=4]="Organization",e[e.Recent=5]="Recent"}(Y||(Y={})),function(e){e.CREATE="create"}(Q||(Q={})),function(e){e[e.PENDING=0]="PENDING",e[e.CAN_LEAVE=1]="CAN_LEAVE",e[e.CANNOT_LEAVE_NO_COLLABORATORS=2]="CANNOT_LEAVE_NO_COLLABORATORS",e[e.CANNOT_LEAVE_ADDRESS_BOOK_GROUP_MEMBER=3]="CANNOT_LEAVE_ADDRESS_BOOK_GROUP_MEMBER",e[e.CANNOT_LEAVE_LAST_COLLABORATOR=4]="CANNOT_LEAVE_LAST_COLLABORATOR",e[e.CANNOT_LEAVE_LAST_DIRECT_COLLABORATOR=5]="CANNOT_LEAVE_LAST_DIRECT_COLLABORATOR",e[e.CANNOT_LEAVE_IS_ADMIN_OF_PROJECT=6]="CANNOT_LEAVE_IS_ADMIN_OF_PROJECT",e[e.CANNOT_LEAVE_LAST_DIRECT_COLLAB_WITH_SHARE_PERMISSION=7]="CANNOT_LEAVE_LAST_DIRECT_COLLAB_WITH_SHARE_PERMISSION",e[e.CANNOT_LEAVE_IS_OWNER=8]="CANNOT_LEAVE_IS_OWNER"}(J||(J={})),function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.ALLOWED=1]="ALLOWED",e[e.ADMIN_DISABLED=2]="ADMIN_DISABLED",e[e.INVALID_REPOSITORY=3]="INVALID_REPOSITORY",e[e.NO_HOME_REPOSITORY=4]="NO_HOME_REPOSITORY"}(X||(X={})),function(e){e.WF_PORTFOLIO="wfPortfolio",e.WF_PROGRAM="wfProgram",e.WF_PROJECT="wfProject",e.WF_TEMPLATE="wfProjectTemplate",e.CC_PROJECTS="ccProject"}(Z||(Z={})),function(e){e[e.None=0]="None",e[e.Ack=1]="Ack",e[e.Read=2]="Read",e[e.Write=4]="Write",e[e.Delete=8]="Delete",e[e.Share=16]="Share",e[e.Rename=32]="Rename",e[e.Move=64]="Move",e[e.Discard=128]="Discard",e[e.Restore=256]="Restore",e[e.Duplicate=512]="Duplicate",e[e.ReadAppMetadata=1024]="ReadAppMetadata",e[e.WriteComment=2048]="WriteComment"}(ee||(ee={})),function(e){e.DRAFT="DRAFT",e.ASSIGNED="ASSIGNED"}(te||(te={})),function(e){e.ANY="ANY",e.NONE="NONE",e.SELF="SELF"}(ie||(ie={})),(je=se||(se={})).albumCover="album-cover",je.animatedCharacter="animated-character",je.bannerPrint="banner-print",je.bannerWeb="banner-web",je.blogGraphic="blog-graphic",je.blogHeader="blog-header",je.bookCover="book-cover",je.bookmark="bookmark",je.brochure="brochure",je.businessCard="business-card",je.calendar="calendar",je.cardGreeting="card-greeting",je.certificate="certificate",je.checklist="checklist",je.classSchedule="class-schedule",je.comicStrip="comic-strip",je.conceptMap="concept-map",je.couponSheet="coupon-sheet",je.coverPage="cover-page",je.deviceCameraRecording="device-camera-recording",je.displayAd="display-ad",je.dividerPage="divider-page",je.drawing="drawing",je.drawingWorksheet="drawing-worksheet",je.ebookCover="ebook-cover",je.emailHeader="email-header",je.etsyShopBanner="etsy-shop-banner",je.etsyShopCover="etsy-shop-cover",je.eventbriteHeader="eventbrite-header",je.facebookAd="facebook-ad",je.facebookEventCover="facebook-event-cover",je.facebookGroupCover="facebook-group-cover",je.facebookPageCover="facebook-page-cover",je.facebookPost="facebook-post",je.facebookProfileCover="facebook-profile-cover",je.facebookShopCover="facebook-shop-cover",je.facebookStory="facebook-story",je.flashCard="flash-card",je.flashCardSheet="flash-card-sheet",je.flyer="flyer",je.generatedImage="generated-image",je.giftCertificate="gift-certificate",je.giftTag="gift-tag",je.googleClassroomBanner="google-classroom-banner",je.graph="graph",je.graphicOrganizer="graphic-organizer",je.idCard="id-card",je.infographic="infographic",je.instagramAd="instagram-ad",je.instagramCarousel="instagram-carousel",je.instagramLandscapePost="instagram-landscape-post",je.instagramPortraitPost="instagram-portrait-post",je.instagramReel="instagram-reel",je.instagramSquarePost="instagram-square-post",je.instagramStory="instagram-story",je.instagramStoryAd="instagram-story-ad",je.invitation="invitation",je.invoice="invoice",je.journal="journal",je.label="label",je.labelSheet="label-sheet",je.leafletTrifold="leaflet-trifold",je.lessonPlan="lesson-plan",je.letter="letter",je.letterhead="letterhead",je.lineAdSmall="line-ad-small",je.lineAdSquare="line-ad-square",je.lineAdSquareVideo="line-ad-square-video",je.lineAdVertical="line-ad-vertical",je.lineRichMenuLarge="line-rich-menu-large",je.lineRichMenuSmall="line-rich-menu-small",je.lineRichMessage="line-rich-message",je.linkedinBlogPost="linkedin-blog-post",je.linkedinPost="linkedin-post",je.linkedinProfileCover="linkedin-profile-cover",je.logo="logo",je.magazine="magazine",je.mediaKit="media-kit",je.meme="meme",je.memo="memo",je.menu="menu",je.mindmap="mindmap",je.mobileVideo="mobile-video",je.mug="mug",je.nameTag="name-tag",je.newsletter="newsletter",je.noteHeaderImage="note-header-image",je.onlineNewsletter="online-newsletter",je.onlineReport="online-report",je.pamphlet="pamphlet",je.photoBook="photo-book",je.pinterestIdeaPin="pinterest-idea-pin",je.pinterestPost="pinterest-post",je.pinterestSquare="pinterest-square",je.pinterestVertical="pinterest-vertical",je.placeCard="place-card",je.planner="planner",je.playlistCover="playlist-cover",je.podcastCover="podcast-cover",je.postcard="postcard",je.poster="poster",je.presentation="presentation",je.printAd="print-ad",je.program="program",je.proposal="proposal",je.recipeCard="recipe-card",je.redditCover="reddit-cover",je.report="report",je.reportCard="report-card",je.resume="resume",je.rubric="rubric",je.snapchatAd="snapchat-ad",je.snapchatFilter="snapchat-filter",je.soundcloudBanner="soundcloud-banner",je.tableOfContents="table-of-contents",je.ticket="ticket",je.tiktokAd="tiktok-ad",je.tiktokVideo="tiktok-video",je.tshirt="tshirt",je.tumblrBanner="tumblr-banner",je.twitchBanner="twitch-banner",je.twitchOverlay="twitch-overlay",je.twitterHeader="twitter-header",je.twitterPost="twitter-post",je.twitterVideo="twitter-video",je.video="video",je.wallpaperDesktop="wallpaper-desktop",je.wallpaperMobile="wallpaper-mobile",je.webpage="webpage",je.webpageJournal="webpage-journal",je.worksheet="worksheet",je.youtubeBanner="youtube-banner",je.youtubeDisplayAds="youtube-display-ads",je.youtubeProfilePhoto="youtube-profile-photo",je.youtubeShorts="youtube-shorts",je.youtubeThumbnail="youtube-thumbnail",je.youtubeVideo="youtube-video",je.youtubeVideoAd="youtube-video-ad",je.zoomBackground="zoom-background",function(e){e.STUDENT="student",e.TEACHER="teacher",e.NONE="none"}(re||(re={})),function(e){e.ACTIVE="ACTIVE",e.DECLINED="DECLINED",e.INACTIVE="INACTIVE",e.INVITED="INVITED",e.IN_REVIEW="IN_REVIEW",e.NOT_A_MEMBER="NOT_A_MEMBER",e.OWNER="OWNER"}(ne||(ne={})),function(e){e.CLASSLINK="CLASSLINK",e.CLEVER="CLEVER",e.EMAIL="EMAIL",e.GOOGLE_CLASSROOM="GOOGLE_CLASSROOM",e.NONE="NONE"}(oe||(oe={})),function(e){e.GC="GC"}(ae||(ae={})),function(e){e.STUDENT="STUDENT",e.TEACHER="TEACHER"}(ce||(ce={})),function(e){e.BLOCKED="BLOCKED",e.INVITED="INVITED",e.JOINED="JOINED",e.NOT_ENROLLED="NOT_ENROLLED",e.REMOVED="REMOVED"}(le||(le={})),function(e){e.CLEVER="clever",e.CLASS_LINK="classlink"}(de||(de={})),function(e){e.ACTIVE="ACTIVE",e.ARCHIVED="ARCHIVED"}(ue||(ue={})),function(e){e.TRUE="TRUE",e.RESTRICTED="RESTRICTED",e.UNRESTRICTED="UNRESTRICTED",e.NONE="NONE"}(he||(he={})),function(e){e.noSubject="",e.allsubjects="allsubjects",e.careersTechnicalEducation="careersTechnicalEducation",e.computerScience="computerScience",e.english="english",e.math="math",e.otherLanguages="otherLanguages",e.others="others",e.science="science",e.socialStudies="socialStudies",e.visualPerformingArts="visualPerformingArts"}(pe||(pe={})),function(e){e.STUDENT="STUDENT",e.TEACHER="TEACHER"}(_e||(_e={})),function(e){e.REMOVE_STUDENT_SUCCESS="REMOVE_STUDENT_SUCCESS",e.BLOCK_STUDENT_SUCCESS="BLOCK_STUDENT_SUCCESS",e.UNBLOCK_STUDENT_SUCCESS="UNBLOCK_STUDENT_SUCCESS",e.DELETE_DOMAIN_MAPPING_ACCEPTED="DELETE_DOMAIN_MAPPING_ACCEPTED",e.REMOVE_TEACHER_SUCCESS="REMOVE_TEACHER_SUCCESS"}(me||(me={})),function(e){e.OWNER="OWNER",e.ACTIVE="ACTIVE",e.INACTIVE="INACTIVE",e.INVITED="INVITED",e.IN_REVIEW="IN_REVIEW",e.DECLINED="DECLINED",e.NOT_A_MEMBER="NOT_A_MEMBER"}(fe||(fe={})),function(e){e.ALLOWED="ALLOWED",e.NOT_ALLOWED="NOT_ALLOWED"}(ge||(ge={})),function(e){e.ACCOUNT_NOT_FOUND="ACCOUNT_NOT_FOUND",e.STUDENT_IN_CLASSROOM="STUDENT_IN_CLASSROOM",e.TEACHER_IN_CLASSROOM="TEACHER_IN_CLASSROOM"}(ye||(ye={})),function(e){e.IMAGE="image",e.VIDEO="video",e.VECTOR="vector",e.AUDIO="audio"}(ve||(ve={})),function(e){e.CREATE_DATE="created_date"}(Oe||(Oe={})),function(e){e.QUEUED="queued",e.IN_PROGRESS="inProgress",e.SUCCESS="success",e.FAILED="failed",e.CANCELLED="cancelled"}(be||(be={})),function(e){e.MODIFIED_DATE="modified_date",e.CREATED_DATE="created_date",e.NAME="name"}(Ie||(Ie={})),function(e){e.Personal="private",e.Public="public",e.Incoming="incoming",e.Discovery="discovery",e.All="all"}(Ee||(Ee={})),function(e){e.All="all",e.None="none"}(Te||(Te={})),function(e){e.All="all",e.Only="only"}(Se||(Se={})),function(e){e.None="none",e.Brand="brand",e.TrainingSet="cm_training_set"}(Ae||(Ae={})),function(e){e.PublishedBrands="publishedBrands",e.AllBrands="allBrands",e.AllEditableBrands="allEditableBrands"}(Pe||(Pe={})),function(e){e[e.None=0]="None",e[e.CollaboratorMaybeEditing=1]="CollaboratorMaybeEditing",e[e.OwnerChange=2]="OwnerChange"}(we||(we={})),function(e){e[e.DifferentOwner=1]="DifferentOwner",e[e.PermissionDeniedDestination=2]="PermissionDeniedDestination",e[e.PermissionDeniedSource=3]="PermissionDeniedSource",e[e.NotAFolder=4]="NotAFolder",e[e.CrossBucketMoveDisabled=5]="CrossBucketMoveDisabled"}(Ce||(Ce={})),function(e){e.NOT_STARTED="NOT_STARTED",e.IN_PROGRESS="IN_PROGRESS",e.RETURNED="RETURNED",e.SUBMITTED="SUBMITTED"}(Re||(Re={})),function(e){e.Any="ANY",e.Self="SELF"}(Le||(Le={})),function(e){e[e.NotStarted=0]="NotStarted",e[e.Fetching=1]="Fetching",e[e.Done=2]="Done",e[e.Error=3]="Error"}(Ne||(Ne={})),function(e){e[e.Size64=64]="Size64",e[e.Size128=128]="Size128",e[e.Size256=256]="Size256",e[e.Size512=512]="Size512",e[e.Size1024=1024]="Size1024"}(De||(De={})),function(e){e.PNG="image/png",e.JPEG="image/jpeg"}(Me||(Me={})),function(e){e.MOBILE="mobile",e.DESKTOP="desktop"}(xe||(xe={})),function(e){e.WEB="web",e.MOBILE="mobile"}(ke||(ke={})),function(e){e.OpenDocumentVersion="onOpenDocumentVersion",e.OpenDeepLinkVersion="onOpenDeepLinkVersion",e.VersionSelection="onVersionSelection",e.RestoreVersion="onRestoreVersion",e.Upgrade="onUpgrade",e.CreateCopy="onCreateCopy",e.Refresh="onRefresh",e.ModeChange="onModeChange",e.ThemeChange="onThemeChange",e.ClosePanel="onClosePanel",e.Error="onError",e.VersionBookmark="onVersionBookmark",e.VersionUnBookmark="onVersionUnBookmark",e.VersionBookmarkStart="onVersionBookmarkStart",e.VersionUnBookmarkStart="onVersionUnBookmarkStart",e.PermanentlyDeleteScreen="onPermanentlyDeleteScreen",e.PermanentlyDeleteVersion="onPermanentlyDeleteVersion",e.VersioningPanelLoadComplete="onVersioningPanelLoadComplete",e.PreviewThumbnailReceived="onPreviewThumbnailReceived"}(He||(He={}));const Be=U,Fe=B,Ve=new Map([[401,{code:Be.AUTHORIZATION_ERROR,message:e=>`Authorization error: ${e}`}],[403,{code:Be.ACCESS_DENIED,message:e=>`Access to resource denied: ${e}`}],[404,{code:Be.NOT_FOUND,message:e=>`Resource not found: ${e}`}],[409,{code:Be.CONFLICT,message:()=>"Resource has a naming conflict."}],[412,{code:Be.CONFLICT,message:()=>"Resource has a conflict. Etag mismatch."}]]);function Ke(e){for("string"==typeof e&&(e=parseInt(e)),e=Math.floor(e);e>999;)e=Math.floor(e/10);return e}var Ge;!function(e){e.LIMIT_CHANGELOGRETENTION="http://ns.adobe.com/adobecloud/problem/limit/changelogretention",e.OPERATION_FAILED="adobecloud/problem/operation_failed",e.SUBSCRIPTION_COUNT="http://ns.adobe.com/adobecloud/problem/limit/subscriptioncount",e.QUOTA_EXCEEDED="http://ns.adobe.com/adobecloud/problem/quotaexceeded",e.CHILDREN_LIMIT_EXCEEDED="http://ns.adobe.com/adobecloud/problem/limit/childrencount",e.NO_HOME_REPOSITORY="http://ns.adobe.com/projects/problem/no-home-repository",e.INVALID_HOME_REPOSITORY="http://ns.adobe.com/projects/problem/invalid-repository",e.ADMIN_ONLY="http://ns.adobe.com/projects/problem/admin-only",e.ACCESS_DENIED="http://ns.adobe.com/adobecloud/problem/accessdenied",e.LAST_VERSION_LEFT="http://ns.adobe.com/adobecloud/problem/noversionleft"}(Ge||(Ge={}));const $e="SAMError";class We extends Error{constructor(e,t,i={},s){const r=`[${Be[e]}${void 0===s?"":"-"+Fe[s]}] ${t}${function(e){let t="";if(null!=e)try{t=` -> ${String(e)}`}catch(e){}return t}(i.underlyingError)}`;void 0!==i.underlyingError?super(r,{cause:i.underlyingError}):super(r),this.code=e,this.subCode=s,this.description=t,this._additionalInfo=i}get name(){return $e}static wrapErrorIfNeeded(e,t,i,s){return i instanceof We?i:new We(e,t,{underlyingError:i},s)}static create(e,t,i,s){return new We(e,t,i,s)}static createWithResponse(e,t){var i,s;const{status:r}=e,n=Ve.get(Ke(r)),o=null!=t?t:e.url,a=e.headers.get("X-Request-Id")||"",c=e.headers.get("X-Breadcrumb-Trail")||"";return new We(null!==(i=null==n?void 0:n.code)&&void 0!==i?i:Be.UNKNOWN,(null!==(s=null==n?void 0:n.message(null!=t?t:o))&&void 0!==s?s:`Unexpected response status: ${r} for ${o}`)+` reqId: ${a} breadcrumbTrail: ${c}`,{response:e,reqId:a,breadcrumbTrail:c},null==n?void 0:n.subCode)}static createWithResponseAndDescription(e,t){var i;const s=Ve.get(Ke(e.status));return new We(null!==(i=null==s?void 0:s.code)&&void 0!==i?i:Be.UNKNOWN,t,{response:e},null==s?void 0:s.subCode)}static createWithRepositoryCode(e,t,i){var s;if(t===Ge.QUOTA_EXCEEDED)return new We(Be.FULL_CLOUD_STORAGE,i,{problemType:t});const r=Ke(e),n=e?Ve.get(r):void 0;return new We(null!==(s=null==n?void 0:n.code)&&void 0!==s?s:Be.UNKNOWN,i,{problemType:t},null==n?void 0:n.subCode)}static createWithApolloError(e){var t;if(e.networkError){const t=e.networkError.response;if(t)return We.createWithResponse(t)}return(null===(t=e.graphQLErrors)||void 0===t?void 0:t.length)>0?We.createWithGraphQLError(e.graphQLErrors[0]):We.create(Be.UNKNOWN,e.message)}static createWithGraphQLError(e){var t;const i=e.extensions;return i?We.createWithRepositoryCode(i.httpErrorCode,null===(t=i.problemType)||void 0===t?void 0:t.type,e.message):We.create(Be.UNKNOWN,e.message)}}function ze(e){return e&&e.name===$e}function qe(e,t){var i={};for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&t.indexOf(s)<0&&(i[s]=e[s]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(s=Object.getOwnPropertySymbols(e);r<s.length;r++)t.indexOf(s[r])<0&&Object.prototype.propertyIsEnumerable.call(e,s[r])&&(i[s[r]]=e[s[r]])}return i}function Ye(e,t,i,s){var r,n=arguments.length,o=n<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,i,s);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(o=(n<3?r(o):n>3?r(t,i,o):r(t,i))||o);return n>3&&o&&Object.defineProperty(t,i,o),o}function Qe(e,t){return function(i,s){t(i,s,e)}}function Je(e){return this instanceof Je?(this.v=e,this):new Je(e)}function Xe(e,t,i){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var s,r=i.apply(e,t||[]),n=[];return s={},o("next"),o("throw"),o("return"),s[Symbol.asyncIterator]=function(){return this},s;function o(e){r[e]&&(s[e]=function(t){return new Promise((function(i,s){n.push([e,t,i,s])>1||a(e,t)}))})}function a(e,t){try{(i=r[e](t)).value instanceof Je?Promise.resolve(i.value.v).then(c,l):d(n[0][2],i)}catch(e){d(n[0][3],e)}var i}function c(e){a("next",e)}function l(e){a("throw",e)}function d(e,t){e(t),n.shift(),n.length&&a(n[0][0],n[0][1])}}function Ze(e){var t,i;return t={},s("next"),s("throw",(function(e){throw e})),s("return"),t[Symbol.iterator]=function(){return this},t;function s(s,r){t[s]=e[s]?function(t){return(i=!i)?{value:Je(e[s](t)),done:"return"===s}:r?r(t):t}:r}}function et(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,i=e[Symbol.asyncIterator];return i?i.call(e):(e=function(e){var t="function"==typeof Symbol&&Symbol.iterator,i=t&&e[t],s=0;if(i)return i.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&s>=e.length&&(e=void 0),{value:e&&e[s++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}(e),t={},s("next"),s("throw"),s("return"),t[Symbol.asyncIterator]=function(){return this},t);function s(i){t[i]=e[i]&&function(t){return new Promise((function(s,r){!function(e,t,i,s){Promise.resolve(s).then((function(t){e({value:t,done:i})}),t)}(s,r,(t=e[i](t)).done,t.value)}))}}}const tt=Symbol("@key parameterMap");var it=(e,t,i)=>{const s=e[tt]=e[tt]||new Map;if(s.has(t))throw We.create(Be.BAD_REQUEST,"@key cannot be applied to more than one parameter");s.set(t,i)};function st(e){return(t,i,s)=>{const r=s.value;if(!r)throw We.create(Be.BAD_REQUEST,"@cache decorator can only be applied to a method");s.value=async function(...t){var s;const n=null===(s=this[tt])||void 0===s?void 0:s.get(i);if(void 0===n)throw We.create(Be.BAD_REQUEST,"@cache decorator requires one of the parameters to be labelled with @key");const o=t[n];return this._core._environment.cache.getItem(o,(()=>r.apply(this,t)),e)}}}function rt(e,t,i){return t?st()(e,t,i):st(e)}var nt=(e,t,i)=>{const s=Symbol(`@memoize ${t}`),r=i.get?"get":"value",n=i[r];i[r]=function(...e){return Object.prototype.hasOwnProperty.call(this,s)||(this[s]=n.call(this,...e)),this[s]}};class ot{constructor(e){this._type=e}get type(){return this._type}toString(){return`SAMEvent(${this._type})`}}const at="change";class ct extends ot{constructor(){super(at)}}const lt=new ct,dt=Symbol("$OBSERVABLE_MAP");function ut(e,t){return(i,s,r)=>{if((r.get||r.value)&&(null==t||t.forEach((t=>function(e,t,i){let s;Object.getOwnPropertyDescriptor(e,dt)?s=e[dt]:e[dt]?(s=new Map(e[dt]),e[dt]=s):(s=new Map,e[dt]=s),s.set(t,i)}(i,t,e)))),r.get){const t=r.get;r.get=function(){return this._core._environment.mobx.reportObserved(this,e.type),t.call(this)}}else{if(!r.value)throw new Error("@observable decorator can only be used with `getters` or `methods`.");{const t=r.value,i=function(...i){return this._core._environment.mobx.reportObserved(this,e.type),t.apply(this,i)};r.value=i}}}}function ht(e,t,i){if(e&&t&&i)return ut(lt)(e,t,i);if("string"==typeof e.type&&("string"==typeof t||void 0===t||Array.isArray(t)))return ut(e,t=t?[].concat(t):void 0);throw new Error("Invalid arguments for @observable")}var pt="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},_t={exports:{}};!function(e){!function(t,i){e.exports?e.exports=i():t.UriTemplate=i()}(pt,(function(){var e={"+":!0,"#":!0,".":!0,"/":!0,";":!0,"?":!0,"&":!0},t={"*":!0};function i(e){return encodeURI(e).replace(/%25[0-9][0-9]/g,(function(e){return"%"+e.substring(3)}))}function s(e){return e=e.replace(/%../g,""),encodeURIComponent(e)===e}function r(r){var n="";e[r.charAt(0)]&&(n=r.charAt(0),r=r.substring(1));var o="",a="",c=!0,l=!1,d=!1;"+"==n?c=!1:"."==n?(a=".",o="."):"/"==n?(a="/",o="/"):"#"==n?(a="#",c=!1):";"==n?(a=";",o=";",l=!0,d=!0):"?"==n?(a="?",o="&",l=!0):"&"==n&&(a="&",o="&",l=!0);for(var u=[],h=r.split(","),p=[],_={},m=0;m<h.length;m++){var f=h[m],g=null;if(-1!=f.indexOf(":")){var y=f.split(":");f=y[0],g=parseInt(y[1])}for(var v={};t[f.charAt(f.length-1)];)v[f.charAt(f.length-1)]=!0,f=f.substring(0,f.length-1);var O={truncate:g,name:f,suffices:v};p.push(O),_[f]=O,u.push(f)}return{varNames:u,prefix:a,substitution:function(e){for(var t="",s=0,r=0;r<p.length;r++){var n=p[r],u=e(n.name);if(null==u||Array.isArray(u)&&0==u.length||"object"==typeof u&&0==Object.keys(u).length)s++;else if(t+=r==s?a:o||",",Array.isArray(u)){l&&(t+=n.name+"=");for(var h=0;h<u.length;h++)h>0&&(t+=n.suffices["*"]&&o||",",n.suffices["*"]&&l&&(t+=n.name+"=")),t+=c?encodeURIComponent(u[h]).replace(/!/g,"%21"):i(u[h])}else if("object"==typeof u){l&&!n.suffices["*"]&&(t+=n.name+"=");var _=!0;for(var m in u)_||(t+=n.suffices["*"]&&o||","),_=!1,t+=c?encodeURIComponent(m).replace(/!/g,"%21"):i(m),t+=n.suffices["*"]?"=":",",t+=c?encodeURIComponent(u[m]).replace(/!/g,"%21"):i(u[m])}else l&&(t+=n.name,d&&""==u||(t+="=")),null!=n.truncate&&(u=u.substring(0,n.truncate)),t+=c?encodeURIComponent(u).replace(/!/g,"%21"):i(u)}return t},unSubstitution:function(e,t,i){if(a&&(e=e.substring(a.length)),1==p.length&&p[0].suffices["*"]){for(var r=(E=p[0]).name,n=E.suffices["*"]?e.split(o||","):[e],d=c&&-1!=e.indexOf("="),u=1;u<n.length;u++)e=n[u],d&&-1==e.indexOf("=")&&(n[u-1]+=(o||",")+e,n.splice(u,1),u--);for(u=0;u<n.length;u++)e=n[u],c&&-1!=e.indexOf("=")&&(d=!0),1==(y=e.split(",")).length?n[u]=y[0]:n[u]=y;if(l||d){for(var h=t[r]||{},m=0;m<n.length;m++){var f=e;if(!l||f){if("string"==typeof n[m]){var g=(e=n[m]).split("=",1)[0];if(e=e.substring(g.length+1),c){if(i&&!s(e))return;e=decodeURIComponent(e)}f=e}else{if(g=(e=n[m][0]).split("=",1)[0],e=e.substring(g.length+1),c){if(i&&!s(e))return;e=decodeURIComponent(e)}n[m][0]=e,f=n[m]}if(c){if(i&&!s(g))return;g=decodeURIComponent(g)}void 0!==h[g]?Array.isArray(h[g])?h[g].push(f):h[g]=[h[g],f]:h[g]=f}}1==Object.keys(h).length&&void 0!==h[r]?t[r]=h[r]:t[r]=h}else{if(c)for(m=0;m<n.length;m++){var y=n[m];if(Array.isArray(y))for(var v=0;v<y.length;v++){if(i&&!s(y[v]))return;y[v]=decodeURIComponent(y[v])}else{if(i&&!s(y))return;n[m]=decodeURIComponent(y)}}void 0!==t[r]?Array.isArray(t[r])?t[r]=t[r].concat(n):t[r]=[t[r]].concat(n):1!=n.length||E.suffices["*"]?t[r]=n:t[r]=n[0]}}else{n=1==p.length?[e]:e.split(o||",");var O={};for(u=0;u<n.length;u++){for(var b=0;b<p.length-1&&b<u&&!p[b].suffices["*"];b++);if(b!=u){for(var I=p.length-1;I>0&&p.length-I<n.length-u&&!p[I].suffices["*"];I--);p.length-I!=n.length-u?O[u]=b:O[u]=I}else O[u]=u}for(u=0;u<n.length;u++)if((e=n[u])||!l){if(y=e.split(","),d=!1,l){r=(e=y[0]).split("=",1)[0],e=e.substring(r.length+1),y[0]=e;var E=_[r]||p[0]}else r=(E=p[O[u]]).name;for(m=0;m<y.length;m++)if(c){if(i&&!s(y[m]))return;y[m]=decodeURIComponent(y[m])}(l||E.suffices["*"])&&void 0!==t[r]?Array.isArray(t[r])?t[r]=t[r].concat(y):t[r]=[t[r]].concat(y):1!=y.length||E.suffices["*"]?t[r]=y:t[r]=y[0]}}return 1}}}function n(e){if(!(this instanceof n))return new n(e);for(var t=e.split("{"),i=[t.shift()],s=[],o=[],a=[],c=[];t.length>0;){var l=t.shift(),d=l.split("}")[0],u=l.substring(d.length+1),h=r(d);o.push(h.substitution),a.push(h.unSubstitution),s.push(h.prefix),i.push(u),c=c.concat(h.varNames)}this.fill=function(e){if(e&&"function"!=typeof e){var t=e;e=function(e){return t[e]}}for(var s=i[0],r=0;r<o.length;r++)s+=(0,o[r])(e),s+=i[r+1];return s},this.fromUri=function(e,t){t=t||{};for(var r={},n=0;n<i.length;n++){var o=i[n];if(e.substring(0,o.length)!==o)return;if(e=e.substring(o.length),n>=i.length-1){if(""==e)break;return}var c=s[n];if(!c||e.substring(0,c.length)===c){for(var l=i[n+1],d=n;;){if(d==i.length-2){var u=e.substring(e.length-l.length);if(u!==l)return;var h=e.substring(0,e.length-l.length);e=u}else if(l){var p=e.indexOf(l);h=e.substring(0,p),e=e.substring(p)}else if(s[d+1])-1===(p=e.indexOf(s[d+1]))&&(p=e.length),h=e.substring(0,p),e=e.substring(p);else{if(i.length>d+2){d++,l=i[d+1];continue}h=e,e=""}break}if(!a[n](h,r,t.strict))return}}return r},this.varNames=c,this.template=e}return n.prototype={toString:function(){return this.template},fillFromObject:function(e){return this.fill(e)},test:function(e,t){return!!this.fromUri(e,t)}},n}))}(_t);var mt=_t.exports;const ft="application/json",gt="application/json-patch+json";var yt;function vt(e,t){if(void 0===e)return!0;if(Object(e)!==e)return!1;const i=Object.keys(e).some((t=>{const i=e[t];return Array.isArray(i)?i.some((({href:e})=>"string"!=typeof e)):"string"!=typeof i.href}));if(i)return!1;if(t){const i=Object.keys(t).every((i=>function(e,t,i){try{const s=bt(e,t),r=mt(s);return i.every((e=>-1!==r.varNames.indexOf(e)))}catch(e){return!1}}(e,i,t[i])));if(!i)return!1}return!0}function Ot(e,t){let i=e&&e[t];if(!i||Array.isArray(i)&&0===i.length)throw We.create(Be.BAD_REQUEST,`Missing link for relationship type: ${t}.`);return Array.isArray(i)&&(i=i[0]),i}function bt(e,t){return Ot(e,t).href}function It(e,t,i={}){const s=bt(e,t),r=mt(s),n=JSON.parse(JSON.stringify(i,((e,t)=>"boolean"==typeof t?t.toString():t)));return r&&r.fill(n)}function Et(e){const t=e&&e.get("Retry-After");if(t)try{const e=parseInt(t,10);if(e)return Math.max(0,e);const i=Date.parse(t);if(i){const e=Date.now();return Math.max(0,i-e)/1e3+Math.floor(30*Math.random())}}catch(e){}return 0}function Tt(e,t){return mt(`${e}{?queryParams*}`).fillFromObject({queryParams:t})}!function(e){e.PRIMARY="http://ns.adobe.com/adobecloud/rel/primary",e.ID="http://ns.adobe.com/adobecloud/rel/id",e.PATH="http://ns.adobe.com/adobecloud/rel/path",e.RENDITION="http://ns.adobe.com/adobecloud/rel/rendition",e.COMPONENT_RENDITION="http://ns.adobe.com/adobecloud/rel/componentRendition",e.MANIFEST="http://ns.adobe.com/adobecloud/rel/manifest",e.QUOTA="http://ns.adobe.com/adobecloud/rel/quota",e.COMPONENT="http://ns.adobe.com/adobecloud/rel/component",e.PAGE="http://ns.adobe.com/adobecloud/rel/page",e.DISCARD="http://ns.adobe.com/adobecloud/rel/discard",e.RESTORE="http://ns.adobe.com/adobecloud/rel/restore",e.DIRECTORY="http://ns.adobe.com/adobecloud/rel/directory",e.DIRECTORY_BASE="http://ns.adobe.com/adobecloud/rel/directory/base",e.AC_EFFECTIVE="http://ns.adobe.com/adobecloud/rel/ac/effective",e.AC_POLICY="http://ns.adobe.com/adobecloud/rel/ac/policy",e.AC_CHECK="http://ns.adobe.com/adobecloud/rel/ac/check",e.CREATE="http://ns.adobe.com/adobecloud/rel/create",e.REPOSITORY="http://ns.adobe.com/adobecloud/rel/repository",e.RESOLVE_ID="http://ns.adobe.com/adobecloud/rel/resolve/id",e.RESOLVE_PATH="http://ns.adobe.com/adobecloud/rel/resolve/path",e.OPS="http://ns.adobe.com/adobecloud/rel/ops",e.BLOCK_INITIALIZE="http://ns.adobe.com/adobecloud/rel/block/init",e.BLOCK_TRANSFER="http://ns.adobe.com/adobecloud/rel/block/transfer",e.BLOCK_FINALIZE="http://ns.adobe.com/adobecloud/rel/block/finalize",e.BLOCK_EXTEND="http://ns.adobe.com/adobecloud/rel/block/extend",e.REPO_METADATA="http://ns.adobe.com/adobecloud/rel/metadata/repository",e.APP_METADATA="http://ns.adobe.com/adobecloud/rel/metadata/application",e.EMBEDDED_METADATA="http://ns.adobe.com/adobecloud/rel/metadata/embedded",e.PERUSER_METADATA="http://ns.adobe.com/adobecloud/rel/metadata/peruser",e.ANNOTATIONS="http://ns.adobe.com/adobecloud/rel/annotations",e.DOWNLOAD="http://ns.adobe.com/adobecloud/rel/download",e.DESCRIBED_BY="describedBy",e.VERSION="version-history",e.SUBSCRIPTION_CREATE="subscription/create",e.NOTIFICATIONS_LONGPOLL="notifications/longpoll",e.ONS_CHANGELOG="ons/changelog",e.REPOSITORIES_PAGE="http://ns.adobe.com/repositories/rel/page",e.TEAMS_CREATE="http://ns.adobe.com/teams/rel/create",e.TEAMS_DISCARD="http://ns.adobe.com/teams/rel/discard",e.TEAMS_RESTORE="http://ns.adobe.com/teams/rel/restore",e.TEAMS_RENAME="http://ns.adobe.com/teams/rel/rename",e.TEAMS_PROPERTIES="http://ns.adobe.com/teams/rel/properties",e.TEAMS_PAGE="http://ns.adobe.com/teams/rel/page",e.TEAMS_PRIMARY="http://ns.adobe.com/teams/rel/primary",e.TEAM_PROVISION="http://ns.adobe.com/teams/rel/provision",e.WORKSPACES_CONTEXT="http://ns.adobe.com/ccprojects/rel/context",e.WORKSPACES_BOOKMARKS_BATCH="http://ns.adobe.com/ccprojects/rel/bookmarks/batch",e.WORKSPACES_PRIMARY="http://ns.adobe.com/ccprojects/rel/primary",e.WORKSPACES_CREATE="http://ns.adobe.com/ccprojects/rel/create",e.WORKSPACES_PAGE="http://ns.adobe.com/ccprojects/rel/page",e.PROJECTS_LIBRARIES_PAGE="http://ns.adobe.com/ccprojects/rel/libraries/page",e.PROJECTS_LIBRARIES_CREATE="http://ns.adobe.com/ccprojects/rel/libraries/create",e.PROJECTS_LIBRARIES_BATCH="http://ns.adobe.com/ccprojects/rel/libraries/batch",e.GENERIC_PAGE="page",e.GENERIC_NEXT="next",e.ATS_MOVE="http://ns.adobe.com/ats/rel/move",e.REVIEW_SERVICE_PROVISION="http://ns.adobe.com/ccassetreview/rel/provision",e.REVIEW_SERVICE_DISCARD="http://ns.adobe.com/ccassetreview/rel/discard",e.REVIEW_SERVICE_OUTPUTS="http://ns.adobe.com/ccassetreview/rel/outputs",e.REVIEW_SERIVCE_HAS_OUTPUTS="http://ns.adobe.com/ccassetreview/rel/hasoutputs",e.PROJECTS_CONTEXT="http://ns.adobe.com/projects/rel/context",e.PROJECTS_PRIMARY="http://ns.adobe.com/projects/rel/primary",e.PROJECTS_COLLECTION="http://ns.adobe.com/projects/rel/collection",e.PROJECTS_CREATE="http://ns.adobe.com/projects/rel/create",e.PROJECTS_RENAME="http://ns.adobe.com/projects/rel/rename",e.PROJECTS_CREATOR="http://ns.adobe.com/projects/rel/creator",e.PROJECTS_GRADIENTS_COLLECTION="http://ns.adobe.com/gradients/rel/collection",e.PROJECTS_CAPABILITY="http://ns.adobe.com/projects/rel/capability",e.ORGANIZATIONS_COLLECTION="http://ns.adobe.com/organizations/rel/collection",e.PROJECTS_RECENT="http://ns.adobe.com/projects/rel/recent",e.PROJECTS_MOVE="http://ns.adobe.com/projects/rel/move",e.PROJECTS_REFERENCE_CREATE="http://ns.adobe.com/projects/rel/references/create",e.PROJECTS_REFERENCE_PRIMARY="http://ns.adobe.com/projects/rel/references/primary",e.ASSIGNMENTS_ASSIGN="http://ns.adobe.com/assignments/rel/assign",e.ASSIGNMENTS_CODE="http://ns.adobe.com/assignments/rel/code",e.ASSIGNMENTS_COLLECTION="http://ns.adobe.com/assignments/rel/collection",e.ASSIGNMENTS_CREATE="http://ns.adobe.com/assignments/rel/create",e.ASSIGNMENTS_PRIMARY="http://ns.adobe.com/assignments/rel/primary",e.ASSIGNMENTS_RETURN="http://ns.adobe.com/assignments/rel/return",e.ASSIGNMENTS_START="http://ns.adobe.com/assignments/rel/start",e.ASSIGNMENTS_SUBMIT="http://ns.adobe.com/assignments/rel/submit",e.BOARDS_COLLECTION="http://ns.adobe.com/boards/rel/collection",e.BOARDS_CREATE="http://ns.adobe.com/boards/rel/create",e.BOARDS_PRIMARY="http://ns.adobe.com/boards/rel/primary",e.BOARDS_DISCARD="http://ns.adobe.com/boards/rel/discard",e.BOARDS_PUBLISH="http://ns.adobe.com/boards/rel/publish",e.BOARDS_UNPUBLISH="http://ns.adobe.com/boards/rel/unpublish",e.STUDENT_ASSIGNMENTS_COLLECTION="http://ns.adobe.com/studentAssignments/rel/collection",e.STUDENT_ASSIGNMENTS_PRIMARY="http://ns.adobe.com/studentAssignments/rel/primary",e.MELVILLE_FIREFLY_GENERATION_CANCEL="http://ns.adobe.com/firefly/rel/cancel",e.MELVILLE_FIREFLY_GENERATION_RESULT="http://ns.adobe.com/firefly/rel/result"}(yt||(yt={}));const St=[200],At=[429,500,502,503,504];var Pt=(e,t,i)=>{const s=Symbol(`@retry ${t}`),r=i.value;i.value=async function(e=0){var n,o;const a=this[s];a&&(clearTimeout(a),this[s]=void 0);try{await r.call(this)}catch(r){let a=0;const c=null===(n=r._additionalInfo)||void 0===n?void 0:n.response;if(At.includes(null==c?void 0:c.status))a=this._core._environment.getValue("MAX_RETRY_INTERVAL")||2e4;else{const t=(null===(o=r._additionalInfo)||void 0===o?void 0:o.response)?1e3*Et(r._additionalInfo.response.headers):0;a=Math.max(this._core._environment.getRetryInterval(e),t)}this._core._environment.log(`Retrying ${t} in ${a}ms`),this[s]=setTimeout((()=>i.value.call(this,e+1)),a)}}},wt=(e,t,i)=>{const s=Symbol(`@synchronized ${t}`),r=i.value;if(!r)throw We.create(Be.BAD_REQUEST,"@synchronized decorator can only be applied to a method");i.value=async function(...e){var i;const n=null===(i=this[tt])||void 0===i?void 0:i.get(t),o=void 0===n?"default":e[n],a=this[s]||(this[s]=new Map);let c;do{if(c=a.get(o),c)try{await c}catch(e){}}while(c);let l=e=>{};a.set(o,new Promise((e=>l=e)));try{return await r.apply(this,e)}finally{a.delete(o),l(void 0)}}};const Ct=Symbol("WeakCacheProperty");var Rt=(e,t,i)=>{var s;const r=i.value;if(!r)throw new Error("@weakCache decorator can only be applied to a method");const n=null!==(s=e[Ct])&&void 0!==s?s:e[Ct]=new Map;i.value=function(...e){var i,s;const o=null===(i=this[tt])||void 0===i?void 0:i.get(t),a=void 0===o||0===e.length?"default":e[o],c=`${t} (${function(e){if("string"==typeof e||"number"==typeof e||e instanceof Date||"boolean"==typeof e)return JSON.stringify(e);if("object"==typeof e&&null!==e){const t=Object.keys(e).sort().reduce(((t,i)=>(t[i]=e[i],t)),{});return JSON.stringify(t)}throw new Error(`Unsupported input type (${e})`)}(a)})`;let l=null===(s=n.get(c))||void 0===s?void 0:s.deref();if(l)return l;if(l=r.call(this,...e),null===(d=l)||"object"!=typeof d&&"function"!=typeof d)throw new Error("Cannot cache primitive types");var d;return n.set(c,new WeakRef(l)),l}};const Lt=6e5;class Nt{constructor(e=6e5){this._ttl=e,this._keepAliveMap=new Map}static getInstance(){return Nt._instance||(Nt._instance=new Nt(Lt)),Nt._instance}static setTTL(e){if(e<0)throw We.create(Be.UNKNOWN,"TTL must be greater than or equal to 0");Nt.getInstance()._ttl=e}add(e){if(0===this._ttl)return;const t=this._keepAliveMap.get(e);t&&clearTimeout(t),this._keepAliveMap.set(e,setTimeout((()=>{this._keepAliveMap.delete(e)}),this._ttl))}}function Dt(e,t,i){const s=i.value;i.value=function(...e){const t=s.apply(this,e);return t instanceof Promise?t.then((e=>Nt.getInstance().add(e))).catch((()=>{})):null!==(null!=t?t:null)&&Nt.getInstance().add(t),t}}const Mt=new WeakMap,xt=new WeakMap;function kt(e){const t=Mt.get(e);return console.assert(null!=t,"'this' is expected an Event object, but got",e),t}function Ht(e){null==e.passiveListener?e.event.cancelable&&(e.canceled=!0,"function"==typeof e.event.preventDefault&&e.event.preventDefault()):"undefined"!=typeof console&&"function"==typeof console.error&&console.error("Unable to preventDefault inside passive event listener invocation.",e.passiveListener)}function jt(e,t){Mt.set(this,{eventTarget:e,event:t,eventPhase:2,currentTarget:e,canceled:!1,stopped:!1,immediateStopped:!1,passiveListener:null,timeStamp:t.timeStamp||Date.now()}),Object.defineProperty(this,"isTrusted",{value:!1,enumerable:!0});const i=Object.keys(t);for(let e=0;e<i.length;++e){const t=i[e];t in this||Object.defineProperty(this,t,Ut(t))}}function Ut(e){return{get(){return kt(this).event[e]},set(t){kt(this).event[e]=t},configurable:!0,enumerable:!0}}function Bt(e){return{value(){const t=kt(this).event;return t[e].apply(t,arguments)},configurable:!0,enumerable:!0}}function Ft(e){if(null==e||e===Object.prototype)return jt;let t=xt.get(e);return null==t&&(t=function(e,t){const i=Object.keys(t);if(0===i.length)return e;function s(t,i){e.call(this,t,i)}s.prototype=Object.create(e.prototype,{constructor:{value:s,configurable:!0,writable:!0}});for(let r=0;r<i.length;++r){const n=i[r];if(!(n in e.prototype)){const e="function"==typeof Object.getOwnPropertyDescriptor(t,n).value;Object.defineProperty(s.prototype,n,e?Bt(n):Ut(n))}}return s}(Ft(Object.getPrototypeOf(e)),e),xt.set(e,t)),t}function Vt(e){return kt(e).immediateStopped}function Kt(e,t){kt(e).passiveListener=t}jt.prototype={get type(){return kt(this).event.type},get target(){return kt(this).eventTarget},get currentTarget(){return kt(this).currentTarget},composedPath(){const e=kt(this).currentTarget;return null==e?[]:[e]},get NONE(){return 0},get CAPTURING_PHASE(){return 1},get AT_TARGET(){return 2},get BUBBLING_PHASE(){return 3},get eventPhase(){return kt(this).eventPhase},stopPropagation(){const e=kt(this);e.stopped=!0,"function"==typeof e.event.stopPropagation&&e.event.stopPropagation()},stopImmediatePropagation(){const e=kt(this);e.stopped=!0,e.immediateStopped=!0,"function"==typeof e.event.stopImmediatePropagation&&e.event.stopImmediatePropagation()},get bubbles(){return Boolean(kt(this).event.bubbles)},get cancelable(){return Boolean(kt(this).event.cancelable)},preventDefault(){Ht(kt(this))},get defaultPrevented(){return kt(this).canceled},get composed(){return Boolean(kt(this).event.composed)},get timeStamp(){return kt(this).timeStamp},get srcElement(){return kt(this).eventTarget},get cancelBubble(){return kt(this).stopped},set cancelBubble(e){if(!e)return;const t=kt(this);t.stopped=!0,"boolean"==typeof t.event.cancelBubble&&(t.event.cancelBubble=!0)},get returnValue(){return!kt(this).canceled},set returnValue(e){e||Ht(kt(this))},initEvent(){}},Object.defineProperty(jt.prototype,"constructor",{value:jt,configurable:!0,writable:!0}),"undefined"!=typeof window&&void 0!==window.Event&&(Object.setPrototypeOf(jt.prototype,window.Event.prototype),xt.set(window.Event.prototype,jt));const Gt=new WeakMap,$t=3;function Wt(e){return null!==e&&"object"==typeof e}function zt(e){const t=Gt.get(e);if(null==t)throw new TypeError("'this' is expected an EventTarget object, but got another value.");return t}function qt(e,t){Object.defineProperty(e,`on${t}`,function(e){return{get(){let t=zt(this).get(e);for(;null!=t;){if(t.listenerType===$t)return t.listener;t=t.next}return null},set(t){"function"==typeof t||Wt(t)||(t=null);const i=zt(this);let s=null,r=i.get(e);for(;null!=r;)r.listenerType===$t?null!==s?s.next=r.next:null!==r.next?i.set(e,r.next):i.delete(e):s=r,r=r.next;if(null!==t){const r={listener:t,listenerType:$t,passive:!1,once:!1,next:null};null===s?i.set(e,r):s.next=r}},configurable:!0,enumerable:!0}}(t))}function Yt(e){function t(){Qt.call(this)}t.prototype=Object.create(Qt.prototype,{constructor:{value:t,configurable:!0,writable:!0}});for(let i=0;i<e.length;++i)qt(t.prototype,e[i]);return t}function Qt(){if(!(this instanceof Qt)){if(1===arguments.length&&Array.isArray(arguments[0]))return Yt(arguments[0]);if(arguments.length>0){const e=new Array(arguments.length);for(let t=0;t<arguments.length;++t)e[t]=arguments[t];return Yt(e)}throw new TypeError("Cannot call a class as a function")}Gt.set(this,new Map)}Qt.prototype={addEventListener(e,t,i){if(null==t)return;if("function"!=typeof t&&!Wt(t))throw new TypeError("'listener' should be a function or an object.");const s=zt(this),r=Wt(i),n=(r?Boolean(i.capture):Boolean(i))?1:2,o={listener:t,listenerType:n,passive:r&&Boolean(i.passive),once:r&&Boolean(i.once),next:null};let a=s.get(e);if(void 0===a)return void s.set(e,o);let c=null;for(;null!=a;){if(a.listener===t&&a.listenerType===n)return;c=a,a=a.next}c.next=o},removeEventListener(e,t,i){if(null==t)return;const s=zt(this),r=(Wt(i)?Boolean(i.capture):Boolean(i))?1:2;let n=null,o=s.get(e);for(;null!=o;){if(o.listener===t&&o.listenerType===r)return void(null!==n?n.next=o.next:null!==o.next?s.set(e,o.next):s.delete(e));n=o,o=o.next}},dispatchEvent(e){if(null==e||"string"!=typeof e.type)throw new TypeError('"event.type" should be a string.');const t=zt(this),i=e.type;let s=t.get(i);if(null==s)return!0;const r=function(e,t){return new(Ft(Object.getPrototypeOf(t)))(e,t)}(this,e);let n=null;for(;null!=s;){if(s.once?null!==n?n.next=s.next:null!==s.next?t.set(i,s.next):t.delete(i):n=s,Kt(r,s.passive?s.listener:null),"function"==typeof s.listener)try{s.listener.call(this,r)}catch(e){"undefined"!=typeof console&&"function"==typeof console.error&&console.error(e)}else s.listenerType!==$t&&"function"==typeof s.listener.handleEvent&&s.listener.handleEvent(r);if(Vt(r))break;s=s.next}return Kt(r,null),function(e,t){kt(e).eventPhase=0}(r),function(e,t){kt(e).currentTarget=null}(r),!r.defaultPrevented}},Object.defineProperty(Qt.prototype,"constructor",{value:Qt,configurable:!0,writable:!0}),"undefined"!=typeof window&&void 0!==window.EventTarget&&Object.setPrototypeOf(Qt.prototype,window.EventTarget.prototype);class Jt extends Qt{constructor(){throw super(),new TypeError("AbortSignal cannot be constructed directly")}get aborted(){const e=Xt.get(this);if("boolean"!=typeof e)throw new TypeError("Expected 'this' to be an 'AbortSignal' object, but got "+(null===this?"null":typeof this));return e}}qt(Jt.prototype,"abort");const Xt=new WeakMap;Object.defineProperties(Jt.prototype,{aborted:{enumerable:!0}}),"function"==typeof Symbol&&"symbol"==typeof Symbol.toStringTag&&Object.defineProperty(Jt.prototype,Symbol.toStringTag,{configurable:!0,value:"AbortSignal"});class Zt{constructor(){ei.set(this,function(){const e=Object.create(Jt.prototype);return Qt.call(e),Xt.set(e,!1),e}())}get signal(){return ti(this)}abort(){var e;e=ti(this),!1===Xt.get(e)&&(Xt.set(e,!0),e.dispatchEvent({type:"abort"}))}}const ei=new WeakMap;function ti(e){const t=ei.get(e);if(null==t)throw new TypeError("Expected 'this' to be an 'AbortController' object, but got "+(null===e?"null":typeof e));return t}Object.defineProperties(Zt.prototype,{signal:{enumerable:!0},abort:{enumerable:!0}}),"function"==typeof Symbol&&"symbol"==typeof Symbol.toStringTag&&Object.defineProperty(Zt.prototype,Symbol.toStringTag,{configurable:!0,value:"AbortController"});const ii="undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:void 0;ii&&(void 0===ii.AbortController&&(ii.AbortController=Zt),void 0===ii.AbortSignal&&(ii.AbortSignal=Jt));var si={exports:{}},ri="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof window.msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto);if(ri){var ni=new Uint8Array(16);si.exports=function(){return ri(ni),ni}}else{var oi=new Array(16);si.exports=function(){for(var e,t=0;t<16;t++)0==(3&t)&&(e=4294967296*Math.random()),oi[t]=e>>>((3&t)<<3)&255;return oi}}for(var ai=[],ci=0;ci<256;++ci)ai[ci]=(ci+256).toString(16).substr(1);var li,di,ui=function(e,t){var i=t||0,s=ai;return[s[e[i++]],s[e[i++]],s[e[i++]],s[e[i++]],"-",s[e[i++]],s[e[i++]],"-",s[e[i++]],s[e[i++]],"-",s[e[i++]],s[e[i++]],"-",s[e[i++]],s[e[i++]],s[e[i++]],s[e[i++]],s[e[i++]],s[e[i++]]].join("")},hi=si.exports,pi=ui,_i=0,mi=0,fi=si.exports,gi=ui,yi=function(e,t,i){var s=t&&i||0,r=t||[],n=(e=e||{}).node||li,o=void 0!==e.clockseq?e.clockseq:di;if(null==n||null==o){var a=hi();null==n&&(n=li=[1|a[0],a[1],a[2],a[3],a[4],a[5]]),null==o&&(o=di=16383&(a[6]<<8|a[7]))}var c=void 0!==e.msecs?e.msecs:(new Date).getTime(),l=void 0!==e.nsecs?e.nsecs:mi+1,d=c-_i+(l-mi)/1e4;if(d<0&&void 0===e.clockseq&&(o=o+1&16383),(d<0||c>_i)&&void 0===e.nsecs&&(l=0),l>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");_i=c,mi=l,di=o;var u=(1e4*(268435455&(c+=122192928e5))+l)%4294967296;r[s++]=u>>>24&255,r[s++]=u>>>16&255,r[s++]=u>>>8&255,r[s++]=255&u;var h=c/4294967296*1e4&268435455;r[s++]=h>>>8&255,r[s++]=255&h,r[s++]=h>>>24&15|16,r[s++]=h>>>16&255,r[s++]=o>>>8|128,r[s++]=255&o;for(var p=0;p<6;++p)r[s+p]=n[p];return t||pi(r)},vi=function(e,t,i){var s=t&&i||0;"string"==typeof e&&(t="binary"===e?new Array(16):null,e=null);var r=(e=e||{}).random||(e.rng||fi)();if(r[6]=15&r[6]|64,r[8]=63&r[8]|128,t)for(var n=0;n<16;++n)t[s+n]=r[n];return t||gi(r)},Oi=vi;Oi.v1=yi,Oi.v4=vi;var bi=Oi;function Ii(){return"undefined"!=typeof crypto&&crypto.randomUUID?crypto.randomUUID():bi.v4()}class Ei{constructor(){this._contexts=new Map}register(e){let t=this._contexts.get(e);t||(t={id:Ii(),references:new Set},this._contexts.set(e,t));const i=Ii();return t.references.add(i),()=>{const t=this._contexts.get(e);t&&(t.references.delete(i),0===t.references.size&&this._contexts.delete(e))}}reportObserved(e,t="change"){for(const[i,{id:s}]of this._contexts){const r=`_atom_${s}_${t}`;let n=e[r];if(!n){const s=()=>n.reportChanged();n=i(`${e.constructor.name}_${t}`,(()=>{e.on(t,s)}),(()=>{e.off(t,s)})),e[r]=n}n.reportObserved()}}}const Ti=Symbol("NotFound");class Si{constructor(e,t){this._name=e,this._core=t}static isSupported(){if("undefined"==typeof window||!window.indexedDB)return!1;try{const e=window.indexedDB.open("sam_indexeddb_test",1);return e.onsuccess=()=>e.result.close(),!0}catch(e){return!1}}async _transaction(e,t){const i=await this._connect();if(i)return new Promise((s=>{try{const r=i.transaction(this._name,e),n=r.objectStore(this._name),o=t(n);r.onerror=e=>{this._core._environment.error(`transaction error: ${e}`),s(void 0)},r.oncomplete=()=>{s(o)}}catch(e){this._core._environment.error(`transaction exception: ${e}`),s(void 0)}}))}async getItem(e){return this._transaction("readonly",(async t=>new Promise((i=>{const s=t.get(e);s.onsuccess=()=>{i(s.result?{value:s.result.value,expiry:s.result.expiry}:void 0)}}))))}async setItem(e,t,i){return this._transaction("readwrite",(s=>{s.put({id:e,expiry:i,value:t})}))}async deleteItem(e){return this._transaction("readwrite",(t=>{t.delete(e)}))}async _connect(){if(this._database)return this._database;const e=this._core._environment.getValue("INDEXED_DB_VERSION"),t=window.indexedDB.open(this._name,e);return new Promise((i=>{t.onerror=e=>{this._core._environment.error(`CONNECTION_FAILED Unable to connect to IndexedDB: ${this._name}, error: ${e}`),i(void 0)},t.onupgradeneeded=()=>{const e=t.result;e.objectStoreNames.contains(this._name)&&e.deleteObjectStore(this._name),e.createObjectStore(this._name,{keyPath:"id"})},t.onsuccess=()=>{const s=this._database=t.result;s.onversionchange=t=>{this._core._environment.error(`IndexedDb version changed detected ${this._name}.${e}, ${t}`),s.close(),s.onversionchange=null,this._database=void 0},i(s)}}))}async _clear(){return this._transaction("readwrite",(async e=>new Promise((t=>{e.clear().onsuccess=()=>{console.log("localDB cleared for",e.name),t(void 0)}}))))}}class Ai{constructor(e,t){this._name=e,this._core=t}static isSupported(){try{return"undefined"!=typeof window&&!!window.localStorage}catch(e){return!1}}_getKey(e){return`${this._name}#${e}`}async getItem(e){const t=window.localStorage.getItem(this._getKey(e));if(t)try{const{value:e,expiry:i}=JSON.parse(t);return{value:e,expiry:i?new Date(i):void 0}}catch(e){}}async setItem(e,t,i){const s=JSON.stringify({expiry:i,value:t});window.localStorage.setItem(this._getKey(e),s)}async deleteItem(e){window.localStorage.removeItem(this._getKey(e))}}class Pi{constructor(){this.items=new Map}getItem(e){return this.items.get(e)}setItem(e,t,i){var s;const r=this.items.get(e);r&&clearTimeout(r.cleanupTimeout);const n=null!==(s=null==i?void 0:i.getTime())&&void 0!==s?s:Date.now()+Pi.MAX_TIME_IN_MEMORY_MS,o=Math.min(Pi.MAX_TIME_IN_MEMORY_MS,n-Date.now()),a=setTimeout((()=>{this.deleteItem(e)}),o);this.items.set(e,{value:t,expiry:i,cleanupTimeout:a})}deleteItem(e){const t=this.items.get(e);t&&clearTimeout(t.cleanupTimeout),this.items.delete(e)}}Pi.MAX_TIME_IN_MEMORY_MS=6e4;class wi{constructor(e,t,i){this._userId=e,this._core=t,this._localCache=new Pi,this._name="SAM.js-"+this._userId,i?this._persistentCache=i:Si.isSupported()?this._persistentCache=new Si(this._name,t):Ai.isSupported()&&(this._persistentCache=new Ai(this._name,t))}get name(){return this._name}async getItem(e,t,i,s){let r=this._localCache.getItem(e);!r&&this._persistentCache&&(r=await this._persistentCache.getItem(e));const n=i&&r&&!i(r.value),o=(null==r?void 0:r.expiry)&&r.expiry<=new Date(Date.now());if((n||o)&&(await this.deleteItem(e),r=void 0),!r&&t){const r=await t();if(i&&!i(r))throw We.create(Be.UNKNOWN,`Value for cache key ${e} is invalid: ${JSON.stringify(r)}`);return await this.setItem(e,r,s),r}return r?r.value:Ti}async setItem(e,t,i=this._core._environment.getValue("CACHE_DEFAULT_TTL")){const s=i?new Date(Date.now()+i):void 0;this._localCache.setItem(e,t,s),this._persistentCache&&await this._persistentCache.setItem(e,t,s)}async deleteItem(e){this._localCache.deleteItem(e),this._persistentCache&&await this._persistentCache.deleteItem(e)}}Ye([wt,Qe(0,it)],wi.prototype,"getItem",null);const Ci="messageLogged",Ri="configChanged";class Li extends Event{constructor(e){super("itemListStateChanged"),this.list=e}}class Ni extends Event{constructor(e,t){super(Ci),this.message=e,this.logLevel=t}}class Di extends Event{constructor(){super("folderContentChanged")}}const Mi="collaborator_changed",xi=new class extends ot{constructor(){super(Mi)}},ki={SHELL_VISIBILITY:"shell:visibility",CC_INHERITED:"cc:inherited",REVIEW_SOURCE_ASSET:"review:sourceAsset",CONVERTED_TO:"convertedTo",NON_AUTO_MIGRATABLE:"ccx:nonAutoMigratableCopiedFromId",COPIED_IN_LEGACY_SPARK_TO:"ccx:copiedLegacySparkId",CC_INHERITABLE:"cc:inheritable",PROJECT_RENDITION:"project:rendition",FIREFLY:"firefly"},Hi={CC:"cc",CLASSROOM_ASSIGNMENTS:"assignment",CCX:"ccx",HZ:"hz"},ji={HZ_DOCUMENT_METADATA:"hz:documentMetadata",CC_CREATED_FROM_UPLOAD:"cc:createdFromUpload"},Ui=Object.values(Hi).map((e=>`"${e}:"*`)),Bi=Object.values(ki).concat(Object.values(ji)).filter((e=>{const t=e.split(":")[0];return!Object.values(Hi).includes(t)})).map((e=>'"'+e+'"')).concat(Ui),Fi=Object.values(ki).map((e=>"app_metadata$$"+e)).concat(Object.values(ji).map((e=>"api:metadata/application$$"+e))),Vi=Array.from(Object.values({COLLABORATION_METADATA:"collaboration_metadata",COLLABMETADATA_MINE:"collab_metadata#mine",REPO_CREATED_BY_CLIENT_ID:"repo:createdByClientId",CUSTOM_MODEL_METADATA:"firefly#ffmodel"}));function Ki(){return[...Fi,...Vi]}const Gi=ee,$i=Object.entries(ee).reduce(((e,[t])=>t===Gi.Ack.toString(10)?e:e|parseInt(t,10)),Gi.None);function Wi(e){const t=e[yt.PRIMARY]||e["*"]||[],i=e[yt.AC_POLICY]||e["*"]||[],s=e[yt.DIRECTORY]||e["*"]||[],r=e[yt.APP_METADATA]||e["*"]||[],n=e[yt.ANNOTATIONS]||e["*"]||[];let o=Gi.None;return t.forEach((e=>{switch(e){case"ack":o|=Gi.Ack;break;case"read":o|=Gi.Read,s.includes("write")&&(o|=Gi.Duplicate);break;case"write":o|=Gi.Write,s.includes("write")&&(o|=Gi.Discard,o|=Gi.Restore);break;case"delete":s.includes("write")&&(o|=Gi.Delete)}})),i.includes("write")&&(o|=Gi.Share),r.includes("read")&&(o|=Gi.ReadAppMetadata),n.includes("write")&&(o|=Gi.WriteComment),s.includes("write")&&t.includes("read")&&t.includes("write")&&(o|=Gi.Rename,t.includes("delete")&&(o|=Gi.Move)),o}const zi="/cloud-content",qi={[yt.PROJECTS_PRIMARY]:["assetId","embed"],[yt.PROJECTS_COLLECTION]:["embed","limit","orderBy","start","view"],[yt.PROJECTS_CREATE]:["embed"],[yt.RESOLVE_PATH]:["path"],[yt.PROJECTS_GRADIENTS_COLLECTION]:[],[yt.PROJECTS_CONTEXT]:[],[yt.PROJECTS_CAPABILITY]:["privilege"],[yt.ORGANIZATIONS_COLLECTION]:[],[yt.PROJECTS_RECENT]:["embed","after","first"],[yt.PROJECTS_REFERENCE_PRIMARY]:["assetId","referenceId"],[yt.PROJECTS_REFERENCE_CREATE]:["assetId"]};var Yi;!function(e){e.GRADIENT_ID="/project:rendition/gradientId"}(Yi||(Yi={}));const Qi=Y,Ji={[Qi.All]:"all",[Qi.Yours]:"yours",[Qi.SWY]:"sharedWithYou",[Qi.Admin]:"admin",[Qi.Organization]:"all",[Qi.Recent]:"all"};var Xi,Zi,es;!function(e){e.CREATE="create"}(Xi||(Xi={})),function(e){e[e.PENDING=0]="PENDING",e[e.CAN_LEAVE=1]="CAN_LEAVE",e[e.CANNOT_LEAVE_NO_COLLABORATORS=2]="CANNOT_LEAVE_NO_COLLABORATORS",e[e.CANNOT_LEAVE_ADDRESS_BOOK_GROUP_MEMBER=3]="CANNOT_LEAVE_ADDRESS_BOOK_GROUP_MEMBER",e[e.CANNOT_LEAVE_LAST_COLLABORATOR=4]="CANNOT_LEAVE_LAST_COLLABORATOR",e[e.CANNOT_LEAVE_LAST_DIRECT_COLLABORATOR=5]="CANNOT_LEAVE_LAST_DIRECT_COLLABORATOR",e[e.CANNOT_LEAVE_IS_ADMIN_OF_PROJECT=6]="CANNOT_LEAVE_IS_ADMIN_OF_PROJECT",e[e.CANNOT_LEAVE_LAST_DIRECT_COLLAB_WITH_SHARE_PERMISSION=7]="CANNOT_LEAVE_LAST_DIRECT_COLLAB_WITH_SHARE_PERMISSION",e[e.CANNOT_LEAVE_IS_OWNER=8]="CANNOT_LEAVE_IS_OWNER"}(Zi||(Zi={})),function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.ALLOWED=1]="ALLOWED",e[e.ADMIN_DISABLED=2]="ADMIN_DISABLED",e[e.INVALID_REPOSITORY=3]="INVALID_REPOSITORY",e[e.NO_HOME_REPOSITORY=4]="NO_HOME_REPOSITORY"}(es||(es={}));const ts=Z,is="application/vnd.adobe.ffmodel+dcx",ss=["cme:training"];var rs,ns,os,as;function cs(e,t){return e===t}function ls(e){return JSON.parse(JSON.stringify(e))}function ds(e,t,i=!1,s=!1){if(e===t)return!0;if(typeof e!=typeof t||e.constructor!==t.constructor)return!1;if(e instanceof Date)return e.toISOString()===t.toISOString();if(Array.isArray(e)){if(!s&&e.length!==t.length)return!1;if(s&&e.length>t.length)return!1;let r=e,n=t;i&&(r=e.slice(0).sort(),n=t.slice(0).sort());let o=0,a=0;for(;;){if(o===r.length)return!0;if(a===n.length)return!1;if(ds(r[o],n[a],i,s))o+=1,a+=1;else{if(!s)return!1;a+=1}}}if(e instanceof Set){if(!s&&e.size!==t.size)return!1;if(s&&e.size>t.size)return!1;for(const i of e.keys())if(!t.has(i))return!1;return!0}if(e instanceof Map){if(!s&&e.size!==t.size)return!1;if(s&&e.size>t.size)return!1;for(const r of e.keys()){if(!t.has(r))return!1;if(!ds(e.get(r),t.get(r),i,s))return!1}return!0}if("object"==typeof e){const r=new Set(Object.keys(e)),n=new Set(Object.keys(t));if(!s&&r.size!==n.size)return!1;if(s&&r.size>n.size)return!1;for(const o of r){if(!n.has(o))return!1;if(!ds(e[o],t[o],i,s))return!1}return!0}return!1}function us(e){if(null==e?void 0:e.size)return e.entries().next().value[0]}!function(e){e.MODIFY_DATE="modified_date",e.CREATE_DATE="created_date",e.NAME="name"}(rs||(rs={})),function(e){e.DRAFT="draft",e.READY="ready",e.PUBLISHED="published",e.UNPUBLISHED="unpublished",e.QUEUED="queued",e.TRAINING="training",e.FAILED="failed",e.CANCELLED="cancelled",e.ALL="all"}(ns||(ns={})),function(e){e.MODIFY_DATE="modifyDate",e.CREATE_DATE="createDate",e.NAME="name"}(os||(os={}));class hs{constructor(e,t,i,s,r){var n;this.url=e,this.headers=t,this.status=i,this.statusText=s,this._body="string"==typeof r?(n=r,"undefined"!=typeof TextEncoder?(new TextEncoder).encode(n).buffer:function(e){const t=[],i=e.length;let s=0;for(;s<i;){const i=e.codePointAt(s);let r=0,n=0;for(i<=127?(r=0,n=0):i<=2047?(r=6,n=192):i<=65535?(r=12,n=224):i<=2097151&&(r=18,n=240),t.push(n|i>>r),r-=6;r>=0;)t.push(128|i>>r&63),r-=6;s+=i>=65536?2:1}return new Uint8Array(t).buffer}(n)):r}static async fromResponse(e){if(e instanceof hs)return e;let t;return t=e.body?await e.arrayBuffer():new ArrayBuffer(0),new hs(e.url,e.headers,e.status,e.statusText,t)}static async deserialize(e){return new hs(e.url,new Headers(e.headers),e.status,e.statusText,function(e){const t=atob(e);return Uint8Array.from(t,(e=>{var t;return null!==(t=e.codePointAt(0))&&void 0!==t?t:0}))}(e.body).buffer)}serialize(){return{url:this.url,status:this.status,statusText:this.statusText,headers:ps(this.headers),body:_s(new Uint8Array(this._body))}}async matches(e){if(e){if(this.headers.has("etag")&&e.headers.has("etag"))return this.headers.get("etag")===e.headers.get("etag");{const[t,i]=await Promise.all([this.arrayBuffer(),e.arrayBuffer()]),s=new Uint8Array(t),r=new Uint8Array(i);return s.byteLength===r.byteLength&&s.every(((e,t)=>e===r[t]))}}return!1}get ok(){const{status:e}=this;return e>=200&&e<=299}get redirected(){return!1}get type(){return"basic"}async json(){try{return JSON.parse(await this.text())}catch(e){throw We.create(Be.INTERNAL_ERROR,`Failed to parse JSON response from '${this.url}' async request.`,{underlyingError:e})}}async bytes(){return new Uint8Array(this._body)}async text(){return async function(e){return"undefined"!=typeof TextDecoder?(new TextDecoder).decode(e):function(e){const t=new Uint8Array(e);let i="",s=0;for(;s<t.length;){let e=t[s],r=0,n=0;if(e<=127?(r=0,n=255&e):e<=223?(r=1,n=31&e):e<=239?(r=2,n=15&e):e<=244&&(r=3,n=7&e),t.length-s-r>0){let i=0;for(;i<r;)e=t[s+i+1],n=n<<6|63&e,i+=1}else n=65533,r=t.length-s;i+=String.fromCodePoint(n),s+=r+1}return i}(e)}(this._body)}clone(){const e=new Headers;return this.headers.forEach(((t,i)=>e.set(i,t))),new hs(this.url,e,this.status,this.statusText,this._body)}get bodyUsed(){return!1}get body(){throw We.create(Be.UNSUPPORTED,"AsyncResponse.body not implemented.")}async arrayBuffer(){return this._body}async blob(){var e;return new Blob([this._body],{type:null!==(e=this.headers.get("content-type"))&&void 0!==e?e:void 0})}async formData(){throw We.create(Be.UNSUPPORTED,"AsyncResponse.formData not implemented.")}}function ps(e){const t={};return e.forEach(((e,i)=>{t[i]=e})),t}function _s(e){const t=Array.from(e,(e=>String.fromCodePoint(e))).join("");return btoa(t)}class ms{constructor(e){this._core=e}getCacheKey(e){return`InterfaceBase-cache-${e}`}async getCachedResponse(e){const t=await this._core._environment.cache.getItem(this.getCacheKey(e));if(t!==Ti)return hs.deserialize(t)}async saveResponseToCache(e,t){await this._core._environment.cache.setItem(this.getCacheKey(e),t.serialize())}async deleteCachedResponse(e){await this._core._environment.cache.deleteItem(this.getCacheKey(e))}}!function(e){e[e.Stage=0]="Stage",e[e.Production=1]="Production"}(as||(as={}));const fs={USER_ID:"",USER_EMAIL:"",CLIENT_ID:"",ACCESS_TOKEN:"",ENVIRONMENT:as.Production,HOST_PRODUCT_DATA:{PRODUCT_ID:"",PRODUCT_LOCATION:""},FETCH_REQUEST_TIMEOUT:6e4,ASYNC_DEFAULT_DELAY:1e3,CACHE_DEFAULT_TTL:2592e6,CACHE_KEEP_ALIVE_TTL:Lt,MIN_RETRY_INTERVAL:1e3,MAX_RETRY_INTERVAL:12e4,ONS_DOCUMENT_VISIBILITY_TIMEOUT:1e4,ONS_DEFAULT_MAX_SUBSCRIPTIONS:5,ONS_DEFAULT_MAX_ASSETS_PER_SUBSCRIPTION:100,GRAPHQL_WATCH_QUERY_TTL:3e4,ONS_SUBSCRIPTION_TIME_TO_LIVE:216e5,ONS_SUBSCRIPTION_RENEW_TIME:3e5,INDEXED_DB_VERSION:1,PROJECTS_LIST_UPDATE_LATENCY:3e3,PROJECTS_ITEM_UPDATE_LATENCY:1e3,CLASSROOMS_LIST_UPDATE_LATENCY:3e3,ASSETS_LIST_UPDATE_LATENCY:100,USS_LIST_UPDATE_LATENCY:3e3,VERSIONS_LIST_UPDATE_LATENCY:100,GQL_LIST_UPDATE_LATENCY:100,ASSET_COPY_NAME_FORMAT:"%@ copy (%d)",ASSET_CONFLICT_NAME_FORMAT:"%@ (%d)",DISABLE_ONS:!1,ENABLE_ONS_CACHE:!1,_VERSION_OVERRIDE_FOR_TEST:"",HIGH_PRIORITY_RAPI_REQUESTS:!1,LOCALE:"en-US",SESSION_TYPE:"logged-in",ONS_OVER_AXON:!1,FEATURE_FLAGS:{"enable-x-bucket-move":!1,"enable-response-cache":!1,"use-graphql-cache":!1,"move-capabilities":{"enable-CCI-CCI-move":!1},"use-graphql":!1,"use-pls-recents":!1,"use-pls-swy":!1,"enable-acpl-next-polyfills":!1,"disable-sam-cpp-models":!1},REQUEST_EDGE_BASED_PUBLISHED_LINKS:!1,EXECUTION_CONTEXT_CLIENT_AGENT:void 0},gs={[as.Stage]:{LABEL:"Staging",ACP_CS_HOST:"platform-cs-stage.adobe.io",SYNC_SERVICE_HOST:"acp-ss-stage.adobe.io",PROJECTS_HOST:"ccprojects-stage.adobe.io",ASSIGNMENTS_HOST:"hume-stage.adobe.io",INVITATIONS_HOST:"invitations-stage.adobe.io",TRANSFER_SERVICE_HOST:"ats-stage.adobe.io",USS_HOST:"adobesearch-stage.adobe.io",XDCE_HOST:"xdce-stage.adobe.io",REVIEW_SERVICE_HOST:"ccassetreview-stage.adobe.io",MELVILLE_HOST:"ccx-melville-stage.adobe.io",MELVILLE_EDGE_HOST:"platform-cs-edge-stage.adobe.io",USSv3_HOST:"acp-asset-ussv3-stage.adobe.io",PPS_HOST:"pps-stage.adobe.io",BEHANCE_HOST:"cc-api-behance-stage.adobe.io",CLASSROOMS_HOST:"edu-classrooms-stage.adobe.io",COMMENT_HOST:"comments-stage.adobe.io",AXON_HOST:"axon.stg.aws.adobess.com",ACPC_SUPERGRAPH_HOST:"platform-cs-stage.adobe.io/graphql",ACPC_SUPERGRAPH_EDGE_HOST:"platform-cs-edge-stage.adobe.io/graphql",ABS_HOST:"ab-stg.adobe-identity.com",WORKFRONT_HOST:"workfront-stage.adobe.io"},[as.Production]:{LABEL:"Production",ACP_CS_HOST:"platform-cs.adobe.io",SYNC_SERVICE_HOST:"acp-ss.adobe.io",PROJECTS_HOST:"ccprojects.adobe.io",ASSIGNMENTS_HOST:"hume.adobe.io",INVITATIONS_HOST:"invitations.adobe.io",TRANSFER_SERVICE_HOST:"ats.adobe.io",USS_HOST:"adobesearch.adobe.io",XDCE_HOST:"xdce.adobe.io",REVIEW_SERVICE_HOST:"ccassetreview.adobe.io",MELVILLE_HOST:"libraries.adobe.io",MELVILLE_EDGE_HOST:"platform-cs-edge.adobe.io",USSv3_HOST:"acp-asset-ussv3.adobe.io",PPS_HOST:"pps.adobe.io",BEHANCE_HOST:"cc-api-behance.adobe.io",CLASSROOMS_HOST:"edu-classrooms.adobe.io",COMMENT_HOST:"comments.adobe.io",AXON_HOST:"axon.adobess.com",ACPC_SUPERGRAPH_HOST:"platform-cs.adobe.io/graphql",ACPC_SUPERGRAPH_EDGE_HOST:"platform-cs-edge.adobe.io/graphql",ABS_HOST:"ab.adobe-identity.com",WORKFRONT_HOST:"workfront.adobe.io"}},ys=e=>"string"==typeof e&&Boolean(e),vs=[{key:"CLIENT_ID",validator:ys},{key:"USER_ID",validator:ys},{key:"ENVIRONMENT",validator:e=>(e=>"number"==typeof e)(e)&&e in as},{key:"HOST_PRODUCT_DATA",validator(e){if(!e)return!1;const{PRODUCT_ID:t}=e;return ys(t)}}];class Os{constructor(e,t,i){this._core=e,this._hooks=i,this._isTokenInvalid=!0,this.mobx=new Ei;const s=Object.assign({},fs.FEATURE_FLAGS,t.FEATURE_FLAGS),r=Object.assign({},fs,t);r.FEATURE_FLAGS=s;const n=vs.filter((({key:e,validator:t})=>!t(r[e])));if(n.length){const e=n.map((({key:e})=>e)).join(", ");throw We.create(Be.BAD_REQUEST,`Invalid required options: ${e}`)}if(r.ACCESS_TOKEN)this._isTokenInvalid=!1;else if(!i.refreshAccessToken)throw We.create(Be.BAD_REQUEST,"refreshAccessToken hook must be provided if ACCESS_TOKEN is not set");this._config=r,this._cache=new wi(r.USER_ID,e,i.persistentCache),this.getValue("FEATURE_FLAGS")["enable-response-cache"]&&(this._responseCache=new ms(this._core))}get cache(){return this._cache}getValue(e){return this._config[e]}setValue(e,t){this._config[e]=t;const i={type:Ri},s={configurationKeyName:e};this._core.dispatch(i,s)}get endpoints(){const e=this._config.ENVIRONMENT;return gs[e]}async getDeviceId(){return this._config.DEVICE_ID||await this.cache.getItem("DEVICE_ID",(async()=>Ii()),(e=>"string"==typeof e))}getUserId(){return this.getValue("USER_ID")}get _maxNumberOfRetries(){return 1}get logSink(){return{error:this.error.bind(this),warn:this.warn.bind(this),info:this.log.bind(this),debug:this.debug.bind(this)}}_loggerEvent(e,t){this._core.listenerCount(Ci)>0&&this._core.emit(Ci,new Ni(e,t))}log(e){this._loggerEvent(e,Tl.Info)}debug(e){this._loggerEvent(e,Tl.Debug)}error(e){this._loggerEvent(e,Tl.Err)}warn(e){this._loggerEvent(e,Tl.Warn)}async _refreshAccessToken(){if("logged-out"!==this._config.SESSION_TYPE&&this._isTokenInvalid){if(!this._hooks.refreshAccessToken)return"";this.log("Refreshing access token from host...");try{this._config.ACCESS_TOKEN=await this._hooks.refreshAccessToken(this._config.ACCESS_TOKEN)}catch(e){throw We.wrapErrorIfNeeded(Be.AUTHORIZATION_ERROR,"Failed to refresh access token",e)}this._config.ACCESS_TOKEN&&(this._isTokenInvalid=!1),this.log("Refreshing access token "+(this._config.ACCESS_TOKEN?"successful":"unsuccessful"))}return this._config.ACCESS_TOKEN}async fetch(e,t={},i=0){var s;if(null===(s=this._hooks)||void 0===s?void 0:s.fetch)return this._hooks.fetch(e,t);const r=this._config.SESSION_TYPE,n=this._isTokenInvalid?await this._refreshAccessToken():this._config.ACCESS_TOKEN;if("logged-out"!==r&&!n)throw We.create(Be.AUTHORIZATION_ERROR,"Unable to obtain access token - did you provide a refreshAccessToken hook?");const{headers:o={},authHeader:a,noOtherHeaders:c,requestTimeoutMs:l,noApiKeyHeader:d}=t,u=qe(t,["headers","authHeader","noOtherHeaders","requestTimeoutMs","noApiKeyHeader"]),h="logged-out"!==r?{[a||"Authorization"]:`${"guest"===r?"AnonBearer":"Bearer"} ${n}`}:{},p=c?ls(o):Object.assign(Object.assign(Object.assign({},ls(o)),h),d?{}:{"X-Api-Key":this._config.CLIENT_ID}),_=new AbortController;let m=()=>{};u.signal?m=((e,...t)=>{const i=new AbortController,s=()=>{t.forEach((e=>e.removeEventListener("abort",r)))},r=()=>{i.abort(),s()};return t.some((e=>e.aborted))?r():t.forEach((e=>e.addEventListener("abort",r))),e.signal=i.signal,s})(u,u.signal,_.signal):u.signal=_.signal;const f=l||this.getValue("FETCH_REQUEST_TIMEOUT"),g=setTimeout((()=>_.abort()),f),y=Date.now();try{const s=await fetch(e,Object.assign(Object.assign({},u),{headers:p})),r=s.headers.get("X-Request-Id")||"no requestId";if(this.debug(`[${r}] ${t.method||"GET"} ${e} ${s.status} (${Date.now()-y}ms)`),clearTimeout(g),401===s.status){if(n!==this._config.ACCESS_TOKEN)return this.fetch(e,t,i+1);if(this._isTokenInvalid=!0,i<this._maxNumberOfRetries)return this.fetch(e,t,i+1)}return s}catch(t){throw this.debug(`Error - ${t} (${Date.now()-y}ms)`),We.wrapErrorIfNeeded(Be.NETWORK_ERROR,`Failed network request when fetching: ${e}`,t)}finally{m()}}getRetryInterval(e){return this.getValue(e<3?"MIN_RETRY_INTERVAL":"MAX_RETRY_INTERVAL")}}function bs(){}function Is(){Is.init.call(this)}function Es(e){return void 0===e._maxListeners?Is.defaultMaxListeners:e._maxListeners}function Ts(e,t,i,s){var r,n,o,a;if("function"!=typeof i)throw new TypeError('"listener" argument must be a function');if((n=e._events)?(n.newListener&&(e.emit("newListener",t,i.listener?i.listener:i),n=e._events),o=n[t]):(n=e._events=new bs,e._eventsCount=0),o){if("function"==typeof o?o=n[t]=s?[i,o]:[o,i]:s?o.unshift(i):o.push(i),!o.warned&&(r=Es(e))&&r>0&&o.length>r){o.warned=!0;var c=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+t+" listeners added. Use emitter.setMaxListeners() to increase limit");c.name="MaxListenersExceededWarning",c.emitter=e,c.type=t,c.count=o.length,a=c,"function"==typeof console.warn?console.warn(a):console.log(a)}}else o=n[t]=i,++e._eventsCount;return e}function Ss(e,t,i){var s=!1;function r(){e.removeListener(t,r),s||(s=!0,i.apply(e,arguments))}return r.listener=i,r}function As(e){var t=this._events;if(t){var i=t[e];if("function"==typeof i)return 1;if(i)return i.length}return 0}function Ps(e,t){for(var i=new Array(t);t--;)i[t]=e[t];return i}Ye([nt],Os.prototype,"getDeviceId",null),Ye([wt],Os.prototype,"_refreshAccessToken",null),bs.prototype=Object.create(null),Is.EventEmitter=Is,Is.usingDomains=!1,Is.prototype.domain=void 0,Is.prototype._events=void 0,Is.prototype._maxListeners=void 0,Is.defaultMaxListeners=10,Is.init=function(){this.domain=null,Is.usingDomains&&(void 0).active,this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=new bs,this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},Is.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||isNaN(e))throw new TypeError('"n" argument must be a positive number');return this._maxListeners=e,this},Is.prototype.getMaxListeners=function(){return Es(this)},Is.prototype.emit=function(e){var t,i,s,r,n,o,a,c="error"===e;if(o=this._events)c=c&&null==o.error;else if(!c)return!1;if(a=this.domain,c){if(t=arguments[1],!a){if(t instanceof Error)throw t;var l=new Error('Uncaught, unspecified "error" event. ('+t+")");throw l.context=t,l}return t||(t=new Error('Uncaught, unspecified "error" event')),t.domainEmitter=this,t.domain=a,t.domainThrown=!1,a.emit("error",t),!1}if(!(i=o[e]))return!1;var d="function"==typeof i;switch(s=arguments.length){case 1:!function(e,t,i){if(t)e.call(i);else for(var s=e.length,r=Ps(e,s),n=0;n<s;++n)r[n].call(i)}(i,d,this);break;case 2:!function(e,t,i,s){if(t)e.call(i,s);else for(var r=e.length,n=Ps(e,r),o=0;o<r;++o)n[o].call(i,s)}(i,d,this,arguments[1]);break;case 3:!function(e,t,i,s,r){if(t)e.call(i,s,r);else for(var n=e.length,o=Ps(e,n),a=0;a<n;++a)o[a].call(i,s,r)}(i,d,this,arguments[1],arguments[2]);break;case 4:!function(e,t,i,s,r,n){if(t)e.call(i,s,r,n);else for(var o=e.length,a=Ps(e,o),c=0;c<o;++c)a[c].call(i,s,r,n)}(i,d,this,arguments[1],arguments[2],arguments[3]);break;default:for(r=new Array(s-1),n=1;n<s;n++)r[n-1]=arguments[n];!function(e,t,i,s){if(t)e.apply(i,s);else for(var r=e.length,n=Ps(e,r),o=0;o<r;++o)n[o].apply(i,s)}(i,d,this,r)}return!0},Is.prototype.addListener=function(e,t){return Ts(this,e,t,!1)},Is.prototype.on=Is.prototype.addListener,Is.prototype.prependListener=function(e,t){return Ts(this,e,t,!0)},Is.prototype.once=function(e,t){if("function"!=typeof t)throw new TypeError('"listener" argument must be a function');return this.on(e,Ss(this,e,t)),this},Is.prototype.prependOnceListener=function(e,t){if("function"!=typeof t)throw new TypeError('"listener" argument must be a function');return this.prependListener(e,Ss(this,e,t)),this},Is.prototype.removeListener=function(e,t){var i,s,r,n,o;if("function"!=typeof t)throw new TypeError('"listener" argument must be a function');if(!(s=this._events))return this;if(!(i=s[e]))return this;if(i===t||i.listener&&i.listener===t)0==--this._eventsCount?this._events=new bs:(delete s[e],s.removeListener&&this.emit("removeListener",e,i.listener||t));else if("function"!=typeof i){for(r=-1,n=i.length;n-- >0;)if(i[n]===t||i[n].listener&&i[n].listener===t){o=i[n].listener,r=n;break}if(r<0)return this;if(1===i.length){if(i[0]=void 0,0==--this._eventsCount)return this._events=new bs,this;delete s[e]}else!function(e,t){for(var i=t,s=i+1,r=e.length;s<r;i+=1,s+=1)e[i]=e[s];e.pop()}(i,r);s.removeListener&&this.emit("removeListener",e,o||t)}return this},Is.prototype.off=function(e,t){return this.removeListener(e,t)},Is.prototype.removeAllListeners=function(e){var t,i;if(!(i=this._events))return this;if(!i.removeListener)return 0===arguments.length?(this._events=new bs,this._eventsCount=0):i[e]&&(0==--this._eventsCount?this._events=new bs:delete i[e]),this;if(0===arguments.length){for(var s,r=Object.keys(i),n=0;n<r.length;++n)"removeListener"!==(s=r[n])&&this.removeAllListeners(s);return this.removeAllListeners("removeListener"),this._events=new bs,this._eventsCount=0,this}if("function"==typeof(t=i[e]))this.removeListener(e,t);else if(t)do{this.removeListener(e,t[t.length-1])}while(t[0]);return this},Is.prototype.listeners=function(e){var t,i,s=this._events;return i=s&&(t=s[e])?"function"==typeof t?[t.listener||t]:function(e){for(var t=new Array(e.length),i=0;i<t.length;++i)t[i]=e[i].listener||e[i];return t}(t):[],i},Is.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):As.call(e,t)},Is.prototype.listenerCount=As,Is.prototype.eventNames=function(){return this._eventsCount>0?Reflect.ownKeys(this._events):[]};const ws="observed",Cs="unobserved";class Rs extends Is{dispatch(e,t){return super.emit(e.type,e,this,t)}once(e,t){const i=super.once(e,t);return this._onEventListenerAdded(),i}on(e,t){if(this.listeners(e).includes(t))return this;const i=super.on(e,t);return e!==ws&&e!==Cs&&(this._onEventListenerAdded(),1===this.listenerCount(e)&&this.emit(ws,e)),i}off(e,t){const i=super.off(e,t);return e!==ws&&e!==Cs&&(this._onEventListenerRemoved(),0===this.listenerCount(e)&&this.emit(Cs,e)),i}_onEventListenerAdded(){}_onEventListenerRemoved(){}}var Ls={name:"@ccx-public/shared-asset-model-js",version:"10.0.561",private:!1,publishConfig:{registry:"https://artifactory.corp.adobe.com/artifactory/api/npm/npm-adobe-release-local/",scope:"@ccx-public"},repository:{type:"git",url:"https://git.corp.adobe.com/ccx/shared-asset-model"},license:"Apache-2.0",main:"./dist/cjs/src/index.js",module:"./dist/mjs/src/index.js",types:"./dist/mjs/src/index.d.ts",exports:{".":{import:"./dist/mjs/src/index.js",require:"./dist/cjs/src/index.js"}},dependencies:{"@apollo/client":"^3.11.1","@ccx-public/component-types":"^1.0.428","@formatjs/intl":"^2.6.5","@opentelemetry/api":"1.7.0","@types/json-patch":"0.0.30","@types/semver":"^7.3.13","abort-controller":"3.0.0","apollo3-cache-persist":"^0.15.0",events:"3.0.0","gql-query-builder":"^3.8.0",graphql:"^16.9.0","http-link-header":"1.1.0","isomorphic-ws":"^5.0.0",md5:"^2.3.0",microdiff:"1.3.1","path-browserify":"^1.0.1","query-string":"7.0.0","uri-templates":"0.2.0",uuid:"3.3.2",ws:"^8.18.0"},engines:{node:">=20.18.1",npm:">=8.0.0"},devDependencies:{"@graphql-codegen/cli":"^5.0.5","@graphql-codegen/fragment-matcher":"^5.1.0","@graphql-codegen/typescript":"^4.1.5","@graphql-codegen/typescript-operations":"^4.5.1","@relative-ci/agent":"^4.2.3","@rollup/plugin-alias":"^5.1.1","@rollup/plugin-commonjs":"^20.0.0","@rollup/plugin-json":"^4.1.0","@rollup/plugin-node-resolve":"^13.0.4","@swc/core":"1.11.7","@swc/jest":"0.2.37","@types/classnames":"^2.2.7","@types/events":"^3.0.0","@types/http-link-header":"1.0.3","@types/istanbul-lib-report":"^3.0.3","@types/jest":"^29.5.14","@types/md5":"^2.3.1","@types/node":"20.12.0","@types/node-fetch":"^2.5.10","@types/path-browserify":"^1.0.2","@types/uri-templates":"file:@types/uri-templates","@types/uuid":"^3.3.2","@types/ws":"^8.5.12","@typescript-eslint/eslint-plugin":"^5.62.0","@typescript-eslint/parser":"^5.62.0",classnames:"^2.2.6","cross-env":"^7.0.3","cross-fetch":"^4.0.0",eslint:"^8.3.0","eslint-config-prettier":"^8.3.0","eslint-plugin-diff":"^2.0.3","fake-indexeddb":"^4.0.2",http:"^0.0.1-security",husky:"4.3.3",jest:"^29.7.0","jest-environment-jsdom":"^29.7.0","jest-junit":"^16.0.0","jest-mock":"^29.7.0","jest-websocket-mock":"^2.5.0","lint-staged":"^10.3.0","merge-dirs":"^0.2.1",mobx:"^6.3.2","mock-socket":"^9.3.1",nock:"^13.5.5",postcss:"^8.3.6",prettier:"^2.8.8",react:"^17.0.2","react-dom":"^17.0.2",rollup:"^2.56.2","rollup-plugin-mv":"^0.0.2","rollup-plugin-polyfill-node":"^0.11.0","rollup-plugin-typescript2":"^0.36.0","rollup-plugin-webpack-stats":"^0.2.3",swc_mut_cjs_exports:"8.0.1","ts-node":"^9.0.0",tslib:"^2.1.0",typedoc:"^0.27.9","typedoc-plugin-external-module-name":"^4.0.3",typescript:"^4.9.5","typescript-plugin-css-modules":"^3.4.0",xml2js:"^0.6.2",yargs:"^17.7.2"},scripts:{pretest:"yarn tsc -p ./__tests__/tsconfig.json --noEmit",test:"node --expose-gc --allow-natives-syntax ../../node_modules/jest/bin/jest.js --logHeapUsage","test:debugnock":"DEBUG=nock.* yarn test","test:watch":"node --allow-natives-syntax ../../node_modules/jest/bin/jest.js --watchAll --no-cache",lint:"eslint --ext .ts,.tsx,.js --quiet ./src","lint:fix":"eslint --fix --ext .ts,.tsx,.js --quiet ./src",prebuild:"yarn tsc --build --force",build:"yarn rollup -c ./rollup.config.js",postbuild:"node ./scripts/postbuild.js && npx relative-ci-agent",watch:"yarn rollup -c ./rollup.config.js --watch",codegen:"graphql-codegen"},husky:{hooks:{"pre-commit":"lint-staged"}},"lint-staged":{"**/*.{ts,tsx,js}":["eslint --fix","yarn test --bail --coverage=false --onlyChanged --findRelatedTests --passWithNoTests"]}};const Ns=Symbol.for("com.adobe.ccac.samjs.extendclass.override_map"),Ds=Symbol.for("com.adobe.ccac.samjs.extendclass.extension_set"),Ms=Symbol.for("com.adobe.ccac.samjs.extendclass.observable_set"),xs=Symbol.for("com.adobe.ccac.samjs.extendclass.emitter"),ks=Symbol.for("com.adobe.ccac.samjs.extendclass.overridden_getters");function Hs({klass:e,core:t,extensions:i={},overrides:s={},eventMap:r={},defaultObservableEvent:n,observableMap:o={}}){const a=Object.getOwnPropertyDescriptors(e.prototype);let c=a;function l(e,t){const i=e[t];if("function"==typeof e[t])return{value:i};if(["string","boolean","number"].includes(typeof e[t]))throw new Error("Cannot use primitives for PropertyDescriptor");return i}void 0===c.on&&(c=Object.getOwnPropertyDescriptors(Object.getPrototypeOf(e.prototype))),a._core||Object.defineProperty(e.prototype,"_core",{value:t}),Object.getOwnPropertyDescriptor(e.prototype,ks)||Object.defineProperty(e.prototype,ks,{value:{}}),Object.getOwnPropertyDescriptor(e.prototype,xs)||Object.defineProperties(e.prototype,{[xs]:{get(){var e;let t;return t="function"==typeof(null===(e=c.on)||void 0===e?void 0:e.value)?{on:c.on.value.bind(this),off:c.off.value.bind(this),emit:c.trigger.value.bind(this),addListener:c.on.value.bind(this),removeListener:c.off.value.bind(this)}:new Is,Object.defineProperty(this,xs,{value:t}),this[xs]}},on:{value(e,...t){var i;return(null!==(i=r[e])&&void 0!==i?i:[e]).forEach((e=>this[xs].on(e,...t))),this}},addListener:{value(...e){return this.on(...e)}},off:{value(e,...t){var i;return(null!==(i=r[e])&&void 0!==i?i:[e]).forEach((e=>this[xs].off(e,...t))),this}},removeListener:{value(...e){return this.off(...e)}},emit:{value(...e){return this[xs].emit(...e)}},dispatch:{value(e){return this.emit(e.type,e,this)}}});const d=new Set,u=e.prototype[Ds]||new Set;Object.keys(i).forEach((t=>{if(a[t])return;const s=l(i,t);Object.defineProperty(e.prototype,t,s),d.add(t),u.add(t)})),e.prototype[Ds]=u;const h=e.prototype[Ns]||new Set;Object.keys(s).forEach((t=>{if(h.has(t))return;if(d.has(t)||u.has(t))throw new Error(`[ExtendClass] cannot override property '${t}' because it is an extension.`);if(!a[t])throw new Error(`[ExtendClass] target class does not have property '${t}' so it cannot be overridden.`);const i=l(s,t),r=a[t].value;"function"==typeof r?Object.defineProperty(e.prototype,t,{get(){return i.value.original=r.bind(this),i.value}}):(a[t].get&&(e.prototype[ks][t]=a[t].get),Object.defineProperty(e.prototype,t,i)),h.add(t),d.add(t)})),e.prototype[Ns]=h;const p={};Object.keys(o).reduce(((e,t)=>(o[t].forEach((i=>{if(e.has(i))throw new Error(`[ExtendClass] cannot have the same property (${i}) appear multiple times in observableMap`);if(d.has(i))throw new Error(`[ExtendClass] cannot make property (${i}) observable as it was defined in extensions/overrides`);e.add(i),p[i]=t})),e)),new Set),n&&Object.keys(a).filter((e=>!!a[e].get)).forEach((e=>p[e]=n));const _=e.prototype[Ms]||new Set;[...u,...h,..._].forEach((e=>d.add(e))),Object.entries(p).forEach((([t,i])=>{var s;(null===(s=a[t])||void 0===s?void 0:s.get)&&!d.has(t)&&(Object.defineProperty(e.prototype,t,{get(){return this._core._environment.mobx.reportObserved(this,i),a[t].get.call(this)}}),_.add(t))})),e.prototype[Ms]=_}function js(e){if("string"!=typeof e)throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}function Us(e,t){for(var i,s="",r=0,n=-1,o=0,a=0;a<=e.length;++a){if(a<e.length)i=e.charCodeAt(a);else{if(47===i)break;i=47}if(47===i){if(n===a-1||1===o);else if(n!==a-1&&2===o){if(s.length<2||2!==r||46!==s.charCodeAt(s.length-1)||46!==s.charCodeAt(s.length-2))if(s.length>2){var c=s.lastIndexOf("/");if(c!==s.length-1){-1===c?(s="",r=0):r=(s=s.slice(0,c)).length-1-s.lastIndexOf("/"),n=a,o=0;continue}}else if(2===s.length||1===s.length){s="",r=0,n=a,o=0;continue}t&&(s.length>0?s+="/..":s="..",r=2)}else s.length>0?s+="/"+e.slice(n+1,a):s=e.slice(n+1,a),r=a-n-1;n=a,o=0}else 46===i&&-1!==o?++o:o=-1}return s}var Bs={resolve:function(){for(var e,t="",i=!1,s=arguments.length-1;s>=-1&&!i;s--){var r;s>=0?r=arguments[s]:(void 0===e&&(e=Ue.cwd()),r=e),js(r),0!==r.length&&(t=r+"/"+t,i=47===r.charCodeAt(0))}return t=Us(t,!i),i?t.length>0?"/"+t:"/":t.length>0?t:"."},normalize:function(e){if(js(e),0===e.length)return".";var t=47===e.charCodeAt(0),i=47===e.charCodeAt(e.length-1);return 0!==(e=Us(e,!t)).length||t||(e="."),e.length>0&&i&&(e+="/"),t?"/"+e:e},isAbsolute:function(e){return js(e),e.length>0&&47===e.charCodeAt(0)},join:function(){if(0===arguments.length)return".";for(var e,t=0;t<arguments.length;++t){var i=arguments[t];js(i),i.length>0&&(void 0===e?e=i:e+="/"+i)}return void 0===e?".":Bs.normalize(e)},relative:function(e,t){if(js(e),js(t),e===t)return"";if((e=Bs.resolve(e))===(t=Bs.resolve(t)))return"";for(var i=1;i<e.length&&47===e.charCodeAt(i);++i);for(var s=e.length,r=s-i,n=1;n<t.length&&47===t.charCodeAt(n);++n);for(var o=t.length-n,a=r<o?r:o,c=-1,l=0;l<=a;++l){if(l===a){if(o>a){if(47===t.charCodeAt(n+l))return t.slice(n+l+1);if(0===l)return t.slice(n+l)}else r>a&&(47===e.charCodeAt(i+l)?c=l:0===l&&(c=0));break}var d=e.charCodeAt(i+l);if(d!==t.charCodeAt(n+l))break;47===d&&(c=l)}var u="";for(l=i+c+1;l<=s;++l)l!==s&&47!==e.charCodeAt(l)||(0===u.length?u+="..":u+="/..");return u.length>0?u+t.slice(n+c):(n+=c,47===t.charCodeAt(n)&&++n,t.slice(n))},_makeLong:function(e){return e},dirname:function(e){if(js(e),0===e.length)return".";for(var t=e.charCodeAt(0),i=47===t,s=-1,r=!0,n=e.length-1;n>=1;--n)if(47===(t=e.charCodeAt(n))){if(!r){s=n;break}}else r=!1;return-1===s?i?"/":".":i&&1===s?"//":e.slice(0,s)},basename:function(e,t){if(void 0!==t&&"string"!=typeof t)throw new TypeError('"ext" argument must be a string');js(e);var i,s=0,r=-1,n=!0;if(void 0!==t&&t.length>0&&t.length<=e.length){if(t.length===e.length&&t===e)return"";var o=t.length-1,a=-1;for(i=e.length-1;i>=0;--i){var c=e.charCodeAt(i);if(47===c){if(!n){s=i+1;break}}else-1===a&&(n=!1,a=i+1),o>=0&&(c===t.charCodeAt(o)?-1==--o&&(r=i):(o=-1,r=a))}return s===r?r=a:-1===r&&(r=e.length),e.slice(s,r)}for(i=e.length-1;i>=0;--i)if(47===e.charCodeAt(i)){if(!n){s=i+1;break}}else-1===r&&(n=!1,r=i+1);return-1===r?"":e.slice(s,r)},extname:function(e){js(e);for(var t=-1,i=0,s=-1,r=!0,n=0,o=e.length-1;o>=0;--o){var a=e.charCodeAt(o);if(47!==a)-1===s&&(r=!1,s=o+1),46===a?-1===t?t=o:1!==n&&(n=1):-1!==t&&(n=-1);else if(!r){i=o+1;break}}return-1===t||-1===s||0===n||1===n&&t===s-1&&t===i+1?"":e.slice(t,s)},format:function(e){if(null===e||"object"!=typeof e)throw new TypeError('The "pathObject" argument must be of type Object. Received type '+typeof e);return function(e,t){var i=t.dir||t.root,s=t.base||(t.name||"")+(t.ext||"");return i?i===t.root?i+s:i+"/"+s:s}(0,e)},parse:function(e){js(e);var t={root:"",dir:"",base:"",ext:"",name:""};if(0===e.length)return t;var i,s=e.charCodeAt(0),r=47===s;r?(t.root="/",i=1):i=0;for(var n=-1,o=0,a=-1,c=!0,l=e.length-1,d=0;l>=i;--l)if(47!==(s=e.charCodeAt(l)))-1===a&&(c=!1,a=l+1),46===s?-1===n?n=l:1!==d&&(d=1):-1!==n&&(d=-1);else if(!c){o=l+1;break}return-1===n||-1===a||0===d||1===d&&n===a-1&&n===o+1?-1!==a&&(t.base=t.name=0===o&&r?e.slice(1,a):e.slice(o,a)):(0===o&&r?(t.name=e.slice(1,n),t.base=e.slice(1,a)):(t.name=e.slice(o,n),t.base=e.slice(o,a)),t.ext=e.slice(n,a)),o>0?t.dir=e.slice(0,o-1):r&&(t.dir="/"),t},sep:"/",delimiter:":",win32:null,posix:null};Bs.posix=Bs;var Fs=Bs;class Vs{constructor(e,t){this.task=e,this.onGotOwnership=t}registerNewTask(e){let t=this;for(;t;){const i=t.next;if(!i)return void(t.next=e);t=i}}}class Ks extends Rs{constructor(e,t){super(),this._core=e,this.id=t}get lastKnownClientMutation(){return this._lastKnownClientMutation}updateLastKnownClientMutation(){this._lastKnownClientMutation=Date.now()}async waitForMutationPropagationIfNeeded(e){const t=this._lastKnownClientMutation;if(t){const i=t+e-Date.now();i>0&&await new Promise((e=>setTimeout(e,i)))}}get exclusiveTask(){var e;return null===(e=this._exclusiveTaskChain)||void 0===e?void 0:e.task}_setExclusiveTaskChain(e){this._exclusiveTaskChain=e,this.dispatch(lt)}_setId(e){this.id=e}static runExclusiveTask(e,t,i){return new Promise((s=>{const r={name:e,items:t},n=()=>s(i(r).finally((()=>{for(const e of t){const t=e._exclusiveTaskChain.next;e._setExclusiveTaskChain(t),null==t||t.onGotOwnership()}})));let o=0;const a=()=>{0==--o&&setTimeout(n,0)};for(const e of t){const t=new Vs(r,a),i=e._exclusiveTaskChain;i?(++o,i.registerNewTask(t)):e._setExclusiveTaskChain(t)}0===o&&n()}))}}Ye([ht],Ks.prototype,"exclusiveTask",null);var Gs=/^utf-?8|ascii|utf-?16-?le|ucs-?2|base-?64|latin-?1$/i,$s=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,Ws=/\s|\uFEFF|\xA0/,zs=/\r?\n[\x20\x09]+/g,qs=/[;,"]/,Ys=/[;,"]|\s/,Qs=/^[!#$%&'*+\-\.^_`|~\da-zA-Z]+$/;function Js(e){return e.replace($s,"")}function Xs(e){return Ws.test(e)}function Zs(e,t){for(;Xs(e[t]);)t++;return t}function er(e){return Ys.test(e)||!Qs.test(e)}class tr{constructor(e){this.refs=[],e&&this.parse(e)}rel(e){for(var t=[],i=e.toLowerCase(),s=0;s<this.refs.length;s++)this.refs[s].rel.toLowerCase()===i&&t.push(this.refs[s]);return t}get(e,t){e=e.toLowerCase();for(var i=[],s=0;s<this.refs.length;s++)this.refs[s][e]===t&&i.push(this.refs[s]);return i}set(e){return this.refs.push(e),this}setUnique(e){return this.refs.some((t=>{return i=t,s=e,Object.keys(i).length===Object.keys(s).length&&Object.keys(i).every((e=>e in s&&i[e]===s[e]));var i,s}))||this.refs.push(e),this}has(e,t){e=e.toLowerCase();for(var i=0;i<this.refs.length;i++)if(this.refs[i][e]===t)return!0;return!1}parse(e,t){for(var i=1,s=(e=Js(e=(t=t||0)?e.slice(t):e).replace(zs,"")).length,r=(t=0,null);t<s;)if(1===i){if(Xs(e[t])){t++;continue}if("<"!==e[t])throw new Error('Unexpected character "'+e[t]+'" at offset '+t);if(null!=r&&(null!=r.rel?this.refs.push(...tr.expandRelations(r)):this.refs.push(r)),-1===(a=e.indexOf(">",t)))throw new Error("Expected end of URI delimiter at offset "+t);r={uri:e.slice(t+1,a)},t=a,i=2,t++}else if(2===i){if(Xs(e[t])){t++;continue}if(";"===e[t])i=4,t++;else{if(","!==e[t])throw new Error('Unexpected character "'+e[t]+'" at offset '+t);i=1,t++}}else{if(4!==i)throw new Error('Unknown parser state "'+i+'"');if(";"===e[t]||Xs(e[t])){t++;continue}if(-1===(a=e.indexOf("=",t)))throw new Error("Expected attribute delimiter at offset "+t);var n=Js(e.slice(t,a)).toLowerCase(),o="";if('"'===e[t=Zs(e,t=a+1)])for(t++;t<s;){if('"'===e[t]){t++;break}"\\"===e[t]&&t++,o+=e[t],t++}else{for(var a=t+1;!qs.test(e[a])&&a<s;)a++;o=e.slice(t,a),t=a}switch(r[n]&&tr.isSingleOccurenceAttr(n)||("*"===n[n.length-1]?r[n]=tr.parseExtendedValue(o):(o="type"===n?o.toLowerCase():o,null!=r[n]?Array.isArray(r[n])?r[n].push(o):r[n]=[r[n],o]:r[n]=o)),e[t]){case",":i=1;break;case";":i=4}t++}return null!=r&&(null!=r.rel?this.refs.push(...tr.expandRelations(r)):this.refs.push(r)),r=null,this}toString(){for(var e=[],t="",i=null,s=0;s<this.refs.length;s++)i=this.refs[s],t=Object.keys(this.refs[s]).reduce((function(e,t){return"uri"===t?e:e+"; "+tr.formatAttribute(t,i[t])}),"<"+i.uri+">"),e.push(t);return e.join(", ")}}tr.isCompatibleEncoding=function(e){return Gs.test(e)},tr.parse=function(e,t){return(new tr).parse(e,t)},tr.isSingleOccurenceAttr=function(e){return"rel"===e||"type"===e||"media"===e||"title"===e||"title*"===e},tr.isTokenAttr=function(e){return"rel"===e||"type"===e||"anchor"===e},tr.escapeQuotes=function(e){return e.replace(/"/g,'\\"')},tr.expandRelations=function(e){return e.rel.split(" ").map((function(t){var i=Object.assign({},e);return i.rel=t,i}))},tr.parseExtendedValue=function(e){var t=/([^']+)?(?:'([^']*)')?(.+)/.exec(e);return{language:t[2].toLowerCase(),encoding:tr.isCompatibleEncoding(t[1])?null:t[1].toLowerCase(),value:tr.isCompatibleEncoding(t[1])?decodeURIComponent(t[3]):t[3]}},tr.formatExtendedAttribute=function(e,t){var i=(t.encoding||"utf-8").toUpperCase();return e+"="+i+"'"+(t.language||"en")+"'"+(Buffer.isBuffer(t.value)&&tr.isCompatibleEncoding(i)?t.value.toString(i):Buffer.isBuffer(t.value)?t.value.toString("hex").replace(/[0-9a-f]{2}/gi,"%$1"):encodeURIComponent(t.value))},tr.formatAttribute=function(e,t){return Array.isArray(t)?t.map((t=>tr.formatAttribute(e,t))).join("; "):"*"===e[e.length-1]||"string"!=typeof t?tr.formatExtendedAttribute(e,t):(tr.isTokenAttr(e)?t=er(t)?'"'+tr.escapeQuotes(t)+'"':tr.escapeQuotes(t):er(t)&&(t='"'+(t=(t=encodeURIComponent(t)).replace(/%20/g," ").replace(/%2C/g,",").replace(/%3B/g,";"))+'"'),e+"="+t)};var ir=tr;const sr=function(){let e=33;const t=["^(["];for(let i=34;i<=127;++i)127!==i&&-1==='()<@,;:"/[]={}'.indexOf(String.fromCharCode(i))||(t.push("\\"+e.toString(8)),e<i-1&&t.push("-\\"+(i-1).toString(8)),e=i+1);return t.push("]+):(.*)$"),new RegExp(t.join(""))}(),rr=/^[^\s]+\s+(\d+)\s*(.*)$/;class nr{constructor(e){this._text=e,this._index=0}readLine(){const{_index:e,_text:t}=this,i=t.indexOf("\n",e);if(-1===i)return;this._index=i+1;let s=t.slice(e,i);return s.endsWith("\r")&&(s=s.slice(0,-1)),s}get remainderText(){return this._text.slice(this._index)}}function or(e,t,i){return void 0!==t&&e<t?t:void 0!==i&&e>i?i:e}class ar extends Rs{constructor(e){super(),this._core=e}}class cr extends Is{constructor(e){super(),this._core=e}}function lr(e){return e&&"function"==typeof e.json}function dr(e){return"data"in e||"errors"in e}class ur extends ar{constructor(e,t={}){super(e),this._core=e,this._options=t,this._isLoaded=!1,this._etag="",this.isDirty=!1,this._activeRevalidations=new Map}async _loadData(){var e,t;return null===(t=(e=this._options).loadData)||void 0===t?void 0:t.call(e)}async _onChange(e){var t,i;await(null===(i=(t=this._options).onChange)||void 0===i?void 0:i.call(t,this.data,e)),this.emit("change")}async load(){await this._loadData()}async get(e){return(e.forceRefresh||!this.isLoaded||this.isDirty)&&await this.load(),this.data}async unload(){this._data=void 0,this._etag="",this._error=void 0,this._isLoaded=!1,await this._onChange()}get isLoaded(){return this._isLoaded}get data(){return this._data}get etag(){return this._etag||""}get error(){return this._error}async _setData(e,t={}){this._data=e,this._etag=t.etag||"",this._error=void 0,this._isLoaded=!0,await this._onChange(t)}async _mergeData(e){this._data=Object.assign(Object.assign({},this._data||{}),e||{}),this._etag="",await this._onChange()}async _parse(e){var t,i,s,r,n,o,a;if(this._parserOverride)return this._parserOverride(e);if(lr(e))return null!==(s=null===(i=(t=this._options).parseResponse)||void 0===i?void 0:i.call(t,e))&&void 0!==s?s:e.json();if(dr(e)){if(null===(r=e.errors)||void 0===r?void 0:r[0]){if(!e.data)throw We.createWithGraphQLError(e.errors[0]);this._core._environment.error("GraphQL response contained errors but also data; ignoring partial errors: "+JSON.stringify(e.errors))}return null!==(a=null===(o=(n=this._options).parseGraphQLResult)||void 0===o?void 0:o.call(n,e))&&void 0!==a?a:e.data}throw We.create(Be.INTERNAL_ERROR,"Resource.parse() received an unexpected response type: "+e)}set parser(e){this._parserOverride=e}get skipRevalidation(){var e,t,i;return null!==(i=null===(t=(e=this._options).skipRevalidation)||void 0===t?void 0:t.call(e))&&void 0!==i&&i}get skipCache(){var e,t,i;return null!==(i=null===(t=(e=this._options).skipCache)||void 0===t?void 0:t.call(e))&&void 0!==i&&i}async _setError(e){var t,i;try{this._error=e,await(null===(i=(t=this._options).onError)||void 0===i?void 0:i.call(t,e))}catch(e){this._error=e}}static getDefaultCacheKey(e,t,i){if(!i||"string"==typeof i)return`${e}-${t}-${null!=i?i:""}`}async deleteCachedResponse(){if(this._cacheKey){const e=this._core._environment._responseCache;e&&(await e.deleteCachedResponse(this._cacheKey),this._cacheKey=void 0)}}async _interceptFetch(e,t,i,s){var r,n,o,a,c,l,d;const u=this._core._environment._responseCache;let h;(null===(n=(r=this._options).skipCache)||void 0===n?void 0:n.call(r))||(this._cacheKey=null!==(c=null===(a=(o=this._options).getCacheKey)||void 0===a?void 0:a.call(o,e,t,i))&&void 0!==c?c:ur.getDefaultCacheKey(e,t,i),h=this.isDirty||!this._cacheKey?void 0:await(null==u?void 0:u.getCachedResponse(this._cacheKey)));const p=h&&!(null===(d=(l=this._options).skipRevalidation)||void 0===d?void 0:d.call(l)),_=async()=>{let e;try{e=await s(),this._cacheKey&&u&&await(null==u?void 0:u.saveResponseToCache(this._cacheKey,e));const t=await e.matches(h);return await this._setData(await this._parse(e),{etag:e.headers.get("ETag")||"",changed:p&&!t,loading:!1}),e}catch(e){if(await this._setError(e),this._error)throw this._error;return new Response}},m=async()=>{const e=this._cacheKey&&this._activeRevalidations.get(this._cacheKey);if(e)return await e;try{const e=_();return this._cacheKey&&this._activeRevalidations.set(this._cacheKey,e),await e}finally{this._cacheKey&&this._activeRevalidations.delete(this._cacheKey)}};return h?(p&&m(),await this._setData(await this._parse(h),{etag:h.headers.get("ETag")||"",changed:!1,loading:p}),h):m()}}Ye([ht],ur.prototype,"isLoaded",null),Ye([ht],ur.prototype,"data",null),Ye([ht],ur.prototype,"etag",null),Ye([ht],ur.prototype,"error",null);class hr extends ur{constructor(e){super(e,{parseResponse:async e=>e,skipCache:()=>!0}),this._core=e}}class pr{constructor(e){this._core=e,this._useHighPriorityRequestsIfEnabled=!1,this._sharedResponses=new Map}async _fetch(e,t={successResponseCodes:St}){var i;const{resource:s=new hr(this._core)}=t,r=qe(t,["resource"]);return await s._interceptFetch(null!==(i=t.method)&&void 0!==i?i:"GET",e,t.body,(()=>this._fetchImpl(e,r,0).then(hs.fromResponse)))}async _fetchImpl(e,t,i){const{additionalRetryErrorCodes:s,successResponseCodes:r=St}=t,n=qe(t,["additionalRetryErrorCodes","successResponseCodes"]),o=[...At,...s||[]],a=await this._getFetchOptionOverrides(e,n);let c=await this._core._environment.fetch(a.href,a.options);const{status:l}=c;if(202===l&&(c=await this._monitorResponse(c)),t.handleError&&l>=400&&await t.handleError(c.clone()),l>=400&&(Et(c.headers)||o.includes(l))){if(i<5){const s=this._getRetryErrorDelay(c,i);return this._core._environment.log(`Retryable error ${l} retrying in ${s}ms, ${i} retries so far`),await new Promise((e=>setTimeout(e,s))),await this._fetchImpl(e,t,i+1)}this._core._environment.log(`Retryable error ${l} attempt ${i} exceeded 5 retries`)}return"any"!==r&&this._checkResponseStatus(c,e,r),c}_checkResponseStatus(e,t,i){if(!i.includes(e.status)){const i=We.createWithResponse(e,t);throw this._core._environment.error(`InterfaceBase error ${i}`),i}}async _monitorResponse(e){let t=e.headers.get("location");if(!t){const i=await e.json();if(!i)throw We.create(Be.BAD_REQUEST,"Failed to parse content for 202 monitor response.");if(t=i.href,!t)throw We.create(Be.BAD_REQUEST,"Missing href property for 202 monitor response.")}const i=this._getMonitorRetryAfter(e.headers);return this._fetchMonitorResponse(e.url,t,i)}async _fetchMonitorResponse(e,t,i){var s;i&&await new Promise((e=>setTimeout(e,i)));const r=await this._core._environment.fetch(t),n=await r.text();if(this._shouldRetryMonitorResponse(r,n)){const i=this._getMonitorRetryAfter(r.headers);return this._fetchMonitorResponse(e,t,i)}return(null===(s=r.headers.get("content-type"))||void 0===s?void 0:s.includes("application/json"))?new hs(e,new Headers(r.headers),r.status,r.statusText,n):function(e,t){if(!t)throw We.create(Be.INTERNAL_ERROR,"Invalid async response body.");const i=new nr(t);let s,r;const n=i.readLine();if(n){const e=n.match(rr);if(!e)throw We.create(Be.INTERNAL_ERROR,"Invalid status line for async response.");if(s=parseInt(e[1],10),!s)throw We.create(Be.INTERNAL_ERROR,"Could not find status code for async response.");r=e[2]}else s=200,r="";const o=[];let a;for(;;){const e=i.readLine();if(!e)break;const t=e.match(sr);t?(a=t[1],o.push([a,t[2]])):a&&o.push([a,e])}return new hs(e,new Headers(o),s,r,i.remainderText)}(e,n)}_shouldRetryMonitorResponse(e,t){return 202===e.status}_getMonitorRetryAfter(e){return 1e3*Et(e)||this._core._environment.getValue("ASYNC_DEFAULT_DELAY")}_getRetryErrorDelay(e,t){const i=this._core._environment.getValue("MIN_RETRY_INTERVAL"),s=this._core._environment.getValue("MAX_RETRY_INTERVAL");return or(1e3*(e&&Et(e.headers)||Math.pow(2,t)),i,s)}async _doGet(e,t){return this._fetch(e,Object.assign({method:"GET",successResponseCodes:St},t))}async _doHead(e,t={}){return this._fetch(e,{method:"HEAD",headers:t})}async _doPost(e,t={},i,s=[201],r=!1,n){return this._fetch(e,{method:"POST",headers:t,noOtherHeaders:r,body:i,successResponseCodes:s,resource:n})}async _doPatch(e,t={},i,s=[200]){return this._fetch(e,{method:"PATCH",headers:t,body:i,successResponseCodes:s})}async _doPut(e,t={},i,s=[201],r=!1,n){return this._fetch(e,Object.assign({method:"PUT",headers:t,body:i,noOtherHeaders:r,successResponseCodes:s},n))}async _doDelete(e,t={},i=[200],s=!1){return this._fetch(e,{method:"DELETE",headers:t,noOtherHeaders:s,successResponseCodes:i})}async _getResponse(e,t){return(await this._doGet(e,t)).json()}async _getSharedResponse(e,t={}){let i=this._sharedResponses.get(e);return i||(i=this._getResponse(e,{headers:t}),this._sharedResponses.set(e,i),i.finally((()=>this._sharedResponses.delete(e)))),i}async _getPagedResponse(e,t={}){var i,s;const r=await this._getResponse(e,t);if((null===(i=null==r?void 0:r._page)||void 0===i?void 0:i.next)&&(null===(s=null==r?void 0:r._links)||void 0===s?void 0:s[yt.PAGE])){const e=mt(r._links[yt.PAGE].href).fill(Object.assign(Object.assign({},r._page),{start:r._page.next,resource:yt.PRIMARY}));return{result:r,next:()=>this._getPagedResponse(e,t)}}return{result:r}}_getAllPages(e,t={}){let i;const s=async e=>{const t=await e(),r=t&&t.result&&t.result.children;return r?(i?i.children=i.children.concat(r):i=t.result,t.next?s(t.next):i):i};return s((()=>this._getPagedResponse(e,t)))}_getLinksFromHeaders(e){const t=e&&e.get("Link");if(!t)throw We.create(Be.UNKNOWN,"HEAD request did not return link header");const i=ir.parse(t);return i&&i.refs.reduce(((e,t)=>{var{rel:i,uri:s}=t,r=qe(t,["rel","uri"]);return i&&(e[i]=e[i]||[],e[i].push(Object.assign({href:s},r))),e}),{})}async _getFetchOptionOverrides(e,t){this._useHighPriorityRequestsIfEnabled&&this._core._environment.getValue("HIGH_PRIORITY_RAPI_REQUESTS")&&(e=e.includes("platform-cs-edge")?e:e.replace("platform-cs","platform-cs-edge"),t.headers=Object.assign(Object.assign({},t.headers||{}),{Priority:"u=1"}));const i=this._core._environment.getValue("ADMIN_MODE_ORG_ID");i&&(t.headers=Object.assign(Object.assign({},t.headers||{}),{"X-ACP-ADMIN-PRIVILEGES":i})),this._core._environment.getValue("REQUEST_EDGE_BASED_PUBLISHED_LINKS")&&e.startsWith("https://platform-cs")&&(t.headers=Object.assign(Object.assign({},t.headers||{}),{"acpc-published-links":"true"}));const s=this._core._environment.getValue("REQUEST_AS_USER_ID");s&&(t.headers=Object.assign(Object.assign({},t.headers||{}),{"User-Id":s}));const r=this._core._environment.getValue("REQUEST_ID"),n=this._core._environment.getValue("BREADCRUMB_TRAIL"),o=Ii();r&&(t.headers=Object.assign(Object.assign({},t.headers||{}),{"x-request-id":`${r}:${o}`})),n&&(t.headers=Object.assign(Object.assign({},t.headers||{}),{"x-breadcrumb-trail":`${n}-SAMJS_${o}`}));const a=this._core._environment.getValue("EXECUTION_CONTEXT_CLIENT_AGENT");return a&&(t.headers=Object.assign(Object.assign({},t.headers||{}),{"Client-Agent":Object.entries(a).map((([e,t])=>`${e}=${t||"na"}`)).join("; ")})),{href:e,options:t}}}const _r=new FinalizationRegistry((e=>{URL.revokeObjectURL(e)}));var mr,fr,gr;!function(e){e[e.NotStarted=0]="NotStarted",e[e.Fetching=1]="Fetching",e[e.Done=2]="Done",e[e.Error=3]="Error"}(mr||(mr={})),function(e){e[e.Size64=64]="Size64",e[e.Size128=128]="Size128",e[e.Size256=256]="Size256",e[e.Size512=512]="Size512",e[e.Size1024=1024]="Size1024"}(fr||(fr={})),function(e){e.PNG="image/png",e.JPEG="image/jpeg"}(gr||(gr={}));const yr=fr.Size512,vr=[fr.Size64,fr.Size128,fr.Size256,fr.Size512,fr.Size1024];class Or extends Rs{constructor(e,t,i){super(),this._core=e,this._availableSizes=t,this._fetchRenditionBlob=i,this._entries=[],this._versionToken=""}_getStandardSize(e,t=this._availableSizes){const i=[...t].sort(((e,t)=>e-t)),s=i.findIndex((t=>t>=e));return-1===s?i[i.length-1]:i[s]}_findURLEntry(e,t){const i=this._getStandardSize(e);if(this._entries.length>0)return this._entries.find((e=>e.size===i&&e.type===t&&e.status!==mr.Error))}_clearStaleEntries(e){const t=this._entries.filter((t=>t.versionToken!==e||(URL.revokeObjectURL(t.url),!1)));this._entries=t}_getEntryWithFallback(e,t){const i=this._findURLEntry(e,t);if(i)return i;const s=this._entries.map((e=>e.size));if(this._entries.length>0){const t=this._getStandardSize(e,s);return this._entries.find((e=>e.size===t))}}renditionURLStatus(e,t,i){var s;const r=this._getStandardSize(e),n=this._entries.find((e=>e.versionToken===i&&e.size>=r&&e.type===t));return null!==(s=n&&n.status)&&void 0!==s?s:mr.NotStarted}get versionToken(){return this._versionToken}getURL(e,t,i){const s=i!==this.versionToken,r=this._getEntryWithFallback(e,t),n=this._getStandardSize(e);if(r&&r.size>=n&&!s)return r.url;const o={size:n,status:mr.Fetching,url:"",type:t,versionToken:i},a=this._entries.find((e=>ds(e,o)||ds(e,Object.assign(Object.assign({},o),{status:mr.Error}))));return r&&a?r.url:(this._entries.push(o),this._fetch(o),r?r.url:o.url)}async _fetch(e){const{size:t,type:i,versionToken:s}=e;this.dispatch({type:"change"});try{const r=await this._fetchRenditionBlob(t,i);s&&s!==this._versionToken&&(this._clearStaleEntries(this._versionToken),this._versionToken=s),e.size=t,e.type=i,e.url=URL.createObjectURL(r),_r.register(this,e.url,e),e.status=mr.Done,e.versionToken=s,this.dispatch({type:"change"})}catch(t){e.status=mr.Error,this.dispatch({type:"change"})}}clearRenditionError(e,t,i){const s=this._getStandardSize(e),r=this._entries.findIndex((e=>e.size>=s&&e.type===t&&e.versionToken===i&&e.status===mr.Error));-1!==r&&(this._entries.splice(r,1),this.dispatch({type:"change"}))}release(){0!==this._entries.length&&(this._entries.forEach((e=>{URL.revokeObjectURL(e.url),_r.unregister(this)})),this._entries=[])}}const br=255,Ir=/^(CON|PRN|AUX|NUL|COM[1-9]|LPT[1-9])$/i,Er=/[\\/:*?"|><]/;function Tr(e){return e.length>0&&e.length<=br&&!Ir.test(e)&&!Er.test(e)}const Sr=/^(.*\/)?(.*?)(?:[\u00A0][^.]*)?(\.[^.]*)?$/;function Ar(e,t,i){function s(e,t){let i=e.replace(/[()]/g,"\\$&");return i=i.replace("%d","([0-9]+)"),i=i.replace("%@","(.*)?"),i+=t?"(\\.[^.]*)$":"(\\.[^.]*)?$",i}const r=e.lastIndexOf(".")>e.lastIndexOf("/"),n=s(t,r),o=t.replace(/ [^ ]*$/,""),a=s(o,r);let c=e.match(n),l=!1;null===c&&(c=e.match(a),l=null!==c);let d="",u="";if(c){let e="",t="",s="";l?[,e,t]=c:[,e,s,t]=c,d=e,u=t,l&&0===i?i=1:l||parseInt(s)!==i||(i+=1)}else{const[,t,i,s]=e.match(Sr);d=`${t||""}${i||""}`,u=s}let h="";return 0!==i?(h=t.replace("%@",`${d||""}`),h=h.replace("%d",i.toString())):h=o.replace("%@",`${d||""}`),{newName:`${h||""}${u||""}`,countUsed:i}}function Pr(e,t,i,s,r){var n;let o=(null===(n=r.get(t))||void 0===n?void 0:n.countUsed)||0,a=!1;const c=[];do{const n=s?Ar(i,e._environment.getValue("ASSET_COPY_NAME_FORMAT"),o):o>0?Ar(i,e._environment.getValue("ASSET_CONFLICT_NAME_FORMAT"),o):{newName:i,countUsed:o};i=n.newName,o=n.countUsed,a=!1;for(const[e,t]of r)if(t.newName===i){a=!0,c.push(e);break}a?o++:r.set(t,n)}while(a);for(const e of c){const t=r.get(e);r.set(e,{newName:t.newName,countUsed:o})}return i}const wr=/^(.*)\^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[12345][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$/;function Cr(e){const t=e.match(wr);return t?t[1]:e}const Rr={"cloud-content-archive":"cloud-content","assets-archive":"assets",archive:"files"};function Lr(e,t){const i=e.split("/"),s="users"===i[1]?3:1,r=Rr[i[s]];if(r)return i[s]=r,i[i.length-1]=t||Cr(i[i.length-1]),i.join("/")}function Nr(e,t){const i=t.repoPath.split("/").slice(0,-1);return i.push(e),i.join("/")}function Dr(e){const{assetPool:t,asset:i,session:s,operation:r,assetContext:n}=e;i.isFolder&&i.repoPath.trim()&&t.forEach((e=>{var t;if(e.repoPath.startsWith(i.repoPath+"/"))switch(r.type){case"move":case"rename":if(!e.repoPath.startsWith(r.newPath)){const t=e.repoPath.replace(i.repoPath,r.newPath);n._adobeAssetUpdater.updateLocalItem(s,e,{"repo:path":t})}break;case"discard":(null===(t=e.ancestorIDs)||void 0===t?void 0:t.includes(i.id))&&!e.isDiscarded&&n._adobeAssetUpdater.updateLocalItem(s,e,{"repo:state":"DISCARDED_PARENT"});break;case"restore":r.newPath&&n._adobeAssetUpdater.updateLocalItem(s,e,{"repo:path":e.repoPath.replace(i.repoPath,r.newPath)}),e._isDiscardedWithParent()&&n._adobeAssetUpdater.updateLocalItem(s,e,{"repo:state":"ACTIVE"})}}))}const Mr=(e,t)=>t.has(e.id)?t.get(e.id):e.name;function xr(e,t,i,s){return[{op:t?Wr.replace:Wr.add,path:`/children/version=${e}/milestone`,value:{label:i,description:s}}]}function kr({name:e,assetId:t,assetList:i,locale:s,getOtherAssetName:r}){const n=e.trim();if(0===n.length)throw We.create(Be.BAD_REQUEST,"The asset name cannot be blank.");if(!Tr(n))throw We.create(Be.BAD_REQUEST,"The asset name is an invalid platform repo name.");if(n.endsWith("."))throw We.create(Be.BAD_REQUEST,"The asset name cannot end with a period.");const o=null==i?void 0:i.find((e=>((null==r?void 0:r(e))||e.name).toLocaleLowerCase(s)===n.toLocaleLowerCase(s)));if(o&&(!t||o.id!==t))throw We.create(Be.CONFLICT,"The asset name must be unique within the parent asset.")}function Hr(e){return/^(\/|\/users\/[^/]+|\/users\/[^/]+\/[^/]+|\/[^/]+)$/.test(e)}function jr(e,t){const i=new URLSearchParams(e.search);for(const[e,s]of Object.entries(t))i.set(e,s);return e.search=i.toString(),e}function Ur(e,t){const i=e[yt.BLOCK_INITIALIZE]?Ot(e,yt.BLOCK_INITIALIZE):void 0,s=i?i["repo:minsingletransfersize"]:_c,r=i?i["repo:maxsingletransfersize"]:pc;return t?or(t,s,r):r}const Br="application/vnd.adobecloud.directory+json",Fr="application/x-sharedcloud-collection+json",Vr=6e6,Kr="application/vnd.adobecloud.bulk-transfer+json",Gr={"repo:principal":"all","repo:modifier":"deny","repo:privileges":["write"],"repo:relations":[yt.AC_POLICY],"repo:inheritance":"deep"},$r={"repo:principal":"all","repo:modifier":"deny","repo:privileges":["write","delete"],"repo:relations":[yt.ANNOTATIONS,yt.APP_METADATA,yt.EMBEDDED_METADATA,yt.REPO_METADATA,yt.PRIMARY,yt.RENDITION],"repo:inheritance":"deep"};var Wr;!function(e){e.add="add",e.remove="remove",e.replace="replace"}(Wr||(Wr={}));const zr={orderDirection:"descending",orderBy:"storage:deviceModifyDate",start:"",limit:0},qr={orderDirection:"descending",orderBy:"created",start:"",limit:0,version:""};function Yr(e){const t={},{start:i,limit:s,version:r}=e;return i&&(t.start=i),s&&(t.limit=s),r&&(t.version=r),t}function Qr(e){return("ascending"===e.orderDirection?"+":"-")+e.orderBy}function Jr(e,t){const i=function(e){const t=Object.assign(Object.assign({},qr),e),i=Yr(t);return i.orderBy=Qr(t),i.resource=yt.VERSION,i}(t);return It(e,yt.PAGE,i)}class Xr extends Error{}class Zr extends pr{constructor(e,t,i,s,r){super(e._core),this._rapi=e,this._assetId=t,this._links=i,this._etag=s,this._version=r,this._useHighPriorityRequestsIfEnabled=!0}get assetID(){return this._assetId}get links(){return this._links}get etag(){return this._etag}async getChildAssets(e,t){const i=function(e,t){const i=Object.assign(Object.assign({},zr),t),s=Yr(i);s.orderBy=Qr(i),s.type=i.type,s.embed=JSON.stringify(i.embed);const{assetTypes:r,excludeAssetTypes:n,assetSubTypes:o}=i.filters||{};return(null==n?void 0:n.length)?s.filter=`"repo:assetType"!="${n[0]}"`:1===(null==r?void 0:r.length)?s.filter=`"repo:assetType"=="${r[0]}"`:(null==r?void 0:r.length)||1!==(null==o?void 0:o.length)||(s.filter=`"repo:assetSubType"=="${o[0]}"`),It(e,yt.PAGE,s)}(this._links,e);return(await this._doGet(i,{headers:{"Cache-Control":"no-cache, no-store, max-age=0"},resource:t})).json()}async getRepoMetadata(e){const t=It(this._links,yt.REPO_METADATA);await this._doGet(t,{resource:e}),this._etag=e.data["repo:etag"]}async getEmbeddedMetadata(e){const t=this.getURLWithVersion(this._links,yt.EMBEDDED_METADATA);await this._doGet(t,{headers:{Accept:ft},resource:e})}async getAppMetadata(e){const t=this.getURLWithVersion(this._links,yt.APP_METADATA);await this._doGet(t,{resource:e})}async patchAppMetadata(e){const t=It(this._links,yt.APP_METADATA);return await this._doPatch(t,{"Content-Type":gt},JSON.stringify(e),[204])}async getEffectivePermissions(e){const t=It(this._links,yt.AC_EFFECTIVE);await this._doGet(t,{resource:e})}async getAssetPolicy(){const e=It(this._links,yt.AC_POLICY);return await this._doGet(e)}async getManifest(e){const t=this.getURLWithVersion(this._links,yt.MANIFEST);await this._doGet(t,{headers:{},resource:e})}async getVersions(e){const t=Jr(this._links,e);return(await this._doGet(t)).json()}async getPerUserMetadata(e){const t=It(this._links,yt.PERUSER_METADATA);await this._doGet(t,{headers:{"Content-Type":ft},resource:e})}async restoreVersionManifest(e){const t=await this._doGet(e,{}),i=await t.json(),s=It(this.links,yt.MANIFEST);await this._doPut(s,{"Content-Type":"application/vnd.adobe.dcx-manifest+json","If-Match":"*"},JSON.stringify(i),[204])}async getVersion(e){const t=Jr(this._links,{version:e});return(await this._doGet(t)).json()}async patchVersion(e){const t=It(this.links,yt.VERSION);return await this._doPatch(t,{"Content-Type":gt},JSON.stringify(e),[204])}async createFolder(e,t=!1){const i=It(this._links,yt.CREATE,{path:e,intermediates:"true",respondWith:yt.REPO_METADATA,nameConflictPolicy:t?"rename":"cancel"}),s=await this._doPost(i,{"Content-Type":Br},void 0,[200,201]);return 201===s.status?await s.json():void 0}async extendTransferUrls(e,t=!1){const i={};t&&(i.directive="use-block-store");const s=await this._doPost(e,i,void 0,[200]);return await s.json()}async _uploadIndividualBlock(e,t,i,s,r){return await this._doPut(e,{},t.slice(i,s),r?[200,412]:[200],!0,{handleError:async e=>{if(403===e.status&&(await e.text()).includes("<Message>Request has expired</Message>"))throw new Xr("Transfer URL has expired")}})}async _blockUpload(e,t,i,s=!1,r,n,o){const a=await this.getBlockUploadInfo(t,e.size,r,i,n,s,o),c=a.initResponse["repo:blocksize"],l=e.size,d=Math.ceil(l/c);let u=0,h=0;for(;u<d;)try{const t=Math.min(3,d-u),i=Array.from({length:t},((t,i)=>{const s=u+i;return this._uploadIndividualBlock(a.transferInfo[s].url.href,e,s*c,Math.min((s+1)*c,l),n)}));await Promise.all(i),u+=t,h=0}catch(e){if(e instanceof Xr){if(h++,h>3)throw We.create(Be.INTERNAL_ERROR,"Maximum retry attempts exceeded for block upload");const e=It(a.initResponse._links,yt.BLOCK_EXTEND,{size:String(l)}),t=await this.extendTransferUrls(e,n);a.transferInfo=t._links[yt.BLOCK_TRANSFER].map(((e,t)=>{const i=t*c;return{url:e,start:i,end:Math.min(l,i+c)}}));continue}throw e}return await this.finalizeBlockUpload(a.finalizeHref,a.initResponse,r,n)}async importFile(e,t,i,s,r=pc,n,o){const a=Ur(this._links,r);if(e.size>=a)return this._blockUpload(e,t,null!=s?s:e.type,i,!1,n,o);const c=o?Object.assign({"milestone:label":o.label},o.description?{"milestone:description":o.description}:{}):{},l=It(this._links,yt.CREATE,Object.assign({path:t,respondWith:yt.REPO_METADATA,nameConflictPolicy:i?"rename":"cancel"},o?{versionHistoryPatch:c}:{})),d=await this._doPost(l,{"Content-Type":null!=s?s:e.type},e,[200,201]);return 201===d.status?await d.json():void 0}async updateFile(e,t,i=pc,s=!1){const r=Ur(this._links,i);if(e.size>=r)return this._blockUpload(e,"",null!=t?t:e.type,!0,s);{const{metaData:t}=await this.commitFileChanges(e,this.etag);if(!t){const e=It(this._links,yt.REPO_METADATA);return(await this._doGet(e)).json()}return t}}async getBlockUploadInfo(e,t,i,s,r,n,o){const a=It(this._links,yt.BLOCK_INITIALIZE),c={"repo:size":t,"repo:blocksize":Vr,"repo:reltype":yt.PRIMARY,"dc:format":s},l={"Content-Type":Kr};r&&(delete c["repo:blocksize"],l.directive="use-block-store");const d=await this._doPost(a,l,JSON.stringify(c),[200]),u=await d.json(),{"repo:blocksize":h,_links:p}=u,_=p[yt.BLOCK_TRANSFER].map(((e,i)=>{const s=i*(r?h:Vr);return{url:e,start:s,end:Math.min(t,s+(r?h:Vr))}})),m=o?Object.assign({"milestone:label":o.label},o.description?{"milestone:description":o.description}:{}):{};return{transferInfo:_,finalizeHref:It(p,yt.BLOCK_FINALIZE,Object.assign(Object.assign({respondWith:yt.REPO_METADATA,nameConflictPolicy:n?"rename":"cancel"},i?{}:{path:e}),o?{versionHistoryPatch:m}:{})),blockSize:h,initResponse:u}}async finalizeBlockUpload(e,t,i,s){const r={"Content-Type":Kr};s&&(r.directive="use-block-store");const n=await this._doPost(e,r,JSON.stringify(t),[200,201]);return i?void 0:n.json()}async getBlockDownloadURL(e,t){const i={};void 0!==t&&(i["Presigned-URL-TTL"]=t.toString());const s=await this._doGet(e,{headers:i}),r=await s.json();if(!(null==r?void 0:r.href))throw We.create(Be.INTERNAL_ERROR,"Cannot get block download URL");return r.href}async getContent(e){const t=this.getURLWithVersion(this._links,yt.PRIMARY);await this._doGet(t,{resource:e})}async getResourceGenerationNumber(e){var t;const i=It(this._links,e);return null!==(t=(await this._doHead(i)).headers.get("resource-generation"))&&void 0!==t?t:void 0}async commitFileChanges(e,t){const i=It(this._links,yt.PRIMARY),s={"Content-type":e.type};t&&(s["If-Match"]=t);const r=await this._doPut(i,s,e,[200,201,204]);return{metaData:201===r.status?await r.json():void 0,eTag:r.headers.get("ETag")}}async restore(e,t=0){const i={op:"restore",target:{"repo:assetId":this.assetID},name:e};try{return(await this.runOperation(i)).asset}catch(i){if(i.code===Be.CONFLICT){const{newName:i,countUsed:s}=Ar(e,this._core._environment.getValue("ASSET_CONFLICT_NAME_FORMAT"),t);return this.restore(i,s)}throw i}}async discard(){const e={op:"discard",target:{"repo:assetId":this.assetID}},{asset:t}=await this.runOperation(e);return t}async runOperation(e){const t=await this._rapi.runOperation(e),{asset:i,error:s}=t[0];if(!i&&!s)throw We.wrapErrorIfNeeded(Be.UNKNOWN,"Missing Asset metadata in operation response",s);if(s)throw s;return t[0]}async runOperationWithEmptyResponse(e){await this._rapi.runOperation(e)}async getRendition(e){const t=It(this._links,yt.RENDITION,{size:String(e.size),type:e.type}),i=new URL(t);jr(i,{etag:this.etag}),await this._doGet(i.toString(),{resource:e,cache:"force-cache"})}async getCustomRendition({size:e=yr,type:t=gr.PNG,urlTemplateOptions:i={},additionalHeaders:s}){const r=It(this._links,yt.RENDITION,Object.assign({size:String(e),type:t},i));return await this._doGet(r,{headers:s})}async getAllCustomRenditions({type:e,urlTemplateOptions:t={},additionalHeaders:i}){const s=It(this._links,yt.RENDITION,e?Object.assign({type:e},t):Object.assign({},t));return await this._doGet(s,{headers:i})}async getAccessControlList(){const e=It(this._links,yt.AC_POLICY),t=await this._doGet(e,{headers:{"Content-Type":"application/vnd.adobecloud.policy+json","If-Match":"*"}}),i=await t.json();return{etag:t.headers.get("ETag")||"","repo:acl":i["repo:acl"]}}_getACPatchData(e){return{"repo:principal":e.principal,"repo:privileges":e.privileges,"repo:modifier":e.modifier,"repo:inheritance":e.inheritance,"repo:relations":e.relations}}async addAccessControlEntries(e,t){const i=e.map((e=>({op:"add",path:"/repo:acl/-",value:this._getACPatchData(e)})));await this._patchACL(i,t)}async updateAccessControlList(e,t){const i=e.map((e=>({op:"replace",path:`/repo:acl/${e.id}`,value:this._getACPatchData(e)})));await this._patchACL(i,t)}async deleteAccessControlEntries(e,t){const i=e.map((e=>({op:"remove",path:`/repo:acl/${e.id}`,value:this._getACPatchData(e)})));await this._patchACL(i,t)}async setEditingInheritanceRestricted(e,t){const i=this._core._environment.getValue("USER_ID");if(e){const e=[{op:"add",path:"/repo:acl/0",value:$r},{op:"add",path:"/repo:acl/1",value:Gr}];if(t){const t=function(e){return[{"repo:principal":{"xdm:provider":{"@id":"https://ims-na1.adobelogin.com/"},"@id":e,"@type":"https://ns.adobe.com/adobecloudplatform/ims/user"},"repo:modifier":"grant","repo:privileges":["read","write"],"repo:relations":["http://ns.adobe.com/adobecloud/rel/ac/policy"],"repo:inheritance":"deep"},{"repo:principal":{"xdm:provider":{"@id":"https://ims-na1.adobelogin.com/"},"@id":e,"@type":"https://ns.adobe.com/adobecloudplatform/ims/user"},"repo:modifier":"grant","repo:privileges":["read","write","delete"],"repo:relations":["http://ns.adobe.com/adobecloud/rel/annotations","http://ns.adobe.com/adobecloud/rel/metadata/application","http://ns.adobe.com/adobecloud/rel/metadata/embedded","http://ns.adobe.com/adobecloud/rel/metadata/repository","http://ns.adobe.com/adobecloud/rel/primary","http://ns.adobe.com/adobecloud/rel/rendition"],"repo:inheritance":"deep"}]}(i);e.push({op:"add",path:"/repo:acl/2",value:t[0]}),e.push({op:"add",path:"/repo:acl/3",value:t[1]})}await this._patchACL(e)}else{const{policyResponse:e,denyEditAceIndex:t,denyShareAceIndex:i}=await this._getEditingInheritanceRestrictedInfo();if(t<0||i<0)return;const s=[{op:"remove",path:`/repo:acl/${i}`},{op:"remove",path:`/repo:acl/${t}`}];s.sort(((e,t)=>e.path<t.path?0:-1)),await this._patchACL(s,e.headers.get("etag")||void 0)}}async _patchACL(e,t){const i=It(this._links,yt.AC_POLICY);await this._doPatch(i,{"Content-Type":"application/json-patch+json","If-Match":t},JSON.stringify(e),[200])}async getEditingInheritanceRestricted(){const{denyEditAceIndex:e,denyShareAceIndex:t}=await this._getEditingInheritanceRestrictedInfo();return e>=0&&t>=0}async _getEditingInheritanceRestrictedInfo(){const e=await this.getAssetPolicy(),t=(await e.json())["repo:acl"],i=t.find((e=>ds($r,e,!0,!0))),s=t.find((e=>ds(Gr,e,!0,!0)));return{policyResponse:e,denyEditAceIndex:t.indexOf(i),denyShareAceIndex:t.indexOf(s)}}getURLWithVersion(e,t){return It(e,t,Object.assign({},this._version&&{version:this._version}))}async removeLastAccessed(){const e=It(this._links,yt.PERUSER_METADATA),t=[];return t.push({op:"remove",path:"/shell:lastAccessDate"}),await this._doPatch(e,{"Content-Type":gt,"X-Metadata-Field":"lastAccessDate"},JSON.stringify(t),[204])}}const en=new Set;function tn(e,t){en.has(e)||(console.warn("One time warning (%s): %s",e,t),en.add(e))}class sn{constructor(){this.promise=new Promise(((e,t)=>{this.resolve=e,this.reject=t}))}}const rn=Symbol("$LAZY_LOAD_MANAGERS");var nn;!function(e){e[e.NotLoaded=1]="NotLoaded",e[e.Pending=2]="Pending",e[e.Loading=3]="Loading",e[e.Loaded=4]="Loaded",e[e.Error=5]="Error"}(nn||(nn={}));class on{constructor({target:e,event:t,fetchData:i,prefetchTimeout:s=100,retryErrorTimeout:r=Number.POSITIVE_INFINITY,cancelFetchData:n}){this._loadStatus=nn.NotLoaded,this._prefetchTimeout=100,this._retryErrorTimeout=Number.POSITIVE_INFINITY,this._retriesRemaining=5,this._onBecomeUnobserved=e=>{e===this._event.type&&(this._loadStatus!==nn.Pending?this._loadStatus===nn.Loading&&this._cancelFetchData&&this._cancelFetchData.call(this._target)&&this.setLoadStatus(nn.NotLoaded):this._prefetchResolve(!0))},this._target=e,this._event=t,this._fetchData=i,this._prefetchTimeout=s,this._retryErrorTimeout=r,this._cancelFetchData=n,this._target.on(Cs,this._onBecomeUnobserved)}static manageLazyLoading(e,t){const i=e;i[rn]=i[rn]||new Map,t.forEach((e=>{const t=new on(Object.assign({target:i},e));i[rn].set(e.event,t)}))}static getManager(e,t){const i=e[rn];let s;s="string"==typeof t?[...i.keys()].find((e=>e.type===t)):t;const r=i.get(s);if(!r)throw new Error(`Target does not have a LazyLoadManager for event ${t}`);return r}static hasManager(e,t){try{return void 0!==on.getManager(e,t)}catch(e){return!1}}static setLoadStatus(e,t,i){on.getManager(e,t).setLoadStatus(i)}static getLoadStatus(e,t){return on.getManager(e,t).loadStatus}static fetchIfNeeded(e,t){return on.getManager(e,t).fetchIfNeeded()}static updatedExternally(e,t){on.getManager(e,t).updatedExternally()}static updatedByItemUpdater(e,t){on.getManager(e,t).updatedByItemUpdater()}get loadStatus(){return this._loadStatus}async _prefetchDelay(){return new Promise((e=>{this._prefetchResolve=e,this.setLoadStatus(nn.Pending),setTimeout((()=>{e(!1),this._prefetchResolve=void 0}),this._prefetchTimeout)}))}onPropertyAccess(){this.fetchIfNeeded()}async fetchIfNeeded(){var e;if(this._loadStatus===nn.NotLoaded){if(this._pendingFetchPromise=new sn,this._prefetchTimeout&&await this._prefetchDelay())return this.setLoadStatus(nn.NotLoaded),void this._pendingFetchPromise.resolve();try{this._loadStatus=nn.Loading,await this._fetchData.call(this._target),this._loadStatus===nn.Loading&&(this.setLoadStatus(nn.Loaded),this._pendingFetchPromise.resolve())}catch(e){this.setLoadStatus(nn.Error),this._pendingFetchPromise.resolve()}}await(null===(e=this._pendingFetchPromise)||void 0===e?void 0:e.promise)}setLoadStatus(e){this._loadStatus!==e&&(this._loadStatus=e,e===nn.NotLoaded||e===nn.Loaded?(e===nn.Loaded&&(this._retriesRemaining=5),this._target.dispatch(this._event)):e===nn.Error&&this._retryErrorTimeout<Number.POSITIVE_INFINITY&&this._retriesRemaining>0&&setTimeout((()=>{this._retriesRemaining--,this._loadStatus===nn.Error&&this.setLoadStatus(nn.NotLoaded)}),this._retryErrorTimeout))}updatedExternally(){this._loadStatus!==nn.Loaded?this.setLoadStatus(nn.Loaded):this._target.dispatch(this._event)}updatedByItemUpdater(){this._loadStatus===nn.Pending&&this._prefetchResolve(!0),this._loadStatus=nn.Loaded}}function an(e,t){return function(i,s,r){if(r.get){const t=r.get;r.get=function(){const i=on.getManager(this,e);if(!i)throw new Error(`@lazyLoaded target is missing LazyLoadManager for event ${e.type}. Use LazyLoadManager.manageLazyLoading() in constructor to configure`);return i.onPropertyAccess(),t.call(this)}}else{if("function"!=typeof r.value)throw new Error("@lazyLoaded only works with getters and methods");{const t=r.value,i=function(...i){const s=on.getManager(this,e);if(!s)throw new Error(`@lazyLoaded target is missing LazyLoadManager for event ${e.type}. Use LazyLoadManager.manageLazyLoading() in constructor to configure`);return s.onPropertyAccess(),t.apply(this,i)};r.value=i}}t=[].concat(t),ut(e,t)(i,s,r)}}class cn extends Ks{constructor(e,t){super(e,t),this._collaboratorsArray=[],this._shareFlagsAreDirty=!0,this._itemPoolDelegate={onItemsUpdated:()=>{this._setCollaboratorData(),on.updatedExternally(this,xi)}},on.manageLazyLoading(this,[{event:xi,fetchData:this._queueCollaborators,prefetchTimeout:0,cancelFetchData:this._dequeueCollaborators}])}get isShared(){return this._fetchShareFlagsIfNeeded(),this._isShared}get isSharedWithYouAsset(){return this._fetchShareFlagsIfNeeded(),this._isSharedWithYouAsset}get directCollaboratorCount(){return this._fetchShareFlagsIfNeeded(),this._directCollaboratorCount}get isPublicLink(){return this._fetchShareFlagsIfNeeded(),this._isPublicLink}get _isSWYAsset_NoLazyLoad(){return this._isSharedWithYouAsset}get _isShared_NoLazyLoad(){return this._isShared}get _directCollaboratorCount_NoLazyLoad(){return this._directCollaboratorCount}get _isPublicLink_NoLazyLoad(){return this._isPublicLink}get isSharedWithMe(){return tn("isSharedWithMe","isSharedWithMe is deprecated and will be removed on or after 2024-10-01. Please use isSharedWithYouAsset instead."),this.isSharedWithYouAsset}get _isCollaboratorDataLoaded(){return on.getLoadStatus(this,xi.type)===nn.Loaded}_fetchShareFlagsIfNeeded(){this._shareFlagsAreDirty&&on.fetchIfNeeded(this,xi)}_queueCollaborators(){return this._core.collaborationContext._collaboratorRequestQueue.enqueue(this)}_dequeueCollaborators(){return this._core.collaborationContext._collaboratorRequestQueue.dequeue(this)}get collaboratorArray(){return this._collaboratorsArray}get collaborators(){return this._collaboratorSources||(this._collaboratorSources=this._core.collaborationContext._getCollaboratorSources(this.id),this._collaboratorSources.collaboratorPool.addDelegate(this._itemPoolDelegate,"context")),this._collaboratorSources.collaboratorSource}async removeCollaborator(e){await this._core.collaborationContext._removeCollaborator(this.id,e)}async removeCurrentUserFromCollaborationList(){return this._core.collaborationContext._removeCurrentUserFromCollaborationList(this)}async createPublicLink(e=!0){const t={recipient:"all",role:"viewer",canShare:!1,canComment:e};this._core.collaborationContext._addCollaborators(this.id,[t])}async removePublicLink(){this._isCollaboratorDataLoaded||(await this._queueCollaborators(),await new Promise((e=>{this.on(Mi,(()=>{this._isCollaboratorDataLoaded&&e()}))})));const e=this.collaboratorArray.find((e=>"all"===e.id));e&&this._core.collaborationContext._removeCollaborator(this.id,e)}async shareWithOwnerOrganization(){const e=(await this._core.collaborationContext._addCollaborators(this.id,[{recipient:"orgEverybody",role:"viewer",canComment:!0,canShare:!1}])).failedCollaborators.find((e=>"orgEverybody"===e.recipient));if(e)throw We.create(e.error.code,e.error.message)}get invitedCollaborators(){return this._collaboratorSources||(this._collaboratorSources=this._core.collaborationContext._getCollaboratorSources(this.id)),this._collaboratorSources.invitedCollaboratorSource}removeInvitedCollaborator(e){return this._core.collaborationContext.removeInvitedCollaborator(this.id,e)}_setCollaboratorData(e){this._collaboratorSources=this._core.collaborationContext._getCollaboratorSources(this.id);const t=this._collaboratorSources.collaboratorPool;this._collaboratorsArray=null!=e?e:t.toArray(),this._shareFlagsAreDirty=!1,this._isShared=this._collaboratorsArray.some((e=>e.isDirect));const i=this._collaboratorsArray.some((e=>e.isDirect&&e.isCurrentUser));this._isSharedWithYouAsset=this._isSWYGroup||i,this._isPublicLink=this._collaboratorsArray.some((e=>"all"===e.id)),this._directCollaboratorCount=this._collaboratorsArray.filter((e=>e.isDirect)).length}}Ye([ht(xi,"_isShared")],cn.prototype,"isShared",null),Ye([ht(xi,"_isSharedWithYouAsset")],cn.prototype,"isSharedWithYouAsset",null),Ye([ht(xi,"_directCollaboratorCount")],cn.prototype,"directCollaboratorCount",null),Ye([ht(xi,"_isPublicLink")],cn.prototype,"isPublicLink",null),Ye([an(xi,"_collaboratorsArray")],cn.prototype,"collaboratorArray",null),Ye([nt],cn.prototype,"collaborators",null),Ye([nt],cn.prototype,"invitedCollaborators",null);class ln extends ur{constructor(e,t,i={}){super(e,Object.assign(Object.assign({},i),{skipRevalidation:()=>{var e;return Boolean(this._parent&&(null===(e=this._core.hostAssetContext.onsContext)||void 0===e?void 0:e.isActive))}})),this._core=e,this._parent=t,this._parent=t}setParent(e){this._parent=e}}class dn extends ln{constructor(e,t){super(e,t,{onError:async e=>{e.code===Be.NOT_FOUND&&await this._setData({})}}),this._core=e,this._parent=t}async _loadData(){await this._parent._ensureLink(yt.EMBEDDED_METADATA);const e=await this._parent._getAssetInterface();await e.getEmbeddedMetadata(this)}}class un extends ln{constructor(e,t){super(e,t,{onError:async e=>{e.code===Be.NOT_FOUND&&await this._setData({})}}),this._core=e}async _loadData(){var e,t;await(null===(e=this._parent)||void 0===e?void 0:e._ensureLink(yt.APP_METADATA));const i=await(null===(t=this._parent)||void 0===t?void 0:t._getAssetInterface());await(null==i?void 0:i.getAppMetadata(this))}async _patch(e){var t,i;await(null===(t=this._parent)||void 0===t?void 0:t._ensureLink(yt.APP_METADATA));const s=await(null===(i=this._parent)||void 0===i?void 0:i._getAssetInterface());await(null==s?void 0:s.patchAppMetadata(e))}}class hn extends ur{constructor(e,t){super(e),this._core=e,this._parent=t}async _loadData(){const e=await this._parent._getAssetInterface();await e.getManifest(this)}}const pn=["file","composite","directory","entity","element"],_n=["ACTIVE","DISCARDED","DISCARDED_PARENT"];var mn,fn;!function(e){e[e.None=0]="None",e[e.CollaboratorMaybeEditing=1]="CollaboratorMaybeEditing",e[e.OwnerChange=2]="OwnerChange"}(mn||(mn={})),function(e){e[e.DifferentOwner=1]="DifferentOwner",e[e.PermissionDeniedDestination=2]="PermissionDeniedDestination",e[e.PermissionDeniedSource=3]="PermissionDeniedSource",e[e.NotAFolder=4]="NotAFolder",e[e.CrossBucketMoveDisabled=5]="CrossBucketMoveDisabled"}(fn||(fn={}));class gn{constructor(e){this._propertyUpdater=e.propertyUpdater,this._changeEvent=e.changeEvent||lt,this._changeEventsMap=e.changeEventMap}updateLocalItem(e,t,i){if(!e.checkIfItemAllowsMutations(t))return;e.ensureItemIsAdded(t);const s=this._propertyUpdater.update(t,i),r=new Set(s.map((e=>{var i,s,r;return null!==(r=null!==(s=null===(i=this._changeEventsMap)||void 0===i?void 0:i.get(e))&&void 0!==s?s:function(e,t){var i;return null===(i=e[dt]||void 0)||void 0===i?void 0:i.get(t)}(t,e))&&void 0!==r?r:this._changeEvent})));s.length&&e.queueChangedItem(t,[...r])}}class yn extends gn{constructor(e){super(e),this._localItemType=e.localItemType,this._getRemoteId=e.getRemoteId,this._getAlternateId=e.getAlternateId||(()=>{})}updateRemoteItem(e,t){const i=this._getRemoteId(t),s=this._getAlternateId(t);if(!i&&!s)throw We.create(Be.BAD_REQUEST,"An ID or alternate ID must exist on the remote item structure.");let r=i?e.getItemById(i):void 0;return!r&&s&&(r=e.getItemById(s),r&&i&&e.reindexItem(r,s,i)),r||(r=new(0,this._localItemType)(e._core,i||s)),this.updateLocalItem(e,r,t),r}updateRemoteItems(e,t){if(!Array.isArray(t))throw We.create(Be.BAD_REQUEST,"Invalid data received, expected list of items.");return t.map((t=>this.updateRemoteItem(e,t)))}}class vn extends yn{constructor(e){super(Object.assign({getRemoteId:t=>t[e.remoteIdProperty]},e))}}const On=Symbol("NotFound"),bn={string:{parse:e=>null==e?void 0:String(e),isEqual:cs},number:{parse:Number,isEqual:cs},date:{parse:e=>{if(null!==e)return void 0===e||e instanceof Date?e:new Date(String(e))},isEqual:(e,t)=>(null==e?void 0:e.toISOString())===(null==t?void 0:t.toISOString())},date_as_number:{parse:e=>void 0===e?void 0:new Date(Number(e)),isEqual:(e,t)=>(null==e?void 0:e.toISOString())===(null==t?void 0:t.toISOString())},boolean:{parse:e=>!0===e||"string"==typeof e&&"true"===e.toLowerCase()||"number"==typeof e&&Boolean(e),isEqual:cs},object:{parse:e=>void 0!==e?ls(e):void 0,isEqual:ds},object_subset:{parse:ls,isEqual(e,t){if(e===t)return!0;if(void 0===e)return!1;if(!t)return!0;const i=Object.keys(t).reduce(((t,i)=>(t[i]=e[i],t)),{});return ds(i,t)}}},In=/([^.[]+)|(\[[^\]]+\])/g;function En(e){const t=function(e){const t=e.match(In)||[];if(!t.length)throw We.create(Be.BAD_REQUEST,`Un-parseable key ${e}`);const i=t.map((e=>"["===e[0]&&"]"===e.slice(-1)?e.slice(1,-1):e));return i}(e);return e=>{let i=e;for(const e of t){if(!Object.prototype.hasOwnProperty.call(i,e))return On;i=i[e]}return i}}function Tn(e){if(e.includes("."))throw We.create(Be.BAD_REQUEST,`Cannot use dot delimiter (${e}) without a custom setter`);return(t,i)=>{i[e]=t}}function Sn(e){if(e.includes("."))throw We.create(Be.BAD_REQUEST,`Cannot use dot delimiter (${e}) without a custom setter`);return(t,i)=>{var s;i[e]=Object.assign(Object.assign({},null!==(s=i[e])&&void 0!==s?s:{}),null!=t?t:{})}}function An(e,t,i){if(!t)return i?bn.object:bn.string;if("string"==typeof t){if(!Object.prototype.hasOwnProperty.call(bn,t))throw We.create(Be.BAD_REQUEST,`Unexpected type format ${t} for ${e} property updater.`);return bn[t]}return t}function Pn(e,t,i,s){return!(i&&!i.includes(s)&&(e._core._environment.error(`Invalid value ${s} passed for the ${t} property. Expected one of ${i.join(", ")}.`),1))}function wn(e,t){const i=function(e,t){if("string"==typeof t)return{name:e,format:bn.string,get:En(t),set:Tn(e),isArray:!1};const{name:i,format:s,choices:r,get:n,set:o,isArray:a,mapByKey:c}=t,l=null!=i?i:e;return{name:l,format:An(l,s,c),choices:r,mapByKey:c,isArray:null!=a&&a,get:null!=n?n:En(null!=i?i:e),set:null!=o?o:"object_subset"===s?Sn(e):Tn(e)}}(e,t),{name:s,format:r,choices:n,get:o,set:a,isArray:c,mapByKey:l}=i;return(t,i)=>{const d=t,u=En(e),h=u(d)===On?void 0:u(d);let p=o(i,t);if(p===On)return!1;if(l){if(!Array.isArray(p))return t._core._environment.error(`Invalid value ${p} passed for the ${s} property. Expected an array.`),!1;const e=new Map;for(const i of p){if(!Object.prototype.hasOwnProperty.call(i,l)){t._core._environment.error(`Invalid item passed for the ${s} array property. Missing ${l} property on the item of the array.`);continue}const o=i[l],a=r.parse(i);Pn(t,s,n,a)&&e.set(o,a)}if(ds(h,e))return!1;p=e}else if(c){if(!Array.isArray(p))return t._core._environment.error(`Invalid value ${p} passed for the ${s} property. Expected an array.`),!1;const e=[];for(const i of p){const o=r.parse(i);Pn(t,s,n,o)&&e.push(o)}if(ds(h,p))return!1;p=e}else{if(p=r.parse(p),!Pn(t,s,n,p))return!1;if(r.isEqual(h,p))return!1}return a(p,d),!0}}class Cn{constructor(e){this._updaters=Object.keys(e).map((t=>({updater:wn(t,e[t]),key:t})))}update(e,t){const i=[];for(const s of this._updaters){const{updater:r,key:n}=s;r(e,t)&&i.push(n)}return i}}var Rn;!function(e){e.STORAGE_ASSIGNEE_TYPE="storage:assignee$$type",e.VISIBILITY="app_metadata$$shell:visibility",e.CREATIVE_CLOUD_TOPLEVEL_COLLECTION_NAME="creative_cloud_toplevel_collection_name",e.FIELD_EXISTS="op_field_exists",e.FIELD_MATCHES="op_field_matches",e.INCLUDES="includes",e.TYPE="type",e.STORAGE_ASSIGNEE_ID="storage:assignee$$id",e.SHARED_VIA_INVITE="shared_via_invite",e.OP_AND="op_and",e.OP_OR="op_or",e.REPO_ACL_MODIFIER="repo:acl$$repo:modifier",e.REPO_ACL_PRIVILEGES="repo:acl$$repo:privileges",e.REPO_ACL_RELATIONS="repo:acl$$repo:relations",e.CREATED_FROM_UPLOAD="app_metadata$$cc:createdFromUpload",e.CREATED_BY_CLIENT_ID="repo:createdByClientId"}(Rn||(Rn={}));const Ln="app_metadata$$review:sourceAsset$$dc:format",Nn="api:metadata/peruser#mine$$shell:lastAccessDate",Dn={name:"asset_name",created:"create_date",modified:"modify_date",shared:"shared_date",lastAccessed:Nn},Mn="application/vnd.adobe.hz.express+dcx";function xn(){return[{[Rn.FIELD_MATCHES]:{[Ln]:Mn}}]}class kn{constructor(e){this._isDiscarded=!1,this._isPublished=!1,this._isSharedWithYou=!1,this._includeHiddenRecursive=!1,this._includeHiddenRecursive=!!(null==e?void 0:e._includeHiddenRecursive),this._isDiscarded=!!(null==e?void 0:e._isDiscarded),this._isPublished=!!(null==e?void 0:e._isPublished),this._isSharedWithYou=!!(null==e?void 0:e._isSharedWithYou)}matches(e){return!(e.isComposite&&0===e.sizeInBytes&&!e.isLibrary&&!e.localID||e.isDiscarded!==this._isDiscarded||e._isSWYAsset_NoLazyLoad&&e._isSWYAsset_NoLazyLoad!==this._isSharedWithYou||this._isDiscarded&&"DISCARDED_PARENT"===e._assetState||e.isPublished!==this._isPublished||"/cloud-content-archive"===e.repoPath||"/archive"===e.repoPath||e.reviewLinkSourceType===Mn||"hiddenSelf"===e.shellVisibility||"hiddenRecursive"===e.shellVisibility&&!this._includeHiddenRecursive)}}class Hn extends kn{constructor(e){super(),this._query=null==e?void 0:e.query,this._deepSearch=null==e?void 0:e.deepSearch,this._asset=null==e?void 0:e.asset}get deepSearch(){return this._deepSearch}get asset(){return this._asset}get query(){return this._query}matches(e){if(this.asset&&this.asset.repositoryID&&e.repositoryID&&this.asset.repositoryID!==e.repositoryID)return!1;if(this.asset&&this.asset.repoPath&&e.repoPath){const t=this.asset.repoPath;if(this.deepSearch){if(!e.repoPath.startsWith(Fs.join(t,"/")))return!1}else if(t!==e.repoPath.substring(0,e.repoPath.lastIndexOf("/")))return!1}return super.matches(e)}}function jn(e,t){return e.localeCompare(t)}function Un(e,t){return e===t?0:e<t?-1:1}class Bn{constructor(e,t,i){this.direction=e,this.field=t,this.comparator=i}get hash(){return this.direction+":"+this.field}sortItems(e){e.sort(this.comparator)}}function Fn(e){return class extends Bn{constructor(t,i){let s=e[i];"descending"===t&&(s=function(e){return(t,i)=>-e(t,i)}(s)),super(t,i,s)}}}const Vn={name:"repo:name",created:"storage:deviceCreateDate",modified:"storage:deviceModifyDate",shared:"storage:deviceModifyDate"},Kn={name:(e,t)=>jn(e.name,t.name),created:(e,t)=>Un(e.created,t.created),modified:(e,t)=>Un(e.modified,t.modified),shared:(e,t)=>Un(e.shared,t.shared)};class Gn extends(Fn(Kn)){}Gn.default=new Gn("descending","modified");const $n="storage_assignee_changed",Wn=new class extends ot{constructor(){super($n)}};class zn extends Set{isDisjointFrom(e){return![...this].some((t=>e.has(t)))}isSubsetOf(e){return[...this].every((t=>e.has(t)))}isSupersetOf(e){return zn.prototype.isSubsetOf.call(e,this)}intersection(e){return new zn([...this].filter((t=>e.has(t))))}union(e){return new zn([...this,...e])}difference(e){return new zn([...this].filter((t=>!e.has(t))))}symmetricDifference(e){return new zn([...this,...e].filter((t=>this.has(t)!==e.has(t))))}}function qn(e,t){const i=Yn("mediaTypes",e);if(i)return[...i];const s=Yn("mediaTypes",t);return s?[...s]:[]}function Yn(e,t){if(t&&e in t)return t[e]}class Qn{constructor(e,t,i,s,r){this._assetPool=e,this._asset=t,this._core=i,this._includePermissions=s,this._loadLibraryData=r}supportsFilter(e){return void 0!==e}async loadPage(e){return await this._loadPage(e)}async _loadPage(e,t){var i,s,r;const{order:n,filter:o,implicitFilter:a,resource:c}=e,{limit:l}=null!==(i=e.loadOptions)&&void 0!==i?i:{},d=qn(a,o);let u;if(this._loadLibraryData){if(!this._asset.isProject)throw We.create(Be.UNSUPPORTED,`Asking for child libraries from non-project asset with id: ${this._asset.id}`);u=this._core.hostAssetContext._libraryInterface.getLibrariesForProject(this._asset.id)}const h=this._assetPool._core._environment.getValue("ASSETS_LIST_UPDATE_LATENCY"),p=Date.now()-h,_=this._assetPool.createLoaderMutationSession();let m,f,g;if(null===(s=this._core._environment.getValue("FEATURE_FLAGS"))||void 0===s?void 0:s["use-graphql"]){const e=await this._core._getGQLManager(),i=await e.getChildren(this._asset.id,{filter:o,order:n,loadOptions:{limit:l},after:t},c);m=i.children,g=i.ancestors,f=i.pageInfo.hasNextPage&&null!==(r=i.pageInfo.endCursor)&&void 0!==r?r:void 0}else{const e=[{resource:{reltype:yt.APP_METADATA},selectors:Bi}];this._includePermissions&&e.push({resource:{reltype:yt.AC_EFFECTIVE}}),await this._asset._ensureLink(yt.PAGE);const i=await this._asset._getAssetInterface(),s=await i.getChildAssets({orderBy:Vn[n.field],orderDirection:n.direction,start:t,limit:l,type:d,filters:{assetTypes:[...o.assetTypes||[]],excludeAssetTypes:[...o.excludeAssetTypes||[]],assetSubTypes:[...o.assetSubTypes||[]]},embed:e},c);g=s["repo:ancestors"],m=s.children,f=s._page.next}this._asset.isProject&&this._core.hostAssetContext._adobeAssetUpdater.updateLocalItem(_,this._asset,{"repo:ancestors":g}),m=m.map((e=>{var t;return e["repo:ancestors"]||(e["repo:ancestors"]=[...null!==(t=this._asset.ancestorIDs)&&void 0!==t?t:[],this._asset.id]),e}));const y=await this._core._adobeAssetFactory.getRepoMetadataUpdaters(m),v=this._core._adobeAssetFactory.assetsFromRepoMetadata(_,m.filter((e=>{var t,i;return!(null===(t=o.excludeMediaTypes)||void 0===t?void 0:t.has(e["dc:format"]))&&!(null===(i=o.excludeAssetTypes)||void 0===i?void 0:i.has(e["repo:assetType"]))})),y);let O,b;return this._loadLibraryData&&(O=v.filter((e=>e.isLibrary)),O.forEach((e=>e._setLibraryLoadState("LOADING")))),v.forEach((e=>{e._storageAssignee_NoLazyLoad.id&&on.updatedByItemUpdater(e,Wn)})),_.commit(),this._loadLibraryData&&u.then((e=>this._updateLibrariesData(O,e))),f&&(b=e=>this._loadPage(e,f)),{items:v,loadNextPage:b,mostRecentValidMutation:p}}_getSafeLibraryData(e){if(!e)return{};const{library_urn:t,id:i,bookmark:s,name:r,ownership:n,roles:o,rendition_grid:a}=e;return{library_urn:t,id:i,bookmark:s,name:r,ownership:n,roles:o,rendition_grid:a}}async _updateLibrariesData(e,t){const i=this._core.hostAssetContext._assetPool.createUpdateSession(),s=await this._core.getLibraryContext();e.forEach((e=>{const r=t.find((t=>t.library_urn===e.id));if(r){const t=this._getSafeLibraryData(r);s._libraryUpdater.updateLocalItem(i,e,t),e._setLibraryLoadState("LOADED")}else e._setLibraryLoadState("NOT_LOADED")})),i.commit()}}const Jn=50;class Xn{constructor(e,t,i){this._assetPool=e,this._core=t,this._loader=i,this._getItemData=e=>function(e,t){var i,s;return Object.assign(Object.assign(Object.assign(Object.assign({},t.rm),{sharedViaInvite:(null===(i=t.cm)||void 0===i?void 0:i.sharedBy.length)>0&&t.cm.sharedBy[0]!==e,isShared:(null===(s=t.cm)||void 0===s?void 0:s.sharedBy.length)>0}),t.am&&{_embedded:{[yt.APP_METADATA]:t.am}}),{shareFlagsAreDirty:!1})}(this._core._environment.getUserId(),e)}async loadPage(e,t){var i,s,r;const{order:n,filter:o,implicitFilter:a,resource:c}=e,{limit:l=Jn}=null!==(i=e.loadOptions)&&void 0!==i?i:{},d=this._core._environment.getValue("USS_LIST_UPDATE_LATENCY"),u=Date.now()-d;t=t||0;const{mediaTypes:h,excludeMediaTypes:p}=o,_=(await this._loader._getUSSResults({order:n,loadOptions:Object.assign({limit:l},e.loadOptions),filter:o,implicitFilter:a,resource:c,start:t,mediaTypes:Array.from(null!=h?h:[]),excludeMediaTypes:Array.from(null!=p?p:[])})).queryResults[0],m=_.items||[],f=await this._core._adobeAssetFactory.getUSSV3Updaters(m),g=this._assetPool.createLoaderUpdateSession(u),y=this._loader._extractItems?this._loader._extractItems(g,m,f):this._extractItems(g,m,f);let v;y.forEach((e=>on.updatedByItemUpdater(e,$n)));const O=_.metadata.totalHits||0,b=m.length,I=0===b?t+l:t+b;I<O&&(v=e=>this.loadPage(e,I));const E={items:y,total:O,loadNextPage:v,mostRecentValidMutation:u};return null===(r=(s=this._loader)._postProcessPage)||void 0===r||r.call(s,e,E),g.commit(),E}_extractItems(e,t,i){var s;return this._core._adobeAssetFactory.assetsFromUSSV3Response(e,t,null!==(s=this._loader._getItemData)&&void 0!==s?s:this._getItemData,i)}}const Zn="USSAdobeAssetFilter";var eo;!function(e){e.Created="rm.storage:deviceCreateDate",e.Modified="rm.storage:deviceModifyDate",e.Name="rm.repo:name"}(eo||(eo={}));const to={name:eo.Name,created:eo.Created,modified:eo.Modified,shared:eo.Modified,lastAccessed:eo.Modified};var io;!function(e){e.Ascending="ASC",e.Descending="DESC"}(io||(io={}));const so={ascending:io.Ascending,descending:io.Descending};var ro,no,oo,ao,co;function lo(){return{[no.NOT]:{funcParams:{[ro.REVIEW_SOURCE_TYPE]:[Mn]}}}}!function(e){e.MEDIA_TYPE="rm.dc:format",e.DIRECTORY_TYPE="am.project:directoryType",e.REVIEW_SOURCE_TYPE="am.review:sourceAsset.dc:format",e.STORAGE_ASSIGNEE_TYPE="rm.storage:assignee.type",e.PARENT_ID="rm.parentDirectoryId",e.REPO_ANCESTORS="rm.repo:ancestors",e.SHELL_VISIBILITY="am.shell:visibility",e.TOP_LEVEL_COLLECTION_NAME="rm.topLevelCollectionName",e.STORAGE_ASSIGNEE_ID="rm.storage:assignee.id",e.CREATED_FROM_UPLOAD="am.cc:createdFromUpload",e.CREATED_BY_CLIENT_ID="rm.repo:createdByClientId",e.ASSET_TYPE="rm.repo:assetType",e.ASSET_SUB_TYPE="rm.repo:assetSubType"}(ro||(ro={})),function(e){e.MISSING="function:missing",e.NOT="function:not"}(no||(no={})),function(e){e.PROJECT="team"}(oo||(oo={})),function(e){e.SharedBy="cm.sharedBy",e.LastAccessDate="am.shell:lastActivity.date",e.ShellVisibility="am.shell:visibility",e.Collaborator="cm.collaborator",e.PublicCollaborator="cm.publicCollaborator",e.ParentProjectId="am.cc:inherited.cc:team.repo:assetId",e.StudentAssignmentAssetId="am.cc:inherited.cc:studentAssignment.repo:assetId",e.StudentAssignmentDirectoryId="am.cc:inheritable.cc:studentAssignment.repo:assetId",e.CCInherited="am.cc:inherited",e.CCInheritable="am.cc:inheritable",e.HzDocumentMetadata="am.hz:documentMetadata",e.CreatedFromUpload="am.cc:createdFromUpload",e.CreatedByClientId="rm.createdByClientId",e.ReviewSourceAsset="am.review:sourceAsset",e.ReviewSourceAssetType="am.review:sourceAsset.dc:format",e.ConvertedTo="am.convertedTo",e.NonAutoMigratable="am.ccx:nonAutoMigratableCopiedFromId",e.CopiedLegacySparkId="am.ccx:copiedLegacySparkId"}(ao||(ao={}));class uo{constructor(e,t,i,s,r){this._adobeAssetSearchInterface=i,this._asset=s,this._implicitFilter=r,this._ussLoaderHelper=new Xn(e,t,this)}supportsFilter(e){return void 0!==e}async loadPage(e){return this._ussLoaderHelper.loadPage(e)}async _getUSSResults({start:e,loadOptions:t,order:i,mediaTypes:s,excludeMediaTypes:r,filter:n}){var o;const a=null===(o=this._implicitFilter)||void 0===o?void 0:o._query,c=Boolean(this._implicitFilter.deepSearch),l={orderBy:to[i.field],orderDirection:so[i.direction],start:e,limit:null==t?void 0:t.limit,mediaTypes:s,excludeMediaTypes:r,query:a,deepSearch:c,assetId:this._asset.cloudID};if(n.name===Zn){const e=n;l.userId=e.userId,l.uploadedFrom=e.uploadedFrom}return this._adobeAssetSearchInterface.getFilteredAssets(l)}}function ho(e,t){return e===t?"subset":e&&t?e.hash===t.hash||"everything"===t.hash?"subset":"everything"===e.hash?"unknown":e.getRelationToFilter(t):e?"subset":"unknown"}function po(e=new Date(-9999,0,1),t=new Date(9999,0,1),i=new Date(-9999,0,1),s=new Date(9999,0,1)){return e>=i&&t<=s?"subset":e>s||t<i?"disjoint":"unknown"}function _o(e,t){const i=new zn(e),s=new zn(t);return s.size?s.size&&!i.size?"unknown":i.isDisjointFrom(s)?"disjoint":i.isSubsetOf(s)?"subset":"unknown":"subset"}!function(e){e[e.NotStarted=1]="NotStarted",e[e.HadLoaderErrors=2]="HadLoaderErrors",e[e.Loading=3]="Loading",e[e.ReadyHasMorePages=4]="ReadyHasMorePages",e[e.ReadyFullyLoaded=5]="ReadyFullyLoaded"}(co||(co={}));const mo="loaderStateChanged",fo="loaderRefreshNeeded";class go extends ot{constructor(e=!1){super(mo),this.hasUpdatedItems=e}}class yo extends ot{constructor(e=0){super(fo),this.revalidateAtPage=e}}const vo=new go(!1),Oo=new go(!0);class bo{constructor(){this.startedGeneration=0,this.loadedGeneration=0}}class Io extends Rs{constructor(e,t,i,s,r){super(),this._core=e,this._loader=t,this._order=i,this._implicitFilter=s,this._filter=r,this.status=co.NotStarted,this._pages=[],this._generation=0,this._nextPageIndex=0,this._revalidateAtPage=0,this._invalidateCache=!1}get mostRecentValidMutation(){return this._mostRecentValidMutation}async load(e,t,i=0,s){this._generation=e,this._nextPageCallback=void 0,this._nextPageIndex=0,this._pendingLoad=void 0,this._revalidateAtPage=i,this._invalidateCache=null!=s&&s,await this._loadPage(t)}async loadNextPage(e){await this._loadPage(e)}async loadAllPages(e={}){e.loadAllPages=!0,await this._loadPage(e)}collectAllItems(e){for(const t of this._pages)if(t&&t.items)for(const i of t.items)e.add(i)}_ensurePage(e){let t=this._pages[e];return t||(t=new bo,this._pages[e]=t),t}async _loadPage(e){let t=this._pendingLoad;t||(t=this._loadPageImpl(e),this._pendingLoad=t),await t,this._pendingLoad===t&&(this._pendingLoad=void 0)}async _loadPageImpl(e={}){var t;const i=this._nextPageCallback,s=this._nextPageIndex;if(s&&!i)return;const r=this._ensurePage(s),n=this._generation;if(r.startedGeneration>=n)return;const o=r.startedGeneration;let a,c,l;r.startedGeneration=n,r.validatedPromise=void 0,this.error=null,this._updateStatus(co.Loading);try{null!==(t=e.limit)&&void 0!==t||(e.limit=r.limit);const o=new ur(this._core,{parseResponse:async e=>e,skipRevalidation:()=>s<this._revalidateAtPage,onChange:async(e,t)=>{if(null==t?void 0:t.loading)l=new sn,r.validatedPromise=l.promise;else{if(null==l||l.resolve(),r.startedGeneration!==n)return;a&&(null==t?void 0:t.changed)&&this.dispatch(new yo(s+1))}},onError:async e=>{l&&(l.reject(e),r.startedGeneration===n&&(this._nextPageCallback=void 0,this.error=e,this.status=co.HadLoaderErrors,e.code===Be.NOT_FOUND?(this._pages=[],this.dispatch(Oo)):(this.status=co.HadLoaderErrors,this.dispatch(vo))))}});o.isDirty=this._invalidateCache;const c={order:this._order,implicitFilter:this._implicitFilter,filter:this._filter,loadOptions:e,resource:o};i?(a=await i(c),this._nextPageCallback=void 0):(a=await this._loader.loadPage(c),this._mostRecentValidMutation=a.mostRecentValidMutation),r.limit=e.limit}catch(e){c=e}if(!(r.loadedGeneration>=n)){if(c){if(r.startedGeneration!==n)return;r.startedGeneration=o}else a&&(r.items=a.items.filter((e=>this._implicitFilter.matches(e)&&this._filter.matches(e))),this.total=a.total,r.loadedGeneration=n);await this._updateStatusAndLinkToNextPage(n,s,a,e,c)&&await this._loadPageImpl(e)}}async _updateStatusAndLinkToNextPage(e,t,i,s,r){if(this._generation!==e||this._nextPageIndex!==t)return i&&this.dispatch(Oo),!1;if(!i)return this.error=r,this._updateStatus(co.HadLoaderErrors),!1;if(this._nextPageIndex=t+1,this._nextPageCallback=i.loadNextPage,i.loadNextPage)this._updateStatus(co.ReadyHasMorePages);else{this._pages.splice(this._nextPageIndex);try{const e=this._pages.map((e=>e.validatedPromise)).filter(Boolean);e.length&&(this.dispatch(Oo),await Promise.all(e)),this._updateStatus(co.ReadyFullyLoaded)}catch(e){return this.error=e,this._updateStatus(co.HadLoaderErrors),!1}}const n=this._nextPageIndex<this._pages.length;return s.loadAllPages||n}_updateStatus(e){const t=e===co.ReadyFullyLoaded||e===co.ReadyHasMorePages;(t||e!==this.status)&&(this.status=e,this.dispatch(t?Oo:vo))}}class Eo{constructor(){}get hash(){return"everything"}matches(e){return void 0!==e}getRelationToFilter(e){return"subset"}}const To="status_changed",So="listChanged",Ao="listFullyLoaded",Po="LoaderUpdateContext",wo=new class extends ot{constructor(){super(So)}},Co=new class extends ot{constructor(){super(To)}};let Ro=0;class Lo extends Rs{constructor(e,t,i,s,r=new Eo,n,o){super(),this._itemPool=e,this.order=i,this.implicitFilter=s,this.filter=r,this._loadOptions=o,this._status=co.NotStarted,this._items=[],this._generation=0,this._completedGeneration=0,this._loaderStates=[],this._lastFetchTime=0,this._needsRefresh=!1,this._invalidateCacheForNextLoad=!1,this._itemUpdatesByGeneration=new Map,this._listId=Ii(),this._onUnhandledPromiseError=e=>{var t;this._updateListStatusFromItemLoaderStates(),(null===(t=this._errors)||void 0===t?void 0:t.length)||(this._errors=[]),this._errors.push(e),this._status=co.HadLoaderErrors,this.emit(To)},this._handlePendingLoad=async()=>{const e=this._pendingLoad;if(e){const{loadOptions:t,revalidateAtPage:i,invalidateCache:s}=e;this._pendingLoad=void 0,this._debug("_handlePendingLoad() awaiting _runLoaders for loaderState.load"),await this._runLoaders((e=>e.load(this._generation,t,i,s)))}},this._onItemLoaderStateChanged=e=>{const{hasUpdatedItems:t}=e;this._cleanPreviousGenerationItemsIfNeeded(),t&&this._updateListItemsFromItemLoaderStates()},this._onItemLoaderRefreshNeeded=e=>{const{revalidateAtPage:t}=e;this._updateListItemsFromItemLoaderStates(),this._needsRefresh=!0,this._loadAsync(this._loadOptions,t).catch(this._onUnhandledPromiseError)},this._globalStateChangedEvent=new Li(this),this._itemPoolDelegate={onItemsUpdated:e=>{if(e.updateContext===Po)return;let t=this._pendingNotifications;t||(t=[],this._pendingNotifications=t),t.push({generation:this._generation,event:e}),this._updateListItemsFromItemLoaderStates()}};for(const e of t){if(e.supportsFilter&&!e.supportsFilter(r))continue;const t=new Io(this._core,e,i,s,r);t.on(mo,this._onItemLoaderStateChanged),t.on(fo,this._onItemLoaderRefreshNeeded),this._loaderStates.push(t)}n&&this._copyInitialItemsFrom(n),e.addDelegate(this._itemPoolDelegate,"list")}_debug(e){this._core._environment.debug(`[ItemList ${this._itemPool.type} ${this._listId.slice(-4)}] ${e}`)}_updateLoadOptions(e={}){var t,i;this._loadOptions||(this._loadOptions={}),this._loadOptions.limit&&e.limit&&this._loadOptions.limit<e.limit&&(this._loadOptions.limit=e.limit),!this._loadOptions.loadAllPages&&e.loadAllPages&&(this._loadOptions.loadAllPages=e.loadAllPages),-1!==e.refreshTimeout&&(-1===this._loadOptions.refreshTimeout||(null!==(t=this._loadOptions.refreshTimeout)&&void 0!==t?t:0)>=(null!==(i=e.refreshTimeout)&&void 0!==i?i:0))&&(this._loadOptions.refreshTimeout=e.refreshTimeout),this._loadAsync(Object.assign(Object.assign({},this._loadOptions),{refreshTimeout:-1===e.refreshTimeout?-1:this._loadOptions.refreshTimeout})).catch(this._onUnhandledPromiseError)}get type(){return this._itemPool.type}get generation(){return this._generation}get completedGeneration(){return this._completedGeneration}get hasLoaders(){return this._loaderStates.length>0}get lastFetchTime(){return this._lastFetchTime}get _core(){return this._itemPool._core}_copyInitialItemsFrom(e){const t=new Map,i=this.filter;for(const s of e.items)this.implicitFilter.matches(s)&&i.matches(s)&&t.set(s,!0);this._generation=e.generation,this._completedGeneration=e.completedGeneration,this._itemUpdatesByGeneration.set(this._generation,t),e.status===co.ReadyFullyLoaded&&"subset"===ho(i,e.filter)&&(this._status=co.ReadyFullyLoaded,this._lastFetchTime=e.lastFetchTime),this._updateListItemsFromItemLoaderStates()}_applyListItemsFrom(e){if(e.status!==co.ReadyFullyLoaded)throw We.create(Be.INTERNAL_ERROR,"_applyListItems other list must be fully loaded");if("subset"!==ho(this.filter,e.filter))throw We.create(Be.INTERNAL_ERROR,"_applyListItems other list must be subset");this._items=e.items.filter((e=>this.implicitFilter.matches(e)&&this.filter.matches(e))),this.order.sortItems(this._items),this._dispatchItemsChangedEvent(),this._status!==co.ReadyFullyLoaded&&(this._status=co.ReadyFullyLoaded,this._dispatchStateChangedEvents())}get status(){return this._loaderStates.length?this._status:co.ReadyFullyLoaded}get errors(){return this._errors}get items(){return this._items}get total(){return this._total}_cleanPreviousGenerationItemsIfNeeded(){let e;for(const t of this._loaderStates){const{status:i,mostRecentValidMutation:s}=t;if(i!==co.NotStarted&&t.status!==co.HadLoaderErrors){if(i===co.Loading||i===co.ReadyHasMorePages)return;s&&(e=e?Math.min(e,s):s)}}this._cleanPreviousGenerationItems(e)}_cleanPreviousGenerationItems(e){this._applyItemsChangedEvents();const t=this._generation;this._completedGeneration=t;const i=new Map;let s=!1,r=0;for(const[n,o]of this._itemUpdatesByGeneration)if(!(n>=t)&&(s=!0,this._itemUpdatesByGeneration.delete(n),r=Math.max(r,n),e))for(const[t,s]of o){const{lastKnownClientMutation:r}=t;(i.has(t)||r&&r>e)&&i.set(t,s)}i.size&&this._itemUpdatesByGeneration.set(r,i),s&&this._dispatchItemsChangedEvent()}refresh(){this._loadAsync(this._loadOptions).catch(this._onUnhandledPromiseError)}load(e){tn("ItemList.load","ItemList.load() is deprecated and will be removed on or after 2024-10-01. Use ItemList.refresh() instead. List load parameters are passed as the 3rd parameter to ItemSource.getList(), which now automatically starts loading."),e=Object.assign({refreshTimeout:0},e),this._updateLoadOptions(e)}async _loadAsync(e,t){var i;if(!this._loaderStates.length)return;const s=null!==(i=null==e?void 0:e.refreshTimeout)&&void 0!==i?i:0,r=this._lastFetchTime;if(this._needsRefresh||!r||!s||-1!==s&&r+s<Date.now())return this._debug(`_loadAsync() calling _load(): _needsRefresh: ${this._needsRefresh}, lastFetchTime: ${r} refreshTimeout: ${s}`),void await this._load(e,t);this._debug(`_loadAsync() not time to refresh: _needsRefresh: ${this._needsRefresh}, lastFetchTime: ${r} refreshTimeout: ${s}`);const n=this._previousLoadPromise;n&&(this._debug("_loadAsync() awaiting previousLoadPromise"),await n),(null==e?void 0:e.loadAllPages)&&await this._ensureAllPagesAreLoaded(e)}async _load(e,t=0){this._needsRefresh=!1;const i=this._invalidateCacheForNextLoad;this._invalidateCacheForNextLoad=!1;let s=this._pendingLoad;s?(null==e?void 0:e.loadAllPages)&&(s.loadOptions||(s.loadOptions={}),s.loadOptions.loadAllPages=!0):(this._status=co.Loading,this._lastFetchTime=Date.now(),this._generation=++Ro,this._debug("_load() creating _pendingLoad"),this._pendingLoad=s={loadOptions:e,revalidateAtPage:t,invalidateCache:i,promise:Promise.resolve().then(this._handlePendingLoad)},this._dispatchStateChangedEvents()),this._debug("_load() awaiting _pendingLoad"),await s.promise}loadNextPage(e){this._loadNextPageAsync(e||this._loadOptions).catch(this._onUnhandledPromiseError)}async _loadNextPageAsync(e){this._loaderStates.length&&(this._pendingLoad?(this._debug("_loadNextPageAsync() awaiting _pendingLoad"),await this._pendingLoad.promise):(this._status=co.Loading,this._dispatchStateChangedEvents(),this._debug("_loadNextPageAsync() awaiting _runLoaders for loaderState.loadNextPage"),await this._runLoaders((t=>t.loadNextPage(e)))))}async _runLoaders(e){this._lastFetchTime=Date.now();const t=Promise.all(this._loaderStates.map(e));this._previousLoadPromise=t;try{this._debug("_runLoaders() awaiting loaders"),await t}finally{this._debug("_runLoaders() loaders complete"),this._previousLoadPromise=void 0,this._updateListStatusFromItemLoaderStates(),this._dispatchStateChangedEvents(),this._status===co.ReadyFullyLoaded&&this.emit(Ao)}}setNeedsRefresh(){if(this.status!==co.NotStarted&&this._loaderStates.length){if(this.listenerCount(So))return this._needsRefresh=!0,this._invalidateCacheForNextLoad=!0,void this.refresh();this._needsRefresh=!0,this._invalidateCacheForNextLoad=!0}}_onEventListenerAdded(){this._needsRefresh&&this.listenerCount(So)&&this.refresh()}async _ensureAllPagesAreLoaded(e){this.status===co.ReadyHasMorePages&&await this._runLoaders((t=>t.loadAllPages(e)))}_dispatchStateChangedEvents(){this._debug(`_dispatchStateChangedEvents status: ${co[this.status]}`),this.dispatch(Co),this._core.dispatch(this._globalStateChangedEvent)}_updateListStatusFromItemLoaderStates(){var e;let t=this._pendingLoad?co.Loading:co.NotStarted;this._errors=void 0;for(const i of this._loaderStates)switch(i.status){case co.HadLoaderErrors:if(this._pendingLoad)break;return this._status=co.HadLoaderErrors,void(this._errors=[i.error]);case co.ReadyHasMorePages:t===co.Loading||(null===(e=this._loadOptions)||void 0===e?void 0:e.loadAllPages)||(t=co.ReadyHasMorePages);break;case co.Loading:t=co.Loading;break;case co.ReadyFullyLoaded:t!==co.ReadyHasMorePages&&t!==co.Loading&&(t=co.ReadyFullyLoaded)}this._status=t}_dispatchItemsChangedEvent(){this.dispatch(wo)}_updateListItemsFromItemLoaderStates(){this._applyItemsChangedEvents();const e=new Set;let t;for(const i of this._loaderStates)i.collectAllItems(e),void 0!==i.total&&(t=Math.max(t||0,i.total));for(const t of this._itemUpdatesByGeneration.values())for(const[i,s]of t.entries())s?e.add(i):e.delete(i);const i=Array.from(e);this.order.sortItems(i),this._items=i,this._total=t,this._dispatchItemsChangedEvent()}_applyItemsChangedEvents(){const e=this._pendingNotifications;if(e){this._pendingNotifications=void 0;for(const t of e){const{event:e,generation:i}=t;if(i<this._completedGeneration)continue;let s=this._itemUpdatesByGeneration.get(i);if(s||(s=new Map,this._itemUpdatesByGeneration.set(i,s)),e.addedItems)for(const t of e.addedItems)this.implicitFilter.matches(t)&&this.filter.matches(t)&&s.set(t,!0);if(e.changedItems)for(const t of e.changedItems){const e=this.implicitFilter.matches(t)&&this.filter.matches(t);s.set(t,e)}if(e.discardedItems)for(const t of e.discardedItems)s.set(t,!1)}}}}Ye([ht(Co)],Lo.prototype,"status",null),Ye([ht(Co)],Lo.prototype,"errors",null),Ye([ht(wo)],Lo.prototype,"items",null),Ye([ht(wo)],Lo.prototype,"total",null);class No{constructor(e){this._ref=e}get[Symbol.toStringTag](){return"WeakRef"}deref(){return this._ref}}var Do="undefined"!=typeof WeakRef?WeakRef:No;function Mo(e){const t=e;return new Promise((i=>{function s(){e.status!==co.Loading&&(t.off(To,s),i())}t.on(To,s),s()}))}var xo,ko,Ho=Object.freeze({__proto__:null,waitForListLoad:Mo,waitForListChange:function(e){const t=e;return new Promise((e=>{t.on(So,(function i(){t.off(So,i),e()}))}))}});function jo(e,t){return e.filterRelation!==t.filterRelation?"subset"===e.filterRelation?-1:1:e.generation!==t.generation?t.generation-e.generation:t.length-e.length}!function(e){e[e.Ascending=0]="Ascending",e[e.Descending=1]="Descending"}(xo||(xo={})),function(e){e[e.Name=0]="Name",e[e.Modified=1]="Modified",e[e.Created=2]="Created",e[e.Shared=3]="Shared"}(ko||(ko={}));class Uo{constructor(e,t,i=new Eo){this._itemPool=e,this._implicitFilter=i,this._lists=new Map,this._loaders=t}getList(e,t=new Eo,i){if("number"==typeof e||"number"==typeof t)throw We.create(Be.UNSUPPORTED,"Using OrderDirection and OrderField is not implemented in SAM.js, and will be deprecated in SAM.cpp");let s=this._getExistingList(e,t);if(s)s._updateLoadOptions(Object.assign({refreshTimeout:-1},i));else{const r=this._getMostCompleteCompatibleList(t);s=new Lo(this._itemPool,this._loaders,e,this._implicitFilter,t,r,i),s.on(Ao,(()=>this._onListFullyLoaded(s))),this._lists.set(this._getListHash(e,t),new Do(s))}return s.status===co.NotStarted&&s.refresh(),s}getListWithTypes(e,t,i){throw We.create(Be.UNSUPPORTED,"getListWithTypes is not implemented in SAM.js and will be deprecated in SAM.cpp")}_getListHash(e,t){return`${t.hash}:${e.hash}`}_getExistingList(e,t){const i=this._getListHash(e,t),s=this._lists.get(i);if(s)return s.deref()}setNeedsRefresh(){for(const e of this._getLists())e.setNeedsRefresh()}_getMostCompleteCompatibleList(e){var t;const i=[];for(const t of this._getLists())if(t.status===co.ReadyFullyLoaded){const s=ho(e,t.filter);"disjoint"!==s&&i.push({list:t,filterRelation:s,generation:t.generation,length:t.items.length})}return i.sort(jo),null===(t=i[0])||void 0===t?void 0:t.list}*_getLists(){const e=this._lists;for(const[t,i]of e.entries()){const s=i.deref();s?yield s:e.delete(t)}}_onListFullyLoaded(e){if(e.status===co.ReadyFullyLoaded)for(const t of this._getLists())t!==e&&"subset"===ho(t.filter,e.filter)&&Mo(t).then((()=>{t.completedGeneration>=e.completedGeneration||t._applyListItemsFrom(e)}))}}Ye([Dt],Uo.prototype,"getList",null);class Bo{constructor(){this._resource=void 0}_shouldDeleteCachedResponse(e){return Boolean(this._resource&&this._resource.etag!==e.etag)}async fetch(e){var t;return await e.load(),this._shouldDeleteCachedResponse(e)&&(null===(t=this._resource)||void 0===t||t.deleteCachedResponse()),this._resource=e,this._resource.data}}class Fo extends Bo{_shouldDeleteCachedResponse(e){return Boolean(this._resource&&this._resource.renditionUrl!==e.renditionUrl)}}class Vo extends ur{constructor(e,t,i,s){super(e,{parseResponse:async e=>await e.blob(),skipRevalidation:()=>!0,skipCache:()=>{var e;return!!(null===(e=this._core._environment.getValue("FEATURE_FLAGS"))||void 0===e?void 0:e["use-graphql-cache"])}}),this._core=e,this._parent=t,this._size=i,this._type=s}get size(){return this._size}get type(){return this._type}async _loadData(){return(await this._parent._getAssetInterface()).getRendition(this)}}class Ko extends Ks{constructor(){super(...arguments),this._etag="static-etag",this._assetId="",this._assetEtag="",this._createdAt=new Date,this._createdBy="",this._manifest=new hn(this._core,this),this._name=""}async _getHeadAssetInterface(){const e=await this._core.getAssetContext();return new Zr(e._rapi,this._assetId,this._assetLinks,this._assetEtag)}async _getAssetInterface(){return new Zr(this._core.hostAssetContext._rapi,this._assetId,this.__links,this._etag)}get assetId(){return this._assetId}get created(){return this._createdAt}get createdBy(){return this._createdBy}get links(){return Object.assign({},this.__links)}get manifest(){return this._manifest}get milestone(){return this._label?{label:this._label,description:this._description}:void 0}get name(){return this._name}get versionId(){return this.id}_getRenditionFetcher(){return this._renditionFetcher||(this._renditionBlobHelper=new Bo,this._renditionFetcher=new Or(this._core,vr,(async(e,t)=>{const i=new Vo(this._core,this,e,t);return this._renditionBlobHelper.fetch(i)})),this._renditionFetcher.on("change",(()=>{this.dispatch({type:"change"})}))),this._renditionFetcher}getRenditionURL(e,t=gr.PNG){return this._getRenditionFetcher().getURL(e,t,this._etag)}renditionURLStatus(e,t){return this._getRenditionFetcher().renditionURLStatus(e,t,this._etag)}async getCustomRendition({size:e,type:t,urlTemplateOptions:i,additionalHeaders:s}={}){return(await this._getAssetInterface()).getCustomRendition({size:e,type:t,urlTemplateOptions:i,additionalHeaders:s})}async getAllCustomRenditions({type:e,urlTemplateOptions:t,additionalHeaders:i}={}){return(await this._getAssetInterface()).getAllCustomRenditions({type:e,urlTemplateOptions:t,additionalHeaders:i})}async getPresignedRenditionURL({size:e,type:t}){const i=await this.getCustomRendition({size:e,type:t,additionalHeaders:{Accept:"application/vnd.adobecloud.download+json"}});return(await i.json()).href}async getPresignedURL(e={}){const t=It(this.__links,yt.DOWNLOAD),i=await this._getAssetInterface();return await i.getBlockDownloadURL(t,e.presignedUrlExpirationSeconds)}async restore(){const e=await this._core.getAssetContext(),t=await e.getAssetWithCloudID(this._assetId);if(t.isComposite){const e=It(this.__links,yt.MANIFEST),i=await this._getHeadAssetInterface();await i.restoreVersionManifest(e),await t._load()}else{const e=It(t.links,yt.PRIMARY);await this.copy(e)}}async copy(e){const t=await this._core.getAssetContext(),i=(await t.getAssetWithCloudID(this._assetId)).isComposite,s=It(this.__links,yt.PRIMARY);if(i)throw We.create(Be.UNSUPPORTED,"AssetVersion.copy not implemented for composite assets");{const t=await this._getHeadAssetInterface();return await t.runOperation({op:"copy",id:this._assetId,source:{href:s,"if-match":"*"},target:{href:e,"if-match":"*"}})}}async moveToAsset(e,t=!1){await this.copyPrimaryToAsset(e),await this.permanentlyDelete(t)}async permanentlyDelete(e=!1){const t=await this._getHeadAssetInterface(),i=(await this._core.getAssetContext())._assetPool.getLocalItemById(this._assetId);try{await t.patchVersion([{op:Wr.remove,path:`/children/version=${this.versionId}`}])}catch(t){if(!ze(t))throw t;if(t.code!==Be.ACCESS_DENIED||!e)throw t;i&&await i.permanentlyDelete()}if(!i)return;const s=i._versionPool.createUpdateSession();s.queueDiscardedItem(this),s.commit()}async copyToAsset(e){const t=await this._getHeadAssetInterface();await t.runOperationWithEmptyResponse({op:"copy_resources",source:{"repo:assetId":this._assetId,"repo:version":this.versionId},target:{"repo:assetId":e},resources:[{reltype:yt.PRIMARY}]})}async copyPrimaryToAsset(e){await this.copyToAsset(e)}async copyToNewAsset(e,t,i){const s=await this._getHeadAssetInterface(),r=await s.runOperation({op:"copy",source:{"repo:assetId":this._assetId,"repo:version":this.versionId},target:{"repo:path":e+"/"+t,"repo:repositoryId":i}});if(!r.asset)throw We.create(Be.UNKNOWN,"Failed to copy asset version");const n=await this._core.getAssetContext(),o=n._assetPool.createUpdateSession(),a=n._adobeAssetUpdater.updateRemoteItem(o,r.asset);return o.commit(),a}async setMilestone(e){var t,i,{label:s=(null===(t=this.milestone)||void 0===t?void 0:t.label)||"",description:r=(null===(i=this.milestone)||void 0===i?void 0:i.description)||""}=e;const n=xr(this.versionId,!!this.milestone,s,r),o=await this._getHeadAssetInterface();await o.patchVersion(n);const a=await this._core.getAssetContext(),c=(await a.getAssetWithCloudID(this._assetId))._versionPool.createUpdateSession();Go.updateLocalItem(c,this,{milestone:{label:s,description:r}}),c.commit()}async removeMilestone(){if(!this.milestone)return;const e=[{op:Wr.remove,path:`/children/version=${this.versionId}/milestone`}],t=await this._getHeadAssetInterface();await t.patchVersion(e);const i=await this._core.getAssetContext(),s=(await i.getAssetWithCloudID(this._assetId))._versionPool.createUpdateSession();Go.updateLocalItem(s,this,{milestone:{label:""}}),s.commit()}}Ye([ht],Ko.prototype,"assetId",null),Ye([ht],Ko.prototype,"created",null),Ye([ht],Ko.prototype,"createdBy",null),Ye([ht],Ko.prototype,"links",null),Ye([ht],Ko.prototype,"milestone",null),Ye([ht],Ko.prototype,"name",null),Ye([ht],Ko.prototype,"versionId",null),Ye([ht],Ko.prototype,"getRenditionURL",null),Ye([ht],Ko.prototype,"renditionURLStatus",null);const Go=new vn({localItemType:Ko,remoteIdProperty:"version",propertyUpdater:new Cn({_createdAt:{name:"created",format:"date"},_createdBy:"created_by",_label:"milestone.label",_description:"milestone.description",_assetId:"assetId",_assetEtag:"assetEtag",_assetLinks:{name:"assetLinks",format:"object"},__links:{name:"_links",format:"object"},_name:"repo:deviceAssetName"})});class $o{constructor(e,t){this._versionPool=e,this._assetInterfacePromise=t}async loadPage(e,t){return await this._loadPage(e,t)}async _loadPage(e,t){var i,s;const{limit:r}=null!==(i=e.loadOptions)&&void 0!==i?i:{},n=this._versionPool._core._environment.getValue("VERSIONS_LIST_UPDATE_LATENCY"),o=Date.now()-n,a=await this._assetInterfacePromise,c=e.filter,l=(null==c?void 0:c.version)||void 0,d=await a.getVersions({start:t,limit:r,version:l}),u=this._versionPool.createLoaderUpdateSession(o),h=d.children.map((e=>Object.assign(Object.assign({},e),{assetId:a.assetID,assetEtag:a.etag,assetLinks:a.links}))),p=Go.updateRemoteItems(u,h);let _;u.commit();const m=d.children.length,f=null===(s=d.children[m-1])||void 0===s?void 0:s.created;return f&&r&&m===r&&(_=e=>this._loadPage(e,f)),{items:p,total:d.total_children,loadNextPage:_,mostRecentValidMutation:o}}}function Wo(e){e.updateLastKnownClientMutation()}function zo(e,t){t.updateLastKnownClientMutation()}class qo{constructor(e,t,i,s,r="fetch"){this._core=e,this._delegate=t,this.updateContext=i,this.mostRecentValidMutation=s,this.type=r}get hasChanges(){return Boolean(this._addedItems||this._changedItems||this._discardedItems)}get addedItems(){return this._addedItems&&Array.from(this._addedItems.values())}get changedItems(){return this._changedItems&&Array.from(this._changedItems.keys())}get discardedItems(){return this._discardedItems&&Array.from(this._discardedItems)}get changedItemsWithEvents(){return this._changedItems&&Array.from(this._changedItems)}checkIfItemAllowsMutations(e){const{lastKnownClientMutation:t}=e,{mostRecentValidMutation:i}=this;return!t||!i||t<i}ensureItemIsAdded(e){var t;const{id:i}=e;if((null===(t=this._addedItems)||void 0===t?void 0:t.get(i))===e)return;const s=this._delegate,r=s.getLocalItemById(i);if(r&&r!==e)throw We.create(Be.BAD_REQUEST,`Item with id ${i} does not match the item with this id in the item pool`);r&&!s.isItemDiscarded(e)||this.queueAddedItem(e)}reindexItem(e,t,i){e._setId(i),this.queueChangedItem(e,[lt]),this._delegate.reindexItem(e,t,i)}queueAddedItem(e){var t;let i=this._addedItems;i||(i=new Map,this._addedItems=i),i.set(e.id,e),null===(t=this._changedItems)||void 0===t||t.delete(e)}queueChangedItem(e,t=[lt]){var i;if(null===(i=this._addedItems)||void 0===i?void 0:i.has(e.id))return;let s=this._changedItems;s||(s=new Map,this._changedItems=s);let r=s.get(e);r||(r=new Set,s.set(e,r)),t.forEach((e=>null==r?void 0:r.add(e)))}queueDiscardedItem(e){let t=this._discardedItems;t||(t=new Set,this._discardedItems=t),t.add(e)}getItemById(e){var t;return(null===(t=this._addedItems)||void 0===t?void 0:t.get(e))||this._delegate.getLocalItemById(e)}findItem(e){return this._delegate.findItem(e)}commit(){var e,t;this._delegate.commitUpdateSession(this);const i=this._changedItems;if(i)for(const[e,t]of i.entries())for(const i of t)e.dispatch(i);"mutation"===this.type&&(null===(e=this._addedItems)||void 0===e||e.forEach(Wo),null===(t=this._discardedItems)||void 0===t||t.forEach(Wo),null==i||i.forEach(zo))}}const Yo="itemsChanged";class Qo extends ot{constructor(e,t,i,s){super(Yo),this.addedItems=e,this.changedItems=t,this.discardedItems=i,this.updateContext=s}}function Jo(e,t){return e.priority===t.priority?0:"list"===e.priority?-1:1}class Xo extends Rs{constructor(e,t){super(),this._core=e,this.type=t,this._objectsById=new Map,this._discardedObjects=new WeakSet,this._delegates=[],this._hasUnsortedDelegates=!1,this.getLocalItemById=e=>{const t=this._getObjectsById().get(e);return null==t?void 0:t.deref()},this.removeLocalItems=e=>{Array.isArray(e)?e.forEach((e=>{this._objectsById.delete(e)})):this._objectsById.delete(e)},this.isItemDiscarded=e=>this._discardedObjects.has(e),this.reindexItem=(e,t,i)=>{t!==i&&(this._objectsById.set(i,new Do(e)),this._objectsById.delete(t))},this._updateSessionDelegate=()=>({getLocalItemById:this.getLocalItemById,isItemDiscarded:this.isItemDiscarded,reindexItem:this.reindexItem,findItem:this.findItem,commitUpdateSession:e=>{if(!e.hasChanges)return;const t=this._objectsById,i=this._discardedObjects,{discardedItems:s}=e;if(s)for(const e of s)i.add(e);const{addedItems:r}=e;if(r)for(const e of r)t.set(e.id,new Do(e)),i.delete(e);const n=new Qo(e.addedItems,e.changedItems,e.discardedItems,e.updateContext),o=this._delegates;this._hasUnsortedDelegates&&(o.sort(Jo),this._hasUnsortedDelegates=!1);let a=!1;for(const e of o){const t=e.delegate.deref();t?t.onItemsUpdated(n,this):a=!0}a&&(this._delegates=o.filter((e=>e.delegate.deref()))),this.dispatch(n)}}),this.findItem=e=>{for(const t of this)if(e(t))return t}}_getObjectsById(){return this._objectsById}createUpdateSession(e,t){return new qo(this._core,this._updateSessionDelegate(),e,t)}createLoaderUpdateSession(e){return new qo(this._core,this._updateSessionDelegate(),Po,e)}createMutationSession(){return new qo(this._core,this._updateSessionDelegate(),void 0,void 0,"mutation")}createLoaderMutationSession(){return new qo(this._core,this._updateSessionDelegate(),Po,void 0,"mutation")}addDelegate(e,t){this._delegates.push({priority:t,delegate:new Do(e)}),this._hasUnsortedDelegates=!0}*[Symbol.iterator](){const e=this._objectsById;for(const[t,i]of e){const s=i.deref();s?yield s:e.delete(t)}}forEach(e){for(const t of this)e(t)}map(e){const t=[];for(const i of this)t.push(e(i));return t}toArray(){return this.map((e=>e))}}class Zo extends ln{constructor(e,t){super(e,t,{parseResponse:async e=>await e.blob()}),this._core=e,this._parent=t}async _loadData(){await this._parent._ensureLink(yt.PRIMARY);const e=await this._parent._getAssetInterface();await e.getContent(this)}}class ea{constructor(e){this._isMilestone=null==e?void 0:e.isMilestone,this._createdAfter=null==e?void 0:e.createdAfter,this._createdBefore=null==e?void 0:e.createdBefore,this._createdBy=null==e?void 0:e.createdBy,this._version=null==e?void 0:e.version}static AssetVersionFilter(e,t,i,s,r){return new ea({createdBy:s,createdAfter:t,createdBefore:i,isMilestone:e,version:r})}get isMilestone(){return this._isMilestone}get createdBy(){return this._createdBy}get createdAfter(){return this._createdAfter}get createdBefore(){return this._createdBefore}get version(){return this._version}get hash(){var e,t,i;const s=null===(e=this.createdBy)||void 0===e?void 0:e.join(","),r=(null===(t=this.createdAfter)||void 0===t?void 0:t.getTime())||0,n=(null===(i=this.createdBefore)||void 0===i?void 0:i.getTime())||0,o=this.version||void 0;return String(this.isMilestone)+":"+s+":"+r+":"+n+":"+o}matches(e){const t=void 0===this.isMilestone||this.isMilestone===Boolean(e.milestone),i=void 0===this.createdBy||this.createdBy.includes(e.createdBy),s=(!this.createdAfter||e.created>=this.createdAfter)&&(!this.createdBefore||e.created<=this.createdBefore),r=void 0===this.version||this.version===e.versionId;return t&&i&&s&&r}_getRelationWrtMilestone(e){return this.isMilestone===e.isMilestone?"subset":void 0===this.isMilestone||void 0===e.isMilestone?"unknown":"disjoint"}_getRelationWrtCreatedBy(e){return _o(this._createdBy,e._createdBy)}_getRelationWrtDateRange(e){return po(this._createdAfter,this._createdBefore,e._createdAfter,e._createdBefore)}_getRelationWrtVersion(e){return this.version===e.version?"subset":void 0===this.version||void 0===e.version?"unknown":"disjoint"}getRelationToFilter(e){const t=[this._getRelationWrtMilestone(e),this._getRelationWrtCreatedBy(e),this._getRelationWrtDateRange(e),this._getRelationWrtVersion(e)];return t.includes("disjoint")?"disjoint":t.includes("unknown")?"unknown":"subset"}}ea.BookmarkedVersions=new ea({isMilestone:!0});class ta extends kn{constructor(e){const{asset:t}=e;super(qe(e,["asset"])),this._asset=t}get asset(){return this._asset}matches(e){if(this._asset.repositoryID&&e.repositoryID&&this._asset.repositoryID!==e.repositoryID)return!1;const t=this._asset.repoPath;return(!t||t===e.repoPath.substring(0,e.repoPath.lastIndexOf("/")))&&super.matches(e)}}function ia(e,t){var i,s,r,n;e._embedded||(e._embedded={}),(i=e._embedded)[s=yt.APP_METADATA]||(i[s]={}),(r=e._embedded[yt.APP_METADATA])["cc:inherited"]||(r["cc:inherited"]={}),(n=e._embedded[yt.APP_METADATA]["cc:inherited"])["cc:team"]||(n["cc:team"]={}),e._embedded[yt.APP_METADATA]["cc:inherited"]["cc:team"]["repo:assetId"]=t}class sa extends ln{constructor(e,t){super(e,t,{onChange:async e=>{var t;if(e)try{const t=e["repo:assetId"],i=e._links,s=e["repo:etag"],r=this._core.hostAssetContext._rapi.getAssetResolveByIdHref(t);await this._core._environment.cache.setItem(r,{links:i,etag:s})}catch(e){}await(null===(t=this._parent)||void 0===t?void 0:t._handleResourceUpdates({repoMetadata:e}))},onError:async e=>{var t;await(null===(t=this._parent)||void 0===t?void 0:t._handleResourceUpdates({error:e}))}}),this._core=e}async _loadData(){var e,t;await(null===(e=this._parent)||void 0===e?void 0:e._ensureLink(yt.REPO_METADATA));const i=await(null===(t=this._parent)||void 0===t?void 0:t._getAssetInterface());await(null==i?void 0:i.getRepoMetadata(this))}}class ra extends ln{constructor(e,t){super(e,t,{parseResponse:async e=>Wi(await e.json()),onChange:async e=>{var t;await(null===(t=this._parent)||void 0===t?void 0:t._handleResourceUpdates({effectivePermission:e}))},onError:async e=>{var t;await(null===(t=this._parent)||void 0===t?void 0:t._handleResourceUpdates({error:e})),this._error=void 0}}),this._core=e}async _loadData(){var e,t;await(null===(e=this._parent)||void 0===e?void 0:e._ensureLink(yt.AC_EFFECTIVE));const i=await(null===(t=this._parent)||void 0===t?void 0:t._getAssetInterface());await(null==i?void 0:i.getEffectivePermissions(this))}}class na{constructor(e){this._core=e,this.acplModel=Qc()}async getLocalAsset(e){if(!this.acplModel)return;const t=(await this.getLocalAssets()).find((t=>t["repo:assetId"]===e||t.localID===e));if(t){const e=this._core._getAssetPool().createUpdateSession(),i=await this._core._adobeAssetFactory.getRepoMetadataUpdaters([t]),s=this._core._adobeAssetFactory.assetFromLocalMetadata(e,t,i);return e.commit(),s}}_expandRepositoryPath(e,t){return"~"===t["repo:repositoryId"]&&t["repo:path"]&&(t["repo:repositoryId"]=e.repositoryID,t["repo:path"]=Fs.join(e.repoPath,t["repo:path"])),t}subscribeToLocalAssetChanges(){var e;null===(e=this.acplModel)||void 0===e||e.on("localAssetChange",(async e=>{const{type:t,localAsset:i}=JSON.parse(e);if(!i)return;const s=await this._core.getAssetContext().then((e=>e.getHomeFolder()));this._expandRepositoryPath(s,i);const r=this._core._getAssetPool(),n=i["repo:assetId"],o=r.createUpdateSession();if("delete"===t){const e=(n?o.getItemById(n):void 0)||o.findItem((e=>e.repoPath===i["repo:path"]));e&&o.queueDiscardedItem(e)}else if("add"===t||"update"===t){const e=await this._core._adobeAssetFactory.getRepoMetadataUpdaters([i]);this._core._adobeAssetFactory.assetFromLocalMetadata(o,i,e)}o.commit()}))}get supportsDownloadComposite(){var e;return void 0!==(null===(e=this.acplModel)||void 0===e?void 0:e.downloadComposite)}get supportsUnpin(){var e;return void 0!==(null===(e=this.acplModel)||void 0===e?void 0:e.unpin)}get supportsLocalAssets(){var e;return void 0!==(null===(e=this.acplModel)||void 0===e?void 0:e.getLocalAssets)}async downloadComposite(e){var t,i;return null===(i=null===(t=this.acplModel)||void 0===t?void 0:t.downloadComposite)||void 0===i?void 0:i.call(t,e)}async unpin(e){var t,i;return null===(i=null===(t=this.acplModel)||void 0===t?void 0:t.unpin)||void 0===i?void 0:i.call(t,e)}async getLocalAssets(){var e,t;if(!this.acplModel)return[];const[i,s=[]]=await Promise.all([this._core.getAssetContext().then((e=>e.getHomeFolder())),null===(t=null===(e=this.acplModel)||void 0===e?void 0:e.getLocalAssets)||void 0===t?void 0:t.call(e)]);return s.map((e=>this._expandRepositoryPath(i,e)))}}class oa{constructor(e,t,i=new na(t)){this._assetPool=e,this._core=t,this.acplModelInterface=i}supportsFilter(e){return void 0!==e}async loadPage(e){const t=await this.acplModelInterface.getLocalAssets(),i=Date.now(),s=this._assetPool.createLoaderUpdateSession(i),r=await this._core._adobeAssetFactory.getRepoMetadataUpdaters(t),n=this._core._adobeAssetFactory.assetsFromLocalMetadata(s,t,r);return s.commit(),n.map((e=>Nt.getInstance().add(e))),{items:n}}}const aa="appassets/firefly-generations",ca="application/vnd.adobe.firefly-generation-image+dcx",la="application/vnd.adobe.firefly-generation-video+dcx",da="application/vnd.adobe.firefly-generation-audio+dcx",ua="application/vnd.adobe.firefly-generation-vector+dcx",ha=[ca,la,da,ua],pa={"application/vnd.adobe.firefly-generation-image+dcx":ve.IMAGE,"application/vnd.adobe.firefly-generation-video+dcx":ve.VIDEO,"application/vnd.adobe.firefly-generation-audio+dcx":ve.AUDIO,"application/vnd.adobe.firefly-generation-vector+dcx":ve.VECTOR},_a={[ve.IMAGE]:ca,[ve.VIDEO]:la,[ve.AUDIO]:da,[ve.VECTOR]:ua},ma=e=>ha.includes(e.mediaType),fa=async(e,t,i)=>{const s=t;if(await s._ensureLink(yt.COMPONENT),e.length<Ur(s.links,pc)&&!i)return{url:It(s.links,yt.COMPONENT,{component_id:e.id,revision:e.revision}),isBlockDownload:!1,componentId:e.id};await s._ensureLink(yt.DOWNLOAD);const r=It(s.links,yt.DOWNLOAD,{resource:JSON.stringify({component_id:e.id,revision:e.revision,reltype:yt.COMPONENT})}),n=await s._getAssetInterface();return{url:await n.getBlockDownloadURL(r),isBlockDownload:!0,componentId:e.id}},ga=e=>{var t,i;return null===(i=null===(t=e.appMetadata.data)||void 0===t?void 0:t.firefly)||void 0===i?void 0:i.generationGroupId},ya=async(e,t)=>{var i,s;if(!(null===(i=e.appMetadata.data)||void 0===i?void 0:i.firefly))return{};const{outputComponents:r}=(null===(s=e.appMetadata.data)||void 0===s?void 0:s.firefly)||{};if(!r)throw We.create(Be.NOT_FOUND,`Resource for history asset ${e.id} not found in app-metadata, asset is corrupt.`);const n=r.map((async i=>{const s=await fa(Object.assign(Object.assign({},i),{id:i.componentId}),e,t);return[i.componentId,Object.assign(Object.assign({},s),{rel:i.rel,name:i.name})]}));return Object.fromEntries(await Promise.all(n))},va=(e,t)=>{var i,s;if(!(null===(i=e.appMetadata.data)||void 0===i?void 0:i.firefly))return;const{outputComponents:r}=(null===(s=e.appMetadata.data)||void 0===s?void 0:s.firefly)||{};if(!r)throw We.create(Be.NOT_FOUND,`Resource for history asset ${e.id} not found in app-metadata, asset is corrupt.`);const n=r[0];return n?fa(Object.assign(Object.assign({},n),{id:n.componentId}),e,t):void 0},Oa=async e=>{var t,i;return await e._ensureLink(yt.MANIFEST),e.manifest.isLoaded||await e.manifest.load(),null===(i=null===(t=e.manifest.data)||void 0===t?void 0:t.children)||void 0===i?void 0:i.find((e=>"input"===e.path))};var ba=Object.freeze({__proto__:null,isGenerationHistoryAsset:ma,getHistoryAssetType:e=>pa[e.mediaType],makeComponentURL:fa,getGenerationModelDisplayName:e=>e._getGenerationModelDisplayName(),getGenerationGroupId:ga,getPrompt:e=>{var t,i;return null===(i=null===(t=e.appMetadata.data)||void 0===t?void 0:t.firefly)||void 0===i?void 0:i.prompt},getModule:e=>{var t,i;return null===(i=null===(t=e.appMetadata.data)||void 0===t?void 0:t.firefly)||void 0===i?void 0:i.module},isUpscaled:e=>{var t,i,s;const{detailLevel:r}=null!==(s=null===(i=null===(t=e.appMetadata.data)||void 0===t?void 0:t.firefly)||void 0===i?void 0:i.generationModel)&&void 0!==s?s:{};if(r)return"full"===r},getCancelUrl:e=>{var t,i,s,r;return null===(r=null===(s=null===(i=null===(t=e.appMetadata.data)||void 0===t?void 0:t.firefly)||void 0===i?void 0:i.status)||void 0===s?void 0:s.links)||void 0===r?void 0:r[yt.MELVILLE_FIREFLY_GENERATION_CANCEL]},getResultUrl:e=>{var t,i,s,r;return null===(r=null===(s=null===(i=null===(t=e.appMetadata.data)||void 0===t?void 0:t.firefly)||void 0===i?void 0:i.status)||void 0===s?void 0:s.links)||void 0===r?void 0:r[yt.MELVILLE_FIREFLY_GENERATION_RESULT]},getGenerationState:e=>{var t,i,s;return null===(s=null===(i=null===(t=e.appMetadata.data)||void 0===t?void 0:t.firefly)||void 0===i?void 0:i.status)||void 0===s?void 0:s.state},getSeedInfo:e=>{var t,i,s,r,n,o;if((null===(t=e.appMetadata.data)||void 0===t?void 0:t.firefly)&&!(null===(s=null===(i=e.appMetadata.data)||void 0===i?void 0:i.firefly)||void 0===s?void 0:s.outputComponents))throw We.create(Be.NOT_FOUND,`Resource for history asset ${e.id} not found in app-metadata, asset is corrupt.`);return null===(o=null===(n=null===(r=e.appMetadata.data)||void 0===r?void 0:r.firefly)||void 0===n?void 0:n.outputComponents[0])||void 0===o?void 0:o.seed},getGenerationModel:async e=>{var t,i;return null===(i=null===(t=e.appMetadata.data)||void 0===t?void 0:t.firefly)||void 0===i?void 0:i.generationModel},getCustomModelId:e=>{var t,i,s;return null===(s=null===(i=null===(t=e.appMetadata.data)||void 0===t?void 0:t.firefly)||void 0===i?void 0:i.generationModel)||void 0===s?void 0:s.customModelId},getOutputComponentURLs:ya,getOutputComponentDownloadURLs:async(e,t)=>{const i=e,s=await ya(i,t);if(s)return i._getGenerationHistoryInterface().getOutputComponentDownloadURLs(s)},getOutputComponentURL:va,getOutputComponentDownloadURL:async(e,t)=>{const i=e,s=await va(i,t);if(s)return i._getGenerationHistoryInterface().getOutputComponentDownloadURL(s)},getGenerationInput:async e=>(await Oa(e)).request,getInputComponentURLs:async e=>{const t=await Oa(e),i={};if(t.components)for(const s of t.components)i[s.name]=await fa(Object.assign(Object.assign({},s),{revision:s.version}),e);return i}});function Ia(e){const t=e.split(":");return[t.pop(),t.join(":")]}function Ea(e){return!0===e?"team_view":!1===e?"team_edit":""}function Ta(e){const[t,i]=e.split("?"),s=new URLSearchParams(i),r={};["start","limit","selector","type","orderBy","group","owner"].forEach((e=>{const t=s.get(e);t&&(r[e]=t,s.delete(e))}));const n=`${s}`;return[n.length>0?`${t}?${n}`:t,r]}class Sa extends pr{_getUrl(e){return`https://${this._core._environment.endpoints.MELVILLE_HOST}${e}`}_getEdgeUrl(e){return`https://${this._core._environment.endpoints.MELVILLE_EDGE_HOST}${e}`}async getLibraryData(e,t){const i=(null==t?void 0:t.selectors)?t.selectors:[],s=(null==t?void 0:t.isDiscarded)||!1,r=Array.from(new Set(["rendition_grid","collaboration",...i])).sort().join(","),n=s?this._getUrl(`/api/v1/archive/${e}`):this._getEdgeUrl(`/api/v1/libraries/${e}`);return await this._getResponse(`${n}?selector=${r}`,{headers:{"Cache-Control":"no-cache, no-store, max-age=0"}})}async getLibraries(e){if((null==e?void 0:e.limit)&&void 0===(null==e?void 0:e.start))throw We.create(Be.BAD_REQUEST,"[Melville] If limit is provided, start must also be provided.");var t;t=e,e=Object.fromEntries(Object.entries(t).map((([e,t])=>Array.isArray(t)?[e,t.sort()]:[e,t])).sort());const i=Tt(this._getEdgeUrl("/api/v1/libraries"),e),[s,r]=Ta(i),n=Object.assign(Object.assign({},{"Cache-Control":"no-cache, no-store, max-age=0",directive:"public-libraries-list-v2"}),r);return await this._getResponse(s,{headers:n})}async getLibrariesForProject(e){return(await this.getLibraries({team:e,selector:"rendition_grid,collaboration,details"})).libraries}async getLibrariesWithLink(e){const[t,i]=Ta(this._getEdgeUrl(e.href));return await this._getResponse(t,{headers:i})}async restoreLibraryElement(e){const[t,i]=Ia(e),s={self:{id:i.toString(),elements:[t]}};await this._doPost(this._getEdgeUrl(`/api/v1/libraries/${i}/archive`),{"Content-Type":"application/json"},JSON.stringify(s),[200])}async permanentlyDeleteLibraryElement(e){const[t,i]=Ia(e);await this._doDelete(this._getEdgeUrl(`/api/v1/libraries/${i}/archive/${t}`),{"Content-Type":"application/json"},[204])}async discardLibrary(e){await this._doDelete(this._getEdgeUrl(`/api/v1/libraries/${e}`),{"Content-Type":"application/json"},[204])}async permanentlyDeleteLibrary(e){await this._doDelete(this._getEdgeUrl(`/api/v1/libraries/${e}?permanent=true`),{"Content-Type":"application/json"},[204])}async restoreLibrary(e){const t={self:`/api/v1/archive/${e}`};await this._doPost(this._getEdgeUrl("/api/v1/libraries"),{"Content-Type":"application/json"},JSON.stringify(t),[201])}async copyLibrary(e,t,i,s){const r=Ea(s),n=Object.assign(Object.assign(Object.assign({source:e},t&&{name:t}),r&&{access:r}),i&&{parent_assetId:i}),o=await this._doPost(this._getEdgeUrl("/api/v1/libraries"),{"Content-Type":"application/json"},JSON.stringify(n),[200,201]);return await o.json()}async moveLibrary(e,t,i){const s=Ea(i),r={self:e,parent_assetId:t,"repo:manifestPatch":[{op:"replace",path:"/id",value:e}]};""!==s&&(r.access=s);const n={"Content-type":"application/json"},o=this._core._environment.getValue("FEATURE_FLAGS");(null==o?void 0:o["enable-x-bucket-move"])||(n["disable-x-bucket-move"]="true");const a=await this._doPost(this._getEdgeUrl("/api/v1/libraries"),n,JSON.stringify(r),[200,201]);return await a.json()}async createLibrary(e){let t,i="/api/v1/libraries";if("string"==typeof e)t={name:e};else{if("object"!=typeof e)throw new Error("Invalid arguments");t=e,i=t.syncCreate?"/api/v1/libraries?invocation_mode=sync":"/api/v1/libraries"}const s=qe(t,["syncCreate"]),r=await this._doPost(this._getEdgeUrl(i),{"Content-Type":"application/json"},JSON.stringify(s),[201,200]);return await r.json()}async bookmarkLibraries(e){const t={bookmarks:e=e.map((e=>{if(!e.id||!e.urn&&!e.url||"collab"===e.type&&!e.urn||"public"===e.type&&!e.url)throw We.create(Be.BAD_REQUEST,"[Melville] BookmarkData must include `id` and either `urn` for collaborated libraries or `url` for public libraries.");return e.type=e.type||(e.url?"public":"collab"),e}))},i=await this._doPost(this._getEdgeUrl("/api/v1/libraries/bookmarks"),{"Content-Type":"application/json"},JSON.stringify(t),[200,201]);return await i.json()}async getBookmarks(){const e=await this._getResponse(this._getEdgeUrl("/api/v1/libraries/bookmarks?useCache=false&ussCache=false"),{headers:{"Content-Type":ft,"Cache-Control":"no-cache, no-store, max-age=0"}});return await e.bookmarks}async unbookmarkLibrary(e){await this._doDelete(this._getEdgeUrl(`/api/v1/libraries/bookmarks/${e}`),{"Content-Type":"application/json"},[204])}async updateMetadata(e,t){await this._doPut(this._getEdgeUrl(`/api/v1/libraries/${e}/metadata`),{"Content-Type":"application/json"},JSON.stringify(t),[204,200])}async searchLibraries(e){const t={query_string:e,asset_type:["library"],selector:"rendition_grid,collaboration,details"},i=await this._doPost(this._getEdgeUrl("/api/v1/libraries/search"),{"Content-Type":"application/json"},JSON.stringify(t),[200]);return await i.json()}async searchLibrariesWithLink(e,t){const[i,s]=Ta(t.href),r={query_string:e,asset_type:["library"],selector:"rendition_grid,collaboration,details",start:s.start,limit:s.limit},n=await this._doPost(this._getEdgeUrl(i),{"Content-Type":"application/json"},JSON.stringify(r),[200]);return await n.json()}async getRenditionTileImage(e){const t=new URL(e.renditionUrl);await this._doGet(t.toString(),{resource:e})}}class Aa extends pr{_getUrl(e){return`https://${this._core._environment.endpoints.MELVILLE_HOST}${e}`}async getGenerationHistoryAssets(e,t){if((null==e?void 0:e.limit)&&void 0===(null==e?void 0:e.start))throw We.create(Be.BAD_REQUEST,"[Melville] If limit is provided, start must also be provided.");e=Pa(e);const i=Tt(this._getUrl("/api/v1/firefly-generations"),e),[s,r]=Ta(i),n=Object.assign(Object.assign({},{"Cache-Control":"no-cache, no-store, max-age=0"}),r);return await this._getResponse(s,{headers:n,resource:t})}async getGenerationHistoryAssetsUsingPageLink(e,t){const[i,s]=Ta(this._getUrl(e.href));return this._getResponse(i,{headers:s,resource:t})}async getGenerationHistoryAssetById(e){return await this._getResponse(this._getUrl(`/api/v1/firefly-generations/${e}`),{headers:{"Content-Type":"application/json"}})}async getOutputComponentDownloadURLs(e){const t=Object.values(e).map((e=>this.getOutputComponentDownloadURL(e)));return Promise.all(t)}async getOutputComponentDownloadURL(e){const{isBlockDownload:t,url:i}=e;if(t)return i;const s=await this._doGet(i),r=URL.createObjectURL(await s.blob());if(!(null==r?void 0:r.length))throw We.create(Be.INTERNAL_ERROR,"Cannot convert blob to URL");return r}}const Pa=e=>Object.fromEntries(Object.entries(e).map((([e,t])=>Array.isArray(t)?[e,t.sort()]:[e,t])).sort());class wa extends ln{constructor(e,t){super(e,t,{onChange:async e=>{var t;await(null===(t=this._parent)||void 0===t?void 0:t._handleResourceUpdates({perUserMetadata:e}))},onError:async e=>{var t;await(null===(t=this._parent)||void 0===t?void 0:t._handleResourceUpdates({error:e}))}}),this._core=e}async _loadData(){var e,t;await(null===(e=this._parent)||void 0===e?void 0:e._ensureLink(yt.PERUSER_METADATA));const i=await(null===(t=this._parent)||void 0===t?void 0:t._getAssetInterface());await(null==i?void 0:i.getPerUserMetadata(this))}}var Ca;function Ra(){return{[Ca.SAM_VERSION]:Ls.version}}!function(e){e.PREFER_RAPI="X-Prefer-RAPI",e.SAM_VERSION="X-Shared-Asset-Model-Version"}(Ca||(Ca={}));const La=".*/classrooms/[^/]+/assignments/[^/]+$",Na=new RegExp(La),Da=La.replace("$","/materials/[^/]+$"),Ma=new RegExp(Da);function xa({repoPath:e}){return Ma.test(e)}const ka=La.replace("$","/students/[^/]+$"),Ha=new RegExp(ka),ja=ka.replace("$","/[^/]+$"),Ua=new RegExp(ja);function Ba({repoPath:e}){return Ua.test(e)}function Fa(e,t,i=!0){let s=!0;if(Array.isArray(e)){for(let r=0;r<e.length&&(s=Fa(e[r],t,i),s);r++);return s}if(!Va(e,"string",!0)&&(s=!1,i))throw Error(`${t} is not a valid string`);if(""===e&&(s=!1,i))throw Error(`${t} is an empty string`);return s}function Va(e,t,i,s){if(!i&&null==e)return!0;switch(t){case"string":return"string"==typeof e;case"date":return"object"==typeof e&&void 0!==e.toDateString;case"string[]":return Array.isArray(e)&&e.every((e=>Va(e,"string",!1)));case"enum":return Object.values(s).some((t=>t===e));case"blob":return e instanceof Blob;case"object":return"object"==typeof e&&!Array.isArray(e)&&null!==e}return!1}function Ka(e,t){return e.reduce(((e,{key:i,type:s,ref:r,isRequired:n})=>{if(!Va(t[i],s,n,r)){const t="enum"===s||"object"===s?"an":"a";let r=`${i.toString()} is not ${t} ${s}`;n&&(r+=" or is missing"),e.push(r)}return e}),[])}function Ga(e,t){return`${e}-${t}`}const $a="application/vnd.adobe.board+dcx";function Wa(e){return(null==e?void 0:e["dc:format"])===$a}const za="application/vnd.adobe.library+dcx";function qa(e){return(null==e?void 0:e["dc:format"])===za}function Ya(e){return!!(null==e?void 0:e["dc:format"])&&ha.includes(null==e?void 0:e["dc:format"])}function Qa({repoMetadata:e,appMetadata:t}){return function(e){var t,i;return!!(null===(i=null===(t=null==e?void 0:e["cc:inheritable"])||void 0===t?void 0:t["cc:assignment"])||void 0===i?void 0:i["repo:assetId"])}(t)||function({repoPath:e}){return Na.test(e)}({repoPath:e["repo:path"]})}function Ja(e){var t,i;return!!(null===(i=null===(t=null==e?void 0:e["cc:inheritable"])||void 0===t?void 0:t["cc:team"])||void 0===i?void 0:i["repo:assetId"])}function Xa(e){var t,i,s;return!!(null===(s=null===(i=null===(t=e.am)||void 0===t?void 0:t["cc:inheritable"])||void 0===i?void 0:i["cc:team"])||void 0===s?void 0:s["repo:assetId"])}function Za(e){var t;return(null===(t=e.rm)||void 0===t?void 0:t["dc:format"])===za}function ec({repoMetadata:e,appMetadata:t}){return function(e){var t,i;return!!(null===(i=null===(t=null==e?void 0:e["cc:inheritable"])||void 0===t?void 0:t["cc:studentAssignment"])||void 0===i?void 0:i["repo:assetId"])}(t)||function({repoPath:e}){return Ha.test(e)}({repoPath:e["repo:path"]})}function tc(e){return e.type===za}function ic(e){return e.type===is}function sc(e){var t,i;return!!(null===(i=null===(t=null==e?void 0:e["cc:inherited"])||void 0===t?void 0:t["cc:studentAssignment"])||void 0===i?void 0:i["repo:assetId"])}function rc({repoMetadata:e,appMetadata:t}){return sc(t)||Ba({repoPath:e["repo:path"]})}function nc(e){return{"repo:assetId":e.id}}function oc(e){var t;return{"repo:assetId":e.asset_id,"repo:repositoryId":e["repo:repositoryId"],_embedded:{[yt.AC_EFFECTIVE]:null===(t=e._embedded)||void 0===t?void 0:t[yt.AC_EFFECTIVE],[yt.APP_METADATA]:e.app_metadata}}}function ac(e){return{library_urn:e.asset_id}}function cc(e){var t,i,s;const r=e.path||[],n=(null===(s=null===(i=null===(t=e.app_metadata)||void 0===t?void 0:t["cc:inherited"])||void 0===i?void 0:i["cc:studentAssignment"])||void 0===s?void 0:s["repo:assetId"])||r[r.length-1];return Object.assign(Object.assign({},e),{"repo:assetId":e.asset_id,computedStudentAssignmentId:n})}function lc(e){var t,i,s,r,n;const o=null!==(i=null===(t=e.rm)||void 0===t?void 0:t["repo:ancestors"])&&void 0!==i?i:[],a=(null===(n=null===(r=null===(s=e.am)||void 0===s?void 0:s["cc:inherited"])||void 0===r?void 0:r["cc:studentAssignment"])||void 0===n?void 0:n["repo:assetId"])||o[o.length-1];return Object.assign(Object.assign(Object.assign({},e.rm),e.am),{computedStudentAssignmentId:a})}function dc(e){return Object.assign(Object.assign({},e),{"repo:assetId":e.asset_id,application_metadata:e.app_metadata,"firefly#ffmodel":e["firefly#ffmodel"],"repo:path":e.original_path,"repo:createDate":Math.floor(new Date(e.create_date).getTime()/1e3),"repo:modifyDate":Math.floor(new Date(e.modify_date).getTime()/1e3),"repo:version":e.asset_version_id,"storage:region":e.region,"repo:size":e.size})}function uc(e){return{library_urn:e.id}}class hc{constructor(e){this._core=e}assetsFromUSSV3Response(e,t,i,s){if(0===s.size||0===t.length)return[];const r=s.get("library");r&&r.updateRemoteItems(e,t.filter(Za).map(uc));const n=s.get("student-assignment-file");n&&n.updateRemoteItems(e,t.filter((e=>rc({repoMetadata:e.rm,appMetadata:e.am}))).map(lc));const o=s.get("project");return o&&o.updateRemoteItems(e,t.filter(Xa).map(nc)),s.get("asset").updateRemoteItems(e,t.map((e=>i(e))))}async getUSSV3Updaters(e){const t=new Map;for(const i of e){if(Xa(i)){const e=await this._core.getProjectContext();t.set("project",e._projectUpdater)}if(Za(i)){const e=await this._core.getLibraryContext();t.set("library",e._libraryUpdater)}}const i=await this._core.getAssetContext();return t.set("asset",i._adobeAssetUpdater),t}async getUSSUpdaters(e){const t=new Map;for(const i of e){if(Ja(i.app_metadata)){const e=await this._core.getProjectContext();t.set("project",e._projectUpdater)}if(tc(i)){const e=await this._core.getLibraryContext();t.set("library",e._libraryUpdater)}if(ic(i)){const e=await this._core.getCustomModelContext();t.set("custom-model",e._customModelUpdaterMelville)}const e=await this._core.getAssetContext();t.set("asset",e._ussAdobeAssetUpdater)}return t}async getRepoMetadataUpdaters(e){var t;const i=new Map;for(const s of e){const e=null===(t=s._embedded)||void 0===t?void 0:t[yt.APP_METADATA],r=await this._core.getAssetContext();if(i.set("asset",r._adobeAssetUpdater),Ja(e)){const e=await this._core.getProjectContext();i.set("project",e._projectUpdater)}else if(qa(s)){const e=await this._core.getLibraryContext();i.set("library",e._libraryUpdater)}else if(Wa(s)){const e=await this._core.getBoardContext();i.set("board",e._boardUpdater)}else if(e&&rc({repoMetadata:s,appMetadata:e})){const e=await this._core.getClassroomContext();i.set("student-assignment-file",e._studentAssignmentFileUpdater)}else if(ec({repoMetadata:s,appMetadata:e})){const e=await this._core.getClassroomContext();i.set("student-assignment",e._studentAssignmentUpdater)}else if(e&&Qa({repoMetadata:s,appMetadata:e})){const e=await this._core.getClassroomContext();i.set("assignment",e._assignmentUpdater)}else if(Ya(s)){const e=await this._core.getGenerationHistoryContext();i.set("generation-history",e._generationHistoryAssetUpdater)}}return i}assetsFromUSSMetadata(e,t,i,s){if(0===s.size||0===t.length)return[];const r=s.get("project");if(r){const i=r.updateRemoteItems(e,t.filter((e=>Ja(e.app_metadata))).map(oc));for(const t of i)t._applyRestorePermission(e)}const n=s.get("student-assignment-file");n&&n.updateRemoteItems(e,t.filter((e=>sc(e.app_metadata)||function(e){return Ua.test(`${e.asset_name_path}/${e.asset_name}`)}(e))).map(cc));const o=s.get("library");o&&o.updateRemoteItems(e,t.filter(tc).map(ac));const a=s.get("custom-model");return a&&a.updateRemoteItems(e,t.filter(ic).map(dc)),s.get("asset").updateRemoteItems(e,t.map((e=>(null==i?void 0:i(e))||e)))}assetsFromRepoMetadata(e,t,i){return 0===i.size||0===t.length?[]:t.map((t=>{var s,r,n;let o={};return(null===(s=t._embedded)||void 0===s?void 0:s[yt.AC_EFFECTIVE])&&(o=Wi(null===(r=t._embedded)||void 0===r?void 0:r[yt.AC_EFFECTIVE])),this.assetFromRepoMetadata({session:e,repoMetadata:t,updaters:i,permissions:o,appMetadata:null===(n=t._embedded)||void 0===n?void 0:n[yt.APP_METADATA]})}))}assetFromRepoMetadata({session:e,repoMetadata:t,updaters:i,permissions:s,appMetadata:r,projectMetadata:n,studentAssignmentMetadata:o,perUserMetadata:a,generationHistoryMetadata:c}){var l,d;let u;r&&Object.keys(r).length>0&&(t._embedded=Object.assign(Object.assign({},t._embedded),{[yt.APP_METADATA]:r}));const h=t||{};s&&Object.keys(s).length>0&&(h.effectivePermission=s),a&&(h.perUserMetadata=a);const p=i.get("asset");if(Ja(r)){const t=i.get("project"),s=n;u=t.updateRemoteItem(e,s),p.updateLocalItem(e,u,h),t.updateLocalItem(e,u,s)}else if(qa(h)){const t=i.get("library"),s={library_urn:h["repo:assetId"]};u=t.updateRemoteItem(e,s),p.updateLocalItem(e,u,h),p.updateRemoteItem(e,h)}else if(Wa(h)){const t=i.get("board"),s=(_=h,Object.assign(Object.assign({},_),{_links:void 0}));u=t.updateRemoteItem(e,s),p.updateLocalItem(e,u,h)}else if(r&&rc({repoMetadata:t,appMetadata:r})){const s=i.get("student-assignment-file"),n=function(e,t){return Object.assign(Object.assign({},e),t)}(h,r||{}),o=t["repo:ancestors"],a=(null===(d=null===(l=r["cc:inherited"])||void 0===l?void 0:l["cc:studentAssignment"])||void 0===d?void 0:d["repo:assetId"])||o[o.length-1];n.computedStudentAssignmentId=a,u=s.updateRemoteItem(e,n),p.updateLocalItem(e,u,h)}else if(ec({repoMetadata:t,appMetadata:r})&&o){const t=i.get("student-assignment"),s=function(e,t){return Object.assign(Object.assign(Object.assign({},e),t),{_links:void 0})}(h,Object.assign(Object.assign({},r||{}),o));u=t.updateRemoteItem(e,s),p.updateLocalItem(e,u,h)}else if(Qa({repoMetadata:t,appMetadata:r})){const t=i.get("assignment"),s=function(e,t){return Object.assign(Object.assign(Object.assign({},e),t),{_links:void 0,children:[]})}(h,r||{});u=t.updateRemoteItem(e,s),p.updateLocalItem(e,u,h)}else if(Ya(h)&&c){const t=i.get("generation-history");u=p.updateRemoteItem(e,h),t.updateLocalItem(e,u,c)}else{const t=h["repo:assetId"],i=h["repo:path"];u=(t?e.getItemById(t):void 0)||(i?this._findLocalAssetByRepoPath(e,t,i):void 0),u?p.updateLocalItem(e,u,h):u=p.updateRemoteItem(e,h),u.ancestorIDs||u._setNeedsRepoMetadata(!0)}var _;return u}_findLocalAssetByRepoPath(e,t,i){const s=e.findItem((e=>Boolean(e.localID)&&e.repoPath===i));return t&&s&&s.id!==t&&e.reindexItem(s,s.id,t),s}assetsFromLocalMetadata(e,t,i){return this.assetsFromRepoMetadata(e,t,i)}assetFromLocalMetadata(e,t,i){return this.assetFromRepoMetadata({session:e,repoMetadata:t,updaters:i})}}const pc=10485760,_c=1;var mc,fc,gc;!function(e){e[e.InSync=0]="InSync",e[e.OutOfSync=1]="OutOfSync",e[e.SyncConflict=2]="SyncConflict",e[e.SyncError=3]="SyncError",e[e.Syncing=4]="Syncing"}(mc||(mc={})),function(e){e[e.None=0]="None",e[e.CloudContentCorrupted=1]="CloudContentCorrupted",e[e.LocalContentCorrupted=2]="LocalContentCorrupted",e[e.HasTooManyComponents=3]="HasTooManyComponents",e[e.HasTooManyChildren=4]="HasTooManyChildren",e[e.MaximumSizeExceeded=5]="MaximumSizeExceeded",e[e.Unknown=6]="Unknown"}(fc||(fc={})),function(e){e[e.NoErr=0]="NoErr",e[e.Conflict=1]="Conflict",e[e.DeleteConflict=2]="DeleteConflict",e[e.ParentDeletedConflict=3]="ParentDeletedConflict"}(gc||(gc={}));const yc=/^\/[^/]+$|^\/$/;class vc extends cn{get isVirtual(){return!1}get localID(){return this._localID}get isAvailableOffline(){return Boolean(this._localID)}get downloadStatus(){return this._downloadStatus}get uploadStatus(){return this._uploadStatus}get syncStatus(){return this._syncStatus}get syncSuspensionReason(){return this._syncSuspensionReason}get xmpNumberOfPages(){return this._xmpNumberOfPages}get downloadComposite(){if(this.isComposite&&this._acplModelInterface.supportsDownloadComposite)return()=>this._acplModelInterface.downloadComposite(this.cloudID)}get unpin(){if(this.isAvailableOffline&&this._acplModelInterface.supportsUnpin)return()=>this._acplModelInterface.unpin(this.cloudID)}constructor(e,t,i){super(e,t),this._core=e,this._name="",this._etag="",this._repositoryID="",this._path="",this._storageRegion="",this._type="",this._size=0,this._version="",this._assetClass="file",this._assetState="ACTIVE",this._created=new Date,this._modified=new Date,this._createdBy="",this._modifiedBy="",this._permissions=$i,this._isPublished=!1,this._storageAssignee={id:"",type:"user"},this._effectivePermissionsResource=new ra(this._core,this),this._repoMetadataResource=new sa(this._core,this),this._isArchivedLibraryElement=!1,this._representations={file:void 0,composite:void 0,directory:void 0},this._isExplicitlyLoading=!1,this._needsRepoMetadata=!1,this.isProject=!1,this.isLibrary=!1,this.isCustomModel=!1,this._versionPool=new Xo(this._core,"version"),this._linksCameFromResolveAPI=!1,this.isUserPinned=!1,this.isNameDCTitle=!1,this._acplModelInterface=new na(this._core),this._embeddedMetadata=new dn(e,this),this._appMetadata=new un(e,this),this._perUserMetadataResource=new wa(e,this),this._manifest=new hn(e,this),this._effectivePermissionsResource=new ra(this._core,this),this._repoMetadataResource=new sa(this._core,this),this._fileContent=new Zo(e,this),this.__links=null==i?void 0:i.links,this._etag=(null==i?void 0:i.etag)||"",this._renditionBlobHelper=new Bo,this._renditionFetcher=new Or(this._core,vr,(async(e,t)=>{const i=new Vo(this._core,this,e,t);return this._renditionBlobHelper.fetch(i)})),this._renditionFetcher.on("change",(()=>{this.dispatch({type:"change"})})),this.fr=new FinalizationRegistry((()=>{this._finalizer()})),this.fr.register(this,"adobe-asset"),on.manageLazyLoading(this,[{event:Wn,fetchData:this._populateStorageAssignee}])}get createdFromUpload(){var e;if(null===(e=this.appMetadata.data)||void 0===e?void 0:e["cc:createdFromUpload"])return!!this.appMetadata.data["cc:createdFromUpload"]}get createdByClientId(){return this._createdByClientId}_getAssetContext(){const e=this._core._getAssetContext();if(!e)throw We.create(Be.UNSUPPORTED,"AdobeAsset was used outside of AssetContext and initializeSharedAssetModel() was not called first.");return e}_finalizer(){this._renditionFetcher.release()}_loadWithRetry(){return this._load()}async _getAssetInterface(){const e=this._getAssetContext();return new Zr(e._rapi,this.id,this.links,this.etag,this.preferredVersion)}_getGenerationHistoryInterface(){return new Aa(this._core)}_getGenerationModelDisplayName(){return this._generationModelDisplayName}get _resources(){return new Map([["embeddedMetadata",this._embeddedMetadata],["appMetadata",this._appMetadata],["manifest",this._manifest],["fileContent",this._fileContent]])}_setResources(e){e.appMetadataResource&&(this._appMetadata=e.appMetadataResource,this._appMetadata.setParent(this)),e.repoMetadataResource&&(this._repoMetadataResource=e.repoMetadataResource,this._repoMetadataResource.setParent(this)),e.effectivePermissionsResource&&(this._effectivePermissionsResource=e.effectivePermissionsResource,this._effectivePermissionsResource.setParent(this)),e.perUserMetadataResource&&(this._perUserMetadataResource=e.perUserMetadataResource,this._perUserMetadataResource.setParent(this))}async _reloadPermissions(){await this._effectivePermissionsResource.load()}async _handleResourceUpdates({repoMetadata:e,effectivePermission:t,perUserMetadata:i,appMetadata:s,error:r}){if(this._isExplicitlyLoading)return;const n=Object.assign({},e);if(r){if(![Be.NOT_FOUND,Be.ACCESS_DENIED].includes(r.code))throw r;n.effectivePermission=r.code===Be.ACCESS_DENIED?Gi.Ack:Gi.None}else e&&(this._linksCameFromResolveAPI=!0),t&&(n.effectivePermission=t),s&&this._appMetadata._setData(s);const o=await this._getAssetContext(),a=[Gi.Ack,Gi.None].includes(n.effectivePermission);if(a&&o._assetPool.isItemDiscarded(this))return this._isShared=!1,this._isSharedWithYouAsset=!1,this._shareFlagsAreDirty=!1,void on.setLoadStatus(this,xi,nn.Loaded);const c="directory"===n["repo:assetClass"]||this.isFolder,l=o._assetPool.createMutationSession();c&&n["repo:path"]&&n["repo:path"]!==this.repoPath&&Dr({assetContext:o,assetPool:o._assetPool,asset:this,session:l,operation:{type:"rename",newPath:n["repo:path"]}}),i&&(n.perUserMetadata=i),a?(n.isShared=!1,n.sharedViaInvite=!1,n.shareFlagsAreDirty=!1,on.setLoadStatus(this,xi,nn.Loaded),l.queueDiscardedItem(this)):t&&(n.shareFlagsAreDirty=!0,on.setLoadStatus(this,xi,nn.NotLoaded)),n["storage:assignee"]&&this._storageAssignee_NoLazyLoad.id===n["storage:assignee"].id&&on.updatedByItemUpdater(this,$n),o._adobeAssetUpdater.updateLocalItem(l,this,n),l.commit()}async _load({repoMetadata:e,appMetadata:t,effectivePermission:i,perUserMetadata:s}={}){var r;let n;try{this._isExplicitlyLoading=!0,e||i||await this._ensureLink(yt.REPO_METADATA),await Promise.allSettled([e?this._repoMetadataResource._setData(e):this._repoMetadataResource.load(),i?this._effectivePermissionsResource._setData(i):this._effectivePermissionsResource.load()])}catch(e){n=e}finally{this._isExplicitlyLoading=!1}n=null!==(r=null!=n?n:this._repoMetadataResource.error)&&void 0!==r?r:this._effectivePermissionsResource.error,n?await this._handleResourceUpdates({error:n}):([Gi.Ack,Gi.None].includes(this._permissions)||(s||await this._ensureLink(yt.PERUSER_METADATA),Hr(this.repoPath)||await Promise.all([this._refreshLoadedResources(t),s?this._perUserMetadataResource._setData(s):this._perUserMetadataResource.load()])),await this._handleResourceUpdates({repoMetadata:this._repoMetadataResource.data,effectivePermission:this._effectivePermissionsResource.data,perUserMetadata:this._perUserMetadataResource.data}),this._needsRepoMetadata=!1)}async _loadRepoMetadata(){await this._repoMetadataResource.load()}_setNeedsRepoMetadata(e){this._needsRepoMetadata=e}async _refreshLoadedResources(e){const t=[...this._resources.values()].filter((e=>e.isLoaded));if(void 0!==this.shellVisibility||yc.test(this.repoPath)||t.includes(this._appMetadata)||(this._permissions&Gi.ReadAppMetadata)!==Gi.ReadAppMetadata||t.push(this._appMetadata),e){await this._appMetadata._setData(e);const i=t.indexOf(this._appMetadata);-1!==i&&t.splice(i,1)}t.length&&(await this._ensureLink(yt.APP_METADATA),await Promise.all(t.map((e=>e.load()))))}get versions(){const e=new $o(this._versionPool,this._ensureLink(yt.PAGE).then((()=>this._getAssetInterface())));return new Uo(this._versionPool,[e],new ea)}async getVersions(){return this.versions}async getVersion(e){const t=this._versionPool.getLocalItemById(e);if(t)return t;await this._ensureLink(yt.PAGE);const i=await this._getAssetInterface(),s=(await i.getVersion(e)).children[0];if(!s)return;const r=this._versionPool.createUpdateSession(),n=await Go.updateRemoteItem(r,Object.assign(Object.assign({},s),{assetId:this.id,assetEtag:this.etag,assetLinks:this.links}));return r.commit(),n}async setVersionAsMilestone(e={}){const{label:t="",description:i="",versionId:s=this.version}=e,r=await this._getAssetInterface(),n=xr(s,!1,t,i);await r.patchVersion(n);const o=this._versionPool.getLocalItemById(s);if(o){const e=this._versionPool.createUpdateSession();Go.updateLocalItem(e,o,{milestone:{label:t,description:i}}),e.commit()}}async getCommentsResource(){return this._getAssetContext().getCommentsResource(this.id)}get assetType(){return this._assetType}get assetSubType(){return this._assetSubType}get isFolder(){return"directory"===this._assetClass}get isAssignment(){return this.appMetadata.data?"assignment"===this.appMetadata.data["project:directoryType"]:void 0}get isBoard(){return this._type===$a}get isFile(){return"file"===this._assetClass}get isStudentAssignment(){var e,t;return this.appMetadata.data?!!(null===(t=null===(e=this.appMetadata.data["cc:inheritable"])||void 0===e?void 0:e["cc:studentAssignment"])||void 0===t?void 0:t["repo:assetId"]):void 0}get isComposite(){return"composite"===this._assetClass}get isLibraryElement(){return"element"===this._assetClass}get isOwnCreation(){return this.createdBy?this.createdBy===this._core._environment.getUserId():void 0}get imageLength(){return this._imageLength}get imageWidth(){return this._imageWidth}get parentAssignmentID(){var e,t,i;const s=null===(i=null===(t=null===(e=this.appMetadata.data)||void 0===e?void 0:e["cc:inherited"])||void 0===t?void 0:t["cc:assignment"])||void 0===i?void 0:i["repo:assetId"];if(s)return s;if(this.ancestorIDs&&this.ancestorIDs.length>0){if(xa({repoPath:this.repoPath}))return this.ancestorIDs.at(-2);if(Ba({repoPath:this.repoPath}))return this.ancestorIDs.at(-3)}}get isChildOfAssignment(){return!!this.parentAssignmentID}get parentClassroomId(){var e,t,i;const s=null===(i=null===(t=null===(e=this.appMetadata.data)||void 0===e?void 0:e["cc:inherited"])||void 0===t?void 0:t["cc:classroom"])||void 0===i?void 0:i["repo:assetId"];if(s)return s;if(this.ancestorIDs&&this.ancestorIDs.length>0){if(Ba({repoPath:this.repoPath}))return this.ancestorIDs.at(-5);if(xa({repoPath:this.repoPath}))return this.ancestorIDs.at(-4)}}get parentClassroomName(){var e,t,i;return(null===(i=null===(t=null===(e=this.appMetadata.data)||void 0===e?void 0:e["cc:inherited"])||void 0===t?void 0:t["cc:classroom"])||void 0===i?void 0:i["repo:name"])||(Ba({repoPath:this.repoPath})?function(e){if(!Ba({repoPath:e}))throw We.create(Be.BAD_REQUEST,"repoPath provided is not a StudentAssignmentFile path");return e.split("/").at(-6)}(this.repoPath):xa({repoPath:this.repoPath})?function(e){if(!xa({repoPath:e}))throw We.create(Be.BAD_REQUEST,"repoPath provided is not a MaterialsFile path");return e.split("/").at(-5)}(this.repoPath):void 0)}get isChildOfClassroom(){return!!this.parentClassroomId}get parentAssignmentMaterialsId(){var e,t,i;return(null===(i=null===(t=null===(e=this.appMetadata.data)||void 0===e?void 0:e["cc:inherited"])||void 0===t?void 0:t["cc:assignmentMaterials"])||void 0===i?void 0:i["repo:assetId"])||(this.ancestorIDs&&this.ancestorIDs.length>0&&xa({repoPath:this.repoPath})?this.ancestorIDs.at(-1):void 0)}get isChildOfAssignmentMaterials(){return!!this.parentAssignmentMaterialsId}get parentStudentAssignmentId(){var e,t,i;const s=null===(i=null===(t=null===(e=this.appMetadata.data)||void 0===e?void 0:e["cc:inherited"])||void 0===t?void 0:t["cc:studentAssignment"])||void 0===i?void 0:i["repo:assetId"];return s||(this.ancestorIDs&&this.ancestorIDs.length>0&&Ba({repoPath:this.repoPath})?this.ancestorIDs.at(-1):s)}get studentAssignmentId(){return this.parentStudentAssignmentId}get isChildOfStudentAssignment(){return!!this.parentStudentAssignmentId}_isPathInsideProject(){return["/projects/[^/]+/[^/]+","/content/assets/projects/[^/]+/[^/]+","/users/[^/]+/projects/[^/]+/[^/]+"].some((e=>new RegExp(e).test(this._path)))}get parentProjectID(){var e,t,i,s;const r=null===(i=null===(t=null===(e=this.appMetadata.data)||void 0===e?void 0:e["cc:inherited"])||void 0===t?void 0:t["cc:team"])||void 0===i?void 0:i["repo:assetId"],n=this._ancestorIDs&&!this._ancestorIDs.includes(r),o=Date.now()-((null===(s=this.created)||void 0===s?void 0:s.getTime())||Date.now());return(!r||n)&&this._isPathInsideProject()&&o>3e4&&this._fixParentProjectID(),r}async _fixParentProjectID(){const e=await this._core.getProjectContext(),t=(await e._callContextAPI(this.cloudID,this.repositoryID))["repo:assetId"];t&&this.appMetadata._mergeData({"cc:inherited":{"cc:team":{"repo:assetId":t}}})}get isChildOfProject(){return!!this.parentProjectID}async isChildOfCSCProject(){if(!this.isChildOfProject)return!1;const e=this.parentProjectID,t=await this._core.getProjectContext(),i=await t.getProjectbyID(e,!1);return[ts.WF_PROJECT,ts.WF_PORTFOLIO,ts.WF_PROGRAM,ts.WF_TEMPLATE].includes(i.directorySubtype)}get isArtifact(){if(this.appMetadata.data)return!!this.appMetadata.data["review:sourceAsset"]}get needsRepoMetadata(){return this._needsRepoMetadata}get isReviewLink(){return!!this.repoPath.startsWith("/pubs/")||this.isArtifact}get reviewLinkSourceType(){var e,t;if(!this.isReviewLink)return"";return(null===(t=null===(e=this.appMetadata.data)||void 0===e?void 0:e[ki.REVIEW_SOURCE_ASSET])||void 0===t?void 0:t["dc:format"])||(["application/vnd.adobe.xd.sharedartifact+dcx","application/vnd.adobe.xd.cloudproject+dcx"].includes(this.mediaType)?"application/vnd.adobe.xd.cloudproject+dcx":this.repoPath.startsWith("/pubs/aero/v5/")?"application/vnd.adobe.real+dcx":this.repoPath.startsWith("/pubs/id_review/")?"legacy-INDD":this.repoPath.startsWith("/pubs/")?"3d/vnd.adobe.asd+dcx":"")}get name(){return Cr(this._name)}get displayName(){}get shellVisibility(){if(void 0!==this._appMetadata.data)return this._appMetadata.data["shell:visibility"]||""}get ancestorIDs(){return this._ancestorIDs}get storageAssignee(){return this._storageAssignee}get _storageAssignee_NoLazyLoad(){return this._storageAssignee}get extension(){return this.name.lastIndexOf(".")>0&&!this.isFolder?this.name.substring(this.name.lastIndexOf(".")+1):""}get mediaType(){return this._type}get cloudID(){return this.id}get repositoryID(){return this._repositoryID}get repositoryName(){return void 0===this._repositoryName&&this._populateRepositoryName(),this._repositoryName}get repoPath(){return this._path}get storageRegion(){return this._storageRegion}get created(){return this._created}get modified(){return this._modified}get lastAccessed(){return this._lastAccessed}get isFavorite(){return this._isFavorite}async setIsFavorite(e){const t=await this._core._getGQLManager();await t.setFavorite(this.id,e);const i=this._getAssetContext(),s=this._core._getAssetPool().createUpdateSession();i._adobeAssetUpdater.updateLocalItem(s,this,{isFavorite:e}),s.commit()}async updateLastAccessed(e){if(e&&!this.isFolder)throw We.create(Be.BAD_REQUEST,"Can only clear lastAccessed for folders");const t=new Date;if(e){await this._ensureLink(yt.PERUSER_METADATA);const e=await this._getAssetInterface();await e.removeLastAccessed()}else{const e=await this._core._getGQLManager();await e.updateLastAccessed(this.id,t.toISOString())}const i=this._getAssetContext(),s=this._core._getAssetPool().createUpdateSession();i._adobeAssetUpdater.updateLocalItem(s,this,{perUserMetadata:{"shell:lastAccessDate":e?null:t.toISOString()}}),s.commit()}get shared(){return this._shared}get sizeInBytes(){return this._size}get isDiscarded(){return this._isArchivedLibraryElement||void 0!==Lr(this.repoPath)||["DISCARDED","DISCARDED_PARENT"].includes(this._assetState)}_isDiscardedWithParent(){return"DISCARDED_PARENT"===this._assetState}get assetRefString(){return JSON.stringify({cloud_id:this.cloudID,path:this.repoPath,display_name:this.name,repository_id:this.repositoryID})}get isPublished(){return this._isPublished}get representations(){return this._representations}get children(){if(!this.isFolder)throw We.create(Be.BAD_REQUEST,"Children list can be fetched only for folder");const e=this.isProject||this.isChildOfProject,t=new Qn(this._core._getAssetPool(),this,this._core,e),i=new ta({asset:this,_isSharedWithYou:!0}),s=this._core._getAssetPool(),r=new oa(s,this._core);return new Uo(s,[t,r],i)}searchChildren(e){if(!this.isFolder)throw We.create(Be.BAD_REQUEST,"Children can be searched only in the folder");const{deepSearch:t,query:i}=e,s=new Hn({asset:this,deepSearch:t,query:i}),r=this._getAssetContext(),n=new uo(this._core._getAssetPool(),this._core,r._adobeAssetSearchInterface,this,s);return new Uo(this._core._getAssetPool(),[n],s)}handleOnsChangedResources(e){(null==e?void 0:e.includes("api:metadata/repository"))&&(this._repoMetadataResource.isDirty=!0,this._loadWithRetry()),(null==e?void 0:e.includes("api:metadata/application"))&&(this._appMetadata.isDirty=!0,this.appMetadata.load()),(null==e?void 0:e.includes("api:ac/policy"))&&(this._effectivePermissionsResource.isDirty=!0,this._reloadPermissions())}async discard(){if(this.isDiscarded)throw We.create(Be.INVALID_OPERATION,"Asset is already discarded");const e=await this._getAssetInterface(),t=await e.discard(),i=this._getAssetContext();if(ma(this))throw We.create(Be.UNSUPPORTED,"Generation History Assets do not currenlty support discard, use permanentlyDelete()");if(this._hasArtifacts&&i._deleteAssetOutputsFolder(this),t){const e=this._core._getAssetPool(),s=e.createUpdateSession();i._adobeAssetUpdater.updateLocalItem(s,this,t),this.isFolder&&Dr({assetPool:e,asset:this,session:s,operation:{type:"discard"},assetContext:i}),s.commit()}}get hasArtifacts(){return this._hasArtifacts}_clearRepositoryName(){this._repositoryName=void 0}async _populateRepositoryName(){if(this._repositoryName)return;const e=this._getAssetContext(),t=this._core._getAssetPool(),i=await e._repositoryNameFromID(this._repositoryID);if(i){const s=t.createUpdateSession();e._adobeAssetUpdater.updateLocalItem(s,this,{repositoryName:i}),s.commit()}}async _populateStorageAssignee(){const e=await this._core.hostAssetContext._getStorageAssigneeFromID(this._repositoryID);e&&(this._storageAssignee=e)}async createFolder(e,t,i=0){if(!this.isFolder)throw We.create(Be.INVALID_OPERATION,"Asset is not Folder");if(!Tr(e))throw We.create(Be.BAD_REQUEST,"Invalid name provided for asset create folder operation.");const s="boolean"==typeof t?t:!0===(null==t?void 0:t.renameOnConflict),r=e;await this._ensureLink(yt.CREATE);const n=await this._getAssetInterface(),o=await n.createFolder(r,s),a=this._getAssetContext();return o?((this.isProject||this.isChildOfProject)&&ia(o,this.isChildOfProject?this.parentProjectID:this.id),a._createAssetFromMetadata(o)):await a.getAssetWithRepoPath(`${this.repoPath}/${r}`,this.repositoryID)}async _setCreatedFromUploadData(){await this.patchAppMetadata([{op:"add",path:"/cc:createdFromUpload",value:!0}]),await this.updateLastAccessed()}async importFile(e,t,i,s,r,n,o,a){var c;if(!this.isFolder)throw We.create(Be.INVALID_OPERATION,"Asset is not Folder");const{file:l,name:d,mediaType:u,retryOnConflict:h,renameOnConflict:p,setCreatedFrom:_=!0,preferredBlockTransferThreshold:m=pc,useBlockStore:f=!1,milestoneProperties:g}="string"==typeof e||e instanceof Blob?{file:e,name:t,mediaType:i,retryOnConflict:s,renameOnConflict:void 0,setCreatedFrom:n,preferredBlockTransferThreshold:o,milestoneProperties:a}:e,y=null!==(c=null!=p?p:h)&&void 0!==c&&c;if("string"==typeof l)throw We.create(Be.BAD_REQUEST,"Unsupported string for file to import");if(!d||!Tr(d))throw We.create(Be.BAD_REQUEST,"Invalid name provided for file import operation.");const v=d;await this._ensureLink(yt.CREATE),await this._ensureLink(yt.BLOCK_INITIALIZE);const O=await this._getAssetInterface(),b=await O.importFile(l,v,y,u,m,f,g);let I;const E=this._getAssetContext();return b?((this.isProject||this.isChildOfProject)&&ia(b,this.isChildOfProject?this.parentProjectID:this.id),I=E._createAssetFromMetadata(b)):I=await E.getAssetWithRepoPath(`${this.repoPath}/${v}`,this.repositoryID),_&&await I._setCreatedFromUploadData(),I}async updateFile(e,t,i=pc){var s;if(this.isFolder)throw We.create(Be.INVALID_OPERATION,"Asset is a folder, not a file");let r;if("object"==typeof e&&"file"in e)r=e;else{if("string"==typeof e)throw We.create(Be.BAD_REQUEST,"Unsupported string for file to update");r={file:e,mediaType:"string"==typeof t?t:void 0,preferredBlockTransferThreshold:"number"==typeof t?t:i,useBlockStore:!1}}if("string"==typeof r.file)throw We.create(Be.BAD_REQUEST,"Unsupported string for file to update");await this._ensureLink(yt.BLOCK_INITIALIZE);const n=await this._getAssetInterface(),o=await n.updateFile(r.file,r.mediaType,null!==(s=r.preferredBlockTransferThreshold)&&void 0!==s?s:pc,r.useBlockStore),a=this._getAssetContext();return o?((this.isProject||this.isChildOfProject)&&ia(o,this.isChildOfProject?this.parentProjectID:this.id),a._createAssetFromMetadata(o)):this}async getBlockUploadInfo(e,t,i,s,r){const{mediaType:n,renameOnConflict:o,useBlockStore:a,milestoneProperties:c}="string"==typeof i?{mediaType:i,renameOnConflict:!1,useBlockStore:s,milestoneProperties:r}:i||{};if(!Tr(e))throw We.create(Be.BAD_REQUEST,"Invalid name provided for file import operation.");return await this._ensureLink(yt.BLOCK_INITIALIZE),(await this._getAssetInterface()).getBlockUploadInfo(e,t,!this.isFolder,n,a,o,c)}async finalizeBlockUpload(e,t){return(await this._getAssetInterface()).finalizeBlockUpload(e,t,!this.isFolder)}async getDownloadURL(e,t=pc){var i,s;let r,n,o,a=pc;void 0===e||("object"==typeof e?(r=e.forceBlockDownload,a=null!==(i=e.preferredBlockTransferThreshold)&&void 0!==i?i:pc,n=e.presignedUrlExpirationSeconds,o=e.fallbackToDirectDownloadThreshold):(r=e,a=null!=t?t:pc)),await this._ensureLink(yt.PRIMARY),await this._ensureLink(yt.BLOCK_INITIALIZE);const c=!(null===(s=this.__links)||void 0===s?void 0:s[yt.DOWNLOAD])&&o&&this._size<=o,l=await this._getAssetInterface();if(!r&&(c||this._size<Ur(l.links,a))){const e=await this._fileContent.get({forceRefresh:!0});if(!e)throw We.create(Be.INTERNAL_ERROR,"Cannot fetch blob");const t=URL.createObjectURL(e);if(!(null==t?void 0:t.length))throw We.create(Be.INTERNAL_ERROR,"Cannot convert blob to URL");return t}{await this._ensureLink(yt.DOWNLOAD);const e=It(this.__links,yt.DOWNLOAD);return await l.getBlockDownloadURL(e,n)}}get fileContent(){if(!this.isFile)throw We.create(Be.BAD_REQUEST,"Cannot get content of an asset that is not a file");return this._fileContent}async commitFileChanges(e,t){if(!this.isFile)throw We.create(Be.INVALID_OPERATION,"Asset is not File");try{await this._ensureLink(yt.PRIMARY);const i=await this._getAssetInterface(),s=await i.commitFileChanges(e,t);return this._fileContent.isLoaded&&await this._fileContent._setData(e,{etag:s.eTag}),{status:gc.NoErr,committedEtag:s.eTag}}catch(t){if(t instanceof We){if(t.code===Be.CONFLICT)return{status:gc.Conflict};if(t.code===Be.NOT_FOUND){const t=this.repoPath.substring(0,this.repoPath.lastIndexOf("/"));let i=!1;const s=await this._getAssetContext().getAssetWithRepoPath(t,this.repositoryID).catch((e=>{const t=e;if(Be.NOT_FOUND!==t.code)throw e;i=!0}));if(i)return{status:gc.ParentDeletedConflict};const r=await(null==s?void 0:s.importFile(e,this.name));return{status:gc.DeleteConflict,newAsset:r}}}throw t}}async restore(e,t){var i;if(!this.isDiscarded)throw We.create(Be.INVALID_OPERATION,"Cannot restore an asset that is not discarded");const s=this._getAssetContext(),r=this._core._getAssetPool();if(this.isLibraryElement){await s.restoreLibraryElement(this.cloudID);const e=r.createUpdateSession();e.queueDiscardedItem(this),e.commit()}else{let n;const o=Lr(this.repoPath,e);if(o)n=await this._move(o,!0);else{const r=await this._getAssetInterface();try{n=await r.restore(e||this.name)}catch(r){const n=r;if(n.code===Be.CONFLICT){const{newName:i,countUsed:s}=Ar(e||this.name,this._core._environment.getValue("ASSET_CONFLICT_NAME_FORMAT"),(t||0)+1);return this.restore(i,s)}if(n.code===Be.ACCESS_DENIED&&(null===(i=this.ancestorIDs)||void 0===i?void 0:i.length)){const e=this.ancestorIDs[this.ancestorIDs.length-1];if((await s.getAssetWithCloudID(e)).isDiscarded)throw We.create(Be.PARENT_DISCARDED,"Parent folder is discarded")}throw n}}if(n){const e=r.createUpdateSession();s._adobeAssetUpdater.updateLocalItem(e,this,n),this.isFolder&&n["repo:path"]&&Dr({assetPool:r,asset:this,session:e,operation:{type:"restore",newPath:o||t?n["repo:path"]:void 0},assetContext:s}),e.commit()}}}async permanentlyDelete(){const e=this._getAssetContext(),t=this._core._getAssetPool();if(this.isLibraryElement){await e.permanentlyDeleteLibraryElement(this.cloudID);const i=t.createUpdateSession();i.queueDiscardedItem(this),i.commit()}else{const t=await e.permanentlyDeleteAssets([this]);if(t.failedResults.length)throw t.failedResults[0].error}}get etag(){return this._etag}get version(){return this._version}get createdBy(){return this._createdBy}get modifiedBy(){return this._modifiedBy}get discarded(){return this._discarded}get discardedBy(){return this._discardedBy}hasPermission(...e){return e.every((e=>(this._permissions&e)===e))}get invitationServiceCapabilities(){let e="none";return this.hasPermission(Gi.Read)&&(e=this.hasPermission(Gi.Write)?this.hasPermission(Gi.Ack)?"owner":"editor":"viewer"),{canComment:this.hasPermission(Gi.WriteComment),canShare:this.hasPermission(Gi.Share),role:e}}isReadOnly(){return this.hasPermission(Gi.Read)&&!this.hasPermission(Gi.Write)}get embeddedMetadata(){return this._embeddedMetadata}get appMetadata(){return this._appMetadata}async patchAppMetadata(e){await this._appMetadata._patch(e)}get manifest(){if(!this.isComposite)throw We.create(Be.BAD_REQUEST,"Cannot get manifest of an asset that is not a composite");return this._manifest}_releaseRenditions(){this._renditionFetcher.release()}getRenditionURL(e,t=gr.PNG){return this.isFolder||this.isLibraryElement&&!this.links[yt.RENDITION]?"":this._renditionFetcher.getURL(e,t,this.etag)}get thumbnailURL(){return this.getRenditionURL(yr,gr.PNG)}get thumbnailStatus(){return this.renditionURLStatus(yr,gr.PNG)}async getCustomRendition({size:e,type:t,urlTemplateOptions:i,additionalHeaders:s}={}){return await this._ensureLink(yt.RENDITION),(await this._getAssetInterface()).getCustomRendition({size:e,type:t,urlTemplateOptions:i,additionalHeaders:s})}async getAllCustomRenditions({type:e,urlTemplateOptions:t,additionalHeaders:i}={}){return await this._ensureLink(yt.RENDITION),(await this._getAssetInterface()).getAllCustomRenditions({type:e,urlTemplateOptions:t,additionalHeaders:i})}clearRenditionError(e=yr,t=gr.PNG){this._renditionFetcher.clearRenditionError(e,t,this.etag)}renditionURLStatus(e,t){return this.isFolder||this.isLibraryElement&&!this.links[yt.RENDITION]?mr.Done:this._renditionFetcher.renditionURLStatus(e,t,this.etag)}get spaceID(){var e,t,i;return tn("AdobeAsset.spaceID","AdobeAsset.spaceID is deprecated and will be removed on or after 2024-10-01."),null===(i=null===(t=null===(e=this.appMetadata.data)||void 0===e?void 0:e["cc:inherited"])||void 0===t?void 0:t["cc:space"])||void 0===i?void 0:i["repo:assetId"]}get isSpaceAsset(){return tn("AdobeAsset.isSpaceAsset","AdobeAsset.isSpaceAsset is deprecated and will be removed on or after 2024-10-01."),!!this.spaceID}async getSpace(){tn("AdobeAsset.getSpace","AdobeAsset.getSpace is deprecated and will be removed on or after 2024-10-01.");const e=await this._core.spaceContext.getEnclosingSpace(this.cloudID);if(!e)throw We.create(Be.NOT_FOUND,"Asset does not belong to a Space");return e}get links(){return Object.assign({},this.__links)}get _canLoadNewChildrenFromONSNotification(){return!0}get pinnedVersion(){return this._pinnedVersion}get pinnedVersionModifyDate(){return this._pinnedVersionModifyDate}get preferredVersion(){return this.pinnedVersion||this.version}async _ensureLink(e){var t;if(null===(t=this.__links)||void 0===t?void 0:t[e])return;const i=this._getAssetContext(),s=this._core._getAssetPool(),r=await i._rapi.getAssetLinks(this.cloudID),n=s.createUpdateSession();i._adobeAssetUpdater.updateLocalItem(n,this,{_links:Object.assign(Object.assign({},this.__links),r)}),n.commit()}async _move(e,t=!1,i=0){try{this._repositoryID||await this._load();const t={op:"move",source:{"repo:assetId":this.id,"repo:repositoryId":this._repositoryID},target:{"repo:path":e,"repo:repositoryId":this._repositoryID}},i=await this._getAssetInterface();return(await i.runOperation(t)).asset}catch(s){if(s.code===Be.CONFLICT&&t){const t=Ar(e,this._core._environment.getValue("ASSET_CONFLICT_NAME_FORMAT"),i+1);return this._move(t.newName,!0,t.countUsed)}throw s}}async _copy(e,t,i=!0,s=0,r){let n={failedResults:[],newModels:[]};if(await Ks.runExclusiveTask("copy",[this],(async()=>{const{path:i,counter:o}=this._finalizePath(e.repoPath,t,s);s=o;const a=new Map;a.set(this.id,this),e.repositoryID||await e._load();const c=this._getCopyOp(e.repositoryID,i),l=this._getAssetContext();n=await l._runOperations([c],a,r||((e,t,i)=>{if(!i)throw We.create(Be.UNKNOWN,"Missing metadata from asset copy operation.");return l._adobeAssetUpdater.updateRemoteItem(e,i)}))})),n.failedResults.length){if(n.failedResults[0].error.code===Be.CONFLICT&&!0===i)return await this._copy(e,t,i,s+1);throw n.failedResults[0].error}return n.newModels[0]}async _copyWithDestMetadata(e,t,i,s=!0,r=0,n){let o={failedResults:[],newModels:[]};const a=await this._getAssetContext();if(await Ks.runExclusiveTask("copy",[this],(async()=>{const{path:s,counter:c}=this._finalizePath(t,i,r);r=c;const l=new Map;l.set(this.id,this);const d=this._getCopyOp(e,s);o=await a._runOperations([d],l,n||((e,t,i)=>{if(!i)throw We.create(Be.UNKNOWN,"Missing metadata from asset copy operation.");return a._adobeAssetUpdater.updateRemoteItem(e,i)}))})),o.failedResults.length){if(o.failedResults[0].error.code===Be.CONFLICT&&!0===s)return await this._copyWithDestMetadata(e,t,i,s,r+1);throw o.failedResults[0].error}return o.newModels[0]}_finalizePath(e,t,i=0){let s=this.name;if(void 0!==t){if(!Tr(t))throw We.create(Be.BAD_REQUEST,"Invalid name provided for asset copy operation.");if(s=t,i){const e=Ar(s,this._core._environment.getValue("ASSET_CONFLICT_NAME_FORMAT"),i);s=e.newName,i=e.countUsed}}else{const t=e===this.repoPath.substring(0,this.repoPath.lastIndexOf("/"))?Ar(s,this._core._environment.getValue("ASSET_COPY_NAME_FORMAT"),i):i>0?Ar(s,this._core._environment.getValue("ASSET_CONFLICT_NAME_FORMAT"),i):{newName:s,countUsed:i};s=t.newName,i=t.countUsed}return{path:`${e}/${s}`,counter:i}}_getCopyOp(e,t){const i=[{reltype:yt.PRIMARY}];return"application/pdf"===this.mediaType?i.push({reltype:yt.APP_METADATA}):ma(this)&&i.push({reltype:yt.APP_METADATA,selectionType:"exclude",selectors:["firefly.generationGroupId"]}),{op:"copy",id:this.id,source:Object.assign(Object.assign({"repo:assetId":this.id},this.isFolder?{}:{"repo:version":"v:pinned"}),this.repositoryID?{"repo:repositoryId":this.repositoryID}:{}),target:{"repo:path":t,"repo:repositoryId":e},includeResources:i}}async copy(e,t){return await this._copy(e,t)}async duplicate(e){const t=this.ancestorIDs.slice(-1)[0],i=await this._getAssetContext().getAssetWithCloudID(t);return await this._copy(i,e)}async rename(e){if(!Tr(e))throw We.create(Be.BAD_REQUEST,"Invalid name provided for asset rename operation.");const t=this._getAssetContext(),i=this._core._getAssetPool(),s=Nr(e,this),r=await this._move(s);if(r){const e=i.createUpdateSession();this.isFolder&&Dr({assetPool:i,asset:this,session:e,operation:{type:"rename",newPath:s},assetContext:t}),t._adobeAssetUpdater.updateLocalItem(e,this,r),e.commit()}if(this._versionPool.getLocalItemById(this.version)){const t=this._versionPool.createUpdateSession();Go.updateRemoteItem(t,{version:this.version,"repo:deviceAssetName":e}),t.commit()}}async move(e,t){let i;t&&(i=new Map([[this.id,t]]));const s=await this._getAssetContext().moveAssets([this],e,i);if(s.failedResults.length)throw s.failedResults[0].error}transferToSpace(e){return tn("AdobeAsset.transferToSpace","AdobeAsset.transferToSpace is deprecated and will be removed on or after 2024-10-01."),this._getAssetContext().transfer(this,e)}}function Oc(e){var t;return void 0!==e.effectivePermission?e.effectivePermission:(null===(t=e._embedded)||void 0===t?void 0:t[yt.AC_EFFECTIVE])?Wi(e._embedded[yt.AC_EFFECTIVE]):On}Ye([ht],vc.prototype,"xmpNumberOfPages",null),Ye([ht],vc.prototype,"createdFromUpload",null),Ye([ht],vc.prototype,"createdByClientId",null),Ye([Pt],vc.prototype,"_loadWithRetry",null),Ye([nt],vc.prototype,"_getGenerationHistoryInterface",null),Ye([wt],vc.prototype,"_handleResourceUpdates",null),Ye([nt],vc.prototype,"versions",null),Ye([ht],vc.prototype,"assetType",null),Ye([ht],vc.prototype,"assetSubType",null),Ye([ht],vc.prototype,"isFolder",null),Ye([ht],vc.prototype,"isAssignment",null),Ye([ht],vc.prototype,"isBoard",null),Ye([ht],vc.prototype,"isFile",null),Ye([ht],vc.prototype,"isStudentAssignment",null),Ye([ht],vc.prototype,"isComposite",null),Ye([ht],vc.prototype,"isLibraryElement",null),Ye([ht],vc.prototype,"isOwnCreation",null),Ye([ht],vc.prototype,"imageLength",null),Ye([ht],vc.prototype,"imageWidth",null),Ye([ht],vc.prototype,"parentAssignmentID",null),Ye([ht],vc.prototype,"isChildOfAssignment",null),Ye([ht],vc.prototype,"parentClassroomId",null),Ye([ht],vc.prototype,"parentClassroomName",null),Ye([ht],vc.prototype,"isChildOfClassroom",null),Ye([ht],vc.prototype,"parentAssignmentMaterialsId",null),Ye([ht],vc.prototype,"isChildOfAssignmentMaterials",null),Ye([ht],vc.prototype,"parentStudentAssignmentId",null),Ye([ht],vc.prototype,"studentAssignmentId",null),Ye([ht],vc.prototype,"isChildOfStudentAssignment",null),Ye([ht],vc.prototype,"parentProjectID",null),Ye([nt],vc.prototype,"_fixParentProjectID",null),Ye([ht],vc.prototype,"isChildOfProject",null),Ye([ht],vc.prototype,"isArtifact",null),Ye([ht],vc.prototype,"name",null),Ye([ht],vc.prototype,"shellVisibility",null),Ye([ht],vc.prototype,"ancestorIDs",null),Ye([an(Wn,"_storageAssignee")],vc.prototype,"storageAssignee",null),Ye([ht],vc.prototype,"extension",null),Ye([ht],vc.prototype,"mediaType",null),Ye([ht],vc.prototype,"cloudID",null),Ye([ht],vc.prototype,"repositoryID",null),Ye([ht],vc.prototype,"repositoryName",null),Ye([ht],vc.prototype,"repoPath",null),Ye([ht],vc.prototype,"storageRegion",null),Ye([ht],vc.prototype,"created",null),Ye([ht],vc.prototype,"modified",null),Ye([ht],vc.prototype,"lastAccessed",null),Ye([ht],vc.prototype,"isFavorite",null),Ye([ht],vc.prototype,"shared",null),Ye([ht],vc.prototype,"sizeInBytes",null),Ye([ht],vc.prototype,"isDiscarded",null),Ye([ht],vc.prototype,"assetRefString",null),Ye([ht],vc.prototype,"isPublished",null),Ye([ht],vc.prototype,"representations",null),Ye([nt],vc.prototype,"children",null),Ye([ht],vc.prototype,"hasArtifacts",null),Ye([ht],vc.prototype,"etag",null),Ye([ht],vc.prototype,"version",null),Ye([ht],vc.prototype,"createdBy",null),Ye([ht],vc.prototype,"modifiedBy",null),Ye([ht],vc.prototype,"discarded",null),Ye([ht],vc.prototype,"discardedBy",null),Ye([ht],vc.prototype,"hasPermission",null),Ye([ht],vc.prototype,"invitationServiceCapabilities",null),Ye([ht],vc.prototype,"appMetadata",null),Ye([ht],vc.prototype,"getRenditionURL",null),Ye([ht],vc.prototype,"thumbnailURL",null),Ye([ht],vc.prototype,"thumbnailStatus",null),Ye([ht],vc.prototype,"renditionURLStatus",null),Ye([ht],vc.prototype,"spaceID",null),Ye([ht],vc.prototype,"links",null),Ye([ht],vc.prototype,"pinnedVersion",null),Ye([ht],vc.prototype,"pinnedVersionModifyDate",null),Ye([ht],vc.prototype,"preferredVersion",null);const bc={parse:e=>e,isEqual:(e,t)=>(null==e?void 0:e.id)===(null==t?void 0:t.id)&&(null==e?void 0:e.type)===(null==t?void 0:t.type)},Ic={localItemType:vc,getAlternateId:e=>e["repo:path"],remoteIdProperty:"repo:assetId",changeEventMap:new Map([["_isShared",xi],["_isSharedWithYouAsset",xi]]),propertyUpdater:new Cn({_name:"repo:name",_etag:"repo:etag",_repositoryID:"repo:repositoryId",_repositoryName:"repositoryName",_path:"repo:path",_storageRegion:"storage:region",_type:"dc:format",_assetType:"repo:assetType",_assetSubType:"repo:assetSubType",_size:{name:"repo:size",format:"number"},_version:"repo:version",_assetClass:{name:"repo:assetClass",choices:pn},_assetState:{name:"repo:state",choices:_n},_created:{name:"storage:deviceCreateDate",format:"date"},_modified:{name:"storage:deviceModifyDate",format:"date"},_lastAccessed:{name:"perUserMetadata[shell:lastAccessDate]",format:"date"},_storageAssignee:{name:"storage:assignee",format:bc},_discarded:{name:"repo:discardDate",format:"date"},_createdBy:"repo:createdBy",_modifiedBy:"repo:modifiedBy",_discardedBy:"repo:discardedBy",_imageLength:{name:"tiff:imageLength",format:"number"},_imageWidth:{name:"tiff:imageWidth",format:"number"},_permissions:{get:Oc,format:"number"},_isShared:{name:"isShared",format:"boolean"},_generationModelDisplayName:{name:"generationModelDisplayName",format:"string"},_isFavorite:{name:"isFavorite",format:"boolean"},_isSharedWithYouAsset:{name:"sharedViaInvite",format:"boolean"},_shareFlagsAreDirty:{name:"shareFlagsAreDirty",format:"boolean"},_localID:"localID",_downloadStatus:{name:"downloadStatus",format:"object"},_uploadStatus:{name:"uploadStatus",format:"object"},_syncStatus:{name:"syncStatus",format:"number"},_syncSuspensionReason:{name:"syncSuspensionReason",format:"number"},"_appMetadata._data":{name:`_embedded[${yt.APP_METADATA}]`,format:"object_subset",set:(e,t)=>{t.appMetadata._mergeData(e)}},_ancestorIDs:{name:"repo:ancestors",isArray:!0,format:"string"},__links:{name:"_links",format:"object_subset"},_hasArtifacts:{name:"hasArtifacts",format:"boolean"},_createdByClientId:"repo:createdByClientId",_representations:{name:"repo:representations",format:"object"},_xmpNumberOfPages:{name:"xmpTPg:NPages",format:"number"},_pinnedVersion:"repo:pinnedVersion",_pinnedVersionModifyDate:{name:"repo:pinnedVersionModifyDate",format:"date"}})},Ec=new vn(Ic);new vn(Ic);const Tc={localItemType:vc,remoteIdProperty:"asset_id",changeEventMap:new Map([["_isShared",xi],["_isSharedWithYouAsset",xi],["_isPublicLink",xi],["_directCollaboratorCount",xi]]),propertyUpdater:new Cn({_name:"asset_name",_etag:{get:function(e){var t;return e.composite_manifest_etag||(null===(t=e.etag)||void 0===t?void 0:t.primary)||""}},_repositoryID:"repo:repositoryId",_path:{get:function(e){return e.asset_name_path&&e.asset_name?Fs.join(e.asset_name_path,e.asset_name):e.asset_name_path||e.asset_name||""},format:"string"},_type:{get:function(e){return e.type===Fr?Br:e.type},format:"string"},_size:{name:"size",format:"number"},_version:"asset_version_id",_assetClass:{get:function(e){return e.type===Fr||e.type===Br?"directory":"dcx"!==e.creative_cloud_asset_type?"file":e.asset_sub_type},choices:pn,format:"string"},_permissions:{get:Oc,format:"number"},_created:{name:"create_date",format:"date"},_modified:{name:"modify_date",format:"date"},_shared:{name:"collab_metadata#mine.shared_date",format:"date_as_number"},_discarded:{name:"discarded_date",format:"date"},_discardedBy:"discarded_by",_assetState:{name:"repo:state",choices:_n,format:"string"},_isArchivedLibraryElement:{name:"isArchivedLibraryElement",format:"boolean"},_lastAccessed:{get:function(e){var t,i;const s=null===(i=null===(t=e["api:metadata/peruser"])||void 0===t?void 0:t[0])||void 0===i?void 0:i["shell:lastAccessDate"];return void 0===s?On:""!==s?s:void 0},format:"date"},_storageAssignee:{name:"storage:assignee",format:bc},_storageRegion:{name:"region",get:function(e){var t,i;switch(null===(t=e.region)||void 0===t?void 0:t.toLowerCase()){case"us":return"VA6";case"ap":return"JPN3";case"eu":return"IRL1";default:return(null===(i=e.region)||void 0===i?void 0:i.toUpperCase())||""}},format:"string"},_createdBy:"creative_cloud_creator_id",_isSharedWithYouAsset:{name:"sharedViaInvite",format:"boolean"},_isSWYGroup:{name:"isSWYGroup",format:"boolean"},_isShared:{name:"isShared",format:"boolean"},_isPublicLink:{name:"isPublicLink",format:"boolean"},_directCollaboratorCount:{name:"directCollaboratorCount",format:"number"},_isPublished:{name:"published",format:"boolean"},_imageLength:{name:"image_height",format:"number"},_imageWidth:{name:"image_width",format:"number"},_shareFlagsAreDirty:{name:"shareFlagsAreDirty",format:"boolean"},"_appMetadata._data":{get(e){const t=e.app_metadata,i=e["api:metadata/application"];return t||i?Object.assign(Object.assign({},t||{}),i||{}):On},format:"object_subset",set:(e,t)=>{t.appMetadata._mergeData(e)}},_ancestorIDs:{name:"path",isArray:!0,format:"string"},__links:{name:"_links",format:"object_subset"},_createdByClientId:"repo:createdByClientId",_representations:{name:"repo:representations",format:"object"},_assetType:"repo:assetType",_assetSubType:"repo:assetSubType",_pinnedVersion:"repo:pinnedVersion",_pinnedVersionModifyDate:{name:"repo:pinnedVersionModifyDate",format:"date"}})},Sc=new vn(Tc),Ac=Symbol("reloadSpace"),Pc=Symbol("clearLastReloadError"),wc=50;class Cc{constructor(e,t,i){this._assetPool=e,this._core=t,this._loader=i}async loadPage(e,t){var i,s,r;const{order:n,filter:o,implicitFilter:a,resource:c}=e,{limit:l=wc}=null!==(i=e.loadOptions)&&void 0!==i?i:{},d=this._core._environment.getValue("USS_LIST_UPDATE_LATENCY"),u=Date.now()-d;t=t||0;const h=qn(a,o),p=function(e,t){var i,s;const r=null!==(i=Yn("excludeMediaTypes",e))&&void 0!==i?i:new zn([]),n=null!==(s=Yn("excludeMediaTypes",t))&&void 0!==s?s:new zn([]);return[...r.union(n)]}(a,o);let _,m;if("name"in o&&o.name===Zn){const e=o;_=e.uploadedFrom,m=e.userId}const f=(await this._loader._getUSSResults(Object.assign(Object.assign({order:n,loadOptions:Object.assign({limit:l},e.loadOptions),filter:o,implicitFilter:a,resource:c,start:t,mediaTypes:Array.from(null!=h?h:[]),excludeMediaTypes:Array.from(null!=p?p:[])},_?{uploadedFrom:_}:{}),m?{userId:m}:{}))).result_sets[0],g=await this._core._adobeAssetFactory.getUSSUpdaters(f.items),y=this._assetPool.createLoaderUpdateSession(u),v=this._extractItems(y,f.items,g);let O;const b=f.total_items||0,I=f.items.length,E=0===I?t+l:t+I;E<b&&(O=e=>this.loadPage(e,E));const T={items:v,total:b,loadNextPage:O,mostRecentValidMutation:u};null===(r=(s=this._loader)._postProcessPage)||void 0===r||r.call(s,e,T);for(const e of v)on.updatedByItemUpdater(e,$n);return y.commit(),T}_getItemData(e){return function(e){let t=!1,i=0;const s=e.collaboration_metadata;void 0!==s&&(t=s.some((e=>"all"===e.collaborator_id)),i=s.length);const r=e["collab_metadata#mine"];return Object.assign(Object.assign({},e),{sharedViaInvite:void 0!==r,isSWYGroup:void 0!==r&&!r.type,isShared:i>0,isPublicLink:t,directCollaboratorCount:i,shareFlagsAreDirty:!1})}(e)}_extractItems(e,t,i){return this._core._adobeAssetFactory.assetsFromUSSMetadata(e,t,this._loader._getItemData||this._getItemData,i)}}class Rc{constructor(e,t,i,s,r,n=!1){this._asset=i,this._ussInterface=s,this._artifactFilter=r,this._embedPermissions=n,this._getItemData=this._getItemDataWithRepoId(this._asset.repositoryID),this._ussLoaderHelper=new Cc(e,t,this)}supportsFilter(e){const t=[];if(t.push(e),!t.every((e=>e.artifactFilter===this._artifactFilter||void 0===e.artifactFilter)))throw We.create(Be.BAD_REQUEST,"SpaceSearchAssetFilter.artifactFilter does not match SpaceSearchAssetLoader.artifactFilter");return!0}loadPage(e){return this._ussLoaderHelper.loadPage(e)}async _getUSSResults({start:e,loadOptions:t,order:i,mediaTypes:s}){return this._ussInterface.searchSpace(this._asset.id,"onlyArtifacts"===this._artifactFilter,this._embedPermissions,{type:s,sort_orderby:Dn[i.field],sort_order:"descending"===i.direction?"desc":"asc",limit:null==t?void 0:t.limit,start_index:e})}_getItemDataWithRepoId(e){return t=>Object.assign(Object.assign({},t),{"repo:repositoryId":e})}}class Lc extends kn{constructor(e){super({_includeHiddenRecursive:null==e?void 0:e._includeHiddenRecursive}),this._asset=null==e?void 0:e.asset,this.artifactFilter=null==e?void 0:e.artifactFilter}matches(e){var t;return!((null===(t=this._asset)||void 0===t?void 0:t.repoPath)&&!e.repoPath.startsWith(`${this._asset.repoPath}/`))&&(!e.isArtifact||"excludeArtifacts"!==this.artifactFilter)&&!(!e.isArtifact&&"onlyArtifacts"===this.artifactFilter)&&super.matches(e)}}Lc.default=new Lc;class Nc extends cn{constructor(){super(...arguments),this._name="",this._repositoryID="",this._repositoryName="",this._pathName="",this._created=new Date,this._modified=new Date,this._contributorCount=0,this._role="NONE",this._color="",this._isBookmarked=!1,this._teamID="",this._teamName="",this._thumbnail="",this._access="private",this._etag="",this._version=0,this._state="active",this._loadedGeneration=0,this._teamRole="UNKNOWN"}get spaceID(){return this.id}get name(){return this._name}get access(){return this._access}get etag(){return this._etag}get state(){return this._state}get repositoryID(){return this._repositoryID}get repositoryName(){return this._repositoryName}get pathName(){return this._pathName}get created(){return this._created}get modified(){return this._modified}get contributorCount(){return this._contributorCount}get role(){return this._role}get color(){return this._color}get isBookmarked(){return this._isBookmarked}get teamID(){return this._teamID}get teamName(){return this._teamName}get description(){return this._description}get thumbnail(){return this._thumbnail}get version(){return this._version}get teamRole(){return this._teamRole}get _links(){return this.__links}async ensureDescription(){var e;return void 0===this._description&&await this.load({refreshTimeout:-1}),null!==(e=this.description)&&void 0!==e?e:""}async getChild(e){var t;return this._children||await this.load({refreshTimeout:-1}),null===(t=this._children)||void 0===t?void 0:t.get(e)}async searchWorkingFiles(){const{_assetPool:e,_ussInterface:t}=this._core.hostAssetContext,i=await this._core.hostAssetContext.getAssetWithRepoPath(`${this.pathName}/working_files`,this.repositoryID),s=new Rc(e,this._core,i,t,"excludeArtifacts",!0),r=new Lc({asset:i,artifactFilter:"excludeArtifacts"});return new Uo(e,[s],r)}async searchArtifacts(e=!1){const{_assetPool:t,_ussInterface:i}=this._core.hostAssetContext,s=await this._core.hostAssetContext.getAssetWithCloudID(this.id),r=new Rc(t,this._core,s,i,"onlyArtifacts",e),n=new Lc({asset:s,artifactFilter:"onlyArtifacts",_includeHiddenRecursive:!0});return new Uo(t,[r],n)}async getWorkingFiles(){return(await this._core.hostAssetContext.getAssetWithRepoPath(`${this.pathName}/working_files`,this.repositoryID)).children}async load(e){var t;const i=null==e?void 0:e.refreshTimeout;let s=this._lastReload;s&&(s.pending||-1===i||i&&s.requestTime+i>Date.now())||(s=this._lastReload={pending:!0,inProgress:!0,generation:(null!==(t=null==s?void 0:s.generation)&&void 0!==t?t:this._loadedGeneration)+1,requestTime:Date.now(),promise:new Promise(((e,t)=>{setTimeout((()=>this._executeReload(s).finally((()=>s.error?t(s.error):e()))),0)}))},this.dispatch(lt)),await s.promise}async _executeReload(e){if(e===this._lastReload){e.pending=!1;try{await this._core.spaceContext[Ac](this)}catch(t){e.error=t}if(e.inProgress=!1,!(this._lastReload!==e&&e.generation<=this._loadedGeneration)){if(e.error instanceof We&&e.error.code===Be.NOT_FOUND){const e=this._core.spaceContext.spacePool.createUpdateSession();e.queueDiscardedItem(this),e.commit()}this.dispatch(lt)}}else!function(e,t){if(!e)throw We.create(Be.UNKNOWN,"The pending flag must be false after the reload was cleared out.")}(!e.pending)}[Pc](){const e=this._lastReload;(null==e?void 0:e.error)&&(e.error=void 0,e.pending=!1,this.dispatch(lt))}get isReloading(){var e,t;return null!==(t=null===(e=this._lastReload)||void 0===e?void 0:e.inProgress)&&void 0!==t&&t}get lastReloadError(){var e;return null===(e=this._lastReload)||void 0===e?void 0:e.error}async update(e){await this._core.spaceContext.updateSpace(this,e)}async rename(e){await this._core.spaceContext.updateSpace(this,{name:e})}async archive(){const e=await this._core.spaceContext.archiveSpaces([this]);if(e.failedResults.length)throw e.failedResults[0].error}async restore(e){let t;void 0!==e&&(t=new Map,t.set(this,e));const i=await this._core.spaceContext.restoreSpaces([this],t);if(i.failedResults.length)throw i.failedResults[0].error}}Ye([ht],Nc.prototype,"name",null),Ye([ht],Nc.prototype,"access",null),Ye([ht],Nc.prototype,"etag",null),Ye([ht],Nc.prototype,"state",null),Ye([ht],Nc.prototype,"repositoryID",null),Ye([ht],Nc.prototype,"repositoryName",null),Ye([ht],Nc.prototype,"pathName",null),Ye([ht],Nc.prototype,"created",null),Ye([ht],Nc.prototype,"modified",null),Ye([ht],Nc.prototype,"contributorCount",null),Ye([ht],Nc.prototype,"role",null),Ye([ht],Nc.prototype,"color",null),Ye([ht],Nc.prototype,"isBookmarked",null),Ye([ht],Nc.prototype,"teamID",null),Ye([ht],Nc.prototype,"teamName",null),Ye([ht],Nc.prototype,"description",null),Ye([ht],Nc.prototype,"thumbnail",null),Ye([ht],Nc.prototype,"version",null),Ye([ht],Nc.prototype,"teamRole",null),Ye([ht],Nc.prototype,"_links",null),Ye([nt],Nc.prototype,"searchWorkingFiles",null),Ye([nt],Nc.prototype,"searchArtifacts",null),Ye([nt],Nc.prototype,"getWorkingFiles",null),Ye([ht],Nc.prototype,"isReloading",null),Ye([ht],Nc.prototype,"lastReloadError",null);const Dc=new vn({localItemType:Nc,remoteIdProperty:"id",propertyUpdater:new Cn({_name:"name",_access:{name:"access",choices:["private","team"]},_etag:"etag",_repositoryID:"repositoryId",_repositoryName:"repositoryName",_pathName:"pathName",_created:{name:"createdDate",format:"date"},_modified:{name:"modifiedDate",format:"date"},_contributorCount:{name:"contributorCount",format:"number"},_role:{name:"role",choices:["NONE","CONTRIBUTOR","REVIEWER"]},_color:{name:"color"},_isBookmarked:{name:"bookmarked",format:"boolean"},_teamID:"teamId",_teamName:"teamName",_description:"description",_thumbnail:"thumbnail",_children:{name:"children",mapByKey:"name",format:{parse:e=>({id:e.id,_links:e._links}),isEqual:(e,t)=>e.id===t.id&&ds(e._links,t._links)}},_version:{name:"version",format:"number"},_teamRole:{name:"teamRole",choices:["UNKNOWN","NONE","MEMBER"]},_state:{name:"state",choices:["active","archived","in_progress"]},__links:{name:"_links",format:"object"}})}),Mc={[yt.REVIEW_SERVICE_PROVISION]:["documentId","assetRegion","repositoryId"],[yt.REVIEW_SERVICE_DISCARD]:["assetId","assetRegion","repositoryId"],[yt.REVIEW_SERVICE_OUTPUTS]:["assetId","assetRegion","documentId","embed","limit","orderBy","outputType","repositoryId","start"],[yt.REVIEW_SERIVCE_HAS_OUTPUTS]:["assetRegion"]},xc=function(e){return e.map((e=>({"repo:assetId":e.id,"repo:repositoryId":e.repositoryID})))};class kc extends pr{constructor(){super(...arguments),this.baseURL=`https://${this._core._environment.endpoints.REVIEW_SERVICE_HOST}`,this.baseEndpoint="/api/v1",this.indexEndpoint=this.baseEndpoint+"/index"}getEndpointURL(e){return`${this.baseURL}${e}`}async _discoverLinks(e){return(await this._getResponse(e,this._getHeaders()))._links}_getHeaders(e){const t={};return e&&(t["Content-Type"]=e),t}async discoverLinks(){return this._discoverLinks(this.getEndpointURL(this.indexEndpoint))}async discardOutputsForAsset(e,t,i){const s=It(await this.discoverLinks(),yt.REVIEW_SERVICE_DISCARD,Object.assign(Object.assign({assetId:e},t&&{assetRegion:t}),i&&{repositoryID:i}));await this._doPost(s,this._getHeaders(),void 0,[204])}async hasOutputs(e,t){const i=It(await this.discoverLinks(),yt.REVIEW_SERIVCE_HAS_OUTPUTS,Object.assign({},t&&{assetRegion:t})),s=await this._doPost(i,this._getHeaders(ft),JSON.stringify(e),[200]);return await s.json()}_createFrameLinkUrl(e){const t=new URL(`${this.baseURL}/api/v1/frameioLink`);return Object.entries(e).forEach((([e,i])=>t.searchParams.set(e,i))),t.toString()}async createReviewLink(e){const{reviewLinkId:t,artifactId:i,projectId:s}=e,r=qe(e,["reviewLinkId","artifactId","projectId"]),n=await this._doPost(this._createFrameLinkUrl(r),{"Content-Type":"application/json"},JSON.stringify({reviewLinkId:`${t}`,artifactId:`${i}`,projectId:`${s}`}));return await n.json()}async getReviewLinks(e){const t=await this._doGet(this._createFrameLinkUrl(e));return await t.json()}async updateReviewLink(e){const{artifactId:t,projectId:i,etag:s="*"}=e,r=qe(e,["artifactId","projectId","etag"]),n=await this._doPut(this._createFrameLinkUrl(r),{"Content-Type":"application/json","If-Match":`${s}`},JSON.stringify({artifactId:`${t}`,projectId:`${i}`}));return await n.json()}async deleteReviewLink(e){const{etag:t}=e,i=qe(e,["etag"]);let s={};t&&(s={"If-Match":`${t}`}),await this._doDelete(this._createFrameLinkUrl(i),s,[204])}}Ye([rt((function(e){return vt(e,Mc)})),Qe(0,it)],kc.prototype,"_discoverLinks",null);class Hc extends pr{constructor(e,t){super(e),this._core=e,this._assetId=t}_getUrl(e){return`https://${this._core._environment.endpoints.COMMENT_HOST}${e}`}_getCommonHeaders(e){const t={"Content-Type":'application/ld+json; profile="https://www.w3.org/ns/anno.jsonld"',Accept:'application/ld+json; profile="https://www.w3.org/ns/anno.jsonld"',Prefer:'return=representation;include="https://www.w3.org/ns/oa#PreferContainedDescriptions"',"x-ccx-workflow":"true"};return e&&(t["If-Match"]=e),t}async getCommentList(e){const t=this._getUrl(`/assets/${this._assetId}/annots/?status=open%2Cresolved`),i=this._getCommonHeaders();return e&&(i["If-None-Match"]=e),this._doGet(t,{headers:i,successResponseCodes:[200,208]})}async getComment(e){const{annotationId:t,etag:i}=e,s=this._getUrl(`/assets/${this._assetId}/annots/${t}?recursive=true`);return this._getResponse(s,{headers:this._getCommonHeaders(i)})}async createComment(e){const t=this._getUrl(`/assets/${this._assetId}/annots`);return(await this._doPost(t,this._getCommonHeaders(),JSON.stringify(e))).json()}async editComment(e){const{annotationId:t,etag:i,body:s}=e,r=this._getUrl(`/assets/${this._assetId}/annots/${t}`);return(await this._doPut(r,this._getCommonHeaders(i),JSON.stringify(s),[200])).json()}async deleteComment(e){const{annotationId:t,etag:i}=e,s=this._getUrl(`/assets/${this._assetId}/annots/${t}?recursive=true`);await this._doDelete(s,this._getCommonHeaders(i),[204])}async getMetadata(){const e=this._getUrl(`/assets/${this._assetId}?operation=fetch_user_comment_metadata`);return this._getResponse(e,{headers:this._getCommonHeaders()})}async updateMetadata(e){const{annotId:t,read:i}=e,s=t||"",r=this._getUrl(`/assets/${this._assetId}/annots/${s}/metadata?recursive=false`);return(await this._doPut(r,{"Content-Type":'application/vnd.adobe.dc+json;profile="https://comments.adobe.io/schemas/annots_metadata.jsonld"',Accept:'application/vnd.adobe.dc+json;profile="https://comments.adobe.io/schemas/annots_metadata.jsonld"',"x-ccx-workflow":"true"},JSON.stringify({annotId:`/assets/${this._assetId}/annots/${s}`,read:i||!1}),[200])).json()}}class jc extends Ks{constructor(){super(...arguments),this._creator=void 0,this._created=new Date(0),this._bodyValue=void 0,this._motivation=void 0,this._generator="https://comments.acrobat.com/Comment",this._type="Annotation",this._target=void 0,this._mentions=void 0,this._modified=new Date(0),this._etag=void 0,this._uri=void 0,this._status=void 0,this._replies=void 0,this._readStatus=!1}get creator(){return this._creator}get created(){return this._created}get bodyValue(){return this._bodyValue||""}get motivation(){return this._motivation||"commenting"}get generator(){return this._generator||"https://comments.acrobat.com/Comment"}get type(){return this._type||"Annotation"}get target(){return this._target}get mentions(){return this._mentions}get modified(){return this._modified}get etag(){return this._etag||""}get uri(){return this._uri||""}get status(){return this._status||"open"}get replies(){return this._replies}get readStatus(){return this._readStatus}toJSON(){return{"@context":["https://www.w3.org/ns/anno.jsonld","https://comments.acrobat.com/ns/anno.jsonld"],creator:this._creator,created:this.created.toISOString(),bodyValue:this.bodyValue,motivation:this.motivation,generator:this.generator,type:this.type,target:this.target,modified:this.modified.toISOString(),etag:this.etag,id:this.uri,creationId:this.id,status:this.status}}get assetUrn(){const e=this.uri.split("/");return e.length>2?e[2]:""}get _pool(){return this._commentsResource._commentPool}get _interface(){return this._commentsResource._commentInterface}async edit(e){const t=this._interface,i=this._pool,s=this.toJSON(),r=Object.assign(Object.assign({},s),e),n=await t.editComment({annotationId:this.id,etag:this.etag,body:r}),o=i.createUpdateSession();return Uc.updateLocalItem(o,this,n),o.commit(),this}async updateResolvedStatus(e){const t=e?"resolved":"open";return this.edit({status:t})}async updateReadStatus(e){const t=this._interface,i=this._pool,s=await t.updateMetadata({annotId:this.id,read:e}),r=i.createUpdateSession();return Uc.updateLocalItem(r,this,{creationId:this.id,readStatus:s.read}),r.commit(),this}async delete(){const e=this._interface,t=this._pool,i=this.id;await e.deleteComment({annotationId:i,etag:this.etag});const s=t.createUpdateSession();s.queueDiscardedItem(this),s.commit(),t.removeLocalItems([i])}async reply(e){const t={motivation:"replying",target:{source:this.uri}};return this._commentsResource.createComment(Object.assign(Object.assign({},e),t))}}Ye([ht],jc.prototype,"creator",null),Ye([ht],jc.prototype,"created",null),Ye([ht],jc.prototype,"bodyValue",null),Ye([ht],jc.prototype,"motivation",null),Ye([ht],jc.prototype,"generator",null),Ye([ht],jc.prototype,"type",null),Ye([ht],jc.prototype,"target",null),Ye([ht],jc.prototype,"mentions",null),Ye([ht],jc.prototype,"modified",null),Ye([ht],jc.prototype,"etag",null),Ye([ht],jc.prototype,"uri",null),Ye([ht],jc.prototype,"status",null),Ye([ht],jc.prototype,"replies",null),Ye([ht],jc.prototype,"readStatus",null);const Uc=new vn({localItemType:jc,remoteIdProperty:"creationId",propertyUpdater:new Cn({_creator:{name:"creator",format:"object"},_created:{name:"created",format:"date"},_bodyValue:{name:"bodyValue",format:"string"},_motivation:{name:"motivation",format:"string"},_generator:{name:"generator",format:"string"},_type:{name:"type",format:"string"},_target:{name:"target",format:"object"},_mentions:{name:"mentions",format:"object"},_modified:{name:"modified",format:"date"},_etag:{name:"etag",format:"string"},_uri:{name:"id",format:"string"},_status:{name:"status",format:"string"},_replies:{name:"replies",format:"object"},_readStatus:{name:"readStatus",format:"boolean"}})});class Bc{constructor(e){this._commentsResource=e}async loadPage(e){return await this._loadPage(e)}get retryAfter(){return 1e3*+(this._retryAfter||"12")}get _pool(){return this._commentsResource._commentPool}get _interface(){return this._commentsResource._commentInterface}async _loadPage(e,t){var i;const s=await this._interface.getCommentList(this._etag);if(this._retryAfter=s.headers.get("retry-after")||void 0,this._etag=s.headers.get("etag")||void 0,200===s.status){const e=(await s.json()).first.items,t=this._pool.createLoaderUpdateSession(Date.now()),i=Uc.updateRemoteItems(t,e);return t.commit(),i.forEach((e=>{e._commentsResource=this._commentsResource})),{items:i,total:i.length,loadNextPage:void 0}}const r=(null===(i=this._commentsResource.getCommentList())||void 0===i?void 0:i.items)||[];return{items:r,total:r.length,loadNextPage:void 0}}}const Fc={created:(e,t)=>Un(e.created.getTime(),t.created.getTime())};class Vc extends(Fn(Fc)){}Vc.default=new Vc("ascending","created");const Kc="commentsChanged";class Gc extends ot{constructor(e){super(Kc),this.annotationIds=e}}const $c=new Gc([]);class Wc extends Rs{constructor(e,t){super(),this._core=e,this._assetId=t,this._commentInterface=new Hc(this._core,this._assetId),this._commentPool=new Xo(this._core,"comment"),this._loader=new Bc(this),this._source=new Uo(this._commentPool,[this._loader]),this._unreadCount=0}async createComment(e){const t=await this._commentInterface.createComment(e),i=this._commentPool.createUpdateSession(),s=Uc.updateRemoteItem(i,t);return i.commit(),s._commentsResource=this,s}async getComment(e){let t=this._commentPool.getLocalItemById(e.annotationId);if(!t){const i=await this._commentInterface.getComment(e),s=this._commentPool.createUpdateSession();t=Uc.updateRemoteItem(s,i),s.commit(),t._commentsResource=this}return t}getCommentList(){return this._list||(this._list=this._source.getList(Vc.default,void 0,{refreshTimeout:-1}),this._updateMetadata()),this._list}get unreadCount(){return this._unreadCount}async _updateMetadata(){if(!this._list)return;await Mo(this._list);const e=await this._commentInterface.getMetadata(),t=new Map(e.map((e=>[e.annotId,e.read]))),i=this._commentPool.createUpdateSession(),s=this._core._environment.getValue("USER_ID");this._commentPool.forEach((e=>{const r=t.get(e.uri)||e.creator.id.includes(s)||!1;e.readStatus!==r&&Uc.updateRemoteItem(i,{creationId:e.id,readStatus:r})})),this._unreadCount=this._list.items.filter((e=>!e.readStatus)).length,i.commit(),this.emit(Kc)}async _poll(){const e=this.getCommentList();e.setNeedsRefresh(),e.refresh(),this._updateMetadata(),this._stopTimeout=setTimeout((()=>this._poll()),this._loader.retryAfter)}startShortPoll(){this._stopTimeout||this._poll()}stopShortPoll(){this._stopTimeout&&(clearTimeout(this._stopTimeout),this._stopTimeout=void 0)}get isShortPollActive(){return void 0!==this._stopTimeout}_onONSNotification(e){var t,i;this.emit(Kc,new Gc(e.annotationIds||[])),null===(t=this._list)||void 0===t||t.setNeedsRefresh(),null===(i=this._list)||void 0===i||i.refresh(),this._updateMetadata()}}var zc;function qc(e,t){let i=null;return function(...s){const r=this;i||(i=setTimeout((()=>{e.apply(r,s),i=null}),t))}}Ye([ht($c)],Wc.prototype,"unreadCount",null),function(e){e[e.Offline=0]="Offline",e[e.Wan=1]="Wan",e[e.Cellular=2]="Cellular",e[e.OnlineUnknown=3]="OnlineUnknown"}(zc||(zc={}));const Yc=120;function Qc(){return"undefined"!=typeof window?null===window||void 0===window?void 0:window.acplModel:void 0}function Jc(e=""){const t=e.split(".");"0-main"===t[2]&&t.splice(2,1);const[i="0",s="0",r="0"]=t;return[i,s,r].map((e=>e.padStart(4,"0"))).join("")}function Xc(e,t){var i;const s=Jc(null===(i=Qc())||void 0===i?void 0:i.version),r=Jc(t);switch(e){case"lt":return s<r;case"gte":return s>=r;default:return!1}}const Zc=new class extends ot{constructor(){super("thumbnailChange")}},el=new class extends ot{constructor(){super("permissionsChange")}};var tl;function il(e,t){switch(!0){case t instanceof Map:return{Map:Array.from(t.entries())};case t instanceof Set:return{Set:[...t]};default:return t}}!function(e){e[e.NONE=0]="NONE",e[e.ERROR=1]="ERROR",e[e.WARN=2]="WARN",e[e.INFO=3]="INFO",e[e.DEBUG=4]="DEBUG"}(tl||(tl={}));class sl{static _isoTime(){return(new Date).toISOString().slice(11)}static _epochToIsoTimeString(e){return new Date(e).toISOString().slice(11)}_formatMessage(e,t,...i){const s=this.includeTimestamp?`[${sl._isoTime()}]`:"";return i.length&&(e+=" <<<DATA\n"+JSON.stringify(i,il,2)+"\nDATA;"),t=t.padEnd(16," "),`[${this._prefix}]${s}[${t}] ${e}`}constructor(e,t=console){this._logSink=console,this.includeTimestamp=!0,this.logLevel=tl.WARN,this._prefix=e,this._logSink=t}logDebug(e,t,...i){var s;this.logLevel>=tl.DEBUG&&(e=this._formatMessage(e,t,...i),null===(s=this._logSink)||void 0===s||s.debug(e))}logInfo(e,t,...i){var s;this.logLevel>=tl.INFO&&(e=this._formatMessage(e,t,...i),null===(s=this._logSink)||void 0===s||s.info(e))}logWarn(e,t,...i){var s;this.logLevel>=tl.WARN&&(e=this._formatMessage(e,t,...i),null===(s=this._logSink)||void 0===s||s.warn(e))}logError(e,t,...i){var s;if(this.logLevel>=tl.ERROR){if(i[0]instanceof Error){const t=i[0];e+=`(${t.message}`,t.cause&&(e+=`: ${t.cause}`),e+=")",i.shift()}else"string"==typeof i[0]&&(e+=`(${i[0]})`,i.shift());e=this._formatMessage(e,t,...i),null===(s=this._logSink)||void 0===s||s.error(e)}}}class rl{constructor(e,t=fetch,i){this.endpoint=e,this._locale="en-US",this._logger=new sl("Axon",i),this._authenticatedGet=t}_getSignedUrlRequestUrl(){return this._reconnectSignedUrl?this._reconnectSignedUrl:"https://"+this.endpoint+"/signed-url"+(this._sessionId?"?sessionId="+this._sessionId:"")}async _getSignedUrl(){let e;try{e=await this._authenticatedGet(this._getSignedUrlRequestUrl())}catch(e){return e instanceof TypeError?{code:997,error:new Error("Failed to authenticate against Axon server",{cause:e.message})}:e instanceof Error?{code:998,error:e}:{code:999,error:new Error("Unknown error while accessing Axon authentication service!")}}try{const t=await e.json();return 200===e.status?"websocketUrl"in t?{code:e.status,signedUrl:t.websocketUrl}:{code:994,error:new Error("Invalid response from Axon service!")}:{code:e.status,error:new Error(null==t?void 0:t.message)}}catch(e){return e instanceof Error?{code:995,error:e}:{code:996,error:new Error("Unknown error while accessing Axon authentication service!")}}}set locale(e){this._locale=e}get locale(){return this._locale}set reconnectSignedUrl(e){this._reconnectSignedUrl=e}get reconnectSignedUrl(){return this._reconnectSignedUrl}set sessionId(e){this._sessionId=e}get sessionId(){return this._sessionId}get logger(){return this._logger}get signedUrl(){var e;return(null===(e=null==this?void 0:this._authentication)||void 0===e?void 0:e.signedUrl)||""}resetSession(){this._sessionId=void 0,this._reconnectSignedUrl=void 0}async authenticate(){return this._authentication=void 0,this._authentication=await this._getSignedUrl(),this.isAuthenticated()}isAuthenticated(){if(!this._authentication)return!1;if(200!==this._authentication.code)return!1;if(void 0===this._authentication.signedUrl)return!1;try{return new URL(this._authentication.signedUrl),!0}catch(e){return!1}}}var nl=null;"undefined"!=typeof WebSocket?nl=WebSocket:"undefined"!=typeof MozWebSocket?nl=MozWebSocket:"undefined"!=typeof global?nl=global.WebSocket||global.MozWebSocket:"undefined"!=typeof window?nl=window.WebSocket||window.MozWebSocket:"undefined"!=typeof self&&(nl=self.WebSocket||self.MozWebSocket);var ol,al,cl,ll,dl,ul,hl,pl,_l,ml=nl;!function(e){e.WsAck="wsack",e.CreateVc="connect",e.CreateVcAck="connectack",e.DeleteVc="disconnect",e.DeleteVcAck="disconnectack",e.Reconnect="reconnect",e.Closesession="closesession",e.Message="message",e.MessageAck="messageack",e.Error="error"}(ol||(ol={})),function(e){e.Active="active",e.CreateInprogress="create_inprogress",e.DeleteInprogress="delete_inprogress",e.Error="error"}(al||(al={})),function(e){e.AuthTokenExpired="authTokenExpired",e.InstanceShuttingDown="instanceShuttingDown",e.PeriodicReset="periodicReset"}(cl||(cl={}));class fl extends Is{constructor(e,t,i="unknown"){super(),this.logSourceId=void 0,this._state=e,this._logger=t,this._logSourceName=i,this.logDebug(`Created with an initial state ${this.state}.`)}_sourceString(){const e=this.logSourceId?this.logSourceId():"";return this._logSourceName+(e?`:${e}`:"(pending)")}get logger(){return this._logger}get state(){return this._state}transitionTo(e){const t=e;this.logDebug(`State Transition: ${this.state} => ${e}.`),this._state=e,this.emit(t.toLowerCase())}logDebug(e,...t){this._logger.logDebug(e,this._sourceString(),...t)}logInfo(e,...t){this._logger.logInfo(e,this._sourceString(),...t)}logWarn(e,...t){this._logger.logWarn(e,this._sourceString(),...t)}logError(e,...t){this._logger.logError(e,this._sourceString(),...t)}}class gl{static CreateFrame(e,t=bi()){return{frameType:e,frameId:t}}}!function(e){e.CREATE_IN_PROGRESS="CREATE_IN_PROGRESS",e.CREATED="CREATED",e.DELETE_IN_PROGRESS="DELETE_IN_PROGRESS",e.DELETED="DELETED"}(ll||(ll={}));class yl extends fl{static VcIdToVcIndex(e){const t=e.split(":");if(2!==t.length)return 0;const i=parseInt(t[1]);return isNaN(i)?0:i}constructor(e,t,i,s,r={}){super(ll.CREATE_IN_PROGRESS,e.logger,"VirConn"),this._session=e,this._frameSenderHook=t,this._vcIndex=i,this._serviceName=s,this._headers=r,this.logSourceId=()=>this._vcIndex?`${this._vcIndex} (${this._serviceName})`:"",this.logDebug("Axon Virtual Connection created!",this.id);const n=Object.assign(Object.assign({},gl.CreateFrame(ol.CreateVc)),{vcId:this.id,serviceName:this._serviceName,headers:this._headers});this.logDebug("Sending CreateVc frame",n),this._frameSenderHook.trigger(n)}get index(){return this._vcIndex}get id(){return this._session.id+":"+this._vcIndex}isActive(){return this.isCreated()&&this._session.isEstablished()}isCreated(){return this.state===ll.CREATED}async ensureActive(e=2e3){return!!this.isActive()||this.state!==ll.DELETE_IN_PROGRESS&&this.state!==ll.DELETED&&(this.logDebug("Waiting for Virtual Connection to be active..."),await new Promise((t=>{const i=setTimeout((()=>{t()}),e);this.once("active",(()=>{clearTimeout(i),t()}))})),this.isActive())}handleAxonErrorFrame(e){switch(this.logDebug("Received Error frame",e),this.state){case ll.CREATE_IN_PROGRESS:case ll.DELETE_IN_PROGRESS:this.transitionTo(ll.DELETED),this.logError(`Virtual Connection creation failed (${e.errorMessage.message})`);break;default:this.emit("error",e.errorMessage)}}handleAxonMessageFrame(e){try{const t=atob(e.payload),i=JSON.parse(t);this.sendMessageAck(e.frameId),this.emit("message",i)}catch(e){this.logError("Failed to decode message payload",e)}}handleAxonMessageAckFrame(e){}sendMessage(e){if(!this.isActive())return void this.logError("Cannot send Message on non-active Virtual Connection!");const t=btoa(e),i=Object.assign(Object.assign({},gl.CreateFrame(ol.Message)),{vcId:this.id,payload:t});this._frameSenderHook.trigger(i)}sendMessageAck(e){if(!this.isActive())return void this.logError("Cannot send MessageAck on non-active Virtual Connection!");const t=Object.assign(Object.assign({},gl.CreateFrame(ol.MessageAck)),{vcId:this.id,messageFrameId:e});this._frameSenderHook.trigger(t)}}!function(e){e.CONNECTION_IN_PROGRESS="CONNECTION_IN_PROGRESS",e.DISCONNECTION_IN_PROGRESS="DISCONNECTION_IN_PROGRESS",e.RECONNECTION_IN_PROGRESS="RECONNECTION_IN_PROGRESS",e.ESTABLISHED="ESTABLISHED",e.DISCONNECTED="DISCONNECTED",e.CLOSED="CLOSED"}(dl||(dl={}));class vl extends fl{constructor(e,t){super(dl.DISCONNECTED,e.config.logger,"Session"),this._axonClient=e,this._frameSenderHook=t,this._virtualConnections=new Map,this._lastVcMonotonicIndex=0,this.logSourceId=()=>this._sessionId?this._sessionId.substring(0,8):""}_handleWsAckFrame(e){var t;this.logDebug("Received WsAck frame",e);const i=this._virtualConnections;if(this._virtualConnections=new Map,this._heartbeatIntervalInSec=void 0,this._sessionId!==e.sessionId){for(const e of i.values())e.transitionTo(ll.DELETED),this.logDebug(`Marking no longer valid Virtual Connection ${e.id} as DELETED`);i.clear()}if(this._sessionId=void 0,!e.sessionId||!e.heartbeatFrequencyInSec||e.heartbeatFrequencyInSec<=0)return this.logError("Rejecting invalid WsAckFrame. Session not established.",e),this.transitionTo(dl.CLOSED),void this._notifyVirtualConnectionsAboutStatusChange();this._sessionId=e.sessionId,this._axonClient.config.sessionId=e.sessionId,this._axonClient.config.reconnectSignedUrl=e.reconnectUrl,this._heartbeatIntervalInSec=e.heartbeatFrequencyInSec;for(const s of null!==(t=e.vcIds)&&void 0!==t?t:[]){const e=yl.VcIdToVcIndex(s.id);if(!e){this.logError(`Unexpected Virtual Connection with Vc Index (${e}).`);continue}const t=i.get(e);if((null==t?void 0:t.isCreated())&&s.status===al.Active)this._virtualConnections.set(e,t),i.delete(e),this._lastVcMonotonicIndex<e&&(this._lastVcMonotonicIndex=e),this.logInfo(`Re-connected to Virtual Connection with index ${e}.`);else{this.logWarn(`Deleting unknown or inactive virtual connection with Vc Id (${s.id}).`),(null==t?void 0:t.isCreated())&&t.transitionTo(ll.DELETE_IN_PROGRESS);const e=Object.assign(Object.assign({},gl.CreateFrame(ol.DeleteVc)),{vcId:s.id});this._frameSenderHook.trigger(e)}}for(const e of i.values())e.transitionTo(ll.DELETED),this.logDebug(`Marking pre-existing and no longer valid Virtual Connection (${e.id}) as DELETED`);this.transitionTo(dl.ESTABLISHED),this.logDebug(`Axon session ${this._sessionId} established with heartbeat interval of ${this._heartbeatIntervalInSec} seconds.`),this._notifyVirtualConnectionsAboutStatusChange()}_handleCreateVcAckFrame(e){this.logDebug("Received CreateVcAck frame",e);const t=yl.VcIdToVcIndex(e.vcId);if(t&&this._virtualConnections.has(t)){const e=this._virtualConnections.get(t);e?(e.transitionTo(ll.CREATED),this._notifyVirtualConnectionsAboutStatusChange()):this.logError(`Failed to handle Virtual Connection Ack Frame (VC with index ${this._sessionId} not found).`)}else this.logError(`Ignoring frame for an invalid Vc Id (${e.vcId}).`)}_handleDeleteVcAckFrame(e){this.logDebug("Received DeleteVcAck frame",e);const t=yl.VcIdToVcIndex(e.vcId),i=this._virtualConnections.get(t);i?(i.transitionTo(ll.DELETED),this._virtualConnections.delete(t)||this.logError(`Failed to delete Virtual Connection (VC with index ${t} not found).`)):this.logError(`Ignoring frame for an invalid Vc Id (${e.vcId}).`),0===this._virtualConnections.size&&(this.logDebug("All Virtual Connections deleted. Closing Axon Session..."),this.close())}_handleReconnectFrame(e){this.logDebug("Received Reconnect frame",e)}_handleCloseSessionFrame(e){this.logDebug("Received CloseSession frame",e)}_handleVcFrame(e){const t=yl.VcIdToVcIndex(e.vcId);if(t&&this._virtualConnections.has(t)){const i=this._virtualConnections.get(t);if(i)switch(e.frameType){case ol.Message:return i.handleAxonMessageFrame(e);case ol.MessageAck:return i.handleAxonMessageAckFrame(e);case ol.Error:return i.handleAxonErrorFrame(e);default:return void this.logError(`Ignoring frame for Vc ${e.vcId} (Unknown frame type: ${e.frameType}).`)}else this.logError(`Failed to access Virtual Connection # ${t} while handling frame ${e.vcId}.`)}else this.logError(`Ignoring Axon frame for Vc ${e.vcId} (No such VC exists).`)}get id(){var e;return null!==(e=this._sessionId)&&void 0!==e?e:""}get heartbeatIntervalInSec(){return this._heartbeatIntervalInSec}handleAxonFrame(e){switch(e.frameType){case ol.WsAck:return this._handleWsAckFrame(e);case ol.CreateVcAck:return this._handleCreateVcAckFrame(e);case ol.DeleteVcAck:return this._handleDeleteVcAckFrame(e);case ol.Reconnect:return this._handleReconnectFrame(e);case ol.Closesession:return this._handleCloseSessionFrame(e);case ol.Message:case ol.MessageAck:case ol.Error:return this._handleVcFrame(e);default:throw new Error("Failed to parse data frame; unknown frame type")}}isEstablished(){return this.state===dl.ESTABLISHED}async ensureEstablished(e=2e3){const t=Date.now()+e;return await this._axonClient.ensureConnected(e)?!!this.isEstablished()||(this.state===dl.DISCONNECTED&&(this.transitionTo(dl.CONNECTION_IN_PROGRESS),this._notifyVirtualConnectionsAboutStatusChange()),this.logDebug("Waiting for session to be established..."),await new Promise((e=>{const i=setTimeout((()=>{e()}),t-Date.now());this.once("established",(()=>{clearTimeout(i),e()}))})),this.isEstablished()):(this.logError("Axon Client could not be connected!"),!1)}_notifyVirtualConnectionsAboutStatusChange(){for(const e of this._virtualConnections.values())e.emit("session_status_changed")}expectReconnection(){this.state!==dl.RECONNECTION_IN_PROGRESS&&(this.transitionTo(dl.RECONNECTION_IN_PROGRESS),this._notifyVirtualConnectionsAboutStatusChange())}expectDisconnection(){this.state!==dl.DISCONNECTION_IN_PROGRESS&&(this.transitionTo(dl.DISCONNECTION_IN_PROGRESS),this._notifyVirtualConnectionsAboutStatusChange())}disconnect(){this.state!==dl.CLOSED&&this.state!==dl.DISCONNECTED&&(this.transitionTo(dl.DISCONNECTED),this._notifyVirtualConnectionsAboutStatusChange())}close(){this.state!==dl.CLOSED&&this.state!==dl.DISCONNECTED&&(this.logDebug("Closing Axon Session..."),this._frameSenderHook.trigger(gl.CreateFrame(ol.Closesession)),this.transitionTo(dl.CLOSED),this._notifyVirtualConnectionsAboutStatusChange(),this._virtualConnections.clear(),this._lastVcMonotonicIndex=0)}async createVc(e,t){if(!this.isEstablished())throw new Error("Axon Session is not established!");const i=++this._lastVcMonotonicIndex,s=new yl(this,this._frameSenderHook,i,e,t);return this._virtualConnections.set(s.index,s),s}async deleteVc(e){if(!this.isEstablished())throw new Error("Axon Session is not established!");const t=Object.assign(Object.assign({},gl.CreateFrame(ol.DeleteVc)),{vcId:e.id});this.logDebug("deleteVc",t),e.transitionTo(ll.DELETE_IN_PROGRESS),this._frameSenderHook.trigger(t),this.logDebug("Waiting for VC to be deleted...");const i=Date.now()+2e3;return await new Promise((t=>{const s=setTimeout((()=>{t()}),i-Date.now());e.once("deleted",(()=>{clearTimeout(s),t()}))})),e.state===ll.DELETED}}vl.State=dl,function(e){e[e.SWITCHING_PROTOCOLS=101]="SWITCHING_PROTOCOLS",e[e.UNAUTHORIZED=401]="UNAUTHORIZED",e[e.FORBIDDEN=403]="FORBIDDEN",e[e.NOT_FOUND=404]="NOT_FOUND",e[e.INTERNAL_SERVER_ERROR=500]="INTERNAL_SERVER_ERROR",e[e.SERVICE_UNAVAILABLE=503]="SERVICE_UNAVAILABLE"}(ul||(ul={})),function(e){e[e.DISCONNECTED_NORMAL=1e3]="DISCONNECTED_NORMAL",e[e.DISCONNECTED_ERROR=1002]="DISCONNECTED_ERROR",e[e.DISCONNECTED_ABNORMAL=1006]="DISCONNECTED_ABNORMAL",e[e.DISCONNECTED_SESSION_CLOSED=4432]="DISCONNECTED_SESSION_CLOSED",e[e.DISCONNECTED_SESSION_ACTIVE=4433]="DISCONNECTED_SESSION_ACTIVE"}(hl||(hl={})),function(e){e[e.AXON_SERVER_DISCONNECTING=425]="AXON_SERVER_DISCONNECTING",e[e.AXON_VC_MALFORMED_ID=400]="AXON_VC_MALFORMED_ID",e[e.AXON_VC_ALREADY_EXISTS=4409]="AXON_VC_ALREADY_EXISTS",e[e.AXON_VC_INTERNAL_ERROR=4500]="AXON_VC_INTERNAL_ERROR",e[e.AXON_VC_SERVICE_TIMEOUT=4503]="AXON_VC_SERVICE_TIMEOUT"}(pl||(pl={})),function(e){e.CONNECTING="CONNECTING",e.RECONNECTING="RECONNECTING",e.CONNECTED="CONNECTED",e.DISCONNECTING="DISCONNECTING",e.DISCONNECTED="DISCONNECTED"}(_l||(_l={}));class Ol extends fl{static _createAxonClientFrameSenderHook(e){return{trigger:t=>{try{const i=JSON.stringify(t);e.send(i,t.frameType)}catch(t){e.logError("Invalid Axon frame passed to the sender hook",t)}}}}constructor(e){super(_l.DISCONNECTED,e.logger,"WebSock"),this._config=e,this._txBuffer=[],this._connectionIteration=0,this._wsIndex=0,this._reconnectAttempt=0,this._onWsOpen=e=>{this.logDebug(`WebSocket opened for ${this._config.endpoint}.`),this.state!==_l.DISCONNECTED&&this.state!==_l.DISCONNECTING?this.state!==_l.CONNECTING&&this.state!==_l.RECONNECTING||(this._clearReconnectTimer(),this.transitionTo(_l.CONNECTED)):this.logWarn("WebSocket opened for a disconnecting or disconnected Axon client!")},this._onWsClose=e=>(this.logDebug(`WebSocket closed (code:${e.code})[reason:${e.reason}].`),this.state!==_l.CONNECTING||e.wasClean?this.isConnected()&&(e.code===hl.DISCONNECTED_SESSION_CLOSED&&(this._config.resetSession(),this.logDebug("Axon server permanently closed the current session.")),this.session.isEstablished())?(this.logWarn("WebSocket closed unexpectedly. Will re-connect using an incremental backoff strategy."),void this._scheduleReconnectWithExponentialBackoff()):void this.terminate():(this._config.reconnectSignedUrl&&this._reconnectAttempt>=2&&(this.logWarn("Reconnections using the existing reconnect Signed URL failed. Will try reconnecting with a new Axon session."),this._config.resetSession(),this._reconnectAttempt=0),void(0===this._reconnectAttempt&&(this.logWarn("WebSocket failed to connect cleanly. Will re-connect using an incremental backoff strategy."),this._scheduleReconnectWithExponentialBackoff())))),this._onWsError=e=>{this.state===_l.DISCONNECTING?this.logWarn(`Ignoring WebSocket error event while Axon Client is being disconnected (${e})`):this.logError("WebSocket error",e)},this._onWsMessage=e=>{"string"==typeof e.data?this._handleTextMessage(e.data):this.logError("Unsupported binary message received (Unimplemented).")},this.logSourceId=()=>this._wsIndex.toString(),this._session=new vl(this,Ol._createAxonClientFrameSenderHook(this))}_cancelHeartbeatMonitoring(){this._heartbeatMonitorTimeout&&(clearTimeout(this._heartbeatMonitorTimeout),this._heartbeatMonitorTimeout=void 0)}_restartHeartbeatMonitoring(){if(this._cancelHeartbeatMonitoring(),!this.isConnected()||!this.session.heartbeatIntervalInSec)return;const e=1300*this.session.heartbeatIntervalInSec;this._heartbeatMonitorTimeout=setTimeout((()=>{this.isConnected()&&(this.logWarn("Missed heartbeat from Axon server! Client will reconnect using backoff strategy."),this._scheduleReconnectWithExponentialBackoff())}),e)}_cancelHeartbeatMessage(){this._heartbeatSenderTimeout&&(clearTimeout(this._heartbeatSenderTimeout),this._heartbeatSenderTimeout=void 0)}_rescheduleHeartbeatMessage(){if(this._cancelHeartbeatMessage(),!this.isConnected()||!this.session.heartbeatIntervalInSec)return;const e=800*this.session.heartbeatIntervalInSec;this._heartbeatSenderTimeout=setTimeout((()=>{this.isConnected()&&this.send("\n")}),e)}_handleTextMessage(e){if(this._reconnectAttempt=0,"\n"!==e){this.logDebug(`Message of ${e.length} char(s) received.`);try{const t=JSON.parse(e);this._session.handleAxonFrame(t),this._heartbeatSenderTimeout||this._rescheduleHeartbeatMessage(),this._restartHeartbeatMonitoring()}catch(t){this.logDebug("Received WebSocket text message",e),this.logError("Failed to handle WebSocket text message",t)}}else this._restartHeartbeatMonitoring()}_transmit(){if(this._ws&&this._ws.readyState===ml.OPEN){for(const e of this._txBuffer)this._ws.send(e),"\n"!==e&&this.logDebug(`Message of ${e.length} byte(s) sent.`);this._txBuffer=[],this._rescheduleHeartbeatMessage()}}get config(){return this._config}get session(){return this._session}isConnected(){return this.state===_l.CONNECTED}async connect(e=2e3){if(this.state!==_l.RECONNECTING&&(this._reconnectAttempt=0),this.state!==_l.DISCONNECTED&&this.state!==_l.RECONNECTING)return this.logDebug(`Connection ignored; client not in DISCONNECTED or RECONNECTING state (current state: ${this.state}).`),!1;const t=++this._connectionIteration;this.transitionTo(_l.CONNECTING),this.logDebug("Connection initiated; authenticating client before opening WebSocket.");const i=await this._config.authenticate();return t!==this._connectionIteration?(this.logDebug("Connection aborted; client must have been simultaneously reconnected, disconnected or terminated."),!1):i?(this._wsIndex++,this._ws=new ml(this._config.signedUrl,"axon-v1"),this._ws.binaryType="arraybuffer",this._ws.onerror=this._onWsError,this._ws.onopen=this._onWsOpen,this._ws.onclose=this._onWsClose,this._ws.onmessage=this._onWsMessage,this.logDebug("WebSocket initialized."),this._waitForConnection(e)):(this.logError("Failed to authenticate against Axon service."),!1)}async ensureConnected(e=2e3){return!(this.state===_l.DISCONNECTED||!await this._waitForConnection(e))||(await this.reconnect(),this.isConnected())}async _waitForConnection(e=2e3){if(this.isConnected())return!0;this.logDebug("Waiting for WebSocket connection...");const t=Date.now()+e;this._ws||await new Promise((e=>{const i=setInterval((()=>{(this._ws||Date.now()>t)&&(e(),clearInterval(i))}),50)}));const i=this._ws;return!!i&&(i.readyState===ml.CONNECTING&&await new Promise((e=>{const i=setTimeout(e,t-Date.now());this.once("connected",(()=>{clearTimeout(i),e()}))})),this.isConnected()?(this.logDebug("WebSocket connection established."),!0):(this.logDebug("WebSocket connection failed."),!1))}async _deinitialize(e){this._cancelHeartbeatMonitoring(),this._cancelHeartbeatMessage();const t=Date.now()+e,i=this._ws;if(i){if(i.onmessage=null,i.onopen=null,i.onclose=null,i.readyState===ml.OPEN&&this.session.isEstablished()&&(this.state===_l.RECONNECTING?this.session.disconnect():(this.session.close(),await new Promise((e=>{const s=setTimeout(e,t-Date.now());i.addEventListener("close",(()=>{this.logDebug("WebSocket closed by server."),clearTimeout(s),e()}),{once:!0})})))),i.readyState===ml.OPEN||i.readyState===ml.CONNECTING){const t=hl.DISCONNECTED_NORMAL;i.close(t),this.logDebug(`WebSocket closing initiated with code ${t} and timeout of ${e} ms.`)}i.readyState===ml.CLOSING&&await new Promise((t=>{const s=setTimeout(t,e);i.addEventListener("close",(()=>{this.logDebug("WebSocket closed by client."),clearTimeout(s),t()}),{once:!0})}))}this._ws=void 0,this.logDebug("WebSocket deinitialized.")}send(e,t){if(t!==ol.Closesession)switch(this.state){case _l.CONNECTING:case _l.RECONNECTING:this._txBuffer.push(e);break;case _l.CONNECTED:this._txBuffer.push(e),this._transmit();case _l.DISCONNECTING:case _l.DISCONNECTED:}else{if(!this._ws)return;if(this._ws.readyState!==ml.OPEN)return;this._ws.send(e),this.logDebug(`Close Session frame of ${e.length} bytes sent.`)}}async reconnect(e=2e3){this.state!==_l.RECONNECTING?(this.session.expectReconnection(),++this._connectionIteration,this.state!==_l.DISCONNECTED&&(this.transitionTo(_l.RECONNECTING),this.logInfo("WebSocket will reconnect now."),await this._deinitialize(300)),await this.connect(e)):this.logDebug("reconnect() aborted; client is already in RECONNECTING state.")}_clearReconnectTimer(){this._reconnectTimer&&(clearTimeout(this._reconnectTimer),this._reconnectTimer=void 0)}_scheduleReconnectWithExponentialBackoff(){if(this._clearReconnectTimer(),++this._reconnectAttempt<2880){const e=this._reconnectAttempt<5?1e3*Math.pow(2,this._reconnectAttempt):3e4;this._reconnectTimer=setTimeout((()=>{this._scheduleReconnectWithExponentialBackoff()}),e),this.logInfo(`Reconnect attempt #${this._reconnectAttempt} starting now! The next attempt is scheduled in ${e}ms.`)}else this.logInfo(`Reconnect attempt #${this._reconnectAttempt} starting now! This is the last attempt!`);this.reconnect()}async terminate(e=300){this.state!==_l.DISCONNECTED?(this._clearReconnectTimer(),this._reconnectAttempt=0,++this._connectionIteration,this.state!==_l.DISCONNECTING&&this.transitionTo(_l.DISCONNECTING),this._txBuffer=[],await this._deinitialize(e),this.state===_l.DISCONNECTING&&this.transitionTo(_l.DISCONNECTED)):this.logDebug("terminate() aborted; client is already in DISCONNECTED state.")}async disconnect(e=600){if(this.state===_l.DISCONNECTED)return void this.logDebug("disconnect() aborted; client is already in DISCONNECTED state.");this.session.expectDisconnection(),this._config.resetSession(),++this._connectionIteration;const t=Date.now()+e,i=this._ws;this.logDebug(`disconnect() started with timeout of ${e} ms.`),this.transitionTo(_l.DISCONNECTING),i&&i.readyState===ml.CONNECTING&&await new Promise((e=>{const s=setTimeout(e,t-Date.now());i.addEventListener("open",(()=>{clearTimeout(s),e()}),{once:!0})})),await this.terminate(Math.max(0,t-Date.now()))}}function bl(e){var t,i;return{localID:e.localID,syncStatus:e.syncStatus,syncSuspensionReason:e.syncSuspensionReason,downloadStatus:e.downloadStatus,uploadStatus:e.uploadStatus,"repo:repositoryId":e.repositoryID,"repo:path":e.repoPath,"repo:assetId":e.cloudID,"repo:size":e.sizeInBytes,"repo:name":e.name,"dc:format":e.mediaType,"storage:deviceCreateDate":null===(t=e.created)||void 0===t?void 0:t.toISOString(),"storage:deviceModifyDate":null===(i=e.modified)||void 0===i?void 0:i.toISOString(),"repo:createdBy":e.createdBy,"repo:modifiedBy":e.modifiedBy}}Ol.State=_l;class Il{constructor(e){this.applicationContext=e,this.onChangedAssets=({previews:e,properties:t,status:i})=>{const s=[...e,...t,...i];for(const e of s)this.isAssetInRecents(e)&&this.emitLocalAssetChange("update",bl(e));s.length||this.onListUpdated()},this.onAddedToRecents=e=>{this.emitLocalAssetChange(e.cloudID?"update":"add",bl(e))},this.onRemovedFromRecents=e=>{this.emitLocalAssetChange("update",{localID:"","repo:assetId":e.cloudID})},this.onListUpdated=qc((()=>{for(const e of this.recentsList.items)this.emitLocalAssetChange("update",bl(e))}),Yc),this.recentsList=e.recentsSource.getList(xo.Descending,ko.Modified),this.recentsList.on("refreshed",this.onListUpdated),this.recentsList.on("movedAsset",this.onListUpdated),this.recentsList.on("addedAsset",(e=>this.onAddedToRecents(e))),this.recentsList.on("removedAsset",(e=>this.onRemovedFromRecents(e))),e.on("changedAssets",this.onChangedAssets),this.onListUpdated()}getLocalAssets(){return this.recentsList.items.filter((e=>e.localID)).map((e=>bl(e)))}isAssetInRecents(e){return this.recentsList.items.some((t=>e.localID===t.localID||e.cloudID===t.cloudID))}emitLocalAssetChange(e,t){var i;null===(i=Qc())||void 0===i||i.trigger("localAssetChange",JSON.stringify({type:e,localAsset:t}))}}const El=Symbol.for("com.adobe.ccac-sam-js.instances");var Tl;!function(e){e[e.Off=0]="Off",e[e.Err=1]="Err",e[e.Warn=2]="Warn",e[e.Info=3]="Info",e[e.Debug=4]="Debug"}(Tl||(Tl={}));class Sl extends Rs{constructor(e,t={}){super(),this._assetPool=new Xo(this,"project or adobeasset"),this._adobeAssetFactory=new hc(this),this._fetchIndexState={},this._environment=new Os(this,e,t),e.CACHE_KEEP_ALIVE_TTL&&Nt.setTTL(e.CACHE_KEEP_ALIVE_TTL)}_getAssetPool(){return this._assetPool}async _setAssetContextFromBindings(e){if(this._AssetContext)return void console.error("[SAMCore] AssetContext already initialized");this._AssetContext=e;const t=(await Promise.resolve().then((function(){return gh}))).default;this._AssetContextJS=new t(this,this._assetPool)}_getAssetContext(){return this._AssetContext}get hostAssetContext(){if(!this._AssetContext)throw We.create(Be.UNSUPPORTED,"samCore.hostAssetContext cannot be used without first calling initializeSharedAssetModel()");return this._AssetContext}async _getGQLManager(){if(!this._gqlManager){const e=(await Promise.resolve().then((function(){return kE}))).default;this._gqlManager=new e(this),await this._gqlManager.initialize()}return this._gqlManager}async getAssetContext(){if(this._AssetContext)return this._AssetContext;const e=(await Promise.resolve().then((function(){return gh}))).default;return this._AssetContext=new e(this,this._assetPool),await this._AssetContext._getONSContext(),await this.getCollaborationContext(),this._AssetContext}get assetLinkManager(){if(!this._AssetContext)throw We.create(Be.UNSUPPORTED,"samCore.assetLinkManager and samCore.assetContext cannot be used without first calling initializeSharedAssetModel()");if(!this._AssetContext._getAssetLinkManager())throw We.create(Be.UNSUPPORTED,"samCore.assetLinkManager cannot be used without first calling initializeSharedAssetModel()");return this._AssetContext._getAssetLinkManager()}get spaceContext(){if(tn("SAMCore.spaceContext","spaceContext is deprecated and will be removed on or after 2024-10-01"),!this._SpaceContext)throw We.create(Be.UNSUPPORTED,"samCore.spaceContext cannot be used without first calling initializeSharedAssetModel()");return this._SpaceContext}async getSpaceContext(){if(this._SpaceContext)return this._SpaceContext;const e=(await Promise.resolve().then((function(){return XE}))).default;return this._SpaceContext=new e(this),this._SpaceContext}_getSpaceContext(){return this._SpaceContext}get collaborationContext(){if(!this._CollaborationContext)throw We.create(Be.UNSUPPORTED,"samCore.collaborationContext cannot be used without first calling initializeSharedAssetModel()");return this._CollaborationContext}async getCollaborationContext(){if(this._CollaborationContext)return this._CollaborationContext;const e=(await Promise.resolve().then((function(){return sh}))).default;return this._CollaborationContext=new e(this),this._CollaborationContext}_getCollaborationContext(){return this._CollaborationContext}get projectContext(){if(!this._ProjectContext)throw We.create(Be.UNSUPPORTED,"samCore.projectContext cannot be used without first calling initializeSharedAssetModel()");return this._ProjectContext}async getProjectContext(){if(this._ProjectContext)return this._ProjectContext;const e=(await Promise.resolve().then((function(){return oT}))).default;return this._ProjectContext=new e(this,this._assetPool),this._ProjectContext}_getProjectContext(){return this._ProjectContext}get classroomContext(){if(!this._ClassroomContext)throw We.create(Be.UNSUPPORTED,"samCore.classroomContext cannot be used without first calling initializeSharedAssetModel()");return this._ClassroomContext}async getClassroomContext(){if(this._ClassroomContext)return this._ClassroomContext;const e=(await Promise.resolve().then((function(){return aA}))).default;return this._ClassroomContext=new e(this,this._assetPool),this._ClassroomContext}_getClassroomContext(){return this._ClassroomContext}async getBoardContext(){if(this._BoardContext)return this._BoardContext;const e=(await Promise.resolve().then((function(){return _A}))).default;return this._BoardContext=new e(this,this._assetPool),this._BoardContext}_getBoardContext(){return this._BoardContext}_getAxonClient(){if(this._AxonClient)return this._AxonClient;const e=new rl(this._environment.endpoints.AXON_HOST,(async e=>this._environment.fetch(e,{noApiKeyHeader:!0})),this._environment.logSink);this._environment.getValue("ENVIRONMENT")===as.Stage&&(e.logger.logLevel=tl.DEBUG);const t=this._environment.getValue("LOCALE");return t&&(e.locale=t),this._AxonClient=Promise.resolve(new Ol(e)),this._AxonClient}get frameioContext(){if(!this._FrameioContext)throw We.create(Be.UNSUPPORTED,"samCore.frameioContext cannot be used without first calling initializeSharedAssetModel()");return this._FrameioContext}async getFrameioContext(){if(this._FrameioContext)return this._FrameioContext;const e=(await Promise.resolve().then((function(){return sm}))).default;return this._FrameioContext=new e(this),this._FrameioContext}_getFrameioContext(){return this._FrameioContext}async getLibraryContext(){if(this._LibraryContext)return this._LibraryContext;const e=(await Promise.resolve().then((function(){return SA}))).default;return this._LibraryContext=new e(this,this._assetPool),this._LibraryContext}_getLibraryContext(){return this._LibraryContext}async getCustomModelContext(){if(this._CustomModelContext)return this._CustomModelContext;const e=(await Promise.resolve().then((function(){return KA}))).default;return this._CustomModelContext=new e(this,this._assetPool),this._CustomModelContext}async getGenerationHistoryContext(){if(this._GenerationHistoryContext)return this._GenerationHistoryContext;const e=(await Promise.resolve().then((function(){return JA}))).default;return this._GenerationHistoryContext=new e(this,this._assetPool),this._GenerationHistoryContext}_getCustomModelContext(){return this._CustomModelContext}makeObservable(e){return this._environment.mobx.register(e)}get environment(){return tn("SAMCore.environment","environment is deprecated and will be renamed for internal use on or after 2024-10-01"),this._environment}updateConfig(e){Object.keys(e).forEach((t=>{const i=t;this._environment.setValue(i,e[i])}))}_getWorkfrontContext(){return this._WorkfrontContext}async getWorkfrontContext(){if(this._WorkfrontContext)return this._WorkfrontContext;const e=(await Promise.resolve().then((function(){return ZA}))).default;return this._WorkfrontContext=new e(this),this._WorkfrontContext}_getKnowledgeWorkspaceContext(){return this._KnowledgeWorkspaceContext}async getKnowledgeWorkspaceContext(){if(this._KnowledgeWorkspaceContext)return this._KnowledgeWorkspaceContext;const e=(await Promise.resolve().then((function(){return iP}))).default;return this._KnowledgeWorkspaceContext=new e(this),this._KnowledgeWorkspaceContext}async getAccessControlContext(){return new(0,(await Promise.resolve().then((function(){return oP}))).default)(this)}async getSharingContext(){if(this._SharingContext)return this._SharingContext;const e=(await Promise.resolve().then((function(){return cP}))).default;return this._SharingContext=new e(this,this._assetPool),this._SharingContext}}async function Al(e,t={}){var i,s,r,n;let o={};"undefined"!=typeof window&&(window[El]?o=window[El]:window[El]=o);const a=void 0!==e._VERSION_OVERRIDE_FOR_TEST&&""!==e._VERSION_OVERRIDE_FOR_TEST?e._VERSION_OVERRIDE_FOR_TEST:Ls.version,[c,l,d]=a.split(".").map(Number),u=Object.keys(o),h=u.find((e=>{if(e===a)return!0;const[t,i,s]=e.split(".").map(Number);return 0!==c&&t===c&&(i>l||i===l&&s>=d)}));if(h)return o[h];u.length>0&&console.warn(`An instance of SAM.js already exists, but is not compatible with the requested version: ${a}. Because of this, a new instance of SAM.js will be created. Loaded versions: ${u.join(", ")}.`);const p="undefined"!=typeof window&&window.acplModel,_=null!==(s=null===(i=e.FEATURE_FLAGS)||void 0===i?void 0:i["enable-acpl-next-polyfills"])&&void 0!==s&&s,m=null!==(n=null===(r=e.FEATURE_FLAGS)||void 0===r?void 0:r["disable-sam-cpp-models"])&&void 0!==n&&n,f=async e=>{const t=e._environment.getValue("LAZY_CONTEXT");if(_&&await async function(e){const t=Qc();if(!t)return;if(!t.getLocalAssets){const e=Promise.resolve().then((async()=>{const e=await t.waitForApplicationContextReady();return new Il(e)}));t.getLocalAssets=async()=>(await e).getLocalAssets()}const i=new na(e);return i.subscribeToLocalAssetChanges(),t.downloadComposite||(t.downloadComposite=async e=>{var i;const s=await t.applicationAssetContext.getAssetWithCloudID(e);await(null===(i=s.downloadComposite)||void 0===i?void 0:i.call(s))}),t.unpin||(t.unpin=async e=>{var i;const s=await t.applicationAssetContext.getAssetWithCloudID(e);await(null===(i=s.unpin)||void 0===i?void 0:i.call(s))}),i}(e),e._getAssetContext()||await e.getAssetContext(),!t){const t=e._getAssetContext();t._getAssetLinkManager()||await t.getAssetLinkManager(),e._getProjectContext()||await e.getProjectContext(),e._getSpaceContext()||await e.getSpaceContext(),e._getClassroomContext()||await e.getClassroomContext(),e._getCollaborationContext()||await e.getCollaborationContext(),e._getLibraryContext()||await e.getLibraryContext(),e._getFrameioContext()||await e.getFrameioContext(),e._getCustomModelContext()||await e.getCustomModelContext(),e._getWorkfrontContext()||await e.getWorkfrontContext()}};o[a]=new Promise(((i,s)=>{var r;if(p&&!e._DISABLE_SAM_CPP)Promise.race([null!==(r=p.applicationAssetContext)&&void 0!==r?r:p.waitForApplicationContextReady()]).then((()=>{try{if(m||!(()=>{var e,t;const i=null===(e=p.applicationAssetContext)||void 0===e?void 0:e.rootFolder.constructor.prototype;return Boolean(i)&&!0===(null===(t=Object.getOwnPropertyDescriptor(i,"name"))||void 0===t?void 0:t.configurable)})()){const s=new Sl(e,t);return void f(s).then((()=>i(s)))}const s=new Sl(e,t);!function(e){const t=Qc().applicationAssetContext.rootFolder.constructor;Xc("lt","9999.9999.9999")&&Hs({klass:t,core:e,overrides:{restore(e){return this.isLibraryElement?this._core._AssetContextJS.restoreLibraryElement(this.cloudID):this.restore.original(e)},permanentlyDelete(){return this.isLibraryElement?this._core._AssetContextJS.permanentlyDeleteLibraryElement(this.cloudID):this.permanentlyDelete.original()},duplicate(){return this.duplicate.original(!1)}},extensions:{_setCollaboratorData(e){vc.prototype._setCollaboratorData.apply(this,[e]),this._isCollaboratorDataLoaded=!0,this.dispatch(xi)},_queueCollaborators(){this._isCollaboratorDataLoaded||vc.prototype._queueCollaborators.apply(this)},isShared:{get(){return this._core._environment.mobx.reportObserved(this,Mi),!!this.isSharedWithYouAsset||(this._queueCollaborators(),this._isShared)}},directCollaboratorCount:{get(){return this._core._environment.mobx.reportObserved(this,Mi),this._queueCollaborators(),this._directCollaboratorCount}},collaboratorArray:{get(){return this._core._environment.mobx.reportObserved(this,Mi),this._queueCollaborators(),this._collaboratorsArray}},isPublicLink:{get(){return this._core._environment.mobx.reportObserved(this,Mi),this._queueCollaborators(),this._isPublicLink}},id:{get(){return this.cloudID||this.localID}},removeCurrentUserFromCollaborationList(){return this._core.collaborationContext._removeCurrentUserFromCollaborationList(this)},discard(){return this.archive().then((()=>{this.routesToAcplV2||tn("discardAsArchive",`Asset.discard(): '${this.repoPath}' will be archived rather than discarded because it routes to ACPL v1 rather than V2.`);const e=()=>{this.isDiscarded&&this._hasArtifacts&&this.routesToAcplV2&&new kc(this._core).discardOutputsForAsset(this.id).then((()=>{this._hasArtifacts=!1,this.off(lt.type,e)}))};this.on(lt.type,e),this.isDiscarded&&this._hasArtifacts&&e()}))},links:{get:()=>({})},hasPermission(...e){this._core._environment.mobx.reportObserved(this,el.type);const t=!!this._permissions&&vc.prototype.hasPermission.apply(this,e);return this._hasLoadedPermissions||(this._hasLoadedPermissions=!0,this._core._AssetContextJS._rapi.resolveById(this.cloudID).then((async e=>{const t=new ra(this._core);return await e.getEffectivePermissions(t),t.data})).then((e=>{this._permissions=e,this.dispatch(el)}))),t},thumbnailURL:{get(){var e;return this._core._environment.mobx.reportObserved(this,Zc.type),this.isFolder||this.isLibraryElement?"":(!this._refreshThumbnail&&this._thumbnailInfo||(this._refreshThumbnail=!1,this._thumbnailStatus=mr.Fetching,this.getThumbnailRendition().then((({file:e,hash:t})=>{var i,s;if(this._thumbnailStatus=mr.Done,(null===(i=this._thumbnailInfo)||void 0===i?void 0:i.file)===e&&(null===(s=this._thumbnailInfo)||void 0===s?void 0:s.hash)===t)return;e=e.replace("#","%23").replace("^","%5E");const r=new URL(`file://${e}`);jr(r,{force:t}),this._thumbnailInfo={file:e,hash:t,url:r.href},this.dispatch(Zc)})).catch((()=>{this._thumbnailStatus=mr.Error,this._thumbnailInfo={},this.dispatch(Zc)}))),(null===(e=this._thumbnailInfo)||void 0===e?void 0:e.url)||"")}},thumbnailStatus:{get(){var e;return null!==(e=this._thumbnailStatus)&&void 0!==e?e:mr.NotStarted}},getRenditionURL(){return tn("getRenditionURL","SAM.cpp does not support all options of getRenditionURL. Clients that run on web and desktop should use AdobeAsset.thumbnailURL instead."),this.thumbnailURL},renditionURLStatus(){return this.thumbnailStatus},clearRenditionError(){this._thumbnailStatus===mr.Error&&(this._thumbnailStatus=mr.NotStarted,this._thumbnailInfo=void 0,this._refreshThumbnail=!0,this.dispatch(Zc))},_onAssetChanged(){this.dispatch(lt)},_onRenditionChanged(){this._refreshThumbnail=!0,this.dispatch(Zc)},transferToSpace(e){return this._core.hostAssetContext.transfer(this,e)},versions:{get(){if(this._assetVersionSource)return this._assetVersionSource;const e=new Xo(this._core,"version"),t=this._core._AssetContextJS._rapi.resolveById(this.id),i=new $o(e,t);return this._assetVersionSource=new Uo(e,[i],new Eo),this._assetVersionSource}},getCommentsResource(){return this._commentsResource||(this._commentsResource=new Wc(this._core,this.id)),this._commentsResource},hasArtifacts:{get(){return this._core._environment.mobx.reportObserved(this,"change"),this._hasArtifacts}}},defaultObservableEvent:lt.type})}(s),function(){const e=Qc().applicationAssetContext;Xc("gte","2.0.0-main.1524")&&Xc("lt","9999.9999.9999")?Object.defineProperties(Nc.prototype,{searchWorkingFiles:{value(){return this._searchWorkingFilesSource?Promise.resolve(this._searchWorkingFilesSource):(this._searchWorkingFilesSource=new Promise(((t,i)=>{e.spaceContext.lookupSpaceById(this.id).then((e=>{e||i(We.create(Be.NOT_FOUND,`searchWorkingFiles could not find Space ${this.id}`)),t(e.searchWorkingFiles())}))})),this._searchWorkingFilesSource)}},searchArtifacts:{value(t=!1){return this._searchArtifactsSource?Promise.resolve(this._searchArtifactsSource):(this._searchArtifactsSource=new Promise(((i,s)=>{e.spaceContext.lookupSpaceById(this.id).then((e=>{e||s(We.create(Be.NOT_FOUND,`searchArtifacts could not find Space ${this.id}`)),i(e.searchArtifacts(t))}))})),this._searchArtifactsSource)}}}):Xc("lt","2.0.0-main.1524")&&Object.defineProperties(Nc.prototype,{searchWorkingFiles:{async value(){const e=this._core._AssetContextJS,{_assetPool:t,_ussInterface:i}=e,s=await this._core.hostAssetContext.getAssetWithRepoPath(`${this.pathName}/working_files`,this.repositoryID),r=new Rc(t,this._core,s,i,"excludeArtifacts",!0),n=new Lc({asset:s,artifactFilter:"excludeArtifacts"});return new Uo(t,[r],n)}},searchArtifacts:{async value(e=!1){const t=this._core._AssetContextJS,{_assetPool:i,_ussInterface:s}=t,r=await this._core.hostAssetContext.getAssetWithCloudID(this.id),n=new Rc(i,this._core,r,s,"onlyArtifacts",e),o=new Lc({asset:r,artifactFilter:"onlyArtifacts",_includeHiddenRecursive:!0});return new Uo(i,[n],o)}}})}(),function(e){const t=Qc(),i=["refreshed","movedAsset","addedAsset","removedAsset"],s=t.applicationAssetContext.rootFolder.children.getList(xo.Descending,ko.Modified).constructor;Xc("lt","9999.9999.9999")&&Hs({klass:s,core:e,extensions:{loadNextPage(){return this.loadMoreItems()},refresh(){return this.load()},_addEventInterceptors(){this._onError||(this._onError=e=>{this._errors=this._errors||[],this._errors.push(e),this.dispatch(Co)},this.on("error",this._onError)),this._onListNotification||(this._onListNotification=qc((()=>{this._items=this[ks].items.call(this),this.dispatch(wo),this.dispatch(Co)}),Yc),i.forEach((e=>this.on(e,this._onListNotification)))),this._onStatusChange||(this._onStatusChange=()=>{this.status===co.Loading?this.dispatch(Co):this._onListNotification()},this.on("statusChanged",this._onStatusChange))},errors:{get(){return this._core._environment.mobx.reportObserved(this,Co.type),this._errors}}},overrides:{load(){this._errors=void 0,this.load.original(),this.dispatch(Co)},loadMoreItems(){this.loadMoreItems.original(),this.dispatch(Co)},items:{get(){return this._core._environment.mobx.reportObserved(this,wo.type),this._items||(this._items=this[ks].items.call(this)),this._items}}},observableMap:{[Co.type]:["status"]}})}(s),function(e){const t=Qc(),i={ascending:xo.Ascending,descending:xo.Descending},s={name:ko.Name,modified:ko.Modified,created:ko.Created,shared:ko.Shared},r=t.applicationAssetContext.rootFolder.children.constructor;Xc("lt","9999.9999.9999")&&Hs({klass:r,core:e,overrides:{getList(e,t){var r,n;let o,a;const c=e;null===(n=null!==(r=c.direction)&&void 0!==r?r:c.field)||void 0===n||n?(a=i[c.direction],o=s[c.field]):(a=e,o=t,t=void 0),a=a in xo?a:xo.Descending,o=o in ko?o:ko.Modified;const l=t;let d;return d=(null==l?void 0:l.mediaTypes)?this.getListWithTypes(a,o,[...l.mediaTypes]):this.getList.original(a,o),d._addEventInterceptors(),d}}})}(s),function(e){const t=Qc(),i=t.applicationAssetContext.constructor;if(Xc("lt","9999.9999.9999")){Hs({klass:i,core:e,overrides:{getAssetWithCloudID(e,t=!1){return this.getAssetWithCloudID.original(e,t)},getAssetWithAssetRefString(e,t=!1){return this.getAssetWithAssetRefString.original(e,t)}},extensions:{getUserRepoID(){return this._userRepoID?Promise.resolve(this._userRepoID):this._core._AssetContextJS._rapi.getHomeDirectoryMetadata().then((e=>(this._userRepoID=e["repo:repositoryId"],this._userRepoID)))},transfer(e,t){return(async()=>{let i;if(t instanceof Nc){const e=await t.getChild("working_files");if(!e)throw We.create(Be.NOT_FOUND,"unable to find working_files for provided space");i=e.id}else i=t.cloudID;let s=e.repositoryID,r=t.repositoryID;"~"===s&&(s=await this.getUserRepoID()),"~"===r&&(r=await this.getUserRepoID());const n={source:{assetId:e.cloudID,repositoryId:s},target:{assetId:i,repositoryId:r}};return this._core._AssetContextJS._assetTransferService.transfer(n)})()},assetPool:{get(){return tn("SAMCpp.ts _assetPool","AssetContext._assetPool is deprecated and will be removed on or after 2024-10-01. ItemPools are not for use by clients."),this._core._AssetContextJS._assetPool}},_assetPool:{get(){return this._core._AssetContextJS._assetPool}},isOnline:{get(){return void 0!==this.networkStatus?this.networkStatus!==zc.Offline:void 0}},recentAssetsSource:{get(){return this.recentsSource}},getRootFolder(){return Promise.resolve(this.rootFolder)},assetsHaveArtifacts:t=>(async()=>{if(t.some((e=>!e.routesToAcplV2)))return!1;const i=new kc(e),s=xc(t),r=await i.hasOutputs(s);return 0!==r.length&&(r.forEach((e=>{const i=t.find((t=>t.id===e["repo:assetId"]));i&&(i._hasArtifacts=!0,i.dispatch({type:"change"}))})),!0)})()},observableMap:{networkChanged:["networkStatus"],stateChanged:["cloudSyncStatus"]}});const s=({properties:e,status:t,previews:i})=>{var s,r;for(const i of[...e,...t])null===(s=i._onAssetChanged)||void 0===s||s.call(i);for(const e of i)null===(r=null==e?void 0:e._onRenditionChanged)||void 0===r||r.call(e)};t.applicationAssetContext._isForwardingAssetChangeEvents||(t.applicationAssetContext.on("changedAssets",s),t.applicationAssetContext._isForwardingAssetChangeEvents=!0)}}(s),u.length>0&&console.error("[initializeSharedAssetModel] SAM.cpp can only be observable by one instance of SAMCore. Clients using SAM.js internal version "+a+" will not see Mobx observables working. Clients on a host app should align on the same SAM.js version before shipping to customers."),s._setAssetContextFromBindings(p.applicationAssetContext).then((()=>{i(s)}))}catch(e){console.error("[initializeSharedAssetModel] failed to patch SAM.cpp",e),s(e)}}));else{const s=new Sl(e,t);f(s).then((()=>i(s)))}}));try{await o[a]}catch(e){throw delete o[a],e}return o[a]}Ye([wt],Sl.prototype,"getAssetContext",null),Ye([nt],Sl.prototype,"assetLinkManager",null),Ye([wt],Sl.prototype,"getSpaceContext",null),Ye([nt],Sl.prototype,"collaborationContext",null),Ye([wt],Sl.prototype,"getCollaborationContext",null),Ye([wt],Sl.prototype,"getClassroomContext",null),Ye([wt],Sl.prototype,"getBoardContext",null),Ye([nt],Sl.prototype,"frameioContext",null),Ye([nt],Sl.prototype,"getAccessControlContext",null);const Pl=(e,t)=>void 0!==Object.getOwnPropertyDescriptor(e,t),wl={scope:["creative_cloud"],asset_id_opacity:!0};class Cl extends pr{_getEndpointHref(e){return`https://${this._core._environment.endpoints.USS_HOST}${e}`}async getQueryResponse(e,t){e=Object.assign(Object.assign({},wl),e);const i=this._getEndpointHref("/universal-search/v2/search"),{PRODUCT_ID:s}=this._core._environment.getValue("HOST_PRODUCT_DATA");return(await this._doPost(i,{"Content-Type":"application/vnd.adobe.search-request+json","X-Product":s,"X-Product-Location":`SAM.js/${Ls.version}`},JSON.stringify(e),[200],!1,t)).json()}async searchSpace(e,t,i,s){var r,n,o,a;const c={hints:[{acp_platform_v2:!0,creative_cloud_rendition_v2:!0}],fetch_fields:{includes:["app_metadata","collaboration_metadata"]},sort_orderby:null!==(r=null==s?void 0:s.sort_orderby)&&void 0!==r?r:"modify_date",sort_order:null!==(n=null==s?void 0:s.sort_order)&&void 0!==n?n:"desc",limit:null!==(o=null==s?void 0:s.limit)&&void 0!==o?o:50,start_index:null!==(a=null==s?void 0:s.start_index)&&void 0!==a?a:0,[Rn.TYPE]:(null==s?void 0:s.type)||[],container:{asset_id:[e]}};return t?c.op_field_exists=[Ln]:c.op_none_of=[{op_field_exists:[Ln]},{[Rn.VISIBILITY]:["hiddenSelf","hiddenRecursive"]}],i&&c.fetch_fields.includes.push("_embedded"),this.getQueryResponse(c)}}class Rl extends pr{constructor(){super(...arguments),this._batchRequestLimit=50}get batchRequestLimit(){return this._batchRequestLimit}_getUrl(e){return`https://${this._core._environment.endpoints.INVITATIONS_HOST}${e}`}async getCollaborators(e){return await this._getSharedResponse(this._getUrl(`/api/v4/share/${encodeURIComponent(e)}?extraFeatures=direct_acl`))}async addCollaborators(e,t){const i=await this._doPost(this._getUrl(`/api/v4/share/${encodeURIComponent(e)}`),{},JSON.stringify(t),[200]),s=await i.json(),r={addedCollaborators:[],failedCollaborators:[]};for(const e of s.collaborators){if(201===e.statusCode){r.addedCollaborators.push(e.recipient);continue}let t=Be.BAD_REQUEST;switch(e.statusCode){case 403:t=Be.ACCESS_DENIED;break;case 409:t=Be.CONFLICT;break;case 500:t=Be.INTERNAL_ERROR}r.failedCollaborators.push({recipient:e.recipient,error:We.create(t,e.statusText)})}return r}async modifyCollaborators(e,t){const i=await this._doPatch(this._getUrl(`/api/v4/share/${encodeURIComponent(e)}?mode=direct_acl`),{},JSON.stringify(t),[200]);return await i.json()}async getCollaboratorListForUrns(e){const t={operation:"bulkGetShares",parameters:{urns:e,queryParams:{extraFeatures:"direct_acl,legacy_role"}}},i=await this._doPost(this._getUrl("/ops/v4/shares"),{"Content-Type":"application/json"},JSON.stringify(t),[200]),s=await i.json();if(!s.result||!Array.isArray(s.result))throw We.create(Be.UNKNOWN,"Failed to parse response for Invitation Service bulk API.");return s}async confirmAccess(e){await this._doPost(this._getUrl(`/api/v4/invitations/urn/${encodeURIComponent(e)}`),{},void 0,[200])}_shouldRetryMonitorResponse(e,t){return 200===e.status&&"completed"!==JSON.parse(t).jobStatus}async declineAccess(e){await this._doDelete(this._getUrl(`/api/v4/invitations/urn/${encodeURIComponent(e)}`),{},[200])}async getPendingInvitations(){const e=await this._doGet(this._getUrl("/api/v4/invitations"),{headers:{"Content-Type":"application/json"}});return await e.json()}async createAccessRequest(e,t,i){const s={operation:"bulkCreateAccessRequest",parameters:{urns:e,requestBody:Object.assign({notification:t},i?{requestedPermissions:i}:{})}},r=await this._doPost(this._getUrl("/ops/v4/shares"),{"Content-Type":"application/json"},JSON.stringify(s),[200]),n=await r.json(),o={successfulRequests:[],failedRequests:[]};for(const e of n.result){if(201===e.statusCode){o.successfulRequests.push(e.urn);continue}let t=Be.BAD_REQUEST;switch(e.statusCode){case 403:t=Be.ACCESS_DENIED;break;case 404:t=Be.NOT_FOUND}o.failedRequests.push({assetId:e.urn,error:We.create(t,e.response||"Access request failed"),response:e.response})}return o}}class Ll extends pr{constructor(){super(...arguments),this.repositoryIndex=`https://${this._core._environment.endpoints.ACP_CS_HOST}/index`,this.repositoryNameIndex=`https://${this._core._environment.endpoints.ACP_CS_HOST}/repositories`,this.workfrontRepositoryIndex=`https://${this._core._environment.endpoints.ACP_CS_HOST}/index-workfront`,this._useHighPriorityRequestsIfEnabled=!0,this._cache=this._core._environment.cache}get _fetchIndexState(){return this._core._fetchIndexState}set _fetchIndexState(e){this._core._fetchIndexState=e}_getAndCacheDocument(e){return this._getAllPages(e)}_getIndexHeaders(){return{"Cache-Control":"no-cache, no-store, max-age=0",directive:"index-skip-repo-regions"}}_getRepositoryHref(e){return`https://${this._core._environment.endpoints.ACP_CS_HOST}/content/repo/${e}/repositoryResource`}async getRootLink(e,t={}){return It((await this.getIndex())._links,e,t)}async getIndex(){var e,t;const i=this._fetchIndexState;if(i.pendingCacheClear&&await i.pendingCacheClear,i.response&&i.hasChildren)return i.response;const s=await this._cache.getItem(this.repositoryIndex);if(s!==Ti&&(i.response=s,i.hasChildren=Boolean(null===(t=null===(e=i.response)||void 0===e?void 0:e.children)||void 0===t?void 0:t.length)),i.promise||(i.promise=new Promise(((e,t)=>{this._getResponse(this.repositoryIndex,{headers:this._getIndexHeaders(),additionalRetryErrorCodes:[404]}).then((async t=>{var s;(null===(s=t.children)||void 0===s?void 0:s.length)?(await this._cache.setItem(this.repositoryIndex,t),i.hasChildren=!0):(i.hasChildren=!1,i.promise=void 0),i.response=t,e(t)})).catch(t)}))),i.promise&&(!i.response||!i.hasChildren))try{await i.promise}catch(e){throw i.promise=void 0,e}return i.response}async getWorkfrontIndex(e){return await this._getResponse(this.workfrontRepositoryIndex,{headers:Object.assign(Object.assign({},this._getIndexHeaders()),{"Org-Id":e}),additionalRetryErrorCodes:[404]})}_clearIndexCache(){this._fetchIndexState.pendingCacheClear=new Promise((e=>{Promise.resolve(this._fetchIndexState.promise).finally((()=>this._cache.deleteItem(this.repositoryIndex))).finally((()=>{this._fetchIndexState={},e()}))}))}async _getAndCacheLinksFromHref(e){const t=await this._doGet(e),{_links:i}=await t.json();return{links:i}}getAssetResolveByIdHref(e){const t=new URL(`https://${this._core._environment.endpoints.ACP_CS_HOST}/links`);return jr(t,{assetId:e}),t.toString()}async getCloudQuotaUsedAndMax(){const e=It((await this.getHomeDirectoryMetadata())._links,yt.QUOTA),t=await this._getResponse(e);return{used:t["storage:bytesUsed"],total:t["storage:bytesLimit"]}}async resolveById(e){const t=this.getAssetResolveByIdHref(e),{links:i}=await this._getAndCacheLinksFromHref(t);return new Zr(this,e,i,"")}async getRepoMetadataById(e,t,i){const s=i&&i[yt.REPO_METADATA]?It(i,yt.REPO_METADATA):await this.getRootLink(yt.RESOLVE_ID,{id:e});return await this._doGet(s,{resource:t}),t.data}async getRepoMetadataByPath(e,t,i,s){const r=s&&s[yt.REPO_METADATA]?It(s,yt.REPO_METADATA):await this.getRootLink(yt.RESOLVE_PATH,{repositoryId:e,path:t,mode:"id"});return await this._doGet(r,{resource:i}),i.data}async getHomeDirectoryMetadata(){return await this._getHomeDirectoryMetadata(0)}async _getHomeDirectoryMetadata(e){var t;let i=await this.getIndex();const s=this._core._environment.getValue("FEATURE_FLAGS");if((null==s?void 0:s["enable-response-cache"])&&0===e||(i=await(null!==(t=this._fetchIndexState.promise)&&void 0!==t?t:i)),!i.children.length){if(e>=5)throw We.create(Be.INVALID_OPERATION,"Home repository not found after 5 retries");return this._core._environment.log(`/index has no children, ${5-e} retries left`),await new Promise((t=>setTimeout(t,this._getRetryErrorDelay(void 0,e)))),await this._getHomeDirectoryMetadata(e+1)}return i.children[0]._embedded[yt.REPO_METADATA]}async runOperation(e){var t,i,s;const r=await this.getRootLink(yt.OPS),n={"Content-type":"application/vnd.adobe.asset-operation+json",Prefer:"respond-async, wait=5"},o=Array.isArray(e)?e[0]:e;"copy"===(null==o?void 0:o.op)&&(n.directive="ops-2021");const a="move"===(null==o?void 0:o.op),c=this._core._environment.getValue("FEATURE_FLAGS");a&&(null==c?void 0:c["enable-x-bucket-move"])&&(n["enable-x-bucket-move"]="true");const l=await this._doPost(r,n,JSON.stringify(e),"any");let d;try{d=await l.json()}catch(e){}if(d&&!Array.isArray(d)&&200!==l.status)return[Object.assign(Object.assign({},o),{error:We.createWithRepositoryCode(l.status,null!==(t=d.type)&&void 0!==t?t:Ge.OPERATION_FAILED,null!==(s=null!==(i=d.title)&&void 0!==i?i:d.message)&&void 0!==s?s:"Operation failed")})];if(this._checkResponseStatus(l,r,[200]),!d)throw We.create(Be.UNKNOWN,"Failed to parse response for repo bulk API.");return(Array.isArray(d)?d:[d]).map((e=>{const{error:t}=e;return Object.assign(Object.assign({},e),{error:t?We.createWithRepositoryCode(t.status,t.type,t.title):void 0})}))}_chunkArray(e,t){const i=[];for(let s=0;s<e.length;s+=t)i.push(e.slice(s,s+t));return i}_combineOperationResults(e){const t={failedResults:[],newModels:[]};for(const i of e)t.failedResults.push(...i.failedResults),t.newModels.push(...i.newModels);return t}async runOperationsForContext(e,t,i,s,r){const n=Array.isArray(e)?e:[e],o=this._chunkArray(n,50).map((e=>this._runOperationsForContextBatch(e,t,i,s,r))),a=await Promise.all(o);return this._combineOperationResults(a)}async _runOperationsForContextBatch(e,t,i,s,r){var n;const o=await this.runOperation(e),a={failedResults:[],newModels:[]},c=i.createMutationSession(),l=[];for(const e of o){const i=e.id&&t.get(e.id);if(!i)continue;const{asset:o,error:d}=e;if(d){if(r){const e=null===(n=r.find((e=>e.match(d))))||void 0===n?void 0:n.action;if(e){l.push(e(i,d).then((e=>{e&&a.failedResults.push(e)})));continue}}a.failedResults.push({model:i,error:d})}else try{const e=s(c,i,o);e&&a.newModels.push(e)}catch(e){const t=e;if(!t||t.code!==Be.UNKNOWN)throw e;a.failedResults.push({model:i,error:t})}}return c.commit(),await Promise.all(l),a}async getRepositoriesData(){return await this._cache.getItem(this.repositoryNameIndex,(()=>this._getResponse(this.repositoryNameIndex)),void 0,2592e6)}async getRepositoryName(e){var t,i;const s=await this.getRepositoriesData();if(!s)return;const r=s.children.find((t=>t._embedded[yt.PRIMARY]["repo:repositoryId"]===e));return null===(i=null===(t=null==r?void 0:r._embedded[yt.PRIMARY]["dc:title"])||void 0===t?void 0:t["rdf:_1"])||void 0===i?void 0:i["@value"]}async getStorageAssignee(e){const t=(await this.getRepositoriesData()).children.find((t=>t._embedded[yt.PRIMARY]["repo:repositoryId"]===e));return(null==t?void 0:t._embedded[yt.PRIMARY]["storage:assignee"])?null==t?void 0:t._embedded[yt.PRIMARY]["storage:assignee"]:void 0}async getRepoOwnerMap(e){let t=await this.getRepositoriesData(),i=new Map(t.children.map((e=>{const t=e._embedded[yt.PRIMARY]||{};return[t["repo:repositoryId"],t["repo:owner"]]})));return e&&!i.has(e)&&(await this._cache.deleteItem(this.repositoryNameIndex),t=await this.getRepositoriesData(),i=new Map(t.children.map((e=>{const t=e._embedded[yt.PRIMARY]||{};return[t["repo:repositoryId"],t["repo:owner"]]})))),i}async getAssetLinks(e){const t=this.getAssetResolveByIdHref(e),{_links:i}=await this._getResponse(t);return i}async getRepositoryLinks(e){const t=this._getRepositoryHref(e),{_links:i}=await this._getResponse(t);return i}async createFolderByPath(e,t,i=!0,s){const r=It(null!=s?s:await this.getRepositoryLinks(t),yt.CREATE,{path:e,intermediates:i,respondWith:yt.REPO_METADATA});return(await this._doPost(r,{"Content-Type":Br},void 0,[200,201])).json()}}Ye([rt,Qe(0,it)],Ll.prototype,"_getAndCacheDocument",null),Ye([rt,Qe(0,it)],Ll.prototype,"_getAndCacheLinksFromHref",null),Ye([wt],Ll.prototype,"getRepositoriesData",null),Ye([rt,Qe(0,it)],Ll.prototype,"getRepositoryLinks",null);const Nl="firstLongPollStarted",Dl="firstLongPollCompleted",Ml="onsMonitoringStatusChanged";var xl;!function(e){e[e.Unknown=0]="Unknown",e[e.Inactive=1]="Inactive",e[e.Restarting=2]="Restarting",e[e.Active=3]="Active",e[e.Error=4]="Error"}(xl||(xl={}));class kl extends ct{constructor(e){super(),this.changedAssets=e}}class Hl extends Event{constructor(e){super(Nl),this.cachedSubscriptionsUsed=e}}class jl extends Event{constructor(e){super(Dl),this.expired=e}}class Ul extends Event{constructor(e){super(Ml),this.status=e}}function Bl(e){(null==e?void 0:e.find((e=>e===Br)))&&e.push(Fr)}const Fl={orderDirection:"descending",orderBy:"shared_date",start:0,limit:0};class Vl extends pr{async getSharedByMeAssets(e,t){Bl((t=Object.assign(Object.assign({},Fl),t)).type);const i={hints:{acp_platform_v2:!0},fetch_fields:{includes:["collab_metadata$$collaborators"]},"storage:assignee$$type":["user"],op_none_of:[{"app_metadata$$shell:visibility":"hiddenSelf"}],parent_id:[e],[Rn.TYPE]:t.type||[],sort_orderby:t.orderBy,sort_order:(s=t,"ascending"===s.orderDirection?"asc":"desc"),limit:t.limit,start_index:t.start};var s;return await this._core.hostAssetContext._ussInterface.getQueryResponse(i)}}const Kl={orderDirection:"descending",orderBy:"shared_date",start:0,limit:0,mediaTypes:[],excludeMediaTypes:[]};class Gl extends pr{async getSWYAssets(e,t){Bl((e=Object.assign(Object.assign({},Kl),e)).mediaTypes),e.excludeMediaTypes=[...new Set(e.excludeMediaTypes.concat(Br))],Bl(e.excludeMediaTypes);const i={shared_via_invite:!0,hints:{acp_platform_v2:!0},fetch_fields:{includes:Ki()},op_none_of:[{op_field_exists:["app_metadata$$cc:inheritable$$cc:team$$repo:assetId","app_metadata$$cc:inherited$$cc:space$$repo:assetId","app_metadata$$cc:inheritable$$cc:space$$repo:assetId"]},{[Rn.VISIBILITY]:["hiddenSelf","hiddenRecursive"]},{[Rn.CREATIVE_CLOUD_TOPLEVEL_COLLECTION_NAME]:"appdata"},{[Rn.TYPE]:e.excludeMediaTypes||[]},{[Rn.STORAGE_ASSIGNEE_ID]:this._core._environment.getValue("USER_ID")},...xn()],[Rn.TYPE]:e.mediaTypes||[],sort_orderby:e.orderBy,sort_order:(s=e,"ascending"===s.orderDirection?"asc":"desc"),limit:e.limit,start_index:e.start};var s;return e.embedPermissions&&i.fetch_fields.includes.push("_embedded"),await this._core.hostAssetContext._ussInterface.getQueryResponse(i,t)}}const $l={orderDirection:io.Descending,orderBy:eo.Modified,start:0,limit:0};class Wl extends pr{async getFilteredAssets(e){var t,i;Bl((e=Object.assign(Object.assign({},$l),e)).mediaTypes),Bl(e.excludeMediaTypes);const s=[{[no.NOT]:{funcParams:Object.assign({[ro.SHELL_VISIBILITY]:["hiddenSelf","hiddenRecursive"]},(null===(t=e.excludeMediaTypes)||void 0===t?void 0:t.length)?{[ro.MEDIA_TYPE]:e.excludeMediaTypes}:{})}}];(null===(i=e.mediaTypes)||void 0===i?void 0:i.length)&&s.push({[ro.MEDIA_TYPE]:e.mediaTypes}),e.deepSearch?s.push({[ro.REPO_ANCESTORS]:e.assetId}):s.push({[ro.PARENT_ID]:e.assetId});const r=e.userId,n=e.uploadedFrom;return r&&s.push({[ro.STORAGE_ASSIGNEE_ID]:r}),n&&(s.push({[ro.CREATED_FROM_UPLOAD]:!0}),"ALL"!==n&&s.push({[ro.CREATED_BY_CLIENT_ID]:n})),s.push(lo()),await this._core.hostAssetContext.__ussInterfaceV3.getQueryResponse(Object.assign(Object.assign({start:e.start,sorts:[{sortOrderBy:e.orderBy,sortOrder:e.orderDirection}],limit:e.limit},e.query?{textQuery:e.query}:{}),{filters:s}))}}const zl={orderDirection:"descending",orderBy:"modify_date",start:0,limit:0};class ql extends pr{async getFilteredAssets(e){Bl((e=Object.assign(Object.assign({},zl),e)).mediaTypes),Bl(e.excludeMediaTypes);const t=Object.assign({hints:{acp_platform_v2:!0},fetch_fields:{includes:Ki()},[Rn.STORAGE_ASSIGNEE_TYPE]:["user"],op_none_of:[{op_field_exists:["app_metadata$$cc:inheritable$$cc:space$$repo:assetId","app_metadata$$cc:inherited$$cc:space$$repo:assetId"]},{[Rn.VISIBILITY]:["hiddenSelf","hiddenRecursive"]},{[Rn.CREATIVE_CLOUD_TOPLEVEL_COLLECTION_NAME]:"appdata"},{[Rn.TYPE]:e.excludeMediaTypes||[]}],op_or:[{[Rn.STORAGE_ASSIGNEE_ID]:this._core._environment.getValue("USER_ID")},{[Rn.SHARED_VIA_INVITE]:!0}],[Rn.TYPE]:e.mediaTypes||[],sort_orderby:e.orderBy,sort_order:(i=e,"ascending"===i.orderDirection?"asc":"desc"),limit:e.limit,start_index:e.start},e.query?{q:e.query}:{});var i;return e.embedPermissions&&t.fetch_fields.includes.push("_embedded"),await this._core.hostAssetContext._ussInterface.getQueryResponse(t)}}const Yl={start:0,limit:0,mediaTypes:[],excludeMediaTypes:[]};class Ql extends pr{_getCommonFilters(e){e=Object.assign(Object.assign({},Yl),e);const{uploadedFrom:t}=null!=e?e:{};Bl(e.mediaTypes),Bl(e.excludeMediaTypes),e.excludeMediaTypes=Array.from(new Set(["application/x-sharedcloud-collection+json",...e.excludeMediaTypes||[]]));const i={hints:{acp_platform_v2:!0},fetch_fields:{includes:Ki()},sort_order:"desc",limit:e.limit,start_index:e.start,[Rn.TYPE]:e.mediaTypes||[],op_none_of:[{[Rn.FIELD_EXISTS]:["app_metadata$$cc:inheritable$$cc:space$$repo:assetId","app_metadata$$cc:inherited$$cc:space$$repo:assetId","app_metadata$$cc:inheritable$$cc:team$$repo:assetId"]},{[Rn.VISIBILITY]:["hiddenSelf","hiddenRecursive"]},{[Rn.CREATIVE_CLOUD_TOPLEVEL_COLLECTION_NAME]:["appdata"]},{[Rn.TYPE]:e.excludeMediaTypes||[]},{[Rn.CREATIVE_CLOUD_TOPLEVEL_COLLECTION_NAME]:"pubs"},{[Rn.OP_AND]:[{[Rn.CREATIVE_CLOUD_TOPLEVEL_COLLECTION_NAME]:"cloud-content"},{[Rn.FIELD_EXISTS]:["app_metadata$$review:sourceAsset$$dc:format"]}]},...xn()]};if(e.embedPermissions&&i.fetch_fields.includes.push("_embedded"),t&&(i.op_and=[],i.op_and.push({[Rn.CREATED_FROM_UPLOAD]:!0})),t&&Array.isArray(t)){const e=i.op_and.push({[Rn.OP_OR]:[]});t.forEach((t=>{i.op_and[e-1][Rn.OP_OR].push({[Rn.CREATED_BY_CLIENT_ID]:t})}))}return t&&!Array.isArray(t)&&"ALL"!==t&&i.op_and.push({[Rn.CREATED_BY_CLIENT_ID]:t}),i}async getRecentAssets(e){const t=this._getCommonFilters(e),{userId:i}=null!=e?e:{};t.sort_orderby="modify_date";const s={[Rn.STORAGE_ASSIGNEE_ID]:null!=i?i:this._core._environment.getValue("USER_ID")};return i?(t.op_and||(t.op_and=[]),t.op_and.push(s)):(t.op_or||(t.op_or=[]),t.op_or.push(s),t.op_or.push({[Rn.SHARED_VIA_INVITE]:!0})),await this._core.hostAssetContext._ussInterface.getQueryResponse(t)}async getMRUAssets(e){const t=this._getCommonFilters(e);t.fetch_fields.includes.push(Nn);const{userId:i}=null!=e?e:{};return i&&(t.op_and||(t.op_and=[]),t.op_and.push({[Rn.STORAGE_ASSIGNEE_ID]:i})),t.sort_orderby=Nn,t.op_field_exists=[Nn],await this._core.hostAssetContext._ussInterface.getQueryResponse(t)}}class Jl extends pr{async transfer(e){const t=await this.discoverLinks(),i=await this._doPost(It(t,yt.ATS_MOVE),{"Content-Type":"application/json"},JSON.stringify(e),[200]),s=await i.json();if(s.status&&200!==s.status)throw We.createWithResponse(i);return s.assetId}async discoverLinks(){return(await this._getResponse(this.getUrl("/")))._links}getUrl(e){return`https://${this._core._environment.endpoints.TRANSFER_SERVICE_HOST}${e}`}}class Xl{constructor(e,t,i,s){this._core=t,this._recentInterface=i,this._implicitFilter=s,this._ussLoaderHelper=new Cc(e,t,this)}supportsFilter(e){return void 0!==e}async loadPage(e){return this._libraryContext||(this._libraryContext=await this._core.getLibraryContext()),this._ussLoaderHelper.loadPage(e)}async _getUSSResults({start:e,loadOptions:t,mediaTypes:i,excludeMediaTypes:s,filter:r}){const n={start:e,limit:null==t?void 0:t.limit,mediaTypes:i,excludeMediaTypes:s,embedPermissions:!0};if(r.name===Zn){const e=r;n.userId=e.userId,n.uploadedFrom=e.uploadedFrom}return this._recentInterface.getRecentAssets(n)}_postProcessPage(e,t){const{items:i}=t;i.length&&(this._implicitFilter._lastModificationDate=i[i.length-1].modified)}}class Zl extends kn{constructor(){super({_isSharedWithYou:!0})}matches(e){return!e.isFolder&&!(this._lastModificationDate&&e.modified<this._lastModificationDate)&&super.matches(e)}}async function ed(e,t,i,s,r){const n=[],o=[];if(e.failedResults.forEach((e=>{e.error.code===Be.CONFLICT?n.push(e.model):o.push(e)})),n.length){for(const[e,t]of s)s.set(e,{newName:t.newName,countUsed:t.countUsed+1});const a=await r(n,t,i,!0,s);return a.failedResults=[...a.failedResults,...o],a.newModels=[...a.newModels,...e.newModels],a}return e}class td extends kn{constructor(){super({_isSharedWithYou:!0})}matches(e){return!e.isFolder&&void 0!==e.lastAccessed&&super.matches(e)}}const id="library_data_changed",sd=new class extends ot{constructor(){super(id)}},rd="restrict_edit_changed",nd=new class extends ot{constructor(){super(rd)}};class od extends ur{constructor(e,t,i){super(e,{parseResponse:async e=>await e.blob(),skipRevalidation:()=>!0}),this._core=e,this._parent=t,this._renditionUrl=i}get renditionUrl(){return this._renditionUrl}async _loadData(){return this._parent._getLibraryInterface().getRenditionTileImage(this)}}class ad extends Rs{constructor(e,t,i){super(),this._library=i,this._index=-1,this._core=this._library._core,this.type=e.type,this._index=t,"href"===this.type?(this._renditionUrl=e.rendition,this._renditionTileBlobHelper=new Fo,this._renditionFetcher=new Or(this._core,[200],(async()=>{const e=new od(this._core,this._library,this._renditionUrl);return this._renditionTileBlobHelper.fetch(e)})),this._renditionFetcher.on("change",(()=>{this.dispatch({type:"change"})}))):(this._renditionData=e.rendition,this.mimetype=e.rendition_mimetype),this.elementId=e.elementId,this.elementType=e.elementType}get imageUrl(){if("href"!==this.type)throw We.create(Be.UNKNOWN,"Cannot fetch rendition for non-image renditions");return this._renditionFetcher.getURL(200,gr.PNG,this._renditionUrl)}get data(){if("href"!==this.type)return"object"==typeof this._renditionData?this._renditionData:(console.warn("Rendition data is not an object, returning default value."),{});throw We.create(Be.UNKNOWN,"Cannot get data for image renditions")}get imageStatus(){return this._renditionFetcher.renditionURLStatus(200,gr.PNG,this._renditionUrl)}_releaseRenditions(){this._renditionFetcher&&this._renditionFetcher.release()}}Ye([ht],ad.prototype,"imageUrl",null),Ye([ht],ad.prototype,"imageStatus",null);class cd extends pr{_getMelvilleUrl(e){return`https://${this._core._environment.endpoints.MELVILLE_HOST}${e}`}async searchCustomModelsUsingPageLink(e,t){const[i,s]=Ta(t.href),r=Object.assign({"Cache-Control":"no-cache, no-store, max-age=0","Content-Type":"application/json"},s),n=this._getMelvilleUrl(i),o=await this._doPost(n,r,JSON.stringify(e),[200]);return await o.json()}async searchCustomModels(e,t){if((null==e?void 0:e.limit)&&void 0===(null==e?void 0:e.start))throw We.create(Be.BAD_REQUEST,"[Melville] If limit is provided, start must also be provided.");e=ld(e);const i=Tt(this._getMelvilleUrl("/api/v1/search/custom-models"),e),[s,r]=Ta(i),n=Object.assign(Object.assign({},{"Cache-Control":"no-cache, no-store, max-age=0","Content-Type":"application/json"}),r),o=await this._doPost(s,n,JSON.stringify(t),[200]);return await o.json()}async getCustomModels(e){if((null==e?void 0:e.limit)&&void 0===(null==e?void 0:e.start))throw We.create(Be.BAD_REQUEST,"[Melville] If limit is provided, start must also be provided.");e=ld(e);const t=Tt(this._getMelvilleUrl("/api/v1/custom-models"),e),[i,s]=Ta(t),r=Object.assign(Object.assign({},{"Cache-Control":"no-cache, no-store, max-age=0"}),s);return await this._getResponse(i,{headers:r})}async getCustomModelById(e){return await this._getResponse(this._getMelvilleUrl(`/api/v1/custom-models/${e}`),{headers:{"Content-Type":"application/json"}})}async getCustomModelsUsingPageLink(e){const[t,i]=Ta(this._getMelvilleUrl(e.href));return this._getResponse(t,{headers:i})}async createTrainingSet(e){const t=e["firefly#cme"]||e["firefly#ffmodel"];if(!e.name)throw We.create(Be.BAD_REQUEST,"Invalid argument: missing required name");if(!e.projectId)throw We.create(Be.BAD_REQUEST,"Invalid argument: missing required projectId. The parent must be a project");if(!t.schemaVersion)throw We.create(Be.BAD_REQUEST,"Invalid argument: missing required schemaVersion.");if(!t.trainingMode)throw We.create(Be.BAD_REQUEST,"Invalid argument: missing required trainingMode.");const i={name:e.name,parent_assetId:e.projectId,roles:[{type:"cm_training_set"}],"firefly#cme":Object.assign(Object.assign({},t),{version:t.schemaVersion})};return(await this._core.getLibraryContext())._createLibrary(i)}async getTrainingSetById(e){return(await this._core.getLibraryContext())._getLibraryRemotely(e,{selectors:["details"]})}async createCustomModel(e){return(await this._doPost(this._getMelvilleUrl("/api/v1/custom-models"),{"Content-Type":"application/json"},JSON.stringify(e),[201])).json()}async updateCustomModel(e,t){const i=`/api/v1/custom-models/${e}`;await this._doPut(this._getMelvilleUrl(i),{"Content-Type":"application/json"},JSON.stringify(t),[204,201,200])}async deleteCustomModel(e){const t=`/api/v1/custom-models/${e}`;await this._doDelete(this._getMelvilleUrl(t),{"Content-Type":"application/json"},[204])}async discardCustomModel(e){await this._doPost(this._getMelvilleUrl(`/api/v1/custom-models/${e}/discard`),{"Content-Type":"application/json"},"",[204])}async restoreCustomModel(e){await this._doPost(this._getMelvilleUrl(`/api/v1/custom-models/${e}/restore`),{"Content-Type":"application/json"},"",[204])}async publish(e){const t=`/api/v1/custom-models/${e}/publish`,i=await this._doPost(this._getMelvilleUrl(t),void 0,void 0,[200]);return await i.json()}async unpublish(e){const t=`/api/v1/custom-models/${e}/unpublish`,i=await this._doPost(this._getMelvilleUrl(t),void 0,void 0,[200]);return await i.json()}}const ld=e=>Object.fromEntries(Object.entries(e).map((([e,t])=>Array.isArray(t)?[e,t.sort()]:[e,t])).sort());function dd(e){return e.isCustomModel}class ud extends vc{constructor(e,t,i){super(e,t,i),this._core=e,this.isCustomModel=!0,this._displayName="",this._conceptId="",this._trainingMode="",this._compression="",this._schemaVersion="",this._customModelInterface=new cd(this._core)}async trainingSet(){const e=await this._core.getLibraryContext();return await e.getLibraryByAssetId(this.trainingSetInfo.id)}async permanentlyDelete(){await this._customModelInterface.deleteCustomModel(this.id);const e=this._core.hostAssetContext._assetPool,t=e.createUpdateSession("Delete Custom Model");t.queueDiscardedItem(this),t.commit(),e.removeLocalItems([this.id])}async discard(){if(this.isDiscarded)throw We.create(Be.INVALID_OPERATION,"Asset is already discarded");await this._customModelInterface.discardCustomModel(this.id);const e=(await this._core.getCustomModelContext())._assetPool.createUpdateSession("discard custom model");(await this._core.getAssetContext())._adobeAssetUpdater.updateLocalItem(e,this,{"repo:state":"DISCARDED"}),e.commit()}async restore(){if(!this.isDiscarded)throw We.create(Be.INVALID_OPERATION,"Cannot restore an asset that is not discarded");const e=await this._core.getAssetContext();await this._customModelInterface.restoreCustomModel(this.id);const t=this._core._getAssetPool().createUpdateSession("restore custom model");e._adobeAssetUpdater.updateLocalItem(t,this,{"repo:state":"ACTIVE"}),t.commit()}async publish(){if("published"===this.publishedState)return;const e=await this._customModelInterface.publish(this.id),t=await this._core.getCustomModelContext(),i=t._assetPool.createUpdateSession();t._customModelUpdaterMelville.updateRemoteItem(i,e),i.commit()}async unpublish(){if("unpublished"===this.publishedState)return;const e=await this._customModelInterface.unpublish(this.id),t=await this._core.getCustomModelContext(),i=t._assetPool.createUpdateSession();t._customModelUpdaterMelville.updateRemoteItem(i,e),i.commit()}get displayName(){return this._displayName}get inferenceReady(){return this.appMetadata.data["cme:inferenceReady"]}get publishedState(){return this.appMetadata.data["cme:publishedState"]}get category(){return this.appMetadata.data["cme:category"]}get signature(){return this.appMetadata.data["cme:signature"]}get baseModelName(){var e;return null===(e=this.appMetadata.data["cme:baseModel"])||void 0===e?void 0:e.name}get baseModelVersion(){var e;return null===(e=this.appMetadata.data["cme:baseModel"])||void 0===e?void 0:e.version}get trainingInfo(){return{trainingState:this.appMetadata.data["cme:training"].state,progress:this.appMetadata.data["cme:training"].progress,jobId:this.appMetadata.data["cme:training"].jobId,errorMessage:this.appMetadata.data["cme:training"].errorMessage,errorCode:this.appMetadata.data["cme:training"].errorCode,links:this.appMetadata.data["cme:training"].links}}get trainingSetInfo(){return{id:this.appMetadata.data["cme:trainingSet"]["repo:assetId"],version:this.appMetadata.data["cme:trainingSet"]["repo:version"]}}get samplePrompt(){return this.appMetadata.data["cme:samplePrompt"]}get renditionUrl(){return super.getRenditionURL(yr)}get conceptId(){return this._conceptId}get trainingMode(){return this._trainingMode}get baseModelSuperclass(){return this._baseModelSuperclass}get deltaWeightsID(){return this._deltaWeightsID}get contentType(){return this._contentType}get compression(){return this._compression}get schemaVersion(){return this._schemaVersion}get hasDefaultGeneratorPermissions(){return this.hasPermission(Gi.Read)&&!this.hasPermission(Gi.Write)&&!this.hasPermission(Gi.WriteComment)}async update(e){const t=Object.keys(e).filter((e=>ss.includes(e)));if(t.length)throw We.create(Be.UNSUPPORTED,`Update keys are unsupported: [${t}]. Use CustomModel.patchAppMetadata`);const i=await this._core.getCustomModelContext();await i.updateCustomModel(this.id,e)}patchAppMetadata(e){const t=e.map((e=>e.path)).filter((e=>!ss.includes(e.substring(1))));if(t.length)throw We.create(Be.UNSUPPORTED,`Patch paths are unsupported: [${t}]. Use "CustomModel.update"`);return super.patchAppMetadata(e)}}Ye([nt,ht],ud.prototype,"trainingSet",null),Ye([ht],ud.prototype,"displayName",null),Ye([ht],ud.prototype,"inferenceReady",null),Ye([ht],ud.prototype,"publishedState",null),Ye([ht],ud.prototype,"category",null),Ye([ht],ud.prototype,"baseModelName",null),Ye([ht],ud.prototype,"baseModelVersion",null),Ye([ht],ud.prototype,"trainingInfo",null),Ye([ht],ud.prototype,"trainingSetInfo",null),Ye([ht],ud.prototype,"samplePrompt",null),Ye([ht],ud.prototype,"renditionUrl",null),Ye([ht],ud.prototype,"conceptId",null),Ye([ht],ud.prototype,"trainingMode",null),Ye([ht],ud.prototype,"deltaWeightsID",null),Ye([ht],ud.prototype,"contentType",null),Ye([ht],ud.prototype,"compression",null),Ye([ht],ud.prototype,"schemaVersion",null);const hd=new vn({localItemType:ud,remoteIdProperty:"repo:assetId",propertyUpdater:new Cn({"_appMetadata._data":{name:"application_metadata",format:"object_subset",set:(e,t)=>{t.appMetadata._mergeData(e)}},_displayName:{name:"repo:name",format:{parse:e=>{const t=e.lastIndexOf(".");return e.slice(0,t)},isEqual:cs}},_conceptId:{name:"firefly#ffmodel",format:{parse:e=>e.conceptId,isEqual:cs}},_contentType:{name:"firefly#ffmodel",format:{parse:e=>e.contentType,isEqual:cs}},_trainingMode:{name:"firefly#ffmodel",format:{parse:e=>e.trainingMode,isEqual:cs}},_baseModelSuperclass:{name:"firefly#ffmodel",format:{parse:e=>e.baseModelSuperclass,isEqual:cs}},_deltaWeightsID:{name:"firefly#ffmodel",format:{parse:e=>e.deltaWeightsID,isEqual:cs}},_compression:{name:"firefly#ffmodel",format:{parse:e=>e.compression,isEqual:cs}},_permissions:{get:function(e){return void 0!==e.asset_acl?Wi(e.asset_acl):On},format:"number"},_schemaVersion:{name:"firefly#ffmodel",format:{parse:e=>e.schemaVersion,isEqual:cs}},__links:{name:"_links",format:"object"},_name:"repo:name",_path:"repo:path",_created:{name:"repo:createDate",format:"date_as_number"},_modified:{name:"repo:modifyDate",format:"date_as_number"},_createdBy:"repo:createdBy",_version:"version",_etag:"repo:etag",_storageRegion:"storage:region",_size:{name:"repo:size",format:"number"}})});class pd extends kn{constructor(e={}){const{trainingSetId:t,generatorOnly:i}=e;super(qe(e,["trainingSetId","generatorOnly"])),this._trainingSetId=t,this._generatorOnly=i}matches(e){return!!dd(e)&&(!this._trainingSetId||this._trainingSetId===e.trainingSetInfo.id)&&!(this._generatorOnly&&!e.hasDefaultGeneratorPermissions)&&super.matches(e)}}class _d{constructor(e,t,i){this._assetPool=e,this._core=t,this._libraryId=i}async loadPage(){return await this._loadPage()}async _loadPage(){const e=await this._core.getLibraryContext(),t=await e._libraryInterface.getLibraryData(this._libraryId),i=this._core._environment.getValue("USS_LIST_UPDATE_LATENCY"),s=Date.now()-i,r=this._assetPool.createLoaderUpdateSession(s);e._libraryUpdater.updateRemoteItem(r,t),r.commit();let n=[];if(t.roles.some((e=>"cm_training_set"===e.type))){const e=t.custom_models;if(!e)return{items:n,total:0};const i=this._assetPool.createLoaderUpdateSession(s);n=hd.updateRemoteItems(i,e),i.commit()}return{items:n,total:n.length}}}function md(e){return e.isLibrary}class fd extends vc{constructor(e,t,i){super(e,t,i),this._core=e,this.isLibrary=!0,this._libraryInterface=new Sa(this._core),this._libraryDataLoadInfo={state:"NOT_LOADED"},this._type="application/vnd.adobe.library+dcx",this._needsRepoMetadata=!0,on.manageLazyLoading(this,[{event:nd,fetchData:this._refreshEditingRestricted}])}_getLibraryInterface(){return this._libraryInterface}async getContents(){if(!this._contents||!this._contents.deref()){const e=await this._core.getLibraryContext(),t=await e._getLibrariesModule();this._contents=new WeakRef(t.getLibraryContents(this))}return this._contents.deref()}_getContentsSync(){if(!this._contents||!this._contents.deref()){const e=this._core._getLibraryContext()._getLibrariesModule_NoLoad();this._contents=new WeakRef(e.getLibraryContents(this))}return this._contents.deref()}get _libraryLoaded(){return"LOADED"===this._libraryDataLoadInfo.state}_setLibraryLoadState(e){const{state:t}=this._libraryDataLoadInfo;if(e!==t)if(this._libraryDataLoadInfo.state=e,"LOADED"===e)this._libraryDataLoadInfo.resolve&&this._libraryDataLoadInfo.resolve();else if("LOADING"===e){let e;this._libraryDataLoadInfo.promise=new Promise((t=>{e=t})),this._libraryDataLoadInfo.resolve=e}else"NOT_LOADED"===e&&(this._libraryDataLoadInfo.resolve&&this._libraryDataLoadInfo.resolve(),this.emit(id))}async _waitForLibraryLoad(e=!1){return this._populateLibraryDataIfNotLoading(),await this._libraryDataLoadInfo.promise,e&&!this._libraryLoaded&&await this._waitForLibraryLoad(!1),this._libraryDataLoadInfo.promise}async _load({repoMetadata:e,appMetadata:t,effectivePermission:i,perUserMetadata:s,requireLibraryDataFetch:r}={}){await super._load({repoMetadata:e,appMetadata:t,effectivePermission:i,perUserMetadata:s}),this._setLibraryLoadState("NOT_LOADED"),r&&(this._populateLibraryDataIfNotLoading(),await this._waitForLibraryLoad())}get elementsCount(){return this._populateLibraryDataIfNotLoading(),this._elementsCount}get displayName(){return this._populateLibraryDataIfNotLoading(),this._displayName}get documentType(){return this._populateLibraryDataIfNotLoading(),this._documentType}get orgID(){return this._populateLibraryDataIfNotLoading(),this._orgID}get publishedTo(){var e,t,i;return null===(i=null===(t=null===(e=this.appMetadata)||void 0===e?void 0:e.data)||void 0===t?void 0:t["brand:publishedTo"])||void 0===i?void 0:i["repo:assetId"]}get publishedFrom(){var e,t,i;return null===(i=null===(t=null===(e=this.appMetadata)||void 0===e?void 0:e.data)||void 0===t?void 0:t["brand:publishedFrom"])||void 0===i?void 0:i["repo:assetId"]}get lastPublishedVersion(){var e,t;return null===(t=null===(e=this.appMetadata)||void 0===e?void 0:e.data)||void 0===t?void 0:t["brand:lastPublishedVersion"]}get extractedFrom(){var e,t,i;return null===(i=null===(t=null===(e=this.appMetadata)||void 0===e?void 0:e.data)||void 0===t?void 0:t["brand:extractedFrom"])||void 0===i?void 0:i.map((e=>e["repo:assetId"]))}get customThumbnail(){return this._populateLibraryDataIfNotLoading(),this._customThumbnail}get roles(){return this._populateLibraryDataIfNotLoading(),this._libraryRoles}get customModelInfo(){return this._populateLibraryDataIfNotLoading(),this._customModelInfo}get renditionGrid(){return this._populateLibraryDataIfNotLoading(),this._renditionGridTiles}async setRoles(e){const t={roles:Array.isArray(e)?e:[e]};await this._libraryInterface.updateMetadata(this.id,t),this._setLibraryLoadState("NOT_LOADED"),await this._populateLibraryDataIfNotLoading()}get isBookmarked(){return this._populateLibraryDataIfNotLoading(),this._libraryLoaded?!!this._bookmark:void 0}get _isPublic(){return this._libraryLoaded?"public"===this._ownership:void 0}get ownership(){return this._populateLibraryDataIfNotLoading(),this._ownership}async getCustomModels(){var e;if(!(null===(e=this.roles)||void 0===e?void 0:e.filter((e=>"cm_training_set"===e.type))))throw We.create(Be.INVALID_OPERATION,"Can only get custom models from training set libraries");const t=this._core._getAssetPool();return new Uo(t,[new _d(t,this._core,this.id)],new pd({trainingSetId:this.id}))}get libraryManifestId(){return this._populateLibraryDataIfNotLoading(),this._legacyLibraryId}async move(e){return this.moveLibrary(e)}async duplicate(e){if(this.ancestorIDs&&this.ancestorIDs.length>0)return super.duplicate(e);if(this._parentAssetId){const t=await this._core.getAssetContext(),i=await t.getAssetWithCloudID(this._parentAssetId);return await this._copy(i,e)}return Promise.reject(We.create(Be.BAD_REQUEST,"Library.duplicate() requires at least one of { this.ancestorIDs, this._parentAssetId } to be defined."))}async moveLibrary(e,t){const i=await this._libraryInterface.moveLibrary(this.cloudID,e.cloudID,t),s=(await this._core.getAssetContext())._assetPool.createUpdateSession("move library"),r=await this._core.getLibraryContext();i.library_urn!==this.id?s.queueDiscardedItem(this):(r._libraryUpdater.updateLocalItem(s,this,i),this._setLibraryLoadState("LOADED")),s.commit()}async rename(e){await this._libraryInterface.updateMetadata(this.id,{name:e}),this._setLibraryLoadState("NOT_LOADED")}async discard(){if(this.isDiscarded)throw We.create(Be.INVALID_OPERATION,"Asset is already discarded");await this._libraryInterface.discardLibrary(this.cloudID);const e=(await this._core.getLibraryContext())._assetPool.createUpdateSession("discard library");(await this._core.getAssetContext())._adobeAssetUpdater.updateLocalItem(e,this,{"repo:state":"DISCARDED"}),e.commit()}async permanentlyDelete(){await this._libraryInterface.permanentlyDeleteLibrary(this.cloudID);const e=(await this._core.getLibraryContext())._assetPool.createUpdateSession("permanently delete library");e.queueDiscardedItem(this),e.commit()}async restore(){if(!this.isDiscarded)throw We.create(Be.INVALID_OPERATION,"Cannot restore an asset that is not discarded");const e=await this._core.getAssetContext();await this._libraryInterface.restoreLibrary(this.cloudID);const t=this._core._getAssetPool().createUpdateSession("restore library");e._adobeAssetUpdater.updateLocalItem(t,this,{"repo:state":"ACTIVE"}),t.commit()}async _copy(e,t){return this.copyLibrary(e,t)}async copyLibrary(e,t,i){const s=await this._libraryInterface.copyLibrary(this.cloudID,t,null==e?void 0:e.cloudID,i),r=this._core._getAssetPool().createUpdateSession("copy library"),n=(await this._core.getLibraryContext())._libraryUpdater.updateRemoteItem(r,s);return n._setLibraryLoadState("LOADED"),r.commit(),n}async bookmark(){if(await this._waitForLibraryLoad(!0),this.isBookmarked)return;let e={};if(this._isPublic)return Promise.reject("Bookmarking public libraries not implemented.");e={id:this._legacyLibraryId,type:"collab",urn:this.cloudID};const{bookmarks:t}=await this._libraryInterface.bookmarkLibraries([e]),i=t.find((e=>e.id===this._legacyLibraryId)),s=await this._core.getLibraryContext(),r=s._assetPool.createUpdateSession("bookmark library");s._libraryUpdater.updateLocalItem(r,this,{bookmark:i}),r.commit()}async unbookmark(){var e;await this._waitForLibraryLoad(!0);const t=null===(e=this._bookmark)||void 0===e?void 0:e.id;if(!t)return;await this._libraryInterface.unbookmarkLibrary(t);const i=await this._core.getLibraryContext(),s=i._assetPool.createUpdateSession("unbookmark library");i._libraryUpdater.updateLocalItem(s,this,{bookmark:void 0}),s.commit()}async _populateLibraryDataIfNotLoading(){if("NOT_LOADED"===this._libraryDataLoadInfo.state){this._setLibraryLoadState("LOADING");const e=await this._core.getLibraryContext(),t=await this._libraryInterface.getLibraryData(this.id,{isDiscarded:this.isDiscarded}),i=this._core._getAssetPool().createUpdateSession();e._libraryUpdater.updateLocalItem(i,this,t),this._setLibraryLoadState("LOADED"),i.commit()}}get isEditingRestricted(){return this._isEditingRestricted}get _isCCIProjectLibrary(){var e,t;return null!==(t=this._ownership&&"team"===this._ownership&&"user"===this.storageAssignee.type&&(null===(e=this.repoPath)||void 0===e?void 0:e.startsWith("/projects/")))&&void 0!==t&&t}async setEditingRestricted(e,t){await this._ensureLink(yt.AC_POLICY);const i=await this._getAssetInterface();await i.setEditingInheritanceRestricted(e,t),this._isEditingRestricted=e,on.updatedExternally(this,rd)}async _refreshEditingRestricted(){await this._ensureLink(yt.AC_POLICY);const e=await this._getAssetInterface();this._isEditingRestricted=await e.getEditingInheritanceRestricted()}async _reloadPermissions(){return on.setLoadStatus(this,rd,nn.NotLoaded),super._reloadPermissions()}get _roles_NoLazyLoad(){return this._libraryRoles}get _ownership_NoLazyLoad(){return this._ownership}get _isBookmarked_NoLazyLoad(){return!!this._bookmark}get _displayName_NoLazyLoad(){return this._displayName}get _legacyLibraryId_NoLazyLoad(){return this._legacyLibraryId}isReferencedByProject(e){var t;return null===(t=this._referencedByProjectIDs)||void 0===t?void 0:t.has(e)}_updateReferencedByProjectIDs(e,t){var i;null!==(i=this._referencedByProjectIDs)&&void 0!==i||(this._referencedByProjectIDs=new Set),t?this._referencedByProjectIDs.add(e):this._referencedByProjectIDs.delete(e)}}Ye([Dt],fd.prototype,"getContents",null),Ye([Dt],fd.prototype,"_getContentsSync",null),Ye([ht(sd)],fd.prototype,"elementsCount",null),Ye([ht(sd)],fd.prototype,"displayName",null),Ye([ht(sd)],fd.prototype,"documentType",null),Ye([ht(sd)],fd.prototype,"orgID",null),Ye([ht],fd.prototype,"publishedTo",null),Ye([ht],fd.prototype,"publishedFrom",null),Ye([ht],fd.prototype,"lastPublishedVersion",null),Ye([ht],fd.prototype,"extractedFrom",null),Ye([ht(sd)],fd.prototype,"customThumbnail",null),Ye([ht(sd)],fd.prototype,"roles",null),Ye([ht(sd,"_customModelInfo")],fd.prototype,"customModelInfo",null),Ye([ht(sd)],fd.prototype,"renditionGrid",null),Ye([ht(sd)],fd.prototype,"isBookmarked",null),Ye([ht(sd)],fd.prototype,"_isPublic",null),Ye([ht(sd)],fd.prototype,"ownership",null),Ye([nt],fd.prototype,"getCustomModels",null),Ye([ht(sd)],fd.prototype,"libraryManifestId",null),Ye([an(nd,"_isEditingRestricted")],fd.prototype,"isEditingRestricted",null);const gd={_bookmark:{name:"bookmark",format:"object"},_libraryRoles:{name:"roles",format:"object",isArray:!0},_orgID:{name:"org_id",format:"string"},_ownership:"ownership",_legacyLibraryId:"id",_customModelInfo:{name:"firefly#cme",format:{parse:e=>{const t=Object.assign(Object.assign({},e),{schemaVersion:e.version?e.version:e.schemaVersion});return delete t.version,t},isEqual:ds}},_renditionGridRaw:{name:"rendition_grid",format:"object",set:(e,t)=>{const i=t;!function(e,t){var i,s;let r=null!==(i=t._renditionGridTiles)&&void 0!==i?i:t._renditionGridTiles=[];const n=[e.main,...null!==(s=e.tiles)&&void 0!==s?s:[]].filter((e=>!!e));n.forEach(((e,i)=>{const s=r.find((t=>t.elementId===e.elementId));s?(s._index=i,"href"===e.type?s._renditionUrl=e.rendition:s._renditionData=e.rendition):r.push(new ad(e,i,t))})),r=r.filter((e=>!!n.find((t=>t.elementId===e.elementId))||(e._releaseRenditions(),!1))),r.sort(((e,t)=>e._index-t._index)),t._renditionGridTiles=r}(e,i),i._renditionGridRaw=e}},_displayName:"name",_elementsCount:{name:"elements_count",format:"number"},_parentAssetId:{name:"parent_assetId",format:"string"},_documentType:{name:"document_type",format:"string"},_referencedByProject:{name:"referenced_by_project",format:"object",set:(e,t)=>{t._updateReferencedByProjectIDs(e.projectId,e.reference)}},_customThumbnail:{name:"thumbnail",format:"object",set:(e,t)=>{t._customThumbnail=new ad(e,-1,t)}}},yd={_etag:"manifest_etag",_repositoryID:"repo:repositoryId",_path:"storage_path",_version:"version",_created:{name:"created_date",format:"date_as_number"},_modified:{name:"modified_date",format:"date_as_number"},_discarded:{name:"archived_date",format:"date_as_number"},_createdBy:"created_by",_modifiedBy:"modified_by",_discardedBy:"archived_by","_appMetadata._data":{name:"application_metadata",format:"object_subset",set:(e,t)=>{t.appMetadata._mergeData(e)}},_storageAssignee:{name:"storage_assignee",format:bc},_size:{name:"storage_used",format:"number"},_permissions:{get:function(e){return void 0!==e.asset_acl?Wi(e.asset_acl):"public"===e.ownership?Gi.Read|Gi.Ack|Gi.ReadAppMetadata:"private"===e.ownership?$i:On},format:"number"},_isSharedWithYouAsset:{get:function(e,t){if(e.collaboration){const i=t._core._environment.getValue("USER_ID");return e.collaboration.collaborators.some((e=>"DIRECT"===e.inheritanceType&&e.collaborator===i))}return On},format:"boolean"},_isShared:{get:function(e){return e.collaboration?e.collaboration.collaborators.some((e=>"DIRECT"===e.inheritanceType)):On},format:"boolean"},_directCollaboratorCount:{get:function(e){return e.collaboration?e.collaboration.collaborators.filter((e=>"DIRECT"===e.inheritanceType)).length:On},format:"number"},_isPublicLink:{get:function(e){return e.collaboration?!!e.collaboration.public:On},format:"boolean"},_shareFlagsAreDirty:{get:function(e){return!e.collaboration&&On},format:"boolean"}},vd=Object.assign(Object.assign({},gd),yd),Od=new vn({localItemType:fd,remoteIdProperty:"library_urn",changeEventMap:new Map([["_libraryRoles",sd],["_displayName",sd],["_legacyLibraryId",sd],["_bookmark",sd],["_ownership",sd],["_renditionGridRaw",sd],["_elementsCount",sd],["_documentType",sd]]),propertyUpdater:new Cn(vd)}),bd={orderDirection:"descending",orderBy:"modify_date",start:0,limit:0,mediaTypes:[],excludeMediaTypes:[]};class Id extends pr{async getPublishedAssets(e){Bl((e=Object.assign(Object.assign({},bd),e)).mediaTypes),Bl(e.excludeMediaTypes);const t={sort_orderby:e.orderBy,hints:{acp_platform_v2:!0},fetch_fields:{includes:["app_metadata"]},op_or:[{[Rn.CREATIVE_CLOUD_TOPLEVEL_COLLECTION_NAME]:"pubs"},{[Rn.OP_AND]:[{[Rn.CREATIVE_CLOUD_TOPLEVEL_COLLECTION_NAME]:"cloud-content"},{[Rn.FIELD_EXISTS]:["app_metadata$$review:sourceAsset$$dc:format"]}]}],op_none_of:[{[Rn.TYPE]:e.excludeMediaTypes||[]},...xn()],[Rn.STORAGE_ASSIGNEE_ID]:this._core._environment.getValue("USER_ID"),asset_id_opacity:!0,[Rn.TYPE]:e.mediaTypes||[],sort_order:(i=e,"ascending"===i.orderDirection?"asc":"desc"),limit:e.limit,start_index:e.start};var i;return await this._core.hostAssetContext._ussInterface.getQueryResponse(t)}}const Ed={name:"asset_name",created:"create_date",modified:"modify_date",lastAccessed:Nn},Td={name:eo.Name,created:eo.Created,modified:eo.Modified,lastAccessed:eo.Modified},Sd={name:(e,t)=>jn(e.name,t.name),created:(e,t)=>Un(e.created,t.created),modified:(e,t)=>Un(e.modified,t.modified),lastAccessed:(e,t)=>Un(e.lastAccessed,t.lastAccessed)};class Ad extends(Fn(Sd)){}Ad.default=new Ad("descending","modified");class Pd{constructor(e,t,i){this._publishedInterface=i,this._ussLoaderHelper=new Cc(e,t,this)}supportsFilter(e){return void 0!==e}async loadPage(e){return this._ussLoaderHelper.loadPage(e)}async _getUSSResults({start:e,loadOptions:t,mediaTypes:i,excludeMediaTypes:s,order:r}){return this._publishedInterface.getPublishedAssets({orderBy:Ed[r.field],orderDirection:r.direction,start:e,limit:null==t?void 0:t.limit,mediaTypes:i,excludeMediaTypes:s})}_getItemData(e){return Object.assign(Object.assign({},e),{published:!0})}}class wd extends kn{constructor(){super({_isPublished:!0})}}class Cd extends kn{constructor(){super({_isDiscarded:!0,_isSharedWithYou:!0})}matches(e){return!this.isSyncedAsset(e)&&!this.isMobileCreation(e)&&!(!e.hasPermission(Gi.Restore)&&!e.hasPermission(Gi.Delete))&&super.matches(e)}isSyncedAsset(e){return e.repoPath.startsWith("/files/")}isMobileCreation(e){return e.repoPath.startsWith("/assets/")&&!e.repoPath.startsWith("/assets/adobe-libraries/")}}const Rd={limit:50,start:0,orderDirection:"descending",orderBy:"modified",mediaTypes:[],excludeMediaTypes:[]},Ld=["creative_cloud_colortheme","creative_cloud_gradient","_embedded"],Nd=["application/vnd.adobe.draw.project+dcx","application/vnd.adobe.sketch.project+dcx","application/vnd.adobe.photoshop-mix.composition+dcx","application/vnd.adobe.photoshop-fix.composition+dcx","application/vnd.adobe.line.sketchbook+dcx","application/vnd.adobe.layup.project+dcx","application/vnd.adobe.comp.project+dcx","application/vnd.adobe.clip.project+dcx","application/vnd.adobe.clsproject+dcx","image/vnd.adobe.cls+dcx"];class Dd extends pr{async getDiscardedAssets(e,t){Bl((e=Object.assign(Object.assign({},Rd),e)).mediaTypes),Bl(e.excludeMediaTypes);const i="ascending"===e.orderDirection?"asc":"desc",s=Dn[e.orderBy||"modified"],r=this._core._environment.getValue("USER_ID"),n={hints:{acp_platform_v2:!0},creative_cloud_archive:!0,creative_cloud_discarded_directly:!0,[Rn.TYPE]:e.mediaTypes||[],fetch_fields:{includes:[...Ki(),...Ld]},op_or:[{[Rn.STORAGE_ASSIGNEE_ID]:r},{op_and:[{[Rn.STORAGE_ASSIGNEE_TYPE]:"org"},{[Rn.TYPE]:["application/vnd.adobe.library+dcx"]},{[Rn.REPO_ACL_MODIFIER]:"grant",[Rn.REPO_ACL_PRIVILEGES]:["write"],[Rn.REPO_ACL_RELATIONS]:[yt.PRIMARY]}]},{op_and:[{op_or:[{[Rn.STORAGE_ASSIGNEE_ID]:r},{[Rn.STORAGE_ASSIGNEE_TYPE]:"org"}]},{op_field_exists:["app_metadata$$cc:inheritable$$cc:team$$repo:assetId","app_metadata$$cc:inherited$$cc:team$$repo:assetId"]}]}],op_none_of:[{[Rn.TYPE]:e.excludeMediaTypes||[]},{[Rn.VISIBILITY]:["hiddenSelf","hiddenRecursive"]},{[Rn.FIELD_EXISTS]:["app_metadata$$review:sourceAsset$$dc:format"]},{[Rn.CREATIVE_CLOUD_TOPLEVEL_COLLECTION_NAME]:["archive","files"]},{[Rn.TYPE]:Nd},...xn()],sort_orderby:s,sort_order:i,limit:e.limit,start_index:e.start};return this._core.hostAssetContext._ussInterface.getQueryResponse(n,t)}}class Md{constructor(e,t,i){this._core=t,this._discardedInterface=i,this._ussLoaderHelper=new Cc(e,t,this)}supportsFilter(e){return void 0!==e}async loadPage(e){return this._discardedSourcePrefetch(),this._libraryContext||(this._libraryContext=await this._core.getLibraryContext()),await this._ussLoaderHelper.loadPage(e)}async _discardedSourcePrefetch(){const e=await this._core.getProjectContext(),t=await this._core.getAssetContext(),i=e._prefetchIndex(),s=t._getListOfRepositoryIDs(),r=await Promise.all([i,s]),n=[],o=r[1];null==o||o.forEach((t=>n.push(e._canRestoreProject(t)))),await Promise.all(n);const a=e._assetPool.createUpdateSession();e._assetPool.forEach((e=>{e.isProject&&e._applyRestorePermission(a)})),a.commit()}_getUSSResults({start:e,loadOptions:t,mediaTypes:i,excludeMediaTypes:s,order:r,resource:n}){return this._discardedInterface.getDiscardedAssets({start:e,limit:null==t?void 0:t.limit,orderBy:r.field,orderDirection:r.direction,mediaTypes:i,excludeMediaTypes:s},n)}_getItemData(e){var t;const i=e.creative_cloud_colortheme||e.creative_cloud_gradient||null===(t=e._links)||void 0===t?void 0:t[yt.RENDITION],s="element"===e.asset_sub_type;return s&&(e._links=Object.assign(Object.assign({},e._links||{}),{[yt.RENDITION]:i})),Object.assign(Object.assign({},e),{isArchivedLibraryElement:s})}}class xd extends kn{constructor(e){super({_isSharedWithYou:!0}),this._query="",this._projectsOnly=!1,this._query=(null==e?void 0:e._query)||"",this._projectsOnly=(null==e?void 0:e._projectsOnly)||!1}get query(){return this._query}get projectsOnly(){return this._projectsOnly}matches(e){return!(this._matchingIDsFromSearch&&!this._matchingIDsFromSearch.has(e.id))&&!(this._query&&!this._matchingIDsFromSearch)&&super.matches(e)}}class kd extends pr{constructor(){super(...arguments),this.queryPath="/uss/v3/query"}async getQueryResponse(e){const t=`https://${this._core._environment.endpoints.USSv3_HOST}${this.queryPath}`,i={experienceId:"Default-Global-Search-Experience",queries:[Object.assign({id:"global-search-1",scope:{entities:["AcpAsset"]},fetchFields:[ao.SharedBy,ao.ShellVisibility,ao.ReviewSourceAssetType,ao.ConvertedTo,ao.NonAutoMigratable,ao.CopiedLegacySparkId,ao.CreatedFromUpload]},e)]};return(await this._doPost(t,{"content-type":"application/vnd.adobe.search-request+json"},JSON.stringify(i),[200])).json()}}class Hd{constructor(e,t,i,s){this._core=t,this._globalSearchInterface=i,this._implicitFilter=s,this._ussLoaderHelper=new Xn(e,this._core,this)}supportsFilter(e){return void 0!==e}async loadPage(e){return this._libraryContext||(this._libraryContext=await this._core.getLibraryContext()),this._ussLoaderHelper.loadPage(e)}_getUSSResults({start:e,loadOptions:t,order:i,mediaTypes:s,excludeMediaTypes:r,filter:n}){var o;const{_query:a,projectsOnly:c}=this._implicitFilter,{excludeInheritanceTypes:l,assetTypes:d,excludeAssetTypes:u,assetSubTypes:h}=n;return this._globalSearchInterface.globalSearch({start:e,limit:null!==(o=null==t?void 0:t.limit)&&void 0!==o?o:50,query:a,order:i,mediaTypes:s,excludeMediaTypes:r,excludeInheritanceTypes:[...l||[]],projectsOnly:c,assetTypes:[...d||[]],excludeAssetTypes:[...u||[]],assetSubTypes:[...h||[]]})}_postProcessPage({filter:e},{items:t}){this._implicitFilter._matchingIDsFromSearch=new Set([...this._implicitFilter._matchingIDsFromSearch||[],...t.map((e=>e.id))])}}class jd extends pr{constructor(e,t){super(e),this._ussInterface=t}async globalSearch({query:e,start:t=0,limit:i=50,order:s,mediaTypes:r,excludeInheritanceTypes:n,projectsOnly:o,assetTypes:a,excludeAssetTypes:c,assetSubTypes:l}){const{field:d="modified",direction:u="descending"}=s||{},h=[];return o?h.push({[ro.DIRECTORY_TYPE]:[oo.PROJECT]}):((null==r?void 0:r.length)&&h.push({[ro.MEDIA_TYPE]:r}),(null==n?void 0:n.length)&&h.push({[no.MISSING]:{funcParams:{fields:n}}}),(null==c?void 0:c.length)?h.push({[no.NOT]:{funcParams:{[ro.ASSET_TYPE]:c}}}):(null==a?void 0:a.length)&&h.push({[ro.ASSET_TYPE]:a}),(null==l?void 0:l.length)&&h.push({[ro.ASSET_SUB_TYPE]:l}),h.push(lo())),this._ussInterface.getQueryResponse({start:t,limit:i,textQuery:e,sorts:[{sortOrderBy:Td[d],sortOrder:"ascending"===u?io.Ascending:io.Descending}],filters:h})}}class Ud{constructor(e,t,i,s){this._implicitFilter=t,this._core=i,this._adobeAssetGlobalSearchInterface=s,this._ussLoaderHelper=new Cc(e,i,this)}supportsFilter(e){return void 0!==e}async loadPage(e){return this._libraryContext||(this._libraryContext=await this._core.getLibraryContext()),this._ussLoaderHelper.loadPage(e)}_getUSSResults({start:e,loadOptions:t,order:i,mediaTypes:s,excludeMediaTypes:r}){var n;const o=null===(n=this._implicitFilter)||void 0===n?void 0:n._query;return this._adobeAssetGlobalSearchInterface.getFilteredAssets({orderBy:Ed[i.field],orderDirection:i.direction,start:e,limit:null==t?void 0:t.limit,mediaTypes:s,excludeMediaTypes:r,query:o,embedPermissions:!0})}_postProcessPage(e,t){const{items:i}=t;this._implicitFilter._matchingIDsFromSearch=new Set([...this._implicitFilter._matchingIDsFromSearch||[],...i.map((e=>e.id))])}}class Bd extends kn{constructor(){super({_isSharedWithYou:!0})}matches(e){return!!e._isSWYAsset_NoLazyLoad&&!e.isProject&&super.matches(e)}}const Fd=[yt.AC_EFFECTIVE,yt.APP_METADATA,yt.PROJECTS_CREATOR,yt.REPOSITORY],Vd={orderDirection:"ascending",orderBy:"repo:name",start:0,limit:0,embed:Fd,isDiscarded:!1},Kd={first:10,embed:Fd};class Gd extends pr{constructor(){super(...arguments),this._gradientResourcesByLanguage=new Map}async _discoverLinks(e){return(await this._getResponse(e))._links}_getEndpointHref(e){return`https://${this._core._environment.endpoints.PROJECTS_HOST}${e}`}_getCreateEndpointHref(){return this._getEndpointHref("/api/v3/internal/csc-projects/:create")}async _discoverProjectLinks(){return this._discoverLinks(this._getEndpointHref("/api/v3/index"))}async getProjects(e,t){const i=function(e,t){const i=Object.assign(Object.assign({},Vd),t),s=function(e){const t={};return e.start&&(t.start=e.start),e.limit&&(t.limit=e.limit),t}(i);s.orderBy=function(e){return("ascending"===e.orderDirection?"+":"-")+e.orderBy}(i);const{embed:r,view:n,repositoryId:o,ownerId:a,nameContains:c,isDiscarded:l,directorySubtypes:d}=i;return(null==r?void 0:r.length)&&(s.embed=r.join(",")),n&&(s.view=n),o&&(s.repositoryId=o),c&&(s.nameContains=c),a&&(s.ownerId=a),l&&(s.state="discarded"),d&&(s.directorySubtype=d.join(",")),It(e,yt.PROJECTS_COLLECTION,s)}(await this._discoverProjectLinks(),e);return await this._getResponse(i,{resource:t})}async getRecentProjects(e,t){const i=function(e,t){var i;const s=Object.assign(Object.assign({},Kd),t),r={};return s.after&&(r.after=s.after),s.first&&(r.first=s.first),(null===(i=s.embed)||void 0===i?void 0:i.length)&&(r.embed=s.embed.join(",")),It(e,yt.PROJECTS_RECENT,r)}(await this._discoverProjectLinks(),e);return await this._getResponse(i,{resource:t})}async _getProjectLink(e,t=Fd){return It(await this._discoverProjectLinks(),yt.PROJECTS_PRIMARY,Object.assign({assetId:e},t.length?{embed:t.join(",")}:void 0))}async getProject(e,t=Fd){const i=await this._getProjectLink(e,t);return await this._getResponse(i)}async getProjectsWithLink(e){return await this._getResponse(e.href)}async _getCreateLink(e){return It(await this._discoverProjectLinks(),yt.PROJECTS_CREATE,e.length?{embed:e.join(",")}:void 0)}async createProject(e,t=Fd){const i=await this._getCreateLink(t),s=await this._doPost(i,{"Content-Type":ft},JSON.stringify(e),[201,403]);let r={};try{r=await s.json()}catch(e){}if(403===r.status){if(r.type===Ge.CHILDREN_LIMIT_EXCEEDED)throw We.create(Be.PROJECT_LIMIT_EXCEEDED,"Maximum number of Projects exceeded",{response:s,reqId:s.headers.get("x-request-id")||""});{const e=We.createWithResponse(s,s.url);throw this._core._environment.error(`ProjectsInterface error ${e}`),e}}return r}async createCSCProject(e,t,i){const{path:s,parentAssetId:r,projectDirectorySubType:n,name:o,appMetadata:a}=e;let c=Object.assign({"project:directorySubtype":n.toString(),"repo:name":o},a?{[yt.APP_METADATA]:Object.assign({},a)}:{});const l=this._getCreateEndpointHref();c=s?Object.assign(Object.assign({},c),{"repo:path":s}):Object.assign(Object.assign({},c),{"repo:assetId":r});const d=await this._doPost(l,Object.assign({"Content-Type":ft,"Org-Id":t},i?{"User-Id":i}:{}),JSON.stringify(c),[201]);return await d.json()}async resolveProjectByName(e){const t=await this._getResolveByPathLink(e);return this._getResponse(t)}async renameProject(e,t){const i=It(t,yt.PROJECTS_RENAME);await this._doPost(i,{"Content-Type":ft},JSON.stringify({"repo:name":e}),[204])}async _getResolveByPathLink(e,t){return It(await this._discoverProjectLinks(),yt.RESOLVE_PATH,Object.assign({path:e},t?{repositoryId:t}:{}))}async validateProjectName(e,t){const i=await this._getResolveByPathLink(e,t);await this._doHead(i)}async discardProject(e,t){if(!(null==t?void 0:t[yt.DISCARD]))throw We.create(Be.BAD_REQUEST,`Discard link is missing for this project${e}`);const i=It(t,yt.DISCARD);await this._doPost(i,void 0,void 0,[204])}async restoreProject(e,t){if(!(null==t?void 0:t[yt.RESTORE]))throw We.create(Be.BAD_REQUEST,`Restore link is missing for this project${e}`);const i=It(t,yt.RESTORE);await this._doPost(i,void 0,void 0,[204])}getGradientsResource(e){let t=this._gradientResourcesByLanguage.get(e);if(!t){let i=!1;t=new ur(this._core,{getCacheKey:(t,i)=>`${t}-${i}-${e}`,skipRevalidation:()=>i,onChange:async(e,t)=>{(null==t?void 0:t.loading)||(i=!0)},loadData:async()=>{const i=await this._getGradientsLink();await this._doGet(i,{headers:{"Content-Type":ft,"Accept-Language":e},resource:t})}}),this._gradientResourcesByLanguage.set(e,t)}return t}async _getGradientsLink(){return It(await this._discoverProjectLinks(),yt.PROJECTS_GRADIENTS_COLLECTION)}async getGradients(e){const t=this.getGradientsResource(e);return await t.get({})}async patchProject(e,t){const i=[];t.gradientID&&i.push({op:"replace",path:Yi.GRADIENT_ID,value:t.gradientID});const s=It(e,yt.APP_METADATA);await this._doPatch(s,{"Content-Type":gt,"If-Match":"*"},JSON.stringify(i),[204])}async _getCapabilityLink(e,t){return It(await this._discoverProjectLinks(),yt.PROJECTS_CAPABILITY,Object.assign({privilege:e},t?{repositoryId:t}:{}))}async getCapability(e,t){const i=await this._getCapabilityLink(e,t);try{await this._doGet(i)}catch(e){if(!ze(e))throw e;const t=e._additionalInfo.response;if(!t)throw e;if(![404,403].includes(t.status))throw e;switch((await t.json()).type){case Ge.ADMIN_ONLY:throw We.create(Be.ACCESS_DENIED,"Admin disabled creation of projects for user",void 0,Fe.PROJECTS_ADMIN_ONLY);case Ge.NO_HOME_REPOSITORY:throw We.create(Be.NOT_FOUND,"No home repository for the user",void 0,Fe.PROJECTS_NO_HOME_REPOSITORY);case Ge.INVALID_HOME_REPOSITORY:throw We.create(Be.NOT_FOUND,"Invalid home Repository for the user",void 0,Fe.PROJECTS_INVALID_REPOSITORY);default:throw e}}}async createLibraryReference(e,t){const i=It(t,yt.PROJECTS_REFERENCE_CREATE);return(await this._doPost(i,{"Content-Type":ft},JSON.stringify({"project:referenceId":e}),[201])).json()}async _issueContextAPIRequest(e,t,i){const s=JSON.stringify({"repo:assetId":e,"repo:repositoryId":t});return(await this._doPost(i,{"Content-Type":"application/json"},s,[200])).json()}async _getOrganizationsCollectionLink(){return It(await this._discoverProjectLinks(),yt.ORGANIZATIONS_COLLECTION)}async getOrganizations(e){const t=await this._getOrganizationsCollectionLink();await this._doGet(t,{resource:e})}async moveCSCProject(e,t){const i=await It(t,yt.PROJECTS_MOVE);await this._doPost(i,{"Content-Type":ft},JSON.stringify({target:{"repo:assetId":e}}),[204])}async deleteLibraryReference(e,t){const i=It(t,yt.PROJECTS_REFERENCE_PRIMARY,{referenceId:e});await this._doDelete(i,{"Content-Type":ft},[204])}}Ye([rt((function(e){return vt(e,qi)})),Qe(0,it)],Gd.prototype,"_discoverLinks",null),Ye([wt],Gd.prototype,"getGradients",null),Ye([wt],Gd.prototype,"getOrganizations",null);const $d="organizations_changed",Wd=new class extends ot{constructor(){super($d)}},zd={name:"asset_name",created:"create_date",modified:"modify_date",shared:"shared_date"},qd={name:(e,t)=>jn(e.name,t.name),shared:(e,t)=>Un(e.shared,t.shared),created:(e,t)=>Un(e.created,t.created),modified:(e,t)=>Un(e.modified,t.modified)};class Yd extends(Fn(qd)){}Yd.default=new Yd("descending","shared");class Qd{constructor(e){var t,i,s,r;this._mediaTypes=void 0,this._excludeMediaTypes=void 0,this._assetTypes=void 0,this._excludeAssetTypes=void 0,this._assetSubTypes=void 0,this._isDiscarded=void 0;const n=e=>(null==e?void 0:e.length)?new zn(e):void 0;this._mediaTypes=n(null==e?void 0:e.mediaTypes),this._excludeMediaTypes=n(null==e?void 0:e.excludeMediaTypes),(null===(t=this._mediaTypes)||void 0===t?void 0:t.size)&&(null===(i=this._excludeMediaTypes)||void 0===i?void 0:i.size)&&(this._mediaTypes=new zn([]),console.warn("AdobeAssetFilter - cannot have both mediaTypes and excludeMediaTypes. Omitting mediaTypes.")),this._assetTypes=n(null==e?void 0:e.assetTypes),this._excludeAssetTypes=n(null==e?void 0:e.excludeAssetTypes),(null===(s=this._assetTypes)||void 0===s?void 0:s.size)&&(null===(r=this._excludeAssetTypes)||void 0===r?void 0:r.size)&&(this._assetTypes=new zn([]),console.warn("AdobeAssetFilter - cannot have both assetTypes and excludeAssetTypes. Omitting assetTypes.")),this._assetSubTypes=n(null==e?void 0:e.assetSubTypes),this._isDiscarded=null==e?void 0:e._isDiscarded}get hash(){const e=e=>(null==e?void 0:e.size)?[...e].sort().join(","):"";let t="mediatypes="+e(this._mediaTypes);return t+=":excludemediatypes="+e(this._excludeMediaTypes),t+=":assetTypes="+e(this._assetTypes),t+=":excludeAssetTypes="+e(this._excludeAssetTypes),t+=":assetSubTypes="+e(this._assetSubTypes),t+=void 0!==this._isDiscarded?":isDiscarded="+this._isDiscarded:"",t}get mediaTypes(){return this._mediaTypes}get excludeMediaTypes(){return this._excludeMediaTypes}get assetTypes(){return this._assetTypes}get excludeAssetTypes(){return this._excludeAssetTypes}get assetSubTypes(){return this._assetSubTypes}get name(){return"AdobeAssetFilter"}matches(e){var t,i,s,r,n;return Boolean((!(null===(t=this._excludeMediaTypes)||void 0===t?void 0:t.size)||!this._excludeMediaTypes.has(e.mediaType))&&(!(null===(i=this._mediaTypes)||void 0===i?void 0:i.size)||this._mediaTypes.has(e.mediaType))&&(!(null===(s=this._assetTypes)||void 0===s?void 0:s.size)||e.assetType&&this._assetTypes.has(e.assetType))&&(!(null===(r=this._excludeAssetTypes)||void 0===r?void 0:r.size)||!this._excludeAssetTypes.has(e.assetType))&&(!(null===(n=this._assetSubTypes)||void 0===n?void 0:n.size)||e.assetSubType&&this._assetSubTypes.has(e.assetSubType))&&(void 0===this._isDiscarded||this._isDiscarded===e.isDiscarded))}getRelationToFilter(e){const t=[this.getMediaRelationToFilter(e),this._getAssetTypeRelationToFilter(e),_o(this._assetSubTypes,e.assetSubTypes),this._getDiscardedTypeRelationToFilter(e)];return t.includes("disjoint")?"disjoint":t.includes("unknown")?"unknown":"subset"}getMediaRelationToFilter(e){return this._getExcludeIncludeFilterRelation(this._mediaTypes,this._excludeMediaTypes,e._mediaTypes,e._excludeMediaTypes)}_getAssetTypeRelationToFilter(e){return this._getExcludeIncludeFilterRelation(this._assetTypes,this._excludeAssetTypes,e._assetTypes,e._excludeAssetTypes)}_getExcludeIncludeFilterRelation(e,t,i,s){return e=new zn(e),t=new zn(t),i=new zn(i),s=new zn(s),"disjoint"===_o(e,i)||s.size&&e.size&&s.isSupersetOf(e)||t.size&&i.size&&t.isSupersetOf(i)?"disjoint":t.size||s.size||"unknown"!==_o(e,i)?!t.size&&s.size&&"unknown"===_o(e,s)||i.size&&t.size&&"subset"===_o(t,i)||!s.size&&t.size&&"disjoint"===_o(i,t)?"unknown":t.size||e.size||i.size||!s.size?t.size&&s.size?s.isSubsetOf(t)?"subset":"unknown":"subset":"unknown":"unknown"}_getDiscardedTypeRelationToFilter(e){return this._isDiscarded===e._isDiscarded||void 0===e._isDiscarded?"subset":void 0===this._isDiscarded?"unknown":"disjoint"}}class Jd extends Qd{constructor(e){super(e),this._excludeInheritanceTypes=void 0;const{uploadedFrom:t,userId:i,excludeInheritanceTypes:s}=null!=e?e:{};if(void 0!==t){if(!t.length)throw We.create(Be.UNSUPPORTED,"Empty uploadedFrom array is not currently supported.");this._uploadedFrom=t}i&&(this._userId=i),s&&(this._excludeInheritanceTypes=new Set(s))}get name(){return Zn}get hash(){var e;let t=`${super.hash}:${this._uploadedFrom}:${this._userId}`;return t+=":excludeinheritancetypes="+((null===(e=this._excludeInheritanceTypes)||void 0===e?void 0:e.size)?`${[...this._excludeInheritanceTypes].sort().join(",")}`:"none"),t}get uploadedFrom(){return this._uploadedFrom}get userId(){return this._userId}get excludeInheritanceTypes(){return this._excludeInheritanceTypes}matches(e){var t,i;return(!this._userId||this._userId===e.storageAssignee.id)&&!(Array.isArray(this._uploadedFrom)&&e.createdFromUpload&&!this._uploadedFrom.includes(null!==(t=e.createdByClientId)&&void 0!==t?t:""))&&!(("ALL"===this._uploadedFrom||Array.isArray(this._uploadedFrom))&&!e.createdFromUpload)&&(!(null===(i=this._excludeInheritanceTypes)||void 0===i?void 0:i.has(ao.StudentAssignmentAssetId))||!e.isChildOfStudentAssignment)&&super.matches(e)}getRelationToFilter(e){if(e.name!==Zn)return tn("USSAdobeAssetFilter","Cannot switch between an AdobeAssetFilter and a USSAdobeAssetFilter"),"disjoint";if(this._userId&&e.userId&&this._userId!==e.userId)return"disjoint";if(this._excludeInheritanceTypes&&e._excludeInheritanceTypes&&[...this._excludeInheritanceTypes].sort()!==[...e._excludeInheritanceTypes].sort())return"disjoint";if(this.excludeInheritanceTypes&&!e.excludeInheritanceTypes||!this.excludeInheritanceTypes&&e.excludeInheritanceTypes)return"unknown";if(Array.isArray(this.uploadedFrom)&&Array.isArray(e.uploadedFrom)){const t=_o(this.uploadedFrom,e.uploadedFrom);if("disjoint"===t)return"disjoint";if("unknown"===t)return"unknown"}return!this.uploadedFrom&&e.uploadedFrom||"ALL"===this.uploadedFrom&&Array.isArray(e.uploadedFrom)||!this.userId&&e.userId?"unknown":super.getRelationToFilter(e)}}const Xd={created:(e,t)=>Un(e.created,t.created)};class Zd extends(Fn(Xd)){}Zd.default=new Zd("descending","created");const eu={[yt.STUDENT_ASSIGNMENTS_COLLECTION]:["assignmentId","assignmentCode","includeStudentDocuments"],[yt.STUDENT_ASSIGNMENTS_PRIMARY]:["studentAssignmentId","includeStudentDocuments"]};var tu;!function(e){e.NOT_STARTED="NOT_STARTED",e.IN_PROGRESS="IN_PROGRESS",e.RETURNED="RETURNED",e.SUBMITTED="SUBMITTED"}(tu||(tu={}));const iu=[tu.IN_PROGRESS,tu.NOT_STARTED,tu.RETURNED,tu.SUBMITTED];var su;!function(e){e.Any="ANY",e.Self="SELF"}(su||(su={}));const ru={includeStudentDocuments:!1},nu=Ra();class ou extends pr{async _discoverLinks(e){return(await this._getResponse(e,{headers:nu}))._links}_getEndpointHref(e){return`https://${this._core._environment.endpoints.ASSIGNMENTS_HOST}${e}`}async discoverStudentAssignmentLinks(){return this._discoverLinks(this._getEndpointHref("/api/v1/index"))}async getStudentAssignments(e){let t={};if(e.assignmentId)t={assignmentId:e.assignmentId};else{if(!e.assignmentCode)throw We.create(Be.BAD_REQUEST,"Either assignmentCode or assignmentId must be provided");t={assignmentCode:e.assignmentCode}}const{loadDocuments:i=!1}=e,s=qe(e,["loadDocuments"]),r=Object.assign({},s);Object.keys(r).forEach((e=>{const t=r[e];(""===t||void 0===t||Array.isArray(t)&&0===t.length)&&delete r[e]}));const n=Object.assign(Object.assign(Object.assign({},t),r),{includeStudentDocuments:i}),o=function(e,t){const i=Object.assign(Object.assign({},ru),t);return new URL(It(e,yt.STUDENT_ASSIGNMENTS_COLLECTION,i)).toString()}(await this.discoverStudentAssignmentLinks(),n);return await this._getResponse(o,{headers:nu})}async getStudentAssignment(e,t,i){var s;const r=null!==(s=null==t?void 0:t.loadDocuments)&&void 0!==s&&s,n=Object.assign({studentAssignmentId:e,includeStudentDocuments:r},t),o=It(await this.discoverStudentAssignmentLinks(),yt.STUDENT_ASSIGNMENTS_PRIMARY,n);return this._getResponse(o,{headers:Object.assign(Object.assign({},nu),i)})}async return(e){const{links:t,studentAssignmentId:i,submissionId:s}=e,r=It(t,yt.ASSIGNMENTS_RETURN,{studentAssignmentId:i,submissionId:s});return(await this._doPost(r,nu,void 0,[200])).json()}async start(e){const{assignmentId:t,links:i}=e,s=It(i,yt.ASSIGNMENTS_START,{assignmentId:t});return(await this._doPost(s,nu,void 0,[200])).json()}async submit(e){const{links:t,studentAssignmentId:i,submissionId:s}=e,r=It(t,yt.ASSIGNMENTS_SUBMIT,{studentAssignmentId:i,submissionId:s});return(await this._doPost(r,nu,void 0,[200])).json()}}Ye([rt((function(e){return vt(e,eu)})),Qe(0,it)],ou.prototype,"_discoverLinks",null);const au="application/vnd.adobecloud.subscription+json",cu="Authorization";var lu;!function(e){e[e.Active=0]="Active",e[e.Inactive=1]="Inactive",e[e.Registering=2]="Registering"}(lu||(lu={}));const du={includeResources:[{reltype:"api:annotation"},{reltype:"api:metadata/repository"},{reltype:"api:metadata/application"},{reltype:"api:ac/policy"}]},uu={includeLabels:["favorite","lastAccessDate"]};class hu extends ct{constructor(e){super(),this.fromCache=e}}class pu extends ar{constructor(e,t){if(super(e._core),this._onsContext=e,this._pendingONSObjects=new Map,this._watchedONSObjects=new Map,this._initializedFromCache=!1,this._monitoringStatus=lu.Inactive,t){const{id:e,href:i,onsObjects:s,expiresAt:r}=t;this._subscriptionId=e,this._subscriptionHref=i,this._expiresAt=r,this._watchedONSObjects=new Map(Object.entries(s||{})),this._initializedFromCache=this._watchedONSObjects.size>0}}get subscriptionId(){return this._subscriptionId}get subscriptionHref(){return this._subscriptionHref}get expiresAt(){var e;return null!==(e=this._expiresAt)&&void 0!==e?e:0}get lastError(){return this._lastError}get watchedONSObjects(){return this._watchedONSObjects}get continuationToken(){return this._continuationToken}set continuationToken(e){this._continuationToken=e}get monitoringStatus(){return this._monitoringStatus}set monitoringStatus(e){this._monitoringStatus=e}abort(){return!!this._retryTimeout&&(clearTimeout(this._retryTimeout),this._retryTimeout=void 0,this.logInfo(`Subscription ${this.subscriptionId} retry got aborted`),!0)}get pendingONSObjects(){return this._pendingONSObjects}set pendingONSObjects(e){this._pendingONSObjects=new Map(e),this._update()}async _update(e=0){var t;this.abort();const i=this._pendingONSObjects;if(ds(i,this._watchedONSObjects))this._lastError?(this._lastError=void 0,this.emit(at)):this._initializedFromCache&&this.emit(at,new hu(!0));else{this.logInfo(`Setting ${i.size} object Id(s) for ${this.subscriptionId||"<pending subscription id>"}`);try{0===i.size?(this.logInfo(`Deleting subscription ${this.subscriptionId} (requested objects no longer exist)`),this.monitoringStatus=lu.Inactive,await this._deleteSubscriptionFromServer()):this._subscriptionHref?(this.logDebug(`Updating subscription ${this.subscriptionId} on the server with objects`,i),await this._updateSubscriptionOnServer(i)):(this.logDebug("Creating new subscription with objects",i),this.monitoringStatus=lu.Inactive,await this._createSubscriptionOnServer(i)),this._watchedONSObjects=i,this._lastError=void 0,this.emit(at)}catch(i){if(this.logError(`Error updating subscription ${this.subscriptionId}:`,i),this._lastError=i,this.emit(at),e<3){let s=1e3*(Et(null===(t=i.response)||void 0===t?void 0:t.headers)||pu.DEFAULT_RETRY_INTERVAL_SEC);s=Math.max(10,s),this._retryTimeout=setTimeout((()=>{this._retryTimeout=void 0,this._update(e+1)}),s)}}}}async _parseSubscriptionResponse(e,t){const i=await t();if(i.status<200||i.status>=300){let t=`operation ${e} with http response.status: ${i.status}`;if(403===i.status){const e=await i.json();e.type===Ge.SUBSCRIPTION_COUNT&&(t=`Maximum number of subscriptions per user per device exceeded (${e.max})`)}throw this.logError(t),We.createWithResponseAndDescription(i,t)}const s=await i.json();if(!(s.id&&s._links&&s._links.self&&s._links.self.href)){const e="No subscription ID or href was returned in subscribe response.";throw this.logError(e),We.create(Be.BAD_REQUEST,e,{response:i})}this._subscriptionId=s.id,this._subscriptionHref=s._links.self.href,s.expiresAt&&(this._expiresAt=s.expiresAt)}async _createRequestBody(e){const t=function(e){const t=[];return e.forEach(((e,i)=>{"asset"===e.type?t.push(Object.assign(Object.assign({id:i},du),e)):"assetList"===e.type&&t.push(Object.assign(Object.assign({id:i},uu),e))})),t}(null!=e?e:this.watchedONSObjects),i=await this._core._environment.getDeviceId(),s={id:this.subscriptionId,objects:t,device:{id:i},expiresAt:Date.now()+this._core._environment.getValue("ONS_SUBSCRIPTION_TIME_TO_LIVE")};return JSON.stringify(s)}async _createSubscriptionOnServer(e){const t=await this._onsContext.getLink(yt.SUBSCRIPTION_CREATE),i=await this._createRequestBody(e);return this._parseSubscriptionResponse("create",(()=>this._core._environment.fetch(t,{method:"POST",body:i,authHeader:cu,headers:{"Content-Type":au}})))}async _updateSubscriptionOnServer(e){const t=[];e.forEach(((e,i)=>{if(!this._watchedONSObjects.has(i)){const s="asset"===e.type?du:uu,r={op:"add",path:"/objects/-",value:Object.assign(Object.assign({id:i},s),e)};t.push(r)}})),this._watchedONSObjects.forEach(((i,s)=>{if(!e.has(s)){const e={op:"remove",path:`/objects/id=${s}`};t.push(e)}}));const i=JSON.stringify(t);try{await this._parseSubscriptionResponse("update",(()=>this._core._environment.fetch(this._subscriptionHref,{method:"PATCH",body:i,authHeader:cu,headers:{"Content-Type":gt}}))),this.logDebug(`Updated subscription ${this._subscriptionId} on the server.`)}catch(t){if(this.logError(`Error updating subscription ${this._subscriptionId} on the server:`,t),t.code===Be.NOT_FOUND)return this.logWarn(`Subscription ${this._subscriptionId} no longer exists`),this.logDebug("Creating a new subscription for objects(s):",e),this.monitoringStatus=lu.Inactive,this._subscriptionHref=void 0,this._createSubscriptionOnServer(e);throw t}}async _deleteSubscriptionFromServer(){this.logInfo(`Deleting subscription ${this._subscriptionId}`);try{await this._core._environment.fetch(this._subscriptionHref,{method:"DELETE",authHeader:cu})}catch(e){this.logError(`Unable to delete subscription: ${this._subscriptionHref}`,e)}this._subscriptionId=void 0,this._subscriptionHref=void 0,this._expiresAt=void 0,this.monitoringStatus=lu.Inactive}async refreshSubscriptionExpiryDate(){this.logDebug(`Refreshing expiry date on subscription ${this.subscriptionId}`);const e=await this._createRequestBody();return this._parseSubscriptionResponse("update",(()=>this._core._environment.fetch(this.subscriptionHref,{method:"PUT",body:e,authHeader:cu,headers:{"Content-Type":au}}))).catch((()=>this._update()))}async _fetchChangeLogPage(e){var t,i,s,r;const n={subscriptionId:this._subscriptionId},o=this._nextChangeLogLinks?It(this._nextChangeLogLinks,yt.GENERIC_NEXT,n):await this._onsContext.getLink(yt.ONS_CHANGELOG,n),a=await this._core._environment.fetch(o,{headers:{directive:"ons-repometa"}});if(200!==a.status){let e=`Unexpected response fetching change log: ${a.status}`;throw 403===a.status&&(await a.json()).type===Ge.LIMIT_CHANGELOGRETENTION&&(e='Changelog retention period expired, discarding "next" link and fetching changelog again.',this._nextChangeLogLinks=void 0),this.logError(e),We.createWithResponseAndDescription(a,e)}const c=await a.json(),l=(null!==(t=c["ons:changedSubscriptions"])&&void 0!==t?t:[]).find((e=>e["ons:subscriptionId"]===this._subscriptionId));return(null!==(i=null==l?void 0:l["ons:changes"])&&void 0!==i?i:[]).forEach((t=>{var i,s,r;const n=t["repo:assetId"],o=null!==(i=t["ons:resources"])&&void 0!==i?i:[],a=[...Object.keys(o)],c=t["ons:subscribedDirectoryAssetId"],l=t["asset:labels"],d=null===(r=null===(s=o["api:annotation"])||void 0===s?void 0:s["repo:resource"])||void 0===r?void 0:r.annotation_id;if(n)if(e.has(n)){const t=e.get(n);t.changedResources=[...new Set([...t.changedResources,...a])],d&&(t.annotationIds=[...new Set([...t.annotationIds||[],d])]),e.set(n,t)}else e.set(n,Object.assign({parentAssetId:c,changedLabels:l,changedResources:a},d&&{annotationIds:[d]}))})),this._nextChangeLogLinks=null==c?void 0:c._links,null===(r=null===(s=this._nextChangeLogLinks)||void 0===s?void 0:s.next)||void 0===r?void 0:r.nextPage}async fetchAndNotifyChanges(e=0){this.logInfo(`Fetching ChangeLog for subscription ${this._subscriptionId}...`),this._retryChangeLogTimeout&&clearTimeout(this._retryChangeLogTimeout);const t=t=>{var i;const s=1e3*Et(null===(i=t.response)||void 0===i?void 0:i.headers),r=Math.max(s,this._core._environment.getRetryInterval(e));this.logInfo(`Retrying change log fetch in ${r}ms`),this._retryChangeLogTimeout=setTimeout((()=>this.fetchAndNotifyChanges(e+1)),r)},i=new Map;try{let e=!0;for(;e;)e=await this._fetchChangeLogPage(i)}catch(e){this.logError("Error fetching change log",e),t(e)}i.size&&(this.logDebug("Changed asset(s):",i),this._onsContext.emit(at,new kl(i)))}async validate(){if(!this._subscriptionHref)return this._pendingONSObjects.size>0?(this.logWarn("Objects exist for subscription but no _subscriptionHref was found, trying to _update() again..."),this._update()):void this.logDebug("Subscription has no assets and no _subscriptionHref set");let e;try{e=await this._core._environment.fetch(this._subscriptionHref,{authHeader:cu}),this.logInfo(`Subscription ${this._subscriptionId} exists on the server`)}catch(e){return void this.logError(`Error checking ${this._subscriptionId}, it does not exist on the server`,e)}return[200,201,204].includes(e.status)?void 0:(this.logInfo("ONS subscription has been invalidated. Creating new subscription..."),this.monitoringStatus=lu.Inactive,this._subscriptionHref=void 0,this._subscriptionId=void 0,this._watchedONSObjects=new Map,this._update())}logDebug(e,...t){this._onsContext.logger.logDebug(e,"Subscription",...t)}logInfo(e,...t){this._onsContext.logger.logInfo(e,"Subscription",...t)}logWarn(e,...t){this._onsContext.logger.logWarn(e,"Subscription",...t)}logError(e,...t){this._onsContext.logger.logError(e,"Subscription",...t)}}pu.DEFAULT_RETRY_INTERVAL_SEC=0,Ye([wt],pu.prototype,"_update",null),Ye([wt],pu.prototype,"fetchAndNotifyChanges",null);const _u="ONS_SUBSCRIPTIONS";class mu extends ar{constructor(e){super(e._core),this._onsContext=e,this._subscriptions=[],this._maxAssetsPerSubscription=5,this._cachedSubscriptionsUsed=!1,this._ONSObjectIds=new Set,this._onSubscriptionChange=e=>{(null==e?void 0:e.fromCache)||(this._cachedSubscriptionsUsed=!1),this._updateCachedSubscriptions(),this._restartMonitoring()},this._cache=e._core._environment.cache}get isActive(){return Boolean(this._abortController)}get subscriptions(){return this._subscriptions}async ensureReady(){return!0}async deinitialize(){return this.stop(),!0}async start(){this.isActive?this.logDebug("ONS Long Poll worker is already started! Skipping this request!"):(this.logInfo("Starting ONS Long Poll Worker..."),this._abortController=new AbortController,this._poll(),this.emit(Ml,new Ul(xl.Active)))}stop(){if(!this.isActive)return void this.logDebug("ONS Long Poll worker is already stopped! Skipping this request!");this.logInfo("Stopping ONS Long Poll Worker..."),this.subscriptions.forEach((e=>e.abort()));const e=this._abortController;delete this._abortController,this._abortController=void 0,null==e||e.abort(),this.emit(Ml,new Ul(xl.Inactive))}async _restartMonitoring(){const e=this._activeSubscriptionIds,t=0===e.length?void 0:await this._onsContext.getLink(yt.NOTIFICATIONS_LONGPOLL,{includeJournal:"false",subscriptionId:e}),i=this._pollURL!==t;this._pollURL=t,this.isActive&&i&&(this.stop(),this.start())}_notifyFirstLongPollStarted(){this.emit(Nl,new Hl(this._cachedSubscriptionsUsed))}_notifyFirstLongPollCompleted(e){this.emit(Dl,new jl(e))}_validateAndUpdateSubscriptionExpiration(){const e=Date.now(),t=Math.max(.1*this._core._environment.getValue("ONS_SUBSCRIPTION_TIME_TO_LIVE"),this._core._environment.getValue("ONS_SUBSCRIPTION_RENEW_TIME"));this.subscriptions.filter((i=>i.watchedONSObjects.size&&i.expiresAt-e<t)).forEach((e=>e.refreshSubscriptionExpiryDate()))}_truncateAssetIdsByMaxSizeIfNeeded(e,t){const i=this._maxAssetsPerSubscription*this._subscriptions.length,s=new Set([...e,...t]);if(s.size>i){this.logInfo(`Total number of assets (${s.size}) exceeds the maximum allowed by ONS. Limiting to ${i}`);const e=Array.from(s).slice(0,i);return new Set(e)}return s}async _getAndParseCachedSubscriptions(){if(!this._onsContext.cacheEnabled)return[];const e=await this._cache.getItem(_u);if(e!==Ti)try{return JSON.parse(e).subscriptions}catch(e){this.logInfo("error parsing cached subscriptions")}return[]}get _activeSubscriptionIds(){return Array.from(this._subscriptions).filter((e=>e.subscriptionId&&e.watchedONSObjects.size>0)).map((e=>`${e.subscriptionId}`)).sort()}async _updateCachedSubscriptions(){if(!this._onsContext.cacheEnabled)return;const e=[];this._subscriptions.forEach((t=>{const{subscriptionId:i,subscriptionHref:s,pendingONSObjects:r,expiresAt:n}=t;if(!i||!s)return;const o={id:i,href:s,onsObjects:Object.fromEntries(r),expiresAt:n||Date.now()+this._core._environment.getValue("ONS_SUBSCRIPTION_TIME_TO_LIVE")};e.push(o)})),await this._cache.setItem(_u,JSON.stringify({subscriptions:e}),this._core._environment.getValue("ONS_SUBSCRIPTION_TIME_TO_LIVE"))}async _ensureSubscriptions(){const e=await this._onsContext.getSubscriptionConfig(),t=e.maxSubscriptionPerLongPoll||this._core._environment.getValue("ONS_DEFAULT_MAX_SUBSCRIPTIONS");if(this._maxAssetsPerSubscription=e.maxAssetsPerRequest||this._core._environment.getValue("ONS_DEFAULT_MAX_ASSETS_PER_SUBSCRIPTION"),t>this._subscriptions.length){const e=await this._getAndParseCachedSubscriptions();this._cachedSubscriptionsUsed=e.length>0;for(let i=this._subscriptions.length;i<t;++i){const t=new pu(this._onsContext,e[i]);this._subscriptions.push(t),t.on("change",this._onSubscriptionChange)}}else if(t<this._subscriptions.length){for(let e=t;e<this._subscriptions.length;++e){const t=this._subscriptions[e];t.pendingONSObjects=new Map,t.off("change",this._onSubscriptionChange)}this._subscriptions.length=t}}async watch(e,t){await this._ensureSubscriptions(),this._ONSObjectIds=this._truncateAssetIdsByMaxSizeIfNeeded(t,e);const i=e=>{if(t.has(e))return{type:"assetList",listLevel:"shallow"};const i=this._onsContext._core.hostAssetContext._assetPool.getLocalItemById(e);return Object.assign({type:"asset"},(null==i?void 0:i.isFolder)?{directoryLevel:"shallow"}:{})},s=new Set,r=this._subscriptions.map((e=>{const t=new Map;return e.pendingONSObjects.forEach(((e,r)=>{this._ONSObjectIds.has(r)&&s.add(r)&&t.set(r,i(r))})),t}));let n=0;this._ONSObjectIds.forEach((e=>{if(!s.has(e)){for(;r[n].size>=this._maxAssetsPerSubscription;)n++;r[n].set(e,i(e))}})),this._subscriptions.forEach(((e,t)=>{e.pendingONSObjects=r[t],e.pendingONSObjects.size>0&&this.logDebug(`Subscription #${t} (${e.subscriptionId}) now has ${e.pendingONSObjects.size} items.`)}))}async _poll(e=0){const t=(t,i=0)=>{i=Math.max(this._core._environment.getRetryInterval(e),i);const s=this._abortController;if(!s)return;this.logInfo(`Retrying long poll in ${i}ms`);const r=setTimeout((()=>this._poll(e+1)),i);s.signal.addEventListener("abort",(()=>{s!==this._abortController&&clearTimeout(r)}))},i=this._abortController;if(i)try{if(void 0===this._pollURL)return void this.logInfo("Poll URL undefined...");this._notifyFirstLongPollStarted();const e=this._pollURL,s=18e4,r=await this._core._environment.fetch(e,{signal:i.signal,authHeader:"X-User-Token",headers:{"x-poll-timeout":"160"},requestTimeoutMs:s});if([200,201,204].includes(r.status)){const t=await r.json();this._notifyFirstLongPollCompleted(!1),this.logInfo(`Successful long poll for ${e}`),t&&t.subscriptions&&t.subscriptions.length>0&&(this.logInfo(`Subscriptions changed: ${t.subscriptions.join(", ")}`),t.subscriptions.forEach((e=>{const t=this.subscriptions.find((t=>t.subscriptionId===e));null==t||t.fetchAndNotifyChanges()})),this._validateAndUpdateSubscriptionExpiration(),this.emit("notified")),t&&t.checkSubscriptions&&t.checkSubscriptions.length>0&&(this.logInfo(`Checking subscriptions for subscriptions to check ${t.checkSubscriptions.length}`),t.checkSubscriptions.forEach((e=>{const t=this.subscriptions.find((t=>t.subscriptionId===e));t&&t.validate()}))),this._pollURL=t&&t._links&&t._links.next&&t._links.next.href,this._poll()}else 404===r.status?(this._notifyFirstLongPollCompleted(!0),this.logInfo(`404 Response long poll for ${e}, subscription missing or expired`),this.subscriptions.forEach((e=>{e.subscriptionId&&e.validate()})),t(0,this._core._environment.getValue("MAX_RETRY_INTERVAL"))):(this.logInfo(`Unexpected response, trying again ${e}`),t(0,1e3*Et(r.headers)))}catch(e){if(i.signal.aborted&&i!==this._abortController)return this.emit("aborted"),void this._notifyFirstLongPollCompleted(!0);this.logInfo("Error trying to create long poll request"),t()}else this.logInfo("No abort controller...")}logDebug(e,...t){this._onsContext.logger.logDebug(e,"Long Poll",...t)}logInfo(e,...t){this._onsContext.logger.logInfo(e,"Long Poll",...t)}logWarn(e,...t){this._onsContext.logger.logWarn(e,"Long Poll",...t)}logError(e,...t){this._onsContext.logger.logError(e,"Long Poll",...t)}}Ye([wt],mu.prototype,"_restartMonitoring",null),Ye([nt],mu.prototype,"_notifyFirstLongPollStarted",null),Ye([nt],mu.prototype,"_notifyFirstLongPollCompleted",null),Ye([wt],mu.prototype,"_updateCachedSubscriptions",null);class fu extends Rs{constructor(e){super(),this._onsContext=e,this._isActive=!1,this._subscriptions=[],this._maxAssetsPerSubscription=100,this._ONSObjectIds=new Set,this._registrationOperationIds=new Set,this._onVcMessage=e=>{switch(e.operationName){case"notification":this._handleNotification(e.body);break;case"error":if(this._registrationOperationIds.has(e.operationId))return this._registrationOperationIds.clear(),this.logError("ONS Error received for a registration operation. Will close the ONS Virtual Connection.",e),void this._closeAxonVc().then((()=>{this._restartMonitoring()}));this.logError("Unknown ONS Error received.",e);break;default:this.logWarn("Unknown Axon Message received",e)}},this._onVcError=e=>{this.logError("Axon Error received",e)},this._onVcDeleted=()=>{this.logInfo("Axon Virtual Connection has been deleted"),this.deinitialize(),this.ensureReady()},this._onVcSessionStatusChanged=()=>{var e;(null===(e=this._axonVc)||void 0===e?void 0:e.isActive())?(this.logDebug("Virtual Connection status changed to Active. Restarting ONS Monitoring..."),this.emit(Ml,new Ul(xl.Restarting)),this._restartMonitoring()):(this.logDebug("Virtual Connection status changed to non-Active."),this.emit(Ml,new Ul(xl.Inactive)))},this._onSubscriptionChange=e=>{this.logDebug("Subscriptions changed!"),this._restartMonitoring()}}get isActive(){return this._isActive}get subscriptions(){return this._subscriptions}_handleNotification(e){var t,i;this.logDebug("Axon Notification received",e),null===(t=e.subscriptions)||void 0===t||t.forEach((e=>{const t=this.subscriptions.find((t=>t.subscriptionId===e.id));t?(t.monitoringStatus=lu.Active,t.continuationToken=e.continuationToken,t.fetchAndNotifyChanges()):this.logWarn(`Subscription ${e.id} not found in the subscriptions array. Skipping notification handling.`)})),this._validateAndUpdateSubscriptionExpiration(),null===(i=e.checkSubscriptions)||void 0===i||i.forEach((e=>{const t=this.subscriptions.find((t=>t.subscriptionId===e.id));t&&t.validate()}))}async _ensureAxonVc(){var e;const t=await this._onsContext._core._getAxonClient();if(!await t.session.ensureEstablished())throw new Error("Axon Session could not be established!");if(this._axonVc&&await this._axonVc.ensureActive())return this._axonVc;this.logDebug("ONS Virtual Connection is not active. Will create a new one..."),this._deactivate();const i=await this._onsContext.getSubscriptionConfig();if(!(null===(e=null==i?void 0:i.onsAxonServiceName)||void 0===e?void 0:e.length))throw new Error("Failed to determine ONS Service Id");const s={"x-api-key":this._onsContext._core._environment.getValue("CLIENT_ID"),locale:t.config.locale};return this._axonVc=await t.session.createVc(i.onsAxonServiceName,s),this._axonVc.on("message",this._onVcMessage),this._axonVc.on("error",this._onVcError),this._axonVc.on("deleted",this._onVcDeleted),this._axonVc.on("session_status_changed",this._onVcSessionStatusChanged),this._axonVc}_validateAndUpdateSubscriptionExpiration(){const e=Date.now(),t=Math.max(.1*this._onsContext._core._environment.getValue("ONS_SUBSCRIPTION_TIME_TO_LIVE"),this._onsContext._core._environment.getValue("ONS_SUBSCRIPTION_RENEW_TIME"));this.subscriptions.filter((i=>i.watchedONSObjects.size&&i.expiresAt-e<t)).forEach((e=>e.refreshSubscriptionExpiryDate()))}async _closeAxonVc(){var e;if(null===(e=this._axonVc)||void 0===e?void 0:e.isActive()){const e=await this._onsContext._core._getAxonClient();if(await e.session.ensureEstablished())try{await e.session.deleteVc(this._axonVc)||this.logWarn("Failed to delete ONS Virtual Connection")}catch(e){this.logWarn("Failed to delete ONS Virtual Connection",e)}}this._deactivate()}_deactivate(){this.subscriptions.forEach((e=>e.monitoringStatus=lu.Inactive)),this._axonVc&&(this._axonVc.off("message",this._onVcMessage),this._axonVc.off("error",this._onVcError),this._axonVc.off("deleted",this._onVcDeleted),this._axonVc=void 0)}async deinitialize(){if(this.emit(Ml,new Ul(xl.Inactive)),!this._axonVc)return!0;const e=this._axonVc;let t;if(this._deactivate(),!e.isActive())return!0;try{if(t=await this._onsContext._core._getAxonClient(),!t.isConnected())return!0;if(!await t.session.ensureEstablished())throw new Error("Axon Session could not be established!")}catch(e){return this.logWarn("ONS Virtual Connection deletion skipped",e),!0}try{return await t.session.deleteVc(e)}catch(e){return this.logError("Failed to delete ONS Virtual Connection",e),!1}}async ensureReady(){try{const e=await this._ensureAxonVc();return!!await e.ensureActive()||(this.logError("Failed to acquire an active ONS Virtual Connection!"),this.emit(Ml,new Ul(xl.Error)),!1)}catch(e){return this.logError("Failed to get the ONS Virtual Connection",e),this.emit(Ml,new Ul(xl.Error)),!1}}async start(){this.isActive?this.logDebug("ONS Axon Worker is already active. Skipping this request!"):(this.logDebug("Starting ONS Axon Worker..."),this._isActive=!0,this.emit(Ml,new Ul(xl.Active)),await this.ensureReady()?await this._monitorActiveSubscriptions()||this.logError("Failed to start monitoring of active subscriptions!"):this.logError("Failed to acquire Axon virtual connection to the ONS! ONS Axon Worker will not be started."))}stop(){this.isActive?(this.logDebug("Stopping ONS Axon Worker..."),this.subscriptions.forEach((e=>e.abort())),this._isActive=!1,this.emit(Ml,new Ul(xl.Inactive))):this.logDebug("ONS Axon Worker is already stopped! Skipping this request!")}async _restartMonitoring(){this.isActive?(this.logDebug(`Restarting ONS Monitoring over Axon for active subscriptions: [${this._activeSubscriptions.map((e=>e.subscriptionId)).join(",")}].`),this.stop(),await this.start()):this.logDebug("ONS Axon Worker is not active. Skipping this request!")}get _subscriptionsWithAssets(){return Array.from(this._subscriptions).filter((e=>e.pendingONSObjects.size>0))}get _activeSubscriptions(){return this._subscriptionsWithAssets.filter((e=>e.subscriptionId&&e.subscriptionHref)).sort(((e,t)=>e.subscriptionId<=t.subscriptionId?-1:1))}get _monitoredSubscriptions(){return this._activeSubscriptions.filter((e=>e.monitoringStatus===lu.Active))}async _monitorActiveSubscriptions(){let e=this._activeSubscriptions.filter((e=>e.monitoringStatus===lu.Inactive));if(0===e.length)return this.logDebug(`No new subscriptions to register for monitoring. Currently monitoring: [${this._monitoredSubscriptions.map((e=>e.subscriptionId)).join(",")}].`),!0;if(!await this.ensureReady())return this.logError("Failed to acquire Axon connection to ONS!"),!1;for(const t of e)await t.validate();e=e.filter((e=>e.subscriptionHref)),this.logDebug(`Registering monitoring for new active subscriptions: [${e.map((e=>e.subscriptionId)).join(",")}].`);try{const t=bi();this._registrationOperationIds.add(t);const i={operationName:"register",operationId:t,body:this._createMonitoringRegistrationRequest(e)};return this.logDebug("Sending subscription monitoring request over Axon",i),this._axonVc.sendMessage(JSON.stringify(i)),e.forEach((e=>e.monitoringStatus=lu.Registering)),!0}catch(e){return this.logError("Failed to send subscription monitoring request over Axon",e),!1}}_createMonitoringRegistrationRequest(e){const t={subscriptions:[]};for(const i of e){if(!i.subscriptionId)continue;const e={id:i.subscriptionId};i.continuationToken&&(e.continuationToken=i.continuationToken),t.subscriptions.push(e)}return t}async _ensureSubscriptions(){const e=this._onsContext._core._environment.getValue("ONS_DEFAULT_MAX_SUBSCRIPTIONS");if(this._maxAssetsPerSubscription=this._onsContext._core._environment.getValue("ONS_DEFAULT_MAX_ASSETS_PER_SUBSCRIPTION"),e>this._subscriptions.length)for(let t=this._subscriptions.length;t<e;++t){const e=new pu(this._onsContext);this._subscriptions.push(e),e.on("change",this._onSubscriptionChange)}else if(e<this._subscriptions.length){for(let t=e;t<this._subscriptions.length;++t){const e=this._subscriptions[t];e.pendingONSObjects=new Map,e.off("change",this._onSubscriptionChange)}this._subscriptions.length=e}}_truncateAssetIdsByMaxSizeIfNeeded(e,t){const i=this._maxAssetsPerSubscription*this._subscriptions.length,s=new Set([...e,...t]);if(s.size>i){this.logWarn(`Number of assets (${s.size}) exceeds the maximum allowed by ONS. Limiting to ${i}`);const e=Array.from(s).slice(0,i);return new Set(e)}return s}async watch(e,t){await this._ensureSubscriptions(),this._ONSObjectIds=this._truncateAssetIdsByMaxSizeIfNeeded(t,e);const i=e=>{if(t.has(e))return{type:"assetList",listLevel:"shallow"};const i=this._onsContext._core.hostAssetContext._assetPool.getLocalItemById(e);return Object.assign({type:"asset"},(null==i?void 0:i.isFolder)?{directoryLevel:"shallow"}:{})},s=new Set,r=this._subscriptions.map((e=>{const t=new Map;return e.pendingONSObjects.forEach(((e,r)=>{this._ONSObjectIds.has(r)&&s.add(r)&&t.set(r,i(r))})),t}));let n=0;this._ONSObjectIds.forEach((e=>{if(!s.has(e)){for(;r[n].size>=this._maxAssetsPerSubscription;)n++;r[n].set(e,i(e))}})),this._subscriptions.forEach(((e,t)=>{e.pendingONSObjects=r[t],e.pendingONSObjects.size>0&&this.logDebug(`Subscription #${t} (${e.subscriptionId}) now has ${e.pendingONSObjects.size} items.`)}))}logDebug(e,...t){this._onsContext.logger.logDebug(e,"Axon",...t)}logInfo(e,...t){this._onsContext.logger.logInfo(e,"Axon",...t)}logWarn(e,...t){this._onsContext.logger.logWarn(e,"Axon",...t)}logError(e,...t){this._onsContext.logger.logError(e,"Axon",...t)}}Ye([wt],fu.prototype,"deinitialize",null),Ye([wt],fu.prototype,"ensureReady",null),Ye([wt],fu.prototype,"start",null),Ye([wt],fu.prototype,"_restartMonitoring",null),Ye([wt],fu.prototype,"_monitorActiveSubscriptions",null);const gu=[yt.SUBSCRIPTION_CREATE,yt.ONS_CHANGELOG];class yu extends ar{constructor(e,t=e._environment.getValue("ENABLE_ONS_CACHE")){super(e),this._cacheEnabled=t,this._isStarted=!1,this._assetsIds=new Set,this._plsAssetListIds=new Set,this._onsMonitoringStatus=xl.Unknown,this._onONSMonitoringStatusChanged=e=>{this.logDebug(`ONS Monitoring Status changed to '${xl[e.status]}'.`),this.onsMonitoringStatus=e.status},this._onVisibilityChange=()=>{var e;this._stopTimeout&&(clearTimeout(this._stopTimeout),this._stopTimeout=void 0),"visible"===(null===(e=this._document)||void 0===e?void 0:e.visibilityState)?this.worker.start():this._stopTimeout=setTimeout((()=>this.worker.stop()),this._core._environment.getValue("ONS_DOCUMENT_VISIBILITY_TIMEOUT"))},this._useAxon=e._environment.getValue("ONS_OVER_AXON"),this._logger=new sl("ONS",e._environment.logSink),this._core._environment.getValue("ENVIRONMENT")===as.Stage&&(this._logger.logLevel=tl.DEBUG),this.onsMonitoringStatus=xl.Inactive}get onsMonitoringStatus(){return this._onsMonitoringStatus}set onsMonitoringStatus(e){this.onsMonitoringStatus!==e&&(this._onsMonitoringStatus=e,this.emit(Ml,new Ul(e)))}get useAxon(){return this._useAxon}set useAxon(e){this.logInfo(`Setting ONS Context transport mode to ${e?"Axon":"Long Poll"}.`),this._useAxon!==e&&this._reinitialize(e)}get logger(){return this._logger}get cacheEnabled(){return this._cacheEnabled}get isActive(){return!!(this._useAxon&&this._onsAxonWorker||!this._useAxon&&this._onsLongPollWorker)&&this.worker.isActive}get isStarted(){return this._isStarted}get worker(){return this._useAxon?this._getAxonWorker():this._getLongPollWorker()}get watchedObjectIds(){const e=new Set;return this.worker.subscriptions.forEach((t=>{t.watchedONSObjects.forEach(((t,i)=>e.add(i)))})),e}get _document(){if("object"==typeof window&&null!==window&&window.document instanceof Document)return window.document}get _documentSupportsVisibility(){const e=this._document;return!!e&&"function"==typeof e.addEventListener&&"function"==typeof e.removeEventListener&&"string"==typeof e.visibilityState&&"object"==typeof e.onvisibilitychange}_getAxonWorker(){return this._onsAxonWorker||(this._onsAxonWorker=new fu(this),this.onsMonitoringStatus=xl.Inactive,this._onsAxonWorker.on(Ml,this._onONSMonitoringStatusChanged)),this._onsAxonWorker}_getLongPollWorker(){return this._onsLongPollWorker||(this._onsLongPollWorker=new mu(this),this.onsMonitoringStatus=xl.Inactive,this._onsLongPollWorker.on(Ml,this._onONSMonitoringStatusChanged),this._onsLongPollWorker.on(at,(e=>{this.emit(at,e)})),this._onsLongPollWorker.on(Nl,(e=>{this.emit(Nl,e)})),this._onsLongPollWorker.on(Dl,(e=>{this.emit(Dl,e)})),this._onsLongPollWorker.on("aborted",(()=>{this.emit("aborted")})),this._onsLongPollWorker.on("notified",(()=>{this.emit("notified")}))),this._onsLongPollWorker}async _reinitialize(e){const t=e?"Axon":"Long Poll";this.logInfo(`Reinitializing ONS Context Process for transport mode: ${t}...`);const i=e=>{const i=`Error initializing ONS Context for transport mode: ${t}`;this.logError(i,e)},s=this.isStarted;await this._deinitialize().then((e=>{if(!e)throw new Error("Failed to deinitialize ONS Context");this.logInfo("ONS Context deinitialized.")})).catch(i),this._useAxon=e,await this.watch(this._assetsIds,this._plsAssetListIds).then((()=>{this.logInfo("ONS Context reinitialized.")})).catch(i),s&&await this.start()}async ensureInitialized(){try{return this.worker.ensureReady()}catch(e){return this.logError("Failed to initialize ONS Axon Worker",e),!1}}async _deinitialize(){this.logInfo("Deinitializing ONS Context..."),this.isStarted&&this.stop();const e=this.worker.deinitialize();return this.worker.off(Ml,this._onONSMonitoringStatusChanged),this._useAxon?this._onsAxonWorker=void 0:this._onsLongPollWorker=void 0,this.onsMonitoringStatus=xl.Unknown,e}async start(){var e,t;if(!this._isStarted)return this.logInfo("Activating ONS Context..."),this._isStarted=!0,this._documentSupportsVisibility&&(null===(e=this._document)||void 0===e||e.addEventListener("visibilitychange",this._onVisibilityChange)),this._documentSupportsVisibility&&"visible"!==(null===(t=this._document)||void 0===t?void 0:t.visibilityState)?void 0:this.worker.start();this.logDebug("ONS Context is already active! Skipping activation call...")}stop(){var e;this._isStarted?(this.logInfo("Deactivating ONS Context..."),this._isStarted=!1,this._documentSupportsVisibility&&(null===(e=this._document)||void 0===e||e.removeEventListener("visibilitychange",this._onVisibilityChange)),this._stopTimeout&&(clearTimeout(this._stopTimeout),this._stopTimeout=void 0),this.worker.stop()):this.logDebug("ONS Context is inactive! Skipping deactivation call...")}async watch(e,t){const i=new Set,s=t;if(e.forEach((t=>{var s;const r=this._core.hostAssetContext._assetPool.getLocalItemById(t);if(!r||r.isFolder)return i.add(t),void this.logDebug(`Will unconditionally monitor asset ${t} of type ${(null==r?void 0:r.isFolder)?"folder":"unknown"}.`);const n=null===(s=null==r?void 0:r.ancestorIDs)||void 0===s?void 0:s.at(-1);n?e.has(n)?this.logDebug(`Asset ${t} will be monitored via shallow monitoring of its parent ${n}`):(i.add(t),this.logDebug(`Will monitor asset ${t} because its parent is unknown.`)):(i.add(t),this.logDebug(`Will monitor asset ${t} because it has no parent.`))})),this._assetsIds=i,this.logDebug(`Watching ${this._assetsIds.size} asset(s):`,this._assetsIds),await this.ensureInitialized())return this.worker.watch(this._assetsIds,s);this.logError("Failed to watch assets due to ONS Context initialization error.")}async _getAndCacheDocument(e){return(await this._core._environment.fetch(e,{headers:{Accept:"application/vnd.syncservice.v2.hal+json"},authHeader:"X-User-Token"})).json()}async _getSyncServiceDiscovery(){var e;const t=await this._getAndCacheDocument(`https://${this._core._environment.endpoints.SYNC_SERVICE_HOST}/api/v1`);if(!this.useAxon&&!(null===(e=null==t?void 0:t._links)||void 0===e?void 0:e[yt.NOTIFICATIONS_LONGPOLL]))throw We.create(Be.UNKNOWN,"Invalid Sync Service Discovery (Missing the required link for Long Poll).");return t}async getSubscriptionConfig(){var e,t;try{const i=await this._getSyncServiceDiscovery();return null!==(t=null===(e=null==i?void 0:i.config)||void 0===e?void 0:e.subscriptions)&&void 0!==t?t:{}}catch(e){return this.logInfo(`Error fetching ONS subscription config from the Sync Service Discovery: ${e}`),{}}}async getLink(e,t={}){return It((await this._getSyncServiceDiscovery())._links,e,t)}logDebug(e,...t){this._logger.logDebug(e,"Context",...t)}logInfo(e,...t){this._logger.logInfo(e,"Context",...t)}logWarn(e,...t){this._logger.logWarn(e,"Context",...t)}logError(e,...t){this._logger.logError(e,"Context",...t)}}Ye([wt],yu.prototype,"ensureInitialized",null),Ye([wt],yu.prototype,"_deinitialize",null),Ye([wt],yu.prototype,"watch",null),Ye([rt((e=>e._links&&gu.every((t=>e._links[t])))),Qe(0,it)],yu.prototype,"_getAndCacheDocument",null);class vu extends kn{matches(e){return!!e.isAvailableOffline&&super.matches(e)}}class Ou extends kn{constructor(){super({_isSharedWithYou:!0})}matches(e){return!0===e.isFavorite}}class bu{constructor(e){this._core=e}async loadPage(e){return await this._loadPage(e)}get assetListId(){return this._assetListId}async _loadPage(e,t){var i;const s=await this._core._getGQLManager(),{mediaTypes:r}=e.filter,{field:n,direction:o}=e.order,{items:a,pageInfo:c,assetListId:l}=await s.getFavorites({first:(null===(i=e.loadOptions)||void 0===i?void 0:i.limit)||50,after:t,filter:r?{dc_format:[...r].sort()}:void 0,orderBy:{field:"name"===n?"NAME":"CREATE_DATE",direction:"ascending"===o?"ASCENDING":"DESCENDING"}},e.resource);l&&(this._assetListId=l);const d=this._core._environment.getValue("GQL_LIST_UPDATE_LATENCY"),u=Date.now()-d,h=this._core._getAssetPool().createLoaderUpdateSession(u),p=Ec.updateRemoteItems(h,a);let _;return h.commit(),c.hasNextPage&&(_=e=>this._loadPage(e,c.endCursor)),{items:p,loadNextPage:_,assetListId:l}}}class Iu{constructor(e){this._core=e}async loadPage(e){return await this._loadPage(e)}supportsFilter(){return!0}get assetListId(){return this._assetListId}async _loadPage(e,t){var i,s;const r=this._getAssetListFilter(e),n=Date.now()-this._core._environment.getValue("GQL_LIST_UPDATE_LATENCY"),o=new sn,{items:a,pageInfo:c,assetListId:l}=await this._getPLSData({first:null!==(s=null===(i=e.loadOptions)||void 0===i?void 0:i.limit)&&void 0!==s?s:20,after:t,filter:r,order:e.order,resource:e.resource},(async e=>{await o.promise,this._processIncrementalData(e)}));l&&(this._assetListId=l);const d=this._core._getAssetPool().createLoaderUpdateSession(n),u=(await this._core.getAssetContext())._adobeAssetUpdater.updateRemoteItems(d,this._extractRemoteItems(a));let h;return c.hasNextPage&&(h=e=>this._loadPage(e,c.endCursor)),d.commit(),o.resolve(),{items:u,loadNextPage:h,mostRecentValidMutation:n,assetListId:this._assetListId}}_getAssetListFilter(e){const{mediaTypes:t,assetTypes:i,excludeAssetTypes:s,assetSubTypes:r}=e.filter,n={};return(null==t?void 0:t.size)&&(n.dc_format=[...t]),(null==s?void 0:s.size)?n.assetType={nin:[...s]}:(null==i?void 0:i.size)&&(n.assetType={in:[...i]}),(null==r?void 0:r.size)&&(n.assetSubType={in:[...r]}),n}_processIncrementalData(e){const t=this._core._getAssetPool(),i=t.createUpdateSession(),s=this._core._getAssetContext()._adobeAssetUpdater,r=this.getAssetNodesFromData(e).filter((e=>{var i;return(null===(i=e.appMetadata)||void 0===i?void 0:i.valueOf)&&void 0!==t.getLocalItemById(e.repo_assetId)})).map((e=>{var t;return{"repo:assetId":e.repo_assetId,_embedded:{[yt.APP_METADATA]:null===(t=e.appMetadata)||void 0===t?void 0:t.valueOf}}}));s.updateRemoteItems(i,r),i.commit()}_extractRemoteItems(e){return e}}const Eu={name:"NAME",created:"DEVICE_CREATE_DATE",modified:"DEVICE_MODIFY_DATE",shared:"SHARE_DATE"},Tu={ascending:"ASCENDING",descending:"DESCENDING"};class Su extends Iu{async _getPLSData({first:e,after:t,filter:i,order:s,resource:r},n){const o=await this._core._getGQLManager();return await o.getSharedWithYou({first:e,after:t,filter:i,orderBy:{field:Eu[s.field],direction:Tu[s.direction]}},r,n)}getAssetNodesFromData(e){return e.sharedWithYou.assetListConnection.edges.map((e=>e.node))}_extractRemoteItems(e){return e.filter((e=>"directory"!==e["repo:assetClass"]))}}class Au extends Iu{async _getPLSData({first:e,after:t,filter:i,resource:s},r){const n=await this._core._getGQLManager();return await n.recents({first:e,after:t,filter:i},s,r)}getAssetNodesFromData(e){return e.recents.assetListConnection.edges.map((e=>e.node))}}var Pu,wu;!function(e){e[e.ALL=0]="ALL",e[e.YOURS=1]="YOURS",e[e.SHARED_WITH_YOU=2]="SHARED_WITH_YOU"}(Pu||(Pu={}));class Cu{constructor(e){this.options=e}get hash(){var e,t,i,s;return`isShared=${null!==(t=null===(e=this.options)||void 0===e?void 0:e.isSharedWithYou)&&void 0!==t?t:"all"}:createdBy=${null!==(s=null===(i=this.options)||void 0===i?void 0:i.ownedBy)&&void 0!==s?s:"any"}`}getRelationToFilter(e){var t,i,s,r,n,o,a,c;return void 0!==(null===(t=this.options)||void 0===t?void 0:t.isSharedWithYou)&&void 0!==(null===(i=e.options)||void 0===i?void 0:i.isSharedWithYou)&&this.options.isSharedWithYou!==e.options.isSharedWithYou||(null===(s=this.options)||void 0===s?void 0:s.ownedBy)&&(null===(r=e.options)||void 0===r?void 0:r.ownedBy)&&this.options.ownedBy!==e.options.ownedBy?"disjoint":void 0===(null===(n=this.options)||void 0===n?void 0:n.isSharedWithYou)&&void 0!==(null===(o=e.options)||void 0===o?void 0:o.isSharedWithYou)||void 0===(null===(a=this.options)||void 0===a?void 0:a.ownedBy)&&void 0!==(null===(c=e.options)||void 0===c?void 0:c.ownedBy)?"unknown":"subset"}matches(e){var t,i,s,r,n,o;return!((void 0!==(null===(t=this.options)||void 0===t?void 0:t.isSharedWithYou)||void 0!==(null===(i=this.options)||void 0===i?void 0:i.ownedBy))&&((null===(s=this.options)||void 0===s?void 0:s.isSharedWithYou)&&!e._isSWYAsset_NoLazyLoad||!1===(null===(r=this.options)||void 0===r?void 0:r.isSharedWithYou)&&!1!==e._isSWYAsset_NoLazyLoad||(null===(n=this.options)||void 0===n?void 0:n.ownedBy)&&(null===(o=e._storageAssignee_NoLazyLoad)||void 0===o?void 0:o.id)!==this.options.ownedBy))}}!function(e){e.Size50="50",e.Size100="100",e.Size115="115",e.Size230="230",e.Size138="138",e.Size276="276"}(wu||(wu={}));class Ru extends Ks{constructor(e,t){super(e,t),this._countryCode="",this._displayName="",this._email="",this._firstName="",this._lastName="",this._addressBookIdent="",this._images={},this._linkedIdentity="",this._urn=""}get ident(){return this.id}get countryCode(){return this._countryCode}get displayName(){return this._displayName}get email(){return this._email}get firstName(){return this._firstName}get lastName(){return this._lastName}get addressBookIdent(){return this._addressBookIdent}get images(){return this._images}get linkPolicy(){return this._linkPolicy}get linkedIdentity(){return this._linkedIdentity}get urn(){return this._urn}}Ye([ht],Ru.prototype,"countryCode",null),Ye([ht],Ru.prototype,"displayName",null),Ye([ht],Ru.prototype,"email",null),Ye([ht],Ru.prototype,"firstName",null),Ye([ht],Ru.prototype,"lastName",null),Ye([ht],Ru.prototype,"addressBookIdent",null),Ye([ht],Ru.prototype,"images",null),Ye([ht],Ru.prototype,"linkPolicy",null),Ye([ht],Ru.prototype,"linkedIdentity",null),Ye([ht],Ru.prototype,"urn",null);const Lu=new vn({localItemType:Ru,remoteIdProperty:"ident",propertyUpdater:new Cn({_countryCode:"countryCode",_displayName:"displayName",_email:"email",_firstName:"firstName",_addressBookIdent:"addressBookIdent",_images:{format:"object",name:"images"},_lastName:"lastName",_linkPolicy:"linkPolicy",_linkedIdentity:"linkedIdentity",_urn:"urn"})});class Nu{constructor(e,t,i,s){this._addressBookUrl=e,this._groupMemberPool=t,this._addressBookInterface=i,this._groupMemberUpdater=s}async loadPage(e,t){const{limit:i=100}=(null==e?void 0:e.loadOptions)||{limit:100};let s;s=t?await this._addressBookInterface.getMembersNextPage(t):await this._addressBookInterface.getMembersFirstPage(this._addressBookUrl,i);const r=this._groupMemberPool.createLoaderMutationSession(),n=this._groupMemberUpdater.updateRemoteItems(r,s._embedded.contacts);return r.commit(),{items:n,loadNextPage:s._links.next?()=>this.loadPage(void 0,s._links.next.href):void 0,total:s.total}}}class Du extends pr{constructor(e){super(e)}get endpoint(){return`https://${this._core._environment.endpoints.ABS_HOST}`}async getAddressBookURL(e){return(await this._getResponse(`${this.endpoint}/api/urns/resolve/${e}`)).url}async getMembersFirstPage(e,t=100){return this._getResponse(`${e}/members/flat?limit=${t}`)}async getMembersNextPage(e){return this._getResponse(e)}async getAddressBooks(e=100){return this._getResponse(`${this.endpoint}/api/address-books?limit=${e}`)}async getContactInAddressBook(e,t){return this._getResponse(`${this.endpoint}/api/address-books/${e}/contacts?linkedIdentity=${t}`)}}const Mu=["owner","viewer","editor","none"],xu=["editor","owner"],ku=["self","deep","deep_override"];class Hu extends Ks{constructor(){super(...arguments),this._role="viewer",this._type="imsUser",this._isDirect=!1,this._assetID="",this._canDiscover=!1,this._canShare=!1,this._commentPermissions=[]}get assetId(){return this._assetID}get hasProfile(){tn("Collaborator.hasProfile","Collaborator.hasProfile is deprecated and will be removed on or after 2024-10-01")}get collaboratorID(){return this.id}get imsUserId(){var e;return"imsUser"===this._type?this.id:null===(e=this._additionalData)||void 0===e?void 0:e.linkedIdentity}get email(){var e;return null===(e=this._additionalData)||void 0===e?void 0:e.email}get name(){var e,t;const i=this._additionalData;return null!==(t=null!==(e=null==i?void 0:i.displayName)&&void 0!==e?e:null==i?void 0:i.groupName)&&void 0!==t?t:null==i?void 0:i.organizationName}get role(){return this._role}get type(){return this._type}get commentPermissions(){return this._commentPermissions}get inheritances(){return this._inheritances}get isDirect(){return this._isDirect}get hasContributorRole(){return xu.includes(this._role)}get hasName(){return!!this.name}get invited(){var e;return null===(e=this._inheritances)||void 0===e?void 0:e.includes("deep")}get isAdmin(){var e;return null===(e=this._inheritances)||void 0===e?void 0:e.includes("deep_override")}get canDiscover(){return this._canDiscover}get canShare(){return this._canShare}get additionalData(){return this._additionalData}get isCurrentUser(){return this._core._environment.getValue("USER_ID")===this.imsUserId}get avatarURL(){return this.getAvatarURL(wu.Size138)}getAvatarURL(e){var t,i,s;return null!==(s=null===(i=null===(t=this._additionalData)||void 0===t?void 0:t.images)||void 0===i?void 0:i[e])&&void 0!==s?s:""}get addressBookGroupUrn(){var e;return(null===(e=this._additionalData)||void 0===e?void 0:e.groupUrn)||""}async getGroupMemberSource(){if("addressBookGroup"!==this.type)throw We.create(U.BAD_REQUEST,"groupMemberSource only applies to addressBookGroup Collaborator");if(!this.addressBookGroupUrn)throw We.create(U.BAD_REQUEST,"addressBookGroupUrn is required");const e=new Du(this._core),t=await e.getAddressBookURL(this.addressBookGroupUrn),i=function(e){return new URL(e).pathname.match(/^\/api\/address-books\/[^/]+/)[1]}(t),s=this._core.collaborationContext._getAddressBookContactPool(i),r=new Nu(t,s,e,Lu);return new Uo(s,[r])}}Ye([ht(xi)],Hu.prototype,"email",null),Ye([ht(xi)],Hu.prototype,"name",null),Ye([ht(xi)],Hu.prototype,"avatarURL",null),Ye([ht(xi)],Hu.prototype,"getAvatarURL",null),Ye([ht(xi)],Hu.prototype,"addressBookGroupUrn",null),Ye([nt],Hu.prototype,"getGroupMemberSource",null);const ju=new vn({localItemType:Hu,remoteIdProperty:"id",changeEvent:xi,propertyUpdater:new Cn({_type:{name:"type",choices:["imsUser","addressBookGroup","addressBookContact","predefinedPrincipal","imsGroup"]},_role:{name:"role",choices:Mu},_inheritances:{name:"inheritances",isArray:!0,choices:ku},_additionalData:{name:"additionalData",format:"object"},_isDirect:{name:"isDirect",format:"boolean"},_avatarURLs:{name:"avatarURLs",format:"object"},_assetID:{name:"assetID",format:"string"},_canDiscover:{name:"canDiscover",format:"boolean"},_canShare:{name:"canShare",format:"boolean"},_commentPermissions:{name:"commentPermissions",isArray:!0}})});class Uu{constructor(e,t,i){this._collaboratorPool=e,this._invitationInterface=t,this._urn=i}async loadPage(){const e=await this._invitationInterface.getCollaborators(this._urn),t=this._collaboratorPool.createLoaderUpdateSession(Date.now()),i=new Set(e.directCollaborators.map((({id:e})=>e))),s=e.collaborators.map((t=>{var s,r;const n=i.has(t.id),o=!!n&&null!==(r=null===(s=e.directCollaborators.find((e=>e.id===t.id)))||void 0===s?void 0:s.canDiscover)&&void 0!==r&&r;return Object.assign(Object.assign({},t),{isDirect:n,canDiscover:o})})),r=ju.updateRemoteItems(t,s);return t.commit(),{items:r}}}const Bu=new vn({localItemType:class extends Ks{constructor(){super(...arguments),this._email="",this._role="viewer",this._canComment=!1,this._canShare=!1,this._acceptanceRequired=!1,this._created=new Date}get invitationID(){return this.id}get email(){return this._email}get role(){return this._role}get canComment(){return this._canComment}get canShare(){return this._canShare}get acceptanceRequired(){return this._acceptanceRequired}get inheritance(){return this._inheritance}get created(){return this._created}},remoteIdProperty:"id",propertyUpdater:new Cn({_email:"email",_role:{name:"role",choices:Mu},_canComment:{name:"canComment",format:"boolean"},_canShare:{name:"canShare",format:"boolean"},_acceptanceRequired:{name:"acceptanceRequired",format:"boolean"},_inheritance:{name:"inheritance",choices:ku},_created:{name:"created",format:"date_as_number"}})});class Fu{constructor(e,t,i){this._invitedCollaboratorPool=e,this._invitationInterface=t,this._urn=i}async loadPage(){const e=await this._invitationInterface.getCollaborators(this._urn),t=this._invitedCollaboratorPool.createLoaderUpdateSession(Date.now()),i=Bu.updateRemoteItems(t,e.invitations);return t.commit(),{items:i}}}const Vu={parse:e=>e,isEqual:(e,t)=>ds(e,t)},Ku={parse:e=>e,isEqual:(e,t)=>ds(e,t)},Gu=new vn({localItemType:class extends Ks{constructor(){super(...arguments),this._collaborators=[],this._error=void 0}get getAssetID(){return this.id}get collaborators(){return this._collaborators}get error(){return this._error}},remoteIdProperty:"urn",propertyUpdater:new Cn({_collaborators:{get:function(e,t){const i=new Xo(t._core,"collaborator").createUpdateSession();if(200!==e.statusCode)return[];const s=JSON.parse(e.response).collaborators.map((t=>Object.assign(Object.assign({},t),{assetID:e.urn}))),r=ju.updateRemoteItems(i,s);return i.commit(),r},format:Vu},_error:{get:function(e){if(200===e.statusCode)return;const t=JSON.parse(e.response);return We.createWithRepositoryCode(t.statusCode,"",t.error)},format:Ku}})});class $u{constructor(e,t,i){this._collaboratorsByAssetIDPool=e,this._invitationInterface=t,this._assetIDs=i}async loadPage(e){return await this._loadPage(e)}async _loadPage(e,t=0){var i,s;const r=Math.min(null!==(s=null===(i=e.loadOptions)||void 0===i?void 0:i.limit)&&void 0!==s?s:1/0,this._invitationInterface.batchRequestLimit),n=this._assetIDs.slice(t,t+r),o=await this._invitationInterface.getCollaboratorListForUrns(n),a=this._collaboratorsByAssetIDPool.createLoaderUpdateSession(Date.now()),c=Gu.updateRemoteItems(a,o.result);let l;return a.commit(),t+c.length<this._assetIDs.length&&(l=e=>this._loadPage(e,t+c.length)),{items:c,loadNextPage:l}}}class Wu{constructor(e,t=50,i=50,s=3){this._batchProcessor=e,this._maxItemsPerBatch=t,this._delay=i,this._maxInFlightBatches=s,this._itemQueue=new Set,this._itemPromises=new Map,this._inFlightBatches=new Set,this._processQueue=async()=>{clearTimeout(this._timer),this._timer=void 0;try{this.inFlightCount>=this._maxInFlightBatches&&await Promise.race([...this._inFlightBatches].map((e=>e.promise)))}catch(e){}for(;this.inFlightCount<=this._maxInFlightBatches&&this._itemQueue.size>0;){const e=new Set;for(;this._itemQueue.size>0&&e.size<this._maxItemsPerBatch;){const t=this._itemQueue.values().next().value;this._itemQueue.delete(t),e.add(t)}const t={batch:e,promise:this._batchProcessor(e).catch((()=>{[...e.values()].forEach((e=>this.rejectItemPromise(e)))})).finally((()=>{this._inFlightBatches.delete(t),[...e.values()].forEach((e=>this.resolveItemPromise(e)))}))};this._inFlightBatches.add(t)}this._itemQueue.size>0&&!this._timer&&(this._timer=setTimeout(this._processQueue,this._delay))}}enqueue(e){if(this.isInQueue(e)||this.isInFlight(e))return this._itemPromises.get(e).promise;this._itemQueue.add(e);const t=new sn;return this._itemPromises.set(e,t),this._timer||(this._timer=setTimeout(this._processQueue,this._delay)),this._itemQueue.size>=this._maxItemsPerBatch&&this._processQueue(),t.promise}dequeue(e){const t=this._itemQueue.has(e);return this._itemQueue.delete(e),t&&(this._itemPromises.get(e).resolve(),this._itemPromises.delete(e)),t}resolveItemPromise(e){var t;null===(t=this._itemPromises.get(e))||void 0===t||t.resolve(),this._itemPromises.delete(e)}rejectItemPromise(e){var t;null===(t=this._itemPromises.get(e))||void 0===t||t.reject(),this._itemPromises.delete(e)}get size(){return this._itemQueue.size}get inFlightCount(){return this._inFlightBatches.size}isInQueue(e){return this._itemQueue.has(e)}isInFlight(e){return!![...this._inFlightBatches].find((t=>t.batch.has(e)))}async _processNow(){if(this._itemQueue.size||this._inFlightBatches.size)do{this._processQueue();try{await Promise.race([...this._inFlightBatches].map((e=>e.promise)))}catch(e){}}while(this._itemQueue.size)}}class zu extends Ks{constructor(e,t){super(e,t),this._displayName="",this._ownerId=""}get ident(){return this.id}get displayName(){return this._displayName}get ownerId(){return this._ownerId}async getContactInAddressBook(e){return this._core.collaborationContext.getContactInAddressBook(this.ident,e)}}Ye([ht],zu.prototype,"ident",null),Ye([ht],zu.prototype,"displayName",null),Ye([ht],zu.prototype,"ownerId",null);const qu=new vn({localItemType:zu,remoteIdProperty:"ident",propertyUpdater:new Cn({_displayName:"displayName",_ownerId:"ownerId"})});class Yu{constructor(e,t,i){this._addressBookPool=e,this._addressBookInterface=t,this._addressBookUpdater=i}async loadPage(e){const{limit:t=100}=(null==e?void 0:e.loadOptions)||{limit:100},i=await this._addressBookInterface.getAddressBooks(t),s=this._addressBookPool.createLoaderMutationSession();return{items:this._addressBookUpdater.updateRemoteItems(s,i._embedded.addressBooks),total:i.total}}}const Qu={name(e,t){var i,s;return jn(null!==(i=e.name)&&void 0!==i?i:e.id,null!==(s=t.name)&&void 0!==s?s:e.id)}};class Ju extends(Fn(Qu)){}Ju.default=new Ju("ascending","name");const Xu={email(e,t){var i,s;return jn(null!==(i=e.email)&&void 0!==i?i:e.id,null!==(s=t.email)&&void 0!==s?s:e.id)}};class Zu extends(Fn(Xu)){}Zu.default=new Zu("ascending","email");const eh={displayName:(e,t)=>jn(e.displayName,t.displayName)};class th extends(Fn(eh)){}th.default=new th("ascending","displayName");class ih{constructor(e){this._core=e,this._collaboratorSourceMap=new Map,this._invitationInterface=new Rl(this._core),this._collaboratorsByAssetIDPool=new Xo(this._core,"collaboratorsByAssetID"),this._accessConfirmedIDs=new Set,this._addressBookPool=new Xo(this._core,"addressBook"),this._addressBookContactPoolMap=new Map,this._handleBatchRequest=async e=>{const t=new Map([...e].map((e=>[e.id,e])));(await this._invitationInterface.getCollaboratorListForUrns([...t.keys()])).result.forEach((e=>{const i=e.urn,s=t.get(i);if(!s)return;if(200!==e.statusCode)return void this._collaboratorRequestQueue.rejectItemPromise(s);const r=this._getCollaboratorSources(i),n=JSON.parse(e.response),o=n.collaborators.map((e=>{const t=n.directCollaborators.find((t=>t.id===e.id));return Object.assign(Object.assign({},e),{assetID:i,isDirect:!!t})})),a=r.collaboratorPool.createUpdateSession(),c=ju.updateRemoteItems(a,o);a.commit(),s._setCollaboratorData(c)}))},this._collaboratorRequestQueue=new Wu(this._handleBatchRequest)}async _getCollaboratorsNow(e){await this._collaboratorRequestQueue.enqueue(e),await this._collaboratorRequestQueue._processNow(),on.hasManager(e,xi)?on.updatedExternally(e,xi):e.dispatch(xi)}getCollaboratorsForAssets(e){tn("getCollaboratorsForAssets","This method is deprecated and will be removed. Use ShareableItem.collaboratorArray instead.");const t=new $u(this._collaboratorsByAssetIDPool,this._invitationInterface,e);return new Uo(this._collaboratorsByAssetIDPool,[t],new Eo)}_getCollaboratorSources(e){const t=this._collaboratorSourceMap.get(e);if(t)return t;const i=new Xo(this._core,"collaborator"),s=new Uu(i,this._invitationInterface,e),r=new Uo(i,[s],new Eo),n=new Xo(this._core,"invitedCollaborator"),o=new Fu(n,this._invitationInterface,e),a={collaboratorPool:i,collaboratorSource:r,invitedCollaboratorPool:n,invitedCollaboratorSource:new Uo(n,[o],new Eo)};return this._collaboratorSourceMap.set(e,a),a}getCollaborators(e){return tn("CollaborationContext.getCollaborators","This method is deprecated and will be removed. Use ShareableItem.collaboratorArray instead."),this._getCollaboratorSources(e).collaboratorSource}async removeCollaborator(e,t){return tn("CollaborationContext.removeCollaborator","This method is deprecated and will be removed on or after 2024-10-01. Use ShareableItem.removeCollaborator instead."),this._removeCollaborator(e,t)}async _removeCollaborator(e,t){var i,s;const r=null===(i=(await this._invitationInterface.modifyCollaborators(e,{collaborators:[{id:t.id,action:"remove"}]})).collaborators)||void 0===i?void 0:i.find((e=>e.id===t.id));if(!r)throw We.create(Be.BAD_REQUEST,"Collaborator patch request unsuccessful");if(200!==r.statusCode)throw We.createWithRepositoryCode(r.statusCode,null!==(s=r.errorSubcode)&&void 0!==s?s:"",r.statusText);const{collaboratorPool:n}=this._getCollaboratorSources(e),o=n.createUpdateSession();o.queueDiscardedItem(t),t.isCurrentUser&&this._accessConfirmedIDs.delete(e),o.commit()}async removeInvitedCollaborator(e,t){var i,s;tn("CollaborationContext.removeInvitedCollaborator","This method is deprecated and will be removed on or after 2025-01-01.");const r=null===(i=(await this._invitationInterface.modifyCollaborators(e,{invitations:[{id:t.id,action:"remove"}]})).invitations)||void 0===i?void 0:i.find((e=>e.id===t.id));if(!r)throw We.create(Be.BAD_REQUEST,"InvitedCollaborator patch request unsuccessful");if(200!==r.statusCode)throw We.createWithRepositoryCode(r.statusCode,null!==(s=r.errorSubcode)&&void 0!==s?s:"",r.statusText);const{invitedCollaboratorPool:n}=this._getCollaboratorSources(e),o=n.createUpdateSession();o.queueDiscardedItem(t),o.commit()}getInvitedCollaborators(e){return tn("CollaborationContext.getInvitedCollaborators","This method is deprecated and will be removed on or after 2025-01-01. Use ShareableItem.collaboratorArray instead."),this._getCollaboratorSources(e).invitedCollaboratorSource}async _removeCurrentUserFromCollaborationList(e){e._isCollaboratorDataLoaded||await this._getCollaboratorsNow(e);const t=e.collaboratorArray.find((e=>e.isCurrentUser));if(!t)throw We.create(Be.BAD_REQUEST,`Current user is not a collaborator on ${e.id}`);if(await this._removeCollaborator(e.id,t),e.collaboratorArray.includes(t)){const i=e.collaboratorArray.filter((e=>e!==t));e._setCollaboratorData(i),on.hasManager(e,xi)?on.updatedExternally(e,xi):e.dispatch(xi)}}removeCurrentUserFromCollaborationList(e){tn("removeCurrentUserFromCollaborationList/getCollaborator","This method does not work correctly and will be removed. Use ShareableItem.removeCurrentUserFromCollaboratorList() insstead.");const t=this.getCollaborator(e);return this._removeCollaborator(e,t)}getCollaborator(e){var t;tn("removeCurrentUserFromCollaborationList/getCollaborator","This method does not work correctly and will be removed. Use ShareableItem.collaboratorsArray.find(c => c.isCurrentUser()) instead.");const i=this._core._environment.getValue("USER_ID");return null!==(t=this._getCollaboratorSources(e).collaboratorPool.getLocalItemById(i))&&void 0!==t?t:new Hu(this._core,i)}async _addCollaborators(e,t,i,s,r,n){const o=Object.assign(Object.assign(Object.assign(Object.assign({recipients:t},s?{notification:s}:{notification:{ans:{}}}),i?{configuration:i}:{}),r?{captcha:r}:{}),n?{inviterLabel:n}:{});return await this._invitationInterface.addCollaborators(e,o)}async _modifyCollaborators(e,t,i,s){const r=Object.assign(Object.assign({collaborators:t},i?{configuration:i}:{}),s?{notification:s}:{});return this._invitationInterface.modifyCollaborators(e,r)}getPendingInvitations(){return this._invitationInterface.getPendingInvitations()}async confirmAccess(e){this._accessConfirmedIDs.has(e)||"guest"===this._core._environment.getValue("SESSION_TYPE")||(await this._invitationInterface.confirmAccess(e),this._accessConfirmedIDs.add(e))}get addressBookSource(){const e=new Yu(this._addressBookPool,new Du(this._core),qu);return new Uo(this._addressBookPool,[e])}getAddressBookOrder(e="ascending",t="displayName"){return new th(e,t)}_getAddressBookContactPool(e){let t=this._addressBookContactPoolMap.get(e);return t||(t=new Xo(this._core,"addressBookContact"),this._addressBookContactPoolMap.set(e,t)),t}async getContactInAddressBook(e,t){const i=this._getAddressBookContactPool(e);let s=i.getLocalItemById(t);if(s)return s;const r=new Du(this._core),n=await r.getContactInAddressBook(e,t),o=i.createMutationSession();return s=Lu.updateRemoteItem(o,n),o.commit(),s}getCollaboratorOrder(e="ascending",t="name"){return new Ju(e,t)}getInvitedCollaboratorOrder(e="ascending",t="email"){return new Zu(e,t)}async _requestAccess(e,t,i){return await this._invitationInterface.createAccessRequest(e,t,i)}}Ye([nt],ih.prototype,"addressBookSource",null),Ye([Dt],ih.prototype,"getContactInAddressBook",null);var sh=Object.freeze({__proto__:null,default:ih});class rh{constructor(e,t,i){this._ffBoardsInterface=i,this._ussLoaderHelper=new Cc(e,t,this)}async loadPage(e){return this._ussLoaderHelper.loadPage(e)}_getListingOptionsFromFilters(e,t){const i=Yn("options",t);return{isSharedWithYou:Yn("isSharedWithYou",i),ownedBy:Yn("ownedBy",i),mediaTypes:qn(e,t)}}async _getUSSResults({start:e,loadOptions:t,order:i,implicitFilter:s,filter:r}){const n=Object.assign({start:e,limit:(null==t?void 0:t.limit)||50,orderDirection:i.direction,orderBy:i.field},this._getListingOptionsFromFilters(s,r));return this._ffBoardsInterface.getAssets(n)}}const nh={start:0,limit:50,orderDirection:"descending",orderBy:"modified"};class oh extends pr{_getCommonFilters(e){const t=Object.assign(Object.assign({},nh),e);return{hints:{acp_platform_v2:!0},fetch_fields:{includes:[...Ki(),"_embedded"]},limit:t.limit,start_index:t.start,op_none_of:[{[Rn.VISIBILITY]:["hiddenSelf","hiddenRecursive"]}],sort_orderby:Dn[t.orderBy],sort_order:"ascending"===t.orderDirection?"asc":"desc"}}async getAssets(e){const{ownedBy:t,isSharedWithYou:i,mediaTypes:s}=e,r=qe(e,["ownedBy","isSharedWithYou","mediaTypes"]),n=this._getCommonFilters(r);return t&&(n[Rn.STORAGE_ASSIGNEE_ID]=t),void 0!==i&&(n[Rn.SHARED_VIA_INVITE]=i),s&&s.length>0&&(Bl(s),n[Rn.TYPE]=s),this._core.hostAssetContext._ussInterface.getQueryResponse(n)}}class ah{constructor(e,t,i){this._core=t,this._swyInterface=i,this._ussLoaderHelper=new Cc(e,t,this)}supportsFilter(e){return void 0!==e}async loadPage(e){return this._libraryContext||(this._libraryContext=await this._core.getLibraryContext()),this._ussLoaderHelper.loadPage(e)}async _getUSSResults({start:e,loadOptions:t,mediaTypes:i,excludeMediaTypes:s,order:r,resource:n}){return this._swyInterface.getSWYAssets({orderBy:zd[r.field],orderDirection:r.direction,start:e,limit:null==t?void 0:t.limit,mediaTypes:i,excludeMediaTypes:s,embedPermissions:!0},n)}}class ch{constructor(e,t,i){this._recentInterface=i,this._ussLoaderHelper=new Cc(e,t,this)}supportsFilter(e){return void 0!==e}async loadPage(e){return this._ussLoaderHelper.loadPage(e)}async _getUSSResults({start:e,loadOptions:t,mediaTypes:i,excludeMediaTypes:s}){return this._recentInterface.getMRUAssets({start:e,limit:null==t?void 0:t.limit,mediaTypes:i,excludeMediaTypes:s,embedPermissions:!0})}}var lh;!function(e){e[e.Initializing=0]="Initializing",e[e.Offline=1]="Offline",e[e.NotStarted=2]="NotStarted",e[e.Disabled=3]="Disabled",e[e.Synchronized=4]="Synchronized",e[e.InProgress=5]="InProgress",e[e.ErrorQuotaExceeded=6]="ErrorQuotaExceeded",e[e.ErrorSyncDown=7]="ErrorSyncDown",e[e.ErrorOther=8]="ErrorOther"}(lh||(lh={}));class dh extends ar{constructor(e,t){super(e),this._core=e,this._assetPool=t,this._rapi=new Ll(this._core),this._invitationInterface=new Rl(this._core),this._ussInterface=new Cl(this._core),this._SBMInterface=new Vl(this._core),this._swyInterface=new Gl(this._core),this._recentInterface=new Ql(this._core),this._adobeAssetSearchInterface=new Wl(this._core),this._adobeAssetGlobalSearchInterface=new ql(this._core),this._assetTransferService=new Jl(this._core),this._assetReviewServiceInterface=new kc(this._core),this._publishedInterface=new Id(this._core),this._discardedInterface=new Dd(this._core),this.__ussInterfaceV3=new kd(this._core),this._globalSearchInterfaceV3=new jd(this._core,this.__ussInterfaceV3),this._libraryInterface=new Sa(this._core),this._acplModelInterface=new na(this._core),this._ffBoardsInterface=new oh(this._core),this._commentsById=new Map,this._adobeAssetUpdater=Ec,this._ussAdobeAssetUpdater=Sc,this._onHomeFolderChange=()=>{this._rapi._clearIndexCache()},this._onOnsAssetChangeEvent=e=>{const t=new Set;e.changedAssets.forEach(((e,i)=>{var s,r;if(null===(s=e.changedResources)||void 0===s?void 0:s.includes("api:annotation")){const t=null===(r=this._commentsById.get(i))||void 0===r?void 0:r.deref();t&&t._onONSNotification(e)}const n=this._assetPool.getLocalItemById(i);if(n&&n.handleOnsChangedResources(e.changedResources),e.parentAssetId&&this._assetPool.getLocalItemById(e.parentAssetId)){const s=this._assetPool.getLocalItemById(e.parentAssetId),r=this._core._getKnowledgeWorkspaceContext(),o=r&&r._isMinimalAsset(s);n||!s._canLoadNewChildrenFromONSNotification||o||this._getAssetById(i,void 0,!0).catch((e=>{if(e.code!==Be.NOT_FOUND)throw e;this._core._environment.log(`_onOnsChangeAssetEvent asset ${i} not found, likely deleted or unshared.`)})),t.add(s)}})),t.forEach((e=>{e.dispatch(new Di)}));const i=new Set(e.changedAssets.keys()),s=this._getAssetLinkManager();s&&s.lists.forEach((e=>e._refreshLinksForChangedAssets(i)))},this._onAssetsChanged=e=>{var t;const i=null===(t=null==e?void 0:e.discardedItems)||void 0===t?void 0:t.map((e=>e.id));this._updateONSSubscriptions(i)},this._organizationsResource=new ur(this._core,{onChange:async e=>{this._defaultOrganizationId=null==e?void 0:e.default,this._organizations=null==e?void 0:e.children.map((e=>({id:e["organization:id"],name:e["organization:name"]||""})))}}),this._assetPool.on(Yo,this._onAssetsChanged),on.manageLazyLoading(this,[{event:Wd,fetchData:this._fetchOrganizations,prefetchTimeout:0}]),this._core.on(Ri,((e,t,i)=>{"ONS_OVER_AXON"===i.configurationKeyName&&(this._core._environment.getValue("ENVIRONMENT")===as.Stage?this.onsContext&&(this.onsContext.useAxon=this._core._environment.getValue("ONS_OVER_AXON")):console.warn("Runtime config update for ONS_OVER_AXON is only supported in the Stage environment."))}))}async _getONSContext(){return this._OnsContext||(this._OnsContext=new yu(this._core),this.dispatch(new Ul(this._OnsContext.onsMonitoringStatus)),this._OnsContext.on(at,this._onOnsAssetChangeEvent),this._OnsContext.on(Nl,(e=>{this.dispatch(new Hl(e.cachedSubscriptionsUsed))})),this._OnsContext.on(Dl,(e=>{this.dispatch(new jl(e.expired))})),this._OnsContext.on(Ml,(e=>{this.dispatch(new Ul(e.status))}))),this._OnsContext}get onsMonitoringStatus(){var e,t;return null!==(t=null===(e=this._OnsContext)||void 0===e?void 0:e.onsMonitoringStatus)&&void 0!==t?t:xl.Unknown}get onsContext(){return this._OnsContext}get repoInterface(){return tn("AssetContext.repoInterface","AssetContext.repoInterface is deprecated and will be removed on or after 2024-10-01. It is for internal SAM.js use only."),this._rapi}get ussInterface(){return tn("AssetContext.ussInterface","AssetContext.ussInterface is deprecated and will be removed on or after 2024-10-01. It is for internal SAM.js use only."),this._ussInterface}get ussInterfaceV3(){return tn("AssetContext.ussInterfaceV3","AssetContext.ussInterfaceV3 is deprecated and will be removed on or after 2024-10-01. It is for internal SAM.js use only."),this.__ussInterfaceV3}get sbmInterface(){return tn("AssetContext.sbmInterface","AssetContext.sbmInterface is deprecated and will be removed on or after 2024-10-01."),this._SBMInterface}get swyInterface(){return tn("AssetContext.swyInterface","AssetContext.swyInterface is deprecated and will be removed on or after 2024-10-01. It is for internal SAM.js use only."),this._swyInterface}get recentInterface(){return tn("AssetContext.recentInterface","AssetContext.recentInterface is deprecated and will be removed on or after 2024-10-01. It is for internal SAM.js use only."),this._recentInterface}get invitationInterface(){return tn("AssetContext.invitationInterface","AssetContext.invitationInterface is deprecated and will be removed on or after 2024-10-01. It is for internal SAM.js use only."),this._invitationInterface}get publishedInterface(){return tn("AssetContext.publishedInterface","AssetContext.publishedInterface is deprecated and will be removed on or after 2024-10-01. It is for internal SAM.js use only."),this._publishedInterface}get assetPool(){return tn("AsseContext._assetPool","AssetContext._assetPool is deprecated and will be removed on or after 2024-10-01. ItemPools are for internal SAM.js use only."),this._assetPool}get sharedSource(){var e;const t=new Bd,i=new oa(this._assetPool,this._core),s=this._core._environment.getValue("FEATURE_FLAGS"),r=null!==(e=null==s?void 0:s["use-pls-swy"])&&void 0!==e&&e?new Su(this._core):new ah(this._assetPool,this._core,this._swyInterface);return new Uo(this._assetPool,[r,i],t)}get recentAssetsSource(){const e=new Zl,t=new Xl(this._assetPool,this._core,this._recentInterface,e),i=new oa(this._assetPool,this._core);return e._lastModificationDate=new Date(9999,0,1),new Uo(this._assetPool,[t,i],e)}get favoriteAssetsSource(){return new Uo(this._assetPool,[new bu(this._core)],new Ou)}get MRUAssetsSource(){var e;const t=new td,i=new oa(this._assetPool,this._core),s=this._core._environment.getValue("FEATURE_FLAGS"),r=null!==(e=null==s?void 0:s["use-pls-recents"])&&void 0!==e&&e?new Au(this._core):new ch(this._assetPool,this._core,this._recentInterface);return new Uo(this._assetPool,[r,i],t)}get publishedSource(){const e=new wd,t=new Pd(this._assetPool,this._core,this._publishedInterface);return new Uo(this._assetPool,[t],e)}get discardedSource(){const e=new Cd,t=new Md(this._assetPool,this._core,this._discardedInterface);return new Uo(this._assetPool,[t],e)}get localRecentsSource(){if(this._acplModelInterface.supportsLocalAssets){const e=new oa(this._assetPool,this._core),t=new vu;return new Uo(this._assetPool,[e],t)}}async getAssetLinkManager(){if(this._AssetLinkManager)return this._AssetLinkManager;const e=(await Promise.resolve().then((function(){return mP}))).default;return this._AssetLinkManager=new e(this),this._AssetLinkManager}_getAssetLinkManager(){return this._AssetLinkManager}getGlobalSearchAssetsSource(e){const t=new xd({_query:e,_matchingIDsFromSearch:new Set}),i=new Ud(this._assetPool,t,this._core,this._adobeAssetGlobalSearchInterface);return new Uo(this._assetPool,[i],t)}getGlobalSearchAssetsSourceV3(e){const t=new xd({_query:e,_matchingIDsFromSearch:new Set}),i=new Hd(this._assetPool,this._core,this._globalSearchInterfaceV3,t);return new Uo(this._assetPool,[i],t)}get ffBoardsSource(){const e=new Qd({mediaTypes:["application/vnd.adobe.hz.aura+dcx"],_isDiscarded:!1}),t=new rh(this._assetPool,this._core,this._ffBoardsInterface);return new Uo(this._assetPool,[t],e)}get isOnline(){return tn("AssetContext.isOnline","AssetContext.isOnline() is not fully implemented for web"),this.networkStatus!==zc.Offline}get networkStatus(){return tn("AssetContext.networkStatus","AssetContext.networkStatus is not fully implemented for web"),zc.OnlineUnknown}async _getAssetById(e,t,i){var s,r;const n=null!==(s=this._assetPool.getLocalItemById(e))&&void 0!==s?s:await this._acplModelInterface.getLocalAsset(e);if(n)return this._core._environment.getValue("DISABLE_ONS")||n.needsRepoMetadata?await n._loadWithRetry():n._linksCameFromResolveAPI||this._rapi.getAssetLinks(e).then((e=>{const t=this._assetPool.createUpdateSession();this._adobeAssetUpdater.updateLocalItem(t,n,{_links:e}),n._linksCameFromResolveAPI=!0,t.commit()})),n;const o=new un(this._core),a=new ra(this._core),c=new wa(this._core);let l,d,u={};if(null===(r=this._core._environment.getValue("FEATURE_FLAGS"))||void 0===r?void 0:r["use-graphql"]){const i=await this._core._getGQLManager();t||(t=new sa(this._core)),await i.getAssetResourcesById(e,{repoMetadataResource:t,appMetadataResource:o,effectivePermissionsResource:a,perUserMetadataResource:c}),l=t.data,d=c.data,u=o.data}else{t||(t=new sa(this._core),await this._rapi.getRepoMetadataById(e,t)),l=t.data;const i=new Zr(this._rapi,e,l._links,l["repo:etag"]);await i.getEffectivePermissions(a),(a.data&Gi.ReadAppMetadata)===Gi.ReadAppMetadata&&(await i.getAppMetadata(o),u=o.data)}const h=a.data,p=new Gd(this._core),_=new ou(this._core);let m,f={};const g=Ja(u),y=ec({appMetadata:u,repoMetadata:l});if(g)m=await p.getProject(l["repo:assetId"]);else if(y){const t=await _.getStudentAssignment(e,void 0,{[Ca.PREFER_RAPI]:"true"});f=this.repoToStudentAssignmentData(l,Object.assign(Object.assign({},u),t))}const v=Object.assign(Object.assign({},null==t?void 0:t.data),{_embedded:{[yt.APP_METADATA]:u}}),O=await this._core._adobeAssetFactory.getRepoMetadataUpdaters([v]);let b;const I=Ya(l);let E={};I&&(b=await this._core.getGenerationHistoryContext(),E=await b._generationHistoryInterface.getGenerationHistoryAssetById(e));const T=this._assetPool.createMutationSession(),S=this._core._adobeAssetFactory.assetFromRepoMetadata({session:T,repoMetadata:l,updaters:O,permissions:h,appMetadata:u,projectMetadata:m,studentAssignmentMetadata:y?f:void 0,perUserMetadata:d,generationHistoryMetadata:I?E:void 0});return l&&l["storage:assignee"]&&S._storageAssignee_NoLazyLoad.id===l["storage:assignee"].id&&on.updatedByItemUpdater(S,$n),T.commit(),i&&S.isLibrary&&await S._waitForLibraryLoad(),S._setResources({repoMetadataResource:t,appMetadataResource:o,effectivePermissionsResource:a,perUserMetadataResource:c}),g?await S._load({repoMetadata:l,appMetadata:u,effectivePermission:h,projectMetadata:m,perUserMetadata:d}):y?await S._load({repoMetadata:f,appMetadata:u,effectivePermission:h,perUserMetadata:d,doFetchStudentAssignmentMetadata:!1}):md(S)?await S._load({repoMetadata:l,appMetadata:u,effectivePermission:h,perUserMetadata:d,requireLibraryDataFetch:i}):await S._load({repoMetadata:l,appMetadata:u,effectivePermission:h,perUserMetadata:d}),S._linksCameFromResolveAPI=!0,S}async getHomeFolder(){if(!this._homeFolder){const e=await this._rapi.getHomeDirectoryMetadata(),t=this._assetPool.createMutationSession();this._setHomeFolder(this._adobeAssetUpdater.updateRemoteItem(t,e)),t.commit()}return this._homeFolder}_setHomeFolder(e){this._homeFolder=e,this._homeFolder.on(at,this._onHomeFolderChange)}async getRootFolder(e){var t,i;if(!this._rootFolder)if(null===(t=this._core._environment.getValue("FEATURE_FLAGS"))||void 0===t?void 0:t["use-graphql"]){const t=null===(i=null==e?void 0:e.listingHints)||void 0===i?void 0:i.map((e=>Object.assign(Object.assign({},e),{effectivePermissions:!1}))),s=Object.assign(Object.assign({},e),{listingHints:t,appMetadata:!1,effectivePermissions:!1,perUserMetadata:!1}),r=await this._core._getGQLManager();if(this._homeFolder){const e=Fs.join(this._homeFolder.repoPath,zi);this._rootFolder=(await r.getAssetByPath(e,this._homeFolder.repositoryID,s)).asset}else{const e=await r.getAssetByPath(zi,void 0,s);this._rootFolder=e.asset,this._setHomeFolder(e.homeFolder)}}else this._rootFolder=await this._getAssetWithRepoPathImpl(zi);return this._rootFolder}async getUserRepoID(){return this.getHomeFolder().then((e=>e.repositoryID))}async getAssetWithCloudID(e,t=!1){if(t){const t=await this._core.getCollaborationContext();await t.confirmAccess(e)}return this._getAssetById(e)}async _getAssetRepoDataWithCloudID(e){const t=new sa(this._core);return await this._rapi.getRepoMetadataById(e,t),t}async getAssetWithRepoPath(e,t){return e===zi?this.getRootFolder():this._getAssetWithRepoPathImpl(e,t)}async _getRepoDataByPath(e,t){const i=new sa(this._core),s=await this._rapi.getRepoMetadataByPath(t,e,i);return i._setData(s),i}async _getTopLevelFolder(e,t){var i;const s=await this._getRepoDataByPath(e,t),r=s.data["repo:assetId"];if(!r)throw We.create(Be.NOT_FOUND,`Top-level folder not found at path: ${e}`);const n=await this._core._adobeAssetFactory.getRepoMetadataUpdaters([s.data]);return null!==(i=this._assetPool.getLocalItemById(r))&&void 0!==i?i:(()=>{const e=this._assetPool.createMutationSession(),t=this._core._adobeAssetFactory.assetFromRepoMetadata({session:e,repoMetadata:s.data,updaters:n});return e.commit(),t})()}async _getAssetWithRepoPathImpl(e,t){if(!t){const i=await this.getHomeFolder();t=i.repositoryID;const s=i.repoPath;e=Fs.join(s,e)}try{let i;if(Hr(e))return i=await this._getTopLevelFolder(e,t),i;const s=await this._getRepoDataByPath(e,t),r=s.data;return i=await this._getAssetById(r["repo:assetId"],s),i._setResources({repoMetadataResource:s}),i}catch(t){const i=["cloud-content","temp"];for(const s of i){const i=`/${s}`,r=e.indexOf(i)===e.lastIndexOf(i);if(t.code===Be.NOT_FOUND&&r&&e.endsWith(i))return(await this.getHomeFolder()).createFolder(s)}throw t}}async getAssetWithAssetRefString(e,t=!1){let i;try{i=JSON.parse(e)}catch(e){throw We.create(Be.BAD_REQUEST,"Incorrectly formatted AssetRefString",{underlyingError:e})}if(i.cloud_id)return this.getAssetWithCloudID(i.cloud_id,t);if(i.path)return this.getAssetWithRepoPath(i.path,i.repository_id);throw We.create(Be.BAD_REQUEST,"Invalid AssetRefString")}_createAssetFromMetadata(e){const t=this._assetPool.createUpdateSession(),i=this._adobeAssetUpdater.updateRemoteItem(t,e);return t.commit(),i}async _repositoryNameFromID(e){return await this._rapi.getRepositoryName(e)}async _getStorageAssigneeFromID(e){return await this._rapi.getStorageAssignee(e)}async _getListOfRepositoryIDs(){const e=await this._rapi.getRepositoriesData();if(e)return e.children.map((e=>e._embedded[yt.PRIMARY]["repo:repositoryId"]))}async getXDCEData(e){return this._core._environment.fetch(`https://${this._core._environment.endpoints.XDCE_HOST}/v2/document/${e}`).then((e=>e.json()))}removeAssetsFromAssetsPool(e){this._assetPool.removeLocalItems(e)}async permanentlyDeleteAssets(e){let t;const i=t=>{if(t.discardedItems){const i=t.discardedItems.filter((t=>e.includes(t))).map((e=>e.id));i.length&&this.removeAssetsFromAssetsPool(i)}};this._assetPool.on(Yo,i);try{await Ks.runExclusiveTask("delete",e,(async()=>{const i=new Map,s=e.map((e=>{i.set(e.id,e);const t={op:"delete",id:e.id,target:{"repo:assetId":e.id}};return e.repositoryID&&(t.target["repo:repositoryId"]=e.repositoryID),t.recursive=e.isFolder,t}));t=await this._runOperations(s,i,((e,t)=>{t._releaseRenditions(),this._assetPool.getLocalItemById(t.id)&&(this._adobeAssetUpdater.updateLocalItem(e,t,{effectivePermission:Gi.None}),e.queueDiscardedItem(t))}))}))}finally{this._assetPool.off(Yo,i)}return t}async getCloudQuotaUsedAndMax(){return this._rapi.getCloudQuotaUsedAndMax()}async transfer(e,t){let i;if(t instanceof Nc){const e=await t.getChild("working_files");if(!e)throw We.create(Be.NOT_FOUND,"unable to find working_files for provided space");i=e.id}else i=t.cloudID;const s={source:{assetId:e.cloudID,repositoryId:e.repositoryID},target:{assetId:i,repositoryId:t.repositoryID}},r=await this._assetTransferService.transfer(s),n=this._assetPool.createUpdateSession();return n.queueDiscardedItem(e),n.commit(),r}async _moveAssets(e,t,i=new Map,s=!0,r){let n={failedResults:[],newModels:[]};return await Ks.runExclusiveTask("move",e,(async()=>{t.repositoryID||await t._load(),void 0===r&&(r=new Map);const s=new Map,o=e.map((e=>{s.set(e.id,e);let n=`${t.repoPath}/${Mr(e,i)}`;n=Pr(this._core,e.id,n,!1,r);const o={op:"move",id:e.id,source:{"repo:assetId":e.id},target:{"repo:path":n,"repo:repositoryId":t.repositoryID}};return e.repositoryID&&(o.source["repo:repositoryId"]=e.repositoryID),o}));n=await this._runOperations(o,s,((e,i,s)=>(i.repositoryID!==t.repositoryID&&i._clearRepositoryName(),i.isFolder&&Dr({assetPool:this._assetPool,asset:i,session:e,operation:{type:"rename",newPath:s["repo:path"]},assetContext:this}),this._adobeAssetUpdater.updateLocalItem(e,i,s),i)))})),s?await ed(n,t,i,r,this._moveAssets.bind(this)):n}async moveAssets(e,t,i=new Map){return this._moveAssets(e,t,i)}async getMoveCapability(e,t){var i;if(!t.isFolder)return{canMove:!1,reason:fn.NotAFolder};if(!t.hasPermission(Gi.Write))return{canMove:!1,reason:fn.PermissionDeniedDestination};if(e.some((e=>!e.hasPermission(Gi.Move))))return{canMove:!1,reason:fn.PermissionDeniedSource};if(await Promise.all([...e,t].map((e=>on.fetchIfNeeded(e,$n)))),e.every((e=>e.storageAssignee.id===t.storageAssignee.id)))return{canMove:!0,warning:mn.None,warnings:[]};const s=await this._rapi.getRepoOwnerMap(t.repositoryID),r=s.get(t.repositoryID);if(void 0===r)throw We.create(Be.NOT_FOUND,"target's repo owner detail is not available");for(const t of e)""===t.repositoryID&&(tn("AssetContext.getMoveCapability","getMoveCapability() requires asset._repositoryID to be set."),await t._loadRepoMetadata());if(!(null===(i=this._core._environment.getValue("FEATURE_FLAGS"))||void 0===i?void 0:i["enable-x-bucket-move"]))return{canMove:!1,reason:fn.CrossBucketMoveDisabled};const n=[];if(e.some((e=>{var t,i;const o=s.get(e.repositoryID);return(null===(i=null===(t=this._core._environment.getValue("FEATURE_FLAGS"))||void 0===t?void 0:t["move-capabilities"])||void 0===i?void 0:i["enable-CCI-CCI-move"])&&"user"===(null==o?void 0:o.type)&&"user"===r.type?(n.push(mn.OwnerChange),!1):(null==o?void 0:o.id)!==r.id})))return{canMove:!1,reason:fn.DifferentOwner};let o=e.some((e=>e.isFolder||e.isProject||e.isChildOfProject||e._isShared_NoLazyLoad));if(o)return n.push(mn.CollaboratorMaybeEditing),{canMove:!0,warning:mn.CollaboratorMaybeEditing,warnings:n};let a=!1;if(e.forEach((e=>{e._isCollaboratorDataLoaded||void 0!==e.isShared||(on.fetchIfNeeded(e,Mi),a=!0)})),a){const t=await this._core.getCollaborationContext();if(await t._collaboratorRequestQueue._processNow(),o=e.some((e=>e.isShared&&e.collaboratorArray.some((e=>e.isDirect&&"editor"===e.role)))),o)return n.push(mn.CollaboratorMaybeEditing),{canMove:!0,warning:mn.CollaboratorMaybeEditing,warnings:n}}return{canMove:!0,warning:n.find((e=>e===mn.CollaboratorMaybeEditing))||n[0]||mn.None,warnings:n}}async assetsHaveArtifacts(e){const t=xc(e),i=await this._assetReviewServiceInterface.hasOutputs(t);if(0===i.length)return!1;const s=this._assetPool.createUpdateSession();return this._adobeAssetUpdater.updateRemoteItems(s,i.map((e=>({"repo:assetId":e["repo:assetId"],hasArtifacts:!0})))),s.commit(),!0}async _deleteAssetOutputsFolder(e){return this._assetReviewServiceInterface.discardOutputsForAsset(e.id)}async _copyAssets(e,t,i=new Map,s=!0,r){let n={failedResults:[],newModels:[]};return await Ks.runExclusiveTask("copy",e,(async()=>{t.repositoryID||await t._load(),void 0===r&&(r=new Map);const s=new Map,o=e.map((e=>{s.set(e.id,e);let n=`${t.repoPath}/${Mr(e,i)}`;const o=t.repoPath===e.repoPath.substring(0,e.repoPath.lastIndexOf("/"));return n=Pr(this._core,e.id,n,o,r),e._getCopyOp(t.repositoryID,n)}));n=await this._runOperations(o,s,((e,t,i)=>{if(!i)throw We.create(Be.UNKNOWN,"Missing metadata from asset bulk operation.");return this._adobeAssetUpdater.updateRemoteItem(e,i)}))})),s?await ed(n,t,i,r,this._copyAssets.bind(this)):n}async copyAssets(e,t,i=new Map){return await this._copyAssets(e,t,i)}async duplicateAssets(e){const t=e[0].repoPath.substring(0,e[0].repoPath.lastIndexOf("/")),i=await this.getAssetWithRepoPath(t,e[0].repositoryID);return await this._copyAssets(e,i)}async createFolderByPath(e,t,i=!0){const s=await this._rapi.createFolderByPath(e,t.id,i,t.links),r=this._assetPool.createUpdateSession(),n=await this._core._adobeAssetFactory.getRepoMetadataUpdaters([s]),o=this._core._adobeAssetFactory.assetFromRepoMetadata({session:r,repoMetadata:s,updaters:n});return r.commit(),o}async _runOperations(e,t,i){return await this._rapi.runOperationsForContext(e,t,this._assetPool,i||((e,t,i)=>{if(!i)throw We.create(Be.UNKNOWN,"Missing metadata from asset bulk operation.");this._adobeAssetUpdater.updateLocalItem(e,t,i)}),[{match:e=>e.code===Be.ACCESS_DENIED||e.code===Be.NOT_FOUND,action:async(e,t)=>(await e._load(),{model:e,error:t})}])}_collectPLSAssetListIds(){return new Set([...this.sharedSource._loaders,...this.MRUAssetsSource._loaders,...this.favoriteAssetsSource._loaders].map((e=>"assetListId"in e&&e.assetListId)).filter((e=>!!e)))}_updateONSSubscriptions(e){const t=new Set,i=this._core._getKnowledgeWorkspaceContext();this._assetPool.forEach((e=>{"/temp"!==e.repoPath&&((null==i?void 0:i._isCuratedCollectionAsset(e))||e.isFile&&(null==i?void 0:i._isMinimalAsset(e))||e.isVirtual||t.add(e.id))})),null==e||e.forEach((e=>t.delete(e)));const s=this._getAssetLinkManager();s&&s.lists.forEach((e=>e.monitoredAssetIDs.forEach((e=>t.add(e))))),this._commentsById.forEach(((e,i)=>{const s=e.deref();s?t.add(s._assetId):this._commentsById.delete(i)}));const r=this._collectPLSAssetListIds(),n=this.onsContext;n&&(t.size>0&&!this._core._environment.getValue("DISABLE_ONS")?(n.watch(t,r),n.start()):n.stop())}async restoreLibraryElement(e){await this._libraryInterface.restoreLibraryElement(e)}async permanentlyDeleteLibraryElement(e){await this._libraryInterface.permanentlyDeleteLibraryElement(e)}getAssetInterface(e){return tn("AdobeAsset.getAssetInterface","AdobeAsset.getAssetInterface is deprecated and will be removed on or after 2024-10-01."),new Zr(this._rapi,e["repo:assetId"],e._links,e["repo:etag"])}async getCommentsResource(e){var t;let i=null===(t=this._commentsById.get(e))||void 0===t?void 0:t.deref();return i||(i=new Wc(this._core,e),this._commentsById.set(e,new Do(i)),this._updateONSSubscriptions()),i}async waitForListLoad(e){const{waitForListLoad:t}=await Promise.resolve().then((function(){return Ho}));return t(e)}async _fetchOrganizations(){const e=new Gd(this._core);await e.getOrganizations(this._organizationsResource)}get organizations(){return this._organizations}get defaultOrganizationId(){return this._defaultOrganizationId}getAdobeAssetOrder(e="descending",t="modified"){return new Gn(e,t)}getSWYAdobeAssetOrder(e="descending",t="shared"){return new Yd(e,t)}getUSSAdobeAssetOrder(e="descending",t="modified"){return new Ad(e,t)}getAssetVersionOrder(e="descending",t="created"){return new Zd(e,t)}getAdobeAssetFilter(e){return new Qd(e)}async getSWYAdobeAssetFilter(){return new Bd}getUSSAdobeAssetFilter(e){return new Jd(e)}getRecentAdobeAssetFilter(){return new Zl}getAssetVersionFilter(e){return new ea(e)}getIsSharedFilter(e=Pu.ALL){switch(e){case Pu.ALL:return new Cu;case Pu.SHARED_WITH_YOU:return new Cu({isSharedWithYou:!0});case Pu.YOURS:return new Cu({ownedBy:this._core._environment.getUserId()});default:throw We.create(Be.UNKNOWN,`Unsupported view selection: ${e}`)}}repoToStudentAssignmentData(e,t){const{_links:i}=t,s=qe(t,["_links"]),{_links:r}=e,n=qe(e,["_links"]);return Object.assign(Object.assign(Object.assign({},n),s),{_links:Object.assign(Object.assign({},r),i)})}}Ye([wt],dh.prototype,"_getONSContext",null),Ye([nt],dh.prototype,"sharedSource",null),Ye([nt],dh.prototype,"recentAssetsSource",null),Ye([nt],dh.prototype,"favoriteAssetsSource",null),Ye([nt],dh.prototype,"MRUAssetsSource",null),Ye([nt],dh.prototype,"publishedSource",null),Ye([nt],dh.prototype,"discardedSource",null),Ye([nt],dh.prototype,"localRecentsSource",null),Ye([wt],dh.prototype,"getAssetLinkManager",null),Ye([nt],dh.prototype,"ffBoardsSource",null),Ye([wt,Qe(0,it)],dh.prototype,"_getAssetById",null),Ye([Dt,wt],dh.prototype,"getHomeFolder",null),Ye([Dt,wt],dh.prototype,"getRootFolder",null),Ye([Dt],dh.prototype,"getAssetWithCloudID",null),Ye([Dt,wt],dh.prototype,"getAssetWithRepoPath",null),Ye([wt],dh.prototype,"_getAssetWithRepoPathImpl",null),Ye([Dt],dh.prototype,"getAssetWithAssetRefString",null),Ye([an(Wd,"_organizations")],dh.prototype,"organizations",null),Ye([an(Wd,"_defaultOrganizationId")],dh.prototype,"defaultOrganizationId",null);var uh,hh,ph,_h,mh,fh,gh=Object.freeze({__proto__:null,get CloudSyncStatus(){return lh},default:dh});!function(e){e.MODIFIED_DATE="modified_date",e.CREATED_DATE="created_date",e.NAME="name"}(uh||(uh={})),function(e){e.Personal="private",e.Public="public",e.Incoming="incoming",e.Discovery="discovery",e.All="all"}(hh||(hh={})),function(e){e.All="all",e.None="none"}(ph||(ph={})),function(e){e.All="all",e.Only="only"}(_h||(_h={})),function(e){e.None="none",e.Brand="brand",e.TrainingSet="cm_training_set"}(mh||(mh={})),function(e){e.PublishedBrands="publishedBrands",e.AllBrands="allBrands",e.AllEditableBrands="allEditableBrands"}(fh||(fh={}));const yh={name:uh.NAME,created:uh.CREATED_DATE,modified:uh.MODIFIED_DATE},vh={name:(e,t)=>jn(e.displayName||e.name,t.displayName||t.name),created:(e,t)=>Un(e.created,t.created),modified:(e,t)=>Un(e.modified,t.modified)};class Oh extends(Fn(vh)){}function bh(e,t){return void 0!==e._ownership_NoLazyLoad&&(t.has(e._ownership_NoLazyLoad)||t.has(hh.All)&&!e._isPublicLink_NoLazyLoad||t.has(hh.Incoming)&&!e._isPublicLink_NoLazyLoad&&e._isBookmarked_NoLazyLoad||t.has(hh.Discovery)&&"private"!==e._ownership_NoLazyLoad&&!e._isPublicLink_NoLazyLoad&&!e._isCCIProjectLibrary)}function Ih(e,t){var i;return void 0!==e._roles_NoLazyLoad&&(t.has(mh.None)&&(!e._roles_NoLazyLoad||0===e._roles_NoLazyLoad.length)||(null===(i=e._roles_NoLazyLoad)||void 0===i?void 0:i.some((e=>t.has(e.type)))))}function Eh(e=new Set([hh.All]),t=new Set([hh.All])){const i=zn.prototype.intersection.call(e,t);if(i.size===e.size)return"subset";const s=zn.prototype.symmetricDifference.call(e,t);return s.has(hh.Public)?"disjoint":t.has(hh.All)?"subset":e.has(hh.All)||s.has(hh.Discovery)&&s.has(hh.Incoming)&&(e.has(hh.Discovery)&&t.has(hh.Incoming)||t.has(hh.Discovery)&&e.has(hh.Incoming))||i.size>0?"unknown":"disjoint"}Oh.default=new Oh("descending","modified");class Th{static EditorBrands(e){return new Th({owner:[hh.All],roles:[mh.Brand],publishMetadata:fh.AllBrands,project:e})}constructor(e={}){if(this.filterOptions=e,this._project=e.project,e.roles&&e.roles.length>0&&(this._roles=new Set([...e.roles])),e.reference){if(this._reference=e.reference,e.owner)throw We.create(Be.BAD_REQUEST,"The reference filter cannot be used with the owner filter.");if(!this._project)throw We.create(Be.BAD_REQUEST,"The reference filter must be used with the project filter.")}else if(this._owner=e.owner?new Set([...e.owner]):Th.DEFAULT._owner,this._owner&&this._owner.size>1){if(this._owner.has(hh.Public))throw We.create(Be.BAD_REQUEST,"Public libraries cannot be combined with other ownership types.");if(this._owner.has(hh.Discovery)&&this._owner.has(hh.Incoming))throw We.create(Be.BAD_REQUEST,"Discovery and Incoming are redundant, as Incoming is a subset of Discovery.")}if(e.publishMetadata){if(!this._roles||!this._roles.has(mh.Brand))throw We.create(Be.BAD_REQUEST,"The publish metadata filter can only be used with the brands role.");this._publishMetadata=e.publishMetadata}}get hash(){return this._hash||(this._hash=[this._owner?`owner=${[...this._owner].sort().join(",")}`:void 0,this._roles?`roles=${[...this._roles].sort().join(",")}`:void 0,this._project?`project=${this._project}`:void 0,this._publishMetadata?`publishMetadata=${this._publishMetadata}`:void 0,this._reference?`reference=${this._reference}`:void 0].filter((e=>e)).join(":")),this._hash}matches(e){return!(!e.isLibrary||this._owner&&!bh(e,this._owner)||this._project&&!function(e,t,i){return t===ph.All&&e.isChildOfProject||"none"===t&&!e.isChildOfProject||"other"===t&&e.isChildOfProject&&!e._isBookmarked_NoLazyLoad||i===_h.Only&&e.isReferencedByProject(t)||i===_h.All&&e.isReferencedByProject(t)||t===e.parentProjectID&&i!==_h.Only}(e,this._project,this._reference)||this._roles&&!Ih(e,this._roles)||this._publishMetadata&&!function(e,t){return t===fh.AllBrands&&!e.publishedTo||t===fh.PublishedBrands&&e.publishedFrom||t===fh.AllEditableBrands&&!e.publishedFrom}(e,this._publishMetadata))}getRelationToFilter(e){const t=[Eh(this._owner,e._owner),(n=this._roles,o=e._roles,n&&o?function(e,t){const i=zn.prototype.intersection.call(e,t);return i.size===e.size?"subset":i.size>0?"unknown":"disjoint"}(n,o):n||o?"unknown":"subset"),(i=this._project,s=e._project,i?s&&i!==s&&(r=i,Object.values(ph).includes(r)||s!==ph.All)?"disjoint":"subset":!i&&s?"unknown":"subset"),(l=this._publishMetadata,d=e._publishMetadata,d&&l!==d?l===fh.PublishedBrands&&d===fh.AllEditableBrands||l===fh.AllEditableBrands&&d===fh.PublishedBrands?"disjoint":d===fh.AllBrands&&l===fh.PublishedBrands?"subset":"unknown":"subset"),(a=this._reference,c=e._reference,a===c||c===_h.All?"subset":a===_h.All?"unknown":"disjoint")];var i,s,r,n,o,a,c,l,d;return t.includes("disjoint")?"disjoint":t.includes("unknown")?"unknown":"subset"}}var Sh;Th.AllLibraries=new Th({owner:[hh.Incoming,hh.Personal]}),Th.CollaboratorBrands=new Th({owner:[hh.All],roles:[mh.Brand],publishMetadata:fh.PublishedBrands}),Th.DEFAULT=Th.AllLibraries,function(e){e.MODIFY_DATE="modifyDate",e.CREATE_DATE="createDate",e.NAME="name"}(Sh||(Sh={}));const Ah={name:(e,t)=>jn(e.name,t.name),modified:(e,t)=>Un(e.modified,t.modified)};class Ph extends(Fn(Ah)){}var wh,Ch,Rh,Lh,Nh,Dh,Mh,xh,kh,Hh,jh,Uh,Bh,Fh,Vh;Ph.default=new Ph("descending","modified"),function(e){e.GC="GC"}(wh||(wh={})),function(e){e.STUDENT="STUDENT",e.TEACHER="TEACHER"}(Ch||(Ch={})),function(e){e.BLOCKED="BLOCKED",e.INVITED="INVITED",e.JOINED="JOINED",e.NOT_ENROLLED="NOT_ENROLLED",e.REMOVED="REMOVED"}(Rh||(Rh={})),function(e){e.CLEVER="clever",e.CLASS_LINK="classlink"}(Lh||(Lh={})),function(e){e.ACTIVE="ACTIVE",e.ARCHIVED="ARCHIVED"}(Nh||(Nh={})),function(e){e.TRUE="TRUE",e.RESTRICTED="RESTRICTED",e.UNRESTRICTED="UNRESTRICTED",e.NONE="NONE"}(Dh||(Dh={})),function(e){e.noSubject="",e.allsubjects="allsubjects",e.careersTechnicalEducation="careersTechnicalEducation",e.computerScience="computerScience",e.english="english",e.math="math",e.otherLanguages="otherLanguages",e.others="others",e.science="science",e.socialStudies="socialStudies",e.visualPerformingArts="visualPerformingArts"}(Mh||(Mh={})),function(e){e.STUDENT="STUDENT",e.TEACHER="TEACHER"}(xh||(xh={})),function(e){e.REMOVE_STUDENT_SUCCESS="REMOVE_STUDENT_SUCCESS",e.BLOCK_STUDENT_SUCCESS="BLOCK_STUDENT_SUCCESS",e.UNBLOCK_STUDENT_SUCCESS="UNBLOCK_STUDENT_SUCCESS",e.DELETE_DOMAIN_MAPPING_ACCEPTED="DELETE_DOMAIN_MAPPING_ACCEPTED"}(kh||(kh={})),function(e){e.OWNER="OWNER",e.ACTIVE="ACTIVE",e.INACTIVE="INACTIVE",e.INVITED="INVITED",e.IN_REVIEW="IN_REVIEW",e.DECLINED="DECLINED",e.NOT_A_MEMBER="NOT_A_MEMBER"}(Hh||(Hh={})),function(e){e.ALLOWED="ALLOWED",e.NOT_ALLOWED="NOT_ALLOWED"}(jh||(jh={})),function(e){e.ACCOUNT_NOT_FOUND="ACCOUNT_NOT_FOUND",e.STUDENT_IN_CLASSROOM="STUDENT_IN_CLASSROOM",e.TEACHER_IN_CLASSROOM="TEACHER_IN_CLASSROOM"}(Uh||(Uh={})),function(e){e.STUDENT="student",e.TEACHER="teacher",e.NONE="none"}(Bh||(Bh={})),function(e){e.ACTIVE="ACTIVE",e.DECLINED="DECLINED",e.INACTIVE="INACTIVE",e.INVITED="INVITED",e.IN_REVIEW="IN_REVIEW",e.NOT_A_MEMBER="NOT_A_MEMBER",e.OWNER="OWNER"}(Fh||(Fh={})),function(e){e.CLASSLINK="CLASSLINK",e.CLEVER="CLEVER",e.EMAIL="EMAIL",e.GOOGLE_CLASSROOM="GOOGLE_CLASSROOM",e.NONE="NONE"}(Vh||(Vh={}));const Kh={name:(e,t)=>jn(e.name,t.name),created(e,t){let i;return i=e.created||t.created?e.created?t.created?Un(e.created.getTime(),t.created.getTime()):-1:1:0,0===i?jn(e.name,t.name):i}};class Gh extends(Fn(Kh)){}Gh.default=new Gh("ascending","name");class $h extends Ks{constructor(){super(...arguments),this._classroomId="",this._displayName="",this._email="",this._firstName="",this._inviteSource=Vh.NONE,this._lastName="",this._membershipStatus=Fh.NOT_A_MEMBER,this._role=Bh.NONE,this._userId=""}get classroomId(){return this._classroomId}get displayName(){return this._displayName}get email(){return this._email}get firstName(){return this._firstName}get inviteSource(){return this._inviteSource}get lastName(){return this._lastName}get membershipStatus(){return this._membershipStatus}get role(){return this._role}get userId(){return this._userId}}Ye([ht],$h.prototype,"classroomId",null),Ye([ht],$h.prototype,"displayName",null),Ye([ht],$h.prototype,"email",null),Ye([ht],$h.prototype,"firstName",null),Ye([ht],$h.prototype,"inviteSource",null),Ye([ht],$h.prototype,"lastName",null),Ye([ht],$h.prototype,"membershipStatus",null),Ye([ht],$h.prototype,"role",null),Ye([ht],$h.prototype,"userId",null);const Wh=new vn({localItemType:$h,remoteIdProperty:"computedKey",propertyUpdater:new Cn({_classroomId:{name:"classroomId",format:"string"},_displayName:{name:"displayName",format:"string"},_email:{name:"email",format:"string"},_firstName:{name:"firstName",format:"string"},_inviteSource:{name:"inviteSource",format:"string",choices:Object.values(Vh)},_lastName:{name:"lastName",format:"string"},_membershipStatus:{name:"membershipStatus",format:"string",choices:Object.values(Fh)},_role:{name:"role",format:"string",choices:Object.values(Bh)},_userId:{name:"userId",format:"string"}})}),zh={name:(e,t)=>jn(e.displayName,t.displayName)};class qh extends(Fn(zh)){}qh.default=new qh("ascending","name");class Yh{constructor(e){this.classroomId=e.classroomId||"",this.role=e.role||Bh.NONE}matches(e){return this.classroomId===e.classroomId&&(this.role&&this.role!==Bh.NONE?e.role===this.role:e.role===Bh.STUDENT||e.role===Bh.TEACHER)}getRelationToFilter(e){return e.classroomId!==this.classroomId||this.role!==e.role&&this.role!==Bh.NONE&&e.role!==Bh.NONE?"disjoint":this.role===e.role||e.role===Bh.NONE?"subset":"unknown"}get hash(){return`id=${this.classroomId}-${this.role}`}}const Qh={[yt.ASSIGNMENTS_COLLECTION]:["classroomId"],[yt.ASSIGNMENTS_CREATE]:["classroomId"],[yt.ASSIGNMENTS_PRIMARY]:["assignmentId"]};var Jh;!function(e){e.DRAFT="DRAFT",e.ASSIGNED="ASSIGNED"}(Jh||(Jh={}));const Xh={canClassroomReadSubmissions:"assignment:canClassroomReadSubmissions",instructions:"assignment:instructions",dueDate:"assignment:dueDate",externalTemplateIds:"assignment:externalTemplateIds",templateIds:"assignment:templateIds",name:"repo:name",tasks:"assignment:tasks",status:"assignment:status",referenceIds:"assignment:referenceIds",externalTutorials:"assignment:externalTemplateIds"};var Zh;!function(e){e.ANY="ANY",e.NONE="NONE",e.SELF="SELF"}(Zh||(Zh={}));const ep={[Jh.DRAFT]:0,[Jh.ASSIGNED]:1},tp=(e,t)=>jn(e.name||"",t.name||""),ip={name:(e,t)=>tp(e,t),dueDate(e,t){let i;return i=e.dueDate||t.dueDate?e.dueDate?t.dueDate?Un(e.dueDate.getTime(),t.dueDate.getTime()):-1:1:0,0===i?tp(e,t):i},status(e,t){const i=Un(ep[e.status],ep[t.status]);return 0===i?tp(e,t):i}};class sp extends(Fn(ip)){}sp.default=new sp("ascending","name");class rp{constructor(e={}){if(this.classroomId=e.classroomId||"",this.campaignId=e.campaignId||"",this.campaignId&&this.classroomId)throw We.create(Be.UNSUPPORTED,"Cannot filter by both campaignId and classroomId");if(!this.campaignId&&!this.classroomId)throw We.create(Be.UNSUPPORTED,"Must filter by either campaignId or classroomId");this.submissions=e.submissions}matches(e){return!(!e.isAssignment||this.classroomId&&e.classroomId!==this.classroomId||this.campaignId&&e.campaignId!==this.campaignId||e.isDiscarded)}getRelationToFilter(e){return this.classroomId&&this.classroomId===e.classroomId||this.campaignId&&this.campaignId===e.campaignId?"subset":"disjoint"}get hash(){return`classroomId=${this.classroomId}&campaignId=${this.campaignId}`}}class np{constructor(e={}){const{currentUserId:t,loadDocuments:i,status:s}=e;this.loadDocuments=void 0===i||i,this.status=s&&s.length>0?s:iu,this.currentUserId=t}matches(e){return!(this.currentUserId&&e.student.id!==this.currentUserId||!this.status.includes(e.status))}getRelationToFilter(e){const t=_o(this.status,e.status);return"disjoint"===t?"disjoint":"unknown"===t||this.loadDocuments&&!e.loadDocuments||!this.currentUserId&&e.currentUserId?"unknown":"subset"}get hash(){return`status=${this.status.join()}&loadDocuments=${this.loadDocuments}${this.currentUserId?`¤tUserId=${this.currentUserId}`:""}`}}const op={[tu.SUBMITTED]:0,[tu.IN_PROGRESS]:1,[tu.RETURNED]:2,[tu.NOT_STARTED]:3},ap=(e,t)=>Un(e.student.displayName||"",t.student.displayName||""),cp={studentDisplayName:(e,t)=>ap(e,t),submissionDate(e,t){let i;return i=e.submissionDate||t.submissionDate?e.submissionDate?t.submissionDate?Un(e.submissionDate.getTime(),t.submissionDate.getTime()):-1:1:0,0===i?ap(e,t):i},status(e,t){const i=Un(op[e.status],op[t.status]);return 0===i?ap(e,t):i}};class lp extends(Fn(cp)){}lp.default=new lp("ascending","studentDisplayName");class dp extends un{constructor(e,t){super(e,t),this._core=e,this._parent=t}async _loadData(){await super._loadData();const e=this._core._getAssetPool().createMutationSession();hp.updateLocalItem(e,this._parent,this.data),e.commit()}}class up extends vc{constructor(e,t,i){super(e,t,i),this._core=e,this._studentAssignmentId="",this._parentAssignmentId="",this._parentClassroomId="",this._sourceAssets=[],this._sourceTasks=[],this._sourceTutorials=[],this._studentAssignmentFileAppMetadata=new dp(e,this),this._needsRepoMetadata=!0}get isChildOfStudentAssignment(){return!0}get studentAssignmentId(){return this._studentAssignmentId}get parentStudentAssignmentId(){return this._studentAssignmentId||super.parentStudentAssignmentId||""}get parentAssignmentID(){return this._parentAssignmentId||super.parentAssignmentID||""}get isChildOfAssignment(){return!0}get isChildOfClassroom(){return!0}get parentClassroomId(){return this._parentClassroomId||super.parentClassroomId}get isChildOfAssignmentMaterials(){return!1}get sourceAsset(){return this._sourceAsset}get sourceAssets(){return this._sourceAssets}get sourceTasks(){return this._sourceTasks}get sourceTutorials(){return this._sourceTutorials}get appMetadata(){return this._studentAssignmentFileAppMetadata}async update({sourceAsset:e,sourceAssets:t,sourceTasks:i,sourceTutorials:s}){if(!(e||t||i||s))throw Error("Incorrect parameters: sourceAsset, sourceTasks, or sourceTutorials parameter required");return await this._core.classroomContext.updateStudentAssignmentFile(this,{sourceAsset:e,sourceAssets:t,sourceTasks:i,sourceTutorials:s}),this}}Ye([ht],up.prototype,"isChildOfStudentAssignment",null),Ye([ht],up.prototype,"studentAssignmentId",null),Ye([ht],up.prototype,"parentStudentAssignmentId",null),Ye([ht],up.prototype,"parentAssignmentID",null),Ye([ht],up.prototype,"isChildOfAssignment",null),Ye([ht],up.prototype,"isChildOfClassroom",null),Ye([ht],up.prototype,"parentClassroomId",null),Ye([ht],up.prototype,"isChildOfAssignmentMaterials",null),Ye([ht],up.prototype,"sourceAsset",null),Ye([ht],up.prototype,"sourceAssets",null),Ye([ht],up.prototype,"sourceTasks",null),Ye([ht],up.prototype,"sourceTutorials",null),Ye([ht],up.prototype,"appMetadata",null);const hp=new vn({localItemType:up,remoteIdProperty:"repo:assetId",propertyUpdater:new Cn({_repositoryID:"repo:repositoryId",_name:"repo:name",_path:"repo:path",_type:"dc:format",_assetClass:{name:"repo:assetClass",choices:pn},_created:{name:"repo:createDate",format:"date"},_modified:{name:"repo:modifyDate",format:"date"},_createdBy:"repo:createdBy",_modifiedBy:"repo:modifiedBy",__links:{name:"_links",format:"object"},_parentAssignmentId:{name:"computedAssignmentId",format:"string"},_parentClassroomId:{name:"computedClassroomAssetId",format:"string"},_studentAssignmentId:{name:"computedStudentAssignmentId",format:"string"},_sourceAsset:{name:"assignment:sourceAsset",format:"object"},_sourceAssets:{isArray:!0,name:"assignment:sourceAssets",format:"string"},_sourceTasks:{isArray:!0,name:"assignment:sourceTasks",format:"string"},_sourceTutorials:{isArray:!0,name:"assignment:sourceTutorials",format:"object"}})}),pp={modified:(e,t)=>Un(e.modified,t.modified),name:(e,t)=>Un(e.name,t.name),created:(e,t)=>Un(e.created,t.created)};class _p extends(Fn(pp)){}_p.default=new _p("descending","modified");class mp extends Qd{matches(e){return e.isChildOfStudentAssignment}}class fp{constructor(e,t){var i;this.studentAssignmentId=e,this.loadDocuments=null===(i=null==t?void 0:t.loadDocuments)||void 0===i||i}matches(e){return!0===e.isChildOfStudentAssignment&&e.studentAssignmentId===this.studentAssignmentId&&!e.isFolder&&e.mediaType!==Br&&!function(e){const t="application/vnd.adobe.gneisswebpage.theme.document+dcx"===e.mediaType,i=e.name.endsWith(".webpagetheme");return t||i}(e)}getRelationToFilter(e){return this.loadDocuments!==e.loadDocuments?"disjoint":this.studentAssignmentId===e.studentAssignmentId?"subset":"disjoint"}get hash(){return`studentAssignmentId=${this.studentAssignmentId}&loadDocuments=${this.loadDocuments}`}}function gp(e){return Object.keys(e).filter((e=>isNaN(Number(e))))}var yp,vp,Op;!function(e){e.OWNER="OWNER",e.POSTER="POSTER",e.VIEWER="VIEWER",e.UNKNOWN="UNKNOWN"}(yp||(yp={})),function(e){e.Text="text",e.AssetLink="assetLink"}(vp||(vp={})),function(e){e.CLASSROOM="classroom"}(Op||(Op={}));const bp={[yt.BOARDS_PRIMARY]:["boardId"]};var Ip;!function(e){e.TEXT="application/vnd.adobe.post.text+dcx",e.ASSET_LINK="application/vnd.adobe.post.assetlink+dcx"}(Ip||(Ip={}));const Ep=function(e,t,i){const s=gp(e).map((t=>e[t])),r=gp(t).map((e=>t[e]));if(i.length!==s.length||i.length!==r.length)throw We.create(Be.INTERNAL_ERROR,`Enum-to-enum map must have exactly ${s.length} entries, got ${i.length}`);const n=new Map,o=new Map;for(const[e,t]of i){if(!s.includes(e))throw We.create(Be.INTERNAL_ERROR,`Value ${e} not in enum A`);if(!r.includes(t))throw We.create(Be.INTERNAL_ERROR,`Value ${t} not in enum B`);if(n.has(e))throw We.create(Be.INTERNAL_ERROR,`Duplicate mapping for A value ${e}`);if(o.has(t))throw We.create(Be.INTERNAL_ERROR,`Duplicate mapping for B value ${t}`);n.set(e,t),o.set(t,e)}return{toB(e){const t=n.get(e);if(void 0===t)throw We.create(Be.INTERNAL_ERROR,`No B-value mapped for A value ${e}`);return t},toA(e){const t=o.get(e);if(void 0===t)throw We.create(Be.INTERNAL_ERROR,`No A-value mapped for B value ${e}`);return t}}}(vp,Ip,[[vp.Text,Ip.TEXT],[vp.AssetLink,Ip.ASSET_LINK]]);class Tp{constructor(e,t){this._core=e,this._board=t}async loadPage(e){return await this._loadPage(e)}async _loadPage(e){const t=await this._core.getBoardContext(),i=(await t.getBoardById(this._board.id))._postPool.toArray();return{items:i,total:i.length,loadNextPage:void 0}}}class Sp{constructor(e){this.data=e,this._userId=void 0,this._displayName=void 0,this._email=void 0,this._firstName=void 0,this._lastName=void 0,this._images=void 0,this._userId=e.userId,this._displayName=e.displayName,this._email=e.email,this._firstName=e.firstName,this._lastName=e.lastName,this._images=e.images}get userId(){return this._userId}get displayName(){return this._displayName}get email(){return this._email}get firstName(){return this._firstName}get lastName(){return this._lastName}get avatarImageURLs(){return this._images}get avatarUrl(){var e;return null===(e=this.avatarImageURLs)||void 0===e?void 0:e[wu.Size138]}}class Ap extends Ks{constructor(){super(...arguments),this._description=void 0,this._boardId="",this._owner=void 0}get boardId(){return this._boardId}get type(){return Ep.toA(this._type)}get name(){return this._name}get created(){return this._created}get modified(){return this._modified}get description(){return this._description}get owner(){return this._owner}get isDeletable(){return!this._isBoardReadOnly()&&(this._isOwner()||this._isBoardOwner())}get isEditable(){return this.isDeletable}_isOwner(){if(this._owner)return this._owner.userId===this._core._environment.getUserId()}_getBoard(){return this._core._getAssetPool().getLocalItemById(this._boardId)}_isBoardOwner(){var e;return(null===(e=this._getBoard())||void 0===e?void 0:e.role)===yp.OWNER}_isBoardReadOnly(){var e,t;return null===(t=null===(e=this._getBoard())||void 0===e?void 0:e.isReadOnly())||void 0===t||t}}Ye([ht],Ap.prototype,"boardId",null),Ye([ht],Ap.prototype,"type",null),Ye([ht],Ap.prototype,"name",null),Ye([ht],Ap.prototype,"created",null),Ye([ht],Ap.prototype,"modified",null),Ye([ht],Ap.prototype,"description",null),Ye([ht],Ap.prototype,"owner",null),Ye([ht],Ap.prototype,"isDeletable",null),Ye([ht],Ap.prototype,"isEditable",null);const Pp=e=>new Cn(Object.assign({_boardId:{name:"computedBoardId",format:"string"},_name:{name:"name",format:"string"},_type:{name:"type",format:"string",choices:Object.values(Ip)},_description:{name:"board#postDescription",format:"string"},_modified:{name:"modified",format:"date"},_created:{name:"created",format:"date"},_owner:{name:"postedBy",format:"object",set:(e,t)=>{const i=t,s=new Sp(e);i._owner=s}}},e));class wp extends Ap{get link(){return{mediaType:this._remoteLink["dc:format"],assetId:this._remoteLink["repo:assetId"],publicUrl:this._remoteLink["board#postPublicUrl"]}}}Ye([ht],wp.prototype,"link",null);const Cp=new vn({localItemType:wp,remoteIdProperty:"id",propertyUpdater:Pp({_remoteLink:{name:"link",format:"object"}})}),Rp=new vn({localItemType:class extends Ap{get text(){return this._text}},remoteIdProperty:"id",propertyUpdater:Pp({_text:{name:"board#postText",format:"string"}})});class Lp extends vc{constructor(e,t,i){super(e,t,i),this._core=e,this._memberRole=yp.UNKNOWN,this._hasLoadedPostsProp=!1,this._postPool=new Xo(this._core,"post"),this._posts=[],this._core.getBoardContext().then((e=>{this._boardContext=e})),this._needsRepoMetadata=!0}_ensureBoardContext(){if(!this._boardContext)throw We.create(Be.INTERNAL_ERROR,"Board context not initialized");return this._boardContext}get _hasLoadedPosts(){return this._hasLoadedPostsProp}set _hasLoadedPosts(e){this._hasLoadedPostsProp=e}get posts(){const e=new Tp(this._core,this);return new Uo(this._postPool,[e])}get description(){return this._description}get displayName(){return this._name.replace(Lp.boardNameSuffix,"")}get _idOfBaseAsset(){return this._baseAssetId}get role(){return this._memberRole}get publishedBoardInfo(){return this._publishedBoardInfo}get isPublishedToAnotherBoard(){return!!this._publishedBoardInfo}get sourceBoardInfo(){return this._sourceBoardInfo}get isPublishedFromAnotherBoard(){return!!this._sourceBoardInfo}async addPost(e){return this._ensureBoardContext().addPost(Object.assign({boardId:this.id},e))}async removePost(e){await this._ensureBoardContext().removePost({boardId:this.id,postId:e})}async updatePost(e){await this._ensureBoardContext().updatePost(Object.assign({boardId:this.id},e))}async update(e){return this._ensureBoardContext().updateBoard(Object.assign({boardId:this.id},e))}async discard(){return this._ensureBoardContext().discardBoard(this.id)}async restore(){}get links(){return Object.assign({},this.__links)}async publish(e={}){return this._ensureBoardContext().publishBoard(Object.assign({boardId:this.id},e))}async unpublish(){return this._ensureBoardContext().unpublishBoard(this.id)}isReadOnly(){return this.isPublishedFromAnotherBoard||!this.hasPermission(ee.Write)}get canAddPost(){return!this.isPublishedFromAnotherBoard&&(this._memberRole===yp.OWNER||this._memberRole===yp.POSTER)}get canUnpublish(){return this._memberRole===yp.OWNER&&this.isPublishedToAnotherBoard}get canPublish(){return!this.isPublishedFromAnotherBoard&&this._memberRole===yp.OWNER}async getPostById(e){return this._ensureBoardContext().getPostByBoardAndPostId({boardId:this.id,postId:e})}handleOnsChangedResources(e){super.handleOnsChangedResources(e),(null==e?void 0:e.includes("api:metadata/repository"))||this._boardContext._fetchBoardById(this.id)}_loadWithRetry(){return this._load()}async _load({repoMetadata:e,appMetadata:t,effectivePermission:i}={}){this._boardContext||(this._boardContext=await this._core.getBoardContext());const s=super._load({repoMetadata:e,appMetadata:t,effectivePermission:i});await Promise.allSettled([s,this._boardContext._fetchBoardById(this.id,s)])}}Lp.boardNameSuffix=".ccboard",Ye([nt],Lp.prototype,"posts",null),Ye([ht],Lp.prototype,"description",null),Ye([ht],Lp.prototype,"displayName",null),Ye([ht],Lp.prototype,"_idOfBaseAsset",null),Ye([ht],Lp.prototype,"role",null),Ye([ht],Lp.prototype,"publishedBoardInfo",null),Ye([ht],Lp.prototype,"isPublishedToAnotherBoard",null),Ye([ht],Lp.prototype,"sourceBoardInfo",null),Ye([ht],Lp.prototype,"isPublishedFromAnotherBoard",null),Ye([ht],Lp.prototype,"links",null),Ye([ht],Lp.prototype,"isReadOnly",null),Ye([ht],Lp.prototype,"canAddPost",null),Ye([ht],Lp.prototype,"canUnpublish",null),Ye([ht],Lp.prototype,"canPublish",null),Ye([Pt],Lp.prototype,"_loadWithRetry",null);const Np=new vn({localItemType:Lp,remoteIdProperty:"repo:assetId",propertyUpdater:new Cn({_id:{name:"repo:assetId",format:"string"},_assetClass:{name:"repo:assetClass",choices:pn},_description:{name:"dc:description",format:"string"},_name:{name:"repo:name",format:"string"},_created:{name:"repo:createDate",format:"date"},_repositoryID:{name:"repo:repositoryId",format:"string"},__links:{name:"_links",format:"object"},_createdBy:{name:"repo:createdBy",format:"string"},_modifiedBy:{name:"repo:modifiedBy",format:"string"},_modified:{name:"repo:modifyDate",format:"date"},_assetState:{name:"repo:state",choices:_n},_type:{name:"dc:format",format:"string"},_path:{name:"repo:path",format:"string"},_remotePosts:{isArray:!0,name:"posts",format:"object",set:async(e,t)=>{const i=t;i._posts.length=0;const s=i._postPool.createMutationSession(),r=i._postPool.toArray().filter((t=>!e.some((e=>e.id===t.id))));r.forEach((e=>s.queueDiscardedItem(e))),i._postPool.removeLocalItems(r.map((e=>e.id)));const n=[];e.forEach((e=>{const t=Object.assign(Object.assign({},e),{computedBoardId:i.id});e.type===Ip.TEXT?n.push(Rp.updateRemoteItem(s,t)):e.type===Ip.ASSET_LINK&&n.push(Cp.updateRemoteItem(s,t))})),s.commit(),i._posts.push(...n)}},_baseAssetId:{name:"board:context[baseAssetId]",format:"string"},_memberRole:{name:"memberRole",choices:Object.values(yp)},_permissions:{get:function(e){var t;if(null===(t=e._embedded)||void 0===t?void 0:t[yt.AC_EFFECTIVE])return Wi(e._embedded[yt.AC_EFFECTIVE]);switch(e.memberRole){case yp.OWNER:return ee.Write|ee.Read|ee.Delete;case yp.POSTER:case yp.VIEWER:return ee.Read;case yp.UNKNOWN:return ee.None;default:return On}},format:"number"},_publishedBoardInfo:{name:"board:publishedBoard",format:"object",set:(e,t)=>{t._publishedBoardInfo=e?{boardId:e["repo:assetId"],showPosterName:e["board:showPosterName"]||!1}:void 0}},_sourceBoardInfo:{name:"board:sourceBoard",format:"object",set:(e,t)=>{t._sourceBoardInfo={boardId:e["repo:assetId"],publishedVersion:e["repo:version"]}}}})}),Dp={noop:()=>0};class Mp extends(Fn(Dp)){}Mp.default=new Mp("ascending","noop");const xp=(e,t)=>jn(e.displayName||"",t.displayName||""),kp=(e,t,i)=>{let s;return s=e[i]||t[i]?e[i]?t[i]?Un(e[i].getTime(),t[i].getTime()):-1:1:0,0===s?xp(e,t):s},Hp={name:(e,t)=>xp(e,t),created:(e,t)=>kp(e,t,"created"),modified:(e,t)=>kp(e,t,"modified")};class jp extends(Fn(Hp)){}jp.default=new jp("ascending","name");class Up{constructor(e={}){this.baseAssetId=e.baseAssetId||"",this.shouldGetDirectlyInBaseAsset=e.shouldGetDirectlyInBaseAsset||!1}matches(e){return!!e.isBoard&&e._idOfBaseAsset===this.baseAssetId&&!e.isDiscarded}getRelationToFilter(e){return this.baseAssetId!==e.baseAssetId?"disjoint":"subset"}get hash(){return`baseAssetId=${this.baseAssetId}&shouldGetDirectlyInBaseAsset=${this.shouldGetDirectlyInBaseAsset}`}}class Bp extends Ks{constructor(){super(...arguments),this._repositoryID=""}get repositoryID(){return this._repositoryID}async createTeam(e){return await this._core.spaceContext.createTeam(this,e)}}Ye([ht],Bp.prototype,"repositoryID",null);const Fp=new vn({localItemType:Bp,remoteIdProperty:"repositoryId",propertyUpdater:new Cn({_repositoryID:"repositoryId"})}),Vp={created:(e,t)=>Un(e.created,t.created),name:(e,t)=>Un(e.name,t.name)};class Kp extends(Fn(Vp)){}Kp.default=new Kp("descending","created");class Gp extends Ad{}Gp.default=new Gp("descending","lastAccessed");class $p extends Ad{}$p.default=new $p("descending","modified");const Wp={name:"repo:name",created:"repo:createDate",lastAccessed:Nn},zp={name:(e,t)=>jn(e.name,t.name),created:(e,t)=>Un(e.created,t.created),lastAccessed:(e,t)=>Un(e.lastAccessed,t.lastAccessed)};class qp extends(Fn(zp)){}qp.default=new qp("ascending","name"),qp.createdDesc=new qp("descending","created"),qp.lastAccessed=new qp("descending","lastAccessed");const Yp={name:rs.NAME,created:rs.CREATE_DATE,modified:rs.MODIFY_DATE},Qp={name:(e,t)=>jn(e.name,t.name),created:(e,t)=>Un(e.created,t.created),modified:(e,t)=>Un(e.modified,t.modified)};class Jp extends(Fn(Qp)){}Jp.default=new Jp("descending","modified");const Xp={created:(e,t)=>Un(e.created,t.created)};class Zp extends(Fn(Xp)){}Zp.default=new Zp("descending","created");const e_={name:os.NAME,created:os.CREATE_DATE,modified:os.MODIFY_DATE},t_={name:(e,t)=>jn(e.name,t.name),created:(e,t)=>Un(e.created,t.created),modified:(e,t)=>Un(e.modified,t.modified)};class i_ extends(Fn(t_)){}i_.default=new i_("descending","modified");const s_={id:(e,t)=>jn(e.id,t.id)};class r_ extends(Fn(s_)){}r_.default=new r_("ascending","id");const n_={name:"name",created:"createDate"},o_={name:(e,t)=>jn(e.name,t.name),created:(e,t)=>Un(e.created,t.created)};class a_ extends(Fn(o_)){}a_.default=new a_("ascending","name");const c_={name:"name",created:"createdDate"},l_={name:(e,t)=>jn(e.name,t.name),created:(e,t)=>Un(e.created,t.created)};class d_ extends(Fn(l_)){}d_.default=new d_("ascending","name");const u_={noop:(e,t)=>0};class h_ extends(Fn(u_)){}h_.default=new h_("ascending","noop");const p_=e=>/\S/.test(e);var __;!function(e){e[e.DISJOINTED=0]="DISJOINTED",e[e.SUPERSET=1]="SUPERSET",e[e.SUBSET=2]="SUBSET",e[e.UNKNOWN=3]="UNKNOWN",e[e.IDENTICAL=4]="IDENTICAL"}(__||(__={}));const m_=[Y.Yours,Y.SWY];class f_{constructor(e={view:Y.All}){this._view=Y.All,this._directorySubtypes=[ts.CC_PROJECTS];const{_isDiscarded:t,view:i,repositoryID:s,organizationID:r,nameContains:n,isDiscarded:o,directorySubtypes:a}=e;this._isDiscarded=!(!t&&!o),void 0!==i&&(this._view=i),this._repositoryID=s,this._organizationID=r,this._nameContains=n,this._directorySubtypes=null!=a?a:this._directorySubtypes}get hash(){var e;return`discarded=${this._isDiscarded}view=${this._view}repositoryId=${this._repositoryID}orgID=${this._organizationID||""}nameContains=${this._nameContains}directorySubtype=${null===(e=this._directorySubtypes)||void 0===e?void 0:e.sort().join("")}`}get view(){return this._view}get repositoryID(){return this._repositoryID}get nameContains(){return this._nameContains}get isDiscarded(){return this._isDiscarded}_getRelationToNameContains(e="",t=""){if(e===t)return __.IDENTICAL;if(!e&&t)return __.UNKNOWN;const i=e.toLowerCase().split(" ").filter(p_).sort(),s=t.toLowerCase().split(" ").filter(p_).sort();if(0===i.length&&0===s.length)return __.IDENTICAL;if(i.length===s.length&&i.every(((e,t)=>e===s[t])))return __.IDENTICAL;let r=0,n=0;return i.forEach((e=>{const t=s.find((t=>{const i=t.startsWith(e),s=e.startsWith(t);return i||s}));t&&(e.length<=t.length&&n++,e.length>t.length&&r++)})),i.length===r?__.SUBSET:i.length===n?__.SUPERSET:0===r&&0===n?__.DISJOINTED:__.UNKNOWN}_searchTarget(e,t){const i=e.toLowerCase().split(/\s+/),s=t.toLowerCase().split(/\s+/);return 0!==i.length&&0!==s.length&&i.every((e=>s.find((t=>t.startsWith(e)))))}get organizationID(){return this._organizationID}get directorySubtypes(){return this._directorySubtypes}matches(e){var t;if(this._view===Y.Recent&&!e._isRecent)return!1;if(this.view!==Y.Recent&&e._isRecent&&!e._allowInLists)return!1;if(!e.isProject)return!1;if(e.isDiscarded!==this._isDiscarded)return!1;if(this._repositoryID&&this._repositoryID!==e.repositoryID)return!1;if(this._organizationID&&this._organizationID!==e.repositoryOwner.id)return!1;if((null===(t=this._directorySubtypes)||void 0===t?void 0:t.length)&&!this._directorySubtypes.includes(e.directorySubtype))return!1;const i=this._nameContains;return!(i&&!this._searchTarget(i,e.name)||m_.includes(this._view)&&this._view!==e.view)}getRelationToFilter(e){if(this._repositoryID&&e.repositoryID&&this._repositoryID!==e.repositoryID)return"disjoint";if(this._isDiscarded!==e._isDiscarded)return"disjoint";if(this._view!==e.view&&m_.includes(this._view)&&m_.includes(e.view))return"disjoint";let t;if((this.nameContains||e.nameContains)&&(t=this._getRelationToNameContains(this.nameContains,e.nameContains),t===__.DISJOINTED))return"disjoint";if(this._organizationID&&e.organizationID&&this._organizationID!==e.organizationID)return"disjoint";const i=_o(this._directorySubtypes,e._directorySubtypes);if("disjoint"===i)return"disjoint";if(t&&t===__.SUPERSET||t===__.UNKNOWN)return"unknown";if(!this._organizationID&&e.organizationID)return"unknown";if([Y.All,Y.Admin,void 0].includes(this._view)&&m_.includes(e.view))return"unknown";if(m_.includes(this.view)&&e.view===Y.All)return"unknown";if(this.view===Y.Admin&&e.view===Y.All)return"unknown";if(this._view===Y.Recent){switch(e.view){case Y.Recent:case Y.All:case Y.Admin:case Y.Yours:case Y.SWY:case Y.Organization:}return"unknown"}return e.view===Y.Recent||"unknown"===i?"unknown":"subset"}}f_.YourProjects=new f_({view:Y.Yours}),f_.AllProjects=new f_({view:Y.All}),f_.SWYProjects=new f_({view:Y.SWY}),f_.AdminProjects=new f_({view:Y.Admin});class g_{constructor(e){this._listingOptions={},e&&(this._listingOptions=e)}get listingOptions(){return this._listingOptions}get hash(){const e=this._listingOptions;return[void 0!==e.publishedState?`publishedState:${e.publishedState}`:void 0,e.createDateMin?`createDateMin:${e.createDateMin.getTime()}`:void 0,e.createDateMax?`createDateMax:${e.createDateMax.getTime()}`:void 0,e.modifyDateMin?`modifyDateMin:${e.modifyDateMin.getTime()}`:void 0,e.modifyDateMax?`modifyDateMax:${e.modifyDateMax.getTime()}`:void 0,e.createdBy?`createdBy:${e.createdBy}`:void 0,e.trainingSetId?`trainingSetId:${e.trainingSetId}`:void 0,e.baseModelName?`baseModelName:${e.baseModelName}`:void 0,e.baseModelVersion?`baseModelVersion:${e.baseModelVersion}`:void 0,e.category?`category:${e.category}`:void 0,void 0!==e.inferenceReady?`inferenceReady:${e.inferenceReady}`:void 0,e.trainingJobId?`trainingJobId:${e.trainingJobId}`:void 0,e.trainingState?`trainingState:${e.trainingState}`:void 0,e.trainingSetVersion?`trainingSetVersion:${e.trainingSetVersion}`:void 0].filter((e=>void 0!==e)).join(":")}matches(e){return!(void 0!==this._listingOptions.publishedState&&e.publishedState!==this._listingOptions.publishedState||void 0!==this._listingOptions.createdBy&&e.createdBy!==this._listingOptions.createdBy||void 0!==this._listingOptions.createDateMin&&e.created<this._listingOptions.createDateMin||void 0!==this._listingOptions.createDateMax&&e.created>this._listingOptions.createDateMax||void 0!==this._listingOptions.modifyDateMin&&e.modified<this._listingOptions.modifyDateMin||void 0!==this._listingOptions.modifyDateMax&&e.modified>this._listingOptions.modifyDateMax||void 0!==this._listingOptions.trainingSetId&&e.trainingSetInfo.id!==this._listingOptions.trainingSetId||void 0!==this._listingOptions.baseModelName&&e.baseModelName!==this._listingOptions.baseModelName||void 0!==this._listingOptions.baseModelVersion&&e.baseModelVersion!==this._listingOptions.baseModelVersion||void 0!==this._listingOptions.category&&e.category!==this._listingOptions.category||void 0!==this._listingOptions.inferenceReady&&e.inferenceReady!==this._listingOptions.inferenceReady||void 0!==this._listingOptions.trainingJobId&&e.trainingInfo.jobId!==this._listingOptions.trainingJobId||void 0!==this._listingOptions.trainingState&&e.trainingInfo.trainingState!==this._listingOptions.trainingState||void 0!==this._listingOptions.trainingSetVersion&&e.trainingSetInfo.version!==this._listingOptions.trainingSetVersion)}getRelationToFilter(e){const t=po(this._listingOptions.createDateMin,this._listingOptions.createDateMax,e._listingOptions.createDateMin,e._listingOptions.createDateMax),i=po(this._listingOptions.modifyDateMin,this._listingOptions.modifyDateMax,e._listingOptions.modifyDateMin,e._listingOptions.modifyDateMax),s=[...["publishedState","createdBy","trainingSetId","baseModelName","baseModelVersion","category","inferenceReady","trainingJobId","trainingState","trainingSetVersion"].map((t=>this.getRelationForParam(e,t))),t,i];return s.some((e=>"disjoint"===e))?"disjoint":s.some((e=>"unknown"===e))?"unknown":"subset"}getRelationForParam(e,t){return this._listingOptions[t]===e._listingOptions[t]?"subset":e._listingOptions[t]?this._listingOptions[t]?"disjoint":"unknown":"subset"}getRelationPublishedState(e){return this.getRelationForParam(e,"publishedState")}getRelationCreatedBy(e){return this.getRelationForParam(e,"createdBy")}getRelationTrainingSetId(e){return this.getRelationForParam(e,"trainingSetId")}getRelationBaseModelName(e){return this.getRelationForParam(e,"baseModelName")}getRelationBaseModelVersion(e){return this.getRelationForParam(e,"baseModelVersion")}getRelationCategory(e){return this.getRelationForParam(e,"category")}getRelationInferenceReady(e){return this.getRelationForParam(e,"inferenceReady")}getRelationTrainingJobId(e){return this.getRelationForParam(e,"trainingJobId")}getRelationTrainingState(e){return this.getRelationForParam(e,"trainingState")}getRelationTrainingSetVersion(e){return this.getRelationForParam(e,"trainingSetVersion")}}class y_{constructor(e){var t,i;this._generationGroupId=null==e?void 0:e.generationGroupId,this._featureFlags=null==e?void 0:e.featureFlags;let s=new zn([ve.IMAGE,ve.VIDEO,...(null===(t=null==e?void 0:e.featureFlags)||void 0===t?void 0:t.generationHistoryVectors)?[ve.VECTOR]:[],...(null===(i=null==e?void 0:e.featureFlags)||void 0===i?void 0:i.generationHistoryAudio)?[ve.AUDIO]:[]]);if((null==e?void 0:e.historyAssetTypes)&&(s=s.intersection(new zn(e.historyAssetTypes))),(null==e?void 0:e.historyAssetType)&&(s=s.intersection(new zn([e.historyAssetType]))),this._historyAssetTypes=Array.from(s),0===this._historyAssetTypes.length)throw We.create(Be.BAD_REQUEST,"GenerationHistoryAssetFilter: No valid history asset types provided.")}get generationGroupId(){return this._generationGroupId}get historyAssetTypes(){return this._historyAssetTypes}get hash(){return[this._generationGroupId?`generationGroupId:${this._generationGroupId}`:void 0,this._historyAssetTypes?`historyAssetType:${this._historyAssetTypes}`:void 0].filter((e=>e)).join(":")}matches(e){var t,i,s,r,n;return!(!(null===(t=this._featureFlags)||void 0===t?void 0:t.generationHistoryAudio)&&e.mediaType===la&&"SoundFXGeneration"===(null===(s=null===(i=e.appMetadata.data)||void 0===i?void 0:i.firefly)||void 0===s?void 0:s.module)||(this._generationGroupId?(null===(n=null===(r=e.appMetadata.data)||void 0===r?void 0:r.firefly)||void 0===n?void 0:n.generationGroupId)!==this._generationGroupId:!this._historyAssetTypes.find((t=>t===pa[e.mediaType]))))}_getGenerationGroupIdRelation(e,t){return e&&t&&e!==t?"disjoint":!t&&e?"unknown":"subset"}getRelationToFilter(e){const{_generationGroupId:t,_historyAssetTypes:i}=e,{_generationGroupId:s,_historyAssetTypes:r}=this,n=[(o=s,a=t,o&&a&&o!==a?"disjoint":a&&!o?"unknown":"subset"),_o(r,i)];var o,a;return n.includes("disjoint")?"disjoint":n.includes("unknown")?"unknown":"subset"}}class v_{constructor(e){this._listingOptions={},e&&(this._listingOptions=e)}get listingOptions(){return this._listingOptions}get hash(){return[this._listingOptions.publishedState?`publishedState:${this._listingOptions.publishedState}`:void 0,this._listingOptions.createDateMin?`createDateMin:${this._listingOptions.createDateMin.getTime()}`:void 0,this._listingOptions.createDateMax?`createDateMax:${this._listingOptions.createDateMax.getTime()}`:void 0,this._listingOptions.modifyDateMin?`modifyDateMin:${this._listingOptions.modifyDateMin.getTime()}`:void 0,this._listingOptions.modifyDateMax?`modifyDateMax:${this._listingOptions.modifyDateMax.getTime()}`:void 0,this._listingOptions.createdBy?`createdBy:${this._listingOptions.createdBy}`:void 0].filter((e=>e)).join(":")}matches(e){return!(this._listingOptions.publishedState&&e.publishedState!==this._listingOptions.publishedState&&this._listingOptions.publishedState!==ns.ALL||this._listingOptions.createdBy&&e.createdBy!==this._listingOptions.createdBy||this._listingOptions.createDateMin&&e.created<this._listingOptions.createDateMin||this._listingOptions.createDateMax&&e.created>this._listingOptions.createDateMax||this._listingOptions.modifyDateMin&&e.modified<this._listingOptions.modifyDateMin||this._listingOptions.modifyDateMax&&e.modified>this._listingOptions.modifyDateMax)}getRelationToFilter(e){const t=this.getRelationPublishedState(e),i=this.getRelationCreatedBy(e),s=po(this._listingOptions.createDateMin,this._listingOptions.createDateMax,e._listingOptions.createDateMin,e._listingOptions.createDateMax),r=po(this._listingOptions.modifyDateMin,this._listingOptions.modifyDateMax,e._listingOptions.modifyDateMin,e._listingOptions.modifyDateMax);return[t,i,s,r].some((e=>"disjoint"===e))?"disjoint":[t,i,s,r].some((e=>"unknown"===e))?"unknown":"subset"}getRelationPublishedState(e){return this._listingOptions.publishedState===e._listingOptions.publishedState||e._listingOptions.publishedState===ns.ALL||void 0===e._listingOptions.publishedState?"subset":this._listingOptions.publishedState===ns.ALL||void 0===this._listingOptions.publishedState?"unknown":"disjoint"}getRelationCreatedBy(e){return this._listingOptions.createdBy===e._listingOptions.createdBy?"subset":e._listingOptions.createdBy?this._listingOptions.createdBy?"disjoint":"unknown":"subset"}}class O_{constructor(e){this._bookmarked=!1,this._bookmarked=Boolean(null==e?void 0:e.bookmarked),this._teamID=null==e?void 0:e.teamID,this._teamRole=null==e?void 0:e.teamRole,this._state=null==e?void 0:e.state,this._teamRole=null==e?void 0:e.teamRole}static ActiveSpacesFromTeam(e){return new O_({state:"active",teamID:e})}get bookmarked(){return this._bookmarked}get teamID(){return this._teamID}get teamRole(){return this._teamRole}get state(){return this._state}get hash(){var e,t;return String(this.bookmarked)+":"+(this.teamID||"all-teams")+":"+(null!==(e=this._teamRole)&&void 0!==e?e:"all-roles")+":"+(null!==(t=this._state)&&void 0!==t?t:"any-state")}matches(e){if(this._bookmarked&&!e.isBookmarked)return!1;const t=this._teamID;if(t&&e.teamID!==t)return!1;const i=this._teamRole;if(i&&e.teamRole!==i)return!1;const s=this._state;return!s||s===e.state}getRelationToFilter(e){const t=e;return this._teamRole!==t._teamRole?this._teamRole&&t._teamRole?"disjoint":"unknown":this.teamID&&t.teamID&&this.teamID!==t.teamID?"disjoint":!this.teamID&&t.teamID||!this.bookmarked&&e.bookmarked?"unknown":this._state!==e._state?this._state&&e._state?"disjoint":"unknown":"subset"}}var b_;O_.ActiveSpaces=new O_({state:"active"}),O_.ArchivedSpaces=new O_({state:"archived"}),O_.ActiveBookmarkedSpaces=new O_({state:"active",bookmarked:!0}),O_.ActiveSpacesFromOtherTeams=new O_({state:"active",teamRole:"NONE"}),function(e){e[e.DISJOINTED=0]="DISJOINTED",e[e.SUPERSET=1]="SUPERSET",e[e.SUBSET=2]="SUBSET",e[e.UNKNOWN=3]="UNKNOWN",e[e.IDENTICAL=4]="IDENTICAL"}(b_||(b_={}));class I_{constructor(e){this._nameContains=null==e?void 0:e.nameContains,this._state=null==e?void 0:e.state}static TeamsContainingName(e){return new I_({nameContains:e})}get nameContains(){return this._nameContains}get state(){return this._state}get hash(){var e,t;return(null!==(e=this._nameContains)&&void 0!==e?e:"any-name")+":"+(null!==(t=this._state)&&void 0!==t?t:"any-state")}_getRelationToNameContains(e,t){if(e===t)return b_.IDENTICAL;const i=e.toLowerCase().split(" ").filter(p_).sort(),s=t.toLowerCase().split(" ").filter(p_).sort();if(0===i.length&&0===s.length)return b_.IDENTICAL;if(0===i.length||0===s.length)return b_.DISJOINTED;if(i.length===s.length&&i.every(((e,t)=>e===s[t])))return b_.IDENTICAL;let r=0,n=0;return i.forEach((e=>{const t=s.find((t=>{const i=t.startsWith(e),s=e.startsWith(t);return i||s}));t&&(e.length<=t.length&&n++,e.length>t.length&&r++)})),i.length===r?b_.SUBSET:i.length===n?b_.SUPERSET:0===r&&0===n?b_.DISJOINTED:b_.UNKNOWN}_searchTarget(e,t){const i=e.toLowerCase().split(" ").filter(p_),s=t.toLowerCase().split(" ").filter(p_);return 0!==i.length&&0!==s.length&&i.every((e=>s.find((t=>t.startsWith(e)))))}matches(e){const t=this._state;if(t&&t!==e.state)return!1;const i=this._nameContains;return!(i&&!this._searchTarget(i,e.name))}getRelationToFilter(e){let t;return this.nameContains&&e.nameContains&&(t=this._getRelationToNameContains(this.nameContains,e.nameContains),t===b_.DISJOINTED)||this.state&&e.state&&this.state!==e.state?"disjoint":!this.state&&e.state||!this.nameContains&&e.nameContains||t&&t===b_.SUPERSET||t===b_.UNKNOWN?"unknown":"subset"}}I_.ActiveTeams=new I_({state:"active"}),I_.DiscardedTeams=new I_({state:"discarded"});class E_ extends cn{constructor(){super(...arguments),this._created=new Date,this._createdBy="",this._name="",this._repositoryID="",this._repositoryName="",this._state="active",this._role="none"}get teamID(){return this.id}get created(){return this._created}get createdBy(){return this._createdBy}get name(){return this._name}get description(){return this._description}get repositoryID(){return this._repositoryID}get repositoryName(){return this._repositoryName}get repositoryOwnerID(){return this._repositoryOwnerID}get repositoryOwnerEmail(){return this._repositoryOwnerEmail}get repositoryOwnerType(){return this._repositoryOwnerType}get collaboratorRole(){return tn("collaboratorRoleDeprecated","The property collaboratorRole has been depecrated in favor of role."),"owner"===this._role?"editor":this._role}get role(){return this._role}get state(){return this._state}get _links(){return this.__links}async archive(){await this._core.spaceContext.archiveTeam(this)}async createSpace(e){return await this._core.spaceContext.createSpace(this,e)}async permanentlyDelete(){await this._core.spaceContext.permanentlyDeleteTeam(this)}async rename(e){await this._core.spaceContext.renameTeam(this,e)}async restore(){await this._core.spaceContext.restoreTeam(this)}async update(e){await this._core.spaceContext.updateTeam(this,e)}async ensureDescription(){await this._core.spaceContext.loadTeamProperties(this)}}Ye([ht],E_.prototype,"created",null),Ye([ht],E_.prototype,"createdBy",null),Ye([ht],E_.prototype,"name",null),Ye([ht],E_.prototype,"description",null),Ye([ht],E_.prototype,"repositoryID",null),Ye([ht],E_.prototype,"repositoryName",null),Ye([ht],E_.prototype,"repositoryOwnerID",null),Ye([ht],E_.prototype,"repositoryOwnerEmail",null),Ye([ht],E_.prototype,"repositoryOwnerType",null),Ye([ht],E_.prototype,"collaboratorRole",null),Ye([ht],E_.prototype,"role",null),Ye([ht],E_.prototype,"state",null),Ye([ht],E_.prototype,"_links",null);const T_=new vn({localItemType:E_,remoteIdProperty:"id",propertyUpdater:new Cn({_created:{name:"createDate",format:"date"},_createdBy:"createdBy",_description:"description",_name:"name",_repositoryID:"repositoryId",_repositoryName:"repositoryName",_repositoryOwnerID:"repositoryOwner.id",_repositoryOwnerEmail:"repositoryOwner.email",_repositoryOwnerType:{name:"repositoryOwner.type",choices:["org","user"]},_role:{name:"role",choices:Mu},_state:{name:"state",choices:["active","discarded"]},__links:{name:"_links",format:"object"}})}),S_={displayName:(e,t)=>jn(e.displayName,t.displayName)};class A_ extends(Fn(S_)){}A_.default=new A_("ascending","displayName");const P_=new vn({localItemType:class extends Ks{constructor(){super(...arguments),this._isDefault=!1,this._type="",this._angle=0,this._stops=[],this._name="",this._languageCode="",this._gradientID="",this._textAlpha=1,this._textMode="RGB",this._textColorValue={r:0,g:0,b:0},this._textType="process"}get isDefault(){return this._isDefault}get type(){return this._type}get angle(){return this._angle}get stops(){return this._stops}get name(){return this._name}get languageCode(){return this._languageCode}get gradientID(){return this._gradientID}get textAlpha(){return this._textAlpha}get textMode(){return this._textMode}get textColorValue(){return this._textColorValue}get textType(){return this._textType}},remoteIdProperty:"computedID",propertyUpdater:new Cn({_isDefault:{name:"project:gradientData.isDefault",format:"boolean"},_type:{name:"project:gradientData.type",format:"string"},_angle:{name:"project:gradientData.angle",format:"string"},_name:{name:"project:gradientName",format:"string"},_stops:{name:"project:gradientData.stops",format:"object"},_languageCode:{name:"project:gradientData.languageCode",format:"string"},_gradientID:"project:gradientId",_textAlpha:{name:"project:gradientTextColor.alpha",format:"number"},_textMode:{name:"project:gradientTextColor.mode",format:"string"},_textColorValue:{name:"project:gradientTextColor.value",format:"object"},_textType:{name:"project:gradientTextColor.type",format:"string"}})}),w_="frameioAuthorizationChange",C_=new class extends ot{constructor(){super(w_)}},R_="frameioReviewLinksChange",L_=new class extends ot{constructor(){super(R_)}},N_="https://api.frame.io",D_={ME:`${N_}/v2/me`,ACCOUNT:`${N_}/v2/accounts/{accountId}`,ACCOUNTS:`${N_}/v2/accounts?join=collaborator`,TEAMS:`${N_}/v2/accounts/{accountId}/teams?include=user_role&role=member`,TEAM:`${N_}/v2/teams/{teamId}?include=account`,PROJECT:`${N_}/v2/projects/{projectId}?include=string`,PROJECTS:`${N_}/v2/teams/{teamId}/projects?filter[archived]`,SHAREDPROJECTS:`${N_}/v2/projects/shared?filter[account_id]={accountId}`,REVIEWS:`${N_}/v2/projects/{projectId}/review_links`,REVIEW:`${N_}/v2/review_links/{reviewLinkId}`,ITEMCREATE:`${N_}/v2/review_links/{reviewLinkId}/assets`,ASSETS:`${N_}/v2/assets/{assetId}/children?include=cover_asset`,ASSET:`${N_}/v2/assets/{assetId}?type=folder&include=cover_asset`,CREATEASSET:`${N_}/v2/assets/{parentId}/children`,VERSION:`${N_}/v2/assets/{assetId}/version`,CREATECOMMENT:`${N_}/v2/assets/{assetId}/comments`,GETCOMMENT:`${N_}/v2/comments/{commentId}?include=string`,GETCOMMENTS:`${N_}/v2/assets/{assetId}/comments?include=string`,IMPRESSIONS:`${N_}/v2/comments/{commentId}/impressions?include=string`,COMMENT:`${N_}/v2/comments/{commentId}`,REPLY:`${N_}/v2/comments/{commentId}/replies`,GETREPLIES:`${N_}/v2/comments/{commentId}/replies?include=replies`,LIKE:`${N_}/v2/comments/{commentId}/like`,COMPLETE:`${N_}/v2/comments/{commentId}/complete`,FOLDERTREE:`${N_}/v2/projects/{projectId}/folder_tree`,ANCESTORS:`${N_}/v2/assets/{assetId}/ancestors`,ADOBE_SUSI_USER:`${N_}/v2/auth/adobe/method`,ADOBE_SUSI:`${N_}/v2/auth/adobe/callback`};function M_(e,t){return mt(e).fill(t)}var x_;!function(e){e[e.authLoggedOut=0]="authLoggedOut",e[e.authLoggedIn=1]="authLoggedIn",e[e.authExpired=2]="authExpired"}(x_||(x_={}));class k_ extends pr{constructor(e){super(e._core),this._frameioContext=e;const{PRODUCT_ID:t}=this._core._environment.getValue("HOST_PRODUCT_DATA"),i="adobe+"+t;this._frameioClientId=i.toLowerCase()}get nativeContext(){const e="undefined"!=typeof window&&window.acplModel;if(!this._nativeContext&&e){const t=e.Workflows;if(t.createShareForReviewWorkflow){const i=t.createShareForReviewWorkflow(e.applicationAssetContext);if(this._nativeContext=i.getFrameioAssetContext(),this._nativeContext){const e=this;this._nativeContext.addEventListener(R_,(t=>{e._frameioContext._handleReviewLinksChangeEvent(t)})),this._nativeContext.addEventListener(w_,(async()=>{const t=e.nativeContext.authenticationInfo();t.frameioToken?(await e._cacheCredentials(JSON.stringify(t)),e._frameioContext._updateCurrentUserId(t.frameioUserId)):(await e._core._environment.cache.deleteItem(e._cachedCredentialsId()),e._frameioContext._updateCurrentUserId(void 0)),e._frameioContext.dispatch(C_)}))}}else tn("FrameioInterface.nativeContext","Share for Review workflows are not enabled for this application")}return this._nativeContext||tn("FrameioInterface.nativeContext","native Frameio context does not exist, web/browser mode is utilized for testing only"),this._nativeContext}get _authenticationId(){return this.adobeId}_cachedCredentialsId(){return"FRAMEIO_CREDENTIALS_"+this._authenticationId}_getRefreshTokenExpiration(e){const t=parseInt(e);return t?t+1296e3:0}async _getCachedCredentials(){const e=this._cachedCredentialsId(),t=await this._core._environment.cache.getItem(e);return t!==Ti?t:""}async _cacheCredentials(e){return this._core._environment.cache.setItem(this._cachedCredentialsId(),e,12096e5)}get adobeId(){return this._core._environment.getValue("USER_ID")}get ccUserId(){return this._core._environment.getValue("USER_EMAIL")||""}get imsToken(){return this._core._environment.getValue("ACCESS_TOKEN")}get xFrameioClient(){return this._frameioClientId}get productKey(){const{PRODUCT_ID:e}=this._core._environment.getValue("HOST_PRODUCT_DATA");return e.includes("Photoshop")?"PHXS":e.includes("Illustrator")?"ILST":e.includes("InDesign")?"IDSN":e.includes("SAMJSDemoApp")?"dev":e.includes("/")?e.slice(0,e.indexOf("/")):"dev"}async checkForCachedCredentials(){const e=await this._getCachedCredentials();if(""!==e){const t=this.nativeContext,i=JSON.parse(e),s=this._getRefreshTokenExpiration(i.frameioLastRefresh);if(s&&s-Math.floor(Date.now()/1e3)<=0)return x_.authExpired;if(i.xFrameioClient=this.xFrameioClient,t&&await t.authenticateUser(i)!==i.token){const e=t.authenticationInfo();return await this._cacheCredentials(JSON.stringify(e)),x_.authLoggedIn}}return x_.authLoggedOut}async isAuthenticated(){return await this.authenticationStatus()===x_.authLoggedIn}async authenticationStatus(){var e,t,i;const s=this.nativeContext;if(s){let e=s.authenticationStatus(this._authenticationId);return e===x_.authLoggedOut&&(e=await this.checkForCachedCredentials()),e}if(null===(e=this._authenticationInfo)||void 0===e?void 0:e.frameioLastRefresh){const e=359,s=new Date,r=new Date(0);return r.setUTCSeconds(parseInt(null===(t=this._authenticationInfo)||void 0===t?void 0:t.frameioLastRefresh)),Math.abs(s.valueOf()-r.valueOf())/36e5>=e?x_.authExpired:(null===(i=this._authenticationInfo)||void 0===i?void 0:i.frameioToken)?x_.authLoggedIn:x_.authLoggedOut}return x_.authLoggedOut}async getToken(){var e;const t=this.nativeContext;return t?await t.getToken():(null===(e=this._authenticationInfo)||void 0===e?void 0:e.frameioToken)||""}async refreshToken(){var e;const t=this.nativeContext;if(t){const e=await t.getToken(!0),i=t.authenticationInfo();return e===i.frameioToken&&await this._cacheCredentials(JSON.stringify(i)),e}return(null===(e=this._authenticationInfo)||void 0===e?void 0:e.frameioToken)||""}async authenticate(e){const t=this.nativeContext;if(t){const i=this.adobeId,s=this.ccUserId,r=this.productKey,n=this.xFrameioClient;if(!t.isUserAuthenticated(this._authenticationId)){const o={adobeId:i,ccUserId:s,productKey:r,xFrameioClient:n};void 0!==e&&(o.frameioToken=e.frameioToken,o.frameioRefreshToken=(null==e?void 0:e.frameioRefreshToken)||void 0,o.frameioTokenExpires=(null==e?void 0:e.frameioTokenExpires)||void 0,o.frameioUserId=(null==e?void 0:e.frameioUserId)||void 0,o.frameioLastRefresh=(null==e?void 0:e.frameioLastRefresh)||void 0);const a=await t.authenticateUser(o);if(""!==a){const e=t.authenticationInfo();await this._cacheCredentials(JSON.stringify(e))}return a}}else this._authenticationInfo=e||void 0;return await this.getToken()}async deauthenticate(){this._authenticationInfo=void 0,await this._core._environment.cache.deleteItem(this._cachedCredentialsId());const e=this.nativeContext;e&&await e.deauthenticateUser(this._authenticationId)}async openFile(e){const t=this.nativeContext;if(t)return await t.openFile(e);throw We.create(Be.UNSUPPORTED,"Method is not supported in browser _environment.")}dispatchReviewLinksChangeEvent(e){const t=this.nativeContext;if(!t)throw We.create(Be.UNSUPPORTED,"Method is not supported in browser _environment.");t.dispatchReviewLinksChangeEvent(e)}async getAdobeSusiInfo(){const e=await this._adobeSusiUserRequest();return{userExists:e.exists,susiAvailable:"adobe"===e.method,restriction:e.restriction||void 0}}async authenticateAdobeSusi(){return await this._adobeSusiRequest()}async _adobeSusiUserRequest(){return(await this._doPost(D_.ADOBE_SUSI_USER,{"Content-Type":"application/json"},JSON.stringify({access_token:this.imsToken}),[200])).json()}async _adobeSusiRequest(){const e=await this._doPost(D_.ADOBE_SUSI,{"Content-Type":"application/json"},JSON.stringify({access_token:this.imsToken}),[200]),t=e.headers,i=await e.json(),s=t.get("authorization"),r=t.get("x-refresh-token"),n=t.get("x-expires");return{frameioToken:s?s.replace("Bearer ",""):"",frameioRefreshToken:r||void 0,frameioTokenExpires:n||void 0,frameioUserId:i.id||void 0,frameioLastRefresh:Date.now().toString(),useAdobeSusi:!0}}async _getFetchOptionOverrides(e,t){const i=await this.getToken();return{href:e,options:Object.assign(Object.assign({},t),{headers:Object.assign(Object.assign({},t.headers),{authorization:`Bearer ${i}`,"x-frameio-client":this.xFrameioClient}),noOtherHeaders:!0})}}async _getMultiPageResponse(e){let t=[];const i=async e=>{const s=await this._doGet(e),r=await s.json(),n=(e=>{const t=e&&e.headers&&e.headers.get("Link"),i=t&&ir.parse(t),s=i&&i.has("rel","next")&&i.get("rel","next"),r=s&&s[0]&&s[0].uri;return r&&r.replace("http:","https:")})(s);return t=t.concat(r),n?i(n):t};return i(e)}async getCurrentUser(){return this._getResponse(D_.ME)}async getAccount(e){return this._getResponse(M_(D_.ACCOUNT,{accountId:e}))}async getAccounts(){return this._getMultiPageResponse(D_.ACCOUNTS)}async getTeams(e){return this._getMultiPageResponse(M_(D_.TEAMS,{accountId:e}))}async getTeam(e){return this._getResponse(M_(D_.TEAM,{teamId:e}))}async getProject(e){return this._getResponse(M_(D_.PROJECT,{projectId:e}))}async getProjects(e){return this._getMultiPageResponse(M_(D_.PROJECTS,{teamId:e}))}async getSharedProjects(e){return this._getMultiPageResponse(M_(D_.SHAREDPROJECTS,{accountId:e}))}async getReviewLinks(e){return this._getMultiPageResponse(M_(D_.REVIEWS,{projectId:e}))}async getReviewLink(e){return this._getResponse(M_(D_.REVIEW,{reviewLinkId:e}))}async createReviewLink(e,t){return(await this._doPost(M_(D_.REVIEWS,{projectId:e}),{"Content-Type":"application/json"},JSON.stringify({name:t}),[200])).json()}async createFolder(e,t){return(await this._doPost(M_(D_.CREATEASSET,{parentId:e}),{"Content-Type":"application/json"},JSON.stringify({name:t,type:"folder"}),[200])).json()}async createFile(e,t,i,s="application/pdf"){return(await this._doPost(M_(D_.CREATEASSET,{parentId:e}),{"Content-Type":"application/json"},JSON.stringify({name:t,type:"file",filetype:s,filesize:i}),[200])).json()}async uploadFile(e,t,i="application/pdf"){const s={method:"PUT",headers:{"Content-Type":i,"x-amz-acl":"private"},body:t};await fetch(e,s)}async reviewLinkAddAsset(e,t){return(await this._doPost(M_(D_.ITEMCREATE,{reviewLinkId:e}),{"Content-Type":"application/json"},JSON.stringify({asset_ids:[t]}),[200])).json()}async getChildren(e){return this._getMultiPageResponse(M_(D_.ASSETS,{assetId:e}))}async getAsset(e){return this._getResponse(M_(D_.ASSET,{assetId:e}))}async addVersionToAsset(e,t){return(await this._doPost(M_(D_.VERSION,{assetId:e}),{"Content-Type":"application/json"},JSON.stringify({next_asset_id:t}),[200])).json()}async createComment(e,t){return(await this._doPost(M_(D_.CREATECOMMENT,{assetId:e}),{"Content-Type":"application/json"},JSON.stringify({text:t}),[200])).json()}async getComment(e){return this._getResponse(M_(D_.GETCOMMENT,{commentId:e}))}async getComments(e){return this._getMultiPageResponse(M_(D_.GETCOMMENTS,{assetId:e}))}async getImpressions(e){return this._getMultiPageResponse(M_(D_.IMPRESSIONS,{commentId:e}))}async updateComment(e,t){return(await this._doPut(M_(D_.COMMENT,{commentId:e}),{"Content-Type":"application/json"},JSON.stringify({text:t}),[200])).json()}async deleteComment(e){return(await this._doDelete(M_(D_.COMMENT,{commentId:e}))).json()}async createReply(e,t){return(await this._doPost(M_(D_.REPLY,{commentId:e}),{"Content-Type":"application/json"},JSON.stringify({text:t}),[200])).json()}async getReplies(e){return this._getMultiPageResponse(M_(D_.GETREPLIES,{commentId:e}))}async createLike(e){return(await this._doPost(M_(D_.LIKE,{commentId:e}),{},void 0,[200])).json()}async deleteLike(e){return(await this._doDelete(M_(D_.LIKE,{commentId:e}))).json()}async completeComment(e){return(await this._doPost(M_(D_.COMPLETE,{commentId:e}),{},void 0,[200])).json()}async uncompleteComment(e){return(await this._doDelete(M_(D_.COMPLETE,{commentId:e}))).json()}async getFolderTree(e){return this._getResponse(M_(D_.FOLDERTREE,{projectId:e}))}async getAncestors(e){return this._getMultiPageResponse(M_(D_.ANCESTORS,{assetId:e}))}}class H_ extends Ks{get context(){return this._core.frameioContext}}const j_=new vn({localItemType:class extends H_{constructor(){super(...arguments),this._accountId="",this._email="",this._name="",this._profileImage="",this._userDefaultColor=""}get accountId(){return this._accountId}get email(){return this._email}get name(){return this._name}get profileImage(){return this._profileImage}get userDefaultColor(){return this._userDefaultColor}async getAccount(){return this._account||(this._account=await this.context.getAccount(this.accountId)),this._account}},remoteIdProperty:"id",propertyUpdater:new Cn({_accountId:"account_id",_email:"email",_name:"name",_profileImage:"profile_image",_userDefaultColor:"user_default_color"})});class U_ extends H_{constructor(){super(...arguments),this._name="",this._projectId="",this._teamId=""}get insertedAt(){return this._insertedAt}get name(){return this._name}get parentId(){return this._parentId}async getParent(){const e=this.context,t=this.parentId;if(t)return e.getAsset(t)}get projectId(){return this._projectId}get teamId(){return this._teamId}get updatedAt(){return this._updatedAt}async getAncestors(){return this.context.getAncestors(this.id)}}const B_=new vn({localItemType:class extends H_{get anonymousUserId(){return this._anonymousUserId||""}get comment(){return this._comment}get commentId(){return this._commentId||""}get deletedAt(){return this._deletedAt}get insertedAt(){return this._insertedAt}get updatedAt(){return this._updatedAt}get userId(){return this._userId||""}},remoteIdProperty:"id",propertyUpdater:new Cn({_anonymousUserId:"anonymous_user_id",_comment:{set:(e,t)=>{const i=t,s=i.context._objectPool.createUpdateSession();i._comment=F_.updateRemoteItem(s,e),s.commit()},name:"comment",format:"object"},_commentId:"comment_id",_deletedAt:{name:"deleted_at",format:"date"},_insertedAt:{name:"inserted_at",format:"date"},_updatedAt:{name:"updated_at",format:"date"},_userId:"user_id"})}),F_=new vn({localItemType:class extends H_{constructor(){super(...arguments),this._completed=!1,this._hasReplies=!1,this._likeCount=0,this._private=!1,this._readCount=0,this._timestamp=0,this._timestampMicroseconds=0}get assetId(){return this._assetId||""}get completed(){return this._completed}get completedAt(){return this._completedAt}get completerId(){return this._completerId||""}get deletedAt(){return this._deletedAt}get hasReplies(){return this._hasReplies}get insertedAt(){return this._insertedAt}get likeCount(){return this._likeCount}get owner(){return this._owner}get ownerId(){return this._ownerId||""}get page(){return this._page||""}get parentId(){return this._parentId||""}get private(){return this._private}get readCount(){return this._readCount}get reviewLinkId(){return this._reviewLinkId||""}get targetAssetId(){return this._targetAssetId||""}get text(){return this._text||""}get textEditedAt(){return this._textEditedAt}get timestamp(){return this._timestamp}get timestampMicroseconds(){return this._timestampMicroseconds}get updatedAt(){return this._updatedAt}async updateComment(e){const t=this.context,i=await t._frameioInterface.updateComment(this.id,e.text),s=t._objectPool.createUpdateSession(),r=F_.updateRemoteItem(s,i);return s.commit(),r}async deleteComment(){const e=this.context,t=await e._frameioInterface.deleteComment(this.id),i=e._objectPool.createUpdateSession(),s=F_.updateRemoteItem(i,t);return i.commit(),s}async createLike(){const e=this.context,t=await e._frameioInterface.createLike(this.id),i=e._objectPool.createUpdateSession(),s=B_.updateRemoteItem(i,t);return i.commit(),s}async deleteLike(){const e=this.context,t=await e._frameioInterface.deleteLike(this.id),i=e._objectPool.createUpdateSession(),s=B_.updateRemoteItem(i,t);return i.commit(),s}async createReply(e){const t=this.context,i=await t._frameioInterface.createReply(this.id,e.text),s=t._objectPool.createUpdateSession(),r=F_.updateRemoteItem(s,i);return s.commit(),r}async getReplies(){const e=this.context,t=await e._frameioInterface.getReplies(this.id),i=e._objectPool.createUpdateSession(),s=F_.updateRemoteItems(i,t);return i.commit(),s}async completeComment(){const e=this.context,t=await e._frameioInterface.completeComment(this.id),i=e._objectPool.createUpdateSession(),s=F_.updateRemoteItem(i,t);return i.commit(),s}async uncompleteComment(){const e=this.context,t=await e._frameioInterface.uncompleteComment(this.id),i=e._objectPool.createUpdateSession(),s=F_.updateRemoteItem(i,t);return i.commit(),s}},remoteIdProperty:"id",propertyUpdater:new Cn({_assetId:"asset_id",_completed:{name:"completed",format:"boolean"},_completedAt:{name:"completed_at",format:"date"},_completerId:"completer_id",_deletedAt:{name:"deleted_at",format:"date"},_hasReplies:{name:"has_replies",format:"boolean"},_insertedAt:{name:"inserted_at",format:"date"},_likeCount:{name:"like_count",format:"number"},_owner:{set:(e,t)=>{const i=t,s=i.context._objectPool.createUpdateSession();i._owner=j_.updateRemoteItem(s,e),s.commit()},name:"owner",format:"object"},_ownerId:"owner_id",_page:"page",_parentId:"parent_id",_private:{name:"private",format:"boolean"},_readCount:{name:"read_count",format:"number"},_reviewLinkId:"review_link_id",_targetAssetId:"target_asset_id",_text:"text",_textEditedAt:{name:"text_edited_at",format:"date"},_timestamp:{name:"timestamp",format:"number"},_timestampMicroseconds:{name:"timestamp_microseconds",format:"number"},_updatedAt:{name:"updated_at",format:"date"}})}),V_=new vn({localItemType:class extends U_{async createComment(e){const t=this.context,i=await t._frameioInterface.createComment(this.id,e.text),s=t._objectPool.createUpdateSession(),r=F_.updateRemoteItem(s,i);return s.commit(),this._comments=void 0,r}async getComments(){let e=this._comments;if(!e){const t=this.context,i=await t._frameioInterface.getComments(this.id),s=t._objectPool.createUpdateSession();e=F_.updateRemoteItems(s,i),s.commit(),this._comments=e}return e}},remoteIdProperty:"id",propertyUpdater:new Cn({_commentCount:"comment_count",_insertedAt:{name:"inserted_at",format:"date"},_name:"name",_parentId:"parent_id",_projectId:"project_id",_teamId:"team_id",_updatedAt:{name:"updated_at",format:"date"}})}),K_=new vn({localItemType:class extends U_{async getChildren(){if(!this._children){const e=this.context,t=await e._frameioInterface.getChildren(this.id),i=e._objectPool.createUpdateSession();this._children=t.map((e=>J_(i,e))),i.commit()}return this._children}async _uploadFile(e,t){const i=this.context,s=t.size(),r=e.length,n=Math.ceil(s/r);let o=0;const a=async s=>{const c=o++;return s=await t.read(c*n,s),i._frameioInterface.uploadFile(e[c],s).then((()=>o<r?a(s):Promise.resolve()))},c=Math.min(r,8),l=[];for(let e=0;e<c;e++)l.push(a(new ArrayBuffer(n)));await Promise.all(l)}async createFile(e,t){const i=this.context,s=await i._frameioInterface.openFile(t),r=s.size(),n=await i._frameioInterface.createFile(this.id,e,r),o=i._objectPool.createUpdateSession(),a=V_.updateRemoteItem(o,n);return o.commit(),await this._uploadFile(n.upload_urls,s),s.close(),a}async createFolder(e){const t=this.context,i=await t._frameioInterface.createFolder(this.id,e),s=t._objectPool.createUpdateSession(),r=K_.updateRemoteItem(s,i);return s.commit(),r}},remoteIdProperty:"id",propertyUpdater:new Cn({_insertedAt:{name:"inserted_at",format:"date"},_name:"name",_parentId:"parent_id",_projectId:"project_id",_teamId:"team_id",_updatedAt:{name:"updated_at",format:"date"}})}),G_=new vn({localItemType:class extends H_{constructor(){super(...arguments),this._email="",this._name=""}get email(){return this._email}get name(){return this._name}async getProjects(){let e=this._projects;if(!e){const t=this.context,i=await this._core.frameioContext._frameioInterface.getProjects(this.id),s=t._objectPool.createUpdateSession();e=q_.updateRemoteItems(s,i),s.commit(),this._projects=e}return e}},remoteIdProperty:"id",propertyUpdater:new Cn({_email:"owner.email",_name:"name"})});class $_ extends U_{constructor(){super(...arguments),this._coverAssetId="",this._versions=0}get coverAssetId(){return this._coverAssetId}async getCoverAsset(){return this._coverAsset||(this._coverAsset=await this.context.getAsset(this.coverAssetId)),this._coverAsset}get versions(){return this._versions}set coverAsset(e){this._coverAsset=e}async getChildren(){if(!this._children){const e=this.context,t=await e._frameioInterface.getChildren(this.id),i=e._objectPool.createUpdateSession();this._children=t.map((e=>J_(i,e))),i.commit()}return this._children}}const W_=new vn({localItemType:$_,remoteIdProperty:"id",propertyUpdater:new Cn({_coverAsset:{name:"cover_asset",format:"object",set:(e,t)=>{const i=t,s=i.context._objectPool.createUpdateSession(),r=J_(s,e);s.commit(),i.coverAsset=r}},_coverAssetId:"cover_asset_id",_insertedAt:{name:"inserted_at",format:"date"},_name:"name",_parentId:"parent_id",_projectId:"project_id",_teamId:"team_id",_updatedAt:{name:"updated_at",format:"date"},_versions:{name:"versions",format:"number"}})}),z_=new vn({localItemType:class extends H_{constructor(){super(...arguments),this._name="",this._shortUrl="",this._ownerId="",this._projectId="",this._active=!1,this._inviteOnly=!1}get name(){return this._name}get shortUrl(){return this._shortUrl}get ownerId(){return this._ownerId}get projectId(){return this._projectId}get active(){return this._active}get inviteOnly(){return this._inviteOnly}get itemId(){return this._itemId}async getArtifactCount(){const e=await this.getItem();return e instanceof $_?e.versions:1}async getArtifact(){const e=await this.getItem();return e instanceof $_?await e.getCoverAsset():e}async getItem(){if(!this._item){if(!this._itemId)return Promise.reject(We.create(Be.BAD_REQUEST,`FrameioReviewLink.getItem() could not find item ${this._itemId}`));this._item=await this.context.getAsset(this._itemId)}return this._item}_dispatchReviewLinksChangeEvent(e){const t=this.context,i={source:e,reviewLink:{id:this.id,name:this._name,short_url:this._shortUrl,owner_id:this._ownerId,project_id:this._projectId,is_active:!!this._active,access_control:{invite_only:!!this._inviteOnly},"frameio:artifactId":this._itemId,"repo:etag":this._etag}};t._frameioInterface.dispatchReviewLinksChangeEvent(JSON.stringify(i))}async updateReviewLink(e,t,i){const s=await t.createFile(this.name,i);if(this._itemId){const t=this.context,i=await t._frameioInterface.addVersionToAsset(this._itemId,s.id),r=t._objectPool.createUpdateSession(),n=W_.updateRemoteItem(r,i);if(r.commit(),this._itemId!==n.id){const i=await t._reviewServiceInterface.updateReviewLink(Object.assign(Object.assign({},e),{projectId:this.projectId,reviewLinkId:this.id,artifactId:n.id,etag:this._etag}));this._etag=i["repo:etag"],this._item=n,this._itemId=n.id}}else{const t=this.context,i=await t._frameioInterface.reviewLinkAddAsset(this.id,s.id),r=t._objectPool.createUpdateSession();z_.updateRemoteItem(r,i),r.commit();const n=await t._reviewServiceInterface.createReviewLink(Object.assign(Object.assign({},e),{projectId:this.projectId,reviewLinkId:this.id,artifactId:s.id}));this._etag=n["repo:etag"],this._item=s,this._itemId=s.id}this._dispatchReviewLinksChangeEvent(e)}},remoteIdProperty:"id",propertyUpdater:new Cn({_name:"name",_shortUrl:"short_url",_ownerId:"owner_id",_projectId:"project_id",_active:{name:"is_active",format:"boolean"},_inviteOnly:{name:"access_control.invite_only",format:"boolean"},_itemId:"frameio:artifactId",_etag:"repo:etag"})}),q_=new vn({localItemType:class extends H_{constructor(){super(...arguments),this._rootAssetId="",this._name="",this._ownerId="",this._teamId=""}get name(){return this._name}get ownerId(){return this._ownerId}get rootAssetId(){return this._rootAssetId}get teamId(){return this._teamId}async getTeam(){return this._team||(this._team=await this.context.getTeam(this.rootAssetId)),this._team}async getRootFolder(){return this._rootFolder||(this._rootFolder=await this.context.getAsset(this.rootAssetId)),this._rootFolder}async getReviewLinks(){let e=this._reviews;if(!e){const t=this.context,i=await t._frameioInterface.getReviewLinks(this.id),s=t._objectPool.createUpdateSession();e=z_.updateRemoteItems(s,i),s.commit(),this._reviews=e}return e}createFolder(e,t){const i=this.context,s=t;s.project_id=this.id,s.team_id=this.teamId;const r=i._objectPool.createUpdateSession(),n=K_.updateRemoteItem(r,s);return r.commit(),n._children=e[s.id].map((t=>this.createFolder(e,t))),n}async getFolderTree(){const e=await this._core.frameioContext._frameioInterface.getFolderTree(this.id);return this._rootFolder=this.createFolder(e.data,e.data.root[0]),this._rootFolder}async createReviewLink(e){const t=this.context,i=await t._frameioInterface.createReviewLink(this.id,e),s=t._objectPool.createUpdateSession(),r=z_.updateRemoteItem(s,i);return s.commit(),this._reviews&&this._reviews.push(r),r}},remoteIdProperty:"id",propertyUpdater:new Cn({_name:"name",_ownerId:"owner_id",_rootAssetId:"root_asset_id",_rootFolder:{name:"root_asset",format:"object",set:(e,t)=>{const i=t,s=i.context._objectPool.createUpdateSession(),r=K_.updateRemoteItem(s,e);s.commit(),i._rootFolder=r}},_team:{set:(e,t)=>{const i=t,s=i.context._objectPool.createUpdateSession();i._team=G_.updateRemoteItem(s,e),s.commit()},name:"team",format:"object"},_teamId:"team_id"})}),Y_=new vn({localItemType:class extends H_{constructor(){super(...arguments),this._displayName="",this._ownerId="",this._version=0}get ownerId(){return this._ownerId}get owner(){return this._owner}get displayName(){return this._displayName}get version(){return this._version}async getTeams(){let e=this._teams;if(!e){const t=this.context,i=await t._frameioInterface.getTeams(this.id),s=t._objectPool.createUpdateSession();e=G_.updateRemoteItems(s,i),s.commit(),this._teams=e}return e}async getSharedProjects(){let e=this._sharedProjects;if(!e){const t=this.context,i=await t._frameioInterface.getSharedProjects(this.id),s=t._objectPool.createUpdateSession();e=q_.updateRemoteItems(s,i),s.commit(),this._sharedProjects=e}return e}async getSharedTeams(){const e=await this.getSharedProjects(),t=new Set,i=[];for(const s of e){const e=s.teamId;if(!t.has(e)){const r=await s.getTeam();t.add(e),i.push(r)}}return i}async getProjectTree(){const e=await this.getTeams(),t=[];return e.forEach((e=>{t.push(e.getProjects())})),await Promise.all(t),e}},remoteIdProperty:"id",propertyUpdater:new Cn({_displayName:"display_name",_owner:{set:(e,t)=>{const i=t,s=i.context._objectPool.createUpdateSession();i._owner=j_.updateRemoteItem(s,e),s.commit()},name:"owner",format:"object"},_ownerId:"owner_id",_version:{name:"version",format:"number"}})});class Q_ extends Rs{constructor(e){super(),this._core=e,this._objectPool=new Xo(this._core,"frameio"),this._frameioInterface=new k_(this),this._reviewServiceInterface=new kc(this._core),this._reviewLinksForDocument=new Map}_updateCurrentUserId(e){e&&this._currentUserId===e||(this._currentUserId=e,this._currentUser=void 0,this._accounts=void 0,this._reviewLinksForDocument.clear())}_mapKeyForSourceDocument(e){return e.documentId?e.documentId:e.assetId}_retainUntilTimeout(e,t=12e4){const i=e.deref();setTimeout((function(){return i}),t)}_handleReviewLinksChangeEvent(e){const t=JSON.parse(e),i=t.reviewLink,s=this._mapKeyForSourceDocument(t.source),r=this._objectPool.createUpdateSession(),n=z_.updateRemoteItem(r,i);r.commit();const o=new WeakRef([{reviewLink:n}]);this._reviewLinksForDocument.set(s,o),this._retainUntilTimeout(o),this.dispatch(L_)}async isAuthenticated(){return await this._frameioInterface.isAuthenticated()}async authenticationStatus(){return await this._frameioInterface.authenticationStatus()}async getToken(){return this._frameioInterface.getToken()}async refreshToken(){return this._frameioInterface.refreshToken()}async authenticate(e){return await this._frameioInterface.authenticate(e)}async deauthenticate(){return await this._frameioInterface.deauthenticate()}async getCurrentUser(){let e=this._currentUser;if(!e){const t=await this._frameioInterface.getCurrentUser(),i=this._objectPool.createUpdateSession();e=j_.updateRemoteItem(i,t),i.commit(),this._currentUser=e}return e}async getAccounts(){let e=this._accounts;if(!e){const t=await this._frameioInterface.getAccounts(),i=this._objectPool.createUpdateSession();e=Y_.updateRemoteItems(i,t),i.commit(),this._accounts=e}return e}_getLocalAncestors(e){const t=new Array;for(;;){const i=this._objectPool.getLocalItemById(e);if(void 0===i)return;if(t.unshift(i),!i.parentId)break;e=i.parentId}return t}async getAncestors(e){let t=this._getLocalAncestors(e);if(!t){const i=await this._frameioInterface.getAncestors(e),s=this._objectPool.createUpdateSession();t=i.map((e=>J_(s,e))),s.commit()}return t}async getReviewLinksForDocument(e,t=!0){const i=this._mapKeyForSourceDocument(e),s=this._reviewLinksForDocument.get(i);let r=s?s.deref():void 0;if(!t&&r)return this._retainUntilTimeout(s),r;r=[];const n=await this._reviewServiceInterface.getReviewLinks(e);n.sort(((e,t)=>t["repo:createdDate"]-e["repo:createdDate"]));for(let e=0;e<n.length;e++){const t=n[e],i=t["frameio:projectId"],s=t["frameio:reviewLinkId"],o=t["frameio:artifactId"],a=t["repo:etag"];let c;try{const e=await this._frameioInterface.getReviewLink(s),t=this._objectPool.createUpdateSession();c=z_.updateRemoteItem(t,e),t.commit()}catch(e){}try{if(!c){const e=await this.getProject(i);c=(await e.getReviewLinks()).find((({id:e})=>e===s))}if(c){c._itemId=o,c._etag=a,await c.getItem(),r.push({reviewLink:c});break}{const e=We.create(Be.NOT_FOUND,`frameio:reviewLinkId = ${s} not found in projectId = ${i}`);r.push({error:e})}}catch(e){const t=e;r.push({error:t})}}const o=new WeakRef(r);return this._reviewLinksForDocument.set(i,o),this._retainUntilTimeout(o),r}async getAccount(e){let t=(await this.getAccounts()).find((t=>t.id===e));if(!t){const i=await this._frameioInterface.getAccount(e),s=this._objectPool.createUpdateSession();t=Y_.updateRemoteItem(s,i),s.commit()}return t}async getAsset(e){let t=this._objectPool.getLocalItemById(e);if(!t){const i=await this._frameioInterface.getAsset(e),s=this._objectPool.createUpdateSession();t=J_(s,i),s.commit()}return t}async getTeam(e){let t=this._objectPool.getLocalItemById(e);if(!t){const i=await this._frameioInterface.getTeam(e),s=this._objectPool.createUpdateSession();t=G_.updateRemoteItem(s,i),s.commit()}return t}async getProject(e){let t=this._objectPool.getLocalItemById(e);if(!t){const i=await this._frameioInterface.getProject(e),s=this._objectPool.createUpdateSession();t=q_.updateRemoteItem(s,i),s.commit()}return t}async getComment(e){let t=this._objectPool.getLocalItemById(e);if(!t){const i=await this._frameioInterface.getComment(e),s=this._objectPool.createUpdateSession();t=F_.updateRemoteItem(s,i),s.commit()}return t}async getAdobeSusiInfo(){return await this._frameioInterface.getAdobeSusiInfo()}}function J_(e,t){if("file"===t.type){const i=e;return V_.updateRemoteItem(i,t)}if("folder"===t.type){const i=e;return K_.updateRemoteItem(i,t)}if("version_stack"===t.type){const i=e;return W_.updateRemoteItem(i,t)}throw We.create(Be.UNSUPPORTED,`Invalid Frameio asset type ${t.type}`)}Ye([Dt],Q_.prototype,"getAsset",null);var X_,Z_,em,tm,im,sm=Object.freeze({__proto__:null,default:Q_,frameioAssetUpdater:J_});!function(e){e.USER="https://ns.adobe.com/adobeaemcloud/aem/user",e.GROUP="https://ns.adobe.com/adobeaemcloud/aem/group"}(X_||(X_={})),function(e){e.ACK="ack",e.READ="read",e.WRITE="write",e.DELETE="delete"}(Z_||(Z_={})),function(e){e.GRANT="grant",e.DENY="deny"}(em||(em={})),function(e){e.SELF="self",e.DEEP="deep",e.DEEP_OVERRIDE="deep_override"}(tm||(tm={})),function(e){e.PRINCIPAL_TYPE_IMS_USER="https://ns.adobe.com/adobecloudplatform/ims/user",e.PRINCIPAL_TYPE_IMS_GROUP="https://ns.adobe.com/adobecloudplatform/ims/group"}(im||(im={}));var rm=function(e,t){return rm=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])},rm(e,t)};function nm(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function i(){this.constructor=e}rm(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)}var om=function(){return om=Object.assign||function(e){for(var t,i=1,s=arguments.length;i<s;i++)for(var r in t=arguments[i])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},om.apply(this,arguments)};function am(e,t){var i={};for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&t.indexOf(s)<0&&(i[s]=e[s]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(s=Object.getOwnPropertySymbols(e);r<s.length;r++)t.indexOf(s[r])<0&&Object.prototype.propertyIsEnumerable.call(e,s[r])&&(i[s[r]]=e[s[r]])}return i}function cm(e,t,i,s){return new(i||(i=Promise))((function(r,n){function o(e){try{c(s.next(e))}catch(e){n(e)}}function a(e){try{c(s.throw(e))}catch(e){n(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,a)}c((s=s.apply(e,t||[])).next())}))}function lm(e,t){var i,s,r,n,o={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return n={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(n[Symbol.iterator]=function(){return this}),n;function a(n){return function(a){return function(n){if(i)throw new TypeError("Generator is already executing.");for(;o;)try{if(i=1,s&&(r=2&n[0]?s.return:n[0]?s.throw||((r=s.return)&&r.call(s),0):s.next)&&!(r=r.call(s,n[1])).done)return r;switch(s=0,r&&(n=[2&n[0],r.value]),n[0]){case 0:case 1:r=n;break;case 4:return o.label++,{value:n[1],done:!1};case 5:o.label++,s=n[1],n=[0];continue;case 7:n=o.ops.pop(),o.trys.pop();continue;default:if(!((r=(r=o.trys).length>0&&r[r.length-1])||6!==n[0]&&2!==n[0])){o=0;continue}if(3===n[0]&&(!r||n[1]>r[0]&&n[1]<r[3])){o.label=n[1];break}if(6===n[0]&&o.label<r[1]){o.label=r[1],r=n;break}if(r&&o.label<r[2]){o.label=r[2],o.ops.push(n);break}r[2]&&o.ops.pop(),o.trys.pop();continue}n=t.call(e,o)}catch(e){n=[6,e],s=0}finally{i=r=0}if(5&n[0])throw n[1];return{value:n[0]?n[1]:void 0,done:!0}}([n,a])}}}function dm(e,t,i){if(i||2===arguments.length)for(var s,r=0,n=t.length;r<n;r++)!s&&r in t||(s||(s=Array.prototype.slice.call(t,0,r)),s[r]=t[r]);return e.concat(s||Array.prototype.slice.call(t))}var um=function(e,t){return um=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])},um(e,t)},hm="Invariant Violation",pm=Object.setPrototypeOf,_m=void 0===pm?function(e,t){return e.__proto__=t,e}:pm,mm=function(e){function t(i){void 0===i&&(i=hm);var s=e.call(this,"number"==typeof i?hm+": "+i+" (see https://github.com/apollographql/invariant-packages)":i)||this;return s.framesToPop=1,s.name=hm,_m(s,t.prototype),s}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function i(){this.constructor=e}um(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)}(t,e),t}(Error);function fm(e,t){if(!e)throw new mm(t)}var gm,ym=["debug","log","warn","error","silent"],vm=ym.indexOf("log");function Om(e){return function(){if(ym.indexOf(e)>=vm)return(console[e]||console.log).apply(console,arguments)}}(gm=fm||(fm={})).debug=Om("debug"),gm.log=Om("log"),gm.warn=Om("warn"),gm.error=Om("error");var bm="3.11.8";function Im(e){try{return e()}catch(e){}}var Em=Im((function(){return globalThis}))||Im((function(){return window}))||Im((function(){return self}))||Im((function(){return global}))||Im((function(){return Im.constructor("return this")()})),Tm=new Map;function Sm(e){var t=Tm.get(e)||1;return Tm.set(e,t+1),"".concat(e,":").concat(t,":").concat(Math.random().toString(36).slice(2))}function Am(e,t){void 0===t&&(t=0);var i=Sm("stringifyForDisplay");return JSON.stringify(e,(function(e,t){return void 0===t?i:t}),t).split(JSON.stringify(i)).join("<undefined>")}function Pm(e){return function(t){for(var i=[],s=1;s<arguments.length;s++)i[s-1]=arguments[s];if("number"==typeof t){var r=t;(t=Nm(r))||(t=Dm(r,i),i=[])}e.apply(void 0,[t].concat(i))}}var wm=Object.assign((function(e,t){for(var i=[],s=2;s<arguments.length;s++)i[s-2]=arguments[s];e||fm(e,Nm(t,i)||Dm(t,i))}),{debug:Pm(fm.debug),log:Pm(fm.log),warn:Pm(fm.warn),error:Pm(fm.error)});function Cm(e){for(var t=[],i=1;i<arguments.length;i++)t[i-1]=arguments[i];return new mm(Nm(e,t)||Dm(e,t))}var Rm=Symbol.for("ApolloErrorMessageHandler_"+bm);function Lm(e){if("string"==typeof e)return e;try{return Am(e,2).slice(0,1e3)}catch(e){return"<non-serializable>"}}function Nm(e,t){if(void 0===t&&(t=[]),e)return Em[Rm]&&Em[Rm](e,t.map(Lm))}function Dm(e,t){if(void 0===t&&(t=[]),e)return"An error occurred! For more details, see the full error text at https://go.apollo.dev/c/err#".concat(encodeURIComponent(JSON.stringify({version:bm,message:e,args:t.map(Lm)})))}function Mm(e,t){if(!Boolean(e))throw new Error(t)}function xm(e,t){if(!Boolean(e))throw new Error(null!=t?t:"Unexpected invariant triggered.")}const km=/\r\n|[\n\r]/g;function Hm(e,t){let i=0,s=1;for(const r of e.body.matchAll(km)){if("number"==typeof r.index||xm(!1),r.index>=t)break;i=r.index+r[0].length,s+=1}return{line:s,column:t+1-i}}function jm(e,t){const i=e.locationOffset.column-1,s="".padStart(i)+e.body,r=t.line-1,n=e.locationOffset.line-1,o=t.line+n,a=1===t.line?i:0,c=t.column+a,l=`${e.name}:${o}:${c}\n`,d=s.split(/\r\n|[\n\r]/g),u=d[r];if(u.length>120){const e=Math.floor(c/80),t=c%80,i=[];for(let e=0;e<u.length;e+=80)i.push(u.slice(e,e+80));return l+Um([[`${o} |`,i[0]],...i.slice(1,e+1).map((e=>["|",e])),["|","^".padStart(t)],["|",i[e+1]]])}return l+Um([[o-1+" |",d[r-1]],[`${o} |`,u],["|","^".padStart(c)],[`${o+1} |`,d[r+1]]])}function Um(e){const t=e.filter((([e,t])=>void 0!==t)),i=Math.max(...t.map((([e])=>e.length)));return t.map((([e,t])=>e.padStart(i)+(t?" "+t:""))).join("\n")}class Bm extends Error{constructor(e,...t){var i,s,r;const{nodes:n,source:o,positions:a,path:c,originalError:l,extensions:d}=function(e){const t=e[0];return null==t||"kind"in t||"length"in t?{nodes:t,source:e[1],positions:e[2],path:e[3],originalError:e[4],extensions:e[5]}:t}(t);super(e),this.name="GraphQLError",this.path=null!=c?c:void 0,this.originalError=null!=l?l:void 0,this.nodes=Fm(Array.isArray(n)?n:n?[n]:void 0);const u=Fm(null===(i=this.nodes)||void 0===i?void 0:i.map((e=>e.loc)).filter((e=>null!=e)));this.source=null!=o?o:null==u||null===(s=u[0])||void 0===s?void 0:s.source,this.positions=null!=a?a:null==u?void 0:u.map((e=>e.start)),this.locations=a&&o?a.map((e=>Hm(o,e))):null==u?void 0:u.map((e=>Hm(e.source,e.start)));const h="object"==typeof(p=null==l?void 0:l.extensions)&&null!==p?null==l?void 0:l.extensions:void 0;var p;this.extensions=null!==(r=null!=d?d:h)&&void 0!==r?r:Object.create(null),Object.defineProperties(this,{message:{writable:!0,enumerable:!0},name:{enumerable:!1},nodes:{enumerable:!1},source:{enumerable:!1},positions:{enumerable:!1},originalError:{enumerable:!1}}),null!=l&&l.stack?Object.defineProperty(this,"stack",{value:l.stack,writable:!0,configurable:!0}):Error.captureStackTrace?Error.captureStackTrace(this,Bm):Object.defineProperty(this,"stack",{value:Error().stack,writable:!0,configurable:!0})}get[Symbol.toStringTag](){return"GraphQLError"}toString(){let e=this.message;if(this.nodes)for(const i of this.nodes)i.loc&&(e+="\n\n"+jm((t=i.loc).source,Hm(t.source,t.start)));else if(this.source&&this.locations)for(const t of this.locations)e+="\n\n"+jm(this.source,t);var t;return e}toJSON(){const e={message:this.message};return null!=this.locations&&(e.locations=this.locations),null!=this.path&&(e.path=this.path),null!=this.extensions&&Object.keys(this.extensions).length>0&&(e.extensions=this.extensions),e}}function Fm(e){return void 0===e||0===e.length?void 0:e}function Vm(e,t,i){return new Bm(`Syntax Error: ${i}`,{source:e,positions:[t]})}class Km{constructor(e,t,i){this.start=e.start,this.end=t.end,this.startToken=e,this.endToken=t,this.source=i}get[Symbol.toStringTag](){return"Location"}toJSON(){return{start:this.start,end:this.end}}}class Gm{constructor(e,t,i,s,r,n){this.kind=e,this.start=t,this.end=i,this.line=s,this.column=r,this.value=n,this.prev=null,this.next=null}get[Symbol.toStringTag](){return"Token"}toJSON(){return{kind:this.kind,value:this.value,line:this.line,column:this.column}}}const $m={Name:[],Document:["definitions"],OperationDefinition:["name","variableDefinitions","directives","selectionSet"],VariableDefinition:["variable","type","defaultValue","directives"],Variable:["name"],SelectionSet:["selections"],Field:["alias","name","arguments","directives","selectionSet"],Argument:["name","value"],FragmentSpread:["name","directives"],InlineFragment:["typeCondition","directives","selectionSet"],FragmentDefinition:["name","variableDefinitions","typeCondition","directives","selectionSet"],IntValue:[],FloatValue:[],StringValue:[],BooleanValue:[],NullValue:[],EnumValue:[],ListValue:["values"],ObjectValue:["fields"],ObjectField:["name","value"],Directive:["name","arguments"],NamedType:["name"],ListType:["type"],NonNullType:["type"],SchemaDefinition:["description","directives","operationTypes"],OperationTypeDefinition:["type"],ScalarTypeDefinition:["description","name","directives"],ObjectTypeDefinition:["description","name","interfaces","directives","fields"],FieldDefinition:["description","name","arguments","type","directives"],InputValueDefinition:["description","name","type","defaultValue","directives"],InterfaceTypeDefinition:["description","name","interfaces","directives","fields"],UnionTypeDefinition:["description","name","directives","types"],EnumTypeDefinition:["description","name","directives","values"],EnumValueDefinition:["description","name","directives"],InputObjectTypeDefinition:["description","name","directives","fields"],DirectiveDefinition:["description","name","arguments","locations"],SchemaExtension:["directives","operationTypes"],ScalarTypeExtension:["name","directives"],ObjectTypeExtension:["name","interfaces","directives","fields"],InterfaceTypeExtension:["name","interfaces","directives","fields"],UnionTypeExtension:["name","directives","types"],EnumTypeExtension:["name","directives","values"],InputObjectTypeExtension:["name","directives","fields"]},Wm=new Set(Object.keys($m));function zm(e){const t=null==e?void 0:e.kind;return"string"==typeof t&&Wm.has(t)}var qm,Ym,Qm,Jm;function Xm(e){return 9===e||32===e}function Zm(e){return e>=48&&e<=57}function ef(e){return e>=97&&e<=122||e>=65&&e<=90}function tf(e){return ef(e)||95===e}function sf(e){var t;let i=Number.MAX_SAFE_INTEGER,s=null,r=-1;for(let t=0;t<e.length;++t){var n;const o=e[t],a=rf(o);a!==o.length&&(s=null!==(n=s)&&void 0!==n?n:t,r=t,0!==t&&a<i&&(i=a))}return e.map(((e,t)=>0===t?e:e.slice(i))).slice(null!==(t=s)&&void 0!==t?t:0,r+1)}function rf(e){let t=0;for(;t<e.length&&Xm(e.charCodeAt(t));)++t;return t}!function(e){e.QUERY="query",e.MUTATION="mutation",e.SUBSCRIPTION="subscription"}(qm||(qm={})),function(e){e.QUERY="QUERY",e.MUTATION="MUTATION",e.SUBSCRIPTION="SUBSCRIPTION",e.FIELD="FIELD",e.FRAGMENT_DEFINITION="FRAGMENT_DEFINITION",e.FRAGMENT_SPREAD="FRAGMENT_SPREAD",e.INLINE_FRAGMENT="INLINE_FRAGMENT",e.VARIABLE_DEFINITION="VARIABLE_DEFINITION",e.SCHEMA="SCHEMA",e.SCALAR="SCALAR",e.OBJECT="OBJECT",e.FIELD_DEFINITION="FIELD_DEFINITION",e.ARGUMENT_DEFINITION="ARGUMENT_DEFINITION",e.INTERFACE="INTERFACE",e.UNION="UNION",e.ENUM="ENUM",e.ENUM_VALUE="ENUM_VALUE",e.INPUT_OBJECT="INPUT_OBJECT",e.INPUT_FIELD_DEFINITION="INPUT_FIELD_DEFINITION"}(Ym||(Ym={})),function(e){e.NAME="Name",e.DOCUMENT="Document",e.OPERATION_DEFINITION="OperationDefinition",e.VARIABLE_DEFINITION="VariableDefinition",e.SELECTION_SET="SelectionSet",e.FIELD="Field",e.ARGUMENT="Argument",e.FRAGMENT_SPREAD="FragmentSpread",e.INLINE_FRAGMENT="InlineFragment",e.FRAGMENT_DEFINITION="FragmentDefinition",e.VARIABLE="Variable",e.INT="IntValue",e.FLOAT="FloatValue",e.STRING="StringValue",e.BOOLEAN="BooleanValue",e.NULL="NullValue",e.ENUM="EnumValue",e.LIST="ListValue",e.OBJECT="ObjectValue",e.OBJECT_FIELD="ObjectField",e.DIRECTIVE="Directive",e.NAMED_TYPE="NamedType",e.LIST_TYPE="ListType",e.NON_NULL_TYPE="NonNullType",e.SCHEMA_DEFINITION="SchemaDefinition",e.OPERATION_TYPE_DEFINITION="OperationTypeDefinition",e.SCALAR_TYPE_DEFINITION="ScalarTypeDefinition",e.OBJECT_TYPE_DEFINITION="ObjectTypeDefinition",e.FIELD_DEFINITION="FieldDefinition",e.INPUT_VALUE_DEFINITION="InputValueDefinition",e.INTERFACE_TYPE_DEFINITION="InterfaceTypeDefinition",e.UNION_TYPE_DEFINITION="UnionTypeDefinition",e.ENUM_TYPE_DEFINITION="EnumTypeDefinition",e.ENUM_VALUE_DEFINITION="EnumValueDefinition",e.INPUT_OBJECT_TYPE_DEFINITION="InputObjectTypeDefinition",e.DIRECTIVE_DEFINITION="DirectiveDefinition",e.SCHEMA_EXTENSION="SchemaExtension",e.SCALAR_TYPE_EXTENSION="ScalarTypeExtension",e.OBJECT_TYPE_EXTENSION="ObjectTypeExtension",e.INTERFACE_TYPE_EXTENSION="InterfaceTypeExtension",e.UNION_TYPE_EXTENSION="UnionTypeExtension",e.ENUM_TYPE_EXTENSION="EnumTypeExtension",e.INPUT_OBJECT_TYPE_EXTENSION="InputObjectTypeExtension"}(Qm||(Qm={})),function(e){e.SOF="<SOF>",e.EOF="<EOF>",e.BANG="!",e.DOLLAR="$",e.AMP="&",e.PAREN_L="(",e.PAREN_R=")",e.SPREAD="...",e.COLON=":",e.EQUALS="=",e.AT="@",e.BRACKET_L="[",e.BRACKET_R="]",e.BRACE_L="{",e.PIPE="|",e.BRACE_R="}",e.NAME="Name",e.INT="Int",e.FLOAT="Float",e.STRING="String",e.BLOCK_STRING="BlockString",e.COMMENT="Comment"}(Jm||(Jm={}));class nf{constructor(e){const t=new Gm(Jm.SOF,0,0,0,0);this.source=e,this.lastToken=t,this.token=t,this.line=1,this.lineStart=0}get[Symbol.toStringTag](){return"Lexer"}advance(){return this.lastToken=this.token,this.token=this.lookahead()}lookahead(){let e=this.token;if(e.kind!==Jm.EOF)do{if(e.next)e=e.next;else{const t=hf(this,e.end);e.next=t,t.prev=e,e=t}}while(e.kind===Jm.COMMENT);return e}}function of(e){return e>=0&&e<=55295||e>=57344&&e<=1114111}function af(e,t){return cf(e.charCodeAt(t))&&lf(e.charCodeAt(t+1))}function cf(e){return e>=55296&&e<=56319}function lf(e){return e>=56320&&e<=57343}function df(e,t){const i=e.source.body.codePointAt(t);if(void 0===i)return Jm.EOF;if(i>=32&&i<=126){const e=String.fromCodePoint(i);return'"'===e?"'\"'":`"${e}"`}return"U+"+i.toString(16).toUpperCase().padStart(4,"0")}function uf(e,t,i,s,r){const n=e.line,o=1+i-e.lineStart;return new Gm(t,i,s,n,o,r)}function hf(e,t){const i=e.source.body,s=i.length;let r=t;for(;r<s;){const t=i.charCodeAt(r);switch(t){case 65279:case 9:case 32:case 44:++r;continue;case 10:++r,++e.line,e.lineStart=r;continue;case 13:10===i.charCodeAt(r+1)?r+=2:++r,++e.line,e.lineStart=r;continue;case 35:return pf(e,r);case 33:return uf(e,Jm.BANG,r,r+1);case 36:return uf(e,Jm.DOLLAR,r,r+1);case 38:return uf(e,Jm.AMP,r,r+1);case 40:return uf(e,Jm.PAREN_L,r,r+1);case 41:return uf(e,Jm.PAREN_R,r,r+1);case 46:if(46===i.charCodeAt(r+1)&&46===i.charCodeAt(r+2))return uf(e,Jm.SPREAD,r,r+3);break;case 58:return uf(e,Jm.COLON,r,r+1);case 61:return uf(e,Jm.EQUALS,r,r+1);case 64:return uf(e,Jm.AT,r,r+1);case 91:return uf(e,Jm.BRACKET_L,r,r+1);case 93:return uf(e,Jm.BRACKET_R,r,r+1);case 123:return uf(e,Jm.BRACE_L,r,r+1);case 124:return uf(e,Jm.PIPE,r,r+1);case 125:return uf(e,Jm.BRACE_R,r,r+1);case 34:return 34===i.charCodeAt(r+1)&&34===i.charCodeAt(r+2)?If(e,r):ff(e,r)}if(Zm(t)||45===t)return _f(e,r,t);if(tf(t))return Ef(e,r);throw Vm(e.source,r,39===t?"Unexpected single quote character ('), did you mean to use a double quote (\")?":of(t)||af(i,r)?`Unexpected character: ${df(e,r)}.`:`Invalid character: ${df(e,r)}.`)}return uf(e,Jm.EOF,s,s)}function pf(e,t){const i=e.source.body,s=i.length;let r=t+1;for(;r<s;){const e=i.charCodeAt(r);if(10===e||13===e)break;if(of(e))++r;else{if(!af(i,r))break;r+=2}}return uf(e,Jm.COMMENT,t,r,i.slice(t+1,r))}function _f(e,t,i){const s=e.source.body;let r=t,n=i,o=!1;if(45===n&&(n=s.charCodeAt(++r)),48===n){if(n=s.charCodeAt(++r),Zm(n))throw Vm(e.source,r,`Invalid number, unexpected digit after 0: ${df(e,r)}.`)}else r=mf(e,r,n),n=s.charCodeAt(r);if(46===n&&(o=!0,n=s.charCodeAt(++r),r=mf(e,r,n),n=s.charCodeAt(r)),69!==n&&101!==n||(o=!0,n=s.charCodeAt(++r),43!==n&&45!==n||(n=s.charCodeAt(++r)),r=mf(e,r,n),n=s.charCodeAt(r)),46===n||tf(n))throw Vm(e.source,r,`Invalid number, expected digit but got: ${df(e,r)}.`);return uf(e,o?Jm.FLOAT:Jm.INT,t,r,s.slice(t,r))}function mf(e,t,i){if(!Zm(i))throw Vm(e.source,t,`Invalid number, expected digit but got: ${df(e,t)}.`);const s=e.source.body;let r=t+1;for(;Zm(s.charCodeAt(r));)++r;return r}function ff(e,t){const i=e.source.body,s=i.length;let r=t+1,n=r,o="";for(;r<s;){const s=i.charCodeAt(r);if(34===s)return o+=i.slice(n,r),uf(e,Jm.STRING,t,r+1,o);if(92!==s){if(10===s||13===s)break;if(of(s))++r;else{if(!af(i,r))throw Vm(e.source,r,`Invalid character within String: ${df(e,r)}.`);r+=2}}else{o+=i.slice(n,r);const t=117===i.charCodeAt(r+1)?123===i.charCodeAt(r+2)?gf(e,r):yf(e,r):bf(e,r);o+=t.value,r+=t.size,n=r}}throw Vm(e.source,r,"Unterminated string.")}function gf(e,t){const i=e.source.body;let s=0,r=3;for(;r<12;){const e=i.charCodeAt(t+r++);if(125===e){if(r<5||!of(s))break;return{value:String.fromCodePoint(s),size:r}}if(s=s<<4|Of(e),s<0)break}throw Vm(e.source,t,`Invalid Unicode escape sequence: "${i.slice(t,t+r)}".`)}function yf(e,t){const i=e.source.body,s=vf(i,t+2);if(of(s))return{value:String.fromCodePoint(s),size:6};if(cf(s)&&92===i.charCodeAt(t+6)&&117===i.charCodeAt(t+7)){const e=vf(i,t+8);if(lf(e))return{value:String.fromCodePoint(s,e),size:12}}throw Vm(e.source,t,`Invalid Unicode escape sequence: "${i.slice(t,t+6)}".`)}function vf(e,t){return Of(e.charCodeAt(t))<<12|Of(e.charCodeAt(t+1))<<8|Of(e.charCodeAt(t+2))<<4|Of(e.charCodeAt(t+3))}function Of(e){return e>=48&&e<=57?e-48:e>=65&&e<=70?e-55:e>=97&&e<=102?e-87:-1}function bf(e,t){const i=e.source.body;switch(i.charCodeAt(t+1)){case 34:return{value:'"',size:2};case 92:return{value:"\\",size:2};case 47:return{value:"/",size:2};case 98:return{value:"\b",size:2};case 102:return{value:"\f",size:2};case 110:return{value:"\n",size:2};case 114:return{value:"\r",size:2};case 116:return{value:"\t",size:2}}throw Vm(e.source,t,`Invalid character escape sequence: "${i.slice(t,t+2)}".`)}function If(e,t){const i=e.source.body,s=i.length;let r=e.lineStart,n=t+3,o=n,a="";const c=[];for(;n<s;){const s=i.charCodeAt(n);if(34===s&&34===i.charCodeAt(n+1)&&34===i.charCodeAt(n+2)){a+=i.slice(o,n),c.push(a);const s=uf(e,Jm.BLOCK_STRING,t,n+3,sf(c).join("\n"));return e.line+=c.length-1,e.lineStart=r,s}if(92!==s||34!==i.charCodeAt(n+1)||34!==i.charCodeAt(n+2)||34!==i.charCodeAt(n+3))if(10!==s&&13!==s)if(of(s))++n;else{if(!af(i,n))throw Vm(e.source,n,`Invalid character within String: ${df(e,n)}.`);n+=2}else a+=i.slice(o,n),c.push(a),13===s&&10===i.charCodeAt(n+1)?n+=2:++n,a="",o=n,r=n;else a+=i.slice(o,n),o=n+1,n+=4}throw Vm(e.source,n,"Unterminated string.")}function Ef(e,t){const i=e.source.body,s=i.length;let r=t+1;for(;r<s&&(ef(n=i.charCodeAt(r))||Zm(n)||95===n);)++r;var n;return uf(e,Jm.NAME,t,r,i.slice(t,r))}const Tf=10,Sf=2;function Af(e){return Pf(e,[])}function Pf(e,t){switch(typeof e){case"string":return JSON.stringify(e);case"function":return e.name?`[function ${e.name}]`:"[function]";case"object":return function(e,t){if(null===e)return"null";if(t.includes(e))return"[Circular]";const i=[...t,e];if(function(e){return"function"==typeof e.toJSON}(e)){const t=e.toJSON();if(t!==e)return"string"==typeof t?t:Pf(t,i)}else if(Array.isArray(e))return function(e,t){if(0===e.length)return"[]";if(t.length>Sf)return"[Array]";const i=Math.min(Tf,e.length),s=e.length-i,r=[];for(let s=0;s<i;++s)r.push(Pf(e[s],t));return 1===s?r.push("... 1 more item"):s>1&&r.push(`... ${s} more items`),"["+r.join(", ")+"]"}(e,i);return function(e,t){const i=Object.entries(e);if(0===i.length)return"{}";if(t.length>Sf)return"["+function(e){const t=Object.prototype.toString.call(e).replace(/^\[object /,"").replace(/]$/,"");if("Object"===t&&"function"==typeof e.constructor){const t=e.constructor.name;if("string"==typeof t&&""!==t)return t}return t}(e)+"]";const s=i.map((([e,i])=>e+": "+Pf(i,t)));return"{ "+s.join(", ")+" }"}(e,i)}(e,t);default:return String(e)}}const wf=globalThis.process?function(e,t){return e instanceof t}:function(e,t){if(e instanceof t)return!0;if("object"==typeof e&&null!==e){var i;const s=t.prototype[Symbol.toStringTag];if(s===(Symbol.toStringTag in e?e[Symbol.toStringTag]:null===(i=e.constructor)||void 0===i?void 0:i.name)){const t=Af(e);throw new Error(`Cannot use ${s} "${t}" from another module or realm.\n\nEnsure that there is only one instance of "graphql" in the node_modules\ndirectory. If different versions of "graphql" are the dependencies of other\nrelied on modules, use "resolutions" to ensure only one version is installed.\n\nhttps://yarnpkg.com/en/docs/selective-version-resolutions\n\nDuplicate "graphql" modules cannot be used at the same time since different\nversions may have different capabilities and behavior. The data from one\nversion used in the function from another could produce confusing and\nspurious results.`)}}return!1};class Cf{constructor(e,t="GraphQL request",i={line:1,column:1}){"string"==typeof e||Mm(!1,`Body must be a string. Received: ${Af(e)}.`),this.body=e,this.name=t,this.locationOffset=i,this.locationOffset.line>0||Mm(!1,"line in locationOffset is 1-indexed and must be positive."),this.locationOffset.column>0||Mm(!1,"column in locationOffset is 1-indexed and must be positive.")}get[Symbol.toStringTag](){return"Source"}}class Rf{constructor(e,t={}){const i=function(e){return wf(e,Cf)}(e)?e:new Cf(e);this._lexer=new nf(i),this._options=t,this._tokenCounter=0}parseName(){const e=this.expectToken(Jm.NAME);return this.node(e,{kind:Qm.NAME,value:e.value})}parseDocument(){return this.node(this._lexer.token,{kind:Qm.DOCUMENT,definitions:this.many(Jm.SOF,this.parseDefinition,Jm.EOF)})}parseDefinition(){if(this.peek(Jm.BRACE_L))return this.parseOperationDefinition();const e=this.peekDescription(),t=e?this._lexer.lookahead():this._lexer.token;if(t.kind===Jm.NAME){switch(t.value){case"schema":return this.parseSchemaDefinition();case"scalar":return this.parseScalarTypeDefinition();case"type":return this.parseObjectTypeDefinition();case"interface":return this.parseInterfaceTypeDefinition();case"union":return this.parseUnionTypeDefinition();case"enum":return this.parseEnumTypeDefinition();case"input":return this.parseInputObjectTypeDefinition();case"directive":return this.parseDirectiveDefinition()}if(e)throw Vm(this._lexer.source,this._lexer.token.start,"Unexpected description, descriptions are supported only on type definitions.");switch(t.value){case"query":case"mutation":case"subscription":return this.parseOperationDefinition();case"fragment":return this.parseFragmentDefinition();case"extend":return this.parseTypeSystemExtension()}}throw this.unexpected(t)}parseOperationDefinition(){const e=this._lexer.token;if(this.peek(Jm.BRACE_L))return this.node(e,{kind:Qm.OPERATION_DEFINITION,operation:qm.QUERY,name:void 0,variableDefinitions:[],directives:[],selectionSet:this.parseSelectionSet()});const t=this.parseOperationType();let i;return this.peek(Jm.NAME)&&(i=this.parseName()),this.node(e,{kind:Qm.OPERATION_DEFINITION,operation:t,name:i,variableDefinitions:this.parseVariableDefinitions(),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()})}parseOperationType(){const e=this.expectToken(Jm.NAME);switch(e.value){case"query":return qm.QUERY;case"mutation":return qm.MUTATION;case"subscription":return qm.SUBSCRIPTION}throw this.unexpected(e)}parseVariableDefinitions(){return this.optionalMany(Jm.PAREN_L,this.parseVariableDefinition,Jm.PAREN_R)}parseVariableDefinition(){return this.node(this._lexer.token,{kind:Qm.VARIABLE_DEFINITION,variable:this.parseVariable(),type:(this.expectToken(Jm.COLON),this.parseTypeReference()),defaultValue:this.expectOptionalToken(Jm.EQUALS)?this.parseConstValueLiteral():void 0,directives:this.parseConstDirectives()})}parseVariable(){const e=this._lexer.token;return this.expectToken(Jm.DOLLAR),this.node(e,{kind:Qm.VARIABLE,name:this.parseName()})}parseSelectionSet(){return this.node(this._lexer.token,{kind:Qm.SELECTION_SET,selections:this.many(Jm.BRACE_L,this.parseSelection,Jm.BRACE_R)})}parseSelection(){return this.peek(Jm.SPREAD)?this.parseFragment():this.parseField()}parseField(){const e=this._lexer.token,t=this.parseName();let i,s;return this.expectOptionalToken(Jm.COLON)?(i=t,s=this.parseName()):s=t,this.node(e,{kind:Qm.FIELD,alias:i,name:s,arguments:this.parseArguments(!1),directives:this.parseDirectives(!1),selectionSet:this.peek(Jm.BRACE_L)?this.parseSelectionSet():void 0})}parseArguments(e){const t=e?this.parseConstArgument:this.parseArgument;return this.optionalMany(Jm.PAREN_L,t,Jm.PAREN_R)}parseArgument(e=!1){const t=this._lexer.token,i=this.parseName();return this.expectToken(Jm.COLON),this.node(t,{kind:Qm.ARGUMENT,name:i,value:this.parseValueLiteral(e)})}parseConstArgument(){return this.parseArgument(!0)}parseFragment(){const e=this._lexer.token;this.expectToken(Jm.SPREAD);const t=this.expectOptionalKeyword("on");return!t&&this.peek(Jm.NAME)?this.node(e,{kind:Qm.FRAGMENT_SPREAD,name:this.parseFragmentName(),directives:this.parseDirectives(!1)}):this.node(e,{kind:Qm.INLINE_FRAGMENT,typeCondition:t?this.parseNamedType():void 0,directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()})}parseFragmentDefinition(){const e=this._lexer.token;return this.expectKeyword("fragment"),!0===this._options.allowLegacyFragmentVariables?this.node(e,{kind:Qm.FRAGMENT_DEFINITION,name:this.parseFragmentName(),variableDefinitions:this.parseVariableDefinitions(),typeCondition:(this.expectKeyword("on"),this.parseNamedType()),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()}):this.node(e,{kind:Qm.FRAGMENT_DEFINITION,name:this.parseFragmentName(),typeCondition:(this.expectKeyword("on"),this.parseNamedType()),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()})}parseFragmentName(){if("on"===this._lexer.token.value)throw this.unexpected();return this.parseName()}parseValueLiteral(e){const t=this._lexer.token;switch(t.kind){case Jm.BRACKET_L:return this.parseList(e);case Jm.BRACE_L:return this.parseObject(e);case Jm.INT:return this.advanceLexer(),this.node(t,{kind:Qm.INT,value:t.value});case Jm.FLOAT:return this.advanceLexer(),this.node(t,{kind:Qm.FLOAT,value:t.value});case Jm.STRING:case Jm.BLOCK_STRING:return this.parseStringLiteral();case Jm.NAME:switch(this.advanceLexer(),t.value){case"true":return this.node(t,{kind:Qm.BOOLEAN,value:!0});case"false":return this.node(t,{kind:Qm.BOOLEAN,value:!1});case"null":return this.node(t,{kind:Qm.NULL});default:return this.node(t,{kind:Qm.ENUM,value:t.value})}case Jm.DOLLAR:if(e){if(this.expectToken(Jm.DOLLAR),this._lexer.token.kind===Jm.NAME){const e=this._lexer.token.value;throw Vm(this._lexer.source,t.start,`Unexpected variable "$${e}" in constant value.`)}throw this.unexpected(t)}return this.parseVariable();default:throw this.unexpected()}}parseConstValueLiteral(){return this.parseValueLiteral(!0)}parseStringLiteral(){const e=this._lexer.token;return this.advanceLexer(),this.node(e,{kind:Qm.STRING,value:e.value,block:e.kind===Jm.BLOCK_STRING})}parseList(e){return this.node(this._lexer.token,{kind:Qm.LIST,values:this.any(Jm.BRACKET_L,(()=>this.parseValueLiteral(e)),Jm.BRACKET_R)})}parseObject(e){return this.node(this._lexer.token,{kind:Qm.OBJECT,fields:this.any(Jm.BRACE_L,(()=>this.parseObjectField(e)),Jm.BRACE_R)})}parseObjectField(e){const t=this._lexer.token,i=this.parseName();return this.expectToken(Jm.COLON),this.node(t,{kind:Qm.OBJECT_FIELD,name:i,value:this.parseValueLiteral(e)})}parseDirectives(e){const t=[];for(;this.peek(Jm.AT);)t.push(this.parseDirective(e));return t}parseConstDirectives(){return this.parseDirectives(!0)}parseDirective(e){const t=this._lexer.token;return this.expectToken(Jm.AT),this.node(t,{kind:Qm.DIRECTIVE,name:this.parseName(),arguments:this.parseArguments(e)})}parseTypeReference(){const e=this._lexer.token;let t;if(this.expectOptionalToken(Jm.BRACKET_L)){const i=this.parseTypeReference();this.expectToken(Jm.BRACKET_R),t=this.node(e,{kind:Qm.LIST_TYPE,type:i})}else t=this.parseNamedType();return this.expectOptionalToken(Jm.BANG)?this.node(e,{kind:Qm.NON_NULL_TYPE,type:t}):t}parseNamedType(){return this.node(this._lexer.token,{kind:Qm.NAMED_TYPE,name:this.parseName()})}peekDescription(){return this.peek(Jm.STRING)||this.peek(Jm.BLOCK_STRING)}parseDescription(){if(this.peekDescription())return this.parseStringLiteral()}parseSchemaDefinition(){const e=this._lexer.token,t=this.parseDescription();this.expectKeyword("schema");const i=this.parseConstDirectives(),s=this.many(Jm.BRACE_L,this.parseOperationTypeDefinition,Jm.BRACE_R);return this.node(e,{kind:Qm.SCHEMA_DEFINITION,description:t,directives:i,operationTypes:s})}parseOperationTypeDefinition(){const e=this._lexer.token,t=this.parseOperationType();this.expectToken(Jm.COLON);const i=this.parseNamedType();return this.node(e,{kind:Qm.OPERATION_TYPE_DEFINITION,operation:t,type:i})}parseScalarTypeDefinition(){const e=this._lexer.token,t=this.parseDescription();this.expectKeyword("scalar");const i=this.parseName(),s=this.parseConstDirectives();return this.node(e,{kind:Qm.SCALAR_TYPE_DEFINITION,description:t,name:i,directives:s})}parseObjectTypeDefinition(){const e=this._lexer.token,t=this.parseDescription();this.expectKeyword("type");const i=this.parseName(),s=this.parseImplementsInterfaces(),r=this.parseConstDirectives(),n=this.parseFieldsDefinition();return this.node(e,{kind:Qm.OBJECT_TYPE_DEFINITION,description:t,name:i,interfaces:s,directives:r,fields:n})}parseImplementsInterfaces(){return this.expectOptionalKeyword("implements")?this.delimitedMany(Jm.AMP,this.parseNamedType):[]}parseFieldsDefinition(){return this.optionalMany(Jm.BRACE_L,this.parseFieldDefinition,Jm.BRACE_R)}parseFieldDefinition(){const e=this._lexer.token,t=this.parseDescription(),i=this.parseName(),s=this.parseArgumentDefs();this.expectToken(Jm.COLON);const r=this.parseTypeReference(),n=this.parseConstDirectives();return this.node(e,{kind:Qm.FIELD_DEFINITION,description:t,name:i,arguments:s,type:r,directives:n})}parseArgumentDefs(){return this.optionalMany(Jm.PAREN_L,this.parseInputValueDef,Jm.PAREN_R)}parseInputValueDef(){const e=this._lexer.token,t=this.parseDescription(),i=this.parseName();this.expectToken(Jm.COLON);const s=this.parseTypeReference();let r;this.expectOptionalToken(Jm.EQUALS)&&(r=this.parseConstValueLiteral());const n=this.parseConstDirectives();return this.node(e,{kind:Qm.INPUT_VALUE_DEFINITION,description:t,name:i,type:s,defaultValue:r,directives:n})}parseInterfaceTypeDefinition(){const e=this._lexer.token,t=this.parseDescription();this.expectKeyword("interface");const i=this.parseName(),s=this.parseImplementsInterfaces(),r=this.parseConstDirectives(),n=this.parseFieldsDefinition();return this.node(e,{kind:Qm.INTERFACE_TYPE_DEFINITION,description:t,name:i,interfaces:s,directives:r,fields:n})}parseUnionTypeDefinition(){const e=this._lexer.token,t=this.parseDescription();this.expectKeyword("union");const i=this.parseName(),s=this.parseConstDirectives(),r=this.parseUnionMemberTypes();return this.node(e,{kind:Qm.UNION_TYPE_DEFINITION,description:t,name:i,directives:s,types:r})}parseUnionMemberTypes(){return this.expectOptionalToken(Jm.EQUALS)?this.delimitedMany(Jm.PIPE,this.parseNamedType):[]}parseEnumTypeDefinition(){const e=this._lexer.token,t=this.parseDescription();this.expectKeyword("enum");const i=this.parseName(),s=this.parseConstDirectives(),r=this.parseEnumValuesDefinition();return this.node(e,{kind:Qm.ENUM_TYPE_DEFINITION,description:t,name:i,directives:s,values:r})}parseEnumValuesDefinition(){return this.optionalMany(Jm.BRACE_L,this.parseEnumValueDefinition,Jm.BRACE_R)}parseEnumValueDefinition(){const e=this._lexer.token,t=this.parseDescription(),i=this.parseEnumValueName(),s=this.parseConstDirectives();return this.node(e,{kind:Qm.ENUM_VALUE_DEFINITION,description:t,name:i,directives:s})}parseEnumValueName(){if("true"===this._lexer.token.value||"false"===this._lexer.token.value||"null"===this._lexer.token.value)throw Vm(this._lexer.source,this._lexer.token.start,`${Lf(this._lexer.token)} is reserved and cannot be used for an enum value.`);return this.parseName()}parseInputObjectTypeDefinition(){const e=this._lexer.token,t=this.parseDescription();this.expectKeyword("input");const i=this.parseName(),s=this.parseConstDirectives(),r=this.parseInputFieldsDefinition();return this.node(e,{kind:Qm.INPUT_OBJECT_TYPE_DEFINITION,description:t,name:i,directives:s,fields:r})}parseInputFieldsDefinition(){return this.optionalMany(Jm.BRACE_L,this.parseInputValueDef,Jm.BRACE_R)}parseTypeSystemExtension(){const e=this._lexer.lookahead();if(e.kind===Jm.NAME)switch(e.value){case"schema":return this.parseSchemaExtension();case"scalar":return this.parseScalarTypeExtension();case"type":return this.parseObjectTypeExtension();case"interface":return this.parseInterfaceTypeExtension();case"union":return this.parseUnionTypeExtension();case"enum":return this.parseEnumTypeExtension();case"input":return this.parseInputObjectTypeExtension()}throw this.unexpected(e)}parseSchemaExtension(){const e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("schema");const t=this.parseConstDirectives(),i=this.optionalMany(Jm.BRACE_L,this.parseOperationTypeDefinition,Jm.BRACE_R);if(0===t.length&&0===i.length)throw this.unexpected();return this.node(e,{kind:Qm.SCHEMA_EXTENSION,directives:t,operationTypes:i})}parseScalarTypeExtension(){const e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("scalar");const t=this.parseName(),i=this.parseConstDirectives();if(0===i.length)throw this.unexpected();return this.node(e,{kind:Qm.SCALAR_TYPE_EXTENSION,name:t,directives:i})}parseObjectTypeExtension(){const e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("type");const t=this.parseName(),i=this.parseImplementsInterfaces(),s=this.parseConstDirectives(),r=this.parseFieldsDefinition();if(0===i.length&&0===s.length&&0===r.length)throw this.unexpected();return this.node(e,{kind:Qm.OBJECT_TYPE_EXTENSION,name:t,interfaces:i,directives:s,fields:r})}parseInterfaceTypeExtension(){const e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("interface");const t=this.parseName(),i=this.parseImplementsInterfaces(),s=this.parseConstDirectives(),r=this.parseFieldsDefinition();if(0===i.length&&0===s.length&&0===r.length)throw this.unexpected();return this.node(e,{kind:Qm.INTERFACE_TYPE_EXTENSION,name:t,interfaces:i,directives:s,fields:r})}parseUnionTypeExtension(){const e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("union");const t=this.parseName(),i=this.parseConstDirectives(),s=this.parseUnionMemberTypes();if(0===i.length&&0===s.length)throw this.unexpected();return this.node(e,{kind:Qm.UNION_TYPE_EXTENSION,name:t,directives:i,types:s})}parseEnumTypeExtension(){const e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("enum");const t=this.parseName(),i=this.parseConstDirectives(),s=this.parseEnumValuesDefinition();if(0===i.length&&0===s.length)throw this.unexpected();return this.node(e,{kind:Qm.ENUM_TYPE_EXTENSION,name:t,directives:i,values:s})}parseInputObjectTypeExtension(){const e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("input");const t=this.parseName(),i=this.parseConstDirectives(),s=this.parseInputFieldsDefinition();if(0===i.length&&0===s.length)throw this.unexpected();return this.node(e,{kind:Qm.INPUT_OBJECT_TYPE_EXTENSION,name:t,directives:i,fields:s})}parseDirectiveDefinition(){const e=this._lexer.token,t=this.parseDescription();this.expectKeyword("directive"),this.expectToken(Jm.AT);const i=this.parseName(),s=this.parseArgumentDefs(),r=this.expectOptionalKeyword("repeatable");this.expectKeyword("on");const n=this.parseDirectiveLocations();return this.node(e,{kind:Qm.DIRECTIVE_DEFINITION,description:t,name:i,arguments:s,repeatable:r,locations:n})}parseDirectiveLocations(){return this.delimitedMany(Jm.PIPE,this.parseDirectiveLocation)}parseDirectiveLocation(){const e=this._lexer.token,t=this.parseName();if(Object.prototype.hasOwnProperty.call(Ym,t.value))return t;throw this.unexpected(e)}node(e,t){return!0!==this._options.noLocation&&(t.loc=new Km(e,this._lexer.lastToken,this._lexer.source)),t}peek(e){return this._lexer.token.kind===e}expectToken(e){const t=this._lexer.token;if(t.kind===e)return this.advanceLexer(),t;throw Vm(this._lexer.source,t.start,`Expected ${Nf(e)}, found ${Lf(t)}.`)}expectOptionalToken(e){return this._lexer.token.kind===e&&(this.advanceLexer(),!0)}expectKeyword(e){const t=this._lexer.token;if(t.kind!==Jm.NAME||t.value!==e)throw Vm(this._lexer.source,t.start,`Expected "${e}", found ${Lf(t)}.`);this.advanceLexer()}expectOptionalKeyword(e){const t=this._lexer.token;return t.kind===Jm.NAME&&t.value===e&&(this.advanceLexer(),!0)}unexpected(e){const t=null!=e?e:this._lexer.token;return Vm(this._lexer.source,t.start,`Unexpected ${Lf(t)}.`)}any(e,t,i){this.expectToken(e);const s=[];for(;!this.expectOptionalToken(i);)s.push(t.call(this));return s}optionalMany(e,t,i){if(this.expectOptionalToken(e)){const e=[];do{e.push(t.call(this))}while(!this.expectOptionalToken(i));return e}return[]}many(e,t,i){this.expectToken(e);const s=[];do{s.push(t.call(this))}while(!this.expectOptionalToken(i));return s}delimitedMany(e,t){this.expectOptionalToken(e);const i=[];do{i.push(t.call(this))}while(this.expectOptionalToken(e));return i}advanceLexer(){const{maxTokens:e}=this._options,t=this._lexer.advance();if(void 0!==e&&t.kind!==Jm.EOF&&(++this._tokenCounter,this._tokenCounter>e))throw Vm(this._lexer.source,t.start,`Document contains more that ${e} tokens. Parsing aborted.`)}}function Lf(e){const t=e.value;return Nf(e.kind)+(null!=t?` "${t}"`:"")}function Nf(e){return function(e){return e===Jm.BANG||e===Jm.DOLLAR||e===Jm.AMP||e===Jm.PAREN_L||e===Jm.PAREN_R||e===Jm.SPREAD||e===Jm.COLON||e===Jm.EQUALS||e===Jm.AT||e===Jm.BRACKET_L||e===Jm.BRACKET_R||e===Jm.BRACE_L||e===Jm.PIPE||e===Jm.BRACE_R}(e)?`"${e}"`:e}const Df=/[\x00-\x1f\x22\x5c\x7f-\x9f]/g;function Mf(e){return xf[e.charCodeAt(0)]}const xf=["\\u0000","\\u0001","\\u0002","\\u0003","\\u0004","\\u0005","\\u0006","\\u0007","\\b","\\t","\\n","\\u000B","\\f","\\r","\\u000E","\\u000F","\\u0010","\\u0011","\\u0012","\\u0013","\\u0014","\\u0015","\\u0016","\\u0017","\\u0018","\\u0019","\\u001A","\\u001B","\\u001C","\\u001D","\\u001E","\\u001F","","",'\\"',"","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","\\\\","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","\\u007F","\\u0080","\\u0081","\\u0082","\\u0083","\\u0084","\\u0085","\\u0086","\\u0087","\\u0088","\\u0089","\\u008A","\\u008B","\\u008C","\\u008D","\\u008E","\\u008F","\\u0090","\\u0091","\\u0092","\\u0093","\\u0094","\\u0095","\\u0096","\\u0097","\\u0098","\\u0099","\\u009A","\\u009B","\\u009C","\\u009D","\\u009E","\\u009F"],kf=Object.freeze({});function Hf(e,t,i=$m){const s=new Map;for(const e of Object.values(Qm))s.set(e,jf(t,e));let r,n,o,a=Array.isArray(e),c=[e],l=-1,d=[],u=e;const h=[],p=[];do{l++;const e=l===c.length,g=e&&0!==d.length;if(e){if(n=0===p.length?void 0:h[h.length-1],u=o,o=p.pop(),g)if(a){u=u.slice();let e=0;for(const[t,i]of d){const s=t-e;null===i?(u.splice(s,1),e++):u[s]=i}}else{u=Object.defineProperties({},Object.getOwnPropertyDescriptors(u));for(const[e,t]of d)u[e]=t}l=r.index,c=r.keys,d=r.edits,a=r.inArray,r=r.prev}else if(o){if(n=a?l:c[l],u=o[n],null==u)continue;h.push(n)}let y;if(!Array.isArray(u)){var _,m;zm(u)||Mm(!1,`Invalid AST Node: ${Af(u)}.`);const i=e?null===(_=s.get(u.kind))||void 0===_?void 0:_.leave:null===(m=s.get(u.kind))||void 0===m?void 0:m.enter;if(y=null==i?void 0:i.call(t,u,n,o,h,p),y===kf)break;if(!1===y){if(!e){h.pop();continue}}else if(void 0!==y&&(d.push([n,y]),!e)){if(!zm(y)){h.pop();continue}u=y}}var f;void 0===y&&g&&d.push([n,u]),e?h.pop():(r={inArray:a,index:l,keys:c,edits:d,prev:r},a=Array.isArray(u),c=a?u:null!==(f=i[u.kind])&&void 0!==f?f:[],l=-1,d=[],o&&p.push(o),o=u)}while(void 0!==r);return 0!==d.length?d[d.length-1][1]:e}function jf(e,t){const i=e[t];return"object"==typeof i?i:"function"==typeof i?{enter:i,leave:void 0}:{enter:e.enter,leave:e.leave}}const Uf={Name:{leave:e=>e.value},Variable:{leave:e=>"$"+e.name},Document:{leave:e=>Bf(e.definitions,"\n\n")},OperationDefinition:{leave(e){const t=Vf("(",Bf(e.variableDefinitions,", "),")"),i=Bf([e.operation,Bf([e.name,t]),Bf(e.directives," ")]," ");return("query"===i?"":i+" ")+e.selectionSet}},VariableDefinition:{leave:({variable:e,type:t,defaultValue:i,directives:s})=>e+": "+t+Vf(" = ",i)+Vf(" ",Bf(s," "))},SelectionSet:{leave:({selections:e})=>Ff(e)},Field:{leave({alias:e,name:t,arguments:i,directives:s,selectionSet:r}){const n=Vf("",e,": ")+t;let o=n+Vf("(",Bf(i,", "),")");return o.length>80&&(o=n+Vf("(\n",Kf(Bf(i,"\n")),"\n)")),Bf([o,Bf(s," "),r]," ")}},Argument:{leave:({name:e,value:t})=>e+": "+t},FragmentSpread:{leave:({name:e,directives:t})=>"..."+e+Vf(" ",Bf(t," "))},InlineFragment:{leave:({typeCondition:e,directives:t,selectionSet:i})=>Bf(["...",Vf("on ",e),Bf(t," "),i]," ")},FragmentDefinition:{leave:({name:e,typeCondition:t,variableDefinitions:i,directives:s,selectionSet:r})=>`fragment ${e}${Vf("(",Bf(i,", "),")")} on ${t} ${Vf("",Bf(s," ")," ")}`+r},IntValue:{leave:({value:e})=>e},FloatValue:{leave:({value:e})=>e},StringValue:{leave:({value:e,block:t})=>t?function(e,t){const i=e.replace(/"""/g,'\\"""'),s=i.split(/\r\n|[\n\r]/g),r=1===s.length,n=s.length>1&&s.slice(1).every((e=>0===e.length||Xm(e.charCodeAt(0)))),o=i.endsWith('\\"""'),a=e.endsWith('"')&&!o,c=e.endsWith("\\"),l=a||c,d=!r||e.length>70||l||n||o;let u="";const h=r&&Xm(e.charCodeAt(0));return(d&&!h||n)&&(u+="\n"),u+=i,(d||l)&&(u+="\n"),'"""'+u+'"""'}(e):`"${e.replace(Df,Mf)}"`},BooleanValue:{leave:({value:e})=>e?"true":"false"},NullValue:{leave:()=>"null"},EnumValue:{leave:({value:e})=>e},ListValue:{leave:({values:e})=>"["+Bf(e,", ")+"]"},ObjectValue:{leave:({fields:e})=>"{"+Bf(e,", ")+"}"},ObjectField:{leave:({name:e,value:t})=>e+": "+t},Directive:{leave:({name:e,arguments:t})=>"@"+e+Vf("(",Bf(t,", "),")")},NamedType:{leave:({name:e})=>e},ListType:{leave:({type:e})=>"["+e+"]"},NonNullType:{leave:({type:e})=>e+"!"},SchemaDefinition:{leave:({description:e,directives:t,operationTypes:i})=>Vf("",e,"\n")+Bf(["schema",Bf(t," "),Ff(i)]," ")},OperationTypeDefinition:{leave:({operation:e,type:t})=>e+": "+t},ScalarTypeDefinition:{leave:({description:e,name:t,directives:i})=>Vf("",e,"\n")+Bf(["scalar",t,Bf(i," ")]," ")},ObjectTypeDefinition:{leave:({description:e,name:t,interfaces:i,directives:s,fields:r})=>Vf("",e,"\n")+Bf(["type",t,Vf("implements ",Bf(i," & ")),Bf(s," "),Ff(r)]," ")},FieldDefinition:{leave:({description:e,name:t,arguments:i,type:s,directives:r})=>Vf("",e,"\n")+t+(Gf(i)?Vf("(\n",Kf(Bf(i,"\n")),"\n)"):Vf("(",Bf(i,", "),")"))+": "+s+Vf(" ",Bf(r," "))},InputValueDefinition:{leave:({description:e,name:t,type:i,defaultValue:s,directives:r})=>Vf("",e,"\n")+Bf([t+": "+i,Vf("= ",s),Bf(r," ")]," ")},InterfaceTypeDefinition:{leave:({description:e,name:t,interfaces:i,directives:s,fields:r})=>Vf("",e,"\n")+Bf(["interface",t,Vf("implements ",Bf(i," & ")),Bf(s," "),Ff(r)]," ")},UnionTypeDefinition:{leave:({description:e,name:t,directives:i,types:s})=>Vf("",e,"\n")+Bf(["union",t,Bf(i," "),Vf("= ",Bf(s," | "))]," ")},EnumTypeDefinition:{leave:({description:e,name:t,directives:i,values:s})=>Vf("",e,"\n")+Bf(["enum",t,Bf(i," "),Ff(s)]," ")},EnumValueDefinition:{leave:({description:e,name:t,directives:i})=>Vf("",e,"\n")+Bf([t,Bf(i," ")]," ")},InputObjectTypeDefinition:{leave:({description:e,name:t,directives:i,fields:s})=>Vf("",e,"\n")+Bf(["input",t,Bf(i," "),Ff(s)]," ")},DirectiveDefinition:{leave:({description:e,name:t,arguments:i,repeatable:s,locations:r})=>Vf("",e,"\n")+"directive @"+t+(Gf(i)?Vf("(\n",Kf(Bf(i,"\n")),"\n)"):Vf("(",Bf(i,", "),")"))+(s?" repeatable":"")+" on "+Bf(r," | ")},SchemaExtension:{leave:({directives:e,operationTypes:t})=>Bf(["extend schema",Bf(e," "),Ff(t)]," ")},ScalarTypeExtension:{leave:({name:e,directives:t})=>Bf(["extend scalar",e,Bf(t," ")]," ")},ObjectTypeExtension:{leave:({name:e,interfaces:t,directives:i,fields:s})=>Bf(["extend type",e,Vf("implements ",Bf(t," & ")),Bf(i," "),Ff(s)]," ")},InterfaceTypeExtension:{leave:({name:e,interfaces:t,directives:i,fields:s})=>Bf(["extend interface",e,Vf("implements ",Bf(t," & ")),Bf(i," "),Ff(s)]," ")},UnionTypeExtension:{leave:({name:e,directives:t,types:i})=>Bf(["extend union",e,Bf(t," "),Vf("= ",Bf(i," | "))]," ")},EnumTypeExtension:{leave:({name:e,directives:t,values:i})=>Bf(["extend enum",e,Bf(t," "),Ff(i)]," ")},InputObjectTypeExtension:{leave:({name:e,directives:t,fields:i})=>Bf(["extend input",e,Bf(t," "),Ff(i)]," ")}};function Bf(e,t=""){var i;return null!==(i=null==e?void 0:e.filter((e=>e)).join(t))&&void 0!==i?i:""}function Ff(e){return Vf("{\n",Kf(Bf(e,"\n")),"\n}")}function Vf(e,t,i=""){return null!=t&&""!==t?e+t+i:""}function Kf(e){return Vf(" ",e.replace(/\n/g,"\n "))}function Gf(e){var t;return null!==(t=null==e?void 0:e.some((e=>e.includes("\n"))))&&void 0!==t&&t}function $f(e){return e.kind===Qm.FIELD||e.kind===Qm.FRAGMENT_SPREAD||e.kind===Qm.INLINE_FRAGMENT}function Wf(e,t){var i=e.directives;return!i||!i.length||function(e){var t=[];return e&&e.length&&e.forEach((function(e){if(function(e){var t=e.name.value;return"skip"===t||"include"===t}(e)){var i=e.arguments,s=e.name.value;wm(i&&1===i.length,71,s);var r=i[0];wm(r.name&&"if"===r.name.value,72,s);var n=r.value;wm(n&&("Variable"===n.kind||"BooleanValue"===n.kind),73,s),t.push({directive:e,ifArgument:r})}})),t}(i).every((function(e){var i=e.directive,s=e.ifArgument,r=!1;return"Variable"===s.value.kind?(r=t&&t[s.value.name.value],wm(void 0!==r,70,i.name.value)):r=s.value.value,"skip"===i.name.value?!r:r}))}function zf(e,t,i){var s=new Set(e),r=s.size;return Hf(t,{Directive:function(e){if(s.delete(e.name.value)&&(!i||!s.size))return kf}}),i?!s.size:s.size<r}function qf(e){return e&&zf(["client","export"],e,!0)}const Yf=()=>Object.create(null),{forEach:Qf,slice:Jf}=Array.prototype,{hasOwnProperty:Xf}=Object.prototype;class Zf{constructor(e=!0,t=Yf){this.weakness=e,this.makeData=t}lookup(){return this.lookupArray(arguments)}lookupArray(e){let t=this;return Qf.call(e,(e=>t=t.getChildTrie(e))),Xf.call(t,"data")?t.data:t.data=this.makeData(Jf.call(e))}peek(){return this.peekArray(arguments)}peekArray(e){let t=this;for(let i=0,s=e.length;t&&i<s;++i){const s=t.mapFor(e[i],!1);t=s&&s.get(e[i])}return t&&t.data}remove(){return this.removeArray(arguments)}removeArray(e){let t;if(e.length){const i=e[0],s=this.mapFor(i,!1),r=s&&s.get(i);r&&(t=r.removeArray(Jf.call(e,1)),r.data||r.weak||r.strong&&r.strong.size||s.delete(i))}else t=this.data,delete this.data;return t}getChildTrie(e){const t=this.mapFor(e,!0);let i=t.get(e);return i||t.set(e,i=new Zf(this.weakness,this.makeData)),i}mapFor(e,t){return this.weakness&&function(e){switch(typeof e){case"object":if(null===e)break;case"function":return!0}return!1}(e)?this.weak||(t?this.weak=new WeakMap:void 0):this.strong||(t?this.strong=new Map:void 0)}}var eg="ReactNative"==Im((function(){return navigator.product})),tg="function"==typeof WeakMap&&!(eg&&!global.HermesInternal),ig="function"==typeof WeakSet,sg="function"==typeof Symbol&&"function"==typeof Symbol.for,rg=sg&&Symbol.asyncIterator;function ng(e){return null!==e&&"object"==typeof e}function og(e,t){var i=t,s=[];return e.definitions.forEach((function(e){if("OperationDefinition"===e.kind)throw Cm(74,e.operation,e.name?" named '".concat(e.name.value,"'"):"");"FragmentDefinition"===e.kind&&s.push(e)})),void 0===i&&(wm(1===s.length,75,s.length),i=s[0].name.value),om(om({},e),{definitions:dm([{kind:"OperationDefinition",operation:"query",selectionSet:{kind:"SelectionSet",selections:[{kind:"FragmentSpread",name:{kind:"Name",value:i}}]}}],e.definitions,!0)})}function ag(e){void 0===e&&(e=[]);var t={};return e.forEach((function(e){t[e.name.value]=e})),t}function cg(e,t){switch(e.kind){case"InlineFragment":return e;case"FragmentSpread":var i=e.name.value;if("function"==typeof t)return t(i);var s=t&&t[i];return wm(s,76,i),s||null;default:return null}}function lg(){}Im((function(){return window.document.createElement})),Im((function(){return navigator.userAgent.indexOf("jsdom")>=0}));class dg{constructor(e=1/0,t=lg){this.max=e,this.dispose=t,this.map=new Map,this.newest=null,this.oldest=null}has(e){return this.map.has(e)}get(e){const t=this.getNode(e);return t&&t.value}get size(){return this.map.size}getNode(e){const t=this.map.get(e);if(t&&t!==this.newest){const{older:e,newer:i}=t;i&&(i.older=e),e&&(e.newer=i),t.older=this.newest,t.older.newer=t,t.newer=null,this.newest=t,t===this.oldest&&(this.oldest=i)}return t}set(e,t){let i=this.getNode(e);return i?i.value=t:(i={key:e,value:t,newer:null,older:this.newest},this.newest&&(this.newest.newer=i),this.newest=i,this.oldest=this.oldest||i,this.map.set(e,i),i.value)}clean(){for(;this.oldest&&this.map.size>this.max;)this.delete(this.oldest.key)}delete(e){const t=this.map.get(e);return!!t&&(t===this.newest&&(this.newest=t.older),t===this.oldest&&(this.oldest=t.newer),t.newer&&(t.newer.older=t.older),t.older&&(t.older.newer=t.newer),this.map.delete(e),this.dispose(t.value,e),!0)}}function ug(){}const hg=ug,pg="undefined"!=typeof WeakRef?WeakRef:function(e){return{deref:()=>e}},_g="undefined"!=typeof WeakMap?WeakMap:Map,mg="undefined"!=typeof FinalizationRegistry?FinalizationRegistry:function(){return{register:ug,unregister:ug}};class fg{constructor(e=1/0,t=hg){this.max=e,this.dispose=t,this.map=new _g,this.newest=null,this.oldest=null,this.unfinalizedNodes=new Set,this.finalizationScheduled=!1,this.size=0,this.finalize=()=>{const e=this.unfinalizedNodes.values();for(let t=0;t<10024;t++){const t=e.next().value;if(!t)break;this.unfinalizedNodes.delete(t);const i=t.key;delete t.key,t.keyRef=new pg(i),this.registry.register(i,t,t)}this.unfinalizedNodes.size>0?queueMicrotask(this.finalize):this.finalizationScheduled=!1},this.registry=new mg(this.deleteNode.bind(this))}has(e){return this.map.has(e)}get(e){const t=this.getNode(e);return t&&t.value}getNode(e){const t=this.map.get(e);if(t&&t!==this.newest){const{older:e,newer:i}=t;i&&(i.older=e),e&&(e.newer=i),t.older=this.newest,t.older.newer=t,t.newer=null,this.newest=t,t===this.oldest&&(this.oldest=i)}return t}set(e,t){let i=this.getNode(e);return i?i.value=t:(i={key:e,value:t,newer:null,older:this.newest},this.newest&&(this.newest.newer=i),this.newest=i,this.oldest=this.oldest||i,this.scheduleFinalization(i),this.map.set(e,i),this.size++,i.value)}clean(){for(;this.oldest&&this.size>this.max;)this.deleteNode(this.oldest)}deleteNode(e){e===this.newest&&(this.newest=e.older),e===this.oldest&&(this.oldest=e.newer),e.newer&&(e.newer.older=e.older),e.older&&(e.older.newer=e.newer),this.size--;const t=e.key||e.keyRef&&e.keyRef.deref();this.dispose(e.value,t),e.keyRef?this.registry.unregister(e):this.unfinalizedNodes.delete(e),t&&this.map.delete(t)}delete(e){const t=this.map.get(e);return!!t&&(this.deleteNode(t),!0)}scheduleFinalization(e){this.unfinalizedNodes.add(e),this.finalizationScheduled||(this.finalizationScheduled=!0,queueMicrotask(this.finalize))}}var gg=new WeakSet;function yg(e){e.size<=(e.max||-1)||gg.has(e)||(gg.add(e),setTimeout((function(){e.clean(),gg.delete(e)}),100))}var vg=function(e,t){var i=new fg(e,t);return i.set=function(e,t){var i=fg.prototype.set.call(this,e,t);return yg(this),i},i},Og=function(e,t){var i=new dg(e,t);return i.set=function(e,t){var i=dg.prototype.set.call(this,e,t);return yg(this),i},i},bg=Symbol.for("apollo.cacheSize"),Ig=om({},Em[bg]),Eg={};function Tg(e,t){Eg[e]=t}var Sg=!1!==globalThis.__DEV__?function(){var e,t,i,s,r;if(!1===globalThis.__DEV__)throw new Error("only supported in development mode");return{limits:Object.fromEntries(Object.entries({parser:1e3,canonicalStringify:1e3,print:2e3,"documentTransform.cache":2e3,"queryManager.getDocumentInfo":2e3,"PersistedQueryLink.persistedQueryHashes":2e3,"fragmentRegistry.transform":2e3,"fragmentRegistry.lookup":1e3,"fragmentRegistry.findFragmentSpreads":4e3,"cache.fragmentQueryDocuments":1e3,"removeTypenameFromVariables.getVariableDefinitions":2e3,"inMemoryCache.maybeBroadcastWatch":5e3,"inMemoryCache.executeSelectionSet":5e4,"inMemoryCache.executeSubSelectedArray":1e4}).map((function(e){var t=e[0],i=e[1];return[t,Ig[t]||i]}))),sizes:om({print:null===(e=Eg.print)||void 0===e?void 0:e.call(Eg),parser:null===(t=Eg.parser)||void 0===t?void 0:t.call(Eg),canonicalStringify:null===(i=Eg.canonicalStringify)||void 0===i?void 0:i.call(Eg),links:Dg(this.link),queryManager:{getDocumentInfo:this.queryManager.transformCache.size,documentTransforms:Lg(this.queryManager.documentTransform)}},null===(r=(s=this.cache).getMemoryInternals)||void 0===r?void 0:r.call(s))}}:void 0,Ag=!1!==globalThis.__DEV__?function(){var e=this.config.fragments;return om(om({},wg.apply(this)),{addTypenameDocumentTransform:Lg(this.addTypenameTransform),inMemoryCache:{executeSelectionSet:Cg(this.storeReader.executeSelectionSet),executeSubSelectedArray:Cg(this.storeReader.executeSubSelectedArray),maybeBroadcastWatch:Cg(this.maybeBroadcastWatch)},fragmentRegistry:{findFragmentSpreads:Cg(null==e?void 0:e.findFragmentSpreads),lookup:Cg(null==e?void 0:e.lookup),transform:Cg(null==e?void 0:e.transform)}})}:void 0,Pg=!1!==globalThis.__DEV__?wg:void 0;function wg(){return{cache:{fragmentQueryDocuments:Cg(this.getFragmentDoc)}}}function Cg(e){return function(e){return!!e&&"dirtyKey"in e}(e)?e.size:void 0}function Rg(e){return null!=e}function Lg(e){return Ng(e).map((function(e){return{cache:e}}))}function Ng(e){return e?dm(dm([Cg(null==e?void 0:e.performWork)],Ng(null==e?void 0:e.left),!0),Ng(null==e?void 0:e.right),!0).filter(Rg):[]}function Dg(e){var t;return e?dm(dm([null===(t=null==e?void 0:e.getMemoryInternals)||void 0===t?void 0:t.call(e)],Dg(null==e?void 0:e.left),!0),Dg(null==e?void 0:e.right),!0).filter(Rg):[]}var Mg,xg=Object.assign((function(e){return JSON.stringify(e,kg)}),{reset:function(){Mg=new Og(Ig.canonicalStringify||1e3)}});function kg(e,t){if(t&&"object"==typeof t){var i=Object.getPrototypeOf(t);if(i===Object.prototype||null===i){var s=Object.keys(t);if(s.every(Hg))return t;var r=JSON.stringify(s),n=Mg.get(r);if(!n){s.sort();var o=JSON.stringify(s);n=Mg.get(o)||s,Mg.set(r,n),Mg.set(o,n)}var a=Object.create(i);return n.forEach((function(e){a[e]=t[e]})),a}}return t}function Hg(e,t,i){return 0===t||i[t-1]<=e}function jg(e){return{__ref:String(e)}}function Ug(e){return Boolean(e&&"object"==typeof e&&"string"==typeof e.__ref)}function Bg(e,t,i,s){if(function(e){return"IntValue"===e.kind}(i)||function(e){return"FloatValue"===e.kind}(i))e[t.value]=Number(i.value);else if(function(e){return"BooleanValue"===e.kind}(i)||function(e){return"StringValue"===e.kind}(i))e[t.value]=i.value;else if(function(e){return"ObjectValue"===e.kind}(i)){var r={};i.fields.map((function(e){return Bg(r,e.name,e.value,s)})),e[t.value]=r}else if(function(e){return"Variable"===e.kind}(i)){var n=(s||{})[i.name.value];e[t.value]=n}else if(function(e){return"ListValue"===e.kind}(i))e[t.value]=i.values.map((function(e){var i={};return Bg(i,t,e,s),i[t.value]}));else if(function(e){return"EnumValue"===e.kind}(i))e[t.value]=i.value;else{if(!function(e){return"NullValue"===e.kind}(i))throw Cm(85,t.value,i.kind);e[t.value]=null}}!1!==globalThis.__DEV__&&Tg("canonicalStringify",(function(){return Mg.size})),xg.reset();var Fg=["connection","include","skip","client","rest","export","nonreactive"],Vg=xg,Kg=Object.assign((function(e,t,i){if(t&&i&&i.connection&&i.connection.key){if(i.connection.filter&&i.connection.filter.length>0){var s=i.connection.filter?i.connection.filter:[];s.sort();var r={};return s.forEach((function(e){r[e]=t[e]})),"".concat(i.connection.key,"(").concat(Vg(r),")")}return i.connection.key}var n=e;if(t){var o=Vg(t);n+="(".concat(o,")")}return i&&Object.keys(i).forEach((function(e){-1===Fg.indexOf(e)&&(i[e]&&Object.keys(i[e]).length?n+="@".concat(e,"(").concat(Vg(i[e]),")"):n+="@".concat(e))})),n}),{setStringify:function(e){var t=Vg;return Vg=e,t}});function Gg(e,t){if(e.arguments&&e.arguments.length){var i={};return e.arguments.forEach((function(e){var s=e.name,r=e.value;return Bg(i,s,r,t)})),i}return null}function $g(e){return e.alias?e.alias.value:e.name.value}function Wg(e,t,i){for(var s,r=0,n=t.selections;r<n.length;r++)if(zg(c=n[r])){if("__typename"===c.name.value)return e[$g(c)]}else s?s.push(c):s=[c];if("string"==typeof e.__typename)return e.__typename;if(s)for(var o=0,a=s;o<a.length;o++){var c,l=Wg(e,cg(c=a[o],i).selectionSet,i);if("string"==typeof l)return l}}function zg(e){return"Field"===e.kind}function qg(e){wm(e&&"Document"===e.kind,77);var t=e.definitions.filter((function(e){return"FragmentDefinition"!==e.kind})).map((function(e){if("OperationDefinition"!==e.kind)throw Cm(78,e.kind);return e}));return wm(t.length<=1,79,t.length),e}function Yg(e){return qg(e),e.definitions.filter((function(e){return"OperationDefinition"===e.kind}))[0]}function Qg(e){return e.definitions.filter((function(e){return"OperationDefinition"===e.kind&&!!e.name})).map((function(e){return e.name.value}))[0]||null}function Jg(e){return e.definitions.filter((function(e){return"FragmentDefinition"===e.kind}))}function Xg(e){var t=Yg(e);return wm(t&&"query"===t.operation,80),t}function Zg(e){var t;qg(e);for(var i=0,s=e.definitions;i<s.length;i++){var r=s[i];if("OperationDefinition"===r.kind){var n=r.operation;if("query"===n||"mutation"===n||"subscription"===n)return r}"FragmentDefinition"!==r.kind||t||(t=r)}if(t)return t;throw Cm(84)}function ey(e){var t=Object.create(null),i=e&&e.variableDefinitions;return i&&i.length&&i.forEach((function(e){e.defaultValue&&Bg(t,e.variable.name,e.defaultValue)})),t}const ty=()=>Object.create(null),{forEach:iy,slice:sy}=Array.prototype,{hasOwnProperty:ry}=Object.prototype;class ny{constructor(e=!0,t=ty){this.weakness=e,this.makeData=t}lookup(...e){return this.lookupArray(e)}lookupArray(e){let t=this;return iy.call(e,(e=>t=t.getChildTrie(e))),ry.call(t,"data")?t.data:t.data=this.makeData(sy.call(e))}peek(...e){return this.peekArray(e)}peekArray(e){let t=this;for(let i=0,s=e.length;t&&i<s;++i){const s=this.weakness&&oy(e[i])?t.weak:t.strong;t=s&&s.get(e[i])}return t&&t.data}getChildTrie(e){const t=this.weakness&&oy(e)?this.weak||(this.weak=new WeakMap):this.strong||(this.strong=new Map);let i=t.get(e);return i||t.set(e,i=new ny(this.weakness,this.makeData)),i}}function oy(e){switch(typeof e){case"object":if(null===e)break;case"function":return!0}return!1}let ay=null;const cy={};let ly=1;function dy(e){try{return e()}catch(e){}}const uy="@wry/context:Slot",hy=dy((()=>globalThis))||dy((()=>global))||Object.create(null),py=hy[uy]||Array[uy]||function(e){try{Object.defineProperty(hy,uy,{value:e,enumerable:!1,writable:!1,configurable:!0})}finally{return e}}(class{constructor(){this.id=["slot",ly++,Date.now(),Math.random().toString(36).slice(2)].join(":")}hasValue(){for(let e=ay;e;e=e.parent)if(this.id in e.slots){const t=e.slots[this.id];if(t===cy)break;return e!==ay&&(ay.slots[this.id]=t),!0}return ay&&(ay.slots[this.id]=cy),!1}getValue(){if(this.hasValue())return ay.slots[this.id]}withValue(e,t,i,s){const r={__proto__:null,[this.id]:e},n=ay;ay={parent:n,slots:r};try{return t.apply(s,i)}finally{ay=n}}static bind(e){const t=ay;return function(){const i=ay;try{return ay=t,e.apply(this,arguments)}finally{ay=i}}}static noContext(e,t,i){if(!ay)return e.apply(i,t);{const s=ay;try{return ay=null,e.apply(i,t)}finally{ay=s}}}}),_y=new py,{hasOwnProperty:my}=Object.prototype,fy=Array.from||function(e){const t=[];return e.forEach((e=>t.push(e))),t};function gy(e){const{unsubscribe:t}=e;"function"==typeof t&&(e.unsubscribe=void 0,t())}const yy=[],vy=100;function Oy(e,t){if(!e)throw new Error(t||"assertion failure")}function by(e,t){const i=e.length;return i>0&&i===t.length&&e[i-1]===t[i-1]}function Iy(e){switch(e.length){case 0:throw new Error("unknown value");case 1:return e[0];case 2:throw e[1]}}function Ey(e){return e.slice(0)}class Ty{constructor(e){this.fn=e,this.parents=new Set,this.childValues=new Map,this.dirtyChildren=null,this.dirty=!0,this.recomputing=!1,this.value=[],this.deps=null,++Ty.count}peek(){if(1===this.value.length&&!Py(this))return Sy(this),this.value[0]}recompute(e){return Oy(!this.recomputing,"already recomputing"),Sy(this),Py(this)?function(e,t){return My(e),_y.withValue(e,Ay,[e,t]),function(e,t){if("function"==typeof e.subscribe)try{gy(e),e.unsubscribe=e.subscribe.apply(null,t)}catch(t){return e.setDirty(),!1}return!0}(e,t)&&function(e){e.dirty=!1,Py(e)||Cy(e)}(e),Iy(e.value)}(this,e):Iy(this.value)}setDirty(){this.dirty||(this.dirty=!0,wy(this),gy(this))}dispose(){this.setDirty(),My(this),Ry(this,((e,t)=>{e.setDirty(),xy(e,this)}))}forget(){this.dispose()}dependOn(e){e.add(this),this.deps||(this.deps=yy.pop()||new Set),this.deps.add(e)}forgetDeps(){this.deps&&(fy(this.deps).forEach((e=>e.delete(this))),this.deps.clear(),yy.push(this.deps),this.deps=null)}}function Sy(e){const t=_y.getValue();if(t)return e.parents.add(t),t.childValues.has(e)||t.childValues.set(e,[]),Py(e)?Ly(t,e):Ny(t,e),t}function Ay(e,t){e.recomputing=!0;const{normalizeResult:i}=e;let s;i&&1===e.value.length&&(s=Ey(e.value)),e.value.length=0;try{if(e.value[0]=e.fn.apply(null,t),i&&s&&!by(s,e.value))try{e.value[0]=i(e.value[0],s[0])}catch(e){}}catch(t){e.value[1]=t}e.recomputing=!1}function Py(e){return e.dirty||!(!e.dirtyChildren||!e.dirtyChildren.size)}function wy(e){Ry(e,Ly)}function Cy(e){Ry(e,Ny)}function Ry(e,t){const i=e.parents.size;if(i){const s=fy(e.parents);for(let r=0;r<i;++r)t(s[r],e)}}function Ly(e,t){Oy(e.childValues.has(t)),Oy(Py(t));const i=!Py(e);if(e.dirtyChildren){if(e.dirtyChildren.has(t))return}else e.dirtyChildren=yy.pop()||new Set;e.dirtyChildren.add(t),i&&wy(e)}function Ny(e,t){Oy(e.childValues.has(t)),Oy(!Py(t));const i=e.childValues.get(t);0===i.length?e.childValues.set(t,Ey(t.value)):by(i,t.value)||e.setDirty(),Dy(e,t),Py(e)||Cy(e)}function Dy(e,t){const i=e.dirtyChildren;i&&(i.delete(t),0===i.size&&(yy.length<vy&&yy.push(i),e.dirtyChildren=null))}function My(e){e.childValues.size>0&&e.childValues.forEach(((t,i)=>{xy(e,i)})),e.forgetDeps(),Oy(null===e.dirtyChildren)}function xy(e,t){t.parents.delete(e),e.childValues.delete(t),Dy(e,t)}Ty.count=0;const ky={setDirty:!0,dispose:!0,forget:!0};function Hy(e){const t=new Map,i=e&&e.subscribe;function s(e){const s=_y.getValue();if(s){let r=t.get(e);r||t.set(e,r=new Set),s.dependOn(r),"function"==typeof i&&(gy(r),r.unsubscribe=i(e))}}return s.dirty=function(e,i){const s=t.get(e);if(s){const r=i&&my.call(ky,i)?i:"setDirty";fy(s).forEach((e=>e[r]())),t.delete(e),gy(s)}},s}let jy;function Uy(...e){return(jy||(jy=new ny("function"==typeof WeakMap))).lookupArray(e)}const By=new Set;function Fy(e,{max:t=Math.pow(2,16),keyArgs:i,makeCacheKey:s=Uy,normalizeResult:r,subscribe:n,cache:o=dg}=Object.create(null)){const a="function"==typeof o?new o(t,(e=>e.dispose())):o,c=function(){const t=s.apply(null,i?i.apply(null,arguments):arguments);if(void 0===t)return e.apply(null,arguments);let o=a.get(t);o||(a.set(t,o=new Ty(e)),o.normalizeResult=r,o.subscribe=n,o.forget=()=>a.delete(t));const c=o.recompute(Array.prototype.slice.call(arguments));return a.set(t,o),By.add(a),_y.hasValue()||(By.forEach((e=>e.clean())),By.clear()),c};function l(e){const t=e&&a.get(e);t&&t.setDirty()}function d(e){const t=e&&a.get(e);if(t)return t.peek()}function u(e){return!!e&&a.delete(e)}return Object.defineProperty(c,"size",{get:()=>a.size,configurable:!1,enumerable:!1}),Object.freeze(c.options={max:t,keyArgs:i,makeCacheKey:s,normalizeResult:r,subscribe:n,cache:a}),c.dirtyKey=l,c.dirty=function(){l(s.apply(null,arguments))},c.peekKey=d,c.peek=function(){return d(s.apply(null,arguments))},c.forgetKey=u,c.forget=function(){return u(s.apply(null,arguments))},c.makeCacheKey=s,c.getKey=i?function(){return s.apply(null,i.apply(null,arguments))}:s,Object.freeze(c)}function Vy(e){return e}var Ky,Gy=function(){function e(e,t){void 0===t&&(t=Object.create(null)),this.resultCache=ig?new WeakSet:new Set,this.transform=e,t.getCacheKey&&(this.getCacheKey=t.getCacheKey),this.cached=!1!==t.cache,this.resetCache()}return e.prototype.getCacheKey=function(e){return[e]},e.identity=function(){return new e(Vy,{cache:!1})},e.split=function(t,i,s){return void 0===s&&(s=e.identity()),Object.assign(new e((function(e){return(t(e)?i:s).transformDocument(e)}),{cache:!1}),{left:i,right:s})},e.prototype.resetCache=function(){var t=this;if(this.cached){var i=new Zf(tg);this.performWork=Fy(e.prototype.performWork.bind(this),{makeCacheKey:function(e){var s=t.getCacheKey(e);if(s)return wm(Array.isArray(s),69),i.lookupArray(s)},max:Ig["documentTransform.cache"],cache:fg})}},e.prototype.performWork=function(e){return qg(e),this.transform(e)},e.prototype.transformDocument=function(e){if(this.resultCache.has(e))return e;var t=this.performWork(e);return this.resultCache.add(t),t},e.prototype.concat=function(t){var i=this;return Object.assign(new e((function(e){return t.transformDocument(i.transformDocument(e))}),{cache:!1}),{left:this,right:t})},e}(),$y=Object.assign((function(e){var t=Ky.get(e);return t||(t=function(e){return Hf(e,Uf)}(e),Ky.set(e,t)),t}),{reset:function(){Ky=new vg(Ig.print||2e3)}});$y.reset(),!1!==globalThis.__DEV__&&Tg("print",(function(){return Ky?Ky.size:0}));var Wy=Array.isArray;function zy(e){return Array.isArray(e)&&e.length>0}var qy={kind:Qm.FIELD,name:{kind:Qm.NAME,value:"__typename"}};function Yy(e,t){return!e||e.selectionSet.selections.every((function(e){return e.kind===Qm.FRAGMENT_SPREAD&&Yy(t[e.name.value],t)}))}function Qy(e){return Yy(Yg(e)||function(e){wm("Document"===e.kind,81),wm(e.definitions.length<=1,82);var t=e.definitions[0];return wm("FragmentDefinition"===t.kind,83),t}(e),ag(Jg(e)))?null:e}function Jy(e){var t=new Map;return function(i){void 0===i&&(i=e);var s=t.get(i);return s||t.set(i,s={variables:new Set,fragmentSpreads:new Set}),s}}function Xy(e,t){qg(t);for(var i=Jy(""),s=Jy(""),r=function(e){for(var t=0,r=void 0;t<e.length&&(r=e[t]);++t)if(!Wy(r)){if(r.kind===Qm.OPERATION_DEFINITION)return i(r.name&&r.name.value);if(r.kind===Qm.FRAGMENT_DEFINITION)return s(r.name.value)}return!1!==globalThis.__DEV__&&wm.error(86),null},n=0,o=t.definitions.length-1;o>=0;--o)t.definitions[o].kind===Qm.OPERATION_DEFINITION&&++n;var a,c,l,d=(a=e,c=new Map,l=new Map,a.forEach((function(e){e&&(e.name?c.set(e.name,e):e.test&&l.set(e.test,e))})),function(e){var t=c.get(e.name.value);return!t&&l.size&&l.forEach((function(i,s){s(e)&&(t=i)})),t}),u=function(e){return zy(e)&&e.map(d).some((function(e){return e&&e.remove}))},h=new Map,p=!1,_={enter:function(e){if(u(e.directives))return p=!0,null}},m=Hf(t,{Field:_,InlineFragment:_,VariableDefinition:{enter:function(){return!1}},Variable:{enter:function(e,t,i,s,n){var o=r(n);o&&o.variables.add(e.name.value)}},FragmentSpread:{enter:function(e,t,i,s,n){if(u(e.directives))return p=!0,null;var o=r(n);o&&o.fragmentSpreads.add(e.name.value)}},FragmentDefinition:{enter:function(e,t,i,s){h.set(JSON.stringify(s),e)},leave:function(e,t,i,r){return e===h.get(JSON.stringify(r))?e:n>0&&e.selectionSet.selections.every((function(e){return e.kind===Qm.FIELD&&"__typename"===e.name.value}))?(s(e.name.value).removed=!0,p=!0,null):void 0}},Directive:{leave:function(e){if(d(e))return p=!0,null}}});if(!p)return t;var f=function(e){return e.transitiveVars||(e.transitiveVars=new Set(e.variables),e.removed||e.fragmentSpreads.forEach((function(t){f(s(t)).transitiveVars.forEach((function(t){e.transitiveVars.add(t)}))}))),e},g=new Set;m.definitions.forEach((function(e){e.kind===Qm.OPERATION_DEFINITION?f(i(e.name&&e.name.value)).fragmentSpreads.forEach((function(e){g.add(e)})):e.kind!==Qm.FRAGMENT_DEFINITION||0!==n||s(e.name.value).removed||g.add(e.name.value)})),g.forEach((function(e){f(s(e)).fragmentSpreads.forEach((function(e){g.add(e)}))}));var y={enter:function(e){if(t=e.name.value,!g.has(t)||s(t).removed)return null;var t}};return Qy(Hf(m,{FragmentSpread:y,FragmentDefinition:y,OperationDefinition:{leave:function(e){if(e.variableDefinitions){var t=f(i(e.name&&e.name.value)).transitiveVars;if(t.size<e.variableDefinitions.length)return om(om({},e),{variableDefinitions:e.variableDefinitions.filter((function(e){return t.has(e.variable.name.value)}))})}}}}))}var Zy=Object.assign((function(e){return Hf(e,{SelectionSet:{enter:function(e,t,i){if(!i||i.kind!==Qm.OPERATION_DEFINITION){var s=e.selections;if(s&&!s.some((function(e){return zg(e)&&("__typename"===e.name.value||0===e.name.value.lastIndexOf("__",0))}))){var r=i;if(!(zg(r)&&r.directives&&r.directives.some((function(e){return"export"===e.name.value}))))return om(om({},e),{selections:dm(dm([],s,!0),[qy],!1)})}}}}})}),{added:function(e){return e===qy}});function ev(e){return"query"===Zg(e).operation?e:Hf(e,{OperationDefinition:{enter:function(e){return om(om({},e),{operation:"query"})}}})}function tv(e){return qg(e),Xy([{test:function(e){return"client"===e.name.value},remove:!0}],e)}var iv=Object.prototype.hasOwnProperty;function sv(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return rv(e)}function rv(e){var t=e[0]||{},i=e.length;if(i>1)for(var s=new ov,r=1;r<i;++r)t=s.merge(t,e[r]);return t}var nv=function(e,t,i){return this.merge(e[i],t[i])},ov=function(){function e(e){void 0===e&&(e=nv),this.reconciler=e,this.isObject=ng,this.pastCopies=new Set}return e.prototype.merge=function(e,t){for(var i=this,s=[],r=2;r<arguments.length;r++)s[r-2]=arguments[r];return ng(t)&&ng(e)?(Object.keys(t).forEach((function(r){if(iv.call(e,r)){var n=e[r];if(t[r]!==n){var o=i.reconciler.apply(i,dm([e,t,r],s,!1));o!==n&&((e=i.shallowCopyForMerge(e))[r]=o)}}else(e=i.shallowCopyForMerge(e))[r]=t[r]})),e):t},e.prototype.shallowCopyForMerge=function(e){return ng(e)&&(this.pastCopies.has(e)||(e=Array.isArray(e)?e.slice(0):om({__proto__:Object.getPrototypeOf(e)},e),this.pastCopies.add(e))),e},e}();function av(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,s=new Array(t);i<t;i++)s[i]=e[i];return s}function cv(e,t){for(var i=0;i<t.length;i++){var s=t[i];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(e,s.key,s)}}function lv(e,t,i){return t&&cv(e.prototype,t),i&&cv(e,i),Object.defineProperty(e,"prototype",{writable:!1}),e}var dv=function(){return"function"==typeof Symbol},uv=function(e){return dv()&&Boolean(Symbol[e])},hv=function(e){return uv(e)?Symbol[e]:"@@"+e};dv()&&!uv("observable")&&(Symbol.observable=Symbol("observable"));var pv=hv("iterator"),_v=hv("observable"),mv=hv("species");function fv(e,t){var i=e[t];if(null!=i){if("function"!=typeof i)throw new TypeError(i+" is not a function");return i}}function gv(e){var t=e.constructor;return void 0!==t&&null===(t=t[mv])&&(t=void 0),void 0!==t?t:Pv}function yv(e){return e instanceof Pv}function vv(e){vv.log?vv.log(e):setTimeout((function(){throw e}))}function Ov(e){Promise.resolve().then((function(){try{e()}catch(e){vv(e)}}))}function bv(e){var t=e._cleanup;if(void 0!==t&&(e._cleanup=void 0,t))try{if("function"==typeof t)t();else{var i=fv(t,"unsubscribe");i&&i.call(t)}}catch(e){vv(e)}}function Iv(e){e._observer=void 0,e._queue=void 0,e._state="closed"}function Ev(e,t,i){e._state="running";var s=e._observer;try{var r=fv(s,t);switch(t){case"next":r&&r.call(s,i);break;case"error":if(Iv(e),!r)throw i;r.call(s,i);break;case"complete":Iv(e),r&&r.call(s)}}catch(e){vv(e)}"closed"===e._state?bv(e):"running"===e._state&&(e._state="ready")}function Tv(e,t,i){if("closed"!==e._state){if("buffering"!==e._state)return"ready"!==e._state?(e._state="buffering",e._queue=[{type:t,value:i}],void Ov((function(){return function(e){var t=e._queue;if(t){e._queue=void 0,e._state="ready";for(var i=0;i<t.length&&(Ev(e,t[i].type,t[i].value),"closed"!==e._state);++i);}}(e)}))):void Ev(e,t,i);e._queue.push({type:t,value:i})}}var Sv=function(){function e(e,t){this._cleanup=void 0,this._observer=e,this._queue=void 0,this._state="initializing";var i=new Av(this);try{this._cleanup=t.call(void 0,i)}catch(e){i.error(e)}"initializing"===this._state&&(this._state="ready")}return e.prototype.unsubscribe=function(){"closed"!==this._state&&(Iv(this),bv(this))},lv(e,[{key:"closed",get:function(){return"closed"===this._state}}]),e}(),Av=function(){function e(e){this._subscription=e}var t=e.prototype;return t.next=function(e){Tv(this._subscription,"next",e)},t.error=function(e){Tv(this._subscription,"error",e)},t.complete=function(){Tv(this._subscription,"complete")},lv(e,[{key:"closed",get:function(){return"closed"===this._subscription._state}}]),e}(),Pv=function(){function e(t){if(!(this instanceof e))throw new TypeError("Observable cannot be called as a function");if("function"!=typeof t)throw new TypeError("Observable initializer must be a function");this._subscriber=t}var t=e.prototype;return t.subscribe=function(e){return"object"==typeof e&&null!==e||(e={next:e,error:arguments[1],complete:arguments[2]}),new Sv(e,this._subscriber)},t.forEach=function(e){var t=this;return new Promise((function(i,s){if("function"==typeof e)var r=t.subscribe({next:function(t){try{e(t,n)}catch(e){s(e),r.unsubscribe()}},error:s,complete:i});else s(new TypeError(e+" is not a function"));function n(){r.unsubscribe(),i()}}))},t.map=function(e){var t=this;if("function"!=typeof e)throw new TypeError(e+" is not a function");return new(gv(this))((function(i){return t.subscribe({next:function(t){try{t=e(t)}catch(e){return i.error(e)}i.next(t)},error:function(e){i.error(e)},complete:function(){i.complete()}})}))},t.filter=function(e){var t=this;if("function"!=typeof e)throw new TypeError(e+" is not a function");return new(gv(this))((function(i){return t.subscribe({next:function(t){try{if(!e(t))return}catch(e){return i.error(e)}i.next(t)},error:function(e){i.error(e)},complete:function(){i.complete()}})}))},t.reduce=function(e){var t=this;if("function"!=typeof e)throw new TypeError(e+" is not a function");var i=gv(this),s=arguments.length>1,r=!1,n=arguments[1];return new i((function(i){return t.subscribe({next:function(t){var o=!r;if(r=!0,!o||s)try{n=e(n,t)}catch(e){return i.error(e)}else n=t},error:function(e){i.error(e)},complete:function(){if(!r&&!s)return i.error(new TypeError("Cannot reduce an empty sequence"));i.next(n),i.complete()}})}))},t.concat=function(){for(var e=this,t=arguments.length,i=new Array(t),s=0;s<t;s++)i[s]=arguments[s];var r=gv(this);return new r((function(t){var s,n=0;return function e(o){s=o.subscribe({next:function(e){t.next(e)},error:function(e){t.error(e)},complete:function(){n===i.length?(s=void 0,t.complete()):e(r.from(i[n++]))}})}(e),function(){s&&(s.unsubscribe(),s=void 0)}}))},t.flatMap=function(e){var t=this;if("function"!=typeof e)throw new TypeError(e+" is not a function");var i=gv(this);return new i((function(s){var r=[],n=t.subscribe({next:function(t){if(e)try{t=e(t)}catch(e){return s.error(e)}var n=i.from(t).subscribe({next:function(e){s.next(e)},error:function(e){s.error(e)},complete:function(){var e=r.indexOf(n);e>=0&&r.splice(e,1),o()}});r.push(n)},error:function(e){s.error(e)},complete:function(){o()}});function o(){n.closed&&0===r.length&&s.complete()}return function(){r.forEach((function(e){return e.unsubscribe()})),n.unsubscribe()}}))},t[_v]=function(){return this},e.from=function(t){var i="function"==typeof this?this:e;if(null==t)throw new TypeError(t+" is not an object");var s=fv(t,_v);if(s){var r=s.call(t);if(Object(r)!==r)throw new TypeError(r+" is not an object");return yv(r)&&r.constructor===i?r:new i((function(e){return r.subscribe(e)}))}if(uv("iterator")&&(s=fv(t,pv)))return new i((function(e){Ov((function(){if(!e.closed){for(var i,r=function(e,t){var i="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(i)return(i=i.call(e)).next.bind(i);if(Array.isArray(e)||(i=function(e,t){if(e){if("string"==typeof e)return av(e,t);var i=Object.prototype.toString.call(e).slice(8,-1);return"Object"===i&&e.constructor&&(i=e.constructor.name),"Map"===i||"Set"===i?Array.from(e):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?av(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){i&&(e=i);var s=0;return function(){return s>=e.length?{done:!0}:{done:!1,value:e[s++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(s.call(t));!(i=r()).done;){var n=i.value;if(e.next(n),e.closed)return}e.complete()}}))}));if(Array.isArray(t))return new i((function(e){Ov((function(){if(!e.closed){for(var i=0;i<t.length;++i)if(e.next(t[i]),e.closed)return;e.complete()}}))}));throw new TypeError(t+" is not observable")},e.of=function(){for(var t=arguments.length,i=new Array(t),s=0;s<t;s++)i[s]=arguments[s];return new("function"==typeof this?this:e)((function(e){Ov((function(){if(!e.closed){for(var t=0;t<i.length;++t)if(e.next(i[t]),e.closed)return;e.complete()}}))}))},lv(e,null,[{key:mv,get:function(){return this}}]),e}();dv()&&Object.defineProperty(Pv,Symbol("extensions"),{value:{symbol:_v,hostReportError:vv},configurable:!0}),function(e){var t,i=("undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof module?module:Function("return this")()).Symbol;if("function"==typeof i)if(i.observable)t=i.observable;else{t="function"==typeof i.for?i.for("https://github.com/benlesh/symbol-observable"):i("https://github.com/benlesh/symbol-observable");try{i.observable=t}catch(e){}}else t="@@observable"}();var wv=Pv.prototype,Cv="@@observable";wv[Cv]||(wv[Cv]=function(){return this});var Rv=Object.prototype.toString;function Lv(e){return Nv(e)}function Nv(e,t){switch(Rv.call(e)){case"[object Array]":if((t=t||new Map).has(e))return t.get(e);var i=e.slice(0);return t.set(e,i),i.forEach((function(e,s){i[s]=Nv(e,t)})),i;case"[object Object]":if((t=t||new Map).has(e))return t.get(e);var s=Object.create(Object.getPrototypeOf(e));return t.set(e,s),Object.keys(e).forEach((function(i){s[i]=Nv(e[i],t)})),s;default:return e}}function Dv(e){return!1!==globalThis.__DEV__&&(t=e,(i=new Set([t])).forEach((function(e){ng(e)&&function(e){if(!1!==globalThis.__DEV__&&!Object.isFrozen(e))try{Object.freeze(e)}catch(e){if(e instanceof TypeError)return null;throw e}return e}(e)===e&&Object.getOwnPropertyNames(e).forEach((function(t){ng(e[t])&&i.add(e[t])}))}))),e;var t,i}function Mv(e,t,i){var s=[];e.forEach((function(e){return e[t]&&s.push(e)})),s.forEach((function(e){return e[t](i)}))}function xv(e,t,i){return new Pv((function(s){var r={then:function(e){return new Promise((function(t){return t(e())}))}};function n(e,t){return function(i){if(e){var n=function(){return s.closed?0:e(i)};r=r.then(n,n).then((function(e){return s.next(e)}),(function(e){return s.error(e)}))}else s[t](i)}}var o={next:n(t,"next"),error:n(i,"error"),complete:function(){r.then((function(){return s.complete()}))}},a=e.subscribe(o);return function(){return a.unsubscribe()}}))}function kv(e){function t(t){Object.defineProperty(e,t,{value:Pv})}return sg&&Symbol.species&&t(Symbol.species),t("@@species"),e}function Hv(e){return e&&"function"==typeof e.then}var jv=function(e){function t(t){var i=e.call(this,(function(e){return i.addObserver(e),function(){return i.removeObserver(e)}}))||this;return i.observers=new Set,i.promise=new Promise((function(e,t){i.resolve=e,i.reject=t})),i.handlers={next:function(e){null!==i.sub&&(i.latest=["next",e],i.notify("next",e),Mv(i.observers,"next",e))},error:function(e){var t=i.sub;null!==t&&(t&&setTimeout((function(){return t.unsubscribe()})),i.sub=null,i.latest=["error",e],i.reject(e),i.notify("error",e),Mv(i.observers,"error",e))},complete:function(){var e=i,t=e.sub,s=e.sources;if(null!==t){var r=(void 0===s?[]:s).shift();r?Hv(r)?r.then((function(e){return i.sub=e.subscribe(i.handlers)}),i.handlers.error):i.sub=r.subscribe(i.handlers):(t&&setTimeout((function(){return t.unsubscribe()})),i.sub=null,i.latest&&"next"===i.latest[0]?i.resolve(i.latest[1]):i.resolve(),i.notify("complete"),Mv(i.observers,"complete"))}}},i.nextResultListeners=new Set,i.cancel=function(e){i.reject(e),i.sources=[],i.handlers.error(e)},i.promise.catch((function(e){})),"function"==typeof t&&(t=[new Pv(t)]),Hv(t)?t.then((function(e){return i.start(e)}),i.handlers.error):i.start(t),i}return nm(t,e),t.prototype.start=function(e){void 0===this.sub&&(this.sources=Array.from(e),this.handlers.complete())},t.prototype.deliverLastMessage=function(e){if(this.latest){var t=this.latest[0],i=e[t];i&&i.call(e,this.latest[1]),null===this.sub&&"next"===t&&e.complete&&e.complete()}},t.prototype.addObserver=function(e){this.observers.has(e)||(this.deliverLastMessage(e),this.observers.add(e))},t.prototype.removeObserver=function(e){this.observers.delete(e)&&this.observers.size<1&&this.handlers.complete()},t.prototype.notify=function(e,t){var i=this.nextResultListeners;i.size&&(this.nextResultListeners=new Set,i.forEach((function(i){return i(e,t)})))},t.prototype.beforeNext=function(e){var t=!1;this.nextResultListeners.add((function(i,s){t||(t=!0,e(i,s))}))},t}(Pv);function Uv(e){return"incremental"in e}function Bv(e){return ng(e)&&"payload"in e}function Fv(e,t){var i=e,s=new ov;return Uv(t)&&zy(t.incremental)&&t.incremental.forEach((function(e){for(var t=e.data,r=e.path,n=r.length-1;n>=0;--n){var o=r[n],a=isNaN(+o)?{}:[];a[o]=t,t=a}i=s.merge(i,t)})),i}function Vv(e){return zy(Kv(e))}function Kv(e){var t=zy(e.errors)?e.errors.slice(0):[];return Uv(e)&&zy(e.incremental)&&e.incremental.forEach((function(e){e.errors&&t.push.apply(t,e.errors)})),t}function Gv(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var i=Object.create(null);return e.forEach((function(e){e&&Object.keys(e).forEach((function(t){var s=e[t];void 0!==s&&(i[t]=s)}))})),i}function $v(e,t){return Gv(e,t,t.variables&&{variables:Gv(om(om({},e&&e.variables),t.variables))})}function Wv(e){return new Pv((function(t){t.error(e)}))}kv(jv);var zv=function(e,t,i){var s=new Error(i);throw s.name="ServerError",s.response=e,s.statusCode=e.status,s.result=t,s};function qv(e,t){return t?t(e):Pv.of()}function Yv(e){return"function"==typeof e?new Jv(e):e}function Qv(e){return e.request.length<=1}var Jv=function(){function e(e){e&&(this.request=e)}return e.empty=function(){return new e((function(){return Pv.of()}))},e.from=function(t){return 0===t.length?e.empty():t.map(Yv).reduce((function(e,t){return e.concat(t)}))},e.split=function(t,i,s){var r,n=Yv(i),o=Yv(s||new e(qv));return r=Qv(n)&&Qv(o)?new e((function(e){return t(e)?n.request(e)||Pv.of():o.request(e)||Pv.of()})):new e((function(e,i){return t(e)?n.request(e,i)||Pv.of():o.request(e,i)||Pv.of()})),Object.assign(r,{left:n,right:o})},e.execute=function(e,t){return e.request(function(e,t){var i=om({},e);return Object.defineProperty(t,"setContext",{enumerable:!1,value:function(e){i=om(om({},i),"function"==typeof e?e(i):e)}}),Object.defineProperty(t,"getContext",{enumerable:!1,value:function(){return om({},i)}}),t}(t.context,function(e){var t={variables:e.variables||{},extensions:e.extensions||{},operationName:e.operationName,query:e.query};return t.operationName||(t.operationName="string"!=typeof t.query?Qg(t.query)||void 0:""),t}(function(e){for(var t=["query","operationName","variables","extensions","context"],i=0,s=Object.keys(e);i<s.length;i++){var r=s[i];if(t.indexOf(r)<0)throw Cm(44,r)}return e}(t))))||Pv.of()},e.concat=function(t,i){var s=Yv(t);if(Qv(s))return!1!==globalThis.__DEV__&&wm.warn(36,s),s;var r,n=Yv(i);return r=Qv(n)?new e((function(e){return s.request(e,(function(e){return n.request(e)||Pv.of()}))||Pv.of()})):new e((function(e,t){return s.request(e,(function(e){return n.request(e,t)||Pv.of()}))||Pv.of()})),Object.assign(r,{left:s,right:n})},e.prototype.split=function(t,i,s){return this.concat(e.split(t,i,s||new e(qv)))},e.prototype.concat=function(t){return e.concat(this,t)},e.prototype.request=function(e,t){throw Cm(37)},e.prototype.onError=function(e,t){if(t&&t.error)return t.error(e),!1;throw e},e.prototype.setOnError=function(e){return this.onError=e,this},e}(),Xv=Jv.from,Zv=Jv.execute;function eO(e){var t={next:function(){return e.read()}};return rg&&(t[Symbol.asyncIterator]=function(){return this}),t}function tO(e){var t,i,s,r,n=e;if(e.body&&(n=e.body),r=n,rg&&r[Symbol.asyncIterator])return function(e){var t,i=e[Symbol.asyncIterator]();return(t={next:function(){return i.next()}})[Symbol.asyncIterator]=function(){return this},t}(n);if(function(e){return!!e.getReader}(n))return eO(n.getReader());if(function(e){return!!e.stream}(n))return eO(n.stream().getReader());if(function(e){return!!e.arrayBuffer}(n))return t=n.arrayBuffer(),i=!1,s={next:function(){return i?Promise.resolve({value:void 0,done:!0}):(i=!0,new Promise((function(e,i){t.then((function(t){e({value:t,done:!1})})).catch(i)})))}},rg&&(s[Symbol.asyncIterator]=function(){return this}),s;if(function(e){return!!e.pipe}(n))return function(e){var t=null,i=null,s=!1,r=[],n=[];function o(e){if(!i){if(n.length){var t=n.shift();if(Array.isArray(t)&&t[0])return t[0]({value:e,done:!1})}r.push(e)}}function a(e){i=e,n.slice().forEach((function(t){t[1](e)})),!t||t()}function c(){s=!0,n.slice().forEach((function(e){e[0]({value:void 0,done:!0})})),!t||t()}t=function(){t=null,e.removeListener("data",o),e.removeListener("error",a),e.removeListener("end",c),e.removeListener("finish",c),e.removeListener("close",c)},e.on("data",o),e.on("error",a),e.on("end",c),e.on("finish",c),e.on("close",c);var l={next:function(){return new Promise((function(e,t){return i?t(i):r.length?e({value:r.shift(),done:!1}):s?e({value:void 0,done:!0}):void n.push([e,t])}))}};return rg&&(l[Symbol.asyncIterator]=function(){return this}),l}(n);throw new Error("Unknown body type for responseIterator. Please pass a streamable response.")}var iO=Symbol();function sO(e){return e.hasOwnProperty("graphQLErrors")}var rO=function(e){function t(i){var s,r,n=i.graphQLErrors,o=i.protocolErrors,a=i.clientErrors,c=i.networkError,l=i.errorMessage,d=i.extraInfo,u=e.call(this,l)||this;return u.name="ApolloError",u.graphQLErrors=n||[],u.protocolErrors=o||[],u.clientErrors=a||[],u.networkError=c||null,u.message=l||(r=dm(dm(dm([],(s=u).graphQLErrors,!0),s.clientErrors,!0),s.protocolErrors,!0),s.networkError&&r.push(s.networkError),r.map((function(e){return ng(e)&&e.message||"Error message not found."})).join("\n")),u.extraInfo=d,u.cause=dm(dm(dm([c],n||[],!0),o||[],!0),a||[],!0).find((function(e){return!!e}))||null,u.__proto__=t.prototype,u}return nm(t,e),t}(Error),nO=Object.prototype.hasOwnProperty;function oO(e){var t={};return e.split("\n").forEach((function(e){var i=e.indexOf(":");if(i>-1){var s=e.slice(0,i).trim().toLowerCase(),r=e.slice(i+1).trim();t[s]=r}})),t}function aO(e,t){e.status>=300&&zv(e,function(){try{return JSON.parse(t)}catch(e){return t}}(),"Response not successful: Received status code ".concat(e.status));try{return JSON.parse(t)}catch(s){var i=s;throw i.name="ServerParseError",i.response=e,i.statusCode=e.status,i.bodyText=t,i}}var cO=function(e,t){var i;try{i=JSON.stringify(e)}catch(e){var s=Cm(40,t,e.message);throw s.parseError=e,s}return i},lO={http:{includeQuery:!0,includeExtensions:!1,preserveHeaderCase:!1},headers:{accept:"*/*","content-type":"application/json"},options:{method:"POST"}},dO=function(e,t){return t(e)};function uO(e,t){for(var i=[],s=2;s<arguments.length;s++)i[s-2]=arguments[s];var r={},n={};i.forEach((function(e){r=om(om(om({},r),e.options),{headers:om(om({},r.headers),e.headers)}),e.credentials&&(r.credentials=e.credentials),n=om(om({},n),e.http)})),r.headers&&(r.headers=function(e,t){if(!t){var i={};return Object.keys(Object(e)).forEach((function(t){i[t.toLowerCase()]=e[t]})),i}var s={};Object.keys(Object(e)).forEach((function(t){s[t.toLowerCase()]={originalName:t,value:e[t]}}));var r={};return Object.keys(s).forEach((function(e){r[s[e].originalName]=s[e].value})),r}(r.headers,n.preserveHeaderCase));var o=e.operationName,a=e.extensions,c=e.variables,l=e.query,d={operationName:o,variables:c};return n.includeExtensions&&(d.extensions=a),n.includeQuery&&(d.query=t(l,$y)),{options:r,body:d}}var hO=Im((function(){return fetch})),pO=function(e){function t(t){void 0===t&&(t={});var i=e.call(this,function(e){void 0===e&&(e={});var t=e.uri,i=void 0===t?"/graphql":t,s=e.fetch,r=e.print,n=void 0===r?dO:r,o=e.includeExtensions,a=e.preserveHeaderCase,c=e.useGETForQueries,l=e.includeUnusedVariables,d=void 0!==l&&l,u=am(e,["uri","fetch","print","includeExtensions","preserveHeaderCase","useGETForQueries","includeUnusedVariables"]);!1!==globalThis.__DEV__&&function(e){if(!e&&"undefined"==typeof fetch)throw Cm(38)}(s||hO);var h={http:{includeExtensions:o,preserveHeaderCase:a},options:u.fetchOptions,credentials:u.credentials,headers:u.headers};return new Jv((function(e){var t=function(e,t){return e.getContext().uri||("function"==typeof t?t(e):t||"/graphql")}(e,i),r=e.getContext(),o={};if(r.clientAwareness){var a=r.clientAwareness,l=a.name,u=a.version;l&&(o["apollographql-client-name"]=l),u&&(o["apollographql-client-version"]=u)}var p=om(om({},o),r.headers),_={http:r.http,options:r.fetchOptions,credentials:r.credentials,headers:p};if(zf(["client"],e.query)){var m=tv(e.query);if(!m)return Wv(new Error("HttpLink: Trying to send a client-only query to the server. To send to the server, ensure a non-client field is added to the query or set the `transformOptions.removeClientFields` option to `true`."));e.query=m}var f,g,y,v,O,b=uO(e,n,lO,h,_),I=b.options,E=b.body;E.variables&&!d&&(E.variables=(g=E.variables,y=e.query,v=om({},g),O=new Set(Object.keys(g)),Hf(y,{Variable:function(e,t,i){i&&"VariableDefinition"!==i.kind&&O.delete(e.name.value)}}),O.forEach((function(e){delete v[e]})),v)),I.signal||"undefined"==typeof AbortController||(f=new AbortController,I.signal=f.signal);var T,S="OperationDefinition"===(T=Zg(e.query)).kind&&"subscription"===T.operation,A=zf(["defer"],e.query);if(c&&!e.query.definitions.some((function(e){return"OperationDefinition"===e.kind&&"mutation"===e.operation}))&&(I.method="GET"),A||S){I.headers=I.headers||{};var P="multipart/mixed;";S&&A&&!1!==globalThis.__DEV__&&wm.warn(39),S?P+="boundary=graphql;subscriptionSpec=1.0,application/json":A&&(P+="deferSpec=20220824,application/json"),I.headers.accept=P}if("GET"===I.method){var w=function(e,t){var i=[],s=function(e,t){i.push("".concat(e,"=").concat(encodeURIComponent(t)))};if("query"in t&&s("query",t.query),t.operationName&&s("operationName",t.operationName),t.variables){var r=void 0;try{r=cO(t.variables,"Variables map")}catch(e){return{parseError:e}}s("variables",r)}if(t.extensions){var n=void 0;try{n=cO(t.extensions,"Extensions map")}catch(e){return{parseError:e}}s("extensions",n)}var o="",a=e,c=e.indexOf("#");-1!==c&&(o=e.substr(c),a=e.substr(0,c));var l=-1===a.indexOf("?")?"?":"&";return{newURI:a+l+i.join("&")+o}}(t,E),C=w.newURI,R=w.parseError;if(R)return Wv(R);t=C}else try{I.body=cO(E,"Payload")}catch(R){return Wv(R)}return new Pv((function(i){var r=s||Im((function(){return fetch}))||hO,n=i.next.bind(i);return r(t,I).then((function(t){var i;e.setContext({response:t});var s,r=null===(i=t.headers)||void 0===i?void 0:i.get("content-type");return null!==r&&/^multipart\/mixed/i.test(r)?function(e,t){return cm(this,void 0,void 0,(function(){var i,s,r,n,o,a,c,l,d,u,h,p,_,m,f,g,y,v,O,b,I,E,T,S;return lm(this,(function(A){switch(A.label){case 0:if(void 0===TextDecoder)throw new Error("TextDecoder must be defined in the environment: please import a polyfill.");i=new TextDecoder("utf-8"),s=null===(S=e.headers)||void 0===S?void 0:S.get("content-type"),r="boundary=",n=(null==s?void 0:s.includes(r))?null==s?void 0:s.substring((null==s?void 0:s.indexOf(r))+9).replace(/['"]/g,"").replace(/\;(.*)/gm,"").trim():"-",o="\r\n--".concat(n),a="",c=tO(e),l=!0,A.label=1;case 1:return l?[4,c.next()]:[3,3];case 2:for(d=A.sent(),u=d.value,h=d.done,p="string"==typeof u?u:i.decode(u),_=a.length-o.length+1,l=!h,m=(a+=p).indexOf(o,_);m>-1;){if(f=void 0,E=[a.slice(0,m),a.slice(m+o.length)],a=E[1],g=(f=E[0]).indexOf("\r\n\r\n"),y=oO(f.slice(0,g)),(v=y["content-type"])&&-1===v.toLowerCase().indexOf("application/json"))throw new Error("Unsupported patch content type: application/json is required.");if(O=f.slice(g))if(b=aO(e,O),Object.keys(b).length>1||"data"in b||"incremental"in b||"errors"in b||"payload"in b)if(Bv(b)){if(I={},"payload"in b){if(1===Object.keys(b).length&&null===b.payload)return[2];I=om({},b.payload)}"errors"in b&&(I=om(om({},I),{extensions:om(om({},"extensions"in I?I.extensions:null),(T={},T[iO]=b.errors,T))})),t(I)}else t(b);else if(1===Object.keys(b).length&&"hasNext"in b&&!b.hasNext)return[2];m=a.indexOf(o)}return[3,1];case 3:return[2]}}))}))}(t,n):(s=e,function(e){return e.text().then((function(t){return aO(e,t)})).then((function(t){return Array.isArray(t)||nO.call(t,"data")||nO.call(t,"errors")||zv(e,t,"Server response was missing for query '".concat(Array.isArray(s)?s.map((function(e){return e.operationName})):s.operationName,"'.")),t}))})(t).then(n)})).then((function(){f=void 0,i.complete()})).catch((function(e){f=void 0,function(e,t){e.result&&e.result.errors&&e.result.data&&t.next(e.result),t.error(e)}(e,i)})),function(){f&&f.abort()}}))}))}(t).request)||this;return i.options=t,i}return nm(t,e),t}(Jv);const{toString:_O,hasOwnProperty:mO}=Object.prototype,fO=Function.prototype.toString,gO=new Map;function yO(e,t){try{return vO(e,t)}finally{gO.clear()}}function vO(e,t){if(e===t)return!0;const i=_O.call(e);if(i!==_O.call(t))return!1;switch(i){case"[object Array]":if(e.length!==t.length)return!1;case"[object Object]":{if(EO(e,t))return!0;const i=OO(e),s=OO(t),r=i.length;if(r!==s.length)return!1;for(let e=0;e<r;++e)if(!mO.call(t,i[e]))return!1;for(let s=0;s<r;++s){const r=i[s];if(!vO(e[r],t[r]))return!1}return!0}case"[object Error]":return e.name===t.name&&e.message===t.message;case"[object Number]":if(e!=e)return t!=t;case"[object Boolean]":case"[object Date]":return+e==+t;case"[object RegExp]":case"[object String]":return e==`${t}`;case"[object Map]":case"[object Set]":{if(e.size!==t.size)return!1;if(EO(e,t))return!0;const s=e.entries(),r="[object Map]"===i;for(;;){const e=s.next();if(e.done)break;const[i,n]=e.value;if(!t.has(i))return!1;if(r&&!vO(n,t.get(i)))return!1}return!0}case"[object Uint16Array]":case"[object Uint8Array]":case"[object Uint32Array]":case"[object Int32Array]":case"[object Int8Array]":case"[object Int16Array]":case"[object ArrayBuffer]":e=new Uint8Array(e),t=new Uint8Array(t);case"[object DataView]":{let i=e.byteLength;if(i===t.byteLength)for(;i--&&e[i]===t[i];);return-1===i}case"[object AsyncFunction]":case"[object GeneratorFunction]":case"[object AsyncGeneratorFunction]":case"[object Function]":{const i=fO.call(e);return i===fO.call(t)&&!function(e,t){const i=e.length-t.length;return i>=0&&e.indexOf(t,i)===i}(i,IO)}}return!1}function OO(e){return Object.keys(e).filter(bO,e)}function bO(e){return void 0!==this[e]}const IO="{ [native code] }";function EO(e,t){let i=gO.get(e);if(i){if(i.has(t))return!0}else gO.set(e,i=new Set);return i.add(t),!1}function TO(e,t,i,s){var r=t.data,n=am(t,["data"]),o=i.data;return yO(n,am(i,["data"]))&&SO(Zg(e).selectionSet,r,o,{fragmentMap:ag(Jg(e)),variables:s})}function SO(e,t,i,s){if(t===i)return!0;var r=new Set;return e.selections.every((function(e){if(r.has(e))return!0;if(r.add(e),!Wf(e,s.variables))return!0;if(AO(e))return!0;if(zg(e)){var n=$g(e),o=t&&t[n],a=i&&i[n],c=e.selectionSet;if(!c)return yO(o,a);var l=Array.isArray(o),d=Array.isArray(a);if(l!==d)return!1;if(l&&d){var u=o.length;if(a.length!==u)return!1;for(var h=0;h<u;++h)if(!SO(c,o[h],a[h],s))return!1;return!0}return SO(c,o,a,s)}var p=cg(e,s.fragmentMap);return p?!!AO(p)||SO(p.selectionSet,t,i,s):void 0}))}function AO(e){return!!e.directives&&e.directives.some(PO)}function PO(e){return"nonreactive"===e.name.value}var wO=function(){function e(){this.assumeImmutableResults=!1,this.getFragmentDoc=Fy(og,{max:Ig["cache.fragmentQueryDocuments"]||1e3,cache:fg})}return e.prototype.batch=function(e){var t,i=this,s="string"==typeof e.optimistic?e.optimistic:!1===e.optimistic?null:void 0;return this.performTransaction((function(){return t=e.update(i)}),s),t},e.prototype.recordOptimisticTransaction=function(e,t){this.performTransaction(e,t)},e.prototype.transformDocument=function(e){return e},e.prototype.transformForLink=function(e){return e},e.prototype.identify=function(e){},e.prototype.gc=function(){return[]},e.prototype.modify=function(e){return!1},e.prototype.readQuery=function(e,t){return void 0===t&&(t=!!e.optimistic),this.read(om(om({},e),{rootId:e.id||"ROOT_QUERY",optimistic:t}))},e.prototype.watchFragment=function(e){var t,i=this,s=e.fragment,r=e.fragmentName,n=e.from,o=e.optimistic,a=void 0===o||o,c=am(e,["fragment","fragmentName","from","optimistic"]),l=this.getFragmentDoc(s,r),d=om(om({},c),{returnPartialData:!0,id:void 0===n||"string"==typeof n?n:this.identify(n),query:l,optimistic:a});return new Pv((function(e){return i.watch(om(om({},d),{immediate:!0,callback:function(i){if(!t||!TO(l,{data:null==t?void 0:t.result},{data:i.result})){var s={data:i.result,complete:!!i.complete};i.missing&&(s.missing=rv(i.missing.map((function(e){return e.missing})))),t=i,e.next(s)}}}))}))},e.prototype.readFragment=function(e,t){return void 0===t&&(t=!!e.optimistic),this.read(om(om({},e),{query:this.getFragmentDoc(e.fragment,e.fragmentName),rootId:e.id,optimistic:t}))},e.prototype.writeQuery=function(e){var t=e.id,i=e.data,s=am(e,["id","data"]);return this.write(Object.assign(s,{dataId:t||"ROOT_QUERY",result:i}))},e.prototype.writeFragment=function(e){var t=e.id,i=e.data,s=e.fragment,r=e.fragmentName,n=am(e,["id","data","fragment","fragmentName"]);return this.write(Object.assign(n,{query:this.getFragmentDoc(s,r),dataId:t,result:i}))},e.prototype.updateQuery=function(e,t){return this.batch({update:function(i){var s=i.readQuery(e),r=t(s);return null==r?s:(i.writeQuery(om(om({},e),{data:r})),r)}})},e.prototype.updateFragment=function(e,t){return this.batch({update:function(i){var s=i.readFragment(e),r=t(s);return null==r?s:(i.writeFragment(om(om({},e),{data:r})),r)}})},e}();!1!==globalThis.__DEV__&&(wO.prototype.getMemoryInternals=Pg);var CO=function(e){function t(i,s,r,n){var o,a=e.call(this,i)||this;if(a.message=i,a.path=s,a.query=r,a.variables=n,Array.isArray(a.path)){a.missing=a.message;for(var c=a.path.length-1;c>=0;--c)a.missing=((o={})[a.path[c]]=a.missing,o)}else a.missing=a.path;return a.__proto__=t.prototype,a}return nm(t,e),t}(Error),RO=Object.prototype.hasOwnProperty;function LO(e){return null==e}function NO(e,t){var i=e.__typename,s=e.id,r=e._id;if("string"==typeof i&&(t&&(t.keyObject=LO(s)?LO(r)?void 0:{_id:r}:{id:s}),LO(s)&&!LO(r)&&(s=r),!LO(s)))return"".concat(i,":").concat("number"==typeof s||"string"==typeof s?s:JSON.stringify(s))}var DO={dataIdFromObject:NO,addTypename:!0,resultCaching:!0,canonizeResults:!1};function MO(e){var t=e.canonizeResults;return void 0===t?DO.canonizeResults:t}var xO=/^[_a-z][_0-9a-z]*/i;function kO(e){var t=e.match(xO);return t?t[0]:e}function HO(e,t,i){return!!ng(t)&&(Wy(t)?t.every((function(t){return HO(e,t,i)})):e.selections.every((function(e){if(zg(e)&&Wf(e,i)){var s=$g(e);return RO.call(t,s)&&(!e.selectionSet||HO(e.selectionSet,t[s],i))}return!0})))}function jO(e){return ng(e)&&!Ug(e)&&!Wy(e)}function UO(e,t){var i=ag(Jg(e));return{fragmentMap:i,lookupFragment:function(e){var s=i[e];return!s&&t&&(s=t.lookup(e)),s||null}}}var BO=Object.create(null),FO=function(){return BO},VO=Object.create(null),KO=function(){function e(e,t){var i=this;this.policies=e,this.group=t,this.data=Object.create(null),this.rootIds=Object.create(null),this.refs=Object.create(null),this.getFieldValue=function(e,t){return Dv(Ug(e)?i.get(e.__ref,t):e&&e[t])},this.canRead=function(e){return Ug(e)?i.has(e.__ref):"object"==typeof e},this.toReference=function(e,t){if("string"==typeof e)return jg(e);if(Ug(e))return e;var s=i.policies.identify(e)[0];if(s){var r=jg(s);return t&&i.merge(s,e),r}}}return e.prototype.toObject=function(){return om({},this.data)},e.prototype.has=function(e){return void 0!==this.lookup(e,!0)},e.prototype.get=function(e,t){if(this.group.depend(e,t),RO.call(this.data,e)){var i=this.data[e];if(i&&RO.call(i,t))return i[t]}return"__typename"===t&&RO.call(this.policies.rootTypenamesById,e)?this.policies.rootTypenamesById[e]:this instanceof zO?this.parent.get(e,t):void 0},e.prototype.lookup=function(e,t){return t&&this.group.depend(e,"__exists"),RO.call(this.data,e)?this.data[e]:this instanceof zO?this.parent.lookup(e,t):this.policies.rootTypenamesById[e]?Object.create(null):void 0},e.prototype.merge=function(e,t){var i,s=this;Ug(e)&&(e=e.__ref),Ug(t)&&(t=t.__ref);var r="string"==typeof e?this.lookup(i=e):e,n="string"==typeof t?this.lookup(i=t):t;if(n){wm("string"==typeof i,1);var o=new ov(YO).merge(r,n);if(this.data[i]=o,o!==r&&(delete this.refs[i],this.group.caching)){var a=Object.create(null);r||(a.__exists=1),Object.keys(n).forEach((function(e){if(!r||r[e]!==o[e]){a[e]=1;var t=kO(e);t===e||s.policies.hasKeyArgs(o.__typename,t)||(a[t]=1),void 0!==o[e]||s instanceof zO||delete o[e]}})),!a.__typename||r&&r.__typename||this.policies.rootTypenamesById[i]!==o.__typename||delete a.__typename,Object.keys(a).forEach((function(e){return s.group.dirty(i,e)}))}}},e.prototype.modify=function(e,t){var i=this,s=this.lookup(e);if(s){var r=Object.create(null),n=!1,o=!0,a={DELETE:BO,INVALIDATE:VO,isReference:Ug,toReference:this.toReference,canRead:this.canRead,readField:function(t,s){return i.policies.readField("string"==typeof t?{fieldName:t,from:s||jg(e)}:t,{store:i})}};if(Object.keys(s).forEach((function(c){var l=kO(c),d=s[c];if(void 0!==d){var u="function"==typeof t?t:t[c]||t[l];if(u){var h=u===FO?BO:u(Dv(d),om(om({},a),{fieldName:l,storeFieldName:c,storage:i.getStorage(e,c)}));if(h===VO)i.group.dirty(e,c);else if(h===BO&&(h=void 0),h!==d&&(r[c]=h,n=!0,d=h,!1!==globalThis.__DEV__)){var p=function(e){if(void 0===i.lookup(e.__ref))return!1!==globalThis.__DEV__&&wm.warn(2,e),!0};if(Ug(h))p(h);else if(Array.isArray(h))for(var _=!1,m=void 0,f=0,g=h;f<g.length;f++){var y=g[f];if(Ug(y)){if(_=!0,p(y))break}else"object"==typeof y&&y&&i.policies.identify(y)[0]&&(m=y);if(_&&void 0!==m){!1!==globalThis.__DEV__&&wm.warn(3,m);break}}}}void 0!==d&&(o=!1)}})),n)return this.merge(e,r),o&&(this instanceof zO?this.data[e]=void 0:delete this.data[e],this.group.dirty(e,"__exists")),!0}return!1},e.prototype.delete=function(e,t,i){var s,r=this.lookup(e);if(r){var n=this.getFieldValue(r,"__typename"),o=t&&i?this.policies.getStoreFieldName({typename:n,fieldName:t,args:i}):t;return this.modify(e,o?((s={})[o]=FO,s):FO)}return!1},e.prototype.evict=function(e,t){var i=!1;return e.id&&(RO.call(this.data,e.id)&&(i=this.delete(e.id,e.fieldName,e.args)),this instanceof zO&&this!==t&&(i=this.parent.evict(e,t)||i),(e.fieldName||i)&&this.group.dirty(e.id,e.fieldName||"__exists")),i},e.prototype.clear=function(){this.replace(null)},e.prototype.extract=function(){var e=this,t=this.toObject(),i=[];return this.getRootIdSet().forEach((function(t){RO.call(e.policies.rootTypenamesById,t)||i.push(t)})),i.length&&(t.__META={extraRootIds:i.sort()}),t},e.prototype.replace=function(e){var t=this;if(Object.keys(this.data).forEach((function(i){e&&RO.call(e,i)||t.delete(i)})),e){var i=e.__META,s=am(e,["__META"]);Object.keys(s).forEach((function(e){t.merge(e,s[e])})),i&&i.extraRootIds.forEach(this.retain,this)}},e.prototype.retain=function(e){return this.rootIds[e]=(this.rootIds[e]||0)+1},e.prototype.release=function(e){if(this.rootIds[e]>0){var t=--this.rootIds[e];return t||delete this.rootIds[e],t}return 0},e.prototype.getRootIdSet=function(e){return void 0===e&&(e=new Set),Object.keys(this.rootIds).forEach(e.add,e),this instanceof zO?this.parent.getRootIdSet(e):Object.keys(this.policies.rootTypenamesById).forEach(e.add,e),e},e.prototype.gc=function(){var e=this,t=this.getRootIdSet(),i=this.toObject();t.forEach((function(s){RO.call(i,s)&&(Object.keys(e.findChildRefIds(s)).forEach(t.add,t),delete i[s])}));var s=Object.keys(i);if(s.length){for(var r=this;r instanceof zO;)r=r.parent;s.forEach((function(e){return r.delete(e)}))}return s},e.prototype.findChildRefIds=function(e){if(!RO.call(this.refs,e)){var t=this.refs[e]=Object.create(null),i=this.data[e];if(!i)return t;var s=new Set([i]);s.forEach((function(e){Ug(e)&&(t[e.__ref]=!0),ng(e)&&Object.keys(e).forEach((function(t){var i=e[t];ng(i)&&s.add(i)}))}))}return this.refs[e]},e.prototype.makeCacheKey=function(){return this.group.keyMaker.lookupArray(arguments)},e}(),GO=function(){function e(e,t){void 0===t&&(t=null),this.caching=e,this.parent=t,this.d=null,this.resetCaching()}return e.prototype.resetCaching=function(){this.d=this.caching?Hy():null,this.keyMaker=new Zf(tg)},e.prototype.depend=function(e,t){if(this.d){this.d($O(e,t));var i=kO(t);i!==t&&this.d($O(e,i)),this.parent&&this.parent.depend(e,t)}},e.prototype.dirty=function(e,t){this.d&&this.d.dirty($O(e,t),"__exists"===t?"forget":"setDirty")},e}();function $O(e,t){return t+"#"+e}function WO(e,t){QO(e)&&e.group.depend(t,"__exists")}!function(e){var t=function(e){function t(t){var i=t.policies,s=t.resultCaching,r=void 0===s||s,n=t.seed,o=e.call(this,i,new GO(r))||this;return o.stump=new qO(o),o.storageTrie=new Zf(tg),n&&o.replace(n),o}return nm(t,e),t.prototype.addLayer=function(e,t){return this.stump.addLayer(e,t)},t.prototype.removeLayer=function(){return this},t.prototype.getStorage=function(){return this.storageTrie.lookupArray(arguments)},t}(e);e.Root=t}(KO||(KO={}));var zO=function(e){function t(t,i,s,r){var n=e.call(this,i.policies,r)||this;return n.id=t,n.parent=i,n.replay=s,n.group=r,s(n),n}return nm(t,e),t.prototype.addLayer=function(e,i){return new t(e,this,i,this.group)},t.prototype.removeLayer=function(e){var t=this,i=this.parent.removeLayer(e);return e===this.id?(this.group.caching&&Object.keys(this.data).forEach((function(e){var s=t.data[e],r=i.lookup(e);r?s?s!==r&&Object.keys(s).forEach((function(i){yO(s[i],r[i])||t.group.dirty(e,i)})):(t.group.dirty(e,"__exists"),Object.keys(r).forEach((function(i){t.group.dirty(e,i)}))):t.delete(e)})),i):i===this.parent?this:i.addLayer(this.id,this.replay)},t.prototype.toObject=function(){return om(om({},this.parent.toObject()),this.data)},t.prototype.findChildRefIds=function(t){var i=this.parent.findChildRefIds(t);return RO.call(this.data,t)?om(om({},i),e.prototype.findChildRefIds.call(this,t)):i},t.prototype.getStorage=function(){for(var e=this.parent;e.parent;)e=e.parent;return e.getStorage.apply(e,arguments)},t}(KO),qO=function(e){function t(t){return e.call(this,"EntityStore.Stump",t,(function(){}),new GO(t.group.caching,t.group))||this}return nm(t,e),t.prototype.removeLayer=function(){return this},t.prototype.merge=function(e,t){return this.parent.merge(e,t)},t}(zO);function YO(e,t,i){var s=e[i],r=t[i];return yO(s,r)?s:r}function QO(e){return!!(e instanceof KO&&e.group.caching)}var JO=function(){function e(){this.known=new(ig?WeakSet:Set),this.pool=new Zf(tg),this.passes=new WeakMap,this.keysByJSON=new Map,this.empty=this.admit({})}return e.prototype.isKnown=function(e){return ng(e)&&this.known.has(e)},e.prototype.pass=function(e){if(ng(e)){var t=function(e){return ng(e)?Wy(e)?e.slice(0):om({__proto__:Object.getPrototypeOf(e)},e):e}(e);return this.passes.set(t,e),t}return e},e.prototype.admit=function(e){var t=this;if(ng(e)){var i=this.passes.get(e);if(i)return i;switch(Object.getPrototypeOf(e)){case Array.prototype:if(this.known.has(e))return e;var s=e.map(this.admit,this);return(a=this.pool.lookupArray(s)).array||(this.known.add(a.array=s),!1!==globalThis.__DEV__&&Object.freeze(s)),a.array;case null:case Object.prototype:if(this.known.has(e))return e;var r=Object.getPrototypeOf(e),n=[r],o=this.sortedKeys(e);n.push(o.json);var a,c=n.length;if(o.sorted.forEach((function(i){n.push(t.admit(e[i]))})),!(a=this.pool.lookupArray(n)).object){var l=a.object=Object.create(r);this.known.add(l),o.sorted.forEach((function(e,t){l[e]=n[c+t]})),!1!==globalThis.__DEV__&&Object.freeze(l)}return a.object}}return e},e.prototype.sortedKeys=function(e){var t=Object.keys(e),i=this.pool.lookupArray(t);if(!i.keys){t.sort();var s=JSON.stringify(t);(i.keys=this.keysByJSON.get(s))||this.keysByJSON.set(s,i.keys={sorted:t,json:s})}return i.keys},e}();function XO(e){return[e.selectionSet,e.objectOrReference,e.context,e.context.canonizeResults]}var ZO=function(){function e(e){var t=this;this.knownResults=new(tg?WeakMap:Map),this.config=Gv(e,{addTypename:!1!==e.addTypename,canonizeResults:MO(e)}),this.canon=e.canon||new JO,this.executeSelectionSet=Fy((function(e){var i,s=e.context.canonizeResults,r=XO(e);r[3]=!s;var n=(i=t.executeSelectionSet).peek.apply(i,r);return n?s?om(om({},n),{result:t.canon.admit(n.result)}):n:(WO(e.context.store,e.enclosingRef.__ref),t.execSelectionSetImpl(e))}),{max:this.config.resultCacheMaxSize||Ig["inMemoryCache.executeSelectionSet"]||5e4,keyArgs:XO,makeCacheKey:function(e,t,i,s){if(QO(i.store))return i.store.makeCacheKey(e,Ug(t)?t.__ref:t,i.varString,s)}}),this.executeSubSelectedArray=Fy((function(e){return WO(e.context.store,e.enclosingRef.__ref),t.execSubSelectedArrayImpl(e)}),{max:this.config.resultCacheMaxSize||Ig["inMemoryCache.executeSubSelectedArray"]||1e4,makeCacheKey:function(e){var t=e.field,i=e.array,s=e.context;if(QO(s.store))return s.store.makeCacheKey(t,i,s.varString)}})}return e.prototype.resetCanon=function(){this.canon=new JO},e.prototype.diffQueryAgainstStore=function(e){var t=e.store,i=e.query,s=e.rootId,r=void 0===s?"ROOT_QUERY":s,n=e.variables,o=e.returnPartialData,a=void 0===o||o,c=e.canonizeResults,l=void 0===c?this.config.canonizeResults:c,d=this.config.cache.policies;n=om(om({},ey(Xg(i))),n);var u,h=jg(r),p=this.executeSelectionSet({selectionSet:Zg(i).selectionSet,objectOrReference:h,enclosingRef:h,context:om({store:t,query:i,policies:d,variables:n,varString:xg(n),canonizeResults:l},UO(i,this.config.fragments))});if(p.missing&&(u=[new CO(eb(p.missing),p.missing,i,n)],!a))throw u[0];return{result:p.result,complete:!u,missing:u}},e.prototype.isFresh=function(e,t,i,s){if(QO(s.store)&&this.knownResults.get(e)===i){var r=this.executeSelectionSet.peek(i,t,s,this.canon.isKnown(e));if(r&&e===r.result)return!0}return!1},e.prototype.execSelectionSetImpl=function(e){var t=this,i=e.selectionSet,s=e.objectOrReference,r=e.enclosingRef,n=e.context;if(Ug(s)&&!n.policies.rootTypenamesById[s.__ref]&&!n.store.has(s.__ref))return{result:this.canon.empty,missing:"Dangling reference to missing ".concat(s.__ref," object")};var o,a=n.variables,c=n.policies,l=n.store.getFieldValue(s,"__typename"),d=[],u=new ov;function h(e,t){var i;return e.missing&&(o=u.merge(o,((i={})[t]=e.missing,i))),e.result}this.config.addTypename&&"string"==typeof l&&!c.rootIdsByTypename[l]&&d.push({__typename:l});var p=new Set(i.selections);p.forEach((function(e){var i,_;if(Wf(e,a))if(zg(e)){var m=c.readField({fieldName:e.name.value,field:e,variables:n.variables,from:s},n),f=$g(e);void 0===m?Zy.added(e)||(o=u.merge(o,((i={})[f]="Can't find field '".concat(e.name.value,"' on ").concat(Ug(s)?s.__ref+" object":"object "+JSON.stringify(s,null,2)),i))):Wy(m)?m.length>0&&(m=h(t.executeSubSelectedArray({field:e,array:m,enclosingRef:r,context:n}),f)):e.selectionSet?null!=m&&(m=h(t.executeSelectionSet({selectionSet:e.selectionSet,objectOrReference:m,enclosingRef:Ug(m)?m:r,context:n}),f)):n.canonizeResults&&(m=t.canon.pass(m)),void 0!==m&&d.push(((_={})[f]=m,_))}else{var g=cg(e,n.lookupFragment);if(!g&&e.kind===Qm.FRAGMENT_SPREAD)throw Cm(9,e.name.value);g&&c.fragmentMatches(g,l)&&g.selectionSet.selections.forEach(p.add,p)}}));var _={result:rv(d),missing:o},m=n.canonizeResults?this.canon.admit(_):Dv(_);return m.result&&this.knownResults.set(m.result,i),m},e.prototype.execSubSelectedArrayImpl=function(e){var t,i=this,s=e.field,r=e.array,n=e.enclosingRef,o=e.context,a=new ov;function c(e,i){var s;return e.missing&&(t=a.merge(t,((s={})[i]=e.missing,s))),e.result}return s.selectionSet&&(r=r.filter(o.store.canRead)),r=r.map((function(e,t){return null===e?null:Wy(e)?c(i.executeSubSelectedArray({field:s,array:e,enclosingRef:n,context:o}),t):s.selectionSet?c(i.executeSelectionSet({selectionSet:s.selectionSet,objectOrReference:e,enclosingRef:Ug(e)?e:n,context:o}),t):(!1!==globalThis.__DEV__&&function(e,t,i){if(!t.selectionSet){var s=new Set([i]);s.forEach((function(i){ng(i)&&(wm(!Ug(i),10,function(e,t){return Ug(t)?e.get(t.__ref,"__typename"):t&&t.__typename}(e,i),t.name.value),Object.values(i).forEach(s.add,s))}))}}(o.store,s,e),e)})),{result:o.canonizeResults?this.canon.admit(r):r,missing:t}},e}();function eb(e){try{JSON.stringify(e,(function(e,t){if("string"==typeof t)throw t;return t}))}catch(e){return e}}var tb=new py,ib=new WeakMap;function sb(e){var t=ib.get(e);return t||ib.set(e,t={vars:new Set,dep:Hy()}),t}function rb(e){sb(e).vars.forEach((function(t){return t.forgetCache(e)}))}function nb(e){var t=new Set,i=new Set,s=function(n){if(arguments.length>0){if(e!==n){e=n,t.forEach((function(e){sb(e).dep.dirty(s),function(e){e.broadcastWatches&&e.broadcastWatches()}(e)}));var o=Array.from(i);i.clear(),o.forEach((function(t){return t(e)}))}}else{var a=tb.getValue();a&&(r(a),sb(a).dep(s))}return e};s.onNextChange=function(e){return i.add(e),function(){i.delete(e)}};var r=s.attachCache=function(e){return t.add(e),sb(e).vars.add(s),s};return s.forgetCache=function(e){return t.delete(e)},s}var ob=Object.create(null);function ab(e){var t=JSON.stringify(e);return ob[t]||(ob[t]=Object.create(null))}function cb(e){var t=ab(e);return t.keyFieldsFn||(t.keyFieldsFn=function(t,i){var s=function(e,t){return i.readField(t,e)},r=i.keyObject=db(e,(function(e){var r=pb(i.storeObject,e,s);return void 0===r&&t!==i.storeObject&&RO.call(t,e[0])&&(r=pb(t,e,hb)),wm(void 0!==r,4,e.join("."),t),r}));return"".concat(i.typename,":").concat(JSON.stringify(r))})}function lb(e){var t=ab(e);return t.keyArgsFn||(t.keyArgsFn=function(t,i){var s=i.field,r=i.variables,n=i.fieldName,o=db(e,(function(e){var i=e[0],n=i.charAt(0);if("@"!==n)if("$"!==n){if(t)return pb(t,e)}else{var o=i.slice(1);if(r&&RO.call(r,o)){var a=e.slice(0);return a[0]=o,pb(r,a)}}else if(s&&zy(s.directives)){var c=i.slice(1),l=s.directives.find((function(e){return e.name.value===c})),d=l&&Gg(l,r);return d&&pb(d,e.slice(1))}})),a=JSON.stringify(o);return(t||"{}"!==a)&&(n+=":"+a),n})}function db(e,t){var i=new ov;return ub(e).reduce((function(e,s){var r,n=t(s);if(void 0!==n){for(var o=s.length-1;o>=0;--o)(r={})[s[o]]=n,n=r;e=i.merge(e,n)}return e}),Object.create(null))}function ub(e){var t=ab(e);if(!t.paths){var i=t.paths=[],s=[];e.forEach((function(t,r){Wy(t)?(ub(t).forEach((function(e){return i.push(s.concat(e))})),s.length=0):(s.push(t),Wy(e[r+1])||(i.push(s.slice(0)),s.length=0))}))}return t.paths}function hb(e,t){return e[t]}function pb(e,t,i){return i=i||hb,_b(t.reduce((function e(t,s){return Wy(t)?t.map((function(t){return e(t,s)})):t&&i(t,s)}),e))}function _b(e){return ng(e)?Wy(e)?e.map(_b):db(Object.keys(e).sort(),(function(t){return pb(e,t)})):e}function mb(e){return void 0!==e.args?e.args:e.field?Gg(e.field,e.variables):null}var fb=function(){},gb=function(e,t){return t.fieldName},yb=function(e,t,i){return(0,i.mergeObjects)(e,t)},vb=function(e,t){return t},Ob=function(){function e(e){this.config=e,this.typePolicies=Object.create(null),this.toBeAdded=Object.create(null),this.supertypeMap=new Map,this.fuzzySubtypes=new Map,this.rootIdsByTypename=Object.create(null),this.rootTypenamesById=Object.create(null),this.usingPossibleTypes=!1,this.config=om({dataIdFromObject:NO},e),this.cache=this.config.cache,this.setRootTypename("Query"),this.setRootTypename("Mutation"),this.setRootTypename("Subscription"),e.possibleTypes&&this.addPossibleTypes(e.possibleTypes),e.typePolicies&&this.addTypePolicies(e.typePolicies)}return e.prototype.identify=function(e,t){var i,s=this,r=t&&(t.typename||(null===(i=t.storeObject)||void 0===i?void 0:i.__typename))||e.__typename;if(r===this.rootTypenamesById.ROOT_QUERY)return["ROOT_QUERY"];for(var n,o=t&&t.storeObject||e,a=om(om({},t),{typename:r,storeObject:o,readField:t&&t.readField||function(){var e=Ib(arguments,o);return s.readField(e,{store:s.cache.data,variables:e.variables})}}),c=r&&this.getTypePolicy(r),l=c&&c.keyFn||this.config.dataIdFromObject;l;){var d=l(om(om({},e),o),a);if(!Wy(d)){n=d;break}l=cb(d)}return n=n?String(n):void 0,a.keyObject?[n,a.keyObject]:[n]},e.prototype.addTypePolicies=function(e){var t=this;Object.keys(e).forEach((function(i){var s=e[i],r=s.queryType,n=s.mutationType,o=s.subscriptionType,a=am(s,["queryType","mutationType","subscriptionType"]);r&&t.setRootTypename("Query",i),n&&t.setRootTypename("Mutation",i),o&&t.setRootTypename("Subscription",i),RO.call(t.toBeAdded,i)?t.toBeAdded[i].push(a):t.toBeAdded[i]=[a]}))},e.prototype.updateTypePolicy=function(e,t){var i=this,s=this.getTypePolicy(e),r=t.keyFields,n=t.fields;function o(e,t){e.merge="function"==typeof t?t:!0===t?yb:!1===t?vb:e.merge}o(s,t.merge),s.keyFn=!1===r?fb:Wy(r)?cb(r):"function"==typeof r?r:s.keyFn,n&&Object.keys(n).forEach((function(t){var s=i.getFieldPolicy(e,t,!0),r=n[t];if("function"==typeof r)s.read=r;else{var a=r.keyArgs,c=r.read,l=r.merge;s.keyFn=!1===a?gb:Wy(a)?lb(a):"function"==typeof a?a:s.keyFn,"function"==typeof c&&(s.read=c),o(s,l)}s.read&&s.merge&&(s.keyFn=s.keyFn||gb)}))},e.prototype.setRootTypename=function(e,t){void 0===t&&(t=e);var i="ROOT_"+e.toUpperCase(),s=this.rootTypenamesById[i];t!==s&&(wm(!s||s===e,5,e),s&&delete this.rootIdsByTypename[s],this.rootIdsByTypename[t]=i,this.rootTypenamesById[i]=t)},e.prototype.addPossibleTypes=function(e){var t=this;this.usingPossibleTypes=!0,Object.keys(e).forEach((function(i){t.getSupertypeSet(i,!0),e[i].forEach((function(e){t.getSupertypeSet(e,!0).add(i);var s=e.match(xO);s&&s[0]===e||t.fuzzySubtypes.set(e,new RegExp(e))}))}))},e.prototype.getTypePolicy=function(e){var t=this;if(!RO.call(this.typePolicies,e)){var i=this.typePolicies[e]=Object.create(null);i.fields=Object.create(null);var s=this.supertypeMap.get(e);!s&&this.fuzzySubtypes.size&&(s=this.getSupertypeSet(e,!0),this.fuzzySubtypes.forEach((function(i,r){if(i.test(e)){var n=t.supertypeMap.get(r);n&&n.forEach((function(e){return s.add(e)}))}}))),s&&s.size&&s.forEach((function(e){var s=t.getTypePolicy(e),r=s.fields,n=am(s,["fields"]);Object.assign(i,n),Object.assign(i.fields,r)}))}var r=this.toBeAdded[e];return r&&r.length&&r.splice(0).forEach((function(i){t.updateTypePolicy(e,i)})),this.typePolicies[e]},e.prototype.getFieldPolicy=function(e,t,i){if(e){var s=this.getTypePolicy(e).fields;return s[t]||i&&(s[t]=Object.create(null))}},e.prototype.getSupertypeSet=function(e,t){var i=this.supertypeMap.get(e);return!i&&t&&this.supertypeMap.set(e,i=new Set),i},e.prototype.fragmentMatches=function(e,t,i,s){var r=this;if(!e.typeCondition)return!0;if(!t)return!1;var n=e.typeCondition.name.value;if(t===n)return!0;if(this.usingPossibleTypes&&this.supertypeMap.has(n))for(var o=this.getSupertypeSet(t,!0),a=[o],c=function(e){var t=r.getSupertypeSet(e,!1);t&&t.size&&a.indexOf(t)<0&&a.push(t)},l=!(!i||!this.fuzzySubtypes.size),d=!1,u=0;u<a.length;++u){var h=a[u];if(h.has(n))return o.has(n)||(d&&!1!==globalThis.__DEV__&&wm.warn(6,t,n),o.add(n)),!0;h.forEach(c),l&&u===a.length-1&&HO(e.selectionSet,i,s)&&(l=!1,d=!0,this.fuzzySubtypes.forEach((function(e,i){var s=t.match(e);s&&s[0]===t&&c(i)})))}return!1},e.prototype.hasKeyArgs=function(e,t){var i=this.getFieldPolicy(e,t,!1);return!(!i||!i.keyFn)},e.prototype.getStoreFieldName=function(e){var t,i=e.typename,s=e.fieldName,r=this.getFieldPolicy(i,s,!1),n=r&&r.keyFn;if(n&&i)for(var o={typename:i,fieldName:s,field:e.field||null,variables:e.variables},a=mb(e);n;){var c=n(a,o);if(!Wy(c)){t=c||s;break}n=lb(c)}return void 0===t&&(t=e.field?function(e,t){var i=null;e.directives&&(i={},e.directives.forEach((function(e){i[e.name.value]={},e.arguments&&e.arguments.forEach((function(s){var r=s.name,n=s.value;return Bg(i[e.name.value],r,n,t)}))})));var s=null;return e.arguments&&e.arguments.length&&(s={},e.arguments.forEach((function(e){var i=e.name,r=e.value;return Bg(s,i,r,t)}))),Kg(e.name.value,s,i)}(e.field,e.variables):Kg(s,mb(e))),!1===t?s:s===kO(t)?t:s+":"+t},e.prototype.readField=function(e,t){var i=e.from;if(i&&(e.field||e.fieldName)){if(void 0===e.typename){var s=t.store.getFieldValue(i,"__typename");s&&(e.typename=s)}var r=this.getStoreFieldName(e),n=kO(r),o=t.store.getFieldValue(i,r),a=this.getFieldPolicy(e.typename,n,!1),c=a&&a.read;if(c){var l=bb(this,i,e,t,t.store.getStorage(Ug(i)?i.__ref:i,r));return tb.withValue(this.cache,c,[o,l])}return o}},e.prototype.getReadFunction=function(e,t){var i=this.getFieldPolicy(e,t,!1);return i&&i.read},e.prototype.getMergeFunction=function(e,t,i){var s=this.getFieldPolicy(e,t,!1),r=s&&s.merge;return!r&&i&&(r=(s=this.getTypePolicy(i))&&s.merge),r},e.prototype.runMergeFunction=function(e,t,i,s,r){var n=i.field,o=i.typename,a=i.merge;return a===yb?Eb(s.store)(e,t):a===vb?t:(s.overwrite&&(e=void 0),a(e,t,bb(this,void 0,{typename:o,fieldName:n.name.value,field:n,variables:s.variables},s,r||Object.create(null))))},e}();function bb(e,t,i,s,r){var n=e.getStoreFieldName(i),o=kO(n),a=i.variables||s.variables,c=s.store,l=c.toReference,d=c.canRead;return{args:mb(i),field:i.field||null,fieldName:o,storeFieldName:n,variables:a,isReference:Ug,toReference:l,storage:r,cache:e.cache,canRead:d,readField:function(){return e.readField(Ib(arguments,t,a),s)},mergeObjects:Eb(s.store)}}function Ib(e,t,i){var s,r=e[0],n=e[1],o=e.length;return"string"==typeof r?s={fieldName:r,from:o>1?n:t}:(s=om({},r),RO.call(s,"from")||(s.from=t)),!1!==globalThis.__DEV__&&void 0===s.from&&!1!==globalThis.__DEV__&&wm.warn(7,Am(Array.from(e))),void 0===s.variables&&(s.variables=i),s}function Eb(e){return function(t,i){if(Wy(t)||Wy(i))throw Cm(8);if(ng(t)&&ng(i)){var s=e.getFieldValue(t,"__typename"),r=e.getFieldValue(i,"__typename");if(s&&r&&s!==r)return i;if(Ug(t)&&jO(i))return e.merge(t.__ref,i),t;if(jO(t)&&Ug(i))return e.merge(t,i.__ref),i;if(jO(t)&&jO(i))return om(om({},t),i)}return i}}function Tb(e,t,i){var s="".concat(t).concat(i),r=e.flavors.get(s);return r||e.flavors.set(s,r=e.clientOnly===t&&e.deferred===i?e:om(om({},e),{clientOnly:t,deferred:i})),r}var Sb=function(){function e(e,t,i){this.cache=e,this.reader=t,this.fragments=i}return e.prototype.writeToStore=function(e,t){var i=this,s=t.query,r=t.result,n=t.dataId,o=t.variables,a=t.overwrite,c=Yg(s),l=new ov;o=om(om({},ey(c)),o);var d=om(om({store:e,written:Object.create(null),merge:function(e,t){return l.merge(e,t)},variables:o,varString:xg(o)},UO(s,this.fragments)),{overwrite:!!a,incomingById:new Map,clientOnly:!1,deferred:!1,flavors:new Map}),u=this.processSelectionSet({result:r||Object.create(null),dataId:n,selectionSet:c.selectionSet,mergeTree:{map:new Map},context:d});if(!Ug(u))throw Cm(11,r);return d.incomingById.forEach((function(t,s){var r=t.storeObject,n=t.mergeTree,o=t.fieldNodeSet,a=jg(s);if(n&&n.map.size){var c=i.applyMerges(n,a,r,d);if(Ug(c))return;r=c}if(!1!==globalThis.__DEV__&&!d.overwrite){var l=Object.create(null);o.forEach((function(e){e.selectionSet&&(l[e.name.value]=!0)})),Object.keys(r).forEach((function(e){(function(e){return!0===l[kO(e)]})(e)&&!function(e){var t=n&&n.map.get(e);return Boolean(t&&t.info&&t.info.merge)}(e)&&function(e,t,i,s){var r=function(e){var t=s.getFieldValue(e,i);return"object"==typeof t&&t},n=r(e);if(n){var o=r(t);if(o&&!Ug(n)&&!yO(n,o)&&!Object.keys(n).every((function(e){return void 0!==s.getFieldValue(o,e)}))){var a=s.getFieldValue(e,"__typename")||s.getFieldValue(t,"__typename"),c=kO(i),l="".concat(a,".").concat(c);if(!Nb.has(l)){Nb.add(l);var d=[];Wy(n)||Wy(o)||[n,o].forEach((function(e){var t=s.getFieldValue(e,"__typename");"string"!=typeof t||d.includes(t)||d.push(t)})),!1!==globalThis.__DEV__&&wm.warn(14,c,a,d.length?"either ensure all objects of type "+d.join(" and ")+" have an ID or a custom merge function, or ":"",l,om({},n),om({},o))}}}}(a,r,e,d.store)}))}e.merge(s,r)})),e.retain(u.__ref),u},e.prototype.processSelectionSet=function(e){var t=this,i=e.dataId,s=e.result,r=e.selectionSet,n=e.context,o=e.mergeTree,a=this.cache.policies,c=Object.create(null),l=i&&a.rootTypenamesById[i]||Wg(s,r,n.fragmentMap)||i&&n.store.get(i,"__typename");"string"==typeof l&&(c.__typename=l);var d=function(){var e=Ib(arguments,c,n.variables);if(Ug(e.from)){var t=n.incomingById.get(e.from.__ref);if(t){var i=a.readField(om(om({},e),{from:t.storeObject}),n);if(void 0!==i)return i}}return a.readField(e,n)},u=new Set;this.flattenFields(r,s,n,l).forEach((function(e,i){var r,n=$g(i),h=s[n];if(u.add(i),void 0!==h){var p=a.getStoreFieldName({typename:l,fieldName:i.name.value,field:i,variables:e.variables}),_=Pb(o,p),m=t.processFieldValue(h,i,i.selectionSet?Tb(e,!1,!1):e,_),f=void 0;i.selectionSet&&(Ug(m)||jO(m))&&(f=d("__typename",m));var g=a.getMergeFunction(l,i.name.value,f);g?_.info={field:i,typename:l,merge:g}:Rb(o,p),c=e.merge(c,((r={})[p]=m,r))}else!1===globalThis.__DEV__||e.clientOnly||e.deferred||Zy.added(i)||a.getReadFunction(l,i.name.value)||!1!==globalThis.__DEV__&&wm.error(12,$g(i),s)}));try{var h=a.identify(s,{typename:l,selectionSet:r,fragmentMap:n.fragmentMap,storeObject:c,readField:d}),p=h[0],_=h[1];i=i||p,_&&(c=n.merge(c,_))}catch(e){if(!i)throw e}if("string"==typeof i){var m=jg(i),f=n.written[i]||(n.written[i]=[]);if(f.indexOf(r)>=0)return m;if(f.push(r),this.reader&&this.reader.isFresh(s,m,r,n))return m;var g=n.incomingById.get(i);return g?(g.storeObject=n.merge(g.storeObject,c),g.mergeTree=wb(g.mergeTree,o),u.forEach((function(e){return g.fieldNodeSet.add(e)}))):n.incomingById.set(i,{storeObject:c,mergeTree:Cb(o)?void 0:o,fieldNodeSet:u}),m}return c},e.prototype.processFieldValue=function(e,t,i,s){var r=this;return t.selectionSet&&null!==e?Wy(e)?e.map((function(e,n){var o=r.processFieldValue(e,t,i,Pb(s,n));return Rb(s,n),o})):this.processSelectionSet({result:e,selectionSet:t.selectionSet,context:i,mergeTree:s}):!1!==globalThis.__DEV__?Lv(e):e},e.prototype.flattenFields=function(e,t,i,s){void 0===s&&(s=Wg(t,e,i.fragmentMap));var r=new Map,n=this.cache.policies,o=new Zf(!1);return function e(a,c){var l=o.lookup(a,c.clientOnly,c.deferred);l.visited||(l.visited=!0,a.selections.forEach((function(o){if(Wf(o,i.variables)){var a=c.clientOnly,l=c.deferred;if(a&&l||!zy(o.directives)||o.directives.forEach((function(e){var t=e.name.value;if("client"===t&&(a=!0),"defer"===t){var s=Gg(e,i.variables);s&&!1===s.if||(l=!0)}})),zg(o)){var d=r.get(o);d&&(a=a&&d.clientOnly,l=l&&d.deferred),r.set(o,Tb(i,a,l))}else{var u=cg(o,i.lookupFragment);if(!u&&o.kind===Qm.FRAGMENT_SPREAD)throw Cm(13,o.name.value);u&&n.fragmentMatches(u,s,t,i.variables)&&e(u.selectionSet,Tb(i,a,l))}}})))}(e,i),r},e.prototype.applyMerges=function(e,t,i,s,r){var n,o=this;if(e.map.size&&!Ug(i)){var a,c=Wy(i)||!Ug(t)&&!jO(t)?void 0:t,l=i;c&&!r&&(r=[Ug(c)?c.__ref:c]);var d=function(e,t){return Wy(e)?"number"==typeof t?e[t]:void 0:s.store.getFieldValue(e,String(t))};e.map.forEach((function(e,t){var i=d(c,t),n=d(l,t);if(void 0!==n){r&&r.push(t);var u=o.applyMerges(e,i,n,s,r);u!==n&&(a=a||new Map).set(t,u),r&&wm(r.pop()===t)}})),a&&(i=Wy(l)?l.slice(0):om({},l),a.forEach((function(e,t){i[t]=e})))}return e.info?this.cache.policies.runMergeFunction(t,i,e.info,s,r&&(n=s.store).getStorage.apply(n,r)):i},e}(),Ab=[];function Pb(e,t){var i=e.map;return i.has(t)||i.set(t,Ab.pop()||{map:new Map}),i.get(t)}function wb(e,t){if(e===t||!t||Cb(t))return e;if(!e||Cb(e))return t;var i=e.info&&t.info?om(om({},e.info),t.info):e.info||t.info,s=e.map.size&&t.map.size,r={info:i,map:s?new Map:e.map.size?e.map:t.map};if(s){var n=new Set(t.map.keys());e.map.forEach((function(e,i){r.map.set(i,wb(e,t.map.get(i))),n.delete(i)})),n.forEach((function(i){r.map.set(i,wb(t.map.get(i),e.map.get(i)))}))}return r}function Cb(e){return!e||!(e.info||e.map.size)}function Rb(e,t){var i=e.map,s=i.get(t);s&&Cb(s)&&(Ab.push(s),i.delete(t))}var Lb,Nb=new Set,Db=function(e){function t(t){void 0===t&&(t={});var i=e.call(this)||this;return i.watches=new Set,i.addTypenameTransform=new Gy(Zy),i.assumeImmutableResults=!0,i.makeVar=nb,i.txCount=0,i.config=function(e){return Gv(DO,e)}(t),i.addTypename=!!i.config.addTypename,i.policies=new Ob({cache:i,dataIdFromObject:i.config.dataIdFromObject,possibleTypes:i.config.possibleTypes,typePolicies:i.config.typePolicies}),i.init(),i}return nm(t,e),t.prototype.init=function(){var e=this.data=new KO.Root({policies:this.policies,resultCaching:this.config.resultCaching});this.optimisticData=e.stump,this.resetResultCache()},t.prototype.resetResultCache=function(e){var t=this,i=this.storeReader,s=this.config.fragments;this.storeWriter=new Sb(this,this.storeReader=new ZO({cache:this,addTypename:this.addTypename,resultCacheMaxSize:this.config.resultCacheMaxSize,canonizeResults:MO(this.config),canon:e?void 0:i&&i.canon,fragments:s}),s),this.maybeBroadcastWatch=Fy((function(e,i){return t.broadcastWatch(e,i)}),{max:this.config.resultCacheMaxSize||Ig["inMemoryCache.maybeBroadcastWatch"]||5e3,makeCacheKey:function(e){var i=e.optimistic?t.optimisticData:t.data;if(QO(i)){var s=e.optimistic,r=e.id,n=e.variables;return i.makeCacheKey(e.query,e.callback,xg({optimistic:s,id:r,variables:n}))}}}),new Set([this.data.group,this.optimisticData.group]).forEach((function(e){return e.resetCaching()}))},t.prototype.restore=function(e){return this.init(),e&&this.data.replace(e),this},t.prototype.extract=function(e){return void 0===e&&(e=!1),(e?this.optimisticData:this.data).extract()},t.prototype.read=function(e){var t=e.returnPartialData,i=void 0!==t&&t;try{return this.storeReader.diffQueryAgainstStore(om(om({},e),{store:e.optimistic?this.optimisticData:this.data,config:this.config,returnPartialData:i})).result||null}catch(e){if(e instanceof CO)return null;throw e}},t.prototype.write=function(e){try{return++this.txCount,this.storeWriter.writeToStore(this.data,e)}finally{--this.txCount||!1===e.broadcast||this.broadcastWatches()}},t.prototype.modify=function(e){if(RO.call(e,"id")&&!e.id)return!1;var t=e.optimistic?this.optimisticData:this.data;try{return++this.txCount,t.modify(e.id||"ROOT_QUERY",e.fields)}finally{--this.txCount||!1===e.broadcast||this.broadcastWatches()}},t.prototype.diff=function(e){return this.storeReader.diffQueryAgainstStore(om(om({},e),{store:e.optimistic?this.optimisticData:this.data,rootId:e.id||"ROOT_QUERY",config:this.config}))},t.prototype.watch=function(e){var t=this;return this.watches.size||function(e){sb(e).vars.forEach((function(t){return t.attachCache(e)}))}(this),this.watches.add(e),e.immediate&&this.maybeBroadcastWatch(e),function(){t.watches.delete(e)&&!t.watches.size&&rb(t),t.maybeBroadcastWatch.forget(e)}},t.prototype.gc=function(e){var t;xg.reset(),$y.reset(),this.addTypenameTransform.resetCache(),null===(t=this.config.fragments)||void 0===t||t.resetCaches();var i=this.optimisticData.gc();return e&&!this.txCount&&(e.resetResultCache?this.resetResultCache(e.resetResultIdentities):e.resetResultIdentities&&this.storeReader.resetCanon()),i},t.prototype.retain=function(e,t){return(t?this.optimisticData:this.data).retain(e)},t.prototype.release=function(e,t){return(t?this.optimisticData:this.data).release(e)},t.prototype.identify=function(e){if(Ug(e))return e.__ref;try{return this.policies.identify(e)[0]}catch(e){!1!==globalThis.__DEV__&&wm.warn(e)}},t.prototype.evict=function(e){if(!e.id){if(RO.call(e,"id"))return!1;e=om(om({},e),{id:"ROOT_QUERY"})}try{return++this.txCount,this.optimisticData.evict(e,this.data)}finally{--this.txCount||!1===e.broadcast||this.broadcastWatches()}},t.prototype.reset=function(e){var t=this;return this.init(),xg.reset(),e&&e.discardWatches?(this.watches.forEach((function(e){return t.maybeBroadcastWatch.forget(e)})),this.watches.clear(),rb(this)):this.broadcastWatches(),Promise.resolve()},t.prototype.removeOptimistic=function(e){var t=this.optimisticData.removeLayer(e);t!==this.optimisticData&&(this.optimisticData=t,this.broadcastWatches())},t.prototype.batch=function(e){var t,i=this,s=e.update,r=e.optimistic,n=void 0===r||r,o=e.removeOptimistic,a=e.onWatchUpdated,c=function(e){var r=i,n=r.data,o=r.optimisticData;++i.txCount,e&&(i.data=i.optimisticData=e);try{return t=s(i)}finally{--i.txCount,i.data=n,i.optimisticData=o}},l=new Set;return a&&!this.txCount&&this.broadcastWatches(om(om({},e),{onWatchUpdated:function(e){return l.add(e),!1}})),"string"==typeof n?this.optimisticData=this.optimisticData.addLayer(n,c):!1===n?c(this.data):c(),"string"==typeof o&&(this.optimisticData=this.optimisticData.removeLayer(o)),a&&l.size?(this.broadcastWatches(om(om({},e),{onWatchUpdated:function(e,t){var i=a.call(this,e,t);return!1!==i&&l.delete(e),i}})),l.size&&l.forEach((function(e){return i.maybeBroadcastWatch.dirty(e)}))):this.broadcastWatches(e),t},t.prototype.performTransaction=function(e,t){return this.batch({update:e,optimistic:t||null!==t})},t.prototype.transformDocument=function(e){return this.addTypenameToDocument(this.addFragmentsToDocument(e))},t.prototype.broadcastWatches=function(e){var t=this;this.txCount||this.watches.forEach((function(i){return t.maybeBroadcastWatch(i,e)}))},t.prototype.addFragmentsToDocument=function(e){var t=this.config.fragments;return t?t.transform(e):e},t.prototype.addTypenameToDocument=function(e){return this.addTypename?this.addTypenameTransform.transformDocument(e):e},t.prototype.broadcastWatch=function(e,t){var i=e.lastDiff,s=this.diff(e);t&&(e.optimistic&&"string"==typeof t.optimistic&&(s.fromOptimisticTransaction=!0),t.onWatchUpdated&&!1===t.onWatchUpdated.call(this,e,s,i))||i&&yO(i.result,s.result)||e.callback(e.lastDiff=s,i)},t}(wO);function Mb(e){return!!e&&e<7}!1!==globalThis.__DEV__&&(Db.prototype.getMemoryInternals=Ag),function(e){e[e.loading=1]="loading",e[e.setVariables=2]="setVariables",e[e.fetchMore=3]="fetchMore",e[e.refetch=4]="refetch",e[e.poll=6]="poll",e[e.ready=7]="ready",e[e.error=8]="error"}(Lb||(Lb={}));var xb=Object.assign,kb=Object.hasOwnProperty,Hb=function(e){function t(t){var i=t.queryManager,s=t.queryInfo,r=t.options,n=e.call(this,(function(e){try{var t=e._subscription._observer;t&&!t.error&&(t.error=Ub)}catch(e){}var i=!n.observers.size;n.observers.add(e);var s=n.last;return s&&s.error?e.error&&e.error(s.error):s&&s.result&&e.next&&e.next(s.result),i&&n.reobserve().catch((function(){})),function(){n.observers.delete(e)&&!n.observers.size&&n.tearDownQuery()}}))||this;n.observers=new Set,n.subscriptions=new Set,n.queryInfo=s,n.queryManager=i,n.waitForOwnResult=Fb(r.fetchPolicy),n.isTornDown=!1,n.subscribeToMore=n.subscribeToMore.bind(n);var o=i.defaultOptions.watchQuery,a=(void 0===o?{}:o).fetchPolicy,c=void 0===a?"cache-first":a,l=r.fetchPolicy,d=void 0===l?c:l,u=r.initialFetchPolicy,h=void 0===u?"standby"===d?c:d:u;n.options=om(om({},r),{initialFetchPolicy:h,fetchPolicy:d}),n.queryId=s.queryId||i.generateQueryId();var p=Yg(n.query);return n.queryName=p&&p.name&&p.name.value,n}return nm(t,e),Object.defineProperty(t.prototype,"query",{get:function(){return this.lastQuery||this.options.query},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"variables",{get:function(){return this.options.variables},enumerable:!1,configurable:!0}),t.prototype.result=function(){var e=this;return new Promise((function(t,i){var s={next:function(i){t(i),e.observers.delete(s),e.observers.size||e.queryManager.removeQuery(e.queryId),setTimeout((function(){r.unsubscribe()}),0)},error:i},r=e.subscribe(s)}))},t.prototype.resetDiff=function(){this.queryInfo.resetDiff()},t.prototype.getCurrentResult=function(e){void 0===e&&(e=!0);var t=this.getLastResult(!0),i=this.queryInfo.networkStatus||t&&t.networkStatus||Lb.ready,s=om(om({},t),{loading:Mb(i),networkStatus:i}),r=this.options.fetchPolicy,n=void 0===r?"cache-first":r;if(Fb(n)||this.queryManager.getDocumentInfo(this.query).hasForcedResolvers);else if(this.waitForOwnResult)this.queryInfo.updateWatch();else{var o=this.queryInfo.getDiff();(o.complete||this.options.returnPartialData)&&(s.data=o.result),yO(s.data,{})&&(s.data=void 0),o.complete?(delete s.partial,!o.complete||s.networkStatus!==Lb.loading||"cache-first"!==n&&"cache-only"!==n||(s.networkStatus=Lb.ready,s.loading=!1)):s.partial=!0,!1===globalThis.__DEV__||o.complete||this.options.partialRefetch||s.loading||s.data||s.error||Bb(o.missing)}return e&&this.updateLastResult(s),s},t.prototype.isDifferentFromLastResult=function(e,t){return!this.last||(this.queryManager.getDocumentInfo(this.query).hasNonreactiveDirective?!TO(this.query,this.last.result,e,this.variables):!yO(this.last.result,e))||t&&!yO(this.last.variables,t)},t.prototype.getLast=function(e,t){var i=this.last;if(i&&i[e]&&(!t||yO(i.variables,this.variables)))return i[e]},t.prototype.getLastResult=function(e){return this.getLast("result",e)},t.prototype.getLastError=function(e){return this.getLast("error",e)},t.prototype.resetLastResults=function(){delete this.last,this.isTornDown=!1},t.prototype.resetQueryStoreErrors=function(){this.queryManager.resetErrors(this.queryId)},t.prototype.refetch=function(e){var t,i={pollInterval:0},s=this.options.fetchPolicy;if(i.fetchPolicy="cache-and-network"===s?s:"no-cache"===s?"no-cache":"network-only",!1!==globalThis.__DEV__&&e&&kb.call(e,"variables")){var r=Xg(this.query),n=r.variableDefinitions;n&&n.some((function(e){return"variables"===e.variable.name.value}))||!1!==globalThis.__DEV__&&wm.warn(20,e,(null===(t=r.name)||void 0===t?void 0:t.value)||r)}return e&&!yO(this.options.variables,e)&&(i.variables=this.options.variables=om(om({},this.options.variables),e)),this.queryInfo.resetLastWrite(),this.reobserve(i,Lb.refetch)},t.prototype.fetchMore=function(e){var t=this,i=om(om({},e.query?e:om(om(om(om({},this.options),{query:this.options.query}),e),{variables:om(om({},this.options.variables),e.variables)})),{fetchPolicy:"no-cache"});i.query=this.transformDocument(i.query);var s=this.queryManager.generateQueryId();this.lastQuery=e.query?this.transformDocument(this.options.query):i.query;var r=this.queryInfo,n=r.networkStatus;r.networkStatus=Lb.fetchMore,i.notifyOnNetworkStatusChange&&this.observe();var o=new Set,a=null==e?void 0:e.updateQuery,c="no-cache"!==this.options.fetchPolicy;return c||wm(a,21),this.queryManager.fetchQuery(s,i,Lb.fetchMore).then((function(l){if(t.queryManager.removeQuery(s),r.networkStatus===Lb.fetchMore&&(r.networkStatus=n),c)t.queryManager.cache.batch({update:function(s){var r=e.updateQuery;r?s.updateQuery({query:t.query,variables:t.variables,returnPartialData:!0,optimistic:!1},(function(e){return r(e,{fetchMoreResult:l.data,variables:i.variables})})):s.writeQuery({query:i.query,variables:i.variables,data:l.data})},onWatchUpdated:function(e){o.add(e.query)}});else{var d=t.getLast("result"),u=a(d.data,{fetchMoreResult:l.data,variables:i.variables});t.reportResult(om(om({},d),{data:u}),t.variables)}return l})).finally((function(){c&&!o.has(t.query)&&jb(t)}))},t.prototype.subscribeToMore=function(e){var t=this,i=this.queryManager.startGraphQLSubscription({query:e.document,variables:e.variables,context:e.context}).subscribe({next:function(i){var s=e.updateQuery;s&&t.updateQuery((function(e,t){var r=t.variables;return s(e,{subscriptionData:i,variables:r})}))},error:function(t){e.onError?e.onError(t):!1!==globalThis.__DEV__&&wm.error(22,t)}});return this.subscriptions.add(i),function(){t.subscriptions.delete(i)&&i.unsubscribe()}},t.prototype.setOptions=function(e){return this.reobserve(e)},t.prototype.silentSetOptions=function(e){var t=Gv(this.options,e||{});xb(this.options,t)},t.prototype.setVariables=function(e){return yO(this.variables,e)?this.observers.size?this.result():Promise.resolve():(this.options.variables=e,this.observers.size?this.reobserve({fetchPolicy:this.options.initialFetchPolicy,variables:e},Lb.setVariables):Promise.resolve())},t.prototype.updateQuery=function(e){var t=this.queryManager,i=e(t.cache.diff({query:this.options.query,variables:this.variables,returnPartialData:!0,optimistic:!1}).result,{variables:this.variables});i&&(t.cache.writeQuery({query:this.options.query,data:i,variables:this.variables}),t.broadcastQueries())},t.prototype.startPolling=function(e){this.options.pollInterval=e,this.updatePolling()},t.prototype.stopPolling=function(){this.options.pollInterval=0,this.updatePolling()},t.prototype.applyNextFetchPolicy=function(e,t){if(t.nextFetchPolicy){var i=t.fetchPolicy,s=void 0===i?"cache-first":i,r=t.initialFetchPolicy,n=void 0===r?s:r;"standby"===s||("function"==typeof t.nextFetchPolicy?t.fetchPolicy=t.nextFetchPolicy(s,{reason:e,options:t,observable:this,initialFetchPolicy:n}):t.fetchPolicy="variables-changed"===e?n:t.nextFetchPolicy)}return t.fetchPolicy},t.prototype.fetch=function(e,t,i){return this.queryManager.setObservableQuery(this),this.queryManager.fetchConcastWithInfo(this.queryId,e,t,i)},t.prototype.updatePolling=function(){var e=this;if(!this.queryManager.ssrMode){var t=this.pollingInfo,i=this.options.pollInterval;if(i&&this.hasObservers()){if(!t||t.interval!==i){wm(i,23),(t||(this.pollingInfo={})).interval=i;var s=function(){var t,i;e.pollingInfo&&(Mb(e.queryInfo.networkStatus)||(null===(i=(t=e.options).skipPollAttempt)||void 0===i?void 0:i.call(t))?r():e.reobserve({fetchPolicy:"no-cache"===e.options.initialFetchPolicy?"no-cache":"network-only"},Lb.poll).then(r,r))},r=function(){var t=e.pollingInfo;t&&(clearTimeout(t.timeout),t.timeout=setTimeout(s,t.interval))};r()}}else t&&(clearTimeout(t.timeout),delete this.pollingInfo)}},t.prototype.updateLastResult=function(e,t){void 0===t&&(t=this.variables);var i=this.getLastError();return i&&this.last&&!yO(t,this.last.variables)&&(i=void 0),this.last=om({result:this.queryManager.assumeImmutableResults?e:Lv(e),variables:t},i?{error:i}:null)},t.prototype.reobserveAsConcast=function(e,t){var i=this;this.isTornDown=!1;var s=t===Lb.refetch||t===Lb.fetchMore||t===Lb.poll,r=this.options.variables,n=this.options.fetchPolicy,o=Gv(this.options,e||{}),a=s?o:xb(this.options,o),c=this.transformDocument(a.query);this.lastQuery=c,s||(this.updatePolling(),!e||!e.variables||yO(e.variables,r)||"standby"===a.fetchPolicy||a.fetchPolicy!==n&&"function"!=typeof a.nextFetchPolicy||(this.applyNextFetchPolicy("variables-changed",a),void 0===t&&(t=Lb.setVariables))),this.waitForOwnResult&&(this.waitForOwnResult=Fb(a.fetchPolicy));var l=function(){i.concast===h&&(i.waitForOwnResult=!1)},d=a.variables&&om({},a.variables),u=this.fetch(a,t,c),h=u.concast,p=u.fromLink,_={next:function(e){yO(i.variables,d)&&(l(),i.reportResult(e,d))},error:function(e){yO(i.variables,d)&&(sO(e)||(e=new rO({networkError:e})),l(),i.reportError(e,d))}};return s||!p&&this.concast||(this.concast&&this.observer&&this.concast.removeObserver(this.observer),this.concast=h,this.observer=_),h.addObserver(_),h},t.prototype.reobserve=function(e,t){return this.reobserveAsConcast(e,t).promise},t.prototype.resubscribeAfterError=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var i=this.last;this.resetLastResults();var s=this.subscribe.apply(this,e);return this.last=i,s},t.prototype.observe=function(){this.reportResult(this.getCurrentResult(!1),this.variables)},t.prototype.reportResult=function(e,t){var i=this.getLastError(),s=this.isDifferentFromLastResult(e,t);(i||!e.partial||this.options.returnPartialData)&&this.updateLastResult(e,t),(i||s)&&Mv(this.observers,"next",e)},t.prototype.reportError=function(e,t){var i=om(om({},this.getLastResult()),{error:e,errors:e.graphQLErrors,networkStatus:Lb.error,loading:!1});this.updateLastResult(i,t),Mv(this.observers,"error",this.last.error=e)},t.prototype.hasObservers=function(){return this.observers.size>0},t.prototype.tearDownQuery=function(){this.isTornDown||(this.concast&&this.observer&&(this.concast.removeObserver(this.observer),delete this.concast,delete this.observer),this.stopPolling(),this.subscriptions.forEach((function(e){return e.unsubscribe()})),this.subscriptions.clear(),this.queryManager.stopQuery(this.queryId),this.observers.clear(),this.isTornDown=!0)},t.prototype.transformDocument=function(e){return this.queryManager.transform(e)},t}(Pv);function jb(e){var t=e.options,i=t.fetchPolicy,s=t.nextFetchPolicy;return"cache-and-network"===i||"network-only"===i?e.reobserve({fetchPolicy:"cache-first",nextFetchPolicy:function(e,t){return this.nextFetchPolicy=s,"function"==typeof this.nextFetchPolicy?this.nextFetchPolicy(e,t):i}}):e.reobserve()}function Ub(e){!1!==globalThis.__DEV__&&wm.error(24,e.message,e.stack)}function Bb(e){!1!==globalThis.__DEV__&&e&&!1!==globalThis.__DEV__&&wm.debug(25,e)}function Fb(e){return"network-only"===e||"no-cache"===e||"standby"===e}kv(Hb);var Vb=new(tg?WeakMap:Map);function Kb(e,t){var i=e[t];"function"==typeof i&&(e[t]=function(){return Vb.set(e,(Vb.get(e)+1)%1e15),i.apply(this,arguments)})}function Gb(e){e.notifyTimeout&&(clearTimeout(e.notifyTimeout),e.notifyTimeout=void 0)}var $b=function(){function e(e,t){void 0===t&&(t=e.generateQueryId()),this.queryId=t,this.listeners=new Set,this.document=null,this.lastRequestId=1,this.stopped=!1,this.dirty=!1,this.observableQuery=null;var i=this.cache=e.cache;Vb.has(i)||(Vb.set(i,0),Kb(i,"evict"),Kb(i,"modify"),Kb(i,"reset"))}return e.prototype.init=function(e){var t=e.networkStatus||Lb.loading;return this.variables&&this.networkStatus!==Lb.loading&&!yO(this.variables,e.variables)&&(t=Lb.setVariables),yO(e.variables,this.variables)||(this.lastDiff=void 0),Object.assign(this,{document:e.document,variables:e.variables,networkError:null,graphQLErrors:this.graphQLErrors||[],networkStatus:t}),e.observableQuery&&this.setObservableQuery(e.observableQuery),e.lastRequestId&&(this.lastRequestId=e.lastRequestId),this},e.prototype.reset=function(){Gb(this),this.dirty=!1},e.prototype.resetDiff=function(){this.lastDiff=void 0},e.prototype.getDiff=function(){var e=this.getDiffOptions();if(this.lastDiff&&yO(e,this.lastDiff.options))return this.lastDiff.diff;this.updateWatch(this.variables);var t=this.observableQuery;if(t&&"no-cache"===t.options.fetchPolicy)return{complete:!1};var i=this.cache.diff(e);return this.updateLastDiff(i,e),i},e.prototype.updateLastDiff=function(e,t){this.lastDiff=e?{diff:e,options:t||this.getDiffOptions()}:void 0},e.prototype.getDiffOptions=function(e){var t;return void 0===e&&(e=this.variables),{query:this.document,variables:e,returnPartialData:!0,optimistic:!0,canonizeResults:null===(t=this.observableQuery)||void 0===t?void 0:t.options.canonizeResults}},e.prototype.setDiff=function(e){var t,i=this,s=this.lastDiff&&this.lastDiff.diff;e&&!e.complete&&(null===(t=this.observableQuery)||void 0===t?void 0:t.getLastError())||(this.updateLastDiff(e),this.dirty||yO(s&&s.result,e&&e.result)||(this.dirty=!0,this.notifyTimeout||(this.notifyTimeout=setTimeout((function(){return i.notify()}),0))))},e.prototype.setObservableQuery=function(e){var t=this;e!==this.observableQuery&&(this.oqListener&&this.listeners.delete(this.oqListener),this.observableQuery=e,e?(e.queryInfo=this,this.listeners.add(this.oqListener=function(){t.getDiff().fromOptimisticTransaction?e.observe():jb(e)})):delete this.oqListener)},e.prototype.notify=function(){var e=this;Gb(this),this.shouldNotify()&&this.listeners.forEach((function(t){return t(e)})),this.dirty=!1},e.prototype.shouldNotify=function(){if(!this.dirty||!this.listeners.size)return!1;if(Mb(this.networkStatus)&&this.observableQuery){var e=this.observableQuery.options.fetchPolicy;if("cache-only"!==e&&"cache-and-network"!==e)return!1}return!0},e.prototype.stop=function(){if(!this.stopped){this.stopped=!0,this.reset(),this.cancel(),this.cancel=e.prototype.cancel;var t=this.observableQuery;t&&t.stopPolling()}},e.prototype.cancel=function(){},e.prototype.updateWatch=function(e){var t=this;void 0===e&&(e=this.variables);var i=this.observableQuery;if(!i||"no-cache"!==i.options.fetchPolicy){var s=om(om({},this.getDiffOptions(e)),{watcher:this,callback:function(e){return t.setDiff(e)}});this.lastWatch&&yO(s,this.lastWatch)||(this.cancel(),this.cancel=this.cache.watch(this.lastWatch=s))}},e.prototype.resetLastWrite=function(){this.lastWrite=void 0},e.prototype.shouldWrite=function(e,t){var i=this.lastWrite;return!(i&&i.dmCount===Vb.get(this.cache)&&yO(t,i.variables)&&yO(e.data,i.result.data))},e.prototype.markResult=function(e,t,i,s){var r=this,n=new ov,o=zy(e.errors)?e.errors.slice(0):[];if(this.reset(),"incremental"in e&&zy(e.incremental)){var a=Fv(this.getDiff().result,e);e.data=a}else if("hasNext"in e&&e.hasNext){var c=this.getDiff();e.data=n.merge(c.result,e.data)}this.graphQLErrors=o,"no-cache"===i.fetchPolicy?this.updateLastDiff({result:e.data,complete:!0},this.getDiffOptions(i.variables)):0!==s&&(Wb(e,i.errorPolicy)?this.cache.performTransaction((function(n){if(r.shouldWrite(e,i.variables))n.writeQuery({query:t,data:e.data,variables:i.variables,overwrite:1===s}),r.lastWrite={result:e,variables:i.variables,dmCount:Vb.get(r.cache)};else if(r.lastDiff&&r.lastDiff.diff.complete)return void(e.data=r.lastDiff.diff.result);var o=r.getDiffOptions(i.variables),a=n.diff(o);!r.stopped&&yO(r.variables,i.variables)&&r.updateWatch(i.variables),r.updateLastDiff(a,o),a.complete&&(e.data=a.result)})):this.lastWrite=void 0)},e.prototype.markReady=function(){return this.networkError=null,this.networkStatus=Lb.ready},e.prototype.markError=function(e){return this.networkStatus=Lb.error,this.lastWrite=void 0,this.reset(),e.graphQLErrors&&(this.graphQLErrors=e.graphQLErrors),e.networkError&&(this.networkError=e.networkError),e},e}();function Wb(e,t){void 0===t&&(t="none");var i="ignore"===t||"all"===t,s=!Vv(e);return!s&&i&&e.data&&(s=!0),s}var zb=Object.prototype.hasOwnProperty,qb=Object.create(null),Yb=function(){function e(e){var t=this;this.clientAwareness={},this.queries=new Map,this.fetchCancelFns=new Map,this.transformCache=new vg(Ig["queryManager.getDocumentInfo"]||2e3),this.queryIdCounter=1,this.requestIdCounter=1,this.mutationIdCounter=1,this.inFlightLinkObservables=new Zf(!1);var i=new Gy((function(e){return t.cache.transformDocument(e)}),{cache:!1});this.cache=e.cache,this.link=e.link,this.defaultOptions=e.defaultOptions,this.queryDeduplication=e.queryDeduplication,this.clientAwareness=e.clientAwareness,this.localState=e.localState,this.ssrMode=e.ssrMode,this.assumeImmutableResults=e.assumeImmutableResults;var s=e.documentTransform;this.documentTransform=s?i.concat(s).concat(i):i,this.defaultContext=e.defaultContext||Object.create(null),(this.onBroadcast=e.onBroadcast)&&(this.mutationStore=Object.create(null))}return e.prototype.stop=function(){var e=this;this.queries.forEach((function(t,i){e.stopQueryNoBroadcast(i)})),this.cancelPendingFetches(Cm(26))},e.prototype.cancelPendingFetches=function(e){this.fetchCancelFns.forEach((function(t){return t(e)})),this.fetchCancelFns.clear()},e.prototype.mutate=function(e){return cm(this,arguments,void 0,(function(e){var t,i,s,r,n,o,a,c=e.mutation,l=e.variables,d=e.optimisticResponse,u=e.updateQueries,h=e.refetchQueries,p=void 0===h?[]:h,_=e.awaitRefetchQueries,m=void 0!==_&&_,f=e.update,g=e.onQueryUpdated,y=e.fetchPolicy,v=void 0===y?(null===(o=this.defaultOptions.mutate)||void 0===o?void 0:o.fetchPolicy)||"network-only":y,O=e.errorPolicy,b=void 0===O?(null===(a=this.defaultOptions.mutate)||void 0===a?void 0:a.errorPolicy)||"none":O,I=e.keepRootFields,E=e.context;return lm(this,(function(e){switch(e.label){case 0:return wm(c,27),wm("network-only"===v||"no-cache"===v,28),t=this.generateMutationId(),c=this.cache.transformForLink(this.transform(c)),i=this.getDocumentInfo(c).hasClientExports,l=this.getVariables(c,l),i?[4,this.localState.addExportedVariables(c,l,E)]:[3,2];case 1:l=e.sent(),e.label=2;case 2:return s=this.mutationStore&&(this.mutationStore[t]={mutation:c,variables:l,loading:!0,error:null}),r=d&&this.markMutationOptimistic(d,{mutationId:t,document:c,variables:l,fetchPolicy:v,errorPolicy:b,context:E,updateQueries:u,update:f,keepRootFields:I}),this.broadcastQueries(),n=this,[2,new Promise((function(e,i){return xv(n.getObservableFromLink(c,om(om({},E),{optimisticResponse:r?d:void 0}),l,{},!1),(function(e){if(Vv(e)&&"none"===b)throw new rO({graphQLErrors:Kv(e)});s&&(s.loading=!1,s.error=null);var i=om({},e);return"function"==typeof p&&(p=p(i)),"ignore"===b&&Vv(i)&&delete i.errors,n.markMutationResult({mutationId:t,result:i,document:c,variables:l,fetchPolicy:v,errorPolicy:b,context:E,update:f,updateQueries:u,awaitRefetchQueries:m,refetchQueries:p,removeOptimistic:r?t:void 0,onQueryUpdated:g,keepRootFields:I})})).subscribe({next:function(t){n.broadcastQueries(),"hasNext"in t&&!1!==t.hasNext||e(t)},error:function(e){s&&(s.loading=!1,s.error=e),r&&n.cache.removeOptimistic(t),n.broadcastQueries(),i(e instanceof rO?e:new rO({networkError:e}))}})}))]}}))}))},e.prototype.markMutationResult=function(e,t){var i=this;void 0===t&&(t=this.cache);var s=e.result,r=[],n="no-cache"===e.fetchPolicy;if(!n&&Wb(s,e.errorPolicy)){if(Uv(s)||r.push({result:s.data,dataId:"ROOT_MUTATION",query:e.document,variables:e.variables}),Uv(s)&&zy(s.incremental)){var o=t.diff({id:"ROOT_MUTATION",query:this.getDocumentInfo(e.document).asQuery,variables:e.variables,optimistic:!1,returnPartialData:!0}),a=void 0;o.result&&(a=Fv(o.result,s)),void 0!==a&&(s.data=a,r.push({result:a,dataId:"ROOT_MUTATION",query:e.document,variables:e.variables}))}var c=e.updateQueries;c&&this.queries.forEach((function(e,n){var o=e.observableQuery,a=o&&o.queryName;if(a&&zb.call(c,a)){var l=c[a],d=i.queries.get(n),u=d.document,h=d.variables,p=t.diff({query:u,variables:h,returnPartialData:!0,optimistic:!1}),_=p.result;if(p.complete&&_){var m=l(_,{mutationResult:s,queryName:u&&Qg(u)||void 0,queryVariables:h});m&&r.push({result:m,dataId:"ROOT_QUERY",query:u,variables:h})}}}))}if(r.length>0||(e.refetchQueries||"").length>0||e.update||e.onQueryUpdated||e.removeOptimistic){var l=[];if(this.refetchQueries({updateCache:function(t){n||r.forEach((function(e){return t.write(e)}));var o,a=e.update,c=!(Uv(o=s)||function(e){return"hasNext"in e&&"data"in e}(o))||Uv(s)&&!s.hasNext;if(a){if(!n){var l=t.diff({id:"ROOT_MUTATION",query:i.getDocumentInfo(e.document).asQuery,variables:e.variables,optimistic:!1,returnPartialData:!0});l.complete&&("incremental"in(s=om(om({},s),{data:l.result}))&&delete s.incremental,"hasNext"in s&&delete s.hasNext)}c&&a(t,s,{context:e.context,variables:e.variables})}n||e.keepRootFields||!c||t.modify({id:"ROOT_MUTATION",fields:function(e,t){var i=t.fieldName,s=t.DELETE;return"__typename"===i?e:s}})},include:e.refetchQueries,optimistic:!1,removeOptimistic:e.removeOptimistic,onQueryUpdated:e.onQueryUpdated||null}).forEach((function(e){return l.push(e)})),e.awaitRefetchQueries||e.onQueryUpdated)return Promise.all(l).then((function(){return s}))}return Promise.resolve(s)},e.prototype.markMutationOptimistic=function(e,t){var i=this,s="function"==typeof e?e(t.variables,{IGNORE:qb}):e;return s!==qb&&(this.cache.recordOptimisticTransaction((function(e){try{i.markMutationResult(om(om({},t),{result:{data:s}}),e)}catch(e){!1!==globalThis.__DEV__&&wm.error(e)}}),t.mutationId),!0)},e.prototype.fetchQuery=function(e,t,i){return this.fetchConcastWithInfo(e,t,i).concast.promise},e.prototype.getQueryStore=function(){var e=Object.create(null);return this.queries.forEach((function(t,i){e[i]={variables:t.variables,networkStatus:t.networkStatus,networkError:t.networkError,graphQLErrors:t.graphQLErrors}})),e},e.prototype.resetErrors=function(e){var t=this.queries.get(e);t&&(t.networkError=void 0,t.graphQLErrors=[])},e.prototype.transform=function(e){return this.documentTransform.transformDocument(e)},e.prototype.getDocumentInfo=function(e){var t=this.transformCache;if(!t.has(e)){var i={hasClientExports:qf(e),hasForcedResolvers:this.localState.shouldForceResolvers(e),hasNonreactiveDirective:zf(["nonreactive"],e),clientQuery:this.localState.clientQuery(e),serverQuery:Xy([{name:"client",remove:!0},{name:"connection"},{name:"nonreactive"}],e),defaultVars:ey(Yg(e)),asQuery:om(om({},e),{definitions:e.definitions.map((function(e){return"OperationDefinition"===e.kind&&"query"!==e.operation?om(om({},e),{operation:"query"}):e}))})};t.set(e,i)}return t.get(e)},e.prototype.getVariables=function(e,t){return om(om({},this.getDocumentInfo(e).defaultVars),t)},e.prototype.watchQuery=function(e){var t=this.transform(e.query);void 0===(e=om(om({},e),{variables:this.getVariables(t,e.variables)})).notifyOnNetworkStatusChange&&(e.notifyOnNetworkStatusChange=!1);var i=new $b(this),s=new Hb({queryManager:this,queryInfo:i,options:e});return s.lastQuery=t,this.queries.set(s.queryId,i),i.init({document:t,observableQuery:s,variables:s.variables}),s},e.prototype.query=function(e,t){var i=this;return void 0===t&&(t=this.generateQueryId()),wm(e.query,29),wm("Document"===e.query.kind,30),wm(!e.returnPartialData,31),wm(!e.pollInterval,32),this.fetchQuery(t,om(om({},e),{query:this.transform(e.query)})).finally((function(){return i.stopQuery(t)}))},e.prototype.generateQueryId=function(){return String(this.queryIdCounter++)},e.prototype.generateRequestId=function(){return this.requestIdCounter++},e.prototype.generateMutationId=function(){return String(this.mutationIdCounter++)},e.prototype.stopQueryInStore=function(e){this.stopQueryInStoreNoBroadcast(e),this.broadcastQueries()},e.prototype.stopQueryInStoreNoBroadcast=function(e){var t=this.queries.get(e);t&&t.stop()},e.prototype.clearStore=function(e){return void 0===e&&(e={discardWatches:!0}),this.cancelPendingFetches(Cm(33)),this.queries.forEach((function(e){e.observableQuery?e.networkStatus=Lb.loading:e.stop()})),this.mutationStore&&(this.mutationStore=Object.create(null)),this.cache.reset(e)},e.prototype.getObservableQueries=function(e){var t=this;void 0===e&&(e="active");var i=new Map,s=new Map,r=new Set;return Array.isArray(e)&&e.forEach((function(e){var i;"string"==typeof e?s.set(e,!1):ng(i=e)&&"Document"===i.kind&&Array.isArray(i.definitions)?s.set(t.transform(e),!1):ng(e)&&e.query&&r.add(e)})),this.queries.forEach((function(t,r){var n=t.observableQuery,o=t.document;if(n){if("all"===e)return void i.set(r,n);var a=n.queryName;if("standby"===n.options.fetchPolicy||"active"===e&&!n.hasObservers())return;("active"===e||a&&s.has(a)||o&&s.has(o))&&(i.set(r,n),a&&s.set(a,!0),o&&s.set(o,!0))}})),r.size&&r.forEach((function(e){var s=Sm("legacyOneTimeQuery"),r=t.getQuery(s).init({document:e.query,variables:e.variables}),n=new Hb({queryManager:t,queryInfo:r,options:om(om({},e),{fetchPolicy:"network-only"})});wm(n.queryId===s),r.setObservableQuery(n),i.set(s,n)})),!1!==globalThis.__DEV__&&s.size&&s.forEach((function(e,t){e||!1!==globalThis.__DEV__&&wm.warn("string"==typeof t?34:35,t)})),i},e.prototype.reFetchObservableQueries=function(e){var t=this;void 0===e&&(e=!1);var i=[];return this.getObservableQueries(e?"all":"active").forEach((function(s,r){var n=s.options.fetchPolicy;s.resetLastResults(),(e||"standby"!==n&&"cache-only"!==n)&&i.push(s.refetch()),t.getQuery(r).setDiff(null)})),this.broadcastQueries(),Promise.all(i)},e.prototype.setObservableQuery=function(e){this.getQuery(e.queryId).setObservableQuery(e)},e.prototype.startGraphQLSubscription=function(e){var t=this,i=e.query,s=e.fetchPolicy,r=e.errorPolicy,n=void 0===r?"none":r,o=e.variables,a=e.context,c=void 0===a?{}:a,l=e.extensions,d=void 0===l?{}:l;i=this.transform(i),o=this.getVariables(i,o);var u=function(e){return t.getObservableFromLink(i,c,e,d).map((function(r){"no-cache"!==s&&(Wb(r,n)&&t.cache.write({query:i,result:r.data,dataId:"ROOT_SUBSCRIPTION",variables:e}),t.broadcastQueries());var o=Vv(r),a=function(e){return!!e.extensions&&Array.isArray(e.extensions[iO])}(r);if(o||a){var c={};if(o&&(c.graphQLErrors=r.errors),a&&(c.protocolErrors=r.extensions[iO]),"none"===n||a)throw new rO(c)}return"ignore"===n&&delete r.errors,r}))};if(this.getDocumentInfo(i).hasClientExports){var h=this.localState.addExportedVariables(i,o,c).then(u);return new Pv((function(e){var t=null;return h.then((function(i){return t=i.subscribe(e)}),e.error),function(){return t&&t.unsubscribe()}}))}return u(o)},e.prototype.stopQuery=function(e){this.stopQueryNoBroadcast(e),this.broadcastQueries()},e.prototype.stopQueryNoBroadcast=function(e){this.stopQueryInStoreNoBroadcast(e),this.removeQuery(e)},e.prototype.removeQuery=function(e){this.fetchCancelFns.delete(e),this.queries.has(e)&&(this.getQuery(e).stop(),this.queries.delete(e))},e.prototype.broadcastQueries=function(){this.onBroadcast&&this.onBroadcast(),this.queries.forEach((function(e){return e.notify()}))},e.prototype.getLocalState=function(){return this.localState},e.prototype.getObservableFromLink=function(e,t,i,s,r){var n,o,a=this;void 0===r&&(r=null!==(n=null==t?void 0:t.queryDeduplication)&&void 0!==n?n:this.queryDeduplication);var c=this.getDocumentInfo(e),l=c.serverQuery,d=c.clientQuery;if(l){var u=this.inFlightLinkObservables,h=this.link,p={query:l,variables:i,operationName:Qg(l)||void 0,context:this.prepareContext(om(om({},t),{forceFetch:!r})),extensions:s};if(t=p.context,r){var _=$y(l),m=xg(i),f=u.lookup(_,m);if(!(o=f.observable)){var g=new jv([Zv(h,p)]);o=f.observable=g,g.beforeNext((function(){u.remove(_,m)}))}}else o=new jv([Zv(h,p)])}else o=new jv([Pv.of({data:{}})]),t=this.prepareContext(t);return d&&(o=xv(o,(function(e){return a.localState.runResolvers({document:d,remoteResult:e,context:t,variables:i})}))),o},e.prototype.getResultsFromLink=function(e,t,i){var s=e.lastRequestId=this.generateRequestId(),r=this.cache.transformForLink(i.query);return xv(this.getObservableFromLink(r,i.context,i.variables),(function(n){var o=Kv(n),a=o.length>0,c=i.errorPolicy;if(s>=e.lastRequestId){if(a&&"none"===c)throw e.markError(new rO({graphQLErrors:o}));e.markResult(n,r,i,t),e.markReady()}var l={data:n.data,loading:!1,networkStatus:Lb.ready};return a&&"none"===c&&(l.data=void 0),a&&"ignore"!==c&&(l.errors=o,l.networkStatus=Lb.error),l}),(function(t){var i=sO(t)?t:new rO({networkError:t});throw s>=e.lastRequestId&&e.markError(i),i}))},e.prototype.fetchConcastWithInfo=function(e,t,i,s){var r=this;void 0===i&&(i=Lb.loading),void 0===s&&(s=t.query);var n,o,a=this.getVariables(s,t.variables),c=this.getQuery(e),l=this.defaultOptions.watchQuery,d=t.fetchPolicy,u=void 0===d?l&&l.fetchPolicy||"cache-first":d,h=t.errorPolicy,p=void 0===h?l&&l.errorPolicy||"none":h,_=t.returnPartialData,m=void 0!==_&&_,f=t.notifyOnNetworkStatusChange,g=void 0!==f&&f,y=t.context,v=void 0===y?{}:y,O=Object.assign({},t,{query:s,variables:a,fetchPolicy:u,errorPolicy:p,returnPartialData:m,notifyOnNetworkStatusChange:g,context:v}),b=function(e){O.variables=e;var s=r.fetchQueryByPolicy(c,O,i);return"standby"!==O.fetchPolicy&&s.sources.length>0&&c.observableQuery&&c.observableQuery.applyNextFetchPolicy("after-fetch",t),s},I=function(){return r.fetchCancelFns.delete(e)};if(this.fetchCancelFns.set(e,(function(e){I(),setTimeout((function(){return n.cancel(e)}))})),this.getDocumentInfo(O.query).hasClientExports)n=new jv(this.localState.addExportedVariables(O.query,O.variables,O.context).then(b).then((function(e){return e.sources}))),o=!0;else{var E=b(O.variables);o=E.fromLink,n=new jv(E.sources)}return n.promise.then(I,I),{concast:n,fromLink:o}},e.prototype.refetchQueries=function(e){var t=this,i=e.updateCache,s=e.include,r=e.optimistic,n=void 0!==r&&r,o=e.removeOptimistic,a=void 0===o?n?Sm("refetchQueries"):void 0:o,c=e.onQueryUpdated,l=new Map;s&&this.getObservableQueries(s).forEach((function(e,i){l.set(i,{oq:e,lastDiff:t.getQuery(i).getDiff()})}));var d=new Map;return i&&this.cache.batch({update:i,optimistic:n&&a||!1,removeOptimistic:a,onWatchUpdated:function(e,t,i){var s=e.watcher instanceof $b&&e.watcher.observableQuery;if(s){if(c){l.delete(s.queryId);var r=c(s,t,i);return!0===r&&(r=s.refetch()),!1!==r&&d.set(s,r),r}null!==c&&l.set(s.queryId,{oq:s,lastDiff:i,diff:t})}}}),l.size&&l.forEach((function(e,i){var s,r=e.oq,n=e.lastDiff,o=e.diff;if(c){if(!o){var a=r.queryInfo;a.reset(),o=a.getDiff()}s=c(r,o,n)}c&&!0!==s||(s=r.refetch()),!1!==s&&d.set(r,s),i.indexOf("legacyOneTimeQuery")>=0&&t.stopQueryNoBroadcast(i)})),a&&this.cache.removeOptimistic(a),d},e.prototype.fetchQueryByPolicy=function(e,t,i){var s=this,r=t.query,n=t.variables,o=t.fetchPolicy,a=t.refetchWritePolicy,c=t.errorPolicy,l=t.returnPartialData,d=t.context,u=t.notifyOnNetworkStatusChange,h=e.networkStatus;e.init({document:r,variables:n,networkStatus:i});var p=function(){return e.getDiff()},_=function(t,i){void 0===i&&(i=e.networkStatus||Lb.loading);var o=t.result;!1===globalThis.__DEV__||l||yO(o,{})||Bb(t.missing);var a=function(e){return Pv.of(om({data:e,loading:Mb(i),networkStatus:i},t.complete?null:{partial:!0}))};return o&&s.getDocumentInfo(r).hasForcedResolvers?s.localState.runResolvers({document:r,remoteResult:{data:o},context:d,variables:n,onlyRunForcedResolvers:!0}).then((function(e){return a(e.data||void 0)})):"none"===c&&i===Lb.refetch&&Array.isArray(t.missing)?a(void 0):a(o)},m="no-cache"===o?0:i===Lb.refetch&&"merge"!==a?1:2,f=function(){return s.getResultsFromLink(e,m,{query:r,variables:n,context:d,fetchPolicy:o,errorPolicy:c})},g=u&&"number"==typeof h&&h!==i&&Mb(i);switch(o){default:case"cache-first":return(y=p()).complete?{fromLink:!1,sources:[_(y,e.markReady())]}:l||g?{fromLink:!0,sources:[_(y),f()]}:{fromLink:!0,sources:[f()]};case"cache-and-network":var y;return(y=p()).complete||l||g?{fromLink:!0,sources:[_(y),f()]}:{fromLink:!0,sources:[f()]};case"cache-only":return{fromLink:!1,sources:[_(p(),e.markReady())]};case"network-only":return g?{fromLink:!0,sources:[_(p()),f()]}:{fromLink:!0,sources:[f()]};case"no-cache":return g?{fromLink:!0,sources:[_(e.getDiff()),f()]}:{fromLink:!0,sources:[f()]};case"standby":return{fromLink:!1,sources:[]}}},e.prototype.getQuery=function(e){return e&&!this.queries.has(e)&&this.queries.set(e,new $b(this,e)),this.queries.get(e)},e.prototype.prepareContext=function(e){void 0===e&&(e={});var t=this.localState.prepareContext(e);return om(om(om({},this.defaultContext),t),{clientAwareness:this.clientAwareness})},e}(),Qb=function(){function e(e){var t=e.cache,i=e.client,s=e.resolvers,r=e.fragmentMatcher;this.selectionsToResolveCache=new WeakMap,this.cache=t,i&&(this.client=i),s&&this.addResolvers(s),r&&this.setFragmentMatcher(r)}return e.prototype.addResolvers=function(e){var t=this;this.resolvers=this.resolvers||{},Array.isArray(e)?e.forEach((function(e){t.resolvers=sv(t.resolvers,e)})):this.resolvers=sv(this.resolvers,e)},e.prototype.setResolvers=function(e){this.resolvers={},this.addResolvers(e)},e.prototype.getResolvers=function(){return this.resolvers||{}},e.prototype.runResolvers=function(e){return cm(this,arguments,void 0,(function(e){var t=e.document,i=e.remoteResult,s=e.context,r=e.variables,n=e.onlyRunForcedResolvers,o=void 0!==n&&n;return lm(this,(function(e){return t?[2,this.resolveDocument(t,i.data,s,r,this.fragmentMatcher,o).then((function(e){return om(om({},i),{data:e.result})}))]:[2,i]}))}))},e.prototype.setFragmentMatcher=function(e){this.fragmentMatcher=e},e.prototype.getFragmentMatcher=function(){return this.fragmentMatcher},e.prototype.clientQuery=function(e){return zf(["client"],e)&&this.resolvers?e:null},e.prototype.serverQuery=function(e){return tv(e)},e.prototype.prepareContext=function(e){var t=this.cache;return om(om({},e),{cache:t,getCacheKey:function(e){return t.identify(e)}})},e.prototype.addExportedVariables=function(e){return cm(this,arguments,void 0,(function(e,t,i){return void 0===t&&(t={}),void 0===i&&(i={}),lm(this,(function(s){return e?[2,this.resolveDocument(e,this.buildRootValueFromCache(e,t)||{},this.prepareContext(i),t).then((function(e){return om(om({},t),e.exportedVariables)}))]:[2,om({},t)]}))}))},e.prototype.shouldForceResolvers=function(e){var t=!1;return Hf(e,{Directive:{enter:function(e){if("client"===e.name.value&&e.arguments&&(t=e.arguments.some((function(e){return"always"===e.name.value&&"BooleanValue"===e.value.kind&&!0===e.value.value}))))return kf}}}),t},e.prototype.buildRootValueFromCache=function(e,t){return this.cache.diff({query:ev(e),variables:t,returnPartialData:!0,optimistic:!1}).result},e.prototype.resolveDocument=function(e,t){return cm(this,arguments,void 0,(function(e,t,i,s,r,n){var o,a,c,l,d,u,h,p,_,m;return void 0===i&&(i={}),void 0===s&&(s={}),void 0===r&&(r=function(){return!0}),void 0===n&&(n=!1),lm(this,(function(f){return o=Zg(e),a=Jg(e),c=ag(a),l=this.collectSelectionsToResolve(o,c),d=o.operation,u=d?d.charAt(0).toUpperCase()+d.slice(1):"Query",p=(h=this).cache,_=h.client,m={fragmentMap:c,context:om(om({},i),{cache:p,client:_}),variables:s,fragmentMatcher:r,defaultOperationType:u,exportedVariables:{},selectionsToResolve:l,onlyRunForcedResolvers:n},[2,this.resolveSelectionSet(o.selectionSet,!1,t,m).then((function(e){return{result:e,exportedVariables:m.exportedVariables}}))]}))}))},e.prototype.resolveSelectionSet=function(e,t,i,s){return cm(this,void 0,void 0,(function(){var r,n,o,a,c,l=this;return lm(this,(function(d){return r=s.fragmentMap,n=s.context,o=s.variables,a=[i],c=function(e){return cm(l,void 0,void 0,(function(){var c,l;return lm(this,(function(d){return(t||s.selectionsToResolve.has(e))&&Wf(e,o)?zg(e)?[2,this.resolveField(e,t,i,s).then((function(t){var i;void 0!==t&&a.push(((i={})[$g(e)]=t,i))}))]:(function(e){return"InlineFragment"===e.kind}(e)?c=e:(c=r[e.name.value],wm(c,18,e.name.value)),c&&c.typeCondition&&(l=c.typeCondition.name.value,s.fragmentMatcher(i,l,n))?[2,this.resolveSelectionSet(c.selectionSet,t,i,s).then((function(e){a.push(e)}))]:[2]):[2]}))}))},[2,Promise.all(e.selections.map(c)).then((function(){return rv(a)}))]}))}))},e.prototype.resolveField=function(e,t,i,s){return cm(this,void 0,void 0,(function(){var r,n,o,a,c,l,d,u,h,p=this;return lm(this,(function(_){return i?(r=s.variables,n=e.name.value,o=$g(e),a=n!==o,c=i[o]||i[n],l=Promise.resolve(c),s.onlyRunForcedResolvers&&!this.shouldForceResolvers(e)||(d=i.__typename||s.defaultOperationType,(u=this.resolvers&&this.resolvers[d])&&(h=u[a?n:o])&&(l=Promise.resolve(tb.withValue(this.cache,h,[i,Gg(e,r),s.context,{field:e,fragmentMap:s.fragmentMap}])))),[2,l.then((function(i){var r,n;if(void 0===i&&(i=c),e.directives&&e.directives.forEach((function(e){"export"===e.name.value&&e.arguments&&e.arguments.forEach((function(e){"as"===e.name.value&&"StringValue"===e.value.kind&&(s.exportedVariables[e.value.value]=i)}))})),!e.selectionSet)return i;if(null==i)return i;var o=null!==(n=null===(r=e.directives)||void 0===r?void 0:r.some((function(e){return"client"===e.name.value})))&&void 0!==n&&n;return Array.isArray(i)?p.resolveSubSelectedArray(e,t||o,i,s):e.selectionSet?p.resolveSelectionSet(e.selectionSet,t||o,i,s):void 0}))]):[2,null]}))}))},e.prototype.resolveSubSelectedArray=function(e,t,i,s){var r=this;return Promise.all(i.map((function(i){return null===i?null:Array.isArray(i)?r.resolveSubSelectedArray(e,t,i,s):e.selectionSet?r.resolveSelectionSet(e.selectionSet,t,i,s):void 0})))},e.prototype.collectSelectionsToResolve=function(e,t){var i=function(e){return!Array.isArray(e)},s=this.selectionsToResolveCache;return function e(r){if(!s.has(r)){var n=new Set;s.set(r,n),Hf(r,{Directive:function(e,t,s,r,o){"client"===e.name.value&&o.forEach((function(e){i(e)&&$f(e)&&n.add(e)}))},FragmentSpread:function(s,r,o,a,c){var l=t[s.name.value];wm(l,19,s.name.value);var d=e(l);d.size>0&&(c.forEach((function(e){i(e)&&$f(e)&&n.add(e)})),n.add(s),d.forEach((function(e){n.add(e)})))}})}return s.get(r)}(e)},e}(),Jb=!1,Xb=function(){function e(e){var t=this;if(this.resetStoreCallbacks=[],this.clearStoreCallbacks=[],!e.cache)throw Cm(15);var i=e.uri,s=e.credentials,r=e.headers,n=e.cache,o=e.documentTransform,a=e.ssrMode,c=void 0!==a&&a,l=e.ssrForceFetchDelay,d=void 0===l?0:l,u=e.connectToDevTools,h=e.queryDeduplication,p=void 0===h||h,_=e.defaultOptions,m=e.defaultContext,f=e.assumeImmutableResults,g=void 0===f?n.assumeImmutableResults:f,y=e.resolvers,v=e.typeDefs,O=e.fragmentMatcher,b=e.name,I=e.version,E=e.devtools,T=e.link;T||(T=i?new pO({uri:i,credentials:s,headers:r}):Jv.empty()),this.link=T,this.cache=n,this.disableNetworkFetches=c||d>0,this.queryDeduplication=p,this.defaultOptions=_||Object.create(null),this.typeDefs=v,this.devtoolsConfig=om(om({},E),{enabled:(null==E?void 0:E.enabled)||u}),void 0===this.devtoolsConfig.enabled&&(this.devtoolsConfig.enabled=!1!==globalThis.__DEV__),d&&setTimeout((function(){return t.disableNetworkFetches=!1}),d),this.watchQuery=this.watchQuery.bind(this),this.query=this.query.bind(this),this.mutate=this.mutate.bind(this),this.watchFragment=this.watchFragment.bind(this),this.resetStore=this.resetStore.bind(this),this.reFetchObservableQueries=this.reFetchObservableQueries.bind(this),this.version=bm,this.localState=new Qb({cache:n,client:this,resolvers:y,fragmentMatcher:O}),this.queryManager=new Yb({cache:this.cache,link:this.link,defaultOptions:this.defaultOptions,defaultContext:m,documentTransform:o,queryDeduplication:p,ssrMode:c,clientAwareness:{name:b,version:I},localState:this.localState,assumeImmutableResults:g,onBroadcast:this.devtoolsConfig.enabled?function(){t.devToolsHookCb&&t.devToolsHookCb({action:{},state:{queries:t.queryManager.getQueryStore(),mutations:t.queryManager.mutationStore||{}},dataWithOptimisticResults:t.cache.extract(!0)})}:void 0}),this.devtoolsConfig.enabled&&this.connectToDevTools()}return e.prototype.connectToDevTools=function(){if("undefined"!=typeof window){var e=window,t=Symbol.for("apollo.devtools");(e[t]=e[t]||[]).push(this),e.__APOLLO_CLIENT__=this,Jb||!1===globalThis.__DEV__||(Jb=!0,window.document&&window.top===window.self&&/^(https?|file):$/.test(window.location.protocol)&&setTimeout((function(){if(!window.__APOLLO_DEVTOOLS_GLOBAL_HOOK__){var e=window.navigator,t=e&&e.userAgent,i=void 0;"string"==typeof t&&(t.indexOf("Chrome/")>-1?i="https://chrome.google.com/webstore/detail/apollo-client-developer-t/jdkknkkbebbapilgoeccciglkfbmbnfm":t.indexOf("Firefox/")>-1&&(i="https://addons.mozilla.org/en-US/firefox/addon/apollo-developer-tools/")),i&&!1!==globalThis.__DEV__&&wm.log("Download the Apollo DevTools for a better development experience: %s",i)}}),1e4))}},Object.defineProperty(e.prototype,"documentTransform",{get:function(){return this.queryManager.documentTransform},enumerable:!1,configurable:!0}),e.prototype.stop=function(){this.queryManager.stop()},e.prototype.watchQuery=function(e){return this.defaultOptions.watchQuery&&(e=$v(this.defaultOptions.watchQuery,e)),!this.disableNetworkFetches||"network-only"!==e.fetchPolicy&&"cache-and-network"!==e.fetchPolicy||(e=om(om({},e),{fetchPolicy:"cache-first"})),this.queryManager.watchQuery(e)},e.prototype.query=function(e){return this.defaultOptions.query&&(e=$v(this.defaultOptions.query,e)),wm("cache-and-network"!==e.fetchPolicy,16),this.disableNetworkFetches&&"network-only"===e.fetchPolicy&&(e=om(om({},e),{fetchPolicy:"cache-first"})),this.queryManager.query(e)},e.prototype.mutate=function(e){return this.defaultOptions.mutate&&(e=$v(this.defaultOptions.mutate,e)),this.queryManager.mutate(e)},e.prototype.subscribe=function(e){return this.queryManager.startGraphQLSubscription(e)},e.prototype.readQuery=function(e,t){return void 0===t&&(t=!1),this.cache.readQuery(e,t)},e.prototype.watchFragment=function(e){return this.cache.watchFragment(e)},e.prototype.readFragment=function(e,t){return void 0===t&&(t=!1),this.cache.readFragment(e,t)},e.prototype.writeQuery=function(e){var t=this.cache.writeQuery(e);return!1!==e.broadcast&&this.queryManager.broadcastQueries(),t},e.prototype.writeFragment=function(e){var t=this.cache.writeFragment(e);return!1!==e.broadcast&&this.queryManager.broadcastQueries(),t},e.prototype.__actionHookForDevTools=function(e){this.devToolsHookCb=e},e.prototype.__requestRaw=function(e){return Zv(this.link,e)},e.prototype.resetStore=function(){var e=this;return Promise.resolve().then((function(){return e.queryManager.clearStore({discardWatches:!1})})).then((function(){return Promise.all(e.resetStoreCallbacks.map((function(e){return e()})))})).then((function(){return e.reFetchObservableQueries()}))},e.prototype.clearStore=function(){var e=this;return Promise.resolve().then((function(){return e.queryManager.clearStore({discardWatches:!0})})).then((function(){return Promise.all(e.clearStoreCallbacks.map((function(e){return e()})))}))},e.prototype.onResetStore=function(e){var t=this;return this.resetStoreCallbacks.push(e),function(){t.resetStoreCallbacks=t.resetStoreCallbacks.filter((function(t){return t!==e}))}},e.prototype.onClearStore=function(e){var t=this;return this.clearStoreCallbacks.push(e),function(){t.clearStoreCallbacks=t.clearStoreCallbacks.filter((function(t){return t!==e}))}},e.prototype.reFetchObservableQueries=function(e){return this.queryManager.reFetchObservableQueries(e)},e.prototype.refetchQueries=function(e){var t=this.queryManager.refetchQueries(e),i=[],s=[];t.forEach((function(e,t){i.push(t),s.push(e)}));var r=Promise.all(s);return r.queries=i,r.results=s,r.catch((function(e){!1!==globalThis.__DEV__&&wm.debug(17,e)})),r},e.prototype.getObservableQueries=function(e){return void 0===e&&(e="active"),this.queryManager.getObservableQueries(e)},e.prototype.extract=function(e){return this.cache.extract(e)},e.prototype.restore=function(e){return this.cache.restore(e)},e.prototype.addResolvers=function(e){this.localState.addResolvers(e)},e.prototype.setResolvers=function(e){this.localState.setResolvers(e)},e.prototype.getResolvers=function(){return this.localState.getResolvers()},e.prototype.setLocalStateFragmentMatcher=function(e){this.localState.setFragmentMatcher(e)},e.prototype.setLink=function(e){this.link=this.queryManager.link=e},Object.defineProperty(e.prototype,"defaultContext",{get:function(){return this.queryManager.defaultContext},enumerable:!1,configurable:!0}),e}();!1!==globalThis.__DEV__&&(Xb.prototype.getMemoryInternals=Sg);var Zb=function(){return Zb=Object.assign||function(e){for(var t,i=1,s=arguments.length;i<s;i++)for(var r in t=arguments[i])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},Zb.apply(this,arguments)},eI=new Map,tI=new Map,iI=!0,sI=!1;function rI(e){return e.replace(/[\s,]+/g," ").trim()}function nI(e){var t,i,s,r=rI(e);if(!eI.has(r)){var n=function(e,t){return new Rf(e,t).parseDocument()}(e,{experimentalFragmentVariables:sI,allowLegacyFragmentVariables:sI});if(!n||"Document"!==n.kind)throw new Error("Not a valid GraphQL document.");eI.set(r,function(e){var t=new Set(e.definitions);t.forEach((function(e){e.loc&&delete e.loc,Object.keys(e).forEach((function(i){var s=e[i];s&&"object"==typeof s&&t.add(s)}))}));var i=e.loc;return i&&(delete i.startToken,delete i.endToken),e}((t=n,i=new Set,s=[],t.definitions.forEach((function(e){if("FragmentDefinition"===e.kind){var t=e.name.value,r=rI((o=e.loc).source.body.substring(o.start,o.end)),n=tI.get(t);n&&!n.has(r)?iI&&console.warn("Warning: fragment with name "+t+" already exists.\ngraphql-tag enforces all fragment names across your application to be unique; read more about\nthis in the docs: http://dev.apollodata.com/core/fragments.html#unique-names"):n||tI.set(t,n=new Set),n.add(r),i.has(r)||(i.add(r),s.push(e))}else s.push(e);var o})),Zb(Zb({},t),{definitions:s}))))}return eI.get(r)}function oI(e){for(var t=[],i=1;i<arguments.length;i++)t[i-1]=arguments[i];"string"==typeof e&&(e=[e]);var s=e[0];return t.forEach((function(t,i){t&&"Document"===t.kind?s+=t.loc.source.body:s+=t,s+=e[i+1]})),nI(s)}var aI,cI=oI;(aI=oI||(oI={})).gql=cI,aI.resetCaches=function(){eI.clear(),tI.clear()},aI.disableFragmentWarnings=function(){iI=!1},aI.enableExperimentalFragmentVariables=function(){sI=!0},aI.disableExperimentalFragmentVariables=function(){sI=!1},oI.default=oI;var lI=function(){function e(e,t,i,s,r){var n=this;this.observer=e,this.operation=t,this.forward=i,this.delayFor=s,this.retryIf=r,this.retryCount=0,this.currentSubscription=null,this.onError=function(e){return cm(n,void 0,void 0,(function(){return lm(this,(function(t){switch(t.label){case 0:return this.retryCount+=1,[4,this.retryIf(this.retryCount,this.operation,e)];case 1:return t.sent()?(this.scheduleRetry(this.delayFor(this.retryCount,this.operation,e)),[2]):(this.observer.error(e),[2])}}))}))},this.try()}return e.prototype.cancel=function(){this.currentSubscription&&this.currentSubscription.unsubscribe(),clearTimeout(this.timerId),this.timerId=void 0,this.currentSubscription=null},e.prototype.try=function(){this.currentSubscription=this.forward(this.operation).subscribe({next:this.observer.next.bind(this.observer),error:this.onError,complete:this.observer.complete.bind(this.observer)})},e.prototype.scheduleRetry=function(e){var t=this;if(this.timerId)throw new Error("RetryLink BUG! Encountered overlapping retries");this.timerId=setTimeout((function(){t.timerId=void 0,t.try()}),e)},e}(),dI=function(e){function t(t){var i=e.call(this)||this,s=t||{},r=s.attempts,n=s.delay;return i.delayFor="function"==typeof n?n:function(e){var t=e||{},i=t.initial,s=void 0===i?300:i,r=t.jitter,n=void 0===r||r,o=t.max,a=void 0===o?1/0:o,c=n?s:s/2;return function(e){var t=Math.min(a,c*Math.pow(2,e));return n&&(t=Math.random()*t),t}}(n),i.retryIf="function"==typeof r?r:function(e){var t=e||{},i=t.retryIf,s=t.max,r=void 0===s?5:s;return function(e,t,s){return!(e>=r)&&(i?i(s,t):!!s)}}(r),i}return nm(t,e),t.prototype.request=function(e,t){var i=this;return new Pv((function(s){var r=new lI(s,e,t,i.delayFor,i.retryIf);return function(){r.cancel()}}))},t}(Jv);const uI=["repo_size","repo_version",{renditionLink:["href","templated"]},{blockDownloadLink:["href","templated"]},{blockUploadLink:["href","templated"]}],hI=[{appMetadata:['am: valueOf(key: "")']},"dc_format",{labels:["lastAccessDate",{favorite:["isFavorite"]}]},{effectivePermissions:["default","primary","applicationMetadata","aclPolicy","directory","annotations"]},"repo_ancestors","repo_assetClass","repo_assetType","repo_assetSubType","primary_etag","repo_assetId","repo_createDate",{repo_createdBy:["id"]},"repo_modifiedBy","repo_modifyDate","repo_name","repo_path","repo_state",{storage_assignee:["id","type"]},"storage_deviceCreateDate","storage_deviceModifyDate","storage_region",{repository:["repo_repositoryId",{repo_owner:["id","type"]},"repo_repositoryType"]},{primaryLink:["href","templated"]},{operation:"Composite",fields:uI,fragment:!0},{operation:"File",fields:[...uI,"tiff_imageLength","tiff_imageWidth"],fragment:!0},{operation:"Directory",fields:[{pageLink:["href","templated"]},{blockUploadLink:["href","templated"]}],fragment:!0}];var pI;!function(e){e.READ="READ",e.WRITE="WRITE",e.ACK="ACK",e.DELETE="DELETE"}(pI||(pI={}));const _I={name:"NAME",created:"CREATE_DATE",modified:"MODIFY_DATE",shared:"MODIFY_DATE"};var mI,fI={},gI={},yI={},vI={};Object.defineProperty(vI,"__esModule",{value:!0}),function(e){e.Mutation="mutation",e.Query="query",e.Subscription="subscription"}(mI||(mI={})),vI.default=mI;var OI={},bI={};Object.defineProperty(bI,"__esModule",{value:!0}),bI.isNestedField=void 0,bI.isNestedField=function(e){return"object"==typeof e&&e.hasOwnProperty("operation")&&e.hasOwnProperty("variables")&&e.hasOwnProperty("fields")||"object"==typeof e&&e.hasOwnProperty("operation")&&e.hasOwnProperty("fragment")&&e.hasOwnProperty("fields")};var II=pt&&pt.__assign||function(){return II=Object.assign||function(e){for(var t,i=1,s=arguments.length;i<s;i++)for(var r in t=arguments[i])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},II.apply(this,arguments)};Object.defineProperty(OI,"__esModule",{value:!0});var EI=bI,TI=function(){function e(){}return e.resolveVariables=function(t){for(var i={},s=0,r=t;s<r.length;s++){var n=r[s],o=n.variables,a=n.fields;i=II(II(II({},i),o),a&&e.getNestedVariables(a)||{})}return i},e.queryDataNameAndArgumentMap=function(e){return e&&Object.keys(e).length?"(".concat(Object.entries(e).reduce((function(e,t,i){var s=t[0],r=t[1];return"".concat(e).concat(0!==i?", ":"").concat(r&&r.name?r.name:s,": $").concat(s)}),""),")"):""},e.queryFieldsMap=function(t){var i=this;return t?t.map((function(t){if((0,EI.isNestedField)(t))return e.queryNestedFieldMap(t);if("object"==typeof t){var s="";return Object.entries(t).forEach((function(e,t,r){var n=e[0],o=e[1];s+="".concat(n," ").concat(o.length>0?"{ "+i.queryFieldsMap(o)+" }":""),t<r.length-1&&(s+=", ")})),s}return"".concat(t)})).join(", "):""},e.operationOrAlias=function(e){return"string"==typeof e?e:"".concat(e.alias,": ").concat(e.name)},e.isFragment=function(e){var t;return null!==(t=!0===(null==e?void 0:e.fragment))&&void 0!==t&&t},e.operationOrFragment=function(t){return e.isFragment(t)?t.operation:e.operationOrAlias(t.operation)},e.getFragment=function(t){return e.isFragment(t)?"... on ":""},e.queryNestedFieldMap=function(t){return"".concat(e.getFragment(t)).concat(e.operationOrFragment(t)," ").concat(this.isFragment(t)?"":this.queryDataNameAndArgumentMap(t.variables)," ").concat(t.fields.length>0?"{ "+this.queryFieldsMap(t.fields)+" }":"")},e.queryVariablesMap=function(t,i){var s={},r=function(e){e&&Object.keys(e).map((function(t){s[t]="object"==typeof e[t]?e[t].value:e[t]}))};return r(t),i&&"object"==typeof i&&r(e.getNestedVariables(i)),s},e.getNestedVariables=function(e){var t={};return function e(i){return null==i||i.forEach((function(i){if((0,EI.isNestedField)(i))t=II(II(II({},i.variables),t),i.fields&&e(i.fields));else if("object"==typeof i)for(var s=0,r=Object.entries(i);s<r.length;s++)e(r[s][1])})),t}(e),t},e.queryDataType=function(e){var t="String",i="object"==typeof e?e.value:e;if(null!=(null==e?void 0:e.type))t=e.type;else{var s=Array.isArray(i)?i[0]:i;switch(typeof s){case"object":t="Object";break;case"boolean":t="Boolean";break;case"number":t=s%1==0?"Int":"Float"}}return"object"==typeof e&&(!0===e.list?t="[".concat(t,"]"):Array.isArray(e.list)&&(t="[".concat(t).concat(e.list[0]?"!":"","]")),e.required&&(t+="!")),t},e}();OI.default=TI,Object.defineProperty(yI,"__esModule",{value:!0});var SI=vI,AI=OI,PI=function(){function e(e){Array.isArray(e)?this.variables=AI.default.resolveVariables(e):(this.variables=e.variables,this.fields=e.fields,this.operation=e.operation)}return e.prototype.mutationBuilder=function(){return this.operationWrapperTemplate(this.variables,this.operationTemplate(this.operation))},e.prototype.mutationsBuilder=function(e){var t=this,i=e.map((function(e){return t.operation=e.operation,t.variables=e.variables,t.fields=e.fields,t.operationTemplate(e.operation)}));return this.operationWrapperTemplate(AI.default.resolveVariables(e),i.join("\n "))},e.prototype.queryDataNameAndArgumentMap=function(){return this.variables&&Object.keys(this.variables).length?"(".concat(Object.keys(this.variables).reduce((function(e,t,i){return"".concat(e).concat(0!==i?", ":"").concat(t,": $").concat(t)}),""),")"):""},e.prototype.queryDataArgumentAndTypeMap=function(e){return Object.keys(e).length?"(".concat(Object.keys(e).reduce((function(t,i,s){return"".concat(t).concat(0!==s?", ":"","$").concat(i,": ").concat(AI.default.queryDataType(e[i]))}),""),")"):""},e.prototype.operationWrapperTemplate=function(e,t){var i="string"==typeof this.operation?this.operation:this.operation.name;return{query:"".concat(SI.default.Mutation," ").concat(i.charAt(0).toUpperCase()+i.slice(1)," ").concat(this.queryDataArgumentAndTypeMap(e)," {\n ").concat(t,"\n}"),variables:AI.default.queryVariablesMap(e)}},e.prototype.operationTemplate=function(e){var t="string"==typeof e?e:"".concat(e.alias,": ").concat(e.name);return"".concat(t," ").concat(this.queryDataNameAndArgumentMap()," {\n ").concat(this.queryFieldsMap(this.fields),"\n }")},e.prototype.queryFieldsMap=function(e){var t=this;return Array.isArray(e)?e.map((function(e){return"object"==typeof e?"".concat(Object.keys(e)[0]," { ").concat(t.queryFieldsMap(Object.values(e)[0])," }"):"".concat(e)})).join(", "):""},e}();yI.default=PI;var wI={};Object.defineProperty(wI,"__esModule",{value:!0});var CI=vI,RI=OI,LI=function(){function e(e){this.queryDataType=function(e){var t="String",i="object"==typeof e?e.value:e;if(void 0!==e.type)t=e.type;else switch(typeof i){case"object":t="Object";break;case"boolean":t="Boolean";break;case"number":t=i%1==0?"Int":"Float"}return"object"==typeof e&&e.required&&(t+="!"),t},Array.isArray(e)?this.variables=RI.default.resolveVariables(e):(this.variables=e.variables,this.fields=e.fields||[],this.operation=e.operation)}return e.prototype.queryBuilder=function(){return this.operationWrapperTemplate(this.operationTemplate())},e.prototype.queriesBuilder=function(e){var t,i=this;return this.operationWrapperTemplate((t=[],e.forEach((function(e){e&&(i.operation=e.operation,i.fields=e.fields,i.variables=e.variables,t.push(i.operationTemplate()))})),t.join(" ")))},e.prototype.queryDataNameAndArgumentMap=function(){return this.variables&&Object.keys(this.variables).length?"(".concat(Object.keys(this.variables).reduce((function(e,t,i){return"".concat(e).concat(0!==i?", ":"").concat(t,": $").concat(t)}),""),")"):""},e.prototype.queryDataArgumentAndTypeMap=function(){var e=this;return this.variables&&Object.keys(this.variables).length?"(".concat(Object.keys(this.variables).reduce((function(t,i,s){return"".concat(t).concat(0!==s?", ":"","$").concat(i,": ").concat(e.queryDataType(e.variables[i]))}),""),")"):""},e.prototype.operationWrapperTemplate=function(e){var t="string"==typeof this.operation?this.operation:this.operation.name;return{query:"".concat(CI.default.Query," ").concat(t.charAt(0).toUpperCase()).concat(t.slice(1)," ").concat(this.queryDataArgumentAndTypeMap()," { ").concat(e," }"),variables:RI.default.queryVariablesMap(this.variables)}},e.prototype.operationTemplate=function(){var e="string"==typeof this.operation?this.operation:"".concat(this.operation.alias,": ").concat(this.operation.name);return"".concat(e," ").concat(this.queryDataNameAndArgumentMap()," { nodes { ").concat(RI.default.queryFieldsMap(this.fields)," } }")},e}();wI.default=LI,Object.defineProperty(gI,"__esModule",{value:!0});var NI=yI,DI=wI;gI.default={DefaultAppSyncQueryAdapter:DI.default,DefaultAppSyncMutationAdapter:NI.default};var MI={},xI=pt&&pt.__assign||function(){return xI=Object.assign||function(e){for(var t,i=1,s=arguments.length;i<s;i++)for(var r in t=arguments[i])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},xI.apply(this,arguments)};Object.defineProperty(MI,"__esModule",{value:!0});var kI=vI,HI=OI,jI=function(){function e(e,t){var i=this;Array.isArray(e)?this.variables=HI.default.resolveVariables(e):(this.variables=e.variables,this.fields=e.fields,this.operation=e.operation),this.config={operationName:""},t&&Object.entries(t).forEach((function(e){var t=e[0],s=e[1];i.config[t]=s}))}return e.prototype.mutationBuilder=function(){return this.operationWrapperTemplate(kI.default.Mutation,this.variables,this.operationTemplate(this.operation))},e.prototype.mutationsBuilder=function(e){var t=this,i=e.map((function(e){return t.operation=e.operation,t.variables=e.variables,t.fields=e.fields,t.operationTemplate(e.operation)}));return this.operationWrapperTemplate(kI.default.Mutation,HI.default.resolveVariables(e),i.join("\n "))},e.prototype.queryDataArgumentAndTypeMap=function(e){return this.fields&&"object"==typeof this.fields&&(e=xI(xI({},HI.default.getNestedVariables(this.fields)),e)),e&&Object.keys(e).length>0?"(".concat(Object.keys(e).reduce((function(t,i,s){return"".concat(t).concat(0!==s?", ":"","$").concat(i,": ").concat(HI.default.queryDataType(e[i]))}),""),")"):""},e.prototype.operationWrapperTemplate=function(e,t,i){var s="".concat(e," ").concat(this.queryDataArgumentAndTypeMap(t)," {\n ").concat(i,"\n }");return this.config.operationName&&(s=s.replace("mutation","mutation ".concat(this.config.operationName))),{query:s,variables:HI.default.queryVariablesMap(t,this.fields)}},e.prototype.operationTemplate=function(e){var t="string"==typeof e?e:"".concat(e.alias,": ").concat(e.name);return"".concat(t," ").concat(HI.default.queryDataNameAndArgumentMap(this.variables)," ").concat(this.fields&&this.fields.length>0?"{\n ".concat(HI.default.queryFieldsMap(this.fields),"\n }"):"")},e}();MI.default=jI;var UI={},BI=pt&&pt.__assign||function(){return BI=Object.assign||function(e){for(var t,i=1,s=arguments.length;i<s;i++)for(var r in t=arguments[i])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},BI.apply(this,arguments)};Object.defineProperty(UI,"__esModule",{value:!0});var FI=vI,VI=OI,KI=function(){function e(e,t){var i=this;this.config={operationName:""},t&&Object.entries(t).forEach((function(e){var t=e[0],s=e[1];i.config[t]=s})),Array.isArray(e)?this.variables=VI.default.resolveVariables(e):(this.variables=e.variables,this.fields=e.fields||[],this.operation=e.operation)}return e.prototype.queryBuilder=function(){return this.operationWrapperTemplate(this.operationTemplate(this.variables))},e.prototype.queriesBuilder=function(e){var t,i=this;return this.operationWrapperTemplate((t=[],e.forEach((function(e){e&&(i.operation=e.operation,i.fields=e.fields,t.push(i.operationTemplate(e.variables)))})),t.join(" ")))},e.prototype.queryDataArgumentAndTypeMap=function(){var e=this.variables;return this.fields&&"object"==typeof this.fields&&(e=BI(BI({},VI.default.getNestedVariables(this.fields)),e)),e&&Object.keys(e).length>0?"(".concat(Object.keys(e).reduce((function(t,i,s){return"".concat(t).concat(0!==s?", ":"","$").concat(i,": ").concat(VI.default.queryDataType(e[i]))}),""),")"):""},e.prototype.operationWrapperTemplate=function(e){var t="".concat(FI.default.Query," ").concat(this.queryDataArgumentAndTypeMap()," { ").concat(e," }");return{query:t=t.replace("query","query".concat(""!==this.config.operationName?" "+this.config.operationName:"")),variables:VI.default.queryVariablesMap(this.variables,this.fields)}},e.prototype.operationTemplate=function(e){var t="string"==typeof this.operation?this.operation:"".concat(this.operation.alias,": ").concat(this.operation.name);return"".concat(t," ").concat(e?VI.default.queryDataNameAndArgumentMap(e):""," ").concat(this.fields&&this.fields.length>0?"{ "+VI.default.queryFieldsMap(this.fields)+" }":"")},e}();UI.default=KI;var GI={};Object.defineProperty(GI,"__esModule",{value:!0});var $I=vI,WI=OI,zI=function(){function e(e){Array.isArray(e)?this.variables=WI.default.resolveVariables(e):(this.variables=e.variables,this.fields=e.fields,this.operation=e.operation)}return e.prototype.subscriptionBuilder=function(){return this.operationWrapperTemplate($I.default.Subscription,this.variables,this.operationTemplate(this.operation))},e.prototype.subscriptionsBuilder=function(e){var t=this,i=e.map((function(e){return t.operation=e.operation,t.variables=e.variables,t.fields=e.fields,t.operationTemplate(e.operation)}));return this.operationWrapperTemplate($I.default.Subscription,WI.default.resolveVariables(e),i.join("\n "))},e.prototype.queryDataNameAndArgumentMap=function(){return this.variables&&Object.keys(this.variables).length?"(".concat(Object.keys(this.variables).reduce((function(e,t,i){return"".concat(e).concat(0!==i?", ":"").concat(t,": $").concat(t)}),""),")"):""},e.prototype.queryDataArgumentAndTypeMap=function(e){return Object.keys(e).length?"(".concat(Object.keys(e).reduce((function(t,i,s){return"".concat(t).concat(0!==s?", ":"","$").concat(i,": ").concat(WI.default.queryDataType(e[i]))}),""),")"):""},e.prototype.operationWrapperTemplate=function(e,t,i){return{query:"".concat(e," ").concat(this.queryDataArgumentAndTypeMap(t)," {\n ").concat(i,"\n}"),variables:WI.default.queryVariablesMap(t)}},e.prototype.operationTemplate=function(e){var t="string"==typeof this.operation?this.operation:"".concat(this.operation.alias,": ").concat(this.operation.name);return"".concat(t," ").concat(this.queryDataNameAndArgumentMap()," {\n ").concat(this.queryFieldsMap(this.fields),"\n }")},e.prototype.queryFieldsMap=function(e){var t=this;return e?e.map((function(e){return"object"==typeof e?"".concat(Object.keys(e)[0]," { ").concat(t.queryFieldsMap(Object.values(e)[0])," }"):"".concat(e)})).join(", "):""},e}();GI.default=zI,Object.defineProperty(fI,"__esModule",{value:!0}),fI.adapters=XI=fI.query=fI.mutation=fI.subscription=void 0;var qI=gI;fI.adapters=qI.default;var YI=MI,QI=UI,JI=GI,XI=fI.query=function(e,t,i){return Array.isArray(e)?t?new t(e,i).queriesBuilder(e):new QI.default(e,i).queriesBuilder(e):t?new t(e,i).queryBuilder():new QI.default(e,i).queryBuilder()};fI.mutation=function(e,t,i){return Array.isArray(e)?t?new t(e,i).mutationsBuilder(e):new YI.default(e,i).mutationsBuilder(e):t?new t(e,i).mutationBuilder():new YI.default(e,i).mutationBuilder()},fI.subscription=function(e,t){return Array.isArray(e)?t?new t(e).subscriptionsBuilder(e):new JI.default(e).subscriptionsBuilder(e):t?new t(e).subscriptionBuilder():new JI.default(e).subscriptionBuilder()};const ZI="\n fragment repoMetadata on Asset {\n repo_assetId\n repo_name\n repo_path\n repo_createDate\n repo_createdBy {\n id\n }\n repo_modifyDate\n repo_modifiedBy\n primary_etag\n repo_state\n dc_format\n storage_deviceCreateDate\n storage_deviceModifyDate\n storage_region\n storage_assignee {\n id\n type\n }\n repository {\n repo_repositoryId\n repo_repositoryType\n repo_owner {\n id\n }\n }\n repo_ancestors\n repo_assetClass\n repo_assetType\n repo_assetSubType\n primaryLink {\n href\n templated\n }\n blockUploadLink {\n href\n templated\n }\n ... on Composite {\n repo_version\n repo_size\n isComposite\n primaryLink {\n href\n }\n blockDownloadLink {\n href\n }\n renditionLink {\n href\n }\n }\n ... on File {\n repo_version\n repo_size\n isFile\n primaryLink {\n href\n }\n blockDownloadLink {\n href\n }\n renditionLink {\n href\n }\n tiff_imageLength\n tiff_imageWidth\n }\n }\n",eE='\n fragment applicationMetadata on Asset {\n appMetadata {\n am: valueOf(key: "")\n }\n }\n',tE="\n fragment effectivePermissions on Asset {\n effectivePermissions {\n aclPolicy\n annotations\n applicationMetadata\n default\n directory\n primary\n }\n }\n";function iE(e){var t,i,s,r;if(!(null==e?void 0:e.listingHints))return"";let n="... on Directory {";n+="\n repo_assetId\n ";for(let o=0;o<e.listingHints.length;o++){const a=e.listingHints[o].order;n+=`\n list${o+1}: childrenConnection(\n first: ${null!==(i=null===(t=e.listingHints[o].loadOptions)||void 0===t?void 0:t.limit)&&void 0!==i?i:10},\n orderBy: [\n {\n field: ${_I[a.field]},\n direction: ${a.direction.toUpperCase()}\n }\n ],\n filter: {\n dc_format: ${null!==(r=null===(s=e.listingHints[o].filter)||void 0===s?void 0:s.mediaTypes)&&void 0!==r?r:null}\n }\n ) {\n edges {\n node {\n ...repoMetadata\n ...applicationMetadata\n # TODO: undefined effectivePermissions is equivalent to false for now.\n # We will change it to deferred in the future.\n ${e.listingHints[o].effectivePermissions?"...effectivePermissions":""}\n }\n }\n pageInfo {\n endCursor\n hasNextPage\n }\n }\n `}return n+="}",n}function sE(e){let t="";return(null==e?void 0:e.appMetadata)&&(t+="\n ...applicationMetadata\n "),(null==e?void 0:e.effectivePermissions)&&(t+="\n ...effectivePermissions\n "),t}function rE(e){var t;return(null==e?void 0:e.effectivePermissions)||(null===(t=null==e?void 0:e.listingHints)||void 0===t?void 0:t.some((e=>e.effectivePermissions)))}function nE(e){var t;return(null==e?void 0:e.appMetadata)||(null===(t=null==e?void 0:e.listingHints)||void 0===t?void 0:t.length)}function oE(e){return ZI+(nE(e)?eE:"")+(rE(e)?tE:"")+`\n query getAssetByPath($assetPath: String!, $repositoryId: ID!) {\n resolveAssetByPath(assetPath: $assetPath, repositoryId: $repositoryId) {\n ...repoMetadata\n ${sE(e)}\n ${iE(e)}\n }\n }\n `}function aE(e){return ZI+(nE(e)?eE:"")+(rE(e)?tE:"")+`\n query getAssetByPath($assetPath: String!) {\n resolveUserHome {\n ...repoMetadata\n ... on Directory {\n assetByRelativePath(relativePath: $assetPath) {\n ...repoMetadata\n ${sE(e)}\n ${iE(e)}\n }\n }\n }\n }\n `}const cE=oI`
mutation updateLastAccessed($assetId: ID!, $input: UpdateLabelInput!) {
updateLabel(assetId: $assetId, input: $input) {
lastAccessDate
}
}
`;var lE=function(e,t,i){if(i||2===arguments.length)for(var s,r=0,n=t.length;r<n;r++)!s&&r in t||(s||(s=Array.prototype.slice.call(t,0,r)),s[r]=t[r]);return e.concat(s||Array.prototype.slice.call(t))},dE=function(){function e(e){var t=e.debug,i=void 0!==t&&t;this.debug=i,this.lines=[]}return e.prototype.emit=function(t,i){if(t in console){var s=e.prefix;console[t].apply(console,lE([s],i,!1))}},e.prototype.tailLogs=function(){var e=this;this.lines.forEach((function(t){var i=t[0],s=t[1];return e.emit(i,s)}))},e.prototype.getLogs=function(){return this.lines},e.prototype.write=function(t,i){var s=e.buffer;this.lines=lE(lE([],this.lines.slice(1-s),!0),[[t,i]],!1),(this.debug||"log"!==t)&&this.emit(t,i)},e.prototype.info=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.write("log",e)},e.prototype.warn=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.write("warn",e)},e.prototype.error=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.write("error",e)},e.buffer=30,e.prefix="[apollo-cache-persist]",e}(),uE=function(){function e(e){var t=e.cache,i=e.serialize,s=void 0===i||i;this.cache=t,this.serialize=s}return e.prototype.extract=function(){var e=this.cache.extract();return this.serialize&&(e=JSON.stringify(e)),e},e.prototype.restore=function(e){this.serialize&&"string"==typeof e&&(e=JSON.parse(e)),null!=e&&this.cache.restore(e)},e}(),hE=function(e,t,i,s){return new(i||(i=Promise))((function(r,n){function o(e){try{c(s.next(e))}catch(e){n(e)}}function a(e){try{c(s.throw(e))}catch(e){n(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,a)}c((s=s.apply(e,t||[])).next())}))},pE=function(e,t){var i,s,r,n,o={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return n={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(n[Symbol.iterator]=function(){return this}),n;function a(a){return function(c){return function(a){if(i)throw new TypeError("Generator is already executing.");for(;n&&(n=0,a[0]&&(o=0)),o;)try{if(i=1,s&&(r=2&a[0]?s.return:a[0]?s.throw||((r=s.return)&&r.call(s),0):s.next)&&!(r=r.call(s,a[1])).done)return r;switch(s=0,r&&(a=[2&a[0],r.value]),a[0]){case 0:case 1:r=a;break;case 4:return o.label++,{value:a[1],done:!1};case 5:o.label++,s=a[1],a=[0];continue;case 7:a=o.ops.pop(),o.trys.pop();continue;default:if(!((r=(r=o.trys).length>0&&r[r.length-1])||6!==a[0]&&2!==a[0])){o=0;continue}if(3===a[0]&&(!r||a[1]>r[0]&&a[1]<r[3])){o.label=a[1];break}if(6===a[0]&&o.label<r[1]){o.label=r[1],r=a;break}if(r&&o.label<r[2]){o.label=r[2],o.ops.push(a);break}r[2]&&o.ops.pop(),o.trys.pop();continue}a=t.call(e,o)}catch(e){a=[6,e],s=0}finally{i=r=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,c])}}},_E=function(){function e(e){var t=e.storage,i=e.key,s=void 0===i?"apollo-cache-persist":i;this.storage=t,this.key=s}return e.prototype.read=function(){return hE(this,void 0,void 0,(function(){return pE(this,(function(e){return[2,this.storage.getItem(this.key)]}))}))},e.prototype.write=function(e){return hE(this,void 0,void 0,(function(){return pE(this,(function(t){switch(t.label){case 0:return[4,this.storage.setItem(this.key,e)];case 1:return t.sent(),[2]}}))}))},e.prototype.purge=function(){return hE(this,void 0,void 0,(function(){return pE(this,(function(e){switch(e.label){case 0:return[4,this.storage.removeItem(this.key)];case 1:return e.sent(),[2]}}))}))},e.prototype.getSize=function(){return hE(this,void 0,void 0,(function(){var e;return pE(this,(function(t){switch(t.label){case 0:return[4,this.storage.getItem(this.key)];case 1:return null==(e=t.sent())?[2,0]:[2,"string"==typeof e?e.length:null]}}))}))},e}(),mE=function(e,t,i,s){return new(i||(i=Promise))((function(r,n){function o(e){try{c(s.next(e))}catch(e){n(e)}}function a(e){try{c(s.throw(e))}catch(e){n(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,a)}c((s=s.apply(e,t||[])).next())}))},fE=function(e,t){var i,s,r,n,o={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return n={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(n[Symbol.iterator]=function(){return this}),n;function a(a){return function(c){return function(a){if(i)throw new TypeError("Generator is already executing.");for(;n&&(n=0,a[0]&&(o=0)),o;)try{if(i=1,s&&(r=2&a[0]?s.return:a[0]?s.throw||((r=s.return)&&r.call(s),0):s.next)&&!(r=r.call(s,a[1])).done)return r;switch(s=0,r&&(a=[2&a[0],r.value]),a[0]){case 0:case 1:r=a;break;case 4:return o.label++,{value:a[1],done:!1};case 5:o.label++,s=a[1],a=[0];continue;case 7:a=o.ops.pop(),o.trys.pop();continue;default:if(!((r=(r=o.trys).length>0&&r[r.length-1])||6!==a[0]&&2!==a[0])){o=0;continue}if(3===a[0]&&(!r||a[1]>r[0]&&a[1]<r[3])){o.label=a[1];break}if(6===a[0]&&o.label<r[1]){o.label=r[1],r=a;break}if(r&&o.label<r[2]){o.label=r[2],o.ops.push(a);break}r[2]&&o.ops.pop(),o.trys.pop();continue}a=t.call(e,o)}catch(e){a=[6,e],s=0}finally{i=r=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,c])}}},gE=function(){function e(e,t){var i=e.log,s=e.cache,r=e.storage,n=t.maxSize,o=void 0===n?1048576:n,a=t.persistenceMapper;this.log=i,this.cache=s,this.storage=r,this.paused=!1,a&&(this.persistenceMapper=a),o&&(this.maxSize=o)}return e.prototype.persist=function(){return mE(this,void 0,void 0,(function(){var e,t;return fE(this,(function(i){switch(i.label){case 0:return i.trys.push([0,6,,7]),e=this.cache.extract(),this.paused||!this.persistenceMapper?[3,2]:[4,this.persistenceMapper(e)];case 1:e=i.sent(),i.label=2;case 2:return null!=this.maxSize&&"string"==typeof e&&e.length>this.maxSize&&!this.paused?[4,this.purge()]:[3,4];case 3:return i.sent(),this.paused=!0,[2];case 4:return this.paused?[2]:[4,this.storage.write(e)];case 5:return i.sent(),this.log.info("string"==typeof e?"Persisted cache of size ".concat(e.length," characters"):"Persisted cache"),[3,7];case 6:throw t=i.sent(),this.log.error("Error persisting cache",t),t;case 7:return[2]}}))}))},e.prototype.restore=function(){return mE(this,void 0,void 0,(function(){var e,t;return fE(this,(function(i){switch(i.label){case 0:return i.trys.push([0,5,,6]),[4,this.storage.read()];case 1:return null==(e=i.sent())?[3,3]:[4,this.cache.restore(e)];case 2:return i.sent(),this.log.info("string"==typeof e?"Restored cache of size ".concat(e.length," characters"):"Restored cache"),[3,4];case 3:this.log.info("No stored cache to restore"),i.label=4;case 4:return[3,6];case 5:throw t=i.sent(),this.log.error("Error restoring cache",t),t;case 6:return[2]}}))}))},e.prototype.purge=function(){return mE(this,void 0,void 0,(function(){var e;return fE(this,(function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,this.storage.purge()];case 1:return t.sent(),this.log.info("Purged cache storage"),[3,3];case 2:throw e=t.sent(),this.log.error("Error purging cache storage",e),e;case 3:return[2]}}))}))},e}(),yE=function(e){var t=e.cache;return function(e){var i=t.write,s=t.evict,r=t.modify,n=t.gc;return t.write=function(){for(var s=[],r=0;r<arguments.length;r++)s[r]=arguments[r];var n=i.apply(t,s);return e(),n},t.evict=function(){for(var i=[],r=0;r<arguments.length;r++)i[r]=arguments[r];var n=s.apply(t,i);return e(),n},t.modify=function(){for(var i=[],s=0;s<arguments.length;s++)i[s]=arguments[s];var n=r.apply(t,i);return e(),n},t.gc=function(){for(var i=[],s=0;s<arguments.length;s++)i[s]=arguments[s];var r=n.apply(t,i);return e(),r},function(){t.write=i,t.evict=s,t.modify=r,t.gc=n}}},vE=function(){function e(t,i){var s=t.log,r=t.persistor,n=this;this.fire=function(){n.debounce?(null!=n.timeout&&clearTimeout(n.timeout),n.timeout=setTimeout(n.persist,n.debounce)):n.persist()},this.persist=function(){n.paused||n.persistor.persist()};var o=e.defaultDebounce,a=i.cache,c=i.debounce,l=i.trigger,d=void 0===l?"write":l;if(d)switch(this.debounce=null!=c?c:o,this.persistor=r,this.paused=!1,d){case"write":this.uninstall=yE({cache:a})(this.fire);break;case"background":c&&s.warn("Debounce is not recommended with `background` trigger"),this.debounce=c,this.uninstall=function(e){var t=e.log,i=e.cache;return function(e){return t.warn("Trigger option `background` not available on web; using `write` trigger"),yE({cache:i})(e)}}({cache:a,log:s})(this.fire);break;default:if("function"!=typeof d)throw Error("Unrecognized trigger option: ".concat(d));this.uninstall=d(this.fire)}}return e.prototype.pause=function(){this.paused=!0},e.prototype.resume=function(){this.paused=!1},e.prototype.remove=function(){this.uninstall&&(this.uninstall(),this.uninstall=null,this.paused=!0)},e.defaultDebounce=1e3,e}(),OE=function(){function e(e){if(!e.cache)throw new Error("In order to persist your Apollo Cache, you need to pass in a cache. Please see https://www.apollographql.com/docs/react/basics/caching.html for our default InMemoryCache.");if(!e.storage)throw new Error("In order to persist your Apollo Cache, you need to pass in an underlying storage provider. Please see https://github.com/apollographql/apollo-cache-persist#storage-providers");var t=new dE(e),i=new uE(e),s=new _E(e),r=new gE({log:t,cache:i,storage:s},e),n=new vE({log:t,persistor:r},e);this.log=t,this.cache=i,this.storage=s,this.persistor=r,this.trigger=n}return e.prototype.persist=function(){return this.persistor.persist()},e.prototype.restore=function(){return this.persistor.restore()},e.prototype.purge=function(){return this.persistor.purge()},e.prototype.pause=function(){this.trigger.pause()},e.prototype.resume=function(){this.trigger.resume()},e.prototype.remove=function(){this.trigger.remove()},e.prototype.getLogs=function(e){if(void 0===e&&(e=!1),!e)return this.log.getLogs();this.log.tailLogs()},e.prototype.getSize=function(){return this.storage.getSize()},e}(),bE=OE,IE=function(){var e=function(t,i){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])},e(t,i)};return function(t,i){if("function"!=typeof i&&null!==i)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");function s(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(s.prototype=i.prototype,new s)}}();!function(e){function t(t){var i=e.call(this,t)||this;return i.storage=new TE(t),i.persistor=new EE({log:i.log,cache:i.cache,storage:i.storage},t),i}IE(t,e),t.prototype.restoreSync=function(){this.persistor.restoreSync()}}(bE);var EE=function(e){function t(t,i){var s=t.log,r=t.cache,n=t.storage;return e.call(this,{log:s,cache:r,storage:n},i)||this}return IE(t,e),t.prototype.restoreSync=function(){this.cache.restore(this.storage.readSync())},t}(gE),TE=function(e){function t(t){return e.call(this,t)||this}return IE(t,e),t.prototype.readSync=function(){return this.storage.getItem(this.key)},t}(_E),SE={Asset:{keyFields:["repo_assetId"]},Repository:{keyFields:["repo_repositoryId"]},Link:{keyFields:["href"]},AssetList:{keyFields:["assetListId"]}};class AE{constructor(e,t,i){this._core=e,this.resource=t,this.processIncrementalData=i,this.firstResultPromise=new sn,this.onQueryIdle=()=>{var e,t;this.queryIdleTimeout=void 0,(null===(e=this.subscription)||void 0===e?void 0:e.closed)||null===(t=this.subscription)||void 0===t||t.unsubscribe()}}start(e){this.subscription=e}async next(e){var t,i,s,r,n,o,a;this.queryIdleTimeout&&(clearTimeout(this.queryIdleTimeout),this.queryIdleTimeout=void 0);const c=this._core._environment.getValue("GRAPHQL_WATCH_QUERY_TTL");let l;this.queryIdleTimeout=setTimeout(this.onQueryIdle,c);try{l=await(null===(t=this.resource)||void 0===t?void 0:t._parse(e))}catch(e){return null===(i=this.resource)||void 0===i||i._setError(e),this.previousResult||this.firstResultPromise.reject(e),void((null===(s=this.subscription)||void 0===s?void 0:s.closed)||null===(r=this.subscription)||void 0===r||r.unsubscribe())}await(null===(n=this.resource)||void 0===n?void 0:n._setData(l,{loading:e.loading,changed:!ds(null===(o=this.previousResult)||void 0===o?void 0:o.data,e.data,!0)})),this.previousResult?null===(a=this.processIncrementalData)||void 0===a||a.call(this,l):this.firstResultPromise.resolve(l),this.previousResult=e}error(e){var t;const i=We.createWithApolloError(e);null===(t=this.resource)||void 0===t||t._setError(i),this.previousResult||this.firstResultPromise.reject(i)}}Ye([wt],AE.prototype,"next",null);const{possibleTypes:PE}={possibleTypes:{Asset:["AssignmentImpl","ClassroomImpl","CompositeImpl","DirectoryImpl","FileImpl","LibraryImpl","ProjectImpl"],AssetContainer:["AssignmentImpl","ClassroomImpl","DirectoryImpl","ProjectImpl"],AssetList:["FavoritesList","RecentsList","SharedWithYouList"],Assignment:["AssignmentImpl"],Cacheable:["CollaborationData"],Classroom:["ClassroomImpl"],Composite:["CompositeImpl","LibraryImpl"],Directory:["AssignmentImpl","ClassroomImpl","DirectoryImpl","ProjectImpl"],File:["FileImpl"],Library:["LibraryImpl"],ListAsset:["AssignmentImpl","ClassroomImpl","CompositeImpl","DirectoryImpl","FileImpl","LibraryImpl","ProjectImpl"],Project:["ProjectImpl"],Rendition:["CmykColor","GrayColor","HsbColor","LabColor","LinearGradient","RadialGradient","RgbColor","TintedCmykColor","TintedLabColor","TintedRgbColor","XcmCcLibraryDataColorTheme"],RenditionGridTile:["ConcreteRenditionGridTile","LinkedRenditionGridTile"],ReviewSourceAsset:["XcmCcLink","XcmCcReviewSourceAssetDeprecated"],ValueContainer:["ApplicationMetadata","EmbeddedMetadata","PerUserMetadata"],Versionable:["CompositeImpl","FileImpl","LibraryImpl"],XcmCcLibraryDataColor:["CmykColor","GrayColor","HsbColor","LabColor","RgbColor","TintedCmykColor","TintedLabColor","TintedRgbColor"],XcmCcLibraryDataRole:["BrandRole","CmeRole"],XcmHalLink:["HalLink","XcmHalLinkAnyOf1"]}};class wE{constructor(e){this._core=e}error(e){this._core._environment.error(e)}warn(e){this._core._environment.warn(e)}get cacheEnabled(){var e,t;return null!==(t=null===(e=this._core._environment.getValue("FEATURE_FLAGS"))||void 0===e?void 0:e["use-graphql-cache"])&&void 0!==t&&t}async _client(e=!0){var t;const i=this._core._environment.getValue("HIGH_PRIORITY_RAPI_REQUESTS"),s=new pO(Object.assign({uri:i?`https://${this._core._environment.endpoints.ACPC_SUPERGRAPH_EDGE_HOST}`:`https://${this._core._environment.endpoints.ACPC_SUPERGRAPH_HOST}`},(null===(t=this._core._environment._hooks)||void 0===t?void 0:t.fetch)?{fetch:this._core._environment._hooks.fetch}:{}));await this._core._environment._refreshAccessToken();const r=new Jv(((e,t)=>{const i=this._core._environment.getValue("ACCESS_TOKEN");return e.setContext({headers:{authorization:`Bearer ${i}`,"x-api-key":this._core._environment.getValue("CLIENT_ID")}}),t(e)})),n=new dI({delay:(e,t,i)=>{if(1===e)return 0;const s=this._core._environment.getValue("MIN_RETRY_INTERVAL"),r=this._core._environment.getValue("MAX_RETRY_INTERVAL"),n=or(1e3*Math.pow(2,e),s,r);return this._core._environment.log(`GQL: Retryable error ${i.statusCode} retrying in ${n}ms, ${e} retries so far`),n},attempts:async(e,t,i)=>{const s=this._core._environment._maxNumberOfRetries,r=e>s,n=function(e){return e&&"statusCode"in e&&"number"==typeof e.statusCode}(i)&&401===i.statusCode;return n&&(this._core._environment._isTokenInvalid=!0),r&&this._core._environment.log(`GQL: Retryable error ${i.statusCode} attempt ${e} exceeded ${s} retries`),!(r||!n||(await this._core._environment._refreshAccessToken(),0))}}),o=new Db({addTypename:e,possibleTypes:PE,typePolicies:SE});if(this.cacheEnabled){const e=this._core._environment.cache;await(a={cache:o,debug:!1,storage:{getItem:t=>e.getItem(t),setItem:(t,i)=>e.setItem(t,i),removeItem:t=>e.deleteItem(t)}},new bE(a).restore())}var a;return new Xb({link:Xv([n,r,s]),cache:o,defaultOptions:{query:{fetchPolicy:this.cacheEnabled?"network-only":"no-cache",errorPolicy:"all"},watchQuery:{fetchPolicy:this.cacheEnabled?"cache-and-network":"no-cache",errorPolicy:"all"}}})}async initialize(e=!0){await this._client(e)}async query(e,t,i){var s,r;t=null!=t?t:new ur(this._core);const n=await this._client();if(this.cacheEnabled||"cache-and-network"===e.fetchPolicy||i){const s=t.skipCache?"network-only":t.skipRevalidation?"cache-first":this.cacheEnabled?"cache-and-network":"no-cache",o=n.watchQuery(Object.assign(Object.assign({},e),{fetchPolicy:null!==(r=e.fetchPolicy)&&void 0!==r?r:s})),a=new AE(this._core,t,i);return o.subscribe(a),a.firstResultPromise.promise}{let i;try{i=await n.query(Object.assign(Object.assign({},e),{fetchPolicy:null!==(s=e.fetchPolicy)&&void 0!==s?s:"no-cache"}))}catch(e){throw We.createWithApolloError(e)}const r=await t._parse(i);return await t._setData(r),r}}async getFavorites(e,t,i){let s;try{s=XI({operation:"favorites",fields:["assetListId",{operation:"assetListConnection",variables:{first:{value:e.first,required:!0},after:e.after,filter:{value:e.filter,type:"AssetListFilter",required:!1},orderBy:{value:e.orderBy,type:"FavoriteOrderByInput",required:!1}},fields:[{pageInfo:["hasNextPage","endCursor"]},{edges:["cursor",{node:[{operation:"Asset",fragment:!0,fields:hI}]}]}]}]},null,{operationName:"favorites"})}catch(e){throw this.error("error building query string"),We.create(Be.INTERNAL_ERROR,"Error building query string for getFavorites",{underlyingError:e})}return this.query({query:oI(s.query),variables:s.variables},t,i)}async setFavorite(e,t){const i=await this._client();try{await i.mutate({mutation:oI`
mutation updateLabel($assetId: ID!, $input: UpdateLabelInput!) {
updateLabel(assetId: $assetId, input: $input) {
favorite {
isFavorite
}
}
}
`,variables:{assetId:e,input:{favorite:{isFavorite:t}}}})}catch(e){if(e instanceof rO)throw We.createWithApolloError(e);throw We.create(Be.UNKNOWN,"No data or error returned from the query getAssetById")}}async getAssetById(e,t){const i=XI({operation:"resolveAssetById",variables:{assetId:{value:e,name:"assetId",required:!0,type:"ID"}},fields:hI},null,{operationName:"getAssetById"});await this.query({query:oI(i.query),variables:i.variables},t)}async getAssetByPath(e,t,i,s){const r={query:oE(i),variables:{assetPath:e,repositoryId:t}};await this.query({query:oI(r.query),variables:r.variables},s)}async getAssetByRelativePath(e,t,i){const s={query:aE(t),variables:{assetPath:e}};return this.query({query:oI(s.query),variables:s.variables},i)}async getSharedWithYou(e,t,i){const{first:s,after:r,filter:n,orderBy:o}=e,a=await Promise.resolve().then((function(){return gP}));return this.query({query:a.SHARED_WITH_YOU_ASSETS,variables:{first:s,after:r,filter:n,orderBy:o}},t,i)}async getChildren(e,t,i){const s={query:ZI+eE+tE+"\n query getChildren($assetId: ID!, $first: Int!, $after: String, $orderBy: [OrderByInput!], $filter: AssetFilter) {\n resolveAssetById(assetId: $assetId) {\n ... on Directory {\n repo_assetId\n repo_ancestors\n childrenConnection(first: $first, after: $after, orderBy: $orderBy, filter: $filter) {\n edges {\n node {\n ...repoMetadata\n ...applicationMetadata\n ...effectivePermissions\n }\n }\n pageInfo {\n endCursor\n hasNextPage\n }\n }\n }\n }\n }\n ",variables:{assetId:e,first:t.first,after:t.after,orderBy:t.orderBy,filter:t.filter}};return this.query({query:oI(s.query),variables:s.variables},i)}async getGenerationHistoryAssets(e,t){const{generationHistoryAssets:i}=await Promise.resolve().then((function(){return vP}));return t&&(t.parser=e=>{var t,i,s;if(lr(e))return e.json();if(dr(e)){if(!e.data){if(!(null===(t=e.errors)||void 0===t?void 0:t[0]))throw We.create(Be.UNKNOWN,"No data or error returned from the query generationHistoryAssets");throw We.createWithGraphQLError(null===(i=e.errors)||void 0===i?void 0:i[0])}const r=null===(s=e.errors)||void 0===s?void 0:s.find((e=>{var t;return!(null===(t=e.path)||void 0===t?void 0:t.includes("fireflyGenerationsDirectory"))}));if(r)throw We.createWithGraphQLError(r);return null===e.data.homeFolder.fireflyGenerationsDirectory?{homeFolder:{fireflyGenerationsDirectory:{generationAssetsConnection:{assets:[],pageInfo:{hasNextPage:!1,endCursor:null}}}}}:e.data}throw We.create(Be.INTERNAL_ERROR,"Resource.parse() received an unexpected response type: "+e)}),(await this.query({query:i,variables:{relativePath:"/appassets/firefly-generations",first:e.first,after:e.after,filter:e.filter,orderBy:e.orderBy}},t)).homeFolder.fireflyGenerationsDirectory.generationAssetsConnection}async recents(e,t=new ur(this._core),i){const{first:s,after:r,filter:n}=e,o=await Promise.resolve().then((function(){return bP}));return this.query({query:o.recents,variables:{first:s,after:r,filter:n}},t,i)}async updateLastAccessed(e){var t,i,s;const r=await this._client(),n=await r.mutate({mutation:cE,variables:e}).catch((e=>{throw We.createWithApolloError(e)}));if(!(null===(t=n.data)||void 0===t?void 0:t.updateLabel)){if(!(null===(i=n.errors)||void 0===i?void 0:i[0]))throw We.create(Be.UNKNOWN,"No data or error returned from the query updateLastAccessed");throw We.createWithGraphQLError(null===(s=n.errors)||void 0===s?void 0:s[0])}}}Ye([nt],wE.prototype,"_client",null),Ye([wt],wE.prototype,"initialize",null);const CE={imagen:"Imagen",veo:"Veo","gpt-4o-image":"GPT",clio:"Firefly",clio_v4:"Firefly",clineto:"Firefly",flux:"Flux",fluxPro:"Flux",fluxUltra:"Flux",fluxBagel:"Flux",fluxKontextPro:"Flux",pika:"Pika",ideogram:"Ideogram","runway-gen4-image":"Runway",runway:"Runway",luma:"Luma",topaz:"Topaz",elevenlabs:"ElevenLabs",moonvalley:"Moonvalley"},RE=e=>{var t;return null!==(t=CE[e])&&void 0!==t?t:e},LE=new vn({localItemType:vc,remoteIdProperty:"asset_id",propertyUpdater:new Cn({"_appMetadata._data":{name:"applicationMetadata",format:"object_subset",set:(e,t)=>{t.appMetadata._setData(e)}},_isFavorite:{name:"isFavorite",format:"boolean"},_assetClass:{get:()=>"composite"},_generationModelDisplayName:"generationModelDisplayName",_name:"repo:name",_size:{name:"repo:size",format:"number"},_type:{name:"type",format:"string",choices:ha},__links:{name:"_links",format:"object"},_created:{name:"createdDate",format:"date"},_modified:{name:"modifiedDate",format:"date"},_etag:"composite_manifest_etag",_path:"asset_name_path",_repositoryID:"repo:repositoryId",_createdBy:"repo:createdBy",_modifiedBy:"repo:modifiedBy"})});function NE(e){const t={};for(const[i,s]of Object.entries(e))if(void 0!==s)if(s&&"object"==typeof s&&!Array.isArray(s)){const e=NE(s);Object.keys(e).length>0&&(t[i]=e)}else t[i]=s;return t}function DE(e){var t,i,s,r,n,o,a,c,l,d,u,h;if(!e)throw We.create(Be.UNKNOWN,"Asset data missing from GraphQL response");const p=Object.fromEntries(Object.entries(null!==(t=e.repo_representations)&&void 0!==t?t:{}).filter((([,e])=>!0===e))),_=e.effectivePermissions&&function(e){const t=e=>null==e?void 0:e.map((e=>e.toLowerCase())),i={};return i["*"]=t(e.default),i[yt.PRIMARY]=t(e.primary),i[yt.AC_POLICY]=t(e.aclPolicy),i[yt.DIRECTORY]=t(e.directory),i[yt.APP_METADATA]=t(e.applicationMetadata),i[yt.ANNOTATIONS]=t(e.annotations),Wi(i)}(e.effectivePermissions);return NE({"dc:format":e.dc_format,"repo:ancestors":e.repo_ancestors,"repo:assetClass":null===(i=e.repo_assetClass)||void 0===i?void 0:i.toLowerCase(),"repo:assetType":e.repo_assetType,"repo:assetSubType":e.repo_assetSubType,"repo:representations":p,"repo:assetId":e.repo_assetId,"repo:etag":e.primary_etag,"repo:createDate":e.repo_createDate,"repo:createdBy":null===(s=e.repo_createdBy)||void 0===s?void 0:s.id,"repo:modifyDate":e.repo_modifyDate,"repo:name":e.repo_name,"repo:path":e.repo_path,"repo:modifiedBy":e.repo_modifiedBy,"repo:repositoryId":null===(r=e.repository)||void 0===r?void 0:r.repo_repositoryId,"repo:state":e.repo_state,"repo:size":e.repo_size,"repo:version":e.repo_version,"storage:assignee":e.storage_assignee,"storage:region":e.storage_region,"storage:deviceCreateDate":e.storage_deviceCreateDate,"storage:deviceModifyDate":e.storage_deviceModifyDate,"tiff:imageLength":e.tiff_imageLength,"tiff:imageWidth":e.tiff_imageWidth,generationModelDisplayName:(null===(o=null===(n=e.appMetadata)||void 0===n?void 0:n.am)||void 0===o?void 0:o.firefly)&&RE(null===(a=e.appMetadata.am.firefly.generationModel)||void 0===a?void 0:a.name),effectivePermission:_,perUserMetadata:{"shell:lastAccessDate":null===(c=e.labels)||void 0===c?void 0:c.lastAccessDate},_embedded:{[yt.APP_METADATA]:(null===(l=e.appMetadata)||void 0===l?void 0:l.am)||{}},_links:{[yt.PRIMARY]:e.primaryLink,[yt.BLOCK_INITIALIZE]:e.blockUploadLink,[yt.DOWNLOAD]:e.blockDownloadLink,[yt.RENDITION]:e.renditionLink,[yt.PAGE]:e.pageLink},isFavorite:null===(u=null===(d=e.labels)||void 0===d?void 0:d.favorite)||void 0===u?void 0:u.isFavorite,sharedViaInvite:!!(null===(h=e.sharingInfo)||void 0===h?void 0:h.sharedWithYou)})}class ME extends ur{constructor(e){super(e,{onChange:async e=>{if(e)for(const t of this.resultHandlers)t(e)}}),this._core=e,this.resultHandlers=[]}addResultHandler(e){this.resultHandlers.push(e),this.data&&e(this.data)}addAssetFromResult(e,t){return new Promise(((i,s)=>{this.addResultHandler((r=>{const n=e(r);n?this._applyDataToAsset(n,t).then(i).catch((e=>{s(We.create(Be.UNKNOWN,"Error applying asset",e))})):s(We.create(Be.UNKNOWN,"Asset not found on GraphQL query"))}))}))}addAssetResourcesFromResult(e,t){return new Promise(((i,s)=>{this.addResultHandler((async r=>{const n=e(r);if(n)try{i(await this._applyDataToAssetResources(n,t))}catch(e){s(We.create(Be.UNKNOWN,"Error applying asset resources"))}else s(We.create(Be.UNKNOWN,"Asset not found on GraphQL query"))}))}))}async _applyDataToAssetResources(e,t){var i,s,r,n,o,a;const c=null!==(i=DE(e))&&void 0!==i?i:{},{effectivePermission:l,perUserMetadata:d,_embedded:u}=c,h=qe(c,["effectivePermission","perUserMetadata","_embedded"]),p=null!==(s=null==u?void 0:u[yt.APP_METADATA])&&void 0!==s?s:{};await Promise.all([null===(r=null==t?void 0:t.repoMetadataResource)||void 0===r?void 0:r._setData(h),null===(n=null==t?void 0:t.effectivePermissionsResource)||void 0===n?void 0:n._setData(l),null===(o=null==t?void 0:t.appMetadataResource)||void 0===o?void 0:o._setData(p),null===(a=null==t?void 0:t.perUserMetadataResource)||void 0===a?void 0:a._setData(d)])}async _applyDataToAsset(e,t){var i,s;const r=null!==(i=DE(e))&&void 0!==i?i:{},{effectivePermission:n,perUserMetadata:o,_embedded:a}=r,c=qe(r,["effectivePermission","perUserMetadata","_embedded"]),l=null!==(s=null==a?void 0:a[yt.APP_METADATA])&&void 0!==s?s:{};if(t)return t._handleResourceUpdates({effectivePermission:n,perUserMetadata:o,repoMetadata:c,appMetadata:l}),t;{const e=this._core._getAssetPool().createMutationSession(),t=await this._core._adobeAssetFactory.getRepoMetadataUpdaters([c]),i=this._core._adobeAssetFactory.assetFromRepoMetadata({session:e,updaters:t,repoMetadata:c,permissions:n,appMetadata:l,perUserMetadata:o});return e.commit(),i}}}class xE{constructor(e){this._core=e,this._gqlInterface=new wE(this._core),this._listData=new Map}async initialize(){await this._gqlInterface.initialize()}_handleListingHints(e,t,i){var s;for(let r=0;t&&r<(null==t?void 0:t.length);r++){const n=i[`list${r+1}`],o=this.generateDirectoryLoaderHash({assetId:e.id,filter:t[r].filter,order:t[r].order,loadOptions:t[r].loadOptions}),a=this._listData.get(o),c={children:n.edges.map((e=>DE(e.node))),pageInfo:n.pageInfo,ancestors:e.ancestorIDs,resource:null==a?void 0:a.resource};this._listData.set(o,c),null===(s=c.resource)||void 0===s||s._setData(c,{changed:!ds(a,c,!0)})}}async getAssetByPath(e,t,i){let s,r;if(t){const s=new ME(this._core);await this._gqlInterface.getAssetByPath(e,t,i,s),r=await s.addAssetFromResult((e=>e.resolveAssetByPath)),s.addResultHandler((e=>{this._handleListingHints(r,null==i?void 0:i.listingHints,e.resolveAssetByPath)}))}else{const t=new ME(this._core);await this._gqlInterface.getAssetByRelativePath(e,i,t),s=await t.addAssetFromResult((e=>e.resolveUserHome)),r=await t.addAssetFromResult((e=>e.resolveUserHome.assetByRelativePath)),t.addResultHandler((e=>{this._handleListingHints(r,null==i?void 0:i.listingHints,e.resolveUserHome.assetByRelativePath)}))}return{homeFolder:s,asset:r}}async getAssetById(e){const t=new ME(this._core);return await this._gqlInterface.getAssetById(e,t),t.addAssetFromResult((e=>e.resolveAssetById))}async getGenerationHistoryAssets(e,t){const{assets:i,pageInfo:s}=await this._gqlInterface.getGenerationHistoryAssets(e,t);return{items:i.map((e=>DE(e.node))),pageInfo:s}}async getAssetResourcesById(e,t){const i=new ME(this._core);await this._gqlInterface.getAssetById(e,i),t&&await i.addAssetResourcesFromResult((e=>e.resolveAssetById),t)}async getFavorites(e,t,i){const{favorites:{assetListId:s,assetListConnection:{pageInfo:r,edges:n}}}=await this._gqlInterface.getFavorites(e,t,i);return{items:n.map((e=>DE(e.node))),pageInfo:r,assetListId:s}}async getSharedWithYou(e,t,i){const{sharedWithYou:{assetListId:s,assetListConnection:{pageInfo:r,edges:n}}}=await this._gqlInterface.getSharedWithYou(e,t,i);return{items:n.map((e=>DE(e.node))),pageInfo:r,assetListId:s}}async recents(e,t,i){const{recents:{assetListId:s,assetListConnection:{pageInfo:r,edges:n}}}=await this._gqlInterface.recents(e,t,i);return{items:n.map((e=>DE(e.node))),pageInfo:r,assetListId:s}}async setFavorite(e,t){await this._gqlInterface.setFavorite(e,t)}generateDirectoryLoaderHash({assetId:e,order:t,filter:i=new Qd,loadOptions:s}){let r=e+":"+t.hash+":"+i.hash;return(null==s?void 0:s.limit)&&(r+="limit:"+s.limit),r}async getChildren(e,t,i=new ur(this._core)){var s,r,n,o,a,c,l;const{filter:d,order:u,loadOptions:h}=t,p=this.generateDirectoryLoaderHash({assetId:e,filter:d,order:u,loadOptions:h}),_=this._listData.get(p);if(_){if(!_.resource)return _.resource=i,_;this._listData.delete(p)}const m={dc_format:(null===(s=null==d?void 0:d.mediaTypes)||void 0===s?void 0:s.size)?[...d.mediaTypes]:void 0};(null===(r=null==d?void 0:d.excludeAssetTypes)||void 0===r?void 0:r.size)?m.assetType={neq:us(d.excludeAssetTypes)}:1===(null===(n=null==d?void 0:d.assetTypes)||void 0===n?void 0:n.size)&&(m.assetType={eq:us(d.assetTypes)}),1===(null===(o=null==d?void 0:d.assetSubTypes)||void 0===o?void 0:o.size)&&(m.assetSubType={eq:us(d.assetSubTypes)});const f=await this._gqlInterface.getChildren(e,{first:null!==(c=null===(a=t.loadOptions)||void 0===a?void 0:a.limit)&&void 0!==c?c:20,orderBy:[{field:_I[t.order.field],direction:t.order.direction.toUpperCase()}],filter:Object.values(m).some((e=>e))?m:void 0,after:t.after},i);if(!(null===(l=f.resolveAssetById)||void 0===l?void 0:l.childrenConnection))throw We.create(Be.UNKNOWN,"childrenConnection not present");const{edges:g,pageInfo:y}=f.resolveAssetById.childrenConnection;return{children:g.map((e=>DE(e.node))),pageInfo:y,ancestors:f.resolveAssetById.repo_ancestors,resource:i}}async updateLastAccessed(e,t){await this._gqlInterface.updateLastAccessed({assetId:e,input:{lastAccessDate:t}})}}Ye([wt],xE.prototype,"getAssetByPath",null),Ye([wt],xE.prototype,"getAssetById",null),Ye([wt],xE.prototype,"getAssetResourcesById",null),Ye([wt],xE.prototype,"getFavorites",null);var kE=Object.freeze({__proto__:null,default:xE});const HE={[yt.WORKSPACES_CONTEXT]:[],[yt.TEAMS_PAGE]:["start","limit"],[yt.WORKSPACES_PRIMARY]:["id","selector"],[yt.WORKSPACES_PAGE]:["orderBy","start","limit","teamId","bookmarkFilter","teamAccess"],[yt.REPOSITORIES_PAGE]:[],[yt.TEAMS_CREATE]:[],[yt.TEAM_PROVISION]:[],[yt.WORKSPACES_BOOKMARKS_BATCH]:[]},jE=[200,201],UE=["FULL"],BE={start:0,limit:0,orderDirection:"ascending",orderBy:"name"},FE={orderDirection:"ascending",orderBy:"name",bookmarked:!1,teamID:void 0,start:0,limit:0};function VE(e,t){return Object.assign({},e,t)}function KE(e){return("ascending"===e.orderDirection?"+":"-")+e.orderBy}function GE(e){const t={};return e.start&&(t.start=e.start),e.limit&&(t.limit=e.limit),t}class $E extends pr{_getHeaders(e){const t={"x-service-features":"CanvasMigration","Cache-Control":"no-cache"};return e&&(t["Content-Type"]=e),t}async _discoverLinks(e){return(await this._getResponse(e,this._getHeaders()))._links}_getEndpointHref(e){return`https://${this._core._environment.endpoints.PROJECTS_HOST}${e}`}async discoverLinks(){return this._discoverLinks(this._getEndpointHref("/api/v2/index"))}async getTeams(e){const t=function(e,t){const i=VE(BE,t),s=GE(i);return s.orderBy=KE(i),s.nameContains=i.nameContains,s.state=i.state,It(e,yt.TEAMS_PAGE,s)}(await this.discoverLinks(),e);return await this._getResponse(t,this._getHeaders())}async getOrgRepositories(){const e=It(await this.discoverLinks(),yt.REPOSITORIES_PAGE,{});return await this._getResponse(e,this._getHeaders())}async createTeam(e){const t=It(await this.discoverLinks(),yt.TEAMS_CREATE,{});return(await this._doPost(t,this._getHeaders(ft),JSON.stringify(e))).json()}async permanentlyDeleteTeam(e){const t=It(e,yt.TEAMS_PRIMARY);await this._doDelete(t,this._getHeaders(),[204])}async archiveTeam(e){const t=It(e,yt.TEAMS_DISCARD);await this._doPost(t,this._getHeaders(),void 0,[204])}async restoreTeam(e){const t=It(e,yt.TEAMS_RESTORE);await this._doPost(t,this._getHeaders(),void 0,[204])}async renameTeam(e,t){const i=It(e,yt.TEAMS_RENAME);await this._doPost(i,this._getHeaders(ft),JSON.stringify({name:t}),[204])}async patchTeam(e,t){const i=It(e,yt.TEAMS_PROPERTIES);await this._doPatch(i,Object.assign(Object.assign({},this._getHeaders(gt)),{"If-Match":"*"}),JSON.stringify(t),[204])}async getTeamProperties(e){const t=It(e,yt.TEAMS_PROPERTIES);return await this._getResponse(t,this._getHeaders())}async provisionTeam(){const e=It(await this.discoverLinks(),yt.TEAM_PROVISION,{});return(await this._doPost(e,this._getHeaders(),void 0,jE)).json()}async getSpaces(e){const t=function(e,t){const i=VE(FE,t),s=GE(i);s.orderBy=KE(i),i.bookmarked||(s.bookmarkFilter=!1),!1===i.teamAccess&&(s.teamAccess=!1);const{teamID:r}=i;return r&&(s.teamId=r),It(e,yt.WORKSPACES_PAGE,s)}(await this.discoverLinks(),e);return await this._getResponse(t,this._getHeaders())}async getSpace(e,t=UE){const i=It(await this.discoverLinks(),yt.WORKSPACES_PRIMARY,{id:e,selector:t});return await this._getResponse(i,this._getHeaders())}async reloadSpace(e,t=UE){const i=It(e,yt.WORKSPACES_PRIMARY,{selector:t});return await this._getResponse(i,this._getHeaders())}async bookmarkOp(e){const t=It(await this.discoverLinks(),yt.WORKSPACES_BOOKMARKS_BATCH);return(await this._doPost(t,this._getHeaders(ft),JSON.stringify(e),[200])).json()}async createSpace(e,t){const i=It(e,yt.WORKSPACES_CREATE);return(await this._doPost(i,this._getHeaders(ft),JSON.stringify(t))).json()}async patchSpace(e,t){const i=It(e,yt.WORKSPACES_PRIMARY);await this._doPatch(i,this._getHeaders(gt),JSON.stringify(t),[200,204])}async getEnclosingSpaces(e){const t=It(await this.discoverLinks(),yt.WORKSPACES_CONTEXT);return(await this._doPost(t,this._getHeaders(ft),JSON.stringify(e),[200])).json()}}Ye([rt((function(e){return vt(e,HE)})),Qe(0,it)],$E.prototype,"_discoverLinks",null);class WE{constructor(e,t,i){this._spacePool=e,this._workspaceInterface=t,this._teamRoleGetterFactory=i}supportsFilter(e){if(!e)return!1;const{teamRole:t,state:i}=e;return"MEMBER"!==t&&"active"===i}async loadPage(e){return await this._loadPage(e)}async _loadPage(e,t){var i;const{order:s,filter:r}=e,{limit:n}=null!==(i=e.loadOptions)&&void 0!==i?i:{},o=null==r?void 0:r.teamRole;if("MEMBER"===o)throw We.create(Be.BAD_REQUEST,"Filtering only for spaces with reamRole MEMBER is not supported.");const a=this._spacePool._core._environment.getValue("PROJECTS_LIST_UPDATE_LATENCY"),c=Date.now()-a,l=this._workspaceInterface.getSpaces({orderBy:c_[s.field],orderDirection:s.direction,teamID:null==r?void 0:r.teamID,bookmarked:null==r?void 0:r.bookmarked,teamAccess:"NONE"!==o&&void 0,start:t,limit:n}),d=o?()=>o:await this._teamRoleGetterFactory(),u=await l,h=this._spacePool.createLoaderUpdateSession(c),p=Dc.updateRemoteItems(h,u.projects.map((e=>Object.assign(Object.assign({},e),{teamRole:d(e.teamId),state:"active"}))));for(const e of p)e[Pc]();let _;h.commit();const m=u.pageSpec.start+u.pageSpec.limit;return m<u.pageSpec.totalLimit&&(_=e=>this._loadPage(e,m)),{items:p,total:u.pageSpec.totalLimit,loadNextPage:_,mostRecentValidMutation:c}}}class zE{constructor(e,t){this._teamPool=e,this._projectInterface=t}async loadPage(e){return await this._loadPage(e)}async _loadPage(e,t){var i;const{order:s,filter:r}=e,{limit:n}=null!==(i=e.loadOptions)&&void 0!==i?i:{},o=this._teamPool._core._environment.getValue("PROJECTS_LIST_UPDATE_LATENCY"),a=Date.now()-o,c=await this._projectInterface.getTeams({orderBy:n_[s.field],orderDirection:s.direction,start:t,limit:n,nameContains:null==r?void 0:r.nameContains,state:null==r?void 0:r.state}),l=this._teamPool.createLoaderUpdateSession(a),d=T_.updateRemoteItems(l,c.teams);let u;l.commit();const h=c.pageSpec.start+c.pageSpec.limit;return h<c.pageSpec.totalLimit&&(u=e=>this._loadPage(e,h)),{items:d,total:c.pageSpec.totalLimit,loadNextPage:u,mostRecentValidMutation:a}}}class qE{constructor(e,t){this._orgRepositoryPool=e,this._projectInterface=t}async loadPage(){const e=await this._projectInterface.getOrgRepositories(),t=this._orgRepositoryPool.createLoaderUpdateSession(Date.now()),i=Fp.updateRemoteItems(t,e.repositories);return t.commit(),{items:i}}}function YE(e){const t=new Set(e.items.map((e=>e.id)));return e=>t.has(e)?"MEMBER":"NONE"}function QE(e){const t=e._links;if(!t)throw We.create(Be.BAD_REQUEST,'Object has not been loaded correctly, missing "_links" property.');return t}class JE{constructor(e){this._core=e,this._orgRepositoryPool=new Xo(this._core,"orgRepository"),this._teamPool=new Xo(this._core,"team"),this._spacePool=new Xo(this._core,"space"),this._projectInterface=new $E(this._core),this._rapi=new Ll(this._core),this._hostAssetContext=this._core.hostAssetContext,this._teamRoleGetterFactory=async()=>YE(await this._fetchTeams()),this._teamPoolDelegate={onItemsUpdated:()=>{const e=this.getTeams()._getExistingList(a_.default,new Eo);if(!e||!e.items.length)return void this._core._environment.debug("[SpaceContext._teamPoolDelegate] skipping update of Space.teamRole -- no teams");const t=this._spacePool,i=YE(e),s=t.createUpdateSession("Updating teamRole across all spaces");this._spacePool.forEach((e=>{const t=i(e.teamID);e.teamRole!==t&&Dc.updateLocalItem(s,e,{teamRole:t})})),s.commit()}},this._teamPool.addDelegate(this._teamPoolDelegate,"context")}get projectInterface(){return this._projectInterface}get orgRepositoryPool(){return this._orgRepositoryPool}get teamPool(){return this._teamPool}get spacePool(){return this._spacePool}async discoverLinks(){return await this._projectInterface.discoverLinks()}getOrgRepositories(){const e=new qE(this._orgRepositoryPool,this._projectInterface);return new Uo(this._orgRepositoryPool,[e])}getTeams(){const e=new zE(this._teamPool,this._projectInterface);return new Uo(this._teamPool,[e],new I_)}getSpaces(){const e=new WE(this._spacePool,this._projectInterface,this._teamRoleGetterFactory);return new Uo(this._spacePool,[e],new O_)}async _fetchTeams(){const e=this.getTeams().getList(a_.default,void 0,{refreshTimeout:3e5});return await Mo(e),e}async provisionType1Team(){if("type1"!==this._core._environment.getValue("ACCOUNT_TYPE"))return;const e=await this._fetchTeams(),t=this._core._environment.getValue("USER_ID");let i=e.items.find((e=>e.repositoryOwnerID===t&&"user"===e.repositoryOwnerType));if(!i){const e=await this._projectInterface.provisionTeam(),t=this._teamPool.createMutationSession();i=T_.updateRemoteItem(t,e),t.commit()}return i}async createTeam(e,t){const i=await this._projectInterface.createTeam(Object.assign(Object.assign({},t),{repositoryId:e.repositoryID})),s=this._teamPool.createMutationSession(),r=T_.updateRemoteItem(s,i);return s.commit(),r}async _renameAsset(e,t){if(!Tr(t))throw We.create(Be.BAD_REQUEST,"Invalid name provided for the rename operation.");const i=await this._hostAssetContext.getAssetWithCloudID(e);return await i.rename(t),i}async _renameTeam(e,t){const i=t.name;if(!i)return;if(!Tr(i))throw We.create(Be.BAD_REQUEST,"Invalid name provided for the rename operation.");const s=QE(e);await this._projectInterface.renameTeam(s,i);const r=this._core._getAssetPool(),n=r.getLocalItemById(e.id),o=await this._core.getAssetContext();if(n){const e=Nr(i,n),t=r.createUpdateSession();Dr({assetPool:r,asset:n,session:t,operation:{type:"rename",newPath:e},assetContext:o}),this._hostAssetContext._adobeAssetUpdater.updateLocalItem(t,n,{"repo:path":e,"repo:name":i}),t.commit()}const a=this.teamPool.createMutationSession();T_.updateLocalItem(a,e,{name:i}),a.commit()}async renameTeam(e,t){await this.updateTeam(e,{name:t})}async restoreTeam(e){await Ks.runExclusiveTask("restore",[e],(async()=>{try{const t=QE(e),i=this.teamPool.createUpdateSession();await this._projectInterface.restoreTeam(t),T_.updateLocalItem(i,e,{state:"active"}),i.commit()}catch(e){throw We.create(Be.UNKNOWN,"An error occured restoring team",{underlyingError:e})}}))}async archiveTeam(e){await Ks.runExclusiveTask("archive",[e],(async()=>{const t=this.teamPool.createUpdateSession();try{const t=QE(e);await this._projectInterface.archiveTeam(t)}catch(t){const i=t;if(i.code!==Be.BAD_REQUEST)throw i;{const t=await this._hostAssetContext.getAssetWithCloudID(e.id);await t.discard()}}T_.updateLocalItem(t,e,{state:"discarded"}),t.commit()}))}_validateDescription(e){return e.length<=1e3}_validateColor(e){return/^#[A-Fa-f0-9]{6}$/.test(e)}_getPatchOP(e,t,i,s){if(s&&!s(e))throw We.create(Be.BAD_REQUEST,`Property ${t} has invalid value`);return 0===e.length&&i&&i.length>0?{op:"remove",path:t}:{op:i?"replace":"add",value:e,path:t}}async _patchTeam(e,t){const{description:i}=t,s=[],r={};if(void 0!==i&&(s.push(this._getPatchOP(i,"/description",e.description,this._validateDescription)),r.description=i),!s.length)return;const n=QE(e);await this._projectInterface.patchTeam(n,s);const o=this.teamPool.createMutationSession();T_.updateLocalItem(o,e,r),o.commit()}async updateTeam(e,t){await Ks.runExclusiveTask("update",[e],(async()=>{const i=await Promise.allSettled([this._patchTeam(e,t),this._renameTeam(e,t)]);this._checkForRejection(i,(()=>{const t=this.teamPool.createUpdateSession();t.queueDiscardedItem(e),t.commit()}))}))}async loadTeamProperties(e){const t=QE(e),i=await this._projectInterface.getTeamProperties(t);if(!i||0===Object.keys(i).length)return;const s=this.teamPool.createMutationSession();T_.updateLocalItem(s,e,Object.assign({},i)),s.commit()}async permanentlyDeleteTeam(e){if("active"===e.state)throw We.create(Be.UNSUPPORTED,"Teams that are not 'discarded' cannot be permanently deleted.");const t=t=>{if(t.discardedItems){const i=t.discardedItems.filter((t=>t.id===e.id)).map((e=>e.id));i.length&&this._teamPool.removeLocalItems(i)}};this._teamPool.on(Yo,t);try{await Ks.runExclusiveTask("delete",[e],(async()=>{const t=QE(e);await this._projectInterface.permanentlyDeleteTeam(t);const i=this.teamPool.createUpdateSession();i.queueDiscardedItem(e),i.commit()}))}finally{this.teamPool.off(Yo,t)}}async[Ac](e){const t=this._core._environment.getValue("PROJECTS_ITEM_UPDATE_LATENCY");await e.waitForMutationPropagationIfNeeded(t);const i=QE(e),s=await this._projectInterface.reloadSpace(i,UE),r=this._spacePool.createUpdateSession();Dc.updateLocalItem(r,e,s),r.commit()}async _moveSpaces(e,t,i=new Map,s=!0,r){let n={failedResults:[],newModels:[]};return await Ks.runExclusiveTask("move",e,(async()=>{const s=await this._hostAssetContext.getAssetWithCloudID(t.id);void 0===r&&(r=new Map);const o=new Map,a=e.map((e=>{o.set(e.id,e);let t=`${s.repoPath}/${Mr(e,i)}`;return t=Pr(this._core,e.id,t,!1,r),{op:"move",id:e.id,source:{"repo:assetId":e.id,"repo:repositoryId":e.repositoryID},target:{"repo:path":t,"repo:repositoryId":s.repositoryID}}}));n=await this._runOperations(a,o,{teamId:t.id,teamName:t.name})})),s?await ed(n,t,i,r,this._moveSpaces.bind(this)):n}async moveSpaces(e,t){return this._moveSpaces(e,t)}async archiveSpaces(e){return await Ks.runExclusiveTask("archive",e,(async()=>{const t=new Map,i=e.map((e=>(t.set(e.id,e),{op:"discard",id:e.id,target:{"repo:assetId":e.id,"repo:repositoryId":e.repositoryID}})));return await this._runOperations(i,t)}))}async restoreSpaces(e,t){return await Ks.runExclusiveTask("restore",e,(async()=>{const i=new Map,s=e.map((e=>(i.set(e.id,e),{op:"restore",id:e.id,target:{"repo:assetId":e.id,"repo:repositoryId":e.repositoryID},name:null==t?void 0:t.get(e)})));return await this._runOperations(s,i)}))}async _runOperations(e,t,i={}){const s=await this._core.getAssetContext();return await this._rapi.runOperationsForContext(e,t,this._spacePool,((e,t,r)=>{if(!r)throw We.create(Be.UNKNOWN,"Missing metadata from asset bulk operation.");const n=r["repo:path"];if(t.pathName!==n){const e=this._core._getAssetPool(),i=e.getLocalItemById(t.id),r=e.createUpdateSession();i&&(Dr({assetPool:e,asset:i,session:r,operation:{type:"rename",newPath:n},assetContext:s}),s._adobeAssetUpdater.updateLocalItem(r,i,{"repo:path":n}),r.commit())}Dc.updateLocalItem(e,t,Object.assign({state:"ACTIVE"===r["repo:state"]?"active":"archived",name:r["repo:name"],pathName:r["repo:path"]},i))}),[{match:e=>e.code===Be.ACCESS_DENIED||e.code===Be.NOT_FOUND,action:async e=>await e.load().catch((t=>({model:e,error:t})))}])}async createSpaceBookmarks(e){return this._bookmarkSpaces("ADD",e)}async removeSpaceBookmarks(e){return this._bookmarkSpaces("REMOVE",e)}async _bookmarkSpaces(e,t){await Ks.runExclusiveTask("bookmark",t,(async()=>{var i;const s=this._core._environment.getValue("USER_ID"),r={bookmarked:"ADD"===e},n=this.spacePool.createUpdateSession(),o=new Map,a=t.map((e=>(o.set(e.id,{space:e,wasBookmarked:e.isBookmarked}),Dc.updateLocalItem(n,e,r),{projectUrn:e.id,userId:s})));let c;n.commit();try{c=await this._projectInterface.bookmarkOp({op:e,items:a})}finally{if(c)for(const e of c.responses){const t=o.get(null===(i=e.request)||void 0===i?void 0:i.projectUrn);t&&(t.status=e.status)}const e=this.spacePool.createUpdateSession(),t=this.spacePool.createMutationSession();for(const{space:i,wasBookmarked:s,status:n}of o.values())201===n?Dc.updateLocalItem(t,i,r):(Dc.updateLocalItem(e,i,{bookmarked:s}),404===n&&e.queueDiscardedItem(i));e.commit(),t.commit()}}))}_checkForRejection(e,t){for(const i of e)if("rejected"===i.status){const e=i.reason;throw e instanceof We&&e.code===Be.NOT_FOUND&&t(),e}}async updateSpace(e,t){await Ks.runExclusiveTask("update",[e],(async()=>{const i=await Promise.allSettled([this._renameSpace(e,t),this._patchSpace(e,t)]);this._checkForRejection(i,(()=>{const t=this.spacePool.createUpdateSession();t.queueDiscardedItem(e),t.commit()}))}))}async _renameSpace(e,t){const{name:i}=t;if(void 0===i)return;const s=await this._renameAsset(e.id,i),r=this.spacePool.createMutationSession();Dc.updateLocalItem(r,e,{name:s.name,pathName:s.repoPath}),r.commit()}async _patchSpace(e,t){const{description:i,color:s}=t,r=[],n={};if(void 0!==i&&(r.push(this._getPatchOP(i,"/description",e.description,this._validateDescription)),n.description=i),void 0!==s&&(r.push(this._getPatchOP(s,"/color",e.color,this._validateColor)),n.color=s),!r.length)return;const o=QE(e);await this._projectInterface.patchSpace(o,r);const a=this.spacePool.createMutationSession();Dc.updateLocalItem(a,e,n),a.commit()}async createSpace(e,t){const i=QE(e);this._validateColor(t.color),this._validateDescription(t.description),Tr(t.name);const s=await this._projectInterface.createSpace(i,Object.assign(Object.assign({},t),{parentId:e.id})),r=this.spacePool.createMutationSession(),n=Dc.updateRemoteItem(r,Object.assign(Object.assign({},s),{teamId:e.id}));return r.commit(),n}async getEnclosingSpace(e){return(await this.getEnclosingSpaces([e])).get(e)}async getEnclosingSpaces(e){const t=this._core._environment.getValue("PROJECTS_LIST_UPDATE_LATENCY"),i=Date.now()-t,s=await this._projectInterface.getEnclosingSpaces(e.map((e=>({"repo:assetId":e})))),r=new Map,n=this.spacePool.createUpdateSession("get enclosing spaces",i);for(const e of s.responses){if(200!==e.status)continue;const t=e.request["repo:assetId"],i=Dc.updateRemoteItem(n,e.body);r.set(t,i)}return n.commit(),r}async lookupSpaceById(e){let t=this._spacePool.getLocalItemById(e);if(!t){const i=await this._projectInterface.getSpace(e,UE),s=this._spacePool.createUpdateSession();t=Dc.updateRemoteItem(s,i),s.commit()}return t}onUserLeftTeam(e){const t=this._teamPool.getLocalItemById(e);if(t){const e=this._teamPool.createUpdateSession();e.queueDiscardedItem(t),e.commit()}}}Ye([nt],JE.prototype,"getOrgRepositories",null),Ye([nt],JE.prototype,"getTeams",null),Ye([nt],JE.prototype,"getSpaces",null);var XE=Object.freeze({__proto__:null,default:JE});function ZE(e,t){return`${e}-${t}`}class eT{constructor(e){const{asset:t,mediaTypes:i,excludeMediaTypes:s}=e,r=qe(e,["asset","mediaTypes","excludeMediaTypes"]);this._implicitDirectoryListingFilter=new ta(Object.assign({asset:t},r)),(i||s)&&(this._adobeAssetFilter=new Qd({mediaTypes:i,excludeMediaTypes:s}))}matches(e){return!(this._adobeAssetFilter&&!this._adobeAssetFilter.matches(e)||this._implicitDirectoryListingFilter&&!this._implicitDirectoryListingFilter.matches(e))}get mediaTypes(){var e;return null===(e=this._adobeAssetFilter)||void 0===e?void 0:e.mediaTypes}}class tT extends vc{constructor(e,t,i){super(e,t,i),this._core=e,this.isProject=!0,this._description="",this._projectPermissions=$i,this._projectInterface=new Gd(this._core),this._repositoryOwner={id:"",type:"user"},this._directorySubtype=ts.CC_PROJECTS,this._assetClass="directory",this._allowInLists=!1,this._isRecent=!1,this._projectLinks=null==i?void 0:i.projectLinks,this._needsRepoMetadata=!0,on.manageLazyLoading(this,[{event:lt,fetchData:this._getGradient}])}get gradientID(){var e;return null!==(e=this._gradientID)&&void 0!==e?e:""}get gradient(){return this._gradient}async _getGradient(){this._gradient=await this._core.projectContext.getGradient(this.gradientID)}get description(){return tn("Description Not yet Supported","Currently the description field is not supported by the service."),this._description}get directorySubtype(){return this._directorySubtype}get inaccessibleLibraryReferencesCount(){return this._inaccessibleLibraryReferences?this._inaccessibleLibraryReferences.length:void 0}async _load({repoMetadata:e,appMetadata:t,effectivePermission:i,projectMetadata:s,perUserMetadata:r}={}){await super._load({repoMetadata:e,appMetadata:t,effectivePermission:i,perUserMetadata:r}),s||(s=await this._projectInterface.getProject(this.id));const n=this._core.projectContext._assetPool.createMutationSession();this._core.projectContext._projectUpdater.updateRemoteItem(n,s),n.commit()}get projectLinks(){return this._projectLinks}get creator(){return this._creator}get view(){if(!this._repositoryOwner.id)return;const e=this._core._environment.getUserId(),{defaultOrganizationId:t,organizations:i}=this._core.hostAssetContext,s=[e,...(null==i?void 0:i.map((e=>e.id)))||[]];return this._repositoryOwner.id===e||this._repositoryOwner.id===t?Qi.Yours:s.includes(this._repositoryOwner.id)?void 0:Qi.SWY}async move(e){tn("[MOVE_UNSUPPORTED]",`Move on a project is not supported ${e}`)}async moveCSCProject(e){const t=await this._core.getProjectContext();await t.moveCSCProject(this.id,e)}async rename(e){var t;if(!(null===(t=this._projectLinks)||void 0===t?void 0:t[yt.PROJECTS_RENAME]))throw We.create(Be.BAD_REQUEST,"Rename link is missing for this project.");if(!Tr(e))throw We.create(Be.BAD_REQUEST,"Invalid name provided for asset rename operation.");await this._projectInterface.renameProject(e,this._projectLinks);const i=this._core.projectContext._assetPool,s=await this._core.getAssetContext(),r=i.createUpdateSession(),n=Nr(e,this);Dr({assetPool:this._core._getAssetPool(),asset:this,session:r,operation:{type:"rename",newPath:n},assetContext:s}),this._core.projectContext._projectUpdater.updateLocalItem(r,this,{"repo:name":e,"repo:path":n}),r.commit()}async discard(){if(this.isDiscarded)throw We.create(Be.INVALID_OPERATION,"Asset is already discarded");await this._ensureLink(yt.DISCARD),await this._projectInterface.discardProject(this.id,this._projectLinks);const e=this._core._getAssetPool(),t=await this._core.getAssetContext(),i=e.createUpdateSession();Dr({assetPool:e,asset:this,session:i,operation:{type:"discard"},assetContext:t}),this._core.projectContext._projectUpdater.updateLocalItem(i,this,{"repo:state":"DISCARDED"}),i.commit()}async restore(){if(!this.isDiscarded)throw We.create(Be.INVALID_OPERATION,"Cannot restore an asset that is not discarded");await this._ensureLink(yt.RESTORE),await this._projectInterface.restoreProject(this.id,this._projectLinks);const e=this._core._getAssetPool(),t=await this._core.getAssetContext(),i=e.createUpdateSession();Dr({assetPool:e,asset:this,session:i,operation:{type:"restore"},assetContext:t}),this._core.projectContext._projectUpdater.updateLocalItem(i,this,{"repo:state":"ACTIVE"}),i.commit()}async _updateProjectLinksFromService(){const e=await this._projectInterface.getProject(this.id),{_links:t}=e,i=this._core.projectContext._assetPool.createUpdateSession();this._core.projectContext._projectUpdater.updateLocalItem(i,this,{_links:t}),i.commit()}_isProjectLinkType(e){return[yt.CREATE,yt.RESTORE,yt.DISCARD,yt.PROJECTS_RENAME,yt.PAGE,yt.PROJECTS_REFERENCE_CREATE,yt.PROJECTS_REFERENCE_PRIMARY].includes(e)}async _ensureLink(e){var t;if(this._isProjectLinkType(e)){(null===(t=this._projectLinks)||void 0===t?void 0:t[e])||await this._updateProjectLinksFromService();const i=Object.assign(Object.assign({},this.__links),{[e]:this._projectLinks[e]}),s=this._core.hostAssetContext._assetPool.createUpdateSession();return this._core.hostAssetContext._adobeAssetUpdater.updateLocalItem(s,this,{_links:i}),void s.commit()}this._core._environment.debug(`ProjectLinkMissing ${e} Link ${e} missing on project, called out fetch it`),await super._ensureLink(e)}async validateProjectNameForRename(e){return e.toLowerCase()===this.name.toLowerCase()||await this._core.projectContext.validateProjectNameForCreate(e,this)}async updateProperties(){}leaveStatus(){const e=this.collaboratorArray;if(!this._isCollaboratorDataLoaded)return Zi.PENDING;if(0===e.length)return Zi.CANNOT_LEAVE_NO_COLLABORATORS;const t=e.find((e=>e.isCurrentUser));return t?"owner"===t.role?Zi.CANNOT_LEAVE_IS_OWNER:!t.isDirect&&t.isAdmin?Zi.CANNOT_LEAVE_IS_ADMIN_OF_PROJECT:1===e.length?Zi.CANNOT_LEAVE_LAST_COLLABORATOR:e.find((e=>e.canShare&&e.isDirect&&e!==t))||"user"===this.storageAssignee.type?t.isDirect?Zi.CAN_LEAVE:Zi.CANNOT_LEAVE_ADDRESS_BOOK_GROUP_MEMBER:Zi.CANNOT_LEAVE_LAST_DIRECT_COLLAB_WITH_SHARE_PERMISSION:Zi.CANNOT_LEAVE_ADDRESS_BOOK_GROUP_MEMBER}userCanLeaveProject(){switch(tn("userCanLeaveProject Deprecated","Use Project.leaveStatus instead. This will be removed on or after 2024-10-01."),this.leaveStatus()){case Zi.PENDING:return;case Zi.CAN_LEAVE:return!0;case Zi.CANNOT_LEAVE_NO_COLLABORATORS:case Zi.CANNOT_LEAVE_ADDRESS_BOOK_GROUP_MEMBER:case Zi.CANNOT_LEAVE_LAST_COLLABORATOR:case Zi.CANNOT_LEAVE_LAST_DIRECT_COLLAB_WITH_SHARE_PERMISSION:case Zi.CANNOT_LEAVE_IS_ADMIN_OF_PROJECT:case Zi.CANNOT_LEAVE_IS_OWNER:return!1}}hasPermission(...e){return e.every((e=>(this._projectPermissions&e)===e))}async updateProject(e){await this._core.projectContext.updateProject(this.id,e)}_applyRestorePermission(e){const t=this._core.projectContext._getCachedRestoreCapability(this.repositoryID),i=t!==this.hasPermission(Gi.Restore);this._projectPermissions=t?this._projectPermissions|Gi.Restore:this._projectPermissions&~Gi.Restore,i&&e.queueChangedItem(this,[lt])}async _reloadPermissions(){await this._load(),super._reloadPermissions()}get librariesSource(){const e=new Qn(this._core.hostAssetContext._assetPool,this,this._core,!0,!0),t=new eT({asset:this,mediaTypes:[za],_isSharedWithYou:!0});return new Uo(this._core.hostAssetContext._assetPool,[e],t)}get repositoryOwner(){return this._repositoryOwner}async createLibrary(e){const t=await this._core.getLibraryContext(),i={name:e.name,parent_assetId:this.id,roles:e.roles};return i.access=e.restrictEdit?"team_view":"team_edit",t._createLibrary(i)}async updateLastAccessed(e){await super.updateLastAccessed(e);const t=this._core.projectContext._assetPool.createUpdateSession();this._core.projectContext._projectUpdater.updateLocalItem(t,this,{isRecent:Boolean(this.lastAccessed)}),t.commit()}async createLibraryReference(e){await this._ensureLink(yt.PROJECTS_REFERENCE_CREATE);const{"project:referenceId":t}=await this._projectInterface.createLibraryReference(e,this._projectLinks),i=await this._core.getLibraryContext(),s=await i.getLibraryByAssetId(t),r=i._assetPool.createUpdateSession("create reference library");i._libraryUpdater.updateLocalItem(r,s,{referenced_by_project:{projectId:this.id,reference:!0}}),r.commit()}async deleteLibraryReference(e){await this._ensureLink(yt.PROJECTS_REFERENCE_PRIMARY),await this._projectInterface.deleteLibraryReference(e,this._projectLinks);const t=this._core.hostAssetContext._assetPool.getLocalItemById(e);if(t){const e=await this._core.getLibraryContext(),i=e._assetPool.createUpdateSession("delete reference library");e._libraryUpdater.updateLocalItem(i,t,{referenced_by_project:{projectId:this.id,reference:!1}}),i.commit()}}async requestAccessToLibraryReferences(e){if(void 0===this._inaccessibleLibraryReferences)return tn("[INACCESSIBLE_REFERENCES_NOT_LOADED]","Inaccessible library references not loaded. No access requests will be made."),{successfulRequests:[],failedRequests:[]};if(0===this._inaccessibleLibraryReferences.length)return{successfulRequests:[],failedRequests:[]};const t=await this._core.getCollaborationContext();return await t._requestAccess(this._inaccessibleLibraryReferences,e,{canComment:!0,canShare:!0,role:"viewer"})}}Ye([ht],tT.prototype,"gradientID",null),Ye([an(lt,"_gradient")],tT.prototype,"gradient",null),Ye([ht],tT.prototype,"description",null),Ye([ht],tT.prototype,"inaccessibleLibraryReferencesCount",null),Ye([ht],tT.prototype,"view",null),Ye([an(xi,"_collaboratorsArray")],tT.prototype,"leaveStatus",null),Ye([ht],tT.prototype,"hasPermission",null),Ye([nt],tT.prototype,"librariesSource",null),Ye([ht],tT.prototype,"repositoryOwner",null);const iT=new vn({localItemType:tT,remoteIdProperty:"repo:assetId",propertyUpdater:new Cn({_repositoryID:"repo:repositoryId",_path:"repo:path",_etag:"repo:etag",_created:{name:"repo:createDate",format:"date"},_description:"description",_name:"repo:name",_assetState:{name:"repo:state",choices:_n},_storageAssignee:{name:"storage:assignee",format:bc},_projectLinks:{name:"_links",format:"object"},_creator:{name:`_embedded[${yt.PROJECTS_CREATOR}]`,format:"object"},_createdBy:`_embedded[${yt.PROJECTS_CREATOR}].id`,_gradientID:{name:`_embedded[${yt.APP_METADATA}][project:rendition].gradientId`,set:(e,t)=>{const i=t;if(!e)return void(i._gradientID="");const s=ZE(e,i._core._environment.getValue("LOCALE"));i._gradientID!==s&&(i._gradientID=s,on.setLoadStatus(i,at,nn.NotLoaded))}},_projectPermissions:{get:function(e){var t;return(null===(t=e._embedded)||void 0===t?void 0:t[yt.AC_EFFECTIVE])?function(e){const t=e[yt.PROJECTS_PRIMARY]||e["*"]||[],i=e[yt.PRIMARY]||e["*"]||[],s=e[yt.DIRECTORY]||e["*"]||[],r=e[yt.ANNOTATIONS]||e["*"]||[],n=e[yt.AC_POLICY]||e["*"]||[];let o=Gi.None;return t.forEach((e=>{switch(e){case"ack":o|=Gi.Ack;break;case"read":o|=Gi.Read;break;case"rename":o|=Gi.Rename;break;case"discard":o|=Gi.Discard;break;case"restore":o|=Gi.Restore}})),i.forEach((e=>{switch(e){case"write":o|=Gi.Write;break;case"delete":s.includes("write")&&(o|=Gi.Delete)}})),n.includes("write")&&(o|=Gi.Share),r.includes("write")&&(o|=Gi.WriteComment),o}(e._embedded[yt.AC_EFFECTIVE]):On},format:"number"},_repositoryOwner:{name:`_embedded[${yt.REPOSITORY}][repo:owner]`,format:bc},_isRecent:{name:"isRecent",format:"boolean"},_allowInLists:{name:"allowInLists",format:"boolean"},_directorySubtype:{name:"project:directorySubtype",choices:["wfPortfolio","wfProgram","wfProject","wfProjectTemplate","ccProject"]},_inaccessibleLibraryReferences:{name:"inaccessibleReferences",isArray:!0,format:"string"}})});class sT{constructor(e,t,i,s){this._projectPool=e,this._projectInterface=t,this._projectUpdater=i,this._core=s}supportsFilter(e){return void 0!==e}async loadPage(e){return await this._loadPage(e)}async _loadPage(e,t){var i,s,r;const{order:n,filter:o}=e,{limit:a}=null!==(i=e.loadOptions)&&void 0!==i?i:{},c=this._projectPool._core._environment.getValue("PROJECTS_LIST_UPDATE_LATENCY"),l=Date.now()-c;let d;if(t)d=await this._projectInterface.getProjectsWithLink(t);else if((null==o?void 0:o.view)===Qi.Recent){const t=a?{first:a}:{};d=await this._projectInterface.getRecentProjects(t,e.resource)}else{const t=o.view?{view:Ji[o.view]}:{},i=o.repositoryID?{repositoryId:o.repositoryID}:{},s=o.nameContains?{nameContains:o.nameContains}:{},r=o.isDiscarded?{isDiscarded:!0}:{},c=o.directorySubtypes?{directorySubtypes:o.directorySubtypes}:{},l=[];if(o.view!==Qi.Yours&&o.view!==Qi.SWY||await on.fetchIfNeeded(this._core.hostAssetContext,$d),o.view===Qi.Yours){const e=this._core.hostAssetContext.defaultOrganizationId||"";l.push(this._core._environment.getUserId()),e&&l.push(e)}else o.view!==Qi.Organization&&o.view!==Qi.Admin||o.organizationID&&l.push(o.organizationID);d=await this._projectInterface.getProjects(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({orderBy:Wp[n.field],orderDirection:n.direction,limit:a},t),i),s),r),l.length?{ownerId:l.join(",")}:{}),c),e.resource)}const u=this._projectPool.createLoaderUpdateSession(l),h=d.children.map((e=>o.view===Qi.Recent?Object.assign(Object.assign({},e),{isRecent:!0}):Object.assign(Object.assign({},e),{allowInLists:!0}))),p=this._projectUpdater.updateRemoteItems(u,h);let _;u.commit();const m=null===(s=d._links)||void 0===s?void 0:s.next;return m&&(_=e=>this._loadPage(e,m)),{items:p,total:null===(r=d._page)||void 0===r?void 0:r.total,loadNextPage:_,mostRecentValidMutation:l}}}class rT{constructor(){this.view=Y.All}matches(e){return e.isProject&&(e._allowInLists||e._isRecent)}}class nT{constructor(e,t){this._core=e,this._assetPool=t,this._projectInterface=new Gd(this._core),this._gradientPool=new Xo(this._core,"gradient"),this._canRestoreProjectCache=new Map,this._projectUpdater=iT,this._core.on(Ri,((e,t,i)=>{"LOCALE"===i.configurationKeyName&&this._getGradients()}))}get assetPool(){return tn("ProjectContext._assetPool","This property is deprecated and will be removed on or after 10-01-2024. For internal use by SAM.js only."),this._assetPool}projects(){this._core.hostAssetContext.organizations;const e=new sT(this._assetPool,this._projectInterface,this._projectUpdater,this._core);return new Uo(this._assetPool,[e],new rT)}async createProject(e){const{name:t,gradientID:i}=e;if(!Tr(t))throw We.create(Be.BAD_REQUEST,"Invalid name provided for the rename operation.");const s=await this.getGradient(i),r=await this._projectInterface.createProject({[yt.APP_METADATA]:{"project:rendition":{gradientId:s.gradientID}},"repo:name":t}),n=this._assetPool.createMutationSession(),o=this._projectUpdater.updateRemoteItem(n,Object.assign(Object.assign({},r),{allowInLists:!0}));return n.commit(),o}async resolveProjectByName(e){const t=await this._projectInterface.resolveProjectByName(e),i=t["repo:assetId"];this._core.collaborationContext.confirmAccess(i);const s=this._assetPool.createMutationSession(),r=this._projectUpdater.updateRemoteItem(s,t);return s.commit(),r}async validateProjectNameForCreate(e,t,i){if(!Tr(e))throw We.create(Be.BAD_REQUEST,"Invalid project name.");let s=e;t&&(s=Nr(e,t));try{await this._projectInterface.validateProjectName(s,i)}catch(e){const t=e;if(t.code===Be.NOT_FOUND)return!0;if(t.code===Be.CONFLICT)return!1;throw e}return!1}async getProjectbyID(e,t=!0){let i=this._assetPool.getLocalItemById(e);if(i)return t&&this._core.collaborationContext.confirmAccess(e),i;t&&await this._core.collaborationContext.confirmAccess(e);const s=await this._projectInterface.getProject(e),r=this._assetPool.createMutationSession();return i=this._projectUpdater.updateRemoteItem(r,s),i.hasPermission(Gi.Write)||"org"!==i.repositoryOwner.type?this._projectUpdater.updateLocalItem(r,i,{allowInLists:!0}):this._checkForInvite(i),r.commit(),i}async _checkForInvite(e){const t=new Cl(this._core);if((await t.getQueryResponse({limit:1,asset_id:e.id,[Rn.SHARED_VIA_INVITE]:!0})).result_sets[0].items.length){const t=this._assetPool.createUpdateSession();this._projectUpdater.updateLocalItem(t,e,{allowInLists:!0}),t.commit()}}async _getGradients(){const e=this._core._environment.getValue("LOCALE"),t=await this._projectInterface.getGradients(e),i=t.default,s=this._gradientPool.createUpdateSession(),r=function(e,t,i){return e.map((e=>Object.assign(Object.assign({},e),{computedID:ZE(e["project:gradientId"],i),"project:gradientData":Object.assign(Object.assign({},e["project:gradientData"]),{isDefault:t===e["project:gradientId"],languageCode:i})})))}(t.children,i,e),n=P_.updateRemoteItems(s,r);return s.commit(),n}async getGradients(){return await this._getGradients()}async getGradient(e){const t=this._gradientPool.getLocalItemById(e),i=this._core._environment.getValue("LOCALE");if(t&&t.languageCode===i)return t;await this._getGradients();const s=this._gradientPool.getLocalItemById(e);if(!s){if(this._defaultGradient&&this._defaultGradient.languageCode===i)return this._defaultGradient;if(this._gradientPool.forEach((e=>{e.isDefault&&(this._defaultGradient=e)})),this._defaultGradient)return this._defaultGradient;throw We.create(Be.UNKNOWN,`Gradient ID does not exist ${e}`)}return s}async updateProject(e,t){let i={};if(t.gradientID){const s=await this.getGradient(t.gradientID),r=await this.getProjectbyID(e),n=r.projectLinks;i=Object.assign(Object.assign({},i),{gradientID:s.gradientID}),await this._projectInterface.patchProject(n,i);const o=this._assetPool.createMutationSession();this._projectUpdater.updateRemoteItem(o,{"repo:assetId":r.id,_embedded:{[yt.APP_METADATA]:{"project:rendition":{gradientId:s.gradientID}}}}),o.commit()}}async canCreateProjects(e){try{return await this._projectInterface.getCapability(Xi.CREATE,e),!0}catch(e){if(!ze(e))throw e;return!1}}async _canRestoreProject(e){if(this._canRestoreProjectCache.has(e))return this._canRestoreProjectCache.get(e);const t=await this.canCreateProjects(e);return this._canRestoreProjectCache.set(e,t),t}_getCachedRestoreCapability(e){return this._canRestoreProjectCache.get(e)||!1}async _prefetchIndex(){await this._projectInterface._discoverProjectLinks()}async canCreateProjectReason(e){try{return await this._projectInterface.getCapability(Xi.CREATE,e),es.ALLOWED}catch(e){if(!ze(e))return es.UNKNOWN;switch(e.subCode){case Fe.PROJECTS_ADMIN_ONLY:return es.ADMIN_DISABLED;case Fe.PROJECTS_NO_HOME_REPOSITORY:return es.NO_HOME_REPOSITORY;case Fe.PROJECTS_INVALID_REPOSITORY:return es.INVALID_REPOSITORY;default:return es.UNKNOWN}}}getProjectsSearchSource(e){const t=new xd({_query:e,_projectsOnly:!0}),i=new Hd(this._core.hostAssetContext._assetPool,this._core,this._core.hostAssetContext._globalSearchInterfaceV3,t);return new Uo(this._assetPool,[i],t)}async _callContextAPI(e,t){const i=(await this._projectInterface._discoverProjectLinks())[yt.PROJECTS_CONTEXT].href;return await this._projectInterface._issueContextAPIRequest(e,t,i)}getProjectOrder(e="ascending",t="name"){return new qp(e,t)}getProjectFilter(e){return new f_(e)}async createCSCProjectByPath(e,t,i,s,r,n){return this._createCSCProject({name:e,subType:t,path:i,orgId:s,userId:r,appMetadata:n})}async createCSCProjectInParent(e,t,i,s,r,n){return this._createCSCProject({name:e,subType:t,parentAssetId:i,orgId:s,userId:r,appMetadata:n})}async moveCSCProject(e,t){const i=await this.getProjectbyID(e,!1);if(i.directorySubtype===ts.CC_PROJECTS)throw We.create(Be.INVALID_OPERATION,"Move is only supported for CSC Projects");const s=i.projectLinks;await this._projectInterface.moveCSCProject(t,s);const r=await this._core.getAssetContext(),n=await this._projectInterface.getProject(e),o=this._assetPool.createMutationSession();Dr({assetPool:this._assetPool,asset:i,session:o,operation:{type:"move",newPath:n["repo:path"]},assetContext:r}),this._projectUpdater.updateRemoteItem(o,n),o.commit()}async _createCSCProject(e){const{name:t,subType:i,parentAssetId:s,path:r,orgId:n,userId:o,appMetadata:a}=e;if(!Tr(t))throw We.create(Be.BAD_REQUEST,"Invalid name provided");const c=Object.assign({name:t,projectDirectorySubType:i},a?{appMetadata:Object.assign({},a)}:{});let l;l=s?Object.assign(Object.assign({},c),{parentAssetId:s}):Object.assign(Object.assign({},c),{path:r});const d=await this._projectInterface.createCSCProject(l,n,o),u=this._assetPool.createMutationSession(),h=this._projectUpdater.updateRemoteItem(u,Object.assign(Object.assign({},d),{allowInLists:!0}));u.commit();const p=new sa(this._core,h);return await p.load(),await h._handleResourceUpdates({repoMetadata:p.data}),h}}Ye([nt],nT.prototype,"projects",null),Ye([Dt],nT.prototype,"createProject",null),Ye([(e,t,i)=>{const s=Symbol(`@consolidated ${t}`),r=i.value;if(!r)throw We.create(Be.BAD_REQUEST,"@consolidated decorator can only be applied to a method");i.value=async function(...e){var i;const n=null===(i=this[tt])||void 0===i?void 0:i.get(t),o=void 0===n?"default":e[n],a=this[s]||(this[s]=new Map),c=a.get(o);if(c)return c;{const t=r.apply(this,e);return a.set(o,t),t.finally((()=>{a.delete(o)})),t}}},Qe(0,it)],nT.prototype,"validateProjectNameForCreate",null),Ye([Dt,wt,Qe(0,it)],nT.prototype,"getProjectbyID",null),Ye([wt],nT.prototype,"_prefetchIndex",null);var oT=Object.freeze({__proto__:null,default:nT});const aT="/api/v1",cT={"Content-Type":ft};class lT extends pr{async _monitorResponse(e){return e}_getUrl(e){return`https://${this._core._environment.endpoints.CLASSROOMS_HOST}${e}`}async createClassroom(e){var t;const i=await this._doPost(this._getUrl(`${aT}/classrooms`),cT,JSON.stringify({className:e.name,subject:e.subject,grades:e.grades,period:e.period,teachers:(null===(t=e.teachers)||void 0===t?void 0:t.map((e=>encodeURIComponent(e))))||[]}),[201]);return await i.json()}async createClassroomFromVirtual(e){const t=await this._doPost(this._getUrl(`${aT}/classrooms/virtual/${e}/create`),{"Content-Type":ft},void 0,[201]);return await t.json()}async updateClassroomFromVirtual(e,t){var i;const s=await this._doPost(this._getUrl(`${aT}/classrooms/virtual/${e}/update`),{"Content-Type":ft},JSON.stringify({className:t.name,subject:t.subject,grades:t.grades,period:t.period,teachers:(null===(i=t.teachers)||void 0===i?void 0:i.map((e=>encodeURIComponent(e))))||[]}),[201]);return await s.json()}async deleteClassroom(e){await this._doDelete(this._getUrl(`${aT}/classrooms/${e}`),cT,[202])}async deleteVirtualClassroom(e){await this._doPost(this._getUrl(`${aT}/classrooms/virtual/${e}/delete`),cT,void 0,[202])}async getClassroom(e){return this._getResponse(this._getUrl(`${aT}/classrooms/${e}`)).then((e=>{var t;return null!==(t=e.importedFrom)&&void 0!==t||(e.importedFrom={}),e}))}async getClassrooms(){return this._getResponse(this._getUrl(`${aT}/classrooms`)).then((e=>e.map((e=>{var t;return null!==(t=e.importedFrom)&&void 0!==t||(e.importedFrom={}),e}))))}async refreshClassroomCode(e){return this._doPut(this._getUrl(`${aT}/classrooms/${e}/code/refresh`),void 0,void 0,[200]).then((e=>e.json()))}async updateClassroom(e,t){var i;return(await this._doPatch(this._getUrl(`${aT}/classrooms/${e}`),{"Content-Type":ft},JSON.stringify({className:t.name,subject:t.subject,grades:t.grades,period:t.period,teachers:(null===(i=t.teachers)||void 0===i?void 0:i.map((e=>encodeURIComponent(e))))||[]}))).json()}async getClassroomTeachers(e){return this.getClassroomMembers(e,Bh.TEACHER)}async getClassroomStudents(e){return await this.getClassroomMembers(e,Bh.STUDENT)}async getClassroomMembers(e,t){const i=t===Bh.NONE?"":`/${t}s`,s=`${aT}/classrooms/${e}/members${i}`,r=await this._getResponse(this._getUrl(s));return r.members.forEach((t=>{t.classroomId=e,t.computedKey=Ga(e,t.userId)})),r.members}async getMembership(e){return this._getResponse(this._getUrl(`${aT}/classrooms/${e}/members/status`))}async blockStudent(e,t){const i=await this._doPost(this._getUrl(`${aT}/classrooms/${e}/members/students/block`),cT,JSON.stringify({studentId:t}),[200]);return await i.json()}async unblockStudent(e,t){const i=await this._doPost(this._getUrl(`${aT}/classrooms/${e}/members/students/unblock`),cT,JSON.stringify({studentId:t}),[200]);return await i.json()}async removeStudent(e,t){const i=await this._doDelete(this._getUrl(`${aT}/classrooms/${e}/members/students?studentId=${t}`),cT,[202]);return await i.json()}async removeTeacher(e,t){const i=await this._doDelete(this._getUrl(`${aT}/classrooms/${e}/members/teachers?userId=${t}`),cT,[202]);return await i.json()}async checkCoTeacherEligibility(e){const t=await this._doPost(this._getUrl(`${aT}/classrooms/users/eligibility`),cT,JSON.stringify({classroomId:e.classroomId,role:"teacher",emails:e.emails}),[200]);return await t.json()}}class dT{constructor(e,t){this._ClassroomMemberPool=e,this._classroomsInterface=t}async loadPage(e){return await this._loadPage(e)}async _loadPage(e){const{filter:t}=e,i=t,s=await this._classroomsInterface.getClassroomMembers(i.classroomId,i.role),r=this._ClassroomMemberPool.createLoaderUpdateSession(Date.now()),n=Wh.updateRemoteItems(r,s);return r.commit(),{items:n,total:n.length,loadNextPage:void 0}}}const uT=Object.values(Mh);class hT extends Ks{constructor(e,t){super(e,t),this._core=e,this._code="",this._createdBy="",this._importSource={},this._isDeleted=!1,this._isVirtual=!1,this._grades=[],this._memberRole=Bh.NONE,this._name="",this._period="",this._status=Nh.ACTIVE,this._subject=Mh.noSubject,this._classroomsInterface=new lT(this._core),this._assetId="";const i=new dT(this._core.classroomContext._classroomMemberPool,this._classroomsInterface);this._members=new Uo(this._core.classroomContext._classroomMemberPool,[i],new Yh({classroomId:this.id}))}get code(){return this._code}get created(){if(this._created)return new Date(this._created)}get createdBy(){return this._createdBy}get importSource(){return this._importSource}get isDeleted(){return this._isDeleted}get isVirtual(){return this._isVirtual}get grades(){return this._grades}get members(){return this._members}get memberRole(){return this._memberRole}get name(){return this._name}get period(){return this._period}get status(){return this._status}get subject(){return this._subject}get type(){return this._type}get userCount(){return this._userCount}get assetId(){return this._assetId}async delete(){await this._classroomsInterface.deleteClassroom(this.id)}async refreshCode(){this._classroomsInterface.refreshClassroomCode(this.id)}async update(e){return this._core.classroomContext.updateClassroom(this.id,e)}async checkCoTeacherEligibility(e){return this._classroomsInterface.checkCoTeacherEligibility(Object.assign(Object.assign({},e),{classroomId:this.id}))}}Ye([ht],hT.prototype,"code",null),Ye([ht],hT.prototype,"created",null),Ye([ht],hT.prototype,"createdBy",null),Ye([ht],hT.prototype,"importSource",null),Ye([ht],hT.prototype,"isDeleted",null),Ye([ht],hT.prototype,"isVirtual",null),Ye([ht],hT.prototype,"grades",null),Ye([ht],hT.prototype,"members",null),Ye([ht],hT.prototype,"memberRole",null),Ye([ht],hT.prototype,"name",null),Ye([ht],hT.prototype,"period",null),Ye([ht],hT.prototype,"status",null),Ye([ht],hT.prototype,"subject",null),Ye([ht],hT.prototype,"type",null),Ye([ht],hT.prototype,"userCount",null),Ye([ht],hT.prototype,"assetId",null);const pT=new vn({localItemType:hT,remoteIdProperty:"classId",getAlternateId:function(e){return e.virtualId},propertyUpdater:new Cn({_assetId:{name:"assetId",format:"string"},_code:{name:"classCode",format:"string"},_created:{name:"createdOn",format:"string"},_createdBy:{name:"createdBy",format:"string"},_importSource:{name:"importedFrom",format:"object",set:(e,t)=>{t._importSource={id:e.sourceId,type:e.source,synced:e.lastUpdatedAt?new Date(e.lastUpdatedAt):void 0}}},_isDeleted:{name:"deleted",format:"boolean"},_isVirtual:{name:"isVirtualClassroom",format:"boolean"},_grades:{isArray:!0,name:"grades"},_memberRole:{name:"memberRole",format:"string"},_name:{name:"className",format:"string"},_period:{name:"period",format:"string"},_status:{name:"status",format:"string",choices:Object.values(Nh)},_subject:{name:"subject",format:"string",choices:uT},_type:{name:"type",format:"string",choices:Object.values(Dh)},_userCount:{name:"userCount",format:"number"},_virtualId:{name:"virtualId",format:"string"}})});class _T{constructor(e,t){this._classroomPool=e,this._classroomsInterface=t}async loadPage(e){return await this._loadPage(e)}async _loadPage(e,t){const i=await this._classroomsInterface.getClassrooms(),s=this._classroomPool.createLoaderUpdateSession(Date.now()),r=pT.updateRemoteItems(s,i);return s.commit(),{items:r,total:r.length,loadNextPage:void 0}}}const mT=Ra(),fT={orderDirection:"ascending",orderBy:"repo:name",start:0,limit:0};class gT extends pr{async _discoverLinks(e){return(await this._getResponse(e,{headers:mT}))._links}_getEndpointHref(e){return`https://${this._core._environment.endpoints.ASSIGNMENTS_HOST}${e}`}async discoverLinks(){return this._discoverLinks(this._getEndpointHref("/api/v1/index"))}async getAssignments(e){if(!e.classroomId&&!e.campaignId)throw We.create(Be.BAD_REQUEST,"classroomId or campaignId is required to fetch assignments");if(e.classroomId&&e.campaignId)throw We.create(Be.BAD_REQUEST,"Cannot fetch assignments by both classroomId and campaignId");const t=function(e,t){const i=Object.assign({},fT,t),s=function(e){const t={};return e.start&&(t.start=e.start.toString()),e.limit&&(t.limit=e.limit.toString()),t}(i);s.orderBy=function(e){return("ascending"===e.orderDirection?"+":"-")+e.orderBy}(i);const{classroomId:r,campaignId:n,submissions:o}=i;return r?s.classroomId=r:n&&(s.campaignId=n),o&&(s.submissions=o),It(e,yt.ASSIGNMENTS_COLLECTION,s)}(await this.discoverLinks(),e);return this._getResponse(t,{headers:mT})}async getAssignmentBy(e,t,i,s){const r=await this.discoverLinks(),n="id"===e?{assignmentId:t}:{assignmentCode:t},o="id"===e?yt.ASSIGNMENTS_PRIMARY:yt.ASSIGNMENTS_CODE;i&&(n.submissions=i);const a=It(r,o,n);return this._getResponse(a,{headers:Object.assign(Object.assign({},mT),s)})}async getAssignment(e,t,i){return this.getAssignmentBy("id",e,t,i)}async getAssignmentByCode(e,t,i){return this.getAssignmentBy("code",e,t,i)}async createAssignment(e){var t,i,s,r;const n=(null!==(i=null===(t=e.tasks)||void 0===t?void 0:t.length)&&void 0!==i?i:0)>0,o=e.status||(n?Jh.ASSIGNED:Jh.DRAFT),a=await this.discoverLinks(),c=new URL(It(a,yt.ASSIGNMENTS_CREATE));jr(c,{classroomId:e.classroomId,assign:(o===Jh.ASSIGNED).toString()});const l=e.externalTemplateIds||[],d=(null===(s=e.externalTutorials)||void 0===s?void 0:s.map((e=>JSON.stringify(e))))||[],u={"assignment:canClassroomReadSubmissions":e.canClassroomReadSubmissions,"assignment:dueDate":null===(r=e.dueDate)||void 0===r?void 0:r.toISOString(),"assignment:instructions":e.instructions,"repo:name":e.name,"assignment:status":o,"assignment:tasks":e.tasks||[],"assignment:createdBy":e.createdBy,"assignment:externalTemplateIds":[...l,...d],"assignment:campaignId":e.campaignId},h=await this._doPost(c.toString(),Object.assign(Object.assign({},mT),{"Content-Type":ft}),JSON.stringify(u),[201]);return await h.json()}async patchAssignment(e,t){const i=It(await this.discoverLinks(),yt.ASSIGNMENTS_PRIMARY,{assignmentId:e}),s=await this._doPatch(i,Object.assign(Object.assign({},mT),{"Content-Type":ft}),JSON.stringify(t),[200,204]);return await s.json()}async discardAssignment(e,t){if(!(null==t?void 0:t[yt.DISCARD]))throw We.create(Be.BAD_REQUEST,`Discard link is missing for this assignment ${e}`);const i=It(t,yt.DISCARD,{assignmentId:e});await this._doPost(i,mT,void 0,[204])}async restoreAssignment(e,t){if(!(null==t?void 0:t[yt.RESTORE]))throw We.create(Be.BAD_REQUEST,`Restore link is missing for this assignment ${e}`);const i=It(t,yt.RESTORE,{assignmentId:e});await this._doPost(i,mT,void 0,[204])}}Ye([rt((function(e){return vt(e,Qh)})),Qe(0,it)],gT.prototype,"_discoverLinks",null);class yT extends un{constructor(e,t){super(e,t),this._core=e,this._parent=t,this._studentAssignmentsInterface=new ou(this._core)}async _loadData(){const e=await this._core.hostAssetContext._rapi.getAssetLinks(this._parent.id),t=await this._studentAssignmentsInterface.getStudentAssignment(this._parent.id,void 0,{[Ca.PREFER_RAPI]:"true"}),{_links:i}=t,s=qe(t,["_links"]);await this._setData(Object.assign(Object.assign({},s),{_links:Object.assign(Object.assign({},e),i)}));const r=this._core._getAssetPool().createMutationSession();bT.updateLocalItem(r,this._parent,this.data),r.commit()}}class vT{constructor({core:e,studentAssignmentsInterface:t}){this._core=e,this._studentAssignmentsInterface=t}async loadPage(e){return await this._loadPage(e)}async _loadPage(e,t){var i;const s=Date.now(),{studentAssignmentId:r}=e.implicitFilter,n=this._core._getAssetPool().getLocalItemById(r);let o=null!==(i=null==n?void 0:n.studentAssignmentFiles)&&void 0!==i?i:[];if(n&&n._hasLoadedChildren)o=this._core._getAssetPool().toArray().filter((e=>e.studentAssignmentId===r));else if(0===o.length){const e=await this._studentAssignmentsInterface.getStudentAssignment(r,{loadDocuments:!0}),t=e["classroom:context"]["classroom:assignmentContext"]["classroom:assignmentAssetId"],i=e["classroom:context"]["classroom:classroomContext"]["classroom:classroomAssetId"],s=this._core._getAssetPool().createMutationSession();o=this._core.classroomContext._updateStudentAssignmentFilesCache({remoteStudentAssignmentFiles:e.children,session:s,assignmentId:t,classroomId:i,studentAssignmentId:r}),n&&(n._hasLoadedChildren=!0)}return{items:o,total:o.length,mostRecentValidMutation:s}}}class OT extends vc{constructor(e,t,i){super(e,t,i),this._core=e,this._assetClass="directory",this._assignmentId="",this._assignmentCode="",this._parentClassroomId="",this._inheritedClassroomId="",this._hasLoadedChildrenProp=!1,this._status=tu.NOT_STARTED,this._student={id:"",displayName:"",email:""},this._studentAssignmentsInterface=new ou(this._core),this._studentAssignmentFiles=[],this._studentAssignmentAppMetadata=new yT(e,this),this._needsRepoMetadata=!0}get isVirtual(){return this.status===tu.NOT_STARTED}get appMetadata(){return this._studentAssignmentAppMetadata}get _hasLoadedChildren(){return this._hasLoadedChildrenProp}set _hasLoadedChildren(e){this._hasLoadedChildrenProp=e}get studentAssignmentFiles(){return this._studentAssignmentFiles}get assignmentId(){return this._assignmentId}get assignmentCode(){return this._assignmentCode}get parentClassroomId(){return this._parentClassroomId||this._inheritedClassroomId||super.parentClassroomId||""}get parentAssignmentId(){return this.assignmentId}get status(){return this._status}get student(){return this._student}get studentDirectoryId(){return this._studentDirectoryId}get submission(){return this._submission}get submissionDate(){return this._submissionDate}get isStudentAssignment(){return!0}async getFiles(e={}){return this._studentDirectoryId?this._core.classroomContext.getStudentAssignmentFiles({studentDirectoryId:this.studentDirectoryId,order:e.order}):[]}get files(){if(this._studentDirectoryId)return this._studentAssignmentFilesSource||(this._studentAssignmentFilesSource=new Uo(this._core._getAssetPool(),[new vT({core:this._core,studentAssignmentsInterface:this._studentAssignmentsInterface})],new fp(this._studentDirectoryId))),this._studentAssignmentFilesSource}get studentAssignmentLinks(){return this.links}get links(){return Object.assign({},this.__links)}get _canLoadNewChildrenFromONSNotification(){return this.hasPermission(Gi.Write)}canStart(){return this._status===tu.NOT_STARTED}canReturn(){return this._status===tu.SUBMITTED}async _load({repoMetadata:e,appMetadata:t,effectivePermission:i,perUserMetadata:s,doFetchStudentAssignmentMetadata:r=!0}={}){if(await super._load({repoMetadata:e,appMetadata:t,effectivePermission:i,perUserMetadata:s}),r){const e=await this._studentAssignmentsInterface.getStudentAssignment(this.id,void 0,{[Ca.PREFER_RAPI]:"true"}),t=this._core._getAssetPool().createMutationSession();bT.updateRemoteItem(t,e),t.commit()}}async return(){var e;return this._core.classroomContext._returnAssignment({links:this.links,studentAssignmentId:this.studentDirectoryId,submissionId:null===(e=this.submission)||void 0===e?void 0:e["repo:assetId"]})}async start(){return this._core.classroomContext._startAssignment({assignmentId:this.assignmentId,links:this.links})}async submit(e){return await this._core.classroomContext.submitAssignment({assignmentId:this.assignmentId,links:this.links,status:this.status,studentAssignmentId:this.studentDirectoryId,submissionId:e}),this}get isChildOfClassroom(){return!0}get isChildOfAssignment(){return!0}get isChildOfAssignmentMaterials(){return!1}get isChildOfStudentAssignment(){return!1}}Ye([ht],OT.prototype,"isVirtual",null),Ye([ht],OT.prototype,"appMetadata",null),Ye([ht],OT.prototype,"assignmentId",null),Ye([ht],OT.prototype,"assignmentCode",null),Ye([ht],OT.prototype,"parentClassroomId",null),Ye([ht],OT.prototype,"parentAssignmentId",null),Ye([ht],OT.prototype,"status",null),Ye([ht],OT.prototype,"student",null),Ye([ht],OT.prototype,"studentDirectoryId",null),Ye([ht],OT.prototype,"submission",null),Ye([ht],OT.prototype,"submissionDate",null),Ye([ht],OT.prototype,"getFiles",null),Ye([ht],OT.prototype,"studentAssignmentLinks",null),Ye([ht],OT.prototype,"links",null),Ye([ht],OT.prototype,"isChildOfClassroom",null),Ye([ht],OT.prototype,"isChildOfAssignment",null),Ye([ht],OT.prototype,"isChildOfAssignmentMaterials",null),Ye([ht],OT.prototype,"isChildOfStudentAssignment",null);const bT=new vn({remoteIdProperty:"repo:assetId",getAlternateId:function(e){var t;let i;if(void 0!==e["classroom:context"])i=e["classroom:context"]["classroom:assignmentContext"]["classroom:assignmentAssetId"];else{if(void 0===e["cc:inherited"]||void 0===e["cc:inherited"]["cc:assignment"])throw We.create(Be.INTERNAL_ERROR,"Remote item does not have classroom:context or cc:inherited defined");i=e["cc:inherited"]["cc:assignment"]["repo:assetId"]}return`${null===(t=e["assignment:assignee"])||void 0===t?void 0:t.id}-${i}`},localItemType:OT,propertyUpdater:new Cn({_assignmentId:{name:"classroom:context[classroom:assignmentContext][classroom:assignmentAssetId]",format:"string"},_assignmentCode:{name:"computedAssignmentCode",format:"string"},_parentClassroomId:{name:"classroom:context[classroom:classroomContext][classroom:classroomAssetId]",format:"string"},_inheritedClassroomId:{name:"cc:inherited[cc:classroom][repo:assetId]",format:"string"},_studentAssignmentFiles:{isArray:!0,name:"children",format:"object",set:(e,t)=>{const i=t;i.studentAssignmentFiles.length=0;const s=i._core._getAssetPool().createMutationSession(),r=i._core.classroomContext._updateStudentAssignmentFilesCache({remoteStudentAssignmentFiles:e,session:s,assignmentId:i.assignmentId,classroomId:i.parentClassroomId,studentAssignmentId:i.id});i.studentAssignmentFiles.push(...r)}},__links:{name:"_links",format:"object"},_status:{name:"assignment:submissionStatus",format:"string"},_student:{name:"assignment:assignee",format:"object_subset",set:(e,t)=>{const i=t;i._student=Object.assign(Object.assign({},i._student),e)}},_studentDirectoryId:{name:"repo:assetId",format:"string"},_submission:{name:"assignment:submission",format:"object"},_submissionDate:{name:"assignment:submissionDate",format:"date"}})});class IT extends un{constructor(e,t){super(e,t),this._core=e,this._parent=t}async _loadData(){await super._loadData();const e=this._core._getAssetPool().createMutationSession();AT.updateLocalItem(e,this._parent,this.data),e.commit()}}class ET{constructor(e){const{assignmentCode:t,assignmentId:i}=e||{};this.assignmentCode=t||"",this.assignmentId=i||""}matches(e){if(!this.assignmentId&&!this.assignmentCode)throw new Error("Getting StudentAssignments across Assignments is not supported at this time");if(!e.isStudentAssignment)return!1;const t=e;return!(this.assignmentId&&this.assignmentId!==t.assignmentId||this.assignmentCode&&this.assignmentCode!==t.assignmentCode)}}const TT=Object.values(Jh);class ST extends vc{constructor(e,t,i){super(e,t,i),this._core=e,this._assetClass="directory",this._assignmentInterface=new gT(this._core),this._canClassroomReadSubmissions=!1,this._classroomId="",this._code="",this._externalTemplateIds=[],this._externalTemplateIdsRemote=[],this._instructions="",this._isAutoCreated=!1,this._studentAssignments=[],this._externalTutorials=[],this._isExternalTutorialsDirty=!1,this._parentClassroomId="",this._materialsAssetId="",this._studentsAssetId="",this._parentAssignmentsFolderAssetId="",this._assignmentAppMetadata=new IT(e,this),this._needsRepoMetadata=!0}get appMetadata(){return this._assignmentAppMetadata}get canClassroomReadSubmissions(){return this._canClassroomReadSubmissions}get campaignId(){return this._campaignId}get classroomId(){return this._classroomId}get isChildOfAssignment(){return!1}get isChildOfAssignmentMaterials(){return!1}get isChildOfClassroom(){return!0}get isChildOfStudentAssignment(){return!1}get studentAssignments(){return this._studentAssignments}_getStudentAssignmentsFilter(){return new ET({assignmentId:this.id})}getStudentAssignments(){return this._core.classroomContext._getStudentAssignmentsSource(this._getStudentAssignmentsFilter())}get code(){return this._code}get isAssignment(){return!0}get instructions(){return this._instructions}get isAutoCreated(){return this._isAutoCreated}get dueDate(){return this._dueDate}get status(){return this._status}get tasks(){var e;return null!==(e=this._tasks)&&void 0!==e?e:[]}get templateIds(){var e;return null!==(e=this._templateIds)&&void 0!==e?e:[]}get parentClassroomId(){return this._parentClassroomId}get materialsAssetId(){return this._materialsAssetId}get studentsAssetId(){return this._studentsAssetId}get _parentAssignmentsAssetId(){return this._parentAssignmentsFolderAssetId}get externalTemplateIds(){return this._isExternalTutorialsDirty&&(this._externalTemplateIds=this._externalTemplateIdsRemote.filter((e=>{try{return JSON.parse(e),!1}catch(e){return!0}}))),this._externalTemplateIds}get externalTutorials(){return this._isExternalTutorialsDirty&&(this._externalTutorials=this._externalTemplateIdsRemote.reduce(((e,t)=>{try{e.push(JSON.parse(t))}catch(e){}return e}),[])),this._externalTutorials}get referenceIds(){var e;return null!==(e=this._referenceIds)&&void 0!==e?e:[]}_loadWithRetry(){return this._load()}async _load({repoMetadata:e,appMetadata:t,effectivePermission:i}={}){await super._load({repoMetadata:e,appMetadata:t,effectivePermission:i});const s=void 0!==this.links[yt.ASSIGNMENTS_PRIMARY],r=0===this.studentAssignments.length;if(!e||!t||r||!s){const e=await this._assignmentInterface.getAssignment(this.id,void 0,{[Ca.PREFER_RAPI]:"true"}),t=this._core._getAssetPool().createMutationSession();AT.updateRemoteItem(t,e),t.commit()}}async updateAssignment(e){return this._core.classroomContext.updateAssignment(this.id,e)}async setTemplates(e){return this._core.classroomContext.updateAssignment(this.id,{templateIds:e})}async discard(){if(this.isDiscarded)return;await this._assignmentInterface.discardAssignment(this.id,this.links);const e=this._core._getAssetPool().createUpdateSession();AT.updateLocalItem(e,this,{"repo:state":_n[1]}),e.commit()}async restore(){if(!this.isDiscarded)return;await this._assignmentInterface.restoreAssignment(this.id,this.links);const e=this._core._getAssetPool().createUpdateSession();AT.updateLocalItem(e,this,{"repo:state":_n[0]}),e.commit()}get links(){return Object.assign({},this.__links)}}Ye([ht],ST.prototype,"appMetadata",null),Ye([ht],ST.prototype,"canClassroomReadSubmissions",null),Ye([ht],ST.prototype,"campaignId",null),Ye([ht],ST.prototype,"classroomId",null),Ye([ht],ST.prototype,"isChildOfAssignment",null),Ye([ht],ST.prototype,"isChildOfAssignmentMaterials",null),Ye([ht],ST.prototype,"isChildOfClassroom",null),Ye([ht],ST.prototype,"isChildOfStudentAssignment",null),Ye([ht],ST.prototype,"studentAssignments",null),Ye([nt],ST.prototype,"getStudentAssignments",null),Ye([ht],ST.prototype,"code",null),Ye([ht],ST.prototype,"isAssignment",null),Ye([ht],ST.prototype,"instructions",null),Ye([ht],ST.prototype,"isAutoCreated",null),Ye([ht],ST.prototype,"dueDate",null),Ye([ht],ST.prototype,"status",null),Ye([ht],ST.prototype,"tasks",null),Ye([ht],ST.prototype,"templateIds",null),Ye([ht],ST.prototype,"parentClassroomId",null),Ye([ht],ST.prototype,"materialsAssetId",null),Ye([ht],ST.prototype,"studentsAssetId",null),Ye([ht],ST.prototype,"externalTemplateIds",null),Ye([ht],ST.prototype,"externalTutorials",null),Ye([ht],ST.prototype,"referenceIds",null),Ye([Pt],ST.prototype,"_loadWithRetry",null),Ye([ht],ST.prototype,"links",null);const AT=new vn({localItemType:ST,remoteIdProperty:"repo:assetId",propertyUpdater:new Cn({_campaignId:{name:"assignment:campaignId",format:"string"},_canClassroomReadSubmissions:{name:"assignment:canClassroomReadSubmissions",format:"boolean"},_name:{name:"repo:name",format:"string"},_created:{name:"repo:createDate",format:"date"},_parentClassroomAssetId:{name:"classroom:context[classroom:classroomContext][classroom:classroomAssetId]",format:"string"},_parentAssignmentsFolderAssetId:{name:"classroom:context[classroom:assignmentsContext][classroom:assignmentsAssetId]",format:"string"},_materialsAssetId:{name:"classroom:context[assignment:materialsContext][assignment:materialsAssetId]",format:"string"},_studentsAssetId:{name:"classroom:context[assignment:studentsContext][assignment:studentsAssetId]",format:"string"},_repositoryID:{name:"repo:repositoryId",format:"string"},__links:{name:"_links",format:"object"},_studentAssignments:{isArray:!0,name:"children",format:"object",set:(e,t)=>{const i=t;i.studentAssignments.length=0;const s=i._core._getAssetPool().createMutationSession(),r=e.map((e=>Object.assign(Object.assign({},e),{computedAssignmentCode:i.code,"classroom:context":{"classroom:assignmentContext":{"classroom:assignmentAssetId":i.id},"classroom:classroomContext":{"classroom:classroomAssetId":i.parentClassroomId},"classroom:assignmentsContext":{"classroom:assignmentsAssetId":i._parentAssignmentsAssetId},"assignment:materialsContext":{"assignment:materialsAssetId":i.materialsAssetId},"assignment:studentsContext":{"assignment:studentsAssetId":i.studentsAssetId}}}))),n=bT.updateRemoteItems(s,r);s.commit(),i.studentAssignments.push(...n),lp.default.sortItems(i.studentAssignments)}},_tasks:{isArray:!0,name:"assignment:tasks"},_code:{name:"assignment:code",format:"string"},_classroomId:{name:"assignment:classroomId",format:"string"},_createdBy:{name:"repo:createdBy",format:"string"},_status:{name:"assignment:status",format:"string",choices:TT},_dueDate:{name:"assignment:dueDate",format:"date"},_instructions:{name:"assignment:instructions",format:"string"},_templateIds:{name:"assignment:templateIds",isArray:!0},_externalTemplateIdsRemote:{name:"assignment:externalTemplateIds",isArray:!0,set:(e,t)=>{const i=t;i._externalTemplateIdsRemote=e,i._isExternalTutorialsDirty=!0}},_referenceIds:{name:"assignment:referenceIds",isArray:!0},_path:{name:"repo:path",format:"string"},_modifiedBy:{name:"repo:modifiedBy",format:"string"},_assetState:{name:"repo:state",choices:_n},_isAutoCreated:{get:e=>"adobe"===e["assignment:createdBy"],format:"boolean"}})});class PT{constructor(e,t){this._assignmentInterface=e,this._core=t}async loadPage(e){return await this._loadPage(e)}async observeAssignmentsFolder(e){const t=e["classroom:context"]["classroom:assignmentsContext"]["classroom:assignmentsAssetId"];return this._core.hostAssetContext.getAssetWithCloudID(t)}async _loadPage(e,t){const i=e.filter,{classroomId:s,campaignId:r,submissions:n}=i,o=await this._assignmentInterface.getAssignments(Object.assign(Object.assign({},e),{classroomId:s,campaignId:r,submissions:await this._core.classroomContext.validateStudentAssignmentsFilter(n,s)})),a=Date.now(),c=this._core._getAssetPool().createLoaderUpdateSession(a),l=AT.updateRemoteItems(c,o.children);return c.commit(),o.children.length>0&&this.observeAssignmentsFolder(o.children[0]).then((e=>{i._monitoredFolder=e})),{items:l,total:o.children.length,mostRecentValidMutation:a}}}class wT{constructor(e,t){this._StudentAssignmentsInterface=e,this._core=t}async loadPage(e){return await this._loadPage(e)}async observeStudentsFolder({remoteStudentAssignments:e}){const t=e[0]["classroom:context"]["assignment:studentsContext"]["assignment:studentsAssetId"];return this._core.hostAssetContext.getAssetWithCloudID(t)}async _loadPage(e,t){const{filter:i,implicitFilter:s}=e,{loadDocuments:r}=i,{assignmentId:n,assignmentCode:o}=s;let a=[];const c=(await this._StudentAssignmentsInterface.getStudentAssignments({assignmentCode:o,assignmentId:n,loadDocuments:r})).children,l=this._core._getAssetPool().createUpdateSession(),d=o?c.map((e=>Object.assign(Object.assign({},e),{computedAssignmentCode:o}))):c;if(a=bT.updateRemoteItems(l,d),l.commit(),r)for(const e of a)e._hasLoadedChildren=!0;return c.length>0&&this.observeStudentsFolder({remoteStudentAssignments:c}).then((e=>{s._monitoredFolder=e})),{items:a,total:a.length,loadNextPage:void 0}}}var CT="object"==typeof globalThis?globalThis:"object"==typeof self?self:"object"==typeof window?window:"object"==typeof global?global:{},RT="1.7.0",LT=/^(\d+)\.(\d+)\.(\d+)(-(.+))?$/,NT=function(e){var t=new Set([e]),i=new Set,s=e.match(LT);if(!s)return function(){return!1};var r=+s[1],n=+s[2],o=+s[3];if(null!=s[4])return function(t){return t===e};function a(e){return i.add(e),!1}function c(e){return t.add(e),!0}return function(e){if(t.has(e))return!0;if(i.has(e))return!1;var s=e.match(LT);if(!s)return a(e);var l=+s[1],d=+s[2],u=+s[3];return null!=s[4]||r!==l?a(e):0===r?n===d&&o<=u?c(e):a(e):n<=d?c(e):a(e)}}(RT),DT=RT.split(".")[0],MT=Symbol.for("opentelemetry.js.api."+DT),xT=CT;function kT(e,t,i,s){var r;void 0===s&&(s=!1);var n=xT[MT]=null!==(r=xT[MT])&&void 0!==r?r:{version:RT};if(!s&&n[e]){var o=new Error("@opentelemetry/api: Attempted duplicate registration of API: "+e);return i.error(o.stack||o.message),!1}return n.version!==RT?(o=new Error("@opentelemetry/api: Registration of version v"+n.version+" for "+e+" does not match previously registered API v"+RT),i.error(o.stack||o.message),!1):(n[e]=t,i.debug("@opentelemetry/api: Registered a global for "+e+" v"+RT+"."),!0)}function HT(e){var t,i,s=null===(t=xT[MT])||void 0===t?void 0:t.version;if(s&&NT(s))return null===(i=xT[MT])||void 0===i?void 0:i[e]}function jT(e,t){t.debug("@opentelemetry/api: Unregistering a global for "+e+" v"+RT+".");var i=xT[MT];i&&delete i[e]}var UT,BT=function(){function e(e){this._namespace=e.namespace||"DiagComponentLogger"}return e.prototype.debug=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return FT("debug",this._namespace,e)},e.prototype.error=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return FT("error",this._namespace,e)},e.prototype.info=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return FT("info",this._namespace,e)},e.prototype.warn=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return FT("warn",this._namespace,e)},e.prototype.verbose=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return FT("verbose",this._namespace,e)},e}();function FT(e,t,i){var s=HT("diag");if(s)return i.unshift(t),s[e].apply(s,function(e,t,i){if(i||2===arguments.length)for(var s,r=0,n=t.length;r<n;r++)!s&&r in t||(s||(s=Array.prototype.slice.call(t,0,r)),s[r]=t[r]);return e.concat(s||Array.prototype.slice.call(t))}([],function(e,t){var i="function"==typeof Symbol&&e[Symbol.iterator];if(!i)return e;var s,r,n=i.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(s=n.next()).done;)o.push(s.value)}catch(e){r={error:e}}finally{try{s&&!s.done&&(i=n.return)&&i.call(n)}finally{if(r)throw r.error}}return o}(i),!1))}!function(e){e[e.NONE=0]="NONE",e[e.ERROR=30]="ERROR",e[e.WARN=50]="WARN",e[e.INFO=60]="INFO",e[e.DEBUG=70]="DEBUG",e[e.VERBOSE=80]="VERBOSE",e[e.ALL=9999]="ALL"}(UT||(UT={}));var VT=function(){function e(){function e(e){return function(){for(var t=[],i=0;i<arguments.length;i++)t[i]=arguments[i];var s=HT("diag");if(s)return s[e].apply(s,function(e,t,i){if(i||2===arguments.length)for(var s,r=0,n=t.length;r<n;r++)!s&&r in t||(s||(s=Array.prototype.slice.call(t,0,r)),s[r]=t[r]);return e.concat(s||Array.prototype.slice.call(t))}([],function(e,t){var i="function"==typeof Symbol&&e[Symbol.iterator];if(!i)return e;var s,r,n=i.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(s=n.next()).done;)o.push(s.value)}catch(e){r={error:e}}finally{try{s&&!s.done&&(i=n.return)&&i.call(n)}finally{if(r)throw r.error}}return o}(t),!1))}}var t=this;t.setLogger=function(e,i){var s,r,n;if(void 0===i&&(i={logLevel:UT.INFO}),e===t){var o=new Error("Cannot use diag as the logger for itself. Please use a DiagLogger implementation like ConsoleDiagLogger or a custom implementation");return t.error(null!==(s=o.stack)&&void 0!==s?s:o.message),!1}"number"==typeof i&&(i={logLevel:i});var a=HT("diag"),c=function(e,t){function i(i,s){var r=t[i];return"function"==typeof r&&e>=s?r.bind(t):function(){}}return e<UT.NONE?e=UT.NONE:e>UT.ALL&&(e=UT.ALL),t=t||{},{error:i("error",UT.ERROR),warn:i("warn",UT.WARN),info:i("info",UT.INFO),debug:i("debug",UT.DEBUG),verbose:i("verbose",UT.VERBOSE)}}(null!==(r=i.logLevel)&&void 0!==r?r:UT.INFO,e);if(a&&!i.suppressOverrideMessage){var l=null!==(n=(new Error).stack)&&void 0!==n?n:"<failed to generate stacktrace>";a.warn("Current logger will be overwritten from "+l),c.warn("Current logger will overwrite one already registered from "+l)}return kT("diag",c,t,!0)},t.disable=function(){jT("diag",t)},t.createComponentLogger=function(e){return new BT(e)},t.verbose=e("verbose"),t.debug=e("debug"),t.info=e("info"),t.warn=e("warn"),t.error=e("error")}return e.instance=function(){return this._instance||(this._instance=new e),this._instance},e}(),KT=function(){function e(e){this._entries=e?new Map(e):new Map}return e.prototype.getEntry=function(e){var t=this._entries.get(e);if(t)return Object.assign({},t)},e.prototype.getAllEntries=function(){return Array.from(this._entries.entries()).map((function(e){var t=function(e,t){var i="function"==typeof Symbol&&e[Symbol.iterator];if(!i)return e;var s,r,n=i.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(s=n.next()).done;)o.push(s.value)}catch(e){r={error:e}}finally{try{s&&!s.done&&(i=n.return)&&i.call(n)}finally{if(r)throw r.error}}return o}(e,2);return[t[0],t[1]]}))},e.prototype.setEntry=function(t,i){var s=new e(this._entries);return s._entries.set(t,i),s},e.prototype.removeEntry=function(t){var i=new e(this._entries);return i._entries.delete(t),i},e.prototype.removeEntries=function(){for(var t,i,s=[],r=0;r<arguments.length;r++)s[r]=arguments[r];var n=new e(this._entries);try{for(var o=function(e){var t="function"==typeof Symbol&&Symbol.iterator,i=t&&e[t],s=0;if(i)return i.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&s>=e.length&&(e=void 0),{value:e&&e[s++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}(s),a=o.next();!a.done;a=o.next()){var c=a.value;n._entries.delete(c)}}catch(e){t={error:e}}finally{try{a&&!a.done&&(i=o.return)&&i.call(o)}finally{if(t)throw t.error}}return n},e.prototype.clear=function(){return new e},e}();function GT(e){return void 0===e&&(e={}),new KT(new Map(Object.entries(e)))}function $T(e){return Symbol.for(e)}VT.instance();var WT,zT=new function e(t){var i=this;i._currentContext=t?new Map(t):new Map,i.getValue=function(e){return i._currentContext.get(e)},i.setValue=function(t,s){var r=new e(i._currentContext);return r._currentContext.set(t,s),r},i.deleteValue=function(t){var s=new e(i._currentContext);return s._currentContext.delete(t),s}},qT=function(){var e=function(t,i){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])},e(t,i)};return function(t,i){if("function"!=typeof i&&null!==i)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");function s(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(s.prototype=i.prototype,new s)}}(),YT=function(){function e(){}return e.prototype.createHistogram=function(e,t){return oS},e.prototype.createCounter=function(e,t){return nS},e.prototype.createUpDownCounter=function(e,t){return aS},e.prototype.createObservableGauge=function(e,t){return lS},e.prototype.createObservableCounter=function(e,t){return cS},e.prototype.createObservableUpDownCounter=function(e,t){return dS},e.prototype.addBatchObservableCallback=function(e,t){},e.prototype.removeBatchObservableCallback=function(e){},e}(),QT=function(){},JT=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return qT(t,e),t.prototype.add=function(e,t){},t}(QT),XT=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return qT(t,e),t.prototype.add=function(e,t){},t}(QT),ZT=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return qT(t,e),t.prototype.record=function(e,t){},t}(QT),eS=function(){function e(){}return e.prototype.addCallback=function(e){},e.prototype.removeCallback=function(e){},e}(),tS=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return qT(t,e),t}(eS),iS=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return qT(t,e),t}(eS),sS=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return qT(t,e),t}(eS),rS=new YT,nS=new JT,oS=new ZT,aS=new XT,cS=new tS,lS=new iS,dS=new sS,uS={get:function(e,t){if(null!=e)return e[t]},keys:function(e){return null==e?[]:Object.keys(e)}},hS={set:function(e,t,i){null!=e&&(e[t]=i)}},pS=function(){function e(){}return e.prototype.active=function(){return zT},e.prototype.with=function(e,t,i){for(var s=[],r=3;r<arguments.length;r++)s[r-3]=arguments[r];return t.call.apply(t,function(e,t,i){if(i||2===arguments.length)for(var s,r=0,n=t.length;r<n;r++)!s&&r in t||(s||(s=Array.prototype.slice.call(t,0,r)),s[r]=t[r]);return e.concat(s||Array.prototype.slice.call(t))}([i],function(e,t){var i="function"==typeof Symbol&&e[Symbol.iterator];if(!i)return e;var s,r,n=i.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(s=n.next()).done;)o.push(s.value)}catch(e){r={error:e}}finally{try{s&&!s.done&&(i=n.return)&&i.call(n)}finally{if(r)throw r.error}}return o}(s),!1))},e.prototype.bind=function(e,t){return t},e.prototype.enable=function(){return this},e.prototype.disable=function(){return this},e}(),_S="context",mS=new pS,fS=function(){function e(){}return e.getInstance=function(){return this._instance||(this._instance=new e),this._instance},e.prototype.setGlobalContextManager=function(e){return kT(_S,e,VT.instance())},e.prototype.active=function(){return this._getContextManager().active()},e.prototype.with=function(e,t,i){for(var s,r=[],n=3;n<arguments.length;n++)r[n-3]=arguments[n];return(s=this._getContextManager()).with.apply(s,function(e,t,i){if(i||2===arguments.length)for(var s,r=0,n=t.length;r<n;r++)!s&&r in t||(s||(s=Array.prototype.slice.call(t,0,r)),s[r]=t[r]);return e.concat(s||Array.prototype.slice.call(t))}([e,t,i],function(e,t){var i="function"==typeof Symbol&&e[Symbol.iterator];if(!i)return e;var s,r,n=i.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(s=n.next()).done;)o.push(s.value)}catch(e){r={error:e}}finally{try{s&&!s.done&&(i=n.return)&&i.call(n)}finally{if(r)throw r.error}}return o}(r),!1))},e.prototype.bind=function(e,t){return this._getContextManager().bind(e,t)},e.prototype._getContextManager=function(){return HT(_S)||mS},e.prototype.disable=function(){this._getContextManager().disable(),jT(_S,VT.instance())},e}();!function(e){e[e.NONE=0]="NONE",e[e.SAMPLED=1]="SAMPLED"}(WT||(WT={}));var gS="0000000000000000",yS="00000000000000000000000000000000",vS={traceId:yS,spanId:gS,traceFlags:WT.NONE},OS=function(){function e(e){void 0===e&&(e=vS),this._spanContext=e}return e.prototype.spanContext=function(){return this._spanContext},e.prototype.setAttribute=function(e,t){return this},e.prototype.setAttributes=function(e){return this},e.prototype.addEvent=function(e,t){return this},e.prototype.setStatus=function(e){return this},e.prototype.updateName=function(e){return this},e.prototype.end=function(e){},e.prototype.isRecording=function(){return!1},e.prototype.recordException=function(e,t){},e}(),bS=$T("OpenTelemetry Context Key SPAN");function IS(e){return e.getValue(bS)||void 0}function ES(){return IS(fS.getInstance().active())}function TS(e,t){return e.setValue(bS,t)}function SS(e){return e.deleteValue(bS)}function AS(e,t){return TS(e,new OS(t))}function PS(e){var t;return null===(t=IS(e))||void 0===t?void 0:t.spanContext()}var wS=/^([0-9a-f]{32})$/i,CS=/^[0-9a-f]{16}$/i;function RS(e){return i=e.traceId,wS.test(i)&&i!==yS&&(t=e.spanId,CS.test(t)&&t!==gS);var t,i}function LS(e){return new OS(e)}var NS=fS.getInstance(),DS=function(){function e(){}return e.prototype.startSpan=function(e,t,i){if(void 0===i&&(i=NS.active()),Boolean(null==t?void 0:t.root))return new OS;var s,r=i&&PS(i);return"object"==typeof(s=r)&&"string"==typeof s.spanId&&"string"==typeof s.traceId&&"number"==typeof s.traceFlags&&RS(r)?new OS(r):new OS},e.prototype.startActiveSpan=function(e,t,i,s){var r,n,o;if(!(arguments.length<2)){2===arguments.length?o=t:3===arguments.length?(r=t,o=i):(r=t,n=i,o=s);var a=null!=n?n:NS.active(),c=this.startSpan(e,r,a),l=TS(a,c);return NS.with(l,o,void 0,c)}},e}(),MS=new DS,xS=function(){function e(e,t,i,s){this._provider=e,this.name=t,this.version=i,this.options=s}return e.prototype.startSpan=function(e,t,i){return this._getTracer().startSpan(e,t,i)},e.prototype.startActiveSpan=function(e,t,i,s){var r=this._getTracer();return Reflect.apply(r.startActiveSpan,r,arguments)},e.prototype._getTracer=function(){if(this._delegate)return this._delegate;var e=this._provider.getDelegateTracer(this.name,this.version,this.options);return e?(this._delegate=e,this._delegate):MS},e}(),kS=new(function(){function e(){}return e.prototype.getTracer=function(e,t,i){return new DS},e}()),HS=function(){function e(){}return e.prototype.getTracer=function(e,t,i){var s;return null!==(s=this.getDelegateTracer(e,t,i))&&void 0!==s?s:new xS(this,e,t,i)},e.prototype.getDelegate=function(){var e;return null!==(e=this._delegate)&&void 0!==e?e:kS},e.prototype.setDelegate=function(e){this._delegate=e},e.prototype.getDelegateTracer=function(e,t,i){var s;return null===(s=this._delegate)||void 0===s?void 0:s.getTracer(e,t,i)},e}(),jS=fS.getInstance(),US=VT.instance(),BS=new(function(){function e(){}return e.prototype.getMeter=function(e,t,i){return rS},e}()),FS="metrics",VS=function(){function e(){}return e.getInstance=function(){return this._instance||(this._instance=new e),this._instance},e.prototype.setGlobalMeterProvider=function(e){return kT(FS,e,VT.instance())},e.prototype.getMeterProvider=function(){return HT(FS)||BS},e.prototype.getMeter=function(e,t,i){return this.getMeterProvider().getMeter(e,t,i)},e.prototype.disable=function(){jT(FS,VT.instance())},e}(),KS=VS.getInstance(),GS=function(){function e(){}return e.prototype.inject=function(e,t){},e.prototype.extract=function(e,t){return e},e.prototype.fields=function(){return[]},e}(),$S=$T("OpenTelemetry Baggage Key");function WS(e){return e.getValue($S)||void 0}function zS(){return WS(fS.getInstance().active())}function qS(e,t){return e.setValue($S,t)}function YS(e){return e.deleteValue($S)}var QS="propagation",JS=new GS,XS=function(){function e(){this.createBaggage=GT,this.getBaggage=WS,this.getActiveBaggage=zS,this.setBaggage=qS,this.deleteBaggage=YS}return e.getInstance=function(){return this._instance||(this._instance=new e),this._instance},e.prototype.setGlobalPropagator=function(e){return kT(QS,e,VT.instance())},e.prototype.inject=function(e,t,i){return void 0===i&&(i=hS),this._getGlobalPropagator().inject(e,t,i)},e.prototype.extract=function(e,t,i){return void 0===i&&(i=uS),this._getGlobalPropagator().extract(e,t,i)},e.prototype.fields=function(){return this._getGlobalPropagator().fields()},e.prototype.disable=function(){jT(QS,VT.instance())},e.prototype._getGlobalPropagator=function(){return HT(QS)||JS},e}(),ZS=XS.getInstance(),eA="trace",tA=function(){function e(){this._proxyTracerProvider=new HS,this.wrapSpanContext=LS,this.isSpanContextValid=RS,this.deleteSpan=SS,this.getSpan=IS,this.getActiveSpan=ES,this.getSpanContext=PS,this.setSpan=TS,this.setSpanContext=AS}return e.getInstance=function(){return this._instance||(this._instance=new e),this._instance},e.prototype.setGlobalTracerProvider=function(e){var t=kT(eA,this._proxyTracerProvider,VT.instance());return t&&this._proxyTracerProvider.setDelegate(e),t},e.prototype.getTracerProvider=function(){return HT(eA)||this._proxyTracerProvider},e.prototype.getTracer=function(e,t){return this.getTracerProvider().getTracer(e,t)},e.prototype.disable=function(){jT(eA,VT.instance()),this._proxyTracerProvider=new HS},e}(),iA={context:jS,diag:US,metrics:KS,propagation:ZS,trace:tA.getInstance()};function sA(e){return function(t){t.traceableAs=()=>e}}function rA(e,t,i){var s;let r;"function"==typeof e&&(null===(s=e.prototype)||void 0===s?void 0:s.constructor)?r=e.prototype.constructor:"object"==typeof e&&e.constructor&&(r=e.constructor);const n=i.value;return i.value=function(...e){let i=t;if(r){let e;"function"==typeof r.traceableAs?e=r.traceableAs():(tn("Class name not provided",`Use the traceableAs decorator on the class of ${i} to ensure the class name does not get minified`),e=r.name),i=e+"."+i}const s=iA.trace.getTracer("sam-js").startSpan(i),o=iA.trace.setSpan(iA.context.active(),s);try{const t=iA.context.with(o,n,this,...e);return t&&"function"==typeof t.then?t.catch((e=>{throw e instanceof Error&&s.recordException(e),e})).finally((()=>{s.end()})):(s.end(),t)}catch(e){throw e instanceof Error&&s.recordException(e),s.end(),e}},i}let nA=class{constructor(e,t){this._core=e,this._assetPool=t,this._assignmentInterface=new gT(this._core),this._classroomsInterface=new lT(this._core),this._studentAssignmentsInterface=new ou(this._core),this._studentAssignmentFileUpdater=hp,this._studentAssignmentUpdater=bT,this._assignmentUpdater=AT,this._classroomPool=new Xo(this._core,"classroom"),this._classroomMemberPool=new Xo(this._core,"classroomMember"),this._core.getBoardContext().then((e=>{this._boardContext=e}))}_ensureBoardContext(){if(!this._boardContext)throw new Error("Board context not initialized");return this._boardContext}async getClassroomById(e){Fa(e,"id");const t=this._classroomsInterface,i=this._classroomPool;let s=i.getLocalItemById(e);if(!s){const r=await t.getClassroom(e),n=i.createUpdateSession();s=pT.updateRemoteItem(n,this._processRemoteClassroomItem(e,r)),n.commit()}return s}async getClassroomByCode(e){Fa(e,"classCode");return this._classroomPool.toArray().find((t=>t.code===e))||this.getClassroomById(e)}getClassrooms(){return new Uo(this._classroomPool,[new _T(this._classroomPool,this._classroomsInterface)])}async getClassroomByAssetId(e){const t=this.getClassrooms().getList(Gh.default,void 0,{loadAllPages:!0});return await Mo(t),t.items.find((t=>t.assetId===e))}async getClassroomByBoardId(e){const t=await this._ensureBoardContext()._getBoard(e);return this.getClassroomByAssetId(t._idOfBaseAsset)}getClassroomMembers(){return new Uo(this._classroomMemberPool,[new dT(this._classroomMemberPool,this._classroomsInterface)])}getAssignments(){const e=new PT(this._assignmentInterface,this._core);return new Uo(this._assetPool,[e])}_getStudentAssignmentsSource(e){const t=new wT(this._studentAssignmentsInterface,this._core);return new Uo(this._assetPool,[t],e)}getStudentAssignments(e){return this._getStudentAssignmentsSource(new ET(e))}cleanAssignmentName(e){return e.trimEnd()}async createClassroom(e){var t;const i=function(e){const t=[],i=[{key:"subject",type:"enum",isRequired:!1,ref:Mh},{key:"grades",type:"string[]",isRequired:!1},{key:"period",type:"string",isRequired:!1},{key:"teachers",type:"string[]",isRequired:!1}];t.push(...Ka(i,e));const s="string"==typeof e.name&&null!==e.name,r="string"==typeof e.id&&null!==e.id;return s||r||t.push("name or id is missing"),t}(e);if(i.length>0)throw We.create(Be.BAD_REQUEST,JSON.stringify(i));let s;if(e.id)s=await this._classroomsInterface.createClassroomFromVirtual(e.id),s.virtualId=e.id;else{const i=(null===(t=e.name)||void 0===t?void 0:t.trim())||"";if(!Tr(i))throw We.create(Be.BAD_REQUEST,"Invalid class name provided for the creation operation.");s=await this._classroomsInterface.createClassroom(Object.assign(Object.assign({},e),{name:i}))}const r=this._classroomPool.createMutationSession(),n=pT.updateRemoteItem(r,s);return r.commit(),n}async createAssignment(e){const t=function(e){var t,i,s,r,n,o,a,c,l;const d=[],u=[{key:"classroomId",type:"string",isRequired:!0},{key:"createdBy",type:"string",isRequired:!1},{key:"dueDate",type:"date",isRequired:!1},{key:"externalTemplateIds",type:"string[]",isRequired:!1},{key:"instructions",type:"string",isRequired:!1},{key:"name",type:"string",isRequired:!0},{key:"status",type:"enum",isRequired:!1,ref:Jh},{key:"tasks",type:"string[]",isRequired:!1},{key:"templateIds",type:"string[]",isRequired:!1}];d.push(...Ka(u,e)),null===(t=e.references)||void 0===t||t.forEach(((e,t)=>{"object"==typeof e?(Va(e.content,"string",!0)||Va(e.content,"blob",!0)||d.push(`references[${t}].content is not a string, Blob, or is missing`),Va(e.name,"string",!0)||d.push(`references[${t}].name is not a string or is missing`)):"string"!=typeof e&&d.push(`references[${t}] is not an string or ExternalAsset`)})),e.externalTutorials&&(Array.isArray(e.externalTutorials)?e.externalTutorials.forEach(((e,t)=>{(function(e){return Ka([{key:"surfaces",type:"object",isRequired:!0},{key:"aem_id",type:"string",isRequired:!0},{key:"metadata",type:"object",isRequired:!1}],e)})(e).forEach((e=>{d.push(`externalTutorials[${t}]: ${e}`)}))})):d.push("externalTutorials is not an array"));const h=(null!==(s=null===(i=e.tasks)||void 0===i?void 0:i.length)&&void 0!==s?s:0)>0,p=(null!==(n=null===(r=e.templateIds)||void 0===r?void 0:r.length)&&void 0!==n?n:0)>0,_=(null!==(a=null===(o=e.externalTutorials)||void 0===o?void 0:o.length)&&void 0!==a?a:0)>0,m=(null!==(l=null===(c=e.externalTemplateIds)||void 0===c?void 0:c.length)&&void 0!==l?l:0)>0;return e.status===Jh.DRAFT||h||p||_||m||d.push("Assigned Assignment must have tasks, templates, externalTemplateIds, or tutorials"),d}(e);if(t.length>0)throw We.create(Be.BAD_REQUEST,JSON.stringify(t));const i=this.cleanAssignmentName(e.name);if(!Tr(i))throw We.create(Be.BAD_REQUEST,"Invalid name provided for the creation operation.");let s=e.classroomId;const r=this._classroomPool.toArray().find((t=>t._virtualId===e.classroomId));if(r)s=r.id;else{const t=await this.getClassroomById(e.classroomId);if(t.isVirtual&&(s=(await this.createClassroom({id:t.id})).id,s===e.classroomId))throw We.create(Be.BAD_REQUEST,"Cannot create an assignment with a virtual classroom.")}const{templateIds:n,references:o}=e,a=qe(e,["templateIds","references"]);a.name=i;const c=null!=n?n:[],l=null!=o?o:[],d=c.length+l.length>0,u=a.status||Jh.DRAFT;let h=this._findAssignment(s,i);const p=!!h;if(!h){Pl(a,"status")&&!d||(a.status=Jh.DRAFT);const e=await this._assignmentInterface.createAssignment(Object.assign(Object.assign({},a),{classroomId:s})),t=this._assetPool.createMutationSession();h=AT.updateRemoteItem(t,e),t.commit()}const _={};if(c.length>0&&(_.templateIds=c),l.length>0&&(_.references=l),d||p)try{await this.updateAssignment(h.id,Object.assign(Object.assign(Object.assign({},_),p?Object.assign(Object.assign({},a),{name:void 0}):{}),{status:u}))}catch(e){throw We.wrapErrorIfNeeded(Be.INTERNAL_ERROR,"Error updating assignment materials",e)}return h}_findAssignment(e,t){return this._assetPool.toArray().find((i=>i instanceof ST&&i.classroomId===e&&i.name===t))}async getAssignmentByID(e,t,i){Fa(e,"id"),i&&Fa(i,"classroomId");let s=this._assetPool.getLocalItemById(e);if(s)return s;const r=await this.validateStudentAssignmentsFilter(t,i),n=await this._assignmentInterface.getAssignment(e,r),o=this._assetPool.createMutationSession();return s=AT.updateRemoteItem(o,n),o.commit(),s}async getAssignmentByCode(e,t,i){Fa(e,"code"),i&&Fa(i,"classroomId");let s=this._assetPool.toArray().find((t=>t.code===e));if(s)return s;const r=await this.validateStudentAssignmentsFilter(t,i),n=await this._assignmentInterface.getAssignmentByCode(e,r),o=this._assetPool.createMutationSession();return s=AT.updateRemoteItem(o,n),o.commit(),s}async getStudentAssignmentById(e,t){var i;const s=this._assetPool.getLocalItemById(e);if(s)return s;const r=await this._studentAssignmentsInterface.getStudentAssignment(e,t),n=this._assetPool.createMutationSession(),o=bT.updateRemoteItem(n,r);return o._hasLoadedChildren=null!==(i=null==t?void 0:t.loadDocuments)&&void 0!==i&&i,n.commit(),o}async _discardAssignment(e){await e.discard()}async _restoreAssignment(e){await e.restore()}_computeRemoteStudentAssignmentFiles({assignmentId:e,classroomId:t,remoteStudentAssignmentFiles:i,studentAssignmentId:s}){return[...i].map((i=>{if(i.computedStudentAssignmentId=s,i.computedAssignmentId=e,t){if(!t.startsWith("urn"))throw We.create(Be.BAD_REQUEST,`The classroomId provided, ${t}, is NOT an asset ID`);i.computedClassroomAssetId=t}return i}))}_updateStudentAssignmentFilesCache({assignmentId:e,classroomId:t,remoteStudentAssignmentFiles:i,session:s,studentAssignmentId:r}){const n=this._computeRemoteStudentAssignmentFiles({remoteStudentAssignmentFiles:i,assignmentId:e,classroomId:t,studentAssignmentId:r}),o=hp.updateRemoteItems(s,n);return s.commit(),o}async _returnAssignment(e){const t=await this._studentAssignmentsInterface.return(e),i=this._assetPool.createMutationSession(),s=bT.updateRemoteItem(i,t);return i.commit(),s}async _startAssignment(e){const t=await this._studentAssignmentsInterface.start(e),i=this._assetPool.createMutationSession(),s=bT.updateRemoteItem(i,t);return i.commit(),s}async submitAssignment(e){const{assignmentId:t,status:i,studentAssignmentId:s,submissionId:r}=e,n=Fa(t,"assignmentId",!1),o=n&&void 0===s||Fa(s,"studentAssignmentId",!1);if(!n&&!o)throw We.create(Be.BAD_REQUEST,"Either studentAssignmentId or assignmentId is required to submit an assignment");if(!n&&i===tu.NOT_STARTED)throw We.create(Be.BAD_REQUEST,"assignmentId is required when the assignment has not been started");if(!s&&i&&i!==tu.NOT_STARTED)throw We.create(Be.BAD_REQUEST,"studentAssignmentId is required once the assignment has been started");let a;if(i&&i===tu.NOT_STARTED)a=await this._startAssignment({assignmentId:t,links:e.links});else if(s)a=await this.getStudentAssignmentById(s);else if(a=(await this.getAssignmentByID(t,Zh.SELF)).studentAssignments[0],a.status===tu.NOT_STARTED)throw We.create(Be.BAD_REQUEST,"studentAssignmentId is required once the assignment has been started");const c=await this._core.hostAssetContext.getAssetWithCloudID(r);if(await this._isFloating(a,c)){if(!c.hasPermission(Gi.Move)||!c.hasPermission(Gi.Write))throw We.create(Be.BAD_REQUEST,`Current user does not have permission to move and / or submit this asset: ${c.id}`);let e,i;try{i=c.repoPath.substring(0,c.repoPath.lastIndexOf("/")),e=await this._core.hostAssetContext.getAssetWithRepoPath(i,c.repositoryID)}catch(e){throw We.create(Be.BAD_REQUEST,`Unable to fetch the parent asset of the file being submitted using the path ${i}: ${e}`)}if(!e.hasPermission(Gi.Write))throw We.create(Be.BAD_REQUEST,`Current user is trying to submit an assignment from a folder that they do not have write permission on -- directory ID: ${e.id}`);const s=this._getFormattedCreatedDateHelper({includeFormattedDate:!1,date:new Date}),r=await this.getAssignmentByID(t),n=`${a.student.displayName} ${r.name} ${s}.${c.extension}`;await c.move(a,n)}const{studentDirectoryId:l}=a,d=await this._studentAssignmentsInterface.submit({links:a.links,studentAssignmentId:l,submissionId:r}),u=this._assetPool.createMutationSession();return bT.updateRemoteItem(u,d),u.commit(),d}async _isFloating(e,t){var i;if(t.isChildOfStudentAssignment){if(t.parentStudentAssignmentId!==e.id)throw We.create(Be.BAD_REQUEST,`Submitted asset is already in a different assignment directory and has been submitted to another assignment -- directory ID: ${t.parentStudentAssignmentId}, attempted to turn in to: ${e.id}`);return!1}try{const s=null===(i=e.children)||void 0===i?void 0:i.getList(Gn.default);if(s)return await Mo(s),!s.items.some((e=>e.id===t.id))}catch(e){throw We.create(Be.BAD_REQUEST,`Error waiting for list load in floating file check: ${e}`)}return!0}async updateStudentAssignmentFile(e,t){var i,s,r,n,o,a;const c=t.sourceAsset||t.sourceTasks||t.sourceTutorials,l=t.sourceAssets||t["assignment:sourceAssets"]||t["assignment:sourceTasks"]||t["assignment:sourceTutorials"];if(c&&l)throw We.create(Be.INTERNAL_ERROR,"Do not use the deprecated interface.");const d=[{op:"add",path:"/assignment:sourceAssets",value:null!==(s=null!==(i=t.sourceAssets)&&void 0!==i?i:t["assignment:sourceAssets"])&&void 0!==s?s:[]},{op:"add",path:"/assignment:sourceTasks",value:null!==(n=null!==(r=t.sourceTasks)&&void 0!==r?r:t["assignment:sourceTasks"])&&void 0!==n?n:[]},{op:"add",path:"/assignment:sourceTutorials",value:null!==(a=null!==(o=t.sourceTutorials)&&void 0!==o?o:t["assignment:sourceTutorials"])&&void 0!==a?a:[]}];t.sourceAsset&&d.push({op:"add",path:"/assignment:sourceAsset",value:t.sourceAsset});const u="string"==typeof e?await this._core.hostAssetContext.getAssetWithCloudID(e):e;return await u.patchAppMetadata(d),u}async validateAssignmentNameForCreate(e,t){await this._validateAssignmentName(e,t)}async validateStudentAssignmentsFilter(e,t){if(e&&e===Zh.ANY){if(!t)throw We.create(Be.BAD_REQUEST,"Cannot fetch specified assignment submission type without classroomId");if((await this.getClassroomMembership(t)).role===Bh.STUDENT)throw We.create(Be.BAD_REQUEST,'Student role cannot request assignment submission type "ANY"')}return e}async validateAssignmentNameForUpdate(e,t,i){await this._validateAssignmentName(e,t,i)}async _validateAssignmentName(e,t,i){const s=e.trim();if(0===s.length)throw We.create(Be.BAD_REQUEST,"The assignment name cannot be blank.");if(!Tr(s))throw We.create(Be.BAD_REQUEST,"The assignment name is an invalid platform repo name.");if(s.endsWith("."))throw We.create(Be.BAD_REQUEST,"The assignment name cannot end with a period.");if(!t)return;if((await this.getClassroomById(t)).isVirtual)return;const r=this.getAssignments().getList(await this.getAssignmentOrder(),await this.getAssignmentFilter({classroomId:t}),{});await Mo(r);const n=this._core._environment.getValue("LOCALE"),o=r.items.find((e=>e.name.toLocaleLowerCase(n)===s.toLocaleLowerCase(n)));if(o&&(!i||o.id!==i))throw We.create(Be.CONFLICT,"The assignment name must be unique within the classroom.")}async _renameAssignment(e,t){const i=await this.getAssignmentByID(e);try{return i.repositoryID||await i._load(),i.rename(t)}catch(t){if(t instanceof We)throw t;throw We.create(Be.INTERNAL_ERROR,`Could not rename asset "${e}"`)}}async updateAssignment(e,t){Fa(e,"assignmentId");const{references:i,status:s,templateIds:r}=t,n=qe(t,["references","status","templateIds"]),o=await this._getUpdatedAssignmentMaterials(e,t),a=n;o.shouldUpdateTemplates&&(a.templateIds=o.updatedTemplateIds),o.shouldUpdateReferences&&(a.referenceIds=o.updatedReferenceIds);const c=[];Boolean(t.name)&&(a.name=this.cleanAssignmentName(t.name),c.push(this._renameAssignment(e,a.name))),s===Jh.ASSIGNED&&(a.status=s),c.push(this._updateAssignmentMetadata(e,a)),await Promise.all(c),this._discardAssets(o.assetsToDiscard)}async _updateAssignmentMetadata(e,t){if(0===Object.keys(t).length)return;const i=Object.entries(Xh).reduce(((e,[i,s])=>{if(Pl(t,i)){const r=t[i];r instanceof Date?e[s]=r.toISOString():e[s]="dueDate"!==i||r?r:""}return e}),{"repo:assetId":e}),s=this._getUpdateAssignmentOps(i);if(0!==s.length){const t=await this._assignmentInterface.patchAssignment(e,s),i=this._assetPool.createMutationSession();AT.updateRemoteItem(i,t),i.commit()}}async _getAssignmentMaterialsFolderAsset(e){const t=await this.getAssignmentByID(e),i=`${t.repoPath}/materials`,s=await this._core.hostAssetContext.getAssetWithRepoPath(i,t.repositoryID);if(!s)throw We.create(Be.BAD_REQUEST,`Could not find materials folder with path of "${i}"`);return s}async _getAssets(e){return(await Promise.allSettled(e.map((e=>this._core.hostAssetContext.getAssetWithCloudID(e))))).map(((t,i)=>{if("fulfilled"===t.status)return t.value;throw We.wrapErrorIfNeeded(Be.INTERNAL_ERROR,`Failed to get asset with ID of "${e[i]}"`,t.reason)}))}async _discardAssets(e){if(0===e.length)return;const t=await this._getAssets(e);await Promise.allSettled(t.map((e=>e.discard())))}_getUpdateAssignmentOps(e){const t=Object.entries(e).filter((([e])=>e.startsWith("assignment:"))).map((([e,t])=>({op:"replace",path:`/${e}`,value:t})));return t}async _copyAssetsToMaterialsFolder(e,t){if(0===t.length)return[];const i=await this.getAssignmentByID(e),s=(await this._getAssets(t)).map(((e,t)=>{const s=e.extension?`.${e.extension}`:"";return e._copyWithDestMetadata(i.repositoryID,`${i.repoPath}/materials`,`${i.name} ${this._getFormattedCreatedDateHelper({includeFormattedDate:!0,date:new Date})} ${t}${s}`)})),r=(await Promise.allSettled(s)).map(((e,i)=>{if("fulfilled"===e.status)return e.value;throw We.wrapErrorIfNeeded(Be.INTERNAL_ERROR,`Failed to copy asset with ID of "${t[i]}"`,e.reason)}));return r.map((e=>e.id))}_getFormattedCreatedDateHelper({includeFormattedDate:e,date:t}){const i=this._core._environment.getValue("LOCALE"),s=e?{year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric",fractionalSecondDigits:3,hourCycle:"h24"}:{hour:"numeric",minute:"numeric",second:"numeric"};return new Intl.DateTimeFormat(i,s).format(t).replace(/[/:]/g,".")}async _determineAssetDifferences(e,t,i){const s=await this.getAssignmentByID(e);if(!i)return{assetsToCopy:[],assetsToKeep:[],assetsToDiscard:s[t]};const r=s[t].filter((e=>!i.includes(e)));return{assetsToCopy:i.filter((e=>!s[t].includes(e))),assetsToKeep:s[t].filter((e=>i.includes(e))),assetsToDiscard:r}}async _getUpdatedAssignmentMaterials(e,t){var i,s;const r=Pl(t,"templateIds"),n=Pl(t,"references"),o={assetsToDiscard:[],shouldUpdateReferences:n,shouldUpdateTemplates:r,updatedReferenceIds:[],updatedTemplateIds:[]},a=[];let c=0;const l=[];if(r){const i=await this._determineAssetDifferences(e,"templateIds",t.templateIds);o.assetsToDiscard.push(...i.assetsToDiscard),a.push(...i.assetsToCopy),o.updatedTemplateIds.push(...i.assetsToKeep),c=a.length}if(n){const{referenceIds:r,referencesToImport:n}=null!==(s=null===(i=t.references)||void 0===i?void 0:i.reduce(((e,t)=>("string"==typeof t?e.referenceIds.push(t):e.referencesToImport.push(t),e)),{referenceIds:[],referencesToImport:[]}))&&void 0!==s?s:{referenceIds:[],referencesToImport:[]},c=await this._determineAssetDifferences(e,"referenceIds",r);o.assetsToDiscard.push(...c.assetsToDiscard),a.push(...c.assetsToCopy),o.updatedReferenceIds.push(...c.assetsToKeep),n.length>0&&l.push((async()=>{const t=[];(await this.importNewReferencesForAssignment(e,n)).forEach((e=>{if("fulfilled"!==e.status)throw We.create(Be.BAD_REQUEST,"Error importing reference asset",{underlyingError:e.reason});t.push(e.value.id)})),o.updatedReferenceIds.push(...t)}))}let d=[];l.push((async()=>{d=await this._copyAssetsToMaterialsFolder(e,a)})),await Promise.all(l.map((e=>e())));const[u,h]=[d.slice(0,c),d.slice(c)];return o.updatedTemplateIds.push(...u),o.updatedReferenceIds.push(...h),o}async importNewReferencesForAssignment(e,t){const i=await this._getAssignmentMaterialsFolderAsset(e);return Promise.allSettled(t.map((async e=>i.importFile(e.content,e.name,e.mediaType,!0,0,!1))))}async getStudentAssignmentFiles({studentDirectoryId:e,order:t}){Fa(e,"studentDirectoryId");const i=(await this._core.hostAssetContext.getAssetWithCloudID(e)).children.getList(t||Gn.default,new mp,{loadAllPages:!0});return await Mo(i),i.items}async refreshClassroomCodes(e){Fa(e,"classIds");const t=(await Promise.allSettled(e.map((e=>this._classroomsInterface.refreshClassroomCode(e))))).filter((e=>"fulfilled"===e.status)).map((e=>e.value)),i=(await Promise.allSettled(t.map((async({classroomId:e,classcode:t})=>{const i=await this._classroomsInterface.getClassroom(e);return i.classCode=t,i})))).filter((e=>"fulfilled"===e.status)).map((e=>e.value)),s=this._classroomPool.createMutationSession();pT.updateRemoteItems(s,i),s.commit()}async deleteClassrooms(e){if(Fa(e,"ids"),Array.isArray(e))await Promise.all(e.map((e=>this.deleteClassrooms(e))));else{const t=await this.getClassroomById(e);t.isVirtual?await this._classroomsInterface.deleteVirtualClassroom(e):await this._classroomsInterface.deleteClassroom(e);const i=this._classroomPool.createUpdateSession();i.queueDiscardedItem(t),i.commit(),this._classroomPool.removeLocalItems([t.id])}}async updateClassroom(e,t){var i;let s;Fa(e,"classroomId");const r=await this.getClassroomById(e);null!==(i=t.name)&&void 0!==i||(t.name=r.name),r.isVirtual?(s=await this._classroomsInterface.updateClassroomFromVirtual(r.id,t),s.virtualId=r.id):s=await this._classroomsInterface.updateClassroom(e,t);const n=this._classroomPool.createMutationSession();pT.updateRemoteItem(n,this._processRemoteClassroomItem(e,s)),n.commit()}_processRemoteClassroomItem(e,t){const i=this._classroomPool.getLocalItemById(e);return(null==i?void 0:i._virtualId)&&(t.virtualId=i._virtualId),t}async getClassroomMembership(e){return Fa(e,"classroomId"),this._classroomsInterface.getMembership(e)}async blockStudentFromClassroom(e,t){return Fa(e,"classroomId"),Fa(t,"studentId"),this._classroomsInterface.blockStudent(e,t)}async unblockStudentFromClassroom(e,t){return Fa(e,"classroomId"),Fa(t,"studentId"),this._classroomsInterface.unblockStudent(e,t)}async removeStudentFromClassroom(e,t){Fa(e,"classroomId"),Fa(t,"studentId");const i=await this._classroomsInterface.removeStudent(e,t);return this.removeUserFromPool(e,t),i}async removeTeacherFromClassroom(e,t){Fa(e,"classroomId"),Fa(t,"teacherId");const i=await this._classroomsInterface.removeTeacher(e,t);return this.removeUserFromPool(e,t),i}removeUserFromPool(e,t){const i=this._classroomMemberPool.getLocalItemById(Ga(e,t));if(i){const s=this._classroomMemberPool.createUpdateSession();s.queueDiscardedItem(i),s.commit(),this._classroomMemberPool.removeLocalItems([Ga(e,t)])}}getClassroomOrder(e="ascending",t="name"){return new Gh(e,t)}getAssignmentOrder(e="ascending",t="name"){return new sp(e,t)}getAssignmentFilter(e={}){return new rp(e)}getStudentAssignmentOrder(e="ascending",t="studentDisplayName"){return new lp(e,t)}getStudentAssignmentFilter(e){return new np(e)}getStudentAssignmentFileOrder(e="ascending",t="name"){return new _p(e,t)}getStudentAssignmentFileFilter(e,t){return new fp(e,t)}getClassroomMemberOrder(e="ascending",t="name"){return new qh(e,t)}getClassroomMemberFilter(e){return new Yh(e)}async checkCoTeacherEligibility(e){return this._classroomsInterface.checkCoTeacherEligibility(e)}async _getClassroomByIdOrCode(e){const{classroomCode:t,classroomId:i}=e;if(i)return this.getClassroomById(i);if(t)return this.getClassroomByCode(t);throw We.create(Be.BAD_REQUEST,"Either classroomCode or classroomId must be provided")}async _getAssignmentId(e){const{assignmentCode:t,assignmentId:i}=e;if(i)return i;if(t)return(await this.getAssignmentByCode(t)).id;throw We.create(Be.BAD_REQUEST,"Either assignmentCode or assignmentId must be provided")}async getClassroomBoards(e){const t=await this._getClassroomByIdOrCode(e);return this._ensureBoardContext().getBoards({baseAssetId:t.assetId})}async getAssignmentBoards(e){const t=await this._getAssignmentId(e);return this._ensureBoardContext().getBoards({baseAssetId:t})}async getAssignmentBoard(e){const t=(await this.getAssignmentBoards(e)).getList(jp.default,void 0,{loadAllPages:!0});if(await Mo(t),t.items.length>1)throw We.create(Be.BAD_REQUEST,`Expected 1 board, got ${t.items.length}`);return t.items[0]}async _getRealClassroomGivenClassroomIdOrCode({classroomId:e,classroomCode:t}){const i=e||"",s=this._classroomPool.toArray().find((e=>e._virtualId===i));if(s)return{classroom:s};{const s=e?{classroomId:e}:{classroomCode:t},r=await this._getClassroomByIdOrCode(s);if(r.isVirtual){const e=await this.createClassroom({id:r.id});if(i===e.id)throw We.create(Be.BAD_REQUEST,"Cannot create an asset with a virtual classroom.");return{classroom:e,isVirtualClassroomJustMigrated:!0}}return{classroom:r}}}async createClassroomBoard(e){const{classroomId:t,classroomCode:i}=e,s=qe(e,["classroomId","classroomCode"]),{classroom:r,isVirtualClassroomJustMigrated:n}=await this._getRealClassroomGivenClassroomIdOrCode({classroomId:t,classroomCode:i}),{id:o,assetId:a}=r;return this._ensureBoardContext().createBoard(Object.assign(Object.assign({},s),{baseAssetId:a,type:Op.CLASSROOM,additionalData:{classroomId:o},shouldCheckForDuplicateName:!n}))}async validateClassroomBoardNameForCreate(e){let t,i;const{classroomCode:s,classroomId:r}=e;if(s||r){const e=r?{classroomId:r}:{classroomCode:s};i=await this._getClassroomByIdOrCode(e),t=i.assetId}return this._ensureBoardContext().validateBoardNameForCreate({name:e.name,baseAssetId:t})}async validateClassroomBoardNameForUpdate(e){const{name:t,boardId:i}=e,s=await this._getClassroomByIdOrCode(e);return this._ensureBoardContext().validateBoardNameForUpdate({name:t,baseAssetId:s.assetId,boardId:i})}};Ye([Dt,wt,Qe(0,it)],nA.prototype,"getClassroomById",null),Ye([Dt,wt,Qe(0,it)],nA.prototype,"getClassroomByCode",null),Ye([nt],nA.prototype,"getClassrooms",null),Ye([Dt,wt,Qe(0,it)],nA.prototype,"getClassroomByAssetId",null),Ye([Dt,wt,Qe(0,it)],nA.prototype,"getClassroomByBoardId",null),Ye([nt],nA.prototype,"getClassroomMembers",null),Ye([nt],nA.prototype,"getAssignments",null),Ye([Dt,Rt,Qe(0,it)],nA.prototype,"getStudentAssignments",null),Ye([rA,Dt,wt],nA.prototype,"createClassroom",null),Ye([rA,Dt,wt],nA.prototype,"createAssignment",null),Ye([Dt,wt,Qe(0,it)],nA.prototype,"getAssignmentByID",null),Ye([Dt,wt,Qe(0,it)],nA.prototype,"getAssignmentByCode",null),Ye([Dt,wt,Qe(0,it)],nA.prototype,"getStudentAssignmentById",null),Ye([wt],nA.prototype,"_discardAssignment",null),Ye([wt],nA.prototype,"_restoreAssignment",null),Ye([wt],nA.prototype,"_returnAssignment",null),Ye([wt],nA.prototype,"_startAssignment",null),Ye([rA,wt],nA.prototype,"submitAssignment",null),Ye([wt],nA.prototype,"_validateAssignmentName",null),Ye([wt],nA.prototype,"_renameAssignment",null),Ye([wt],nA.prototype,"updateAssignment",null),Ye([wt],nA.prototype,"_updateAssignmentMetadata",null),Ye([wt],nA.prototype,"refreshClassroomCodes",null),Ye([rA],nA.prototype,"updateClassroom",null),Ye([Dt,Rt,Qe(0,it)],nA.prototype,"getClassroomBoards",null),Ye([Dt,Rt,Qe(0,it)],nA.prototype,"getAssignmentBoards",null),Ye([Dt,wt,Qe(0,it)],nA.prototype,"getAssignmentBoard",null),Ye([rA],nA.prototype,"createClassroomBoard",null),nA=Ye([sA("ClassroomContext")],nA);var oA=nA,aA=Object.freeze({__proto__:null,default:oA});const cA={"repo:name":"Sample board name","dc:description":"Board description","board#type":"classroom","board:context":{baseAssetId:"urn:aaid:sc:VA6C2:af99f449-ea01-3e3e-aba5-fe57fd38364b",boardsAssetId:"urn:aaid:sc:VA6C2:af99f449-ea01-3e3e-aba5-fe57fd38364c"},"repo:assetId":"urn:aaid:sc:VA6C2:61b71cdc-4d42-5ac2-8d19-dede02efdxyz","repo:createDate":"2024-10-01T21:59:01.415Z","repo:modifyDate":"2024-10-01T21:59:06.565Z","repo:createdBy":"1916195E667CADAB0A12345D@AdobeID","repo:modifiedBy":"1916195E667CADAB0A12345D@AdobeID",posts:[{id:"af46a980-9cc5-4baf-935c-123fcb6ee615",description:"Text 1",type:"application/vnd.adobe.post.text+dcx",postedBy:{userId:"BF44198F668D1EAE0A494021@af361967668d0331494131.e",email:"assignmentstudent1@itaw16.onmicrosoft.com",firstName:"John",lastName:"Doe",displayName:"John. Doe",images:{50:"https://example_50_pixel.com",100:"https://example_100_pixel.com"}},created:"2020-03-17T21:23:25.693Z",modified:"2020-03-17T22:23:25.693Z","board#createdData":{userId:"0D522D2B5D7687E40A494215@AdobeID"},"board#modifiedData":{userId:"0D522D2B5D7687E40A494215@AdobeID"}},{id:"af46a980-9cc5-4baf-935c-501fcb6ee616",name:"My poster",description:"My poster description",type:"application/vnd.adobe.post.assetlink+dcx",link:{"repo:assetId":"urn:aaid:sc:VA6C2:61b71cdc-4d42-5ac2-8d19-dede02efdbbb","repo:etag":'"167dd86b8f8d4ac88f40722210655c51"'},postedBy:{userId:"BF44198F668D1EAE0A494021@af361967668d0331494131.e",email:"assignmentstudent1@itaw16.onmicrosoft.com",firstName:"John",lastName:"Doe",displayName:"John. Doe",images:{50:"https://example_50_pixel.com",100:"https://example_100_pixel.com"}},created:"2020-03-17T21:23:25.693Z",modified:"2020-03-17T22:23:25.693Z","board#createdData":{userId:"0D522D2B5D7687E40A494215@AdobeID"},"board#modifiedData":{userId:"0D522D2B5D7687E40A494215@AdobeID"}}]},lA=Ra();class dA extends pr{async _discoverLinks(e){return(await this._getResponse(e,{headers:lA}))._links}_getEndpointHref(e){return`https://${this._core._environment.endpoints.ASSIGNMENTS_HOST}${e}`}async discoverLinks(){return this._discoverLinks(this._getEndpointHref("/api/v1/boards/index"))}async createBoard(e){const t=await this.discoverLinks(),{name:i,description:s,type:r,additionalData:n,posts:o}=e,a={"repo:name":i,"dc:description":s,"board#type":r,additionalMetadata:n};o&&(a.posts=await Promise.all(o.map((e=>this.mapPostCreationData(e)))));const c=It(t,yt.BOARDS_CREATE,{baseAssetId:e.baseAssetId,useBaseAssetDirectory:e.shouldCreateDirectlyInBaseAsset||!1});return(await this._doPost(c,Object.assign(Object.assign({},lA),{"Content-Type":ft}),JSON.stringify(a),[201])).json()}async getBoard(e){const t=It(await this.discoverLinks(),yt.BOARDS_PRIMARY,{boardId:e});return(await this._doGet(t,{headers:lA})).json()}async getBoards(e){const{baseAssetId:t}=e,i=It(await this.discoverLinks(),yt.BOARDS_COLLECTION,{baseAssetId:t,useBaseAssetDirectory:e.shouldGetDirectlyInBaseAsset||!1}),s=await this._doGet(i,{headers:lA});return(await s.json()).children}async mapPostCreationData(e){const{name:t,description:i,type:s,userId:r}=e,n={name:t,"board#postDescription":i,type:Ep.toB(s)};if(r&&(n.userId=r),s===vp.Text&&(n["board#postText"]=e.text),s===vp.AssetLink){const t=await this._core.hostAssetContext.getAssetWithCloudID(e.assetId);n.link={"repo:assetId":e.assetId,"dc:format":t.mediaType}}return n}async updateBoard(e){const t=await this.discoverLinks(),{displayName:i,description:s,postsToAdd:r=[],postsToRemove:n,postsToUpdate:o,boardId:a}=e,c=[];void 0!==i&&c.push({op:"replace",path:"/repo:name",value:i}),void 0!==s&&c.push({op:"replace",path:"/dc:description",value:s});for(const e of r)c.push({op:"add",path:"/board#post",value:await this.mapPostCreationData(e)});null==n||n.forEach((e=>{c.push({op:"remove",path:`/board#post/${e}`})})),null==o||o.forEach((e=>{c.push({op:"replace",path:`/board#post/${e.id}/board#postDescription`,value:e.description})}));const l=It(t,yt.BOARDS_PRIMARY,{boardId:a});if(c.length>0)return(await this._doPatch(l,Object.assign(Object.assign({},lA),{"Content-Type":ft}),JSON.stringify(c))).json()}async updateUsers(e){return await this.discoverLinks(),Promise.resolve(cA)}async discardBoard(e,t){if(!(null==t?void 0:t[yt.BOARDS_DISCARD]))throw We.create(Be.BAD_REQUEST,`Discard link is missing for this board ${e}`);const i=It(t,yt.BOARDS_DISCARD,{boardId:e});await this._doPost(i,lA,void 0,[204])}async publishBoard(e){const{boardId:t,links:i,boardTitle:s,boardSubTitle:r,showPosterName:n}=e;if(!(null==i?void 0:i[yt.BOARDS_PUBLISH]))throw We.create(Be.BAD_REQUEST,`Publish link is missing for this board ${t}`);const o=It(i,yt.BOARDS_PUBLISH,{boardId:t}),a={boardTitle:s,boardSubTitle:r,showPosterName:n};return(await this._doPost(o,Object.assign(Object.assign({},lA),{"Content-Type":ft}),JSON.stringify(a),[201])).json()}async unpublishBoard({boardId:e,links:t}){if(!(null==t?void 0:t[yt.BOARDS_UNPUBLISH]))throw We.create(Be.BAD_REQUEST,`Unpublish link is missing for this board ${e}`);const i=It(t,yt.BOARDS_UNPUBLISH,{boardId:e});await this._doPost(i,lA,void 0,[204])}}Ye([rt((function(e){return vt(e,bp)})),Qe(0,it)],dA.prototype,"_discoverLinks",null);class uA{constructor(e){this._core=e,this._boardsInterface=new dA(e)}async observeBoardsFolder(e){const t=e[0]["board:context"].boardsAssetId;return this._core.hostAssetContext.getAssetWithCloudID(t)}async loadPage(e){return this._loadPage(e)}async _loadPage(e){const{filter:t,implicitFilter:i}=e,s=i.baseAssetId||t.baseAssetId,r=i.shouldGetDirectlyInBaseAsset||t.shouldGetDirectlyInBaseAsset||!1,n=await this._boardsInterface.getBoards({baseAssetId:s,shouldGetDirectlyInBaseAsset:r}),o=this._core._getAssetPool().createLoaderUpdateSession(Date.now()),a=Np.updateRemoteItems(o,n);return o.commit(),n.length>0&&this.observeBoardsFolder(n).then((e=>{i._monitoredFolder=e})),{items:a,total:a.length,mostRecentValidMutation:Date.now()}}}let hA=class{constructor(e,t){this._core=e,this._assetPool=t,this._boardsInterface=new dA(this._core),this._boardUpdater=Np}updateBoardInPool({board:e,remoteBoard:t,hasLoadedPosts:i}){const s=this._core._getAssetPool().createMutationSession();let r;return e?(Np.updateLocalItem(s,e,t),r=e):r=Np.updateRemoteItem(s,t),s.commit(),void 0!==i&&(r._hasLoadedPosts=i),r}async getBoardById(e){const t=this._core._getAssetPool().getLocalItemById(e),i=(null==t?void 0:t._hasLoadedPosts)?t:await this._fetchBoardById(e);if(null==i?void 0:i.isDiscarded)throw We.create(Be.NOT_FOUND,`Board ${e} is discarded`);return i}async _getBoard(e){return this._core._getAssetPool().getLocalItemById(e)||this._fetchBoardById(e)}async _fetchBoardById(e,t){if(!Fa([e],"Board ID",!1))throw We.create(Be.BAD_REQUEST,"Board ID is required");let i,s;try{i=await this._boardsInterface.getBoard(e)}catch(e){s=e}if(await t,i)return this.updateBoardInPool({remoteBoard:i,hasLoadedPosts:!0});if(ze(s)&&(s.code===Be.NOT_FOUND||s.code===Be.ACCESS_DENIED)){const t=this._core._getAssetPool().getLocalItemById(e);t&&this._discardBoardFromPool(t)}throw s}async validateBoardNameForCreate({name:e,baseAssetId:t,shouldValidateDirectlyInBaseAsset:i=!1}){await this._validateBoardName({name:e,baseAssetId:t,shouldValidateDirectlyInBaseAsset:i})}async validateBoardNameForUpdate({name:e,baseAssetId:t,boardId:i,shouldValidateDirectlyInBaseAsset:s=!1}){try{Fa([t,i],"BaseAssetId and boardId")}catch(e){throw We.create(Be.BAD_REQUEST,"Base asset ID and board ID are required for name validation")}await this._validateBoardName({name:e,baseAssetId:t,boardId:i,shouldValidateDirectlyInBaseAsset:s})}async _validateBoardName({name:e,baseAssetId:t,boardId:i,shouldValidateDirectlyInBaseAsset:s=!1}){let r=[];if(t){const e=this.getBoardFilter({baseAssetId:t}),i=this.getBoardOrder(),n=this.getBoards({baseAssetId:t,shouldGetDirectlyInBaseAsset:s}).getList(i,e,{loadAllPages:!0});if(await Mo(n),n.status===co.HadLoaderErrors)throw We.create(Be.NETWORK_ERROR,"Failed to load boards");r=n.items}return kr({name:e,assetId:i,assetList:r,locale:this._core._environment.getValue("LOCALE"),getOtherAssetName:e=>e instanceof Lp?e.displayName:e.name})}async createBoard(e){const{name:t,baseAssetId:i,shouldCheckForDuplicateName:s=!0,type:r,additionalData:n,posts:o=[]}=e;if(!i||!r)throw We.create(Be.BAD_REQUEST,"Base asset ID and type are required for board creation");if(r===Op.CLASSROOM&&!(null==n?void 0:n.classroomId))throw We.create(Be.BAD_REQUEST,"Classroom ID is required for classroom boards");await this._validateBoardName({name:t,baseAssetId:s?i:void 0}),o.length>0&&(e.posts=await Promise.all(o.map((e=>this.processNewPost(e)))));const a=await this._boardsInterface.createBoard(e);return this.updateBoardInPool({remoteBoard:a,hasLoadedPosts:!0})}async _getUserHomeUploadsFolder(){const e=`${zi}/Uploads`;try{return await this._core.hostAssetContext.getAssetWithRepoPath(e)}catch(t){if(ze(t)&&t.code===Be.NOT_FOUND)return(await this._core.hostAssetContext.getRootFolder()).createFolder(e.split("/").pop());throw We.wrapErrorIfNeeded(Be.INTERNAL_ERROR,"Failed to get uploads folder",t)}}async _uploadFileForAssetLinkPost(e){let t;return t=e.parentAssetId?await this._core.hostAssetContext.getAssetWithCloudID(e.parentAssetId):await this._getUserHomeUploadsFolder(),t.importFile(e.blob,e.fileName,e.mediaType,!0,0,!1)}async _updateBoardAfterPatchingBoard(e){const t=await this._boardsInterface.updateBoard(e);t&&this.updateBoardInPool({remoteBoard:t,hasLoadedPosts:!0})}async processNewPost(e){if(e.type===vp.AssetLink){if(e.assetId&&e.blob)throw We.create(Be.BAD_REQUEST,"Asset ID and blob cannot be provided together for asset link posts");if(!e.assetId&&e.blob){if(!e.fileName)throw We.create(Be.BAD_REQUEST,"File name is required for asset link posts with a blob");const t=(({name:e,maxLength:t=br,shouldValidate:i=!1})=>{const s=e.replaceAll(new RegExp(Er,"g"),"").substring(0,t).replace(/[\u{0000}-\u{001F}|\u{007F}]+/gu,"").replace(/[\s|.]+$/g,"");return i&&kr({name:s}),s})({name:e.fileName,maxLength:240,shouldValidate:!0}),i={blob:e.blob,fileName:t,mediaType:e.mediaType,parentAssetId:e.parentAssetId},s=await this._uploadFileForAssetLinkPost(i);e.assetId=s.id,e.fileName=s.name}else if(!e.assetId)throw We.create(Be.BAD_REQUEST,"Asset ID or blob is required for asset link posts")}else if(e.type===vp.Text&&!e.text)throw We.create(Be.BAD_REQUEST,"Text is required for text posts");return e}async addPost(e){var{boardId:t}=e,i=qe(e,["boardId"]);const s={boardId:t,postsToAdd:[await this.processNewPost(i)]};await this._updateBoardAfterPatchingBoard(s)}async removePost({boardId:e,postId:t}){const i={boardId:e,postsToRemove:[t]};await this._updateBoardAfterPatchingBoard(i)}async updatePost(e){var{boardId:t}=e;const i={boardId:t,postsToUpdate:[qe(e,["boardId"])]};await this._updateBoardAfterPatchingBoard(i)}getBoards({baseAssetId:e,shouldGetDirectlyInBaseAsset:t}){if(!e)throw We.create(Be.BAD_REQUEST,"Base asset ID is required for fetching boards");const i=new uA(this._core),s=new Up({baseAssetId:e,shouldGetDirectlyInBaseAsset:t||!1});return new Uo(this._assetPool,[i],s)}_cleanBoardName(e){return e.trimEnd()}async _validateAndCleanBoardNameBeforeRenamingBoard({boardId:e,newName:t,baseAssetId:i}){return await this._validateBoardName({name:t,baseAssetId:i,boardId:e}),`${this._cleanBoardName(t)}${Lp.boardNameSuffix}`}async updateBoard({boardId:e,description:t,displayName:i}){let s,r;const n=void 0!==i,o=void 0!==t;if((o||n)&&(s=await this._getBoard(e)),n&&(r=await this._validateAndCleanBoardNameBeforeRenamingBoard({boardId:e,newName:i,baseAssetId:null==s?void 0:s._idOfBaseAsset})),o&&t!==(null==s?void 0:s.description)||n){const i={boardId:e,description:t,displayName:r};await this._updateBoardAfterPatchingBoard(i)}}_discardBoardFromPool(e){const t=this._core._getAssetPool().createUpdateSession();Np.updateLocalItem(t,e,{effectivePermission:Gi.None}),t.queueDiscardedItem(e),t.commit(),this._core._getAssetPool().removeLocalItems([e.id])}async discardBoard(e){const t=await this._getBoard(e);return await this._boardsInterface.discardBoard(e,t.links),this._discardBoardFromPool(t)}async publishBoard(e){const{boardId:t,boardSubTitle:i,boardTitle:s,showPosterName:r}=e,n=await this._getBoard(t);if(!n.canPublish)throw We.create(Be.BAD_REQUEST,"The board is read-only and cannot be published");const o=await this._boardsInterface.publishBoard({boardId:t,links:n.links,boardTitle:s,boardSubTitle:i,showPosterName:r}),a={"board:publishedBoard":{"repo:assetId":o["repo:assetId"],"board:showPosterName":r}};return this.updateBoardInPool({board:n,remoteBoard:a}),this.updateBoardInPool({remoteBoard:o,hasLoadedPosts:!0})}async unpublishBoard(e){var t;const i=await this._getBoard(e);if(!i.canUnpublish)throw We.create(Be.BAD_REQUEST,"The board is not published so cannot be unpublished");await this._boardsInterface.unpublishBoard({boardId:e,links:i.links});const s=null===(t=i.publishedBoardInfo)||void 0===t?void 0:t.boardId,r=this._assetPool.getLocalItemById(s);r&&this._discardBoardFromPool(r),this.updateBoardInPool({board:i,remoteBoard:{"board:publishedBoard":void 0}})}getBoardOrder(e){const t=Object.assign({},{direction:"ascending",field:"name"},e);return new jp(t.direction,t.field)}getBoardFilter(e){return new Up(e)}getPostOrder(e={}){const t={direction:Mp.default.direction,field:Mp.default.field},i=Object.assign({},t,e);return new Mp(i.direction,i.field)}async getPostByBoardAndPostId({boardId:e,postId:t}){const i=(await this.getBoardById(e))._postPool.getLocalItemById(t);if(!i)throw We.create(Be.NOT_FOUND,`Post with ID ${t} not found`);return i}};Ye([Dt,wt,Qe(0,it)],hA.prototype,"getBoardById",null),Ye([Dt,wt,Qe(0,it)],hA.prototype,"_getBoard",null),Ye([Dt,wt,Qe(0,it)],hA.prototype,"_fetchBoardById",null),Ye([rA],hA.prototype,"createBoard",null),Ye([rA],hA.prototype,"addPost",null),Ye([rA],hA.prototype,"updatePost",null),Ye([Dt,Rt,Qe(0,it)],hA.prototype,"getBoards",null),Ye([wt],hA.prototype,"_validateAndCleanBoardNameBeforeRenamingBoard",null),Ye([rA],hA.prototype,"updateBoard",null),Ye([rA],hA.prototype,"publishBoard",null),Ye([rA],hA.prototype,"unpublishBoard",null),hA=Ye([sA("BoardContext")],hA);var pA=hA,_A=Object.freeze({__proto__:null,default:pA});class mA extends kn{constructor(e){super({_isSharedWithYou:!0}),this.filterOptions=e,(null==e?void 0:e.owner)&&e.owner.length>0&&(this._owner=new Set([...e.owner])),(null==e?void 0:e.roles)&&e.roles.length>0&&(this._roles=new Set([...e.roles]))}matches(e){return!!e.isLibrary&&!(this._owner&&!bh(e,this._owner))&&!(this._roles&&!Ih(e,this._roles))&&super.matches(e)}}mA.TrainingSets=new mA({owner:[hh.All],roles:[mh.TrainingSet]});class fA{constructor(e,t,i,s){this._libraryPool=e,this._libraryInterface=t,this._libraryUpdater=i,this._core=s}supportsFilter(e){return void 0!==e}async loadPage(e){return await this._loadPage(e)}async _loadPage(e,t){var i,s,r;let n;const o=e.filter;if(t)(null===(i=e.loadOptions)||void 0===i?void 0:i.limit)&&(t.href=t.href.replace(/limit=[0-9]*/,`limit=${e.loadOptions.limit}`)),n=await this._libraryInterface.getLibrariesWithLink(t);else{const{limit:t}=null!==(s=e.loadOptions)&&void 0!==s?s:{},i=e.implicitFilter,r=e.order,a=i._owner||o._owner||Th.DEFAULT._owner,c=i._roles||o._roles,l={};a&&!o._reference&&(l.owner=[...a].sort().join(",")),o._reference&&(l.references=o._reference),c&&(l.roles=[...c].sort().join(",")),o._project&&(l.team=o._project),o._publishMetadata&&(l.itemFilter=o._publishMetadata),l.orderBy="ascending"===r.direction?yh[r.field]:`-${yh[r.field]}`,t&&(l.limit=t,l.start||(l.start=0)),l.selector="rendition_grid,collaboration,details",n=await this._libraryInterface.getLibraries(l)}o._project&&this._decorateLibraryDataWithReferencedByProject(n.libraries,o._project);const a=this._libraryPool._core._environment.getValue("USS_LIST_UPDATE_LATENCY"),c=Date.now()-a,l=this._libraryPool.createLoaderUpdateSession(c),d=this._libraryUpdater.updateRemoteItems(l,n.libraries);let u;d.forEach((e=>e._setLibraryLoadState("LOADED"))),d.forEach((e=>on.updatedByItemUpdater(e,$n))),l.commit(),o._project&&this._updateProjectInaccessibleReferences(o._project,n.inaccessibleReferences);const h=null===(r=n._links)||void 0===r?void 0:r.next;return h&&(u=e=>this._loadPage(e,h)),{items:d,total:n.total_count,loadNextPage:u,mostRecentValidMutation:c}}_decorateLibraryDataWithReferencedByProject(e,t){t!==ph.All&&t!==ph.None&&e.forEach((e=>{const{reference:i}=e;i&&t&&(e.referenced_by_project={projectId:t,reference:i})}))}_updateProjectInaccessibleReferences(e,t){if(!t)return;const i=this._core._getProjectContext();if(!i)return;const s=i._assetPool.getLocalItemById(e);if(!s)return;const r=i._assetPool.createUpdateSession("update project inaccessible references");i._projectUpdater.updateLocalItem(r,s,{inaccessibleReferences:t}),r.commit()}}class gA{constructor(e,t,i){this._libraryPool=e,this._libraryInterface=t,this._libraryUpdater=i}supportsFilter(e){return void 0!==e}async loadPage(e){return await this._loadPage(e)}async _loadPage(e,t){var i,s,r;const{implicitFilter:n}=e,{_query:o}=n,a=this._libraryPool._core._environment.getValue("PROJECTS_LIST_UPDATE_LATENCY"),c=Date.now()-a;let l;t?((null===(i=e.loadOptions)||void 0===i?void 0:i.limit)&&(t.href=t.href.replace(/limit=[0-9]*/,`limit=${e.loadOptions.limit}`)),l=await this._libraryInterface.searchLibrariesWithLink(o,t)):l=await this._libraryInterface.searchLibraries(o);const d=this._libraryPool.createLoaderUpdateSession(c),u=this._libraryUpdater.updateRemoteItems(d,null!==(s=l.libraries)&&void 0!==s?s:[]);for(const e of u)on.updatedByItemUpdater(e,$n);let h;d.commit();const p=null===(r=l._links)||void 0===r?void 0:r.next;return p&&(h=e=>this._loadPage(e,p)),n._matchingIDsFromSearch=new Set([...n._matchingIDsFromSearch||[],...u.map((e=>e.id))]),{items:u,total:l.total_count,loadNextPage:h,mostRecentValidMutation:c}}}class yA extends kn{constructor(e){var t,i;super(),this._query="",this._query=null!==(i=null===(t=e.query)||void 0===t?void 0:t.trim())&&void 0!==i?i:""}get query(){return this._query}matches(e){return!!e.isLibrary&&!(this._matchingIDsFromSearch&&!this._matchingIDsFromSearch.has(e.id))&&!(this._query&&!this._matchingIDsFromSearch)&&super.matches(e)}}class vA extends Is{constructor(e,t){super(),this._asset=void 0,this._callback=()=>{this.emit("change")},this._cacheKey=e,this._path=t}get cacheKey(){return this._cacheKey}get path(){return this._path}get asset(){return this._asset}async ensureExistence(e,t){const i=e._core._environment,s=i.cache,r=this._cacheKey,n=await s.getItem(r);try{const t=n!==Ti?await e.getAssetWithCloudID(n):await e.getAssetWithRepoPath(this._path);return s.setItem(r,t.cloudID),this._setAsset(t,s)}catch(r){if(r.code===Be.NOT_FOUND){i.debug(`${this._path} not found, creating it now`);const r=await this._create(e,t);return this._setAsset(r,s)}throw r}}async _setAsset(e,t){return this._asset=e,await t.setItem(this._cacheKey,e.cloudID),this._setUpWatcher(),e}}class OA extends vA{constructor(){super("SYNC_GROUP_ID","/assets/adobe-libraries")}async _create(e,t){return await(await e.getHomeFolder()).createFolder(this.path)}_setUpWatcher(){var e;null===(e=this._asset)||void 0===e||e.on("change",this._callback)}}class bA extends vA{constructor(e,t){super(e,t)}async _create(e,t){return await t.getBookmarks(),e.getAssetWithRepoPath(this.path)}_setUpWatcher(){var e,t;null===(e=this._asset)||void 0===e||e.on("change",this._callback),null===(t=this._asset)||void 0===t||t.appMetadata.on("change",this._callback)}}class IA extends bA{constructor(){super("COLLAB_BOOKMARKS_ID","/sync/adobe-libraries/collab-bookmarks.json")}}class EA extends bA{constructor(){super("PUBLIC_BOOKMARKS_ID","/sync/adobe-libraries/bookmarks.json")}}class TA{constructor(e,t){this._core=e,this.__assetPool=t,this._libraryUpdater=Od,this._libraryInterface=new Sa(this._core),this._syncGroupLocation=new OA,this._publicBookmarkLocation=new EA,this._collabBookmarkLocation=new IA}get _assetPool(){return this.__assetPool}get librariesSource(){const e=new fA(this._assetPool,this._libraryInterface,this._libraryUpdater,this._core);return this._ensureSubscriptionLocationExistence().then((()=>{this._publicBookmarkLocation.on("change",this._onPublicBookmarksChanged.bind(this)),this._collabBookmarkLocation.on("change",this._onCollabBookmarksChanged.bind(this))})).catch((e=>{this._core._environment.error(`Error ensuring subscription location existence: ${e}`)})),new Uo(this._assetPool,[e],new mA)}_onPublicBookmarksChanged(){var e;for(const t of this.librariesSource._getLists())(null===(e=t.filter._owner)||void 0===e?void 0:e.has(hh.Public))&&t.refresh()}_onCollabBookmarksChanged(){var e;for(const t of this.librariesSource._getLists())(null===(e=t.filter._owner)||void 0===e?void 0:e.has(hh.Incoming))&&t.refresh()}async _createLibrary(e){if(!Tr(e.name))throw We.create(Be.BAD_REQUEST,"Invalid name provided for the createLibrary operation.");const t=await this._libraryInterface.createLibrary(e),i=this._assetPool.createMutationSession(),s=this._libraryUpdater.updateRemoteItem(i,t);return s._setLibraryLoadState("LOADED"),i.commit(),s}getLibrarySearchSource(e){const t=new yA({query:e}),i=new gA(this._assetPool,this._libraryInterface,this._libraryUpdater);return new Uo(this._assetPool,[i],t)}async createPersonalLibrary(e){const t={syncCreate:!0,name:e.name,roles:e.roles};return this._createLibrary(t)}async _getLibraryLocally(e){const t=this._assetPool.getLocalItemById(e);if(t)return await t._waitForLibraryLoad(),t}async _getLibraryRemotely(e,t){const i=await this._libraryInterface.getLibraryData(e,t);if(!i)return;const s=this._assetPool.createMutationSession(),r=this._libraryUpdater.updateRemoteItem(s,i);return s.commit(),r}_isValidURN(e){return/^urn:[a-zA-Z0-9][a-zA-Z0-9-]{0,31}:[a-zA-Z0-9()+,\-.:=@;$_!*'%/?#]+$/.test(e)}async getLibraryByAssetId(e){const t=this._isValidURN(e)?await(async e=>{let t=await this._getLibraryLocally(e);return t||(t=await this._getLibraryRemotely(e)),t})(e):await(async e=>await this._getLibraryRemotely(e))(e);if(!t)throw We.create(Be.NOT_FOUND,`Library not found for the given ID: ${e}`);return t}async _ensureSubscriptionLocationExistence(){const e=await this._core.getAssetContext();return Promise.allSettled([this._syncGroupLocation.ensureExistence(e,this._libraryInterface),this._publicBookmarkLocation.ensureExistence(e,this._libraryInterface),this._collabBookmarkLocation.ensureExistence(e,this._libraryInterface)]).then((e=>{e.forEach((e=>{if("rejected"===e.status)throw e.reason}))}))}getLibraryOrder(e="descending",t="modified"){return new Oh(e,t)}getLibraryFilter(e){return new Th(e)}async _getLibrariesModule(){if(!this._ccLibraries)try{const{default:e,CloudDriver:t}=await Promise.resolve().then((function(){return hM})),i=this._core._environment.getValue("ACCESS_TOKEN"),s=this._core._environment.getValue("ENVIRONMENT")===as.Production?"production":"staging",r=new t(this._core,(async()=>({env:s,token:i,options:{}})));await r.init();const n={disableLocalFallthrough:!0,skipConnectingOnInit:!1,disablePreemptiveLibraryLoad:!0};this._ccLibraries=new e(this._core,this._assetPool,r,n)}catch(e){throw this._core._environment.error(`Error loading CCLibraries module: ${e}`),e}return this._ccLibraries}_getLibrariesModule_NoLoad(){return this._ccLibraries}}Ye([nt],TA.prototype,"librariesSource",null),Ye([Dt],TA.prototype,"createPersonalLibrary",null),Ye([Dt],TA.prototype,"getLibraryByAssetId",null);var SA=Object.freeze({__proto__:null,default:TA});class AA{constructor(e,t,i){this._assetPool=e,this._core=t,this._customModelInterface=i}async loadPage(e){return await this._loadPage(e)}async _loadPage(e,t){var i;let s;const{order:r,limit:n,filter:o}=e,a={},c=r||Jp.default,l=c.field;a.orderBy="ascending"===c.direction?Yp[l]:`-${Yp[l]}`,n&&(a.limit=n,a.start||(a.start=0));const d=null==o?void 0:o.listingOptions,u=d?Object.assign({},d):{};u.createDateMin&&(u.createdDateMin=u.createDateMin.getTime(),delete u.createDateMin),u.createDateMax&&(u.createdDateMax=u.createDateMax.getTime(),delete u.createDateMax),u.modifyDateMin&&(u.modifiedDateMin=u.modifyDateMin.getTime(),delete u.modifyDateMin),u.modifyDateMax&&(u.modifiedDateMax=u.modifyDateMax.getTime(),delete u.modifyDateMax),s=t?await this._customModelInterface.searchCustomModelsUsingPageLink(u,t):await this._customModelInterface.searchCustomModels(a,u);const h=this._core._environment.getValue("USS_LIST_UPDATE_LATENCY"),p=Date.now()-h,_=this._assetPool.createLoaderUpdateSession(p),m=hd.updateRemoteItems(_,s.custom_models);let f;_.commit();const g=null===(i=s._links)||void 0===i?void 0:i.next;return g&&(f=e=>this._loadPage(e,g)),{items:m,total:s.total_count,loadNextPage:f,mostRecentValidMutation:p}}}const PA=(e,t)=>e||t?{min:wA(t),max:wA(e)}:void 0,wA=e=>e?e.toISOString():e;class CA{constructor(e,t){this._core=e,this._customModelContext=t,this._ussInterface=this._core.hostAssetContext._ussInterface,this._ussLoaderHelper=new Cc(this._core.hostAssetContext._assetPool,e,this)}supportsFilter(e){return void 0!==e}loadPage(e){return this._ussLoaderHelper.loadPage(e)}async _getUSSResults(e){var t,i,s;const{implicitFilter:{query:r},filter:{listingOptions:n},order:o}=e,a=PA(null==n?void 0:n.createDateMax,null==n?void 0:n.createDateMin),c=PA(null==n?void 0:n.modifyDateMax,null==n?void 0:n.modifyDateMin),l=Object.assign(Object.assign({hints:[{acp_platform_v2:!0,creative_cloud_rendition_v2:!0}],asset_name:r,limit:null!==(i=null===(t=e.loadOptions)||void 0===t?void 0:t.limit)&&void 0!==i?i:100,start_index:null!==(s=null==e?void 0:e.start)&&void 0!==s?s:0,[Rn.TYPE]:[is],creative_cloud_asset_type:"dcx"},{sort_order:"ascending"===(d=o).direction?"asc":"desc",sort_orderby:{name:"asset_name",created:"create_date",modified:"modify_date"}[d.field]}),{fetch_fields:{includes:["_embedded","stock_content","link_additional_metadata","app_metadata","firefly#cme$$baseModelName","firefly#cme$$baseModelVersion","firefly#cme$$conceptId","firefly#cme$$trainingMode","firefly#cme$$superclass","firefly#cme$$version","firefly#ffmodel"]},"app_metadata$$cme:publishedState":null==n?void 0:n.publishedState,sync_created_date:a?{range:a}:void 0,sync_updated_date:c?{range:c}:void 0});var d;return this._ussInterface.getQueryResponse(l)}_postProcessPage({implicitFilter:e},t){const{items:i}=t;e._matchingIDsFromSearch=new Set([...e._matchingIDsFromSearch||[],...i.map((e=>e.id))])}}class RA extends pd{constructor(e){const{query:t}=e;super(qe(e,["query"])),this._query=t.trim()}get query(){return this._query}matches(e){return!(this._matchingIDsFromSearch&&!this._matchingIDsFromSearch.has(e.id))&&!(this._query&&!this._matchingIDsFromSearch)&&super.matches(e)}}class LA extends vc{constructor(){super(...arguments),this.isCustomModel=!0,this._inferenceReady=!1,this._publishedState=ns.UNPUBLISHED,this._samplePrompt="",this._displayName="",this._baseModelName="",this._baseModelVersion="",this._conceptId="",this._trainingMode=""}get inferenceReady(){return this._inferenceReady}get publishedState(){return this._publishedState}get samplePrompt(){return this._samplePrompt}get renditionUrl(){return this._renditionUrl}get displayName(){return this._displayName}get baseModelName(){return this._baseModelName}get baseModelVersion(){return this._baseModelVersion}get conceptId(){return this._conceptId}get trainingMode(){return this._trainingMode}}Ye([ht],LA.prototype,"inferenceReady",null),Ye([ht],LA.prototype,"publishedState",null),Ye([ht],LA.prototype,"samplePrompt",null),Ye([ht],LA.prototype,"renditionUrl",null),Ye([ht],LA.prototype,"displayName",null),Ye([ht],LA.prototype,"baseModelName",null),Ye([ht],LA.prototype,"baseModelVersion",null),Ye([ht],LA.prototype,"conceptId",null),Ye([ht],LA.prototype,"trainingMode",null);const NA=new vn({localItemType:LA,remoteIdProperty:"assetId",propertyUpdater:new Cn({_inferenceReady:{name:"inferenceReady",format:"boolean"},_publishedState:"publishedState",_samplePrompt:"samplePrompt",_renditionUrl:"renditionUrl",_displayName:"displayName",_baseModelName:"baseModelName",_baseModelVersion:"baseModelVersion",_conceptId:"conceptId",_trainingMode:"trainingMode",_links:{name:"_links",format:"object"},_name:"assetName",_path:"path",_created:{name:"createDate",format:"date"},_modified:{name:"modifyDate",format:"date"},_createdBy:"createdBy",_version:"version",_etag:"etag",_storageRegion:"region",_size:{name:"size",format:"number"}})});class DA{constructor(e,t,i){this._assetPool=e,this._core=t,this._customModelInterface=i}async loadPage(e){return await this._loadPage(e)}async _loadPage(e,t){var i,s;const{order:r,filter:n}=e,{limit:o}=null!==(i=e.loadOptions)&&void 0!==i?i:{},a=n.listingOptions,c=Object.assign({orderBy:e_[r.field],limit:o},a),l=await this._customModelInterface.getCustomModels(t?Object.assign(Object.assign({},c),{startIndex:t}):c),d=this._assetPool.createLoaderUpdateSession(Date.now()-this._core._environment.getValue("USS_LIST_UPDATE_LATENCY")),u=NA.updateRemoteItems(d,l.items);let h;d.commit();const p=null===(s=l.nextPage)||void 0===s?void 0:s.startIndex;return p&&(h=e=>this._loadPage(e,p)),{items:u,loadNextPage:h,total:l.total}}}const MA={VA6C2:"va6",VA6:"va6",VA7:"va6",JPN3:"jpn3",IRL1:"irl1"};class xA extends pr{_getMelvilleUrl(e){return`https://${this._core._environment.endpoints.MELVILLE_HOST}${e}`}async _getFetchOptionOverrides(e,t){const{href:i,options:s}=await super._getFetchOptionOverrides(e,t);return{href:i,options:Object.assign(Object.assign({},s),{headers:Object.assign(Object.assign({},s.headers),{"X-Product-Location":`SAM.js/${Ls.version}`})})}}async _getUrl(e){const t=await this._core.hostAssetContext.getHomeFolder(),i=MA[t.storageRegion],s=this._core._environment.endpoints.ACP_CS_HOST,r=s.split(".")[0],n=`${r}-${i}`;return`https://${s.replace(r,n)}/fps/${e}`}async getCustomModels(e){const t=e?JSON.parse(JSON.stringify(e)):{},i=Tt(await this._getUrl("customModels"),t);return this._getResponse(i)}async createTrainingSet(e){if(!e.name)throw We.create(Be.BAD_REQUEST,"Invalid argument: missing required name");if(!e.projectId)throw We.create(Be.BAD_REQUEST,"Invalid argument: missing required projectId. The parent must be a project");if(!e["firefly#ffmodel"].schemaVersion)throw We.create(Be.BAD_REQUEST,"Invalid argument: missing required schemaVersion.");const t={name:e.name,parent_assetId:e.projectId,roles:[{type:"cm_training_set"}],"firefly#ffmodel":e["firefly#ffmodel"],"firefly#cme":Object.assign(Object.assign({},e["firefly#ffmodel"]),{version:e["firefly#ffmodel"].schemaVersion})};return(await this._core.getLibraryContext())._createLibrary(t)}async getTrainingSetById(e){return(await this._core.getLibraryContext())._getLibraryRemotely(e)}async createCustomModel(e){const t=(await this._doPost(this._getMelvilleUrl("/api/v1/custom-models"),{"Content-Type":"application/json"},JSON.stringify(e),[201,200])).headers.get("asset-id");if(!t)throw We.create(Be.NOT_FOUND,"Asset id for newly created custom model not returned by melville");return{id:t}}}class kA{constructor(e,t,i){this._assetPool=e,this._core=t,this._customModelInterface=i}supportsFilter(e){return void 0!==e}async loadPage(e){return this._loadPage(e)}async _loadPage(e,t){var i,s;const{order:r,implicitFilter:n,filter:o}=e,{limit:a}=null!==(i=e.loadOptions)&&void 0!==i?i:{},c=n,l="listingOptions"in o&&o.listingOptions||[],d=Object.assign(Object.assign({orderBy:e_[r.field],limit:a},l),{name:c.query}),u=await this._customModelInterface.getCustomModels(t?Object.assign(Object.assign({},d),{startIndex:t}):d),h=this._assetPool.createLoaderUpdateSession(Date.now()-this._core._environment.getValue("USS_LIST_UPDATE_LATENCY")),p=NA.updateRemoteItems(h,u.items);let _;h.commit();const m=null===(s=u.nextPage)||void 0===s?void 0:s.startIndex;return m&&(_=e=>this._loadPage(e,m)),n._matchingIDsFromSearch=new Set([...n._matchingIDsFromSearch||[],...p.map((e=>e.id))]),{items:p,loadNextPage:_,total:u.total}}}class HA extends kn{constructor(e){super(e)}matches(e){return!!e.isCustomModel&&super.matches(e)}}class jA extends HA{constructor(e){const{query:t}=e;super(qe(e,["query"])),this._query=t.trim()}get query(){return this._query}matches(e){return!(this._matchingIDsFromSearch&&!this._matchingIDsFromSearch.has(e.id))&&!(this._query&&!this._matchingIDsFromSearch)&&super.matches(e)}}class UA{constructor(e,t){this._core=e,this._assetPool=t,this._customModelInterface=new xA(this._core),this._customModelUpdater=NA,this._libraryInterface=new Sa(this._core)}getCustomModelOrder(e="descending",t="modified"){return new i_(e,t)}getCustomModelFilter(e){return new v_(e)}customModelSearchSource(e){const t=new jA({query:e});return new Uo(this._assetPool,[new kA(this._assetPool,this._core,this._customModelInterface)],t)}get customModelSource(){return new Uo(this._assetPool,[new DA(this._assetPool,this._core,this._customModelInterface)],new HA)}async createTrainingSet(e){return this._customModelInterface.createTrainingSet(e)}async trainingSetsSource(){const e=await this._core.getLibraryContext(),t=new fA(e._assetPool,this._libraryInterface,Od,this._core);return new Uo(e._assetPool,[t],mA.TrainingSets)}async getTrainingSetById(e){return this._customModelInterface.getTrainingSetById(e)}async createCustomModel(e){return this._customModelInterface.createCustomModel(e)}}Ye([nt],UA.prototype,"customModelSource",null),Ye([nt],UA.prototype,"trainingSetsSource",null);class BA extends Th{constructor(e){super(Object.assign(Object.assign({},e),{owner:[hh.All],roles:[mh.TrainingSet]}))}}BA.DEFAULT=new BA;class FA{constructor(e={}){this._customModelFilter=e.customModelFilter||new g_,this._trainingSetFilter=e.trainingSetFilter||new BA}get _owner(){return this._trainingSetFilter?this._trainingSetFilter._owner:void 0}get _roles(){return this._trainingSetFilter?this._trainingSetFilter._roles:void 0}matches(e){return dd(e)?!!this._customModelFilter&&this._customModelFilter.matches(e):!!md(e)&&!!this._trainingSetFilter&&this._trainingSetFilter.matches(e)}}class VA{constructor(e,t){this._core=e,this._assetPool=t,this._customModelInterface=new cd(this._core),this._customModelUpdaterMelville=hd,this._libraryInterface=new Sa(this._core)}get legacyCustomModelContext(){return this._LegacyCustomModelContext||(this._LegacyCustomModelContext=new UA(this._core,this._assetPool)),this._LegacyCustomModelContext}customModelSearchSource(e){const t=new RA({query:e});return new Uo(this._assetPool,[new CA(this._core,this)],t)}customModelDashboardSource(){const e=new FA({customModelFilter:new pd({generatorOnly:!0}),trainingSetFilter:mA.TrainingSets});return new Uo(this._assetPool,[new AA(this._assetPool,this._core,this._customModelInterface),new fA(this._assetPool,this._libraryInterface,Od,this._core)],e)}get customModelSource(){return new Uo(this._assetPool,[new AA(this._assetPool,this._core,this._customModelInterface)],new pd)}async createTrainingSet(e){return this._customModelInterface.createTrainingSet(e)}async trainingSetsSource(){const e=await this._core.getLibraryContext(),t=new fA(e._assetPool,this._libraryInterface,Od,this._core);return new Uo(e._assetPool,[t],mA.TrainingSets)}async getTrainingSetById(e){return this._customModelInterface.getTrainingSetById(e)}async updateTrainingSet(e,t,i=!1){if(i&&(!t.schemaVersion||!t.trainingMode))throw We.create(Be.BAD_REQUEST,"Schema version and training mode are required fields on the training set metadata. To overwrite all metadata, these must be included in the payload.");const s=await this.getTrainingSetById(e);if(!s)throw We.create(Be.NOT_FOUND,"Training set not found");let r;r=i?{"firefly#cme":Object.assign({},t)}:{"firefly#cme":Object.assign(Object.assign({},s.customModelInfo),t)},await this._libraryInterface.updateMetadata(s.id,r),await this.getTrainingSetById(s.id)}async createCustomModel(e){const t=await this._customModelInterface.createCustomModel(e),i=this._assetPool.createMutationSession(),s=this._customModelUpdaterMelville.updateRemoteItem(i,t);return i.commit(),s}async _fetchAndUpdateCustomModelById(e){const t=await this._customModelInterface.getCustomModelById(e),i=this._assetPool.createMutationSession(),s=this._customModelUpdaterMelville.updateRemoteItem(i,t);return i.commit(),s}async getCustomModelById(e){const t=this._assetPool.getLocalItemById(e);if(t){if(!t.isCustomModel)throw We.create(Be.INVALID_OPERATION,"Attempting to fetch asset type that is not a custom model");return t}return this._fetchAndUpdateCustomModelById(e)}async updateCustomModel(e,t){await this._customModelInterface.updateCustomModel(e,t),await this._fetchAndUpdateCustomModelById(e)}getCustomModelOrder(e="descending",t="modified"){return new Jp(e,t)}getCustomModelFilter(e){return new g_(e)}getTrainingSetOrder(e="descending",t="modified"){return new Oh(e,t)}getTrainingSetFilter(e){return new BA(e)}}Ye([nt],VA.prototype,"customModelSource",null),Ye([Dt],VA.prototype,"createTrainingSet",null),Ye([nt],VA.prototype,"trainingSetsSource",null),Ye([Dt],VA.prototype,"getTrainingSetById",null),Ye([Dt],VA.prototype,"createCustomModel",null),Ye([Dt],VA.prototype,"getCustomModelById",null);var KA=Object.freeze({__proto__:null,default:VA});class GA extends kn{matches(e){var t;return ma(e)&&(null===(t=e.repoPath)||void 0===t?void 0:t.startsWith("/"+aa+"/"))}}const $A=Symbol("GenerationHistoryDirectoryRef"),WA=Symbol("GenerationHistoryFavoritesListRef");class zA{constructor(e,t){this._core=e,this._generationHistoryInterface=t}async loadPage(e){return await this._loadPage(e)}async _loadAssetsFromSupergraph(e,t){var i;const s=await this._core._getGQLManager(),{loadOptions:{limit:r=50}={},order:n,filter:o}=e,{historyAssetTypes:a}=null!==(i=o)&&void 0!==i?i:{};e.filter[WA]=this._core.hostAssetContext.favoriteAssetsSource.getList(Kp.default,new Qd({mediaTypes:a.map((e=>_a[e]))}),{loadAllPages:!0});const c=await s.getGenerationHistoryAssets({first:r,after:t,orderBy:[{direction:"ascending"===n.direction?"ASCENDING":"DESCENDING",field:"CREATE_DATE"}],filter:{dc_format:a.map((e=>_a[e]))}},e.resource),l=Date.now()-this._core._environment.getValue("GQL_LIST_UPDATE_LATENCY"),d=this._core._getAssetPool().createLoaderUpdateSession(l),u=Ec.updateRemoteItems(d,c.items);let h;return d.commit(),c.pageInfo.hasNextPage&&(h=e=>{var t;return this._loadAssetsFromSupergraph(e,null!==(t=c.pageInfo.endCursor)&&void 0!==t?t:void 0)}),{items:u,loadNextPage:h}}async _loadPage(e,t){var i,s,r;let n;if(!e.filter.generationGroupId)return await this._loadAssetsFromSupergraph(e);if(t)n=await this._generationHistoryInterface.getGenerationHistoryAssetsUsingPageLink(t,e.resource);else{const{order:t}=e,{limit:r}=null!==(i=e.loadOptions)&&void 0!==i?i:{},{generationGroupId:o,historyAssetTypes:a}=null!==(s=e.filter)&&void 0!==s?s:{},c={};c.orderBy="ascending"===t.direction?"created_date":"-created_date",o&&(c.generationGroupId=o),a.length&&(c.generationType=a.join(",")),r&&(c.limit=r,c.start||(c.start=0));const l=this._generationHistoryInterface.getGenerationHistoryAssets(c,e.resource);e.filter[WA]=this._core.hostAssetContext.favoriteAssetsSource.getList(Kp.default,new Qd({mediaTypes:a.map((e=>_a[e]))}),{loadAllPages:!0});const[d]=await Promise.all([l,this.getDefaultGHAFolder().then((t=>e.filter[$A]=t))]);n=d}const o=this._core._environment.getValue("USS_LIST_UPDATE_LATENCY"),a=Date.now()-o,c=this._core._getAssetPool().createLoaderUpdateSession(a),l=LE.updateRemoteItems(c,n.listings);let d;c.commit();const u=null===(r=n._links)||void 0===r?void 0:r.next;return u&&(d=e=>this._loadPage(e,u)),{items:l,total:n.total_count,loadNextPage:d,mostRecentValidMutation:a}}async getDefaultGHAFolder(){const e=await this._core.getGenerationHistoryContext(),{_fireflyGenerationsDirectoryID:t}=e,i=t?await this._core.hostAssetContext.getAssetWithCloudID(t):await this._core.hostAssetContext.getAssetWithRepoPath(`/${aa}`).then((e=>e)).catch((async e=>{if(e.code===Be.NOT_FOUND){const e=await this._core.hostAssetContext.getHomeFolder(),t=await e._getAssetInterface(),i=await t.createFolder(aa);return this._core.hostAssetContext._createAssetFromMetadata(i)}throw We.create(Be.UNKNOWN,"SAM was unable to resolve or create the firefly-generations directory")}));return e._fireflyGenerationsDirectoryID=i.cloudID,i}}class qA{constructor(e){this._core=e}async loadPage(e){return await this._loadPage(e)}async _loadPage(e){var t;const{generationGroupId:i}=null!==(t=e.filter)&&void 0!==t?t:{};return i?{items:this._core._getAssetPool().toArray().filter((e=>ga(e)===i))}:{items:[]}}}const YA=e=>{const t=e.filter((e=>"add"===e.action&&e.error));if(t.length>0)throw t[0].error};class QA{constructor(e,t){this._core=e,this._assetPool=t,this._generationHistoryInterface=new Aa(this._core),this._generationHistoryAssetUpdater=LE}get generationHistorySource(){return new Uo(this._assetPool,[new zA(this._core,this._generationHistoryInterface),new qA(this._core)],new GA)}async getGenerationHistoryAssetById(e){const t=this._assetPool.getLocalItemById(e);if(t){if(!ma(t))throw We.create(Be.INVALID_OPERATION,"Attempting to fetch asset type that is not a generation history asset");return t}const{isFavorite:i}=await(await this._core._getGQLManager()).getAssetById(e),s=await this._generationHistoryInterface.getGenerationHistoryAssetById(e),r=this._assetPool.createMutationSession(),n=this._generationHistoryAssetUpdater.updateRemoteItem(r,Object.assign(Object.assign({},s),{isFavorite:i}));return r.commit(),n}get generationHistoryUtils(){return Object.assign(Object.assign({},ba),{MEDIA_TO_HISTORY_ASSET_TYPE:pa,HISTORY_ASSET_TYPE_TO_MEDIA_TYPE:_a,GENERATION_HISTORY_MEDIA_TYPES:ha})}getGenerationHistoryAssetFilter(e){var t,i,s,r;const n=e;return n.featureFlags={generationHistoryVectors:null!==(i=null===(t=this._core._environment.getValue("FEATURE_FLAGS"))||void 0===t?void 0:t["generation-history-vectors"])&&void 0!==i&&i,generationHistoryAudio:null!==(r=null===(s=this._core._environment.getValue("FEATURE_FLAGS"))||void 0===s?void 0:s["generation-history-audio"])&&void 0!==r&&r},new y_(n)}getGenerationHistoryAssetOrder(e="descending",t="created"){return new Zp(e,t)}async getPublicLink(e){const t={mode:"all",role:"viewer",canShare:!1,canComment:!0};let i="all";const s=await this._core.getSharingContext();return await s.updateAccess(e,t).then(YA).catch((r=>{if(r.code===Be.ACCESS_DENIED&&"security/sharingRestriction"===r.description)return i="orgEverybody",s.updateAccess(e,Object.assign(Object.assign({},t),{mode:"orgEverybody"})).then(YA);throw r})),{link:`https://firefly-stage.corp.adobe.com/open/${e}`,permission:i}}}Ye([nt],QA.prototype,"generationHistorySource",null),Ye([Dt],QA.prototype,"getGenerationHistoryAssetById",null);var JA=Object.freeze({__proto__:null,default:QA});class XA extends pr{_getWorkfrontLinkURL(){return`https://${this._core._environment.endpoints.WORKFRONT_HOST}/esm-connector/api/v1/search`}async getWorkfrontLink(e,t){const i=new URL(`${this._getWorkfrontLinkURL()}?`);return jr(i,{UID:e}),(await this._doGet(i.toString(),{headers:{"x-gw-ims-org-id":t}})).json()}}var ZA=Object.freeze({__proto__:null,default:class{constructor(e){this._core=e,this._workfrontInterface=new XA(this._core)}async getAssetWithRepoPath(e,t){const i=await this._core.getAssetContext(),{data:s}=await i._getRepoDataByPath(e,t),r=i._assetPool.createMutationSession(),n=await this._core._adobeAssetFactory.getRepoMetadataUpdaters([s]),o=this._core._adobeAssetFactory.assetFromRepoMetadata({session:r,repoMetadata:s,updaters:n});return r.commit(),o}async getRepository(e){const t=(await this._core.getAssetContext())._rapi,i=(await t.getWorkfrontIndex(e)).newWorkfrontParentDir._embedded[yt.REPO_METADATA];return{id:i["repo:repositoryId"],path:i["repo:path"],name:i["repo:name"],links:i._links}}async getAssetWithCloudID(e){const t=await this._core.getAssetContext(),i=(await t._getAssetRepoDataWithCloudID(e)).data,s=this._core._getAssetPool().createUpdateSession("getAssetWithCloudID"),r=await this._core._adobeAssetFactory.getRepoMetadataUpdaters([i]),n=this._core._adobeAssetFactory.assetFromRepoMetadata({session:s,repoMetadata:i,updaters:r});return s.commit(),n}async getWorkfrontLink(e,t){var i;let s;if(t)s=t;else{const e=new ur(this._core),t=new Gd(this._core);await t.getOrganizations(e),s=null===(i=e.data)||void 0===i?void 0:i.default}return(await this._workfrontInterface.getWorkfrontLink(e,s)).workfrontURL}async setDenyWithDeepOverride(e){return Promise.reject(`Method is unimplemented, assetId: ${e}`)}_getPrivileges(){return[Z_.ACK,Z_.READ,Z_.WRITE,Z_.DELETE]}async setDeny(e,t,i){const s=await this._core.getAccessControlContext(),r=await s.getACL(e);await r.addACES([{inheritance:t,principal:i,privileges:this._getPrivileges(),modifier:em.DENY,relations:[]}])}async removeDeny(e,t,i){const s=await this._core.getAccessControlContext(),r=await s.getACL(e),n=r.aces.find((e=>e.inheritance===t&&ds(e.principal,i)&&e.isDeny&&e.privileges.every((e=>this._getPrivileges().includes(e)))&&0===e.relations.length));if(!n)throw We.create(Be.NOT_FOUND,"ACE matching the requested inheritance and principal was not found");await r.removeACES([n])}async removeDenyWithDeepOverride(e){return Promise.reject(`Method is unimplemented, assetId: ${e}`)}async _getResourceGenerationNumber(e,t){const i=await this._core.getAssetContext();let s=i._assetPool.getLocalItemById(e);s||(s=await i.getAssetWithCloudID(e,!1)),await s._ensureLink(t);const r=await s._getAssetInterface(),n=await r.getResourceGenerationNumber(t);if(!n)throw We.create(Be.BAD_REQUEST,"Resource Generation Number not found, only available in Node environments");const o=Number(n);if(isNaN(o))throw We.create(Be.BAD_REQUEST,"Resource Generation Number is not a number");return o}async getPrimaryRGN(e){return this._getResourceGenerationNumber(e,yt.PRIMARY)}async getRepoMetadataRGN(e){return this._getResourceGenerationNumber(e,yt.REPO_METADATA)}async getAppMetadataRGN(e){return this._getResourceGenerationNumber(e,yt.APP_METADATA)}}});const eP={isCuratedCollectionAsset:!1};class tP{constructor(e){this._core=e,this._minimalAssets=new WeakMap}_isCuratedCollectionAsset(e){const t=this._minimalAssets.get(e);return!!t&&t.isCuratedCollectionAsset}_isMinimalAsset(e){return this._minimalAssets.has(e)}async getMinimalAssetWithAssetId(e,t,i){return this._getMinimalAssetById(e,t,i)}async _getMinimalAssetById(e,t,i,s){const r=await this._core.getAssetContext(),n=r._rapi,o=r._assetPool.getLocalItemById(e);if(o){const i=this._core._environment.getValue("DISABLE_ONS");if(!s&&i&&(s=new sa(this._core),await n.getRepoMetadataById(e,s,t)),s){const e=r._assetPool.createMutationSession();r._adobeAssetUpdater.updateRemoteItem(e,s.data),e.commit()}return o}s||(s=new sa(this._core),await n.getRepoMetadataById(e,s,t));const a=s.data;a._links=Object.assign(Object.assign({},a._links),t);const c=r._assetPool.createMutationSession(),l=await this._core._adobeAssetFactory.getRepoMetadataUpdaters([a]),d=this._core._adobeAssetFactory.assetFromRepoMetadata({session:c,repoMetadata:a,updaters:l}),u=Object.assign(Object.assign({},eP),i);return this._minimalAssets.set(d,{isCuratedCollectionAsset:u.isCuratedCollectionAsset}),a&&a["storage:assignee"]&&d._storageAssignee_NoLazyLoad.id===a["storage:assignee"].id&&on.updatedByItemUpdater(d,$n),c.commit(),d._setResources({repoMetadataResource:s,effectivePermissionsResource:void 0,appMetadataResource:void 0,perUserMetadataResource:void 0}),d}async getMinimalAssetWithRepoPath(e,t,i,s){return this._getMinimalAssetWithRepoPathImpl(e,t,i,s)}async _getMinimalAssetWithRepoPathImpl(e,t,i,s){const r=(await this._core.getAssetContext())._rapi;let n;const o=new sa(this._core),a=await r.getRepoMetadataByPath(t,e,o,i);return n=await this._getMinimalAssetById(a["repo:assetId"],i,s,o),n}}Ye([Dt,wt,Qe(0,it)],tP.prototype,"getMinimalAssetWithAssetId",null),Ye([wt,Qe(0,it)],tP.prototype,"_getMinimalAssetById",null),Ye([Dt,wt],tP.prototype,"getMinimalAssetWithRepoPath",null),Ye([wt],tP.prototype,"_getMinimalAssetWithRepoPathImpl",null);var iP=Object.freeze({__proto__:null,DefaultMinimalAssetLoadOptions:eP,default:tP});class sP{constructor(e,t,i,s=[],r){this._core=e,this._assetId=t,this._etag=i,this._aces=s,this._assetInterface=r}get aces(){return[...this._aces]}set aces(e){this._aces=[...e]}get assetId(){return this._assetId}get etag(){return this._etag}set etag(e){this._etag=e}get isEmpty(){return 0===this._aces.length}async _forceRefreshACL(){const e=await this._core.getAccessControlContext();await e.getACL(this.assetId,!0)}async _handleConflict(e){throw ze(e)&&e.code===Be.CONFLICT&&await this._forceRefreshACL(),e}hasDirtyACES(){return this._aces.some((e=>e._isDirty))}async removeACES(e){if(this.hasDirtyACES())throw We.create(Be.BAD_REQUEST,"Cant delete ACEs with pending changes, these will be overwritten");[...e].sort(((e,t)=>e.id<t.id?0:-1));try{await this._assetInterface.deleteAccessControlEntries(e,this._etag)}catch(e){await this._handleConflict(e)}return await this._forceRefreshACL(),this._aces}async addACES(e){if(this.hasDirtyACES())throw We.create(Be.BAD_REQUEST,"Cant add ACES with pending changes, these will be overwritten");return await this._assetInterface.addAccessControlEntries(e,this._etag),await this._forceRefreshACL(),this._aces}async updateACES(){if(!this.hasDirtyACES())throw We.create(Be.BAD_REQUEST,"No changes to commit");const e=this._aces.filter((e=>e._isDirty));try{await this._assetInterface.updateAccessControlList(e,this._etag)}catch(e){await this._handleConflict(e)}await this._forceRefreshACL()}}class rP{constructor(e,t,i,s,r,n,o){this._core=e,this.id=t,this._privileges=i,this._modifier=s,this._inheritance=r,this._relations=n,this._principal=o,this.__isDirty=!1,this.__isDeleted=!1}_checkIfDeleted(){if(this.__isDeleted)throw We.create(Be.BAD_REQUEST,"Cannot update a deleted ACE")}get _isDirty(){return this.__isDirty}set _isDirty(e){this.__isDirty=e}set _isDeleted(e){this.__isDeleted=e}get _isDeleted(){return this.__isDeleted}get principal(){return this._principal}set principal(e){this._checkIfDeleted(),this._principal=e,this._isDirty=!0}get privileges(){return this._privileges}set privileges(e){this._checkIfDeleted(),this._privileges=e,this._isDirty=!0}get modifier(){return this._modifier}set modifier(e){this._checkIfDeleted(),this._modifier=e,this._isDirty=!0}get inheritance(){return this._inheritance}set inheritance(e){this._checkIfDeleted(),this._inheritance=e,this._isDirty=!0}get relations(){return this._relations}set relations(e){this._checkIfDeleted(),this._relations=e,this._isDirty=!0}get isDeny(){return this._modifier===em.DENY}get isGrant(){return this._modifier===em.GRANT}get isDeepInheritance(){return this._inheritance===tm.DEEP}get isSelfInheritance(){return this._inheritance===tm.SELF}get isDeepOverrideInheritance(){return this._inheritance===tm.DEEP_OVERRIDE}get isUserPrincipal(){return"string"!=typeof this._principal&&this._principal["@type"]===im.PRINCIPAL_TYPE_IMS_USER}get isGroupPrincipal(){return"string"!=typeof this._principal&&this._principal["@type"]===im.PRINCIPAL_TYPE_IMS_GROUP}}class nP{constructor(e){this._core=e,this._aclCache=new Map}_getCachedACL(e){const t=this._aclCache.get(e);if(t){const e=t.deref();if(e)return e}}async _getAssetInterface(e){const t=this._core._getAssetPool().getLocalItemById(e);let i;if(t)i=await t._getAssetInterface();else{const t=await this._core.getAssetContext(),s=await t._getAssetRepoDataWithCloudID(e);i=new Zr(t._rapi,e,s.data._links,s.data["repo:etag"])}return i}async getACL(e,t=!1){const i=this._getCachedACL(e);if(i&&!t)return i;const s=await this._getAssetInterface(e),r=await s.getAccessControlList(),n=(e,t)=>new rP(this._core,t,e["repo:privileges"],e["repo:modifier"],e["repo:inheritance"],e["repo:relations"],e["repo:principal"]);if(i&&t&&(i.aces.forEach((e=>{e._isDeleted=!0})),i.aces=[]),i)return i.aces=r["repo:acl"].map(n),i.etag=r.etag,i;const o=new sP(this._core,e,r.etag,r["repo:acl"].map(n),s);return this._aclCache.set(e,new WeakRef(o)),o}}Ye([rt,Qe(0,it)],nP.prototype,"_getAssetInterface",null);var oP=Object.freeze({__proto__:null,default:nP});const aP=e=>["all","authenticated","allWithPassword","orgEverybody"].includes(e.id);var cP=Object.freeze({__proto__:null,default:class{constructor(e,t){this._core=e,this._assetPool=t}async _getAdobeAsset(e){var t;const i=null!==(t=this._assetPool.getLocalItemById(e))&&void 0!==t?t:await(await this._core.getAssetContext()).getAssetWithCloudID(e);return await on.fetchIfNeeded(i,Mi),i}async _getPrincipalCollaborators(e){return(await(await this._getAdobeAsset(e)).collaboratorArray).filter(aP)}async updateAccess(e,t){const i=await this._getPrincipalCollaborators(e),s=[],r=[];if("private"===t.mode)null==i||i.forEach((e=>s.push({id:e.id,action:"remove"})));else{const{mode:e}=t,a=qe(t,["mode"]),c=i.filter((t=>e!==t.id)).map((e=>({id:e.id,action:"remove"}))),l=i.find((t=>e===t.id));l&&(o=l,!("private"===(n=t).mode?!o:n.mode===o.id&&n.role===o.role&&n.canShare===o.canShare&&n.canComment===o.commentPermissions.includes("write")))&&s.push(Object.assign({id:l.id,action:"update"},a)),l||r.push(Object.assign({recipient:e},a)),c.length>0&&s.push(...c)}var n,o;const a=Promise.all([s.length>0?this._core.collaborationContext._modifyCollaborators(e,s):Promise.resolve(void 0),r.length>0?this._core.collaborationContext._addCollaborators(e,r):Promise.resolve(void 0)]).then((([e,t])=>{var i,s;const r=(null===(i=null==e?void 0:e.collaborators)||void 0===i?void 0:i.map((e=>({action:"update",id:e.id,statusCode:e.statusCode,statusText:e.statusText,errorSubcode:e.errorSubcode}))))||[];let n=(null===(s=null==t?void 0:t.addedCollaborators)||void 0===s?void 0:s.map((e=>({action:"add",id:e}))))||[];return(null==t?void 0:t.failedCollaborators)&&(n=n.concat(t.failedCollaborators.map((e=>({action:"add",id:e.recipient,error:e.error}))))),[...r,...n]}));return a}}});const lP=["repo:repositoryId","repo:name","repo:etag","stRef:relativePath","stRef:documentID"];function dP(e){const t=e._permissions;return t===Gi.Ack||t===Gi.None}const uP=["application/illustrator"];class hP extends ar{constructor(e,t){super(e._core),this._assetLinkList=e,this._data=t,this._resolutionErrors=[],this._onChange=()=>{var e,t;const i=null===(e=this._resolvedAssets)||void 0===e?void 0:e.filter(dP);(null==i?void 0:i.length)&&(this._resolutionErrors=i.map((e=>We.create(e._permissions===Gi.Ack?Be.ACCESS_DENIED:Be.NOT_FOUND,"lost access"))),this._resolvedAssets=null===(t=this._resolvedAssets)||void 0===t?void 0:t.filter((e=>!i.includes(e)))),this.emit("change"),this._assetLinkList._onChange()}}async _setLinkData(e,t){return this._data=e,t&&(this._resolvedAssets=[t]),this._onChange(),this.adobeAsset&&this.assetID===this.adobeAsset.cloudID||await this._resolveWithRetry(),this}async _setLinkedAsset(e){const t=this._getLinkDataForAsset(e);return this._setLinkData(t,e)}_getLinkDataForAsset(e){var t,i;const s={"repo:assetId":e.cloudID,"repo:repositoryId":e.repositoryID,"repo:etag":e.etag,"dc:format":e.mediaType,"repo:name":e.name,"stRef:documentID":null===(t=e.embeddedMetadata.data)||void 0===t?void 0:t["xmpMM:DocumentID"],"stRef:instanceID":null===(i=e.embeddedMetadata.data)||void 0===i?void 0:i["xmpMM:InstanceID"],"stRef:manager":"Adobe Cloud"},r=this._assetLinkList.containerAsset;return r&&r.repositoryID===e.repositoryID&&(s["stRef:relativePath"]=Fs.relative(Fs.dirname(r.repoPath),e.repoPath)),s}_serializeLinkData(e){return JSON.stringify(e,Object.keys(e).sort())}_resolveWithRetry(){return this._resolve()}async _resolve(){var e;const t=[],i=[],s=e=>{if(![Be.NOT_FOUND,Be.ACCESS_DENIED].includes(e.code))throw e;i.push(e)};try{const e=await this._context.getAssetWithCloudID(this.assetID);e.embeddedMetadata.isLoaded||await e.embeddedMetadata.load(),t.push(e)}catch(e){this._core._environment.error(`Failed to resolve link by id (${this.assetID}): ${e}`),s(e)}const r=this._assetLinkList.containerAsset;if(this.relativePath&&r&&r.repositoryID===this.repositoryID){const i=Fs.join(Fs.dirname(r.repoPath),this.relativePath);try{const s=await this._context.getAssetWithRepoPath(i,this.repositoryID);s.embeddedMetadata.isLoaded||await s.embeddedMetadata.load(),t[0]&&t[0].cloudID===s.cloudID||((null===(e=t[0])||void 0===e?void 0:e.isDiscarded)?t.unshift(s):t.push(s))}catch(e){this._core._environment.error(`Failed to resolve link by path: ${this.repositoryID}, ${i}`),s(e)}}this._resolvedAssets&&this._resolvedAssets.forEach((e=>e.off("change",this._onChange))),t.forEach((e=>e.on("change",this._onChange))),this._resolvedAssets=t,this._resolutionErrors=i,this._onChange()}get _context(){return this._assetLinkList._manager._context}get adobeAsset(){var e;return null===(e=this._resolvedAssets)||void 0===e?void 0:e[0]}get alternativeAdobeAsset(){var e;return null===(e=this._resolvedAssets)||void 0===e?void 0:e[1]}get linkStatus(){if(!this._resolvedAssets)return"UpToDate";if(!this.adobeAsset)return this._resolutionErrors.some((e=>e.code===Be.ACCESS_DENIED))?"Restricted":"Broken";if(this.adobeAsset.isDiscarded)return"Discarded";const e=this.adobeAsset.embeddedMetadata.data["xmpMM:InstanceID"]||"",t=!e&&!this.instanceID||uP.includes(this.type),i=e!==this.instanceID||t&&this.etag!==this.adobeAsset.etag;if(this.alternativeAdobeAsset||i)return"OutOfDate";const s=this._getLinkDataForAsset(this.adobeAsset),r=lP.some((e=>s[e]!==this._data[e]));return r?"MetadataOutOfDate":"UpToDate"}get fragmentIdentifier(){return this._data["stRef:fromPart"]||""}get version(){return this._data["repo:version"]||""}get assetID(){return this._data["repo:assetId"]}get repositoryID(){return this._data["repo:repositoryId"]||""}get name(){return this._data["repo:name"]||""}get type(){return this._data["dc:format"]||""}get etag(){return this._data["repo:etag"]||""}get relativePath(){return this._data["stRef:relativePath"]||""}get documentID(){return this._data["stRef:documentID"]||""}get instanceID(){return this._data["stRef:instanceID"]||""}getAssetLinkRef(){return Object.assign({},this._data)}getAssetLinkRefString(){return this._serializeLinkData(this._data)}getNewAssetLinkRef(e){return this._getLinkDataForAsset(e)}getNewAssetLinkRefString(e){return this._serializeLinkData(this.getNewAssetLinkRef(e))}async updateWithAsset(e){return await this._setLinkedAsset(e),this.getAssetLinkRefString()}async updateWithLinkRef(e){return await this._setLinkData(e),e}async updateWithLinkRefString(e){return await this._setLinkData(JSON.parse(e)),e}acceptMetadataChanges(){if(this.adobeAsset&&"MetadataOutOfDate"===this.linkStatus){const e=this._getLinkDataForAsset(this.adobeAsset);this._data=Object.assign(Object.assign({},this._data),e),this._onChange()}return this.getAssetLinkRefString()}}Ye([wt],hP.prototype,"_setLinkData",null),Ye([Pt],hP.prototype,"_resolveWithRetry",null),Ye([ht],hP.prototype,"adobeAsset",null),Ye([ht],hP.prototype,"alternativeAdobeAsset",null),Ye([ht],hP.prototype,"linkStatus",null),Ye([ht],hP.prototype,"fragmentIdentifier",null),Ye([ht],hP.prototype,"version",null),Ye([ht],hP.prototype,"assetID",null),Ye([ht],hP.prototype,"repositoryID",null),Ye([ht],hP.prototype,"name",null),Ye([ht],hP.prototype,"type",null),Ye([ht],hP.prototype,"etag",null),Ye([ht],hP.prototype,"relativePath",null),Ye([ht],hP.prototype,"documentID",null),Ye([ht],hP.prototype,"instanceID",null),Ye([ht],hP.prototype,"getAssetLinkRef",null),Ye([ht],hP.prototype,"getAssetLinkRefString",null),Ye([ht],hP.prototype,"getNewAssetLinkRef",null),Ye([ht],hP.prototype,"getNewAssetLinkRefString",null);class pP extends cr{constructor(e,t){super(e._core),this._manager=e,this._containerAsset=t,this._links=new Set,this._directlyMonitoredAssetIDs=new Map,this._onChange=()=>{this.emit("change")},this._refreshLinks=(e=new Set(this.monitoredAssetIDs))=>{this.forEach((t=>{!t.adobeAsset&&e.has(t.assetID)&&t._resolveWithRetry()}))},this._refreshLinksForChangedAssets=e=>{this._refreshLinks(e);const t=this._monitoredAssetIDs,i=new Set;e.forEach((e=>{t.has(e)&&i.add(e);const s=this._directlyMonitoredAssetIDs.get(e.toLowerCase());s&&i.add(s)})),this.emit("notified",[...i])}}addAssetID(e){this._directlyMonitoredAssetIDs.set(e.toLowerCase(),e),this._onChange()}removeAssetID(e){this._directlyMonitoredAssetIDs.delete(e.toLowerCase()),this._onChange()}add(e){return Promise.all(e.map((async e=>{const t="string"==typeof e?JSON.parse(e):e,i=new hP(this,t);return this._links.add(i),this._onChange(),await i._resolveWithRetry(),i})))}async create(e,t,i){const s="string"==typeof e?e:e.cloudID,r=new hP(this,{"repo:assetId":s,"stRef:fromPart":t,"repo:version":i,"stRef:manager":"Adobe Cloud"});return this._links.add(r),this._onChange(),await r._resolve(),r.adobeAsset&&r._setLinkedAsset(r.adobeAsset),r}remove(e){this._links.delete(e),this._onChange()}clear(){this._links.clear(),this._onChange()}get count(){return this._links.size}get links(){return[...this._links]}get _monitoredAssetIDs(){const e=new Set(this._directlyMonitoredAssetIDs.values());return this.forEach((t=>{e.add(t.assetID),t.alternativeAdobeAsset&&e.add(t.alternativeAdobeAsset.cloudID)})),e}get monitoredAssetIDs(){return[...this._monitoredAssetIDs]}forEach(e){this._links.forEach(e)}get containerAsset(){return this._containerAsset}activate(e=0){tn("AssetLinkList.activate",`AssetLinkList.activate(${e}) is deprecated - lists are always monitored for notifications.This method will be removed on or after 2024-10-01.`)}deactivate(){tn("AssetLinkList.deactivate","AssetLinkList.deactivate() is deprecated - lists are always monitored for notifications. This method will be removed on or after 2024-10-01.")}get isActive(){return tn("AssetLinkList.isActive","AssetLinkList.isActive is deprecated - lists are always monitored for notifications. This method will be removed on or after 2024-10-01."),!0}async updateContainerAsset(e){this._containerAsset=e,this._onChange(),await Promise.all(Array.from(this._links).map((e=>e._resolveWithRetry())))}clone(e){e.links.forEach((e=>this._links.add(e)))}}Ye([ht],pP.prototype,"count",null),Ye([ht],pP.prototype,"links",null),Ye([ht],pP.prototype,"monitoredAssetIDs",null),Ye([ht],pP.prototype,"forEach",null),Ye([ht],pP.prototype,"containerAsset",null),Ye([ht],pP.prototype,"isActive",null);class _P extends ar{constructor(e){super(e._core),this._context=e,this._lists=new Set,this._onListChange=()=>{this._context._updateONSSubscriptions()}}createList(e){const t=new pP(this,e);return t.on("change",this._onListChange),this._lists.add(t),this.emit("change"),t}removeList(e){this._lists.delete(e),e.off("change",this._onListChange),this.emit("change")}get lists(){return[...this._lists]}}Ye([ht],_P.prototype,"lists",null);var mP=Object.freeze({__proto__:null,default:_P});const fP=oI`query SharedWithYou(
$first: Int!
$after: String
$filter: AssetListFilter
$orderBy: SharedWithYouOrderByInput) {
sharedWithYou {
assetListId
assetListConnection(
first: $first
after: $after
filter: $filter
orderBy: $orderBy) {
edges {
cursor
node {
... on Asset {
sharingInfo {
sharedWithYou {
shareDate
sharedBy {
id
}
}
}
repo_assetClass
repo_assetType
repo_assetSubType
labels {
lastAccessDate
}
#defer
repository {
repo_repositoryId
}
dc_format
storage_deviceCreateDate
storage_deviceModifyDate
primary_etag
effectivePermissions {
aclPolicy
annotations
applicationMetadata
default
directory
primary
}
primaryLink {
href
}
blockUploadLink {
href
}
repo_ancestors
repo_createDate
repo_createdBy {
id
}
repo_path
repo_representations {
composite
directory
file
}
repo_modifiedBy
repo_modifyDate
repo_name
repo_state
repo_assetId
storage_region
storage_assignee {
id
type
}
... @defer {
appMetadata {
valueOf(key: "")
}
}
}
... on Composite {
repo_version
repo_size
blockDownloadLink {
href
}
renditionLink {
href
}
}
... on File {
repo_version
repo_size
blockDownloadLink {
href
}
renditionLink {
href
}
tiff_imageLength
tiff_imageWidth
}
}
}
pageInfo {
endCursor
hasNextPage
}
}
}
}
`;var gP=Object.freeze({__proto__:null,SHARED_WITH_YOU_ASSETS:fP});const yP=oI`${ZI+eE+"\nquery generationHistoryListing($relativePath: String!, $first: Int!, $after: String, $orderBy: [OrderByInput], $filter: AssetFilter) {\n homeFolder: resolveUserHome {\n id: repo_assetId\n\n ... on Directory {\n fireflyGenerationsDirectory: assetByRelativePath(\n relativePath: $relativePath\n ) {\n id: repo_assetId\n name: repo_name\n ... on Directory {\n generationAssetsConnection: childrenConnection(first: $first, after: $after, orderBy: $orderBy, filter: $filter) {\n pageInfo {\n hasNextPage\n endCursor\n }\n assets: edges {\n cursor\n node {\n ...repoMetadata\n ...applicationMetadata\n }\n }\n }\n }\n }\n }\n }\n}\n"}`;var vP=Object.freeze({__proto__:null,generationHistoryAssets:yP});const OP=oI` query PLSRecents($first: Int!, $after: String, $filter: AssetListFilter) {
recents {
assetListId
assetListConnection(first: $first, after: $after, filter: $filter) {
pageInfo {
endCursor
hasNextPage
}
edges {
cursor
node {
... on Asset {
dc_format
repo_assetId
repo_name
repo_path
primary_etag
repo_representations {
composite
directory
file
}
repo_state
repo_ancestors
repo_createDate
repo_modifyDate
repo_modifiedBy
repo_createdBy {
id
}
storage_region
storage_deviceCreateDate
storage_deviceModifyDate
storage_assignee {
id
type
}
repo_assetClass
repo_assetType
repo_assetSubType
repository {
repo_repositoryId
}
sharingInfo {
sharedWithYou {
shareDate
sharedBy {
id
}
}
}
effectivePermissions {
aclPolicy
annotations
applicationMetadata
default
directory
primary
}
primaryLink {
href
}
blockUploadLink {
href
}
labels {
lastAccessDate
}
... @defer {
appMetadata {
valueOf(key: "")
}
}
... on Composite {
repo_version
repo_size
isComposite
blockDownloadLink {
href
}
renditionLink {
href
}
}
... on File {
repo_version
repo_size
isFile
blockDownloadLink {
href
}
renditionLink {
href
}
tiff_imageLength
tiff_imageWidth
}
}
}
}
}
}
}
`;var bP=Object.freeze({__proto__:null,recents:OP});const IP={"application/andrew-inset":["ez"],"application/applixware":["aw"],"application/atom+xml":["atom"],"application/atomcat+xml":["atomcat"],"application/atomsvc+xml":["atomsvc"],"application/ccxml+xml":["ccxml"],"application/cdmi-capability":["cdmia"],"application/cdmi-container":["cdmic"],"application/cdmi-domain":["cdmid"],"application/cdmi-object":["cdmio"],"application/cdmi-queue":["cdmiq"],"application/cu-seeme":["cu"],"application/davmount+xml":["davmount"],"application/docbook+xml":["dbk"],"application/dssc+der":["dssc"],"application/dssc+xml":["xdssc"],"application/ecmascript":["ecma"],"application/emma+xml":["emma"],"application/epub+zip":["epub"],"application/exi":["exi"],"application/font-tdpfr":["pfr"],"application/gml+xml":["gml"],"application/gpx+xml":["gpx"],"application/gxf":["gxf"],"application/hyperstudio":["stk"],"application/illustrator":["ai"],"application/illustrator-text":["ai"],"application/illustrator.template":["ait"],"application/inkml+xml":["ink","inkml"],"application/ipfix":["ipfix"],"application/java-archive":["jar"],"application/java-serialized-object":["ser"],"application/java-vm":["class"],"application/javascript":["js"],"application/json":["json"],"application/jsonml+json":["jsonml"],"application/lost+xml":["lostxml"],"application/mac-binhex40":["hqx"],"application/mac-compactpro":["cpt"],"application/mads+xml":["mads"],"application/marc":["mrc"],"application/marcxml+xml":["mrcx"],"application/mathematica":["ma","nb","mb"],"application/mathml+xml":["mathml"],"application/mbox":["mbox"],"application/mediaservercontrol+xml":["mscml"],"application/metalink+xml":["metalink"],"application/metalink4+xml":["meta4"],"application/mets+xml":["mets"],"application/mods+xml":["mods"],"application/mp21":["m21","mp21"],"application/mp4":["mp4s"],"application/msword":["doc","dot"],"application/mxf":["mxf"],"application/octet-stream":["bin","dms","lrf","mar","so","dist","distz","pkg","bpk","dump","elc","deploy"],"application/oda":["oda"],"application/oebps-package+xml":["opf"],"application/ogg":["ogx"],"application/omdoc+xml":["omdoc"],"application/onenote":["onetoc","onetoc2","onetmp","onepkg"],"application/oxps":["oxps"],"application/patch-ops-error+xml":["xer"],"application/pdf":["pdf"],"application/pgp-encrypted":["pgp"],"application/pgp-signature":["asc","sig"],"application/photoshop":["psd"],"application/photoshop.large":["psb"],"application/pics-rules":["prf"],"application/pkcs10":["p10"],"application/pkcs7-mime":["p7m","p7c"],"application/pkcs7-signature":["p7s"],"application/pkcs8":["p8"],"application/pkix-attr-cert":["ac"],"application/pkix-cert":["cer"],"application/pkix-crl":["crl"],"application/pkix-pkipath":["pkipath"],"application/pkixcmp":["pki"],"application/pls+xml":["pls"],"application/postscript":["ai","eps","ps"],"application/prs.cww":["cww"],"application/pskc+xml":["pskcxml"],"application/rdf+xml":["rdf"],"application/reginfo+xml":["rif"],"application/relax-ng-compact-syntax":["rnc"],"application/resource-lists+xml":["rl"],"application/resource-lists-diff+xml":["rld"],"application/rls-services+xml":["rs"],"application/rpki-ghostbusters":["gbr"],"application/rpki-manifest":["mft"],"application/rpki-roa":["roa"],"application/rsd+xml":["rsd"],"application/rss+xml":["rss"],"application/rtf":["rtf"],"application/sbml+xml":["sbml"],"application/scvp-cv-request":["scq"],"application/scvp-cv-response":["scs"],"application/scvp-vp-request":["spq"],"application/scvp-vp-response":["spp"],"application/sdp":["sdp"],"application/set-payment-initiation":["setpay"],"application/set-registration-initiation":["setreg"],"application/shf+xml":["shf"],"application/smil+xml":["smi","smil"],"application/sparql-query":["rq"],"application/sparql-results+xml":["srx"],"application/srgs":["gram"],"application/srgs+xml":["grxml"],"application/sru+xml":["sru"],"application/ssdl+xml":["ssdl"],"application/ssml+xml":["ssml"],"application/tei+xml":["tei","teicorpus"],"application/thraud+xml":["tfi"],"application/timestamped-data":["tsd"],"application/vnd.3gpp.pic-bw-large":["plb"],"application/vnd.3gpp.pic-bw-small":["psb"],"application/vnd.3gpp.pic-bw-var":["pvb"],"application/vnd.3gpp2.tcap":["tcap"],"application/vnd.3m.post-it-notes":["pwn"],"application/vnd.accpac.simply.aso":["aso"],"application/vnd.accpac.simply.imp":["imp"],"application/vnd.acucobol":["acu"],"application/vnd.acucorp":["atc","acutc"],"application/vnd.adobe.ae.graphic+zip":["aegraphic","mogrt"],"application/vnd.adobe.air-application-installer-package+zip":["air"],"application/vnd.adobe.animate-xfl+zip":["fla","xfl"],"application/vnd.adobe.animate-oam+zip":["oam"],"application/vnd.adobe.animate-sym+zip":["sym"],"application/vnd.adobe.animate-swf+zip":["swa"],"application/vnd.adobe.characterstyle+json":["style"],"application/vnd.adobe.characterstyle+snippet":["idms"],"application/vnd.adobe.charts+zip":["zip"],"application/vnd.adobe.ch.puppet+zip":["puppet"],"application/vnd.adobe.color+json":["ase"],"application/vnd.adobe.colortheme+json":["ase"],"application/vnd.adobe.cube+txt":["cube"],"application/vnd.adobe.element.agc+json":["agc"],"application/vnd.adobe.exr.light+zip":["exr"],"application/vnd.adobe.fbx.3d+zip":["fbx"],"application/vnd.adobe.formscentral.fcdt":["fcdt"],"application/vnd.adobe.fxp":["fxp","fxpl"],"application/vnd.adobe.hz.express+dcxucf":["dcxucf"],"application/vnd.adobe.ibl.light+zip":["ibl","zip"],"application/vnd.adobe.illustrator.template":["ait"],"application/vnd.adobe.indesign-idms":["idms"],"application/vnd.adobe.indesign-idms-text":["idms"],"application/vnd.adobe.indesign.template":["indt"],"application/vnd.adobe.layerstyle":["asl"],"application/vnd.adobe.look+xml":["look"],"application/vnd.adobe.graphic+json":["json"],"application/vnd.adobe.mdl.material+zip":["mdl","zip"],"application/vnd.adobe.muse-collection":["muse"],"application/vnd.adobe.obj.3d+zip":["obj","zip"],"application/vnd.adobe.paragraphstyle+json":["style"],"application/vnd.adobe.paragraphstyle+snippet":["idms"],"application/vnd.adobe.photoshop.template":["psdt"],"application/vnd.adobe.ppro.graphic+zip":["prgraphic","mogrt"],"application/vnd.adobe.ribbon.brush+zip":["brush"],"application/vnd.adobe.sbsar+zip":["sbsar"],"application/vnd.adobe.scatter.brush+zip":["brush"],"application/vnd.adobe.vector.brush+zip":["brush"],"application/vnd.adobe.text+json":["text-json"],"application/vnd.adobe.theo.document+dcxucf":["dcxucf"],"application/vnd.adobe.xdp+xml":["xdp"],"application/vnd.adobe.xfdf":["xfdf"],"application/vnd.ahead.space":["ahead"],"application/vnd.airzip.filesecure.azf":["azf"],"application/vnd.airzip.filesecure.azs":["azs"],"application/vnd.amazon.ebook":["azw"],"application/vnd.americandynamics.acc":["acc"],"application/vnd.amiga.ami":["ami"],"application/vnd.android.package-archive":["apk"],"application/vnd.anser-web-certificate-issue-initiation":["cii"],"application/vnd.anser-web-funds-transfer-initiation":["fti"],"application/vnd.antix.game-component":["atx"],"application/vnd.apple.installer+xml":["mpkg"],"application/vnd.apple.mpegurl":["m3u8"],"application/vnd.aristanetworks.swi":["swi"],"application/vnd.astraea-software.iota":["iota"],"application/vnd.audiograph":["aep"],"application/vnd.blueice.multipass":["mpm"],"application/vnd.bmi":["bmi"],"application/vnd.businessobjects":["rep"],"application/vnd.chemdraw+xml":["cdxml"],"application/vnd.chipnuts.karaoke-mmd":["mmd"],"application/vnd.cinderella":["cdy"],"application/vnd.claymore":["cla"],"application/vnd.cloanto.rp9":["rp9"],"application/vnd.clonk.c4group":["c4g","c4d","c4f","c4p","c4u"],"application/vnd.cluetrust.cartomobile-config":["c11amc"],"application/vnd.cluetrust.cartomobile-config-pkg":["c11amz"],"application/vnd.commonspace":["csp"],"application/vnd.contact.cmsg":["cdbcmsg"],"application/vnd.cosmocaller":["cmc"],"application/vnd.crick.clicker":["clkx"],"application/vnd.crick.clicker.keyboard":["clkk"],"application/vnd.crick.clicker.palette":["clkp"],"application/vnd.crick.clicker.template":["clkt"],"application/vnd.crick.clicker.wordbank":["clkw"],"application/vnd.criticaltools.wbs+xml":["wbs"],"application/vnd.ctc-posml":["pml"],"application/vnd.cups-ppd":["ppd"],"application/vnd.curl.car":["car"],"application/vnd.curl.pcurl":["pcurl"],"application/vnd.dart":["dart"],"application/vnd.data-vision.rdz":["rdz"],"application/vnd.dece.data":["uvf","uvvf","uvd","uvvd"],"application/vnd.dece.ttml+xml":["uvt","uvvt"],"application/vnd.dece.unspecified":["uvx","uvvx"],"application/vnd.dece.zip":["uvz","uvvz"],"application/vnd.denovo.fcselayout-link":["fe_launch"],"application/vnd.dna":["dna"],"application/vnd.dolby.mlp":["mlp"],"application/vnd.dpgraph":["dpg"],"application/vnd.dreamfactory":["dfac"],"application/vnd.ds-keypoint":["kpxx"],"application/vnd.dvb.ait":["ait"],"application/vnd.dvb.service":["svc"],"application/vnd.dynageo":["geo"],"application/vnd.ecowin.chart":["mag"],"application/vnd.enliven":["nml"],"application/vnd.epson.esf":["esf"],"application/vnd.epson.msf":["msf"],"application/vnd.epson.quickanime":["qam"],"application/vnd.epson.salt":["slt"],"application/vnd.epson.ssf":["ssf"],"application/vnd.eszigno3+xml":["es3","et3"],"application/vnd.ezpix-album":["ez2"],"application/vnd.ezpix-package":["ez3"],"application/vnd.fdf":["fdf"],"application/vnd.fdsn.mseed":["mseed"],"application/vnd.fdsn.seed":["seed","dataless"],"application/vnd.flographit":["gph"],"application/vnd.fluxtime.clip":["ftc"],"application/vnd.framemaker":["fm","frame","maker","book"],"application/vnd.frogans.fnc":["fnc"],"application/vnd.frogans.ltf":["ltf"],"application/vnd.fsc.weblaunch":["fsc"],"application/vnd.fujitsu.oasys":["oas"],"application/vnd.fujitsu.oasys2":["oa2"],"application/vnd.fujitsu.oasys3":["oa3"],"application/vnd.fujitsu.oasysgp":["fg5"],"application/vnd.fujitsu.oasysprs":["bh2"],"application/vnd.fujixerox.ddd":["ddd"],"application/vnd.fujixerox.docuworks":["xdw"],"application/vnd.fujixerox.docuworks.binder":["xbd"],"application/vnd.fuzzysheet":["fzs"],"application/vnd.genomatix.tuxedo":["txd"],"application/vnd.geogebra.file":["ggb"],"application/vnd.geogebra.tool":["ggt"],"application/vnd.geometry-explorer":["gex","gre"],"application/vnd.geonext":["gxt"],"application/vnd.geoplan":["g2w"],"application/vnd.geospace":["g3w"],"application/vnd.gmx":["gmx"],"application/vnd.google-earth.kml+xml":["kml"],"application/vnd.google-earth.kmz":["kmz"],"application/vnd.grafeq":["gqf","gqs"],"application/vnd.groove-account":["gac"],"application/vnd.groove-help":["ghf"],"application/vnd.groove-identity-message":["gim"],"application/vnd.groove-injector":["grv"],"application/vnd.groove-tool-message":["gtm"],"application/vnd.groove-tool-template":["tpl"],"application/vnd.groove-vcard":["vcg"],"application/vnd.hal+xml":["hal"],"application/vnd.handheld-entertainment+xml":["zmm"],"application/vnd.hbci":["hbci"],"application/vnd.hhe.lesson-player":["les"],"application/vnd.hp-hpgl":["hpgl"],"application/vnd.hp-hpid":["hpid"],"application/vnd.hp-hps":["hps"],"application/vnd.hp-jlyt":["jlt"],"application/vnd.hp-pcl":["pcl"],"application/vnd.hp-pclxl":["pclxl"],"application/vnd.ibm.minipay":["mpy"],"application/vnd.ibm.modcap":["afp","listafp","list3820"],"application/vnd.ibm.rights-management":["irm"],"application/vnd.ibm.secure-container":["sc"],"application/vnd.iccprofile":["icc","icm"],"application/vnd.igloader":["igl"],"application/vnd.immervision-ivp":["ivp"],"application/vnd.immervision-ivu":["ivu"],"application/vnd.insors.igm":["igm"],"application/vnd.intercon.formnet":["xpw","xpx"],"application/vnd.intergeo":["i2g"],"application/vnd.intu.qbo":["qbo"],"application/vnd.intu.qfx":["qfx"],"application/vnd.ipunplugged.rcprofile":["rcprofile"],"application/vnd.irepository.package+xml":["irp"],"application/vnd.is-xpr":["xpr"],"application/vnd.isac.fcs":["fcs"],"application/vnd.jam":["jam"],"application/vnd.jcp.javame.midlet-rms":["rms"],"application/vnd.jisp":["jisp"],"application/vnd.joost.joda-archive":["joda"],"application/vnd.kahootz":["ktz","ktr"],"application/vnd.kde.karbon":["karbon"],"application/vnd.kde.kchart":["chrt"],"application/vnd.kde.kformula":["kfo"],"application/vnd.kde.kivio":["flw"],"application/vnd.kde.kontour":["kon"],"application/vnd.kde.kpresenter":["kpr","kpt"],"application/vnd.kde.kspread":["ksp"],"application/vnd.kde.kword":["kwd","kwt"],"application/vnd.kenameaapp":["htke"],"application/vnd.kidspiration":["kia"],"application/vnd.kinar":["kne","knp"],"application/vnd.koan":["skp","skd","skt","skm"],"application/vnd.kodak-descriptor":["sse"],"application/vnd.las.las+xml":["lasxml"],"application/vnd.llamagraphics.life-balance.desktop":["lbd"],"application/vnd.llamagraphics.life-balance.exchange+xml":["lbe"],"application/vnd.lotus-1-2-3":["123"],"application/vnd.lotus-approach":["apr"],"application/vnd.lotus-freelance":["pre"],"application/vnd.lotus-notes":["nsf"],"application/vnd.lotus-organizer":["org"],"application/vnd.lotus-screencam":["scm"],"application/vnd.lotus-wordpro":["lwp"],"application/vnd.macports.portpkg":["portpkg"],"application/vnd.mcd":["mcd"],"application/vnd.medcalcdata":["mc1"],"application/vnd.mediastation.cdkey":["cdkey"],"application/vnd.mfer":["mwf"],"application/vnd.mfmp":["mfm"],"application/vnd.micrografx.flo":["flo"],"application/vnd.micrografx.igx":["igx"],"application/vnd.mif":["mif"],"application/vnd.mobius.daf":["daf"],"application/vnd.mobius.dis":["dis"],"application/vnd.mobius.mbk":["mbk"],"application/vnd.mobius.mqy":["mqy"],"application/vnd.mobius.msl":["msl"],"application/vnd.mobius.plc":["plc"],"application/vnd.mobius.txf":["txf"],"application/vnd.mophun.application":["mpn"],"application/vnd.mophun.certificate":["mpc"],"application/vnd.mozilla.xul+xml":["xul"],"application/vnd.ms-artgalry":["cil"],"application/vnd.ms-cab-compressed":["cab"],"application/vnd.ms-excel":["xls","xlm","xla","xlc","xlt","xlw"],"application/vnd.ms-excel.addin.macroenabled.12":["xlam"],"application/vnd.ms-excel.sheet.binary.macroenabled.12":["xlsb"],"application/vnd.ms-excel.sheet.macroenabled.12":["xlsm"],"application/vnd.ms-excel.template.macroenabled.12":["xltm"],"application/vnd.ms-fontobject":["eot"],"application/vnd.ms-htmlhelp":["chm"],"application/vnd.ms-ims":["ims"],"application/vnd.ms-lrm":["lrm"],"application/vnd.ms-officetheme":["thmx"],"application/vnd.ms-pki.seccat":["cat"],"application/vnd.ms-pki.stl":["stl"],"application/vnd.ms-powerpoint":["ppt","pps","pot"],"application/vnd.ms-powerpoint.addin.macroenabled.12":["ppam"],"application/vnd.ms-powerpoint.presentation.macroenabled.12":["pptm"],"application/vnd.ms-powerpoint.slide.macroenabled.12":["sldm"],"application/vnd.ms-powerpoint.slideshow.macroenabled.12":["ppsm"],"application/vnd.ms-powerpoint.template.macroenabled.12":["potm"],"application/vnd.ms-project":["mpp","mpt"],"application/vnd.ms-word.document.macroenabled.12":["docm"],"application/vnd.ms-word.template.macroenabled.12":["dotm"],"application/vnd.ms-works":["wps","wks","wcm","wdb"],"application/vnd.ms-wpl":["wpl"],"application/vnd.ms-xpsdocument":["xps"],"application/vnd.mseq":["mseq"],"application/vnd.musician":["mus"],"application/vnd.muvee.style":["msty"],"application/vnd.mynfc":["taglet"],"application/vnd.neurolanguage.nlu":["nlu"],"application/vnd.nitf":["ntf","nitf"],"application/vnd.noblenet-directory":["nnd"],"application/vnd.noblenet-sealer":["nns"],"application/vnd.noblenet-web":["nnw"],"application/vnd.nokia.n-gage.data":["ngdat"],"application/vnd.nokia.radio-preset":["rpst"],"application/vnd.nokia.radio-presets":["rpss"],"application/vnd.novadigm.edm":["edm"],"application/vnd.novadigm.edx":["edx"],"application/vnd.novadigm.ext":["ext"],"application/vnd.oasis.opendocument.chart":["odc"],"application/vnd.oasis.opendocument.chart-template":["otc"],"application/vnd.oasis.opendocument.database":["odb"],"application/vnd.oasis.opendocument.formula":["odf"],"application/vnd.oasis.opendocument.formula-template":["odft"],"application/vnd.oasis.opendocument.graphics":["odg"],"application/vnd.oasis.opendocument.graphics-template":["otg"],"application/vnd.oasis.opendocument.image":["odi"],"application/vnd.oasis.opendocument.image-template":["oti"],"application/vnd.oasis.opendocument.presentation":["odp"],"application/vnd.oasis.opendocument.presentation-template":["otp"],"application/vnd.oasis.opendocument.spreadsheet":["ods"],"application/vnd.oasis.opendocument.spreadsheet-template":["ots"],"application/vnd.oasis.opendocument.text":["odt"],"application/vnd.oasis.opendocument.text-master":["odm"],"application/vnd.oasis.opendocument.text-template":["ott"],"application/vnd.oasis.opendocument.text-web":["oth"],"application/vnd.olpc-sugar":["xo"],"application/vnd.oma.dd2+xml":["dd2"],"application/vnd.openofficeorg.extension":["oxt"],"application/vnd.openxmlformats-officedocument.presentationml.presentation":["pptx"],"application/vnd.openxmlformats-officedocument.presentationml.slide":["sldx"],"application/vnd.openxmlformats-officedocument.presentationml.slideshow":["ppsx"],"application/vnd.openxmlformats-officedocument.presentationml.template":["potx"],"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":["xlsx"],"application/vnd.openxmlformats-officedocument.spreadsheetml.template":["xltx"],"application/vnd.openxmlformats-officedocument.wordprocessingml.document":["docx"],"application/vnd.openxmlformats-officedocument.wordprocessingml.template":["dotx"],"application/vnd.osgeo.mapguide.package":["mgp"],"application/vnd.osgi.dp":["dp"],"application/vnd.osgi.subsystem":["esa"],"application/vnd.palm":["pdb","pqa","oprc"],"application/vnd.pawaafile":["paw"],"application/vnd.pg.format":["str"],"application/vnd.pg.osasli":["ei6"],"application/vnd.picsel":["efif"],"application/vnd.pmi.widget":["wg"],"application/vnd.pocketlearn":["plf"],"application/vnd.powerbuilder6":["pbd"],"application/vnd.previewsystems.box":["box"],"application/vnd.proteus.magazine":["mgz"],"application/vnd.publishare-delta-tree":["qps"],"application/vnd.pvi.ptid1":["ptid"],"application/vnd.quark.quarkxpress":["qxd","qxt","qwd","qwt","qxl","qxb"],"application/vnd.realvnc.bed":["bed"],"application/vnd.recordare.musicxml":["mxl"],"application/vnd.recordare.musicxml+xml":["musicxml"],"application/vnd.rig.cryptonote":["cryptonote"],"application/vnd.rim.cod":["cod"],"application/vnd.rn-realmedia":["rm"],"application/vnd.rn-realmedia-vbr":["rmvb"],"application/vnd.route66.link66+xml":["link66"],"application/vnd.sailingtracker.track":["st"],"application/vnd.seemail":["see"],"application/vnd.sema":["sema"],"application/vnd.semd":["semd"],"application/vnd.semf":["semf"],"application/vnd.shana.informed.formdata":["ifm"],"application/vnd.shana.informed.formtemplate":["itp"],"application/vnd.shana.informed.interchange":["iif"],"application/vnd.shana.informed.package":["ipk"],"application/vnd.simtech-mindmapper":["twd","twds"],"application/vnd.smaf":["mmf"],"application/vnd.smart.teacher":["teacher"],"application/vnd.solent.sdkm+xml":["sdkm","sdkd"],"application/vnd.spotfire.dxp":["dxp"],"application/vnd.spotfire.sfs":["sfs"],"application/vnd.stardivision.calc":["sdc"],"application/vnd.stardivision.draw":["sda"],"application/vnd.stardivision.impress":["sdd"],"application/vnd.stardivision.math":["smf"],"application/vnd.stardivision.writer":["sdw","vor"],"application/vnd.stardivision.writer-global":["sgl"],"application/vnd.stepmania.package":["smzip"],"application/vnd.stepmania.stepchart":["sm"],"application/vnd.sun.xml.calc":["sxc"],"application/vnd.sun.xml.calc.template":["stc"],"application/vnd.sun.xml.draw":["sxd"],"application/vnd.sun.xml.draw.template":["std"],"application/vnd.sun.xml.impress":["sxi"],"application/vnd.sun.xml.impress.template":["sti"],"application/vnd.sun.xml.math":["sxm"],"application/vnd.sun.xml.writer":["sxw"],"application/vnd.sun.xml.writer.global":["sxg"],"application/vnd.sun.xml.writer.template":["stw"],"application/vnd.sus-calendar":["sus","susp"],"application/vnd.svd":["svd"],"application/vnd.symbian.install":["sis","sisx"],"application/vnd.syncml+xml":["xsm"],"application/vnd.syncml.dm+wbxml":["bdm"],"application/vnd.syncml.dm+xml":["xdm"],"application/vnd.tao.intent-module-archive":["tao"],"application/vnd.tcpdump.pcap":["pcap","cap","dmp"],"application/vnd.tmobile-livetv":["tmo"],"application/vnd.trid.tpt":["tpt"],"application/vnd.triscape.mxs":["mxs"],"application/vnd.trueapp":["tra"],"application/vnd.ufdl":["ufd","ufdl"],"application/vnd.uiq.theme":["utz"],"application/vnd.umajin":["umj"],"application/vnd.unity":["unityweb"],"application/vnd.uoml+xml":["uoml"],"application/vnd.vcx":["vcx"],"application/vnd.visio":["vsd","vst","vss","vsw"],"application/vnd.visionary":["vis"],"application/vnd.vsf":["vsf"],"application/vnd.wap.wbxml":["wbxml"],"application/vnd.wap.wmlc":["wmlc"],"application/vnd.wap.wmlscriptc":["wmlsc"],"application/vnd.webturbo":["wtb"],"application/vnd.wolfram.player":["nbp"],"application/vnd.wordperfect":["wpd"],"application/vnd.wqd":["wqd"],"application/vnd.wt.stf":["stf"],"application/vnd.xara":["xar"],"application/vnd.xfdl":["xfdl"],"application/vnd.yamaha.hv-dic":["hvd"],"application/vnd.yamaha.hv-script":["hvs"],"application/vnd.yamaha.hv-voice":["hvp"],"application/vnd.yamaha.openscoreformat":["osf"],"application/vnd.yamaha.openscoreformat.osfpvg+xml":["osfpvg"],"application/vnd.yamaha.smaf-audio":["saf"],"application/vnd.yamaha.smaf-phrase":["spf"],"application/vnd.yellowriver-custom-menu":["cmp"],"application/vnd.zul":["zir","zirz"],"application/vnd.zzazz.deck+xml":["zaz"],"application/voicexml+xml":["vxml"],"application/widget":["wgt"],"application/winhlp":["hlp"],"application/wsdl+xml":["wsdl"],"application/wspolicy+xml":["wspolicy"],"application/x-7z-compressed":["7z"],"application/x-abiword":["abw"],"application/x-ace-compressed":["ace"],"application/x-apple-diskimage":["dmg"],"application/x-authorware-bin":["aab","x32","u32","vox"],"application/x-authorware-map":["aam"],"application/x-authorware-seg":["aas"],"application/x-bcpio":["bcpio"],"application/x-bittorrent":["torrent"],"application/x-blorb":["blb","blorb"],"application/x-bzip":["bz"],"application/x-bzip2":["bz2","boz"],"application/x-cbr":["cbr","cba","cbt","cbz","cb7"],"application/x-cdlink":["vcd"],"application/x-cfs-compressed":["cfs"],"application/x-chat":["chat"],"application/x-chess-pgn":["pgn"],"application/x-conference":["nsc"],"application/x-cpio":["cpio"],"application/x-csh":["csh"],"application/x-debian-package":["deb","udeb"],"application/x-dgc-compressed":["dgc"],"application/x-director":["dir","dcr","dxr","cst","cct","cxt","w3d","fgd","swa"],"application/x-doom":["wad"],"application/x-dtbncx+xml":["ncx"],"application/x-dtbook+xml":["dtb"],"application/x-dtbresource+xml":["res"],"application/x-dvi":["dvi"],"application/x-envoy":["evy"],"application/x-eva":["eva"],"application/x-font-bdf":["bdf"],"application/x-font-ghostscript":["gsf"],"application/x-font-linux-psf":["psf"],"application/x-font-otf":["otf"],"application/x-font-pcf":["pcf"],"application/x-font-snf":["snf"],"application/x-font-ttf":["ttf","ttc"],"application/x-font-type1":["pfa","pfb","pfm","afm"],"application/font-woff":["woff"],"application/x-freearc":["arc"],"application/x-futuresplash":["spl"],"application/x-gca-compressed":["gca"],"application/x-glulx":["ulx"],"application/x-gnumeric":["gnumeric"],"application/x-gramps-xml":["gramps"],"application/x-gtar":["gtar"],"application/x-hdf":["hdf"],"application/x-install-instructions":["install"],"application/x-iso9660-image":["iso"],"application/x-java-jnlp-file":["jnlp"],"application/x-latex":["latex"],"application/x-lzh-compressed":["lzh","lha"],"application/x-mie":["mie"],"application/x-mobipocket-ebook":["prc","mobi"],"application/x-ms-application":["application"],"application/x-ms-shortcut":["lnk"],"application/x-ms-wmd":["wmd"],"application/x-ms-wmz":["wmz"],"application/x-ms-xbap":["xbap"],"application/x-msaccess":["mdb"],"application/x-msbinder":["obd"],"application/x-mscardfile":["crd"],"application/x-msclip":["clp"],"application/x-msdownload":["exe","dll","com","bat","msi"],"application/x-msmediaview":["mvb","m13","m14"],"application/x-msmetafile":["wmf","wmz","emf","emz"],"application/x-msmoney":["mny"],"application/x-mspublisher":["pub"],"application/x-msschedule":["scd"],"application/x-msterminal":["trm"],"application/x-mswrite":["wri"],"application/x-netcdf":["nc","cdf"],"application/x-nzb":["nzb"],"application/x-pkcs12":["p12","pfx"],"application/x-pkcs7-certificates":["p7b","spc"],"application/x-pkcs7-certreqresp":["p7r"],"application/x-rar-compressed":["rar"],"application/x-research-info-systems":["ris"],"application/x-sh":["sh"],"application/x-shar":["shar"],"application/x-shockwave-flash":["swf"],"application/x-silverlight-app":["xap"],"application/x-sql":["sql"],"application/x-stuffit":["sit"],"application/x-stuffitx":["sitx"],"application/x-subrip":["srt"],"application/x-sv4cpio":["sv4cpio"],"application/x-sv4crc":["sv4crc"],"application/x-t3vm-image":["t3"],"application/x-tads":["gam"],"application/x-tar":["tar"],"application/x-tcl":["tcl"],"application/x-tex":["tex"],"application/x-tex-tfm":["tfm"],"application/x-texinfo":["texinfo","texi"],"application/x-tgif":["obj"],"application/x-ustar":["ustar"],"application/x-wais-source":["src"],"application/x-x509-ca-cert":["der","crt"],"application/x-xfig":["fig"],"application/x-xliff+xml":["xlf"],"application/x-xpinstall":["xpi"],"application/x-xz":["xz"],"application/x-zmachine":["z1","z2","z3","z4","z5","z6","z7","z8"],"application/xaml+xml":["xaml"],"application/xcap-diff+xml":["xdf"],"application/xenc+xml":["xenc"],"application/xhtml+xml":["xhtml","xht"],"application/xml":["xml","xsl"],"application/xml-dtd":["dtd"],"application/xop+xml":["xop"],"application/xproc+xml":["xpl"],"application/xslt+xml":["xslt"],"application/xspf+xml":["xspf"],"application/xv+xml":["mxml","xhvml","xvml","xvm"],"application/yang":["yang"],"application/yin+xml":["yin"],"application/zip":["zip"],"audio/adpcm":["adp"],"audio/aif":["aif"],"audio/basic":["au","snd"],"audio/m4a":["m4a"],"audio/midi":["mid","midi","kar","rmi"],"audio/mp4":["mp4a"],"audio/mpeg":["mpga","mp2","mp2a","m2a"],"audio/mpeg3":["mp3","m3a"],"audio/ogg":["oga","ogg","spx"],"audio/s3m":["s3m"],"audio/silk":["sil"],"audio/vnd.dece.audio":["uva","uvva"],"audio/vnd.digital-winds":["eol"],"audio/vnd.dra":["dra"],"audio/vnd.dts":["dts"],"audio/vnd.dts.hd":["dtshd"],"audio/vnd.lucent.voice":["lvp"],"audio/vnd.ms-playready.media.pya":["pya"],"audio/vnd.nuera.ecelp4800":["ecelp4800"],"audio/vnd.nuera.ecelp7470":["ecelp7470"],"audio/vnd.nuera.ecelp9600":["ecelp9600"],"audio/vnd.rip":["rip"],"audio/wav":["wav"],"audio/webm":["weba"],"audio/x-aac":["aac"],"audio/x-aiff":["aiff","aifc"],"audio/x-caf":["caf"],"audio/x-flac":["flac"],"audio/x-matroska":["mka"],"audio/x-mpegurl":["m3u"],"audio/x-ms-wax":["wax"],"audio/x-ms-wma":["wma"],"audio/x-pn-realaudio":["ram","ra"],"audio/x-pn-realaudio-plugin":["rmp"],"audio/x-wav":["wav"],"audio/xm":["xm"],"chemical/x-cdx":["cdx"],"chemical/x-cif":["cif"],"chemical/x-cmdf":["cmdf"],"chemical/x-cml":["cml"],"chemical/x-csml":["csml"],"chemical/x-xyz":["xyz"],"image/bmp":["bmp"],"image/cgm":["cgm"],"image/dng":["dng"],"image/g3fax":["g3"],"image/gif":["gif"],"image/heic":["heic"],"image/heif":["heif"],"image/ief":["ief"],"image/jpeg":["jpeg","jpg","jpe"],"image/jpg":["jpeg","jpg"],"image/ktx":["ktx"],"image/png":["png"],"image/prs.btif":["btif"],"image/sgi":["sgi"],"image/svg+xml":["svg","svgz"],"image/tiff":["tiff","tif"],"image/vnd.adobe.photoshop":["psd"],"image/vnd.adobe.photoshop.template":["psdt"],"image/vnd.adobe.pattern+png":["png"],"image/vnd.adobe.shape+svg":["shape"],"image/vnd.dece.graphic":["uvi","uvvi","uvg","uvvg"],"image/vnd.dvb.subtitle":["sub"],"image/vnd.djvu":["djvu","djv"],"image/vnd.dwg":["dwg"],"image/vnd.dxf":["dxf"],"image/vnd.fastbidsheet":["fbs"],"image/vnd.fpx":["fpx"],"image/vnd.fst":["fst"],"image/vnd.fujixerox.edmics-mmr":["mmr"],"image/vnd.fujixerox.edmics-rlc":["rlc"],"image/vnd.ms-modi":["mdi"],"image/vnd.ms-photo":["wdp"],"image/vnd.net-fpx":["npx"],"image/vnd.wap.wbmp":["wbmp"],"image/vnd.xiff":["xif"],"image/webp":["webp"],"image/x-3ds":["3ds"],"image/x-adobe-dng":["dng"],"image/x-adobe-photoshop-brush":["abr"],"image/x-cmu-raster":["ras"],"image/x-cmx":["cmx"],"image/x-freehand":["fh","fhc","fh4","fh5","fh7"],"image/x-icon":["ico"],"image/x-mrsid-image":["sid"],"image/x-pcx":["pcx"],"image/x-pict":["pic","pct"],"image/x-portable-anymap":["pnm"],"image/x-portable-bitmap":["pbm"],"image/x-portable-graymap":["pgm"],"image/x-portable-pixmap":["ppm"],"image/x-rgb":["rgb"],"image/x-tga":["tga"],"image/x-xbitmap":["xbm"],"image/x-xpixmap":["xpm"],"image/x-xwindowdump":["xwd"],"message/rfc822":["eml","mime"],"model/gltf-binary":["glb"],"model/gltf+json":["gltf"],"model/iges":["igs","iges"],"model/mesh":["msh","mesh","silo"],"model/vnd.usdz+zip":["usdz"],"model/vnd.adobe.dn+dcx":["dn"],"model/vnd.adobe.dn+dcxucf":["dn"],"model/vnd.collada+xml":["dae"],"model/vnd.dwf":["dwf"],"model/vnd.gdl":["gdl"],"model/vnd.gtw":["gtw"],"model/vnd.mts":["mts"],"model/vnd.vtu":["vtu"],"model/vrml":["wrl","vrml"],"model/x3d+binary":["x3db","x3dbz"],"model/x3d+vrml":["x3dv","x3dvz"],"model/x3d+xml":["x3d","x3dz"],"text/cache-manifest":["appcache"],"text/calendar":["ics","ifb"],"text/css":["css"],"text/csv":["csv"],"text/html":["html","htm"],"text/n3":["n3"],"text/plain":["txt","text","conf","def","list","log","in"],"text/prs.lines.tag":["dsc"],"text/richtext":["rtx"],"text/sgml":["sgml","sgm"],"text/tab-separated-values":["tsv"],"text/troff":["t","tr","roff","man","me","ms"],"text/turtle":["ttl"],"text/uri-list":["uri","uris","urls"],"text/vcard":["vcard"],"text/vnd.curl":["curl"],"text/vnd.curl.dcurl":["dcurl"],"text/vnd.curl.scurl":["scurl"],"text/vnd.curl.mcurl":["mcurl"],"text/vnd.dvb.subtitle":["sub"],"text/vnd.fly":["fly"],"text/vnd.fmi.flexstor":["flx"],"text/vnd.graphviz":["gv"],"text/vnd.in3d.3dml":["3dml"],"text/vnd.in3d.spot":["spot"],"text/vnd.sun.j2me.app-descriptor":["jad"],"text/vnd.wap.wml":["wml"],"text/vnd.wap.wmlscript":["wmls"],"text/x-asm":["s","asm"],"text/x-c":["c","cc","cxx","cpp","h","hh","dic"],"text/x-fortran":["f","for","f77","f90"],"text/x-java-source":["java"],"text/x-opml":["opml"],"text/x-pascal":["p","pas"],"text/x-nfo":["nfo"],"text/x-setext":["etx"],"text/x-sfv":["sfv"],"text/x-uuencode":["uu"],"text/x-vcalendar":["vcs"],"text/x-vcard":["vcf"],"video/3gpp":["3gp"],"video/3gpp2":["3g2"],"video/h261":["h261"],"video/h263":["h263"],"video/h264":["h264"],"video/jpeg":["jpgv"],"video/jpm":["jpm","jpgm"],"video/mj2":["mj2","mjp2"],"video/mp4":["mp4","mp4v","mpg4"],"video/mpeg":["mpeg","mpg","mpe","m1v","m2v"],"video/ogg":["ogv"],"video/quicktime":["mov","qt"],"video/vnd.dece.hd":["uvh","uvvh"],"video/vnd.dece.mobile":["uvm","uvvm"],"video/vnd.dece.pd":["uvp","uvvp"],"video/vnd.dece.sd":["uvs","uvvs"],"video/vnd.dece.video":["uvv","uvvv"],"video/vnd.dvb.file":["dvb"],"video/vnd.fvt":["fvt"],"video/vnd.mpegurl":["mxu","m4u"],"video/vnd.ms-playready.media.pyv":["pyv"],"video/vnd.uvvu.mp4":["uvu","uvvu"],"video/vnd.vivo":["viv"],"video/webm":["webm"],"video/x-f4v":["f4v"],"video/x-fli":["fli"],"video/x-flv":["flv"],"video/x-m4v":["m4v"],"video/x-matroska":["mkv","mk3d","mks"],"video/x-mng":["mng"],"video/x-ms-asf":["asf","asx","wmv"],"video/x-ms-vob":["vob"],"video/x-ms-wm":["wm"],"video/x-ms-wmv":["wmv"],"video/x-ms-wmx":["wmx"],"video/x-ms-wvx":["wvx"],"video/x-msvideo":["avi"],"video/x-quicktime":["mov"],"video/x-sgi-movie":["movie"],"video/x-smv":["smv"],"x-conference/x-cooltalk":["ice"],"3d/vnd.adobe.dn+dcxucf":["dn"]},EP=new Set(["application/x-indesign","application/postscript","application/illustrator","application/pdf","application/vnd.adobe.psremix","application/vnd.adobe.pstouch","application/vnd.adobe.ideas","application/vnd.adobe.ase","image/jpeg","image/jpg","image/pjpeg","image/tiff","image/gif","image/bmp","image/x-ms-bmp","image/svg+xml","image/png","image/x-png","image/jp2","image/psd","image/vnd.adobe.photoshop","image/heic","application/photoshop","application/x-photoshop","image/raw","image/dng","image/x-adobe-dng","video/mp4","video/mpeg","video/x-ms-wmv","video/3gpp","video/3gpp2","video/quicktime","video/x-msvideo","video/x-flv","video/x-ms-asf","video/x-m4v","video/mp2t","application/mxf","application/x-shockwave-flash","application/vnd.adobe.brushes.brush+ucf","application/vnd.adobe.collage","application/vnd.adobe.proto","application/msword","application/msexcel","application/mspowerpoint","application/vnd.ms-publisher","application/vnd.openxmlformats-officedocument.wordprocessingml.document","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","application/vnd.openxmlformats-officedocument.presentationml.presentation","text/plain","text/rtf","application/illustrator.template","application/vnd.adobe.indesign.template","application/vnd.adobe.photoshop.template","image/vnd.adobe.photoshop.template"]),TP={};function SP(e){return e?IP[e.toLowerCase()]||function(e){const t=e.match(/application\/x-adobe-libraries-(.+)/);return t?[t[1]]:[]}(e.toLowerCase()):[]}function AP(e){return e?TP[e.toLowerCase()]||function(e){return[`application/x-adobe-libraries-${e}`]}(e.toLowerCase()):[]}function PP(e){return EP.has(e)}Object.keys(IP).forEach((e=>{IP[e].forEach((t=>{TP[t]=TP[t]||[],TP[t].push(e)}))}));const wP="@PLACEHOLDER",CP=[1,1,2,3,5,8,13,21,34,55],RP=10485760,LP=[45623,45625],NP=5242880,DP={photoshop:"TOOLKIT_NAME_PHOTOSHOP",photoshop_swatches:"TOOLKIT_NAME_PHOTOSHOP_SWATCHES",photoshop_brushes:"TOOLKIT_NAME_PHOTOSHOP_BRUSHES",photoshop_gradients:"TOOLKIT_NAME_PHOTOSHOP_GRADIENTS",photoshop_patterns:"TOOLKIT_NAME_PHOTOSHOP_PATTERNS",photoshop_styles:"TOOLKIT_NAME_PHOTOSHOP_STYLES",photoshop_shapes:"TOOLKIT_NAME_PHOTOSHOP_SHAPES",photoshop_swatches_prerelease:"TOOLKIT_NAME_PHOTOSHOP_SWATCHES_PR",photoshop_brushes_prerelease:"TOOLKIT_NAME_PHOTOSHOP_BRUSHES_PR",photoshop_gradients_prerelease:"TOOLKIT_NAME_PHOTOSHOP_GRADIENTS_PR",photoshop_patterns_prerelease:"TOOLKIT_NAME_PHOTOSHOP_PATTERNS_PR",photoshop_styles_prerelease:"TOOLKIT_NAME_PHOTOSHOP_STYLES_PR",photoshop_shapes_prerelease:"TOOLKIT_NAME_PHOTOSHOP_SHAPES_PR"},MP={IMAGE_ELEMENT_TYPE:"application/vnd.adobe.element.image+dcx",COLOR_ELEMENT_TYPE:"application/vnd.adobe.element.color+dcx",COLOR_THEME_ELEMENT_TYPE:"application/vnd.adobe.element.colortheme+dcx",BRUSH_ELEMENT_TYPE:"application/vnd.adobe.element.brush+dcx",CHARACTER_STYLE_ELEMENT_TYPE:"application/vnd.adobe.element.characterstyle+dcx",PARAGRAPH_STYLE_ELEMENT_TYPE:"application/vnd.adobe.element.paragraphstyle+dcx",FONT_ELEMENT_TYPE:"application/vnd.adobe.element.font+dcx",LAYER_STYLE_ELEMENT_TYPE:"application/vnd.adobe.element.layerstyle+dcx",LOOK_ELEMENT_TYPE:"application/vnd.adobe.element.look+dcx",CAPSULE_ELEMENT_TYPE:"application/vnd.adobe.element.graphic+dcx",VIDEO_ELEMENT_TYPE:"application/vnd.adobe.element.video+dcx",THREE_D_ELEMENT_TYPE:"application/vnd.adobe.element.3d+dcx",LIGHT_ELEMENT_TYPE:"application/vnd.adobe.element.light+dcx",MATERIAL_ELEMENT_TYPE:"application/vnd.adobe.element.material+dcx",PATTERN_ELEMENT_TYPE:"application/vnd.adobe.element.pattern+dcx",TEMPLATE_ELEMENT_TYPE:"application/vnd.adobe.element.template+dcx",TEXT_ELEMENT_TYPE:"application/vnd.adobe.element.text+dcx",ANIMATION_ELEMENT_TYPE:"application/vnd.adobe.element.animation+dcx",LIBRARY_TYPE:"application/vnd.adobe.library+dcx",GRADIENT_ELEMENT_TYPE:"application/vnd.adobe.element.gradient+dcx",COMPONENT_ELEMENT_TYPE:"application/vnd.adobe.element.component+dcx",AUDIO_ELEMENT_TYPE:"application/vnd.adobe.element.audio+dcx"},xP={MAX_ELEMENTS:1e4,MAX_REMOVED_ELEMENTS:2e3,MAX_COMPONENT_SIZE:1073741824,DL_NAMESPACE:"library",VALID_RELATIONS:["primary","rendition","alternate"],DEFAULT_GROUP_CLASSIFIER:"$default",ELEMENT_ACTIONS:["edit","openStock","editInSource"],LIBRARY_ACTIONS:["editInSource"],DOCUMENT_LIBRARY_ACTION_PRODUCT_MAP:{types:{"application/vnd.adobe.xd.cloudproject+dcx":["SPKR"]},products:{}},ELEMENT_ACTION_PRODUCT_MAP:{types:{"application/vnd.adobe.element.image+dcx":{"application/illustrator":["ILST_EDIT","ILST_PLACE","IDSN_PLACE"],"image/svg+xml":["ILST_EDIT","ILST_PLACE"],"application/vnd.adobe.indesign-idms":["IDSN_EDIT","IDSN_PLACE"],"image/vnd.adobe.photoshop":["PHXS_EDIT","PHXS_PLACE","IDSN_PLACE"],"application/photoshop":["PHXS_EDIT","PHXS_PLACE","IDSN_PLACE"],"application/photoshop.large":["PHXS_EDIT","PHXS_PLACE","IDSN_PLACE"],"image/png":["PHXS_EDIT","PHXS_PLACE","ILST_PLACE","IDSN_PLACE","PPRO_PLACE","AEFT_PLACE"],"image/jpeg":["PHXS_EDIT","PHXS_PLACE","ILST_PLACE","IDSN_PLACE","PPRO_PLACE","AEFT_PLACE"],"image/jpg":["PHXS_EDIT","PHXS_PLACE","IDSN_PLACE","ILST_PLACE","PPRO_PLACE","AEFT_PLACE"],"image/gif":["PHXS_EDIT","PHXS_PLACE","ILST_PLACE","IDSN_PLACE","PPRO_PLACE","AEFT_PLACE"],"image/bmp":["PHXS_EDIT","PHXS_PLACE","ILST_PLACE","IDSN_PLACE","PPRO_PLACE","AEFT_PLACE"],"image/x-portable-bitmap":["PHXS_EDIT","PHXS_PLACE"],"image/x-pict":["PHXS_EDIT","PHXS_PLACE"],"image/x-pcx":["PHXS_EDIT","PHXS_PLACE"],"image/x-portable-graymap":["PHXS_EDIT","PHXS_PLACE"],"image/x-portable-anymap":["PHXS_EDIT","PHXS_PLACE"],"image/x-portable-pixmap":["PHXS_EDIT","PHXS_PLACE"],"image/x-tga":["PHXS_EDIT","PHXS_PLACE"],"image/tiff":["PHXS_EDIT","PHXS_PLACE"],"image/vnd.wap.wbmp":["PHXS_EDIT","PHXS_PLACE"]},"application/vnd.adobe.element.text+dcx":{"application/illustrator-text":["ILST_EDIT_TEXT"],"application/vnd.adobe.indesign-idms-text":["IDSN_EDIT_TEXT"]},"application/vnd.adobe.element.template+dcx":{"image/vnd.adobe.photoshop.template":["PHXS_PLACE"],"application/illustrator.template":["ILST_PLACE"],"application/vnd.adobe.indesign.template":["IDSN_PLACE"]},"application/vnd.adobe.element.3d+dcx":{"application/vnd.adobe.obj.3d+zip":["ESHR_PLACE"]},"application/vnd.adobe.element.material+dcx":{"application/vnd.adobe.mdl.material+zip":["ESHR_PLACE"]},"application/vnd.adobe.element.light+dcx":{"application/vnd.adobe.ibl.light+zip":["ESHR_PLACE"]},"application/vnd.adobe.element.animation+dcx":{"application/vnd.adobe.animate-xfl+zip":["FLPR_EDIT"],"application/vnd.adobe.animate-sym+zip":["FLPR_EDIT"]}},products:{}},VECTOR_RENDITION_ELEMENT_TYPES:["application/illustrator"],ANALYTICS_ENABLED:!1},kP="cclibraries",HP="LIBS",jP=JSON.stringify({apiVersion:12}),UP=["start","limit","selector","type","orderBy","group","owner"],BP={OK:200,CREATED:201,ACCEPTED:202,NO_CONTENT:204,MULTIPLE_CHOICES:300,BAD_REQUEST:400,UNAUTHORIZED:401,FORBIDDEN:403,NOT_FOUND:404,CONFLICT:409,PRECONDITION_FAILED:412,UNSUPPOERTED_MEDIA_TYPE:415,IM_A_TEAPOT:418,INTERNAL_SERVER_ERROR:500,BAD_GATEWAY:502,SERVICE_UNAVAILABLE:503},FP="AbortError",VP=`${wP}-[a-f0-9]{8}-(?:[a-f0-9]{4}-){3}[a-f0-9]{12}`,KP=new RegExp(`^${VP}$`),GP=new RegExp(`(${VP})`),$P=()=>`${wP}-${bi.v4()}`;function WP(e){return KP.test(e)}const zP=e=>{const[t]=GP.exec(e)||[];return t},qP=e=>Object.assign({ownership:"private",groups:[],elements:[],documentationElements:[],deletable:!0,removedElements:[],areElementsLoaded:!0,isLibraryLoaded:!0,isWritable:!0,isParentWritable:!0,details:{elementCount:0,documentationElementCount:0,removedElementCount:0},removeType:"delete"},e);function YP(e){try{if(e&&"object"==typeof e&&!Array.isArray(e))return e;const t=JSON.parse(e);if(t&&"object"==typeof t&&!Array.isArray(t))return t}catch(e){return}}function QP(e){const t=XP(e);return t?JSON.stringify(t,Object.keys(t).sort()):""}const JP=new RegExp("([^/]+);node=(.*)");function XP(e){return YP(e)||function(e){const t=e.match(JP);if(!t)return;const[,i,s]=t;return{"dc:format":"application/vnd.adobe.library+dcx","stRef:documentID":i,"stRef:fromPart":`id=${s}`}}(e)}function ZP(e){var t;const i=XP(e);if(i)return{libraryAssetId:i["repo:assetId"],libraryId:i["stRef:documentID"],elementId:null===(t=i["stRef:fromPart"])||void 0===t?void 0:t.substring(3)}}function ew(e){e.sort(((e,t)=>t.size-e.size));const t=Math.ceil(e.length/6);return e.splice(0,t).reduce(((e,t)=>e+Math.round(t.size/1024*2.5)),0)}class tw extends We{constructor(e,t,i,s){var r;(function(e){const t=e;return!!t.code&&!!t.message})(e)&&(t=e.message,i=e.libraryId,s=null===(r=e._additionalInfo)||void 0===r?void 0:r.underlyingError,e=e.code),super(function(e){switch(e){case"EXCEEDS_QUOTA":return Be.FULL_CLOUD_STORAGE;case"LOGGED_OUT":case"NOT_ALLOWED":return Be.AUTHORIZATION_ERROR;case"NETWORK_ERROR":return Be.NETWORK_ERROR;case"NOT_SUPPORTED":case"NOT_IMPLEMENTED":return Be.UNSUPPORTED;default:return Be.UNKNOWN}}(e),t||"",{underlyingError:s}),this.libraryErrorCode=e,this.libraryId=i}get underlyingError(){var e;return null===(e=this._additionalInfo)||void 0===e?void 0:e.underlyingError}}class iw{constructor(){this._emitter=new Is}get DANGEROUS(){return{removeAllListeners:e=>(e?this._emitter.removeAllListeners(e):this._emitter.removeAllListeners(),this)}}addListener(e,t){return this._emitter.addListener(e,t),this}on(e,t){return this.addListener(e,t)}once(e,t){return this._emitter.once(e,t),this}removeListener(e,t){return this._emitter.removeListener(e,t),this}off(e,t){return this.removeListener(e,t)}setMaxListeners(e){return this._emitter.setMaxListeners(e),this}getMaxListeners(){return this._emitter.getMaxListeners()}listeners(e){return this._emitter.listeners(e)}rawListeners(e){return this._emitter.rawListeners(e)}emit(e,...t){return this._emitter.emit(e,...t)}listenerCount(e){return this._emitter.listenerCount(e)}prependListener(e,t){return this._emitter.prependListener(e,t),this}prependOnceListener(e,t){return this._emitter.prependOnceListener(e,t),this}eventNames(){return this._emitter.eventNames()}}class sw{static get instance(){return sw._loggerInstance||(sw._loggerInstance=new sw),sw._loggerInstance}setEventEmitter(e){this._eventEmitter=e}_loggerEvent(e,t){var i;null===(i=this._eventEmitter)||void 0===i||i.emit("messageLogged",new Ni(`[SAMJS LibraryContents] ${e}`,t))}log(e){this._loggerEvent(e,Tl.Info)}warn(e){this._loggerEvent(e,Tl.Warn)}error(e){this._loggerEvent(e,Tl.Err)}info(e){this._loggerEvent(e,Tl.Info)}debug(e){this._loggerEvent(e,Tl.Debug)}}var rw,nw=sw.instance;class ow{constructor(e){this.data=e}get config(){return this.data.config}get user(){return this.data.user}get ignoreRenditionGrids(){return this.data.ignoreRenditionGrids}get installedApps(){return this.data.installedApps||[]}get processInfo(){return this.data.processInfo}get environment(){return this.data.environment}get renditionSize(){return this.data.config.RENDITION_SIZES}get fullRenditionConfig(){return this.data.config.FULL_RENDITION_CONFIG}}class aw extends Error{constructor(e){super(e),Object.setPrototypeOf(this,new.target.prototype)}}function cw(e,t){return new Promise(((i,s)=>{const r=()=>{clearTimeout(n),null==t||t.removeEventListener("abort",r),s(new DOMException("Request aborted","AbortError"))},n=setTimeout((()=>{null==t||t.removeEventListener("abort",r),i()}),e);t&&(t.addEventListener("abort",r),t.aborted&&r())}))}!function(e){e[e.RESOLVE=0]="RESOLVE",e[e.REJECT=1]="REJECT"}(rw||(rw={}));const lw=(...e)=>{const t=new AbortController,i=()=>{t.abort(),e.forEach((e=>e.removeEventListener("abort",i)))};return e.some((e=>e.aborted))?i():e.forEach((e=>e.addEventListener("abort",i))),t.signal},dw=new class{constructor(){this.signalToReasonMap=new WeakMap}getSignal(e){var t;return null!==(t=e.signal)&&void 0!==t?t:e}reason(e){return this.signalToReasonMap.get(this.getSignal(e))}give(e,t){this.signalToReasonMap.set(this.getSignal(e),t)}};var uw;async function hw(e){var t,i,s,r;const n=[];try{for(var o,a=!0,c=et(e);!(t=(o=await c.next()).done);){r=o.value,a=!1;try{const e=r;n.push(...e)}finally{a=!0}}}catch(e){i={error:e}}finally{try{a||t||!(s=c.return)||await s.call(c)}finally{if(i)throw i.error}}return n}!function(e){e.CONNECTED="connected",e.CONNECTING="connecting",e.LOADING="loading",e.ERROR="error"}(uw||(uw={}));class pw extends iw{constructor(e,t){super(),this._connector=t,this._isConnected=!1,this._failedConnectionAttempt=!1,this._options={},this._config=new ow({config:{},environment:"production"}),this._cachedFetch=function(e){const t=new Map;return(...i)=>{const s=JSON.stringify(i),r=t.get(s);if(r)return r;const n=e.apply(void 0,i);return t.set(s,n),setTimeout((()=>n.finally((()=>t.delete(s))))),n}}(fetch),this._loadElementsAbortController=new AbortController,this._core=e}get config(){return this._config}get environment(){return this._config.environment}get token(){return this._token}get isConnected(){return this._isConnected}get connectionState(){return this._failedConnectionAttempt?uw.ERROR:this.isConnected?uw.CONNECTED:this._connectionPromise?uw.CONNECTING:uw.LOADING}resetAbortController(){this._abortController=new AbortController}get abortController(){return this._abortController}init(e={},t=(()=>{}),i=(()=>{})){return this._options=Object.assign(Object.assign({},this._options),e),this.on("connect",t),this.on("disconnect",i),this._options.skipConnectingOnInit?Promise.resolve():this.connect()}get _isConnectingOrConnected(){return Boolean(this._abortController&&!this._abortController.signal.aborted)}connect(){return this._isConnectingOrConnected||(this.resetAbortController(),this._connectionPromise=this._connect(),this.emit("connecting")),this._connectionPromise}async _attemptToConnect(e){const t=async t=>{try{const{future:i,cancel:s}=function(e,t){let i;return{future:new Promise(((...t)=>{i=setTimeout(t[e],1e4)})),cancel:()=>clearTimeout(i)}}(rw.REJECT),r=new AbortController,n=await Promise.race([this._connector(r.signal),i]).finally((()=>{r.abort(),s()}));return(null==e?void 0:e.aborted)?t(!1):(await this._handleConnected(n),this._isConnected=!0,t(!0))}catch(e){return t(!1)}};return new Promise((e=>t(e))).then((e=>(this._failedConnectionAttempt=!e,this._failedConnectionAttempt&&this.emit("failedConnection"),e)))}async _connect(){var e;const t=null===(e=this._abortController)||void 0===e?void 0:e.signal;for(let e=0;!await this._attemptToConnect(t);e+=1){if(void 0!==this._options.retryCount&&this._options.retryCount<=e)return void nw.log(`[DRIVER] Failed to connect to server (Attempt: ${e}). Exceeded max retries.`);const i=1e3*CP[Math.min(e,CP.length-1)];nw.log(`[DRIVER] Failed to connect to server (Attempt: ${e}). Will retry in ${i}ms.`);try{await cw(i,t)}catch(e){if(e instanceof Error&&"AbortError"===e.name)return;throw e}}this.emit("connect",this)}disconnect(){var e,t;null===(e=this._abortController)||void 0===e||e.abort(),this._isConnected=!1,this._failedConnectionAttempt=!1,null===(t=this._handleDisconnected)||void 0===t||t.call(this),this.emit("disconnect",this)}async reconnect(){nw.warn("Process restart. Attempting to reconnect"),this.disconnect(),await this.connect()}sleep(e,t){var i,s;return cw(e,t&&(null===(i=this._abortController)||void 0===i?void 0:i.signal)?lw(t,this._abortController.signal):null===(s=this._abortController)||void 0===s?void 0:s.signal)}getAllLibraries(e,t){return hw(this.getLibraries(e,t))}getAllElements(e,t,i){return hw(this.getElements(e,t,i))}getAllDocumentationElements(e,t,i){return hw(this.getDocumentationElements(e,t,i))}getAllRemovedElements(e,t,i){return hw(this.getRemovedElements(e,t,i))}getAllGroups(e){return hw(this.getGroups(e))}publishBrand(e){throw new tw("NOT_IMPLEMENTED","Driver.publishBrand is not implemented.")}unpublishBrand(e){throw new tw("NOT_IMPLEMENTED","Driver.unpublishBrand is not implemented.")}setRenditionCacheChangeListener(e){}addWatchedLibrary(e){}removeWatchedLibrary(e){}addLibrariesSyncGroupListener(e){}removeLibrariesSyncGroupListener(){}operationFactory(e,t,i){return new e(t,i)}getOperationTypes(e){return this._operationTypes}constructOperation(e){var t;if(0===e.actions.length)return;if(this._options.readOnly)throw new tw("NOT_ALLOWED","Cannot perform write action -- in read-only mode.");const i=null===(t=this.getOperationTypes(e))||void 0===t?void 0:t.find((t=>t.supportsAction(e.actions[0])));if(!i)throw new Error;const s=this.operationFactory(i,this,e);for(const t of e.actions)if(!s.addAction(t))break;return s}getLocalSettings(){var e;const t=null!==(e=this._localStorage)&&void 0!==e?e:new Map;return{config:Object.fromEntries(t.entries())}}}class _w extends iw{constructor(){super(...arguments),this._abortController=new AbortController,this._isComplete=!1,this._progress=0}abort(){this.DANGEROUS.removeAllListeners(),this._abortController.abort()}get isComplete(){return 100===this.progress}get progress(){return this._progress}set progress(e){this._progress=Math.min(e,100)}}class mw extends We{static isRequestError(e){return!!e.code}constructor(e,t,i,s){super(function(e){switch(e){case"UNAUTHORIZED":case"INVALID_CREDENTIALS":return U.AUTHORIZATION_ERROR;case"REQUEST_TIMEOUT":return U.REQUEST_TIMED_OUT;case"OUT_OF_SPACE":return U.FULL_LOCAL_DISK_SPACE;case"NOT_FOUND":case"ENOENT":return U.NOT_FOUND;default:return U.UNKNOWN}}(e),t,{underlyingError:s}),this._requestErrorCode=e,this._response=i}get requestErrorCode(){return this._requestErrorCode}get response(){return this._response}get underlyingError(){return this._additionalInfo.underlyingError}set underlyingError(e){this._additionalInfo.underlyingError=e}setResponse(e){return this.response?nw.warn("Request Error response reference is already set."):this._response=e,this}}function fw(e,t){return gw(null==e?void 0:e.status,t).setResponse(e)}function gw(e,t){switch(e){case 304:return new mw("NOT_MODIFIED","Response has not changed.");case 401:return new mw("UNAUTHORIZED","Token expired or invalid");case 403:return new mw("INVALID_CREDENTIALS","You do not have access to this resource.");case 404:return new mw("ENOENT"===t?t:"NOT_FOUND","Resource not found");case 408:return new mw("REQUEST_TIMEOUT","Server could not respond in a timely manner");case 412:return new mw("PRECONDITION_FAILED","This resource does not match the requisite conditions.");case 422:return new mw("INVALID_DATA","Library is corrupt, unzipping failed.");case 507:return new mw("OUT_OF_SPACE","Hard disk ran out of space.");default:return new mw("GENERIC_ERROR",`Something went wrong: ${e}`)}}function yw(e){const t=fw(e._additionalInfo.response);return t.underlyingError=e,t}class vw{constructor(e,t,i,s,r){this.url=e,this.headers=t,this.status=i,this.statusText=s,this._text=r}get ok(){const{status:e}=this;return e>=BP.OK&&e<BP.MULTIPLE_CHOICES}get redirected(){return!1}get type(){return"basic"}async json(){try{return JSON.parse(this._text)}catch(e){throw new tw("INVALID_DATA",`Failed to parse JSON response from '${this.url}' async request.`,void 0,e)}}async text(){return this._text}get trailer(){throw new tw("NOT_IMPLEMENTED","AsyncResponse.trailer not implemented.")}clone(){const e=new Headers;return this.headers.forEach(((t,i)=>e.set(i,t))),new vw(this.url,e,this.status,this.statusText,this._text)}get bodyUsed(){throw new tw("NOT_IMPLEMENTED","AsyncResponse.bodyUsed not implemented.")}get body(){throw new tw("NOT_IMPLEMENTED","AsyncResponse.body not implemented.")}async arrayBuffer(){throw new tw("NOT_IMPLEMENTED","AsyncResponse.arrayBuffer not implemented.")}async blob(){throw new tw("NOT_IMPLEMENTED","AsyncResponse.blob not implemented.")}async formData(){throw new tw("NOT_IMPLEMENTED","AsyncResponse.formData not implemented.")}}const Ow=function(){let e=33;const t=["^(["];for(let i=34;i<=127;++i)127!==i&&-1==='()<@,;:"/[]={}'.indexOf(String.fromCharCode(i))||(t.push("\\"+e.toString(8)),e<i-1&&t.push("-\\"+(i-1).toString(8)),e=i+1);return t.push("]+):(.*)$"),new RegExp(t.join(""))}(),bw=/^[^\s]+\s+(\d+)\s*(.*)$/;class Iw{constructor(e){this._text=e,this._index=0}readLine(){const{_index:e,_text:t}=this,i=t.indexOf("\n",e);if(-1===i)return;this._index=i+1;let s=t.slice(e,i);return s.endsWith("\r")&&(s=s.slice(0,-1)),s}get remainderText(){return this._text.slice(this._index)}}class Ew extends _w{constructor(e,t){super(),this._driver=e,this._handleResponse(t)}cancel(){this.abort(),this._location&&(this._driver.abortOperation(this._location),this._location=void 0)}get error(){return this._error}async _handleResponse(e){var t;try{const i=await e;if([BP.NO_CONTENT,BP.OK].includes(i.status)){let e,t,s;if(this.progress=100,i.status===BP.OK&&(t=await i.text().then((t=>(e=t,function(e,t){if(!t)throw new tw("INVALID_DATA","Invalid async response body.");const i=new Iw(t);let s,r;const n=i.readLine();if(n){const e=n.match(bw);if(!e)throw new tw("INVALID_DATA","Invalid status line for async response.");if(s=parseInt(e[1],10),!s)throw new tw("INVALID_DATA","Could not find status code for async response.");r=e[2]}else s=BP.OK,r="";const o=[];let a,c=i.readLine();for(;c;){const e=c.match(Ow);e?(a=e[1],o.push([a,e[2]])):a&&o.push([a,c]),c=i.readLine()}return new vw("",new Headers(o),s,r,i.remainderText)}(0,t)))).then((e=>(s=e.headers,e.json().catch((()=>{}))))).catch((()=>JSON.parse(e))).catch((()=>{nw.error(`Error parsing async response: ${i}`)}))),null==t?void 0:t.exception_code)throw new mw(t.status,t.message,i,t);return this.emit("change",!0,t,s),void this.DANGEROUS.removeAllListeners()}if(i.status===BP.ACCEPTED){let e={};try{e=await i.json()}catch(e){}e.progress&&(this.progress=e.progress,this.emit("change"));const s=null!==(t=i.headers.get("location"))&&void 0!==t?t:e.href;s&&(this._location=s);const r=i.headers.get("retry-after")?parseInt(i.headers.get("retry-after"),10):1;if(!this._location)throw new mw("MALFORMED_RESPONSE","Location header is missing from ops monitor response");return await this._driver.sleep(1e3*r,this._abortController.signal),this._handleResponse(this._driver.fetch(this._location,{signal:this._abortController.signal}))}throw new mw("UNEXPECTED_RESPONSE",`Unexpected response from ops monitor: ${i.status}`)}catch(e){this._error=e,this.progress=100,this.emit("change",!0),this.DANGEROUS.removeAllListeners()}}}const Tw={staging:{hostname:gs[as.Stage].MELVILLE_EDGE_HOST,invitation_hostname:"invitations-stage.adobe.io",teams_hostname:"ccprojects-stage.adobe.io",platform_hostname:"platform-cs-stage.adobe.io"},production:{hostname:gs[as.Production].MELVILLE_EDGE_HOST,invitation_hostname:"invitations.adobe.io",teams_hostname:"ccprojects.adobe.io",platform_hostname:"platform-cs.adobe.io"}};function Sw(e,t,i){const s=i.value;i.value=async function(...e){if(0===this._actions.length)throw new tw("NOT_SUPPORTED","Operation must have at least one action to be executed.",this._library.id);return nw.log(`[OPERATION] Performing ${this._actions.length} actions.`),s.apply(this,e)}}class Aw{static supportsAction(e){return this.prototype.supportsAction(e)}constructor(e,t){this._actions=[],this._driver=e,this._library=t}addAction(e){return!!this.supportsAction(e)&&(this._actions.push(e),!0)}get actions(){return this._actions}}class Pw extends Aw{constructor(){super(...arguments),this._actionMappers={}}get action(){return this._actions[0]}async execute(){return{actions:[await this._actionMappers[this.action.name||""](this.action)]}}addAction(e){return 1!==this._actions.length&&super.addAction(e)}}Ye([Sw],Pw.prototype,"execute",null);const ww="platform-cs",Cw=`${ww}-edge`,Rw=[`https://${ww}.adobe.io/index`,`https://${ww}-stage.adobe.io/index`],Lw={Priority:"u=1"};function Nw(e){const t=e.split(".");if(3===t.length)try{return JSON.parse(atob(t[1]))}catch(e){return}}function Dw(e){const t=Nw(e);if(t)return{user:{id:t.user_id,clientId:t.client_id}}}function Mw(e){const t=Nw(e);if(t){const e=Date.now()-parseInt(t.created_at,10);return Math.max(parseInt(t.expires_in,10)-e,0)}}function xw(e){let t;try{t=new URL(e)}catch(t){return{url:e,headers:{}}}return t.hostname.includes(ww)?(Rw.includes(e)&&(t.hostname=t.hostname.replace(ww,Cw)),{url:t.href,headers:Object.assign({},Lw)}):{url:e,headers:{}}}function kw(e,t=200){const{renditionUrl:i={}}=e.data,{template:s,substitutions:r={}}="string"==typeof i?{template:i}:i;if(s){const e=mt(s).fill(Object.assign(Object.assign({},r),{size:`${t}`,type:"image/png"})),{url:i}=xw(e);return i}}var Hw;function jw(e,t=e.manifest.data){var i,s,r,n,o,a,c;const l=null===(i=e.manifest)||void 0===i?void 0:i.etag,d=Uw(e,null===(s=t.children)||void 0===s?void 0:s.find((e=>"elements"===e.name))),u=Uw(e,null===(r=t.children)||void 0===r?void 0:r.find((e=>"removed_elements"===e.name))),h=Uw(e,null===(n=t.children)||void 0===n?void 0:n.find((e=>"documentation_elements"===e.name))),p=null===(o=t.children)||void 0===o?void 0:o.find((e=>"groups"===e.name)),_=(null===(a=null==p?void 0:p.children)||void 0===a?void 0:a.map((e=>({id:e.id,name:e.name,classifier:e["library#classifier"],order:e["library#order"],parentId:e["library#parentId"],sourceRef:e["library#sourceRef"],customData:Vw(e)}))))||[],m={id:t.id,name:t.name,etag:l,localizedNames:t["library#localizedName"],toolkitId:t["toolkit#id"],documentId:t["library#documentId"],documentType:t["library#documentType"],createdBy:e.createdBy,modifiedBy:e.modifiedBy,createdDate:e.created.valueOf(),modifiedDate:e.modified.valueOf(),version:t.components&&t.components[0].version,roles:t["library#roles"],description:t["library#description"],details:{elementCount:d.length,documentationElementCount:h.length,removedElementCount:u.length},groups:_,elements:d,documentationElements:h,removedElements:u,customData:Vw(t),isLibraryLoaded:!0,areElementsLoaded:!0,appMetadata:null===(c=e.appMetadata)||void 0===c?void 0:c.data};return t.components&&t.components[0].version&&(m.version=t.components[0].version),m}function Uw(e,t){var i;return t&&(null===(i=t.children)||void 0===i?void 0:i.map((t=>{const i={id:t.id,name:t.name,isAutoNamed:t["library#autoName"],type:t.type,tags:t.tags||[],dependencyIds:t["library#dependencies"]||[],localizedNames:t["library#localizedName"],createdDate:t["library#created"],createdLocally:!1,createdContext:t["library#createdData"]||{},modifiedDate:t["library#modified"],modifiedLocally:!1,description:t["library#description"],descriptionModifiedLocally:!1,removedLocally:!1,representations:Fw(e,t),groups:t["library#groups"]?Object.entries(t["library#groups"]).map((([e,{order:t}])=>{const[i,s]=e.split("#");return{id:s,classifier:i,order:t}})):[],sourceRef:t["library#sourceRef"],roles:t["library#roles"],customData:Vw(t)};return function(e,t){var i;const s=e.links[Hw.RENDITION],r=null===(i=null==s?void 0:s[0])||void 0===i?void 0:i.href,n=function(e=[]){let t,i=0;for(const s of e){const e=s.isFullSize?Number.POSITIVE_INFINITY:Math.max(s.height||0,s.width||0);(!t||s.isPreferredThumbnail&&!t.isPreferredThumbnail||"primary"===s.relationship&&"primary"!==t.relationship||"rendition"===s.relationship&&!["primary","rendition"].includes(null==t?void 0:t.relationship)||"rendition"===s.relationship&&"rendition"===t.relationship&&e>i)&&PP(s.type)&&(t=s,i=e)}return t}(t.representations);n&&(t.renditionUrl={template:r,substitutions:{fragment:`id=${n.id}`,size:200}})}(e,i),i})))||[]}function Bw(e,t){var i;const s=e.links[Hw.COMPONENT],r=null===(i=null==s?void 0:s[0])||void 0===i?void 0:i.href,n=r&&mt(r);return null==n?void 0:n.fill({revision:t.version,component_id:t.id})}function Fw(e,t){var i,s;return[...(null===(i=t.components)||void 0===i?void 0:i.map((t=>({id:t.id,type:t.type,relationship:t.rel,url:Bw(e,t),isFullSize:t["library#isFullSize"]||t["library#isfullSize"],isExternalLink:!1,width:t.width,height:t.height,contentLength:t.length,isPreferredThumbnail:t["library#isPreferredThumbnail"],customData:Vw(t)}))))||[],...(null===(s=t.children)||void 0===s?void 0:s.map((e=>({id:e.id,type:e.type,linktype:e["library#linktype"],relationship:e["library#rel"],isFullSize:!1,isExternalLink:!1,customData:Vw(e)}))))||[]]}function Vw(e){const t={};for(const[i,s]of Object.entries(e)){const[e,r]=i.split("#");"library"!==e&&r&&(t[i]=s)}return t}!function(e){e.DOWNLOAD="http://ns.adobe.com/adobecloud/rel/download",e.MANIFEST="http://ns.adobe.com/adobecloud/rel/manifest",e.APPLICATION="http://ns.adobe.com/adobecloud/rel/metadata/application",e.EMBEDDED="http://ns.adobe.com/adobecloud/rel/metadata/embedded",e.REPOSITORY="http://ns.adobe.com/adobecloud/rel/metadata/repository",e.PRIMARY="http://ns.adobe.com/adobecloud/rel/primary",e.RENDITION="http://ns.adobe.com/adobecloud/rel/rendition",e.COMPONENT="http://ns.adobe.com/adobecloud/rel/component",e.RESOLVE="http://ns.adobe.com/adobecloud/rel/resolve/id",e.BLOCK_INIT="http://ns.adobe.com/adobecloud/rel/block/init",e.BLOCK_TRANSFER="http://ns.adobe.com/adobecloud/rel/block/transfer",e.BLOCK_FINALIZE="http://ns.adobe.com/adobecloud/rel/block/finalize"}(Hw||(Hw={}));const Kw=/^[A-Z0-9]{30}$/,Gw=["color#data","colortheme#data","channel#data","imageguideline#data","gradient#data","audio#data","font#data","characterstyle#data","paragraphstyle#data","text#data","3d#data","video#data","pattern#data","candy#data","graphic#data","clio#data","firefly#cme"];function $w(e){var t,i;const s={id:null!==(t=e.elementId)&&void 0!==t?t:bi.v4(),name:"temp rendition element",type:e.type,createdDate:Date.now(),modifiedDate:Date.now(),representations:[{id:bi.v4(),type:e.rendition_mimetype,relationship:"primary",isFullSize:!1,isExternalLink:!1,isPreferredThumbnail:!0}],groups:[]};switch(e.type){case"application/vnd.adobe.gradient.noise+json":case"href":s.type="application/vnd.adobe.element.image+dcx",s.renditionUrl=e.rendition,s.representations[0].type="image/png",s.representations[0].url=e.rendition;break;case"application/vnd.adobe.color+json":case"application/vnd.adobe.element.color+dcx":s.representations[0].customData={"color#data":null===(i=e.rendition.swatches[0])||void 0===i?void 0:i.find((e=>"RGB"===e.mode))};break;case"application/vnd.adobe.colortheme+json":case"application/vnd.adobe.element.colortheme+dcx":s.representations[0].type="application/vnd.adobe.colortheme+json",s.representations[0].customData={"colortheme#data":e.rendition};break;case"application/vnd.adobe.gradient+json":case"application/vnd.adobe.element.gradient+dcx":s.representations[0].customData={"gradient#data":e.rendition};break;default:return}return s}function Ww(e){return"public"===e.ownership&&Kw.test(e.id)}function zw(e,t=!1,i=!1){var s,r,n,o;const a=e.manifest_etag||'""',c=!t&&(e=>{const t=e.asset_acl;if(!t)return;const i=t["http://ns.adobe.com/adobecloud/rel/primary"];if(i)return i.includes("write");const s=t["*"];return!!s&&s.includes("write")})(e),l=Object.assign({id:"public"===e.ownership&&(null===(s=e.bookmark)||void 0===s?void 0:s.id)||e.id,name:e.name,ownership:"team"===e.ownership?"incoming":e.ownership,etag:a,version:e.version,default:e.default,localizedNames:e.localized_names,toolkitId:e.toolkit_id,documentId:e.document_id,documentType:e.document_type,createdDate:e.created_date,modifiedDate:e.modified_date,createdBy:e.created_by,modifiedBy:e.modified_by,groups:null===(r=e.groups)||void 0===r?void 0:r.map(Yw),details:{elementCount:e.elements_count,documentationElementCount:0,removedElementCount:e.removed_elements_count},appMetadata:e.application_metadata,collaboration:e.collaboration,assetId:e.library_urn,isWritable:c,isParentWritable:!0,removeType:c?"discard":"none",deletable:c,roles:e.roles,description:e.description,owner:null===(n=e.storage_assignee)||void 0===n?void 0:n.id,ownerType:e.ownership?"team"===e.ownership?"org":"user":void 0,customData:Vw(e),isLibraryLoaded:!0,publicLinkId:Ww(e)?e.id:void 0,bookmark:e.bookmark},i?function(e,t){var i;if(!e||!e.main)return{};const s=$w(e.main),r=(null===(i=e.tiles)||void 0===i?void 0:i.filter(Boolean).map($w))||[];return{renditionGrid:{main:s?{id:s.id}:void 0,tiles:r.map((e=>e?{id:e.id}:void 0)).filter(Boolean),gridGenerationEtag:t},elements:[s,...r].filter(Boolean)}}(e.rendition_grid,a):{});return(e.workspace_urn||e.parent_assetId)&&(l.team={id:null!==(o=e.workspace_urn)&&void 0!==o?o:e.parent_assetId}),l}function qw(e){var t,i,s,r,n;return{id:e.id,name:e.name,isAutoNamed:e.is_auto_named,type:e.type,tags:e.tags||[],dependencyIds:e.dependency_ids||[],localizedNames:e.localized_names||{},createdDate:e.created_date,createdLocally:!1,createdContext:(null===(t=e.details)||void 0===t?void 0:t.created)||{},modifiedDate:e.modified_date,modifiedLocally:!1,description:null===(i=e.details)||void 0===i?void 0:i.description,descriptionModifiedLocally:!1,removedLocally:!1,representations:(null===(s=e.representations)||void 0===s?void 0:s.map(Jw))||[],renditionUrl:"href"===(null===(r=e.thumbnail)||void 0===r?void 0:r.type)&&e.thumbnail.rendition,groups:(null===(n=e.groups)||void 0===n?void 0:n.map(Qw))||[],sourceRef:e.sourceRef,roles:e.roles,customData:Vw(e),libraryAssetId:e.parent_id}}function Yw(e){return{id:e.id,classifier:e.classifier,name:e.name,order:e.order,parentId:e.parent_id,createdDate:e.created_date,modifiedDate:e.modified_date,sourceRef:e.sourceRef}}function Qw(e){return{id:e.id,classifier:e.classifier,order:e.order}}function Jw(e){var t,i,s,r;return{id:e.id,type:e.type,linktype:e.linktype,relationship:e.relationship,isFullSize:e.is_full_size,isExternalLink:e.is_external_link,height:e.height,width:e.width,contentLength:e.content_length,url:null===(i=null===(t=e._links)||void 0===t?void 0:t["http://ns.adobe.com/melville/rel/primary"])||void 0===i?void 0:i.href,blockDownloadUrl:null===(r=null===(s=e._links)||void 0===s?void 0:s["http://ns.adobe.com/melville/rel/download"])||void 0===r?void 0:r.href,customData:{"channel#data":e["channel#data"],"imageguideline#data":e["imageguideline#data"],"color#data":e["color#data"],"characterstyle#data":e["characterstyle#data"],"paragraphstyle#data":e["paragraphstyle#data"],"gradient#data":e["gradient#data"],"colortheme#data":e["colortheme#data"],"font#data":e["font#data"],"adobestock#trackingdata":e["adobestock#trackingdata"],"firefly#cme":e["firefly#cme"]}}}function Xw(e){return{name:e.name,id:e.id,isWritable:"editor"===e.collaboratorRole,owner:e.repositoryOwner,ownerName:e.repositoryName}}function Zw(e){var t;return Object.assign({id:e.id,name:e.name,roles:e.roles,description:e.description,tags:e.tags,sourceRef:e.sourceRef,group:null===(t=e.groups)||void 0===t?void 0:t[0]},iC(e.customData))}function eC(e){return{id:e.id,libraryAssetId:e.parent_id,name:e.name,type:e.type,createdDate:e.created_date,modifiedDate:e.modified_date,renditionUrl:e.thumbnail.rendition,tags:e.tags,roles:e.roles,representations:e.representations.map(Jw),groups:(e.groups||[]).map(Qw)}}function tC(e){var t,i,s,r,n;const o=(null==(a=e.source)?void 0:a.id)&&(null==a?void 0:a.storage_href)&&(null==a?void 0:a.asset_id)&&(null==a?void 0:a.type)&&(null==a?void 0:a.content_length)&&(null==a?void 0:a.etag)&&(null==a?void 0:a.version)?e.source:void 0;var a;return Object.assign({id:null!==(t=null==o?void 0:o.id)&&void 0!==t?t:e.id,type:null!==(i=null==o?void 0:o.type)&&void 0!==i?i:e.type,relationship:e.relationship,path:e.path,is_full_size:e.isFullSize,is_external_link:e.isExternalLink,width:null!==(s=null==o?void 0:o.width)&&void 0!==s?s:e.width,height:null!==(r=null==o?void 0:o.height)&&void 0!==r?r:e.height,content_length:null!==(n=null==o?void 0:o.content_length)&&void 0!==n?n:e.contentLength,is_preferred_thumbnail:e.isPreferredThumbnail,name:null==o?void 0:o.name,storage_href:null==o?void 0:o.storage_href,asset_id:null==o?void 0:o.asset_id,etag:null==o?void 0:o.etag,md5:null==o?void 0:o.md5,version:null==o?void 0:o.version},iC(e.customData,Gw))}function iC(e={},t){const i={};for(const[s,r]of Object.entries(e)){const e=s;!(null==t?void 0:t.includes(e))&&t||(i[e]=r)}return i}function sC(e,t){var i;return Object.assign(Object.assign({},Zw(e)),{client:t,type:e.type,representations:null===(i=e.representations)||void 0===i?void 0:i.map(tC)})}const rC=e=>e.map((e=>{const{id:t,version:i}=e,s=qe(e,["id","version"]);return Object.assign(Object.assign({},s),{"repo:assetId":t,"repo:version":i})})),nC={read:"team_view",all:"team_edit"},oC=["createLibrary","removeLibrary","unfollowLibrary","leaveLibrary","permanentlyDeleteLibrary","copyLibrary","moveLibrary"];let aC=class extends Pw{constructor(){super(...arguments),this._actionMappers={createLibrary:e=>this._createLibraryActionMap(e),copyLibrary:e=>this._createLibraryActionMap(e),removeLibrary:async e=>(await this._removeLibrary(),e),permanentlyDeleteLibrary:async e=>(await this._permanentlyDeleteLibrary(),e),unfollowLibrary:async e=>(await this._unfollowLibrary(),e),leaveLibrary:async e=>(await this._leaveLibrary(),e),moveLibrary:async e=>{const t=await this._moveLibrary();return Object.assign(Object.assign({},e),{data:t,originalAction:e})}},this._createLibraryActionMap=async e=>{const t=await this._createLibrary(e);return Object.assign(Object.assign({},e),{type:"update",data:t,originalAction:e})}}supportsAction(e){return oC.includes(e.name)}_createLibrary(e){return new Promise(((t,i)=>{var s,r;const{name:n,team:o,roles:a,documentExtractionData:c}=null!==(s=e.data)&&void 0!==s?s:{},{permissionInheritance:l,source:d,includeAppMetadata:u}=null!==(r=e.flags)&&void 0!==r?r:{},h={name:n,roles:a,documentExtractionData:(null==c?void 0:c.length)>0?rC(c):void 0,source:null==d?void 0:d.assetId,parent_assetId:null==o?void 0:o.id,access:nC[l]||void 0,includeResources:u?[{relType:"http://ns.adobe.com/adobecloud/rel/metadata/application"},{relType:"http://ns.adobe.com/adobecloud/rel/primary"}]:void 0},p=this._driver.fetch("/api/v1/libraries?invocation_mode=async",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(h)}),_=new Ew(this._driver,p);_.on("change",((e,s)=>{if(e)if(_.error)i(_.error);else if(s){const e=zw(s);(null==c?void 0:c.length)>0&&e.assetId&&this._patchBrandAppMetadata(e.assetId,"/brand:extractedFrom",rC(c)),e.isWritable=!0,e.isParentWritable=!0,t(e)}else t(void 0)}))}))}_removeLibrary(){return this._driver.fetch(`/api/v1/libraries/${this._library.assetId}`,{method:"DELETE"})}_permanentlyDeleteLibrary(){return this._driver.fetch(`/api/v1/libraries/${this._library.assetId}?permanent=true`,{method:"DELETE"})}_unfollowLibrary(){var e;return this._driver.fetch(`/api/v1/libraries/bookmarks/${null===(e=this._library.bookmark)||void 0===e?void 0:e.id}`,{method:"DELETE"})}async _leaveLibrary(){var e,t;const i=null===(e=this._driver.config.user)||void 0===e?void 0:e.id,s=await this._driver.fetch(`https://${this._driver.driverConfig.invitation_hostname}/api/v4/share/${this._library.assetId}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({collaborators:[{action:"remove",id:i}]})});if(null===(t=(await s.json()).collaborators)||void 0===t?void 0:t.find((e=>e.statusCode>300)))throw fw(s);return this._unfollowLibrary()}_moveLibrary(){return this._driver.moveLibrary(this._library.assetId,this.action.data.team.id,this.action.data.owner)}async _patchBrandAppMetadata(e,t,i){var s;const r=await(null===(s=this._driver._core)||void 0===s?void 0:s.hostAssetContext.getAssetWithCloudID(e));null==r||r.patchAppMetadata([{op:"add",path:t,value:i}])}};Ye([rA],aC.prototype,"_createLibrary",null),aC=Ye([sA("CloudSingleOperation")],aC);var cC=aC;const lC=e=>e.replace(/ |\t|\n/g,""),dC=/^(\$\.(?:elements|removedElements|documentationElements))\[\?\(@\.id=="([^"]+)"\)\]$/,uC=/^\$\.groups\[\?\(@\.id=="([^"]+)"\)\]$/;function hC(e){e=lC(e);const[,,t]=dC.exec(e)||[];return t}function pC(e){e=lC(e);const[,t]=dC.exec(e)||[];return t}function _C(e){e=lC(e);const[,t]=uC.exec(e)||[];return t}class mC extends Aw{supportsAction(e){return["moveElement","copyElement","dependent"].includes(e.name)}addAction(e){var t,i,s,r,n,o;if(!this.supportsAction(e))return!1;const a=this._actions[this._actions.length-1];return a||"dependent"===e.name?e.library===(null===(t=e.link)||void 0===t?void 0:t.library)?"dependent"===e.name?a.link===e&&(this._actions.push(e),!0):(null===(i=e.library)||void 0===i?void 0:i.actions.indexOf(e))+1===(null===(r=null===(s=e.link)||void 0===s?void 0:s.library)||void 0===r?void 0:r.actions.indexOf(e.link))&&super.addAction(e):(null===(n=a.link)||void 0===n?void 0:n.library)===(null===(o=e.link)||void 0===o?void 0:o.library)&&a.type===e.type&&super.addAction(e):super.addAction(e)}async execute(){var e;const t="moveElement"===this._actions[0].name,i=null===(e=this._actions[0].link)||void 0===e?void 0:e.library,s=this._actions.filter((e=>"dependent"!==e.name)),r=s.map((e=>hC(e.path))),{elements:n,etag:o,sourceEtag:a}=await this._doMoveCopyRequest(t,this._library,i,r);if(n.length!==s.length)throw new Error;let c,l;return i===this._library?(c=[],l=this._actions.map((e=>{if("dependent"!==e.name)return e;const t=s.findIndex((t=>t===e.link||t.originalAction===e.link));return Object.assign(Object.assign({},e),{data:n[t],originalAction:e})}))):(l=this._actions,c=this._actions.map(((e,t)=>Object.assign(Object.assign({},e.link),{data:n[t],originalAction:e.link})))),{actions:l,etag:a,linkedActions:c,linkedEtag:o}}}Ye([Sw],mC.prototype,"execute",null);class fC extends mC{async _doMoveCopyRequest(e,t,i,s){const r=this._library.assetId,n=i.assetId,o=await this._driver.fetch(`/api/v1/libraries/${n}/elements`,{method:"POST",headers:{"Content-Type":"application/json","If-Match":i.etag},body:JSON.stringify({[e?"self":"source"]:{id:r,elements:s,"if-match":this._library.etag}})});return{elements:(await o.json()).elements.map(qw),etag:o.headers.get("etag"),sourceEtag:o.headers.get("x-source-etag")}}}function gC(e){return"undefined"!=typeof structuredClone?structuredClone(e):JSON.parse(JSON.stringify(e))}function yC(e,t,i){var s;const r=i.reduce(((e,i)=>i(e,t)),e);return r!==e&&(r.originalAction=e),"aggregate"===r.type&&(r.actions=null===(s=r.actions)||void 0===s?void 0:s.map((e=>yC(e,t,i)))),r}function vC(e,t){var i,s,r;t||(t=e);const n={};for(const t of e)WP(null===(s=null===(i=t.originalAction)||void 0===i?void 0:i.data)||void 0===s?void 0:s.id)&&(n[null===(r=t.originalAction)||void 0===r?void 0:r.data.id]=t.data);const o=[OC,bC,IC];return t.map((e=>yC(e,n,o)))}function OC(e,t){var i;const s=e.path&&function(e){const t=hC(e)||_C(e);return WP(t)&&t}(e.path);if(s){const a=null===(i=t[s])||void 0===i?void 0:i.id;if(a)return Object.assign(Object.assign({},e),{path:(r=e.path,n=s,o=a,r.replace(n,o))})}var r,n,o;return e}function bC(e,t){var i,s,r,n,o,a,c,l,d,u;let h=!1;const p=[];if(null===(s=null===(i=e.data)||void 0===i?void 0:i.groups)||void 0===s||s.forEach((e=>{var i;if(e.id&&WP(e.id)){const s=null===(i=t[e.id])||void 0===i?void 0:i.id;if(s)return h=!0,void p.push(Object.assign(Object.assign({},e),{id:s}))}p.push(e)})),h)return Object.assign(Object.assign({},e),{data:Object.assign(Object.assign({},e.data),{groups:p})});if((null===(r=e.data)||void 0===r?void 0:r.id)&&WP(null===(n=e.data)||void 0===n?void 0:n.id)){const i=null===(a=t[null===(o=e.data)||void 0===o?void 0:o.id])||void 0===a?void 0:a.id;i&&(e.data.id=i)}if((null===(c=e.data)||void 0===c?void 0:c.parentId)&&WP(null===(l=e.data)||void 0===l?void 0:l.parentId)){const i=null===(u=t[null===(d=e.data)||void 0===d?void 0:d.parentId])||void 0===u?void 0:u.id;i&&(e.data.parentId=i)}return e}function IC(e,t){var i,s;const r=[];let n=!1;const o=e=>{let i=Object.assign({},e);if(e.id&&WP(e.id)){const s=t[e.id];s&&(i=s,n=!0)}return i};return null===(s=null===(i=e.data)||void 0===i?void 0:i.representations)||void 0===s||s.forEach((e=>{e.source&&(e.source=o(e.source)),r.push(o(e))})),n?Object.assign(Object.assign({},e),{data:Object.assign(Object.assign({},e.data),{representations:r})}):e}function EC(e){var t;const i={};for(let s=0;s<e.length;s+=1){const r=e[s],n=null===(t=r.body)||void 0===t?void 0:t.id;if("POST"===r.method&&WP(n)&&(i[n]=`$${s}.id`,delete r.body.id),["PUT","DELETE"].includes(r.method)){const e=zP(r.path);if(e){if(!i[e])throw new Error(`Unmapped placeholder ID: ${e}`);r.path=r.path.replace(e,i[e])}}if(["PUT","POST"].includes(r.method)){if(r.path.startsWith("elements")&&r.body.representations&&SC(r.body.representations),r.path.startsWith("elements")&&r.body.groups)for(const e of r.body.groups)if(WP(e.id)){if(!i[e.id])throw new Error(`Unmapped placeholder ID: ${e.id}`);e.id=i[e.id]}if(r.path.startsWith("groups")&&r.body.parent_id&&WP(r.body.parent_id)){if(!i[r.body.parent_id])throw new Error(`Unmapped placeholder ID: ${r.body.parent_id}`);r.body.parent_id=i[r.body.parent_id]}}}return e}function TC(e,t){const i={};for(const[s,r]of Object.entries(e))(void 0!==r||(null==t?void 0:t.includes(s)))&&(i[s]=r);return i}function SC(e){for(const t of e)WP(t.id)&&(t.id=void 0);return e}const AC=["updateLibrary","createElement","updateElement","removeElement","restoreElement","deleteElement","createGroup","removeGroup"];function PC(e,t){return Object.assign(Object.assign({},e),{data:t,originalAction:e})}const wC={updateLibrary:(e,t)=>PC(e,TC(zw(t,!1,!1),["documentId","documentType","roles"])),createElement:(e,t)=>PC(e,qw(t.elements[0])),updateElement:(e,t)=>PC(e,qw(t.elements[0])),restoreElement:e=>e,removeElement:e=>e,deleteElement:e=>e,createGroup:(e,t)=>PC(e,Yw(t)),removeGroup:e=>e};let CC=class extends Aw{constructor(){super(...arguments),this._baseLibraryOperationPath=`/api/v1/libraries/${this._library.assetId}`,this._actionMappers={updateLibrary:e=>{return{method:"PUT",path:"metadata",body:(t=e.data,Object.assign({name:t.name,document_id:t.documentId,roles:t.roles,description:t.description},iC(t.customData)))};var t},createElement:e=>({method:"POST",path:"elements",body:sC(e.data,this._driver.getClientInfo())}),updateElement:e=>({method:"PUT",path:"elements/metadata",body:{elements:[Zw(Object.assign({id:hC(e.path)},e.data))]}}),removeElement:e=>({method:"DELETE",path:`elements/${hC(e.path)}`}),restoreElement:e=>({method:"POST",path:"archive",body:{elementIds:[`${e.data.id}`]}}),deleteElement:e=>({method:"DELETE",path:`elements/${hC(e.path)}`,query_params:{permanent:"true"}}),createGroup:e=>{return{method:"POST",path:"groups",body:(t=e.data,i=this._driver.getClientInfo(),{group:{name:t.name,classifier:t.classifier,order:t.order,parent_id:t.parentId},client:i})};var t,i},removeGroup:e=>{var t;return{method:"DELETE",path:`groups/${_C(e.path)}`,query_params:(null===(t=e.flags)||void 0===t?void 0:t.includeElements)?{include_contents:"true"}:void 0}}},this._actions=[]}async execute(){const e=EC(this._actions.map((e=>this._actionMappers[e.name](e)))),t=await this._driver.fetch(this._baseLibraryOperationPath,{method:"PATCH",headers:{"Content-Type":"application/json","If-Match":this._library.etag},body:JSON.stringify({requests:e.map((e=>Object.assign(Object.assign({},e),{path:`${this._baseLibraryOperationPath}/${e.path}`})))})}),{responses:i}=await t.json();if(!Array.isArray(i)||i.length!==this._actions.length)throw new tw("INVALID_RESPONSE","Malformed batch response.",this._library.id);let s=this._actions.map(((e,t)=>wC[e.name](e,i[t])));return s=vC(s),{actions:s,etag:t.headers.get("ETag")}}supportsAction(e){return function(e){return AC.includes(e.name)}(e)}};Ye([Sw,rA],CC.prototype,"execute",null),CC=Ye([sA("BatchOperation")],CC);var RC=CC;let LC=class extends Aw{supportsAction(e){return"updateElementContent"===e.name}addAction(e){return(!this._actions[0]||this._actions[0].path===e.path)&&super.addAction(e)}async execute(){const e=this._actions[this._actions.length-1],t=await this._updateElementContent(hC(e.path),e.data),i=qw((await t.json()).elements[0]),s=this._actions.map(((e,t)=>t!==this._actions.length-1?Object.assign(Object.assign({},e),{type:"no-op",originalAction:e}):Object.assign(Object.assign({},e),{data:i,originalAction:e})));return{actions:s,etag:t.headers.get("ETag")}}_updateElementContent(e,t){return SC(t.representations),this._driver.fetch(`/api/v1/libraries/${this._library.assetId}/elements/${e}/representations`,{method:"PUT",headers:{"If-Match":this._library.etag,"Content-Type":"application/json"},body:JSON.stringify(sC(t,this._driver.getClientInfo()))})}};Ye([Sw,rA],LC.prototype,"execute",null),LC=Ye([sA("ContentOperation")],LC);var NC=LC;class DC extends Aw{constructor(){super(...arguments),this._actionMappers={}}async execute(){const e=this.actions.map((e=>this._actionMappers[e.name](e)));return{actions:await Promise.all(e)}}}Ye([Sw],DC.prototype,"execute",null);class MC extends DC{constructor(){super(...arguments),this._actionMappers={uploadComponent:async e=>{const t=JSON.parse(await this._driver.stageRepresentationForCommit(e.library,e.data.file,e.data.type));return Object.assign(Object.assign({},e),{data:t,originalAction:e})}}}supportsAction(e){return"uploadComponent"===e.name}}function xC(e){const t=e.match(/^<(.*)>;/);if(!t)return;const i={href:t[1]},s=e.matchAll(/\s([\w:]*)="([^"]*)"[;,]?/g);for(const e of s){const t=e[1],s=e[2];i[t]=kC(s)}return i}function kC(e){if("true"===e||"false"===e)return"true"===e;const t=+e;return isNaN(t)?e:t}var HC={},jC=e=>encodeURIComponent(e).replace(/[!'()*]/g,(e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`)),UC="%[a-f0-9]{2}",BC=new RegExp(UC,"gi"),FC=new RegExp("("+UC+")+","gi");function VC(e,t){try{return decodeURIComponent(e.join(""))}catch(e){}if(1===e.length)return e;t=t||1;var i=e.slice(0,t),s=e.slice(t);return Array.prototype.concat.call([],VC(i),VC(s))}function KC(e){try{return decodeURIComponent(e)}catch(s){for(var t=e.match(BC),i=1;i<t.length;i++)t=(e=VC(t,i).join("")).match(BC);return e}}var GC=function(e){if("string"!=typeof e)throw new TypeError("Expected `encodedURI` to be of type `string`, got `"+typeof e+"`");try{return e=e.replace(/\+/g," "),decodeURIComponent(e)}catch(t){return function(e){for(var t={"%FE%FF":"��","%FF%FE":"��"},i=FC.exec(e);i;){try{t[i[0]]=decodeURIComponent(i[0])}catch(e){var s=KC(i[0]);s!==i[0]&&(t[i[0]]=s)}i=FC.exec(e)}t["%C2"]="�";for(var r=Object.keys(t),n=0;n<r.length;n++){var o=r[n];e=e.replace(new RegExp(o,"g"),t[o])}return e}(e)}},$C=(e,t)=>{if("string"!=typeof e||"string"!=typeof t)throw new TypeError("Expected the arguments to be of type `string`");if(""===t)return[e];const i=e.indexOf(t);return-1===i?[e]:[e.slice(0,i),e.slice(i+t.length)]},WC=function(e,t){for(var i={},s=Object.keys(e),r=Array.isArray(t),n=0;n<s.length;n++){var o=s[n],a=e[o];(r?-1!==t.indexOf(o):t(o,a,e))&&(i[o]=a)}return i};!function(e){const t=jC,i=GC,s=$C,r=WC;function n(e){if("string"!=typeof e||1!==e.length)throw new TypeError("arrayFormatSeparator must be single character string")}function o(e,i){return i.encode?i.strict?t(e):encodeURIComponent(e):e}function a(e,t){return t.decode?i(e):e}function c(e){return Array.isArray(e)?e.sort():"object"==typeof e?c(Object.keys(e)).sort(((e,t)=>Number(e)-Number(t))).map((t=>e[t])):e}function l(e){const t=e.indexOf("#");return-1!==t&&(e=e.slice(0,t)),e}function d(e){const t=(e=l(e)).indexOf("?");return-1===t?"":e.slice(t+1)}function u(e,t){return t.parseNumbers&&!Number.isNaN(Number(e))&&"string"==typeof e&&""!==e.trim()?e=Number(e):!t.parseBooleans||null===e||"true"!==e.toLowerCase()&&"false"!==e.toLowerCase()||(e="true"===e.toLowerCase()),e}function h(e,t){n((t=Object.assign({decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1},t)).arrayFormatSeparator);const i=function(e){let t;switch(e.arrayFormat){case"index":return(e,i,s)=>{t=/\[(\d*)\]$/.exec(e),e=e.replace(/\[\d*\]$/,""),t?(void 0===s[e]&&(s[e]={}),s[e][t[1]]=i):s[e]=i};case"bracket":return(e,i,s)=>{t=/(\[\])$/.exec(e),e=e.replace(/\[\]$/,""),t?void 0!==s[e]?s[e]=[].concat(s[e],i):s[e]=[i]:s[e]=i};case"comma":case"separator":return(t,i,s)=>{const r="string"==typeof i&&i.includes(e.arrayFormatSeparator),n="string"==typeof i&&!r&&a(i,e).includes(e.arrayFormatSeparator);i=n?a(i,e):i;const o=r||n?i.split(e.arrayFormatSeparator).map((t=>a(t,e))):null===i?i:a(i,e);s[t]=o};case"bracket-separator":return(t,i,s)=>{const r=/(\[\])$/.test(t);if(t=t.replace(/\[\]$/,""),!r)return void(s[t]=i?a(i,e):i);const n=null===i?[]:i.split(e.arrayFormatSeparator).map((t=>a(t,e)));void 0!==s[t]?s[t]=[].concat(s[t],n):s[t]=n};default:return(e,t,i)=>{void 0!==i[e]?i[e]=[].concat(i[e],t):i[e]=t}}}(t),r=Object.create(null);if("string"!=typeof e)return r;if(!(e=e.trim().replace(/^[?#&]/,"")))return r;for(const n of e.split("&")){if(""===n)continue;let[e,o]=s(t.decode?n.replace(/\+/g," "):n,"=");o=void 0===o?null:["comma","separator","bracket-separator"].includes(t.arrayFormat)?o:a(o,t),i(a(e,t),o,r)}for(const e of Object.keys(r)){const i=r[e];if("object"==typeof i&&null!==i)for(const e of Object.keys(i))i[e]=u(i[e],t);else r[e]=u(i,t)}return!1===t.sort?r:(!0===t.sort?Object.keys(r).sort():Object.keys(r).sort(t.sort)).reduce(((e,t)=>{const i=r[t];return Boolean(i)&&"object"==typeof i&&!Array.isArray(i)?e[t]=c(i):e[t]=i,e}),Object.create(null))}e.extract=d,e.parse=h,e.stringify=(e,t)=>{if(!e)return"";n((t=Object.assign({encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:","},t)).arrayFormatSeparator);const i=i=>t.skipNull&&null==e[i]||t.skipEmptyString&&""===e[i],s=function(e){switch(e.arrayFormat){case"index":return t=>(i,s)=>{const r=i.length;return void 0===s||e.skipNull&&null===s||e.skipEmptyString&&""===s?i:null===s?[...i,[o(t,e),"[",r,"]"].join("")]:[...i,[o(t,e),"[",o(r,e),"]=",o(s,e)].join("")]};case"bracket":return t=>(i,s)=>void 0===s||e.skipNull&&null===s||e.skipEmptyString&&""===s?i:null===s?[...i,[o(t,e),"[]"].join("")]:[...i,[o(t,e),"[]=",o(s,e)].join("")];case"comma":case"separator":case"bracket-separator":{const t="bracket-separator"===e.arrayFormat?"[]=":"=";return i=>(s,r)=>void 0===r||e.skipNull&&null===r||e.skipEmptyString&&""===r?s:(r=null===r?"":r,0===s.length?[[o(i,e),t,o(r,e)].join("")]:[[s,o(r,e)].join(e.arrayFormatSeparator)])}default:return t=>(i,s)=>void 0===s||e.skipNull&&null===s||e.skipEmptyString&&""===s?i:null===s?[...i,o(t,e)]:[...i,[o(t,e),"=",o(s,e)].join("")]}}(t),r={};for(const t of Object.keys(e))i(t)||(r[t]=e[t]);const a=Object.keys(r);return!1!==t.sort&&a.sort(t.sort),a.map((i=>{const r=e[i];return void 0===r?"":null===r?o(i,t):Array.isArray(r)?0===r.length&&"bracket-separator"===t.arrayFormat?o(i,t)+"[]":r.reduce(s(i),[]).join("&"):o(i,t)+"="+o(r,t)})).filter((e=>e.length>0)).join("&")},e.parseUrl=(e,t)=>{t=Object.assign({decode:!0},t);const[i,r]=s(e,"#");return Object.assign({url:i.split("?")[0]||"",query:h(d(e),t)},t&&t.parseFragmentIdentifier&&r?{fragmentIdentifier:a(r,t)}:{})},e.stringifyUrl=(t,i)=>{i=Object.assign({encode:!0,strict:!0},i);const s=l(t.url).split("?")[0]||"",r=e.extract(t.url),n=e.parse(r,{sort:!1}),a=Object.assign(n,t.query);let c=e.stringify(a,i);c&&(c=`?${c}`);let d=function(e){let t="";const i=e.indexOf("#");return-1!==i&&(t=e.slice(i)),t}(t.url);return t.fragmentIdentifier&&(d=`#${o(t.fragmentIdentifier,i)}`),`${s}${c}${d}`},e.pick=(t,i,s)=>{s=Object.assign({parseFragmentIdentifier:!0},s);const{url:n,query:o,fragmentIdentifier:a}=e.parseUrl(t,s);return e.stringifyUrl({url:n,query:r(o,i),fragmentIdentifier:a},s)},e.exclude=(t,i,s)=>{const r=Array.isArray(i)?e=>!i.includes(e):(e,t)=>!i(e,t);return e.pick(t,r,s)}}(HC);var zC,qC,YC={exports:{}},QC={exports:{}};zC="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",qC={rotl:function(e,t){return e<<t|e>>>32-t},rotr:function(e,t){return e<<32-t|e>>>t},endian:function(e){if(e.constructor==Number)return 16711935&qC.rotl(e,8)|4278255360&qC.rotl(e,24);for(var t=0;t<e.length;t++)e[t]=qC.endian(e[t]);return e},randomBytes:function(e){for(var t=[];e>0;e--)t.push(Math.floor(256*Math.random()));return t},bytesToWords:function(e){for(var t=[],i=0,s=0;i<e.length;i++,s+=8)t[s>>>5]|=e[i]<<24-s%32;return t},wordsToBytes:function(e){for(var t=[],i=0;i<32*e.length;i+=8)t.push(e[i>>>5]>>>24-i%32&255);return t},bytesToHex:function(e){for(var t=[],i=0;i<e.length;i++)t.push((e[i]>>>4).toString(16)),t.push((15&e[i]).toString(16));return t.join("")},hexToBytes:function(e){for(var t=[],i=0;i<e.length;i+=2)t.push(parseInt(e.substr(i,2),16));return t},bytesToBase64:function(e){for(var t=[],i=0;i<e.length;i+=3)for(var s=e[i]<<16|e[i+1]<<8|e[i+2],r=0;r<4;r++)8*i+6*r<=8*e.length?t.push(zC.charAt(s>>>6*(3-r)&63)):t.push("=");return t.join("")},base64ToBytes:function(e){e=e.replace(/[^A-Z0-9+\/]/gi,"");for(var t=[],i=0,s=0;i<e.length;s=++i%4)0!=s&&t.push((zC.indexOf(e.charAt(i-1))&Math.pow(2,-2*s+8)-1)<<2*s|zC.indexOf(e.charAt(i))>>>6-2*s);return t}},QC.exports=qC;var JC={utf8:{stringToBytes:function(e){return JC.bin.stringToBytes(unescape(encodeURIComponent(e)))},bytesToString:function(e){return decodeURIComponent(escape(JC.bin.bytesToString(e)))}},bin:{stringToBytes:function(e){for(var t=[],i=0;i<e.length;i++)t.push(255&e.charCodeAt(i));return t},bytesToString:function(e){for(var t=[],i=0;i<e.length;i++)t.push(String.fromCharCode(e[i]));return t.join("")}}},XC=JC,ZC=function(e){return null!=e&&(eR(e)||function(e){return"function"==typeof e.readFloatLE&&"function"==typeof e.slice&&eR(e.slice(0,0))}(e)||!!e._isBuffer)};function eR(e){return!!e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)}!function(){var e=QC.exports,t=XC.utf8,i=ZC,s=XC.bin,r=function(n,o){n.constructor==String?n=o&&"binary"===o.encoding?s.stringToBytes(n):t.stringToBytes(n):i(n)?n=Array.prototype.slice.call(n,0):Array.isArray(n)||n.constructor===Uint8Array||(n=n.toString());for(var a=e.bytesToWords(n),c=8*n.length,l=1732584193,d=-271733879,u=-1732584194,h=271733878,p=0;p<a.length;p++)a[p]=16711935&(a[p]<<8|a[p]>>>24)|4278255360&(a[p]<<24|a[p]>>>8);a[c>>>5]|=128<<c%32,a[14+(c+64>>>9<<4)]=c;var _=r._ff,m=r._gg,f=r._hh,g=r._ii;for(p=0;p<a.length;p+=16){var y=l,v=d,O=u,b=h;l=_(l,d,u,h,a[p+0],7,-680876936),h=_(h,l,d,u,a[p+1],12,-389564586),u=_(u,h,l,d,a[p+2],17,606105819),d=_(d,u,h,l,a[p+3],22,-1044525330),l=_(l,d,u,h,a[p+4],7,-176418897),h=_(h,l,d,u,a[p+5],12,1200080426),u=_(u,h,l,d,a[p+6],17,-1473231341),d=_(d,u,h,l,a[p+7],22,-45705983),l=_(l,d,u,h,a[p+8],7,1770035416),h=_(h,l,d,u,a[p+9],12,-1958414417),u=_(u,h,l,d,a[p+10],17,-42063),d=_(d,u,h,l,a[p+11],22,-1990404162),l=_(l,d,u,h,a[p+12],7,1804603682),h=_(h,l,d,u,a[p+13],12,-40341101),u=_(u,h,l,d,a[p+14],17,-1502002290),l=m(l,d=_(d,u,h,l,a[p+15],22,1236535329),u,h,a[p+1],5,-165796510),h=m(h,l,d,u,a[p+6],9,-1069501632),u=m(u,h,l,d,a[p+11],14,643717713),d=m(d,u,h,l,a[p+0],20,-373897302),l=m(l,d,u,h,a[p+5],5,-701558691),h=m(h,l,d,u,a[p+10],9,38016083),u=m(u,h,l,d,a[p+15],14,-660478335),d=m(d,u,h,l,a[p+4],20,-405537848),l=m(l,d,u,h,a[p+9],5,568446438),h=m(h,l,d,u,a[p+14],9,-1019803690),u=m(u,h,l,d,a[p+3],14,-187363961),d=m(d,u,h,l,a[p+8],20,1163531501),l=m(l,d,u,h,a[p+13],5,-1444681467),h=m(h,l,d,u,a[p+2],9,-51403784),u=m(u,h,l,d,a[p+7],14,1735328473),l=f(l,d=m(d,u,h,l,a[p+12],20,-1926607734),u,h,a[p+5],4,-378558),h=f(h,l,d,u,a[p+8],11,-2022574463),u=f(u,h,l,d,a[p+11],16,1839030562),d=f(d,u,h,l,a[p+14],23,-35309556),l=f(l,d,u,h,a[p+1],4,-1530992060),h=f(h,l,d,u,a[p+4],11,1272893353),u=f(u,h,l,d,a[p+7],16,-155497632),d=f(d,u,h,l,a[p+10],23,-1094730640),l=f(l,d,u,h,a[p+13],4,681279174),h=f(h,l,d,u,a[p+0],11,-358537222),u=f(u,h,l,d,a[p+3],16,-722521979),d=f(d,u,h,l,a[p+6],23,76029189),l=f(l,d,u,h,a[p+9],4,-640364487),h=f(h,l,d,u,a[p+12],11,-421815835),u=f(u,h,l,d,a[p+15],16,530742520),l=g(l,d=f(d,u,h,l,a[p+2],23,-995338651),u,h,a[p+0],6,-198630844),h=g(h,l,d,u,a[p+7],10,1126891415),u=g(u,h,l,d,a[p+14],15,-1416354905),d=g(d,u,h,l,a[p+5],21,-57434055),l=g(l,d,u,h,a[p+12],6,1700485571),h=g(h,l,d,u,a[p+3],10,-1894986606),u=g(u,h,l,d,a[p+10],15,-1051523),d=g(d,u,h,l,a[p+1],21,-2054922799),l=g(l,d,u,h,a[p+8],6,1873313359),h=g(h,l,d,u,a[p+15],10,-30611744),u=g(u,h,l,d,a[p+6],15,-1560198380),d=g(d,u,h,l,a[p+13],21,1309151649),l=g(l,d,u,h,a[p+4],6,-145523070),h=g(h,l,d,u,a[p+11],10,-1120210379),u=g(u,h,l,d,a[p+2],15,718787259),d=g(d,u,h,l,a[p+9],21,-343485551),l=l+y>>>0,d=d+v>>>0,u=u+O>>>0,h=h+b>>>0}return e.endian([l,d,u,h])};r._ff=function(e,t,i,s,r,n,o){var a=e+(t&i|~t&s)+(r>>>0)+o;return(a<<n|a>>>32-n)+t},r._gg=function(e,t,i,s,r,n,o){var a=e+(t&s|i&~s)+(r>>>0)+o;return(a<<n|a>>>32-n)+t},r._hh=function(e,t,i,s,r,n,o){var a=e+(t^i^s)+(r>>>0)+o;return(a<<n|a>>>32-n)+t},r._ii=function(e,t,i,s,r,n,o){var a=e+(i^(t|~s))+(r>>>0)+o;return(a<<n|a>>>32-n)+t},r._blocksize=16,r._digestsize=16,YC.exports=function(t,i){if(null==t)throw new Error("Illegal argument "+t);var n=e.wordsToBytes(r(t,i));return i&&i.asBytes?n:i&&i.asString?s.bytesToString(n):e.bytesToHex(n)}}();var tR=YC.exports;class iR extends iw{constructor(e){super(),this._driver=e,this._onChangeCallback=(e,t,i)=>{var s;const r=i;null===(s=this._changeCallback)||void 0===s||s.call(this,r)}}connect(){var e,t;this._librariesToMonitor=null===(e=this._driver._core)||void 0===e?void 0:e.assetLinkManager.createList(),null===(t=this._librariesToMonitor)||void 0===t||t.on("notified",this._onChangeCallback)}disconnect(){var e,t;this._changeCallback=void 0,null===(e=this._librariesToMonitor)||void 0===e||e.clear(),null===(t=this._librariesToMonitor)||void 0===t||t.off("notified",this._onChangeCallback),this._librariesToMonitor=void 0}get isConnected(){return!!this._librariesToMonitor}async setWatchedLibraries(e,t){if(!this._librariesToMonitor)return;const i=this._librariesToMonitor,s=new Set(e.map((e=>e.assetId)));i.monitoredAssetIDs.forEach((e=>!s.has(e)&&i.removeAssetID(e))),s.forEach((e=>e&&i.addAssetID(e))),this._changeCallback=t}async addWatchedLibrary(e){var t;e.assetId&&(null===(t=this._librariesToMonitor)||void 0===t||t.addAssetID(e.assetId))}removeWatchedLibrary(e){var t;e.assetId&&(null===(t=this._librariesToMonitor)||void 0===t||t.removeAssetID(e.assetId))}async addLibrariesSyncGroupListener(e){var t;if(this._syncGroupListener||!e)return;let i;this._syncGroupListener={notify:e};try{i=await(null===(t=this._driver._core)||void 0===t?void 0:t.hostAssetContext.getAssetWithRepoPath("/assets/adobe-libraries"))}catch(e){if(21===e.code)return;throw e}i?(this._syncGroupListener.asset=i,i.on("change",e)):delete this._syncGroupListener}removeLibrariesSyncGroupListener(){if(this._syncGroupListener){const{asset:e,notify:t}=this._syncGroupListener;null==e||e.off("change",t),delete this._syncGroupListener}}}function sR(e,t){return e.next().then((e=>({result:e,index:t})))}class rR{constructor(){this._data=new Map}get length(){return this._data.size}key(e){return Array.from(this._data.keys())[e]}getItem(e){return this._data.get(e)}setItem(e,t){this._data.set(e,t)}removeItem(e){this._data.delete(e)}clear(){this._data.clear()}}class nR{constructor(e,t){this._settings=new Map,this._storageKey=e,this._storage=null!=t?t:"undefined"!=typeof window?window.localStorage:new rR,this._load()}entries(){return this._settings.entries()}setItem(e,t){this._settings.set(e,t),this._save()}getItem(e){return this._settings.get(e)}_setItem(e,t){this._storage.setItem(e,t)}_load(){const e=this._storage.getItem(this._storageKey);if(e)try{this._settings=new Map(JSON.parse(e))}catch(e){nw.error("Error restoring previous settings."),this._storage.removeItem(this._storageKey)}}_save(){const e=JSON.stringify(Array.from(this._settings.entries()));this._setItem(this._storageKey,e)}}function oR(e){var t;return{name:e.name,id:e.id,owner:e.storageAssignee,ownerName:null!==(t=e.storageAssignee.displayName)&&void 0!==t?t:"",isWritable:!0}}function aR(e){return{type:e.type,angle:e.angle,stops:e.stops}}const cR={field:"modifiedDate",direction:"descending"},lR={modifiedDate:"modified_date",name:"name"};let dR=class extends pw{constructor(){super(...arguments),this._fetch=fetch,this._notificationManager=new iR(this),this._operationTypes=[fC,cC,RC,NC,MC]}getLibrary(e,t){return this.getLibraryByAssetId(e.id,t)}getElements(e,...t){return this._getElementsByAssetId(e.id,...t)}async getElementsPage(e,t=0,i=100,s=cR,r){const n=`${"descending"===s.direction?"-":""}${lR[s.field]}`,o={start:t.toString(),limit:i.toString(),orderBy:n,selector:"default,representations,details"};return await this.fetch(`/api/v1/libraries/${e.id}/elements`,{headers:o}).then((e=>e.json()))}getRemovedElements(e,...t){return this._getRemovedElementsByAssetId(e.id,...t)}getDocumentationElements(e,...t){return this._getDocumentationElementsByAssetId(e.id,...t)}getElement(e,t){return this._getElement(e.id,t)}async _handleConnected(e){var t,i,s,r,n,o;const a=Dw(e.token);var c;this._localStorage=new nR(("cloud",`CCLibraries_${null==(c=null==a?void 0:a.user)?void 0:c.id}_cloud`),e.localStorage),this._env=e.env,this._token=e.token,this._refreshAccessToken=e.refreshAccessToken,this._clientId=null===(t=null==a?void 0:a.user)||void 0===t?void 0:t.clientId,this._analyticsEnabled=(null===(s=null===(i=e.config)||void 0===i?void 0:i.processInfo)||void 0===s?void 0:s.analyticsEnabled)||!1,this._ignoreRenditionGrids=(null===(r=e.config)||void 0===r?void 0:r.ignoreRenditionGrids)||!1,this._codeVersion=null===(o=null===(n=e.config)||void 0===n?void 0:n.processInfo)||void 0===o?void 0:o.codeVersion,this._fetch=e.fetch||fetch.bind(globalThis),this._notificationManager.connect(),await this.getConfiguration()}_handleDisconnected(){var e;null===(e=this._notificationManager)||void 0===e||e.disconnect()}async getConfiguration(){const e=this.getLocalSettings(),t=Dw(this._token);return this._config=new ow(Object.assign(Object.assign(Object.assign({},e),t),{environment:this._env,processInfo:{analyticsEnabled:this._analyticsEnabled,codeVersion:this._codeVersion,syncingEnabled:!0},ignoreRenditionGrids:this._ignoreRenditionGrids})),this.config}get driverConfig(){return Tw[this._env]}updateOptions(e){this._options=e}fetchAccessToken(e,t,i,s){return Promise.resolve({access_token:this._token,expires_in:Mw(this._token)})}async getLibraryById(e){if(!e)return;const{value:t}=await this.getLibraryByAssetId(e).next();return t}getLibraryByAssetId(e,t={}){var i,s;return Xe(this,arguments,(function*(){if(!e)return yield Je({});let r=t.etag;const n=["default"];if(t.getRenditionGrid&&n.push("rendition_grid"),t.getAppMetadata&&n.push("app_metadata"),!t.elementParams){try{yield yield Je(this._getLibrary(e,r,n))}catch(e){if(!(e instanceof mw&&"NOT_MODIFIED"===e.requestErrorCode))throw e}return yield Je(void 0)}const o=this._getManifest(e,t);if(o.then((()=>{var e;const i=null===(e=t.elementParams)||void 0===e?void 0:e.abortController;i&&(i.abort(),dw.give(i,"REQUEST NOT NEEDED"))})),null===(i=t.elementParams)||void 0===i?void 0:i.loadProgressively)try{try{const t=yield Je(this._getLibrary(e,r,n));r=t.etag,yield yield Je(t)}catch(e){if(!(e instanceof mw&&"NOT_MODIFIED"===e.requestErrorCode&&t.elementParams))throw e}yield Je(yield*Ze(et(this._getAllElements(e,Object.assign(Object.assign({},t.elementParams),{etag:r})))))}catch(e){if(!((null===(s=t.elementParams.abortController)||void 0===s?void 0:s.signal.aborted)||e instanceof mw&&"NOT_FOUND"===e.requestErrorCode))throw e}yield yield Je(o)}))}_getLibrary(e,t,i=["default"]){const s={};s["if-none-match"]=t||"*";const r=new URLSearchParams({selector:i});i.includes("app_metadata")&&r.set("randomizer",bi.v4());const n=`/api/v1/libraries/${e}?${r.toString()}`;return this.fetch(n,{headers:s}).then((e=>e.json())).then((e=>zw(e,this._options.readOnly,null==i?void 0:i.includes("rendition_grid"))))}async _getManifest(e,t){var i;let s;try{s=await(null===(i=this._core)||void 0===i?void 0:i.hostAssetContext.getAssetWithCloudID(e))}catch(e){throw yw(e)}if(!s||(null==s?void 0:s.isDiscarded))throw gw(404);try{const e=[s.manifest];t.getAppMetadata&&e.push(s.appMetadata),await Promise.all(e.map((e=>!e.isLoaded&&e.load())));const i=jw(s);return s.manifest.unload(),i}catch(e){throw yw(e)}}getLibraries(e,t=!0){return Xe(this,arguments,(function*(){if(this._options.enableBrandLifecycleManagement){const t=yield Je(this.getProjectByName("Adobe GenStudio Brands"));if(t){nw.info("[CLOUD DRIVER] M3 - Loading brands inside project.");const i={team:[t.id],roles:["brand"]};return yield Je(yield*Ze(et(this.getLibrariesList(e,i)))),yield Je(void 0)}{nw.error("[CLOUD DRIVER] M3 - Adobe GenStudio Brands project not found.");const t={itemFilter:["publishedBrands"],roles:["brand"]};return yield Je(yield*Ze(et(this.getLibrariesList(e,t)))),yield Je(void 0)}}{nw.info("[CLOUD DRIVER] M2 - Loading all libraries.");const i={owner:["private","incoming"],selector:t?["rendition_grid"]:["default"]},s={owner:["public"],selector:t?["rendition_grid","details"]:["default","details"]},r=[this.getLibrariesList(e,i),this.getLibrariesList(e,s)];this._options.includeApprovedBrandsInLibraries&&(nw.info("[CLOUD DRIVER] M2 - Loading approved brands."),r.push(this.getApprovedBrandLibraries(e))),yield Je(yield*Ze(et(function(...e){return Xe(this,arguments,(function*(){const t=e.map(sR);let i=t.length;for(;i;){const s=yield Je(Promise.race(t));s.result.done?(t[s.index]=new Promise((()=>{})),i--):(yield yield Je(s.result.value),t[s.index]=sR(e[s.index],s.index))}}))}(...r))))}}))}getApprovedBrandLibraries(e){return Xe(this,arguments,(function*(){yield Je(yield*Ze(et(this.fetchAllApprovedBrandPages("/api/v1/search",this._getLibrariesResponseMapper(),e))))}))}fetchAllApprovedBrandPages(e,t,i){var s,r;return Xe(this,arguments,(function*(){let n=e;for(;n;){const e=yield Je(this.fetch(n,{signal:i,method:"POST",body:JSON.stringify({library_roles_type:["approvedbrand"]}),headers:{owner:"all","content-type":"application/json"}}).then((e=>e.json())));yield yield Je(t(e)),n=null===(r=null===(s=e._links)||void 0===s?void 0:s.next)||void 0===r?void 0:r.href}}))}getLibrariesList(e,t){return Xe(this,arguments,(function*(){yield Je(yield*Ze(et(this.fetchAllPages(this._getLibrariesURL(t),{headers:{directive:"public-libraries-list-v2"}},this._getLibrariesResponseMapper(t),e))))}))}getLibrariesPage(e,t){return Xe(this,arguments,(function*(){yield Je(yield*Ze(et(this.fetchOnePage(this._getLibrariesURL(t),this._getLibrariesResponseMapper(t),e,!1))))}))}async getPresignedDownloadUrl(e){const t=await this.fetch(e);var i;return{size:(i=await t.json()).size,type:i.type,url:i.href}}async loadVersionHistory(e){const t=await this._core.hostAssetContext.getAssetWithCloudID(e);let i;return await new Promise(((e,s)=>{i=t.versions.getList(Zd.default,void 0,{loadAllPages:!0}),i.on(To,(function t(){(null==i?void 0:i.status)!==co.Loading&&(null==i||i.off(To,t),(null==i?void 0:i.errors)&&s(),e())}))})),null==i?void 0:i.items.map((t=>function(e,t){var i;const s=null===(i=t.links)||void 0===i?void 0:i[Hw.MANIFEST].href,r=s?mt(s):void 0;return{id:t.versionId,assetId:e,createdDate:t.created.getTime(),createdBy:t.createdBy,manifestUrl:null==r?void 0:r.fill({})}}(e,t)))}async loadVersion(e,t){const i=this._core.hostAssetContext,s=await i.getAssetWithCloudID(e),r=await this.fetch(t);return jw(s,await r.json())}async getCollaborators(e){const t=this._core.collaborationContext.getCollaborators(e);let i;return await new Promise(((e,s)=>{i=null==t?void 0:t.getList(Ju.default,void 0,{loadAllPages:!0}),null==i||i.on(To,(function t(){(null==i?void 0:i.status)!==co.Loading&&(null==i||i.off(To,t),(null==i?void 0:i.errors)?s():e())}))})),null==i?void 0:i.items.map((t=>function(e,t){return{id:t.collaboratorID,assetId:e,imsUserId:t.imsUserId,email:t.email,name:t.name,role:t.role,type:t.type,inheritances:t.inheritances,isDirect:t.isDirect,hasContributorRole:t.hasContributorRole,hasName:t.hasName,invited:t.invited,isAdmin:t.isAdmin}}(e,t)))}followLibrary(e,t){return this.fetch("/api/v1/libraries/bookmarks",{method:"POST",body:JSON.stringify({bookmarks:[{type:"collab",id:t,urn:e}]}),headers:{"content-type":"application/json"}}).then((()=>{}))}moveLibrary(e,t,i){return new Promise(((s,r)=>{const n={"content-type":"application/json"};i&&(n["x-organization-id"]=i);const o=this.fetch(`/api/v1/libraries?${HC.stringify({invocation_mode:"async"})}`,{method:"POST",body:JSON.stringify({self:e,repository:t}),headers:n}),a=new Ew(this,o);a.on("change",((e,t)=>{e&&(a.error?r(a.error):s(TC(zw(t))))}))}))}importLibrary(e){throw new Error("Not implemented")}exportLibrary(e,t){throw new Error("Not implemented")}publishBrand(e){if(!e.assetId)throw new tw("INVALID_PARAMETER","Brand asset id must be defined for publishing. Please wait before trying again.");return this.fetch(`/api/v1/brands/${e.assetId}/publish`,{method:"POST",headers:{"content-type":"application/json"}})}unpublishBrand(e){let t;if(e.publishedTo)t=e.publishedTo;else{if(!e.publishedFrom)throw new tw("INVALID_PARAMETER","Brand must be publsihed before unpublishing. Please wait before trying again.");t=e.assetId}return this.fetch(`/api/v1/brands/${t}/unpublish`,{method:"POST",headers:{"content-type":"application/json"}})}async abortOperation(e){throw new Error("Not supported in cloud mode.")}setLibraryChangeListener(e,t){this._notificationManager.setWatchedLibraries(e,(e=>t(e,"assetId")))}setSyncStateListener(){}removeLibraryChangeListener(){this._notificationManager.disconnect()}removeSyncStateListener(){}removeFontDataChangeListeners(){}addWatchedLibrary(e){this._notificationManager.addWatchedLibrary(e)}removeWatchedLibrary(e){this._notificationManager.removeWatchedLibrary(e)}addLibrariesSyncGroupListener(e){this._notificationManager.addLibrariesSyncGroupListener(e)}removeLibrariesSyncGroupListener(){this._notificationManager.removeLibrariesSyncGroupListener()}_getLibrariesURL(e){return`/api/v1/libraries?${new URLSearchParams(e).toString()}`}_getLibrariesResponseMapper(e){return t=>void 0===t.libraries?[]:t.libraries.map((t=>{var i,s;return zw(t,this._options.readOnly,null===(s=null===(i=null==e?void 0:e.selector)||void 0===i?void 0:i.includes("rendition_grid"))||void 0===s||s)}))}_getElement(e,t){return this.fetch(`/api/v1/libraries/${e}/elements/${t}?selector=default,representations,details,tags`).then((e=>e.json())).then((e=>qw(e)))}_getAllElements(e,t){var i,s;return Xe(this,arguments,(function*(){var r,n,o,a;const c=[["elements","_getElementsByAssetId"],["documentationElements","_getDocumentationElementsByAssetId"],["removedElements","_getRemovedElementsByAssetId"]],l={};for(const[p,_]of c)if(t.types.includes(p))try{for(var d,u=!0,h=(n=void 0,et(this[_](e,t.sort,t.etag,void 0,null===(i=t.abortController)||void 0===i?void 0:i.signal)));!(r=(d=yield Je(h.next())).done);){a=d.value,u=!1;try{const e=a;l[p]=l[p]||[],null===(s=l[p])||void 0===s||s.push(...e),t.loadProgressively&&(yield yield Je({[p]:l[p]}))}finally{u=!0}}}catch(e){n={error:e}}finally{try{u||r||!(o=h.return)||(yield Je(o.call(h)))}finally{if(n)throw n.error}}yield yield Je(Object.assign({areElementsLoaded:!0},t.loadProgressively?{}:l))}))}_getElementsByAssetId(e,t=cR,i,s=100,r){return Xe(this,arguments,(function*(){yield Je(yield*Ze(et(this._getElementsOfTypeByAssetId("elements",e,t,i,s,r))))}))}_getRemovedElementsByAssetId(e,t=cR,i,s=100,r){return Xe(this,arguments,(function*(){yield Je(yield*Ze(et(this._getElementsOfTypeByAssetId("archive",e,t,i,s,r))))}))}_getDocumentationElementsByAssetId(e,t=cR,i,s=100,r){return Xe(this,arguments,(function*(){yield yield Je(Promise.resolve([]))}))}_getElementsOfTypeByAssetId(e,t,i=cR,s,r=100,n){return Xe(this,arguments,(function*(){const o=`${"descending"===i.direction?"-":""}${lR[i.field]}`,a={limit:r,orderBy:o,selector:["default","representations","details"]};yield Je(yield*Ze(et(this.fetchAllPages(`/api/v1/libraries/${t}/${e}?${HC.stringify(a,{arrayFormat:"comma"})}`,{},(e=>e.elements.map((e=>{if(!e.manifest_etag&&'""'===s||e.manifest_etag===s)return qw(e);throw new mw("PRECONDITION_FAILED",`An element did not match the provided etag: ${s}`)}))),n))))}))}getSearchResults(e,t,i,s){return Xe(this,arguments,(function*(){const{field:r,direction:n}=i;let o="modifiedDate"===r?"modified_date":"name";"descending"===n&&(o=`-${o}`),yield Je(yield*Ze(et(this.fetchAllPages("/api/v1/search",{method:"POST",signal:s,headers:{"Content-Type":"application/json"},body:JSON.stringify({query_string:e,library_id:t.library_id,asset_type:["element"],orderBy:o,limit:300})},(e=>e.elements.map(eC))))))}))}async getTeams(){const e=await this.fetch(`https://${this.driverConfig.teams_hostname}/api/v2/teams`),t=await e.json();return void 0===t.teams?[]:t.teams.filter((e=>"org"===e.repositoryOwner.type)).map(Xw)}async getProjects(){if(!this._core)return[];const e=await this._core.projectContext.projects().getList(qp.default,f_.AllProjects,{loadAllPages:!0});return await Mo(e),e.items.map(oR)}async getProjectByName(e){if(!this._core)return;const t=await this._core.projectContext.resolveProjectByName(e);return t?oR(t):void 0}async getProjectGradient(e){if(!this._core)return;const t=await this._core.projectContext.getProjectbyID(e.id);return this._core.projectContext.getGradient(t.gradientID).then(aR)}getGroups(e){return Xe(this,arguments,(function*(){yield yield Je(Promise.resolve(void 0))}))}getRenditionUrl(e,t){let i;try{const s=kw(e,t);if(!s)return"";i=new URL(s)}catch(e){return nw.log(String(e)),""}return jr(i,{api_key:this._clientId,user_token:this._token}),i.toString()}getAuthenticatedThumbnailURL(e,t){return Promise.resolve(this.getRenditionUrl(e,t))}getRenditionPath(e,t,i){return Promise.resolve("")}getRendition(e,t){return this.fetch(kw(e,t))}async getRepresentationContent(e){let t;if(e.contentLength<RP)t=e._data.url;else{const i=await this.getPresignedDownloadUrl(e._data.blockDownloadUrl);t=i&&i.url,t||(t=e._data.url)}return this.fetch(t)}async setLocalSetting(e,t){var i;t=JSON.stringify(t),null===(i=this._localStorage)||void 0===i||i.setItem(e,t)}getLocalSetting(e){var t;const i=null===(t=this._localStorage)||void 0===t?void 0:t.getItem(e);return i&&JSON.parse(i)}getInstalledVersion(e){throw new Error("Not supported in cloud mode.")}setFontDataChangeListener(e){}moveUrlQueryParamsToHeaders(e,t={}){const[i,s]=e.split("?"),r=new URLSearchParams(s);for(const e of UP){const i=r.get(e);i&&(t[e]=i,r.delete(e))}return[`${i}${[...r].length>0?"?":""}${r}`,t]}async sendAction(e){throw new tw("NOT_SUPPORTED","Application actions are not supported in a cloud environment",e.item.id)}async openInCCD(e){throw new Error("Not supported in cloud mode.")}async fetch(e,t,i={}){var s,r,n;!function(e,t){var i;null===(i=iA.trace.getActiveSpan())||void 0===i||i.setAttribute("path",t||"")}(0,e),(t=t||{}).headers=t.headers||{},t.headers["x-api-key"]=this._clientId,!1!==i.includeAuthHeader&&(t.headers.Authorization=`Bearer ${this._token}`);const{url:o,headers:a}=xw(e);e=o,t.headers=Object.assign(Object.assign({},a),t.headers),t.signal=t.signal?lw(t.signal,null===(s=this._abortController)||void 0===s?void 0:s.signal):null===(r=this._abortController)||void 0===r?void 0:r.signal,e.startsWith("/")&&(e=`https://${this.driverConfig.hostname}${e}`);const c=Date.now(),l=await this._fetch(e,t).catch((e=>{if(e.name===FP)return new Response("{}");throw nw.info(`Error - ${e} (${Date.now()-c}ms)`),e})),d=l.headers.get("X-Request-Id")||"no requestId";if(nw.info(`[${d}] ${t.method||"GET"} ${e} ${l.status} (${Date.now()-c}ms)`),l.status>=300)throw"UNAUTHORIZED"===fw(l).requestErrorCode&&(null===(n=this._refreshAccessToken)||void 0===n||n.call(this)),await this._getFetchError(l);return l}async _getFetchError(e){if(403===e.status)try{const t=await e.json();if("string"==typeof t.type&&"quota"===t.type.toLowerCase())return new tw("EXCEEDS_QUOTA",t.problem_type_message||"Storage quota exceeded")}catch(e){}return fw(e)}fetchAllPages(e,t,i,s,r=!0){var n,o;return Xe(this,arguments,(function*(){let a=e;for(;a;){const{headers:e={}}=t,c=qe(t,["headers"]);r&&([a]=this.moveUrlQueryParamsToHeaders(a,e));const l=yield Je(this.fetch(a,Object.assign(Object.assign({signal:s},c),{headers:e})).then((e=>e.json())));yield yield Je(i(l)),a=null===(o=null===(n=l._links)||void 0===n?void 0:n.next)||void 0===o?void 0:o.href}}))}fetchOnePage(e,t,i,s=!0){return Xe(this,arguments,(function*(){let r;s&&([e,r]=this.moveUrlQueryParamsToHeaders(e));const n=yield Je(this.fetch(e,{signal:i,headers:r}).then((e=>e.json())));yield yield Je(t(n))}))}async copyFile(e,t,i){throw new Error("Not supported in cloud mode.")}async getFileSize(e){throw new Error("Not supported in cloud mode.")}getRenditionGrid(e){throw new Error("Not supported in cloud mode.")}async stageRepresentationForCommit(e,t,i){var s;const r=i||t.type,n=await this._fetchLibraryLinks(e),o=n[Hw.COMPONENT],a=n[Hw.BLOCK_INIT],c=(null==a?void 0:a["repo:maxSingleTransferSize"])||RP;if(!o)throw new tw("NOT_ALLOWED","Library is missing component upload link",e.id);const l=bi.v4(),d=mt(o.href).fill({component_id:l}),u=await async function(e,t){if(PP(t))try{return"undefined"!=typeof window&&window.FileReader&&window.Image?function(e){return new Promise((t=>{const i=new FileReader;i.onload=e=>{var i;const s=new Image;s.onload=()=>{t({width:s.width,height:s.height})},s.onerror=()=>{t(void 0)},s.src=null===(i=e.target)||void 0===i?void 0:i.result},i.readAsDataURL(e)}))}(e):void 0}catch(e){return}}(t,r),h={id:l,storage_href:d,asset_id:e.assetId,type:r,content_length:t.size,name:t.name,width:null==u?void 0:u.width,height:null==u?void 0:u.height};if(t.size>c&&a){const e=await this._initializeBlockUpload(a,l,t,r);await this._transferBlocks(e,t);const i=await this._finalizeBlockUpload(e);return Object.assign(h,i),JSON.stringify(h)}const p=await this.fetch(d,{method:"PUT",headers:{"Content-Type":r},body:await t.arrayBuffer()});return Object.assign(h,{etag:p.headers.get("etag"),md5:null!==(s=p.headers.get("content-md5"))&&void 0!==s?s:void 0,version:p.headers.get("revision")}),JSON.stringify(h)}async _fetchLibraryLinks(e){if(!e.assetId)throw new tw("NOT_SUPPORTED","Library does not have an assetId",e.id);const t=await this.fetch(`https://${this.driverConfig.platform_hostname}`),i=(await t.json())._links[Hw.RESOLVE],s=mt(i.href).fill({id:e.assetId}),r=(await this.fetch(s,{method:"HEAD"})).headers.get("link");return r?function(e){const t={};do{const i=e.indexOf("<");if(-1===i)break;let s=e.indexOf("<",i+1);-1===s&&(s=e.length);const r=xC(e.substring(i,s));r&&(t[r.rel]=r),e=e.substring(s)}while(e.length>0);return t}(r):{}}async _initializeBlockUpload(e,t,i,s){const r={"repo:size":i.size,"repo:blocksize":e["repo:maxSingleTransferSize"]||RP,"repo:reltype":Hw.COMPONENT,component_id:t,"dc:format":s},n=await this.fetch(e.href,{method:"POST",headers:{"Content-Type":"application/vnd.adobecloud.bulk-transfer+json"},body:JSON.stringify(r)});return await n.json()}async _transferBlocks(e,t){const i=e["repo:blocksize"],s=e._links[Hw.BLOCK_TRANSFER];let r=0;const n=[];for(let e=0;r<=t.size;e+=1){const o=Math.min(r+i,t.size);n.push(this.fetch(s[e].href,{method:"PUT",headers:{"Content-Length":String(o-r)},body:t.slice(r,o),duplex:"half"},{includeAuthHeader:!1})),r+=i}return await Promise.all(n)}async _finalizeBlockUpload(e){var t;const i=e._links[Hw.BLOCK_FINALIZE];let s=i.href;i.templated&&(s=mt(i.href).fill({}));const r=this.fetch(s,{method:"POST",headers:{"Content-Type":"application/vnd.adobecloud.bulk-transfer+json"},body:JSON.stringify(e)}),n=await r;return n.status===BP.ACCEPTED?new Promise(((e,t)=>{const i=new Ew(this,r);i.on("change",((s,r,n)=>{var o;s&&(i.error?t(i.error):e({etag:n.get("etag"),md5:null!==(o=n.get("content-md5"))&&void 0!==o?o:void 0,version:n.get("version")}))}))})):{etag:n.headers.get("etag"),md5:null!==(t=n.headers.get("content-md5"))&&void 0!==t?t:void 0,version:n.headers.get("version")}}getLocalDriver(){return new KR(this._core,(()=>this._requestProcessToUploadData(bi.v4(),Date.now())))}async _requestProcessToUploadData(e,t){var i;if(Date.now()-t>15e3)throw nw.log("Timed out and no response received from process and/or server"),new Error("Unable to get process connection info (timed out)");const s=`https://${e}.${tR(null===(i=this.config.user)||void 0===i?void 0:i.id)}.adobelocalhost.com`,r=[];for(let e=LP[0];e<=LP[1];e+=1)r.push(`${s}:${e}`);this.resetAbortController(),await Promise.allSettled(r.map((e=>fetch(e))));try{const[t]=await Promise.all([this._fetchProcessConnectInfo(e).catch((()=>{})),cw(1e3)]);if(!t)throw new mw("MALFORMED_RESPONSE",`Invalid response retrieving process connection data for uuid: ${e}`);return t}catch(i){return nw.error(String(i)),this._requestProcessToUploadData(e,t)}}async _fetchProcessConnectInfo(e){const t=`https://${this.driverConfig.hostname}/api/v1/client-tokens/${e}`,i=await this.fetch(t).then((e=>e.json()),(e=>nw.error(e))),{restApiToken:s,restApiPort:r}=JSON.parse(i.token);if(!s||!r)throw new mw("MALFORMED_RESPONSE","Response did not include necessary process connection data");return{hostname:`http://127.0.0.1:${r}`,token:s}}getClientInfo(){var e;return{deviceId:`${this._clientId}-${null===(e=this.config.user)||void 0===e?void 0:e.id}`,device:"undefined"!=typeof window?window.navigator.userAgent:"node-js",app:this._clientId}}async getTempDir(e){throw new Error("Not supported in cloud mode.")}ignoreLocalSyncEvents(){return!1}};Ye([rA],dR.prototype,"getLibraryById",null),Ye([rA],dR.prototype,"_getAllElements",null),Ye([rA],dR.prototype,"_getElementsOfTypeByAssetId",null),Ye([rA],dR.prototype,"getTeams",null),Ye([rA],dR.prototype,"getProjects",null),Ye([rA],dR.prototype,"getProjectByName",null),Ye([rA],dR.prototype,"getProjectGradient",null),Ye([rA],dR.prototype,"getRendition",null),Ye([rA],dR.prototype,"fetch",null),Ye([rA],dR.prototype,"stageRepresentationForCommit",null),dR=Ye([sA("CloudDriver")],dR);var uR=dR;class hR{static getInstance(e){let t=this.libAbortControllerMap.get(e);return t||(t=new AbortController,this.libAbortControllerMap.set(e,t)),t}static removeInstance(e){return this.libAbortControllerMap.delete(e)}}function pR(e,t=!1){var i;const s=!t&&e.is_writable,r={id:e.id,etag:e.etag,name:e.name,ownership:e.ownership,default:e.default,localizedNames:e.localized_names,toolkitId:e.toolkit_id,documentId:e.document_id,documentType:e.document_type,createdDate:e.created_date,modifiedDate:e.modified_date,groups:(e.groups||[]).map(gR),details:{elementCount:e.details.num_elements,documentationElementCount:e.details.num_documentation_elements,removedElementCount:e.details.num_archived_elements},renditionGrid:e.rendition_grid,collaboration:e.collaboration,assetId:e.asset_id,isWritable:s,isParentWritable:!t&&e.is_parent_writable,team:e.team_id?{id:e.team_id}:void 0,roles:e.roles,owner:e.owner,ownerType:e.owner_type,customData:e.custom_data,isLibraryLoaded:!0,storageUsed:e.storage_used,publicLinkId:(n=e.public_link,null==n?void 0:n.substring(n.lastIndexOf("/")+1)),locallyManaged:e.locally_managed,bookmark:e.bookmark,removeType:null!==(i=e.remove_type)&&void 0!==i?i:s?"delete":"none",deletable:s};var n;return e.elements&&(r.elements=e.elements.map(mR)),r}function _R(e){var t,i;return{id:e.id,name:e.name,ownership:e.ownership,default:e.default,localized_names:e.localizedNames,toolkit_id:e.toolkitId,document_id:e.documentId,document_type:e.documentType,groups:null===(t=e.groups)||void 0===t?void 0:t.map(yR),collaboration:e.collaboration,details:{num_elements:0,num_documentation_elements:0,num_archived_elements:0},team_id:null===(i=e.team)||void 0===i?void 0:i.id,roles:e.roles,custom_data:e.customData}}function mR(e){var t,i,s;return{id:e.id,name:e.name,isAutoNamed:e.is_auto_named,autoName:e.auto_name,type:e.type,libraryId:null===(t=e.library)||void 0===t?void 0:t.id,sourceRef:e.source_ref,sourceModifiedDate:e.source_modified_date,tags:e.tags,dependencyIds:e.dependency_ids,localizedNames:e.localized_names,createdDate:e.created_date,createdLocally:e.created_locally,createdBy:e.created_by,createdContext:e.created_context,modifiedDate:e.modified_date,modifiedLocally:e.modified_locally,modifiedBy:e.modified_by,modifiedContext:e.modified_context,description:e.description,descriptionModifiedDate:e.description_modified_date,descriptionModifiedLocally:e.description_modified_locally,descriptionModifiedBy:e.description_modified_by,descriptionModifiedContext:e.description_modified_context,removedDate:e.removed_date,removedLocally:e.removed_locally,removedBy:e.removed_by,removedContext:e.removed_context,representations:null===(i=e.representations)||void 0===i?void 0:i.map(bR),groups:null===(s=e.groups)||void 0===s?void 0:s.map(vR),roles:e.roles,customData:e.custom_data,elementRef:e.element_ref}}function fR(e){var t,i;return{id:e.id,name:e.name,is_auto_named:e.isAutoNamed,auto_name:e.autoName,type:e.type,source_ref:e.sourceRef,description:e.description,tags:e.tags,dependency_ids:e.dependencyIds,localized_names:e.localizedNames,created_date:e.createdDate,modified_date:e.modifiedDate,representations:null===(t=e.representations)||void 0===t?void 0:t.map((e=>IR(e,!1))),groups:null===(i=e.groups)||void 0===i?void 0:i.map(OR),roles:e.roles,custom_data:e.customData}}function gR(e){return{id:e.id,classifier:e.classifier,name:e.name,order:e.order,parentId:e.parent_id,localizedNames:e.localized_names,createdDate:e.created_date,createdBy:e.created_by,createdContext:e.created_context,createdLocally:e.created_locally,modifiedDate:e.modified_date,modifiedBy:e.modified_by,modifiedContext:e.modified_context,modifiedLocally:e.modified_locally,sourceRef:e.source_ref,customData:e.custom_data}}function yR(e){return{id:e.id,classifier:e.classifier,name:e.name,order:e.order,parent_id:e.parentId,localized_names:e.localizedNames,created_date:e.createdDate,modified_date:e.modifiedDate,source_ref:e.sourceRef,custom_data:e.customData}}function vR(e){return{id:e.id,classifier:e.classifier,order:e.order}}function OR(e){return{id:e.id,classifier:e.classifier,order:e.order}}function bR(e){var t;return{id:e.id,type:e.type,relationship:e.relationship,isFullSize:e.is_full_size,isExternalLink:e.is_external_link,isPreferredThumbnail:e.is_preferred_thumbnail,customData:e.custom_data,path:e.path,width:e.width,height:e.height,contentLength:e.content_length,url:e.url,children:null===(t=e.children)||void 0===t?void 0:t.map(bR)}}function IR(e,t=!1){var i;return{id:e.id,type:e.type,relationship:t?void 0:e.relationship,is_full_size:!1,is_external_link:!1,source:e.source,children:null===(i=e.children)||void 0===i?void 0:i.map((e=>IR(e,!0))),custom_data:e.customData}}function ER(e){return{name:e.name,id:e.id,owner:{type:e.ownerType,id:e.ownerId},ownerName:e.ownerName,isWritable:e.permissions.includes("write")}}function TR(e){return{name:e.name,id:e.id,owner:{type:e.storageAssignee.type,id:e.storageAssignee.id},ownerName:e.storageAssignee.displayName,isReadOnly:e.isReadOnly,isWritable:!0}}function SR(e,t){if(e=(e||"0").toString().replace(/(\.0)*$/,"").replace(/[^.0-9]+/gim,"."),t=(t||"0").toString().replace(/(\.0)*$/,"").replace(/[^.0-9]+/gim,"."),(isNaN(parseInt(e,10))||parseInt(e,10)>250)&&(e="0"),(isNaN(parseInt(t,10))||parseInt(t,10)>250)&&(t="0"),e===t)return 0;const i=e.split("."),s=t.split(".");let r;for(let e=0;e<i.length&&e<s.length;e++){if(r=parseInt(i[e],10)-parseInt(s[e],10),isNaN(r))return isNaN(parseInt(i[e],10))?1:-1;if(r>0)return-1;if(r<0)return 1}return r=i.length-s.length,r>0?-1:r<0?1:0}hR.libAbortControllerMap=new Map;const AR=["updateLibrary","createElement","updateElement","removeElement","restoreElement","deleteElement","createGroup","updateGroup","removeGroup"];function PR(e,t){return Object.assign(Object.assign({},e),{data:t,originalAction:e})}const wR={updateLibrary:(e,t)=>PR(e,pR(t)),createElement:(e,t)=>PR(e,mR(t)),updateElement:(e,t)=>PR(e,mR(t)),restoreElement:(e,t)=>PR(e,mR(t)),removeElement:e=>e,deleteElement:e=>e,createGroup:(e,t)=>PR(e,gR(t)),updateGroup:(e,t)=>PR(e,gR(t)),removeGroup:e=>e};class CR extends Aw{constructor(){super(...arguments),this._actionMappers={updateLibrary:e=>({method:"PUT",path:"",body:_R(e.data)}),createElement:e=>({method:"POST",path:"elements",body:fR(e.data)}),updateElement:e=>({method:"PUT",path:`elements/${hC(e.path)}`,body:fR(e.data)}),removeElement:e=>({method:"DELETE",path:`elements/${hC(e.path)}`}),restoreElement:e=>({method:"POST",path:`removed_elements/${e.data.id}/restore`}),deleteElement:e=>({method:"DELETE",path:`elements/${hC(e.path)}?permanent=true`}),createGroup:e=>({method:"POST",path:"groups",body:yR(e.data)}),updateGroup:e=>({method:"PUT",path:`groups/${_C(e.path)}`,body:yR(e.data)}),removeGroup:e=>{var t;return{method:"DELETE",path:`groups/${_C(e.path)}${(null===(t=e.flags)||void 0===t?void 0:t.includeElements)?"?include_contents=true":""}`}}},this._actions=[]}async execute(){const e=EC(this._actions.map((e=>this._actionMappers[e.name](e)))),t=await this._driver.fetch(`/libraries/${this._library.id}`,{method:"PATCH",headers:{"If-Match":this._library.etag},body:JSON.stringify(e)}),i=await t.json();if(!Array.isArray(i)||i.length!==this._actions.length)throw new tw("INVALID_RESPONSE","Malformed batch response.",this._library.id);let s=this._actions.map(((e,t)=>wR[e.name](e,i[t])));return s=vC(s),{actions:s,etag:t.headers.get("ETag")}}supportsAction(e){return function(e){return AR.includes(e.name)}(e)}}Ye([Sw],CR.prototype,"execute",null);class RR extends Aw{supportsAction(e){return"updateElementContent"===e.name}addAction(e){return(!this._actions[0]||this._actions[0].path===e.path)&&super.addAction(e)}async execute(){const e=this._actions[this._actions.length-1],t=await this._updateElementContent(hC(e.path),e.data),i=mR(await t.json()),s=this._actions.map(((e,t)=>t!==this._actions.length-1?Object.assign(Object.assign({},e),{type:"no-op",originalAction:e}):Object.assign(Object.assign({},e),{data:i,originalAction:e})));return{actions:s,etag:t.headers.get("ETag")}}_updateElementContent(e,t){const i=Object.assign(Object.assign({},t),{representations:SC(gC(t.representations))});return this._driver.fetch(`/libraries/${this._library.id}/elements/${e}`,{method:"PUT",headers:{"If-Match":this._library.etag},body:JSON.stringify(fR(i))})}}Ye([Sw],RR.prototype,"execute",null);class LR extends Pw{constructor(){super(...arguments),this._actionMappers={createLibrary:e=>this._createLibraryActionMap(e),copyLibrary:e=>this._createLibraryActionMap(e),permanentlyDeleteLibrary:e=>this._permanentlyDeleteLibrary(e),removeLibrary:async e=>(await this._removeLibrary(),e),unfollowLibrary:async e=>(await this._removeLibrary("unfollow"),e),leaveLibrary:async e=>(await this._removeLibrary("leave"),e),moveLibrary:async e=>{const t=await this._moveLibrary();return Object.assign(Object.assign({},e),{data:t,originalAction:e})}}}supportsAction(e){return["createLibrary","removeLibrary","permanentlyDeleteLibrary","unfollowLibrary","leaveLibrary","copyLibrary","moveLibrary"].includes(e.name)}async _createLibraryActionMap(e){const t=await this._createLibrary(e);return Object.assign(Object.assign({},e),{type:"update",data:t,originalAction:e})}_createLibrary(e){const{data:t={},flags:i={}}=e;return new Promise(((e,s)=>{var r,n;const o=this._driver.fetch("/libraries",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:t.name,team_id:null===(r=t.team)||void 0===r?void 0:r.id,roles:t.roles,team_permission_inheritance:i.permissionInheritance,source:null===(n=i.source)||void 0===n?void 0:n.id})}),a=new Ew(this._driver,o);a.on("change",((t,i)=>{if(t){a.error&&s(a.error);const t=i?pR(i):void 0;e(t)}}))}))}_permanentlyDeleteLibrary(e){throw new Error("permanentlyDeleteLibrary not supported by LocalDriver, use removeLibrary instead")}_removeLibrary(e="remove"){return"remove"===e&&hR.getInstance(this._library.id).abort(),this._driver.fetch(`/libraries/${this._library.id}?action=${e}`,{method:"DELETE"}).then((()=>{"remove"===e&&hR.removeInstance(this._library.id)}))}_moveLibrary(){return this._driver.moveLibrary(this._library.id,this.action.data.team.id)}}class NR extends DC{constructor(){super(...arguments),this._actionMappers={uploadComponent:async e=>{const t=await this._driver.stageRepresentationForCommit(e.library,e.data.file,e.data.type);return Object.assign(Object.assign({},e),{data:{path:t},originalAction:e})}}}supportsAction(e){return"uploadComponent"===e.name}}class DR extends mC{async _doMoveCopyRequest(e,t,i,s){const r=this._library.id,n=i.id,o=await this._driver.fetch(`/libraries/${n}/elements`,{method:"POST",headers:{"If-Match":i.etag},body:JSON.stringify({[e?"self":"source"]:{id:r,elements:s,etag:this._library.etag}})});return{elements:(await o.json()).elements.map(mR),etag:o.headers.get("ETag"),sourceEtag:o.headers.get("Source-ETag")}}}class MR extends Aw{get action(){return this._actions[0]}supportsAction(e){return["moveGroup","copyGroup","dependent"].includes(e.name)}addAction(e){return!!this.supportsAction(e)&&(this._actions[this._actions.length-1]||"dependent"===e.name?"dependent"===e.name&&super.addAction(e):super.addAction(e))}async execute(){var e,t;const i="moveGroup"===this.action.name,s=this._library.id,r=null===(e=this.action.link)||void 0===e?void 0:e.library,n=null==r?void 0:r.id,o=_C(this.action.path),a=await this._driver.fetch(`/libraries/${n}/groups`,{method:"POST",headers:{"If-Match":null==r?void 0:r.etag},body:JSON.stringify({[i?"self":"source"]:{id:s,group_id:o,include_contents:null===(t=this.action.flags)||void 0===t?void 0:t.includeElements,etag:this._library.etag}})}),c=await a.json();let l,d;return r===this._library?(l=[],d=this._actions.map((e=>"dependent"!==e.name?e:Object.assign(Object.assign({},e),{data:c,originalAction:e})))):(d=this._actions,l=this._actions.map((e=>Object.assign(Object.assign({},e.link),{data:c,originalAction:e.link})))),{actions:d,etag:a.headers.get("Source-ETag"),linkedActions:l}}}Ye([Sw],MR.prototype,"execute",null);var xR,kR,HR,jR=function(){throw new Error("ws does not work in the browser. Browser clients must use the native WebSocket object")},UR="undefined"==typeof window?class extends Is{constructor(e){super();const t=e.replace(/http(s?):\/\//,"ws$1://");this._ws=new jR(t),this._ws.addEventListener("message",(e=>{try{const{type:t,message:i}=JSON.parse(e.data);nw.log(`[NOTIFICATIONS] Received event: ${t}`),this.emit(t,i)}catch(e){this.emit("error",new tw("INVALID_JSON","Received invalid JSON"))}})),this._ws.addEventListener("error",(e=>{this.close(),this.emit("error",e)}))}get isOpen(){return this._ws.readyState===this._ws.OPEN}close(){this.isOpen&&(this.removeAllListeners(),this._ws.close())}}:(null===(HR=null===(kR=null===(xR=null===window||void 0===window?void 0:window.navigator)||void 0===xR?void 0:xR.userAgent)||void 0===kR?void 0:kR.startsWith)||void 0===HR?void 0:HR.call(kR,"Adobe UXP Runtime"))?class extends Is{constructor(e){super();const t=e.replace(/http(s?):\/\//,"ws$1://");this._ws=new WebSocket(t),this._ws.addEventListener("message",(e=>{try{const{type:t,message:i}=JSON.parse(e.data);nw.log(`[NOTIFICATIONS] Received event: ${t}`),this.emit(t,i)}catch(e){this.emit("error",new tw("INVALID_JSON","Received invalid JSON"))}})),this._ws.addEventListener("error",(e=>{this.close(),this.emit("error",e)}))}get isOpen(){return this._ws.readyState===this._ws.OPEN}close(){this.isOpen&&(this.removeAllListeners(),this._ws.close())}}:class extends Is{constructor(e){super(),this._listenedEvents=new Set,this._errorCount=0,this._eventSource=new EventSource(e),this._eventSource.onopen=()=>{this._errorCount=0},this._eventSource.onerror=e=>{this._errorCount+=1,this._errorCount>=3&&(this.close(),this.emit("error",e))}}on(e,t){return super.on(e,t),this._listenedEvents.has(e)||(this._listenedEvents.add(e),this._eventSource.addEventListener(e,(t=>{nw.log(`[NOTIFICATIONS] Received event: ${e}`);try{this.emit(e,JSON.parse(t.data))}catch(e){t.data?this.emit("error",new tw("INVALID_JSON","Received invalid JSON")):this.emit("error",new tw("INVALID_RESPONSE","Received invalid response (no data)"))}}))),this}close(){this.removeAllListeners(),this._eventSource.close()}};class BR{constructor(e,t,i=2e3,s=8e3){this.vulcanInterface=e,this.VulcanMessage=t,this._timeout=i,this._launchTimeout=s}_generateListener(e,t){const i=s=>{clearTimeout(this._timeoutId),this.removeListener(i,t),e(s)};return i}async _connectionInfoHandler(e,t){if(!(null==t?void 0:t.aborted)){if(!e)throw new tw("REQUEST_FAILED","No Vulcan response received");try{const t=JSON.parse(this.getPayload(e)),i={apiVersion:t.apiVersion,apiMinVersion:t.apiMinVersion,apiMaxVersion:t.apiMaxVersion};if(t.updateRequired)return Object.assign(Object.assign({},i),{updateRequired:t.updateRequired});if(t.serviceToken&&t.serviceHostname)return Object.assign(Object.assign({},i),{token:t.serviceToken,hostname:t.serviceHostname});throw new tw("INVALID_RESPONSE","Incorrect data was returned via Vulcan")}catch(e){throw new tw("INVALID_RESPONSE","Incorrect data was returned via Vulcan",void 0,e)}}}async _launchProcessHandler(e,t){if(!(null==t?void 0:t.aborted)){if(!e)throw new tw("REQUEST_FAILED","No Vulcan response received");return this._requestConnectionInfo(t)}}_launchProcess(e){return new Promise((t=>{const i=this._generateListener((i=>t(this._launchProcessHandler(i,e))),this.getMessageType("INITIALIZE"));this._timeoutId=setTimeout(i,this._launchTimeout),this.sendMessage(i,this.getMessageType("INITIALIZE")),this.launchApp(i)}))}_requestConnectionInfo(e){return new Promise((t=>{const i=this._generateListener((i=>{t(this._connectionInfoHandler(i,e))}));this._timeoutId=setTimeout(i,this._timeout),this.sendMessage(i)}))}async connect(e){return this._requestConnectionInfo(e).catch((async t=>{if(!await this.isAppRunning().catch((()=>!1)))return this._launchProcess(e);throw t}))}getMessageType(e){return this.messageTypes[e]}}const FR={field:"modifiedDate",direction:"descending"},VR={reconnectOnErrors:[401,403],reconnectOnNoResponse:!0};class KR extends pw{constructor(e,t,i={}){super(e,t),this._libraryChangeListener=()=>{},this._renditionCacheChangeListener=()=>{},this._lastNotificationPayload={},this._operationTypes=[CR,RR,LR,DR,MR,NR],this._handleConfigurationMutation=e=>{const t=new ow(e);return this._needToReconnect(t)&&this.reconnect(),this._config=t,this.emit("configChange"),this.config},this._handleRenditionCacheMutation=e=>{this._renditionCacheChangeListener(mR(e))},this._handleLibraryMutation=e=>{if(!e)return;const t=new Set(Object.keys(e)),i=Object.keys(this._lastNotificationPayload).filter((i=>{const s=e[i];return t.delete(i),!s||"number"!=typeof s&&"string"!=typeof s}));i.push(...t),this._lastNotificationPayload=Object.keys(e).reduce(((t,i)=>{const s=e[i];return"number"==typeof s||"string"==typeof s?s&&(t[i]=s):t[i]=s.modified_date,t}),{}),this._libraryChangeListener(i)},this._options=i}getLibrary(e,t){return this._getLibraryById(e.id,t)}getElements(e,...t){return this._getElementsByLibraryId(e.id,...t)}getRemovedElements(e,...t){return this._getRemovedElementsByLibraryId(e.id,...t)}getDocumentationElements(e,...t){return this._getDocumentationElementsByLibraryId(e.id,...t)}getElement(e,t){return this._getElement(e.id,t)}reconnect(){var e;return null===(e=this._notificationEventSource)||void 0===e||e.close(),this.isConnected?super.reconnect():Promise.resolve()}async _handleConnected(e){if("updateRequired"in e)throw this._handleConfigurationMutation({config:{},environment:this._config.environment,processInfo:{updateRequired:e.updateRequired,apiVersion:e.apiVersion}}),new tw("CONNECTION_FAILED",`LocalDriver failed to connect - ${e.updateRequired} update required`);this._hostname=e.hostname,this._token=e.token,this._cloudParams=e.cloudParams,this._notificationEventSource=new UR(`${this._hostname}/notifications?token=${this._token}`),this._notificationEventSource.on("error",(e=>{e instanceof tw&&"INVALID_JSON"===e.libraryErrorCode?nw.log("[NOTIFICATIONS] Received invalid JSON object."):this.reconnect()})),await this.getConfiguration(),this._notificationEventSource.on("configurationMutation",this._handleConfigurationMutation.bind(this)),this._notificationEventSource.on("libraryMutation",this._handleLibraryMutation.bind(this)),this._notificationEventSource.on("renditionCacheMutation",this._handleRenditionCacheMutation.bind(this))}_handleDisconnected(){var e;null===(e=this._notificationEventSource)||void 0===e||e.close()}get cloudParams(){var e,t;if(this._cloudParams&&(null===(e=this.config.user)||void 0===e?void 0:e.id))return Object.assign(Object.assign({},this._cloudParams),{userId:null===(t=this.config.user)||void 0===t?void 0:t.id})}getCloudDriver(){if(this.cloudParams)return new uR(this._core,(async()=>{const{userId:e,clientId:t,clientSecret:i,scopes:s,core:r}=this.cloudParams,{access_token:n}=await this.fetchAccessToken(e,t,i,s);return{env:this.config.environment,core:r,token:n}}))}fetchAccessToken(e,t,i,s){var r;return this.fetch("/configuration/access_token",{method:"POST",body:JSON.stringify({userId:null===(r=this._config.user)||void 0===r?void 0:r.id,clientId:t,clientSecret:i,scopes:s})}).then((e=>e.json()))}_getElement(e,t){return this.fetch(`/libraries/${e}/elements/${t}`).then((e=>e.json())).then(mR)}_getElementsOfType(e,t,i=FR,s,r){return Xe(this,arguments,(function*(){const i={};s&&(i["if-none-match"]=s);const n=yield Je(this.fetch(`/libraries/${t}/${e}`,{headers:i,signal:r})),o=yield Je(n.json());yield yield Je(o.elements.map(mR))}))}_getElementsByLibraryId(e,t=FR,i,s,r){return Xe(this,arguments,(function*(){yield Je(yield*Ze(et(this._getElementsOfType("elements",e,t,i,r))))}))}async getElementsPage(e,t,i,s,r){throw new tw("NOT_IMPLEMENTED","LocalDriver.getElementsPage not implemented.")}getSearchResults(e,t,i,s){return Xe(this,arguments,(function*(){t.elements_only=!0;let r="name"===i.field?"name":"modified_date";"descending"===i.direction&&(r=`-${r}`);const n=e=>{var t,i;return null!==(i=null===(t=e.results)||void 0===t?void 0:t.map(mR))&&void 0!==i?i:[]},o={method:"POST",headers:{"Content-Type":"application/json"},signal:s};if("type"!==i.sectionType)o.body=JSON.stringify({q:e,order_by:r,filters:t,limit:300}),yield Je(yield*Ze(et(this.fetchAllPages("/search",o,n))));else for(const s of i.sections)t.element_types=t.element_types=[s],o.body=JSON.stringify({q:e,order_by:r,filters:t,limit:300}),yield Je(yield*Ze(et(this.fetchAllPages("/search",o,n))))}))}fetchAllPages(e,t,i){var s,r,n,o;return Xe(this,arguments,(function*(){let a=e;for(;a;){const e=yield Je(this.fetch(a,t).then((e=>e.json())));yield yield Je(i(e)),a=null===(r=null===(s=e._links)||void 0===s?void 0:s.next)||void 0===r?void 0:r.uri;const c=null===(o=null===(n=e._links)||void 0===n?void 0:n.next)||void 0===o?void 0:o.body;c&&(t.body=JSON.stringify(c))}}))}_getDocumentationElementsByLibraryId(e,t=FR,i){return Xe(this,arguments,(function*(){yield Je(yield*Ze(et(this._getElementsOfType("documentation_elements",e,t,i))))}))}_getRemovedElementsByLibraryId(e,t=FR,i){return Xe(this,arguments,(function*(){yield Je(yield*Ze(et(this._getElementsOfType("removed_elements",e,t,i))))}))}async getTeams(){const e=await this.fetch("/teams"),t=await e.json();return void 0!==t.teams?t.teams.map(ER):[]}async getProjects(){var e,t;const i=await this.fetch("/projects"),s=await i.json();return null!==(t=null===(e=null==s?void 0:s.projects)||void 0===e?void 0:e.map(TR))&&void 0!==t?t:[]}async getProjectGradient(e){const t=await this.fetch(`/projects/${e.id}/gradient`),i=await t.json();return i.gradient?{type:(s=i.gradient).type,angle:s.angle,stops:s.stops}:void 0;var s}getGroups(e){return Xe(this,arguments,(function*(){yield yield Je(Promise.resolve(void 0))}))}getLibraries(){return Xe(this,arguments,(function*(){let e="/libraries";this._options.ignoreRenditionGrids||(e+="?includeRenditionGrid=true"),yield yield Je(this.fetch(e).then((e=>e.json())).then((e=>void 0!==e.libraries?e.libraries.map((e=>pR(e,this._options.readOnly))):[])))}))}getLibrariesList(){return Xe(this,arguments,(function*(){yield yield Je(Promise.resolve(void 0))}))}getLibrariesPage(){return Xe(this,arguments,(function*(){yield yield Je(Promise.resolve(void 0))}))}_getAllElements(e,t){var i,s;return Xe(this,arguments,(function*(){var r,n,o,a;const c=[["elements","_getElementsByLibraryId"],["documentationElements","_getDocumentationElementsByLibraryId"],["removedElements","_getRemovedElementsByLibraryId"]],l={};for(const[p,_]of c)if(t.types.includes(p))try{for(var d,u=!0,h=(n=void 0,et(this[_](e,t.sort,t.etag,void 0,null===(i=t.abortController)||void 0===i?void 0:i.signal)));!(r=(d=yield Je(h.next())).done);){a=d.value,u=!1;try{const e=a;l[p]=l[p]||[],null===(s=l[p])||void 0===s||s.push(...e),t.loadProgressively&&(yield yield Je({[p]:l[p]}))}finally{u=!0}}}catch(e){n={error:e}}finally{try{u||r||!(o=h.return)||(yield Je(o.call(h)))}finally{if(n)throw n.error}}yield yield Je(Object.assign({areElementsLoaded:!0},t.loadProgressively?{}:l))}))}async getLibraryById(e,t){const{value:i}=await this._getLibraryById(e,t).next();return i}_getLibraryById(e,t={}){var i;return Xe(this,arguments,(function*(){const s=t.etag;try{const r={};let n;s&&(r["if-none-match"]=s),void 0!==t.optimisticFetch&&(n={optimisticFetch:t.optimisticFetch});let o=`/libraries/${e}`;this._options.ignoreRenditionGrids||(o+="?includeRenditionGrid=true");const a=yield Je(this.fetch(o,{headers:r},n));if(202===a.status)return yield Je(void 0);const c=yield Je(a.json());c.etag=a.headers.get("ETag"),t.elementParams?delete c.elements:null!==(i=c.elements)&&void 0!==i||(c.elements=[]);const l=pR(c,this._options.readOnly);yield yield Je(l)}catch(e){if(!(e instanceof mw&&"NOT_MODIFIED"===e.requestErrorCode&&t.elementParams))throw e}t.elementParams&&(yield Je(yield*Ze(et(this._getAllElements(e,Object.assign(Object.assign({},t.elementParams),{etag:t.firstElementsLoad?void 0:s}))))))}))}followLibrary(e,t){return this.fetch("/libraries",{method:"POST",body:JSON.stringify({follow:!0,type:"collab",id:t,assetId:e})}).then((()=>{}))}moveLibrary(e,t){return new Promise(((i,s)=>{const r=this.fetch("/libraries",{method:"POST",body:JSON.stringify({self:e,team_id:t})}),n=new Ew(this,r);n.on("change",((e,t)=>{e&&(n.error?s(n.error):t?i(pR(t)):i())}))}))}importLibrary(e,t=(()=>{})){if("string"!=typeof e)throw new Error("Input must be a local path in local mode.");const i=this.fetch("/libraries",{method:"POST",body:JSON.stringify({source:{path:e}})}),s=new Ew(this,i);return s.on("change",((e,i)=>{if(e){const e=i?pR(i):void 0;t(s.error,e)}})),s}exportLibrary(e,t,i=(()=>{})){if(!t)throw new Error("Destination path is required in local mode.");const s=this.fetch(`/libraries/${e.id}/export`,{method:"POST",body:JSON.stringify({path:t})}),r=new Ew(this,s);return r.on("change",(e=>{e&&i(r.error)})),r}async abortOperation(e){return this.fetch(e,{method:"DELETE"})}getRenditionUrl(e,t){return`${this._hostname}/libraries/${e.library.id}/elements/${e.elementId}/renditions/${t}?token=${this._token}`}getAuthenticatedThumbnailURL(e,t){return this.fetch(`/libraries/${e.library.id}/elements/${e.elementId}/renditions/${t}/url`,{headers:{"cache-control":"none"}}).then((e=>e.json())).then((e=>e.url))}getRenditionPath(e,t,i){const s=hR.getInstance(e);return this.fetch(`/libraries/${e}/elements/${t}/renditions/${i}/path`,{headers:{"cache-control":"none"},signal:s.signal}).then((e=>e.json())).then((e=>e.path))}getRendition(e,t){return this.fetch(`/libraries/${e.library.id}/elements/${e.elementId}/renditions/${t}`)}getRepresentationContent(e){return this.fetch(`/libraries/${e.library.id}/elements/${e.element.elementId}/representations/${e.id}`)}setLibraryChangeListener(e,t){this._libraryChangeListener=t}setRenditionCacheChangeListener(e){this._renditionCacheChangeListener=e}setFontDataChangeListener(e){var t;this.removeFontDataChangeListeners(),null===(t=this._notificationEventSource)||void 0===t||t.on("fontDataMutation",e)}setSyncStateListener(e){var t,i;null===(t=this._notificationEventSource)||void 0===t||t.removeAllListeners("syncMutation"),null===(i=this._notificationEventSource)||void 0===i||i.on("syncMutation",e)}removeLibraryChangeListener(){var e;null===(e=this._notificationEventSource)||void 0===e||e.removeAllListeners("libraryMutation")}removeFontDataChangeListeners(){var e;null===(e=this._notificationEventSource)||void 0===e||e.removeAllListeners("fontDataMutation")}removeSyncStateListener(){var e;null===(e=this._notificationEventSource)||void 0===e||e.removeAllListeners("syncMutation")}removeRenditionCacheChangeListener(){var e;null===(e=this._notificationEventSource)||void 0===e||e.removeAllListeners("renditionCacheMutation")}_needToReconnect(e){var t,i,s;return(null===(i=null===(t=this.config)||void 0===t?void 0:t.user)||void 0===i?void 0:i.id)&&this.config.user.id!==(null===(s=e.user)||void 0===s?void 0:s.id)||!1}async getConfiguration(){const e=await this.fetch("/configuration"),t=await e.json();return this._handleConfigurationMutation(t),this.config}async updateRenditionCacheConfiguration(e,t){return e||t?(await this.updateConfiguration({RENDITION_SIZES:e,FULL_RENDITION_CONFIG:t}).catch((e=>{nw.error(`Unable to update process configuration. ${e}`)})),this.config):this.config}async updateConfiguration(e){if(Object.keys(e).length){const t=await this.fetch("/configuration",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}),i=await t.json();this._handleConfigurationMutation(i)}return this.config}async setLocalSetting(e,t){void 0===t&&(t=null),await this.updateConfiguration(Object.fromEntries([[e,t]])),this._config.config[e]=t}getLocalSetting(e){var t;return null===(t=this._config.config)||void 0===t?void 0:t[e]}getInstalledVersion(e){return this._config.installedApps.filter((t=>t.code.toLowerCase()===e.toLowerCase())).map((e=>e.version)).sort(SR)[0]}async sendAction(e){return this.fetch("/action",{method:"POST",body:e.toJSON()})}async openInCCD(e){return this.fetch("/action/open_ccd",{method:"POST",body:JSON.stringify({path:e})})}async fetch(e,t,i={}){var s,r,n,o;(t=t||{}).headers=t.headers||{},t.headers.token=this._token,t.headers["Content-Type"]=t.headers["Content-Type"]||"application/json",t.headers["x-client-version"]="15",i=Object.assign(Object.assign({},VR),i),!this._options.optimistic||void 0!==i.optimisticFetch&&!0!==i.optimisticFetch||(t.headers["x-optimism"]="true"),t.signal=t.signal?lw(t.signal,null===(s=this._abortController)||void 0===s?void 0:s.signal):null===(r=this._abortController)||void 0===r?void 0:r.signal;try{const i=await fetch(`${/^https?:\/\//.test(e)?"":this._hostname}${e}`,t);if(i.status>=300){const e=await i.text();throw fw(i,e.replace(/["]+/g,""))}return i}catch(e){if(mw.isRequestError(e)){const t=(null===(n=null==i?void 0:i.reconnectOnErrors)||void 0===n?void 0:n.includes(null===(o=e.response)||void 0===o?void 0:o.status))&&this.isConnected;if(t)this.reconnect();else if(!t&&e.name===FP)return new Response("{}")}else"Failed to fetch"===e.message&&(null==i?void 0:i.reconnectOnNoResponse)?(nw.warn(`Fetch request failed to respond: ${e}`),this.reconnect()):"Network request failed"===e.message&&(nw.warn(`Network request failed to respond: ${e}`),this.reconnect());throw e}}async copyFile(e,t,i=!1){const s=await this.fetch("/util/file/copy",{method:"POST",body:JSON.stringify({source:e,destination:t,allowOverride:Boolean(i)})},{reconnectOnNoResponse:!0,reconnectOnErrors:[401]});return(await s.json()).path}async getFileSize(e){const t=await this.fetch("/util/file/size",{method:"POST",body:JSON.stringify({path:e})});return(await t.json()).size}getRenditionGrid(e){return e.renditionGrid}async stageRepresentationForCommit(e,t,i){var s,r,n;try{if(t instanceof File){const e=await this.fetch("/util/file",{method:"POST",headers:{"Content-Type":null===(r=AP(null===(s=t.name)||void 0===s?void 0:s.split(".")[1]))||void 0===r?void 0:r[0]},body:t});return(await e.json()).path}}catch(e){if((null===(n=null==e?void 0:e.response)||void 0===n?void 0:n.status)===BP.INTERNAL_SERVER_ERROR)return Promise.reject(e)}return t.path}async isSystemFontAvailable(e,t){const i=await this.fetch("/util/font/available",{method:"POST",body:JSON.stringify({font_name:e,match_family:t})});return(await i.json()).is_font_available}async getFontData(e){const t=await this.fetch("/util/font/data",{method:"POST",body:JSON.stringify({font_id:e})});return(await t.json()).font_data}async getTempDir(e){if(!e||!e.id)throw new tw("INVALID_PARAMETER","Need to pass a library with an ID");const t=await this.fetch(`/libraries/${e.id}/temp_dir`);return(await t.json()).path}getCollaborators(e){throw new tw("NOT_IMPLEMENTED","LocalDriver.getCollaborators not implemented.")}ignoreLocalSyncEvents(){return!0}}class GR extends uR{constructor(e,t,i,s={}){super(e,(()=>i().then((e=>Object.assign({samDisableOns:!0},e))))),this._localConnector=t,this._cloudConnector=i,this._localDriver=new KR(e,t,Object.assign(Object.assign({},s),{optimistic:!0}))}connect(){return Promise.all([this.localDriver.connect(),super.connect()]).then((()=>{}))}get localDriver(){return this._localDriver}call(e,t,...i){return e.locallyManaged?this._localDriver[t](...i):super[t](...i)}_handleDisconnected(){super._handleDisconnected(),this.localDriver.isConnected&&this.localDriver.disconnect()}setLibraryChangeListener(e,t){this.localDriver.setLibraryChangeListener(e,t)}setFontDataChangeListener(e){this.localDriver.setFontDataChangeListener(e)}removeFontDataChangeListeners(){this.localDriver.removeFontDataChangeListeners()}getLibraries(){return this.localDriver.getLibraries()}getLibrary(e,t){return e.locallyManaged||(null==t?void 0:t.optimisticFetch)?this.localDriver.getLibrary(e,t):super.getLibrary(e,t)}getElements(e,t,i,s,r){return this.call(e,"getElements",t,i,s,r)}getElement(e,t){return this.call(e,"getElement",e,t)}async getLibraryById(e,t){return(null==t?void 0:t.optimisticFetch)||(null==t?void 0:t.locallyManaged)?this._localDriver._getLibraryById(e,t).next():super.getLibraryById(e)}getRenditionUrl(e,t){return this.call(e.library,"getRenditionUrl",e,t)}getRendition(e,t){return this.call(e.library,"getRendition",e,t)}getRepresentationContent(e){return this.call(e.library,"getRepresentationContent",e)}getOperationTypes(e){return e.locallyManaged?this._localDriver.getOperationTypes(e):super.getOperationTypes(e)}operationFactory(e,t,i){return new e(i.locallyManaged?this._localDriver:this,i)}ignoreLocalSyncEvents(){return this.localDriver.isConnected?this.localDriver.ignoreLocalSyncEvents():super.ignoreLocalSyncEvents()}}class $R{}function WR(e){return void 0!==e.launchAppEx?new YR(e):new qR(e)}class zR extends $R{constructor(e){super(),this._specifer=kP,this._vulcanInterface=e}addMessageListener(e,t,i){this.vulcanInterface.addMessageListener(e,t,i)}removeMessageListener(e,t,i){this.vulcanInterface.removeMessageListener(e,t,i)}dispatchMessage(e){this.vulcanInterface.dispatchMessage(e)}getPayload(e){return this.vulcanInterface.getPayload(e)}}class qR extends zR{constructor(e){super(e),this._vulcanInterface=e,this._specifer=kP}get vulcanInterface(){return this._vulcanInterface}getTargetSpecifiers(){return this.vulcanInterface.getTargetSpecifiers()}launchApp(e,t){return this.vulcanInterface.launchApp(this._specifer,e,t)}isAppRunning(){return this.vulcanInterface.isAppRunning(this._specifer)}isAppInstalled(){return this.vulcanInterface.isAppInstalled(this._specifer)}getAppPath(){return this.vulcanInterface.getAppPath(this._specifer)}}class YR extends zR{constructor(e){super(e),this._specifer=HP}get vulcanInterface(){return this._vulcanInterface}getTargetSpecifiers(){return this.vulcanInterface.getTargetSpecifiersEx()}launchApp(e,t){return this.vulcanInterface.launchAppEx(this._specifer,e,t)}isAppRunning(){return this.vulcanInterface.isAppRunningEx(this._specifer)}isAppInstalled(){return this.vulcanInterface.isAppInstalledEx(this._specifer)}getAppPath(){return this.vulcanInterface.getAppPathEx(this._specifer)}}class QR extends BR{constructor(e,t,i){super(WR(e),t,i),this.messageTypes={REQUEST:"vulcan.SuiteMessage.cclibraries.api.QueryRequest",RESPONSE:"vulcan.SuiteMessage.cclibraries.api.QueryResponse",INITIALIZE:"vulcan.SuiteMessage.cclibraries.service.Initialized"}}removeListener(e,t){return this.vulcanInterface.removeMessageListener(t||this.messageTypes.RESPONSE,e)}sendMessage(e,t){if(this.vulcanInterface.addMessageListener(t||this.messageTypes.RESPONSE,e),t!==this.messageTypes.INITIALIZE){const e=new this.VulcanMessage(this.messageTypes.REQUEST);e.setPayload(jP),this.vulcanInterface.dispatchMessage(e)}}async isAppRunning(){return this.vulcanInterface.isAppRunning()}launchApp(e){this.vulcanInterface.launchApp()}getPayload(e){return this.vulcanInterface.getPayload(e)}}class JR extends BR{constructor(e,t,i){super(WR(e),t,i),this.messageTypes={REQUEST:"cclibraries.api.QueryRequest",RESPONSE:"cclibraries.api.QueryResponse",INITIALIZE:"cclibraries.service.Initialized"}}_wrapHandler(e){return(t,i)=>e(i)}removeListener(e,t){return this.vulcanInterface.removeMessageListener(t||this.messageTypes.RESPONSE,e)}sendMessage(e,t){if(this.vulcanInterface.addMessageListener(t||this.messageTypes.RESPONSE,this._wrapHandler(e)),t!==this.messageTypes.INITIALIZE){const e=new this.VulcanMessage(this.messageTypes.REQUEST);e.data=jP,this.vulcanInterface.dispatchMessage(e)}}async isAppRunning(){return this.vulcanInterface.isAppRunning()}launchApp(e){this.vulcanInterface.launchApp()}getPayload(e){return e}}class XR extends BR{constructor(e,t,i){super(WR(e),t,i),this.messageTypes={REQUEST:"cclibraries.api.QueryRequest",RESPONSE:"cclibraries.api.QueryResponse",INITIALIZE:"cclibraries.service.Initialized"}}_wrapHandler(e){return(t,i)=>e(t)}removeListener(e,t){return this.vulcanInterface.removeMessageListener(t||this.messageTypes.RESPONSE,e)}sendMessage(e,t){if(this.vulcanInterface.addMessageListener(t||this.messageTypes.RESPONSE,this._wrapHandler(e)),t!==this.messageTypes.INITIALIZE){const e={message:jP,type:t||this.messageTypes.REQUEST};this.vulcanInterface.dispatchMessage(e)}}async isAppRunning(){return this.vulcanInterface.isAppRunning()}launchApp(e){this.vulcanInterface.launchApp()}getPayload(e){return e}}class ZR extends BR{constructor(){super(...arguments),this.messageTypes={REQUEST:"vulcan.SuiteMessage.cclibraries.api.QueryRequest",RESPONSE:"vulcan.SuiteMessage.cclibraries.api.QueryResponse",INITIALIZE:null}}get _installedAppsFn(){const{getInstalledApps:e,getInstalledAppsEx:t}=this.vulcanInterface.control;return t?t.bind(this.vulcanInterface.control):e.bind(this.vulcanInterface.control)}async _getCCLibrariesInstall(){return(await this._installedAppsFn()).find((e=>e.name===kP||e.sapCode===HP))}removeListener(e,t){null!==t&&this.vulcanInterface.dispatcher.removeEventListener(this.messageTypes.RESPONSE,e)}sendMessage(e,t){null!==t&&(this.vulcanInterface.dispatcher.addEventListener(this.messageTypes.RESPONSE,e),this.vulcanInterface.dispatcher.broadcastMessage(new this.vulcanInterface.message(this.messageTypes.REQUEST,jP)))}async isAppRunning(){var e;return null===(e=await this._getCCLibrariesInstall())||void 0===e?void 0:e.isRunning()}async launchApp(e){const t=await this._getCCLibrariesInstall();t&&(await t.launch(),e("launched"))}getPayload(e){return e.payload}}class eL extends _w{constructor(e){super(),this._generator=e,this._results=[],this._getPages()}async _getPages(){var e,t,i,s;try{for(var r,n=!0,o=et(this._generator(this._abortController.signal));!(e=(r=await o.next()).done);){s=r.value,n=!1;try{const e=s;this._results.push(...e),this.emit("change",!1)}finally{n=!0}}}catch(e){t={error:e}}finally{try{n||e||!(i=o.return)||await i.call(o)}finally{if(t)throw t.error}}this.progress=100,this.emit("change",!0)}get results(){return this._results}}var tL=new class{constructor(){this._contexts=new Map}register(e,t){const i=bi.v4();return this._contexts.set(i,{createAtom:e,transaction:t}),()=>this._contexts.delete(i)}transaction(e){return Array.from(this._contexts.values()).reduce(((e,{transaction:t})=>()=>t((()=>e()))),e)()}reportObserved(e,t){for(const[i,{createAtom:s}]of this._contexts){const r=`_atom_${i}_${t}`;let n=e[r];if(!n){const i=()=>n.reportChanged();n=s(`${e.constructor.name}${r}`,(()=>e.on(t,i)),(()=>e.off(t,i))),e[r]=n}n.reportObserved()}}};function iL(...e){return function(t,i,s){const r=s.get?"get":s.value?"value":void 0;if(r){const t=s[r];s[r]=function(...i){for(const t of e)tL.reportObserved(this,t);return t.apply(this,i)}}}}function sL(...e){return(e=>"string"!=typeof e[0])(e)?iL("change")(...e):iL(...e)}class rL extends Ks{get _childrenData(){return this._children.map((e=>e._data))}constructor(e,t){super(e,t),this.core=e,this._isCommitted=!1,this._waitingForCommit=!1,this._children=[],this._libraryContext=e._getLibraryContext(),this._apiRoot=this._libraryContext._getLibrariesModule_NoLoad(),this._driver=this._apiRoot.driver,this._commitFuture=new Promise(((e,i)=>{this._commitResolver=()=>{this._isCommitted=!0,e()},WP(t)||this._commitResolver(),this.on("remove",(()=>{this._waitingForCommit&&!this._isCommitted&&i()}))}))}_update(e){const t=WP(this.id)&&e.id&&this.id!==e.id;this._updateImplementation(e),t&&this._commitResolver&&this._commitResolver()}_updateChildren(e){this._children&&((()=>{e.forEach((e=>{let t=this._children.find((t=>t.id===e.id||t.id===e.previousPlaceholderId));t?(t._update(e),t.emit("change")):(t=new this._ChildClass(this._core,this,e),this._children.push(t))}))})(),(()=>{const t=new Set(e.map((e=>e.id))),i=this._childrenData.filter((e=>!t.has(e.id)));i.forEach((e=>{const t=this._children.find((t=>t.id===e.id));t&&(t.emit("remove"),t.removeAllListeners())}))})())}get committed(){return this._waitingForCommit=!0,this._commitFuture}get isCommitted(){return this._isCommitted}}function nL(e,t,i){const s=i.set?"set":i.value?"value":void 0;if(s){const e=i[s];i[s]=function(...i){if(this.library&&!this.library.hasPermission(Gi.Write))throw new tw("NOT_ALLOWED",`${t} requires write access`,this.id);return e.apply(this,i)}}}function oL(e,t,i){const s=i.set?"set":i.value?"value":void 0;if(s){const e=i[s];i[s]=function(...i){if(!this.apiRoot.cloudDriver)throw new tw("NOT_ALLOWED",`${t} requires a cloud driver`);return e.apply(this,i)}}}function aL(e,t,i){const s=i.set?"set":i.value?"value":void 0;if(s){const e=i[s];i[s]=function(...i){if(!(this.apiRoot.driver instanceof KR))throw new tw("NOT_ALLOWED",`${t} requires a local driver`);return e.apply(this,i)}}}function cL(e,t){for(const i of t){if(i.id===e.id)return i;if(i.children){const t=cL(e,i.children);if(t)return t}}}function lL(e,t){if(e instanceof EL)return t;const i=gC(e.element._childrenData),s=cL(e,i);return s&&(s.children=t),i}function dL(e){e=null!=e?e:{};const t=[];for(const[i,s]of Object.entries(e)){const[e,r]=i.split("#",2);t.push({namespace:e,key:r,value:s})}return t}class uL extends rL{constructor(e,t,i){super(e,i.id),this.core=e,this._data=i,this._ChildClass=uL,this._updateImplementation=e=>{this._data=Object.assign(this._data,e),this._updateChildren(this._data.children||[]),this.emit("change")},this._parent=t}get children(){return this._children}get parent(){return this._parent}get element(){let e=this._parent;for(;e instanceof uL;)e=e._parent;return e}get library(){return this.element.library}get isWritable(){return this.element.isWritable}get type(){const e=this._data.type;return"application/vnd.adobe.library.link+dcx"===e?this._data.linktype:e}get relationship(){return this._data.relationship}set relationship(e){throw new tw("NOT_IMPLEMENTED","Only Read Only functionality supported currently.")}get width(){return this._data.width}set width(e){throw new tw("NOT_IMPLEMENTED","Only Read Only functionality supported currently.")}get height(){return this._data.height}set height(e){throw new tw("NOT_IMPLEMENTED","Only Read Only functionality supported currently.")}get isFullSize(){return this._data.isFullSize}set isFullSize(e){throw new tw("NOT_IMPLEMENTED","Only Read Only functionality supported currently.")}get isPreferredThumbnail(){return this._data.isPreferredThumbnail}set isPreferredThumbnail(e){throw new tw("NOT_IMPLEMENTED","Only Read Only functionality supported currently.")}get contentLength(){return this._data.contentLength}set contentLength(e){throw new tw("NOT_IMPLEMENTED","Only Read Only functionality supported currently.")}get libraryContents(){return this.element.libraryContents}get isDeletedLocally(){return!1}get isExternalLink(){return this._data.isExternalLink}isCompatibleType(e){const t=this.getContentPath();if(t&&!this.isExternalLink){const i=function(e){const t=e&&e.replace(/^.*[\\/]/,""),i=t?t.lastIndexOf("."):-1;if(-1!==i)return t.substr(i+1).toLowerCase()}(t);if(-1===SP(e).indexOf(i))return!1}return e===this.type}getValue(e,t){var i;return null===(i=this._data.customData)||void 0===i?void 0:i[`${e}#${t}`]}getValues(){return dL(this._data.customData)}setValue(e,t,i,s){throw new tw("NOT_IMPLEMENTED","Only Read Only functionality supported currently.")}removeValue(e,t,i){throw new tw("NOT_IMPLEMENTED","Only Read Only functionality supported currently.")}setContent(e,t,i){throw new tw("NOT_IMPLEMENTED","Only Read Only functionality supported currently.")}setContentFromPath(e,t){throw new tw("NOT_IMPLEMENTED","Only Read Only functionality supported currently.")}setStagedContent(e){throw new tw("NOT_IMPLEMENTED","Only Read Only functionality supported currently.")}setContentFromURL(e,t,i){throw new tw("NOT_IMPLEMENTED","Only Read Only functionality supported currently.")}getContentPath(){return this._data.path}getContent(){return this._driver.getRepresentationContent(this).then((e=>e.blob()))}getContentURL(){return this._data.url}getAuthenticatedContentURL(){return Promise.resolve("")}_createChild(e){const t=$P(),i=this._data.children?[...this._data.children]:[];return i.push({id:t,type:e,isFullSize:!1,isExternalLink:!1}),this.element._actionDispatch({name:"updateElementContent",type:"update",data:{representations:lL(this,i)}}),this._children.find((e=>e.id===t))}_removeChild(e){const t=this._data.children?[...this._data.children]:[],i=t.findIndex((t=>t.id===e.id));-1!==i&&(t.splice(i,1),this.element._actionDispatch({name:"updateElementContent",type:"update",data:{representations:lL(this,t)}}))}testExternalLink(){return Promise.resolve(!1)}clearCachedExternalLink(){}getCachedExternalLinkError(){}getExternalLinkDownloadProgress(){if(this.isExternalLink){const e=`${this.library.id}.${this.element.elementId}.${this.id}`;return this.library.apiRoot.syncState.getExternalLinkDownloadProgressByKey(e)}}get _childrenData(){return this._data.children||[]}_updateActionDispatch(e){const t=this.parent._childrenData.filter((e=>e.id!==this.id));return this.element._actionDispatch({name:"updateElementContent",type:"update",data:{representations:lL(this.parent,[...t,Object.assign(Object.assign({},this._data),e)])}}),Promise.resolve()}}function hL(e){return e=e.toString().replace(/(\.0)*$/,"").replace(/[^.0-9]+/gim,"."),(isNaN(parseInt(e,10))||parseInt(e,10)>250)&&(e="0"),e}function pL(e="0",t="0"){if(e===t)return 0;const i=hL(e).split("."),s=hL(t).split(".");let r;for(let e=0;e<i.length&&e<s.length;e++){const t=parseInt(i[e],10);if(r=t-parseInt(s[e],10),isNaN(r))return isNaN(t)?1:-1;if(r>0)return-1;if(r<0)return 1}return r=i.length-s.length,r>0?-1:r<0?1:0}Ye([nL],uL.prototype,"relationship",null),Ye([nL],uL.prototype,"width",null),Ye([nL],uL.prototype,"height",null),Ye([nL],uL.prototype,"isFullSize",null),Ye([nL],uL.prototype,"isPreferredThumbnail",null),Ye([nL],uL.prototype,"contentLength",null),Ye([nL],uL.prototype,"setValue",null),Ye([nL],uL.prototype,"removeValue",null),Ye([nL],uL.prototype,"setContent",null),Ye([nL],uL.prototype,"setContentFromPath",null),Ye([nL],uL.prototype,"setStagedContent",null),Ye([nL],uL.prototype,"setContentFromURL",null);class _L{constructor(e,t){this._item=e,this._applicationActionData=t}get item(){return this._item}get minVersion(){return this._applicationActionData.minVersion}get appCode(){return this._applicationActionData.appCode}get appName(){return this._applicationActionData.appName}get action(){return this._applicationActionData.action}get installedVersions(){const{installedApps:e}=this.item.apiRoot.driver.config;return e.filter((e=>e.code===this._applicationActionData.appCode)).map((e=>e.version)).sort(pL)}isCompatibleVersionInstalled(){return this.installedVersions.length&&pL(this._applicationActionData.minVersion,this.installedVersions[0])>=0}async invoke(){if(!this.isCompatibleVersionInstalled())throw new tw("NOT_SUPPORTED","A compatible version of the application is needed for this action",this.item instanceof EL?this.item.library.id:this.item.id);return this.item.apiRoot.driver.sendAction(this)}toJSON(){return JSON.stringify(Object.assign(Object.assign({},this._applicationActionData),this.item instanceof EL?{libraryId:this.item.library.id,elementId:this.item.id}:{libraryId:this.item.id}))}}function mL(e,t,i,s){return i.map((i=>{const r=s[i];if(r&&(!t||t===r.action))return new _L(e,r)})).filter(Boolean).sort(((e,t)=>(null==e?void 0:e.isCompatibleVersionInstalled)&&!(null==t?void 0:t.isCompatibleVersionInstalled)?-1:!(null==e?void 0:e.isCompatibleVersionInstalled)&&(null==t?void 0:t.isCompatibleVersionInstalled)?1:0))}const fL=e=>"RGB"===e.mode,gL=e=>fL(e)&&(!e.profileName||"sRGB IEC61966-2.1"===e.profileName),yL=(e,t,i)=>{const s=`application/vnd.adobe.${t}+json`;for(let r=0;r<e.representations.length;r++){const n=e.representations[r];if(n.type===s){const e=n.getValue(t,"data");if(e&&(!i||i(e)))return e}}},vL=e=>t=>{const i=yL(t,e);if(i){const e=i.adbeFont&&i.adbeFont.style.toLowerCase();return!e||e.includes("normal")||e.includes("regular")?i.fontFamily:`${i.fontFamily} ${i.adbeFont.style}`}},OL={"application/vnd.adobe.element.color+dcx":e=>(e=>{const t=Array.isArray(e)?e.find(gL)||e.find(fL):e;return t&&t.value?((e,t,i)=>{let s=(Math.round(e)<<16|Math.round(t)<<8|Math.round(i)).toString(16);for(;s.length<6;)s="0"+s;return`#${s}`.toUpperCase()})(t.value.r,t.value.g,t.value.b):""})(yL(e,"color",gL)||yL(e,"color",fL)),"application/vnd.adobe.element.characterstyle+dcx":vL("characterstyle"),"application/vnd.adobe.element.paragraphstyle+dcx":vL("paragraphstyle"),"application/vnd.adobe.element.font+dcx":e=>{const t=yL(e,"font");return(null==t?void 0:t.name)||""}};class bL extends rL{get sourceRefString(){return this._sourceRef}get sourceRef(){if(!this.sourceRefString)return;let e=YP(this.sourceRefString);if(!e){const[t,i]=this.sourceRefString.split("#");e={"repo:assetId":t,"stRef:fromPart":i};const s=this._sourceModifiedDate;s&&(e["stRef:fromPartInstanceID"]=`${s}`)}return e}set sourceRef(e){if("object"!=typeof e||!YP(e)){const e=this._parent;throw new tw("INVALID_PARAMETER","sourceRef must be a valid JSON object",e.library.id)}this._actionDispatch({name:this._updateAction,type:"update",data:{sourceRef:JSON.stringify(e,Object.keys(e).sort())}})}}function IL(e){return`${e.libraryAssetId}#${e.id}`}Ye([sL],bL.prototype,"sourceRefString",null),Ye([sL,nL],bL.prototype,"sourceRef",null);class EL extends bL{constructor(e,t){super(e,t),this._groups=[],this._name="",this._type="",this.isElement=!0,this._updateAction="updateElement",this._lastLocalUpdateDate=0,this._ChildClass=uL,this._updateImplementation=e=>{const t=this._itemPool.createUpdateSession();this._updater.updateLocalItem(t,this,e),t.commit()},this._updater=this._apiRoot.elementUpdater,this._itemPool=this._apiRoot.elementPool,this._elementId=WP(t)?t:t.split("#")[1]}get libraryContents(){if(!this._parent){if(!this._libraryAssetId)throw Error("Element._libraryAssetId is not defined, so we cannot find the Library or LibraryContents.");const e=this._core._getAssetPool().getLocalItemById(this._libraryAssetId);this._parent=e._getContentsSync()}return this._parent}get library(){return this.libraryContents.library}get elementId(){return this._elementId}get type(){return this._type}get modified(){return new Date(Math.max(this._modifiedDate,this._lastLocalUpdateDate))}get created(){return new Date(this._createdDate)}get instanceId(){const e=this.getPrimaryRepresentation();return null==e?void 0:e.id}getReference(){const e={"dc:format":this.library.mediaType,"repo:assetId":this._libraryAssetId,"repo:name":this.library.displayName,"stRef:manager":"Adobe Cloud","stRef:documentID":this.library.libraryManifestId,"stRef:fromPart":`id=${this.id}`,"stRef:fromPartName":this.name};return this.instanceId&&(e["stRef:fromPartInstanceID"]=this.instanceId),this.sourceRef&&"application/vnd.adobe.firefly-recipe+dcx"!==this.sourceRef["dc:format"]&&(e["stRef:fromPartDerivedFrom"]=this.sourceRef),e}getReferenceString(){return QP(this.getReference())}getLegacyReference(){var e;return null!==(e=this._elementRef)&&void 0!==e?e:`cloud-asset://${this.library.id};node=${this.id}`}get name(){return this.isAutoNamed?(e=>{const t=OL[e.type];return t?t(e):""})(this):this._name}set name(e){this._actionDispatch({name:"updateElement",type:"update",data:{name:null==e?void 0:e.normalize()}})}get isAutoNamed(){const e=this._name,t=this._autoName;return!e||e===t}get isWritable(){return this.library.hasPermission(Gi.Write)}get tags(){return this._tags||[]}set tags(e){this._actionDispatch({name:"updateElement",type:"update",data:{tags:e}})}async getDependencies(){const e=[];if(this._dependencyIds)for(const t of this._dependencyIds){const i=await this.libraryContents.getElementById(t);i!==this&&e.push(i)}return e}setDependencies(e){const t=e.map((e=>e.id));this._actionDispatch({name:"updateElement",type:"update",data:{dependencyIds:t}})}createGroup(){}getGroups(e="$default"){return[]}getOrderInGroup(e){if(e.library!==this.library)return;const t=this._groups.find((t=>t.classifier===e.classifierName&&t.id===e.id));return t&&t.order}setOrderInGroup(e,t,i=!0){const s=i?this._groups.filter((t=>t.classifier!==e.classifierName)):[...this._groups],r=this._groups.findIndex((({id:t})=>t===e.id)),n={id:e.id,classifier:e.classifierName,order:t};t||-1===r?t&&-1!==r?s.splice(r,1,n):-1===r&&s.push(n):s.splice(r,1),this._actionDispatch({name:"updateElement",type:"update",data:{groups:s}})}get description(){return this._description}set description(e){this._actionDispatch({name:"updateElement",type:"update",data:{description:e}})}get descriptionModified(){return new Date(this._descriptionModifiedDate)}get descriptionModifiedBy(){return this._descriptionModifiedBy}get descriptionModifiedContext(){return this._descriptionModifiedContext}get wasDescriptionModifiedLocally(){return this._descriptionModifiedLocally}get modifiedBy(){return this._modifiedBy}get modifiedContext(){return this._modifiedContext}get wasModifiedLocally(){return this._modifiedLocally}get createdBy(){return this._createdBy}get createdContext(){return this._createdContext}get wasCreatedLocally(){return this._createdLocally}get isDeletedLocally(){return!1}beginOperation(){return this.libraryContents.beginOperation()}endOperation(e){return this.libraryContents.endOperation(e)}get representations(){return this._children}getPrimaryRepresentation(){return this.representations.find((e=>"primary"===e.relationship))}getRepresentationById(e){return this.representations.find((t=>t.id===e))}createRepresentation(e,t,i,s){const r=$P(),n=[...this._childrenData];return n.splice(1,0,{id:r,type:e,relationship:t,isFullSize:!1,isExternalLink:!1}),this._actionDispatch({name:"updateElementContent",type:"update",data:{representations:n}}),this.getRepresentationById(r)}removeRepresentation(e){const t=[...this._childrenData],i=t.findIndex((t=>t.id===e.id));-1!==i&&(t.splice(i,1),this._actionDispatch({name:"updateElementContent",type:"update",data:{representations:t}}))}removeAllRepresentations(){this._actionDispatch({name:"updateElementContent",type:"update",data:{renditionUrl:{},representations:[]}})}getValue(e,t){var i;return null===(i=this._customData)||void 0===i?void 0:i[`${e}#${t}`]}getValues(){return dL(this._customData)}setValue(e,t,i){this._actionDispatch({name:"updateElement",type:"update",data:{customData:{[`${e}#${t}`]:i}}})}removeValue(e,t){this.setValue(e,t,null)}getThumbnailURL(e){return this._driver.getRenditionUrl(this,e)}async getThumbnailPath(e="full"){return await this.committed,this._driver.getRenditionPath(this.library.id,this.id,e)}getThumbnailContent(e){return this._driver.getRendition(this,e).then((e=>e.blob()))}supportsVectorThumbnail(){const e=this.getPrimaryRepresentation();return!!e&&xP.VECTOR_RENDITION_ELEMENT_TYPES.includes(e.type)}getActions(e){const t=this.getPrimaryRepresentation();if(!t)return[];if(this.library.documentType){const t=this._apiRoot.getOption("DOCUMENT_LIBRARY_ACTION_PRODUCT_MAP"),i=t.types[this.library.documentType]||[];return mL(this.library,e,i,t.products)}const i=this._apiRoot.getOption("ELEMENT_ACTION_PRODUCT_MAP");return mL(this,e,(i.types[this.type]||{})[t.type]||[],i.products)}get roles(){return this._roles||[]}set roles(e){this._actionDispatch({name:"updateElement",type:"update",data:{roles:e}})}get isStockAsset(){const e=Object.values(MP).includes(this.type),t=void 0!==this.getStockDataForElement();return e&&t}get isLicensed(){var e;return"purchased"===(null===(e=this.getStockDataForElement())||void 0===e?void 0:e.state)}getStockDataForElement(e){const t=void 0===e?this.getPrimaryRepresentation():this.representations[e];let i=null==t?void 0:t.getValue("adobestock","trackingdata");if(i&&(null==t?void 0:t.isExternalLink)&&(null==t?void 0:t.getCachedExternalLinkError())&&""!==(null==t?void 0:t.getContentURL())){i=this.getStockDataForElement(void 0===e?0:e+1)||Object.assign(Object.assign({},i),{state:"not_purchased"})}return i}_actionDispatch(e){e.path||(e.path=`$.elements[?(@.id == "${this.id}")]`),this._lastLocalUpdateDate=Date.now(),this.libraryContents._actionDispatch(e)}}Ye([sL],EL.prototype,"modified",null),Ye([sL],EL.prototype,"created",null),Ye([sL,nL],EL.prototype,"name",null),Ye([sL],EL.prototype,"isAutoNamed",null),Ye([sL],EL.prototype,"isWritable",null),Ye([sL,nL],EL.prototype,"tags",null),Ye([sL],EL.prototype,"getDependencies",null),Ye([nL],EL.prototype,"setDependencies",null),Ye([nL],EL.prototype,"createGroup",null),Ye([sL],EL.prototype,"getGroups",null),Ye([sL],EL.prototype,"getOrderInGroup",null),Ye([nL],EL.prototype,"setOrderInGroup",null),Ye([sL,nL],EL.prototype,"description",null),Ye([sL],EL.prototype,"descriptionModified",null),Ye([sL],EL.prototype,"descriptionModifiedBy",null),Ye([sL],EL.prototype,"descriptionModifiedContext",null),Ye([sL],EL.prototype,"wasDescriptionModifiedLocally",null),Ye([sL],EL.prototype,"modifiedBy",null),Ye([sL],EL.prototype,"modifiedContext",null),Ye([sL],EL.prototype,"wasModifiedLocally",null),Ye([sL],EL.prototype,"createdBy",null),Ye([sL],EL.prototype,"createdContext",null),Ye([sL],EL.prototype,"wasCreatedLocally",null),Ye([sL],EL.prototype,"isDeletedLocally",null),Ye([sL],EL.prototype,"representations",null),Ye([sL],EL.prototype,"getPrimaryRepresentation",null),Ye([sL],EL.prototype,"getRepresentationById",null),Ye([nL],EL.prototype,"createRepresentation",null),Ye([nL],EL.prototype,"removeRepresentation",null),Ye([nL],EL.prototype,"removeAllRepresentations",null),Ye([sL],EL.prototype,"getValue",null),Ye([sL],EL.prototype,"getValues",null),Ye([nL],EL.prototype,"setValue",null),Ye([nL],EL.prototype,"removeValue",null),Ye([sL],EL.prototype,"supportsVectorThumbnail",null),Ye([sL],EL.prototype,"getActions",null),Ye([sL,nL],EL.prototype,"roles",null);const TL={localItemType:EL,getRemoteId:e=>function(e){if(!e.id)throw We.create(Be.BAD_REQUEST,"Element data requires an id");return WP(e.id)?e.id:IL(e)}(e),getAlternateId:function(e){return e.previousPlaceholderId},changeEventMap:new Map([]),propertyUpdater:new Cn({_roles:{name:"roles",format:"object",isArray:!0},_name:"name",_libraryAssetId:"libraryAssetId",_children:{name:"representations",format:"object",set:(e,t)=>{t._updateChildren(e)}},_elementId:"id",_type:"type",_modifiedDate:{name:"modifiedDate",format:"number"},_createdDate:{name:"createdDate",format:"number"},_tags:{name:"tags",format:"object",isArray:!0},_dependencyIds:{name:"dependencyIds",format:"object",isArray:!0},_description:"description",_descriptionModifiedDate:{name:"descriptionModifiedDate",format:"number"},_descriptionModifiedBy:"descriptionModifiedBy",_descriptionModifiedContext:{name:"descriptionModifiedContext",format:"object"},_descriptionModifiedLocally:{name:"descriptionModifiedLocally",format:"boolean"},_modifiedBy:"modifiedBy",_modifiedContext:{name:"modifiedContext",format:"object"},_modifiedLocally:{name:"modifiedLocally",format:"boolean"},_createdBy:"createdBy",_createdContext:{name:"createdContext",format:"object"},_createdLocally:{name:"createdLocally",format:"boolean"},_customData:{name:"customData",format:"object"}})},SL=new yn(TL);function AL(e){return"insert"===e.type}function PL(e){return"update"===e.type}function wL(e){return"remove"===e.type}function CL(e){return"aggregate"===e.type}const RL=/(\.[a-zA-Z0-9]+)|(\[\?\(([^\[\]]+)\)\])/g,LL=/^\$(?:(\.[a-zA-Z0-9]+)|(\[\?\(([^\[\]]+)\)\]))*$/,NL=/^([^ ]+) *== *"(.+)"$/;function DL(){return function(e,t,i){const s=i.value;return i.value=function(e,t,...i){if(!LL.test(t))throw new tw("INVALID_PARAMETER","JSON Path is not valid");return s.apply(this,[e,t,...i])},i}}class ML{static get(e,t){var i;return"$"===t?e:null===(i=t.match(RL))||void 0===i?void 0:i.reduce(((e,t)=>e&&this._handlePathPart(e,t)),e)}static set(e,t,i){if("$"===t)throw new tw("INVALID_PARAMETER","Cannot set in root of object");const s=t.match(RL);if(s){const t=s.pop(),r=s.join("");if(!t)throw new tw("INVALID_PARAMETER","JSON path must end in a field");let n=e;if(r&&(n=this.get(e,`$${r}`),!n))throw new tw("INVALID_PARAMETER","JSON path parent does not exist");return n[t.substring(1)]=i,i}}static insert(e,t,i){var s;const r=null!==(s=this.get(e,t))&&void 0!==s?s:this.set(e,t,[]);Array.isArray(r)?r.push(i):nw.warn("JSONPath.insert failed to insert into non-array")}static remove(e,t){const i=null==t?void 0:t.match(RL),s=null==i?void 0:i.pop(),r=(null==i?void 0:i.reduce(((e,t)=>e&&this._handlePathPart(e,t)),e))||[];if(!(null==s?void 0:s.startsWith("[?(")))throw new tw("INVALID_PARAMETER","JSON Path must end in a filter");if(!Array.isArray(r))return;const n=this._handleFilterExpression(r,s.substring(3,s.length-2)),o=r.indexOf(n);-1!==o&&r.splice(o,1)}static _handlePathPart(e,t){return t.startsWith("[?(")?this._handleFilterExpression(e,t.substring(3,t.length-2)):e[t.substring(1)]}static _handleFilterExpression(e,t){const[,i,s]=NL.exec(t)||[],r=i.replace(/^@/,"$");if(Array.isArray(e))return e.find((e=>this.get(e,r)===s))}}function xL(e,t){return CL(t)?t.actions.reduce(((e,t)=>xL(e,t)),e):AL(t)?function(e,t){return ML.insert(e,t.path,t.data),e}(e,t):PL(t)?function(e,t){const i=ML.get(e,t.path);return Object.assign(i,t.data),e}(e,t):wL(t)?function(e,t){return ML.remove(e,t.path),e}(e,t):e}Ye([DL()],ML,"get",null),Ye([DL()],ML,"set",null),Ye([DL()],ML,"insert",null),Ye([DL()],ML,"remove",null);class kL{constructor(e=10){this._cache=new Map,this._capacity=e}has(e){if(this._cache.get(e))return e}add(e){if(this._cache.has(e))this._cache.delete(e);else if(this._cache.size>=this._capacity){const e=Array.from(this._cache.entries()).reduce(((e,t)=>e[1]<t[1]?e:t))[0];this._cache.delete(e)}this._cache.set(e,Date.now())}}const HL={Date:!0,RegExp:!0,String:!0,Number:!0};function jL(e,t,i={cyclesFix:!0},s=[]){let r=[];const n=Array.isArray(e);for(const o in e){const a=e[o],c=n?+o:o;if(!(o in t)){r.push({type:"REMOVE",path:[c],oldValue:e[o]});continue}const l=t[o],d="object"==typeof a&&"object"==typeof l;if(!(a&&l&&d)||HL[Object.getPrototypeOf(a).constructor.name]||i.cyclesFix&&s.includes(a))a===l||d&&(isNaN(a)?a+""==l+"":+a==+l)||r.push({path:[c],type:"CHANGE",value:l,oldValue:a});else{const e=jL(a,l,i,i.cyclesFix?s.concat([a]):[]);r.push.apply(r,e.map((e=>(e.path.unshift(c),e))))}}const o=Array.isArray(t);for(const i in t)i in e||r.push({type:"CREATE",path:[o?+i:i],value:t[i]});return r}const UL=[{test:e=>CL(e)&&["moveGroup","copyGroup"].includes(e.name),handler:function(e,t){var i;const s=[],r=_C(t.path),n=t.actions.map((e=>"removeElement"===e.name&&e.baseData)),o=(null===(i=e.elements)||void 0===i?void 0:i.filter((e=>e.groups.find((e=>e.id===r)))))||[],a=o.filter((e=>!n.find((t=>t.id===e.id))));for(const e of a)s.push({name:"updateElement",type:"update",path:`$.elements[?(@.id == "${e.id}")]`,data:{groups:e.groups.filter((e=>e.id!==r))}});const c=n.filter((e=>!o.find((t=>t.id===e.id))));for(let e=t.actions.length-1;e>=0;e-=1){const i=t.actions[e];c.find((e=>e.id===i.baseData.id))&&t.actions.splice(e,1)}return s.push(t),s}},{test:e=>PL(e)&&"updateElementContent"===e.name,handler:function(e,t){const i=ML.get(e,t.path);return i&&i.modifiedDate!==t.baseData.modifiedDate&&!jL(i.representations,t.baseData.representations,{cyclesFix:!1}).find((e=>"id"!==e.path[1]&&"CREATE"!==e.type&&!(void 0===e.oldValue&&"REMOVE"===e.type)))||i&&i.modifiedDate===t.baseData.modifiedDate?[t]:[{name:"createElement",type:"insert",path:pC(t.path),data:gC(Object.assign(Object.assign(Object.assign({},t.baseData),t.data),{id:$P()}))}]}},{test:e=>PL(e)&&"updateGroup"===e.name,handler:function(e,t){const i=ML.get(e,t.path);return i?[Object.assign(Object.assign({},t),{baseData:gC(i)})]:[{name:"createGroup",type:"insert",path:"$.groups",data:gC(Object.assign(Object.assign(Object.assign({},t.baseData),t.data),{id:$P()}))}]}},{test:e=>PL(e)&&"updateElement"===e.name,handler:function(e,t){const i=ML.get(e,t.path);return i?[Object.assign(Object.assign({},t),{baseData:gC(i)})]:[]}},{test:e=>CL(e)&&"removeElement"===e.name,handler:function(e,t){const i=ML.get(e,t.path),s=t.actions.find((e=>"removeElement"===e.name));return i&&i.modifiedDate===(null==s?void 0:s.baseData.modifiedDate)?[t]:[]}},{test:e=>wL(e),handler:function(e,t){const i=ML.get(e,t.path);return i&&i.modifiedDate===t.baseData.modifiedDate?[t]:[]}}];function BL(e,t){for(const{test:i,handler:s}of UL)if(i(t))return s(e,t);return[t]}class FL extends Rs{constructor(e,t,i){super(),this._core=e,this._apiRoot=t,this.library=i,this._actions=[],this._reducer=xL,this._operation=void 0,this._isSquelched=!1,this._receivedEventDuringSquelchPeriod=!1,this._pendingActionSemaphore=0,this._pendingOperationResolvers=[],this._lastLocalUpdateDate=0,this._previouslySeenEtags=new kL,this._pendingActions=[],this._mergeBaseData=(e,t)=>{if(!0===t){const t=(e,t)=>{const i=new Set(e.map((e=>e.id)));return t.filter((e=>!i.has(e.id))).concat(e)},i=e.elements||[],s=this._baseData.elements||[];e.elements=t(i,s)}this._baseData=Object.assign(Object.assign({},this._baseData),e)};const s={groups:[],elements:[],assetId:i.id,id:i._legacyLibraryId_NoLazyLoad};this._baseData=s,this._currentData=gC(s),this._assetPool=t.assetPool,this._elementPool=t.elementPool,this._elementUpdater=t.elementUpdater}get data(){return this._currentData}get baseData(){return this._baseData}get actions(){return this._actions}_revert(){this._actions=[],this._pendingActions=[],this._pendingActionSemaphore=0;const e=this._currentData;this._currentData=gC(this._baseData),this._updateChildren(e,this._currentData),this.emit("change")}_actionDispatch(e){var t;if(e.path||(e.path="$"),"aggregate"===e.type&&(null===(t=e.actions)||void 0===t||t.map((t=>{if("remove"===t.type){const i=ML.get(this._currentData,e.path);t.baseData={modifiedDate:i.modifiedDate}}return t}))),"remove"===e.type){const t=ML.get(this._currentData,e.path);e.baseData={modifiedDate:t.modifiedDate}}"update"===e.type&&(e.baseData=gC(ML.get(this._currentData,e.path))),(AL(e)||PL(e))&&(e.data=gC(e.data));const i=this._reducer(this._currentData,e);this.isOperationInProgress?this._pendingActions.push(e):this._actions.push(e),this._currentData=i,this._lastLocalUpdateDate=Date.now(),"no-op"!==e.type&&(this._updateChildren(e.baseData,i),this.emit("change"))}_commit(e,t){this._confirmActionsAtHead(e),function(e){var t,i,s;for(const r of e)r.data&&WP(null===(i=null===(t=r.originalAction)||void 0===t?void 0:t.data)||void 0===i?void 0:i.id)&&(r.data.previousPlaceholderId=null===(s=r.originalAction)||void 0===s?void 0:s.data.id)}(e);let i=Object.assign({},this._baseData);for(const t of e)i=this._reducer(i,t),this._actions.shift();this._actions=vC(e,this._actions),t&&(this._previouslySeenEtags.add(this.etag),i.etag=t),this._lastLocalUpdateDate=Date.now(),this._update(i,!1),e.forEach((e=>{!function(e){["removeLibrary","unfollowLibrary","leaveLibrary","permanentlyDeleteLibrary"].includes(e.name)}(e)})),this.emit("action",...e.map((e=>({type:"commit",action:e})))),this.emit("commit")}_confirmActionsAtHead(e){if(this._actions.length<e.length)return!1;for(const t in e)if(e[t]!==this._actions[t])return!1;return!0}beginOperation(){this._squelchChangeEvents(),this._pendingActionSemaphore+=1,nw.log(`[STORE] Starting operation (Depth: ${this._pendingActionSemaphore})`)}endOperation(e){if(this._pendingActionSemaphore=Math.max(0,this._pendingActionSemaphore-1),nw.log(`[STORE] Ending operation (Depth: ${this._pendingActionSemaphore})`),0===this._pendingActionSemaphore){nw.log("[STORE] Reached end of operation stack. Adding actions to queue...");const e=this._collapseActions(this._pendingActions);return this._actions=this.actions.concat(e),this._pendingActions=[],this.emit("action",...e.map((e=>({type:"dispatch",action:e})))),this._unsquelchChangeEvents(),new Promise((e=>{const t=()=>{this._actions.length||(this._pendingOperationResolvers.forEach((e=>e())),this._pendingOperationResolvers=[],e(),this.off("commit",t))};this.on("commit",t)}))}return new Promise((e=>{this._pendingOperationResolvers.push(e)}))}_squelchChangeEvents(){this._isSquelched=!0}_unsquelchChangeEvents(){this._isSquelched=!1,this._receivedEventDuringSquelchPeriod&&(this._receivedEventDuringSquelchPeriod=!1,this.emit("change"))}emit(e,...t){return this._isSquelched&&"change"===e?(this._receivedEventDuringSquelchPeriod=!0,this.listenerCount(e)>0):super.emit(e,...t)}get etag(){return this._baseData.etag}set etag(e){this._baseData.etag=e}get isOperationInProgress(){return 0!==this._pendingActionSemaphore}set operation(e){this._operation=e}get operation(){return this._operation}_collapseActions(e){const t=[],i={},s={};for(const r of e){if(["updateElement","updateElementContent"].includes(r.name)&&PL(r)){const e=hC(r.path),t=i[e];if(t){nw.log("[LIBRARY] Identified collapsible action (updateElement). Combining with (createElement)"),t.data=Object.assign(Object.assign({},t.data),r.data);continue}const n=s[e];if(n){n.data=Object.assign(Object.assign({},n.data),r.data);continue}}"createElement"===r.name&&AL(r)&&(i[r.data.id]=r),"updateElementContent"===r.name&&PL(r)&&(s[hC(r.path)]=r),t.push(r)}return t}_update(e,t){this._mergeBaseData(e,t),this._rebaseCurrentDataAndActions(),this.emit("change")}_rebaseCurrentDataAndActions(){let e=gC(this._baseData);this._actions=this._actions.map((t=>{const i=BL(e,t);return e=i.reduce(((t,i)=>this._reducer(e,i)),e),i})).flat(),this._pendingActions=this._pendingActions.map((t=>{const i=BL(e,t);return e=i.reduce(((t,i)=>this._reducer(e,i)),e),i})).flat();const t=this._currentData;this._currentData=e,this._updateChildren(t,e)}_updateChildren(e,t){const i=this._elementPool,s=i.createUpdateSession(),r=t.elements,n=e.elements;(()=>{r.forEach((e=>{const t=e.previousPlaceholderId?i.getLocalItemById(e.previousPlaceholderId):i.getLocalItemById(IL(e));t?t._update(e):this._elementUpdater.updateRemoteItem(s,e)}))})(),(()=>{const e=new Set(r.map((e=>e.id)));n.filter((t=>!e.has(t.id))).forEach((e=>{const t=i.getLocalItemById(IL(e));t&&s.queueDiscardedItem(t)}))})(),s.commit()}get _driver(){return this._apiRoot.driver}}class VL{constructor(e,t,i,s){this._core=e,this._elementPool=t,this._driver=i,this._library=s}async loadPage(e){return this._loadPage(e)}async _loadPage(e,t=0){var i;const s=await this._driver.getElementsPage(this._library,t,null===(i=null==e?void 0:e.loadOptions)||void 0===i?void 0:i.limit,function(e){if(e)return{field:"name"===e.field?e.field:"modifiedDate",direction:e.direction}}(null==e?void 0:e.order),this._library.etag),r=this._core._environment.getValue("USS_LIST_UPDATE_LATENCY"),n=Date.now()-r;return{items:await this._updatePoolFromPage(s,n),total:s.total_count,mostRecentValidMutation:n,loadNextPage:this._nextPageLinkFromResponse(s)}}async _updatePoolFromPage(e,t){const i=e.elements.map((e=>{const t=qw(e);return t.libraryAssetId=this._library.id,t})),s=this._elementPool.createLoaderUpdateSession(t),r=SL.updateRemoteItems(s,i);return s.commit(),r}_nextPageLinkFromResponse(e){var t;const i=null===(t=e._page)||void 0===t?void 0:t.next;if(i)return e=>this._loadPage(e,i)}}class KL{constructor(e={}){this._libraryId=e.libraryId}matches(e){return!this._libraryId||this._libraryId===e.library.id}}class GL extends FL{get elementsSource(){if(this.library._isPublicLink_NoLazyLoad)throw We.create(Be.UNSUPPORTED,"elements source is not currently supported for public libraries");return new Uo(this._elementPool,[new VL(this._core,this._elementPool,this._driver,this.library)],new KL({libraryId:this.library.id}))}async getElementById(e){const t=`${this.library.id}#${e}`;let i=this._elementPool.getLocalItemById(t);if(!i){const s=await this._driver.getElement(this.library,e);s.libraryAssetId=s.libraryAssetId||this.library.id,this._update({elements:[s]},!0),i=this._elementPool.getLocalItemById(t)}if(!i)throw new tw("INVALID_PARAMETER","Need to pass a valid element ID");return Promise.resolve(i)}_actionDispatch(e){e.library||(e.library=this.library),e.libraryContents||(e.libraryContents=this),super._actionDispatch(e)}}Ye([nt],GL.prototype,"elementsSource",null);class $L extends bL{constructor(){super(...arguments),this.isGroup=!0,this._isDeletedLocally=!1,this._updateAction="updateGroup",this._data={}}get data(){return this._data}get classifierName(){return this.data.classifier}get name(){return this.data.name}set name(e){this._actionDispatch({name:"updateGroup",type:"update",data:{name:e}})}get order(){return this.data.order}set order(e){this._actionDispatch({name:"updateGroup",type:"update",data:{order:e}})}get modified(){return this.data.modifiedDate}get modifiedBy(){return this.data.modifiedBy}get modifiedContext(){return this.data.modifiedContext}get wasModifiedLocally(){return this.data.modifiedLocally}get created(){return this.data.createdDate}get createdBy(){return this.data.createdBy}get createdContext(){return this.data.createdContext}get wasCreatedLocally(){return this.data.createdLocally}getValue(e,t){var i;return null===(i=this.data.customData)||void 0===i?void 0:i[`${e}#${t}`]}getValues(){return dL(this.data.customData)}get children(){return this.library.getGroups(this.classifierName).filter((e=>e.parent&&e.parent.id===this.id))}getFilteredChildren(e){return this.children.filter(e)}get elements(){const e=[],t=t=>void 0!==t.getOrderInGroup(this)&&e.push(t);return this.library.elements.forEach(t),this.library.documentationElements.forEach(t),e}isEmpty(){return 0===this.elements.length&&0===this.children.length}setValue(e,t,i,s){this._actionDispatch({name:"updateGroup",type:"update",data:{customData:Object.assign(Object.assign({},this.data.customData),{[`${e}#${t}`]:i})}})}removeValue(e,t,i){this.setValue(e,t,null,i)}get isDeletedLocally(){return this._isDeletedLocally}set isDeletedLocally(e){this._isDeletedLocally=e,this.emit("change")}get library(){return this._parent}getLocalizedName(e="en_US"){var t;return null===(t=this.data.localizedNames)||void 0===t?void 0:t[e]}getLocalizedNames(){return this.data.localizedNames||{}}setLocalizedName(e,t){return this._actionDispatch({name:"updateGroup",type:"update",data:{localizedNames:Object.assign(Object.assign({},this.data.localizedNames),{[e]:t})}})}get parent(){return this.library.getGroupById(this._data.parentId)}set parent(e){this._actionDispatch({name:"updateGroup",type:"update",data:{parentId:(null==e?void 0:e.id)||null}})}_createChild(e,t){const i=$P();return this._actionDispatch({name:"createGroup",type:"insert",data:{id:i,name:e,order:t,classifier:this.classifierName,parentId:this.id},path:"$.groups"}),this.library.getGroupById(i)}_actionDispatch(e){e.path||(e.path=`$.groups[?(@.id == "${this.id}")]`),this.library._actionDispatch(e)}}Ye([sL,nL],$L.prototype,"name",null),Ye([sL,nL],$L.prototype,"order",null),Ye([sL],$L.prototype,"modified",null),Ye([sL],$L.prototype,"modifiedBy",null),Ye([sL],$L.prototype,"modifiedContext",null),Ye([sL],$L.prototype,"wasModifiedLocally",null),Ye([sL],$L.prototype,"created",null),Ye([sL],$L.prototype,"createdBy",null),Ye([sL],$L.prototype,"createdContext",null),Ye([sL],$L.prototype,"wasCreatedLocally",null),Ye([sL],$L.prototype,"getValue",null),Ye([sL],$L.prototype,"getValues",null),Ye([sL],$L.prototype,"children",null),Ye([sL],$L.prototype,"getFilteredChildren",null),Ye([sL],$L.prototype,"elements",null),Ye([sL],$L.prototype,"isEmpty",null),Ye([nL],$L.prototype,"setValue",null),Ye([nL],$L.prototype,"removeValue",null),Ye([sL],$L.prototype,"isDeletedLocally",null),Ye([sL],$L.prototype,"getLocalizedName",null),Ye([sL],$L.prototype,"getLocalizedNames",null),Ye([nL],$L.prototype,"setLocalizedName",null),Ye([nL,sL],$L.prototype,"parent",null);class WL extends rL{constructor(){super(...arguments),this._data={}}get data(){return this._data}get name(){return this._data.name}get owner(){return this._data.owner}get ownerName(){return this._data.ownerName}get isReadOnly(){return this._data.isReadOnly}get isWritable(){return this._data.isWritable}async _refreshGradient(){if(this._data.gradient)return this._data.gradient;const e=await this._apiRoot.driver.getProjectGradient(this);this._update({gradient:e})}get gradientData(){return this._refreshGradient(),this._data.gradient}}Ye([sL],WL.prototype,"gradientData",null);var zL=function(e,t){return zL=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])},zL(e,t)};function qL(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function i(){this.constructor=e}zL(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)}var YL=function(){return YL=Object.assign||function(e){for(var t,i=1,s=arguments.length;i<s;i++)for(var r in t=arguments[i])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},YL.apply(this,arguments)};function QL(e,t,i){if(i||2===arguments.length)for(var s,r=0,n=t.length;r<n;r++)!s&&r in t||(s||(s=Array.prototype.slice.call(t,0,r)),s[r]=t[r]);return e.concat(s||Array.prototype.slice.call(t))}function JL(e,t){var i=t&&t.cache?t.cache:aN,s=t&&t.serializer?t.serializer:iN;return(t&&t.strategy?t.strategy:tN)(e,{cache:i,serializer:s})}function XL(e,t,i,s){var r,n=null==(r=s)||"number"==typeof r||"boolean"==typeof r?s:i(s),o=t.get(n);return void 0===o&&(o=e.call(this,s),t.set(n,o)),o}function ZL(e,t,i){var s=Array.prototype.slice.call(arguments,3),r=i(s),n=t.get(r);return void 0===n&&(n=e.apply(this,s),t.set(r,n)),n}function eN(e,t,i,s,r){return i.bind(t,e,s,r)}function tN(e,t){return eN(e,this,1===e.length?XL:ZL,t.cache.create(),t.serializer)}"function"==typeof SuppressedError&&SuppressedError;var iN=function(){return JSON.stringify(arguments)};function sN(){this.cache=Object.create(null)}sN.prototype.get=function(e){return this.cache[e]},sN.prototype.set=function(e,t){this.cache[e]=t};var rN,nN,oN,aN={create:function(){return new sN}},cN={variadic:function(e,t){return eN(e,this,ZL,t.cache.create(),t.serializer)},monadic:function(e,t){return eN(e,this,XL,t.cache.create(),t.serializer)}};function lN(e){return e.type===nN.literal}function dN(e){return e.type===nN.argument}function uN(e){return e.type===nN.number}function hN(e){return e.type===nN.date}function pN(e){return e.type===nN.time}function _N(e){return e.type===nN.select}function mN(e){return e.type===nN.plural}function fN(e){return e.type===nN.pound}function gN(e){return e.type===nN.tag}function yN(e){return!(!e||"object"!=typeof e||e.type!==oN.number)}function vN(e){return!(!e||"object"!=typeof e||e.type!==oN.dateTime)}!function(e){e[e.EXPECT_ARGUMENT_CLOSING_BRACE=1]="EXPECT_ARGUMENT_CLOSING_BRACE",e[e.EMPTY_ARGUMENT=2]="EMPTY_ARGUMENT",e[e.MALFORMED_ARGUMENT=3]="MALFORMED_ARGUMENT",e[e.EXPECT_ARGUMENT_TYPE=4]="EXPECT_ARGUMENT_TYPE",e[e.INVALID_ARGUMENT_TYPE=5]="INVALID_ARGUMENT_TYPE",e[e.EXPECT_ARGUMENT_STYLE=6]="EXPECT_ARGUMENT_STYLE",e[e.INVALID_NUMBER_SKELETON=7]="INVALID_NUMBER_SKELETON",e[e.INVALID_DATE_TIME_SKELETON=8]="INVALID_DATE_TIME_SKELETON",e[e.EXPECT_NUMBER_SKELETON=9]="EXPECT_NUMBER_SKELETON",e[e.EXPECT_DATE_TIME_SKELETON=10]="EXPECT_DATE_TIME_SKELETON",e[e.UNCLOSED_QUOTE_IN_ARGUMENT_STYLE=11]="UNCLOSED_QUOTE_IN_ARGUMENT_STYLE",e[e.EXPECT_SELECT_ARGUMENT_OPTIONS=12]="EXPECT_SELECT_ARGUMENT_OPTIONS",e[e.EXPECT_PLURAL_ARGUMENT_OFFSET_VALUE=13]="EXPECT_PLURAL_ARGUMENT_OFFSET_VALUE",e[e.INVALID_PLURAL_ARGUMENT_OFFSET_VALUE=14]="INVALID_PLURAL_ARGUMENT_OFFSET_VALUE",e[e.EXPECT_SELECT_ARGUMENT_SELECTOR=15]="EXPECT_SELECT_ARGUMENT_SELECTOR",e[e.EXPECT_PLURAL_ARGUMENT_SELECTOR=16]="EXPECT_PLURAL_ARGUMENT_SELECTOR",e[e.EXPECT_SELECT_ARGUMENT_SELECTOR_FRAGMENT=17]="EXPECT_SELECT_ARGUMENT_SELECTOR_FRAGMENT",e[e.EXPECT_PLURAL_ARGUMENT_SELECTOR_FRAGMENT=18]="EXPECT_PLURAL_ARGUMENT_SELECTOR_FRAGMENT",e[e.INVALID_PLURAL_ARGUMENT_SELECTOR=19]="INVALID_PLURAL_ARGUMENT_SELECTOR",e[e.DUPLICATE_PLURAL_ARGUMENT_SELECTOR=20]="DUPLICATE_PLURAL_ARGUMENT_SELECTOR",e[e.DUPLICATE_SELECT_ARGUMENT_SELECTOR=21]="DUPLICATE_SELECT_ARGUMENT_SELECTOR",e[e.MISSING_OTHER_CLAUSE=22]="MISSING_OTHER_CLAUSE",e[e.INVALID_TAG=23]="INVALID_TAG",e[e.INVALID_TAG_NAME=25]="INVALID_TAG_NAME",e[e.UNMATCHED_CLOSING_TAG=26]="UNMATCHED_CLOSING_TAG",e[e.UNCLOSED_TAG=27]="UNCLOSED_TAG"}(rN||(rN={})),function(e){e[e.literal=0]="literal",e[e.argument=1]="argument",e[e.number=2]="number",e[e.date=3]="date",e[e.time=4]="time",e[e.select=5]="select",e[e.plural=6]="plural",e[e.pound=7]="pound",e[e.tag=8]="tag"}(nN||(nN={})),function(e){e[e.number=0]="number",e[e.dateTime=1]="dateTime"}(oN||(oN={}));var ON=/[ \xA0\u1680\u2000-\u200A\u202F\u205F\u3000]/,bN=/(?:[Eec]{1,6}|G{1,5}|[Qq]{1,5}|(?:[yYur]+|U{1,5})|[ML]{1,5}|d{1,2}|D{1,3}|F{1}|[abB]{1,5}|[hkHK]{1,2}|w{1,2}|W{1}|m{1,2}|s{1,2}|[zZOvVxX]{1,4})(?=([^']*'[^']*')*[^']*$)/g;function IN(e){var t={};return e.replace(bN,(function(e){var i=e.length;switch(e[0]){case"G":t.era=4===i?"long":5===i?"narrow":"short";break;case"y":t.year=2===i?"2-digit":"numeric";break;case"Y":case"u":case"U":case"r":throw new RangeError("`Y/u/U/r` (year) patterns are not supported, use `y` instead");case"q":case"Q":throw new RangeError("`q/Q` (quarter) patterns are not supported");case"M":case"L":t.month=["numeric","2-digit","short","long","narrow"][i-1];break;case"w":case"W":throw new RangeError("`w/W` (week) patterns are not supported");case"d":t.day=["numeric","2-digit"][i-1];break;case"D":case"F":case"g":throw new RangeError("`D/F/g` (day) patterns are not supported, use `d` instead");case"E":t.weekday=4===i?"long":5===i?"narrow":"short";break;case"e":if(i<4)throw new RangeError("`e..eee` (weekday) patterns are not supported");t.weekday=["short","long","narrow","short"][i-4];break;case"c":if(i<4)throw new RangeError("`c..ccc` (weekday) patterns are not supported");t.weekday=["short","long","narrow","short"][i-4];break;case"a":t.hour12=!0;break;case"b":case"B":throw new RangeError("`b/B` (period) patterns are not supported, use `a` instead");case"h":t.hourCycle="h12",t.hour=["numeric","2-digit"][i-1];break;case"H":t.hourCycle="h23",t.hour=["numeric","2-digit"][i-1];break;case"K":t.hourCycle="h11",t.hour=["numeric","2-digit"][i-1];break;case"k":t.hourCycle="h24",t.hour=["numeric","2-digit"][i-1];break;case"j":case"J":case"C":throw new RangeError("`j/J/C` (hour) patterns are not supported, use `h/H/K/k` instead");case"m":t.minute=["numeric","2-digit"][i-1];break;case"s":t.second=["numeric","2-digit"][i-1];break;case"S":case"A":throw new RangeError("`S/A` (second) patterns are not supported, use `s` instead");case"z":t.timeZoneName=i<4?"short":"long";break;case"Z":case"O":case"v":case"V":case"X":case"x":throw new RangeError("`Z/O/v/V/X/x` (timeZone) patterns are not supported, use `z` instead")}return""})),t}var EN=/[\t-\r \x85\u200E\u200F\u2028\u2029]/i,TN=/^\.(?:(0+)(\*)?|(#+)|(0+)(#+))$/g,SN=/^(@+)?(\+|#+)?[rs]?$/g,AN=/(\*)(0+)|(#+)(0+)|(0+)/g,PN=/^(0+)$/;function wN(e){var t={};return"r"===e[e.length-1]?t.roundingPriority="morePrecision":"s"===e[e.length-1]&&(t.roundingPriority="lessPrecision"),e.replace(SN,(function(e,i,s){return"string"!=typeof s?(t.minimumSignificantDigits=i.length,t.maximumSignificantDigits=i.length):"+"===s?t.minimumSignificantDigits=i.length:"#"===i[0]?t.maximumSignificantDigits=i.length:(t.minimumSignificantDigits=i.length,t.maximumSignificantDigits=i.length+("string"==typeof s?s.length:0)),""})),t}function CN(e){switch(e){case"sign-auto":return{signDisplay:"auto"};case"sign-accounting":case"()":return{currencySign:"accounting"};case"sign-always":case"+!":return{signDisplay:"always"};case"sign-accounting-always":case"()!":return{signDisplay:"always",currencySign:"accounting"};case"sign-except-zero":case"+?":return{signDisplay:"exceptZero"};case"sign-accounting-except-zero":case"()?":return{signDisplay:"exceptZero",currencySign:"accounting"};case"sign-never":case"+_":return{signDisplay:"never"}}}function RN(e){var t;if("E"===e[0]&&"E"===e[1]?(t={notation:"engineering"},e=e.slice(2)):"E"===e[0]&&(t={notation:"scientific"},e=e.slice(1)),t){var i=e.slice(0,2);if("+!"===i?(t.signDisplay="always",e=e.slice(2)):"+?"===i&&(t.signDisplay="exceptZero",e=e.slice(2)),!PN.test(e))throw new Error("Malformed concise eng/scientific notation");t.minimumIntegerDigits=e.length}return t}function LN(e){return CN(e)||{}}function NN(e){for(var t={},i=0,s=e;i<s.length;i++){var r=s[i];switch(r.stem){case"percent":case"%":t.style="percent";continue;case"%x100":t.style="percent",t.scale=100;continue;case"currency":t.style="currency",t.currency=r.options[0];continue;case"group-off":case",_":t.useGrouping=!1;continue;case"precision-integer":case".":t.maximumFractionDigits=0;continue;case"measure-unit":case"unit":t.style="unit",t.unit=r.options[0].replace(/^(.*?)-/,"");continue;case"compact-short":case"K":t.notation="compact",t.compactDisplay="short";continue;case"compact-long":case"KK":t.notation="compact",t.compactDisplay="long";continue;case"scientific":t=YL(YL(YL({},t),{notation:"scientific"}),r.options.reduce((function(e,t){return YL(YL({},e),LN(t))}),{}));continue;case"engineering":t=YL(YL(YL({},t),{notation:"engineering"}),r.options.reduce((function(e,t){return YL(YL({},e),LN(t))}),{}));continue;case"notation-simple":t.notation="standard";continue;case"unit-width-narrow":t.currencyDisplay="narrowSymbol",t.unitDisplay="narrow";continue;case"unit-width-short":t.currencyDisplay="code",t.unitDisplay="short";continue;case"unit-width-full-name":t.currencyDisplay="name",t.unitDisplay="long";continue;case"unit-width-iso-code":t.currencyDisplay="symbol";continue;case"scale":t.scale=parseFloat(r.options[0]);continue;case"rounding-mode-floor":t.roundingMode="floor";continue;case"rounding-mode-ceiling":t.roundingMode="ceil";continue;case"rounding-mode-down":t.roundingMode="trunc";continue;case"rounding-mode-up":t.roundingMode="expand";continue;case"rounding-mode-half-even":t.roundingMode="halfEven";continue;case"rounding-mode-half-down":t.roundingMode="halfTrunc";continue;case"rounding-mode-half-up":t.roundingMode="halfExpand";continue;case"integer-width":if(r.options.length>1)throw new RangeError("integer-width stems only accept a single optional option");r.options[0].replace(AN,(function(e,i,s,r,n,o){if(i)t.minimumIntegerDigits=s.length;else{if(r&&n)throw new Error("We currently do not support maximum integer digits");if(o)throw new Error("We currently do not support exact integer digits")}return""}));continue}if(PN.test(r.stem))t.minimumIntegerDigits=r.stem.length;else if(TN.test(r.stem)){if(r.options.length>1)throw new RangeError("Fraction-precision stems only accept a single optional option");r.stem.replace(TN,(function(e,i,s,r,n,o){return"*"===s?t.minimumFractionDigits=i.length:r&&"#"===r[0]?t.maximumFractionDigits=r.length:n&&o?(t.minimumFractionDigits=n.length,t.maximumFractionDigits=n.length+o.length):(t.minimumFractionDigits=i.length,t.maximumFractionDigits=i.length),""}));var n=r.options[0];"w"===n?t=YL(YL({},t),{trailingZeroDisplay:"stripIfInteger"}):n&&(t=YL(YL({},t),wN(n)))}else if(SN.test(r.stem))t=YL(YL({},t),wN(r.stem));else{var o=CN(r.stem);o&&(t=YL(YL({},t),o));var a=RN(r.stem);a&&(t=YL(YL({},t),a))}}return t}var DN,MN={"001":["H","h"],419:["h","H","hB","hb"],AC:["H","h","hb","hB"],AD:["H","hB"],AE:["h","hB","hb","H"],AF:["H","hb","hB","h"],AG:["h","hb","H","hB"],AI:["H","h","hb","hB"],AL:["h","H","hB"],AM:["H","hB"],AO:["H","hB"],AR:["h","H","hB","hb"],AS:["h","H"],AT:["H","hB"],AU:["h","hb","H","hB"],AW:["H","hB"],AX:["H"],AZ:["H","hB","h"],BA:["H","hB","h"],BB:["h","hb","H","hB"],BD:["h","hB","H"],BE:["H","hB"],BF:["H","hB"],BG:["H","hB","h"],BH:["h","hB","hb","H"],BI:["H","h"],BJ:["H","hB"],BL:["H","hB"],BM:["h","hb","H","hB"],BN:["hb","hB","h","H"],BO:["h","H","hB","hb"],BQ:["H"],BR:["H","hB"],BS:["h","hb","H","hB"],BT:["h","H"],BW:["H","h","hb","hB"],BY:["H","h"],BZ:["H","h","hb","hB"],CA:["h","hb","H","hB"],CC:["H","h","hb","hB"],CD:["hB","H"],CF:["H","h","hB"],CG:["H","hB"],CH:["H","hB","h"],CI:["H","hB"],CK:["H","h","hb","hB"],CL:["h","H","hB","hb"],CM:["H","h","hB"],CN:["H","hB","hb","h"],CO:["h","H","hB","hb"],CP:["H"],CR:["h","H","hB","hb"],CU:["h","H","hB","hb"],CV:["H","hB"],CW:["H","hB"],CX:["H","h","hb","hB"],CY:["h","H","hb","hB"],CZ:["H"],DE:["H","hB"],DG:["H","h","hb","hB"],DJ:["h","H"],DK:["H"],DM:["h","hb","H","hB"],DO:["h","H","hB","hb"],DZ:["h","hB","hb","H"],EA:["H","h","hB","hb"],EC:["h","H","hB","hb"],EE:["H","hB"],EG:["h","hB","hb","H"],EH:["h","hB","hb","H"],ER:["h","H"],ES:["H","hB","h","hb"],ET:["hB","hb","h","H"],FI:["H"],FJ:["h","hb","H","hB"],FK:["H","h","hb","hB"],FM:["h","hb","H","hB"],FO:["H","h"],FR:["H","hB"],GA:["H","hB"],GB:["H","h","hb","hB"],GD:["h","hb","H","hB"],GE:["H","hB","h"],GF:["H","hB"],GG:["H","h","hb","hB"],GH:["h","H"],GI:["H","h","hb","hB"],GL:["H","h"],GM:["h","hb","H","hB"],GN:["H","hB"],GP:["H","hB"],GQ:["H","hB","h","hb"],GR:["h","H","hb","hB"],GT:["h","H","hB","hb"],GU:["h","hb","H","hB"],GW:["H","hB"],GY:["h","hb","H","hB"],HK:["h","hB","hb","H"],HN:["h","H","hB","hb"],HR:["H","hB"],HU:["H","h"],IC:["H","h","hB","hb"],ID:["H"],IE:["H","h","hb","hB"],IL:["H","hB"],IM:["H","h","hb","hB"],IN:["h","H"],IO:["H","h","hb","hB"],IQ:["h","hB","hb","H"],IR:["hB","H"],IS:["H"],IT:["H","hB"],JE:["H","h","hb","hB"],JM:["h","hb","H","hB"],JO:["h","hB","hb","H"],JP:["H","K","h"],KE:["hB","hb","H","h"],KG:["H","h","hB","hb"],KH:["hB","h","H","hb"],KI:["h","hb","H","hB"],KM:["H","h","hB","hb"],KN:["h","hb","H","hB"],KP:["h","H","hB","hb"],KR:["h","H","hB","hb"],KW:["h","hB","hb","H"],KY:["h","hb","H","hB"],KZ:["H","hB"],LA:["H","hb","hB","h"],LB:["h","hB","hb","H"],LC:["h","hb","H","hB"],LI:["H","hB","h"],LK:["H","h","hB","hb"],LR:["h","hb","H","hB"],LS:["h","H"],LT:["H","h","hb","hB"],LU:["H","h","hB"],LV:["H","hB","hb","h"],LY:["h","hB","hb","H"],MA:["H","h","hB","hb"],MC:["H","hB"],MD:["H","hB"],ME:["H","hB","h"],MF:["H","hB"],MG:["H","h"],MH:["h","hb","H","hB"],MK:["H","h","hb","hB"],ML:["H"],MM:["hB","hb","H","h"],MN:["H","h","hb","hB"],MO:["h","hB","hb","H"],MP:["h","hb","H","hB"],MQ:["H","hB"],MR:["h","hB","hb","H"],MS:["H","h","hb","hB"],MT:["H","h"],MU:["H","h"],MV:["H","h"],MW:["h","hb","H","hB"],MX:["h","H","hB","hb"],MY:["hb","hB","h","H"],MZ:["H","hB"],NA:["h","H","hB","hb"],NC:["H","hB"],NE:["H"],NF:["H","h","hb","hB"],NG:["H","h","hb","hB"],NI:["h","H","hB","hb"],NL:["H","hB"],NO:["H","h"],NP:["H","h","hB"],NR:["H","h","hb","hB"],NU:["H","h","hb","hB"],NZ:["h","hb","H","hB"],OM:["h","hB","hb","H"],PA:["h","H","hB","hb"],PE:["h","H","hB","hb"],PF:["H","h","hB"],PG:["h","H"],PH:["h","hB","hb","H"],PK:["h","hB","H"],PL:["H","h"],PM:["H","hB"],PN:["H","h","hb","hB"],PR:["h","H","hB","hb"],PS:["h","hB","hb","H"],PT:["H","hB"],PW:["h","H"],PY:["h","H","hB","hb"],QA:["h","hB","hb","H"],RE:["H","hB"],RO:["H","hB"],RS:["H","hB","h"],RU:["H"],RW:["H","h"],SA:["h","hB","hb","H"],SB:["h","hb","H","hB"],SC:["H","h","hB"],SD:["h","hB","hb","H"],SE:["H"],SG:["h","hb","H","hB"],SH:["H","h","hb","hB"],SI:["H","hB"],SJ:["H"],SK:["H"],SL:["h","hb","H","hB"],SM:["H","h","hB"],SN:["H","h","hB"],SO:["h","H"],SR:["H","hB"],SS:["h","hb","H","hB"],ST:["H","hB"],SV:["h","H","hB","hb"],SX:["H","h","hb","hB"],SY:["h","hB","hb","H"],SZ:["h","hb","H","hB"],TA:["H","h","hb","hB"],TC:["h","hb","H","hB"],TD:["h","H","hB"],TF:["H","h","hB"],TG:["H","hB"],TH:["H","h"],TJ:["H","h"],TL:["H","hB","hb","h"],TM:["H","h"],TN:["h","hB","hb","H"],TO:["h","H"],TR:["H","hB"],TT:["h","hb","H","hB"],TW:["hB","hb","h","H"],TZ:["hB","hb","H","h"],UA:["H","hB","h"],UG:["hB","hb","H","h"],UM:["h","hb","H","hB"],US:["h","hb","H","hB"],UY:["h","H","hB","hb"],UZ:["H","hB","h"],VA:["H","h","hB"],VC:["h","hb","H","hB"],VE:["h","H","hB","hb"],VG:["h","hb","H","hB"],VI:["h","hb","H","hB"],VN:["H","h"],VU:["h","H"],WF:["H","hB"],WS:["h","H"],XK:["H","hB","h"],YE:["h","hB","hb","H"],YT:["H","hB"],ZA:["H","h","hb","hB"],ZM:["h","hb","H","hB"],ZW:["H","h"],"af-ZA":["H","h","hB","hb"],"ar-001":["h","hB","hb","H"],"ca-ES":["H","h","hB"],"en-001":["h","hb","H","hB"],"en-HK":["h","hb","H","hB"],"en-IL":["H","h","hb","hB"],"en-MY":["h","hb","H","hB"],"es-BR":["H","h","hB","hb"],"es-ES":["H","h","hB","hb"],"es-GQ":["H","h","hB","hb"],"fr-CA":["H","h","hB"],"gl-ES":["H","h","hB"],"gu-IN":["hB","hb","h","H"],"hi-IN":["hB","h","H"],"it-CH":["H","h","hB"],"it-IT":["H","h","hB"],"kn-IN":["hB","h","H"],"ml-IN":["hB","h","H"],"mr-IN":["hB","hb","h","H"],"pa-IN":["hB","hb","h","H"],"ta-IN":["hB","h","hb","H"],"te-IN":["hB","h","H"],"zu-ZA":["H","hB","hb","h"]};function xN(e){var t=e.hourCycle;if(void 0===t&&e.hourCycles&&e.hourCycles.length&&(t=e.hourCycles[0]),t)switch(t){case"h24":return"k";case"h23":return"H";case"h12":return"h";case"h11":return"K";default:throw new Error("Invalid hourCycle")}var i,s=e.language;return"root"!==s&&(i=e.maximize().region),(MN[i||""]||MN[s||""]||MN["".concat(s,"-001")]||MN["001"])[0]}var kN=new RegExp("^".concat(ON.source,"*")),HN=new RegExp("".concat(ON.source,"*$"));function jN(e,t){return{start:e,end:t}}var UN=!!String.prototype.startsWith&&"_a".startsWith("a",1),BN=!!String.fromCodePoint,FN=!!Object.fromEntries,VN=!!String.prototype.codePointAt,KN=!!String.prototype.trimStart,GN=!!String.prototype.trimEnd,$N=Number.isSafeInteger?Number.isSafeInteger:function(e){return"number"==typeof e&&isFinite(e)&&Math.floor(e)===e&&Math.abs(e)<=9007199254740991},WN=!0;try{WN="a"===(null===(DN=eD("([^\\p{White_Space}\\p{Pattern_Syntax}]*)","yu").exec("a"))||void 0===DN?void 0:DN[0])}catch(e){WN=!1}var zN,qN=UN?function(e,t,i){return e.startsWith(t,i)}:function(e,t,i){return e.slice(i,i+t.length)===t},YN=BN?String.fromCodePoint:function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];for(var i,s="",r=e.length,n=0;r>n;){if((i=e[n++])>1114111)throw RangeError(i+" is not a valid code point");s+=i<65536?String.fromCharCode(i):String.fromCharCode(55296+((i-=65536)>>10),i%1024+56320)}return s},QN=FN?Object.fromEntries:function(e){for(var t={},i=0,s=e;i<s.length;i++){var r=s[i],n=r[0],o=r[1];t[n]=o}return t},JN=VN?function(e,t){return e.codePointAt(t)}:function(e,t){var i=e.length;if(!(t<0||t>=i)){var s,r=e.charCodeAt(t);return r<55296||r>56319||t+1===i||(s=e.charCodeAt(t+1))<56320||s>57343?r:s-56320+(r-55296<<10)+65536}},XN=KN?function(e){return e.trimStart()}:function(e){return e.replace(kN,"")},ZN=GN?function(e){return e.trimEnd()}:function(e){return e.replace(HN,"")};function eD(e,t){return new RegExp(e,t)}if(WN){var tD=eD("([^\\p{White_Space}\\p{Pattern_Syntax}]*)","yu");zN=function(e,t){var i;return tD.lastIndex=t,null!==(i=tD.exec(e)[1])&&void 0!==i?i:""}}else zN=function(e,t){for(var i=[];;){var s=JN(e,t);if(void 0===s||nD(s)||oD(s))break;i.push(s),t+=s>=65536?2:1}return YN.apply(void 0,i)};var iD,sD=function(){function e(e,t){void 0===t&&(t={}),this.message=e,this.position={offset:0,line:1,column:1},this.ignoreTag=!!t.ignoreTag,this.locale=t.locale,this.requiresOtherClause=!!t.requiresOtherClause,this.shouldParseSkeletons=!!t.shouldParseSkeletons}return e.prototype.parse=function(){if(0!==this.offset())throw Error("parser can only be used once");return this.parseMessage(0,"",!1)},e.prototype.parseMessage=function(e,t,i){for(var s=[];!this.isEOF();){var r=this.char();if(123===r){if((n=this.parseArgument(e,i)).err)return n;s.push(n.val)}else{if(125===r&&e>0)break;if(35!==r||"plural"!==t&&"selectordinal"!==t){if(60===r&&!this.ignoreTag&&47===this.peek()){if(i)break;return this.error(rN.UNMATCHED_CLOSING_TAG,jN(this.clonePosition(),this.clonePosition()))}if(60===r&&!this.ignoreTag&&rD(this.peek()||0)){if((n=this.parseTag(e,t)).err)return n;s.push(n.val)}else{var n;if((n=this.parseLiteral(e,t)).err)return n;s.push(n.val)}}else{var o=this.clonePosition();this.bump(),s.push({type:nN.pound,location:jN(o,this.clonePosition())})}}}return{val:s,err:null}},e.prototype.parseTag=function(e,t){var i=this.clonePosition();this.bump();var s=this.parseTagName();if(this.bumpSpace(),this.bumpIf("/>"))return{val:{type:nN.literal,value:"<".concat(s,"/>"),location:jN(i,this.clonePosition())},err:null};if(this.bumpIf(">")){var r=this.parseMessage(e+1,t,!0);if(r.err)return r;var n=r.val,o=this.clonePosition();if(this.bumpIf("</")){if(this.isEOF()||!rD(this.char()))return this.error(rN.INVALID_TAG,jN(o,this.clonePosition()));var a=this.clonePosition();return s!==this.parseTagName()?this.error(rN.UNMATCHED_CLOSING_TAG,jN(a,this.clonePosition())):(this.bumpSpace(),this.bumpIf(">")?{val:{type:nN.tag,value:s,children:n,location:jN(i,this.clonePosition())},err:null}:this.error(rN.INVALID_TAG,jN(o,this.clonePosition())))}return this.error(rN.UNCLOSED_TAG,jN(i,this.clonePosition()))}return this.error(rN.INVALID_TAG,jN(i,this.clonePosition()))},e.prototype.parseTagName=function(){var e,t=this.offset();for(this.bump();!this.isEOF()&&(45===(e=this.char())||46===e||e>=48&&e<=57||95===e||e>=97&&e<=122||e>=65&&e<=90||183==e||e>=192&&e<=214||e>=216&&e<=246||e>=248&&e<=893||e>=895&&e<=8191||e>=8204&&e<=8205||e>=8255&&e<=8256||e>=8304&&e<=8591||e>=11264&&e<=12271||e>=12289&&e<=55295||e>=63744&&e<=64975||e>=65008&&e<=65533||e>=65536&&e<=983039);)this.bump();return this.message.slice(t,this.offset())},e.prototype.parseLiteral=function(e,t){for(var i=this.clonePosition(),s="";;){var r=this.tryParseQuote(t);if(r)s+=r;else{var n=this.tryParseUnquoted(e,t);if(n)s+=n;else{var o=this.tryParseLeftAngleBracket();if(!o)break;s+=o}}}var a=jN(i,this.clonePosition());return{val:{type:nN.literal,value:s,location:a},err:null}},e.prototype.tryParseLeftAngleBracket=function(){return this.isEOF()||60!==this.char()||!this.ignoreTag&&(rD(e=this.peek()||0)||47===e)?null:(this.bump(),"<");var e},e.prototype.tryParseQuote=function(e){if(this.isEOF()||39!==this.char())return null;switch(this.peek()){case 39:return this.bump(),this.bump(),"'";case 123:case 60:case 62:case 125:break;case 35:if("plural"===e||"selectordinal"===e)break;return null;default:return null}this.bump();var t=[this.char()];for(this.bump();!this.isEOF();){var i=this.char();if(39===i){if(39!==this.peek()){this.bump();break}t.push(39),this.bump()}else t.push(i);this.bump()}return YN.apply(void 0,t)},e.prototype.tryParseUnquoted=function(e,t){if(this.isEOF())return null;var i=this.char();return 60===i||123===i||35===i&&("plural"===t||"selectordinal"===t)||125===i&&e>0?null:(this.bump(),YN(i))},e.prototype.parseArgument=function(e,t){var i=this.clonePosition();if(this.bump(),this.bumpSpace(),this.isEOF())return this.error(rN.EXPECT_ARGUMENT_CLOSING_BRACE,jN(i,this.clonePosition()));if(125===this.char())return this.bump(),this.error(rN.EMPTY_ARGUMENT,jN(i,this.clonePosition()));var s=this.parseIdentifierIfPossible().value;if(!s)return this.error(rN.MALFORMED_ARGUMENT,jN(i,this.clonePosition()));if(this.bumpSpace(),this.isEOF())return this.error(rN.EXPECT_ARGUMENT_CLOSING_BRACE,jN(i,this.clonePosition()));switch(this.char()){case 125:return this.bump(),{val:{type:nN.argument,value:s,location:jN(i,this.clonePosition())},err:null};case 44:return this.bump(),this.bumpSpace(),this.isEOF()?this.error(rN.EXPECT_ARGUMENT_CLOSING_BRACE,jN(i,this.clonePosition())):this.parseArgumentOptions(e,t,s,i);default:return this.error(rN.MALFORMED_ARGUMENT,jN(i,this.clonePosition()))}},e.prototype.parseIdentifierIfPossible=function(){var e=this.clonePosition(),t=this.offset(),i=zN(this.message,t),s=t+i.length;return this.bumpTo(s),{value:i,location:jN(e,this.clonePosition())}},e.prototype.parseArgumentOptions=function(e,t,i,s){var r,n=this.clonePosition(),o=this.parseIdentifierIfPossible().value,a=this.clonePosition();switch(o){case"":return this.error(rN.EXPECT_ARGUMENT_TYPE,jN(n,a));case"number":case"date":case"time":this.bumpSpace();var c=null;if(this.bumpIf(",")){this.bumpSpace();var l=this.clonePosition();if((g=this.parseSimpleArgStyleIfPossible()).err)return g;if(0===(p=ZN(g.val)).length)return this.error(rN.EXPECT_ARGUMENT_STYLE,jN(this.clonePosition(),this.clonePosition()));c={style:p,styleLocation:jN(l,this.clonePosition())}}if((y=this.tryParseArgumentClose(s)).err)return y;var d=jN(s,this.clonePosition());if(c&&qN(null==c?void 0:c.style,"::",0)){var u=XN(c.style.slice(2));if("number"===o)return(g=this.parseNumberSkeletonFromString(u,c.styleLocation)).err?g:{val:{type:nN.number,value:i,location:d,style:g.val},err:null};if(0===u.length)return this.error(rN.EXPECT_DATE_TIME_SKELETON,d);var h=u;this.locale&&(h=function(e,t){for(var i="",s=0;s<e.length;s++){var r=e.charAt(s);if("j"===r){for(var n=0;s+1<e.length&&e.charAt(s+1)===r;)n++,s++;var o=1+(1&n),a=n<2?1:3+(n>>1),c=xN(t);for("H"!=c&&"k"!=c||(a=0);a-- >0;)i+="a";for(;o-- >0;)i=c+i}else i+="J"===r?"H":r}return i}(u,this.locale));var p={type:oN.dateTime,pattern:h,location:c.styleLocation,parsedOptions:this.shouldParseSkeletons?IN(h):{}};return{val:{type:"date"===o?nN.date:nN.time,value:i,location:d,style:p},err:null}}return{val:{type:"number"===o?nN.number:"date"===o?nN.date:nN.time,value:i,location:d,style:null!==(r=null==c?void 0:c.style)&&void 0!==r?r:null},err:null};case"plural":case"selectordinal":case"select":var _=this.clonePosition();if(this.bumpSpace(),!this.bumpIf(","))return this.error(rN.EXPECT_SELECT_ARGUMENT_OPTIONS,jN(_,YL({},_)));this.bumpSpace();var m=this.parseIdentifierIfPossible(),f=0;if("select"!==o&&"offset"===m.value){if(!this.bumpIf(":"))return this.error(rN.EXPECT_PLURAL_ARGUMENT_OFFSET_VALUE,jN(this.clonePosition(),this.clonePosition()));var g;if(this.bumpSpace(),(g=this.tryParseDecimalInteger(rN.EXPECT_PLURAL_ARGUMENT_OFFSET_VALUE,rN.INVALID_PLURAL_ARGUMENT_OFFSET_VALUE)).err)return g;this.bumpSpace(),m=this.parseIdentifierIfPossible(),f=g.val}var y,v=this.tryParsePluralOrSelectOptions(e,o,t,m);if(v.err)return v;if((y=this.tryParseArgumentClose(s)).err)return y;var O=jN(s,this.clonePosition());return"select"===o?{val:{type:nN.select,value:i,options:QN(v.val),location:O},err:null}:{val:{type:nN.plural,value:i,options:QN(v.val),offset:f,pluralType:"plural"===o?"cardinal":"ordinal",location:O},err:null};default:return this.error(rN.INVALID_ARGUMENT_TYPE,jN(n,a))}},e.prototype.tryParseArgumentClose=function(e){return this.isEOF()||125!==this.char()?this.error(rN.EXPECT_ARGUMENT_CLOSING_BRACE,jN(e,this.clonePosition())):(this.bump(),{val:!0,err:null})},e.prototype.parseSimpleArgStyleIfPossible=function(){for(var e=0,t=this.clonePosition();!this.isEOF();)switch(this.char()){case 39:this.bump();var i=this.clonePosition();if(!this.bumpUntil("'"))return this.error(rN.UNCLOSED_QUOTE_IN_ARGUMENT_STYLE,jN(i,this.clonePosition()));this.bump();break;case 123:e+=1,this.bump();break;case 125:if(!(e>0))return{val:this.message.slice(t.offset,this.offset()),err:null};e-=1;break;default:this.bump()}return{val:this.message.slice(t.offset,this.offset()),err:null}},e.prototype.parseNumberSkeletonFromString=function(e,t){var i=[];try{i=function(e){if(0===e.length)throw new Error("Number skeleton cannot be empty");for(var t=[],i=0,s=e.split(EN).filter((function(e){return e.length>0}));i<s.length;i++){var r=s[i].split("/");if(0===r.length)throw new Error("Invalid number skeleton");for(var n=r[0],o=r.slice(1),a=0,c=o;a<c.length;a++)if(0===c[a].length)throw new Error("Invalid number skeleton");t.push({stem:n,options:o})}return t}(e)}catch(e){return this.error(rN.INVALID_NUMBER_SKELETON,t)}return{val:{type:oN.number,tokens:i,location:t,parsedOptions:this.shouldParseSkeletons?NN(i):{}},err:null}},e.prototype.tryParsePluralOrSelectOptions=function(e,t,i,s){for(var r,n=!1,o=[],a=new Set,c=s.value,l=s.location;;){if(0===c.length){var d=this.clonePosition();if("select"===t||!this.bumpIf("="))break;var u=this.tryParseDecimalInteger(rN.EXPECT_PLURAL_ARGUMENT_SELECTOR,rN.INVALID_PLURAL_ARGUMENT_SELECTOR);if(u.err)return u;l=jN(d,this.clonePosition()),c=this.message.slice(d.offset,this.offset())}if(a.has(c))return this.error("select"===t?rN.DUPLICATE_SELECT_ARGUMENT_SELECTOR:rN.DUPLICATE_PLURAL_ARGUMENT_SELECTOR,l);"other"===c&&(n=!0),this.bumpSpace();var h=this.clonePosition();if(!this.bumpIf("{"))return this.error("select"===t?rN.EXPECT_SELECT_ARGUMENT_SELECTOR_FRAGMENT:rN.EXPECT_PLURAL_ARGUMENT_SELECTOR_FRAGMENT,jN(this.clonePosition(),this.clonePosition()));var p=this.parseMessage(e+1,t,i);if(p.err)return p;var _=this.tryParseArgumentClose(h);if(_.err)return _;o.push([c,{value:p.val,location:jN(h,this.clonePosition())}]),a.add(c),this.bumpSpace(),c=(r=this.parseIdentifierIfPossible()).value,l=r.location}return 0===o.length?this.error("select"===t?rN.EXPECT_SELECT_ARGUMENT_SELECTOR:rN.EXPECT_PLURAL_ARGUMENT_SELECTOR,jN(this.clonePosition(),this.clonePosition())):this.requiresOtherClause&&!n?this.error(rN.MISSING_OTHER_CLAUSE,jN(this.clonePosition(),this.clonePosition())):{val:o,err:null}},e.prototype.tryParseDecimalInteger=function(e,t){var i=1,s=this.clonePosition();this.bumpIf("+")||this.bumpIf("-")&&(i=-1);for(var r=!1,n=0;!this.isEOF();){var o=this.char();if(!(o>=48&&o<=57))break;r=!0,n=10*n+(o-48),this.bump()}var a=jN(s,this.clonePosition());return r?$N(n*=i)?{val:n,err:null}:this.error(t,a):this.error(e,a)},e.prototype.offset=function(){return this.position.offset},e.prototype.isEOF=function(){return this.offset()===this.message.length},e.prototype.clonePosition=function(){return{offset:this.position.offset,line:this.position.line,column:this.position.column}},e.prototype.char=function(){var e=this.position.offset;if(e>=this.message.length)throw Error("out of bound");var t=JN(this.message,e);if(void 0===t)throw Error("Offset ".concat(e," is at invalid UTF-16 code unit boundary"));return t},e.prototype.error=function(e,t){return{val:null,err:{kind:e,message:this.message,location:t}}},e.prototype.bump=function(){if(!this.isEOF()){var e=this.char();10===e?(this.position.line+=1,this.position.column=1,this.position.offset+=1):(this.position.column+=1,this.position.offset+=e<65536?1:2)}},e.prototype.bumpIf=function(e){if(qN(this.message,e,this.offset())){for(var t=0;t<e.length;t++)this.bump();return!0}return!1},e.prototype.bumpUntil=function(e){var t=this.offset(),i=this.message.indexOf(e,t);return i>=0?(this.bumpTo(i),!0):(this.bumpTo(this.message.length),!1)},e.prototype.bumpTo=function(e){if(this.offset()>e)throw Error("targetOffset ".concat(e," must be greater than or equal to the current offset ").concat(this.offset()));for(e=Math.min(e,this.message.length);;){var t=this.offset();if(t===e)break;if(t>e)throw Error("targetOffset ".concat(e," is at invalid UTF-16 code unit boundary"));if(this.bump(),this.isEOF())break}},e.prototype.bumpSpace=function(){for(;!this.isEOF()&&nD(this.char());)this.bump()},e.prototype.peek=function(){if(this.isEOF())return null;var e=this.char(),t=this.offset(),i=this.message.charCodeAt(t+(e>=65536?2:1));return null!=i?i:null},e}();function rD(e){return e>=97&&e<=122||e>=65&&e<=90}function nD(e){return e>=9&&e<=13||32===e||133===e||e>=8206&&e<=8207||8232===e||8233===e}function oD(e){return e>=33&&e<=35||36===e||e>=37&&e<=39||40===e||41===e||42===e||43===e||44===e||45===e||e>=46&&e<=47||e>=58&&e<=59||e>=60&&e<=62||e>=63&&e<=64||91===e||92===e||93===e||94===e||96===e||123===e||124===e||125===e||126===e||161===e||e>=162&&e<=165||166===e||167===e||169===e||171===e||172===e||174===e||176===e||177===e||182===e||187===e||191===e||215===e||247===e||e>=8208&&e<=8213||e>=8214&&e<=8215||8216===e||8217===e||8218===e||e>=8219&&e<=8220||8221===e||8222===e||8223===e||e>=8224&&e<=8231||e>=8240&&e<=8248||8249===e||8250===e||e>=8251&&e<=8254||e>=8257&&e<=8259||8260===e||8261===e||8262===e||e>=8263&&e<=8273||8274===e||8275===e||e>=8277&&e<=8286||e>=8592&&e<=8596||e>=8597&&e<=8601||e>=8602&&e<=8603||e>=8604&&e<=8607||8608===e||e>=8609&&e<=8610||8611===e||e>=8612&&e<=8613||8614===e||e>=8615&&e<=8621||8622===e||e>=8623&&e<=8653||e>=8654&&e<=8655||e>=8656&&e<=8657||8658===e||8659===e||8660===e||e>=8661&&e<=8691||e>=8692&&e<=8959||e>=8960&&e<=8967||8968===e||8969===e||8970===e||8971===e||e>=8972&&e<=8991||e>=8992&&e<=8993||e>=8994&&e<=9e3||9001===e||9002===e||e>=9003&&e<=9083||9084===e||e>=9085&&e<=9114||e>=9115&&e<=9139||e>=9140&&e<=9179||e>=9180&&e<=9185||e>=9186&&e<=9254||e>=9255&&e<=9279||e>=9280&&e<=9290||e>=9291&&e<=9311||e>=9472&&e<=9654||9655===e||e>=9656&&e<=9664||9665===e||e>=9666&&e<=9719||e>=9720&&e<=9727||e>=9728&&e<=9838||9839===e||e>=9840&&e<=10087||10088===e||10089===e||10090===e||10091===e||10092===e||10093===e||10094===e||10095===e||10096===e||10097===e||10098===e||10099===e||10100===e||10101===e||e>=10132&&e<=10175||e>=10176&&e<=10180||10181===e||10182===e||e>=10183&&e<=10213||10214===e||10215===e||10216===e||10217===e||10218===e||10219===e||10220===e||10221===e||10222===e||10223===e||e>=10224&&e<=10239||e>=10240&&e<=10495||e>=10496&&e<=10626||10627===e||10628===e||10629===e||10630===e||10631===e||10632===e||10633===e||10634===e||10635===e||10636===e||10637===e||10638===e||10639===e||10640===e||10641===e||10642===e||10643===e||10644===e||10645===e||10646===e||10647===e||10648===e||e>=10649&&e<=10711||10712===e||10713===e||10714===e||10715===e||e>=10716&&e<=10747||10748===e||10749===e||e>=10750&&e<=11007||e>=11008&&e<=11055||e>=11056&&e<=11076||e>=11077&&e<=11078||e>=11079&&e<=11084||e>=11085&&e<=11123||e>=11124&&e<=11125||e>=11126&&e<=11157||11158===e||e>=11159&&e<=11263||e>=11776&&e<=11777||11778===e||11779===e||11780===e||11781===e||e>=11782&&e<=11784||11785===e||11786===e||11787===e||11788===e||11789===e||e>=11790&&e<=11798||11799===e||e>=11800&&e<=11801||11802===e||11803===e||11804===e||11805===e||e>=11806&&e<=11807||11808===e||11809===e||11810===e||11811===e||11812===e||11813===e||11814===e||11815===e||11816===e||11817===e||e>=11818&&e<=11822||11823===e||e>=11824&&e<=11833||e>=11834&&e<=11835||e>=11836&&e<=11839||11840===e||11841===e||11842===e||e>=11843&&e<=11855||e>=11856&&e<=11857||11858===e||e>=11859&&e<=11903||e>=12289&&e<=12291||12296===e||12297===e||12298===e||12299===e||12300===e||12301===e||12302===e||12303===e||12304===e||12305===e||e>=12306&&e<=12307||12308===e||12309===e||12310===e||12311===e||12312===e||12313===e||12314===e||12315===e||12316===e||12317===e||e>=12318&&e<=12319||12320===e||12336===e||64830===e||64831===e||e>=65093&&e<=65094}function aD(e){e.forEach((function(e){if(delete e.location,_N(e)||mN(e))for(var t in e.options)delete e.options[t].location,aD(e.options[t].value);else uN(e)&&yN(e.style)||(hN(e)||pN(e))&&vN(e.style)?delete e.style.location:gN(e)&&aD(e.children)}))}function cD(e,t){void 0===t&&(t={}),t=YL({shouldParseSkeletons:!0,requiresOtherClause:!0},t);var i=new sD(e,t).parse();if(i.err){var s=SyntaxError(rN[i.err.kind]);throw s.location=i.err.location,s.originalMessage=i.err.message,s}return(null==t?void 0:t.captureLocation)||aD(i.val),i.val}!function(e){e.MISSING_VALUE="MISSING_VALUE",e.INVALID_VALUE="INVALID_VALUE",e.MISSING_INTL_API="MISSING_INTL_API"}(iD||(iD={}));var lD,dD=function(e){function t(t,i,s){var r=e.call(this,t)||this;return r.code=i,r.originalMessage=s,r}return qL(t,e),t.prototype.toString=function(){return"[formatjs Error: ".concat(this.code,"] ").concat(this.message)},t}(Error),uD=function(e){function t(t,i,s,r){return e.call(this,'Invalid values for "'.concat(t,'": "').concat(i,'". Options are "').concat(Object.keys(s).join('", "'),'"'),iD.INVALID_VALUE,r)||this}return qL(t,e),t}(dD),hD=function(e){function t(t,i,s){return e.call(this,'Value for "'.concat(t,'" must be of type ').concat(i),iD.INVALID_VALUE,s)||this}return qL(t,e),t}(dD),pD=function(e){function t(t,i){return e.call(this,'The intl string context variable "'.concat(t,'" was not provided to the string "').concat(i,'"'),iD.MISSING_VALUE,i)||this}return qL(t,e),t}(dD);function _D(e){return"function"==typeof e}function mD(e,t,i,s,r,n,o){if(1===e.length&&lN(e[0]))return[{type:lD.literal,value:e[0].value}];for(var a=[],c=0,l=e;c<l.length;c++){var d=l[c];if(lN(d))a.push({type:lD.literal,value:d.value});else if(fN(d))"number"==typeof n&&a.push({type:lD.literal,value:i.getNumberFormat(t).format(n)});else{var u=d.value;if(!r||!(u in r))throw new pD(u,o);var h=r[u];if(dN(d))h&&"string"!=typeof h&&"number"!=typeof h||(h="string"==typeof h||"number"==typeof h?String(h):""),a.push({type:"string"==typeof h?lD.literal:lD.object,value:h});else if(hN(d)){var p="string"==typeof d.style?s.date[d.style]:vN(d.style)?d.style.parsedOptions:void 0;a.push({type:lD.literal,value:i.getDateTimeFormat(t,p).format(h)})}else if(pN(d))p="string"==typeof d.style?s.time[d.style]:vN(d.style)?d.style.parsedOptions:s.time.medium,a.push({type:lD.literal,value:i.getDateTimeFormat(t,p).format(h)});else if(uN(d))(p="string"==typeof d.style?s.number[d.style]:yN(d.style)?d.style.parsedOptions:void 0)&&p.scale&&(h*=p.scale||1),a.push({type:lD.literal,value:i.getNumberFormat(t,p).format(h)});else{if(gN(d)){var _=d.children,m=d.value,f=r[m];if(!_D(f))throw new hD(m,"function",o);var g=f(mD(_,t,i,s,r,n).map((function(e){return e.value})));Array.isArray(g)||(g=[g]),a.push.apply(a,g.map((function(e){return{type:"string"==typeof e?lD.literal:lD.object,value:e}})))}if(_N(d)){if(!(y=d.options[h]||d.options.other))throw new uD(d.value,h,Object.keys(d.options),o);a.push.apply(a,mD(y.value,t,i,s,r))}else if(mN(d)){var y;if(!(y=d.options["=".concat(h)])){if(!Intl.PluralRules)throw new dD('Intl.PluralRules is not available in this environment.\nTry polyfilling it using "@formatjs/intl-pluralrules"\n',iD.MISSING_INTL_API,o);var v=i.getPluralRules(t,{type:d.pluralType}).select(h-(d.offset||0));y=d.options[v]||d.options.other}if(!y)throw new uD(d.value,h,Object.keys(d.options),o);a.push.apply(a,mD(y.value,t,i,s,r,h-(d.offset||0)))}}}}return(O=a).length<2?O:O.reduce((function(e,t){var i=e[e.length-1];return i&&i.type===lD.literal&&t.type===lD.literal?i.value+=t.value:e.push(t),e}),[]);var O}function fD(e){return{create:function(){return{get:function(t){return e[t]},set:function(t,i){e[t]=i}}}}}!function(e){e[e.literal=0]="literal",e[e.object=1]="object"}(lD||(lD={}));var gD,yD=function(){function e(t,i,s,r){void 0===i&&(i=e.defaultLocale);var n=this;if(this.formatterCache={number:{},dateTime:{},pluralRules:{}},this.format=function(e){var t=n.formatToParts(e);if(1===t.length)return t[0].value;var i=t.reduce((function(e,t){return e.length&&t.type===lD.literal&&"string"==typeof e[e.length-1]?e[e.length-1]+=t.value:e.push(t.value),e}),[]);return i.length<=1?i[0]||"":i},this.formatToParts=function(e){return mD(n.ast,n.locales,n.formatters,n.formats,e,void 0,n.message)},this.resolvedOptions=function(){var e;return{locale:(null===(e=n.resolvedLocale)||void 0===e?void 0:e.toString())||Intl.NumberFormat.supportedLocalesOf(n.locales)[0]}},this.getAst=function(){return n.ast},this.locales=i,this.resolvedLocale=e.resolveLocale(i),"string"==typeof t){if(this.message=t,!e.__parse)throw new TypeError("IntlMessageFormat.__parse must be set to process `message` of type `string`");var o=r||{};o.formatters;var a=function(e,t){var i={};for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&t.indexOf(s)<0&&(i[s]=e[s]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(s=Object.getOwnPropertySymbols(e);r<s.length;r++)t.indexOf(s[r])<0&&Object.prototype.propertyIsEnumerable.call(e,s[r])&&(i[s[r]]=e[s[r]])}return i}(o,["formatters"]);this.ast=e.__parse(t,YL(YL({},a),{locale:this.resolvedLocale}))}else this.ast=t;if(!Array.isArray(this.ast))throw new TypeError("A message must be provided as a String or AST.");this.formats=function(e,t){return t?Object.keys(e).reduce((function(i,s){var r,n;return i[s]=(r=e[s],(n=t[s])?YL(YL(YL({},r||{}),n||{}),Object.keys(r).reduce((function(e,t){return e[t]=YL(YL({},r[t]),n[t]||{}),e}),{})):r),i}),YL({},e)):e}(e.formats,s),this.formatters=r&&r.formatters||function(e){return void 0===e&&(e={number:{},dateTime:{},pluralRules:{}}),{getNumberFormat:JL((function(){for(var e,t=[],i=0;i<arguments.length;i++)t[i]=arguments[i];return new((e=Intl.NumberFormat).bind.apply(e,QL([void 0],t,!1)))}),{cache:fD(e.number),strategy:cN.variadic}),getDateTimeFormat:JL((function(){for(var e,t=[],i=0;i<arguments.length;i++)t[i]=arguments[i];return new((e=Intl.DateTimeFormat).bind.apply(e,QL([void 0],t,!1)))}),{cache:fD(e.dateTime),strategy:cN.variadic}),getPluralRules:JL((function(){for(var e,t=[],i=0;i<arguments.length;i++)t[i]=arguments[i];return new((e=Intl.PluralRules).bind.apply(e,QL([void 0],t,!1)))}),{cache:fD(e.pluralRules),strategy:cN.variadic})}}(this.formatterCache)}return Object.defineProperty(e,"defaultLocale",{get:function(){return e.memoizedDefaultLocale||(e.memoizedDefaultLocale=(new Intl.NumberFormat).resolvedOptions().locale),e.memoizedDefaultLocale},enumerable:!1,configurable:!0}),e.memoizedDefaultLocale=null,e.resolveLocale=function(e){if(void 0!==Intl.Locale){var t=Intl.NumberFormat.supportedLocalesOf(e);return t.length>0?new Intl.Locale(t[0]):new Intl.Locale("string"==typeof e?e:e[0])}},e.__parse=cD,e.formats={number:{integer:{maximumFractionDigits:0},currency:{style:"currency"},percent:{style:"percent"}},date:{short:{month:"numeric",day:"numeric",year:"2-digit"},medium:{month:"short",day:"numeric",year:"numeric"},long:{month:"long",day:"numeric",year:"numeric"},full:{weekday:"long",month:"long",day:"numeric",year:"numeric"}},time:{short:{hour:"numeric",minute:"numeric"},medium:{hour:"numeric",minute:"numeric",second:"numeric"},long:{hour:"numeric",minute:"numeric",second:"numeric",timeZoneName:"short"},full:{hour:"numeric",minute:"numeric",second:"numeric",timeZoneName:"short"}}},e}();!function(e){e.FORMAT_ERROR="FORMAT_ERROR",e.UNSUPPORTED_FORMATTER="UNSUPPORTED_FORMATTER",e.INVALID_CONFIG="INVALID_CONFIG",e.MISSING_DATA="MISSING_DATA",e.MISSING_TRANSLATION="MISSING_TRANSLATION"}(gD||(gD={}));var vD=function(e){function t(i,s,r){var n=this,o=r?r instanceof Error?r:new Error(String(r)):void 0;return(n=e.call(this,"[@formatjs/intl Error ".concat(i,"] ").concat(s,"\n").concat(o?"\n".concat(o.message,"\n").concat(o.stack):""))||this).code=i,"function"==typeof Error.captureStackTrace&&Error.captureStackTrace(n,t),n}return qL(t,e),t}(Error),OD=function(e){function t(t,i){return e.call(this,gD.UNSUPPORTED_FORMATTER,t,i)||this}return qL(t,e),t}(vD),bD=function(e){function t(t,i){return e.call(this,gD.INVALID_CONFIG,t,i)||this}return qL(t,e),t}(vD),ID=function(e){function t(t,i){return e.call(this,gD.MISSING_DATA,t,i)||this}return qL(t,e),t}(vD),ED=function(e){function t(t,i,s){var r=e.call(this,gD.FORMAT_ERROR,"".concat(t,"\nLocale: ").concat(i,"\n"),s)||this;return r.locale=i,r}return qL(t,e),t}(vD),TD=function(e){function t(t,i,s,r){var n=e.call(this,"".concat(t,"\nMessageID: ").concat(null==s?void 0:s.id,"\nDefault Message: ").concat(null==s?void 0:s.defaultMessage,"\nDescription: ").concat(null==s?void 0:s.description,"\n"),i,r)||this;return n.descriptor=s,n.locale=i,n}return qL(t,e),t}(ED),SD=function(e){function t(t,i){var s=e.call(this,gD.MISSING_TRANSLATION,'Missing message: "'.concat(t.id,'" for locale "').concat(i,'", using ').concat(t.defaultMessage?"default message (".concat("string"==typeof t.defaultMessage?t.defaultMessage:t.defaultMessage.map((function(e){var t;return null!==(t=e.value)&&void 0!==t?t:JSON.stringify(e)})).join(),")"):"id"," as fallback."))||this;return s.descriptor=t,s}return qL(t,e),t}(vD);function AD(e,t,i){return void 0===i&&(i={}),t.reduce((function(t,s){return s in e?t[s]=e[s]:s in i&&(t[s]=i[s]),t}),{})}var PD={formats:{},messages:{},timeZone:void 0,defaultLocale:"en",defaultFormats:{},fallbackOnEmptyString:!0,onError:function(e){},onWarn:function(e){}};function wD(e){return{create:function(){return{get:function(t){return e[t]},set:function(t,i){e[t]=i}}}}}function CD(e,t,i,s){var r,n=e&&e[t];if(n&&(r=n[i]),r)return r;s(new OD("No ".concat(t," format named: ").concat(i)))}function RD(e,t){return Object.keys(e).reduce((function(i,s){return i[s]=YL({timeZone:t},e[s]),i}),{})}function LD(e,t){return Object.keys(YL(YL({},e),t)).reduce((function(i,s){return i[s]=YL(YL({},e[s]||{}),t[s]||{}),i}),{})}function ND(e,t){if(!t)return e;var i=yD.formats;return YL(YL(YL({},i),e),{date:LD(RD(i.date,t),RD(e.date||{},t)),time:LD(RD(i.time,t),RD(e.time||{},t))})}JL((function(){for(var e,t=[],i=0;i<arguments.length;i++)t[i]=arguments[i];return new((e=Intl.NumberFormat).bind.apply(e,QL([void 0],t,!1)))}),{strategy:cN.variadic}),JL((function(){for(var e,t=[],i=0;i<arguments.length;i++)t[i]=arguments[i];return new((e=Intl.DateTimeFormat).bind.apply(e,QL([void 0],t,!1)))}),{strategy:cN.variadic}),JL((function(){for(var e,t=[],i=0;i<arguments.length;i++)t[i]=arguments[i];return new((e=Intl.PluralRules).bind.apply(e,QL([void 0],t,!1)))}),{strategy:cN.variadic}),JL((function(){for(var e,t=[],i=0;i<arguments.length;i++)t[i]=arguments[i];return new((e=Intl.Locale).bind.apply(e,QL([void 0],t,!1)))}),{strategy:cN.variadic}),JL((function(){for(var e,t=[],i=0;i<arguments.length;i++)t[i]=arguments[i];return new((e=Intl.ListFormat).bind.apply(e,QL([void 0],t,!1)))}),{strategy:cN.variadic});var DD=function(e,t,i,s,r){var n=e.locale,o=e.formats,a=e.messages,c=e.defaultLocale,l=e.defaultFormats,d=e.fallbackOnEmptyString,u=e.onError,h=e.timeZone,p=e.defaultRichTextElements;void 0===i&&(i={id:""});var _=i.id,m=i.defaultMessage;!function(e,t,i){if(void 0===i&&(i=Error),!e)throw new i("[@formatjs/intl] An `id` must be provided to format a message. You can either:\n1. Configure your build toolchain with [babel-plugin-formatjs](https://formatjs.io/docs/tooling/babel-plugin)\nor [@formatjs/ts-transformer](https://formatjs.io/docs/tooling/ts-transformer) OR\n2. Configure your `eslint` config to include [eslint-plugin-formatjs](https://formatjs.io/docs/tooling/linter#enforce-id)\nto autofix this issue")}(!!_);var f=String(_),g=a&&Object.prototype.hasOwnProperty.call(a,f)&&a[f];if(Array.isArray(g)&&1===g.length&&g[0].type===nN.literal)return g[0].value;if(!s&&g&&"string"==typeof g&&!p)return g.replace(/'\{(.*?)\}'/gi,"{$1}");if(s=YL(YL({},p),s||{}),o=ND(o,h),l=ND(l,h),!g){if(!1===d&&""===g)return g;if((!m||n&&n.toLowerCase()!==c.toLowerCase())&&u(new SD(i,n)),m)try{return t.getMessageFormat(m,c,l,r).format(s)}catch(e){return u(new TD('Error formatting default message for: "'.concat(f,'", rendering default message verbatim'),n,i,e)),"string"==typeof m?m:f}return f}try{return t.getMessageFormat(g,n,o,YL({formatters:t},r||{})).format(s)}catch(e){u(new TD('Error formatting message: "'.concat(f,'", using ').concat(m?"default message":"id"," as fallback."),n,i,e))}if(m)try{return t.getMessageFormat(m,c,l,r).format(s)}catch(e){u(new TD('Error formatting the default message for: "'.concat(f,'", rendering message verbatim'),n,i,e))}return"string"==typeof g?g:"string"==typeof m?m:f},MD=["formatMatcher","timeZone","hour12","weekday","era","year","month","day","hour","minute","second","timeZoneName","hourCycle","dateStyle","timeStyle","calendar","numberingSystem","fractionalSecondDigits"];function xD(e,t,i,s){var r=e.locale,n=e.formats,o=e.onError,a=e.timeZone;void 0===s&&(s={});var c=s.format,l=YL(YL({},a&&{timeZone:a}),c&&CD(n,t,c,o)),d=AD(s,MD,l);return"time"!==t||d.hour||d.minute||d.second||d.timeStyle||d.dateStyle||(d=YL(YL({},d),{hour:"numeric",minute:"numeric"})),i(r,d)}function kD(e,t){for(var i=[],s=2;s<arguments.length;s++)i[s-2]=arguments[s];var r=i[0],n=i[1],o=void 0===n?{}:n,a="string"==typeof r?new Date(r||0):r;try{return xD(e,"date",t,o).format(a)}catch(t){e.onError(new ED("Error formatting date.",e.locale,t))}return String(a)}function HD(e,t){for(var i=[],s=2;s<arguments.length;s++)i[s-2]=arguments[s];var r=i[0],n=i[1],o=void 0===n?{}:n,a="string"==typeof r?new Date(r||0):r;try{return xD(e,"time",t,o).format(a)}catch(t){e.onError(new ED("Error formatting time.",e.locale,t))}return String(a)}function jD(e,t){for(var i=[],s=2;s<arguments.length;s++)i[s-2]=arguments[s];var r=i[0],n=i[1],o=i[2],a=void 0===o?{}:o,c=e.timeZone,l=e.locale,d=e.onError,u=AD(a,MD,c?{timeZone:c}:{});try{return t(l,u).formatRange(r,n)}catch(t){d(new ED("Error formatting date time range.",e.locale,t))}return String(r)}function UD(e,t){for(var i=[],s=2;s<arguments.length;s++)i[s-2]=arguments[s];var r=i[0],n=i[1],o=void 0===n?{}:n,a="string"==typeof r?new Date(r||0):r;try{return xD(e,"date",t,o).formatToParts(a)}catch(t){e.onError(new ED("Error formatting date.",e.locale,t))}return[]}function BD(e,t){for(var i=[],s=2;s<arguments.length;s++)i[s-2]=arguments[s];var r=i[0],n=i[1],o=void 0===n?{}:n,a="string"==typeof r?new Date(r||0):r;try{return xD(e,"time",t,o).formatToParts(a)}catch(t){e.onError(new ED("Error formatting time.",e.locale,t))}return[]}var FD=["style","type","fallback","languageDisplay"];function VD(e,t,i,s){var r=e.locale,n=e.onError;Intl.DisplayNames||n(new dD('Intl.DisplayNames is not available in this environment.\nTry polyfilling it using "@formatjs/intl-displaynames"\n',iD.MISSING_INTL_API));var o=AD(s,FD);try{return t(r,o).of(i)}catch(e){n(new ED("Error formatting display name.",r,e))}}var KD=["type","style"],GD=Date.now();function $D(e,t,i,s){void 0===s&&(s={});var r=WD(e,t,i,s).reduce((function(e,t){var i=t.value;return"string"!=typeof i?e.push(i):"string"==typeof e[e.length-1]?e[e.length-1]+=i:e.push(i),e}),[]);return 1===r.length?r[0]:0===r.length?"":r}function WD(e,t,i,s){var r=e.locale,n=e.onError;void 0===s&&(s={}),Intl.ListFormat||n(new dD('Intl.ListFormat is not available in this environment.\nTry polyfilling it using "@formatjs/intl-listformat"\n',iD.MISSING_INTL_API));var o=AD(s,KD);try{var a={},c=i.map((function(e,t){if("object"==typeof e){var i=function(e){return"".concat(GD,"_").concat(e,"_").concat(GD)}(t);return a[i]=e,i}return String(e)}));return t(r,o).formatToParts(c).map((function(e){return"literal"===e.type?e:YL(YL({},e),{value:a[e.value]||e.value})}))}catch(e){n(new ED("Error formatting list.",r,e))}return i}var zD=["type"];function qD(e,t,i,s){var r=e.locale,n=e.onError;void 0===s&&(s={}),Intl.PluralRules||n(new dD('Intl.PluralRules is not available in this environment.\nTry polyfilling it using "@formatjs/intl-pluralrules"\n',iD.MISSING_INTL_API));var o=AD(s,zD);try{return t(r,o).select(i)}catch(e){n(new ED("Error formatting plural.",r,e))}return"other"}var YD=["numeric","style"];function QD(e,t,i,s,r){void 0===r&&(r={}),s||(s="second"),Intl.RelativeTimeFormat||e.onError(new dD('Intl.RelativeTimeFormat is not available in this environment.\nTry polyfilling it using "@formatjs/intl-relativetimeformat"\n',iD.MISSING_INTL_API));try{return function(e,t,i){var s=e.locale,r=e.formats,n=e.onError;void 0===i&&(i={});var o=i.format,a=!!o&&CD(r,"relative",o,n)||{};return t(s,AD(i,YD,a))}(e,t,r).format(i,s)}catch(t){e.onError(new ED("Error formatting relative time.",e.locale,t))}return String(i)}var JD=["style","currency","unit","unitDisplay","useGrouping","minimumIntegerDigits","minimumFractionDigits","maximumFractionDigits","minimumSignificantDigits","maximumSignificantDigits","compactDisplay","currencyDisplay","currencySign","notation","signDisplay","unit","unitDisplay","numberingSystem","trailingZeroDisplay","roundingPriority","roundingIncrement","roundingMode"];function XD(e,t,i){var s=e.locale,r=e.formats,n=e.onError;void 0===i&&(i={});var o=i.format,a=o&&CD(r,"number",o,n)||{};return t(s,AD(i,JD,a))}function ZD(e,t,i,s){void 0===s&&(s={});try{return XD(e,t,s).format(i)}catch(t){e.onError(new ED("Error formatting number.",e.locale,t))}return String(i)}function eM(e,t,i,s){void 0===s&&(s={});try{return XD(e,t,s).formatToParts(i)}catch(t){e.onError(new ED("Error formatting number.",e.locale,t))}return[]}function tM(e,t){var i=function(e){void 0===e&&(e={dateTime:{},number:{},message:{},relativeTime:{},pluralRules:{},list:{},displayNames:{}});var t=Intl.RelativeTimeFormat,i=Intl.ListFormat,s=Intl.DisplayNames,r=JL((function(){for(var e,t=[],i=0;i<arguments.length;i++)t[i]=arguments[i];return new((e=Intl.DateTimeFormat).bind.apply(e,QL([void 0],t,!1)))}),{cache:wD(e.dateTime),strategy:cN.variadic}),n=JL((function(){for(var e,t=[],i=0;i<arguments.length;i++)t[i]=arguments[i];return new((e=Intl.NumberFormat).bind.apply(e,QL([void 0],t,!1)))}),{cache:wD(e.number),strategy:cN.variadic}),o=JL((function(){for(var e,t=[],i=0;i<arguments.length;i++)t[i]=arguments[i];return new((e=Intl.PluralRules).bind.apply(e,QL([void 0],t,!1)))}),{cache:wD(e.pluralRules),strategy:cN.variadic});return{getDateTimeFormat:r,getNumberFormat:n,getMessageFormat:JL((function(e,t,i,s){return new yD(e,t,i,YL({formatters:{getNumberFormat:n,getDateTimeFormat:r,getPluralRules:o}},s||{}))}),{cache:wD(e.message),strategy:cN.variadic}),getRelativeTimeFormat:JL((function(){for(var e=[],i=0;i<arguments.length;i++)e[i]=arguments[i];return new(t.bind.apply(t,QL([void 0],e,!1)))}),{cache:wD(e.relativeTime),strategy:cN.variadic}),getPluralRules:o,getListFormat:JL((function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return new(i.bind.apply(i,QL([void 0],e,!1)))}),{cache:wD(e.list),strategy:cN.variadic}),getDisplayNames:JL((function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return new(s.bind.apply(s,QL([void 0],e,!1)))}),{cache:wD(e.displayNames),strategy:cN.variadic})}}(t),s=YL(YL({},PD),e),r=s.locale,n=s.defaultLocale,o=s.onError;return r?!Intl.NumberFormat.supportedLocalesOf(r).length&&o?o(new ID('Missing locale data for locale: "'.concat(r,'" in Intl.NumberFormat. Using default locale: "').concat(n,'" as fallback. See https://formatjs.io/docs/react-intl#runtime-requirements for more details'))):!Intl.DateTimeFormat.supportedLocalesOf(r).length&&o&&o(new ID('Missing locale data for locale: "'.concat(r,'" in Intl.DateTimeFormat. Using default locale: "').concat(n,'" as fallback. See https://formatjs.io/docs/react-intl#runtime-requirements for more details'))):(o&&o(new bD('"locale" was not configured, using "'.concat(n,'" as fallback. See https://formatjs.io/docs/react-intl/api#intlshape for more details'))),s.locale=s.defaultLocale||"en"),function(e){var t;e.onWarn&&e.defaultRichTextElements&&"string"==typeof((t=e.messages||{})?t[Object.keys(t)[0]]:void 0)&&e.onWarn('[@formatjs/intl] "defaultRichTextElements" was specified but "message" was not pre-compiled. \nPlease consider using "@formatjs/cli" to pre-compile your messages for performance.\nFor more details see https://formatjs.io/docs/getting-started/message-distribution')}(s),YL(YL({},s),{formatters:i,formatNumber:ZD.bind(null,s,i.getNumberFormat),formatNumberToParts:eM.bind(null,s,i.getNumberFormat),formatRelativeTime:QD.bind(null,s,i.getRelativeTimeFormat),formatDate:kD.bind(null,s,i.getDateTimeFormat),formatDateToParts:UD.bind(null,s,i.getDateTimeFormat),formatTime:HD.bind(null,s,i.getDateTimeFormat),formatDateTimeRange:jD.bind(null,s,i.getDateTimeFormat),formatTimeToParts:BD.bind(null,s,i.getDateTimeFormat),formatPlural:qD.bind(null,s,i.getPluralRules),formatMessage:DD.bind(null,s,i),$t:DD.bind(null,s,i),formatList:$D.bind(null,s,i.getListFormat),formatListToParts:WD.bind(null,s,i.getListFormat),formatDisplayName:VD.bind(null,s,i.getDisplayNames)})}const iM="en-US",sM={"cs-CZ":()=>Promise.resolve().then((function(){return wM})),"da-DK":()=>Promise.resolve().then((function(){return GM})),"de-DE":()=>Promise.resolve().then((function(){return ox})),"en-US":()=>Promise.resolve().then((function(){return Ix})),"es-ES":()=>Promise.resolve().then((function(){return jx})),"fi-FI":()=>Promise.resolve().then((function(){return ek})),"fr-CA":()=>Promise.resolve().then((function(){return fk})),"fr-FR":()=>Promise.resolve().then((function(){return Nk})),"fr-MA":()=>Promise.resolve().then((function(){return qk})),"hu-HU":()=>Promise.resolve().then((function(){return dH})),"it-IT":()=>Promise.resolve().then((function(){return AH})),"ja-JP":()=>Promise.resolve().then((function(){return VH})),"ko-KR":()=>Promise.resolve().then((function(){return sj})),"nb-NO":()=>Promise.resolve().then((function(){return vj})),"nl-NL":()=>Promise.resolve().then((function(){return xj})),"pl-PL":()=>Promise.resolve().then((function(){return Jj})),"pt-BR":()=>Promise.resolve().then((function(){return pU})),"ru-RU":()=>Promise.resolve().then((function(){return CU})),"sv-SE":()=>Promise.resolve().then((function(){return $U})),"tr-TR":()=>Promise.resolve().then((function(){return aB})),"uk-UA":()=>Promise.resolve().then((function(){return EB})),"zh-CN":()=>Promise.resolve().then((function(){return UB})),"zh-TW":()=>Promise.resolve().then((function(){return tF})),"zu-ZU":()=>Promise.resolve().then((function(){return gF})),"zz-ZZ":()=>Promise.resolve().then((function(){return DF}))};class rM{constructor(e=iM){this.setLocale(e)}get locale(){return this._locale}async setLocale(e){sM[e]||(nw.log(`[INTL] ${e} is not a supported language. Falling back to en-US`),e=iM);const{messages:t,locale:i}=await this._loadLocaleData(e);return this._intl=tM({locale:e,messages:t,defaultLocale:iM},{dateTime:{},number:{},message:{},relativeTime:{},pluralRules:{},list:{},displayNames:{}}),this._locale=i,e}_loadLocaleData(e){return sM[e]().then((t=>({messages:t,locale:e}))).catch((e=>this._loadLocaleData(iM)))}formatMessage(e,t){if(this._intl)return this._intl.formatMessage({id:e},t);nw.log("[INTL] no localization data loaded")}}class nM extends iw{constructor(e){super(),this._driver=e,this._fontsCache={}}async getFontData(e){const t=this._fontsCache[e];if(t)return t;const i=await this._driver.getFontData(e);return this._updateFontData(e,i),i}_updateFontData(e,t){this._fontsCache[e]=t}async isSystemFontAvailable(e,t){return await this._driver.isSystemFontAvailable(e,t)}_clearCache(){this._fontsCache={},this.emit("change")}}Ye([sL],nM.prototype,"getFontData",null),Ye([sL],nM.prototype,"isSystemFontAvailable",null);class oM extends iw{constructor(){super(...arguments),this._map=new Map}set(e,t){this._map.set(e,t),this.emit("change")}delete(e){this._map.delete(e),this.emit("change")}clear(){this._map.clear(),this.emit("change")}entries(){return this._map.entries()}get(e){return this._map.get(e)}}Ye([sL("change")],oM.prototype,"entries",null),Ye([sL("change")],oM.prototype,"get",null);class aM{constructor(e,t,i){}registerIndex(e){}updateIndices(e,t){}get(e){}getByIndex(e,t){}add(e,t=!0){return{}}remove(e,t=!0){}replace(e,t=!0){}upsert(...e){}all(){return[]}get length(){return 0}get driver(){}get changes(){return[]}on(e,t){}off(e,t){}}class cM extends Is{constructor(e,t,i={}){super()}async changeDriver(e){}initialLibrariesLoad(){}all(){return[]}async loadList(e){return[]}async loadPage(e,t){return[]}get isLoaded(){return!1}get isLoading(){return!1}get changes(){return[]}get syncStatus(){return{}}pause(e=!1){}resume(){}async waitForHydrate(){}get(e){return{syncStatus:{}}}getByIndex(e,t){return{syncStatus:{}}}doOperations(){}onSyncChange(e){}offSyncChange(e){}get DANGEROUS(){return{removeAllListeners:e=>{}}}add(e){return{}}upsert(e){return{}}hydrate(){}remove(e){}_halt(){}}"undefined"!=typeof window&&"undefined"==typeof global&&(window.global=window);const lM={enableBrandLifecycleManagement:!1,includeApprovedBrandsInLibraries:!1,elementTypes:["elements"],readOnly:!1,skipConnectingOnInit:!1};class dM extends iw{constructor(e,t,i,s={}){var r;super(),this._core=e,this.assetPool=t,this._missingResolutionTargetsMap=new oM,this._resolutionProgressMap=new Map,this._teamsCache=new aM(this,WL),this.elementUpdater=SL,this._handleDriverConnect=e=>e instanceof uR?this._handleCloudDriverConnect(e):e instanceof KR?this._handleLocalDriverConnect(e):void 0,this._handleDriverDisconnect=e=>{if(e instanceof KR)return this._handleLocalDriverDisconnect()},this.translate=(e,t)=>this._intl.formatMessage(e,t),globalThis.CCLIBS=null!==(r=globalThis.CCLIBS)&&void 0!==r?r:this,this._options=Object.assign(Object.assign({},lM),s),this._driver=i,this._options.mobXCreateAtom&&this._options.mobXTransaction&&tL.register(this._options.mobXCreateAtom,this._options.mobXTransaction),i instanceof uR?this._cloudDriver=i:this._options.cloudDriver instanceof uR&&(this._cloudDriver=this._options.cloudDriver),i instanceof KR&&(this._fontManager=new nM(i)),this.utils=Object.assign(Object.assign({},dM.utils),{copyFile:this.copyFile.bind(this),getInstalledVersion:this.getInstalledVersion.bind(this),getFileSize:this.getFileSize.bind(this),getRenditionGrid:this.getRenditionGrid.bind(this),extractElementId:hC,extractGroupId:_C}),this._elementPool=new Xo(this._core,"element"),this._teamsCache.on("change",(()=>this.emit("teamChange"))),this._missingResolutionTargetsMap.on("change",(()=>this.emit("resolutionStatusChange"))),this._driver.on("connect",this._handleDriverConnect),this._driver.on("disconnect",this._handleDriverDisconnect),this._bindDriverEvents(),this._intl=new rM(this._options.locale),this._libraryCache=new cM(this,this._driver,{readOnly:this._options.readOnly,skipConnectingOnInit:this._options.skipConnectingOnInit,fileSystemCache:this._options.fileSystemCache,enableBrandLifecycleManagement:this._options.enableBrandLifecycleManagement,includeApprovedBrandsInLibraries:this._options.includeApprovedBrandsInLibraries}),this._bindLibraryCacheEvents(),nw.setEventEmitter(this._core)}get elementPool(){return this._elementPool}getLibraryContents(e){return new GL(this._core,this,e)}async changeDriver(e){let t;await this._libraryCache.changeDriver(e),this._driver=e,this._driver instanceof KR&&(this._fontManager=new nM(this._driver)),this._driver.on("connect",this._handleDriverConnect),this._driver.on("disconnect",this._handleDriverDisconnect),this._bindDriverEvents();const i=new Promise((e=>t=e));return this._driver.once("connect",(()=>t())),i}_handleCloudDriverConnect(e){if(this.driver instanceof GR||this._options.disableLocalFallthrough)return this.emit("change"),void this.emit("driverConnect");e.getLocalDriver().init({retryCount:3,skipConnectingOnInit:this._options.skipConnectingOnInit},(e=>{this._libraryCache.pause(!0),this._libraryCache.DANGEROUS.removeAllListeners(),this._driver.DANGEROUS.removeAllListeners(),this._libraryCache=new cM(this,e,{readOnly:this._options.readOnly,skipConnectingOnInit:this._options.skipConnectingOnInit}),this._bindLibraryCacheEvents(),this._driver=e,this._bindDriverEvents(),this.emit("change")}))}_handleLocalDriverConnect(e){var t;e.updateRenditionCacheConfiguration(this.options.renditionSizes,this.options.fullRenditionConfig);const i=null!==(t=this.cloudDriver)&&void 0!==t?t:e.getCloudDriver();null==i||i.init({readOnly:!0},(e=>{this._cloudDriver=e})),this.emit("driverConnect")}_handleLocalDriverDisconnect(){this.emit("driverDisconnect")}_bindDriverEvents(){this._driver.on("configChange",(()=>this.emit("configChange"))),this._driver.on("connecting",(()=>this.emit("connecting"))),this._driver.on("failedConnection",(()=>this.emit("failedConnection")))}_bindLibraryCacheEvents(){this._libraryCache.on("connect",(()=>this.emit("connect"))),this._libraryCache.on("loaded",(()=>this.emit("loaded"))),this._libraryCache.on("hydrate",(()=>this.emit("restore"))),this._libraryCache.on("sync",(()=>this.emit("sync"))),this._libraryCache.on("report",((...e)=>this.emit("report",...e))),this._libraryCache.on("change",this._libraryCacheChangeHandler.bind(this)),this._libraryCache.on("modelChange",this._libraryCacheChangeHandler.bind(this)),this._libraryCache.on("fontDataChange",(()=>{var e;return null===(e=this.fontManager)||void 0===e?void 0:e._clearCache()}))}_libraryCacheChangeHandler(){this.emit("change",{libraries:this._libraryCache.changes})}makeObservable(e,t){return tL.register(e,t)}get apiRoot(){return this}get apiVersion(){return 2}get options(){return this._options}updateOptions(e){this._options=e}get driver(){return this._driver}get cloudDriver(){return this._cloudDriver}get libraries(){return this._libraryCache.initialLibrariesLoad(),this._libraryCache.all().filter((e=>!e.isDeletedLocally&&function(e,t){var i,s;if(!e||function(e){var t;return!!(null===(t=e.roles)||void 0===t?void 0:t.some((e=>"cm_training_set"===e.type)))}(e))return!1;const r="incoming"===e.ownership,n="private"===e.ownership||"outgoing"===e.ownership,o=t?r:n,a=!!(null===(i=e.bookmark)||void 0===i?void 0:i.id),c=!!(null===(s=e.roles)||void 0===s?void 0:s.find((e=>"approvedbrand"===e.type)));return o||a||c}(e.data,this._options.enableBrandLifecycleManagement)))}async getLibraries(e){return this._libraryCache.loadList(e)}async getLibrariesPage(e,t){return this._libraryCache.loadPage(e,t)}get connected(){return Boolean(this.driver.isConnected)}get areLibrariesLoaded(){var e;return Boolean(null===(e=this._libraryCache)||void 0===e?void 0:e.isLoaded)}get areLibrariesLoading(){var e;return null===(e=this._libraryCache)||void 0===e?void 0:e.isLoading}get userQuota(){var e;return null===(e=this.driver.config.user)||void 0===e?void 0:e.quota}get processInfo(){return Object.assign(Object.assign({},this.driver.config.processInfo),{environment:this.driver.config.environment})}get storageUsed(){return this.libraries.reduce(((e,t)=>"private"===t.ownership?e+t.storageUsed:e),0)}async _refreshTeams(){var e;try{const t=((null===(e=this._options.featureFlags)||void 0===e?void 0:e.enableProjects)?this._driver.getProjects:this._driver.getTeams).bind(this._driver),i=await t();this._teamsCache.replace(i)}catch(e){if(e.name!==FP)throw e}return this._teamsCache.all()}async refreshTeams(){return"staging"===this.driver.config.environment&&nw.warn("CCLibraries.refreshTeams is deprecated. Use CCLibraries.refreshProjects instead."),this._refreshTeams()}async refreshProjects(){return this._refreshTeams()}get teams(){return"staging"===this.driver.config.environment&&nw.warn("CCLibraries.teams is deprecated. Use CCLibraries.projects instead."),this._teamsCache.all()}get projects(){return this._teamsCache.all()}get userId(){var e,t,i;return null===(i=null===(t=null===(e=this._driver)||void 0===e?void 0:e.config)||void 0===t?void 0:t.user)||void 0===i?void 0:i.id}createLibrary(e,t={}){var i;const s=this._libraryCache.add(qP({id:$P(),name:e,documentExtractionData:t.documentExtractionData,roles:t.roles,team:null===(i=t.team)||void 0===i?void 0:i.data,bookmark:t.team?{id:$P()}:void 0}));return s.actionDispatch({name:"createLibrary",type:"no-op",data:s.data,flags:{lockNewLibraries:!0,permissionInheritance:t.permissionInheritance}}),s}removeLibrary(e){e.actionDispatch({name:"removeLibrary",type:"no-op",path:"$"}),e.isDeletedLocally=!0}permanentlyDeleteLibrary(e){e.actionDispatch({name:"permanentlyDeleteLibrary",type:"no-op",path:"$"}),e.isDeletedLocally=!0}leaveLibrary(e){e.actionDispatch({name:"leaveLibrary",type:"no-op",path:"$"}),e.isDeletedLocally=!0}followLibrary(e,t){return this._driver.followLibrary(e,t)}unfollowLibrary(e){e.actionDispatch({name:"unfollowLibrary",type:"no-op",path:"$"}),e.isDeletedLocally=!0}importLibrary(e,t=(()=>{})){return this._driver.importLibrary(e,((e,i)=>{if(e)return t(e);this._libraryCache.upsert(i);const s=this._libraryCache.get(null==i?void 0:i.id);t(void 0,s)}))}exportLibrary(e,t,i=(()=>{})){return this._driver.exportLibrary(e,t,i)}getLibraryById(e){return this._libraryCache.get(e)}getLibraryByAssetId(e){return this._libraryCache.getByIndex("assetId",e)}copyLibrary(e,t={}){var i,s,r;const n=this._libraryCache.add(qP({id:$P(),name:null!==(i=t.newName)&&void 0!==i?i:e.name,roles:e.roles,team:null===(s=t.team)||void 0===s?void 0:s.data,bookmark:t.team?{id:$P()}:void 0}));return n.actionDispatch({name:"copyLibrary",type:"no-op",data:{name:t.newName,team:null===(r=t.team)||void 0===r?void 0:r.data,documentExtractionData:t.documentExtractionData},flags:{lockNewLibraries:!0,permissionInheritance:t.permissionInheritance,source:e,includeAppMetadata:t.includeAppMetadata}}),n}moveLibrary(e,t){e.actionDispatch({name:"moveLibrary",type:"update",data:{team:{id:t.id,name:t.name},bookmark:{id:$P()},ownership:"incoming",ownerType:"org",owner:t.owner.id}})}getHybridSearchResults(e,t,i){const s=function(s){return Xe(this,arguments,(function*(){var r,n,o,a;const c=new RegExp(e,"ig"),l=this.libraries.filter((e=>(null==t?void 0:t.library_id)===e.id||!(null==t?void 0:t.library_id))).reduce(((e,t)=>{const i=t.elements.filter((e=>c.test(e.name)));return e.push(...i),e}),[]);yield yield Je(l);const d=l.map((e=>e.id));if(null==t?void 0:t.library_id){const e=this.getLibraryById(t.library_id);t=Object.assign(Object.assign({},t),{library_id:null==e?void 0:e.assetId})}try{for(var u,h=!0,p=et(this.driver.getSearchResults(e,t,i,s));!(r=(u=yield Je(p.next())).done);){a=u.value,h=!1;try{const e=a;yield yield Je(e.map((e=>{if(d.includes(e.id))return;if(!this.getLibraryByAssetId(e.libraryAssetId))return;const t=new EL(this._core,IL(e));return t._update(e),t})).filter(Boolean))}finally{h=!0}}}catch(e){n={error:e}}finally{try{h||r||!(o=p.return)||(yield Je(o.call(p)))}finally{if(n)throw n.error}}}))}.bind(this);return this._searchLoader=new eL(s),this._searchLoader}getSearchResults(e,t,i){this.abortSearch();const s=(t=t||{})&&t.library_id;if(this._driver instanceof GR)return this.getHybridSearchResults(e,t,i);const r=function(r){return Xe(this,arguments,(function*(){var n,o,a,c;const l=new Map,d=[];try{for(var u,h=!0,p=et(this._driver.getSearchResults(e,t,i,r));!(n=(u=yield Je(p.next())).done);){c=u.value,h=!1;try{const e=c;yield Je(e.forEach((e=>{const t=e.libraryId||s;let i=this.getLibraryById(t);if(i&&i.areElementsLoaded)return e;i||(i=this._libraryCache.add(qP({id:t,name:t,areElementsLoaded:!1,isLibraryLoaded:!1})),d.push(t)),d.includes(t)||(i.abortLoadElements(),i.clearElements(!1),d.push(t));const r=l.get(i)||[];return r.push(e),l.set(i,r),e})));for(const[e,t]of l)yield Je(e.loadGivenElements(t,!1,!1));l.clear(),yield yield Je(e.map((e=>{const t=e.libraryId||s;if(!t)return;const i=this.getLibraryById(t);return null==i?void 0:i.getElementById(e.id)})))}finally{h=!0}}}catch(e){o={error:e}}finally{try{h||n||!(a=p.return)||(yield Je(a.call(p)))}finally{if(o)throw o.error}}}))}.bind(this);return this._searchLoader=new eL(r),this._searchLoader}abortSearch(){this._searchLoader&&this._searchLoader.abort()}copyFile(e,t,i){return this.driver.copyFile(e,t,i)}getInstalledVersion(e){return this.driver.getInstalledVersion(e)}getFileSize(e){return this.driver.getFileSize(e)}getRenditionGrid(e){return this.driver.getRenditionGrid(e)}getOption(e){var t,i,s;const r=function(e){if(!function(e){return/^[A-Z_]*$/.test(e)}(e))throw new aw("String must be upper snake case to convert");return e.toLowerCase().replace(/_([a-z])/g,((e,t)=>t.toUpperCase()))}(e);return(null===(s=null===(i=null===(t=this._driver)||void 0===t?void 0:t.config)||void 0===i?void 0:i.processInfo)||void 0===s?void 0:s[r])||xP[e]}async setLocalSetting(e,t){try{JSON.stringify(t)}catch(e){throw new tw("INVALID_PARAMETER","Value must be serializable to JSON")}await this._driver.setLocalSetting(e,t)}getLocalSetting(e){return this._driver.getLocalSetting(e)}getLocale(){return this._intl.locale}setLocale(e){return this._intl.setLocale(e)}isConnected(){return Boolean(this.driver.isConnected)}get connectionState(){return this.driver.connectionState}reconnect(){var e;this.isConnected()||null===(e=this._driver)||void 0===e||e.connect()}disconnect(){var e;null===(e=this._driver)||void 0===e||e.disconnect()}isSyncingEnabled(){var e;return null===(e=this._driver.config.processInfo)||void 0===e?void 0:e.syncingEnabled}enableSyncing(){return this._libraryCache.resume(),this._setSyncEnabledConfig(!0)}async disableSyncing(e=!1){await this._setSyncEnabledConfig(!1),this._libraryCache.pause(e)}async _setSyncEnabledConfig(e){return this.setLocalSetting("processInfo",Object.assign(Object.assign({},this._driver.config.processInfo),{syncingEnabled:e}))}async _resolveLibrary(e){const t=`library#${e}`;if(!this._resolutionProgressMap.has(t)){const i=this.driver.getLibraryById(e).then((e=>(this._libraryCache.upsert(e),this._libraryCache.get(e.id)))).catch((e=>{if("NOT_FOUND"!==e.requestErrorCode)throw nw.log(String(e)),e})).finally((()=>{this._resolutionProgressMap.delete(t)}));this._resolutionProgressMap.set(t,i)}return this._resolutionProgressMap.get(t)}async _resolveElementById(e,t,i=!1){if(!e)return;const s=e.getElementById(t,!i);if(s)return s;try{const s=await this.driver.getElement(e,t);return e.loadGivenElements([s],!1,!0),e.getElementById(t,!i)}catch(e){if("NOT_FOUND"!==e.requestErrorCode)throw nw.log(String(e)),e;return}}async resolveLibraryById(e){await this._libraryCache.waitForHydrate();return this.getLibraryById(e)||this._resolveLibrary(e)}async resolveLibraryByAssetId(e){await this._libraryCache.waitForHydrate();return this.getLibraryByAssetId(e)||this._resolveLibrary(e)}async resolveLibraryWithoutCache(e){return this._resolveLibrary(e)}resolveCachedLibraryReference(e){if(!e)return;const{libraryId:t}=ZP(e);if(!t)return;return this.getLibraryById(t)||this._getLinkReferenceStatus(e)}async resolveLibraryReference(e){if(!e)return;const{libraryAssetId:t,libraryId:i}=ZP(e);return t||i?this.isLocallyManaged?this.resolveLibraryById(i):this.resolveLibraryByAssetId(t):void 0}async resolveElementReference(e,t=!1){if(!e)return;const{elementId:i}=ZP(e);if(!i)return;const s=await this.resolveElementReferenceToLibrary(e);return s?this._resolveElementById(s,i,t):void 0}resolveCachedElementReference(e,t=!1){if(!e)return;const{libraryId:i,elementId:s}=ZP(e);if(!i||!s)return;const r=this.getLibraryById(i);return(null==r?void 0:r.getElementById(s,!t))||this._getLinkReferenceStatus(e,!0,t)}async resolveElementReferenceToLibrary(e){if(!e)return;const{libraryAssetId:t,libraryId:i}=ZP(e);return t||i?this.isLocallyManaged?this.resolveLibraryById(i):this.resolveLibraryByAssetId(t):void 0}resolveCachedElementReferenceToLibrary(e){return this.resolveCachedLibraryReference(e)}_getLinkReferenceStatus(e,t=!1,i=!1){const s=t?"element":"library",r=i&&"removed",n=`${QP(e)}#${s}#${r}`;if(this._missingResolutionTargetsMap.get(n))return null;this._resolveElementReferenceAndNotify(e,n,t,i)}_resolveElementReferenceAndNotify(e,t,i=!1,s=!1){if(!this._resolutionProgressMap.has(t)){const r=(i?this.resolveElementReference.bind(this):this.resolveElementReferenceToLibrary.bind(this))(e,s).then((e=>{this._missingResolutionTargetsMap.set(t,!e)})).finally((()=>{this._resolutionProgressMap.delete(t)}));this._resolutionProgressMap.set(t,r)}return this._resolutionProgressMap.get(t)}openInCCD(e){return this._driver.openInCCD(e)}get canAccessLocalProcess(){return this._driver instanceof KR}getAccessToken(e,t,i,s){return this._driver.fetchAccessToken(e,t,i,s)}getLibraryByToolkitId(e){let[t]=this.libraries.filter((t=>t.toolkitId===e)).sort(((e,t)=>e.created-t.created));if(!t){const i=this.translate(DP[e]);t=this.createLibrary(i),t.toolkitId=e}return t}getDefaultLibrary(){const e=this.getLocalSetting("defaultLibrary");if(e){const{id:t,assetId:i}=e,s=this.resolveCachedElementReferenceToLibrary({"repo:assetId":i,"stRef:documentID":t,"stRef:fromPart":""});if(void 0===s||(null==s?void 0:s.isWritable))return s}return this._options.disableFallbackDefaultLibrary?null:this.libraries.reduce(((e,t)=>{const i=!e||(e.created||0)>(t.created||0);return"private"===t.ownership&&i?t:e}),null)}setDefaultLibrary(e){if(e&&!e.isWritable)throw new tw("INVALID_PARAMETER","Read-only libraries cannot be set as default");this.setLocalSetting("defaultLibrary",{id:null==e?void 0:e.id,assetId:null==e?void 0:e.assetId}),this._setDefaultLibraryMonitor()}_setDefaultLibraryMonitor(){var e;null===(e=this._disposeDefaultLibraryMonitor)||void 0===e||e.call(this);const t=this.getDefaultLibrary();if(t){const{id:e,assetId:i}=t,s=()=>{t.id===e&&t.assetId===i||this.setDefaultLibrary(t)};this._disposeDefaultLibraryMonitor=()=>t.off("change",s),t.on("change",s)}}get syncState(){return this._libraryCache.syncStatus}get retryTime(){}getTempDir(e){return this.driver.getTempDir(e)}get fontManager(){return this._fontManager}get isLocallyManaged(){return this.driver instanceof KR}publishBrand(e){return this._driver.publishBrand(e)}unpublishBrand(e){return this._driver.unpublishBrand(e)}}dM.errors=tw,dM.utils={getExtensions:SP,getMimeTypes:AP},Ye([sL],dM.prototype,"options",null),Ye([sL],dM.prototype,"libraries",null),Ye([sL],dM.prototype,"getLibraries",null),Ye([sL],dM.prototype,"getLibrariesPage",null),Ye([sL("driverConnect","driverDisconnect","loaded")],dM.prototype,"connected",null),Ye([sL("loaded")],dM.prototype,"areLibrariesLoaded",null),Ye([sL("loaded","sync")],dM.prototype,"areLibrariesLoading",null),Ye([sL("configChange")],dM.prototype,"userQuota",null),Ye([aL,sL("configChange")],dM.prototype,"processInfo",null),Ye([sL],dM.prototype,"storageUsed",null),Ye([sL("teamChange")],dM.prototype,"refreshTeams",null),Ye([sL("teamChange")],dM.prototype,"refreshProjects",null),Ye([sL("teamChange")],dM.prototype,"teams",null),Ye([sL("teamChange")],dM.prototype,"projects",null),Ye([sL("configChange")],dM.prototype,"userId",null),Ye([sL("configChange")],dM.prototype,"getOption",null),Ye([sL("configChange")],dM.prototype,"getLocalSetting",null),Ye([sL("driverConnect","driverDisconnect","loaded")],dM.prototype,"isConnected",null),Ye([sL("driverConnect","driverDisconnect","loaded","connecting","failedConnection")],dM.prototype,"connectionState",null),Ye([sL("configChange")],dM.prototype,"isSyncingEnabled",null),Ye([sL("change","resolutionStatusChange")],dM.prototype,"resolveCachedLibraryReference",null),Ye([sL("change","resolutionStatusChange")],dM.prototype,"resolveCachedElementReference",null),Ye([sL("change","resolutionStatusChange")],dM.prototype,"resolveCachedElementReferenceToLibrary",null),Ye([sL("sync")],dM.prototype,"syncState",null),Ye([aL],dM.prototype,"fontManager",null),Ye([oL],dM.prototype,"publishBrand",null),Ye([oL],dM.prototype,"unpublishBrand",null);const uM={mimeTypeToExtensions:SP,extensionToMimeTypes:AP,canComputeRenditionFromMimeType:PP,getSNISettings:()=>({TLS_DISCOVERY_PORT_RANGE:LP}),isPlaceholderId:WP,parseLinkReference:XP,serializeLinkReference:QP,estimateUploadTime:function(e){const{standard:t,asimov:i}=e.reduce(((e,t)=>(t.size>NP?e.asimov.push(t):e.standard.push(t),e)),{standard:[],asimov:[]});return Math.max(ew(t),ew(i.map((e=>{const{size:t}=e,i=Math.floor(t/NP),s=t%NP,r=i+(s?1:0);return Array.from({length:r},((e,t)=>({size:t===r-1?s:NP})))})).flat()))}};var hM=Object.freeze({__proto__:null,utils:uM,LocalDriver:KR,CloudDriver:uR,HybridDriver:GR,cepConnector:(e,t,i=8e3)=>{const s=new QR(e,t,i);return e=>s.connect(e)},ccdConnector:(e,t,i=8e3)=>{const s=new JR(e,t,i);return e=>s.connect(e)},nodeConnector:(e,t,i=8e3)=>{const s=new XR(e,t,i);return e=>s.connect(e)},uxpConnector:(e,t=8e3)=>{const i=new ZR(e,void 0,t);return e=>i.connect(e)},ProgressiveLoader:eL,Element:EL,LibraryContents:GL,Representation:uL,Group:$L,default:dM}),pM="Vaše sada nástrojů",_M="Vaše knihovna aplikace Photoshop",mM="Vaše vzorníky v aplikaci Photoshop",fM="Vaše štětce v aplikaci Photoshop",gM="Vaše přechody v aplikaci Photoshop",yM="Vaše vzory v aplikaci Photoshop",vM="Vaše styly v aplikaci Photoshop",OM="Vaše tvary v aplikaci Photoshop",bM="Vzorky barev předběžné verze aplikace Ps",IM="Štětce předběžné verze aplikace Ps",EM="Přechody předběžné verze aplikace Ps",TM="Vzory předběžné verze aplikace Ps",SM="Styly předběžné verze aplikace Ps",AM="Tvary předběžné verze aplikace Ps",PM={TOOLKIT_NAME_DEFAULT:pM,TOOLKIT_NAME_PHOTOSHOP:_M,TOOLKIT_NAME_PHOTOSHOP_SWATCHES:mM,TOOLKIT_NAME_PHOTOSHOP_BRUSHES:fM,TOOLKIT_NAME_PHOTOSHOP_GRADIENTS:gM,TOOLKIT_NAME_PHOTOSHOP_PATTERNS:yM,TOOLKIT_NAME_PHOTOSHOP_STYLES:vM,TOOLKIT_NAME_PHOTOSHOP_SHAPES:OM,TOOLKIT_NAME_PHOTOSHOP_SWATCHES_PR:bM,TOOLKIT_NAME_PHOTOSHOP_BRUSHES_PR:IM,TOOLKIT_NAME_PHOTOSHOP_GRADIENTS_PR:EM,TOOLKIT_NAME_PHOTOSHOP_PATTERNS_PR:TM,TOOLKIT_NAME_PHOTOSHOP_STYLES_PR:SM,TOOLKIT_NAME_PHOTOSHOP_SHAPES_PR:AM},wM=Object.freeze({__proto__:null,TOOLKIT_NAME_DEFAULT:pM,TOOLKIT_NAME_PHOTOSHOP:_M,TOOLKIT_NAME_PHOTOSHOP_SWATCHES:mM,TOOLKIT_NAME_PHOTOSHOP_BRUSHES:fM,TOOLKIT_NAME_PHOTOSHOP_GRADIENTS:gM,TOOLKIT_NAME_PHOTOSHOP_PATTERNS:yM,TOOLKIT_NAME_PHOTOSHOP_STYLES:vM,TOOLKIT_NAME_PHOTOSHOP_SHAPES:OM,TOOLKIT_NAME_PHOTOSHOP_SWATCHES_PR:bM,TOOLKIT_NAME_PHOTOSHOP_BRUSHES_PR:IM,TOOLKIT_NAME_PHOTOSHOP_GRADIENTS_PR:EM,TOOLKIT_NAME_PHOTOSHOP_PATTERNS_PR:TM,TOOLKIT_NAME_PHOTOSHOP_STYLES_PR:SM,TOOLKIT_NAME_PHOTOSHOP_SHAPES_PR:AM,default:PM}),CM="Din værktøjspakke",RM="Dit Photoshop-bibliotek",LM="Dine Photoshop-farveprøver",NM="Dine Photoshop-pensler",DM="Dine Photoshop-farveforløb",MM="Dine Photoshop-mønstre",xM="Dine Photoshop-typer",kM="Dine Photoshop-former",HM="Dine Ps Prerelease-farveprøver",jM="Dine Ps Prerelease-pensler",UM="Dine Ps Prerelease-farveforløb",BM="Dine Ps Prerelease-mønstre",FM="Dine Ps Prerelease-typer",VM="Dine Ps Prerelease-former",KM={TOOLKIT_NAME_DEFAULT:CM,TOOLKIT_NAME_PHOTOSHOP:RM,TOOLKIT_NAME_PHOTOSHOP_SWATCHES:LM,TOOLKIT_NAME_PHOTOSHOP_BRUSHES:NM,TOOLKIT_NAME_PHOTOSHOP_GRADIENTS:DM,TOOLKIT_NAME_PHOTOSHOP_PATTERNS:MM,TOOLKIT_NAME_PHOTOSHOP_STYLES:xM,TOOLKIT_NAME_PHOTOSHOP_SHAPES:kM,TOOLKIT_NAME_PHOTOSHOP_SWATCHES_PR:HM,TOOLKIT_NAME_PHOTOSHOP_BRUSHES_PR:jM,TOOLKIT_NAME_PHOTOSHOP_GRADIENTS_PR:UM,TOOLKIT_NAME_PHOTOSHOP_PATTERNS_PR:BM,TOOLKIT_NAME_PHOTOSHOP_STYLES_PR:FM,TOOLKIT_NAME_PHOTOSHOP_SHAPES_PR:VM},GM=Object.freeze({__proto__:null,TOOLKIT_NAME_DEFAULT:CM,TOOLKIT_NAME_PHOTOSHOP:RM,TOOLKIT_NAME_PHOTOSHOP_SWATCHES:LM,TOOLKIT_NAME_PHOTOSHOP_BRUSHES:NM,TOOLKIT_NAME_PHOTOSHOP_GRADIENTS:DM,TOOLKIT_NAME_PHOTOSHOP_PATTERNS:MM,TOOLKIT_NAME_PHOTOSHOP_STYLES:xM,TOOLKIT_NAME_PHOTOSHOP_SHAPES:kM,TOOLKIT_NAME_PHOTOSHOP_SWATCHES_PR:HM,TOOLKIT_NAME_PHOTOSHOP_BRUSHES_PR:jM,TOOLKIT_NAME_PHOTOSHOP_GRADIENTS_PR:UM,TOOLKIT_NAME_PHOTOSHOP_PATTERNS_PR:BM,TOOLKIT_NAME_PHOTOSHOP_STYLES_PR:FM,TOOLKIT_NAME_PHOTOSHOP_SHAPES_PR:VM,default:KM}),$M="Ihr Toolkit",WM="Ihre Photoshop-Bibliothek",zM="Ihre Photoshop-Farbfelder",qM="Ihre Photoshop-Pinsel",YM="Ihre Photoshop-Verläufe",QM="Ihre Photoshop-Muster",JM="Ihre Photoshop-Stile",XM="Ihre Photoshop-Formen",ZM="Ihre Ps Prerelease-Farbfelder",ex="Ihre Ps Prerelease-Pinsel",tx="Ihre Ps Prerelease-Verläufe",ix="Ihre Ps Prerelease-Muster",sx="Ihre Ps Prerelease-Stile",rx="Ihre Ps Prerelease-Formen",nx={TOOLKIT_NAME_DEFAULT:$M,TOOLKIT_NAME_PHOTOSHOP:WM,TOOLKIT_NAME_PHOTOSHOP_SWATCHES:zM,TOOLKIT_NAME_PHOTOSHOP_BRUSHES:qM,TOOLKIT_NAME_PHOTOSHOP_GRADIENTS:YM,TOOLKIT_NAME_PHOTOSHOP_PATTERNS:QM,TOOLKIT_NAME_PHOTOSHOP_STYLES:JM,TOOLKIT_NAME_PHOTOSHOP_SHAPES:XM,TOOLKIT_NAME_PHOTOSHOP_SWATCHES_PR:ZM,TOOLKIT_NAME_PHOTOSHOP_BRUSHES_PR:ex,TOOLKIT_NAME_PHOTOSHOP_GRADIENTS_PR:tx,TOOLKIT_NAME_PHOTOSHOP_PATTERNS_PR:ix,TOOLKIT_NAME_PHOTOSHOP_STYLES_PR:sx,TOOLKIT_NAME_PHOTOSHOP_SHAPES_PR:rx},ox=Object.freeze({__proto__:null,TOOLKIT_NAME_DEFAULT:$M,TOOLKIT_NAME_PHOTOSHOP:WM,TOOLKIT_NAME_PHOTOSHOP_SWATCHES:zM,TOOLKIT_NAME_PHOTOSHOP_BRUSHES:qM,TOOLKIT_NAME_PHOTOSHOP_GRADIENTS:YM,TOOLKIT_NAME_PHOTOSHOP_PATTERNS:QM,TOOLKIT_NAME_PHOTOSHOP_STYLES:JM,TOOLKIT_NAME_PHOTOSHOP_SHAPES:XM,TOOLKIT_NAME_PHOTOSHOP_SWATCHES_PR:ZM,TOOLKIT_NAME_PHOTOSHOP_BRUSHES_PR:ex,TOOLKIT_NAME_PHOTOSHOP_GRADIENTS_PR:tx,TOOLKIT_NAME_PHOTOSHOP_PATTERNS_PR:ix,TOOLKIT_NAME_PHOTOSHOP_STYLES_PR:sx,TOOLKIT_NAME_PHOTOSHOP_SHAPES_PR:rx,default:nx}),ax="Your Toolkit",cx="Your Photoshop Library",lx="Your Photoshop Swatches",dx="Your Photoshop Brushes",ux="Your Photoshop Gradients",hx="Your Photoshop Patterns",px="Your Photoshop Styles",_x="Your Photoshop Shapes",mx="Your Ps Prerelease Swatches",fx="Your Ps Prerelease Brushes",gx="Your Ps Prerelease Gradients",yx="Your Ps Prerelease Patterns",vx="Your Ps Prerelease Styles",Ox="Your Ps Prerelease Shapes",bx={TOOLKIT_NAME_DEFAULT:ax,TOOLKIT_NAME_PHOTOSHOP:cx,TOOLKIT_NAME_PHOTOSHOP_SWATCHES:lx,TOOLKIT_NAME_PHOTOSHOP_BRUSHES:dx,TOOLKIT_NAME_PHOTOSHOP_GRADIENTS:ux,TOOLKIT_NAME_PHOTOSHOP_PATTERNS:hx,TOOLKIT_NAME_PHOTOSHOP_STYLES:px,TOOLKIT_NAME_PHOTOSHOP_SHAPES:_x,TOOLKIT_NAME_PHOTOSHOP_SWATCHES_PR:mx,TOOLKIT_NAME_PHOTOSHOP_BRUSHES_PR:fx,TOOLKIT_NAME_PHOTOSHOP_GRADIENTS_PR:gx,TOOLKIT_NAME_PHOTOSHOP_PATTERNS_PR:yx,TOOLKIT_NAME_PHOTOSHOP_STYLES_PR:vx,TOOLKIT_NAME_PHOTOSHOP_SHAPES_PR:Ox},Ix=Object.freeze({__proto__:null,TOOLKIT_NAME_DEFAULT:ax,TOOLKIT_NAME_PHOTOSHOP:cx,TOOLKIT_NAME_PHOTOSHOP_SWATCHES:lx,TOOLKIT_NAME_PHOTOSHOP_BRUSHES:dx,TOOLKIT_NAME_PHOTOSHOP_GRADIENTS:ux,TOOLKIT_NAME_PHOTOSHOP_PATTERNS:hx,TOOLKIT_NAME_PHOTOSHOP_STYLES:px,TOOLKIT_NAME_PHOTOSHOP_SHAPES:_x,TOOLKIT_NAME_PHOTOSHOP_SWATCHES_PR:mx,TOOLKIT_NAME_PHOTOSHOP_BRUSHES_PR:fx,TOOLKIT_NAME_PHOTOSHOP_GRADIENTS_PR:gx,TOOLKIT_NAME_PHOTOSHOP_PATTERNS_PR:yx,TOOLKIT_NAME_PHOTOSHOP_STYLES_PR:vx,TOOLKIT_NAME_PHOTOSHOP_SHAPES_PR:Ox,default:bx}),Ex="Su kit de herramientas",Tx="Su biblioteca de Photoshop",Sx="Sus muestras de Photoshop",Ax="Sus pinceles de Photoshop",Px="Sus degradados de Photoshop",wx="Sus motivos de Photoshop",Cx="Sus estilos de Photoshop",Rx="Sus formas de Photoshop",Lx="Sus muestras de la versión previa de Ps",Nx="Sus pinceles de la versión previa de Ps",Dx="Sus degradados de la versión previa de Ps",Mx="Sus motivos de la versión previa de Ps",xx="Sus estilos de la versión previa de Ps",kx="Sus formas de la versión previa de Ps",Hx={TOOLKIT_NAME_DEFAULT:Ex,TOOLKIT_NAME_PHOTOSHOP:Tx,TOOLKIT_NAME_PHOTOSHOP_SWATCHES:Sx,TOOLKIT_NAME_PHOTOSHOP_BRUSHES:Ax,TOOLKIT_NAME_PHOTOSHOP_GRADIENTS:Px,TOOLKIT_NAME_PHOTOSHOP_PATTERNS:wx,TOOLKIT_NAME_PHOTOSHOP_STYLES:Cx,TOOLKIT_NAME_PHOTOSHOP_SHAPES:Rx,TOOLKIT_NAME_PHOTOSHOP_SWATCHES_PR:Lx,TOOLKIT_NAME_PHOTOSHOP_BRUSHES_PR:Nx,TOOLKIT_NAME_PHOTOSHOP_GRADIENTS_PR:Dx,TOOLKIT_NAME_PHOTOSHOP_PATTERNS_PR:Mx,TOOLKIT_NAME_PHOTOSHOP_STYLES_PR:xx,TOOLKIT_NAME_PHOTOSHOP_SHAPES_PR:kx},jx=Object.freeze({__proto__:null,TOOLKIT_NAME_DEFAULT:Ex,TOOLKIT_NAME_PHOTOSHOP:Tx,TOOLKIT_NAME_PHOTOSHOP_SWATCHES:Sx,TOOLKIT_NAME_PHOTOSHOP_BRUSHES:Ax,TOOLKIT_NAME_PHOTOSHOP_GRADIENTS:Px,TOOLKIT_NAME_PHOTOSHOP_PATTERNS:wx,TOOLKIT_NAME_PHOTOSHOP_STYLES:Cx,TOOLKIT_NAME_PHOTOSHOP_SHAPES:Rx,TOOLKIT_NAME_PHOTOSHOP_SWATCHES_PR:Lx,TOOLKIT_NAME_PHOTOSHOP_BRUSHES_PR:Nx,TOOLKIT_NAME_PHOTOSHOP_GRADIENTS_PR:Dx,TOOLKIT_NAME_PHOTOSHOP_PATTERNS_PR:Mx,TOOLKIT_NAME_PHOTOSHOP_STYLES_PR:xx,TOOLKIT_NAME_PHOTOSHOP_SHAPES_PR:kx,default:Hx}),Ux="Oma työkalusarja",Bx="Oma Photoshop-kirjasto",Fx="Omat Photoshop-värimallit",Vx="Omat Photoshop-siveltimet",Kx="Omat Photoshop-liukuvärit",Gx="Omat Photoshop-kuviot",$x="Omat Photoshop-tyylit",Wx="Omat Photoshop-muodot",zx="Omat Ps Prerelease -värimallit",qx="Omat Ps Prerelease -siveltimet",Yx="Omat Ps Prerelease -liukuvärit",Qx="Omat Ps Prerelease -kuviot",Jx="Omat Ps Prerelease -tyylit",Xx="Omat Ps Prerelease -muodot",Zx={TOOLKIT_NAME_DEFAULT:Ux,TOOLKIT_NAME_PHOTOSHOP:Bx,TOOLKIT_NAME_PHOTOSHOP_SWATCHES:Fx,TOOLKIT_NAME_PHOTOSHOP_BRUSHES:Vx,TOOLKIT_NAME_PHOTOSHOP_GRADIENTS:Kx,TOOLKIT_NAME_PHOTOSHOP_PATTERNS:Gx,TOOLKIT_NAME_PHOTOSHOP_STYLES:$x,TOOLKIT_NAME_PHOTOSHOP_SHAPES:Wx,TOOLKIT_NAME_PHOTOSHOP_SWATCHES_PR:zx,TOOLKIT_NAME_PHOTOSHOP_BRUSHES_PR:qx,TOOLKIT_NAME_PHOTOSHOP_GRADIENTS_PR:Yx,TOOLKIT_NAME_PHOTOSHOP_PATTERNS_PR:Qx,TOOLKIT_NAME_PHOTOSHOP_STYLES_PR:Jx,TOOLKIT_NAME_PHOTOSHOP_SHAPES_PR:Xx},ek=Object.freeze({__proto__:null,TOOLKIT_NAME_DEFAULT:Ux,TOOLKIT_NAME_PHOTOSHOP:Bx,TOOLKIT_NAME_PHOTOSHOP_SWATCHES:Fx,TOOLKIT_NAME_PHOTOSHOP_BRUSHES:Vx,TOOLKIT_NAME_PHOTOSHOP_GRADIENTS:Kx,TOOLKIT_NAME_PHOTOSHOP_PATTERNS:Gx,TOOLKIT_NAME_PHOTOSHOP_STYLES:$x,TOOLKIT_NAME_PHOTOSHOP_SHAPES:Wx,TOOLKIT_NAME_PHOTOSHOP_SWATCHES_PR:zx,TOOLKIT_NAME_PHOTOSHOP_BRUSHES_PR:qx,TOOLKIT_NAME_PHOTOSHOP_GRADIENTS_PR:Yx,TOOLKIT_NAME_PHOTOSHOP_PATTERNS_PR:Qx,TOOLKIT_NAME_PHOTOSHOP_STYLES_PR:Jx,TOOLKIT_NAME_PHOTOSHOP_SHAPES_PR:Xx,default:Zx}),tk="Votre boîte à outils",ik="Votre bibliothèque Photoshop",sk="Vos nuances Photoshop",rk="Vos pinceaux Photoshop",nk="Vos dégradés Photoshop",ok="Vos motifs Photoshop",ak="Vos styles Photoshop",ck="Vos formes Photoshop",lk="Vos nuances Version préliminaire Ps",dk="Vos pinceaux Version préliminaire Ps",uk="Vos dégradés Version préliminaire Ps",hk="Vos motifs Version préliminaire Ps",pk="Vos styles Version préliminaire Ps",_k="Vos formes Version préliminaire Ps",mk={TOOLKIT_NAME_DEFAULT:tk,TOOLKIT_NAME_PHOTOSHOP:ik,TOOLKIT_NAME_PHOTOSHOP_SWATCHES:sk,TOOLKIT_NAME_PHOTOSHOP_BRUSHES:rk,TOOLKIT_NAME_PHOTOSHOP_GRADIENTS:nk,TOOLKIT_NAME_PHOTOSHOP_PATTERNS:ok,TOOLKIT_NAME_PHOTOSHOP_STYLES:ak,TOOLKIT_NAME_PHOTOSHOP_SHAPES:ck,TOOLKIT_NAME_PHOTOSHOP_SWATCHES_PR:lk,TOOLKIT_NAME_PHOTOSHOP_BRUSHES_PR:dk,TOOLKIT_NAME_PHOTOSHOP_GRADIENTS_PR:uk,TOOLKIT_NAME_PHOTOSHOP_PATTERNS_PR:hk,TOOLKIT_NAME_PHOTOSHOP_STYLES_PR:pk,TOOLKIT_NAME_PHOTOSHOP_SHAPES_PR:_k},fk=Object.freeze({__proto__:null,TOOLKIT_NAME_DEFAULT:tk,TOOLKIT_NAME_PHOTOSHOP:ik,TOOLKIT_NAME_PHOTOSHOP_SWATCHES:sk,TOOLKIT_NAME_PHOTOSHOP_BRUSHES:rk,TOOLKIT_NAME_PHOTOSHOP_GRADIENTS:nk,TOOLKIT_NAME_PHOTOSHOP_PATTERNS:ok,TOOLKIT_NAME_PHOTOSHOP_STYLES:ak,TOOLKIT_NAME_PHOTOSHOP_SHAPES:ck,TOOLKIT_NAME_PHOTOSHOP_SWATCHES_PR:lk,TOOLKIT_NAME_PHOTOSHOP_BRUSHES_PR:dk,TOOLKIT_NAME_PHOTOSHOP_GRADIENTS_PR:uk,TOOLKIT_NAME_PHOTOSHOP_PATTERNS_PR:hk,TOOLKIT_NAME_PHOTOSHOP_STYLES_PR:pk,TOOLKIT_NAME_PHOTOSHOP_SHAPES_PR:_k,default:mk}),gk="Votre boîte à outils",yk="Votre bibliothèque Photoshop",vk="Vos nuances Photoshop",Ok="Vos pinceaux Photoshop",bk="Vos dégradés Photoshop",Ik="Vos motifs Photoshop",Ek="Vos styles Photoshop",Tk="Vos formes Photoshop",Sk="Vos nuances Version préliminaire Ps",Ak="Vos pinceaux Version préliminaire Ps",Pk="Vos dégradés Version préliminaire Ps",wk="Vos motifs Version préliminaire Ps",Ck="Vos styles Version préliminaire Ps",Rk="Vos formes Version préliminaire Ps",Lk={TOOLKIT_NAME_DEFAULT:gk,TOOLKIT_NAME_PHOTOSHOP:yk,TOOLKIT_NAME_PHOTOSHOP_SWATCHES:vk,TOOLKIT_NAME_PHOTOSHOP_BRUSHES:Ok,TOOLKIT_NAME_PHOTOSHOP_GRADIENTS:bk,TOOLKIT_NAME_PHOTOSHOP_PATTERNS:Ik,TOOLKIT_NAME_PHOTOSHOP_STYLES:Ek,TOOLKIT_NAME_PHOTOSHOP_SHAPES:Tk,TOOLKIT_NAME_PHOTOSHOP_SWATCHES_PR:Sk,TOOLKIT_NAME_PHOTOSHOP_BRUSHES_PR:Ak,TOOLKIT_NAME_PHOTOSHOP_GRADIENTS_PR:Pk,TOOLKIT_NAME_PHOTOSHOP_PATTERNS_PR:wk,TOOLKIT_NAME_PHOTOSHOP_STYLES_PR:Ck,TOOLKIT_NAME_PHOTOSHOP_SHAPES_PR:Rk},Nk=Object.freeze({__proto__:null,TOOLKIT_NAME_DEFAULT:gk,TOOLKIT_NAME_PHOTOSHOP:yk,TOOLKIT_NAME_PHOTOSHOP_SWATCHES:vk,TOOLKIT_NAME_PHOTOSHOP_BRUSHES:Ok,TOOLKIT_NAME_PHOTOSHOP_GRADIENTS:bk,TOOLKIT_NAME_PHOTOSHOP_PATTERNS:Ik,TOOLKIT_NAME_PHOTOSHOP_STYLES:Ek,TOOLKIT_NAME_PHOTOSHOP_SHAPES:Tk,TOOLKIT_NAME_PHOTOSHOP_SWATCHES_PR:Sk,TOOLKIT_NAME_PHOTOSHOP_BRUSHES_PR:Ak,TOOLKIT_NAME_PHOTOSHOP_GRADIENTS_PR:Pk,TOOLKIT_NAME_PHOTOSHOP_PATTERNS_PR:wk,TOOLKIT_NAME_PHOTOSHOP_STYLES_PR:Ck,TOOLKIT_NAME_PHOTOSHOP_SHAPES_PR:Rk,default:Lk}),Dk="Votre boîte à outils",Mk="Votre bibliothèque Photoshop",xk="Vos nuances Photoshop",kk="Vos pinceaux Photoshop",Hk="Vos dégradés Photoshop",jk="Vos motifs Photoshop",Uk="Vos styles Photoshop",Bk="Vos formes Photoshop",Fk="Vos nuances Version préliminaire Ps",Vk="Vos pinceaux Version préliminaire Ps",Kk="Vos dégradés Version préliminaire Ps",Gk="Vos motifs Version préliminaire Ps",$k="Vos styles Version préliminaire Ps",Wk="Vos formes Version préliminaire Ps",zk={TOOLKIT_NAME_DEFAULT:Dk,TOOLKIT_NAME_PHOTOSHOP:Mk,TOOLKIT_NAME_PHOTOSHOP_SWATCHES:xk,TOOLKIT_NAME_PHOTOSHOP_BRUSHES:kk,TOOLKIT_NAME_PHOTOSHOP_GRADIENTS:Hk,TOOLKIT_NAME_PHOTOSHOP_PATTERNS:jk,TOOLKIT_NAME_PHOTOSHOP_STYLES:Uk,TOOLKIT_NAME_PHOTOSHOP_SHAPES:Bk,TOOLKIT_NAME_PHOTOSHOP_SWATCHES_PR:Fk,TOOLKIT_NAME_PHOTOSHOP_BRUSHES_PR:Vk,TOOLKIT_NAME_PHOTOSHOP_GRADIENTS_PR:Kk,TOOLKIT_NAME_PHOTOSHOP_PATTERNS_PR:Gk,TOOLKIT_NAME_PHOTOSHOP_STYLES_PR:$k,TOOLKIT_NAME_PHOTOSHOP_SHAPES_PR:Wk},qk=Object.freeze({__proto__:null,TOOLKIT_NAME_DEFAULT:Dk,TOOLKIT_NAME_PHOTOSHOP:Mk,TOOLKIT_NAME_PHOTOSHOP_SWATCHES:xk,TOOLKIT_NAME_PHOTOSHOP_BRUSHES:kk,TOOLKIT_NAME_PHOTOSHOP_GRADIENTS:Hk,TOOLKIT_NAME_PHOTOSHOP_PATTERNS:jk,TOOLKIT_NAME_PHOTOSHOP_STYLES:Uk,TOOLKIT_NAME_PHOTOSHOP_SHAPES:Bk,TOOLKIT_NAME_PHOTOSHOP_SWATCHES_PR:Fk,TOOLKIT_NAME_PHOTOSHOP_BRUSHES_PR:Vk,TOOLKIT_NAME_PHOTOSHOP_GRADIENTS_PR:Kk,TOOLKIT_NAME_PHOTOSHOP_PATTERNS_PR:Gk,TOOLKIT_NAME_PHOTOSHOP_STYLES_PR:$k,TOOLKIT_NAME_PHOTOSHOP_SHAPES_PR:Wk,default:zk}),Yk="Az Ön eszköztára",Qk="Az Ön Photoshop könyvtára",Jk="Az Ön Photoshop színtárai",Xk="Az Ön Photoshop ecsetei",Zk="Az Ön Photoshop színátmenetei",eH="Az Ön Photoshop mintái",tH="Az Ön Photoshop stílusai",iH="Az Ön Photoshop alakzatai",sH="PS előzetes kiadás – színtárak",rH="PS előzetes kiadás – ecsetek",nH="PS előzetes kiadás – színátmenetek",oH="PS előzetes kiadás – minták",aH="PS előzetes kiadás – stílusok",cH="PS előzetes kiadás – alakzatok",lH={TOOLKIT_NAME_DEFAULT:Yk,TOOLKIT_NAME_PHOTOSHOP:Qk,TOOLKIT_NAME_PHOTOSHOP_SWATCHES:Jk,TOOLKIT_NAME_PHOTOSHOP_BRUSHES:Xk,TOOLKIT_NAME_PHOTOSHOP_GRADIENTS:Zk,TOOLKIT_NAME_PHOTOSHOP_PATTERNS:eH,TOOLKIT_NAME_PHOTOSHOP_STYLES:tH,TOOLKIT_NAME_PHOTOSHOP_SHAPES:iH,TOOLKIT_NAME_PHOTOSHOP_SWATCHES_PR:sH,TOOLKIT_NAME_PHOTOSHOP_BRUSHES_PR:rH,TOOLKIT_NAME_PHOTOSHOP_GRADIENTS_PR:nH,TOOLKIT_NAME_PHOTOSHOP_PATTERNS_PR:oH,TOOLKIT_NAME_PHOTOSHOP_STYLES_PR:aH,TOOLKIT_NAME_PHOTOSHOP_SHAPES_PR:cH},dH=Object.freeze({__proto__:null,TOOLKIT_NAME_DEFAULT:Yk,TOOLKIT_NAME_PHOTOSHOP:Qk,TOOLKIT_NAME_PHOTOSHOP_SWATCHES:Jk,TOOLKIT_NAME_PHOTOSHOP_BRUSHES:Xk,TOOLKIT_NAME_PHOTOSHOP_GRADIENTS:Zk,TOOLKIT_NAME_PHOTOSHOP_PATTERNS:eH,TOOLKIT_NAME_PHOTOSHOP_STYLES:tH,TOOLKIT_NAME_PHOTOSHOP_SHAPES:iH,TOOLKIT_NAME_PHOTOSHOP_SWATCHES_PR:sH,TOOLKIT_NAME_PHOTOSHOP_BRUSHES_PR:rH,TOOLKIT_NAME_PHOTOSHOP_GRADIENTS_PR:nH,TOOLKIT_NAME_PHOTOSHOP_PATTERNS_PR:oH,TOOLKIT_NAME_PHOTOSHOP_STYLES_PR:aH,TOOLKIT_NAME_PHOTOSHOP_SHAPES_PR:cH,default:lH}),uH="Il vostro toolkit",hH="La vostra Libreria Photoshop",pH="Campioni di Photoshop personali",_H="Pennelli di Photoshop personali",mH="Sfumature di Photoshop personali",fH="Pattern di Photoshop personali",gH="Stili di Photoshop personali",yH="Forme di Photoshop personali",vH="I campioni Ps Prerelease",OH="I pennelli Ps Prerelease",bH="Le sfumature Ps Prerelease",IH="I pattern Ps Prerelease",EH="Gli stili Ps Prerelease",TH="Le forme Ps Prerelease",SH={TOOLKIT_NAME_DEFAULT:uH,TOOLKIT_NAME_PHOTOSHOP:hH,TOOLKIT_NAME_PHOTOSHOP_SWATCHES:pH,TOOLKIT_NAME_PHOTOSHOP_BRUSHES:_H,TOOLKIT_NAME_PHOTOSHOP_GRADIENTS:mH,TOOLKIT_NAME_PHOTOSHOP_PATTERNS:fH,TOOLKIT_NAME_PHOTOSHOP_STYLES:gH,TOOLKIT_NAME_PHOTOSHOP_SHAPES:yH,TOOLKIT_NAME_PHOTOSHOP_SWATCHES_PR:vH,TOOLKIT_NAME_PHOTOSHOP_BRUSHES_PR:OH,TOOLKIT_NAME_PHOTOSHOP_GRADIENTS_PR:bH,TOOLKIT_NAME_PHOTOSHOP_PATTERNS_PR:IH,TOOLKIT_NAME_PHOTOSHOP_STYLES_PR:EH,TOOLKIT_NAME_PHOTOSHOP_SHAPES_PR:TH},AH=Object.freeze({__proto__:null,TOOLKIT_NAME_DEFAULT:uH,TOOLKIT_NAME_PHOTOSHOP:hH,TOOLKIT_NAME_PHOTOSHOP_SWATCHES:pH,TOOLKIT_NAME_PHOTOSHOP_BRUSHES:_H,TOOLKIT_NAME_PHOTOSHOP_GRADIENTS:mH,TOOLKIT_NAME_PHOTOSHOP_PATTERNS:fH,TOOLKIT_NAME_PHOTOSHOP_STYLES:gH,TOOLKIT_NAME_PHOTOSHOP_SHAPES:yH,TOOLKIT_NAME_PHOTOSHOP_SWATCHES_PR:vH,TOOLKIT_NAME_PHOTOSHOP_BRUSHES_PR:OH,TOOLKIT_NAME_PHOTOSHOP_GRADIENTS_PR:bH,TOOLKIT_NAME_PHOTOSHOP_PATTERNS_PR:IH,TOOLKIT_NAME_PHOTOSHOP_STYLES_PR:EH,TOOLKIT_NAME_PHOTOSHOP_SHAPES_PR:TH,default:SH}),PH="自分の Toolkit",wH="Photoshop ライブラリ",CH="あなたの Photoshop スウォッチ",RH="あなたの Photoshop ブラシ",LH="あなたの Photoshop グラデーション",NH="あなたの Photoshop パターン",DH="あなたの Photoshop スタイル",MH="あなたの Photoshop シェイプ",xH="Ps プレリリースのサンプル",kH="Ps プレリリースのブラシ",HH="Ps プレリリースのグラデーション",jH="Ps プレリリースのパターン",UH="Ps プレリリースのスタイル",BH="Ps プレリリースのシェイプ",FH={TOOLKIT_NAME_DEFAULT:PH,TOOLKIT_NAME_PHOTOSHOP:wH,TOOLKIT_NAME_PHOTOSHOP_SWATCHES:CH,TOOLKIT_NAME_PHOTOSHOP_BRUSHES:RH,TOOLKIT_NAME_PHOTOSHOP_GRADIENTS:LH,TOOLKIT_NAME_PHOTOSHOP_PATTERNS:NH,TOOLKIT_NAME_PHOTOSHOP_STYLES:DH,TOOLKIT_NAME_PHOTOSHOP_SHAPES:MH,TOOLKIT_NAME_PHOTOSHOP_SWATCHES_PR:xH,TOOLKIT_NAME_PHOTOSHOP_BRUSHES_PR:kH,TOOLKIT_NAME_PHOTOSHOP_GRADIENTS_PR:HH,TOOLKIT_NAME_PHOTOSHOP_PATTERNS_PR:jH,TOOLKIT_NAME_PHOTOSHOP_STYLES_PR:UH,TOOLKIT_NAME_PHOTOSHOP_SHAPES_PR:BH},VH=Object.freeze({__proto__:null,TOOLKIT_NAME_DEFAULT:PH,TOOLKIT_NAME_PHOTOSHOP:wH,TOOLKIT_NAME_PHOTOSHOP_SWATCHES:CH,TOOLKIT_NAME_PHOTOSHOP_BRUSHES:RH,TOOLKIT_NAME_PHOTOSHOP_GRADIENTS:LH,TOOLKIT_NAME_PHOTOSHOP_PATTERNS:NH,TOOLKIT_NAME_PHOTOSHOP_STYLES:DH,TOOLKIT_NAME_PHOTOSHOP_SHAPES:MH,TOOLKIT_NAME_PHOTOSHOP_SWATCHES_PR:xH,TOOLKIT_NAME_PHOTOSHOP_BRUSHES_PR:kH,TOOLKIT_NAME_PHOTOSHOP_GRADIENTS_PR:HH,TOOLKIT_NAME_PHOTOSHOP_PATTERNS_PR:jH,TOOLKIT_NAME_PHOTOSHOP_STYLES_PR:UH,TOOLKIT_NAME_PHOTOSHOP_SHAPES_PR:BH,default:FH}),KH="Photoshop Library",GH="Photoshop 견본",$H="Photoshop 브러시",WH="Photoshop 그래디언트",zH="Photoshop 패턴",qH="Photoshop 스타일",YH="Photoshop 모양",QH="Ps 사전 릴리스 견본",JH="Ps 사전 릴리스 브러시",XH="Ps 사전 릴리스 그래디언트",ZH="Ps 사전 릴리스 패턴",ej="Ps 사전 릴리스 스타일",tj="Ps 사전 릴리스 모양",ij={TOOLKIT_NAME_DEFAULT:"툴킷",TOOLKIT_NAME_PHOTOSHOP:KH,TOOLKIT_NAME_PHOTOSHOP_SWATCHES:GH,TOOLKIT_NAME_PHOTOSHOP_BRUSHES:$H,TOOLKIT_NAME_PHOTOSHOP_GRADIENTS:WH,TOOLKIT_NAME_PHOTOSHOP_PATTERNS:zH,TOOLKIT_NAME_PHOTOSHOP_STYLES:qH,TOOLKIT_NAME_PHOTOSHOP_SHAPES:YH,TOOLKIT_NAME_PHOTOSHOP_SWATCHES_PR:QH,TOOLKIT_NAME_PHOTOSHOP_BRUSHES_PR:JH,TOOLKIT_NAME_PHOTOSHOP_GRADIENTS_PR:XH,TOOLKIT_NAME_PHOTOSHOP_PATTERNS_PR:ZH,TOOLKIT_NAME_PHOTOSHOP_STYLES_PR:ej,TOOLKIT_NAME_PHOTOSHOP_SHAPES_PR:tj},sj=Object.freeze({__proto__:null,TOOLKIT_NAME_DEFAULT:"툴킷",TOOLKIT_NAME_PHOTOSHOP:KH,TOOLKIT_NAME_PHOTOSHOP_SWATCHES:GH,TOOLKIT_NAME_PHOTOSHOP_BRUSHES:$H,TOOLKIT_NAME_PHOTOSHOP_GRADIENTS:WH,TOOLKIT_NAME_PHOTOSHOP_PATTERNS:zH,TOOLKIT_NAME_PHOTOSHOP_STYLES:qH,TOOLKIT_NAME_PHOTOSHOP_SHAPES:YH,TOOLKIT_NAME_PHOTOSHOP_SWATCHES_PR:QH,TOOLKIT_NAME_PHOTOSHOP_BRUSHES_PR:JH,TOOLKIT_NAME_PHOTOSHOP_GRADIENTS_PR:XH,TOOLKIT_NAME_PHOTOSHOP_PATTERNS_PR:ZH,TOOLKIT_NAME_PHOTOSHOP_STYLES_PR:ej,TOOLKIT_NAME_PHOTOSHOP_SHAPES_PR:tj,default:ij}),rj="Ditt verktøysett",nj="Ditt Photoshop-bibliotek",oj="Dine Photoshop-fargekart",aj="Dine Photoshop-pensler",cj="Dine Photoshop-graderinger",lj="Dine Photoshop-mønstre",dj="Dine Photoshop-stiler",uj="Dine Photoshop-former",hj="Dine forhåndsutgivelsesfargekart for Ps",pj="Dine forhåndsutgivelsespensler for Ps",_j="Dine forhåndsutgivelsesgraderinger for Ps",mj="Dine forhåndsutgivelsesmønstre for Ps",fj="Dine forhåndsutgivelsesstiler for Ps",gj="Dine forhåndsutgivelsesformer for Ps",yj={TOOLKIT_NAME_DEFAULT:rj,TOOLKIT_NAME_PHOTOSHOP:nj,TOOLKIT_NAME_PHOTOSHOP_SWATCHES:oj,TOOLKIT_NAME_PHOTOSHOP_BRUSHES:aj,TOOLKIT_NAME_PHOTOSHOP_GRADIENTS:cj,TOOLKIT_NAME_PHOTOSHOP_PATTERNS:lj,TOOLKIT_NAME_PHOTOSHOP_STYLES:dj,TOOLKIT_NAME_PHOTOSHOP_SHAPES:uj,TOOLKIT_NAME_PHOTOSHOP_SWATCHES_PR:hj,TOOLKIT_NAME_PHOTOSHOP_BRUSHES_PR:pj,TOOLKIT_NAME_PHOTOSHOP_GRADIENTS_PR:_j,TOOLKIT_NAME_PHOTOSHOP_PATTERNS_PR:mj,TOOLKIT_NAME_PHOTOSHOP_STYLES_PR:fj,TOOLKIT_NAME_PHOTOSHOP_SHAPES_PR:gj},vj=Object.freeze({__proto__:null,TOOLKIT_NAME_DEFAULT:rj,TOOLKIT_NAME_PHOTOSHOP:nj,TOOLKIT_NAME_PHOTOSHOP_SWATCHES:oj,TOOLKIT_NAME_PHOTOSHOP_BRUSHES:aj,TOOLKIT_NAME_PHOTOSHOP_GRADIENTS:cj,TOOLKIT_NAME_PHOTOSHOP_PATTERNS:lj,TOOLKIT_NAME_PHOTOSHOP_STYLES:dj,TOOLKIT_NAME_PHOTOSHOP_SHAPES:uj,TOOLKIT_NAME_PHOTOSHOP_SWATCHES_PR:hj,TOOLKIT_NAME_PHOTOSHOP_BRUSHES_PR:pj,TOOLKIT_NAME_PHOTOSHOP_GRADIENTS_PR:_j,TOOLKIT_NAME_PHOTOSHOP_PATTERNS_PR:mj,TOOLKIT_NAME_PHOTOSHOP_STYLES_PR:fj,TOOLKIT_NAME_PHOTOSHOP_SHAPES_PR:gj,default:yj}),Oj="Uw toolkit",bj="Uw Photoshop-bibliotheek",Ij="Uw Photoshop-stalen",Ej="Uw Photoshop-penselen",Tj="Uw Photoshop-verlopen",Sj="Uw Photoshop-patronen",Aj="Uw Photoshop-stijlen",Pj="Uw Photoshop-vormen",wj="Ps Prerelease-stalen",Cj="Ps Prerelease-penselen",Rj="Ps Prerelease-verlopen",Lj="Ps Prerelease-patronen",Nj="Ps Prerelease-stijlen",Dj="Ps Prerelease-vormen",Mj={TOOLKIT_NAME_DEFAULT:Oj,TOOLKIT_NAME_PHOTOSHOP:bj,TOOLKIT_NAME_PHOTOSHOP_SWATCHES:Ij,TOOLKIT_NAME_PHOTOSHOP_BRUSHES:Ej,TOOLKIT_NAME_PHOTOSHOP_GRADIENTS:Tj,TOOLKIT_NAME_PHOTOSHOP_PATTERNS:Sj,TOOLKIT_NAME_PHOTOSHOP_STYLES:Aj,TOOLKIT_NAME_PHOTOSHOP_SHAPES:Pj,TOOLKIT_NAME_PHOTOSHOP_SWATCHES_PR:wj,TOOLKIT_NAME_PHOTOSHOP_BRUSHES_PR:Cj,TOOLKIT_NAME_PHOTOSHOP_GRADIENTS_PR:Rj,TOOLKIT_NAME_PHOTOSHOP_PATTERNS_PR:Lj,TOOLKIT_NAME_PHOTOSHOP_STYLES_PR:Nj,TOOLKIT_NAME_PHOTOSHOP_SHAPES_PR:Dj},xj=Object.freeze({__proto__:null,TOOLKIT_NAME_DEFAULT:Oj,TOOLKIT_NAME_PHOTOSHOP:bj,TOOLKIT_NAME_PHOTOSHOP_SWATCHES:Ij,TOOLKIT_NAME_PHOTOSHOP_BRUSHES:Ej,TOOLKIT_NAME_PHOTOSHOP_GRADIENTS:Tj,TOOLKIT_NAME_PHOTOSHOP_PATTERNS:Sj,TOOLKIT_NAME_PHOTOSHOP_STYLES:Aj,TOOLKIT_NAME_PHOTOSHOP_SHAPES:Pj,TOOLKIT_NAME_PHOTOSHOP_SWATCHES_PR:wj,TOOLKIT_NAME_PHOTOSHOP_BRUSHES_PR:Cj,TOOLKIT_NAME_PHOTOSHOP_GRADIENTS_PR:Rj,TOOLKIT_NAME_PHOTOSHOP_PATTERNS_PR:Lj,TOOLKIT_NAME_PHOTOSHOP_STYLES_PR:Nj,TOOLKIT_NAME_PHOTOSHOP_SHAPES_PR:Dj,default:Mj}),kj="Twój zestaw narzędzi",Hj="Biblioteka programu Photoshop",jj="Próbki programu Photoshop",Uj="Pędzle programu Photoshop",Bj="Gradienty programu Photoshop",Fj="Wzory programu Photoshop",Vj="Style programu Photoshop",Kj="Kształty programu Photoshop",Gj="Próbki we wstępnym wydaniu Ps",$j="Pędzle we wstępnym wydaniu Ps",Wj="Gradienty we wstępnym wydaniu Ps",zj="Wzory we wstępnym wydaniu Ps",qj="Style we wstępnym wydaniu Ps",Yj="Kształty we wstępnym wydaniu Ps",Qj={TOOLKIT_NAME_DEFAULT:kj,TOOLKIT_NAME_PHOTOSHOP:Hj,TOOLKIT_NAME_PHOTOSHOP_SWATCHES:jj,TOOLKIT_NAME_PHOTOSHOP_BRUSHES:Uj,TOOLKIT_NAME_PHOTOSHOP_GRADIENTS:Bj,TOOLKIT_NAME_PHOTOSHOP_PATTERNS:Fj,TOOLKIT_NAME_PHOTOSHOP_STYLES:Vj,TOOLKIT_NAME_PHOTOSHOP_SHAPES:Kj,TOOLKIT_NAME_PHOTOSHOP_SWATCHES_PR:Gj,TOOLKIT_NAME_PHOTOSHOP_BRUSHES_PR:$j,TOOLKIT_NAME_PHOTOSHOP_GRADIENTS_PR:Wj,TOOLKIT_NAME_PHOTOSHOP_PATTERNS_PR:zj,TOOLKIT_NAME_PHOTOSHOP_STYLES_PR:qj,TOOLKIT_NAME_PHOTOSHOP_SHAPES_PR:Yj},Jj=Object.freeze({__proto__:null,TOOLKIT_NAME_DEFAULT:kj,TOOLKIT_NAME_PHOTOSHOP:Hj,TOOLKIT_NAME_PHOTOSHOP_SWATCHES:jj,TOOLKIT_NAME_PHOTOSHOP_BRUSHES:Uj,TOOLKIT_NAME_PHOTOSHOP_GRADIENTS:Bj,TOOLKIT_NAME_PHOTOSHOP_PATTERNS:Fj,TOOLKIT_NAME_PHOTOSHOP_STYLES:Vj,TOOLKIT_NAME_PHOTOSHOP_SHAPES:Kj,TOOLKIT_NAME_PHOTOSHOP_SWATCHES_PR:Gj,TOOLKIT_NAME_PHOTOSHOP_BRUSHES_PR:$j,TOOLKIT_NAME_PHOTOSHOP_GRADIENTS_PR:Wj,TOOLKIT_NAME_PHOTOSHOP_PATTERNS_PR:zj,TOOLKIT_NAME_PHOTOSHOP_STYLES_PR:qj,TOOLKIT_NAME_PHOTOSHOP_SHAPES_PR:Yj,default:Qj}),Xj="Seu kit de ferramentas",Zj="Sua biblioteca do Photoshop",eU="Suas amostras do Photoshop",tU="Seus pincéis do Photoshop",iU="Seus gradientes do Photoshop",sU="Seus padrões do Photoshop",rU="Seus estilos do Photoshop",nU="Suas formas do Photoshop",oU="Suas amostras de pré-lançamento do Ps",aU="Seus pincéis de pré-lançamento do Ps",cU="Seus gradientes de pré-lançamento do Ps",lU="Seus padrões de pré-lançamento do Ps",dU="Seus estilos de pré-lançamento do Ps",uU="Suas formas de pré-lançamento do Ps",hU={TOOLKIT_NAME_DEFAULT:Xj,TOOLKIT_NAME_PHOTOSHOP:Zj,TOOLKIT_NAME_PHOTOSHOP_SWATCHES:eU,TOOLKIT_NAME_PHOTOSHOP_BRUSHES:tU,TOOLKIT_NAME_PHOTOSHOP_GRADIENTS:iU,TOOLKIT_NAME_PHOTOSHOP_PATTERNS:sU,TOOLKIT_NAME_PHOTOSHOP_STYLES:rU,TOOLKIT_NAME_PHOTOSHOP_SHAPES:nU,TOOLKIT_NAME_PHOTOSHOP_SWATCHES_PR:oU,TOOLKIT_NAME_PHOTOSHOP_BRUSHES_PR:aU,TOOLKIT_NAME_PHOTOSHOP_GRADIENTS_PR:cU,TOOLKIT_NAME_PHOTOSHOP_PATTERNS_PR:lU,TOOLKIT_NAME_PHOTOSHOP_STYLES_PR:dU,TOOLKIT_NAME_PHOTOSHOP_SHAPES_PR:uU},pU=Object.freeze({__proto__:null,TOOLKIT_NAME_DEFAULT:Xj,TOOLKIT_NAME_PHOTOSHOP:Zj,TOOLKIT_NAME_PHOTOSHOP_SWATCHES:eU,TOOLKIT_NAME_PHOTOSHOP_BRUSHES:tU,TOOLKIT_NAME_PHOTOSHOP_GRADIENTS:iU,TOOLKIT_NAME_PHOTOSHOP_PATTERNS:sU,TOOLKIT_NAME_PHOTOSHOP_STYLES:rU,TOOLKIT_NAME_PHOTOSHOP_SHAPES:nU,TOOLKIT_NAME_PHOTOSHOP_SWATCHES_PR:oU,TOOLKIT_NAME_PHOTOSHOP_BRUSHES_PR:aU,TOOLKIT_NAME_PHOTOSHOP_GRADIENTS_PR:cU,TOOLKIT_NAME_PHOTOSHOP_PATTERNS_PR:lU,TOOLKIT_NAME_PHOTOSHOP_STYLES_PR:dU,TOOLKIT_NAME_PHOTOSHOP_SHAPES_PR:uU,default:hU}),_U="Инструменты",mU="Библиотека Photoshop",fU="Ваши образцы Photoshop",gU="Ваши кисти Photoshop",yU="Ваши градиенты Photoshop",vU="Ваши узоры Photoshop",OU="Ваши стили Photoshop",bU="Ваши фигуры Photoshop",IU="Ваши образцы предв. версии Ps",EU="Ваши кисти предв. версии Ps",TU="Ваши градиенты предв. версии Ps",SU="Ваши узоры предв. версии Ps",AU="Ваши стили предв. версии Ps",PU="Ваши фигуры предв. версии Ps",wU={TOOLKIT_NAME_DEFAULT:_U,TOOLKIT_NAME_PHOTOSHOP:mU,TOOLKIT_NAME_PHOTOSHOP_SWATCHES:fU,TOOLKIT_NAME_PHOTOSHOP_BRUSHES:gU,TOOLKIT_NAME_PHOTOSHOP_GRADIENTS:yU,TOOLKIT_NAME_PHOTOSHOP_PATTERNS:vU,TOOLKIT_NAME_PHOTOSHOP_STYLES:OU,TOOLKIT_NAME_PHOTOSHOP_SHAPES:bU,TOOLKIT_NAME_PHOTOSHOP_SWATCHES_PR:IU,TOOLKIT_NAME_PHOTOSHOP_BRUSHES_PR:EU,TOOLKIT_NAME_PHOTOSHOP_GRADIENTS_PR:TU,TOOLKIT_NAME_PHOTOSHOP_PATTERNS_PR:SU,TOOLKIT_NAME_PHOTOSHOP_STYLES_PR:AU,TOOLKIT_NAME_PHOTOSHOP_SHAPES_PR:PU},CU=Object.freeze({__proto__:null,TOOLKIT_NAME_DEFAULT:_U,TOOLKIT_NAME_PHOTOSHOP:mU,TOOLKIT_NAME_PHOTOSHOP_SWATCHES:fU,TOOLKIT_NAME_PHOTOSHOP_BRUSHES:gU,TOOLKIT_NAME_PHOTOSHOP_GRADIENTS:yU,TOOLKIT_NAME_PHOTOSHOP_PATTERNS:vU,TOOLKIT_NAME_PHOTOSHOP_STYLES:OU,TOOLKIT_NAME_PHOTOSHOP_SHAPES:bU,TOOLKIT_NAME_PHOTOSHOP_SWATCHES_PR:IU,TOOLKIT_NAME_PHOTOSHOP_BRUSHES_PR:EU,TOOLKIT_NAME_PHOTOSHOP_GRADIENTS_PR:TU,TOOLKIT_NAME_PHOTOSHOP_PATTERNS_PR:SU,TOOLKIT_NAME_PHOTOSHOP_STYLES_PR:AU,TOOLKIT_NAME_PHOTOSHOP_SHAPES_PR:PU,default:wU}),RU="Ditt Toolkit",LU="Ditt Photoshop-bibliotek",NU="Dina Photoshop-färgrutor",DU="Dina Photoshop-penslar",MU="Dina Photoshop-övertoningar",xU="Dina Photoshop-mönster",kU="Dina Photoshop-format",HU="Dina Photoshop-former",jU="Färgrutor i den tidiga Ps-versionen",UU="Penslar i den tidiga Ps-versionen",BU="Övertoningar i den tidiga Ps-versionen",FU="Mönster i den tidiga Ps-versionen",VU="Format i den tidiga Ps-versionen",KU="Former i den tidiga Ps-versionen",GU={TOOLKIT_NAME_DEFAULT:RU,TOOLKIT_NAME_PHOTOSHOP:LU,TOOLKIT_NAME_PHOTOSHOP_SWATCHES:NU,TOOLKIT_NAME_PHOTOSHOP_BRUSHES:DU,TOOLKIT_NAME_PHOTOSHOP_GRADIENTS:MU,TOOLKIT_NAME_PHOTOSHOP_PATTERNS:xU,TOOLKIT_NAME_PHOTOSHOP_STYLES:kU,TOOLKIT_NAME_PHOTOSHOP_SHAPES:HU,TOOLKIT_NAME_PHOTOSHOP_SWATCHES_PR:jU,TOOLKIT_NAME_PHOTOSHOP_BRUSHES_PR:UU,TOOLKIT_NAME_PHOTOSHOP_GRADIENTS_PR:BU,TOOLKIT_NAME_PHOTOSHOP_PATTERNS_PR:FU,TOOLKIT_NAME_PHOTOSHOP_STYLES_PR:VU,TOOLKIT_NAME_PHOTOSHOP_SHAPES_PR:KU},$U=Object.freeze({__proto__:null,TOOLKIT_NAME_DEFAULT:RU,TOOLKIT_NAME_PHOTOSHOP:LU,TOOLKIT_NAME_PHOTOSHOP_SWATCHES:NU,TOOLKIT_NAME_PHOTOSHOP_BRUSHES:DU,TOOLKIT_NAME_PHOTOSHOP_GRADIENTS:MU,TOOLKIT_NAME_PHOTOSHOP_PATTERNS:xU,TOOLKIT_NAME_PHOTOSHOP_STYLES:kU,TOOLKIT_NAME_PHOTOSHOP_SHAPES:HU,TOOLKIT_NAME_PHOTOSHOP_SWATCHES_PR:jU,TOOLKIT_NAME_PHOTOSHOP_BRUSHES_PR:UU,TOOLKIT_NAME_PHOTOSHOP_GRADIENTS_PR:BU,TOOLKIT_NAME_PHOTOSHOP_PATTERNS_PR:FU,TOOLKIT_NAME_PHOTOSHOP_STYLES_PR:VU,TOOLKIT_NAME_PHOTOSHOP_SHAPES_PR:KU,default:GU}),WU="Araç Setiniz",zU="Photoshop Kitaplığınız",qU="Photoshop Renk Örnekleriniz",YU="Photoshop Fırçalarınız",QU="Photoshop Degradeleriniz",JU="Photoshop Desenleriniz",XU="Photoshop Stilleriniz",ZU="Photoshop Şekilleriniz",eB="Ps Ön Sürüm Renk Örnekleriniz",tB="Ps Ön Sürüm Fırçalarınız",iB="Ps Ön Sürüm Degradeleriniz",sB="Ps Ön Sürüm Desenleriniz",rB="Ps Ön Sürüm Stilleriniz",nB="Ps Ön Sürüm Şekilleriniz",oB={TOOLKIT_NAME_DEFAULT:WU,TOOLKIT_NAME_PHOTOSHOP:zU,TOOLKIT_NAME_PHOTOSHOP_SWATCHES:qU,TOOLKIT_NAME_PHOTOSHOP_BRUSHES:YU,TOOLKIT_NAME_PHOTOSHOP_GRADIENTS:QU,TOOLKIT_NAME_PHOTOSHOP_PATTERNS:JU,TOOLKIT_NAME_PHOTOSHOP_STYLES:XU,TOOLKIT_NAME_PHOTOSHOP_SHAPES:ZU,TOOLKIT_NAME_PHOTOSHOP_SWATCHES_PR:eB,TOOLKIT_NAME_PHOTOSHOP_BRUSHES_PR:tB,TOOLKIT_NAME_PHOTOSHOP_GRADIENTS_PR:iB,TOOLKIT_NAME_PHOTOSHOP_PATTERNS_PR:sB,TOOLKIT_NAME_PHOTOSHOP_STYLES_PR:rB,TOOLKIT_NAME_PHOTOSHOP_SHAPES_PR:nB},aB=Object.freeze({__proto__:null,TOOLKIT_NAME_DEFAULT:WU,TOOLKIT_NAME_PHOTOSHOP:zU,TOOLKIT_NAME_PHOTOSHOP_SWATCHES:qU,TOOLKIT_NAME_PHOTOSHOP_BRUSHES:YU,TOOLKIT_NAME_PHOTOSHOP_GRADIENTS:QU,TOOLKIT_NAME_PHOTOSHOP_PATTERNS:JU,TOOLKIT_NAME_PHOTOSHOP_STYLES:XU,TOOLKIT_NAME_PHOTOSHOP_SHAPES:ZU,TOOLKIT_NAME_PHOTOSHOP_SWATCHES_PR:eB,TOOLKIT_NAME_PHOTOSHOP_BRUSHES_PR:tB,TOOLKIT_NAME_PHOTOSHOP_GRADIENTS_PR:iB,TOOLKIT_NAME_PHOTOSHOP_PATTERNS_PR:sB,TOOLKIT_NAME_PHOTOSHOP_STYLES_PR:rB,TOOLKIT_NAME_PHOTOSHOP_SHAPES_PR:nB,default:oB}),cB="Мій інструментарій",lB="Моя бібліотека Photoshop",dB="Ваші зразки робіт, створені за допомогою Photoshop",uB="Ваші пензлі Photoshop",hB="Ваші градієнти Photoshop",pB="Ваші візерунки Photoshop",_B="Ваші стилі Photoshop",mB="Ваші фігури Photoshop",fB="Ваші зразки Ps, доступні напередодні випуску",gB="Ваші пензлі Ps, доступні напередодні випуску",yB="Ваші градієнти Ps, доступні напередодні випуску",vB="Ваші візерунки Ps, доступні напередодні випуску",OB="Ваші стилі Ps, доступні напередодні випуску",bB="Ваші фігури Ps, доступні напередодні випуску",IB={TOOLKIT_NAME_DEFAULT:cB,TOOLKIT_NAME_PHOTOSHOP:lB,TOOLKIT_NAME_PHOTOSHOP_SWATCHES:dB,TOOLKIT_NAME_PHOTOSHOP_BRUSHES:uB,TOOLKIT_NAME_PHOTOSHOP_GRADIENTS:hB,TOOLKIT_NAME_PHOTOSHOP_PATTERNS:pB,TOOLKIT_NAME_PHOTOSHOP_STYLES:_B,TOOLKIT_NAME_PHOTOSHOP_SHAPES:mB,TOOLKIT_NAME_PHOTOSHOP_SWATCHES_PR:fB,TOOLKIT_NAME_PHOTOSHOP_BRUSHES_PR:gB,TOOLKIT_NAME_PHOTOSHOP_GRADIENTS_PR:yB,TOOLKIT_NAME_PHOTOSHOP_PATTERNS_PR:vB,TOOLKIT_NAME_PHOTOSHOP_STYLES_PR:OB,TOOLKIT_NAME_PHOTOSHOP_SHAPES_PR:bB},EB=Object.freeze({__proto__:null,TOOLKIT_NAME_DEFAULT:cB,TOOLKIT_NAME_PHOTOSHOP:lB,TOOLKIT_NAME_PHOTOSHOP_SWATCHES:dB,TOOLKIT_NAME_PHOTOSHOP_BRUSHES:uB,TOOLKIT_NAME_PHOTOSHOP_GRADIENTS:hB,TOOLKIT_NAME_PHOTOSHOP_PATTERNS:pB,TOOLKIT_NAME_PHOTOSHOP_STYLES:_B,TOOLKIT_NAME_PHOTOSHOP_SHAPES:mB,TOOLKIT_NAME_PHOTOSHOP_SWATCHES_PR:fB,TOOLKIT_NAME_PHOTOSHOP_BRUSHES_PR:gB,TOOLKIT_NAME_PHOTOSHOP_GRADIENTS_PR:yB,TOOLKIT_NAME_PHOTOSHOP_PATTERNS_PR:vB,TOOLKIT_NAME_PHOTOSHOP_STYLES_PR:OB,TOOLKIT_NAME_PHOTOSHOP_SHAPES_PR:bB,default:IB}),TB="您的工具箱",SB="您的 Photoshop 库",AB="您的 Photoshop 色板",PB="您的 Photoshop 画笔",wB="您的 Photoshop 渐变",CB="您的 Photoshop 图案",RB="您的 Photoshop 样式",LB="您的 Photoshop 形状",NB="您的 PS Prerelease 色板",DB="您的 PS Prerelease 画笔",MB="您的 PS Prerelease 渐变",xB="您的 PS Prerelease 图案",kB="您的 PS Prerelease 样式",HB="您的 PS Prerelease 形状",jB={TOOLKIT_NAME_DEFAULT:TB,TOOLKIT_NAME_PHOTOSHOP:SB,TOOLKIT_NAME_PHOTOSHOP_SWATCHES:AB,TOOLKIT_NAME_PHOTOSHOP_BRUSHES:PB,TOOLKIT_NAME_PHOTOSHOP_GRADIENTS:wB,TOOLKIT_NAME_PHOTOSHOP_PATTERNS:CB,TOOLKIT_NAME_PHOTOSHOP_STYLES:RB,TOOLKIT_NAME_PHOTOSHOP_SHAPES:LB,TOOLKIT_NAME_PHOTOSHOP_SWATCHES_PR:NB,TOOLKIT_NAME_PHOTOSHOP_BRUSHES_PR:DB,TOOLKIT_NAME_PHOTOSHOP_GRADIENTS_PR:MB,TOOLKIT_NAME_PHOTOSHOP_PATTERNS_PR:xB,TOOLKIT_NAME_PHOTOSHOP_STYLES_PR:kB,TOOLKIT_NAME_PHOTOSHOP_SHAPES_PR:HB},UB=Object.freeze({__proto__:null,TOOLKIT_NAME_DEFAULT:TB,TOOLKIT_NAME_PHOTOSHOP:SB,TOOLKIT_NAME_PHOTOSHOP_SWATCHES:AB,TOOLKIT_NAME_PHOTOSHOP_BRUSHES:PB,TOOLKIT_NAME_PHOTOSHOP_GRADIENTS:wB,TOOLKIT_NAME_PHOTOSHOP_PATTERNS:CB,TOOLKIT_NAME_PHOTOSHOP_STYLES:RB,TOOLKIT_NAME_PHOTOSHOP_SHAPES:LB,TOOLKIT_NAME_PHOTOSHOP_SWATCHES_PR:NB,TOOLKIT_NAME_PHOTOSHOP_BRUSHES_PR:DB,TOOLKIT_NAME_PHOTOSHOP_GRADIENTS_PR:MB,TOOLKIT_NAME_PHOTOSHOP_PATTERNS_PR:xB,TOOLKIT_NAME_PHOTOSHOP_STYLES_PR:kB,TOOLKIT_NAME_PHOTOSHOP_SHAPES_PR:HB,default:jB}),BB="您的工具組。",FB="您的 Photoshop 資料庫",VB="您的 Photoshop 色票",KB="您的 Photoshop 筆刷",GB="您的 Photoshop 漸層",$B="您的 Photoshop 圖樣圖樣",WB="您的 Photoshop 樣式",zB="您的 Photoshop 形狀",qB="您的 Ps 預先發佈色票",YB="您的 Ps 預先發佈筆刷",QB="您的 Ps 預先發佈漸層",JB="您的 Ps 預先發佈圖樣",XB="您的 Ps 預先發佈樣式",ZB="您的 Ps 預先發佈形狀",eF={TOOLKIT_NAME_DEFAULT:BB,TOOLKIT_NAME_PHOTOSHOP:FB,TOOLKIT_NAME_PHOTOSHOP_SWATCHES:VB,TOOLKIT_NAME_PHOTOSHOP_BRUSHES:KB,TOOLKIT_NAME_PHOTOSHOP_GRADIENTS:GB,TOOLKIT_NAME_PHOTOSHOP_PATTERNS:$B,TOOLKIT_NAME_PHOTOSHOP_STYLES:WB,TOOLKIT_NAME_PHOTOSHOP_SHAPES:zB,TOOLKIT_NAME_PHOTOSHOP_SWATCHES_PR:qB,TOOLKIT_NAME_PHOTOSHOP_BRUSHES_PR:YB,TOOLKIT_NAME_PHOTOSHOP_GRADIENTS_PR:QB,TOOLKIT_NAME_PHOTOSHOP_PATTERNS_PR:JB,TOOLKIT_NAME_PHOTOSHOP_STYLES_PR:XB,TOOLKIT_NAME_PHOTOSHOP_SHAPES_PR:ZB},tF=Object.freeze({__proto__:null,TOOLKIT_NAME_DEFAULT:BB,TOOLKIT_NAME_PHOTOSHOP:FB,TOOLKIT_NAME_PHOTOSHOP_SWATCHES:VB,TOOLKIT_NAME_PHOTOSHOP_BRUSHES:KB,TOOLKIT_NAME_PHOTOSHOP_GRADIENTS:GB,TOOLKIT_NAME_PHOTOSHOP_PATTERNS:$B,TOOLKIT_NAME_PHOTOSHOP_STYLES:WB,TOOLKIT_NAME_PHOTOSHOP_SHAPES:zB,TOOLKIT_NAME_PHOTOSHOP_SWATCHES_PR:qB,TOOLKIT_NAME_PHOTOSHOP_BRUSHES_PR:YB,TOOLKIT_NAME_PHOTOSHOP_GRADIENTS_PR:QB,TOOLKIT_NAME_PHOTOSHOP_PATTERNS_PR:JB,TOOLKIT_NAME_PHOTOSHOP_STYLES_PR:XB,TOOLKIT_NAME_PHOTOSHOP_SHAPES_PR:ZB,default:eF}),iF="Your Toolkit",sF="Your Photoshop Library",rF="Your Photoshop Swatches",nF="Your Photoshop Brushes",oF="Your Photoshop Gradients",aF="Your Photoshop Patterns",cF="Your Photoshop Styles",lF="Your Photoshop Shapes",dF="Your Ps Prerelease Swatches",uF="Your Ps Prerelease Brushes",hF="Your Ps Prerelease Gradients",pF="Your Ps Prerelease Patterns",_F="Your Ps Prerelease Styles",mF="Your Ps Prerelease Shapes",fF={TOOLKIT_NAME_DEFAULT:iF,TOOLKIT_NAME_PHOTOSHOP:sF,TOOLKIT_NAME_PHOTOSHOP_SWATCHES:rF,TOOLKIT_NAME_PHOTOSHOP_BRUSHES:nF,TOOLKIT_NAME_PHOTOSHOP_GRADIENTS:oF,TOOLKIT_NAME_PHOTOSHOP_PATTERNS:aF,TOOLKIT_NAME_PHOTOSHOP_STYLES:cF,TOOLKIT_NAME_PHOTOSHOP_SHAPES:lF,TOOLKIT_NAME_PHOTOSHOP_SWATCHES_PR:dF,TOOLKIT_NAME_PHOTOSHOP_BRUSHES_PR:uF,TOOLKIT_NAME_PHOTOSHOP_GRADIENTS_PR:hF,TOOLKIT_NAME_PHOTOSHOP_PATTERNS_PR:pF,TOOLKIT_NAME_PHOTOSHOP_STYLES_PR:_F,TOOLKIT_NAME_PHOTOSHOP_SHAPES_PR:mF},gF=Object.freeze({__proto__:null,TOOLKIT_NAME_DEFAULT:iF,TOOLKIT_NAME_PHOTOSHOP:sF,TOOLKIT_NAME_PHOTOSHOP_SWATCHES:rF,TOOLKIT_NAME_PHOTOSHOP_BRUSHES:nF,TOOLKIT_NAME_PHOTOSHOP_GRADIENTS:oF,TOOLKIT_NAME_PHOTOSHOP_PATTERNS:aF,TOOLKIT_NAME_PHOTOSHOP_STYLES:cF,TOOLKIT_NAME_PHOTOSHOP_SHAPES:lF,TOOLKIT_NAME_PHOTOSHOP_SWATCHES_PR:dF,TOOLKIT_NAME_PHOTOSHOP_BRUSHES_PR:uF,TOOLKIT_NAME_PHOTOSHOP_GRADIENTS_PR:hF,TOOLKIT_NAME_PHOTOSHOP_PATTERNS_PR:pF,TOOLKIT_NAME_PHOTOSHOP_STYLES_PR:_F,TOOLKIT_NAME_PHOTOSHOP_SHAPES_PR:mF,default:fF}),yF="[u] ćčŁįb_Your Toolkit",vF="[t] ćčŁįb_Your Photoshop Library",OF="[m] ćčŁįb_Your Photoshop Swatches",bF="[i] ćčŁįb_Your Photoshop Brushes",IF="[h] ćčŁįb_Your Photoshop Gradients",EF="[j] ćčŁįb_Your Photoshop Patterns",TF="[l] ćčŁįb_Your Photoshop Styles",SF="[k] ćčŁįb_Your Photoshop Shapes",AF="[qB] ćčŁįb_Your Ps Prerelease Swatches",PF="[p+] ćčŁįb_Your Ps Prerelease Brushes",wF="[p8] ćčŁįb_Your Ps Prerelease Gradients",CF="[p9] ćčŁįb_Your Ps Prerelease Patterns",RF="[qA] ćčŁįb_Your Ps Prerelease Styles",LF="[p/] ćčŁįb_Your Ps Prerelease Shapes",NF={TOOLKIT_NAME_DEFAULT:yF,TOOLKIT_NAME_PHOTOSHOP:vF,TOOLKIT_NAME_PHOTOSHOP_SWATCHES:OF,TOOLKIT_NAME_PHOTOSHOP_BRUSHES:bF,TOOLKIT_NAME_PHOTOSHOP_GRADIENTS:IF,TOOLKIT_NAME_PHOTOSHOP_PATTERNS:EF,TOOLKIT_NAME_PHOTOSHOP_STYLES:TF,TOOLKIT_NAME_PHOTOSHOP_SHAPES:SF,TOOLKIT_NAME_PHOTOSHOP_SWATCHES_PR:AF,TOOLKIT_NAME_PHOTOSHOP_BRUSHES_PR:PF,TOOLKIT_NAME_PHOTOSHOP_GRADIENTS_PR:wF,TOOLKIT_NAME_PHOTOSHOP_PATTERNS_PR:CF,TOOLKIT_NAME_PHOTOSHOP_STYLES_PR:RF,TOOLKIT_NAME_PHOTOSHOP_SHAPES_PR:LF},DF=Object.freeze({__proto__:null,TOOLKIT_NAME_DEFAULT:yF,TOOLKIT_NAME_PHOTOSHOP:vF,TOOLKIT_NAME_PHOTOSHOP_SWATCHES:OF,TOOLKIT_NAME_PHOTOSHOP_BRUSHES:bF,TOOLKIT_NAME_PHOTOSHOP_GRADIENTS:IF,TOOLKIT_NAME_PHOTOSHOP_PATTERNS:EF,TOOLKIT_NAME_PHOTOSHOP_STYLES:TF,TOOLKIT_NAME_PHOTOSHOP_SHAPES:SF,TOOLKIT_NAME_PHOTOSHOP_SWATCHES_PR:AF,TOOLKIT_NAME_PHOTOSHOP_BRUSHES_PR:PF,TOOLKIT_NAME_PHOTOSHOP_GRADIENTS_PR:wF,TOOLKIT_NAME_PHOTOSHOP_PATTERNS_PR:CF,TOOLKIT_NAME_PHOTOSHOP_STYLES_PR:RF,TOOLKIT_NAME_PHOTOSHOP_SHAPES_PR:LF,default:NF})}}]);